-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmp.s
154 lines (154 loc) · 2.12 KB
/
tmp.s
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
.intel_syntax noprefix
.global main
fibbonacci:
push rbp
mov rbp, rsp
sub rsp, 208
mov rax, rbp
mov rax, rbp
sub rax, 8
mov [rax], rdi
mov rax, rbp
sub rax, 8
push rax
pop rax
mov rax, [rax]
push rax
push 0
pop rdi
pop rax
cmp rax, rdi
sete al
movzb rax, al
push rax
pop rax
cmp rax, 0
je .Lelse1
push 0
pop rax
mov rsp, rbp
pop rbp
ret
pop rax
jmp .Lend1
.Lelse1:
mov rax, rbp
sub rax, 8
push rax
pop rax
mov rax, [rax]
push rax
push 1
pop rdi
pop rax
cmp rax, rdi
sete al
movzb rax, al
push rax
pop rax
cmp rax, 0
je .Lelse2
push 1
pop rax
mov rsp, rbp
pop rbp
ret
pop rax
jmp .Lend2
.Lelse2:
mov rax, rbp
sub rax, 8
push rax
pop rax
mov rax, [rax]
push rax
push 1
pop rdi
pop rax
sub rax, rdi
push rax
pop rax
mov rdi, rax
mov rax, rsp
and rax, 15
jnz .L.call.3
mov rax, 0
call fibbonacci
jmp .L.end.3
.L.call.3:
sub rsp, 8
mov rax, 0
call fibbonacci
add rsp, 8
.L.end.3:
push rax
mov rax, rbp
sub rax, 8
push rax
pop rax
mov rax, [rax]
push rax
push 2
pop rdi
pop rax
sub rax, rdi
push rax
pop rax
mov rdi, rax
mov rax, rsp
and rax, 15
jnz .L.call.4
mov rax, 0
call fibbonacci
jmp .L.end.4
.L.call.4:
sub rsp, 8
mov rax, 0
call fibbonacci
add rsp, 8
.L.end.4:
push rax
pop rdi
pop rax
add rax, rdi
push rax
pop rax
mov rsp, rbp
pop rbp
ret
pop rax
.Lend2:
.Lend1:
pop rax
mov rsp, rbp
pop rbp
ret
main:
push rbp
mov rbp, rsp
sub rsp, 208
mov rax, rbp
push 5
pop rax
mov rdi, rax
mov rax, rsp
and rax, 15
jnz .L.call.5
mov rax, 0
call fibbonacci
jmp .L.end.5
.L.call.5:
sub rsp, 8
mov rax, 0
call fibbonacci
add rsp, 8
.L.end.5:
push rax
pop rax
mov rsp, rbp
pop rbp
ret
pop rax
mov rsp, rbp
pop rbp
ret