// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9CompileJsonObject
JX9_PRIVATE sxi32 jx9CompileJsonObject(jx9_gen_state *pGen, sxi32 iCompileFlag)
{
	SyToken *pKey, *pCur;
	sxi32 nPair = 0;
	sxi32 rc;

	pGen->pIn++; /* Jump the open querly braces '{'*/
	pGen->pEnd--;
	SXUNUSED(iCompileFlag); /* cc warning */
	for(;;){
		/* Jump leading commas */
		while( pGen->pIn < pGen->pEnd && (pGen->pIn->nType & JX9_TK_COMMA) ){
			pGen->pIn++;
		}
		pCur = pGen->pIn;
		if( SXRET_OK != jx9GetNextExpr(pGen->pIn, pGen->pEnd, &pGen->pIn) ){
			/* No more entry to process */
			break;
		}
		/* Compile the key */
		pKey = pCur;
		while( pCur < pGen->pIn ){
			if( pCur->nType & JX9_TK_COLON /*':'*/  ){
				break;
			}
			pCur++;
		}
		rc = SXERR_EMPTY;
		if( pCur < pGen->pIn ){
			if( &pCur[1] >= pGen->pIn ){
				/* Missing value */
				rc = jx9GenCompileError(&(*pGen), E_ERROR, pCur->nLine, "JSON Object: Missing entry value");
				if( rc == SXERR_ABORT ){
					return SXERR_ABORT;
				}
				return SXRET_OK;
			}
			/* Compile the expression holding the key */
			rc = GenStateCompileJSONEntry(&(*pGen), pKey, pCur,
				EXPR_FLAG_RDONLY_LOAD                /* Do not create the variable if inexistant */, 
				GenStateJSONObjectKeyNodeValidator   /* Node validator callback */
				);
			if( rc == SXERR_ABORT ){
				return SXERR_ABORT;
			}
			pCur++; /* Jump the double colon ':'  */
		}else if( pKey == pCur ){
			/* Key is omitted, emit an error */
			jx9GenCompileError(&(*pGen),E_ERROR, pCur->nLine, "JSON Object: Missing entry key");
			pCur++; /* Jump the double colon ':'  */
		}else{
			/* Reset back the cursor and point to the entry value */
			pCur = pKey;
		}
		/* Compile indice value */
		rc = GenStateCompileJSONEntry(&(*pGen), pCur, pGen->pIn, EXPR_FLAG_RDONLY_LOAD/*Do not create the variable if inexistant*/,0);
		if( rc == SXERR_ABORT ){
			return SXERR_ABORT;
		}
		nPair++;
	}
	/* Emit the load map instruction */
	jx9VmEmitInstr(pGen->pVm, JX9_OP_LOAD_MAP, nPair * 2, 1, 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
addq $0x20, 0x158(%rdi)
addq $-0x20, 0x160(%rdi)
leaq 0x158(%rdi), %r15
xorl %r14d, %r14d
movq 0x158(%rbx), %r12
movq 0x160(%rbx), %rsi
cmpq %rsi, %r12
jae 0x4efc6
addq $0x20, %r12
testb $0x2, -0xe(%r12)
je 0x4efc2
movq %r12, (%r15)
leaq 0x20(%r12), %rax
cmpq %rsi, %r12
movq %rax, %r12
jb 0x4efa1
addq $-0x20, %rax
movq %rax, %r12
jmp 0x4efc6
addq $-0x20, %r12
movq %r12, %rdi
movq %r15, %rdx
callq 0x4dc3f
testl %eax, %eax
jne 0x4f0ee
movl %r14d, -0x2c(%rbp)
movq (%r15), %r14
movq %r12, %r13
cmpq %r14, %r12
setb %al
jae 0x4f076
testb $0x10, 0x12(%r12)
movq %r12, %r13
jne 0x4f01c
leaq 0x20(%r12), %r13
cmpq %r14, %r13
setb %al
jae 0x4f076
leaq 0x20(%r13), %rcx
testb $0x10, 0x12(%r13)
movq %rcx, %r13
je 0x4efff
addq $-0x20, %rcx
movq %rcx, %r13
testb %al, %al
je 0x4f076
leaq 0x20(%r13), %rax
cmpq %r14, %rax
jae 0x4f121
movq 0x160(%rbx), %rcx
movq %rcx, -0x38(%rbp)
movq %r12, 0x158(%rbx)
movq %r13, 0x160(%rbx)
movq %rbx, %rdi
movl $0x2, %esi
leaq 0x7e3(%rip), %rdx       # 0x4f838
movq %rax, %r12
callq 0x4a7a9
movq %r14, 0x158(%rbx)
movq -0x38(%rbp), %rcx
movq %rcx, 0x160(%rbx)
cmpl $-0xa, %eax
jne 0x4f09c
jmp 0x4f0e6
cmpq %r13, %r12
jne 0x4f09c
movl 0x14(%r13), %edx
movq %rbx, %rdi
movl $0x1, %esi
leaq 0x28d6d(%rip), %rcx     # 0x77dfb
xorl %eax, %eax
callq 0x49434
addq $0x20, %r13
movq %r13, %r12
movq 0x158(%rbx), %r14
movq 0x160(%rbx), %r13
movq %r12, 0x158(%rbx)
movq %r14, 0x160(%rbx)
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x4a7a9
movq %r14, 0x158(%rbx)
movq %r13, 0x160(%rbx)
cmpl $-0xa, %eax
je 0x4f0e6
movl -0x2c(%rbp), %r14d
incl %r14d
jmp 0x4ef8a
movl $0xfffffff6, %r15d      # imm = 0xFFFFFFF6
jmp 0x4f10f
movq (%rbx), %rdi
addl %r14d, %r14d
xorl %r15d, %r15d
movl $0x6, %esi
movl %r14d, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x493c1
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x14(%r13), %edx
leaq 0x28cae(%rip), %rcx     # 0x77dda
xorl %r15d, %r15d
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x49434
cmpl $-0xa, %eax
cmovel %eax, %r15d
jmp 0x4f10f