// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: bcf_hdr_init
bcf_hdr_t *bcf_hdr_init(const char *mode)
{
    int i;
    bcf_hdr_t *h;
    h = (bcf_hdr_t*)calloc(1, sizeof(bcf_hdr_t));
    if (!h) return NULL;
    for (i = 0; i < 3; ++i) {
        if ((h->dict[i] = kh_init(vdict)) == NULL) goto fail;
        // Supersize the hash to make collisions very unlikely
        static int dsize[3] = {16384,16384,2048}; // info, contig, format
        if (kh_resize(vdict, h->dict[i], dsize[i]) < 0) goto fail;
    }

    bcf_hdr_aux_t *aux = (bcf_hdr_aux_t*)calloc(1,sizeof(bcf_hdr_aux_t));
    if ( !aux ) goto fail;
    if ( (aux->gen = kh_init(hdict))==NULL ) { free(aux); goto fail; }
    aux->key_len = NULL;
    aux->dict = *((vdict_t*)h->dict[0]);
    aux->version = 0;
    free(h->dict[0]);
    h->dict[0] = aux;

    if ( strchr(mode,'w') )
    {
        bcf_hdr_append(h, "##fileformat=VCFv4.2");
        // The filter PASS must appear first in the dictionary
        bcf_hdr_append(h, "##FILTER=<ID=PASS,Description=\"All filters passed\">");
        aux->version = VCF_DEF;
    }
    return h;

 fail:
    for (i = 0; i < 3; ++i)
        kh_destroy(vdict, h->dict[i]);
    free(h);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x1, %edi
movl $0xa8, %esi
callq 0x42e0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x3f593
movq $0x0, -0x8(%rbp)
jmp 0x3f6fe
movl $0x0, -0x14(%rbp)
cmpl $0x3, -0x14(%rbp)
jge 0x3f5f4
callq 0x3f710
movq -0x20(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movq %rax, 0x28(%rcx,%rdx,8)
cmpq $0x0, %rax
jne 0x3f5bd
jmp 0x3f6c3
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0x28(%rax,%rcx,8), %rdi
movslq -0x14(%rbp), %rcx
leaq 0xe608b(%rip), %rax     # 0x125660
movl (%rax,%rcx,4), %esi
callq 0x3f730
cmpl $0x0, %eax
jge 0x3f5e7
jmp 0x3f6c3
jmp 0x3f5e9
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3f59a
movl $0x1, %edi
movl $0x40, %esi
callq 0x42e0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x3f613
jmp 0x3f6c3
callq 0x3fce0
movq -0x28(%rbp), %rcx
movq %rax, 0x28(%rcx)
cmpq $0x0, %rax
jne 0x3f634
movq -0x28(%rbp), %rdi
callq 0x45a0
jmp 0x3f6c3
movq -0x28(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rsi
movl $0x28, %edx
callq 0x43b0
movq -0x28(%rbp), %rax
movl $0x0, 0x38(%rax)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x45a0
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rdi
movl $0x77, %esi
callq 0x4160
cmpq $0x0, %rax
je 0x3f6b9
movq -0x20(%rbp), %rdi
leaq 0xc8369(%rip), %rsi     # 0x107a02
callq 0x3ebf0
movq -0x20(%rbp), %rdi
leaq 0xc8208(%rip), %rsi     # 0x1078b1
callq 0x3ebf0
movq -0x28(%rbp), %rax
movl $0x3d10d0, 0x38(%rax)   # imm = 0x3D10D0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3f6fe
movl $0x0, -0x14(%rbp)
cmpl $0x3, -0x14(%rbp)
jge 0x3f6ed
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0x28(%rax,%rcx,8), %rdi
callq 0x3fd00
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3f6ca
movq -0x20(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)