// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9_hashmap_diff
static int jx9_hashmap_diff(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	jx9_hashmap_node *pEntry;
	jx9_hashmap *pSrc, *pMap;
	jx9_value *pArray;
	jx9_value *pVal;
	sxi32 rc;
	sxu32 n;
	int i;
	if( nArg < 1 || !jx9_value_is_json_array(apArg[0]) ){
		/* Missing arguments, return NULL */
		jx9_result_null(pCtx);
		return JX9_OK;
	}
	if( nArg == 1 ){
		/* Return the first array since we cannot perform a diff */
		jx9_result_value(pCtx, apArg[0]);
		return JX9_OK;
	}
	/* Create a new array */
	pArray = jx9_context_new_array(pCtx);
	if( pArray == 0 ){
		jx9_result_null(pCtx);
		return JX9_OK;
	}
	/* Point to the internal representation of the source hashmap */
	pSrc = (jx9_hashmap *)apArg[0]->x.pOther;
	/* Perform the diff */
	pEntry = pSrc->pFirst;
	n = pSrc->nEntry;
	for(;;){
		if( n < 1 ){
			break;
		}
		/* Extract the node value */
		pVal = HashmapExtractNodeValue(pEntry);
		if( pVal ){
			for( i = 1 ; i < nArg ; i++ ){
				if( !jx9_value_is_json_array(apArg[i])) {
					/* ignore */
					continue;
				}
				/* Point to the internal representation of the hashmap */
				pMap = (jx9_hashmap *)apArg[i]->x.pOther;
				/* Perform the lookup */
				rc = HashmapFindValue(pMap, pVal, 0, TRUE);
				if( rc == SXRET_OK ){
					/* Value exist */
					break;
				}
			}
			if( i >= nArg ){
				/* Perform the insertion */
				HashmapInsertNode((jx9_hashmap *)pArray->x.pOther, pEntry, TRUE);
			}
		}
		/* Point to the next entry */
		pEntry = pEntry->pPrev; /* Reverse link */
		n--;
	}
	/* Return the freshly created array */
	jx9_result_value(pCtx, pArray);
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
testl %esi, %esi
jle 0x5eb67
movl %esi, %r13d
movq (%rdx), %rsi
testb $0x40, 0x8(%rsi)
jne 0x5eb81
movq 0x8(%rbx), %rdi
callq 0x309f2
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, %r13d
jne 0x5eb91
movq %rbx, %rdi
callq 0x30d83
jmp 0x5eb70
movq %rdx, -0x30(%rbp)
movq %rbx, %rdi
callq 0x317eb
movq %rax, -0x40(%rbp)
testq %rax, %rax
je 0x5eb67
movq %rbx, -0x50(%rbp)
movq -0x30(%rbp), %rcx
movq (%rcx), %rax
movq (%rax), %rdx
movl 0x2c(%rdx), %eax
testl %eax, %eax
je 0x5ec77
addq $0x10, %rdx
movl %r13d, %ebx
movl $0x1, %r15d
subq %rbx, %r15
movl %eax, -0x34(%rbp)
movq (%rdx), %rdx
movq (%rdx), %rax
movq (%rax), %rax
movl 0x38(%rdx), %r13d
cmpl %r13d, 0x218(%rax)
movq %rdx, -0x48(%rbp)
jbe 0x5ebfd
imull 0x220(%rax), %r13d
addq 0x210(%rax), %r13
jmp 0x5ec00
xorl %r13d, %r13d
testq %r13, %r13
je 0x5ec64
movb $0x1, %r14b
movl $0x2, %r12d
movq -0x8(%rcx,%r12,8), %rax
testb $0x40, 0x8(%rax)
je 0x5ec31
movq (%rax), %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x5f9b8
movq -0x30(%rbp), %rcx
testl %eax, %eax
je 0x5ec4a
cmpq %rbx, %r12
setb %r14b
leaq (%r15,%r12), %rax
incq %rax
incq %r12
cmpq $0x2, %rax
jne 0x5ec0e
jmp 0x5ec50
testb $0x1, %r14b
jne 0x5ec64
movq -0x40(%rbp), %rax
movq (%rax), %rdi
movq -0x48(%rbp), %rsi
callq 0x5faf4
movq -0x30(%rbp), %rcx
movq -0x48(%rbp), %rdx
addq $0x48, %rdx
movl -0x34(%rbp), %eax
decl %eax
jne 0x5ebcf
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x40(%rbp), %rdi
callq 0x3ebc8
jmp 0x5eb70