clarify the purpose of this project
[nyanglibc.git] / stdio-common / tempname.shared.s
blobd242fc7b77f4046fde7a58b396faa20bea9bcd1f
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 #NO_APP
7 .p2align 4,,15
8 .type try_nocreate, @function
9 try_nocreate:
10 .LFB69:
11 .cfi_startproc
12 subq $152, %rsp
13 .cfi_def_cfa_offset 160
14 movq %rsp, %rsi
15 call __GI___lstat64
16 testl %eax, %eax
17 movq __libc_errno@gottpoff(%rip), %rax
18 je .L2
19 movl %fs:(%rax), %edx
20 cmpl $75, %edx
21 je .L2
22 xorl %eax, %eax
23 cmpl $2, %edx
24 setne %al
25 addq $152, %rsp
26 .cfi_remember_state
27 .cfi_def_cfa_offset 8
28 negl %eax
29 ret
30 .p2align 4,,10
31 .p2align 3
32 .L2:
33 .cfi_restore_state
34 movl $17, %fs:(%rax)
35 movl $-1, %eax
36 addq $152, %rsp
37 .cfi_def_cfa_offset 8
38 ret
39 .cfi_endproc
40 .LFE69:
41 .size try_nocreate, .-try_nocreate
42 .p2align 4,,15
43 .type try_dir, @function
44 try_dir:
45 .LFB68:
46 .cfi_startproc
47 movl $448, %esi
48 jmp __GI___mkdir
49 .cfi_endproc
50 .LFE68:
51 .size try_dir, .-try_dir
52 .p2align 4,,15
53 .type try_file, @function
54 try_file:
55 .LFB67:
56 .cfi_startproc
57 movl (%rsi), %esi
58 movl $384, %edx
59 xorl %eax, %eax
60 andb $60, %sil
61 orb $-62, %sil
62 jmp __GI___open
63 .cfi_endproc
64 .LFE67:
65 .size try_file, .-try_file
66 .section .rodata.str1.1,"aMS",@progbits,1
67 .LC0:
68 .string "file"
69 .LC1:
70 .string "/tmp"
71 .LC2:
72 .string "TMPDIR"
73 .LC3:
74 .string "%.*s/%.*sXXXXXX"
75 .text
76 .p2align 4,,15
77 .globl __path_search
78 .hidden __path_search
79 .type __path_search, @function
80 __path_search:
81 .LFB66:
82 .cfi_startproc
83 pushq %r15
84 .cfi_def_cfa_offset 16
85 .cfi_offset 15, -16
86 pushq %r14
87 .cfi_def_cfa_offset 24
88 .cfi_offset 14, -24
89 pushq %r13
90 .cfi_def_cfa_offset 32
91 .cfi_offset 13, -32
92 pushq %r12
93 .cfi_def_cfa_offset 40
94 .cfi_offset 12, -40
95 movq %rdi, %r13
96 pushq %rbp
97 .cfi_def_cfa_offset 48
98 .cfi_offset 6, -48
99 pushq %rbx
100 .cfi_def_cfa_offset 56
101 .cfi_offset 3, -56
102 movq %rsi, %r12
103 movq %rdx, %rbx
104 subq $168, %rsp
105 .cfi_def_cfa_offset 224
106 testq %rcx, %rcx
107 je .L33
108 cmpb $0, (%rcx)
109 movq %rcx, %r14
110 jne .L46
111 .L33:
112 testl %r8d, %r8d
113 movl $4, %ebp
114 leaq .LC0(%rip), %r14
115 jne .L47
116 .L16:
117 testq %rbx, %rbx
118 je .L48
119 .L19:
120 movq %rbx, %rdi
121 call __GI_strlen
122 cmpq $1, %rax
123 jbe .L34
124 cmpb $47, -1(%rbx,%rax)
125 leaq -1(%rax), %rdx
126 je .L29
127 jmp .L34
128 .p2align 4,,10
129 .p2align 3
130 .L30:
131 cmpb $47, -1(%rbx,%rdx)
132 leaq -1(%rdx), %rdi
133 jne .L28
134 movq %rdi, %rdx
135 .L29:
136 cmpq $1, %rdx
137 jne .L30
138 .L28:
139 leaq 8(%rbp,%rdx), %rax
140 cmpq %r12, %rax
141 ja .L49
142 leaq .LC3(%rip), %rsi
143 movq %r14, %r9
144 movl %ebp, %r8d
145 movq %rbx, %rcx
146 movq %r13, %rdi
147 xorl %eax, %eax
148 call __GI_sprintf
149 xorl %eax, %eax
150 .L14:
151 addq $168, %rsp
152 .cfi_remember_state
153 .cfi_def_cfa_offset 56
154 popq %rbx
155 .cfi_def_cfa_offset 48
156 popq %rbp
157 .cfi_def_cfa_offset 40
158 popq %r12
159 .cfi_def_cfa_offset 32
160 popq %r13
161 .cfi_def_cfa_offset 24
162 popq %r14
163 .cfi_def_cfa_offset 16
164 popq %r15
165 .cfi_def_cfa_offset 8
167 .p2align 4,,10
168 .p2align 3
169 .L46:
170 .cfi_restore_state
171 movq %rcx, %rdi
172 movl %r8d, 8(%rsp)
173 movl $5, %ebp
174 call __GI_strlen
175 movl 8(%rsp), %r8d
176 cmpq $5, %rax
177 cmovbe %rax, %rbp
178 testl %r8d, %r8d
179 je .L16
180 .L47:
181 leaq .LC2(%rip), %rdi
182 leaq 16(%rsp), %r15
183 call __GI___libc_secure_getenv
184 testq %rax, %rax
185 je .L17
186 movq %r15, %rsi
187 movq %rax, %rdi
188 movq %rax, 8(%rsp)
189 call __GI___stat64
190 testl %eax, %eax
191 jne .L17
192 movl 40(%rsp), %eax
193 movq 8(%rsp), %rdx
194 andl $61440, %eax
195 cmpl $16384, %eax
196 je .L50
197 .p2align 4,,10
198 .p2align 3
199 .L17:
200 testq %rbx, %rbx
201 je .L21
202 movq %r15, %rsi
203 movq %rbx, %rdi
204 call __GI___stat64
205 testl %eax, %eax
206 jne .L21
207 movl 40(%rsp), %eax
208 andl $61440, %eax
209 cmpl $16384, %eax
210 jne .L21
211 jmp .L19
212 .p2align 4,,10
213 .p2align 3
214 .L48:
215 leaq 16(%rsp), %r15
216 .L21:
217 leaq .LC1(%rip), %rdi
218 movq %r15, %rsi
219 call __GI___stat64
220 testl %eax, %eax
221 jne .L25
222 movl 40(%rsp), %eax
223 leaq .LC1(%rip), %rbx
224 movl $4, %edx
225 andl $61440, %eax
226 cmpl $16384, %eax
227 je .L28
228 .L25:
229 movq __libc_errno@gottpoff(%rip), %rax
230 movl $2, %fs:(%rax)
231 movl $-1, %eax
232 jmp .L14
233 .p2align 4,,10
234 .p2align 3
235 .L34:
236 movq %rax, %rdx
237 jmp .L28
238 .L50:
239 movq %rdx, %rbx
240 jmp .L19
241 .L49:
242 movq __libc_errno@gottpoff(%rip), %rax
243 movl $22, %fs:(%rax)
244 movl $-1, %eax
245 jmp .L14
246 .cfi_endproc
247 .LFE66:
248 .size __path_search, .-__path_search
249 .section .rodata.str1.1
250 .LC4:
251 .string "X"
252 .text
253 .p2align 4,,15
254 .globl __gen_tempname
255 .hidden __gen_tempname
256 .type __gen_tempname, @function
257 __gen_tempname:
258 .LFB72:
259 .cfi_startproc
260 pushq %r15
261 .cfi_def_cfa_offset 16
262 .cfi_offset 15, -16
263 pushq %r14
264 .cfi_def_cfa_offset 24
265 .cfi_offset 14, -24
266 movslq %ecx, %rax
267 pushq %r13
268 .cfi_def_cfa_offset 32
269 .cfi_offset 13, -32
270 pushq %r12
271 .cfi_def_cfa_offset 40
272 .cfi_offset 12, -40
273 movq %rdi, %r15
274 pushq %rbp
275 .cfi_def_cfa_offset 48
276 .cfi_offset 6, -48
277 pushq %rbx
278 .cfi_def_cfa_offset 56
279 .cfi_offset 3, -56
280 movslq %esi, %rbx
281 subq $104, %rsp
282 .cfi_def_cfa_offset 160
283 movl %edx, 60(%rsp)
284 leaq tryfunc.8750(%rip), %rdx
285 leaq 64(%rsp), %rcx
286 movq %rdi, 24(%rsp)
287 movq (%rdx,%rax,8), %rsi
288 movq __libc_errno@gottpoff(%rip), %rax
289 shrq $4, %rcx
290 movq %rcx, %r14
291 movq %rcx, 64(%rsp)
292 movl %fs:(%rax), %eax
293 movq %rsi, 16(%rsp)
294 movl %eax, 44(%rsp)
295 leaq try_nocreate(%rip), %rax
296 cmpq %rax, %rsi
297 sete %r9b
298 movb %r9b, 8(%rsp)
299 call __GI_strlen
300 leaq 6(%rbx), %rdx
301 cmpq %rdx, %rax
302 jb .L52
303 subq %rbx, %rax
304 leaq .LC4(%rip), %rsi
305 leaq -6(%r15,%rax), %rax
306 movq %rax, %rdi
307 movq %rax, (%rsp)
308 call __GI_strspn
309 cmpq $5, %rax
310 movzbl 8(%rsp), %r9d
311 jbe .L52
312 leaq 60(%rsp), %rax
313 leaq letters(%rip), %r15
314 movl $238328, 40(%rsp)
315 xorl %r8d, %r8d
316 movabsq $-821457390474406913, %rbp
317 movabsq $2862933555777941757, %r13
318 movq %rax, 32(%rsp)
319 movl $3037000493, %r12d
320 .p2align 4,,10
321 .p2align 3
322 .L53:
323 xorl %ebx, %ebx
324 jmp .L60
325 .p2align 4,,10
326 .p2align 3
327 .L71:
328 subl $1, %r8d
329 .L56:
330 movq %r14, %rdx
331 movabsq $-8925843906633654007, %rax
332 movq %r14, %rcx
333 shrq %rdx
334 movq (%rsp), %rdi
335 mulq %rdx
336 shrq $4, %rdx
337 movq %rdx, %rax
338 movq %rdx, %r14
339 movq %rdx, 64(%rsp)
340 salq $5, %rax
341 subq %rdx, %rax
342 addq %rax, %rax
343 subq %rax, %rcx
344 movzbl (%r15,%rcx), %eax
345 movb %al, (%rdi,%rbx)
346 addq $1, %rbx
347 cmpq $6, %rbx
348 je .L70
349 .L60:
350 testl %r8d, %r8d
351 jne .L71
352 testb %r9b, %r9b
353 jne .L59
354 .L57:
355 leaq 80(%rsp), %rsi
356 movl $1, %edi
357 call __GI___clock_gettime
358 movq 88(%rsp), %rcx
359 xorq %r14, %rcx
360 imulq %r13, %rcx
361 leaq (%rcx,%r12), %r14
362 cmpq %rbp, %r14
363 movq %r14, 64(%rsp)
364 jbe .L72
365 .L59:
366 leaq 72(%rsp), %rdi
367 movl $1, %edx
368 movl $8, %esi
369 call __GI___getrandom
370 cmpq $8, %rax
371 jne .L57
372 movq 72(%rsp), %r14
373 cmpq %rbp, %r14
374 movq %r14, 64(%rsp)
375 ja .L59
376 .p2align 4,,10
377 .p2align 3
378 .L72:
379 movl $9, %r8d
380 movl $1, %r9d
381 jmp .L56
382 .p2align 4,,10
383 .p2align 3
384 .L70:
385 movb %r9b, 15(%rsp)
386 movl %r8d, 8(%rsp)
387 movq 32(%rsp), %rsi
388 movq 24(%rsp), %rdi
389 movq 16(%rsp), %rax
390 call *%rax
391 testl %eax, %eax
392 movl 8(%rsp), %r8d
393 movzbl 15(%rsp), %r9d
394 jns .L73
395 movq __libc_errno@gottpoff(%rip), %rax
396 cmpl $17, %fs:(%rax)
397 jne .L64
398 subl $1, 40(%rsp)
399 jne .L53
400 .L64:
401 movl $-1, %eax
402 .L51:
403 addq $104, %rsp
404 .cfi_remember_state
405 .cfi_def_cfa_offset 56
406 popq %rbx
407 .cfi_def_cfa_offset 48
408 popq %rbp
409 .cfi_def_cfa_offset 40
410 popq %r12
411 .cfi_def_cfa_offset 32
412 popq %r13
413 .cfi_def_cfa_offset 24
414 popq %r14
415 .cfi_def_cfa_offset 16
416 popq %r15
417 .cfi_def_cfa_offset 8
419 .L73:
420 .cfi_restore_state
421 movq __libc_errno@gottpoff(%rip), %rbx
422 movl 44(%rsp), %esi
423 movl %esi, %fs:(%rbx)
424 addq $104, %rsp
425 .cfi_remember_state
426 .cfi_def_cfa_offset 56
427 popq %rbx
428 .cfi_def_cfa_offset 48
429 popq %rbp
430 .cfi_def_cfa_offset 40
431 popq %r12
432 .cfi_def_cfa_offset 32
433 popq %r13
434 .cfi_def_cfa_offset 24
435 popq %r14
436 .cfi_def_cfa_offset 16
437 popq %r15
438 .cfi_def_cfa_offset 8
440 .L52:
441 .cfi_restore_state
442 movq __libc_errno@gottpoff(%rip), %rax
443 movl $22, %fs:(%rax)
444 movl $-1, %eax
445 jmp .L51
446 .cfi_endproc
447 .LFE72:
448 .size __gen_tempname, .-__gen_tempname
449 .section .data.rel.ro.local,"aw",@progbits
450 .align 16
451 .type tryfunc.8750, @object
452 .size tryfunc.8750, 24
453 tryfunc.8750:
454 .quad try_file
455 .quad try_dir
456 .quad try_nocreate
457 .section .rodata.str1.32,"aMS",@progbits,1
458 .align 32
459 .type letters, @object
460 .size letters, 63
461 letters:
462 .string "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"