// File: /workspace/github_c_makefile_star2_O2/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 $0x68, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
movabsq $0x800000000, %rcx      # imm = 0x800000000
leaq -0x90(%rbp), %rdi
movq %rcx, 0x14(%rdi)
andl $0x0, 0x10(%rdi)
movq %rdx, -0x68(%rbp)
andl $0x0, 0x1c(%rdi)
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movl %esi, %r14d
andq $0x0, 0x20(%rdi)
pushq $0x10
popq %rsi
callq 0x3eba8
movq 0x158(%rbx), %rax
movq 0x160(%rbx), %rsi
xorl %ecx, %ecx
movq %rax, %r15
cmpq %rsi, %r15
jae 0x401bc
movl 0x10(%r15), %edx
testb $0x40, %dl
jne 0x401b0
testb %dl, %dl
js 0x401b4
btl $0x12, %edx
jae 0x401b6
testl %ecx, %ecx
jg 0x401b6
jmp 0x401bc
incl %ecx
jmp 0x401b6
decl %ecx
addq $0x20, %r15
jmp 0x40192
xorl %r12d, %r12d
cmpq %rax, %r15
jbe 0x408ad
movl %r14d, -0x4c(%rbp)
movq %rsi, -0x60(%rbp)
movq %r15, 0x160(%rbx)
leaq -0x90(%rbp), %rcx
andl $0x0, 0x10(%rcx)
andl $0x0, 0x1c(%rcx)
leaq -0x58(%rbp), %rcx
andq $0x0, (%rcx)
pushq $0x68
popq %r13
movq %r15, %rcx
movl %r13d, %r12d
cmpq %rcx, %rax
jae 0x40512
movq (%rbx), %rdi
movl %r13d, %esi
callq 0x279f7
testq %rax, %rax
je 0x40728
movq %rax, %r14
movq %rax, %rdi
movl %r13d, %esi
callq 0x27aea
movq (%rbx), %rax
movabsq $0x800000000, %rcx      # imm = 0x800000000
movq %rcx, 0x4c(%r14)
andl $0x0, 0x48(%r14)
andl $0x0, 0x54(%r14)
movq %rax, 0x38(%r14)
andq $0x0, 0x40(%r14)
andq $0x0, 0x58(%r14)
movq 0x158(%rbx), %r8
movq %r8, 0x18(%r14)
movq %r8, -0x38(%rbp)
movl 0x10(%r8), %eax
testb $0x20, %al
jne 0x402cc
testb $0x10, %al
jne 0x402d9
testb $0x40, %al
jne 0x40331
btl $0xb, %eax
jb 0x40372
testb $0x4, %al
jne 0x403bc
testb $0x8, %al
jne 0x404b4
testl $0x121680, %eax         # imm = 0x121680
jne 0x402d3
leaq 0x4c60(%rip), %rcx      # 0x44ef7
testb $0x3, %al
jne 0x402c6
btl $0xd, %eax
leaq 0x4433(%rip), %rcx      # 0x446d9
jb 0x402c6
btl $0xe, %eax
leaq 0x4958(%rip), %rcx      # 0x44c0b
jb 0x402c6
btl $0x10, %eax
leaq 0x4ced(%rip), %rcx      # 0x44fad
jae 0x408fd
movq %rcx, 0x30(%r14)
jmp 0x402d3
movq 0x18(%r8), %rax
movq %rax, (%r14)
addq $0x20, %r8
jmp 0x402f9
leaq 0x20(%r8), %rax
cmpq 0x160(%rbx), %rax
jae 0x40756
addq $0x40, %r8
leaq 0x2a5c(%rip), %rax      # 0x42d51
movq %rax, 0x30(%r14)
movq %r8, %r13
movq %r13, 0x20(%r14)
movq %r14, -0x58(%rbp)
movq %r13, 0x158(%rbx)
leaq -0x90(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x2be00
movq 0x158(%rbx), %rax
movq 0x160(%rbx), %rcx
movl %r12d, %r13d
jmp 0x401f8
addq $0x20, %r8
movq %r8, -0x38(%rbp)
movq 0x160(%rbx), %rsi
movq %r8, %rdi
pushq $0x40
popq %rdx
movl $0x80, %ecx
leaq -0x38(%rbp), %r8
callq 0x424f6
movq -0x38(%rbp), %r13
cmpq 0x160(%rbx), %r13
jae 0x4077d
addq $0x20, %r13
leaq 0x3c21(%rip), %rax      # 0x43f91
jmp 0x403b3
addq $0x20, %r8
movq %r8, -0x38(%rbp)
movq 0x160(%rbx), %rsi
movq %r8, %rdi
movl $0x800, %edx            # imm = 0x800
movl $0x1000, %ecx           # imm = 0x1000
leaq -0x38(%rbp), %r8
callq 0x424f6
movq -0x38(%rbp), %r13
cmpq 0x160(%rbx), %r13
jae 0x407ca
addq $0x20, %r13
leaq 0x3d3d(%rip), %rax      # 0x440f0
movq %rax, 0x30(%r14)
jmp 0x402fc
movl 0x18(%r8), %eax
leal -0xd(%rax), %ecx
cmpl $0x4, %ecx
jae 0x40406
leaq 0x20(%r8), %rax
movq 0x160(%rbx), %rsi
cmpq %rsi, %rax
jae 0x404b4
movq %r8, %rdi
movl $0xa40, %edx            # imm = 0xA40
movl $0x1480, %ecx           # imm = 0x1480
leaq -0x38(%rbp), %r8
callq 0x424f6
leaq 0x4092(%rip), %rax      # 0x4448b
movq %rax, 0x30(%r14)
movq -0x38(%rbp), %r13
jmp 0x402fc
cmpl $0x2, %eax
je 0x403c8
cmpl $0x6, %eax
jne 0x404b4
leaq 0x20(%r8), %r13
movq 0x160(%rbx), %rcx
cmpq %rcx, %r13
jae 0x404c4
movl 0x14(%r8), %eax
movl %eax, -0x2c(%rbp)
testb $0xc, 0x30(%r8)
leaq 0x40(%r8), %rdi
cmoveq %r13, %rdi
cmpq %rcx, %rdi
jae 0x408d6
testb $0x2, 0x11(%rdi)
je 0x408d6
addq $0x20, %rdi
movq %rdi, -0x48(%rbp)
movq %rcx, %r13
movq %rcx, %rsi
movl $0x200, %edx            # imm = 0x200
movl $0x400, %ecx            # imm = 0x400
leaq -0x48(%rbp), %r8
callq 0x424f6
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
jae 0x408df
movq %r13, %rax
leaq 0x20(%rdi), %r13
cmpq %rax, %r13
jae 0x408df
testb $0x40, 0x30(%rdi)
jne 0x404d0
movq %rbx, %rdi
pushq $0x1
popq %rsi
movl -0x2c(%rbp), %edx
leaq 0x25a50(%rip), %rcx     # 0x65ef3
xorl %eax, %eax
callq 0x3eed6
cmpl $-0xa, %eax
jne 0x40506
jmp 0x408f4
addq $0x20, %r8
leaq 0x3cef(%rip), %rax      # 0x441ae
jmp 0x402f5
leaq 0x3ce3(%rip), %rax      # 0x441ae
jmp 0x403b3
addq $0x40, %rdi
movq %rdi, -0x48(%rbp)
movq %rax, %rsi
movq %rax, -0x40(%rbp)
pushq $0x40
popq %rdx
movl $0x80, %ecx
leaq -0x48(%rbp), %r8
callq 0x424f6
movq -0x48(%rbp), %rax
xorl %r13d, %r13d
cmpq -0x40(%rbp), %rax
setb %r13b
shll $0x5, %r13d
addq %rax, %r13
leaq 0x3e6c(%rip), %rax      # 0x44379
jmp 0x403b3
movl -0x80(%rbp), %esi
movq -0x88(%rbp), %r14
testl %esi, %esi
je 0x4074c
pushq $0x1
popq %rax
movl %eax, -0x40(%rbp)
jle 0x40567
movq (%r14), %r12
movq (%r12), %rax
testq %rax, %rax
je 0x40567
movl 0x10(%rax), %eax
andl $-0x2, %eax
cmpl $0x10, %eax
jne 0x40567
movq 0x18(%r12), %rdi
movl %esi, %r13d
xorl %esi, %esi
callq 0x4000a
movl %r13d, %esi
movq %rax, (%r12)
movq (%r14), %rax
movq (%rax), %rcx
movq 0x18(%rax), %rax
movq %rcx, 0x18(%rax)
pushq $-0xa
popq %rax
movl %eax, -0x2c(%rbp)
xorl %eax, %eax
testl %esi, %esi
movl $0x0, %edx
movl %esi, -0x30(%rbp)
cmovgl %esi, %edx
xorl %r9d, %r9d
xorl %esi, %esi
xorl %r13d, %r13d
cmpq %rdx, %rax
je 0x40731
movq (%r14,%rax,8), %r8
movq 0x18(%r8), %rdi
movl 0x10(%rdi), %r11d
btl $0x9, %r11d
jb 0x40686
btl $0xa, %r11d
jb 0x406f1
btl $0xb, %r11d
jae 0x405c1
cmpq $0x0, 0x30(%r8)
je 0x4070b
btl $0xc, %r11d
jb 0x406ff
testb $0x40, %r11b
je 0x405dd
cmpq $0x0, 0x30(%r8)
je 0x4071d
testb %r11b, %r11b
js 0x4070f
testq %rax, %rax
je 0x40720
andl $0x20, %r11d
je 0x40720
movq (%r8), %rcx
movl 0x10(%rcx), %r11d
leal -0x7(%r11), %ecx
cmpl $0x1, %ecx
ja 0x40720
movq -0x8(%r14,%rax,8), %rcx
movq 0x30(%rcx), %rcx
leaq 0x2734(%rip), %rdi      # 0x42d51
cmpq %rdi, %rcx
setne %dil
leaq 0x3b83(%rip), %r10      # 0x441ae
cmpq %r10, %rcx
setne %cl
testb %cl, %dil
jne 0x40720
xorl %edi, %edi
cmpl $0x8, %r11d
sete %dil
xorl $0x11, %edi
xorl %r12d, %r12d
movq %r12, %r11
addq $0x20, %r12
cmpq $0x660, %r12            # imm = 0x660
je 0x40668
leaq 0x43cbf(%rip), %rcx     # 0x84320
cmpl %edi, 0x10(%r11,%rcx)
jne 0x4064a
leaq 0x43cb1(%rip), %rcx     # 0x84320
addq %rcx, %r11
movq %r11, (%r8)
movq (%r14,%rax,8), %rcx
movq 0x18(%rcx), %rcx
movq %r11, 0x18(%rcx)
jmp 0x40720
testq %rax, %rax
je 0x406ec
movq -0x8(%r14,%rax,8), %r8
movq 0x18(%r8), %r12
movq 0x30(%r8), %r8
leaq 0x26b2(%rip), %rcx      # 0x42d51
cmpq %rcx, %r8
sete %cl
leaq 0x3b02(%rip), %r10      # 0x441ae
cmpq %r10, %r8
sete %r10b
orb %cl, %r10b
movl 0x10(%r12), %r8d
testw $0x740c, %r8w           # imm = 0x740C
setne %cl
orb %r10b, %cl
cmpb $0x1, %cl
jne 0x406ec
andl $0x20, %r8d
jne 0x406ec
orl $0x20, %r11d
movl %r11d, 0x10(%rdi)
leaq 0x4435f(%rip), %r8      # 0x84a40
movq %r8, 0x18(%rdi)
movq (%r14,%rax,8), %rcx
movq %r8, (%rcx)
incl %r9d
jmp 0x40720
testl %r9d, %r9d
jle 0x4078d
decl %r9d
jmp 0x40720
testl %esi, %esi
jle 0x4080d
decl %esi
jmp 0x40720
incl %esi
jmp 0x40720
testl %r13d, %r13d
jle 0x40829
decl %r13d
jmp 0x40720
incl %r13d
incq %rax
jmp 0x40584
pushq $-0x1
popq %r12
jmp 0x40801
orl %esi, %r9d
orl %r13d, %r9d
je 0x40763
movq (%r14), %rax
movq 0x18(%rax), %rdi
leaq 0x2585f(%rip), %rcx     # 0x65fa6
jmp 0x40830
xorl %eax, %eax
xorl %r12d, %r12d
jmp 0x40854
movl 0x14(%r8), %edx
leaq 0x25212(%rip), %rcx     # 0x65973
jmp 0x407d8
movq %rbx, %rdi
movq %r14, %rsi
movl -0x30(%rbp), %edx
callq 0x4339b
testl %eax, %eax
je 0x40799
movl %eax, %r12d
jmp 0x40851
movq 0x18(%r14), %rax
movl 0x14(%rax), %edx
leaq 0x255bf(%rip), %rcx     # 0x65d4a
jmp 0x407d8
leaq 0x257a9(%rip), %rcx     # 0x65f3d
jmp 0x40830
movq (%r14), %r12
testq %r12, %r12
je 0x40816
movq -0x68(%rbp), %rax
testq %rax, %rax
je 0x407b7
movq %rbx, %rdi
movq %r12, %rsi
callq *%rax
cmpl $-0xa, %eax
je 0x40824
movq %rbx, %rdi
movq %r12, %rsi
movl -0x4c(%rbp), %edx
callq 0x42fba
movl %eax, -0x2c(%rbp)
jmp 0x40824
movq 0x18(%r14), %rax
movl 0x14(%rax), %edx
leaq 0x2559a(%rip), %rcx     # 0x65d72
pushq $0x1
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3eed6
xorl %r12d, %r12d
cmpl $-0xa, %eax
sete %r12b
addl %r12d, %r12d
orl $-0xc, %r12d
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x27bf8
movq -0x88(%rbp), %r14
movl -0x80(%rbp), %eax
jmp 0x40854
leaq 0x2574c(%rip), %rcx     # 0x65f60
jmp 0x40830
movl $0x0, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x30(%rbp), %eax
jmp 0x4085f
leaq 0x25753(%rip), %rcx     # 0x65f83
movl 0x14(%rdi), %edx
pushq $0x1
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3eed6
xorl %r12d, %r12d
cmpl $-0xa, %eax
sete %r12b
addl %r12d, %r12d
orl $-0xc, %r12d
movl -0x30(%rbp), %eax
movl $0x0, -0x40(%rbp)
movl %r12d, -0x2c(%rbp)
movl %eax, %r13d
xorl %r12d, %r12d
cmpq %r12, %r13
je 0x40880
movq (%r14,%r12,8), %rsi
testq %rsi, %rsi
je 0x4087b
movq %rbx, %rdi
callq 0x4503d
incq %r12
jmp 0x40865
movq -0x60(%rbp), %rax
movq %rax, 0x160(%rbx)
movq %r15, 0x158(%rbx)
cmpl $-0xa, -0x2c(%rbp)
movl -0x40(%rbp), %r12d
jne 0x408ad
leaq -0x90(%rbp), %rdi
callq 0x31feb
pushq $-0xa
popq %rax
jmp 0x408c7
leaq -0x90(%rbp), %rdi
callq 0x31feb
xorl %eax, %eax
testl %r12d, %r12d
setg %al
leal (%rax,%rax,2), %eax
addl $-0x3, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x255a1(%rip), %rcx     # 0x65e7e
jmp 0x408e6
leaq 0x255dc(%rip), %rcx     # 0x65ec2
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl -0x2c(%rbp), %edx
jmp 0x407de
pushq $-0xa
popq %r12
jmp 0x407f6
andq $0x0, 0x30(%r14)
movl 0x14(%r8), %edx
leaq 0x25494(%rip), %rcx     # 0x65da1
pushq $0x1
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3eed6
jmp 0x407e5