.global main main: mov $scanf_format, %rdi push %rax mov %rsp, %rsi xor %rax, %rax call scanf pop %r8 # This is the input mov %r8, %r9 # This is the accumulator looptop: dec %r8 imul %r8, %r9 cmp $2, %r8 jg looptop # printing part mov $format,%rdi mov %r9, %rsi xor %rax, %rax call printf ret format: .asciz "%lu\n" scanf_format: .asciz "%ld"