-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_cpe.64sa
More file actions
437 lines (435 loc) · 7.09 KB
/
test_cpe.64sa
File metadata and controls
437 lines (435 loc) · 7.09 KB
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
427
428
429
430
431
432
433
434
435
436
437
.Ltext0:
usage:
subq $8, %rsp
movq %rdi, %rdx
movl $.LC0, %esi
movl $1, %edi
movl $0, %eax
call __printf_chk
movl $.LC1, %edi
call puts
movl $.LC2, %edi
call puts
movl $.LC3, %edi
call puts
movl $.LC4, %edi
call puts
movl $.LC5, %edi
call puts
movl $.LC6, %edi
call puts
movl $.LC7, %edi
call puts
movl $.LC8, %edi
call puts
movl $.LC9, %edi
call puts
movl $0, %edi
call exit
psum1:
movss (%rdi), %xmm0
movss %xmm0, (%rsi)
cmpq $1, %rdx
jle .L3
movl $1, %eax
/* $begin psum1-s 35 */
# Inner loop of psum1
# a in %rdi, i in %rax, cnt in %rdx
.L5: # \textbf{loop:}
vmovss -4(%rsi,%rax,4), %xmm0 # Get p[i-1]
vaddss (%rdi,%rax,4), %xmm0, %xmm0 # Add a[i]
vmovss %xmm0, (%rsi,%rax,4) # Store at p[i]
addq $1, %rax # Increment i
cmpq %rdx, %rax # Compare i:cnt
jne .L5 # If !=, goto \textbf{loop}
/* $end psum1-s 35 */
.L3:
rep; ret
tpsum1:
movq %rdi, %rdx
movq p(%rip), %rsi
movq a(%rip), %rdi
call psum1
rep; ret
psum2:
movss (%rdi), %xmm0
movss %xmm0, (%rsi)
leaq -1(%rdx), %rcx
cmpq $1, %rcx
jle .L12
movl $1, %eax
.L10:
movss -4(%rsi,%rax,4), %xmm0
addss (%rdi,%rax,4), %xmm0
movss %xmm0, (%rsi,%rax,4)
addss 4(%rdi,%rax,4), %xmm0
movss %xmm0, 4(%rsi,%rax,4)
addq $2, %rax
cmpq %rcx, %rax
jl .L10
leaq -3(%rdx), %rax
andq $-2, %rax
addq $3, %rax
jmp .L8
.L12:
movl $1, %eax
.L8:
cmpq %rax, %rdx
jle .L7
movss -4(%rsi,%rax,4), %xmm0
addss (%rdi,%rax,4), %xmm0
movss %xmm0, (%rsi,%rax,4)
.L7:
rep; ret
tpsum2:
movq %rdi, %rdx
movq p(%rip), %rsi
movq a(%rip), %rdi
call psum2
rep; ret
psum1a:
movss (%rdi), %xmm0
movss %xmm0, (%rsi)
cmpq $1, %rdx
jle .L14
movl $1, %eax
/* $begin psum1a-s 92 */
# Inner loop of psum1a
# a in %rdi, i in %rax, cnt in %rdx, last_val in %xmm0
.L16: # \textbf{loop:}
vaddss (%rdi,%rax,4), %xmm0, %xmm0 # last_val = val = last_val + a[i]
vmovss %xmm0, (%rsi,%rax,4) # Store val in p[i]
addq $1, %rax # Increment i
cmpq %rdx, %rax # Compare i:cnt
jne .L16 # If !=, goto \textbf{loop}
/* $end psum1a-s 92 */
.L14:
rep; ret
tpsum1a:
movq %rdi, %rdx
movq p(%rip), %rsi
movq a(%rip), %rdi
call psum1a
rep; ret
check:
pushq %r14
pushq %r13
pushq %r12
pushq %rbp
pushq %rbx
movq %rdi, %r14
movq %rsi, %rbp
testq %rsi, %rsi
jle .L19
movl $0, %ebx
movabsq $2361183241434822607, %r13
.L21:
movq a(%rip), %rax
leaq (%rax,%rbx,4), %r12
call random
movq %rax, %rcx
imulq %r13
sarq $7, %rdx
movq %rcx, %rax
sarq $63, %rax
subq %rax, %rdx
imulq $1000, %rdx, %rdx
subq %rdx, %rcx
cvtsi2ssq %rcx, %xmm0
movss %xmm0, (%r12)
addq $1, %rbx
cmpq %rbp, %rbx
jne .L21
jmp .L20
.L26:
movq b(%rip), %rax
leaq 0(,%rbx,4), %rcx
movss (%rax,%rbx,4), %xmm4
movq c(%rip), %rdx
movss (%rdx,%rbx,4), %xmm2
ucomiss %xmm2, %xmm4
jp .L27
je .L22
.L27:
movss -4(%rdx,%rcx), %xmm0
cvtps2pd %xmm0, %xmm0
unpcklps %xmm4, %xmm4
cvtps2pd %xmm4, %xmm4
movss -4(%rax,%rcx), %xmm3
cvtps2pd %xmm3, %xmm3
unpcklps %xmm2, %xmm2
cvtps2pd %xmm2, %xmm2
movq a(%rip), %rax
movss (%rax,%rcx), %xmm1
cvtps2pd %xmm1, %xmm1
movq %rbx, %rdx
movl $.LC10, %esi
movl $1, %edi
movl $5, %eax
call __printf_chk
addq $1, %r12
cmpq $10, %r12
jle .L22
movl $.LC11, %edi
call puts
movl $1, %edi
call exit
.L22:
addq $1, %rbx
cmpq %rbp, %rbx
jne .L26
jmp .L18
.L19:
movq b(%rip), %rax
movq %rax, p(%rip)
movq %rsi, %rdi
call tpsum1
movq c(%rip), %rax
movq %rax, p(%rip)
movq %rbp, %rdi
call *%r14
jmp .L18
.L20:
movq b(%rip), %rax
movq %rax, p(%rip)
movq %rbp, %rdi
call tpsum1
movq c(%rip), %rax
movq %rax, p(%rip)
movq %rbp, %rdi
call *%r14
movl $0, %r12d
movl $0, %ebx
jmp .L26
.L18:
popq %rbx
popq %rbp
popq %r12
popq %r13
popq %r14
ret
main:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbp
pushq %rbx
subq $40, %rsp
movl %edi, %r15d
cmpl $1, %edi
jle .L56
movq %rsi, %r14
movl $0, %r13d
movl $2, 28(%rsp)
movl $31415, %r12d
movl $1, 24(%rsp)
xorpd %xmm2, %xmm2
movsd %xmm2, (%rsp)
movl $8, 8(%rsp)
movl $1, %ebx
movl $1024, 20(%rsp)
movl $tpsum1, %ebp
.L49:
movslq %ebx, %rax
leaq 0(,%rax,8), %rdx
movq (%r14,%rax,8), %rax
cmpb $45, (%rax)
jne .L31
movzbl 1(%rax), %eax
subl $97, %eax
cmpb $20, %al
ja .L32
movzbl %al, %eax
jmp *.L33(,%rax,8)
.L33:
.L41:
movl $tpsum2, %ebp
jmp .L31
.L39:
movl $1, %r13d
jmp .L31
.L38:
movl $0, 28(%rsp)
jmp .L31
.L36:
addl $1, %ebx
cmpl %ebx, %r15d
jg .L42
movq (%r14), %rdi
call usage
.L42:
movq 8(%r14,%rdx), %rdi
movl $10, %edx
movl $0, %esi
call strtol
movl %eax, 20(%rsp)
subl $1, %eax
cmpl $262143, %eax
jbe .L31
movq (%r14), %rdi
call usage
.L37:
addl $1, %ebx
cmpl %ebx, %r15d
jg .L43
movq (%r14), %rdi
call usage
.L43:
movq 8(%r14,%rdx), %rdi
movl $10, %edx
movl $0, %esi
call strtol
movl %eax, 24(%rsp)
testl %eax, %eax
jns .L31
movq (%r14), %rdi
call usage
.L35:
addl $1, %ebx
cmpl %ebx, %r15d
jg .L44
movq (%r14), %rdi
call usage
.L44:
movq 8(%r14,%rdx), %rdi
movl $10, %edx
movl $0, %esi
call strtol
movl %eax, %r12d
jmp .L31
.L34:
addl $1, %ebx
cmpl %ebx, %r15d
jg .L45
movq (%r14), %rdi
call usage
.L45:
movq 8(%r14,%rdx), %rdi
movl $0, %esi
call strtod
movsd %xmm0, (%rsp)
xorpd %xmm3, %xmm3
ucomisd %xmm0, %xmm3
ja .L46
ucomisd .LC13(%rip), %xmm0
jbe .L31
.L46:
movq (%r14), %rdi
call usage
.L40:
addl $1, %ebx
cmpl %ebx, %r15d
jg .L48
movq (%r14), %rdi
call usage
.L48:
movq 8(%r14,%rdx), %rdi
movl $10, %edx
movl $0, %esi
call strtol
movl %eax, 8(%rsp)
testl %eax, %eax
jg .L31
movq (%r14), %rdi
call usage
.L32:
movq (%r14), %rdi
call usage
.L57:
movl $tpsum1a, %ebp
.L31:
addl $1, %ebx
cmpl %ebx, %r15d
jg .L49
jmp .L30
.L56:
movl $0, %r13d
movl $2, 28(%rsp)
movl $31415, %r12d
movl $1, 24(%rsp)
xorpd %xmm6, %xmm6
movsd %xmm6, (%rsp)
movl $8, 8(%rsp)
movl $1024, 20(%rsp)
movl $tpsum1, %ebp
.L30:
movslq 20(%rsp), %r14
movq $data, a(%rip)
leaq 0(,%r14,4), %rdx
leaq data(%rdx), %rax
movq %rax, b(%rip)
addq %rax, %rdx
movq %rdx, c(%rip)
movq %rax, p(%rip)
cmpq $tpsum1, %rbp
je .L50
movq %r14, %rsi
movq %rbp, %rdi
call check
.L50:
cmpl $1, 8(%rsp)
je .L51
movl 24(%rsp), %eax
movl %eax, %ebx
testl %eax, %eax
jne .L55
jmp .L53
.L51:
movq %r14, %rsi
movq %rbp, %rdi
call measure_function
cvtsi2sd 20(%rsp), %xmm1
movapd %xmm0, %xmm5
divsd %xmm1, %xmm5
movapd %xmm5, %xmm1
movl $.LC14, %esi
movl $1, %edi
movl $2, %eax
call __printf_chk
jmp .L54
.L55:
movslq 28(%rsp), %r15
movslq 8(%rsp), %rax
movq %rax, 8(%rsp)
.L58:
movl %r12d, %edi
call srandom
movq %r15, %r9
movsd (%rsp), %xmm0
movl %r13d, %r8d
movq stdout(%rip), %rcx
movq 8(%rsp), %rdx
movq %r14, %rsi
movq %rbp, %rdi
call find_cpe_full
movl $.LC15, %esi
movl $1, %edi
movl $1, %eax
call __printf_chk
subl $1, %ebx
jne .L58
.L53:
movq %r14, %rsi
movq %rbp, %rdi
call find_cpe
movl $.LC16, %esi
movl $1, %edi
movl $1, %eax
call __printf_chk
.L54:
movl $0, %eax
addq $40, %rsp
popq %rbx
popq %rbp
popq %r12
popq %r13
popq %r14
popq %r15
ret
.Letext0:
.Ldebug_info0:
.Ldebug_abbrev0:
.Ldebug_loc0:
.Ldebug_ranges0:
.Ldebug_line0: