section .data
fmt db "%d ", 0
section .bss
x resd 1
section .text
extern printf
extern scanf
global main
main:
enter 12, 0
mov dword [ebp-4], 0x80000000
mov dword [ebp-8], 0x80000000
mov dword [ebp-12], 0x80000000
push x
push fmt
call scanf
add esp, 8
mov esi, [x]
.loop:
test esi, esi
jz .done
dec esi
push x
push fmt
call scanf
add esp, 8
mov eax, [x]
.first:
cmp eax, [ebp-4]
jle .second
mov ebx, [ebp-4]
mov [ebp-4], eax
mov eax, ebx
.second:
cmp eax, [ebp-8]
jle .third
mov ebx, [ebp-8]
mov [ebp-8], eax
mov eax, ebx
.third:
cmp eax, [ebp-12]
jle .loop
mov ebx, [ebp-12]
mov [ebp-12], eax
mov eax, ebx
jmp .loop
.done:
push dword [ebp-4]
push fmt
call printf
add esp, 8
push dword [ebp-8]
push fmt
call printf
add esp, 8
push dword [ebp-12]
push fmt
call printf
add esp, 8
leave
ret