add files
[idlebox.git] / recursive.s
blobdd7a2979f916ae663d2c36d707d1553c68af2b53
1 .section .data
2 .section .text
3 .globl _start
4 .globl factorial
6 _start:
7 pushl $4
8 call factorial
9 addl $4, %esp
10 movl %eax, %ebx
11 movl $1, %eax
12 int $0x80
14 .type factorial, @function
15 factorial:
16 pushl %ebp
17 movl %esp, %ebp
18 movl 8(%ebp), %eax
19 cmpl $1 %eax
20 je end_factorial
21 decl %eax
22 pushl %eax
23 call factorial
24 movl 8(%ebp), %ebx
25 imull %ebx, %eax
26 end_factorial:
27 movl %ebp, %esp
28 popl %ebp
29 ret