// File: /workspace/github_c_makefile_star2_O0/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
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x51(%rbp)
jae 0x6f28c
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x6f295
jmp 0x6f2a3
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x6f259
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f2e8
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x6f2c5
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x6f2e8
movq -0x8(%rbp), %rax
movsbl (%rax), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x2d, %edx
cmovel %ecx, %eax
movb %al, -0x21(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl $0xf, -0x3c(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f31f
cmpl $0x0, -0x3c(%rbp)
je 0x6f31f
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x6f324
jmp 0x6f4b9
movsd -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
cvtsi2sd %eax, %xmm1
movsd 0x527c1(%rip), %xmm2    # 0xc1b00
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f391
cmpl $0x0, -0x3c(%rbp)
je 0x6f391
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x6f396
jmp 0x6f4b9
movsd -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
cvtsi2sd %eax, %xmm1
movsd 0x5274f(%rip), %xmm2    # 0xc1b00
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f403
cmpl $0x0, -0x3c(%rbp)
je 0x6f403
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x6f408
jmp 0x6f4b9
movsd -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
cvtsi2sd %eax, %xmm1
movsd 0x526dd(%rip), %xmm2    # 0xc1b00
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f475
cmpl $0x0, -0x3c(%rbp)
je 0x6f475
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x6f477
jmp 0x6f4b9
movsd -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
cvtsi2sd %eax, %xmm1
movsd 0x5266e(%rip), %xmm2    # 0xc1b00
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x6f2ef
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f721
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0x6f4e3
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
jne 0x6f721
movsd 0x5261d(%rip), %xmm0    # 0xc1b08
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f52c
cmpl $0x0, -0x3c(%rbp)
je 0x6f52c
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x6f531
jmp 0x6f70e
movsd -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
cvtsi2sd %eax, %xmm1
movsd 0x525b4(%rip), %xmm2    # 0xc1b00
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x5259f(%rip), %xmm0    # 0xc1b00
mulsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f5b0
cmpl $0x0, -0x3c(%rbp)
je 0x6f5b0
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x6f5b5
jmp 0x6f70e
movsd -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
cvtsi2sd %eax, %xmm1
movsd 0x52530(%rip), %xmm2    # 0xc1b00
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x5251b(%rip), %xmm0    # 0xc1b00
mulsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f634
cmpl $0x0, -0x3c(%rbp)
je 0x6f634
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x6f639
jmp 0x6f70e
movsd -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
cvtsi2sd %eax, %xmm1
movsd 0x524ac(%rip), %xmm2    # 0xc1b00
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x52497(%rip), %xmm0    # 0xc1b00
mulsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f6b8
cmpl $0x0, -0x3c(%rbp)
je 0x6f6b8
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x6f6ba
jmp 0x6f70e
movsd -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
cvtsi2sd %eax, %xmm1
movsd 0x5242b(%rip), %xmm2    # 0xc1b00
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x52416(%rip), %xmm0    # 0xc1b00
mulsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x6f4fc
movsd -0x50(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x1, %eax
jne 0x6f75d
movsd -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x6f73c
jp 0x6f73c
jmp 0x6f75d
movsd -0x30(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x30(%rbp)
cmpl $0x0, -0x3c(%rbp)
jg 0x6f799
jmp 0x6f765
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f797
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x65, %eax
je 0x6f787
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x45, %eax
jne 0x6f789
jmp 0x6f797
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x6f765
jmp 0x6f799
movb $0x0, -0x21(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f91d
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x65, %eax
je 0x6f7c7
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x45, %eax
jne 0x6f91d
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x6f818
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x6f7f5
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x6f818
movq -0x8(%rbp), %rax
movsbl (%rax), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x2d, %edx
cmovel %ecx, %eax
movb %al, -0x21(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x52(%rbp)
jae 0x6f861
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x800, %ecx            # imm = 0x800
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x52(%rbp)
je 0x6f861
cmpl $0x134, -0x40(%rbp)     # imm = 0x134
setl %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0x6f86a
jmp 0x6f88b
imull $0xa, -0x40(%rbp), %eax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
subl $0x30, %ecx
addl %ecx, %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x6f81f
cmpb $0x0, -0x21(%rbp)
je 0x6f8a3
cmpl $0x133, -0x40(%rbp)     # imm = 0x133
jle 0x6f8a1
movl $0x133, -0x40(%rbp)     # imm = 0x133
jmp 0x6f8b5
cmpl $0x134, -0x40(%rbp)     # imm = 0x134
jle 0x6f8b3
movl $0x134, -0x40(%rbp)     # imm = 0x134
jmp 0x6f8b5
leaq 0x51924(%rip), %rax     # 0xc11e0
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x40(%rbp)
je 0x6f91b
movl -0x40(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x6f903
cmpb $0x0, -0x21(%rbp)
je 0x6f8ef
movq -0x48(%rbp), %rax
movsd (%rax), %xmm1
movsd -0x30(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x6f901
movq -0x48(%rbp), %rax
movsd (%rax), %xmm0
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x6f903
jmp 0x6f905
movl -0x40(%rbp), %eax
sarl %eax
movl %eax, -0x40(%rbp)
movq -0x48(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x48(%rbp)
jmp 0x6f8c0
jmp 0x6f91d
jmp 0x6f91f
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x53(%rbp)
jae 0x6f952
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x53(%rbp)
movb -0x53(%rbp), %al
testb $0x1, %al
jne 0x6f95b
jmp 0x6f969
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x6f91f
cmpq $0x0, -0x20(%rbp)
je 0x6f97b
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x18(%rbp)
je 0x6f98f
movsd -0x30(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x8(%rbp), %rdx
movq -0x38(%rbp), %rsi
movl $0xfffffff4, %eax       # imm = 0xFFFFFFF4
xorl %ecx, %ecx
cmpq %rsi, %rdx
cmovael %ecx, %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)