forked from markfloryan/pdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_fib.s
189 lines (189 loc) · 3.53 KB
/
test_fib.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
.file "test_fib.cpp"
.intel_syntax noprefix
.local _ZStL8__ioinit
.comm _ZStL8__ioinit,1,1
.text
.globl fib
.type fib, @function
fib:
.LFB1021:
.cfi_startproc
push ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
mov ebp, esp
.cfi_def_cfa_register 5
push ebx
sub esp, 4
.cfi_offset 3, -12
cmp DWORD PTR [ebp+8], 0
je .L2
cmp DWORD PTR [ebp+8], 1
jne .L3
.L2:
mov eax, 1
jmp .L4
.L3:
mov eax, DWORD PTR [ebp+8]
sub eax, 1
sub esp, 12
push eax
call fib
add esp, 16
mov ebx, eax
mov eax, DWORD PTR [ebp+8]
sub eax, 2
sub esp, 12
push eax
call fib
add esp, 16
add eax, ebx
.L4:
mov ebx, DWORD PTR [ebp-4]
leave
.cfi_restore 5
.cfi_restore 3
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE1021:
.size fib, .-fib
.section .rodata
.LC0:
.string "Enter value for fib(): "
.LC1:
.string "The result is: "
.text
.globl main
.type main, @function
main:
.LFB1022:
.cfi_startproc
lea ecx, [esp+4]
.cfi_def_cfa 1, 0
and esp, -16
push DWORD PTR [ecx-4]
push ebp
.cfi_escape 0x10,0x5,0x2,0x75,0
mov ebp, esp
push ecx
.cfi_escape 0xf,0x3,0x75,0x7c,0x6
sub esp, 20
mov eax, DWORD PTR gs:20
mov DWORD PTR [ebp-12], eax
xor eax, eax
mov DWORD PTR [ebp-20], 0
sub esp, 8
push OFFSET FLAT:.LC0
push OFFSET FLAT:_ZSt4cout
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
add esp, 16
sub esp, 8
push OFFSET FLAT:_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
push eax
call _ZNSolsEPFRSoS_E
add esp, 16
sub esp, 8
lea eax, [ebp-20]
push eax
push OFFSET FLAT:_ZSt3cin
call _ZNSirsERi
add esp, 16
mov eax, DWORD PTR [ebp-20]
sub esp, 12
push eax
call fib
add esp, 16
mov DWORD PTR [ebp-16], eax
sub esp, 8
push OFFSET FLAT:.LC1
push OFFSET FLAT:_ZSt4cout
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
add esp, 16
sub esp, 8
push DWORD PTR [ebp-16]
push eax
call _ZNSolsEi
add esp, 16
sub esp, 8
push OFFSET FLAT:_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
push eax
call _ZNSolsEPFRSoS_E
add esp, 16
mov eax, 0
mov edx, DWORD PTR [ebp-12]
xor edx, DWORD PTR gs:20
je .L7
call __stack_chk_fail
.L7:
mov ecx, DWORD PTR [ebp-4]
.cfi_def_cfa 1, 0
leave
.cfi_restore 5
lea esp, [ecx-4]
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE1022:
.size main, .-main
.type _Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
.LFB1031:
.cfi_startproc
push ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
mov ebp, esp
.cfi_def_cfa_register 5
sub esp, 8
cmp DWORD PTR [ebp+8], 1
jne .L10
cmp DWORD PTR [ebp+12], 65535
jne .L10
sub esp, 12
push OFFSET FLAT:_ZStL8__ioinit
call _ZNSt8ios_base4InitC1Ev
add esp, 16
sub esp, 4
push OFFSET FLAT:__dso_handle
push OFFSET FLAT:_ZStL8__ioinit
push OFFSET FLAT:_ZNSt8ios_base4InitD1Ev
call __cxa_atexit
add esp, 16
.L10:
nop
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE1031:
.size _Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii
.type _GLOBAL__sub_I_fib, @function
_GLOBAL__sub_I_fib:
.LFB1032:
.cfi_startproc
push ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
mov ebp, esp
.cfi_def_cfa_register 5
sub esp, 8
sub esp, 8
push 65535
push 1
call _Z41__static_initialization_and_destruction_0ii
add esp, 16
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE1032:
.size _GLOBAL__sub_I_fib, .-_GLOBAL__sub_I_fib
.section .init_array,"aw"
.align 4
.long _GLOBAL__sub_I_fib
.hidden __dso_handle
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609"
.section .note.GNU-stack,"",@progbits