clarify the purpose of this project
[nyanglibc.git] / stdlib / xpg_basename.s
blob75462ba253856a9598cec2f7540f105ccb1e8c8e
1 .text
2 .section .rodata.str1.1,"aMS",@progbits,1
3 .LC0:
4 .string "."
5 .text
6 .p2align 4,,15
7 .globl __xpg_basename
8 .type __xpg_basename, @function
9 __xpg_basename:
10 testq %rdi, %rdi
11 leaq .LC0(%rip), %rax
12 je .L20
13 cmpb $0, (%rdi)
14 je .L20
15 pushq %rbx
16 movl $47, %esi
17 movq %rdi, %rbx
18 call strrchr
19 testq %rax, %rax
20 je .L12
21 cmpb $0, 1(%rax)
22 jne .L3
23 cmpq %rax, %rbx
24 jb .L24
25 jmp .L1
26 .p2align 4,,10
27 .p2align 3
28 .L26:
29 subq $1, %rax
30 cmpq %rax, %rbx
31 je .L23
32 .L24:
33 cmpb $47, -1(%rax)
34 je .L26
35 movq %rax, %rdx
36 subq $1, %rax
37 cmpq %rax, %rbx
38 movb $0, (%rdx)
39 jnb .L1
40 cmpb $47, -2(%rdx)
41 jne .L8
42 jmp .L1
43 .p2align 4,,10
44 .p2align 3
45 .L27:
46 cmpb $47, -1(%rax)
47 je .L1
48 .L8:
49 subq $1, %rax
50 cmpq %rax, %rbx
51 jne .L27
52 .L1:
53 popq %rbx
54 ret
55 .p2align 4,,10
56 .p2align 3
57 .L20:
58 rep ret
59 .p2align 4,,10
60 .p2align 3
61 .L3:
62 addq $1, %rax
63 popq %rbx
64 ret
65 .p2align 4,,10
66 .p2align 3
67 .L7:
68 addq $1, %rax
69 .L23:
70 cmpb $0, 1(%rax)
71 jne .L7
72 popq %rbx
73 ret
74 .p2align 4,,10
75 .p2align 3
76 .L12:
77 movq %rbx, %rax
78 popq %rbx
79 ret
80 .size __xpg_basename, .-__xpg_basename
81 .hidden strrchr