clarify the purpose of this project
[nyanglibc.git] / stdlib / mblen.s
blob1d7ac46f1c952cdc339cdf875993f9b146a8ad0b
1 .text
2 .p2align 4,,15
3 .globl mblen
4 .type mblen, @function
5 mblen:
6 testq %rdi, %rdi
7 pushq %rbx
8 je .L10
9 xorl %eax, %eax
10 cmpb $0, (%rdi)
11 jne .L11
12 popq %rbx
13 ret
14 .p2align 4,,10
15 .p2align 3
16 .L11:
17 leaq state(%rip), %rcx
18 movq %rsi, %rdx
19 movq %rdi, %rsi
20 xorl %edi, %edi
21 movq $0, state(%rip)
22 call __mbrtowc
23 movl $-1, %edx
24 testl %eax, %eax
25 cmovs %edx, %eax
26 popq %rbx
27 ret
28 .p2align 4,,10
29 .p2align 3
30 .L10:
31 movq _nl_current_LC_CTYPE@gottpoff(%rip), %rax
32 movq %fs:(%rax), %rax
33 movq (%rax), %rbx
34 movq 40(%rbx), %rax
35 testq %rax, %rax
36 je .L12
37 .L4:
38 movq $0, state(%rip)
39 movq (%rax), %rax
40 popq %rbx
41 movl 88(%rax), %eax
42 ret
43 .p2align 4,,10
44 .p2align 3
45 .L12:
46 leaq _nl_C_LC_CTYPE(%rip), %rax
47 cmpq %rax, %rbx
48 je .L6
49 movq %rbx, %rdi
50 call __wcsmbs_load_conv
51 movq 40(%rbx), %rax
52 jmp .L4
53 .L6:
54 leaq __wcsmbs_gconv_fcts_c(%rip), %rax
55 jmp .L4
56 .size mblen, .-mblen
57 .local state
58 .comm state,8,8
59 .hidden __wcsmbs_gconv_fcts_c
60 .hidden __wcsmbs_load_conv
61 .hidden _nl_C_LC_CTYPE
62 .hidden _nl_current_LC_CTYPE
63 .hidden __mbrtowc