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