1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
DEFAULT REL
section .data
a dd 0
b dd 0
section .text
global _recur
_recur:
mov eax, DWORD[esp + 4*1]
mov DWORD[a],eax
mov eax, DWORD[esp + 4*2]
mov DWORD[b],eax
push ebp
mov ebp, esp
mov eax, DWORD[a]
push eax
mov eax, 0
pop ecx
cmp ecx,eax
jne LAB27
mov eax, 1
push eax
mov eax, DWORD[b]
add eax, DWORD[esp]
add esp, 4
mov esp, ebp
pop ebp
ret
jmp LAB23
LAB27:
LAB23:
mov eax, DWORD[a]
push eax
mov eax, DWORD[a]
push eax
mov eax, 1
sub eax, DWORD[esp]
neg eax
add esp, 4
push eax
mov eax, DWORD[b]
pop ecx
push eax
push ecx
call _recur
add eax, DWORD[esp]
add esp, 4
mov esp, ebp
pop ebp
ret
ret
global _foo
_foo:
push ebp
mov ebp, esp
mov eax, 2
push eax
mov eax, 2
pop ecx
push eax
push ecx
call _recur
mov esp, ebp
pop ebp
ret
ret
|