// File: /workspace/github_c_makefile_star2_O2/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
movzbl (%rdi), %r15d
cmpq $0x20, %r15
ja 0x92f1
btq %r15, %rax
jae 0x92f1
incq %rdi
jmp 0x92dc
leal -0x2b(%r15), %eax
xorl %r8d, %r8d
testb $-0x3, %al
sete %r8b
pushq $-0x1
popq %rcx
xorl %eax, %eax
leaq (%r8,%rax), %r10
movzbl (%rdi,%r10), %r12d
leal -0x30(%r12), %edx
cmpb $0xa, %dl
jb 0x9322
cmpl $0x2e, %r12d
jne 0x9327
testl %ecx, %ecx
jns 0x9327
movl %eax, %ecx
incq %rax
jmp 0x9303
xorl %r11d, %r11d
testl %ecx, %ecx
setns %r11b
cmovsl %eax, %ecx
movl %r11d, %r9d
negl %r9d
leaq (%r9,%rax), %r13
movl %eax, %esi
subl %r11d, %esi
cmpl $0x13, %esi
pushq $0x12
popq %rdx
cmovll %edx, %esi
testl %r13d, %r13d
je 0x9413
movq %r9, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
addl %ecx, %r11d
addl %esi, %r11d
subq %rax, %r11
addq $-0x12, %r11
leaq (%rdi,%r8), %rbp
leaq (%rax,%rbp), %r14
cmpl $0x12, %r13d
cmovgel %edx, %r13d
xorl %ebx, %ebx
cmpl $0x9, %r13d
jle 0x93ae
movb (%rbp), %r9b
cmpb $0x2e, %r9b
jne 0x9397
movb 0x1(%rbp), %r9b
addq $0x2, %rbp
jmp 0x939a
incq %rbp
movsbl %r9b, %esi
imull $0xa, %ebx, %r9d
leal (%r9,%rsi), %ebx
addl $-0x30, %ebx
decl %r13d
jmp 0x937d
xorl %r9d, %r9d
testl %r13d, %r13d
jle 0x93e1
movb (%rbp), %sil
cmpb $0x2e, %sil
jne 0x93ca
movb 0x1(%rbp), %sil
addq $0x2, %rbp
jmp 0x93cd
incq %rbp
movsbl %sil, %esi
imull $0xa, %r9d, %r9d
addl %esi, %r9d
addl $-0x30, %r9d
decl %r13d
jmp 0x93b1
cvtsi2sd %ebx, %xmm0
orl $0x20, %r12d
cmpl $0x65, %r12d
jne 0x941c
movzbl 0x1(%rdi,%r10), %esi
cmpl $0x2b, %esi
movq 0x10(%rsp), %rbx
je 0x9426
cmpl $0x2d, %esi
jne 0x9433
addq %r8, %rdi
leaq (%rax,%rdi), %r14
addq $0x2, %r14
xorl %edi, %edi
jmp 0x943d
xorpd %xmm0, %xmm0
jmp 0x9565
movq 0x10(%rsp), %rbx
jmp 0x94a9
addq %r8, %rdi
leaq (%rax,%rdi), %r14
addq $0x2, %r14
jmp 0x943a
leaq (%rdi,%r10), %r14
incq %r14
movb $0x1, %dil
decq %r14
xorl %r8d, %r8d
movb 0x1(%r14), %sil
cmpb $0x2f, %sil
jle 0x9470
cmpb $0x39, %sil
ja 0x9470
cmpl $0x147ae13, %r8d        # imm = 0x147AE13
jg 0x9470
imull $0xa, %r8d, %r10d
addb $-0x30, %sil
movzbl %sil, %r8d
addl %r10d, %r8d
incq %r14
jmp 0x9443
movb 0x1(%r14), %sil
incq %r14
addb $-0x30, %sil
cmpb $0xa, %sil
jb 0x9470
movl %r8d, %esi
negl %esi
testb %dil, %dil
cmovnel %r8d, %esi
addl %ecx, %esi
movq 0x8(%rsp), %rdi
leal (%rax,%rdi), %ecx
cmpl $0x13, %ecx
cmovgel %ecx, %edx
addl %esi, %edx
subl %edi, %edx
subl %eax, %edx
addl $-0x12, %edx
movl %edx, %r11d
cvtsi2sd %r9d, %xmm1
mulsd 0x17002(%rip), %xmm0    # 0x204b8
cmpl $0xfffffe00, %r11d      # imm = 0xFFFFFE00
jg 0x94eb
movapd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
callq 0x32d0
movsd 0x8(%rsp), %xmm1
movapd 0x10(%rsp), %xmm0
movl $0x22, (%rax)
movl $0x1ff, %ecx            # imm = 0x1FF
xorl %eax, %eax
jmp 0x952f
cmpl $0x200, %r11d           # imm = 0x200
jl 0x9520
movapd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
callq 0x32d0
movsd 0x8(%rsp), %xmm1
movapd 0x10(%rsp), %xmm0
movl $0x22, (%rax)
movl $0x1ff, %ecx            # imm = 0x1FF
movb $0x1, %al
jmp 0x952f
testl %r11d, %r11d
setns %al
movl %r11d, %ecx
negl %ecx
cmovsl %r11d, %ecx
addsd %xmm1, %xmm0
leaq 0x17976(%rip), %rdx     # 0x20eb0
movsd 0x16ece(%rip), %xmm1    # 0x20410
testl %ecx, %ecx
je 0x9557
testb $0x1, %cl
je 0x954f
mulsd (%rdx), %xmm1
shrl %ecx
addq $0x8, %rdx
jmp 0x9542
testb %al, %al
je 0x9561
mulsd %xmm1, %xmm0
jmp 0x9565
divsd %xmm1, %xmm0
testq %rbx, %rbx
je 0x956d
movq %r14, (%rbx)
cmpb $0x2d, %r15b
jne 0x957b
xorpd 0x17025(%rip), %xmm0    # 0x205a0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq