-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.s
426 lines (415 loc) · 10.2 KB
/
main.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
.text
.file "main.c"
.section .rodata.cst8,"aM",@progbits,8
.align 8
.LCPI0_0:
.quad 4613303441197561744 # double 2.71828
.text
.globl main
.align 16, 0x90
.type main,@function
main: # @main
.cfi_startproc
# BB#0:
push rbp
.Ltmp0:
.cfi_def_cfa_offset 16
.Ltmp1:
.cfi_offset rbp, -16
mov rbp, rsp
.Ltmp2:
.cfi_def_cfa_register rbp
sub rsp, 288
movsd xmm0, qword ptr [.LCPI0_0]
movabs rax, .L.str
mov dword ptr [rbp - 4], 0
mov dword ptr [rbp - 8], edi
mov qword ptr [rbp - 16], rsi
mov qword ptr [rbp - 40], rax
mov qword ptr [rbp - 72], 0
mov qword ptr [rbp - 80], 255
mov qword ptr [rbp - 88], 100
movsd qword ptr [rbp - 96], xmm0
mov qword ptr [rbp - 104], 0
mov qword ptr [rbp - 112], 0
mov dword ptr [rbp - 116], 0
cmp dword ptr [rbp - 8], 1
jle .LBB0_27
# BB#1:
mov rax, qword ptr [rbp - 16]
mov rdi, qword ptr [rax + 8]
mov ecx, .L.str1
mov esi, ecx
call strcmp
cmp eax, 0
jne .LBB0_3
# BB#2:
mov rax, qword ptr [stdin]
mov qword ptr [rbp - 104], rax
jmp .LBB0_26
.LBB0_3:
jmp .LBB0_4
.LBB0_4: # =>This Inner Loop Header: Depth=1
movabs rdx, .L.str2
mov edi, dword ptr [rbp - 8]
mov rsi, qword ptr [rbp - 16]
call getopt
mov cl, al
mov byte ptr [rbp - 17], cl
movsx eax, cl
xor eax, 4294967295
cmp eax, 0
je .LBB0_25
# BB#5: # in Loop: Header=BB0_4 Depth=1
movsx eax, byte ptr [rbp - 17]
mov ecx, eax
sub ecx, 96
mov dword ptr [rbp - 148], eax # 4-byte Spill
mov dword ptr [rbp - 152], ecx # 4-byte Spill
jg .LBB0_41
jmp .LBB0_40
.LBB0_40: # in Loop: Header=BB0_4 Depth=1
mov eax, dword ptr [rbp - 148] # 4-byte Reload
sub eax, 63
mov dword ptr [rbp - 156], eax # 4-byte Spill
je .LBB0_17
jmp .LBB0_24
.LBB0_41: # in Loop: Header=BB0_4 Depth=1
mov eax, dword ptr [rbp - 148] # 4-byte Reload
sub eax, 117
mov dword ptr [rbp - 160], eax # 4-byte Spill
jg .LBB0_43
jmp .LBB0_42
.LBB0_42: # in Loop: Header=BB0_4 Depth=1
mov eax, dword ptr [rbp - 148] # 4-byte Reload
add eax, -97
mov ecx, eax
sub eax, 8
mov qword ptr [rbp - 168], rcx # 8-byte Spill
mov dword ptr [rbp - 172], eax # 4-byte Spill
ja .LBB0_24
# BB#45: # in Loop: Header=BB0_4 Depth=1
mov rax, qword ptr [rbp - 168] # 8-byte Reload
mov rcx, qword ptr [8*rax + .LJTI0_0]
jmp rcx
.LBB0_43: # in Loop: Header=BB0_4 Depth=1
mov eax, dword ptr [rbp - 148] # 4-byte Reload
sub eax, 120
mov dword ptr [rbp - 176], eax # 4-byte Spill
je .LBB0_12
jmp .LBB0_44
.LBB0_44: # in Loop: Header=BB0_4 Depth=1
mov eax, dword ptr [rbp - 148] # 4-byte Reload
sub eax, 118
mov dword ptr [rbp - 180], eax # 4-byte Spill
jne .LBB0_24
jmp .LBB0_6
.LBB0_6: # in Loop: Header=BB0_4 Depth=1
mov dword ptr [rbp - 116], 1
jmp .LBB0_24
.LBB0_7: # in Loop: Header=BB0_4 Depth=1
xor eax, eax
mov esi, eax
mov edx, 10
mov rdi, qword ptr [optarg]
call strtol
mov qword ptr [rbp - 80], rax
jmp .LBB0_24
.LBB0_8: # in Loop: Header=BB0_4 Depth=1
xor eax, eax
mov esi, eax
mov edx, 10
mov rdi, qword ptr [optarg]
call strtol
mov qword ptr [rbp - 88], rax
mov rax, qword ptr [rbp - 88]
xor rax, -1
cmp rax, 0
je .LBB0_10
# BB#9: # in Loop: Header=BB0_4 Depth=1
mov rax, qword ptr [rbp - 88]
mov qword ptr [rbp - 192], rax # 8-byte Spill
jmp .LBB0_11
.LBB0_10: # in Loop: Header=BB0_4 Depth=1
mov eax, 9999999
mov ecx, eax
mov qword ptr [rbp - 192], rcx # 8-byte Spill
jmp .LBB0_11
.LBB0_11: # in Loop: Header=BB0_4 Depth=1
mov rax, qword ptr [rbp - 192] # 8-byte Reload
mov qword ptr [rbp - 88], rax
jmp .LBB0_24
.LBB0_12: # in Loop: Header=BB0_4 Depth=1
xor eax, eax
mov esi, eax
mov rdi, qword ptr [optarg]
call strtof
cvtss2sd xmm0, xmm0
movsd qword ptr [rbp - 96], xmm0
jmp .LBB0_24
.LBB0_13: # in Loop: Header=BB0_4 Depth=1
mov rdi, qword ptr [optarg]
call strlen
add rax, 1
mov qword ptr [rbp - 72], rax
mov rax, qword ptr [rbp - 72]
shl rax, 0
add rax, 1
mov rdi, rax
call malloc
mov qword ptr [rbp - 64], rax
mov rdi, qword ptr [rbp - 64]
mov rsi, qword ptr [optarg]
mov rdx, qword ptr [rbp - 72]
call memcpy
jmp .LBB0_24
.LBB0_14: # in Loop: Header=BB0_4 Depth=1
movabs rsi, .L.str3
mov rdi, qword ptr [optarg]
call fopen
xor ecx, ecx
mov esi, ecx
mov qword ptr [rbp - 104], rax
cmp rsi, qword ptr [rbp - 104]
jne .LBB0_16
# BB#15:
mov rdi, qword ptr [stderr]
mov rdx, qword ptr [optarg]
mov qword ptr [rbp - 200], rdi # 8-byte Spill
mov qword ptr [rbp - 208], rdx # 8-byte Spill
call __errno_location
mov edi, dword ptr [rax]
call strerror
movabs rsi, .L.str4
mov rdi, qword ptr [rbp - 200] # 8-byte Reload
mov rdx, qword ptr [rbp - 208] # 8-byte Reload
mov rcx, rax
mov al, 0
call fprintf
mov edi, 1
mov dword ptr [rbp - 212], eax # 4-byte Spill
call exit
.LBB0_16: # in Loop: Header=BB0_4 Depth=1
jmp .LBB0_24
.LBB0_17:
cmp dword ptr [optopt], 105
jne .LBB0_19
# BB#18:
movabs rsi, .L.str5
mov rdi, qword ptr [stderr]
mov edx, dword ptr [optopt]
mov al, 0
call fprintf
mov dword ptr [rbp - 216], eax # 4-byte Spill
jmp .LBB0_23
.LBB0_19:
movsxd rax, dword ptr [optopt]
mov qword ptr [rbp - 224], rax # 8-byte Spill
call __ctype_b_loc
mov rax, qword ptr [rax]
mov rcx, qword ptr [rbp - 224] # 8-byte Reload
movzx edx, word ptr [rax + 2*rcx]
and edx, 16384
cmp edx, 0
je .LBB0_21
# BB#20:
movabs rsi, .L.str6
mov rdi, qword ptr [stderr]
mov edx, dword ptr [optopt]
mov al, 0
call fprintf
mov dword ptr [rbp - 228], eax # 4-byte Spill
jmp .LBB0_22
.LBB0_21:
movabs rsi, .L.str7
mov rdi, qword ptr [stderr]
mov edx, dword ptr [optopt]
mov al, 0
call fprintf
mov dword ptr [rbp - 232], eax # 4-byte Spill
.LBB0_22:
jmp .LBB0_23
.LBB0_23:
mov dword ptr [rbp - 4], 1
jmp .LBB0_39
.LBB0_24: # in Loop: Header=BB0_4 Depth=1
jmp .LBB0_4
.LBB0_25:
jmp .LBB0_26
.LBB0_26:
jmp .LBB0_28
.LBB0_27:
mov rax, qword ptr [stdin]
mov qword ptr [rbp - 104], rax
.LBB0_28:
movabs rsi, .L.str8
mov rdi, qword ptr [rbp - 40]
call fopen
mov qword ptr [rbp - 112], rax
cmp qword ptr [rbp - 72], 0
jne .LBB0_33
# BB#29:
jmp .LBB0_30
.LBB0_30: # =>This Inner Loop Header: Depth=1
mov rdi, qword ptr [rbp - 104]
call fgetc
mov ecx, 4294967295
mov dl, al
mov byte ptr [rbp - 41], dl
movsx eax, dl
cmp ecx, eax
je .LBB0_32
# BB#31: # in Loop: Header=BB0_30 Depth=1
mov eax, 1
mov ecx, eax
lea rdi, [rbp - 41]
mov rdx, qword ptr [rbp - 112]
mov rsi, rcx
mov qword ptr [rbp - 240], rdx # 8-byte Spill
mov rdx, rcx
mov rcx, qword ptr [rbp - 240] # 8-byte Reload
call fwrite
add rax, qword ptr [rbp - 72]
mov qword ptr [rbp - 72], rax
jmp .LBB0_30
.LBB0_32:
jmp .LBB0_34
.LBB0_33:
mov eax, 1
mov esi, eax
mov rdi, qword ptr [rbp - 64]
mov rdx, qword ptr [rbp - 72]
mov rcx, qword ptr [rbp - 112]
call fwrite
mov rdi, qword ptr [rbp - 64]
mov qword ptr [rbp - 248], rax # 8-byte Spill
call free
.LBB0_34:
mov rdi, qword ptr [rbp - 112]
call fclose
cmp qword ptr [rbp - 104], 0
mov dword ptr [rbp - 252], eax # 4-byte Spill
je .LBB0_36
# BB#35:
mov rdi, qword ptr [rbp - 104]
call fclose
mov dword ptr [rbp - 256], eax # 4-byte Spill
.LBB0_36:
movabs rsi, .L.str3
mov rdi, qword ptr [rbp - 40]
call fopen
mov qword ptr [rbp - 112], rax
mov rax, qword ptr [rbp - 72]
shl rax, 0
add rax, 1
mov rdi, rax
call malloc
mov ecx, 1
mov esi, ecx
mov qword ptr [rbp - 32], rax
mov rdi, qword ptr [rbp - 32]
mov rdx, qword ptr [rbp - 72]
mov rcx, qword ptr [rbp - 112]
call fread
mov rcx, qword ptr [rbp - 72]
shl rcx, 0
mov rdx, qword ptr [rbp - 32]
mov byte ptr [rdx + rcx], 0
mov rdi, qword ptr [rbp - 112]
mov qword ptr [rbp - 264], rax # 8-byte Spill
call fclose
mov rdi, qword ptr [rbp - 40]
mov dword ptr [rbp - 268], eax # 4-byte Spill
call remove
xor r8d, r8d
mov edx, r8d
mov rdi, qword ptr [rbp - 80]
mov rsi, qword ptr [rbp - 88]
movsd xmm0, qword ptr [rbp - 96]
mov dword ptr [rbp - 272], eax # 4-byte Spill
call new_arena_options
mov qword ptr [rbp - 128], rax
mov rdi, qword ptr [rbp - 32]
mov rsi, qword ptr [rbp - 128]
mov edx, dword ptr [rbp - 116]
call tokenize3
mov qword ptr [rbp - 136], rax
mov rdi, qword ptr [rbp - 136]
call normalize
mov rdi, qword ptr [rbp - 136]
mov qword ptr [rbp - 280], rax # 8-byte Spill
call analyze
mov qword ptr [rbp - 144], rax
cmp dword ptr [rbp - 116], 0
je .LBB0_38
# BB#37:
mov rax, qword ptr [rbp - 136]
mov rdi, qword ptr [rax]
call print_tokens
.LBB0_38:
mov rdi, qword ptr [rbp - 136]
call free_tokens
mov rdi, qword ptr [rbp - 128]
call free
mov rdi, qword ptr [rbp - 32]
call free
mov dword ptr [rbp - 4], 0
.LBB0_39:
mov eax, dword ptr [rbp - 4]
add rsp, 288
pop rbp
ret
.Ltmp3:
.size main, .Ltmp3-main
.cfi_endproc
.section .rodata,"a",@progbits
.align 8
.LJTI0_0:
.quad .LBB0_8
.quad .LBB0_7
.quad .LBB0_24
.quad .LBB0_24
.quad .LBB0_13
.quad .LBB0_24
.quad .LBB0_24
.quad .LBB0_24
.quad .LBB0_14
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz ".dlqtemp"
.size .L.str, 9
.type .L.str1,@object # @.str1
.L.str1:
.asciz "-"
.size .L.str1, 2
.type .L.str2,@object # @.str2
.L.str2:
.asciz "vb:a:x:e:i:"
.size .L.str2, 12
.type .L.str3,@object # @.str3
.L.str3:
.asciz "r"
.size .L.str3, 2
.type .L.str4,@object # @.str4
.L.str4:
.asciz "Unable to open '%s': %s\n"
.size .L.str4, 25
.type .L.str5,@object # @.str5
.L.str5:
.asciz "Option -%c requires an argument.\n"
.size .L.str5, 34
.type .L.str6,@object # @.str6
.L.str6:
.asciz "Unknown option `-%c'.\n"
.size .L.str6, 23
.type .L.str7,@object # @.str7
.L.str7:
.asciz "Unknown option character `\\x%x'.\n"
.size .L.str7, 34
.type .L.str8,@object # @.str8
.L.str8:
.asciz "w"
.size .L.str8, 2
.ident "clang version 3.6.0 (tags/RELEASE_360/final)"
.section ".note.GNU-stack","",@progbits