// File: /workspace/github_c_makefile_star2_O1/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
xorl %eax, %eax
leaq 0x4a34e(%rip), %r13     # 0x93950
leaq 0x2e0e7(%rip), %r15     # 0x776f0
movq 0x158(%r14), %r8
cmpq 0x160(%r14), %r8
jae 0x49728
testb $0x4, 0x10(%r8)
jne 0x49628
xorl %ecx, %ecx
jmp 0x49694
movl 0x18(%r8), %edx
movl $0x8, %ecx
cmpl %edx, -0x8(%rcx,%r13)
je 0x49649
addq $0x10, %rcx
cmpq $0xe8, %rcx
jne 0x49631
xorl %ecx, %ecx
jmp 0x4964d
movq (%rcx,%r13), %rcx
movb $0x1, %r12b
testq %rcx, %rcx
jne 0x4968b
leal -0xd(%rdx), %ecx
cmpl $0x4, %ecx
jb 0x49689
cmpl $0x2, %edx
je 0x49689
movl 0x14(%r8), %edx
xorl %r12d, %r12d
movq %r14, %rdi
movl $0x1, %esi
movq %r15, %rcx
xorl %eax, %eax
callq 0x49434
cmpl $-0xa, %eax
jne 0x49714
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
xorl %ecx, %ecx
testb %r12b, %r12b
je 0x49728
movq %r14, %rdi
testq %rcx, %rcx
je 0x496a0
callq *%rcx
jmp 0x496d4
xorl %esi, %esi
xorl %edx, %edx
callq 0x4a7a9
movl %eax, %r12d
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
cmpl $-0x3, %r12d
je 0x496d4
movq (%r14), %rdi
movl $0xb, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x493c1
movl %r12d, %eax
cmpl $-0xa, %eax
je 0x49723
movq 0x158(%r14), %rdx
movq 0x160(%r14), %rcx
cmpq %rcx, %rdx
jae 0x49709
addq $0x20, %rdx
testb $0x4, -0xe(%rdx)
je 0x49709
movq %rdx, 0x158(%r14)
leaq 0x20(%rdx), %rsi
cmpq %rcx, %rdx
movq %rsi, %rdx
jb 0x496f0
testb $0x1, %bl
je 0x49609
jmp 0x49728
leaq 0x1056(%rip), %rcx      # 0x4a771
movb $0x1, %r12b
jmp 0x4968b
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq