// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9HashmapUnion
JX9_PRIVATE sxi32 jx9HashmapUnion(jx9_hashmap *pLeft, jx9_hashmap *pRight)
{
	jx9_hashmap_node *pEntry;
	sxi32 rc = SXRET_OK;
	jx9_value *pObj;
	sxu32 n;
	if( pLeft == pRight ){
		/* Same map. This can easily happen since hashmaps are passed by reference.
		 * Unlike the  engine.
		 */
		return SXRET_OK;
	}
	/* Perform the union */
	pEntry = pRight->pFirst;
	for(n = 0 ; n < pRight->nEntry ; ++n ){
		/* Make sure the given key does not exists in the left array */
		if( pEntry->iType == HASHMAP_BLOB_NODE ){
			/* BLOB key */
			if( SXRET_OK != 
				HashmapLookupBlobKey(&(*pLeft), SyBlobData(&pEntry->xKey.sKey), SyBlobLength(&pEntry->xKey.sKey), 0) ){
					pObj = HashmapExtractNodeValue(pEntry);
					if( pObj ){
						/* Perform the insertion */
						rc = HashmapInsertBlobKey(&(*pLeft), SyBlobData(&pEntry->xKey.sKey),
							SyBlobLength(&pEntry->xKey.sKey),pObj);
						if( rc != SXRET_OK ){
							return rc;
						}
					}
			}
		}else{
			/* INT key */
			if( SXRET_OK != HashmapLookupIntKey(&(*pLeft), pEntry->xKey.iKey, 0) ){
				pObj = HashmapExtractNodeValue(pEntry);
				if( pObj ){
					/* Perform the insertion */
					rc = HashmapInsertIntKey(&(*pLeft), pEntry->xKey.iKey, pObj);
					if( rc != SXRET_OK ){
						return rc;
					}
				}
			}
		}
		/* Point to the next entry */
		pEntry = pEntry->pPrev; /* Reverse link */
	}
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x78b3d
movl $0x0, -0x4(%rbp)
jmp 0x78c56
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x2c(%rcx), %eax
jae 0x78c4f
movq -0x20(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x78bd8
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x20(%rbp), %rax
movl 0x20(%rax), %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x70050
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x78bd6
movq -0x20(%rbp), %rdi
callq 0x6ea20
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x78bd4
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x20(%rbp), %rax
movl 0x20(%rax), %edx
movq -0x30(%rbp), %rcx
callq 0x70150
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x78bd2
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x78c56
jmp 0x78bd4
jmp 0x78bd6
jmp 0x78c35
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x702a0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x78c33
movq -0x20(%rbp), %rdi
callq 0x6ea20
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x78c31
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x30(%rbp), %rdx
callq 0x70370
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x78c2f
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x78c56
jmp 0x78c31
jmp 0x78c33
jmp 0x78c35
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x20(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x78b50
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop