// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: SyHexStrToInt64
JX9_PRIVATE sxi32 SyHexStrToInt64(const char *zSrc, sxu32 nLen, void * pOutVal, const char **zRest)
{
	const char *zIn, *zEnd;
	int isNeg = FALSE;
	sxi64 nVal = 0;
#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 == '-' || *zSrc == '+' ) ){
		isNeg = (zSrc[0] == '-') ? TRUE :FALSE;
		zSrc++;
	}
	if( zSrc < &zEnd[-2] && zSrc[0] == '0' && (zSrc[1] == 'x' || zSrc[1] == 'X') ){
		/* Bypass hex prefix */
		zSrc += sizeof(char) * 2;
	}	
	/* Skip leading zero */
	while(zSrc < zEnd && zSrc[0] == '0' ){
		zSrc++;
	}
	zIn = zSrc;
	for(;;){
		if(zSrc >= zEnd || !SyisHex(zSrc[0]) || (int)(zSrc-zIn) > 15) break; nVal = nVal * 16 + SyHexToint(zSrc[0]);  zSrc++ ;
		if(zSrc >= zEnd || !SyisHex(zSrc[0]) || (int)(zSrc-zIn) > 15) break; nVal = nVal * 16 + SyHexToint(zSrc[0]);  zSrc++ ;
		if(zSrc >= zEnd || !SyisHex(zSrc[0]) || (int)(zSrc-zIn) > 15) break; nVal = nVal * 16 + SyHexToint(zSrc[0]);  zSrc++ ;
		if(zSrc >= zEnd || !SyisHex(zSrc[0]) || (int)(zSrc-zIn) > 15) break; nVal = nVal * 16 + SyHexToint(zSrc[0]);  zSrc++ ;
	}
	while( zSrc < zEnd && SyisSpace(zSrc[0]) ){
		zSrc++;
	}	
	if( zRest ){
		*zRest = 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
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x34(%rbp)
movq $0x0, -0x40(%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, -0x41(%rbp)
jae 0x71287
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, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x71290
jmp 0x7129e
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x71254
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x712e3
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x712c0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x712e3
movq -0x8(%rbp), %rax
movsbl (%rax), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x2d, %edx
cmovel %ecx, %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $-0x2, %rcx
cmpq %rcx, %rax
jae 0x71326
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x71326
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x78, %eax
je 0x7131a
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
jne 0x71326
movq -0x8(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x8(%rbp)
jmp 0x71328
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0x42(%rbp)
jae 0x71347
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
sete %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
testb $0x1, %al
jne 0x71350
jmp 0x7135e
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x71328
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x713a0
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x713a0
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
cmpl $0xf, %eax
jle 0x713a5
jmp 0x71534
movq -0x40(%rbp), %rax
shlq $0x4, %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %edi
callq 0x72070
movl %eax, %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x71413
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x71413
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
cmpl $0xf, %eax
jle 0x71418
jmp 0x71534
movq -0x40(%rbp), %rax
shlq $0x4, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %edi
callq 0x72070
movl %eax, %ecx
movq -0x58(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x71486
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x71486
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
cmpl $0xf, %eax
jle 0x7148b
jmp 0x71534
movq -0x40(%rbp), %rax
shlq $0x4, %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %edi
callq 0x72070
movl %eax, %ecx
movq -0x60(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x714f9
callq 0xd1f0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x714f9
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
cmpl $0xf, %eax
jle 0x714fb
jmp 0x71534
movq -0x40(%rbp), %rax
shlq $0x4, %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %edi
callq 0x72070
movl %eax, %ecx
movq -0x68(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x71366
jmp 0x71536
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0x69(%rbp)
jae 0x71569
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, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x71572
jmp 0x71580
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x71536
cmpq $0x0, -0x20(%rbp)
je 0x71592
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x18(%rbp)
je 0x715bb
cmpl $0x1, -0x34(%rbp)
jne 0x715b0
cmpq $0x0, -0x40(%rbp)
je 0x715b0
xorl %eax, %eax
subq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdx
movq -0x30(%rbp), %rsi
movl $0xfffffff4, %eax       # imm = 0xFFFFFFF4
xorl %ecx, %ecx
cmpq %rsi, %rdx
cmovael %ecx, %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)