// File: /workspace/github_c_makefile_star2_O3/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9CompileLangConstruct
JX9_PRIVATE sxi32 jx9CompileLangConstruct(jx9_gen_state *pGen,sxi32 iCompileFlag)
{
	SyString *pName;
	sxu32 nKeyID;
	sxi32 rc;
	/* Name of the language construct [i.e: print, die...]*/
	pName = &pGen->pIn->sData;
	nKeyID = (sxu32)SX_PTR_TO_INT(pGen->pIn->pUserData);
	pGen->pIn++; /* Jump the language construct keyword */
	if( nKeyID == JX9_TKWRD_PRINT ){
		SyToken *pTmp, *pNext = 0;
		/* Compile arguments one after one */
		pTmp = pGen->pEnd;
		jx9VmEmitInstr(pGen->pVm, JX9_OP_LOADC, 0, 1 /* Boolean true index */, 0, 0);
		while( SXRET_OK == jx9GetNextExpr(pGen->pIn, pTmp, &pNext) ){
			if( pGen->pIn < pNext ){
				pGen->pEnd = pNext;
				rc = jx9CompileExpr(&(*pGen), EXPR_FLAG_RDONLY_LOAD/* Do not create variable if inexistant */, 0);
				if( rc == SXERR_ABORT ){
					return SXERR_ABORT;
				}
				if( rc != SXERR_EMPTY ){
					/* Ticket 1433-008: Optimization #1: Consume input directly 
					 * without the overhead of a function call.
					 * This is a very powerful optimization that improve
					 * performance greatly.
					 */
					jx9VmEmitInstr(pGen->pVm,JX9_OP_CONSUME,1,0,0,0);
				}
			}
			/* Jump trailing commas */
			while( pNext < pTmp && (pNext->nType & JX9_TK_COMMA) ){
				pNext++;
			}
			pGen->pIn = pNext;
		}
		/* Restore token stream */
		pGen->pEnd = pTmp;	
	}else{
		sxi32 nArg = 0;
		sxu32 nIdx = 0;
		rc = jx9CompileExpr(&(*pGen), EXPR_FLAG_RDONLY_LOAD/* Do not create variable if inexistant */, 0);
		if( rc == SXERR_ABORT ){
			return SXERR_ABORT;
		}else if(rc != SXERR_EMPTY ){
			nArg = 1;
		}
		if( SXRET_OK != GenStateFindLiteral(&(*pGen), pName, &nIdx) ){
			jx9_value *pObj;
			/* Emit the call instruction */
			pObj = jx9VmReserveConstObj(pGen->pVm, &nIdx);
			if( pObj == 0 ){
				SXUNUSED(iCompileFlag); /* cc warning */
				return GenStateOutOfMem(pGen);
			}
			jx9MemObjInitFromString(pGen->pVm, pObj, pName);
			/* Install in the literal table */
			GenStateInstallLiteral(&(*pGen), pObj, nIdx);
		}
		/* Emit the call instruction */
		jx9VmEmitInstr(pGen->pVm, JX9_OP_LOADC, 0, nIdx, 0, 0);
		jx9VmEmitInstr(pGen->pVm, JX9_OP_CALL, nArg, 0, 0, 0);
	}
	/* Node successfully compiled */
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x158(%rdi), %r14
movl 0x18(%r14), %eax
leaq 0x20(%r14), %rcx
movq %rcx, 0x158(%rdi)
cmpl $0x2, %eax
jne 0x4e214
leaq -0x38(%rbp), %r12
movq $0x0, (%r12)
movq (%rbx), %rdi
movq 0x160(%rbx), %r15
xorl %r14d, %r14d
movl $0x4, %esi
xorl %edx, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x48365
movq 0x158(%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4ca44
testl %eax, %eax
jne 0x4e268
movq -0x38(%rbp), %r13
cmpq %r13, 0x158(%rbx)
jae 0x4e1f2
movq %r13, 0x160(%rbx)
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x49789
cmpl $-0x3, %eax
je 0x4e1f2
cmpl $-0xa, %eax
je 0x4e300
movq (%rbx), %rdi
movl $0x3e, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x48365
cmpq %r15, %r13
jae 0x4e204
testb $0x2, 0x12(%r13)
je 0x4e204
addq $0x20, %r13
jmp 0x4e1f2
movq %r13, -0x38(%rbp)
movq %r13, 0x158(%rbx)
movq %r13, %rdi
jmp 0x4e194
movl $0x0, -0x2c(%rbp)
xorl %r15d, %r15d
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x49789
cmpl $-0xa, %eax
je 0x4e300
cmpl $-0x3, %eax
je 0x4e241
movl $0x1, %r15d
movl 0x8(%r14), %edx
testl %edx, %edx
je 0x4e274
cmpl $0x0, 0x30(%rbx)
je 0x4e274
movq (%r14), %rsi
leaq 0x8(%rbx), %rdi
callq 0x448fa
testq %rax, %rax
je 0x4e274
movl 0x10(%rax), %ecx
movl %ecx, -0x2c(%rbp)
jmp 0x4e2b3
movq %r15, 0x160(%rbx)
jmp 0x4e306
movq (%rbx), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x480f1
testq %rax, %rax
je 0x4e2e5
movq %rax, %r12
movq (%rbx), %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x44c17
movl 0x28(%r12), %edx
movl -0x2c(%rbp), %ecx
testl %edx, %edx
je 0x4e2b3
leaq 0x8(%rbx), %rdi
movq 0x20(%r12), %rsi
callq 0x445f4
movl -0x2c(%rbp), %ecx
movq (%rbx), %rdi
xorl %r14d, %r14d
movl $0x4, %esi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x48365
movq (%rbx), %rdi
movl $0x10, %esi
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x48365
jmp 0x4e306
leaq 0x2746d(%rip), %rcx     # 0x75759
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x483d1
movl $0xfffffff6, %r14d      # imm = 0xFFFFFFF6
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq