// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x158(%rax)
movq -0x10(%rbp), %rax
movq 0x160(%rax), %rcx
addq $-0x20, %rcx
movq %rcx, 0x160(%rax)
movl $0x0, -0x14(%rbp)
jmp 0x8801b
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rcx
movq -0x10(%rbp), %rdx
xorl %eax, %eax
cmpq 0x160(%rdx), %rcx
movb %al, -0x31(%rbp)
jae 0x88054
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
movl 0x10(%rax), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
setne %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x8805d
jmp 0x88075
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x158(%rax)
jmp 0x8801b
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x160(%rax), %rsi
movq -0x10(%rbp), %rdx
addq $0x158, %rdx            # imm = 0x158
callq 0x85700
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x880b7
jmp 0x88223
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x158(%rcx), %rax
jae 0x880f1
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x100000, %eax         # imm = 0x100000
cmpl $0x0, %eax
je 0x880e3
jmp 0x880f1
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
jmp 0x880bf
movl $0xfffffffd, -0x30(%rbp) # imm = 0xFFFFFFFD
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x158(%rcx), %rax
jae 0x881a1
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq -0x10(%rbp), %rcx
cmpq 0x158(%rcx), %rax
jb 0x88161
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x14(%rax), %edx
movl $0x1, %esi
leaq 0x3c18d(%rip), %rcx     # 0xc42c6
movb $0x0, %al
callq 0x7e990
movl %eax, -0x30(%rbp)
cmpl $-0xa, -0x30(%rbp)
jne 0x88155
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x8824d
movl $0x0, -0x4(%rbp)
jmp 0x8824d
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl $0x2, %ecx
leaq 0xd27(%rip), %r8        # 0x88ea0
callq 0x88e00
movl %eax, -0x30(%rbp)
cmpl $-0xa, -0x30(%rbp)
jne 0x88193
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x8824d
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
jmp 0x881e1
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0x881d7
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x14(%rax), %edx
movl $0x1, %esi
leaq 0x3c125(%rip), %rcx     # 0xc42e7
movb $0x0, %al
callq 0x7e990
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
jmp 0x881df
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x881e1
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rdx
movl $0x2, %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0x88e00
movl %eax, -0x30(%rbp)
cmpl $-0xa, -0x30(%rbp)
jne 0x88215
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x8824d
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x88019
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x2c(%rbp), %edx
shll %edx
movl $0x6, %esi
movl $0x1, %ecx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %r8
callq 0x7e8f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)