// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: SyOctalStrToInt64
JX9_PRIVATE sxi32 SyOctalStrToInt64(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++;
	}
	/* Skip leading zero */
	while(zSrc < zEnd && zSrc[0] == '0' ){
		zSrc++; 
	}
	zIn = zSrc;
	for(;;){
		if(zSrc >= zEnd || !SyisDigit(zSrc[0])){ break; } if( (c=zSrc[0]-'0') > 7 || (int)(zSrc-zIn) > 20){ break;} nVal = nVal * 8 +  c; zSrc++;
		if(zSrc >= zEnd || !SyisDigit(zSrc[0])){ break; } if( (c=zSrc[0]-'0') > 7 || (int)(zSrc-zIn) > 20){ break;} nVal = nVal * 8 +  c; zSrc++;
		if(zSrc >= zEnd || !SyisDigit(zSrc[0])){ break; } if( (c=zSrc[0]-'0') > 7 || (int)(zSrc-zIn) > 20){ break;} nVal = nVal * 8 +  c; zSrc++;
		if(zSrc >= zEnd || !SyisDigit(zSrc[0])){ break; } if( (c=zSrc[0]-'0') > 7 || (int)(zSrc-zIn) > 20){ break;} nVal = nVal * 8 +  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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, -0x40(%rbp)
movq %rdi, %r14
movl %esi, %r13d
addq %rdi, %r13
cmpq %r13, %r14
jae 0x37a0e
callq 0xc190
movq (%rax), %rcx
movsbq (%r14), %rax
testb $0x20, 0x1(%rcx,%rax,2)
je 0x379f6
incq %r14
jmp 0x379d9
movzbl %al, %eax
cmpl $0x2b, %eax
je 0x37a03
cmpl $0x2d, %eax
jne 0x37a0e
cmpl $0x2d, %eax
sete %al
movl %eax, -0x34(%rbp)
jmp 0x37a17
movl $0x0, -0x34(%rbp)
jmp 0x37a1a
incq %r14
cmpq %r13, %r14
jae 0x37a25
cmpb $0x30, (%r14)
je 0x37a17
xorl %r15d, %r15d
movq %r14, %rdi
xorl %r9d, %r9d
movq %r9, -0x30(%rbp)
leaq (%r14,%r15), %r12
cmpq %r13, %r12
jae 0x37b33
movq %rdi, %rbx
callq 0xc190
movq (%rax), %rax
movb (%r12), %dl
movsbq %dl, %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x37b86
cmpb $0x37, %dl
movq %rbx, %rdi
jg 0x37b8b
movq -0x30(%rbp), %r9
leaq (%rcx,%r9,8), %r9
addq $-0x30, %r9
leaq 0x1(%rdi), %rcx
leaq (%r14,%r15), %r12
incq %r12
cmpq %r13, %r12
jae 0x37b26
movsbq (%r12), %rdx
testb $0x8, 0x1(%rax,%rdx,2)
je 0x37b2f
leal 0x1(%r15), %esi
cmpl $0x14, %esi
jg 0x37b26
cmpb $0x37, %dl
jg 0x37b26
leaq (%rdx,%r9,8), %r9
addq $-0x30, %r9
leaq (%r14,%r15), %r12
addq $0x2, %r12
cmpq %r13, %r12
jae 0x37b2f
leaq 0x2(%rdi), %rcx
movsbq (%r12), %rdx
testb $0x8, 0x1(%rax,%rdx,2)
je 0x37b26
leal 0x2(%r15), %esi
cmpl $0x14, %esi
jg 0x37b26
cmpb $0x37, %dl
jg 0x37b26
leaq (%rdx,%r9,8), %r9
addq $-0x30, %r9
leaq 0x3(%rdi), %rcx
leaq (%r14,%r15), %r12
addq $0x3, %r12
cmpq %r13, %r12
jae 0x37b26
movsbq (%r12), %rdx
testb $0x8, 0x1(%rax,%rdx,2)
je 0x37b2f
leal 0x3(%r15), %eax
cmpl $0x14, %eax
jg 0x37b26
cmpb $0x37, %dl
jg 0x37b26
leaq (%rdx,%r9,8), %r9
addq $-0x30, %r9
addq $0x4, %rdi
addq $0x4, %r15
jmp 0x37a2e
movq %r9, -0x30(%rbp)
movq %rcx, %r12
jmp 0x37b33
movq %r9, -0x30(%rbp)
cmpq %r13, %r12
jae 0x37b4f
callq 0xc190
movq (%rax), %rax
movsbq (%r12), %rcx
incq %r12
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x37b33
movq -0x40(%rbp), %rdx
testq %rdx, %rdx
je 0x37b77
movq -0x30(%rbp), %rsi
movq %rsi, %rax
negq %rax
setb %cl
testb $0x1, %cl
cmoveq %rsi, %rax
cmpb $0x0, -0x34(%rbp)
cmoveq %rsi, %rax
movq %rax, (%rdx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %r12
jmp 0x37b33
movq %rdi, %r12
jmp 0x37b33