section .text
global main
extern io_get_dec, io_print_dec, io_print_char
main:
push 1
call process
add esp, 4
mov eax, 10
call io_print_char
ret
process:
push ebp
mov ebp, esp
sub esp, 4
call io_get_dec
mov [ebp-4], eax
cmp eax, 0
je .return
mov eax, [ebp+8]
test eax, 1
jnz .odd
push dword [ebp+8]
inc dword [esp]
call process
add esp, 4
mov eax, [ebp-4]
call io_print_dec
mov eax, ' '
call io_print_char
jmp .return
.odd:
mov eax, [ebp-4]
call io_print_dec
mov eax, ' '
call io_print_char
push dword [ebp+8]
inc dword [esp]
call process
add esp, 4
.return:
mov esp, ebp
pop ebp
ret