Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .section .data
- .section .text
- .globl _start
- .globl factorial
- _start:
- push $4
- call factorial
- add $4, %rsp
- mov %rax, %rbx
- mov $1, %rax
- int $0x80
- .type factorial, @function
- factorial:
- push %rbp
- mov %rsp, %rbp
- mov $1, %rax
- mov 8(%rbp), %rcx
- start_loop:
- cmp $1, %rcx
- je loop_exit
- imul %rcx, %rax
- dec %rcx
- jmp start_loop
- loop_exit:
- mov %rbp, %rsp
- pop %rbp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement