// File: /workspace/github_c_makefile_star2_O1/ccxvii[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 0xc5b5
btq %r15, %rax
jae 0xc5b5
incq %rsi
jmp 0xc5a0
leal -0x2b(%r15), %eax
xorl %edi, %edi
testb $-0x3, %al
sete %dil
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %eax, %eax
leaq (%rdi,%rax), %r8
movzbl (%rsi,%r8), %r9d
leal -0x30(%r9), %edx
cmpb $0xa, %dl
jb 0xc5e6
cmpl $0x2e, %r9d
jne 0xc5eb
testl %ecx, %ecx
jns 0xc5eb
movl %eax, %ecx
incq %rax
jmp 0xc5c8
xorl %edx, %edx
testl %ecx, %ecx
cmovsl %eax, %ecx
setns %dl
negl %edx
leaq (%rdx,%rax), %r12
testl %r12d, %r12d
je 0xc6ed
leaq (%rsi,%rdi), %r14
cmpl $0x12, %r12d
movl $0x12, %ebp
movl $0x12, %r10d
cmovll %r12d, %r10d
xorpd %xmm2, %xmm2
movq %r14, %r11
xorpd %xmm0, %xmm0
cmpl $0xa, %r12d
jl 0xc683
leal (%rdx,%rax), %r11d
cmpl $0xa, %r11d
movl $0xa, %r10d
cmovll %r11d, %r10d
cmpl $0x12, %r11d
cmovll %r11d, %ebp
incl %ebp
xorl %r12d, %r12d
movq %r14, %r11
movb (%r11), %r13b
cmpb $0x2e, %r13b
jne 0xc661
movb 0x1(%r11), %r13b
addq $0x2, %r11
jmp 0xc664
incq %r11
movsbl %r13b, %r13d
leal (%r12,%r12,4), %r12d
leal -0x30(%r13,%r12,2), %r12d
decl %ebp
cmpl $0xa, %ebp
jg 0xc64e
decl %r10d
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
testl %r10d, %r10d
jle 0xc6c2
incl %r10d
xorl %r12d, %r12d
movb (%r11), %bpl
cmpb $0x2e, %bpl
jne 0xc6a1
movb 0x1(%r11), %bpl
addq $0x2, %r11
jmp 0xc6a4
incq %r11
movsbl %bpl, %r13d
leal (%r12,%r12,4), %r12d
leal -0x30(%r13,%r12,2), %r12d
decl %r10d
cmpl $0x1, %r10d
jg 0xc68e
xorps %xmm2, %xmm2
cvtsi2sd %r12d, %xmm2
orl $0x20, %r9d
cmpl $0x65, %r9d
jne 0xc6f6
movzbl 0x1(%rsi,%r8), %r9d
cmpl $0x2b, %r9d
je 0xc700
cmpl $0x2d, %r9d
jne 0xc70d
addq %rdi, %rsi
leaq (%rax,%rsi), %r14
addq $0x2, %r14
xorl %esi, %esi
jmp 0xc717
xorpd %xmm0, %xmm0
jmp 0xc846
addq %rax, %r14
xorl %edi, %edi
movb $0x1, %sil
jmp 0xc762
addq %rdi, %rsi
leaq (%rax,%rsi), %r14
addq $0x2, %r14
jmp 0xc714
leaq (%rsi,%r8), %r14
incq %r14
movb $0x1, %sil
movb (%r14), %r8b
xorl %edi, %edi
cmpb $0x30, %r8b
jl 0xc74e
xorl %edi, %edi
cmpb $0x39, %r8b
ja 0xc74e
cmpl $0x147ae13, %edi        # imm = 0x147AE13
jg 0xc74e
leal (%rdi,%rdi,4), %edi
addb $-0x30, %r8b
movsbl %r8b, %r8d
leal (%r8,%rdi,2), %edi
movb 0x1(%r14), %r8b
incq %r14
cmpb $0x2f, %r8b
jg 0xc724
decq %r14
movb 0x1(%r14), %r8b
incq %r14
addb $-0x30, %r8b
cmpb $0xa, %r8b
jb 0xc751
movl %edi, %r8d
negl %r8d
testb %sil, %sil
cmovnel %edi, %r8d
addl %ecx, %r8d
subl %edx, %r8d
leal (%rax,%rdx), %ecx
cmpl $0x13, %ecx
movl $0x12, %edx
cmovgel %ecx, %edx
addl %r8d, %edx
subq %rax, %rdx
addq $-0x12, %rdx
cmpl $0xfffffe00, %edx       # imm = 0xFFFFFE00
jg 0xc7c1
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
xorl %eax, %eax
jmp 0xc801
cmpl $0x200, %edx            # imm = 0x200
jl 0xc7f5
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
movb $0x1, %al
jmp 0xc801
testl %edx, %edx
setns %al
movl %edx, %ecx
negl %ecx
cmovsl %edx, %ecx
mulsd 0x1ed17(%rip), %xmm0    # 0x2b520
movsd 0x1eca7(%rip), %xmm1    # 0x2b4b8
testl %ecx, %ecx
je 0xc834
leaq 0x1f694(%rip), %rdx     # 0x2beb0
testb $0x1, %cl
je 0xc825
mulsd (%rdx), %xmm1
movl %ecx, %esi
shrl %esi
addq $0x8, %rdx
cmpl $0x1, %ecx
movl %esi, %ecx
ja 0xc81c
addsd %xmm2, %xmm0
testb %al, %al
je 0xc842
mulsd %xmm1, %xmm0
jmp 0xc846
divsd %xmm1, %xmm0
testq %rbx, %rbx
je 0xc84e
movq %r14, (%rbx)
cmpb $0x2d, %r15b
jne 0xc85c
xorpd 0x1eba4(%rip), %xmm0    # 0x2b400
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq