// File: /workspace/github_c_makefile_star2_O3/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9CompileExpr
static sxi32 jx9CompileExpr(
	jx9_gen_state *pGen, /* Code generator state */
	sxi32 iFlags,        /* Control flags */
	sxi32 (*xTreeValidator)(jx9_gen_state *, jx9_expr_node *) /* Node validator callback.NULL otherwise */
	)
{
	jx9_expr_node *pRoot;
	SySet sExprNode;
	SyToken *pEnd;
	sxi32 nExpr;
	sxi32 iNest;
	sxi32 rc;
	/* Initialize worker variables */
	nExpr = 0;
	pRoot = 0;
	SySetInit(&sExprNode, &pGen->pVm->sAllocator, sizeof(jx9_expr_node *));
	SySetAlloc(&sExprNode, 0x10);
	rc = SXRET_OK;
	/* Delimit the expression */
	pEnd = pGen->pIn;
	iNest = 0;
	while( pEnd < pGen->pEnd ){
		if( pEnd->nType & JX9_TK_OCB /* '{' */ ){
			/* Ticket 1433-30: Annonymous/Closure functions body */
			iNest++;
		}else if(pEnd->nType & JX9_TK_CCB /* '}' */ ){
			iNest--;
		}else if( pEnd->nType & JX9_TK_SEMI /* ';' */ ){
			if( iNest <= 0 ){
				break;
			}
		}
		pEnd++;
	}
	if( iFlags & EXPR_FLAG_COMMA_STATEMENT ){
		SyToken *pEnd2 = pGen->pIn;
		iNest = 0;
		/* Stop at the first comma */
		while( pEnd2 < pEnd ){
			if( pEnd2->nType & (JX9_TK_OCB/*'{'*/|JX9_TK_OSB/*'['*/|JX9_TK_LPAREN/*'('*/) ){
				iNest++;
			}else if(pEnd2->nType & (JX9_TK_CCB/*'}'*/|JX9_TK_CSB/*']'*/|JX9_TK_RPAREN/*')'*/)){
				iNest--;
			}else if( pEnd2->nType & JX9_TK_COMMA /*','*/ ){
				if( iNest <= 0 ){
					break;
				}
			}
			pEnd2++;
		}
		if( pEnd2 <pEnd ){
			pEnd = pEnd2;
		}
	}
	if( pEnd > pGen->pIn ){
		SyToken *pTmp = pGen->pEnd;
		/* Swap delimiter */
		pGen->pEnd = pEnd;
		/* Try to get an expression tree */
		rc = jx9ExprMakeTree(&(*pGen), &sExprNode, &pRoot);
		if( rc == SXRET_OK && pRoot ){
			rc = SXRET_OK;
			if( xTreeValidator ){
				/* Call the upper layer validator callback */
				rc = xTreeValidator(&(*pGen), pRoot);
			}
			if( rc != SXERR_ABORT ){
				/* Generate code for the given tree */
				rc = GenStateEmitExprCode(&(*pGen), pRoot, iFlags);
			}
			nExpr = 1;
		}
		/* Release the whole tree */
		jx9ExprFreeTree(&(*pGen), &sExprNode);
		/* Synchronize token stream */
		pGen->pEnd = pTmp;
		pGen->pIn  = pEnd;
		if( rc == SXERR_ABORT ){
			SySetRelease(&sExprNode);
			return SXERR_ABORT;
		}
	}
	SySetRelease(&sExprNode);
	return nExpr > 0 ? SXRET_OK : SXERR_EMPTY;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, -0x38(%rbp)
movl %esi, %r13d
movq %rdi, %rbx
movq (%rdi), %r12
movabsq $0x800000000, %rax      # imm = 0x800000000
movq %rax, -0x54(%rbp)
movq %r12, -0x68(%rbp)
movq $0x0, -0x48(%rbp)
movq %r12, %rdi
movl $0x80, %esi
callq 0x33d86
movq %rax, %r14
movq %rax, -0x60(%rbp)
testq %rax, %rax
je 0x497e1
movl $0x10, -0x54(%rbp)
movq 0x158(%rbx), %rax
movq 0x160(%rbx), %r15
cmpq %r15, %rax
jae 0x49b9e
movl %r13d, -0x2c(%rbp)
xorl %ecx, %ecx
movq %rax, %r13
movl 0x10(%r13), %edx
testb $0x40, %dl
jne 0x4981a
testb %dl, %dl
js 0x4981e
btl $0x12, %edx
jae 0x49820
testl %ecx, %ecx
jg 0x49820
jmp 0x49829
incl %ecx
jmp 0x49820
decl %ecx
addq $0x20, %r13
cmpq %r15, %r13
jb 0x49801
cmpq %rax, %r13
jbe 0x49b9e
movq %r13, 0x160(%rbx)
xorl %eax, %eax
leaq -0x68(%rbp), %rcx
movl %eax, 0x10(%rcx)
movl %eax, 0x1c(%rcx)
leaq -0x40(%rbp), %rax
movq $0x0, (%rax)
movq %r15, -0x70(%rbp)
movq (%rbx), %rdi
movl $0x68, %esi
callq 0x2e481
testq %rax, %rax
je 0x49bd9
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq $0x0, 0x60(%rax)
movq (%rbx), %rax
movl $0x8, 0x50(%r12)
movq %rax, 0x38(%r12)
movq 0x158(%rbx), %r8
movq %r8, 0x18(%r12)
movl 0x10(%r8), %eax
testb $0x20, %al
jne 0x4991e
testb $0x10, %al
jne 0x4992c
testb $0x40, %al
jne 0x49986
btl $0xb, %eax
jb 0x499d2
testb $0x4, %al
jne 0x49a29
testb $0x8, %al
jne 0x49b35
testl $0x121680, %eax         # imm = 0x121680
jne 0x49926
leaq 0x5317(%rip), %rcx      # 0x4ebff
testb $0x3, %al
jne 0x49917
btl $0xd, %eax
leaq 0x4a8d(%rip), %rcx      # 0x4e384
jb 0x49917
btl $0xe, %eax
leaq 0x4fd3(%rip), %rcx      # 0x4e8d7
jb 0x49917
btl $0x10, %eax
leaq 0x53e0(%rip), %rcx      # 0x4ecf1
jae 0x49fa1
movq %rcx, 0x30(%r12)
jmp 0x49926
movq 0x18(%r8), %rax
movq %rax, (%r12)
addq $0x20, %r8
jmp 0x4994d
leaq 0x20(%r8), %rax
cmpq 0x160(%rbx), %rax
jae 0x49e42
addq $0x40, %r8
leaq 0x2db7(%rip), %rax      # 0x4c6ff
movq %rax, 0x30(%r12)
movq %r8, %r14
movq %r14, 0x20(%r12)
movq %r12, -0x40(%rbp)
movq %r14, 0x158(%rbx)
leaq -0x68(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x33094
movq 0x158(%rbx), %rax
cmpq 0x160(%rbx), %rax
jb 0x49854
jmp 0x49be4
leaq 0x20(%r8), %r14
movq 0x160(%rbx), %rax
cmpq %rax, %r14
jae 0x499bc
movl $0x1, %ecx
movl 0x10(%r14), %edx
testb $0x40, %dl
jne 0x499b1
testb %dl, %dl
jns 0x499b3
cmpl $0x2, %ecx
jl 0x499bc
decl %ecx
jmp 0x499b3
incl %ecx
addq $0x20, %r14
cmpq %rax, %r14
jb 0x4999b
cmpq %rax, %r14
jae 0x49e4f
addq $0x20, %r14
leaq 0x40aa(%rip), %rax      # 0x4da7a
jmp 0x49a1f
leaq 0x20(%r8), %r14
movq 0x160(%rbx), %rax
cmpq %rax, %r14
jae 0x49a0b
movl $0x1, %ecx
movl 0x10(%r14), %edx
btl $0xb, %edx
jb 0x49a00
btl $0xc, %edx
jae 0x49a02
cmpl $0x2, %ecx
jl 0x49a0b
decl %ecx
jmp 0x49a02
incl %ecx
addq $0x20, %r14
cmpq %rax, %r14
jb 0x499e7
cmpq %rax, %r14
jae 0x49e65
addq $0x20, %r14
leaq 0x4235(%rip), %rax      # 0x4dc54
movq %rax, 0x30(%r12)
jmp 0x49950
movl 0x18(%r8), %eax
leal -0xd(%rax), %ecx
cmpl $0x4, %ecx
jae 0x49a82
leaq 0x20(%r8), %rcx
movq 0x160(%rbx), %rax
cmpq %rax, %rcx
jae 0x49b35
movl $0x1, %ecx
movl 0x10(%r8), %edx
testl $0xa40, %edx            # imm = 0xA40
je 0x49a5e
incl %ecx
jmp 0x49a6d
testl $0x1480, %edx           # imm = 0x1480
je 0x49a6d
cmpl $0x2, %ecx
jl 0x49a76
decl %ecx
addq $0x20, %r8
cmpq %rax, %r8
jb 0x49a4e
leaq 0x46ad(%rip), %rax      # 0x4e12a
jmp 0x49948
cmpl $0x2, %eax
je 0x49a35
cmpl $0x6, %eax
jne 0x49b35
leaq 0x20(%r8), %r14
movq 0x160(%rbx), %rax
cmpq %rax, %r14
jae 0x49b45
movl 0x14(%r8), %edx
testb $0xc, 0x30(%r8)
leaq 0x40(%r8), %rcx
cmoveq %r14, %rcx
cmpq %rax, %rcx
jae 0x49f7e
testb $0x2, 0x11(%rcx)
je 0x49f7e
addq $0x20, %rcx
cmpq %rax, %rcx
jae 0x49af9
movl $0x1, %esi
movl 0x10(%rcx), %edi
btl $0x9, %edi
jb 0x49aee
btl $0xa, %edi
jae 0x49af0
cmpl $0x2, %esi
jl 0x49af9
decl %esi
jmp 0x49af0
incl %esi
addq $0x20, %rcx
cmpq %rax, %rcx
jb 0x49ad6
cmpq %rax, %rcx
jae 0x49f8a
leaq 0x20(%rcx), %r14
cmpq %rax, %r14
jae 0x49f8a
testb $0x40, 0x30(%rcx)
jne 0x49b51
movq %rbx, %rdi
movl $0x1, %esi
leaq 0x2c3ef(%rip), %rcx     # 0x75f13
xorl %eax, %eax
callq 0x483d1
cmpl $-0xa, %eax
jne 0x49b92
jmp 0x49f96
addq $0x20, %r8
leaq 0x4216(%rip), %rax      # 0x4dd56
jmp 0x49948
leaq 0x420a(%rip), %rax      # 0x4dd56
jmp 0x49a1f
addq $0x40, %rcx
cmpq %rax, %rcx
jae 0x49b81
movl $0x1, %edx
movl 0x10(%rcx), %esi
testb $0x40, %sil
jne 0x49b76
testb %sil, %sil
jns 0x49b78
cmpl $0x2, %edx
jl 0x49b81
decl %edx
jmp 0x49b78
incl %edx
addq $0x20, %rcx
cmpq %rax, %rcx
jb 0x49b5f
xorl %r14d, %r14d
cmpq %rax, %rcx
setb %r14b
shll $0x5, %r14d
addq %rcx, %r14
leaq 0x440a(%rip), %rax      # 0x4dfa3
jmp 0x49a1f
xorl %ebx, %ebx
testq %r12, %r12
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x49bbb
movq %r12, %rdi
movq %r14, %rsi
callq 0x3490d
xorl %eax, %eax
testl %ebx, %ebx
setg %al
leal (%rax,%rax,2), %ebx
addl $-0x3, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x49efa
movl -0x58(%rbp), %r12d
testq %r12, %r12
je 0x49df6
movq -0x60(%rbp), %r14
testl %r12d, %r12d
jle 0x49dfe
movq (%r14), %r15
movq (%r15), %rax
testq %rax, %rax
je 0x49c30
movl 0x10(%rax), %eax
andl $-0x2, %eax
cmpl $0x10, %eax
jne 0x49c30
movq 0x18(%r15), %rdi
xorl %esi, %esi
callq 0x492a0
movq %rax, (%r15)
movq (%r14), %rax
movq (%rax), %rcx
movq 0x18(%rax), %rax
movq %rcx, 0x18(%rax)
xorl %eax, %eax
xorl %r9d, %r9d
xorl %edx, %edx
xorl %r10d, %r10d
movq (%r14,%rax,8), %r15
movq 0x18(%r15), %rdi
movl 0x10(%rdi), %r8d
btl $0x9, %r8d
jb 0x49d35
btl $0xa, %r8d
jb 0x49da0
btl $0xb, %r8d
jae 0x49c6e
cmpq $0x0, 0x30(%r15)
je 0x49dba
btl $0xc, %r8d
jb 0x49dae
testb $0x40, %r8b
je 0x49c8a
cmpq $0x0, 0x30(%r15)
je 0x49dcc
testb %r8b, %r8b
js 0x49dbe
testq %rax, %rax
je 0x49dcf
andl $0x20, %r8d
je 0x49dcf
movq (%r15), %rcx
movl 0x10(%rcx), %esi
leal -0x7(%rsi), %ecx
cmpl $0x1, %ecx
ja 0x49dcf
movq -0x8(%r14,%rax,8), %rcx
movq 0x30(%rcx), %rcx
leaq 0x2a37(%rip), %rdi      # 0x4c6ff
cmpq %rdi, %rcx
setne %dil
leaq 0x4080(%rip), %r8       # 0x4dd56
cmpq %r8, %rcx
setne %cl
testb %cl, %dil
jne 0x49dcf
xorl %r8d, %r8d
cmpl $0x8, %esi
sete %r8b
xorl $0x11, %r8d
leaq 0x47626(%rip), %rsi     # 0x91320
xorl %edi, %edi
cmpl %r8d, (%rsi)
je 0x49d13
incq %rdi
addq $0x20, %rsi
cmpq $0x32, %rdi
jne 0x49cfc
movl $0x32, %edi
shlq $0x5, %rdi
leaq 0x475f2(%rip), %rcx     # 0x91310
addq %rcx, %rdi
movq %rdi, (%r15)
movq (%r14,%rax,8), %rcx
movq 0x18(%rcx), %rcx
movq %rdi, 0x18(%rcx)
jmp 0x49dcf
testq %rax, %rax
je 0x49d9b
movq -0x8(%r14,%rax,8), %rsi
movq 0x18(%rsi), %r15
movq 0x30(%rsi), %rsi
leaq 0x29b1(%rip), %rcx      # 0x4c6ff
cmpq %rcx, %rsi
sete %r11b
leaq 0x3ffa(%rip), %rcx      # 0x4dd56
cmpq %rcx, %rsi
sete %cl
orb %r11b, %cl
movl 0x10(%r15), %esi
testl $0x740c, %esi           # imm = 0x740C
setne %r11b
orb %cl, %r11b
cmpb $0x1, %r11b
jne 0x49d9b
andl $0x20, %esi
jne 0x49d9b
orl $0x20, %r8d
movl %r8d, 0x10(%rdi)
leaq 0x47ca0(%rip), %rsi     # 0x91a30
movq %rsi, 0x18(%rdi)
movq (%r14,%rax,8), %rcx
movq %rsi, (%rcx)
incl %r10d
jmp 0x49dcf
testl %r10d, %r10d
jle 0x49e5c
decl %r10d
jmp 0x49dcf
testl %edx, %edx
jle 0x49ec7
decl %edx
jmp 0x49dcf
incl %edx
jmp 0x49dcf
testl %r9d, %r9d
jle 0x49ed0
decl %r9d
jmp 0x49dcf
incl %r9d
incq %rax
cmpq %r12, %rax
jne 0x49c3a
orl %edx, %r10d
orl %r9d, %r10d
je 0x49dfe
movq (%r14), %rax
movq 0x18(%rax), %rdi
leaq 0x2c1d5(%rip), %rcx     # 0x75fc6
jmp 0x49ed7
xorl %r15d, %r15d
jmp 0x49efa
movq %rbx, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x4cf4c
movl %eax, %r15d
testl %eax, %eax
jne 0x49efa
movq (%r14), %r15
testq %r15, %r15
je 0x49eb7
movq -0x38(%rbp), %rax
testq %rax, %rax
je 0x49e9d
movq %rbx, %rdi
movq %r15, %rsi
callq *%rax
cmpl $-0xa, %eax
jne 0x49e9d
movl $0xfffffff6, -0x38(%rbp) # imm = 0xFFFFFFF6
jmp 0x49eae
movl 0x14(%r8), %edx
leaq 0x2bb46(%rip), %rcx     # 0x75993
jmp 0x49e70
movl 0x14(%r8), %edx
leaq 0x2bf10(%rip), %rcx     # 0x75d6a
jmp 0x49e70
leaq 0x2c0fa(%rip), %rcx     # 0x75f5d
jmp 0x49ed7
movl 0x14(%r8), %edx
leaq 0x2bf22(%rip), %rcx     # 0x75d92
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x483d1
xorl %r15d, %r15d
cmpl $-0xa, %eax
sete %r15b
addl %r15d, %r15d
orl $-0xc, %r15d
movq (%rbx), %rdi
movq %r12, %rsi
callq 0x2e659
jmp 0x49efa
movq %rbx, %rdi
movq %r15, %rsi
movl -0x2c(%rbp), %edx
callq 0x4cab5
movl %eax, -0x38(%rbp)
movl $0x1, -0x2c(%rbp)
jmp 0x49f0d
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x38(%rbp)
jmp 0x49f0d
leaq 0x2c0b2(%rip), %rcx     # 0x75f80
jmp 0x49ed7
leaq 0x2c0cc(%rip), %rcx     # 0x75fa3
movl 0x14(%rdi), %edx
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x483d1
xorl %r15d, %r15d
cmpl $-0xa, %eax
sete %r15b
addl %r15d, %r15d
orl $-0xc, %r15d
movl %r15d, -0x38(%rbp)
movq -0x60(%rbp), %r14
movl $0x0, -0x2c(%rbp)
movl -0x58(%rbp), %r12d
testl %r12d, %r12d
je 0x49f31
movl %r12d, %r12d
xorl %r15d, %r15d
movq (%r14,%r15,8), %rsi
testq %rsi, %rsi
je 0x49f29
movq %rbx, %rdi
callq 0x4ed8c
incq %r15
cmpq %r15, %r12
jne 0x49f18
movq -0x70(%rbp), %rax
movq %rax, 0x160(%rbx)
movq %r13, 0x158(%rbx)
movq -0x68(%rbp), %r12
cmpl $-0xa, -0x38(%rbp)
jne 0x49f76
testq %r12, %r12
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
movl $0xfffffff6, %ebx       # imm = 0xFFFFFFF6
jne 0x49bc8
movq %r12, %rdi
movq %r14, %rsi
callq 0x3490d
jmp 0x49bc8
movl -0x2c(%rbp), %ebx
jmp 0x49ba0
leaq 0x2bf19(%rip), %rcx     # 0x75e9e
jmp 0x49e70
leaq 0x2bf51(%rip), %rcx     # 0x75ee2
jmp 0x49e70
movl $0xfffffff6, %r15d      # imm = 0xFFFFFFF6
jmp 0x49e90
movq $0x0, 0x30(%r12)
movl 0x14(%r8), %edx
leaq 0x2be0c(%rip), %rcx     # 0x75dc1
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x483d1
jmp 0x49e7f