// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: SyStrToInt64
JX9_PRIVATE sxi32 SyStrToInt64(const char *zSrc, sxu32 nLen, void * pOutVal, const char **zRest)
{
	int isNeg = FALSE;
	const char *zEnd;
	sxi64 nVal;
	sxi16 i;
#if defined(UNTRUST)
	if( SX_EMPTY_STR(zSrc) ){
		if( pOutVal ){
			*(sxi32 *)pOutVal = 0;
		}
		return SXERR_EMPTY;
	}
#endif
	zEnd = &zSrc[nLen];
	while(zSrc < zEnd && SyisSpace(zSrc[0]) ){
		zSrc++;
	}
	if( zSrc < zEnd && ( zSrc[0] == '-' || zSrc[0] == '+' ) ){
		isNeg = (zSrc[0] == '-') ? TRUE :FALSE;
		zSrc++;
	}
	/* Skip leading zero */
	while(zSrc < zEnd && zSrc[0] == '0' ){
		zSrc++;
	}
	i = 19;
	if( (sxu32)(zEnd-zSrc) >= 19 ){
		i = SyMemcmp(zSrc, isNeg ? SXINT64_MIN_STR : SXINT64_MAX_STR, 19) <= 0 ? 19 : 18 ;
	}
	nVal = 0;
	for(;;){
		if(zSrc >= zEnd || !i || !SyisDigit(zSrc[0])){ break; } nVal = nVal * 10 + ( zSrc[0] - '0' ) ; --i ; zSrc++;
		if(zSrc >= zEnd || !i || !SyisDigit(zSrc[0])){ break; } nVal = nVal * 10 + ( zSrc[0] - '0' ) ; --i ; zSrc++;
		if(zSrc >= zEnd || !i || !SyisDigit(zSrc[0])){ break; } nVal = nVal * 10 + ( zSrc[0] - '0' ) ; --i ; zSrc++;
		if(zSrc >= zEnd || !i || !SyisDigit(zSrc[0])){ break; } nVal = nVal * 10 + ( zSrc[0] - '0' ) ; --i ; zSrc++;
	}
	/* Skip trailing spaces */
	while(zSrc < zEnd && SyisSpace(zSrc[0])){
		zSrc++;
	}
	if( zRest ){
		*zRest = (char *)zSrc;
	}	
	if( pOutVal ){
		if( isNeg == TRUE && nVal != 0 ){
			nVal = -nVal;
		}
		*(sxi64 *)pOutVal = nVal;
	}
	return (zSrc >= zEnd) ? SXRET_OK : SXERR_SYNTAX;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %esi, %r14d
movq %rdi, %r15
movl %esi, %r13d
addq %rdi, %r13
movq %rdi, %r12
movq %rdx, -0x48(%rbp)
cmpq %r13, %r12
jae 0x37bf2
callq 0xc190
movq (%rax), %rcx
movsbq (%r12), %rax
testb $0x20, 0x1(%rcx,%rax,2)
je 0x37bd2
incq %r12
jmp 0x37bb4
movzbl %al, %eax
cmpl $0x2b, %eax
je 0x37bdf
cmpl $0x2d, %eax
jne 0x37bf2
movq %r15, %rdx
xorl %ecx, %ecx
cmpl $0x2d, %eax
sete %cl
movl %ecx, -0x34(%rbp)
incq %r12
jmp 0x37bfc
movq %r15, %rdx
movl $0x0, -0x34(%rbp)
xorl %edi, %edi
leaq (%r12,%rdi), %r15
cmpq %r13, %r15
jae 0x37c12
cmpb $0x30, (%r15)
jne 0x37c12
incq %rdi
jmp 0x37bfe
movq %r13, -0x40(%rbp)
addl %edx, %r14d
subl %r12d, %r14d
subl %edi, %r14d
movw $0x13, %cx
cmpl $0x13, %r14d
jb 0x37c5a
cmpl $0x0, -0x34(%rbp)
leaq 0x2c453(%rip), %rax     # 0x64087
leaq 0x2c438(%rip), %rsi     # 0x64073
cmoveq %rax, %rsi
pushq $0x13
popq %rdx
movq %rdi, %rbx
movq %r15, %rdi
callq 0x2d30e
movq %rbx, %rdi
xorl %ecx, %ecx
testl %eax, %eax
setle %cl
orl $0x12, %ecx
movzwl %cx, %eax
leaq -0x3(%rax), %rcx
movq %rcx, -0x50(%rbp)
leaq -0x2(%rax), %rcx
movq %rcx, -0x58(%rbp)
movq %rax, -0x70(%rbp)
decq %rax
movq %rax, -0x60(%rbp)
leaq (%r12,%rdi), %rbx
xorl %r13d, %r13d
xorl %eax, %eax
movq %rdi, -0x68(%rbp)
leaq (%rbx,%r13), %r14
cmpq -0x40(%rbp), %r14
movq %rax, -0x30(%rbp)
jae 0x37da5
cmpw %r13w, -0x70(%rbp)
je 0x37da5
leaq (%r12,%r13), %rax
movq %rax, -0x78(%rbp)
callq 0xc190
movq -0x78(%rbp), %r8
movq -0x68(%rbp), %rdi
movq (%rax), %rax
movsbq (%r8,%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x37dbc
imulq $0xa, -0x30(%rbp), %rdx
addq %rcx, %rdx
addq $-0x30, %rdx
leaq (%rbx,%r13), %rcx
incq %rcx
cmpq -0x40(%rbp), %rcx
jae 0x37d79
cmpw %r13w, -0x60(%rbp)
je 0x37d79
movsbq 0x1(%r8,%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x37d86
imulq $0xa, %rdx, %rdx
addq %rcx, %rdx
addq $-0x30, %rdx
leaq (%rbx,%r13), %rcx
addq $0x2, %rcx
cmpq -0x40(%rbp), %rcx
jae 0x37d8f
cmpw %r13w, -0x58(%rbp)
je 0x37d8f
movsbq 0x2(%r8,%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x37d9d
imulq $0xa, %rdx, %rdx
addq %rcx, %rdx
addq $-0x30, %rdx
leaq 0x3(%r15), %r14
leaq (%rbx,%r13), %rcx
addq $0x3, %rcx
cmpq -0x40(%rbp), %rcx
jae 0x37daa
cmpw %r13w, -0x50(%rbp)
je 0x37daa
movsbq 0x3(%r8,%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x37db0
imulq $0xa, %rdx, %rax
addq %rcx, %rax
addq $-0x30, %rax
addq $0x4, %r15
addq $0x4, %r13
jmp 0x37c85
movq %rdx, -0x30(%rbp)
leaq (%rbx,%r13), %r14
incq %r14
jmp 0x37dbc
movq %rdx, -0x30(%rbp)
incq %r15
jmp 0x37da5
movq %rdx, -0x30(%rbp)
leaq (%rbx,%r13), %r14
addq $0x2, %r14
jmp 0x37dbc
movq %rdx, -0x30(%rbp)
addq $0x2, %r15
movq %r15, %r14
jmp 0x37dbc
movq %rdx, -0x30(%rbp)
jmp 0x37dbc
movq %rdx, -0x30(%rbp)
leaq (%rbx,%r13), %r14
addq $0x3, %r14
movq -0x48(%rbp), %rbx
movq -0x40(%rbp), %r15
cmpq %r15, %r14
jae 0x37ddf
callq 0xc190
movq (%rax), %rax
movsbq (%r14), %rcx
incq %r14
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x37dc4
testq %rbx, %rbx
je 0x37e03
movq -0x30(%rbp), %rdx
movq %rdx, %rax
negq %rax
setb %cl
testb $0x1, %cl
cmoveq %rdx, %rax
cmpl $0x0, -0x34(%rbp)
cmoveq %rdx, %rax
movq %rax, (%rbx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq