// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
cmpl $0x5, (%rsi)
jne 0x2cb01
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq 0x28(%rdi), %r13
movq 0x28(%r13), %rax
movl (%rax), %edx
testq %rdx, %rdx
setne %sil
je 0x2c9dd
movq 0x10(%rax), %rdi
xorl %r12d, %r12d
xorl %ebp, %ebp
movl %ebp, %ecx
shrl $0x4, %ecx
movl (%rdi,%rcx,4), %r8d
movl %r12d, %ecx
andb $0x1e, %cl
shrl %cl, %r8d
testb $0x3, %r8b
jne 0x2c9ca
movq 0x20(%rax), %rcx
cmpq %r14, (%rcx,%rbp,8)
je 0x2c9fc
incq %rbp
cmpq %rdx, %rbp
setb %sil
addl $0x2, %r12d
cmpq %rbp, %rdx
jne 0x2c9a8
leaq 0x81d9b(%rip), %rdi     # 0xae77f
leaq 0x81c38(%rip), %rsi     # 0xae623
leaq 0x81d46(%rip), %rcx     # 0xae738
movl $0x429, %edx            # imm = 0x429
callq 0x42e0
testb $0x1, %sil
je 0x2c9dd
movq 0x18(%rax), %rax
movq (%rax,%rbp,8), %rdi
callq 0x45c0
movq 0x28(%r13), %rax
cmpl %ebp, (%rax)
je 0x2ca3c
movq 0x10(%rax), %rdx
shrl $0x4, %ebp
movl (%rdx,%rbp,4), %esi
andl $0x1e, %r12d
movl %esi, %edi
movl %r12d, %ecx
shrl %cl, %edi
testb $0x3, %dil
jne 0x2ca3c
btsl %r12d, %esi
movl %esi, (%rdx,%rbp,4)
decl 0x4(%rax)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x8(%r15), %rdx
movq 0x10(%r15), %rcx
leaq 0x81d34(%rip), %rsi     # 0xae792
xorl %eax, %eax
callq 0x8b533
testl %eax, %eax
js 0x2cadf
movq 0x28(%r13), %rdi
movq 0x20(%rsp), %rsi
leaq 0xc(%rsp), %r12
movq %r12, %rdx
callq 0x2cb20
cmpl $0x0, (%r12)
js 0x2cadf
movl %eax, %ebp
movq 0x10(%r14), %rdi
callq 0x45c0
movq 0x10(%r15), %rdi
callq 0x4930
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x2cae9
movq 0x28(%r13), %rax
movq 0x20(%rax), %rax
movl %ebp, %ecx
movq %r14, (%rax,%rcx,8)
movq 0x8(%r14), %rdi
leaq 0x81cde(%rip), %rsi     # 0xae79a
callq 0x46e0
xorl %r15d, %r15d
testl %eax, %eax
jne 0x2caef
movq 0x10(%r14), %rsi
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x2cd13
movq 0x28(%rbx), %rcx
movl %eax, 0x38(%rcx)
jmp 0x2caef
movq 0x20(%rsp), %rdi
callq 0x45c0
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x81c19(%rip), %rdi     # 0xae721
leaq 0x81b14(%rip), %rsi     # 0xae623
leaq 0x81c22(%rip), %rcx     # 0xae738
movl $0x41f, %edx            # imm = 0x41F
callq 0x42e0