// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x50(%rax), %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x4b434
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x5, (%rax)
jne 0x4b0b1
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x10(%rax)
je 0x4b0b1
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x4b05d
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x5, (%rax)
je 0x4b01c
jmp 0x4b052
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rsi
callq 0x46b0
cmpl $0x0, %eax
jne 0x4b050
jmp 0x4b05d
jmp 0x4b052
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x4affd
movl -0x30(%rbp), %eax
cmpl -0x20(%rbp), %eax
jl 0x4b0ac
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3b0f0
movq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0x3ce30
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jge 0x4b0a3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4b459
movl -0x2c(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x4b424
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x4, (%rax)
jne 0x4b19e
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xbaeb7(%rip), %rsi     # 0x105f98
callq 0x3bb40
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0x4b199
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %esi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x8(%rax), %r8
leaq 0xbae58(%rip), %rdx     # 0x105f98
callq 0x3e160
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x4b197
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3b0f0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x3ce30
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jge 0x4b18e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4b459
movl -0x2c(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x4b199
jmp 0x4b422
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xbade3(%rip), %rsi     # 0x105f98
callq 0x3bb40
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x4b1c5
jmp 0x4b1e4
leaq 0xbce2b(%rip), %rdi     # 0x107ff7
leaq 0xbc490(%rip), %rsi     # 0x107663
movl $0x1217, %edx           # imm = 0x1217
leaq 0xbce1d(%rip), %rcx     # 0x107ffc
callq 0x42d0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %esi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
leaq 0xbad7b(%rip), %rdx     # 0x105f98
xorl %eax, %eax
movl %eax, %r8d
callq 0x3e160
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x4b27e
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3b0f0
movq -0x80(%rbp), %rdi
movq %rax, %rsi
callq 0x3ce30
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jge 0x4b270
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4b459
movl -0x2c(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x4b420
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x1, (%rax)
je 0x4b2ac
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x2, (%rax)
jne 0x4b41e
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movq (%rax), %rsi
callq 0x3e520
movl %eax, -0x64(%rbp)
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movq (%rax), %rsi
callq 0x3e520
movl %eax, -0x68(%rbp)
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x64(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq -0x50(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x8, %rax
andq $0xf, %rax
movq -0x60(%rbp), %rcx
movq 0x20(%rcx), %rcx
movl -0x68(%rbp), %edx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
movq -0x50(%rbp), %rdx
movslq (%rdx), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x8, %rcx
andq $0xf, %rcx
cmpq %rcx, %rax
je 0x4b393
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movq (%rax), %rcx
movl $0x3, %edi
leaq 0xbccb4(%rip), %rsi     # 0x108030
leaq 0xbccbd(%rip), %rdx     # 0x108040
movb $0x0, %al
callq 0x9d90
movl -0x28(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x64(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq -0x50(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x4, %rax
andq $0xf, %rax
movq -0x60(%rbp), %rcx
movq 0x20(%rcx), %rcx
movl -0x68(%rbp), %edx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
movq -0x50(%rbp), %rdx
movslq (%rdx), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x4, %rcx
andq $0xf, %rcx
cmpq %rcx, %rax
je 0x4b41c
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movq (%rax), %rcx
movl $0x3, %edi
leaq 0xbcc2b(%rip), %rsi     # 0x108030
leaq 0xbcc70(%rip), %rdx     # 0x10807c
movb $0x0, %al
callq 0x9d90
movl -0x28(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x4b41e
jmp 0x4b420
jmp 0x4b422
jmp 0x4b424
jmp 0x4b426
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4afb2
cmpl $0x0, -0x24(%rbp)
je 0x4b453
movq -0x10(%rbp), %rdi
callq 0x3ae50
cmpl $0x0, %eax
jge 0x4b451
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4b459
jmp 0x4b453
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)