// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: SyStrToInt32
JX9_PRIVATE sxi32 SyStrToInt32(const char *zSrc, sxu32 nLen, void * pOutVal, const char **zRest)
{
	int isNeg = FALSE;
	const char *zEnd;
	sxi32 nVal = 0;
	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 = 10;
	if( (sxu32)(zEnd-zSrc) >= 10 ){
		/* Handle overflow */
		i = SyMemcmp(zSrc, (isNeg == TRUE) ? SXINT32_MIN_STR : SXINT32_MAX_STR, nLen) <= 0 ? 10 : 9; 
	}
	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;
		}
		*(sxi32 *)pOutVal = nVal;
	}
	return (zSrc >= zEnd) ? SXRET_OK : SXERR_SYNTAX;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0x37(%rbp)
jae 0x7c276
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, -0x37(%rbp)
movb -0x37(%rbp), %al
testb $0x1, %al
jne 0x7c27f
jmp 0x7c28d
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x7c243
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x7c2d2
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x7c2af
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x7c2d2
movq -0x8(%rbp), %rax
movsbl (%rax), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x2d, %edx
cmovel %ecx, %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x7c2d4
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0x38(%rbp)
jae 0x7c2f3
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
sete %al
movb %al, -0x38(%rbp)
movb -0x38(%rbp), %al
testb $0x1, %al
jne 0x7c2fc
jmp 0x7c30a
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x7c2d4
movw $0xa, -0x36(%rbp)
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
subq %rcx, %rax
cmpl $0xa, %eax
jb 0x7c35a
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %ecx
leaq 0x46b48(%rip), %rsi     # 0xc2e76
leaq 0x46b36(%rip), %rax     # 0xc2e6b
cmpl $0x1, %ecx
cmoveq %rax, %rsi
movl -0xc(%rbp), %edx
callq 0x5d3c0
movl %eax, %edx
movl $0x9, %eax
movl $0xa, %ecx
cmpl $0x0, %edx
cmovlel %ecx, %eax
movw %ax, -0x36(%rbp)
jmp 0x7c35c
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x7c38d
cmpw $0x0, -0x36(%rbp)
je 0x7c38d
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 0x7c392
jmp 0x7c4e2
imull $0xa, -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
subl $0x30, %ecx
addl %ecx, %eax
movl %eax, -0x34(%rbp)
movw -0x36(%rbp), %ax
addw $-0x1, %ax
movw %ax, -0x36(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x7c3ee
cmpw $0x0, -0x36(%rbp)
je 0x7c3ee
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 0x7c3f3
jmp 0x7c4e2
imull $0xa, -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
subl $0x30, %ecx
addl %ecx, %eax
movl %eax, -0x34(%rbp)
movw -0x36(%rbp), %ax
addw $-0x1, %ax
movw %ax, -0x36(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x7c44f
cmpw $0x0, -0x36(%rbp)
je 0x7c44f
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 0x7c454
jmp 0x7c4e2
imull $0xa, -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
subl $0x30, %ecx
addl %ecx, %eax
movl %eax, -0x34(%rbp)
movw -0x36(%rbp), %ax
addw $-0x1, %ax
movw %ax, -0x36(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x7c4b0
cmpw $0x0, -0x36(%rbp)
je 0x7c4b0
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 0x7c4b2
jmp 0x7c4e2
imull $0xa, -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
subl $0x30, %ecx
addl %ecx, %eax
movl %eax, -0x34(%rbp)
movw -0x36(%rbp), %ax
addw $-0x1, %ax
movw %ax, -0x36(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x7c35c
jmp 0x7c4e4
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0x39(%rbp)
jae 0x7c517
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, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x7c520
jmp 0x7c52e
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x7c4e4
cmpq $0x0, -0x20(%rbp)
je 0x7c540
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x18(%rbp)
je 0x7c564
cmpl $0x1, -0x24(%rbp)
jne 0x7c55b
cmpl $0x0, -0x34(%rbp)
je 0x7c55b
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rdx
movq -0x30(%rbp), %rsi
movl $0xfffffff4, %eax       # imm = 0xFFFFFFF4
xorl %ecx, %ecx
cmpq %rsi, %rdx
cmovael %ecx, %eax
addq $0x40, %rsp
popq %rbp
retq
nop