// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: HashmapFindValue
static int HashmapFindValue(
	jx9_hashmap *pMap,   /* Target hashmap */
	jx9_value *pNeedle,  /* Lookup key */
	jx9_hashmap_node **ppNode, /* OUT: target node on success  */
	int bStrict      /* TRUE for strict comparison */
	)
{
	jx9_hashmap_node *pEntry;
	jx9_value sVal, *pVal;
	jx9_value sNeedle;
	sxi32 rc;
	sxu32 n;
	/* Perform a linear search since we cannot sort the hashmap based on values */
	pEntry = pMap->pFirst;
	n = pMap->nEntry;
	jx9MemObjInit(pMap->pVm, &sVal);
	jx9MemObjInit(pMap->pVm, &sNeedle);
	for(;;){
		if( n < 1 ){
			break;
		}
		/* Extract node value */
		pVal = HashmapExtractNodeValue(pEntry);
		if( pVal ){
			if( (pVal->iFlags|pNeedle->iFlags) & MEMOBJ_NULL ){
				sxi32 iF1 = pVal->iFlags;
				sxi32 iF2 = pNeedle->iFlags;
				if( iF1 == iF2 ){
					/* NULL values are equals */
					if( ppNode ){
						*ppNode = pEntry;
					}
					return SXRET_OK;
				}
			}else{
				/* Duplicate value */
				jx9MemObjLoad(pVal, &sVal);
				jx9MemObjLoad(pNeedle, &sNeedle);
				rc = jx9MemObjCmp(&sNeedle, &sVal, bStrict, 0);
				jx9MemObjRelease(&sVal);
				jx9MemObjRelease(&sNeedle);
				if( rc == 0 ){
					if( ppNode ){
						*ppNode = pEntry;
					}
					/* Match found*/
					return SXRET_OK;
				}
			}
		}
		/* Point to the next entry */
		pEntry = pEntry->pPrev; /* Reverse link */
		n--;
	}
	/* No such entry */
	return SXERR_NOTFOUND;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0xc0(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0x70(%rbp), %rsi
callq 0x6da90
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x6da90
cmpl $0x1, -0xc0(%rbp)
jae 0xa0b94
jmp 0xa0c9f
movq -0x30(%rbp), %rdi
callq 0x6ea20
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0xa0c7f
movq -0x78(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
orl 0x8(%rcx), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0xa0c0a
movq -0x78(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xc4(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xc8(%rbp)
movl -0xc4(%rbp), %eax
cmpl -0xc8(%rbp), %eax
jne 0xa0c08
cmpq $0x0, -0x20(%rbp)
je 0xa0bfc
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xa0ca6
jmp 0xa0c7d
movq -0x78(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x72d20
movq -0x18(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x72d20
movl -0x24(%rbp), %edx
leaq -0xb8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
xorl %ecx, %ecx
callq 0x77300
movl %eax, -0xbc(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x56ab0
leaq -0xb8(%rbp), %rdi
callq 0x56ab0
cmpl $0x0, -0xbc(%rbp)
jne 0xa0c7b
cmpq $0x0, -0x20(%rbp)
je 0xa0c72
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xa0ca6
jmp 0xa0c7d
jmp 0xa0c7f
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0xc0(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0xa0b86
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)