// File: /workspace/github_c_makefile_star2_O3/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, %r15
leaq 0x158(%rdi), %r14
movq 0x158(%rdi), %r13
movq 0x160(%rdi), %r12
addq $0x20, %r13
movq %r13, 0x158(%rdi)
addq $-0x20, %r12
movq %r12, 0x160(%rdi)
movl $0x0, -0x2c(%rbp)
movq %r14, -0x38(%rbp)
cmpq %r12, %r13
jae 0x4daed
addq $0x20, %r13
testb $0x2, -0xe(%r13)
je 0x4dae9
movq %r13, (%r14)
leaq 0x20(%r13), %rbx
cmpq %r12, %r13
movq %rbx, %r13
jb 0x4dacd
addq $-0x20, %rbx
jmp 0x4daf0
addq $-0x20, %r13
movq %r13, %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x4ca44
testl %eax, %eax
jne 0x4dbfe
movq %r15, %rdi
movq (%r14), %r13
movq %rbx, %r15
cmpq %r13, %rbx
jae 0x4db31
leaq 0x20(%rbx), %r12
testb $0x10, -0xe(%r12)
jne 0x4db63
leaq 0x20(%r12), %r15
cmpq %r13, %r12
movq %r15, %r12
jb 0x4db18
addq $-0x20, %r15
cmpq %r15, %rbx
movq %rdi, %r14
jne 0x4dbb0
movl 0x14(%r15), %edx
movq %r14, %rdi
movl $0x1, %esi
leaq 0x282ba(%rip), %rcx     # 0x75e06
xorl %eax, %eax
callq 0x483d1
addq $0x20, %r15
movq 0x158(%r14), %r13
movq %r15, %rbx
jmp 0x4dbb0
cmpq %r13, %r12
jae 0x4dc30
leaq -0x20(%r12), %rax
movq %rdi, %r14
movq 0x160(%rdi), %r15
movq %rbx, 0x158(%rdi)
movq %rax, 0x160(%rdi)
movl $0x2, %esi
leaq 0x783(%rip), %rdx       # 0x4e318
callq 0x49789
movq %r13, 0x158(%r14)
movq %r15, 0x160(%r14)
movq %r12, %rbx
cmpl $-0xa, %eax
je 0x4dbf6
movq 0x160(%r14), %r12
movq %rbx, 0x158(%r14)
movq %r13, 0x160(%r14)
movq %r14, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x49789
movq %r13, 0x158(%r14)
movq %r12, 0x160(%r14)
cmpl $-0xa, %eax
je 0x4dbf6
movq %r14, %r15
incl -0x2c(%rbp)
movq -0x38(%rbp), %r14
jmp 0x4dac4
movl $0xfffffff6, %r14d      # imm = 0xFFFFFFF6
jmp 0x4dc1e
movq (%r15), %rdi
movl -0x2c(%rbp), %edx
addl %edx, %edx
xorl %r14d, %r14d
movl $0x6, %esi
movl $0x1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x48365
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0xc(%r12), %edx
leaq 0x281a9(%rip), %rcx     # 0x75de5
xorl %r14d, %r14d
movl $0x1, %esi
xorl %eax, %eax
callq 0x483d1
cmpl $-0xa, %eax
cmovel %eax, %r14d
jmp 0x4dc1e