// File: /workspace/github_c_makefile_star2_O3/ArtifexSoftware[P]mujs/./jsdtoa.c
// Function: js_strtod
double
js_strtod(const char *string, char **endPtr)
{
	int sign, expSign = FALSE;
	double fraction, dblExp, *d;
	register const char *p;
	register int c;

	/* Exponent read from "EX" field. */
	int exp = 0;

	/* Exponent that derives from the fractional part. Under normal
	 * circumstances, it is the negative of the number of digits in F.
	 * However, if I is very long, the last digits of I get dropped
	 * (otherwise a long I with a large negative exponent could cause an
	 * unnecessary overflow on I alone). In this case, fracExp is
	 * incremented one for each dropped digit.
	 */
	int fracExp = 0;

	/* Number of digits in mantissa. */
	int mantSize;

	/* Number of mantissa digits BEFORE decimal point. */
	int decPt;

	/* Temporarily holds location of exponent in string. */
	const char *pExp;

	/*
	 * Strip off leading blanks and check for a sign.
	 */

	p = string;
	while (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r') {
		p += 1;
	}
	if (*p == '-') {
		sign = TRUE;
		p += 1;
	} else {
		if (*p == '+') {
			p += 1;
		}
		sign = FALSE;
	}

	/*
	 * Count the number of digits in the mantissa (including the decimal
	 * point), and also locate the decimal point.
	 */

	decPt = -1;
	for (mantSize = 0; ; mantSize += 1)
	{
		c = *p;
		if (!(c>='0'&&c<='9')) {
			if ((c != '.') || (decPt >= 0)) {
				break;
			}
			decPt = mantSize;
		}
		p += 1;
	}

	/*
	 * Now suck up the digits in the mantissa. Use two integers to
	 * collect 9 digits each (this is faster than using floating-point).
	 * If the mantissa has more than 18 digits, ignore the extras, since
	 * they can't affect the value anyway.
	 */

	pExp = p;
	p -= mantSize;
	if (decPt < 0) {
		decPt = mantSize;
	} else {
		mantSize -= 1;			/* One of the digits was the point. */
	}
	if (mantSize > 18) {
		fracExp = decPt - 18;
		mantSize = 18;
	} else {
		fracExp = decPt - mantSize;
	}
	if (mantSize == 0) {
		fraction = 0.0;
		p = string;
		goto done;
	} else {
		int frac1, frac2;
		frac1 = 0;
		for ( ; mantSize > 9; mantSize -= 1)
		{
			c = *p;
			p += 1;
			if (c == '.') {
				c = *p;
				p += 1;
			}
			frac1 = 10*frac1 + (c - '0');
		}
		frac2 = 0;
		for (; mantSize > 0; mantSize -= 1)
		{
			c = *p;
			p += 1;
			if (c == '.') {
				c = *p;
				p += 1;
			}
			frac2 = 10*frac2 + (c - '0');
		}
		fraction = (1.0e9 * frac1) + frac2;
	}

	/*
	 * Skim off the exponent.
	 */

	p = pExp;
	if ((*p == 'E') || (*p == 'e')) {
		p += 1;
		if (*p == '-') {
			expSign = TRUE;
			p += 1;
		} else {
			if (*p == '+') {
				p += 1;
			}
			expSign = FALSE;
		}
		while ((*p >= '0') && (*p <= '9') && exp < INT_MAX/100) {
			exp = exp * 10 + (*p - '0');
			p += 1;
		}
		while ((*p >= '0') && (*p <= '9'))
			p += 1;
	}
	if (expSign) {
		exp = fracExp - exp;
	} else {
		exp = fracExp + exp;
	}

	/*
	 * Generate a floating-point number that represents the exponent.
	 * Do this by processing the exponent one bit at a time to combine
	 * many powers of 2 of 10. Then combine the exponent with the
	 * fraction.
	 */

	if (exp < -maxExponent) {
		exp = maxExponent;
		expSign = TRUE;
		errno = ERANGE;
	} else if (exp > maxExponent) {
		exp = maxExponent;
		expSign = FALSE;
		errno = ERANGE;
	} else if (exp < 0) {
		expSign = TRUE;
		exp = -exp;
	} else {
		expSign = FALSE;
	}
	dblExp = 1.0;
	for (d = powersOf10; exp != 0; exp >>= 1, d += 1) {
		if (exp & 01) {
			dblExp *= *d;
		}
	}
	if (expSign) {
		fraction /= dblExp;
	} else {
		fraction *= dblExp;
	}

done:
	if (endPtr != NULL) {
		*endPtr = (char *) p;
	}

	if (sign) {
		return -fraction;
	}
	return fraction;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movabsq $0x100002600, %rax      # imm = 0x100002600
movq %rdi, %rsi
movzbl (%rsi), %r15d
cmpq $0x20, %r15
ja 0xc304
btq %r15, %rax
jae 0xc304
incq %rsi
jmp 0xc2ef
leal -0x2b(%r15), %eax
xorl %edi, %edi
testb $-0x3, %al
sete %dil
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
leaq (%rdi,%rcx), %r8
movzbl (%rsi,%r8), %r9d
leal -0x30(%r9), %edx
cmpb $0xa, %dl
jb 0xc335
cmpl $0x2e, %r9d
jne 0xc33a
testl %eax, %eax
jns 0xc33a
movl %ecx, %eax
incq %rcx
jmp 0xc317
xorl %r10d, %r10d
testl %eax, %eax
setns %r10b
cmovsl %ecx, %eax
movl %r10d, %edx
negl %edx
leaq (%rdx,%rcx), %r12
movl %ecx, %r11d
subl %r10d, %r11d
cmpl $0x13, %r11d
movl $0x12, %ebp
cmovll %ebp, %r11d
testl %r12d, %r12d
je 0xc3c7
addq %rsi, %rdi
cmpl $0x12, %r12d
cmovll %r12d, %ebp
cmpl $0xa, %r12d
jl 0xc3d0
leal (%rdx,%rcx), %r14d
cmpl $0x12, %r14d
movl $0x12, %ebp
cmovll %r14d, %ebp
incl %ebp
xorl %r12d, %r12d
movq %rdi, %r14
movb (%r14), %r13b
cmpb $0x2e, %r13b
jne 0xc3a4
movb 0x1(%r14), %r13b
addq $0x2, %r14
jmp 0xc3a7
incq %r14
movsbl %r13b, %r13d
leal (%r12,%r12,4), %r12d
leal -0x30(%r13,%r12,2), %r12d
decl %ebp
cmpl $0xa, %ebp
jg 0xc391
cvtsi2sd %r12d, %xmm0
movl $0x9, %ebp
jmp 0xc3e0
xorpd %xmm0, %xmm0
jmp 0xc573
xorpd %xmm0, %xmm0
movq %rdi, %r14
xorpd %xmm2, %xmm2
testl %r12d, %r12d
jle 0xc417
incl %ebp
xorl %r12d, %r12d
movb (%r14), %r13b
cmpb $0x2e, %r13b
jne 0xc3f8
movb 0x1(%r14), %r13b
addq $0x2, %r14
jmp 0xc3fb
incq %r14
movsbl %r13b, %r13d
leal (%r12,%r12,4), %r12d
leal -0x30(%r13,%r12,2), %r12d
decl %ebp
cmpl $0x1, %ebp
jg 0xc3e5
xorps %xmm2, %xmm2
cvtsi2sd %r12d, %xmm2
orl $0x20, %r9d
cmpl $0x65, %r9d
jne 0xc437
movzbl 0x1(%rsi,%r8), %r9d
cmpl $0x2b, %r9d
je 0xc44f
cmpl $0x2d, %r9d
jne 0xc45f
xorl %edi, %edi
jmp 0xc452
addl %r10d, %eax
addl %r11d, %eax
subq %rcx, %rax
addq $-0x12, %rax
addq %rcx, %rdi
movq %rdi, %r14
jmp 0xc4d9
movb $0x1, %dil
leaq (%rsi,%r8), %r14
addq $0x2, %r14
movb (%r14), %r9b
jmp 0xc469
leaq (%rsi,%r8), %r14
incq %r14
movb $0x1, %dil
xorl %esi, %esi
cmpb $0x30, %r9b
jl 0xc49d
xorl %esi, %esi
cmpb $0x39, %r9b
ja 0xc49d
cmpl $0x147ae13, %esi        # imm = 0x147AE13
jg 0xc49d
leal (%rsi,%rsi,4), %esi
addb $-0x30, %r9b
movzbl %r9b, %r8d
leal (%r8,%rsi,2), %esi
movb 0x1(%r14), %r9b
incq %r14
cmpb $0x2f, %r9b
jg 0xc473
decq %r14
movb 0x1(%r14), %r8b
incq %r14
addb $-0x30, %r8b
cmpb $0xa, %r8b
jb 0xc4a0
movl %esi, %r8d
negl %r8d
testb %dil, %dil
cmovnel %esi, %r8d
addl %eax, %r8d
leal (%rcx,%rdx), %esi
cmpl $0x13, %esi
movl $0x12, %eax
cmovgel %esi, %eax
addl %r8d, %eax
subl %edx, %eax
subl %ecx, %eax
addl $-0x12, %eax
mulsd 0x1f03f(%rip), %xmm0    # 0x2b520
leal 0x1ff(%rax), %ecx
cmpl $0x3fe, %ecx            # imm = 0x3FE
ja 0xc508
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
testl %eax, %eax
setns %bpl
jne 0xc539
movsd 0x1efb2(%rip), %xmm1    # 0x2b4b8
jmp 0xc560
cmpl $0xfffffe01, %eax       # imm = 0xFFFFFE01
setge %bpl
movapd %xmm0, 0x10(%rsp)
movsd %xmm2, 0x8(%rsp)
callq 0x32d0
movsd 0x8(%rsp), %xmm2
movapd 0x10(%rsp), %xmm0
movl $0x22, (%rax)
movl $0x1ff, %ecx            # imm = 0x1FF
movsd 0x1ef77(%rip), %xmm1    # 0x2b4b8
leaq 0x1f998(%rip), %rax     # 0x2bee0
testb $0x1, %cl
je 0xc551
mulsd (%rax), %xmm1
movl %ecx, %edx
shrl %edx
addq $0x8, %rax
cmpl $0x1, %ecx
movl %edx, %ecx
ja 0xc548
addsd %xmm2, %xmm0
testb %bpl, %bpl
je 0xc56f
mulsd %xmm1, %xmm0
jmp 0xc573
divsd %xmm1, %xmm0
testq %rbx, %rbx
je 0xc57b
movq %r14, (%rbx)
cmpb $0x2d, %r15b
jne 0xc589
xorpd 0x1ee77(%rip), %xmm0    # 0x2b400
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq