clarify the purpose of this project
[nyanglibc.git] / io / getdirname.s
blobacc5d2d1b9331ed16baddcd41b286ea7dfa263cc
1 .text
2 .section .rodata.str1.1,"aMS",@progbits,1
3 .LC0:
4 .string "PWD"
5 .LC1:
6 .string "."
7 .text
8 .p2align 4,,15
9 .globl get_current_dir_name
10 .type get_current_dir_name, @function
11 get_current_dir_name:
12 pushq %rbx
13 leaq .LC0(%rip), %rdi
14 subq $288, %rsp
15 call getenv
16 testq %rax, %rax
17 je .L2
18 leaq .LC1(%rip), %rdi
19 movq %rsp, %rsi
20 movq %rax, %rbx
21 call __stat64
22 testl %eax, %eax
23 je .L9
24 .L2:
25 xorl %esi, %esi
26 xorl %edi, %edi
27 call __getcwd
28 .L1:
29 addq $288, %rsp
30 popq %rbx
31 ret
32 .p2align 4,,10
33 .p2align 3
34 .L9:
35 leaq 144(%rsp), %rsi
36 movq %rbx, %rdi
37 call __stat64
38 testl %eax, %eax
39 jne .L2
40 movq (%rsp), %rax
41 cmpq %rax, 144(%rsp)
42 jne .L2
43 movq 8(%rsp), %rax
44 cmpq %rax, 152(%rsp)
45 jne .L2
46 movq %rbx, %rdi
47 call __strdup
48 jmp .L1
49 .size get_current_dir_name, .-get_current_dir_name
50 .hidden __strdup
51 .hidden __getcwd
52 .hidden __stat64
53 .hidden getenv