// File: /workspace/github_c_makefile_star2_O3/ArtifexSoftware[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
leaq 0x4(%rdi), %rax
xorl %ecx, %ecx
movsd 0xa86c(%rip), %xmm2     # 0x2b450
xorl %ebx, %ebx
movb (%rdi,%rcx), %dl
leal -0x3a(%rdx), %esi
cmpb $-0xa, %sil
jb 0x20e5d
leal (%rbx,%rbx,4), %esi
addb $-0x30, %dl
movzbl %dl, %edx
leal (%rdx,%rsi,2), %ebx
incq %rcx
cmpl $0x4, %ecx
jne 0x20be6
movb (%rax), %cl
movl $0x1, %r14d
cmpb $0x2d, %cl
jne 0x20c82
leaq 0x7(%rdi), %rax
xorl %ecx, %ecx
xorl %r15d, %r15d
movb 0x5(%rdi,%rcx), %dl
leal -0x3a(%rdx), %esi
cmpb $-0xa, %sil
jb 0x20e5d
leal (%r15,%r15,4), %esi
addb $-0x30, %dl
movzbl %dl, %edx
leal (%rdx,%rsi,2), %r15d
incq %rcx
cmpl $0x2, %ecx
jne 0x20c20
movb (%rax), %cl
cmpb $0x2d, %cl
jne 0x20c88
leaq 0xa(%rdi), %rax
xorl %ecx, %ecx
xorl %r14d, %r14d
movb 0x8(%rdi,%rcx), %dl
leal -0x3a(%rdx), %esi
cmpb $-0xa, %sil
jb 0x20e5d
leal (%r14,%r14,4), %esi
addb $-0x30, %dl
movzbl %dl, %edx
leal (%rdx,%rsi,2), %r14d
incq %rcx
cmpl $0x2, %ecx
jne 0x20c57
movb (%rax), %cl
jmp 0x20c88
movl $0x1, %r15d
xorl %r12d, %r12d
cmpb $0x54, %cl
jne 0x20d79
xorl %ecx, %ecx
xorl %r12d, %r12d
movb 0x1(%rax,%rcx), %dl
leal -0x3a(%rdx), %esi
cmpb $-0xa, %sil
jb 0x20e5d
leal (%r12,%r12,4), %esi
addb $-0x30, %dl
movzbl %dl, %edx
leal (%rdx,%rsi,2), %r12d
incq %rcx
cmpl $0x2, %ecx
jne 0x20c99
cmpb $0x3a, 0x3(%rax)
jne 0x20e5d
leaq 0x6(%rax), %r11
xorl %ecx, %ecx
xorl %r13d, %r13d
movb 0x4(%rax,%rcx), %dl
leal -0x3a(%rdx), %esi
cmpb $-0xa, %sil
jb 0x20e5d
leal (%r13,%r13,4), %esi
addb $-0x30, %dl
movzbl %dl, %edx
leal (%rdx,%rsi,2), %r13d
incq %rcx
cmpl $0x2, %ecx
jne 0x20cd3
movb (%r11), %cl
cmpb $0x3a, %cl
jne 0x20e70
leaq 0x9(%rax), %r11
xorl %ecx, %ecx
xorl %ebp, %ebp
movb 0x7(%rax,%rcx), %dl
leal -0x3a(%rdx), %esi
cmpb $-0xa, %sil
jb 0x20e5d
leal (%rbp,%rbp,4), %esi
addb $-0x30, %dl
movzbl %dl, %edx
leal (%rdx,%rsi,2), %ebp
incq %rcx
cmpl $0x2, %ecx
jne 0x20d0f
movb (%r11), %cl
cmpb $0x2e, %cl
jne 0x20e72
leaq 0xd(%rax), %r11
xorl %ecx, %ecx
xorl %r10d, %r10d
movb 0xa(%rax,%rcx), %dl
leal -0x3a(%rdx), %esi
cmpb $-0xa, %sil
jb 0x20e5d
leal (%r10,%r10,4), %esi
addb $-0x30, %dl
movzbl %dl, %edx
leal (%rdx,%rsi,2), %r10d
incq %rcx
cmpl $0x3, %ecx
jne 0x20d4a
movb (%r11), %cl
jmp 0x20e75
xorl %r13d, %r13d
xorl %ebp, %ebp
xorl %r10d, %r10d
xorl %ecx, %ecx
cmpb $0x0, (%rax)
jne 0x20e5d
leal -0xd(%r15), %eax
cmpl $-0xc, %eax
jb 0x20e5d
leal -0x20(%r14), %eax
cmpl $-0x1f, %eax
jb 0x20e5d
cmpl $0x18, %r12d
ja 0x20e5d
cmpl $0x3b, %r13d
ja 0x20e5d
cmpl $0x3b, %ebp
ja 0x20e5d
cmpl $0x3e7, %r10d           # imm = 0x3E7
ja 0x20e5d
cmpl $0x18, %r12d
jne 0x20de0
movl %ebp, %eax
orl %r13d, %eax
orl %r10d, %eax
jne 0x20e5d
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
decl %r15d
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r14d, %xmm2
movq %r10, %rbx
movl %ecx, %r14d
callq 0x20a3b
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r13d, %xmm2
cvtsi2sd %ebp, %xmm3
cvtsi2sd %ebx, %xmm4
movsd 0xa6cb(%rip), %xmm5     # 0x2b4f0
mulsd %xmm5, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm5, %xmm1
addsd %xmm3, %xmm1
mulsd 0xa6bb(%rip), %xmm1     # 0x2b4f8
movapd %xmm0, %xmm2
addsd %xmm4, %xmm1
mulsd 0xa673(%rip), %xmm2     # 0x2b4c0
addsd %xmm1, %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
subsd %xmm0, %xmm2
movapd %xmm2, %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
xorl %r10d, %r10d
cmpb $0x2b, %cl
je 0x20e98
movzbl %cl, %eax
cmpl $0x2d, %eax
je 0x20e98
cmpl $0x5a, %eax
jne 0x20f42
incq %r11
xorl %ecx, %ecx
movq %r11, %rax
jmp 0x20d83
leaq 0x3(%r11), %rax
xorl %esi, %esi
xorl %edx, %edx
movb 0x1(%r11,%rsi), %dil
leal -0x3a(%rdi), %r8d
cmpb $-0xa, %r8b
jb 0x20e5d
leal (%rdx,%rdx,4), %edx
addb $-0x30, %dil
movzbl %dil, %edi
leal (%rdi,%rdx,2), %edx
incq %rsi
cmpl $0x2, %esi
jne 0x20ea0
xorl %esi, %esi
cmpb $0x3a, (%rax)
jne 0x20efe
leaq 0x6(%r11), %rax
xorl %edi, %edi
xorl %esi, %esi
movb 0x4(%r11,%rdi), %r8b
leal -0x3a(%r8), %r9d
cmpb $-0xa, %r9b
jb 0x20e5d
leal (%rsi,%rsi,4), %esi
addb $-0x30, %r8b
movzbl %r8b, %r8d
leal (%r8,%rsi,2), %esi
incq %rdi
cmpl $0x2, %edi
jne 0x20ed4
cmpl $0x17, %edx
jg 0x20e5d
cmpl $0x3b, %esi
jg 0x20e5d
cvtsi2sd %edx, %xmm0
cvtsi2sd %esi, %xmm1
mulsd 0xa5c8(%rip), %xmm1     # 0x2b4e8
mulsd 0xa5b0(%rip), %xmm0     # 0x2b4d8
addsd %xmm1, %xmm0
cmpb $0x2b, %cl
je 0x20f39
xorpd 0xa4c7(%rip), %xmm0     # 0x2b400
cvttsd2si %xmm0, %ecx
jmp 0x20d83
movq %r10, 0x10(%rsp)
movq %r11, 0x8(%rsp)
callq 0x20256
movq 0x10(%rsp), %r10
movsd 0xa4f2(%rip), %xmm2     # 0x2b450
cvttsd2si %xmm0, %ecx
movq 0x8(%rsp), %rax
jmp 0x20d83