Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .686
- include libc.inc
- .model flat
- public _sort_gen_asm
- public _print_array
- data segment "data"
- format db "%d", 10,13,0
- data ends
- text segment "code"
- _sort_gen_asm_arg1 = 8
- _sort_gen_asm_arg2 = 12
- _print_array_arg1 = 8
- _print_array_arg2 = 12
- _sort_gen_asm PROC
- push ebp
- mov ebp, esp
- push esi
- push edi
- mov edi, DWORD PTR _sort_gen_asm_arg1[ebp]
- xor esi, esi
- cmp DWORD PTR [edi], esi
- jbe SHORT LN4
- push ebx
- mov ebx, DWORD PTR _sort_gen_asm_arg2[ebp]
- LL5:
- test esi, esi
- je SHORT LN2
- mov eax, DWORD PTR [edi+4]
- lea eax, DWORD PTR [eax+esi*4]
- push eax
- add eax, -4
- push eax
- call ebx
- add esp, 8
- cmp eax, -1
- je SHORT LN2
- mov eax, DWORD PTR [edi+4]
- lea eax, DWORD PTR [eax+esi*4]
- push eax
- add eax, -4
- push eax
- call ebx
- add esp, 8
- test eax, eax
- je SHORT LN2
- mov eax, DWORD PTR [edi+4]
- mov edx, DWORD PTR [eax+esi*4]
- lea ecx, DWORD PTR [eax+esi*4]
- mov eax, DWORD PTR [ecx-4]
- mov DWORD PTR [ecx], eax
- mov eax, DWORD PTR [edi+4]
- mov DWORD PTR [eax+esi*4-4], edx
- dec esi
- jmp SHORT LN1
- LN2:
- inc esi
- LN1:
- cmp esi, DWORD PTR [edi]
- jb SHORT LL5
- pop ebx
- LN4:
- pop edi
- pop esi
- pop ebp
- ret 0
- _sort_gen_asm ENDP
- _print_array PROC
- push ebp
- mov ebp, esp
- mov ebx, _print_array_arg1[ebp]
- mov ecx, _print_array_arg2[ebp]
- test ecx, ecx
- je exit
- mov edx, 0
- loopchik:
- push edx
- push ecx
- push [ebx+edx]
- push offset format
- call _printf
- add esp, 8
- pop ecx
- pop edx
- add edx, 4
- loop loopchik
- exit:
- mov esp, ebp
- pop ebp
- ret
- _print_array ENDP
- text ends
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement