// File: /workspace/github_c_makefile_star2_O2/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 $0x68, %rsp
movq %rdx, -0x88(%rbp)
movq %rdi, %r14
movl %esi, %ebx
addq %rdi, %rbx
cmpq %rbx, %r14
jae 0x3645e
callq 0xc190
movq (%rax), %rcx
movsbq (%r14), %rax
testb $0x20, 0x1(%rcx,%rax,2)
je 0x36443
incq %r14
jmp 0x36426
movzbl %al, %eax
cmpl $0x2b, %eax
je 0x36450
cmpl $0x2d, %eax
jne 0x3645e
cmpl $0x2d, %eax
sete %al
movl %eax, -0x34(%rbp)
incq %r14
jmp 0x36465
movl $0x0, -0x34(%rbp)
pushq $0xf
popq %rdx
xorpd %xmm2, %xmm2
xorl %r13d, %r13d
movq %r14, %r15
movq %rbx, -0x30(%rbp)
leaq (%r14,%r13), %r12
cmpq %rbx, %r12
jae 0x36578
movq %rdx, %rbx
movapd %xmm2, -0x50(%rbp)
callq 0xc190
movq (%rax), %rax
movsbq (%r12), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x36580
movq %r15, %rsi
addl $-0x30, %ecx
cvtsi2sd %ecx, %xmm0
movapd -0x50(%rbp), %xmm2
movsd 0x2d0fe(%rip), %xmm1    # 0x635b8
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
leaq (%r14,%r13), %r12
incq %r12
pushq $0xe
popq %r15
cmpq -0x30(%rbp), %r12
jae 0x3656e
movsbq (%r12), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x3656e
movq %rbx, %rdx
addl $-0x30, %ecx
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
leaq (%r14,%r13), %r12
addq $0x2, %r12
pushq $0xd
popq %r15
movq -0x30(%rbp), %rbx
cmpq %rbx, %r12
jae 0x36573
movsbq (%r12), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x36573
addl $-0x30, %ecx
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
leaq (%r14,%r13), %r12
addq $0x3, %r12
leal -0x3(%rdx), %r15d
cmpq %rbx, %r12
jae 0x36595
cmpl $0xc, %r13d
je 0x36595
movsbq (%r12), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x3658e
addl $-0x30, %ecx
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movq %rsi, %r15
addq $0x4, %r15
addl $-0x4, %edx
addq $0x4, %r13
jmp 0x36476
subl %r13d, %r15d
jmp 0x36588
subl %r13d, %r15d
jmp 0x36595
movq %r15, %r12
movl %edx, %r15d
jmp 0x36595
movl %ebx, %r15d
movapd -0x50(%rbp), %xmm2
movq -0x30(%rbp), %rbx
jmp 0x36595
movq %rsi, %r12
addq $0x3, %r12
cmpq %rbx, %r12
jae 0x36743
movzbl (%r12), %eax
orl $0x2, %eax
cmpl $0x2e, %eax
jne 0x36743
leaq 0x1(%r12), %rsi
movl %r15d, %eax
leaq -0x3(%rax), %rcx
movq %rcx, -0x68(%rbp)
leaq -0x2(%rax), %rcx
movq %rcx, -0x70(%rbp)
movq %rax, -0x80(%rbp)
decq %rax
movq %rax, -0x78(%rbp)
movsd 0x2cfe6(%rip), %xmm3    # 0x635c0
xorl %r13d, %r13d
leaq (%r12,%r13), %r14
incq %r14
cmpq %rbx, %r14
jae 0x3670d
cmpl %r13d, -0x80(%rbp)
je 0x3670d
movq %rsi, -0x58(%rbp)
movsd %xmm3, -0x60(%rbp)
movapd %xmm2, -0x50(%rbp)
callq 0xc190
movq (%rax), %rcx
movsbq (%r14), %rax
testb $0x8, 0x1(%rcx,%rax,2)
je 0x36715
addl $-0x30, %eax
cvtsi2sd %eax, %xmm0
movapd -0x50(%rbp), %xmm2
movsd 0x2cf88(%rip), %xmm1    # 0x635b8
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd -0x60(%rbp), %xmm3
mulsd %xmm1, %xmm3
leaq (%r12,%r13), %r14
addq $0x2, %r14
leal -0x1(%r15), %eax
cmpq %rbx, %r14
jae 0x36739
cmpl %r13d, -0x78(%rbp)
je 0x36739
movsbq (%r14), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x36724
addl $-0x30, %edx
cvtsi2sd %edx, %xmm0
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
mulsd %xmm1, %xmm3
leaq (%r12,%r13), %r14
addq $0x3, %r14
leal -0x2(%r15), %eax
cmpq %rbx, %r14
movq -0x58(%rbp), %rsi
jae 0x36739
cmpl %r13d, -0x70(%rbp)
je 0x36739
movsbq (%r14), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x3672d
addl $-0x30, %edx
cvtsi2sd %edx, %xmm0
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
mulsd %xmm1, %xmm3
leaq 0x3(%rsi), %rdx
leaq (%r12,%r13), %r14
addq $0x4, %r14
leal -0x3(%r15), %eax
cmpq %rbx, %r14
jae 0x36736
cmpl %r13d, -0x68(%rbp)
je 0x36736
movsbq (%r14), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x36739
addl $-0x30, %edx
cvtsi2sd %edx, %xmm0
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
mulsd %xmm1, %xmm3
addq $0x4, %rsi
addl $-0x4, %r15d
addq $0x4, %r13
jmp 0x365dd
movq %rsi, %r14
movl %r15d, %eax
jmp 0x36739
movl %r15d, %eax
movapd -0x50(%rbp), %xmm2
movsd -0x60(%rbp), %xmm3
jmp 0x36739
movq -0x58(%rbp), %r14
incq %r14
jmp 0x36739
addq $0x2, %rsi
movq %rsi, %r14
jmp 0x36739
movq %rdx, %r14
divsd %xmm3, %xmm2
movq %r14, %r12
movl %eax, %r15d
cmpb $0x0, -0x34(%rbp)
je 0x3676e
movapd 0x2ce9f(%rip), %xmm0    # 0x635f0
xorpd %xmm2, %xmm0
movapd %xmm2, %xmm1
cmpneqsd %xmm0, %xmm1
andpd %xmm1, %xmm0
andnpd %xmm2, %xmm1
orpd %xmm0, %xmm1
movapd %xmm1, %xmm2
testl %r15d, %r15d
jg 0x3678a
jmp 0x36778
incq %r12
cmpq %rbx, %r12
jae 0x3678a
movzbl (%r12), %eax
orl $0x20, %eax
cmpl $0x65, %eax
jne 0x36775
cmpq %rbx, %r12
movapd %xmm2, -0x50(%rbp)
jae 0x3685a
movzbl (%r12), %eax
orl $0x20, %eax
cmpl $0x65, %eax
jne 0x3685a
leaq 0x1(%r12), %rax
movq %rbx, %rcx
movb $0x1, %bl
cmpq %rcx, %rax
jae 0x367d2
movzbl (%rax), %ecx
cmpl $0x2d, %ecx
je 0x367c5
cmpl $0x2b, %ecx
jne 0x367d2
cmpb $0x2d, %cl
setne %bl
addq $0x2, %r12
movq %r12, %rax
xorl %r14d, %r14d
movq %rax, %r12
cmpq -0x30(%rbp), %r12
jae 0x36811
callq 0xc190
movapd -0x50(%rbp), %xmm2
movq (%rax), %rcx
movsbq (%r12), %rax
testb $0x8, 0x1(%rcx,%rax,2)
je 0x36811
cmpl $0x133, %r14d           # imm = 0x133
jg 0x36811
imull $0xa, %r14d, %ecx
leal (%rcx,%rax), %r14d
addl $-0x30, %r14d
incq %r12
jmp 0x367d8
testb %bl, %bl
je 0x3681c
movl $0x134, %eax            # imm = 0x134
jmp 0x36821
movl $0x133, %eax            # imm = 0x133
cmpl %eax, %r14d
cmovll %r14d, %eax
leaq 0x2c391(%rip), %rcx     # 0x62bc0
testl %eax, %eax
je 0x36851
testb $0x1, %al
je 0x36849
movsd (%rcx), %xmm0
testb %bl, %bl
je 0x36845
mulsd %xmm0, %xmm2
jmp 0x36849
divsd %xmm0, %xmm2
sarl %eax
addq $0x8, %rcx
jmp 0x3682f
movapd %xmm2, -0x50(%rbp)
movq -0x30(%rbp), %rbx
cmpq %rbx, %r12
jae 0x36876
callq 0xc190
movq (%rax), %rax
movsbq (%r12), %rcx
incq %r12
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x3685a
movq -0x88(%rbp), %rax
testq %rax, %rax
je 0x3688b
movapd -0x50(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq