// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: GenStateCompileChunk
static sxi32 GenStateCompileChunk(
	jx9_gen_state *pGen, /* Code generator state */
	sxi32 iFlags             /* Compile flags */
	)
{
	ProcLangConstruct xCons;
	sxi32 rc;
	rc = SXRET_OK; /* Prevent compiler warning */
	for(;;){
		if( pGen->pIn >= pGen->pEnd ){
			/* No more input to process */
			break;
		}
		xCons = 0;
		if( pGen->pIn->nType & JX9_TK_KEYWORD ){
			sxu32 nKeyword = (sxu32)SX_PTR_TO_INT(pGen->pIn->pUserData);
			/* Try to extract a language construct handler */
			xCons = GenStateGetStatementHandler(nKeyword);
			if( xCons == 0 && !jx9IsLangConstruct(nKeyword) ){
				rc = jx9GenCompileError(pGen, E_ERROR, pGen->pIn->nLine,
					"Syntax error: Unexpected keyword '%z'",
					&pGen->pIn->sData);
				if( rc == SXERR_ABORT ){
					break;
				}
				/* Synchronize with the first semi-colon and avoid compiling
				 * this erroneous statement.
				 */
				xCons = jx9ErrorRecover;
			}
		}
		if( xCons == 0 ){
			/* Assume an expression an try to compile it */
			rc = jx9CompileExpr(&(*pGen), 0, 0);
			if(  rc != SXERR_EMPTY ){
				/* Pop l-value */
				jx9VmEmitInstr(pGen->pVm, JX9_OP_POP, 1, 0, 0, 0);
			}
		}else{
			/* Go compile the sucker */
			rc = xCons(&(*pGen));
		}
		if( rc == SXERR_ABORT ){
			/* Request to abort compilation */
			break;
		}
		/* Ignore trailing semi-colons ';' */
		while( pGen->pIn < pGen->pEnd && (pGen->pIn->nType & JX9_TK_SEMI) ){
			pGen->pIn++;
		}
		if( iFlags & JX9_COMPILE_SINGLE_STMT ){
			/* Compile a single statement and return */
			break;
		}
		/* LOOP ONE */
		/* LOOP TWO */
		/* LOOP THREE */
		/* LOOP FOUR */
	}
	/* Return compilation status */
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0x158(%rdi), %r8
movq 0x160(%rdi), %rcx
pushq $-0x3
popq %r15
leaq 0x458d6(%rip), %r12     # 0x84960
xorl %eax, %eax
cmpq %rcx, %r8
jae 0x3f16a
testb $0x4, 0x10(%r8)
je 0x3f0d1
movl 0x18(%r8), %eax
xorl %ecx, %ecx
leaq 0x10(%rcx), %rdx
cmpq $0xf0, %rdx
je 0x3f0c2
cmpl %eax, (%rcx,%r12)
movq %rdx, %rcx
jne 0x3f0a2
movq -0x8(%rdx,%r12), %rcx
testq %rcx, %rcx
jne 0x3f128
cmpl $0x10, %eax
ja 0x3f104
movl $0x1e004, %ecx          # imm = 0x1E004
btl %eax, %ecx
jae 0x3f104
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4012f
movl %eax, %r13d
movl %r15d, %eax
cmpl $-0x3, %r13d
je 0x3f132
movq (%r14), %rdi
pushq $0xb
popq %rsi
pushq $0x1
popq %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x3ee6f
movl %r13d, %eax
jmp 0x3f12d
movl 0x14(%r8), %edx
movq %r14, %rdi
pushq $0x1
popq %rsi
leaq 0x265c6(%rip), %rcx     # 0x656db
xorl %eax, %eax
callq 0x3eed6
leaq 0xfde(%rip), %rcx       # 0x40101
cmpl $-0xa, %eax
je 0x3f167
movq %r14, %rdi
callq *%rcx
cmpl $-0xa, %eax
je 0x3f167
movq 0x158(%r14), %rdx
movq 0x160(%r14), %rcx
addq $0x20, %rdx
leaq -0x20(%rdx), %r8
cmpq %rcx, %r8
jae 0x3f15c
testb $0x4, -0xe(%rdx)
je 0x3f15c
movq %rdx, 0x158(%r14)
jmp 0x3f140
testb $0x1, %bl
je 0x3f08c
jmp 0x3f16a
pushq $-0xa
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq