extern puts section .data text db "Number reaches 1",0 even db "even",0 odd db "odd",0 number dq 7 section .text global main main: sub rsp, 8 mov r8, [number] _loop: cmp r8, 1 ;if number is 1 then end je _printstupid test r8, 1 ;odd even check jnz _odd jz _even _odd: ; mov rdi, odd ; cld ; call puts mov rax, r8 ; gotta do this because mul only takes one argument mov r9, 3 mul r9 add rax, 1 mov r8, rax jmp _loop _even: ; mov rdi, even ; cld ; call puts xor rdx, rdx mov rax, r8 mov rcx, 2 div rcx mov r8, rax jmp _loop _printstupid: mov rdi, text cld call puts ;this is the put s way of printing a string _end: add rsp, 8 ret