// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: bcf_hdr_sync
int bcf_hdr_sync(bcf_hdr_t *h)
{
    int i;
    for (i = 0; i < 3; i++)
    {
        vdict_t *d = (vdict_t*)h->dict[i];
        khint_t k;
        if ( h->n[i] < kh_size(d) )
        {
            bcf_idpair_t *new_idpair;
            // this should be true only for i=2, BCF_DT_SAMPLE
            new_idpair = (bcf_idpair_t*) realloc(h->id[i], kh_size(d)*sizeof(bcf_idpair_t));
            if (!new_idpair) return -1;
            h->n[i] = kh_size(d);
            h->id[i] = new_idpair;
        }
        for (k=kh_begin(d); k<kh_end(d); k++)
        {
            if (!kh_exist(d,k)) continue;
            h->id[i][kh_val(d,k).id].key = kh_key(d,k);
            h->id[i][kh_val(d,k).id].val = &kh_val(d,k);
        }
    }

    // Invalidate key length cache
    bcf_hdr_aux_t *aux = get_hdr_aux(h);
    if (aux && aux->key_len) {
        free(aux->key_len);
        aux->key_len = NULL;
    }

    h->dirty = 0;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x3, -0x14(%rbp)
jge 0x3afc2
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0x28(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x20(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x3aeeb
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rdi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, %esi
shlq $0x4, %rsi
callq 0x4840
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x3aec8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3b00c
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, 0x10(%rax,%rcx,8)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jae 0x3afb2
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x24(%rbp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0x24(%rbp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x3af28
jmp 0x3afa4
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x24(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rdx
movq 0x10(%rax,%rdx,8), %rax
movq -0x20(%rbp), %rdx
movq 0x20(%rdx), %rdx
movl -0x24(%rbp), %esi
imulq $0x38, %rsi, %rsi
addq %rsi, %rdx
movslq 0x30(%rdx), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rcx
movl -0x24(%rbp), %eax
imulq $0x38, %rax, %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rdx
movq 0x10(%rax,%rdx,8), %rax
movq -0x20(%rbp), %rdx
movq 0x20(%rdx), %rdx
movl -0x24(%rbp), %esi
imulq $0x38, %rsi, %rsi
addq %rsi, %rdx
movslq 0x30(%rdx), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3aef2
jmp 0x3afb4
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3ae63
movq -0x10(%rbp), %rdi
callq 0x3b020
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x3affa
movq -0x38(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x3affa
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x45a0
movq -0x38(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x54(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)