// File: 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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x273d0
movq -0x10(%rbp), %rdi
leaq -0x78(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x273d0
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
leaq -0x90(%rbp), %rcx
callq 0x275d0
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xa8(%rbp), %rcx
callq 0x275d0
movq -0x80(%rbp), %rax
cmpq -0x98(%rbp), %rax
jae 0x279d9
movq -0x18(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq -0x90(%rbp), %rcx
movl $0x1, %r9d
movl %r9d, %r8d
callq 0x25380
leaq -0x48(%rbp), %rdi
callq 0x27680
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
leaq -0x90(%rbp), %rcx
callq 0x275d0
jmp 0x27a27
movq -0x18(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movq -0xa8(%rbp), %rcx
movl $0x1, %r9d
movl %r9d, %r8d
callq 0x25380
leaq -0x78(%rbp), %rdi
callq 0x27680
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xa8(%rbp), %rcx
callq 0x275d0
jmp 0x27a29
leaq -0x48(%rbp), %rdi
callq 0x27890
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xa9(%rbp)
jne 0x27a58
leaq -0x78(%rbp), %rdi
callq 0x27890
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0xa9(%rbp)
movb -0xa9(%rbp), %al
testb $0x1, %al
jne 0x27982
leaq -0x48(%rbp), %rdi
callq 0x27890
cmpl $0x0, %eax
jne 0x27acc
jmp 0x27a76
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
leaq -0x90(%rbp), %rcx
callq 0x275d0
movq -0x18(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq -0x90(%rbp), %rcx
movl $0x1, %r9d
movl %r9d, %r8d
callq 0x25380
leaq -0x48(%rbp), %rdi
callq 0x27680
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x27a76
jmp 0x27acc
leaq -0x78(%rbp), %rdi
callq 0x27890
cmpl $0x0, %eax
jne 0x27b38
jmp 0x27adc
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0xa8(%rbp), %rcx
callq 0x275d0
movq -0x18(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movq -0xa8(%rbp), %rcx
movl $0x1, %r9d
movl %r9d, %r8d
callq 0x25380
leaq -0x78(%rbp), %rdi
callq 0x27680
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x27adc
jmp 0x27b38
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)