clarify the purpose of this project
[nyanglibc.git] / locale / newlocale.shared.s
blobd8ae49b6dac83004b92fc11a93db63b60b455331
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 .section .rodata.str1.1,"aMS",@progbits,1
7 .LC0:
8 .string "C"
9 .LC1:
10 .string "LOCPATH"
11 #NO_APP
12 .text
13 .p2align 4,,15
14 .globl __newlocale
15 .type __newlocale, @function
16 __newlocale:
17 pushq %rbp
18 movq %rsp, %rbp
19 pushq %r15
20 pushq %r14
21 pushq %r13
22 pushq %r12
23 movq %rsi, %r14
24 pushq %rbx
25 movq %rdx, %rbx
26 subq $408, %rsp
27 cmpl $64, %edi
28 je .L48
29 testl $-8128, %edi
30 movl %edi, %r12d
31 jne .L4
32 .L2:
33 testq %r14, %r14
34 je .L4
35 leaq _nl_C_locobj(%rip), %rax
36 cmpq %rax, %rbx
37 je .L49
38 testq %rbx, %rbx
39 je .L5
40 cmpl $8127, %r12d
41 je .L5
42 movdqu (%rbx), %xmm0
43 testl %r12d, %r12d
44 movq 224(%rbx), %rax
45 movaps %xmm0, -288(%rbp)
46 movdqu 16(%rbx), %xmm0
47 movq %rax, -64(%rbp)
48 movaps %xmm0, -272(%rbp)
49 movdqu 32(%rbx), %xmm0
50 movaps %xmm0, -256(%rbp)
51 movdqu 48(%rbx), %xmm0
52 movaps %xmm0, -240(%rbp)
53 movdqu 64(%rbx), %xmm0
54 movaps %xmm0, -224(%rbp)
55 movdqu 80(%rbx), %xmm0
56 movaps %xmm0, -208(%rbp)
57 movdqu 96(%rbx), %xmm0
58 movaps %xmm0, -192(%rbp)
59 movdqu 112(%rbx), %xmm0
60 movaps %xmm0, -176(%rbp)
61 movdqu 128(%rbx), %xmm0
62 movaps %xmm0, -160(%rbp)
63 movdqu 144(%rbx), %xmm0
64 movaps %xmm0, -144(%rbp)
65 movdqu 160(%rbx), %xmm0
66 movaps %xmm0, -128(%rbp)
67 movdqu 176(%rbx), %xmm0
68 movaps %xmm0, -112(%rbp)
69 movdqu 192(%rbx), %xmm0
70 movaps %xmm0, -96(%rbp)
71 movdqu 208(%rbx), %xmm0
72 movaps %xmm0, -80(%rbp)
73 jne .L11
74 movl $232, %edi
75 call malloc@PLT
76 testq %rax, %rax
77 movq %rax, %r15
78 je .L97
79 movdqa -288(%rbp), %xmm0
80 movups %xmm0, (%rax)
81 movdqa -272(%rbp), %xmm0
82 movups %xmm0, 16(%rax)
83 movdqa -256(%rbp), %xmm0
84 movups %xmm0, 32(%rax)
85 movdqa -240(%rbp), %xmm0
86 movups %xmm0, 48(%rax)
87 movdqa -224(%rbp), %xmm0
88 movups %xmm0, 64(%rax)
89 movdqa -208(%rbp), %xmm0
90 movups %xmm0, 80(%rax)
91 movdqa -192(%rbp), %xmm0
92 movups %xmm0, 96(%rax)
93 movdqa -176(%rbp), %xmm0
94 movups %xmm0, 112(%rax)
95 movdqa -160(%rbp), %xmm0
96 movups %xmm0, 128(%rax)
97 movdqa -144(%rbp), %xmm0
98 movups %xmm0, 144(%rax)
99 movdqa -128(%rbp), %xmm0
100 movups %xmm0, 160(%rax)
101 movdqa -112(%rbp), %xmm0
102 movups %xmm0, 176(%rax)
103 movdqa -96(%rbp), %xmm0
104 movups %xmm0, 192(%rax)
105 movdqa -80(%rbp), %xmm0
106 movups %xmm0, 208(%rax)
107 movq -64(%rbp), %rax
108 movq %rax, 224(%r15)
109 .L13:
110 movq (%r15), %rax
111 movq 64(%rax), %rcx
112 leaq 256(%rcx), %rdx
113 movq 88(%rax), %rcx
114 movq 72(%rax), %rax
115 movq %rdx, 104(%r15)
116 leaq 512(%rcx), %rdx
117 addq $512, %rax
118 movq %rax, 120(%r15)
119 movq %rdx, 112(%r15)
120 jmp .L1
121 .p2align 4,,10
122 .p2align 3
123 .L92:
124 movl -436(%rbp), %eax
125 movl -440(%rbp), %r12d
126 movq -448(%rbp), %rbx
127 notl %eax
128 testl %r12d, %eax
129 je .L19
130 .p2align 4,,10
131 .p2align 3
132 .L4:
133 movq __libc_errno@gottpoff(%rip), %rax
134 xorl %r15d, %r15d
135 movl $22, %fs:(%rax)
136 .L1:
137 leaq -40(%rbp), %rsp
138 movq %r15, %rax
139 popq %rbx
140 popq %r12
141 popq %r13
142 popq %r14
143 popq %r15
144 popq %rbp
146 .p2align 4,,10
147 .p2align 3
148 .L49:
149 xorl %ebx, %ebx
150 .L5:
151 testl %r12d, %r12d
152 leaq _nl_C_locobj(%rip), %r15
153 je .L1
154 leaq .LC0(%rip), %rdi
155 movl $2, %ecx
156 movq %r14, %rsi
157 repz cmpsb
158 je .L1
159 testq %rbx, %rbx
160 jne .L100
161 movdqu _nl_C_locobj(%rip), %xmm0
162 movq 224+_nl_C_locobj(%rip), %rax
163 movaps %xmm0, -288(%rbp)
164 movdqu 16+_nl_C_locobj(%rip), %xmm0
165 movq %rax, -64(%rbp)
166 movaps %xmm0, -272(%rbp)
167 movdqu 32+_nl_C_locobj(%rip), %xmm0
168 movaps %xmm0, -256(%rbp)
169 movdqu 48+_nl_C_locobj(%rip), %xmm0
170 movaps %xmm0, -240(%rbp)
171 movdqu 64+_nl_C_locobj(%rip), %xmm0
172 movaps %xmm0, -224(%rbp)
173 movdqu 80+_nl_C_locobj(%rip), %xmm0
174 movaps %xmm0, -208(%rbp)
175 movdqu 96+_nl_C_locobj(%rip), %xmm0
176 movaps %xmm0, -192(%rbp)
177 movdqu 112+_nl_C_locobj(%rip), %xmm0
178 movaps %xmm0, -176(%rbp)
179 movdqu 128+_nl_C_locobj(%rip), %xmm0
180 movaps %xmm0, -160(%rbp)
181 movdqu 144+_nl_C_locobj(%rip), %xmm0
182 movaps %xmm0, -144(%rbp)
183 movdqu 160+_nl_C_locobj(%rip), %xmm0
184 movaps %xmm0, -128(%rbp)
185 movdqu 176+_nl_C_locobj(%rip), %xmm0
186 movaps %xmm0, -112(%rbp)
187 movdqu 192+_nl_C_locobj(%rip), %xmm0
188 movaps %xmm0, -96(%rbp)
189 movdqu 208+_nl_C_locobj(%rip), %xmm0
190 movaps %xmm0, -80(%rbp)
191 .L11:
192 leaq .LC1(%rip), %rdi
193 movq $0, -416(%rbp)
194 movq $0, -408(%rbp)
195 call __GI_getenv
196 testq %rax, %rax
197 je .L16
198 cmpb $0, (%rax)
199 je .L16
200 leaq -408(%rbp), %r15
201 leaq -416(%rbp), %r13
202 movl $58, %esi
203 movq %rax, %rdi
204 movq %r15, %rcx
205 movq %r13, %rdx
206 call __argz_create_sep
207 testl %eax, %eax
208 jne .L97
209 leaq _nl_default_locale_path(%rip), %rdx
210 movl $58, %ecx
211 movq %r15, %rsi
212 movq %r13, %rdi
213 call __argz_add_sep
214 testl %eax, %eax
215 jne .L97
216 .p2align 4,,10
217 .p2align 3
218 .L16:
219 leaq -400(%rbp), %rdx
220 xorl %eax, %eax
221 movq %rdx, -424(%rbp)
222 jmp .L15
223 .p2align 4,,10
224 .p2align 3
225 .L18:
226 addq $1, %rax
227 .L15:
228 cmpq $6, %rax
229 je .L18
230 cmpl $12, %eax
231 movq %r14, (%rdx,%rax,8)
232 jne .L18
233 movl $59, %esi
234 movq %r14, %rdi
235 call __GI_strchr
236 testq %rax, %rax
237 je .L19
238 movq %r14, %rdi
239 leaq _nl_category_name_sizes(%rip), %r13
240 call __GI_strlen
241 leaq 1(%rax), %rdx
242 addq $31, %rax
243 movq %r14, %rsi
244 andq $-16, %rax
245 subq %rax, %rsp
246 leaq 15(%rsp), %rdi
247 andq $-16, %rdi
248 call __GI_memcpy@PLT
249 movl %r12d, -440(%rbp)
250 movl $0, -436(%rbp)
251 movq %rax, %r12
252 movq %rbx, -448(%rbp)
253 .p2align 4,,10
254 .p2align 3
255 .L20:
256 movl $61, %esi
257 movq %r12, %rdi
258 call __GI_strchr
259 testq %rax, %rax
260 movq %rax, -432(%rbp)
261 je .L92
262 subq %r12, %rax
263 xorl %r15d, %r15d
264 movq %rax, %r14
265 jmp .L25
266 .p2align 4,,10
267 .p2align 3
268 .L22:
269 cmpl $12, %r15d
270 je .L4
271 .L21:
272 addq $1, %r15
273 .L25:
274 cmpq $6, %r15
275 je .L21
276 movzbl 0(%r13,%r15), %eax
277 cmpq %r14, %rax
278 jne .L22
279 leaq _nl_category_name_idxs(%rip), %rax
280 movq %r14, %rdx
281 movq %r12, %rdi
282 movzbl (%rax,%r15), %esi
283 leaq _nl_category_names(%rip), %rax
284 addq %rax, %rsi
285 call __GI_memcmp@PLT
286 testl %eax, %eax
287 jne .L22
288 movq -432(%rbp), %rdi
289 movl %r15d, %ecx
290 movl $1, %eax
291 sall %cl, %eax
292 movl $59, %esi
293 movslq %r15d, %rcx
294 orl %eax, -436(%rbp)
295 addq $1, %rdi
296 movq %rdi, -400(%rbp,%rcx,8)
297 call __GI_strchr
298 testq %rax, %rax
299 je .L92
300 movb $0, (%rax)
301 leaq 1(%rax), %r12
302 jmp .L20
303 .p2align 4,,10
304 .p2align 3
305 .L48:
306 movl $8127, %r12d
307 jmp .L2
308 .p2align 4,,10
309 .p2align 3
310 .L19:
311 movl __libc_pthread_functions_init(%rip), %ecx
312 testl %ecx, %ecx
313 je .L26
314 movq 144+__libc_pthread_functions(%rip), %rax
315 leaq __libc_setlocale_lock(%rip), %rdi
316 #APP
317 # 162 "newlocale.c" 1
318 ror $2*8+1, %rax
319 xor %fs:48, %rax
320 # 0 "" 2
321 #NO_APP
322 call *%rax
323 .L26:
324 xorl %r15d, %r15d
325 movq %rbx, -432(%rbp)
326 xorl %r14d, %r14d
327 leaq -288(%rbp), %r13
328 movq %r15, %rbx
329 jmp .L27
330 .p2align 4,,10
331 .p2align 3
332 .L28:
333 cmpq $6, %rbx
334 leal 1(%rbx), %r15d
335 je .L34
336 movq 128(%r13,%rbx,8), %rdi
337 leaq _nl_C_name(%rip), %rax
338 cmpq %rax, %rdi
339 je .L33
340 .L95:
341 call __GI_strlen
342 leaq 1(%r14,%rax), %r14
343 .L33:
344 cmpl $13, %r15d
345 je .L101
346 .L34:
347 addq $1, %rbx
348 .L27:
349 btl %ebx, %r12d
350 jnc .L28
351 movq -424(%rbp), %rax
352 movq -408(%rbp), %rsi
353 movl %ebx, %edx
354 movq -416(%rbp), %rdi
355 leaq (%rax,%rbx,8), %rcx
356 call _nl_find_locale
357 testq %rax, %rax
358 movq %rax, 0(%r13,%rbx,8)
359 je .L102
360 movq -424(%rbp), %rax
361 leal 1(%rbx), %r15d
362 movq (%rax,%rbx,8), %rdi
363 leaq _nl_C_name(%rip), %rax
364 cmpq %rax, %rdi
365 jne .L95
366 cmpl $13, %r15d
367 jne .L34
368 .p2align 4,,10
369 .p2align 3
370 .L101:
371 movq %r14, %rax
372 movq -432(%rbp), %rbx
373 movl %r15d, %r14d
374 addq $232, %rax
375 movq %rax, %rdi
376 call malloc@PLT
377 testq %rax, %rax
378 movq %rax, %r15
379 je .L29
380 xorl %edx, %edx
381 testq %rbx, %rbx
382 leaq 232(%rax), %rax
383 je .L103
384 movq %rbx, -432(%rbp)
385 movq %rdx, %r14
386 movq %r13, %rbx
387 movl %r12d, %r13d
388 movq %rax, %r12
389 jmp .L37
390 .p2align 4,,10
391 .p2align 3
392 .L105:
393 movq -432(%rbp), %rax
394 movq (%rax,%r14,8), %rsi
395 cmpl $-1, 48(%rsi)
396 je .L42
397 movl %r14d, %edi
398 call _nl_remove_locale
399 .L42:
400 movq (%rbx,%r14,8), %rax
401 movq %rax, (%r15,%r14,8)
402 movq -424(%rbp), %rax
403 movq (%rax,%r14,8), %rsi
404 leaq _nl_C_name(%rip), %rax
405 cmpq %rax, %rsi
406 je .L96
407 .L46:
408 movq %r12, 128(%r15,%r14,8)
409 movq %r12, %rdi
410 call __GI_stpcpy@PLT
411 leaq 1(%rax), %r12
412 .L44:
413 cmpl $12, %r14d
414 je .L104
415 .L45:
416 addq $1, %r14
417 .L37:
418 btl %r14d, %r13d
419 jc .L105
420 cmpq $6, %r14
421 je .L45
422 movq (%rbx,%r14,8), %rax
423 movq 128(%rbx,%r14,8), %rsi
424 movq %rax, (%r15,%r14,8)
425 leaq _nl_C_name(%rip), %rax
426 cmpq %rax, %rsi
427 jne .L46
428 .L96:
429 movq %rax, 128(%r15,%r14,8)
430 jmp .L44
431 .L102:
432 movl %ebx, %r14d
433 .L29:
434 leal -1(%r14), %r9d
435 movslq %r9d, %rbx
436 jmp .L36
437 .p2align 4,,10
438 .p2align 3
439 .L32:
440 btl %ebx, %r12d
441 jnc .L31
442 movq 0(%r13,%rbx,8), %rsi
443 cmpl $-1, 48(%rsi)
444 je .L31
445 movl %ebx, %edi
446 call _nl_remove_locale
447 .L31:
448 subq $1, %rbx
449 .L36:
450 leal 1(%rbx), %eax
451 testl %eax, %eax
452 jg .L32
453 movl __libc_pthread_functions_init(%rip), %edx
454 testl %edx, %edx
455 je .L97
456 movq 152+__libc_pthread_functions(%rip), %rax
457 leaq __libc_setlocale_lock(%rip), %rdi
458 #APP
459 # 183 "newlocale.c" 1
460 ror $2*8+1, %rax
461 xor %fs:48, %rax
462 # 0 "" 2
463 #NO_APP
464 call *%rax
465 .L97:
466 xorl %r15d, %r15d
467 jmp .L1
468 .L104:
469 movq -432(%rbp), %rbx
470 movq %rbx, %rdi
471 call free@PLT
472 .L40:
473 movl __libc_pthread_functions_init(%rip), %eax
474 testl %eax, %eax
475 je .L13
476 movq 152+__libc_pthread_functions(%rip), %rax
477 leaq __libc_setlocale_lock(%rip), %rdi
478 #APP
479 # 263 "newlocale.c" 1
480 ror $2*8+1, %rax
481 xor %fs:48, %rax
482 # 0 "" 2
483 #NO_APP
484 call *%rax
485 jmp .L13
486 .L103:
487 movq -424(%rbp), %r14
488 movq %rax, %rdi
489 .p2align 4,,10
490 .p2align 3
491 .L39:
492 btl %ebx, %r12d
493 jnc .L38
494 movq (%r14,%rbx,8), %rsi
495 leaq _nl_C_name(%rip), %rax
496 cmpq %rax, %rsi
497 je .L38
498 movq %rdi, 128(%r13,%rbx,8)
499 call __GI_stpcpy@PLT
500 leaq 1(%rax), %rdi
501 .L38:
502 addq $1, %rbx
503 cmpq $13, %rbx
504 jne .L39
505 movdqa -288(%rbp), %xmm0
506 movq -64(%rbp), %rax
507 movups %xmm0, (%r15)
508 movdqa -272(%rbp), %xmm0
509 movq %rax, 224(%r15)
510 movups %xmm0, 16(%r15)
511 movdqa -256(%rbp), %xmm0
512 movups %xmm0, 32(%r15)
513 movdqa -240(%rbp), %xmm0
514 movups %xmm0, 48(%r15)
515 movdqa -224(%rbp), %xmm0
516 movups %xmm0, 64(%r15)
517 movdqa -208(%rbp), %xmm0
518 movups %xmm0, 80(%r15)
519 movdqa -192(%rbp), %xmm0
520 movups %xmm0, 96(%r15)
521 movdqa -176(%rbp), %xmm0
522 movups %xmm0, 112(%r15)
523 movdqa -160(%rbp), %xmm0
524 movups %xmm0, 128(%r15)
525 movdqa -144(%rbp), %xmm0
526 movups %xmm0, 144(%r15)
527 movdqa -128(%rbp), %xmm0
528 movups %xmm0, 160(%r15)
529 movdqa -112(%rbp), %xmm0
530 movups %xmm0, 176(%r15)
531 movdqa -96(%rbp), %xmm0
532 movups %xmm0, 192(%r15)
533 movdqa -80(%rbp), %xmm0
534 movups %xmm0, 208(%r15)
535 jmp .L40
536 .L100:
537 leaq -288(%rbp), %r13
538 movl $58, %ecx
539 movq %rbx, %rsi
540 movq %r13, %rdi
541 rep movsl
542 jmp .L11
543 .size __newlocale, .-__newlocale
544 .weak newlocale
545 .set newlocale,__newlocale
546 .hidden _nl_remove_locale
547 .hidden _nl_find_locale
548 .hidden _nl_C_name
549 .hidden __libc_setlocale_lock
550 .hidden __libc_pthread_functions
551 .hidden __libc_pthread_functions_init
552 .hidden _nl_category_names
553 .hidden _nl_category_name_idxs
554 .hidden _nl_category_name_sizes
555 .hidden __argz_add_sep
556 .hidden _nl_default_locale_path
557 .hidden __argz_create_sep
558 .hidden _nl_C_locobj