// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: SyBinaryStrToInt64
JX9_PRIVATE sxi32 SyBinaryStrToInt64(const char *zSrc, sxu32 nLen, void * pOutVal, const char **zRest)
{
	const char *zIn, *zEnd;
	int isNeg = FALSE;
	sxi64 nVal = 0;
	int c;
#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++;
	}
	if( zSrc < &zEnd[-2] && zSrc[0] == '0' && (zSrc[1] == 'b' || zSrc[1] == 'B') ){
		/* Bypass binary prefix */
		zSrc += sizeof(char) * 2;
	}
	/* Skip leading zero */
	while(zSrc < zEnd && zSrc[0] == '0' ){
		zSrc++; 
	}
	zIn = zSrc;
	for(;;){
		if(zSrc >= zEnd || (zSrc[0] != '1' && zSrc[0] != '0') || (int)(zSrc-zIn) > 62){ break; } c = zSrc[0] - '0'; nVal = (nVal << 1) + c; zSrc++;
		if(zSrc >= zEnd || (zSrc[0] != '1' && zSrc[0] != '0') || (int)(zSrc-zIn) > 62){ break; } c = zSrc[0] - '0'; nVal = (nVal << 1) + c; zSrc++;
		if(zSrc >= zEnd || (zSrc[0] != '1' && zSrc[0] != '0') || (int)(zSrc-zIn) > 62){ break; } c = zSrc[0] - '0'; nVal = (nVal << 1) + c; zSrc++;
		if(zSrc >= zEnd || (zSrc[0] != '1' && zSrc[0] != '0') || (int)(zSrc-zIn) > 62){ break; } c = zSrc[0] - '0'; nVal = (nVal << 1) + c; zSrc++;
	}
	/* Skip trailing spaces */
	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 $0x50, %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, -0x45(%rbp)
jae 0x71647
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, -0x45(%rbp)
movb -0x45(%rbp), %al
testb $0x1, %al
jne 0x71650
jmp 0x7165e
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x71614
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x716a3
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x71680
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x716a3
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 0x716e6
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x716e6
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x62, %eax
je 0x716da
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x42, %eax
jne 0x716e6
movq -0x8(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x8(%rbp)
jmp 0x716e8
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0x46(%rbp)
jae 0x71707
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
sete %al
movb %al, -0x46(%rbp)
movb -0x46(%rbp), %al
testb $0x1, %al
jne 0x71710
jmp 0x7171e
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x716e8
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x71758
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
je 0x71748
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x71758
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
cmpl $0x3e, %eax
jle 0x7175d
jmp 0x718b0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
shlq %rax
movslq -0x44(%rbp), %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 0x717ba
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
je 0x717aa
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x717ba
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
cmpl $0x3e, %eax
jle 0x717bf
jmp 0x718b0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
shlq %rax
movslq -0x44(%rbp), %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 0x7181c
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
je 0x7180c
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x7181c
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
cmpl $0x3e, %eax
jle 0x71821
jmp 0x718b0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
shlq %rax
movslq -0x44(%rbp), %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 0x7187e
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
je 0x7186e
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x7187e
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
cmpl $0x3e, %eax
jle 0x71880
jmp 0x718b0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
shlq %rax
movslq -0x44(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x71726
jmp 0x718b2
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0x47(%rbp)
jae 0x718e5
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, -0x47(%rbp)
movb -0x47(%rbp), %al
testb $0x1, %al
jne 0x718ee
jmp 0x718fc
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x718b2
cmpq $0x0, -0x20(%rbp)
je 0x7190e
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x18(%rbp)
je 0x71937
cmpl $0x1, -0x34(%rbp)
jne 0x7192c
cmpq $0x0, -0x40(%rbp)
je 0x7192c
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 $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)