// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9MemObjAdd
JX9_PRIVATE sxi32 jx9MemObjAdd(jx9_value *pObj1, jx9_value *pObj2, int bAddStore)
{
	if( ((pObj1->iFlags|pObj2->iFlags) & MEMOBJ_HASHMAP) == 0 ){
			/* Arithemtic operation */
			jx9MemObjToNumeric(pObj1);
			jx9MemObjToNumeric(pObj2);
			if( (pObj1->iFlags|pObj2->iFlags) & MEMOBJ_REAL ){
				/* Floating point arithmetic */
				jx9_real a, b;
				if( (pObj1->iFlags & MEMOBJ_REAL) == 0 ){
					jx9MemObjToReal(pObj1);
				}
				if( (pObj2->iFlags & MEMOBJ_REAL) == 0 ){
					jx9MemObjToReal(pObj2);
				}
				a = pObj1->x.rVal;
				b = pObj2->x.rVal;
				pObj1->x.rVal = a+b;
				MemObjSetType(pObj1, MEMOBJ_REAL);
				/* Try to get an integer representation also */
				MemObjTryIntger(&(*pObj1));
			}else{
				/* Integer arithmetic */
				sxi64 a, b;
				a = pObj1->x.iVal;
				b = pObj2->x.iVal;
				pObj1->x.iVal = a+b;
				MemObjSetType(pObj1, MEMOBJ_INT);
			}
	}else{
		if( (pObj1->iFlags|pObj2->iFlags) & MEMOBJ_HASHMAP ){
			jx9_hashmap *pMap;
			sxi32 rc;
			if( bAddStore ){
				/* Do not duplicate the hashmap, use the left one since its an add&store operation.
				 */
				if( (pObj1->iFlags & MEMOBJ_HASHMAP) == 0 ){				
					/* Force a hashmap cast */
					rc = jx9MemObjToHashmap(pObj1);
					if( rc != SXRET_OK ){
						jx9VmThrowError(pObj1->pVm, 0, JX9_CTX_ERR, "JX9 is running out of memory while creating array");
						return rc;
					}
				}
				/* Point to the structure that describe the hashmap */
				pMap = (jx9_hashmap *)pObj1->x.pOther;
			}else{
				/* Create a new hashmap */
				pMap = jx9NewHashmap(pObj1->pVm, 0, 0);
				if( pMap == 0){
					jx9VmThrowError(pObj1->pVm, 0, JX9_CTX_ERR, "JX9 is running out of memory while creating array");
					return SXERR_MEM;
				}
			}
			if( !bAddStore ){
				if(pObj1->iFlags & MEMOBJ_HASHMAP ){
					/* Perform a hashmap duplication */
					jx9HashmapDup((jx9_hashmap *)pObj1->x.pOther, pMap);
				}else{
					if((pObj1->iFlags & MEMOBJ_NULL) == 0 ){
						/* Simple insertion */
						jx9HashmapInsert(pMap, 0, pObj1);
					}
				}
			}
			/* Perform the union */
			if(pObj2->iFlags & MEMOBJ_HASHMAP ){
				jx9HashmapUnion(pMap, (jx9_hashmap *)pObj2->x.pOther);
			}else{
				if((pObj2->iFlags & MEMOBJ_NULL) == 0 ){
					/* Simple insertion */
					jx9HashmapInsert(pMap, 0, pObj2);
				}
			}
			/* Reflect the change */
			if( pObj1->iFlags & MEMOBJ_STRING ){
				SyBlobRelease(&pObj1->sBlob);
			}
			pObj1->x.pOther = pMap;
			MemObjSetType(pObj1, MEMOBJ_HASHMAP);
		}
	}
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movl 0x8(%rsi), %ecx
orl %eax, %ecx
testb $0x40, %cl
jne 0x3b164
movq %rbx, %rdi
callq 0x3acd2
movq %r15, %rdi
callq 0x3acd2
movl 0x8(%rbx), %ecx
movl 0x8(%r15), %eax
movl %eax, %edx
orl %ecx, %edx
testb $0x4, %dl
jne 0x3b184
movq (%r15), %rax
addq %rax, (%rbx)
andl $0xfffffe90, %ecx       # imm = 0xFFFFFE90
orl $0x2, %ecx
movl %ecx, 0x8(%rbx)
jmp 0x3b30d
testl %edx, %edx
je 0x3b1d2
testb $0x40, %al
jne 0x3b17c
movq %rbx, %rdi
callq 0x3ad9e
testl %eax, %eax
jne 0x3b1fd
movq (%rbx), %r14
jmp 0x3b22b
testb $0x4, %cl
jne 0x3b195
movq %rbx, %rdi
callq 0x3ac20
movl 0x8(%r15), %eax
testb $0x4, %al
jne 0x3b1a1
movq %r15, %rdi
callq 0x3ac20
movsd (%rbx), %xmm0
addsd (%r15), %xmm0
movsd %xmm0, (%rbx)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%rbx), %eax
orl $0x4, %eax
movl %eax, 0x8(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3bae2
movq 0x10(%rbx), %rdi
callq 0x368e4
testq %rax, %rax
je 0x3b1fd
movq %rax, %r14
movl 0x8(%rbx), %eax
testb $0x40, %al
jne 0x3b220
testb $0x20, %al
jne 0x3b22b
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x36999
jmp 0x3b22b
movq 0x10(%rbx), %rdi
leaq 0x2934f(%rip), %rcx     # 0x64557
pushq $0x1
popq %rdx
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x38388
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x3bb43
movl 0x8(%r15), %eax
testb $0x40, %al
jne 0x3b24d
testb $0x20, %al
jne 0x3b2ec
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x36999
jmp 0x3b2ec
movq (%r15), %r12
cmpq %r12, %r14
je 0x3b2ec
leaq 0x10(%r12), %r15
xorl %r13d, %r13d
cmpl 0x2c(%r12), %r13d
jae 0x3b2ec
movq (%r15), %r15
cmpl $0x2, 0x8(%r15)
jne 0x3b2ae
movq 0x18(%r15), %rsi
movl 0x20(%r15), %edx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x36c0a
testl %eax, %eax
je 0x3b2e0
movq %r15, %rdi
callq 0x35e71
testq %rax, %rax
je 0x3b2e0
movq 0x18(%r15), %rsi
movl 0x20(%r15), %edx
movq %r14, %rdi
movq %rax, %rcx
callq 0x36cac
jmp 0x3b2dc
movq 0x10(%r15), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x36e57
testl %eax, %eax
je 0x3b2e0
movq %r15, %rdi
callq 0x35e71
testq %rax, %rax
je 0x3b2e0
movq 0x10(%r15), %rsi
movq %r14, %rdi
movq %rax, %rdx
callq 0x36ec2
testl %eax, %eax
jne 0x3b2ec
addq $0x48, %r15
incl %r13d
jmp 0x3b261
movl 0x8(%rbx), %eax
testb $0x1, %al
je 0x3b2ff
leaq 0x18(%rbx), %rdi
callq 0x2a72f
movl 0x8(%rbx), %eax
movq %r14, (%rbx)
andl $0xfffffe90, %eax       # imm = 0xFFFFFE90
orl $0x40, %eax
movl %eax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq