clarify the purpose of this project
[nyanglibc.git] / time / mktime.s
blobb098af1ca81185b2d745b8b482fe66ae69926039
1 .text
2 .p2align 4,,15
3 .type ydhms_diff, @function
4 ydhms_diff:
5 movq %rdi, %r10
6 pushq %r14
7 xorl %eax, %eax
8 sarq $2, %r10
9 pushq %r13
10 pushq %r12
11 addl $475, %r10d
12 pushq %rbp
13 testb $3, %dil
14 pushq %rbx
15 movslq %r9d, %rbx
16 sete %al
17 movq %rbx, %r12
18 subl %eax, %r10d
19 xorl %eax, %eax
20 sarq $2, %r12
21 movl %r10d, %r13d
22 movslq %edx, %r11
23 addl $475, %r12d
24 andl $3, %r9d
25 movl $1374389535, %r9d
26 sete %al
27 shrl $31, %r13d
28 subq %rbx, %rdi
29 leal 0(%r13,%r10), %r14d
30 subl %eax, %r12d
31 movslq %ecx, %rcx
32 subl %r12d, %r10d
33 movslq %r8d, %r8
34 movl %r14d, %eax
35 sarl $31, %r14d
36 imull %r9d
37 sarl $3, %edx
38 movl %edx, %ebp
39 subl %r14d, %ebp
40 subl %r13d, %ebp
41 movl %r12d, %r13d
42 shrl $31, %r13d
43 leal 0(%r13,%r12), %r14d
44 movl %r14d, %eax
45 sarl $31, %r14d
46 imull %r9d
47 movl %ebp, %eax
48 movl %edx, %r9d
49 movslq 56(%rsp), %rdx
50 sarl $3, %r9d
51 subl %r14d, %r9d
52 subl %r13d, %r9d
53 subl %r9d, %eax
54 movslq %r9d, %r9
55 subl %eax, %r10d
56 sarq $2, %r9
57 movl %r10d, %eax
58 movslq %ebp, %r10
59 sarq $2, %r10
60 subl %r9d, %r10d
61 addl %eax, %r10d
62 leaq (%rdi,%rdi,8), %rax
63 movslq %r10d, %r10
64 leaq (%rdi,%rax,8), %rax
65 leaq (%rax,%rax,4), %rax
66 addq %rax, %rsi
67 movslq 48(%rsp), %rax
68 subq %rax, %rsi
69 addq %r10, %rsi
70 leaq (%rsi,%rsi,2), %rax
71 leaq (%r11,%rax,8), %rax
72 subq %rdx, %rax
73 movq %rax, %rdx
74 salq $4, %rdx
75 subq %rax, %rdx
76 leaq (%rcx,%rdx,4), %rax
77 movslq 64(%rsp), %rdx
78 subq %rdx, %rax
79 movq %rax, %rdx
80 salq $4, %rdx
81 subq %rax, %rdx
82 leaq (%r8,%rdx,4), %rax
83 movslq 72(%rsp), %rdx
84 popq %rbx
85 popq %rbp
86 popq %r12
87 subq %rdx, %rax
88 popq %r13
89 popq %r14
90 ret
91 .size ydhms_diff, .-ydhms_diff
92 .p2align 4,,15
93 .type ranged_convert, @function
94 ranged_convert:
95 pushq %r15
96 pushq %r14
97 movq %rdx, %r15
98 pushq %r13
99 pushq %r12
100 movq %rsi, %r14
101 pushq %rbp
102 pushq %rbx
103 movq %rdi, %rbx
104 subq $104, %rsp
105 movq (%rsi), %r13
106 leaq 88(%rsp), %rbp
107 movq %rsi, 72(%rsp)
108 movq %rdx, %rsi
109 movq %r13, 88(%rsp)
110 movq %rbp, %rdi
111 call *%rbx
112 testq %rax, %rax
113 movq %rax, 16(%rsp)
114 je .L5
115 movq %r13, (%r14)
116 .L4:
117 movq 16(%rsp), %rax
118 addq $104, %rsp
119 popq %rbx
120 popq %rbp
121 popq %r12
122 popq %r13
123 popq %r14
124 popq %r15
126 .p2align 4,,10
127 .p2align 3
128 .L5:
129 movq __libc_errno@gottpoff(%rip), %rax
130 xorl %r14d, %r14d
131 movl $-1, 12(%rsp)
132 cmpl $75, %fs:(%rax)
133 jne .L4
134 .p2align 4,,10
135 .p2align 3
136 .L7:
137 movq %r14, %r12
138 movq %r13, %rax
139 sarq %r12
140 sarq %rax
141 addq %r12, %rax
142 movq %r13, %r12
143 orq %r14, %r12
144 andl $1, %r12d
145 addq %rax, %r12
146 cmpq %r12, %r14
147 je .L8
148 cmpq %r12, %r13
149 je .L8
150 movq %r12, 88(%rsp)
151 movq %r15, %rsi
152 movq %rbp, %rdi
153 call *%rbx
154 testq %rax, %rax
155 je .L9
156 movl (%r15), %eax
157 movq %r12, %r14
158 movl %eax, 12(%rsp)
159 movl 4(%r15), %eax
160 movl %eax, 32(%rsp)
161 movl 8(%r15), %eax
162 movl %eax, 36(%rsp)
163 movl 12(%r15), %eax
164 movl %eax, 40(%rsp)
165 movl 16(%r15), %eax
166 movl %eax, 68(%rsp)
167 movl 20(%r15), %eax
168 movl %eax, 64(%rsp)
169 movl 24(%r15), %eax
170 movl %eax, 44(%rsp)
171 movl 28(%r15), %eax
172 movl %eax, 24(%rsp)
173 movl 32(%r15), %eax
174 movl %eax, 28(%rsp)
175 movq 40(%r15), %rax
176 movq %rax, 48(%rsp)
177 movq 48(%r15), %rax
178 movq %rax, 56(%rsp)
179 jmp .L7
180 .p2align 4,,10
181 .p2align 3
182 .L9:
183 movq __libc_errno@gottpoff(%rip), %rax
184 cmpl $75, %fs:(%rax)
185 jne .L4
186 movq %r12, %r13
187 jmp .L7
188 .p2align 4,,10
189 .p2align 3
190 .L8:
191 movl 12(%rsp), %eax
192 testl %eax, %eax
193 js .L4
194 movq 72(%rsp), %rcx
195 movq %r15, 16(%rsp)
196 movq %r14, (%rcx)
197 movl %eax, (%r15)
198 movl 32(%rsp), %eax
199 movl %eax, 4(%r15)
200 movl 36(%rsp), %eax
201 movl %eax, 8(%r15)
202 movl 40(%rsp), %eax
203 movl %eax, 12(%r15)
204 movl 68(%rsp), %eax
205 movl %eax, 16(%r15)
206 movl 64(%rsp), %eax
207 movl %eax, 20(%r15)
208 movl 44(%rsp), %eax
209 movl %eax, 24(%r15)
210 movl 24(%rsp), %eax
211 movl %eax, 28(%r15)
212 movl 28(%rsp), %eax
213 movl %eax, 32(%r15)
214 movq 48(%rsp), %rax
215 movq %rax, 40(%r15)
216 movq 56(%rsp), %rax
217 movq %rax, 48(%r15)
218 jmp .L4
219 .size ranged_convert, .-ranged_convert
220 .p2align 4,,15
221 .globl __mktime_internal
222 .hidden __mktime_internal
223 .type __mktime_internal, @function
224 __mktime_internal:
225 pushq %r15
226 pushq %r14
227 pushq %r13
228 pushq %r12
229 movq %rdi, %r13
230 pushq %rbp
231 pushq %rbx
232 subq $280, %rsp
233 movl (%rdi), %eax
234 movq %rsi, 32(%rsp)
235 movslq 12(%rdi), %rsi
236 movq %rdx, 56(%rsp)
237 movl $715827883, %edx
238 movl %eax, 52(%rsp)
239 movl 4(%rdi), %eax
240 movl %eax, 8(%rsp)
241 movl 8(%rdi), %eax
242 movl 16(%rdi), %edi
243 movl %eax, 12(%rsp)
244 movl 32(%r13), %eax
245 movl %eax, 72(%rsp)
246 movl %edi, %eax
247 imull %edx
248 movl %edi, %eax
249 sarl $31, %eax
250 sarl %edx
251 movl %edx, %ecx
252 subl %eax, %ecx
253 leal (%rcx,%rcx,2), %edx
254 movl %ecx, %eax
255 movl %edi, %ecx
256 sall $2, %edx
257 subl %edx, %ecx
258 movslq 20(%r13), %rdx
259 movl %ecx, %edi
260 shrl $31, %edi
261 subl %edi, %eax
262 cltq
263 leaq (%rax,%rdx), %r15
264 xorl %eax, %eax
265 testb $3, %r15b
266 jne .L16
267 movq %r15, %rax
268 movabsq $-6640827866535438581, %rdx
269 imulq %rdx
270 movq %r15, %rax
271 sarq $63, %rax
272 addq %r15, %rdx
273 sarq $6, %rdx
274 subq %rax, %rdx
275 leaq (%rdx,%rdx,4), %rax
276 leaq (%rax,%rax,4), %r8
277 movl $1, %eax
278 salq $2, %r8
279 cmpq %r8, %r15
280 je .L62
281 .L16:
282 leal (%rdi,%rdi), %edx
283 movl 52(%rsp), %ebx
284 movl $70, %r9d
285 addl %edx, %edi
286 leal (%rcx,%rdi,4), %edx
287 leaq (%rax,%rax), %rcx
288 movq %r15, %rdi
289 addq %rax, %rcx
290 movslq %edx, %rdx
291 leaq (%rax,%rcx,4), %rax
292 addq %rdx, %rax
293 leaq __mon_yday(%rip), %rdx
294 movzwl (%rdx,%rax,2), %eax
295 movl $0, %edx
296 subl $1, %eax
297 cltq
298 addq %rax, %rsi
299 cmpl $59, %ebx
300 movl $59, %eax
301 cmovle %ebx, %eax
302 movq %rsi, 24(%rsp)
303 movl $6, %ebx
304 testl %eax, %eax
305 cmovns %eax, %edx
306 movq 56(%rsp), %rax
307 xorl %r14d, %r14d
308 movl %edx, 48(%rsp)
309 movl %edx, %r8d
310 movq (%rax), %rax
311 movq %rax, 16(%rsp)
312 movl 16(%rsp), %eax
313 negl %eax
314 movl %eax, 76(%rsp)
315 pushq %rax
316 pushq $0
317 pushq $0
318 pushq $0
319 movl 40(%rsp), %ecx
320 movl 44(%rsp), %edx
321 call ydhms_diff
322 addq $32, %rsp
323 movq %rax, %r12
324 movq %rax, 80(%rsp)
325 movq %rax, 120(%rsp)
326 movq %rax, %rbp
327 leaq 144(%rsp), %rax
328 movq %r13, 64(%rsp)
329 movq %rax, 16(%rsp)
330 leaq 120(%rsp), %rax
331 movq %rax, 40(%rsp)
332 .L24:
333 movq 16(%rsp), %rdx
334 movq 40(%rsp), %rsi
335 movq 32(%rsp), %rdi
336 call ranged_convert
337 testq %rax, %rax
338 je .L28
339 movl 144(%rsp), %r13d
340 movq %r15, %rdi
341 pushq %r13
342 movl 156(%rsp), %eax
343 pushq %rax
344 movl 168(%rsp), %eax
345 pushq %rax
346 movl 196(%rsp), %eax
347 pushq %rax
348 movl 196(%rsp), %r9d
349 movl 80(%rsp), %r8d
350 movl 40(%rsp), %ecx
351 movl 44(%rsp), %edx
352 movq 56(%rsp), %rsi
353 call ydhms_diff
354 addq $32, %rsp
355 testq %rax, %rax
356 movq 120(%rsp), %rdx
357 je .L19
358 cmpq %rdx, %r12
359 jne .L20
360 cmpq %rdx, %rbp
361 jne .L63
362 .L20:
363 subl $1, %ebx
364 je .L33
365 addq %rdx, %rax
366 xorl %r14d, %r14d
367 movq %rbp, %r12
368 movq %rax, 120(%rsp)
369 movl 176(%rsp), %eax
370 movq %rdx, %rbp
371 testl %eax, %eax
372 setne %r14b
373 jmp .L24
374 .p2align 4,,10
375 .p2align 3
376 .L63:
377 movl 176(%rsp), %edi
378 testl %edi, %edi
379 js .L60
380 movl 72(%rsp), %esi
381 setne %cl
382 testl %esi, %esi
383 js .L64
384 setne %sil
385 cmpb %cl, %sil
386 je .L20
387 .L60:
388 movl %r13d, %r14d
389 movq 64(%rsp), %r13
390 .L21:
391 movq %rdx, %rax
392 movslq 76(%rsp), %rcx
393 subq 80(%rsp), %rax
394 movq 56(%rsp), %rsi
395 subq %rcx, %rax
396 movq %rax, (%rsi)
397 movl 52(%rsp), %esi
398 cmpl %r14d, %esi
399 je .L35
400 testl %esi, %esi
401 setle %cl
402 xorl %eax, %eax
403 cmpl $60, %r14d
404 sete %al
405 andq %rcx, %rax
406 movslq 48(%rsp), %rcx
407 subq %rcx, %rax
408 movq %rax, %rcx
409 movslq %esi, %rax
410 addq %rcx, %rax
411 addq %rax, %rdx
412 movq %rdx, 120(%rsp)
413 jo .L33
414 movq %rdx, 208(%rsp)
415 leaq 208(%rsp), %rdi
416 movq 16(%rsp), %rsi
417 movq 32(%rsp), %rax
418 call *%rax
419 testq %rax, %rax
420 je .L28
421 movq 120(%rsp), %rdx
422 .L35:
423 movdqa 144(%rsp), %xmm0
424 movq 192(%rsp), %rax
425 movups %xmm0, 0(%r13)
426 movdqa 160(%rsp), %xmm0
427 movq %rax, 48(%r13)
428 movups %xmm0, 16(%r13)
429 movdqa 176(%rsp), %xmm0
430 movups %xmm0, 32(%r13)
431 jmp .L15
432 .p2align 4,,10
433 .p2align 3
434 .L33:
435 movq __libc_errno@gottpoff(%rip), %rax
436 movq $-1, %rdx
437 movl $75, %fs:(%rax)
438 .L15:
439 addq $280, %rsp
440 movq %rdx, %rax
441 popq %rbx
442 popq %rbp
443 popq %r12
444 popq %r13
445 popq %r14
446 popq %r15
448 .p2align 4,,10
449 .p2align 3
450 .L62:
451 andl $3, %edx
452 xorl %eax, %eax
453 cmpq $1, %rdx
454 sete %al
455 jmp .L16
456 .p2align 4,,10
457 .p2align 3
458 .L64:
459 movzbl %cl, %ecx
460 cmpl %r14d, %ecx
461 jl .L20
462 jmp .L60
463 .p2align 4,,10
464 .p2align 3
465 .L19:
466 movl 72(%rsp), %edi
467 movl 176(%rsp), %eax
468 movl %r13d, %r14d
469 movq 64(%rsp), %r13
470 testl %edi, %edi
471 sete 72(%rsp)
472 movzbl 72(%rsp), %ebx
473 testl %eax, %eax
474 sete %cl
475 cmpb %cl, %bl
476 je .L21
477 testl %edi, %edi
478 js .L21
479 testl %eax, %eax
480 js .L21
481 leaq 208(%rsp), %rax
482 movq %r13, 104(%rsp)
483 movq 32(%rsp), %r13
484 movl $601200, %ebp
485 movq %r15, 96(%rsp)
486 movq %rax, 64(%rsp)
487 leaq 128(%rsp), %rax
488 movq %rax, 88(%rsp)
489 .p2align 4,,10
490 .p2align 3
491 .L34:
492 leaq 136(%rsp), %r12
493 movl %ebp, %ebx
494 leal (%rbp,%rbp), %r15d
495 negl %ebx
496 movl $2, %r14d
497 movl %r14d, %eax
498 movq %r12, 40(%rsp)
499 movl %ebx, %r12d
500 movl %r15d, %r14d
501 movq %rdx, %rbx
502 movl %eax, %r15d
503 movslq %r12d, %rax
504 addq %rax, %rbx
505 movq %rbx, 128(%rsp)
506 jno .L65
507 .L27:
508 addl %r14d, %r12d
509 cmpl $1, %r15d
510 je .L31
511 movq 120(%rsp), %rbx
512 movslq %r12d, %rax
513 movl $1, %r15d
514 addq %rax, %rbx
515 movq %rbx, 128(%rsp)
516 jo .L27
517 .L65:
518 movq 64(%rsp), %rdx
519 movq 88(%rsp), %rsi
520 movq %r13, %rdi
521 call ranged_convert
522 testq %rax, %rax
523 je .L28
524 movl 240(%rsp), %eax
525 testl %eax, %eax
526 sete %dl
527 cmpb %dl, 72(%rsp)
528 je .L29
529 testl %eax, %eax
530 jns .L27
531 .L29:
532 movl 208(%rsp), %eax
533 pushq %rax
534 movl 220(%rsp), %eax
535 pushq %rax
536 movl 232(%rsp), %eax
537 pushq %rax
538 movl 260(%rsp), %eax
539 pushq %rax
540 movl 260(%rsp), %r9d
541 movl 80(%rsp), %r8d
542 movl 40(%rsp), %ecx
543 movl 44(%rsp), %edx
544 movq 56(%rsp), %rsi
545 movq 128(%rsp), %rdi
546 call ydhms_diff
547 addq $32, %rsp
548 addq 128(%rsp), %rax
549 movq 16(%rsp), %rsi
550 movq 40(%rsp), %rdi
551 movq %rax, %rbx
552 movq %rax, 136(%rsp)
553 call *%r13
554 testq %rax, %rax
555 jne .L66
556 movq __libc_errno@gottpoff(%rip), %rax
557 cmpl $75, %fs:(%rax)
558 je .L27
559 .p2align 4,,10
560 .p2align 3
561 .L28:
562 movq $-1, %rdx
563 jmp .L15
564 .p2align 4,,10
565 .p2align 3
566 .L31:
567 addl $601200, %ebp
568 cmpl $269337600, %ebp
569 je .L33
570 movq 120(%rsp), %rdx
571 jmp .L34
572 .L66:
573 movq %rbx, %rdx
574 movq 104(%rsp), %r13
575 movl 144(%rsp), %r14d
576 jmp .L21
577 .size __mktime_internal, .-__mktime_internal
578 .p2align 4,,15
579 .globl mktime
580 .hidden mktime
581 .type mktime, @function
582 mktime:
583 pushq %rbx
584 movq %rdi, %rbx
585 call __tzset
586 movq %rbx, %rdi
587 leaq localtime_offset.4532(%rip), %rdx
588 leaq __localtime_r(%rip), %rsi
589 popq %rbx
590 jmp __mktime_internal
591 .size mktime, .-mktime
592 .weak timelocal
593 .hidden timelocal
594 .set timelocal,mktime
595 .local localtime_offset.4532
596 .comm localtime_offset.4532,8,8
597 .hidden __mon_yday
598 .globl __mon_yday
599 .section .rodata
600 .align 32
601 .type __mon_yday, @object
602 .size __mon_yday, 52
603 __mon_yday:
604 .value 0
605 .value 31
606 .value 59
607 .value 90
608 .value 120
609 .value 151
610 .value 181
611 .value 212
612 .value 243
613 .value 273
614 .value 304
615 .value 334
616 .value 365
617 .value 0
618 .value 31
619 .value 60
620 .value 91
621 .value 121
622 .value 152
623 .value 182
624 .value 213
625 .value 244
626 .value 274
627 .value 305
628 .value 335
629 .value 366
630 .hidden __localtime_r
631 .hidden __tzset