// File: /workspace/github_c_makefile_star2_O1/ccxvii[P]mujs/./jsdate.c
// Function: parseDateTime
static double parseDateTime(const char *s)
{
	int y = 1970, m = 1, d = 1, H = 0, M = 0, S = 0, ms = 0;
	int tza = 0;
	double t;

	/* Parse ISO 8601 formatted date and time: */
	/* YYYY("-"MM("-"DD)?)?("T"HH":"mm(":"ss("."sss)?)?("Z"|[+-]HH(":"mm)?)?)? */

	if (!toint(&s, 4, &y)) return NAN;
	if (*s == '-') {
		s += 1;
		if (!toint(&s, 2, &m)) return NAN;
		if (*s == '-') {
			s += 1;
			if (!toint(&s, 2, &d)) return NAN;
		}
	}

	if (*s == 'T') {
		s += 1;
		if (!toint(&s, 2, &H)) return NAN;
		if (*s != ':') return NAN;
		s += 1;
		if (!toint(&s, 2, &M)) return NAN;
		if (*s == ':') {
			s += 1;
			if (!toint(&s, 2, &S)) return NAN;
			if (*s == '.') {
				s += 1;
				if (!toint(&s, 3, &ms)) return NAN;
			}
		}
		if (*s == 'Z') {
			s += 1;
			tza = 0;
		} else if (*s == '+' || *s == '-') {
			int tzh = 0, tzm = 0;
			int tzs = *s == '+' ? 1 : -1;
			s += 1;
			if (!toint(&s, 2, &tzh)) return NAN;
			if (*s == ':') {
				s += 1;
				if (!toint(&s, 2, &tzm)) return NAN;
			}
			if (tzh > 23 || tzm > 59) return NAN;
			tza = tzs * (tzh * msPerHour + tzm * msPerMinute);
		} else {
			tza = LocalTZA();
		}
	}

	if (*s) return NAN;

	if (m < 1 || m > 12) return NAN;
	if (d < 1 || d > 31) return NAN;
	if (H < 0 || H > 24) return NAN;
	if (M < 0 || M > 59) return NAN;
	if (S < 0 || S > 59) return NAN;
	if (ms < 0 || ms > 999) return NAN;
	if (H == 24 && (M != 0 || S != 0 || ms != 0)) return NAN;

	/* TODO: DaylightSavingTA on local times */
	t = MakeDate(MakeDay(y, m-1, d), MakeTime(H, M, S, ms));
	return t - tza;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x4(%rdi), %rax
xorl %edx, %edx
xorl %r14d, %r14d
movb (%rbx,%rdx), %sil
leal -0x3a(%rsi), %ecx
cmpb $-0xa, %cl
jb 0x20e78
leal (%r14,%r14,4), %edi
addb $-0x30, %sil
movzbl %sil, %esi
leal (%rsi,%rdi,2), %r14d
incq %rdx
cmpl $0x4, %edx
jne 0x20e51
movq %rax, %rbx
movsd 0xa5d0(%rip), %xmm2     # 0x2b450
cmpb $-0xa, %cl
jae 0x20e98
movapd %xmm2, %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %r15d
cmpb $0x2d, (%rbx)
jne 0x20f27
leaq 0x1(%rbx), %rax
addq $0x3, %rbx
xorl %edx, %edx
xorl %r12d, %r12d
movb (%rax,%rdx), %sil
leal -0x3a(%rsi), %ecx
cmpb $-0xa, %cl
jb 0x20edb
leal (%r12,%r12,4), %edi
addb $-0x30, %sil
movzbl %sil, %esi
leal (%rsi,%rdi,2), %r12d
incq %rdx
cmpl $0x2, %edx
jne 0x20eb4
movq %rbx, %rax
cmpb $-0xa, %cl
jb 0x20e85
cmpb $0x2d, (%rax)
jne 0x210f1
leaq 0x1(%rax), %rbx
addq $0x3, %rax
xorl %edx, %edx
xorl %r15d, %r15d
movb (%rbx,%rdx), %sil
leal -0x3a(%rsi), %ecx
cmpb $-0xa, %cl
jb 0x20f1d
leal (%r15,%r15,4), %edi
addb $-0x30, %sil
movzbl %sil, %esi
leal (%rsi,%rdi,2), %r15d
incq %rdx
cmpl $0x2, %edx
jne 0x20ef6
movq %rax, %rbx
cmpb $-0xa, %cl
jae 0x20f2d
jmp 0x20e85
movl $0x1, %r12d
xorl %r13d, %r13d
cmpb $0x54, (%rbx)
jne 0x20ffe
leaq 0x1(%rbx), %rax
addq $0x3, %rbx
xorl %edx, %edx
xorl %r13d, %r13d
movb (%rax,%rdx), %sil
leal -0x3a(%rsi), %ecx
cmpb $-0xa, %cl
jb 0x20f6e
leal (%r13,%r13,4), %edi
addb $-0x30, %sil
movzbl %sil, %esi
leal (%rsi,%rdi,2), %r13d
incq %rdx
cmpl $0x2, %edx
jne 0x20f46
movq %rbx, %rax
cmpb $-0xa, %cl
jb 0x20e85
cmpb $0x3a, (%rax)
jne 0x20e85
leaq 0x1(%rax), %rbx
addq $0x3, %rax
xorl %edx, %edx
xorl %ebp, %ebp
movb (%rbx,%rdx), %sil
leal -0x3a(%rsi), %ecx
cmpb $-0xa, %cl
jb 0x20fb2
leal (%rbp,%rbp,4), %edi
addb $-0x30, %sil
movzbl %sil, %esi
leal (%rsi,%rdi,2), %ebp
incq %rdx
cmpl $0x2, %edx
jne 0x20f8c
movq %rax, %rbx
cmpb $-0xa, %cl
jb 0x20e85
cmpb $0x3a, (%rbx)
jne 0x210f9
leaq 0x1(%rbx), %rax
addq $0x3, %rbx
xorl %edx, %edx
xorl %r11d, %r11d
movb (%rax,%rdx), %sil
leal -0x3a(%rsi), %ecx
cmpb $-0xa, %cl
jb 0x211a6
leal (%r11,%r11,4), %edi
addb $-0x30, %sil
movzbl %sil, %esi
leal (%rsi,%rdi,2), %r11d
incq %rdx
cmpl $0x2, %edx
jne 0x20fd1
jmp 0x211a9
xorl %ebp, %ebp
xorl %r11d, %r11d
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpb $0x0, (%rbx)
jne 0x20e85
leal -0xd(%r12), %eax
cmpl $-0xc, %eax
jb 0x20e85
leal -0x20(%r15), %eax
cmpl $-0x1f, %eax
jb 0x20e85
cmpl $0x18, %r13d
ja 0x20e85
cmpl $0x3b, %ebp
ja 0x20e85
cmpl $0x3b, %r11d
ja 0x20e85
cmpl $0x3e7, %r9d            # imm = 0x3E7
ja 0x20e85
cmpl $0x18, %r13d
jne 0x2106b
movl %r11d, %eax
orl %ebp, %eax
orl %r9d, %eax
jne 0x20e85
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
decl %r12d
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r15d, %xmm2
movq %r11, %rbx
movq %r9, %r14
movl %r10d, %r15d
callq 0x20caa
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %ebp, %xmm2
cvtsi2sd %ebx, %xmm3
cvtsi2sd %r14d, %xmm4
movsd 0xa43c(%rip), %xmm5     # 0x2b4f0
mulsd %xmm5, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm5, %xmm1
addsd %xmm3, %xmm1
mulsd 0xa42c(%rip), %xmm1     # 0x2b4f8
movapd %xmm0, %xmm2
addsd %xmm4, %xmm1
mulsd 0xa3e4(%rip), %xmm2     # 0x2b4c0
addsd %xmm1, %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
subsd %xmm0, %xmm2
jmp 0x20e85
movq %rax, %rbx
jmp 0x20f2d
xorl %r11d, %r11d
xorl %r9d, %r9d
movzbl (%rbx), %ecx
cmpl $0x2b, %ecx
je 0x2111d
cmpl $0x2d, %ecx
je 0x2111d
cmpl $0x5a, %ecx
jne 0x21203
incq %rbx
jmp 0x21006
leaq 0x1(%rbx), %rax
addq $0x3, %rbx
xorl %edi, %edi
xorl %edx, %edx
movb (%rax,%rdi), %r8b
leal -0x3a(%r8), %esi
cmpb $-0xa, %sil
jb 0x21151
leal (%rdx,%rdx,4), %edx
addb $-0x30, %r8b
movzbl %r8b, %r8d
leal (%r8,%rdx,2), %edx
incq %rdi
cmpl $0x2, %edi
jne 0x21129
movq %rbx, %rax
xorl %r10d, %r10d
cmpb $-0xa, %sil
jb 0x21287
cmpb $0x3a, (%rax)
jne 0x2122e
movq %r9, %rbx
leaq 0x1(%rax), %r8
addq $0x3, %rax
xorl %r9d, %r9d
xorl %esi, %esi
movb (%r8,%r9), %r10b
leal -0x3a(%r10), %edi
cmpb $-0xa, %dil
jb 0x21232
leal (%rsi,%rsi,4), %esi
addb $-0x30, %r10b
movzbl %r10b, %r10d
leal (%r10,%rsi,2), %esi
incq %r9
cmpl $0x2, %r9d
jne 0x21177
jmp 0x21235
movq %rax, %rbx
cmpb $-0xa, %cl
jb 0x20e85
cmpb $0x2e, (%rbx)
jne 0x210fc
leaq 0x1(%rbx), %rax
leaq 0x4(%rbx), %rcx
xorl %r9d, %r9d
movl $0x1, %esi
movb (%rbx,%rsi), %dil
leal -0x3a(%rdi), %edx
cmpb $-0xa, %dl
jb 0x211f2
leal (%r9,%r9,4), %r8d
addb $-0x30, %dil
movzbl %dil, %edi
leal (%rdi,%r8,2), %r9d
incq %rsi
cmpl $0x4, %esi
jne 0x211cb
movq %rcx, %rax
movq %rax, %rbx
cmpb $-0xa, %dl
jae 0x210ff
jmp 0x20e85
movq %r11, 0x10(%rsp)
movq %r9, 0x8(%rsp)
callq 0x204c6
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %r11
movsd 0xa22c(%rip), %xmm2     # 0x2b450
cvttsd2si %xmm0, %r10d
jmp 0x21009
xorl %esi, %esi
jmp 0x21247
movq %r8, %rax
xorl %r10d, %r10d
movl $0x0, %r8d
cmpb $-0xa, %dil
movq %rbx, %r9
jb 0x2128a
cmpl $0x17, %edx
jg 0x21284
cmpl $0x3b, %esi
jg 0x21284
cvtsi2sd %edx, %xmm0
cvtsi2sd %esi, %xmm1
mulsd 0xa287(%rip), %xmm1     # 0x2b4e8
mulsd 0xa26f(%rip), %xmm0     # 0x2b4d8
addsd %xmm1, %xmm0
cmpb $0x2b, %cl
je 0x2127a
xorpd 0xa186(%rip), %xmm0     # 0x2b400
cvttsd2si %xmm0, %r10d
movb $0x1, %r8b
jmp 0x2128a
xorl %r10d, %r10d
xorl %r8d, %r8d
movq %rax, %rbx
testb %r8b, %r8b
jne 0x21009
jmp 0x20e85