// File: /workspace/github_c_makefile_star2_O3/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:
movq 0x158(%rdi), %r8
xorl %eax, %eax
cmpq 0x160(%rdi), %r8
jae 0x486b0
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
leaq 0x493a9(%rip), %r13     # 0x91950
leaq 0x11a3(%rip), %r15      # 0x49751
testb $0x4, 0x10(%r8)
je 0x485ea
movl 0x18(%r8), %eax
movl $0x8, %ecx
cmpl %eax, -0x8(%rcx,%r13)
je 0x485d4
addq $0x10, %rcx
cmpq $0xe8, %rcx
jne 0x485be
jmp 0x485dd
movq (%rcx,%r13), %rcx
testq %rcx, %rcx
jne 0x48645
leal -0xd(%rax), %ecx
cmpl $0x4, %ecx
jb 0x485ea
cmpl $0x2, %eax
jne 0x48623
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x49789
movl %eax, %r12d
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
cmpl $-0x3, %r12d
je 0x4864f
movq (%r14), %rdi
movl $0xb, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x48365
movl %r12d, %eax
jmp 0x4864a
movl 0x14(%r8), %edx
movq %r14, %rdi
movl $0x1, %esi
leaq 0x2d0c5(%rip), %rcx     # 0x756fb
xorl %eax, %eax
callq 0x483d1
movq %r15, %rcx
cmpl $-0xa, %eax
je 0x4869d
movq %r14, %rdi
callq *%rcx
cmpl $-0xa, %eax
je 0x4869d
movq 0x158(%r14), %r8
movq 0x160(%r14), %rcx
cmpq %rcx, %r8
jae 0x4868d
addq $0x20, %r8
testb $0x4, -0xe(%r8)
je 0x48689
movq %r8, 0x158(%r14)
leaq 0x20(%r8), %rdx
cmpq %rcx, %r8
movq %rdx, %r8
jb 0x48666
addq $-0x20, %rdx
movq %rdx, %r8
jmp 0x4868d
addq $-0x20, %r8
testb $0x1, %bl
jne 0x486a2
cmpq %rcx, %r8
jb 0x485ae
jmp 0x486a2
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq