// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/vcf.c
// Function: bcf_hdr_combine
int bcf_hdr_combine(bcf_hdr_t *dst, const bcf_hdr_t *src)
{
    int i, ndst_ori = dst->nhrec, need_sync = 0, ret = 0, res;
    for (i=0; i<src->nhrec; i++)
    {
        if ( src->hrec[i]->type==BCF_HL_GEN && src->hrec[i]->value )
        {
            int j;
            for (j=0; j<ndst_ori; j++)
            {
                if ( dst->hrec[j]->type!=BCF_HL_GEN ) continue;

                // Checking only the key part of generic lines, otherwise
                // the VCFs are too verbose. Should we perhaps add a flag
                // to bcf_hdr_combine() and make this optional?
                if ( !strcmp(src->hrec[i]->key,dst->hrec[j]->key) ) break;
            }
            if ( j>=ndst_ori ) {
                res = bcf_hdr_add_hrec(dst, bcf_hrec_dup(src->hrec[i]));
                if (res < 0) return -1;
                need_sync += res;
            }
        }
        else if ( src->hrec[i]->type==BCF_HL_STR )
        {
            // NB: we are ignoring fields without ID
            int j = bcf_hrec_find_key(src->hrec[i],"ID");
            if ( j>=0 )
            {
                bcf_hrec_t *rec = bcf_hdr_get_hrec(dst, src->hrec[i]->type, "ID", src->hrec[i]->vals[j], src->hrec[i]->key);
                if ( !rec ) {
                    res = bcf_hdr_add_hrec(dst, bcf_hrec_dup(src->hrec[i]));
                    if (res < 0) return -1;
                    need_sync += res;
                }
            }
        }
        else
        {
            int j = bcf_hrec_find_key(src->hrec[i],"ID");
            assert( j>=0 ); // this should always be true for valid VCFs

            bcf_hrec_t *rec = bcf_hdr_get_hrec(dst, src->hrec[i]->type, "ID", src->hrec[i]->vals[j], NULL);
            if ( !rec ) {
                res = bcf_hdr_add_hrec(dst, bcf_hrec_dup(src->hrec[i]));
                if (res < 0) return -1;
                need_sync += res;
            } else if ( src->hrec[i]->type==BCF_HL_INFO || src->hrec[i]->type==BCF_HL_FMT )
            {
                // Check that both records are of the same type. The bcf_hdr_id2length
                // macro cannot be used here because dst header is not synced yet.
                vdict_t *d_src = (vdict_t*)src->dict[BCF_DT_ID];
                vdict_t *d_dst = (vdict_t*)dst->dict[BCF_DT_ID];
                khint_t k_src  = kh_get(vdict, d_src, src->hrec[i]->vals[0]);
                khint_t k_dst  = kh_get(vdict, d_dst, src->hrec[i]->vals[0]);
                if ( (kh_val(d_src,k_src).info[rec->type]>>8 & 0xf) != (kh_val(d_dst,k_dst).info[rec->type]>>8 & 0xf) )
                {
                    hts_log_warning("Trying to combine \"%s\" tag definitions of different lengths",
                        src->hrec[i]->vals[0]);
                    ret |= 1;
                }
                if ( (kh_val(d_src,k_src).info[rec->type]>>4 & 0xf) != (kh_val(d_dst,k_dst).info[rec->type]>>4 & 0xf) )
                {
                    hts_log_warning("Trying to combine \"%s\" tag definitions of different types",
                        src->hrec[i]->vals[0]);
                    ret |= 1;
                }
            }
        }
    }
    if ( need_sync ) {
        if (bcf_hdr_sync(dst) < 0) return -1;
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpl $0x0, 0x50(%rsi)
jle 0x3bbb0
movq %rsi, %r13
movq %rdi, %r12
movl 0x50(%rdi), %ebp
leaq 0x6e5d0(%rip), %rbx     # 0xa9d0a
xorl %r15d, %r15d
xorl %r14d, %r14d
movl $0x0, 0xc(%rsp)
movq %rdi, 0x28(%rsp)
movq %rsi, (%rsp)
movq %rbp, 0x60(%rsp)
movq %r13, %rax
movq %r12, %r13
movq 0x48(%rax), %rax
movq (%rax,%r15,8), %r12
movl (%r12), %ebp
cmpl $0x4, %ebp
je 0x3b8bb
cmpl $0x5, %ebp
jne 0x3b7fe
cmpq $0x0, 0x10(%r12)
je 0x3b7fe
movq %r15, 0x10(%rsp)
movl %r14d, %r15d
movq 0x60(%rsp), %rbp
testl %ebp, %ebp
jle 0x3b7c1
movq 0x48(%r13), %rbx
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rax
cmpl $0x5, (%rax)
jne 0x3b7b9
movq 0x8(%r12), %rdi
movq 0x8(%rax), %rsi
callq 0x46e0
testl %eax, %eax
je 0x3b926
incq %r14
cmpq %r14, %rbp
jne 0x3b79a
movq %r12, %rdi
callq 0x2acf6
movq %r13, %r12
movq %r13, %rdi
movq %rax, %rsi
callq 0x2bd95
testl %eax, %eax
movl $0x0, %ecx
cmovsl %ecx, %eax
js 0x3bbb4
movl %r15d, %r14d
addl %eax, %r14d
leaq 0x6e516(%rip), %rbx     # 0xa9d0a
movq 0x10(%rsp), %r15
jmp 0x3b938
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2b32b
testl %eax, %eax
js 0x3bbce
movq 0x28(%r12), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rcx
movq %r13, %r12
movq %r13, %rdi
movl %ebp, %esi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x2ce51
movq (%rsp), %r13
movq 0x48(%r13), %rcx
movq (%rcx,%r15,8), %rdi
testq %rax, %rax
je 0x3b8fe
movl (%rdi), %ecx
decl %ecx
cmpl $0x1, %ecx
ja 0x3bb81
movq %rax, 0x50(%rsp)
movq 0x28(%r13), %rdx
movq 0x28(%r12), %rax
movq %rax, 0x40(%rsp)
movq 0x28(%rdi), %rax
movq (%rax), %r8
movl (%rdx), %esi
movl $0x0, %eax
testl %esi, %esi
movq %rdx, 0x38(%rsp)
movq %r8, 0x58(%rsp)
movl %r14d, 0x24(%rsp)
movq %r15, 0x10(%rsp)
je 0x3b9e0
movb (%r8), %cl
testb %cl, %cl
je 0x3b941
leaq 0x1(%r8), %rax
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %ebp, %ecx
imull $0x1000193, %ecx, %ebp  # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x3b8a2
jmp 0x3b946
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2b32b
testl %eax, %eax
js 0x3b935
movq 0x8(%r12), %r8
movq 0x28(%r12), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rcx
movq %r13, %r12
movq %r13, %rdi
movl $0x4, %esi
movq %rbx, %rdx
callq 0x2ce51
testq %rax, %rax
jne 0x3b938
movq (%rsp), %r13
movq 0x48(%r13), %rax
movq (%rax,%r15,8), %rdi
callq 0x2acf6
movq %r12, %rdi
movq %rax, %rsi
callq 0x2bd95
testl %eax, %eax
movl $0x0, %ecx
cmovsl %ecx, %eax
js 0x3bbb4
addl %eax, %r14d
jmp 0x3bb81
leaq 0x6e3dd(%rip), %rbx     # 0xa9d0a
movl %r15d, %r14d
movq 0x10(%rsp), %r15
movq %r13, %r12
movq (%rsp), %r13
jmp 0x3bb81
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
movq %rsi, 0x18(%rsp)
leal -0x1(%rsi), %r12d
andl %r12d, %ebp
movq 0x10(%rdx), %rdi
movl $0x1, %ebx
movl %ebp, %r14d
movq %rdi, 0x30(%rsp)
movl %r14d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %r15d
leal (%r14,%r14), %r13d
andl $0x1e, %r13d
movl %r15d, %eax
movl %r13d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x3b9bf
testb $0x1, %al
jne 0x3b9ab
movq 0x18(%rdx), %rax
movl %r14d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r8, %rsi
callq 0x46e0
movq 0x30(%rsp), %rdi
movq 0x58(%rsp), %r8
movq 0x38(%rsp), %rdx
testl %eax, %eax
je 0x3b9bf
addl %ebx, %r14d
andl %r12d, %r14d
incl %ebx
cmpl %ebp, %r14d
jne 0x3b963
movq 0x18(%rsp), %rax
jmp 0x3b9d2
movl %r13d, %ecx
shrl %cl, %r15d
testb $0x3, %r15b
movq 0x18(%rsp), %rax
cmovel %r14d, %eax
movq 0x28(%rsp), %r12
movq (%rsp), %r13
movq 0x10(%rsp), %r15
movq 0x40(%rsp), %rsi
movl (%rsi), %edx
testl %edx, %edx
movl $0x0, %edi
je 0x3bac3
movl %eax, 0x18(%rsp)
movb (%r8), %cl
testb %cl, %cl
je 0x3ba1e
leaq 0x1(%r8), %rax
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %ebp, %ecx
imull $0x1000193, %ecx, %ebp  # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x3ba08
jmp 0x3ba23
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
movq %rdx, 0x48(%rsp)
leal -0x1(%rdx), %r12d
andl %r12d, %ebp
movq 0x10(%rsi), %rdi
movl $0x1, %ebx
movl %ebp, %r14d
movq %rdi, 0x30(%rsp)
movl %r14d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %r15d
leal (%r14,%r14), %r13d
andl $0x1e, %r13d
movl %r15d, %eax
movl %r13d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x3ba9c
testb $0x1, %al
jne 0x3ba88
movq 0x18(%rsi), %rax
movl %r14d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r8, %rsi
callq 0x46e0
movq 0x30(%rsp), %rdi
movq 0x58(%rsp), %r8
movq 0x40(%rsp), %rsi
testl %eax, %eax
je 0x3ba9c
addl %ebx, %r14d
andl %r12d, %r14d
incl %ebx
cmpl %ebp, %r14d
jne 0x3ba40
movq 0x48(%rsp), %rax
jmp 0x3baaf
movl %r13d, %ecx
shrl %cl, %r15d
testb $0x3, %r15b
movq 0x48(%rsp), %rax
cmovel %r14d, %eax
movl %eax, %edi
movq 0x28(%rsp), %r12
movq (%rsp), %r13
movq 0x10(%rsp), %r15
movl 0x18(%rsp), %eax
movl %eax, %eax
imulq $0x38, %rax, %rbx
movq 0x38(%rsp), %r9
movq 0x20(%r9), %rcx
addq %rbx, %rcx
movq 0x50(%rsp), %r10
movslq (%r10), %rdx
movl %edi, %eax
imulq $0x38, %rax, %r14
movq 0x20(%rsi), %rax
addq %r14, %rax
movq (%rax,%rdx,8), %rax
xorq (%rcx,%rdx,8), %rax
testl $0xf00, %eax            # imm = 0xF00
je 0x3bb40
movl $0x3, %edi
leaq 0x7045b(%rip), %rsi     # 0xabf60
leaq 0x70464(%rip), %rdx     # 0xabf70
movq %r8, %rcx
xorl %eax, %eax
callq 0x942d
movq 0x50(%rsp), %rax
movslq (%rax), %rcx
movq 0x38(%rsp), %rax
addq 0x20(%rax), %rbx
movq 0x40(%rsp), %rax
addq 0x20(%rax), %r14
movq (%r14,%rcx,8), %rax
xorq (%rbx,%rcx,8), %rax
movl $0x1, 0xc(%rsp)
testb $-0x10, %al
je 0x3bb75
movq 0x48(%r13), %rax
movq (%rax,%r15,8), %rax
movq 0x28(%rax), %rax
movq (%rax), %rcx
movl $0x3, %edi
leaq 0x70401(%rip), %rsi     # 0xabf60
leaq 0x70446(%rip), %rdx     # 0xabfac
xorl %eax, %eax
callq 0x942d
movl $0x1, 0xc(%rsp)
leaq 0x6e18e(%rip), %rbx     # 0xa9d0a
movl 0x24(%rsp), %r14d
incq %r15
movslq 0x50(%r13), %rax
cmpq %rax, %r15
jl 0x3b756
testl %r14d, %r14d
je 0x3bbbb
movq %r12, %rdi
callq 0x2ab97
testl %eax, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl 0xc(%rsp), %ecx
cmovsl %eax, %ecx
movl %ecx, %eax
jmp 0x3bbbf
xorl %eax, %eax
jmp 0x3bbbf
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3bbbf
movl 0xc(%rsp), %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x70352(%rip), %rdi     # 0xabf27
leaq 0x6f9f7(%rip), %rsi     # 0xab5d3
leaq 0x70349(%rip), %rcx     # 0xabf2c
movl $0x1217, %edx           # imm = 0x1217
callq 0x42e0