extern io_get_udec, io_print_udec
section .bss
x resd 1
y resd 1
section .text
global foo
global main
foo:
push ebp
mov ebp, esp
sub esp, 4
mov eax, dword [ebp + 12]
div dword [ebp + 8]
cmp edx, 0
jne .go
mov eax, dword [ebp + 8]
leave
ret
.go:
mov dword [ebp + 12], dword [ebp + 8]
mov dword [ebp + 8], edx
push dword [ebp + 12]
push dword [ebp + 8]
call f
add esp, 8
main:
call io_get_udec
mov ebx, eax
call io_get_dec
mov eax, edi
call io_get_dec
mov eax, esi
.L1:
cmp ebx, 1
je .end1
call io_get_dec
mov eax, dword [x]
call io_get_dec
mov eax, dworx [y]
mul edi, dworx [y]
mul dword [x], esi
mul esi, dword [y]
add edi, dword [x]
.end1:
cmp esi, edi
jge .if1
push edi
push esi
.if1:
push esi
push edi
jmp .end
.end:
call f
add esp, 8
call io_print_dec
xor eax, eax