// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: SyStrToReal
JX9_PRIVATE sxi32 SyStrToReal(const char *zSrc, sxu32 nLen, void * pOutVal, const char **zRest)
{
#define SXDBL_DIG        15
#define SXDBL_MAX_EXP    308
#define SXDBL_MIN_EXP_PLUS	307
	static const sxreal aTab[] = {
	10, 
	1.0e2, 
	1.0e4, 
	1.0e8, 
	1.0e16, 
	1.0e32, 
	1.0e64, 
	1.0e128, 
	1.0e256
	};
	sxu8 neg = FALSE;
	sxreal Val = 0.0;
	const char *zEnd;
	sxi32 Lim, exp;
	sxreal *p = 0;
#ifdef UNTRUST
	if( SX_EMPTY_STR(zSrc)  ){
		if( pOutVal ){
			*(sxreal *)pOutVal = 0.0;
		}
		return SXERR_EMPTY;
	}
#endif
	zEnd = &zSrc[nLen];
	while( zSrc < zEnd && SyisSpace(zSrc[0]) ){
		zSrc++; 
	}
	if( zSrc < zEnd && (zSrc[0] == '-' || zSrc[0] == '+' ) ){
		neg =  zSrc[0] == '-' ? TRUE : FALSE ;
		zSrc++;
	}
	Lim = SXDBL_DIG ;
	for(;;){
		if(zSrc >= zEnd||!Lim||!SyisDigit(zSrc[0])) break ; Val = Val * 10.0 + (zSrc[0] - '0') ; zSrc++ ; --Lim;
		if(zSrc >= zEnd||!Lim||!SyisDigit(zSrc[0])) break ; Val = Val * 10.0 + (zSrc[0] - '0') ; zSrc++ ; --Lim;
		if(zSrc >= zEnd||!Lim||!SyisDigit(zSrc[0])) break ; Val = Val * 10.0 + (zSrc[0] - '0') ; zSrc++ ; --Lim;
		if(zSrc >= zEnd||!Lim||!SyisDigit(zSrc[0])) break ; Val = Val * 10.0 + (zSrc[0] - '0') ; zSrc++ ; --Lim;
	}
	if( zSrc < zEnd && ( zSrc[0] == '.' || zSrc[0] == ',' ) ){
		sxreal dec = 1.0;
		zSrc++;
		for(;;){
			if(zSrc >= zEnd||!Lim||!SyisDigit(zSrc[0])) break ; Val = Val * 10.0 + (zSrc[0] - '0') ; dec *= 10.0; zSrc++ ;--Lim;
			if(zSrc >= zEnd||!Lim||!SyisDigit(zSrc[0])) break ; Val = Val * 10.0 + (zSrc[0] - '0') ; dec *= 10.0; zSrc++ ;--Lim;
			if(zSrc >= zEnd||!Lim||!SyisDigit(zSrc[0])) break ; Val = Val * 10.0 + (zSrc[0] - '0') ; dec *= 10.0; zSrc++ ;--Lim;
			if(zSrc >= zEnd||!Lim||!SyisDigit(zSrc[0])) break ; Val = Val * 10.0 + (zSrc[0] - '0') ; dec *= 10.0; zSrc++ ;--Lim;
		}
		Val /= dec;
	}
	if( neg == TRUE && Val != 0.0 ) {
		Val = -Val ; 
	}
	if( Lim <= 0 ){
		/* jump overflow digit */
		while( zSrc < zEnd ){
			if( zSrc[0] == 'e' || zSrc[0] == 'E' ){
				break;  
			}
			zSrc++;
		}
	}
	neg = FALSE;
	if( zSrc < zEnd && ( zSrc[0] == 'e' || zSrc[0] == 'E' ) ){
		zSrc++;
		if( zSrc < zEnd && ( zSrc[0] == '-' || zSrc[0] == '+') ){
			neg = zSrc[0] == '-' ? TRUE : FALSE ;
			zSrc++;
		}
		exp = 0;
		while( zSrc < zEnd && SyisDigit(zSrc[0]) && exp < SXDBL_MAX_EXP ){
			exp = exp * 10 + (zSrc[0] - '0');
			zSrc++;
		}
		if( neg  ){
			if( exp > SXDBL_MIN_EXP_PLUS ) exp = SXDBL_MIN_EXP_PLUS ;
		}else if ( exp > SXDBL_MAX_EXP ){
			exp = SXDBL_MAX_EXP; 
		}		
		for( p = (sxreal *)aTab ; exp ; exp >>= 1 , p++ ){
			if( exp & 01 ){
				if( neg ){
					Val /= *p ;
				}else{
					Val *= *p;
				}
			}
		}
	}
	while( zSrc < zEnd && SyisSpace(zSrc[0]) ){
		zSrc++;
	}
	if( zRest ){
		*zRest = zSrc; 
	}
	if( pOutVal ){
		*(sxreal *)pOutVal = Val;
	}
	return zSrc >= zEnd ? SXRET_OK : SXERR_SYNTAX;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, -0x48(%rbp)
movq %rdi, %r14
movl %esi, %r15d
addq %rdi, %r15
testl %esi, %esi
je 0x3f3bd
callq 0xc170
movq (%rax), %rax
movsbq (%r14), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x3f3a4
incq %r14
cmpq %r15, %r14
jb 0x3f38f
jmp 0x3f3bd
movzbl %cl, %eax
cmpl $0x2b, %eax
je 0x3f3b1
cmpl $0x2d, %eax
jne 0x3f3bd
cmpl $0x2d, %eax
sete %r12b
incq %r14
jmp 0x3f3c0
xorl %r12d, %r12d
cmpq %r15, %r14
jae 0x3f4bd
callq 0xc170
movq (%rax), %rcx
xorpd %xmm3, %xmm3
movl $0xf, %ebx
xorl %eax, %eax
movsd 0x3625c(%rip), %xmm0    # 0x75640
movq %r14, %r13
movsbq (%r14,%rax), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x3f7e2
addl $-0x30, %edx
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
leaq (%r14,%rax), %rdx
incq %rdx
cmpq %r15, %rdx
jae 0x3f4cb
movsbq (%rdx), %rsi
testb $0x8, 0x1(%rcx,%rsi,2)
je 0x3f4cb
addl $-0x30, %esi
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
leaq (%r14,%rax), %rdx
addq $0x2, %rdx
cmpq %r15, %rdx
jae 0x3f4d2
movsbq (%rdx), %rsi
testb $0x8, 0x1(%rcx,%rsi,2)
je 0x3f4d2
addl $-0x30, %esi
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
leaq (%r14,%rax), %rdx
addq $0x3, %rdx
cmpq %r15, %rdx
jae 0x3f4de
cmpl $0xc, %eax
je 0x3f4de
movsbq (%rdx), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x3f4de
addl $-0x30, %edx
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
addq $0x4, %r13
addl $-0x4, %ebx
leaq (%rax,%r14), %rdx
addq $0x4, %rdx
cmpq %r15, %rdx
jae 0x3f4e5
leaq 0x4(%rax), %rdx
cmpl $0xb, %eax
movq %rdx, %rax
jne 0x3f3e7
jmp 0x3f4e5
movl $0xf, %ebx
xorpd %xmm3, %xmm3
movq %r14, %r13
jmp 0x3f4e5
movl $0xe, %ebx
jmp 0x3f4d7
movl $0xd, %ebx
subl %eax, %ebx
movq %rdx, %r13
jmp 0x3f4e5
addq $0x3, %r13
addl $-0x3, %ebx
cmpq %r15, %r13
jae 0x3f67e
movzbl (%r13), %eax
orl $0x2, %eax
cmpl $0x2e, %eax
jne 0x3f67e
leaq 0x1(%r13), %r14
movsd 0x3613d(%rip), %xmm0    # 0x75648
cmpq %r15, %r14
jae 0x3f677
testl %ebx, %ebx
je 0x3f677
movapd %xmm3, -0x40(%rbp)
callq 0xc170
movapd -0x40(%rbp), %xmm3
movq (%rax), %rax
movl %ebx, %ecx
leaq -0x1(%rcx), %rdx
leaq -0x2(%rcx), %rsi
leaq -0x3(%rcx), %rdi
addq $-0x4, %rcx
movsd 0x36100(%rip), %xmm0    # 0x75648
xorl %r8d, %r8d
movsd 0x360ed(%rip), %xmm1    # 0x75640
movsbq 0x1(%r13,%r8), %r9
testb $0x8, 0x1(%rax,%r9,2)
je 0x3f7ea
addl $-0x30, %r9d
xorps %xmm2, %xmm2
cvtsi2sd %r9d, %xmm2
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
mulsd %xmm1, %xmm0
leaq 0x1(%r14), %r9
leaq (%r8,%r13), %r11
addq $0x2, %r11
leal -0x1(%rbx), %r10d
cmpq %r15, %r11
jae 0x3f671
cmpl %r8d, %edx
je 0x3f671
movsbq (%r11), %r11
testb $0x8, 0x1(%rax,%r11,2)
je 0x3f671
addl $-0x30, %r11d
xorps %xmm2, %xmm2
cvtsi2sd %r11d, %xmm2
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
mulsd %xmm1, %xmm0
leaq 0x2(%r14), %r9
leaq (%r8,%r13), %r11
addq $0x3, %r11
leal -0x2(%rbx), %r10d
cmpq %r15, %r11
jae 0x3f671
cmpl %r8d, %esi
je 0x3f671
movsbq (%r11), %r11
testb $0x8, 0x1(%rax,%r11,2)
je 0x3f671
addl $-0x30, %r11d
xorps %xmm2, %xmm2
cvtsi2sd %r11d, %xmm2
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
mulsd %xmm1, %xmm0
leaq 0x3(%r14), %r9
leaq (%r8,%r13), %r11
addq $0x4, %r11
leal -0x3(%rbx), %r10d
cmpq %r15, %r11
jae 0x3f671
cmpl %r8d, %edi
je 0x3f671
movsbq (%r11), %r11
testb $0x8, 0x1(%rax,%r11,2)
je 0x3f671
addl $-0x30, %r11d
xorps %xmm2, %xmm2
cvtsi2sd %r11d, %xmm2
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
mulsd %xmm1, %xmm0
addq $0x4, %r14
addl $-0x4, %ebx
leaq (%r8,%r13), %r9
addq $0x5, %r9
cmpq %r15, %r9
jae 0x3f677
leaq 0x4(%r8), %r9
cmpl %r8d, %ecx
movq %r9, %r8
jne 0x3f553
jmp 0x3f677
movq %r9, %r14
movl %r10d, %ebx
divsd %xmm0, %xmm3
movq %r14, %r13
testb %r12b, %r12b
je 0x3f6a8
movapd 0x35f25(%rip), %xmm0    # 0x755b0
xorpd %xmm3, %xmm0
movapd %xmm3, %xmm1
cmpneqsd %xmm0, %xmm1
andpd %xmm1, %xmm0
andnpd %xmm3, %xmm1
orpd %xmm0, %xmm1
movapd %xmm1, %xmm3
testl %ebx, %ebx
jg 0x3f6c3
cmpq %r15, %r13
jae 0x3f6c3
movzbl (%r13), %eax
orl $0x20, %eax
cmpl $0x65, %eax
je 0x3f6c3
incq %r13
jmp 0x3f6ac
cmpq %r15, %r13
jae 0x3f78c
movzbl (%r13), %eax
orl $0x20, %eax
cmpl $0x65, %eax
jne 0x3f78c
leaq 0x1(%r13), %rbx
movb $0x1, %r14b
cmpq %r15, %rbx
jae 0x3f703
movzbl (%rbx), %eax
cmpl $0x2d, %eax
je 0x3f6f6
cmpl $0x2b, %eax
jne 0x3f703
cmpb $0x2d, %al
setne %r14b
addq $0x2, %r13
movq %r13, %rbx
xorl %eax, %eax
cmpq %r15, %rbx
jae 0x3f741
movapd %xmm3, -0x40(%rbp)
callq 0xc170
movapd -0x40(%rbp), %xmm3
movq (%rax), %rcx
xorl %eax, %eax
movsbq (%rbx), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x3f741
cmpl $0x133, %eax            # imm = 0x133
jg 0x3f741
leal (%rax,%rax,4), %eax
leal (%rdx,%rax,2), %eax
addl $-0x30, %eax
incq %rbx
cmpq %r15, %rbx
jb 0x3f71e
testb %r14b, %r14b
je 0x3f74d
movl $0x134, %ecx            # imm = 0x134
jmp 0x3f752
movl $0x133, %ecx            # imm = 0x133
cmpl %ecx, %eax
cmovll %eax, %ecx
testl %ecx, %ecx
je 0x3f789
leaq 0x3546e(%rip), %rax     # 0x74bd0
testb $0x1, %cl
je 0x3f77a
movsd (%rax), %xmm0
testb %r14b, %r14b
je 0x3f776
mulsd %xmm0, %xmm3
jmp 0x3f77a
divsd %xmm0, %xmm3
movl %ecx, %edx
sarl %edx
addq $0x8, %rax
cmpl $0x1, %ecx
movl %edx, %ecx
ja 0x3f762
movq %rbx, %r13
cmpq %r15, %r13
jae 0x3f7c6
movapd %xmm3, -0x40(%rbp)
callq 0xc170
movapd -0x40(%rbp), %xmm3
movq (%rax), %rax
movsbq (%r13), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x3f7c6
incq %r13
cmpq %r15, %r13
jae 0x3f7c6
movsbq (%r13), %rcx
incq %r13
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x3f7b2
movq -0x48(%rbp), %rax
testq %rax, %rax
je 0x3f7d3
movsd %xmm3, (%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq %rax, %r14
jmp 0x3f4c6
leaq (%r8,%r13), %r14
incq %r14
jmp 0x3f677