// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9CompileLiteral
JX9_PRIVATE sxi32 jx9CompileLiteral(jx9_gen_state *pGen,sxi32 iCompileFlag)
{
	SyToken *pToken = pGen->pIn;
	jx9_value *pObj;
	SyString *pStr;	
	sxu32 nIdx;
	/* Extract token value */
	pStr = &pToken->sData;
	/* Deal with the reserved literals [i.e: null, false, true, ...] first */
	if( pStr->nByte == sizeof("NULL") - 1 ){
		if( SyStrnicmp(pStr->zString, "null", sizeof("NULL")-1) == 0 ){
			/* NULL constant are always indexed at 0 */
			jx9VmEmitInstr(pGen->pVm, JX9_OP_LOADC, 0, 0, 0, 0);
			return SXRET_OK;
		}else if( SyStrnicmp(pStr->zString, "true", sizeof("TRUE")-1) == 0 ){
			/* TRUE constant are always indexed at 1 */
			jx9VmEmitInstr(pGen->pVm, JX9_OP_LOADC, 0, 1, 0, 0);
			return SXRET_OK;
		}
	}else if (pStr->nByte == sizeof("FALSE") - 1 &&
		SyStrnicmp(pStr->zString, "false", sizeof("FALSE")-1) == 0 ){
			/* FALSE constant are always indexed at 2 */
			jx9VmEmitInstr(pGen->pVm, JX9_OP_LOADC, 0, 2, 0, 0);
			return SXRET_OK;
	}else if(pStr->nByte == sizeof("__LINE__") - 1 &&
		SyMemcmp(pStr->zString, "__LINE__", sizeof("__LINE__")-1) == 0 ){
			/* TICKET 1433-004: __LINE__ constant must be resolved at compile time, not run time */
			pObj = jx9VmReserveConstObj(pGen->pVm, &nIdx);
			if( pObj == 0 ){
				SXUNUSED(iCompileFlag); /* cc warning */
				return GenStateOutOfMem(pGen);
			}
			jx9MemObjInitFromInt(pGen->pVm, pObj, pToken->nLine);
			/* Emit the load constant instruction */
			jx9VmEmitInstr(pGen->pVm, JX9_OP_LOADC, 0, nIdx, 0, 0);
			return SXRET_OK;
	}else if( pStr->nByte == sizeof("__FUNCTION__") - 1 &&
		SyMemcmp(pStr->zString, "__FUNCTION__", sizeof("__FUNCTION__")-1) == 0 ){
			GenBlock *pBlock = pGen->pCurrent;
			/* TICKET 1433-004: __FUNCTION__/__METHOD__ constants must be resolved at compile time, not run time */
			while( pBlock && (pBlock->iFlags & GEN_BLOCK_FUNC) == 0 ){
				/* Point to the upper block */
				pBlock = pBlock->pParent;
			}
			if( pBlock == 0 ){
				/* Called in the global scope, load NULL */
				jx9VmEmitInstr(pGen->pVm, JX9_OP_LOADC, 0, 0, 0, 0);
			}else{
				/* Extract the target function/method */
				jx9_vm_func *pFunc = (jx9_vm_func *)pBlock->pUserData;
				pObj = jx9VmReserveConstObj(pGen->pVm, &nIdx);
				if( pObj == 0 ){
					return GenStateOutOfMem(pGen);
				}
				jx9MemObjInitFromString(pGen->pVm, pObj, &pFunc->sName);
				/* Emit the load constant instruction */
				jx9VmEmitInstr(pGen->pVm, JX9_OP_LOADC, 0, nIdx, 0, 0);
			}
			return SXRET_OK;
	}
	/* Query literal table */
	if( SXRET_OK != GenStateFindLiteral(&(*pGen), &pToken->sData, &nIdx) ){
		jx9_value *pObj;
		/* Unknown literal, install it in the literal table */
		pObj = jx9VmReserveConstObj(pGen->pVm, &nIdx);
		if( pObj == 0 ){
			return GenStateOutOfMem(pGen);
		}
		jx9MemObjInitFromString(pGen->pVm, pObj, &pToken->sData);
		GenStateInstallLiteral(&(*pGen), pObj, nIdx);
	}
	/* Emit the load constant instruction */
	jx9VmEmitInstr(pGen->pVm,JX9_OP_LOADC,1,nIdx, 0, 0);
	/* Node successfully compiled */
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x158(%rdi), %r14
movl 0x8(%r14), %eax
addl $-0x4, %eax
cmpl $0x8, %eax
ja 0x442a0
leaq 0x1e5f3(%rip), %rcx     # 0x627cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r14), %r15
leaq 0x228d3(%rip), %rsi     # 0x66abf
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x32436
testl %eax, %eax
je 0x44312
leaq 0x1da68(%rip), %rsi     # 0x61c6e
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x32436
testl %eax, %eax
jne 0x442a0
movq (%rbx), %rdi
xorl %ebx, %ebx
pushq $0x4
popq %rsi
pushq $0x1
jmp 0x44284
movq (%r14), %rdi
leaq 0x21c39(%rip), %rsi     # 0x65e68
pushq $0x8
popq %rdx
callq 0x2d30e
testl %eax, %eax
jne 0x442a0
movq (%rbx), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x3ebdc
testq %rax, %rax
je 0x4436c
movq (%rbx), %rdi
movl 0x14(%r14), %edx
movq %rax, %rsi
callq 0x3c0cd
jmp 0x44347
movq (%r14), %rdi
leaq 0x1da05(%rip), %rsi     # 0x61c73
pushq $0x5
popq %rdx
callq 0x32436
testl %eax, %eax
jne 0x442a0
movq (%rbx), %rdi
xorl %ebx, %ebx
pushq $0x4
popq %rsi
pushq $0x2
popq %rcx
jmp 0x44352
movq (%r14), %rdi
leaq 0x21bdd(%rip), %rsi     # 0x65e71
pushq $0xc
popq %rdx
callq 0x2d30e
testl %eax, %eax
je 0x442f7
leaq -0x1c(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x44ea5
testl %eax, %eax
je 0x442e7
movq (%rbx), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x3ebdc
testq %rax, %rax
je 0x4436c
movq %rax, %r15
movq (%rbx), %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x3bbfe
movl -0x1c(%rbp), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x44ed8
movq (%rbx), %rdi
movl -0x1c(%rbp), %ecx
xorl %ebx, %ebx
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
jmp 0x44354
leaq 0xc8(%rbx), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x44312
testb $0x8, 0x14(%rax)
jne 0x44320
addq $0x8, %rax
jmp 0x442fe
movq (%rbx), %rdi
xorl %ebx, %ebx
pushq $0x4
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x44354
movq 0x40(%rax), %r14
movq (%rbx), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x3ebdc
testq %rax, %rax
je 0x4436c
movq (%rbx), %rdi
addq $0x50, %r14
movq %rax, %rsi
movq %r14, %rdx
callq 0x3bbfe
movq (%rbx), %rdi
movl -0x1c(%rbp), %ecx
xorl %ebx, %ebx
pushq $0x4
popq %rsi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x3ee6f
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x426d9
pushq $-0xa
popq %rbx
jmp 0x4435f