// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_substr_compare
static int jx9Builtin_substr_compare(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const char *zSource, *zOfft, *zSub;
	int nOfft, nLen, nSrcLen, nSublen;
	int iCase = 0;
	int rc;
	if( nArg < 3 ){
		/* Missing arguments, return FALSE */
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}
	/* Extract the target string */
	zSource = jx9_value_to_string(apArg[0], &nSrcLen);
	if( nSrcLen < 1 ){
		/* Empty string, return FALSE */
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}
	nLen = nSrcLen; /* cc warning */
	/* Extract the substring */
	zSub = jx9_value_to_string(apArg[1], &nSublen);
	if( nSublen < 1 || nSublen > nSrcLen){
		/* Empty string, return FALSE */
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}
	/* Extract the offset */
	nOfft = jx9_value_to_int(apArg[2]);
	if( nOfft < 0 ){
		zOfft = &zSource[nSrcLen+nOfft]; 
		if( zOfft < zSource ){
			/* Invalid offset */
			jx9_result_bool(pCtx, 0);
			return JX9_OK;
		}
		nLen = (int)(&zSource[nSrcLen]-zOfft);
		nOfft = (int)(zOfft-zSource);
	}else if( nOfft >= nSrcLen ){
		/* Invalid offset */
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}else{
		zOfft = &zSource[nOfft];
		nLen = nSrcLen - nOfft;
	}
	if( nArg > 3 ){
		/* Extract the length */
		nLen = jx9_value_to_int(apArg[3]);
		if( nLen < 1 ){
			/* Invalid  length */
			jx9_result_int(pCtx, 1);
			return JX9_OK;
		}else if( nLen + nOfft > nSrcLen ){
			/* Invalid length */
			nLen = nSrcLen - nOfft;
		}
		if( nArg > 4 ){
			/* Case-sensitive or not */
			iCase = jx9_value_to_bool(apArg[4]);
		}
	}
	/* Perform the comparison */
	if( iCase ){
		rc = SyStrnicmp(zOfft, zSub, (sxu32)nLen);
	}else{
		rc = SyStrncmp(zOfft, zSub, (sxu32)nLen);
	}
	/* Comparison result */
	jx9_result_int(pCtx, rc);
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x4c(%rbp)
cmpl $0x3, -0x14(%rbp)
jge 0x91cb7
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0x91e73
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0x44(%rbp), %rsi
callq 0x56e20
movq %rax, -0x28(%rbp)
cmpl $0x1, -0x44(%rbp)
jge 0x91ce8
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0x91e73
movl -0x44(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x48(%rbp), %rsi
callq 0x56e20
movq %rax, -0x38(%rbp)
cmpl $0x1, -0x48(%rbp)
jl 0x91d11
movl -0x48(%rbp), %eax
cmpl -0x44(%rbp), %eax
jle 0x91d28
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0x91e73
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x56c90
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0x91d98
movq -0x28(%rbp), %rax
movl -0x44(%rbp), %ecx
addl -0x3c(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x91d73
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0x91e73
movq -0x28(%rbp), %rax
movslq -0x44(%rbp), %rcx
addq %rcx, %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x3c(%rbp)
jmp 0x91dd1
movl -0x3c(%rbp), %eax
cmpl -0x44(%rbp), %eax
jl 0x91db7
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0x91e73
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x44(%rbp), %eax
subl -0x3c(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x91dd1
cmpl $0x3, -0x14(%rbp)
jle 0x91e32
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x56c90
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x40(%rbp)
jge 0x91e04
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x56fb0
movl $0x0, -0x4(%rbp)
jmp 0x91e73
movl -0x40(%rbp), %eax
addl -0x3c(%rbp), %eax
cmpl -0x44(%rbp), %eax
jle 0x91e18
movl -0x44(%rbp), %eax
subl -0x3c(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x91e1a
cmpl $0x4, -0x14(%rbp)
jle 0x91e30
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x56cf0
movl %eax, -0x4c(%rbp)
jmp 0x91e32
cmpl $0x0, -0x4c(%rbp)
je 0x91e4d
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x40(%rbp), %edx
callq 0x67830
movl %eax, -0x50(%rbp)
jmp 0x91e60
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x40(%rbp), %edx
callq 0x98d80
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0x56fb0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)