clarify the purpose of this project
[nyanglibc.git] / time / getdate.s
blob15a8c133b71242f39ff76edf2a381810c80704f9
1 .text
2 .section .rodata.str1.1,"aMS",@progbits,1
3 .LC0:
4 .string "DATEMSK"
5 .LC1:
6 .string "rce"
7 .text
8 .p2align 4,,15
9 .globl __getdate_r
10 .hidden __getdate_r
11 .type __getdate_r, @function
12 __getdate_r:
13 .LFB74:
14 pushq %rbp
15 movq %rsp, %rbp
16 pushq %r15
17 pushq %r14
18 pushq %r13
19 pushq %r12
20 movq %rdi, %r12
21 pushq %rbx
22 leaq .LC0(%rip), %rdi
23 movq %rsi, %rbx
24 subq $344, %rsp
25 call getenv
26 movq %rax, %r13
27 movl $1, %eax
28 testq %r13, %r13
29 je .L1
30 cmpb $0, 0(%r13)
31 jne .L96
32 .L1:
33 leaq -40(%rbp), %rsp
34 popq %rbx
35 popq %r12
36 popq %r13
37 popq %r14
38 popq %r15
39 popq %rbp
40 ret
41 .p2align 4,,10
42 .p2align 3
43 .L96:
44 leaq -192(%rbp), %rsi
45 movq %r13, %rdi
46 call __stat64
47 testl %eax, %eax
48 js .L52
49 movl -168(%rbp), %edx
50 movl $4, %eax
51 andl $61440, %edx
52 cmpl $32768, %edx
53 jne .L1
54 movl $4, %esi
55 movq %r13, %rdi
56 call __access
57 testl %eax, %eax
58 js .L4
59 leaq .LC1(%rip), %rsi
60 movq %r13, %rdi
61 call _IO_new_fopen@PLT
62 testq %rax, %rax
63 movq %rax, %r14
64 je .L4
65 orl $32768, (%rax)
66 movq __libc_tsd_CTYPE_B@gottpoff(%rip), %rax
67 movq %fs:(%rax), %r15
68 movsbq (%r12), %rax
69 testb $32, 1(%r15,%rax,2)
70 je .L5
71 .p2align 4,,10
72 .p2align 3
73 .L6:
74 addq $1, %r12
75 movsbq (%r12), %rax
76 testb $32, 1(%r15,%rax,2)
77 jne .L6
78 .L5:
79 movq %r12, %rdi
80 call strlen
81 testq %rax, %rax
82 je .L55
83 movsbq -1(%r12,%rax), %rdx
84 leaq -1(%rax), %r13
85 testb $32, 1(%r15,%rdx,2)
86 jne .L8
87 jmp .L55
88 .p2align 4,,10
89 .p2align 3
90 .L10:
91 movsbq -1(%r12,%r13), %rdx
92 leaq -1(%r13), %rcx
93 testb $32, 1(%r15,%rdx,2)
94 je .L9
95 movq %rcx, %r13
96 .L8:
97 testq %r13, %r13
98 jne .L10
99 movl $1, %r15d
100 .L11:
101 addq $30, %r15
102 movq %r12, %rsi
103 movq %r13, %rdx
104 andq $-16, %r15
105 subq %r15, %rsp
106 leaq 15(%rsp), %rcx
107 andq $-16, %rcx
108 movq %rcx, %rdi
109 call memcpy@PLT
110 movq $0, -376(%rbp)
111 movb $0, (%rax,%r13)
112 movq %rax, %r12
113 .L7:
114 leaq -336(%rbp), %rax
115 movq $0, -344(%rbp)
116 movq $0, -336(%rbp)
117 xorl %r15d, %r15d
118 movabsq $-9223372034707292160, %r13
119 movq %rax, -368(%rbp)
120 leaq -344(%rbp), %rax
121 movq %rax, -360(%rbp)
122 jmp .L18
123 .p2align 4,,10
124 .p2align 3
125 .L97:
126 movq -344(%rbp), %rsi
127 leaq -1(%rsi,%rax), %rax
128 cmpb $10, (%rax)
129 jne .L15
130 movb $0, (%rax)
131 movq -344(%rbp), %rsi
132 .L15:
133 movq %r13, (%rbx)
134 movq %r13, 8(%rbx)
135 movq %rbx, %rdx
136 movq %r13, 16(%rbx)
137 movl $-2147483648, 24(%rbx)
138 movq %r12, %rdi
139 movl $-1, 32(%rbx)
140 movq $0, 40(%rbx)
141 movq $0, 48(%rbx)
142 call strptime
143 testq %rax, %rax
144 movq %rax, %r15
145 je .L16
146 cmpb $0, (%rax)
147 je .L17
148 .L16:
149 testb $16, (%r14)
150 jne .L14
151 .L18:
152 movq -368(%rbp), %rsi
153 movq -360(%rbp), %rdi
154 movq %r14, %rdx
155 call __getline
156 testq %rax, %rax
157 jns .L97
158 .L14:
159 movq -376(%rbp), %rdi
160 call free@PLT
161 movq -344(%rbp), %rdi
162 call free@PLT
163 testb $32, (%r14)
164 jne .L47
165 movq %r14, %rdi
166 call _IO_new_fclose@PLT
167 testq %r15, %r15
168 je .L21
169 .L20:
170 cmpb $0, (%r15)
171 jne .L21
172 leaq -256(%rbp), %r13
173 movl $5, %edi
174 movq %r13, %rsi
175 call __clock_gettime
176 movq -256(%rbp), %rax
177 leaq -320(%rbp), %rsi
178 leaq -328(%rbp), %rdi
179 movq %rax, -328(%rbp)
180 call __localtime_r
181 movl 24(%rbx), %r12d
182 xorl %esi, %esi
183 cmpl $6, %r12d
184 ja .L22
185 movabsq $-9223372034707292160, %rax
186 cmpq %rax, 16(%rbx)
187 je .L98
188 .L22:
189 movl 16(%rbx), %edx
190 movl 20(%rbx), %ecx
191 cmpl $11, %edx
192 ja .L24
193 cmpl $-2147483648, 12(%rbx)
194 je .L99
195 .L24:
196 movl 8(%rbx), %eax
197 cmpl $-2147483648, %eax
198 je .L27
199 movl 4(%rbx), %r9d
200 movl (%rbx), %r8d
201 movl %eax, %edi
202 .L28:
203 cmpl $-2147483648, %r9d
204 jne .L31
205 movl $0, 4(%rbx)
206 .L31:
207 cmpl $-2147483648, %r8d
208 jne .L32
209 movl $0, (%rbx)
210 .L32:
211 cmpl $23, %edi
212 ja .L33
213 cmpl $-2147483648, %edx
214 je .L100
215 cmpl $-2147483648, %ecx
216 je .L49
217 .L40:
218 testl %esi, %esi
219 jne .L38
220 movl 16(%rbx), %ecx
221 cmpl $11, %ecx
222 ja .L41
223 movl $1, %eax
224 movl 12(%rbx), %esi
225 salq %cl, %rax
226 testl $2773, %eax
227 jne .L42
228 testl $1320, %eax
229 jne .L43
230 testb $2, %al
231 je .L41
232 testl %esi, %esi
233 jle .L41
234 movl 20(%rbx), %eax
235 leal 1900(%rax), %ecx
236 movl $28, %eax
237 testb $3, %cl
238 jne .L46
239 movl %ecx, %eax
240 movl $100, %edi
241 cltd
242 idivl %edi
243 movl $29, %eax
244 testl %edx, %edx
245 jne .L46
246 movl %ecx, %eax
247 movl $400, %edi
248 cltd
249 idivl %edi
250 cmpl $1, %edx
251 sbbl %eax, %eax
252 notl %eax
253 addl $29, %eax
254 .L46:
255 cmpl %eax, %esi
256 jle .L38
257 .L41:
258 movl $8, %eax
259 jmp .L1
260 .p2align 4,,10
261 .p2align 3
262 .L52:
263 movl $3, %eax
264 jmp .L1
265 .p2align 4,,10
266 .p2align 3
267 .L4:
268 movl $2, %eax
269 jmp .L1
270 .p2align 4,,10
271 .p2align 3
272 .L9:
273 cmpq %r13, %rax
274 jbe .L55
275 leaq 1(%r13), %r15
276 movq %r15, %rdi
277 call __libc_alloca_cutoff
278 testl %eax, %eax
279 jne .L11
280 cmpq $4096, %r15
281 jbe .L11
282 movq %r15, %rdi
283 call malloc@PLT
284 testq %rax, %rax
285 movq %rax, -376(%rbp)
286 je .L101
287 movq -376(%rbp), %r15
288 movq %r12, %rsi
289 movq %r13, %rdx
290 movq %r15, %rdi
291 movq %r15, %r12
292 call memcpy@PLT
293 movb $0, (%r15,%r13)
294 jmp .L7
295 .p2align 4,,10
296 .p2align 3
297 .L21:
298 movl $7, %eax
299 jmp .L1
300 .p2align 4,,10
301 .p2align 3
302 .L55:
303 movq $0, -376(%rbp)
304 jmp .L7
305 .p2align 4,,10
306 .p2align 3
307 .L47:
308 movq %r14, %rdi
309 call _IO_new_fclose@PLT
310 movl $5, %eax
311 jmp .L1
312 .p2align 4,,10
313 .p2align 3
314 .L17:
315 movq -376(%rbp), %rdi
316 call free@PLT
317 movq -344(%rbp), %rdi
318 call free@PLT
319 testb $32, (%r14)
320 jne .L47
321 movq %r14, %rdi
322 call _IO_new_fclose@PLT
323 jmp .L20
324 .L42:
325 subl $1, %esi
326 cmpl $30, %esi
327 ja .L41
328 .L38:
329 movq %rbx, %rdi
330 call mktime
331 movq %rax, %rdx
332 xorl %eax, %eax
333 cmpq $-1, %rdx
334 jne .L1
335 jmp .L41
336 .L33:
337 cmpl $-2147483648, %ecx
338 je .L49
339 .L39:
340 cmpl $-2147483648, %edx
341 jne .L40
342 .L94:
343 movl -304(%rbp), %edx
344 .L37:
345 movl %edx, 16(%rbx)
346 jmp .L40
347 .L27:
348 movabsq $-9223372034707292160, %rax
349 cmpq %rax, (%rbx)
350 je .L29
351 movl 4(%rbx), %r9d
352 movl (%rbx), %r8d
353 .L30:
354 movl $0, 8(%rbx)
355 xorl %edi, %edi
356 xorl %eax, %eax
357 jmp .L28
358 .L49:
359 movl -300(%rbp), %eax
360 movl %eax, 20(%rbx)
361 jmp .L39
362 .L98:
363 cmpl $-2147483648, 12(%rbx)
364 je .L102
365 movl 16(%rbx), %edx
366 movl 20(%rbx), %ecx
367 jmp .L24
368 .L100:
369 cmpl $-2147483648, 12(%rbx)
370 je .L103
371 .L35:
372 cmpl $-2147483648, %ecx
373 jne .L94
374 movl -300(%rbp), %eax
375 movl %eax, 20(%rbx)
376 jmp .L94
377 .L99:
378 cmpl $-2147483648, %ecx
379 je .L104
380 .L25:
381 cmpl $-2147483648, %r12d
382 movl $1, %eax
383 je .L26
384 pxor %xmm0, %xmm0
385 movq %r13, %rdi
386 movq $0, -208(%rbp)
387 movaps %xmm0, -240(%rbp)
388 movl %ecx, -236(%rbp)
389 movl %edx, -240(%rbp)
390 movaps %xmm0, -256(%rbp)
391 movaps %xmm0, -224(%rbp)
392 movl $1, -244(%rbp)
393 call mktime
394 movl %r12d, %ecx
395 subl -232(%rbp), %ecx
396 movl $-1840700269, %edx
397 addl $7, %ecx
398 movl %ecx, %eax
399 imull %edx
400 leal (%rdx,%rcx), %eax
401 movl %ecx, %edx
402 sarl $31, %edx
403 sarl $2, %eax
404 subl %edx, %eax
405 leal 0(,%rax,8), %edx
406 subl %eax, %edx
407 subl %edx, %ecx
408 movl 16(%rbx), %edx
409 leal 1(%rcx), %eax
410 movl 20(%rbx), %ecx
411 .L26:
412 movl %eax, 12(%rbx)
413 movl $1, %esi
414 jmp .L24
415 .L29:
416 movl -312(%rbp), %eax
417 movl -316(%rbp), %r9d
418 movl -320(%rbp), %r8d
419 cmpl $-2147483648, %eax
420 movl %eax, 8(%rbx)
421 movl %r9d, 4(%rbx)
422 movl %r8d, (%rbx)
423 je .L30
424 movl %eax, %edi
425 jmp .L28
426 .p2align 4,,10
427 .p2align 3
428 .L43:
429 subl $1, %esi
430 cmpl $29, %esi
431 ja .L41
432 jmp .L38
433 .L102:
434 movl -300(%rbp), %eax
435 movl -304(%rbp), %edx
436 movl $7, %ecx
437 movl $1, %esi
438 movl %eax, 20(%rbx)
439 movl %r12d, %eax
440 subl -296(%rbp), %eax
441 movl %edx, 16(%rbx)
442 addl $7, %eax
443 cltd
444 idivl %ecx
445 movl -308(%rbp), %eax
446 addl %edx, %eax
447 movl %eax, 12(%rbx)
448 jmp .L22
449 .L104:
450 movl %edx, %ecx
451 subl -304(%rbp), %ecx
452 shrl $31, %ecx
453 addl -300(%rbp), %ecx
454 movl %ecx, 20(%rbx)
455 jmp .L25
456 .L103:
457 cmpl $-2147483648, 24(%rbx)
458 jne .L35
459 subl -312(%rbp), %eax
460 movl -304(%rbp), %edx
461 movl %edx, 16(%rbx)
462 shrl $31, %eax
463 addl -308(%rbp), %eax
464 cmpl $-2147483648, %ecx
465 movl %eax, 12(%rbx)
466 jne .L38
467 movl -300(%rbp), %eax
468 cmpl $-2147483648, %edx
469 movl %eax, 20(%rbx)
470 jne .L38
471 movl $1, %esi
472 jmp .L37
473 .L101:
474 movq %r14, %rdi
475 call _IO_new_fclose@PLT
476 movl $6, %eax
477 jmp .L1
478 .LFE74:
479 .size __getdate_r, .-__getdate_r
480 .weak getdate_r
481 .set getdate_r,__getdate_r
482 .p2align 4,,15
483 .globl getdate
484 .type getdate, @function
485 getdate:
486 .LFB75:
487 leaq tmbuf.10029(%rip), %rsi
488 subq $8, %rsp
489 call __getdate_r
490 testl %eax, %eax
491 leaq tmbuf.10029(%rip), %rdx
492 jne .L111
493 .L105:
494 movq %rdx, %rax
495 addq $8, %rsp
497 .p2align 4,,10
498 .p2align 3
499 .L111:
500 movl %eax, getdate_err(%rip)
501 xorl %edx, %edx
502 jmp .L105
503 .LFE75:
504 .size getdate, .-getdate
505 .local tmbuf.10029
506 .comm tmbuf.10029,56,32
507 .comm getdate_err,4,4
508 .hidden mktime
509 .hidden __libc_alloca_cutoff
510 .hidden __localtime_r
511 .hidden __clock_gettime
512 .hidden __getline
513 .hidden strptime
514 .hidden strlen
515 .hidden __access
516 .hidden __stat64
517 .hidden getenv