clarify the purpose of this project
[nyanglibc.git] / libio / wstrops.s
blob76a536d8253c3176e0a42f15382928a53861c279
1 .text
2 .p2align 4,,15
3 .globl _IO_wstr_underflow
4 .type _IO_wstr_underflow, @function
5 _IO_wstr_underflow:
6 movq 160(%rdi), %rax
7 movq 32(%rax), %rdx
8 movq 8(%rax), %rcx
9 cmpq %rcx, %rdx
10 jbe .L2
11 movq %rdx, 8(%rax)
12 movq %rdx, %rcx
13 .L2:
14 movl (%rdi), %esi
15 movl %esi, %r8d
16 andl $3072, %r8d
17 cmpl $3072, %r8d
18 je .L3
19 movq (%rax), %rdx
20 .L4:
21 cmpq %rcx, %rdx
22 movl $-1, %eax
23 jnb .L1
24 movl (%rdx), %eax
25 .L1:
26 rep ret
27 .p2align 4,,10
28 .p2align 3
29 .L3:
30 andl $-2049, %esi
31 movl %esi, (%rdi)
32 movq 40(%rax), %rsi
33 movq %rdx, (%rax)
34 movq %rsi, 32(%rax)
35 jmp .L4
36 .size _IO_wstr_underflow, .-_IO_wstr_underflow
37 .p2align 4,,15
38 .globl _IO_wstr_overflow
39 .type _IO_wstr_overflow, @function
40 _IO_wstr_overflow:
41 movl (%rdi), %ecx
42 testb $8, %cl
43 je .L9
44 xorl %eax, %eax
45 cmpl $-1, %esi
46 setne %al
47 negl %eax
48 ret
49 .p2align 4,,10
50 .p2align 3
51 .L9:
52 pushq %r15
53 movl %ecx, %eax
54 pushq %r14
55 pushq %r13
56 pushq %r12
57 andl $3072, %eax
58 pushq %rbp
59 pushq %rbx
60 subq $24, %rsp
61 cmpl $1024, %eax
62 movq 160(%rdi), %rdx
63 je .L11
64 movq 32(%rdx), %rcx
65 .L12:
66 movq 48(%rdx), %r13
67 movq 56(%rdx), %rbp
68 xorl %r8d, %r8d
69 movq %rdi, %rbx
70 movq %rcx, %rdi
71 movl %esi, %r12d
72 subq %r13, %rbp
73 movq %rbp, %r14
74 sarq $2, %r14
75 cmpl $-1, %esi
76 sete %r8b
77 subq 24(%rdx), %rdi
78 addq %r14, %r8
79 sarq $2, %rdi
80 cmpq %rdi, %r8
81 jbe .L13
82 movq 8(%rdx), %rsi
83 .L14:
84 cmpl $-1, %r12d
85 je .L18
86 leaq 4(%rcx), %rax
87 movq %rax, 32(%rdx)
88 movl %r12d, (%rcx)
89 movq %rax, %rcx
90 .L18:
91 cmpq %rsi, %rcx
92 movl %r12d, %eax
93 jbe .L8
94 movq %rcx, 8(%rdx)
95 .L8:
96 addq $24, %rsp
97 popq %rbx
98 popq %rbp
99 popq %r12
100 popq %r13
101 popq %r14
102 popq %r15
104 .p2align 4,,10
105 .p2align 3
106 .L13:
107 testb $8, 116(%rbx)
108 jne .L16
109 leaq 50(%r14), %r15
110 movabsq $4611686018427387903, %rax
111 leaq (%r15,%r15), %rcx
112 cmpq %rax, %rcx
113 ja .L16
114 cmpq %rcx, %r14
115 movq %rcx, (%rsp)
116 ja .L16
117 leaq 0(,%r15,8), %rax
118 movq %rax, %rdi
119 movq %rax, 8(%rsp)
120 call malloc@PLT
121 testq %rax, %rax
122 movq %rax, %r15
123 je .L16
124 testq %r13, %r13
125 movq (%rsp), %rcx
126 je .L17
127 movq %r14, %rdx
128 movq %r13, %rsi
129 movq %rax, %rdi
130 call __wmemcpy
131 movq %r13, %rdi
132 call free@PLT
133 movq 160(%rbx), %rax
134 movq (%rsp), %rcx
135 movq $0, 48(%rax)
136 .L17:
137 movq %rcx, %rdx
138 leaq (%r15,%rbp), %rdi
139 xorl %esi, %esi
140 subq %r14, %rdx
141 call __wmemset
142 movq 8(%rsp), %rdx
143 movl $1, %ecx
144 movq %r15, %rsi
145 movq %rbx, %rdi
146 addq %r15, %rdx
147 call _IO_wsetb
148 movq 160(%rbx), %rdx
149 movq 16(%rdx), %rax
150 movq 8(%rdx), %rsi
151 movq 32(%rdx), %rcx
152 movq %r15, 24(%rdx)
153 subq %r13, %rax
154 subq %r13, %rsi
155 addq %r15, %rax
156 subq %r13, %rcx
157 addq %r15, %rsi
158 movq %rax, 16(%rdx)
159 movq (%rdx), %rax
160 addq %r15, %rcx
161 movq %rsi, 8(%rdx)
162 movq %rcx, 32(%rdx)
163 subq %r13, %rax
164 addq %r15, %rax
165 movq %rax, (%rdx)
166 movq 56(%rdx), %rax
167 movq %rax, 40(%rdx)
168 jmp .L14
169 .p2align 4,,10
170 .p2align 3
171 .L11:
172 orb $8, %ch
173 movq 8(%rdx), %rax
174 movl %ecx, (%rdi)
175 movq (%rdx), %rcx
176 movq %rax, (%rdx)
177 movq %rcx, 32(%rdx)
178 jmp .L12
179 .p2align 4,,10
180 .p2align 3
181 .L16:
182 addq $24, %rsp
183 movl $-1, %eax
184 popq %rbx
185 popq %rbp
186 popq %r12
187 popq %r13
188 popq %r14
189 popq %r15
191 .size _IO_wstr_overflow, .-_IO_wstr_overflow
192 .section .rodata.str1.1,"aMS",@progbits,1
193 .LC0:
194 .string "wstrops.c"
195 .LC1:
196 .string "offset >= oldend"
197 .text
198 .p2align 4,,15
199 .type enlarge_userbuf, @function
200 enlarge_userbuf:
201 pushq %r15
202 pushq %r14
203 pushq %r13
204 pushq %r12
205 pushq %rbp
206 pushq %rbx
207 subq $56, %rsp
208 movq 160(%rdi), %rbx
209 movq 48(%rbx), %r15
210 movq 56(%rbx), %rcx
211 subq %r15, %rcx
212 sarq $2, %rcx
213 cmpq %rsi, %rcx
214 jge .L41
215 movl 116(%rdi), %ebp
216 andl $8, %ebp
217 jne .L35
218 leaq 100(%rsi), %r12
219 movabsq $4611686018427387903, %rax
220 movq %rcx, 40(%rsp)
221 cmpq %rax, %r12
222 ja .L35
223 movq 24(%rbx), %rax
224 salq $2, %r12
225 movq %rdi, 24(%rsp)
226 movq %r12, %rdi
227 movl %edx, 36(%rsp)
228 movq %rsi, 8(%rsp)
229 movq 40(%rbx), %r14
230 movq %rax, 16(%rsp)
231 call malloc@PLT
232 testq %rax, %rax
233 movq %rax, %r13
234 je .L35
235 testq %r15, %r15
236 je .L36
237 movq 40(%rsp), %rcx
238 movq %r15, %rsi
239 movq %rax, %rdi
240 movq %rcx, %rdx
241 call __wmemcpy
242 movq %r15, %rdi
243 call free@PLT
244 movq $0, 48(%rbx)
245 .L36:
246 subq 16(%rsp), %r14
247 movq 24(%rsp), %rdi
248 leaq 0(%r13,%r12), %rdx
249 movl $1, %ecx
250 movq %r13, %rsi
251 movq %r14, %r8
252 sarq $2, %r8
253 movq %r8, 16(%rsp)
254 call _IO_wsetb
255 movl 36(%rsp), %eax
256 movq 16(%rsp), %r8
257 testl %eax, %eax
258 je .L37
259 movq 24(%rbx), %rax
260 movq %r13, 16(%rbx)
261 subq %r15, %rax
262 addq %r13, %rax
263 movq %rax, 24(%rbx)
264 movq 32(%rbx), %rax
265 subq %r15, %rax
266 addq %r13, %rax
267 movq %rax, 32(%rbx)
268 movq 40(%rbx), %rax
269 subq %r15, %rax
270 addq %r13, %rax
271 movq %rax, 40(%rbx)
272 movq (%rbx), %rax
273 subq %r15, %rax
274 addq %r13, %rax
275 cmpq %r8, 8(%rsp)
276 movq %rax, (%rbx)
277 movq 56(%rbx), %rax
278 movq %rax, 8(%rbx)
279 jl .L40
280 movq 8(%rsp), %rdx
281 leaq 0(%r13,%r14), %rdi
282 xorl %esi, %esi
283 subq %r8, %rdx
284 call __wmemset
285 jmp .L32
286 .p2align 4,,10
287 .p2align 3
288 .L35:
289 movl $1, %ebp
290 .L32:
291 addq $56, %rsp
292 movl %ebp, %eax
293 popq %rbx
294 popq %rbp
295 popq %r12
296 popq %r13
297 popq %r14
298 popq %r15
300 .p2align 4,,10
301 .p2align 3
302 .L41:
303 xorl %ebp, %ebp
304 jmp .L32
305 .p2align 4,,10
306 .p2align 3
307 .L37:
308 movq 16(%rbx), %rax
309 movq %r13, 24(%rbx)
310 subq %r15, %rax
311 addq %r13, %rax
312 movq %rax, 16(%rbx)
313 movq (%rbx), %rax
314 subq %r15, %rax
315 addq %r13, %rax
316 movq %rax, (%rbx)
317 movq 8(%rbx), %rax
318 subq %r15, %rax
319 addq %r13, %rax
320 movq %rax, 8(%rbx)
321 movq 32(%rbx), %rax
322 subq %r15, %rax
323 addq %r13, %rax
324 cmpq %r8, 8(%rsp)
325 movq %rax, 32(%rbx)
326 movq 56(%rbx), %rax
327 movq %rax, 40(%rbx)
328 jl .L40
329 movq 8(%rsp), %rdx
330 leaq 0(%r13,%r14), %rdi
331 xorl %esi, %esi
332 xorl %ebp, %ebp
333 subq %r8, %rdx
334 call __wmemset
335 jmp .L32
336 .L40:
337 leaq __PRETTY_FUNCTION__.11554(%rip), %rcx
338 leaq .LC0(%rip), %rsi
339 leaq .LC1(%rip), %rdi
340 movl $225, %edx
341 call __assert_fail
342 .size enlarge_userbuf, .-enlarge_userbuf
343 .p2align 4,,15
344 .globl _IO_wstr_seekoff
345 .type _IO_wstr_seekoff, @function
346 _IO_wstr_seekoff:
347 pushq %r15
348 pushq %r14
349 pushq %r13
350 pushq %r12
351 movl %edx, %r13d
352 pushq %rbp
353 pushq %rbx
354 movq %rdi, %rbp
355 movq %rsi, %r12
356 subq $24, %rsp
357 movq 160(%rdi), %rdx
358 testl %ecx, %ecx
359 movl (%rdi), %esi
360 movq 32(%rdx), %rax
361 movq 24(%rdx), %rdi
362 jne .L50
363 movl %esi, %ecx
364 andl $1024, %ecx
365 je .L51
366 testl $2048, %esi
367 jne .L76
368 cmpq %rax, %rdi
369 jb .L80
370 cmpq %rax, 8(%rdx)
371 movq 16(%rdx), %rsi
372 movl $1, %ecx
373 cmovnb 8(%rdx), %rax
374 subq %rsi, %rax
375 movq %rax, %r14
376 movq %rax, %r15
377 sarq $2, %r14
378 .L75:
379 testl %r13d, %r13d
380 je .L78
381 cmpl $1, %r13d
382 je .L61
383 movq %r14, %rdi
384 movabsq $2305843009213693951, %rax
385 movq %r14, %rbx
386 negq %rdi
387 subq %r14, %rax
388 .L60:
389 cmpq %rdi, %r12
390 jl .L69
391 cmpq %rax, %r12
392 jg .L69
393 addq %r12, %rbx
394 cmpq %r14, %rbx
395 jg .L89
396 .L64:
397 leaq (%rsi,%rbx,4), %rax
398 movq %r12, %rbx
399 movq %rax, (%rdx)
400 leaq (%rsi,%r15), %rax
401 movq %rax, 8(%rdx)
402 jmp .L58
403 .p2align 4,,10
404 .p2align 3
405 .L50:
406 cmpq %rax, %rdi
407 jnb .L90
408 .L52:
409 testl $256, %esi
410 jne .L73
411 .L91:
412 movq 48(%rdx), %r8
413 movq %r8, 16(%rdx)
414 .L56:
415 andl $-2049, %esi
416 testl %ecx, %ecx
417 movq %rax, (%rdx)
418 movq %rax, 8(%rdx)
419 movl %esi, 0(%rbp)
420 jne .L55
421 .L54:
422 subq %rdi, %rax
423 sarq $2, %rax
424 movq %rax, %rbx
425 .L49:
426 addq $24, %rsp
427 movq %rbx, %rax
428 popq %rbx
429 popq %rbp
430 popq %r12
431 popq %r13
432 popq %r14
433 popq %r15
435 .p2align 4,,10
436 .p2align 3
437 .L73:
438 movq 72(%rdx), %r8
439 movq %r8, 16(%rdx)
440 jmp .L56
441 .p2align 4,,10
442 .p2align 3
443 .L90:
444 testl $2048, %esi
445 jne .L52
446 .L55:
447 cmpq %rax, 8(%rdx)
448 movq 16(%rdx), %rsi
449 movq $-1, %rbx
450 cmovnb 8(%rdx), %rax
451 subq %rsi, %rax
452 movq %rax, %r14
453 movq %rax, %r15
454 sarq $2, %r14
455 testb $1, %cl
456 jne .L75
457 .L58:
458 andl $2, %ecx
459 je .L49
460 testl %r13d, %r13d
461 je .L79
462 cmpl $1, %r13d
463 jne .L86
464 movq 32(%rdx), %rbx
465 subq 24(%rdx), %rbx
466 movabsq $2305843009213693951, %rax
467 sarq $2, %rbx
468 movq %rbx, %rcx
469 subq %rbx, %rax
470 negq %rcx
471 .L67:
472 cmpq %rcx, %r12
473 jl .L69
474 cmpq %rax, %r12
475 jg .L69
476 addq %r12, %rbx
477 cmpq %r14, %rbx
478 jg .L70
479 .L72:
480 movq 24(%rdx), %rax
481 leaq (%rax,%rbx,4), %rax
482 movq %rax, 32(%rdx)
483 jmp .L49
484 .p2align 4,,10
485 .p2align 3
486 .L51:
487 cmpq %rax, %rdi
488 jb .L52
489 testl $2048, %esi
490 je .L54
491 jmp .L52
492 .p2align 4,,10
493 .p2align 3
494 .L76:
495 testl $256, %esi
496 movl $2, %ecx
497 jne .L73
498 jmp .L91
499 .p2align 4,,10
500 .p2align 3
501 .L79:
502 movabsq $2305843009213693951, %rax
503 xorl %ecx, %ecx
504 xorl %ebx, %ebx
505 jmp .L67
506 .p2align 4,,10
507 .p2align 3
508 .L78:
509 movabsq $2305843009213693951, %rax
510 xorl %edi, %edi
511 xorl %ebx, %ebx
512 jmp .L60
513 .p2align 4,,10
514 .p2align 3
515 .L86:
516 movq %r14, %rcx
517 movabsq $2305843009213693951, %rax
518 movq %r14, %rbx
519 negq %rcx
520 subq %r14, %rax
521 jmp .L67
522 .p2align 4,,10
523 .p2align 3
524 .L70:
525 xorl %edx, %edx
526 movq %rbx, %rsi
527 movq %rbp, %rdi
528 call enlarge_userbuf
529 testl %eax, %eax
530 jne .L71
531 movq 160(%rbp), %rdx
532 jmp .L72
533 .p2align 4,,10
534 .p2align 3
535 .L61:
536 movq (%rdx), %rbx
537 movabsq $2305843009213693951, %rax
538 subq %rsi, %rbx
539 sarq $2, %rbx
540 movq %rbx, %rdi
541 subq %rbx, %rax
542 negq %rdi
543 jmp .L60
544 .p2align 4,,10
545 .p2align 3
546 .L89:
547 movl $1, %edx
548 movq %rbx, %rsi
549 movq %rbp, %rdi
550 movl %ecx, 12(%rsp)
551 call enlarge_userbuf
552 testl %eax, %eax
553 movl 12(%rsp), %ecx
554 jne .L71
555 movq 160(%rbp), %rdx
556 movq 16(%rdx), %rsi
557 jmp .L64
558 .p2align 4,,10
559 .p2align 3
560 .L80:
561 movl $1, %ecx
562 jmp .L52
563 .p2align 4,,10
564 .p2align 3
565 .L69:
566 movq __libc_errno@gottpoff(%rip), %rax
567 movq $-1, %rbx
568 movl $22, %fs:(%rax)
569 jmp .L49
570 .L71:
571 movq $-1, %rbx
572 jmp .L49
573 .size _IO_wstr_seekoff, .-_IO_wstr_seekoff
574 .p2align 4,,15
575 .globl _IO_wstr_pbackfail
576 .type _IO_wstr_pbackfail, @function
577 _IO_wstr_pbackfail:
578 testb $8, (%rdi)
579 je .L95
580 cmpl $-1, %esi
581 jne .L93
582 .L95:
583 jmp _IO_wdefault_pbackfail
584 .p2align 4,,10
585 .p2align 3
586 .L93:
587 movl $-1, %eax
589 .size _IO_wstr_pbackfail, .-_IO_wstr_pbackfail
590 .p2align 4,,15
591 .globl _IO_wstr_finish
592 .type _IO_wstr_finish, @function
593 _IO_wstr_finish:
594 pushq %rbx
595 movq 160(%rdi), %rax
596 movq %rdi, %rbx
597 movq 48(%rax), %rdi
598 testq %rdi, %rdi
599 je .L100
600 testb $8, 116(%rbx)
601 je .L105
602 .L100:
603 movq $0, 48(%rax)
604 movq %rbx, %rdi
605 xorl %esi, %esi
606 popq %rbx
607 jmp _IO_wdefault_finish
608 .p2align 4,,10
609 .p2align 3
610 .L105:
611 call free@PLT
612 movq 160(%rbx), %rax
613 jmp .L100
614 .size _IO_wstr_finish, .-_IO_wstr_finish
615 .p2align 4,,15
616 .globl _IO_wstr_init_static
617 .type _IO_wstr_init_static, @function
618 _IO_wstr_init_static:
619 pushq %r13
620 pushq %r12
621 movq %rcx, %r13
622 pushq %rbp
623 pushq %rbx
624 movq %rdi, %r12
625 movq %rsi, %rbx
626 subq $8, %rsp
627 testq %rdx, %rdx
628 jne .L107
629 movq %rsi, %rdi
630 call __wcslen@PLT
631 leaq (%rbx,%rax,4), %rbp
632 .L108:
633 xorl %ecx, %ecx
634 movq %rbp, %rdx
635 movq %rbx, %rsi
636 movq %r12, %rdi
637 call _IO_wsetb
638 movq 160(%r12), %rax
639 testq %r13, %r13
640 movq %rbx, 24(%rax)
641 movq %rbx, 16(%rax)
642 movq %rbx, (%rax)
643 je .L110
644 movq %r13, 32(%rax)
645 movq %rbp, 40(%rax)
646 movq %r13, 8(%rax)
647 .L111:
648 movq $0, 224(%r12)
649 addq $8, %rsp
650 popq %rbx
651 popq %rbp
652 popq %r12
653 popq %r13
655 .p2align 4,,10
656 .p2align 3
657 .L107:
658 leaq (%rsi,%rdx,4), %rbp
659 cmpq %rbp, %rsi
660 jb .L108
661 movq %rsi, %rbp
662 notq %rbp
663 andq $-4, %rbp
664 addq %rsi, %rbp
665 jmp .L108
666 .p2align 4,,10
667 .p2align 3
668 .L110:
669 movq %rbx, 32(%rax)
670 movq %rbx, 40(%rax)
671 movq %rbp, 8(%rax)
672 jmp .L111
673 .size _IO_wstr_init_static, .-_IO_wstr_init_static
674 .p2align 4,,15
675 .globl _IO_wstr_count
676 .type _IO_wstr_count, @function
677 _IO_wstr_count:
678 movq 160(%rdi), %rdx
679 movq 32(%rdx), %rax
680 cmpq %rax, 8(%rdx)
681 cmovnb 8(%rdx), %rax
682 subq 16(%rdx), %rax
683 sarq $2, %rax
685 .size _IO_wstr_count, .-_IO_wstr_count
686 .section .rodata.str1.16,"aMS",@progbits,1
687 .align 16
688 .type __PRETTY_FUNCTION__.11554, @object
689 .size __PRETTY_FUNCTION__.11554, 16
690 __PRETTY_FUNCTION__.11554:
691 .string "enlarge_userbuf"
692 .hidden _IO_wstr_jumps
693 .globl _IO_wstr_jumps
694 .section __libc_IO_vtables,"aw",@progbits
695 .align 32
696 .type _IO_wstr_jumps, @object
697 .size _IO_wstr_jumps, 168
698 _IO_wstr_jumps:
699 .quad 0
700 .quad 0
701 .quad _IO_wstr_finish
702 .quad _IO_wstr_overflow
703 .quad _IO_wstr_underflow
704 .quad _IO_wdefault_uflow
705 .quad _IO_wstr_pbackfail
706 .quad _IO_wdefault_xsputn
707 .quad _IO_wdefault_xsgetn
708 .quad _IO_wstr_seekoff
709 .quad _IO_default_seekpos
710 .quad _IO_default_setbuf
711 .quad _IO_default_sync
712 .quad _IO_wdefault_doallocate
713 .quad _IO_default_read
714 .quad _IO_default_write
715 .quad _IO_default_seek
716 .quad _IO_default_sync
717 .quad _IO_default_stat
718 .quad _IO_default_showmanyc
719 .quad _IO_default_imbue
720 .hidden _IO_wdefault_doallocate
721 .hidden _IO_wdefault_xsgetn
722 .hidden _IO_wdefault_xsputn
723 .hidden _IO_wdefault_uflow
724 .hidden _IO_wdefault_finish
725 .hidden _IO_wdefault_pbackfail
726 .hidden __assert_fail
727 .hidden _IO_wsetb
728 .hidden __wmemset
729 .hidden __wmemcpy