// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x158(%rdi), %r15
movl 0x18(%r15), %eax
leaq 0x20(%r15), %rcx
movq %rcx, 0x158(%rdi)
cmpl $0x2, %eax
jne 0x4f740
leaq -0x30(%rbp), %r15
movq $0x0, (%r15)
movq (%rbx), %rdi
movq 0x160(%rbx), %r14
movl $0x4, %esi
xorl %edx, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x493c1
movq 0x158(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4dc3f
testl %eax, %eax
sete %r12b
jne 0x4f7be
movq -0x30(%rbp), %rax
cmpq %rax, 0x158(%rbx)
jae 0x4f71b
movq %rax, 0x160(%rbx)
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x4a7a9
cmpl $-0x3, %eax
je 0x4f71b
cmpl $-0xa, %eax
je 0x4f7c5
movq (%rbx), %rdi
movl $0x3e, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x493c1
movq -0x30(%rbp), %rdi
cmpq %r14, %rdi
jae 0x4f730
testb $0x2, 0x12(%rdi)
je 0x4f730
addq $0x20, %rdi
jmp 0x4f71f
movq %rdi, -0x30(%rbp)
movq %rdi, 0x158(%rbx)
jmp 0x4f6b9
movl $0x0, -0x24(%rbp)
xorl %r14d, %r14d
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x4a7a9
cmpl $-0xa, %eax
je 0x4f826
cmpl $-0x3, %eax
je 0x4f76d
movl $0x1, %r14d
leaq -0x24(%rbp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x50201
testl %eax, %eax
je 0x4f7f2
movq (%rbx), %rdi
leaq -0x24(%rbp), %rsi
callq 0x49175
movq %rax, %r12
testq %rax, %rax
je 0x4f7d2
movq (%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x45a64
movl 0x28(%r12), %edx
testl %edx, %edx
je 0x4f7ed
movl -0x24(%rbp), %ecx
leaq 0x8(%rbx), %rdi
movq 0x20(%r12), %rsi
callq 0x4542b
jmp 0x4f7ed
movq %r14, 0x160(%rbx)
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
testb $0x1, %r12b
je 0x4f822
jmp 0x4f82b
leaq 0x27f75(%rip), %rcx     # 0x7774e
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x49434
testq %r12, %r12
je 0x4f826
movq (%rbx), %rdi
movl -0x24(%rbp), %ecx
movl $0x4, %esi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x493c1
movq (%rbx), %rdi
movl $0x10, %esi
movl %r14d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x493c1
xorl %eax, %eax
jmp 0x4f82b
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq