clarify the purpose of this project
[nyanglibc.git] / io / ttyname_r.shared.s
blob612e09ab3b705e8d7ad719478ab2cc8679a21075
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 "stdin"
9 .LC1:
10 .string "stdout"
11 .LC2:
12 .string "stderr"
13 #NO_APP
14 .section .text.compat,"ax",@progbits
15 .p2align 4,,15
16 .type getttyname_r, @function
17 getttyname_r:
18 pushq %r15
19 pushq %r14
20 movq %rdi, %r14
21 pushq %r13
22 pushq %r12
23 movq %r8, %r12
24 pushq %rbp
25 pushq %rbx
26 movq %rdx, %rbp
27 subq $200, %rsp
28 movq %rsi, 16(%rsp)
29 movl %ecx, 44(%rsp)
30 call __GI_strlen
31 movq %r14, %rdi
32 movq %rax, 24(%rsp)
33 call __opendir
34 testq %rax, %rax
35 je .L19
36 movq %rax, %rbx
37 leaq 48(%rsp), %rax
38 leaq .LC0(%rip), %r13
39 leaq .LC1(%rip), %r15
40 movq %rax, 32(%rsp)
41 .p2align 4,,10
42 .p2align 3
43 .L2:
44 movq %rbx, %rdi
45 call __GI___readdir64
46 testq %rax, %rax
47 je .L22
48 movq 8(%rbp), %rcx
49 cmpq %rcx, (%rax)
50 je .L4
51 movl (%r12), %edx
52 testl %edx, %edx
53 je .L2
54 .L4:
55 leaq 19(%rax), %r8
56 movl $6, %ecx
57 movq %r13, %rdi
58 movq %r8, %rsi
59 repz cmpsb
60 je .L2
61 movl $7, %ecx
62 movq %r8, %rsi
63 movq %r15, %rdi
64 repz cmpsb
65 je .L2
66 leaq .LC2(%rip), %rdi
67 movl $7, %ecx
68 movq %r8, %rsi
69 repz cmpsb
70 je .L2
71 movq %r8, %rdi
72 movq %r8, 8(%rsp)
73 call __GI_strlen
74 leaq 1(%rax), %rdx
75 cmpq 16(%rsp), %rdx
76 movq 8(%rsp), %r8
77 ja .L23
78 movq 24(%rsp), %rax
79 movq %r8, %rsi
80 leaq (%r14,%rax), %rdi
81 call __GI___stpncpy
82 movq 32(%rsp), %rsi
83 movb $0, (%rax)
84 movq %r14, %rdi
85 call __GI___stat64
86 testl %eax, %eax
87 movl %eax, %edx
88 jne .L2
89 movq 8(%rbp), %rax
90 cmpq %rax, 56(%rsp)
91 jne .L2
92 movq 0(%rbp), %rax
93 cmpq %rax, 48(%rsp)
94 jne .L2
95 movl 72(%rsp), %eax
96 andl $61440, %eax
97 cmpl $8192, %eax
98 jne .L2
99 movq 40(%rbp), %rax
100 cmpq %rax, 88(%rsp)
101 jne .L2
102 movq %rbx, %rdi
103 movl %edx, 8(%rsp)
104 call __closedir
105 movq __libc_errno@gottpoff(%rip), %rax
106 movl 44(%rsp), %ebx
107 movl 8(%rsp), %edx
108 movl %ebx, %fs:(%rax)
109 jmp .L1
110 .p2align 4,,10
111 .p2align 3
112 .L22:
113 movq %rbx, %rdi
114 call __closedir
115 movq __libc_errno@gottpoff(%rip), %rax
116 movl 44(%rsp), %ebx
117 movl $25, %edx
118 movl %ebx, %fs:(%rax)
119 .L1:
120 addq $200, %rsp
121 movl %edx, %eax
122 popq %rbx
123 popq %rbp
124 popq %r12
125 popq %r13
126 popq %r14
127 popq %r15
129 .p2align 4,,10
130 .p2align 3
131 .L19:
132 movq __libc_errno@gottpoff(%rip), %rax
133 movl $-1, (%r12)
134 movl %fs:(%rax), %edx
135 jmp .L1
136 .L23:
137 movl $-1, (%r12)
138 movq %rbx, %rdi
139 call __closedir
140 movq __libc_errno@gottpoff(%rip), %rax
141 movl $34, %edx
142 movl $34, %fs:(%rax)
143 jmp .L1
144 .size getttyname_r, .-getttyname_r
145 .section .rodata.str1.1
146 .LC3:
147 .string "(unreachable)"
148 .text
149 .p2align 4,,15
150 .globl __ttyname_r
151 .hidden __ttyname_r
152 .type __ttyname_r, @function
153 __ttyname_r:
154 pushq %r15
155 pushq %r14
156 pushq %r13
157 pushq %r12
158 pushq %rbp
159 pushq %rbx
160 subq $424, %rsp
161 testq %rsi, %rsi
162 movl $0, 28(%rsp)
163 je .L59
164 cmpq $9, %rdx
165 jbe .L60
166 movq __libc_errno@gottpoff(%rip), %r13
167 movq %rsi, %rbx
168 leaq 64(%rsp), %rsi
169 movq %rdx, %r12
170 movl %edi, %ebp
171 movl %fs:0(%r13), %r15d
172 call __GI___tcgetattr
173 testl %eax, %eax
174 js .L58
175 leaq 128(%rsp), %r14
176 movl %ebp, %edi
177 movq %r14, %rsi
178 call __GI___fstat64
179 testl %eax, %eax
180 js .L58
181 leaq 32(%rsp), %r8
182 movl $12132, %edx
183 leaq 46(%rsp), %rsi
184 xorl %ecx, %ecx
185 movabsq $7310238724270485551, %rax
186 movw %dx, 44(%rsp)
187 movslq %ebp, %rdi
188 movl $10, %edx
189 movq %r8, 8(%rsp)
190 movq %rax, 32(%rsp)
191 movl $1714382444, 40(%rsp)
192 movb $0, 46(%rsp)
193 call _fitoa_word
194 movq 8(%rsp), %r8
195 leaq -1(%r12), %rdx
196 movb $0, (%rax)
197 movq %rbx, %rsi
198 movq %r8, %rdi
199 call __readlink
200 cmpq $-1, %rax
201 je .L61
202 cmpq $13, %rax
203 movq %rax, %rbp
204 jbe .L35
205 movabsq $7521962890978293032, %rax
206 cmpq %rax, (%rbx)
207 je .L62
208 .L35:
209 movb $0, (%rbx,%rbp)
210 cmpb $47, (%rbx)
211 leaq 272(%rsp), %rdx
212 je .L36
213 .L37:
214 movl $1, %ebp
215 .L32:
216 movabsq $8319397760812278831, %rax
217 movq %rdx, %rsi
218 movq %rbx, %rdi
219 movq %rax, (%rbx)
220 movl $47, %eax
221 movw %ax, 8(%rbx)
222 call __GI___stat64
223 testl %eax, %eax
224 jne .L38
225 movl 296(%rsp), %eax
226 andl $61440, %eax
227 cmpl $16384, %eax
228 je .L63
229 .L38:
230 cmpl $-1, 28(%rsp)
231 movl %r15d, %fs:0(%r13)
232 je .L51
233 leaq 28(%rsp), %r9
234 .L43:
235 subq $5, %r12
236 movq %r9, %r8
237 movb $0, 5(%rbx)
238 movl %r15d, %ecx
239 movq %r14, %rdx
240 movq %r12, %rsi
241 movq %rbx, %rdi
242 movq %r9, 8(%rsp)
243 call getttyname_r
244 cltq
245 movq 8(%rsp), %r9
246 testq %rax, %rax
247 jne .L64
248 .L40:
249 xorl %eax, %eax
250 jmp .L24
251 .p2align 4,,10
252 .p2align 3
253 .L60:
254 movq __libc_errno@gottpoff(%rip), %r13
255 .L31:
256 movl $34, %fs:0(%r13)
257 movl $34, %eax
258 .L24:
259 addq $424, %rsp
260 popq %rbx
261 popq %rbp
262 popq %r12
263 popq %r13
264 popq %r14
265 popq %r15
267 .p2align 4,,10
268 .p2align 3
269 .L58:
270 movl %fs:0(%r13), %eax
271 jmp .L24
272 .p2align 4,,10
273 .p2align 3
274 .L59:
275 movq __libc_errno@gottpoff(%rip), %rax
276 movl $22, %fs:(%rax)
277 movl $22, %eax
278 jmp .L24
279 .p2align 4,,10
280 .p2align 3
281 .L51:
282 movl $1, %edx
283 movl $2, %eax
284 .L41:
285 testl %ebp, %ebp
286 je .L24
287 testb %dl, %dl
288 je .L24
289 movq 168(%rsp), %rdx
290 movq %rdx, %rcx
291 shrq $32, %rdx
292 shrq $8, %rcx
293 andl $-4096, %edx
294 andl $4095, %ecx
295 orl %ecx, %edx
296 subl $136, %edx
297 cmpl $7, %edx
298 ja .L24
299 movl $19, %fs:0(%r13)
300 movl $19, %eax
301 jmp .L24
302 .p2align 4,,10
303 .p2align 3
304 .L61:
305 cmpl $36, %fs:0(%r13)
306 je .L31
307 xorl %ebp, %ebp
308 leaq 272(%rsp), %rdx
309 jmp .L32
310 .p2align 4,,10
311 .p2align 3
312 .L64:
313 cmpl $-1, 28(%rsp)
314 je .L57
315 movb $0, 5(%rbx)
316 movq %r9, %r8
317 movl %r15d, %ecx
318 movq %r14, %rdx
319 movq %r12, %rsi
320 movq %rbx, %rdi
321 movl $1, 28(%rsp)
322 call getttyname_r
323 cltq
324 .L57:
325 testq %rax, %rax
326 setne %dl
327 jmp .L41
328 .p2align 4,,10
329 .p2align 3
330 .L36:
331 movq %rdx, %rsi
332 movq %rbx, %rdi
333 movq %rdx, 8(%rsp)
334 call __GI___stat64
335 testl %eax, %eax
336 movq 8(%rsp), %rdx
337 jne .L37
338 movq 280(%rsp), %rcx
339 cmpq %rcx, 136(%rsp)
340 jne .L37
341 movq 128(%rsp), %rcx
342 cmpq %rcx, 272(%rsp)
343 jne .L37
344 movl 296(%rsp), %ecx
345 andl $61440, %ecx
346 cmpl $8192, %ecx
347 jne .L37
348 movq 168(%rsp), %rcx
349 cmpq %rcx, 312(%rsp)
350 jne .L37
351 jmp .L24
352 .p2align 4,,10
353 .p2align 3
354 .L62:
355 cmpl $1701601889, 8(%rbx)
356 jne .L35
357 cmpb $41, 12(%rbx)
358 jne .L35
359 subq $13, %rbp
360 leaq 13(%rbx), %rsi
361 movq %rbx, %rdi
362 movq %rbp, %rdx
363 call __GI_memmove
364 jmp .L35
365 .p2align 4,,10
366 .p2align 3
367 .L63:
368 leaq 28(%rsp), %r9
369 leaq -9(%r12), %rsi
370 movl %r15d, %ecx
371 movq %r14, %rdx
372 movq %rbx, %rdi
373 movq %r9, %r8
374 movq %r9, 8(%rsp)
375 call getttyname_r
376 cltq
377 movq 8(%rsp), %r9
378 testq %rax, %rax
379 je .L40
380 cmpl $-1, 28(%rsp)
381 je .L57
382 jmp .L43
383 .size __ttyname_r, .-__ttyname_r
384 .weak ttyname_r
385 .set ttyname_r,__ttyname_r
386 .hidden __readlink
387 .hidden _fitoa_word
388 .hidden __closedir
389 .hidden __opendir