// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9CompileVariable
JX9_PRIVATE sxi32 jx9CompileVariable(jx9_gen_state *pGen,sxi32 iCompileFlag)
{
	sxu32 nLine = pGen->pIn->nLine;
	SyHashEntry *pEntry;
	SyString *pName;
	char *zName = 0;
	sxi32 iP1;
	void *p3;
	sxi32 rc;
	
	pGen->pIn++; /* Jump the dollar sign '$' */
	if( pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (JX9_TK_ID|JX9_TK_KEYWORD)) == 0 ){
		/* Invalid variable name */
		rc = jx9GenCompileError(pGen, E_ERROR, nLine, "Invalid variable name");
		if( rc == SXERR_ABORT ){
			/* Error count limit reached, abort immediately */
			return SXERR_ABORT;
		}
		return SXRET_OK;
	}
	/* Extract variable name */
	pName = &pGen->pIn->sData;
	/* Advance the stream cursor */
	pGen->pIn++;
	pEntry = SyHashGet(&pGen->hVar, (const void *)pName->zString, pName->nByte);
	if( pEntry == 0 ){
		/* Duplicate name */
		zName = SyMemBackendStrDup(&pGen->pVm->sAllocator, pName->zString, pName->nByte);
		if( zName == 0 ){
			return GenStateOutOfMem(pGen);
		}
		/* Install in the hashtable */
		SyHashInsert(&pGen->hVar, zName, pName->nByte, zName);
	}else{
		/* Name already available */
		zName = (char *)pEntry->pUserData;
	}
	p3 = (void *)zName;	
	iP1 = 0;
	if( iCompileFlag & EXPR_FLAG_RDONLY_LOAD ){
		if( (iCompileFlag & EXPR_FLAG_LOAD_IDX_STORE) == 0 ){
			/* Read-only load.In other words do not create the variable if inexistant */
			iP1 = 1;
		}
	}
	/* Emit the load instruction */
	jx9VmEmitInstr(pGen->pVm, JX9_OP_LOAD, iP1, 0, p3, 0);
	/* Node successfully compiled */
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
movl 0x14(%rax), %eax
movl %eax, -0x18(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x158(%rax)
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x160(%rcx), %rax
jae 0x851dc
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
movl 0x10(%rax), %eax
andl $0xc, %eax
cmpl $0x0, %eax
jne 0x85217
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
movl $0x1, %esi
leaq 0x3ec85(%rip), %rcx     # 0xc3e74
movb $0x0, %al
callq 0x7e990
movl %eax, -0x44(%rbp)
cmpl $-0xa, -0x44(%rbp)
jne 0x8520b
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x8531c
movl $0x0, -0x4(%rbp)
jmp 0x8531c
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x158(%rax)
movq -0x10(%rbp), %rdi
addq $0x88, %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x76c30
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x852bc
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x6da40
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x8529b
movq -0x10(%rbp), %rdi
callq 0x84570
movl %eax, -0x4(%rbp)
jmp 0x8531c
movq -0x10(%rbp), %rdi
addq $0x88, %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x30(%rbp), %rcx
callq 0x77a80
jmp 0x852c8
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x14(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x852f6
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x852f4
movl $0x1, -0x34(%rbp)
jmp 0x852f6
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x34(%rbp), %edx
movq -0x40(%rbp), %r8
movl $0x3, %esi
xorl %ecx, %ecx
xorl %eax, %eax
movl %eax, %r9d
callq 0x7e8f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)