// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/vcf.c
// Function: bcf_hdr_update_hrec
int bcf_hdr_update_hrec(bcf_hdr_t *hdr, bcf_hrec_t *hrec, const bcf_hrec_t *tmp)
{
    assert( hrec->type==BCF_HL_GEN );
    int ret;
    khint_t k;
    bcf_hdr_aux_t *aux = get_hdr_aux(hdr);
    for (k=kh_begin(aux->gen); k<kh_end(aux->gen); k++)
    {
        if ( !kh_exist(aux->gen,k) ) continue;
        if ( hrec!=(bcf_hrec_t*)kh_val(aux->gen,k) ) continue;
        break;
    }
    assert( k<kh_end(aux->gen) );   // something went wrong, should never happen
    free((char*)kh_key(aux->gen,k));
    kh_del(hdict,aux->gen,k);
    kstring_t str = {0,0,0};
    if ( ksprintf(&str, "##%s=%s", tmp->key,tmp->value) < 0 )
    {
        free(str.s);
        return -1;
    }
    k = kh_put(hdict, aux->gen, str.s, &ret);
    if ( ret<0 )
    {
        free(str.s);
        return -1;
    }
    free(hrec->value);
    hrec->value = strdup(tmp->value);
    if ( !hrec->value ) return -1;
    kh_val(aux->gen,k) = hrec;

    if (!strcmp(hrec->key,"fileformat")) {
        //update version
        get_hdr_aux(hdr)->version = bcf_get_version(NULL, hrec->value);
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, 0x10(%rsp)
cmpl $0x5, (%rsi)
jne 0x2ba30
movq 0x28(%rdi), %r13
movq 0x28(%r13), %rax
movl (%rax), %edx
testq %rdx, %rdx
je 0x2b912
movq %rsi, %r14
movq 0x10(%rax), %rsi
xorl %r8d, %r8d
xorl %r12d, %r12d
movl %r8d, %ebp
andl $0x1e, %ebp
movl $0x3, %r15d
movl %ebp, %ecx
shll %cl, %r15d
movl %r12d, %ebx
shrl $0x4, %ebx
testl %r15d, (%rsi,%rbx,4)
jne 0x2b906
movq 0x20(%rax), %rcx
cmpq %r14, (%rcx,%r12,8)
je 0x2b931
incq %r12
addl $0x2, %r8d
cmpq %r12, %rdx
jne 0x2b8df
leaq 0x7fe16(%rip), %rdi     # 0xab72f
leaq 0x7fcb3(%rip), %rsi     # 0xab5d3
leaq 0x7fdc1(%rip), %rcx     # 0xab6e8
movl $0x429, %edx            # imm = 0x429
callq 0x42e0
movq %rdi, 0x8(%rsp)
movq 0x18(%rax), %rax
movq (%rax,%r12,8), %rdi
callq 0x45c0
movq 0x28(%r13), %rax
cmpl %r12d, (%rax)
je 0x2b961
movq 0x10(%rax), %rcx
movl (%rcx,%rbx,4), %edx
testl %r15d, %edx
jne 0x2b961
btsl %ebp, %edx
movl %edx, (%rcx,%rbx,4)
decl 0x4(%rax)
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x10(%rsp), %rbx
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rcx
leaq 0x7fdba(%rip), %rsi     # 0xab742
xorl %eax, %eax
callq 0x89557
testl %eax, %eax
js 0x2ba0e
movq 0x28(%r13), %rdi
movq 0x30(%rsp), %rsi
leaq 0x1c(%rsp), %r12
movq %r12, %rdx
callq 0x2ba4f
cmpl $0x0, (%r12)
js 0x2ba0e
movl %eax, %ebp
movq 0x10(%r14), %rdi
callq 0x45c0
movq 0x10(%rbx), %rdi
callq 0x4930
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x2ba18
movq 0x28(%r13), %rax
movq 0x20(%rax), %rax
movl %ebp, %ecx
movq %r14, (%rax,%rcx,8)
movq 0x8(%r14), %rdi
leaq 0x7fd64(%rip), %rsi     # 0xab74a
callq 0x46e0
xorl %r15d, %r15d
testl %eax, %eax
jne 0x2ba1e
movq 0x10(%r14), %rsi
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x2bc61
movq 0x8(%rsp), %rcx
movq 0x28(%rcx), %rcx
movl %eax, 0x38(%rcx)
jmp 0x2ba1e
movq 0x30(%rsp), %rdi
callq 0x45c0
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7fc9a(%rip), %rdi     # 0xab6d1
leaq 0x7fb95(%rip), %rsi     # 0xab5d3
leaq 0x7fca3(%rip), %rcx     # 0xab6e8
movl $0x41f, %edx            # imm = 0x41F
callq 0x42e0