// File: /workspace/github_cpp_makefile_star2_O1/splatlab[P]debgr/threadsafe-gqf/gqf.c
// Function: qf_merge
void qf_merge(QF *qfa, QF *qfb, QF *qfc) 
{
	QFi qfia, qfib;
	qf_iterator(qfa, &qfia, 0);
	qf_iterator(qfb, &qfib, 0);

	uint64_t keya, valuea, counta, keyb, valueb, countb;
	qfi_get(&qfia, &keya, &valuea, &counta);
	qfi_get(&qfib, &keyb, &valueb, &countb);
	do {
		if (keya < keyb) {
			qf_insert(qfc, keya, valuea, counta, true, true);
			qfi_next(&qfia);
			qfi_get(&qfia, &keya, &valuea, &counta);
		}
		else {
			qf_insert(qfc, keyb, valueb, countb, true, true);
			qfi_next(&qfib);
			qfi_get(&qfib, &keyb, &valueb, &countb);
		}
	} while(!qfi_end(&qfia) && !qfi_end(&qfib));

	if (!qfi_end(&qfia)) {
		do {
			qfi_get(&qfia, &keya, &valuea, &counta);
			qf_insert(qfc, keya, valuea, counta, true, true);
		} while(!qfi_next(&qfia));
	}
	if (!qfi_end(&qfib)) {
		do {
			qfi_get(&qfib, &keyb, &valueb, &countb);
			qf_insert(qfc, keyb, valueb, countb, true, true);
		} while(!qfi_next(&qfib));
	}

	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x48(%rsp), %r15
movq %r15, %rsi
xorl %edx, %edx
callq 0x12995
leaq 0x18(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x12995
movq (%r15), %r14
movq 0x10(%r15), %rsi
leaq 0x8(%rsp), %r12
leaq 0x10(%rsp), %r13
movq %r14, %rdi
movq %r12, %rdx
movq %r13, %rcx
callq 0x126cd
movq 0x8(%r15), %rbp
movq 0x8(%r14), %rax
movb 0x38(%rax), %cl
shlq %cl, %rbp
orq (%r12), %rbp
movq (%r13), %r14
incq 0x60(%rax)
addq %r14, 0x58(%rax)
leaq 0x18(%rsp), %rax
movq (%rax), %r12
movq 0x10(%rax), %rsi
movq %rax, %r15
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r12, %rdi
callq 0x126cd
movq 0x8(%r15), %r15
movq 0x8(%r12), %rax
movb 0x38(%rax), %cl
shlq %cl, %r15
leaq 0x8(%rsp), %rcx
orq (%rcx), %r15
leaq 0x10(%rsp), %rcx
movq (%rcx), %r12
incq 0x60(%rax)
addq %r12, 0x58(%rax)
movq %rbx, %rdi
cmpq %r15, %rbp
jae 0x13045
movq %rbp, %rsi
movq %r14, %rcx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x10351
leaq 0x48(%rsp), %rdi
callq 0x12c5d
movq 0x48(%rsp), %r14
movq 0x58(%rsp), %rsi
movq %r14, %rdi
leaq 0x8(%rsp), %rdx
movq %r13, %rcx
callq 0x126cd
movq 0x50(%rsp), %rbp
movq 0x8(%r14), %rax
movb 0x38(%rax), %cl
shlq %cl, %rbp
orq 0x8(%rsp), %rbp
movq 0x10(%rsp), %r14
incq 0x60(%rax)
addq %r14, 0x58(%rax)
jmp 0x130a2
movq %r15, %rsi
movq %r12, %rcx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x10351
leaq 0x18(%rsp), %rdi
callq 0x12c5d
movq 0x18(%rsp), %r12
movq 0x28(%rsp), %rsi
movq %r12, %rdi
leaq 0x8(%rsp), %rdx
movq %r13, %rcx
callq 0x126cd
movq 0x20(%rsp), %r15
movq 0x8(%r12), %rax
movb 0x38(%rax), %cl
shlq %cl, %r15
orq 0x8(%rsp), %r15
movq 0x10(%rsp), %r12
incq 0x60(%rax)
addq %r12, 0x58(%rax)
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %rax
movq 0x8(%rcx), %rcx
movq 0x18(%rcx), %rcx
cmpq %rcx, %rax
jae 0x13142
movq 0x18(%rsp), %rdx
movq 0x28(%rsp), %rsi
movq 0x8(%rdx), %rdx
cmpq 0x18(%rdx), %rsi
jb 0x12fdf
cmpq %rcx, %rax
jae 0x13142
leaq 0x8(%rsp), %r14
leaq 0x10(%rsp), %r15
leaq 0x48(%rsp), %r12
movq 0x48(%rsp), %r13
movq 0x58(%rsp), %rsi
movq %r13, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x126cd
movq 0x50(%rsp), %rsi
movq 0x8(%r13), %rax
movb 0x38(%rax), %cl
shlq %cl, %rsi
orq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rcx
incq 0x60(%rax)
addq %rcx, 0x58(%rax)
movq %rbx, %rdi
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x10351
movq %r12, %rdi
callq 0x12c5d
testl %eax, %eax
je 0x130e9
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
movq 0x8(%rax), %rax
cmpq 0x18(%rax), %rcx
jae 0x131be
leaq 0x8(%rsp), %r14
leaq 0x10(%rsp), %r15
leaq 0x18(%rsp), %r12
movq 0x18(%rsp), %r13
movq 0x28(%rsp), %rsi
movq %r13, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x126cd
movq 0x20(%rsp), %rsi
movq 0x8(%r13), %rax
movb 0x38(%rax), %cl
shlq %cl, %rsi
orq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rcx
incq 0x60(%rax)
addq %rcx, 0x58(%rax)
movq %rbx, %rdi
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x10351
movq %r12, %rdi
callq 0x12c5d
testl %eax, %eax
je 0x13165
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq