// File: /workspace/github_c_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x158(%rdi), %r14
movl 0x8(%r14), %r15d
leal -0x4(%r15), %eax
cmpl $0x8, %eax
ja 0x4de90
leaq 0x24a61(%rip), %rcx     # 0x727e8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r14), %r12
leaq 0x28d45(%rip), %rsi     # 0x76adf
movq %r12, %rdi
movl $0x4, %edx
callq 0x39f3f
testl %eax, %eax
je 0x4df21
leaq 0x23ebe(%rip), %rsi     # 0x71c74
movq %r12, %rdi
movl $0x4, %edx
callq 0x39f3f
testl %eax, %eax
jne 0x4de90
movq (%rbx), %rdi
xorl %ebx, %ebx
movl $0x4, %esi
xorl %edx, %edx
movl $0x1, %ecx
jmp 0x4df67
movq (%r14), %rdi
leaq 0x2809d(%rip), %rsi     # 0x75e88
movl $0x8, %edx
callq 0x347f1
testl %eax, %eax
jne 0x4de90
movq (%rbx), %rdi
leaq -0x24(%rbp), %rsi
callq 0x480f1
testq %rax, %rax
je 0x4df74
movq (%rbx), %rcx
movl 0x14(%r14), %edx
xorps %xmm0, %xmm0
movups %xmm0, 0xc(%rax)
movups %xmm0, 0x2c(%rax)
movups %xmm0, 0x1c(%rax)
movl $0x0, 0x3c(%rax)
movq %rcx, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq %rcx, 0x18(%rax)
movq %rdx, (%rax)
movl $0x2, 0x8(%rax)
jmp 0x4df58
movq (%r14), %rdi
leaq 0x23e25(%rip), %rsi     # 0x71c79
movl $0x5, %edx
callq 0x39f3f
testl %eax, %eax
jne 0x4de90
movq (%rbx), %rdi
xorl %ebx, %ebx
movl $0x4, %esi
xorl %edx, %edx
movl $0x2, %ecx
jmp 0x4df67
movq (%r14), %rdi
leaq 0x2800f(%rip), %rsi     # 0x75e91
movl $0xc, %edx
callq 0x347f1
testl %eax, %eax
je 0x4df09
testl %r15d, %r15d
je 0x4deb7
cmpl $0x0, 0x30(%rbx)
je 0x4deb7
movq (%r14), %rsi
leaq 0x8(%rbx), %rdi
movl %r15d, %edx
callq 0x448fa
testq %rax, %rax
je 0x4deb7
movl 0x10(%rax), %ecx
movl %ecx, -0x24(%rbp)
jmp 0x4def8
movq (%rbx), %rdi
leaq -0x24(%rbp), %rsi
callq 0x480f1
testq %rax, %rax
je 0x4df74
movq %rax, %r15
movq (%rbx), %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x44c17
movl 0x28(%r15), %edx
movl -0x24(%rbp), %ecx
testl %edx, %edx
je 0x4def8
leaq 0x8(%rbx), %rdi
movq 0x20(%r15), %rsi
callq 0x445f4
movl -0x24(%rbp), %ecx
movq (%rbx), %rdi
xorl %ebx, %ebx
movl $0x4, %esi
movl $0x1, %edx
jmp 0x4df67
movq 0xc8(%rbx), %rax
testq %rax, %rax
je 0x4df21
testb $0x8, 0x14(%rax)
jne 0x4df31
movq 0x8(%rax), %rax
jmp 0x4df10
movq (%rbx), %rdi
xorl %ebx, %ebx
movl $0x4, %esi
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x4df67
movq 0x40(%rax), %r14
movq (%rbx), %rdi
leaq -0x24(%rbp), %rsi
callq 0x480f1
testq %rax, %rax
je 0x4df74
movq (%rbx), %rdi
addq $0x50, %r14
movq %rax, %rsi
movq %r14, %rdx
callq 0x44c17
movq (%rbx), %rdi
movl -0x24(%rbp), %ecx
xorl %ebx, %ebx
movl $0x4, %esi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x48365
jmp 0x4df94
leaq 0x277de(%rip), %rcx     # 0x75759
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x483d1
movl $0xfffffff6, %ebx       # imm = 0xFFFFFFF6
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq