clarify the purpose of this project
[nyanglibc.git] / gmon / gmon.s
blob31d3ab1e1c99d59ed23ab8040c95b44e6f32acc3
1 .text
2 .p2align 4,,15
3 .type callback, @function
4 callback:
5 movq 8(%rdi), %rcx
6 xorl %eax, %eax
7 cmpb $0, (%rcx)
8 jne .L1
9 movq (%rdi), %rax
10 movq %rax, (%rdx)
11 movl $1, %eax
12 .L1:
13 rep ret
14 .size callback, .-callback
15 .section .rodata.str1.1,"aMS",@progbits,1
16 .LC0:
17 .string "GMON_OUT_PREFIX"
18 .LC1:
19 .string "gmon.out"
20 .LC2:
21 .string "%s.%u"
22 .LC3:
23 .string "_mcleanup: gmon.out: %s\n"
24 .text
25 .p2align 4,,15
26 .type write_gmon, @function
27 write_gmon:
28 pushq %rbp
29 leaq .LC0(%rip), %rdi
30 movq %rsp, %rbp
31 pushq %r15
32 pushq %r14
33 pushq %r13
34 pushq %r12
35 pushq %rbx
36 subq $1768, %rsp
37 call getenv
38 testq %rax, %rax
39 je .L9
40 movl __libc_enable_secure(%rip), %edx
41 testl %edx, %edx
42 je .L50
43 .L9:
44 leaq .LC1(%rip), %rdi
45 xorl %eax, %eax
46 movl $438, %edx
47 movl $131649, %esi
48 call __open_nocancel
49 testl %eax, %eax
50 movl %eax, %ebx
51 js .L51
52 .L8:
53 leaq -1776(%rbp), %rsi
54 movq $0, -1768(%rbp)
55 movl $20, %edx
56 movl %ebx, %edi
57 movl $1852796263, -1776(%rbp)
58 movl $1, -1772(%rbp)
59 movl $0, 16(%rsi)
60 call __write_nocancel
61 leaq callback(%rip), %rdi
62 leaq -1784(%rbp), %rsi
63 movq $0, -1784(%rbp)
64 call __dl_iterate_phdr
65 movq -1784(%rbp), %rax
66 movb $0, -1744(%rbp)
67 movq %rax, %rdi
68 movq 16+_gmonparam(%rip), %rax
69 testq %rax, %rax
70 jne .L48
71 leaq -1072(%rbp), %r13
72 leaq -1744(%rbp), %r12
73 leaq -1712(%rbp), %r15
74 .L11:
75 leaq -48(%rbp), %rcx
76 leaq -1785(%rbp), %r10
77 movb $1, -1785(%rbp)
78 movq %r13, %rax
79 movq %r15, %rdx
80 .p2align 4,,10
81 .p2align 3
82 .L12:
83 movq %rdx, 16(%rax)
84 movq %r10, (%rax)
85 addq $32, %rax
86 movq $1, -24(%rax)
87 movq $20, -8(%rax)
88 addq $20, %rdx
89 cmpq %rax, %rcx
90 jne .L12
91 movq 32+_gmonparam(%rip), %rax
92 xorl %edx, %edx
93 xorl %r14d, %r14d
94 shrq $3, %rax
95 testq %rax, %rax
96 movq %rax, -1800(%rbp)
97 je .L14
98 movq %r10, -1808(%rbp)
99 movq %rdi, %r10
100 .p2align 4,,10
101 .p2align 3
102 .L13:
103 movq 24+_gmonparam(%rip), %rax
104 movq (%rax,%r14,8), %rax
105 testq %rax, %rax
106 je .L15
107 movq 88+_gmonparam(%rip), %rdi
108 movq 64+_gmonparam(%rip), %rcx
109 movq 40+_gmonparam(%rip), %rsi
110 leaq 0(,%rdi,8), %r9
111 subq %r10, %rcx
112 imulq %r14, %r9
113 addq %rcx, %r9
114 .p2align 4,,10
115 .p2align 3
116 .L17:
117 leaq (%rax,%rax,2), %r8
118 movq %r9, -1744(%rbp)
119 salq $3, %r8
120 leaq (%rsi,%r8), %rax
121 movq (%rax), %rcx
122 subq %r10, %rcx
123 movq %rcx, -1736(%rbp)
124 movq 8(%rax), %rcx
125 movl %ecx, -1728(%rbp)
126 movslq %edx, %rcx
127 movl 16(%r12), %edi
128 leaq (%rcx,%rcx,4), %rcx
129 movdqa (%r12), %xmm0
130 addl $1, %edx
131 leaq (%r15,%rcx,4), %rcx
132 cmpl $32, %edx
133 movups %xmm0, (%rcx)
134 movl %edi, 16(%rcx)
135 jne .L16
136 movl $64, %edx
137 movq %r13, %rsi
138 movl %ebx, %edi
139 movl $20, %eax
140 #APP
141 # 68 "../sysdeps/unix/sysv/linux/not-cancel.h" 1
142 syscall
144 # 0 "" 2
145 #NO_APP
146 movq 40+_gmonparam(%rip), %rsi
147 xorl %edx, %edx
148 leaq (%rsi,%r8), %rax
149 .L16:
150 movq 16(%rax), %rax
151 testq %rax, %rax
152 jne .L17
153 .L15:
154 addq $1, %r14
155 cmpq %r14, -1800(%rbp)
156 jne .L13
157 testl %edx, %edx
158 movq -1808(%rbp), %r10
159 je .L14
160 addl %edx, %edx
161 movq %r13, %rsi
162 movl %ebx, %edi
163 movl $20, %eax
164 #APP
165 # 68 "../sysdeps/unix/sysv/linux/not-cancel.h" 1
166 syscall
168 # 0 "" 2
169 #NO_APP
170 .L14:
171 movq __bb_head(%rip), %r9
172 movb $2, -1785(%rbp)
173 movq %r10, -1712(%rbp)
174 movq $1, -1704(%rbp)
175 movq %r12, -1696(%rbp)
176 movq $8, -1688(%rbp)
177 testq %r9, %r9
178 movq $8, -1064(%rbp)
179 movq $8, -1048(%rbp)
180 movq $8, -1032(%rbp)
181 movq $8, -1016(%rbp)
182 movq $8, -1000(%rbp)
183 movq $8, -984(%rbp)
184 movq $8, -968(%rbp)
185 movq $8, -952(%rbp)
186 je .L19
187 movl $20, %r10d
188 .p2align 4,,10
189 .p2align 3
190 .L24:
191 movq 24(%r9), %rax
192 movl $2, %edx
193 movq %r15, %rsi
194 movl %ebx, %edi
195 movq %rax, -1744(%rbp)
196 movl %r10d, %eax
197 #APP
198 # 68 "../sysdeps/unix/sysv/linux/not-cancel.h" 1
199 syscall
201 # 0 "" 2
202 #NO_APP
203 movq -1744(%rbp), %rsi
204 testq %rsi, %rsi
205 je .L20
206 movq 40(%r9), %r11
207 movq 16(%r9), %rdi
208 xorl %r8d, %r8d
209 xorl %edx, %edx
210 .p2align 4,,10
211 .p2align 3
212 .L21:
213 leaq 0(,%r8,8), %rax
214 leaq 1(%rdx), %rcx
215 movq %rdx, %r12
216 addq $1, %r8
217 salq $4, %r12
218 addq $2, %rdx
219 leaq (%r11,%rax), %r14
220 salq $4, %rcx
221 addq %rdi, %rax
222 cmpq %rsi, %r8
223 movq %r14, -1072(%rbp,%r12)
224 movq %rax, -1072(%rbp,%rcx)
225 jnb .L52
226 cmpq $6, %rdx
227 jbe .L21
228 movq %r13, %rsi
229 movl %ebx, %edi
230 movl %r10d, %eax
231 #APP
232 # 68 "../sysdeps/unix/sysv/linux/not-cancel.h" 1
233 syscall
235 # 0 "" 2
236 #NO_APP
237 xorl %edx, %edx
238 movq 40(%r9), %r11
239 movq 16(%r9), %rdi
240 movq -1744(%rbp), %rsi
241 jmp .L21
242 .p2align 4,,10
243 .p2align 3
244 .L52:
245 movq %r13, %rsi
246 movl %ebx, %edi
247 movl %r10d, %eax
248 #APP
249 # 68 "../sysdeps/unix/sysv/linux/not-cancel.h" 1
250 syscall
252 # 0 "" 2
253 #NO_APP
254 .L20:
255 movq 32(%r9), %r9
256 testq %r9, %r9
257 jne .L24
258 .L19:
259 movl %ebx, %edi
260 call __close_nocancel
261 leaq -40(%rbp), %rsp
262 popq %rbx
263 popq %r12
264 popq %r13
265 popq %r14
266 popq %r15
267 popq %rbp
269 .p2align 4,,10
270 .p2align 3
271 .L48:
272 movq 8+_gmonparam(%rip), %rdx
273 leaq -1712(%rbp), %r15
274 leaq -1744(%rbp), %r12
275 movq %rax, -1032(%rbp)
276 leaq -1072(%rbp), %r13
277 shrq %rax
278 movq %r12, -1072(%rbp)
279 movq $1, -1064(%rbp)
280 movq %rdx, -1040(%rbp)
281 movq 64+_gmonparam(%rip), %rdx
282 movq %r15, -1056(%rbp)
283 movq $40, -1048(%rbp)
284 movl %eax, -1696(%rbp)
285 subq %rdi, %rdx
286 movq %rdx, -1712(%rbp)
287 movq 72+_gmonparam(%rip), %rdx
288 subq %rdi, %rdx
289 movq %rdx, -1704(%rbp)
290 call __profile_frequency
291 movabsq $32480047799690611, %rdi
292 movl %eax, -1692(%rbp)
293 xorl %eax, %eax
294 movq %rdi, -1688(%rbp)
295 movl $3, %edx
296 movw %ax, 36(%r15)
297 movl $0, 32(%r15)
298 movb $0, 38(%r15)
299 movq %r13, %rsi
300 movb $115, -1673(%rbp)
301 movl %ebx, %edi
302 movl $20, %eax
303 #APP
304 # 68 "../sysdeps/unix/sysv/linux/not-cancel.h" 1
305 syscall
307 # 0 "" 2
308 #NO_APP
309 movq -1784(%rbp), %rax
310 movq %rax, %rdi
311 jmp .L11
312 .L50:
313 movq %rax, %rdi
314 movq %rax, %rbx
315 movq %rsp, %r12
316 call strlen
317 leaq 20(%rax), %r13
318 addq $35, %rax
319 andq $-16, %rax
320 subq %rax, %rsp
321 call __getpid
322 leaq .LC2(%rip), %rdx
323 movl %eax, %r8d
324 movq %rbx, %rcx
325 movq %rsp, %rdi
326 movq %r13, %rsi
327 xorl %eax, %eax
328 call __snprintf
329 movq %rsp, %rdi
330 xorl %eax, %eax
331 movl $438, %edx
332 movl $131649, %esi
333 call __open_nocancel
334 cmpl $-1, %eax
335 movl %eax, %ebx
336 movq %r12, %rsp
337 jne .L8
338 jmp .L9
339 .L51:
340 movq __libc_errno@gottpoff(%rip), %rax
341 leaq -1072(%rbp), %rsi
342 movl $300, %edx
343 movl %fs:(%rax), %edi
344 call __strerror_r
345 leaq .LC3(%rip), %rsi
346 movq %rax, %rdx
347 xorl %edi, %edi
348 xorl %eax, %eax
349 call __fxprintf
350 leaq -40(%rbp), %rsp
351 popq %rbx
352 popq %r12
353 popq %r13
354 popq %r14
355 popq %r15
356 popq %rbp
358 .size write_gmon, .-write_gmon
359 .p2align 4,,15
360 .type __moncontrol.part.0, @function
361 __moncontrol.part.0:
362 subq $8, %rsp
363 movl s_scale(%rip), %ecx
364 movq 64+_gmonparam(%rip), %rdx
365 movq 16+_gmonparam(%rip), %rsi
366 movq 8+_gmonparam(%rip), %rdi
367 call __profil
368 movq $0, _gmonparam(%rip)
369 addq $8, %rsp
371 .size __moncontrol.part.0, .-__moncontrol.part.0
372 .p2align 4,,15
373 .globl __moncontrol
374 .hidden __moncontrol
375 .type __moncontrol, @function
376 __moncontrol:
377 cmpq $2, _gmonparam(%rip)
378 je .L59
379 testl %edi, %edi
380 jne .L61
381 subq $8, %rsp
382 xorl %ecx, %ecx
383 xorl %edx, %edx
384 xorl %esi, %esi
385 xorl %edi, %edi
386 call __profil
387 movq $3, _gmonparam(%rip)
388 addq $8, %rsp
390 .p2align 4,,10
391 .p2align 3
392 .L61:
393 jmp __moncontrol.part.0
394 .p2align 4,,10
395 .p2align 3
396 .L59:
397 rep ret
398 .size __moncontrol, .-__moncontrol
399 .weak moncontrol
400 .set moncontrol,__moncontrol
401 .section .rodata.str1.1
402 .LC4:
403 .string "monstartup: out of memory\n"
404 .text
405 .p2align 4,,15
406 .globl __monstartup
407 .type __monstartup, @function
408 __monstartup:
409 pushq %r13
410 pushq %r12
411 andq $-4, %rdi
412 pushq %rbp
413 leaq 3(%rsi), %rbp
414 pushq %rbx
415 movq %rdi, %r13
416 movabsq $2951479051793528259, %rcx
417 andq $-4, %rbp
418 subq $8, %rsp
419 movq %rdi, 64+_gmonparam(%rip)
420 movq %rbp, %rax
421 movq %rbp, 72+_gmonparam(%rip)
422 movq $2, 88+_gmonparam(%rip)
423 subq %rdi, %rax
424 movq $4, 96+_gmonparam(%rip)
425 leaq (%rax,%rax,2), %rdx
426 movq %rax, %rdi
427 movq %rax, 80+_gmonparam(%rip)
428 shrq %rdi
429 shrq $2, %rdx
430 leaq 7(%rdi), %rbx
431 movq %rdi, 32+_gmonparam(%rip)
432 movq %rdx, %rax
433 mulq %rcx
434 andq $-8, %rbx
435 movq %rbx, 16+_gmonparam(%rip)
436 shrq $2, %rdx
437 cmpq $49, %rdx
438 ja .L63
439 movq $50, 56+_gmonparam(%rip)
440 movl $1200, %r12d
441 .L64:
442 addq %rbx, %rdi
443 movl $1, %esi
444 movq %r12, 48+_gmonparam(%rip)
445 addq %r12, %rdi
446 call calloc@PLT
447 testq %rax, %rax
448 je .L73
449 subl %r13d, %ebp
450 addq %rax, %r12
451 movq %rax, 40+_gmonparam(%rip)
452 movq $0, 16(%rax)
453 movslq %ebp, %rax
454 movq %r12, 8+_gmonparam(%rip)
455 addq %rbx, %r12
456 cmpq %rax, %rbx
457 movq %r12, 24+_gmonparam(%rip)
458 jnb .L68
459 testq %rbx, %rbx
460 js .L69
461 pxor %xmm0, %xmm0
462 cvtsi2ssq %rbx, %xmm0
463 .L70:
464 cmpq $2, _gmonparam(%rip)
465 pxor %xmm1, %xmm1
466 cvtsi2ss %ebp, %xmm1
467 divss %xmm1, %xmm0
468 mulss .LC5(%rip), %xmm0
469 cvttss2si %xmm0, %eax
470 movl %eax, s_scale(%rip)
471 jne .L74
472 .L62:
473 addq $8, %rsp
474 popq %rbx
475 popq %rbp
476 popq %r12
477 popq %r13
479 .p2align 4,,10
480 .p2align 3
481 .L63:
482 cmpq $1048576, %rdx
483 jbe .L75
484 movq $1048576, 56+_gmonparam(%rip)
485 movl $25165824, %r12d
486 jmp .L64
487 .p2align 4,,10
488 .p2align 3
489 .L68:
490 cmpq $2, _gmonparam(%rip)
491 movl $65536, s_scale(%rip)
492 je .L62
493 .L74:
494 addq $8, %rsp
495 popq %rbx
496 popq %rbp
497 popq %r12
498 popq %r13
499 jmp __moncontrol.part.0
500 .p2align 4,,10
501 .p2align 3
502 .L75:
503 leaq (%rdx,%rdx,2), %r12
504 movq %rdx, 56+_gmonparam(%rip)
505 salq $3, %r12
506 jmp .L64
507 .p2align 4,,10
508 .p2align 3
509 .L69:
510 pxor %xmm0, %xmm0
511 shrq %rbx
512 cvtsi2ssq %rbx, %xmm0
513 addss %xmm0, %xmm0
514 jmp .L70
515 .p2align 4,,10
516 .p2align 3
517 .L73:
518 leaq .LC4(%rip), %rsi
519 movl $26, %edx
520 movl $2, %edi
521 call __write_nocancel
522 movq $0, 40+_gmonparam(%rip)
523 movq $2, _gmonparam(%rip)
524 addq $8, %rsp
525 popq %rbx
526 popq %rbp
527 popq %r12
528 popq %r13
530 .size __monstartup, .-__monstartup
531 .weak monstartup
532 .set monstartup,__monstartup
533 .p2align 4,,15
534 .globl __write_profiling
535 .type __write_profiling, @function
536 __write_profiling:
537 pushq %rbx
538 movq _gmonparam(%rip), %rbx
539 movq $3, _gmonparam(%rip)
540 testl %ebx, %ebx
541 jne .L77
542 call write_gmon
543 .L77:
544 movslq %ebx, %rbx
545 movq %rbx, _gmonparam(%rip)
546 popq %rbx
548 .size __write_profiling, .-__write_profiling
549 .weak write_profiling
550 .set write_profiling,__write_profiling
551 .p2align 4,,15
552 .globl _mcleanup
553 .type _mcleanup, @function
554 _mcleanup:
555 subq $8, %rsp
556 xorl %edi, %edi
557 call __moncontrol
558 cmpq $2, _gmonparam(%rip)
559 je .L80
560 call write_gmon
561 .L80:
562 movq 40+_gmonparam(%rip), %rdi
563 addq $8, %rsp
564 jmp free@PLT
565 .size _mcleanup, .-_mcleanup
566 .local s_scale
567 .comm s_scale,4,4
568 .hidden _gmonparam
569 .globl _gmonparam
570 .data
571 .align 32
572 .type _gmonparam, @object
573 .size _gmonparam, 104
574 _gmonparam:
575 .quad 3
576 .zero 96
577 .hidden __bb_head
578 .comm __bb_head,8,8
579 .section .rodata.cst4,"aM",@progbits,4
580 .align 4
581 .LC5:
582 .long 1199570944
583 .hidden __profil
584 .hidden __fxprintf
585 .hidden __strerror_r
586 .hidden __snprintf
587 .hidden __getpid
588 .hidden strlen
589 .hidden __profile_frequency
590 .hidden __close_nocancel
591 .hidden __dl_iterate_phdr
592 .hidden __write_nocancel
593 .hidden __open_nocancel
594 .hidden getenv