Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #factoral and call a recursive function
- .section .data
- .section .text
- .globl _start
- .globl factorial
- _start:
- pushl $5
- call factorial
- addl $5, %esp
- movl %eax, %ebx
- movl $1, %eax
- int $0x80
- .type factorial,@function
- factorial:
- pushl %ebp
- movl %esp, %ebp
- movl 8(%ebp), %eax
- cmpl $1, %eax
- je end_factorial
- decl %eax
- pushl %eax
- call factorial
- movl 8(%ebp), %ebx
- imull %ebx, %eax
- end_factorial:
- movl %ebp, %esp
- popl %ebp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement