// File: /workspace/github_c_makefile_star2_O3/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: VmExtractCallback
static int VmExtractCallback(jx9_value *pKey, jx9_value *pValue, void *pUserData)
{
	extract_aux_data *pAux = (extract_aux_data *)pUserData;
	int iFlags = pAux->iFlags;
	jx9_vm *pVm = pAux->pVm;
	jx9_value *pObj;
	SyString sVar;
	if( (iFlags & 0x10/* EXTR_PREFIX_INVALID */) && (pKey->iFlags & (MEMOBJ_INT|MEMOBJ_BOOL|MEMOBJ_REAL))){
		iFlags |= 0x08; /*EXTR_PREFIX_ALL*/
	}
	/* Perform a string cast */
	jx9MemObjToString(pKey);
	if( SyBlobLength(&pKey->sBlob) < 1 ){
		/* Unavailable variable name */
		return SXRET_OK;
	}
	sVar.nByte = 0; /* cc warning */
	if( (iFlags & 0x08/*EXTR_PREFIX_ALL*/ ) && pAux->Prefixlen > 0 ){
		sVar.nByte = (sxu32)SyBufferFormat(pAux->zWorker, sizeof(pAux->zWorker), "%.*s_%.*s", 
			pAux->Prefixlen, pAux->zPrefix, 
			SyBlobLength(&pKey->sBlob), SyBlobData(&pKey->sBlob)
			);
	}else{
		sVar.nByte = (sxu32) SyMemcpy(SyBlobData(&pKey->sBlob), pAux->zWorker, 
			SXMIN(SyBlobLength(&pKey->sBlob), sizeof(pAux->zWorker)));
	}
	sVar.zString = pAux->zWorker;
	/* Try to extract the variable */
	pObj = VmExtractMemObj(pVm, &sVar, TRUE, FALSE);
	if( pObj ){
		/* Collision */
		if( iFlags & 0x02 /* EXTR_SKIP */ ){
			return SXRET_OK;
		}
		if( iFlags & 0x04 /* EXTR_PREFIX_SAME */ ){
			if( (iFlags & 0x08/*EXTR_PREFIX_ALL*/) || pAux->Prefixlen < 1){
				/* Already prefixed */
				return SXRET_OK;
			}
			sVar.nByte = SyBufferFormat(
				pAux->zWorker, sizeof(pAux->zWorker),
				"%.*s_%.*s", 
				pAux->Prefixlen, pAux->zPrefix, 
				SyBlobLength(&pKey->sBlob), SyBlobData(&pKey->sBlob)
				);
			pObj = VmExtractMemObj(pVm, &sVar, TRUE, TRUE);
		}
	}else{
		/* Create the variable */
		pObj = VmExtractMemObj(pVm, &sVar, TRUE, TRUE);
	}
	if( pObj ){
		/* Overwrite the old value */
		jx9MemObjStore(pValue, pObj);
		/* Increment counter */
		pAux->iCount++;
	}
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rsi, -0x30(%rbp)
movq %rdi, %r12
movl 0x1c(%rdx), %r14d
testb $0x10, %r14b
je 0x51475
movl %r14d, %eax
orl $0x8, %eax
testb $0xe, 0x8(%r12)
cmovnel %eax, %r14d
movq (%rbx), %r15
movq %r12, %rdi
callq 0x3f163
movl 0x28(%r12), %r9d
testl %r9d, %r9d
je 0x5156b
testb $0x8, %r14b
je 0x514c1
movl 0x18(%rbx), %ecx
testl %ecx, %ecx
jle 0x514c1
leaq 0x20(%rbx), %rdi
movq 0x10(%rbx), %r8
movq 0x20(%r12), %rax
movq %rax, (%rsp)
leaq 0x24ee8(%rip), %rdx     # 0x7639b
movl $0x400, %esi            # imm = 0x400
xorl %eax, %eax
callq 0x349a5
jmp 0x514db
movq 0x20(%r12), %rdi
leaq 0x20(%rbx), %rsi
movl $0x400, %edx            # imm = 0x400
cmpl %edx, %r9d
cmovbl %r9d, %edx
callq 0x34893
leaq -0x40(%rbp), %rsi
movl %eax, 0x8(%rsi)
leaq 0x20(%rbx), %r13
movq %r13, (%rsi)
movq %r15, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x43c65
testq %rax, %rax
je 0x51541
testb $0x2, %r14b
jne 0x5156b
testb $0x4, %r14b
je 0x5155c
testb $0x8, %r14b
jne 0x5156b
movl 0x18(%rbx), %ecx
testl %ecx, %ecx
jle 0x5156b
movq 0x10(%rbx), %r8
movl 0x28(%r12), %r9d
movq 0x20(%r12), %rax
movq %rax, (%rsp)
leaq 0x24e6c(%rip), %rdx     # 0x7639b
movq %r13, %rdi
movl $0x400, %esi            # imm = 0x400
xorl %eax, %eax
callq 0x349a5
movl %eax, -0x38(%rbp)
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x43c65
testq %rax, %rax
je 0x5156b
movq -0x30(%rbp), %rdi
movq %rax, %rsi
callq 0x3e19f
incl 0x8(%rbx)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq