LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_hdr_destroy
void bcf_hdr_destroy(bcf_hdr_t *h)
{
    int i;
    khint_t k;
    if (!h) return;
    for (i = 0; i < 3; ++i) {
        vdict_t *d = (vdict_t*)h->dict[i];
        if (d == 0) continue;
        for (k = kh_begin(d); k != kh_end(d); ++k)
            if (kh_exist(d, k)) free((char*)kh_key(d, k));
        if ( i==0 )
        {
            bcf_hdr_aux_t *aux = get_hdr_aux(h);
            for (k=kh_begin(aux->gen); k<kh_end(aux->gen); k++)
                if ( kh_exist(aux->gen,k) ) free((char*)kh_key(aux->gen,k));
            kh_destroy(hdict, aux->gen);
            free(aux->key_len); // may exist for dict[0] only
        }
        kh_destroy(vdict, d);
        free(h->id[i]);
    }
    for (i=0; i<h->nhrec; i++)
        bcf_hrec_destroy(h->hrec[i]);
    if (h->nhrec) free(h->hrec);
    if (h->samples) free(h->samples);
    free(h->keep_samples);
    free(h->transl[0]); free(h->transl[1]);
    free(h->mem.s);
    free(h);
}

// Assembly:
testq %rdi, %rdi
je 0x256c5
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r13
xorl %r12d, %r12d
movq %rdi, (%rsp)
cmpq $0x3, %r12
je 0x25655
movq 0x28(%r13,%r12,8), %r14
testq %r14, %r14
je 0x2564d
xorl %ebp, %ebp
xorl %r15d, %r15d
cmpl (%r14), %r15d
je 0x255c4
movq 0x10(%r14), %rax
movl %r15d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x255bc
movq 0x18(%r14), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x45c0
incl %r15d
addl $0x2, %ebp
jmp 0x2558f
testq %r12, %r12
jne 0x2563b
movq 0x28(%r13), %r13
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x28(%r13), %r15
movl (%r15), %eax
cmpq %rax, %rbx
jae 0x2560b
movq 0x10(%r15), %rax
movq %rbx, %rcx
shrq $0x4, %rcx
movl (%rax,%rcx,4), %eax
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x25603
movq 0x18(%r15), %rax
movq (%rax,%rbx,8), %rdi
callq 0x45c0
incq %rbx
addl $0x2, %ebp
jmp 0x255d1
movq 0x18(%r15), %rdi
callq 0x45c0
movq 0x10(%r15), %rdi
callq 0x45c0
movq 0x20(%r15), %rdi
callq 0x45c0
movq %r15, %rdi
callq 0x45c0
movq 0x30(%r13), %rdi
callq 0x45c0
movq (%rsp), %r13
movq %r14, %rdi
callq 0x25526
movq 0x10(%r13,%r12,8), %rdi
callq 0x45c0
incq %r12
jmp 0x25572
xorl %ebx, %ebx
movslq 0x50(%r13), %rax
cmpq %rax, %rbx
jge 0x25672
movq 0x48(%r13), %rax
movq (%rax,%rbx,8), %rdi
callq 0x22854
incq %rbx
jmp 0x25657
testl %eax, %eax
je 0x2567f
movq 0x48(%r13), %rdi
callq 0x45c0
movq 0x40(%r13), %rdi
callq 0x45c0
movq 0x78(%r13), %rdi
callq 0x45c0
movq 0x60(%r13), %rdi
callq 0x45c0
movq 0x68(%r13), %rdi
callq 0x45c0
movq 0x90(%r13), %rdi
callq 0x45c0
movq %r13, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_hdr_write
int bcf_hdr_write(htsFile *hfp, bcf_hdr_t *h)
{
    if (!h) {
        errno = EINVAL;
        return -1;
    }
    if ( h->dirty ) {
        if (bcf_hdr_sync(h) < 0) return -1;
    }
    hfp->format.category = variant_data;
    if (hfp->format.format == vcf || hfp->format.format == text_format) {
        hfp->format.format = vcf;
        return vcf_hdr_write(hfp, h);
    }

    if (hfp->format.format == binary_format)
        hfp->format.format = bcf;

    kstring_t htxt = {0,0,0};
    if (bcf_hdr_format(h, 1, &htxt) < 0) {
        free(htxt.s);
        return -1;
    }
    kputc('\0', &htxt); // include the \0 byte

    BGZF *fp = hfp->fp.bgzf;
    if ( bgzf_write(fp, "BCF\2\2", 5) !=5 ) return -1;
    uint8_t hlen[4];
    u32_to_le(htxt.l, hlen);
    if ( bgzf_write(fp, hlen, 4) !=4 ) return -1;
    if ( bgzf_write(fp, htxt.s, htxt.l) != htxt.l ) return -1;
    if ( bgzf_flush(fp) < 0) return -1;

    free(htxt.s);
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x25d3f
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x54(%rsi)
je 0x25d0d
movq %r14, %rdi
callq 0x2276e
testl %eax, %eax
js 0x25d4a
movl $0x2, 0x48(%rbx)
movl 0x4c(%rbx), %eax
cmpl $0x1, %eax
je 0x25d57
cmpl $0x8, %eax
je 0x25d26
cmpl $0x2, %eax
jne 0x25d5e
movl $0x8, 0x4c(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
addq $0x28, %rsp
popq %rbx
popq %r14
jmp 0x25e0e
callq 0x4050
movl $0x16, (%rax)
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movl $0x9, 0x4c(%rbx)
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x25ea7
testl %eax, %eax
js 0x25dff
movq %rsp, %rsi
xorl %edi, %edi
callq 0x25f76
movq 0x38(%rbx), %r14
leaq 0x609cb(%rip), %rsi     # 0x8675f
pushq $0x5
popq %rdx
movq %r14, %rdi
callq 0x6be34
cmpq $0x5, %rax
jne 0x25d4a
movl (%rsp), %eax
leaq 0x24(%rsp), %rsi
movl %eax, (%rsi)
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x6be34
pushq $-0x1
popq %rbx
cmpq $0x4, %rax
jne 0x25d4d
movq (%rsp), %rdx
movq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x6be34
cmpq (%rsp), %rax
jne 0x25d4d
movq %r14, %rdi
callq 0x6b9d9
testl %eax, %eax
js 0x25d4d
movq 0x10(%rsp), %rdi
callq 0x45c0
xorl %ebx, %ebx
jmp 0x25d4d
movq 0x10(%rsp), %rdi
callq 0x45c0
jmp 0x25d4a
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: vcf_hdr_write
int vcf_hdr_write(htsFile *fp, const bcf_hdr_t *h)
{
    kstring_t htxt = {0,0,0};
    if (bcf_hdr_format(h, 0, &htxt) < 0) {
        free(htxt.s);
        return -1;
    }
    while (htxt.l && htxt.s[htxt.l-1] == '\0') --htxt.l; // kill trailing zeros
    int ret;
    if ( fp->format.compression!=no_compression ) {
        ret = bgzf_write(fp->fp.bgzf, htxt.s, htxt.l);
        if (bgzf_flush(fp->fp.bgzf) != 0) return -1;
    } else {
        ret = hwrite(fp->fp.hfile, htxt.s, htxt.l);
    }
    free(htxt.s);
    return ret<0 ? -1 : 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
movq %rsi, %rdi
xorl %esi, %esi
callq 0x25ea7
testl %eax, %eax
js 0x25e77
movq (%rsp), %rdx
movq 0x10(%rsp), %rsi
movq %rdx, %rax
subq $0x1, %rax
jb 0x25e56
cmpb $0x0, -0x1(%rsi,%rdx)
jne 0x25e56
movq %rax, (%rsp)
movq %rax, %rdx
jmp 0x25e40
cmpl $0x0, 0x54(%rbx)
movq 0x38(%rbx), %rdi
je 0x25e86
callq 0x6be34
movq %rax, %r14
movq 0x38(%rbx), %rdi
callq 0x6b9d9
testl %eax, %eax
jne 0x25e81
jmp 0x25e8e
movq 0x10(%rsp), %rdi
callq 0x45c0
pushq $-0x1
popq %rax
jmp 0x25e9f
callq 0x27cb0
movq %rax, %r14
movq 0x10(%rsp), %rdi
callq 0x45c0
movslq %r14d, %rax
shrq $0x1f, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_hdr_format
int bcf_hdr_format(const bcf_hdr_t *hdr, int is_bcf, kstring_t *str)
{
    int i, r = 0;
    for (i=0; i<hdr->nhrec; i++)
        r |= _bcf_hrec_format(hdr->hrec[i], is_bcf, str) < 0;

    r |= ksprintf(str, "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO") < 0;
    if ( bcf_hdr_nsamples(hdr) )
    {
        r |= ksprintf(str, "\tFORMAT") < 0;
        for (i=0; i<bcf_hdr_nsamples(hdr); i++)
            r |= ksprintf(str, "\t%s", hdr->samples[i]) < 0;
    }
    r |= ksprintf(str, "\n") < 0;

    return r ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
xorl %r12d, %r12d
xorl %r15d, %r15d
movslq 0x50(%r14), %rax
cmpq %rax, %r12
jge 0x25ee3
movq 0x48(%r14), %rax
movq (%rax,%r12,8), %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x279db
shrl $0x1f, %eax
orl %eax, %r15d
incq %r12
jmp 0x25ebd
leaq 0x602b6(%rip), %rsi     # 0x861a0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x69048
movl %eax, %ebp
cmpl $0x0, 0x8(%r14)
je 0x25f48
leaq 0x60a22(%rip), %rsi     # 0x86926
movq %rbx, %rdi
xorl %eax, %eax
callq 0x69048
orl %eax, %ebp
shrl $0x1f, %ebp
orl %r15d, %ebp
leaq 0x603a2(%rip), %r15     # 0x862bf
xorl %r12d, %r12d
movslq 0x8(%r14), %rax
cmpq %rax, %r12
jge 0x25f4e
movq 0x40(%r14), %rax
movq (%rax,%r12,8), %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x69048
shrl $0x1f, %eax
orl %eax, %ebp
incq %r12
jmp 0x25f20
shrl $0x1f, %ebp
orl %r15d, %ebp
leaq 0x5dc9e(%rip), %rsi     # 0x83bf3
movq %rbx, %rdi
xorl %eax, %eax
callq 0x69048
shrl $0x1f, %eax
xorl %ecx, %ecx
orl %ebp, %eax
setne %cl
negl %ecx
movl %ecx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_clear
void bcf_clear(bcf1_t *v)
{
    int i;
    for (i=0; i<v->d.m_info; i++)
    {
        if ( v->d.info[i].vptr_free )
        {
            free(v->d.info[i].vptr - v->d.info[i].vptr_off);
            v->d.info[i].vptr_free = 0;
        }
    }
    for (i=0; i<v->d.m_fmt; i++)
    {
        if ( v->d.fmt[i].p_free )
        {
            free(v->d.fmt[i].p - v->d.fmt[i].p_off);
            v->d.fmt[i].p_free = 0;
        }
    }
    v->rid = v->pos = v->rlen = v->unpacked = 0;
    bcf_float_set_missing(v->qual);
    v->n_info = v->n_allele = v->n_fmt = v->n_sample = 0;
    v->shared.l = v->indiv.l = 0;
    v->d.var_type = -1;
    v->d.shared_dirty = 0;
    v->d.indiv_dirty  = 0;
    v->d.n_flt = 0;
    v->errcode = 0;
    if (v->d.m_als) v->d.als[0] = 0;
    if (v->d.m_id) v->d.id[0] = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
pushq $0x1c
popq %r14
xorl %r15d, %r15d
movslq 0x54(%rbx), %rax
cmpq %rax, %r15
jge 0x2601c
movq 0x90(%rbx), %rcx
movl (%rcx,%r14), %eax
testl %eax, %eax
jns 0x26013
movq -0xc(%rcx,%r14), %rdi
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
subq %rax, %rdi
callq 0x45c0
movq 0x90(%rbx), %rax
andl $0x7fffffff, (%rax,%r14) # imm = 0x7FFFFFFF
incq %r15
addq $0x28, %r14
jmp 0x25fda
pushq $0x1c
popq %r14
xorl %r15d, %r15d
movslq 0x50(%rbx), %rax
cmpq %rax, %r15
jge 0x26065
movq 0x98(%rbx), %rcx
movl (%rcx,%r14), %eax
testl %eax, %eax
jns 0x2605c
movq -0xc(%rcx,%r14), %rdi
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
subq %rax, %rdi
callq 0x45c0
movq 0x98(%rbx), %rax
andl $0x7fffffff, (%rax,%r14) # imm = 0x7FFFFFFF
incq %r15
addq $0x20, %r14
jmp 0x26023
andl $0x0, 0xbc(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andl $0x0, 0x10(%rbx)
movl 0x89494(%rip), %eax     # 0xaf510
movl %eax, 0x14(%rbx)
andq $0x0, 0x38(%rbx)
movups %xmm0, 0x18(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0xac(%rbx)
andl $0x0, 0xb4(%rbx)
andl $0x0, 0x68(%rbx)
andl $0x0, 0xcc(%rbx)
xorl %eax, %eax
cmpl %eax, 0x5c(%rbx)
je 0x260b7
movq 0x80(%rbx), %rax
movb $0x0, (%rax)
cmpl $0x0, 0x58(%rbx)
je 0x260c4
movq 0x78(%rbx), %rax
movb $0x0, (%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_empty
void bcf_empty(bcf1_t *v)
{
    bcf_clear1(v);
    free(v->d.id);
    free(v->d.als);
    free(v->d.allele); free(v->d.flt); free(v->d.info); free(v->d.fmt);
    if (v->d.var ) free(v->d.var);
    free(v->shared.s); free(v->indiv.s);
    memset(&v->d,0,sizeof(v->d));
    memset(&v->shared,0,sizeof(v->shared));
    memset(&v->indiv,0,sizeof(v->indiv));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x25fcb
movq 0x78(%rbx), %rdi
callq 0x45c0
movq 0x80(%rbx), %rdi
callq 0x45c0
movq 0x88(%rbx), %rdi
callq 0x45c0
movq 0x70(%rbx), %rdi
callq 0x45c0
movq 0x90(%rbx), %rdi
callq 0x45c0
movq 0x98(%rbx), %rdi
callq 0x45c0
movq 0xa0(%rbx), %rdi
callq 0x45c0
leaq 0x20(%rbx), %r14
movq 0x30(%rbx), %rdi
callq 0x45c0
movq 0x48(%rbx), %rdi
callq 0x45c0
movl $0x98, %edx
movq %r14, %rdi
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4250
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_unpack_fmt_core1
static inline uint8_t *bcf_unpack_fmt_core1(uint8_t *ptr, int n_sample, bcf_fmt_t *fmt)
{
    uint8_t *ptr_start = ptr;
    fmt->id = bcf_dec_typed_int1(ptr, &ptr);
    fmt->n = bcf_dec_size(ptr, &ptr, &fmt->type);
    fmt->size = fmt->n << bcf_type_shift[fmt->type];
    fmt->p = ptr;
    fmt->p_off  = ptr - ptr_start;
    fmt->p_free = 0;
    ptr += n_sample * fmt->size;
    fmt->p_len = ptr - fmt->p;
    return ptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq %rsp, %r15
movq %rdi, (%r15)
movq %r15, %rsi
callq 0x2c18d
movl %eax, (%rbx)
movq (%r15), %rdi
leaq 0xc(%rbx), %rdx
movq %r15, %rsi
callq 0x2855d
movl %eax, 0x4(%rbx)
movslq 0xc(%rbx), %rcx
leaq 0x89188(%rip), %rdx     # 0xaf520
movb (%rcx,%rdx), %cl
shll %cl, %eax
movl %eax, 0x8(%rbx)
movq (%r15), %rcx
movq %rcx, 0x10(%rbx)
movl %ecx, %edx
subl %r14d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl %edx, 0x1c(%rbx)
imull %ebp, %eax
cltq
addq %rax, %rcx
movl %eax, 0x18(%rbx)
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_read
int bcf_read(htsFile *fp, const bcf_hdr_t *h, bcf1_t *v)
{
    if (fp->format.format == vcf) return vcf_read(fp,h,v);
    int ret = bcf_read1_core(fp->fp.bgzf, v);
    if (ret == 0) ret = bcf_record_check(h, v);
    if ( ret!=0 || !h->keep_samples ) return ret;
    return bcf_subset_format(h,v);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
cmpl $0x8, 0x4c(%rdi)
jne 0x263ed
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x2642b
movq 0x38(%rdi), %rdi
movq %rbx, %rsi
callq 0x26462
testl %eax, %eax
jne 0x2640c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x265b3
testl %eax, %eax
je 0x26415
movl %eax, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
xorl %ebp, %ebp
cmpq $0x0, 0x78(%r14)
je 0x2640e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x26168
jmp 0x2640e
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_readrec
int bcf_readrec(BGZF *fp, void *null, void *vv, int *tid, hts_pos_t *beg, hts_pos_t *end)
{
    bcf1_t *v = (bcf1_t *) vv;
    int ret = bcf_read1_core(fp, v);
    if (ret == 0) ret = bcf_record_check(NULL, v);
    if (ret  >= 0)
        *tid = v->rid, *beg = v->pos, *end = v->pos + v->rlen;
    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r14
movq %rdx, %rsi
callq 0x26462
testl %eax, %eax
jne 0x26dc8
xorl %edi, %edi
movq %r14, %rsi
callq 0x265b3
testl %eax, %eax
js 0x26dc8
movl 0x10(%r14), %ecx
movl %ecx, (%r12)
movq (%r14), %rcx
movq %rcx, (%r15)
addq 0x8(%r14), %rcx
movq %rcx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_copy
bcf1_t *bcf_copy(bcf1_t *dst, bcf1_t *src)
{
    bcf1_sync(src);

    bcf_clear(dst);
    dst->rid  = src->rid;
    dst->pos  = src->pos;
    dst->rlen = src->rlen;
    dst->qual = src->qual;
    dst->n_info = src->n_info; dst->n_allele = src->n_allele;
    dst->n_fmt = src->n_fmt; dst->n_sample = src->n_sample;

    if ( dst->shared.m < src->shared.l )
    {
        dst->shared.s = (char*) realloc(dst->shared.s, src->shared.l);
        dst->shared.m = src->shared.l;
    }
    dst->shared.l = src->shared.l;
    memcpy(dst->shared.s,src->shared.s,dst->shared.l);

    if ( dst->indiv.m < src->indiv.l )
    {
        dst->indiv.s = (char*) realloc(dst->indiv.s, src->indiv.l);
        dst->indiv.m = src->indiv.l;
    }
    dst->indiv.l = src->indiv.l;
    memcpy(dst->indiv.s,src->indiv.s,dst->indiv.l);

    return dst;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x26ee1
movq %rbx, %rdi
callq 0x25fcb
movl 0x10(%r14), %eax
movl %eax, 0x10(%rbx)
movups (%r14), %xmm0
movups %xmm0, (%rbx)
movss 0x14(%r14), %xmm0
movss %xmm0, 0x14(%rbx)
movq 0x18(%rbx), %rcx
movq 0x28(%rbx), %rax
movw 0x18(%r14), %cx
movq %rcx, 0x18(%rbx)
movzwl 0x1a(%r14), %edx
shll $0x10, %edx
movabsq $-0xffff0001, %rsi      # imm = 0xFFFFFFFF0000FFFF
andq %rcx, %rsi
orq %rdx, %rsi
movq %rsi, 0x18(%rbx)
movzbl 0x1c(%r14), %ecx
shlq $0x20, %rcx
movabsq $-0xff00000001, %rdx    # imm = 0xFFFFFF00FFFFFFFF
andq %rsi, %rdx
orq %rcx, %rdx
movq %rdx, 0x18(%rbx)
movabsq $-0x10000000000, %rcx   # imm = 0xFFFFFF0000000000
andq 0x18(%r14), %rcx
movabsq $0xffffffffff, %rsi     # imm = 0xFFFFFFFFFF
andq %rdx, %rsi
orq %rcx, %rsi
movq %rsi, 0x18(%rbx)
movq 0x20(%r14), %rdx
movq 0x30(%rbx), %rdi
cmpq %rdx, %rax
jae 0x26e97
movq %rdx, %rsi
callq 0x4860
movq %rax, %rdi
movq %rax, 0x30(%rbx)
movq 0x20(%r14), %rdx
movq %rdx, 0x28(%rbx)
movq %rdx, 0x20(%rbx)
movq 0x30(%r14), %rsi
callq 0x43c0
movq 0x38(%r14), %rdx
movq 0x48(%rbx), %rdi
cmpq %rdx, 0x40(%rbx)
jae 0x26ec9
movq %rdx, %rsi
callq 0x4860
movq %rax, %rdi
movq %rax, 0x48(%rbx)
movq 0x38(%r14), %rdx
movq %rdx, 0x40(%rbx)
movq %rdx, 0x38(%rbx)
movq 0x48(%r14), %rsi
callq 0x43c0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: vcf_write
int vcf_write(htsFile *fp, const bcf_hdr_t *h, bcf1_t *v)
{
    ssize_t ret;
    fp->line.l = 0;
    if (vcf_format1(h, v, &fp->line) != 0)
        return -1;
    if ( fp->format.compression!=no_compression ) {
        if (bgzf_flush_try(fp->fp.bgzf, fp->line.l) < 0)
            return -1;
        if (fp->idx && !fp->fp.bgzf->mt)
            hts_idx_amend_last(fp->idx, bgzf_tell(fp->fp.bgzf));
        ret = bgzf_write(fp->fp.bgzf, fp->line.s, fp->line.l);
    } else {
        ret = hwrite(fp->fp.hfile, fp->line.s, fp->line.l);
    }

    if (fp->idx && fp->format.compression == bgzf) {
        int tid;
        if ((tid = hts_idx_tbi_name(fp->idx, v->rid, bcf_seqname_safe(h, v))) < 0)
            return -1;

        if (bgzf_idx_push(fp->fp.bgzf, fp->idx,
                          tid, v->pos, v->pos + v->rlen,
                          bgzf_tell(fp->fp.bgzf), 1) < 0)
            return -1;
    }

    return ret==fp->line.l ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r12
leaq 0x10(%rdi), %r14
andq $0x0, 0x10(%rdi)
movq %rsi, %rdi
movq %rdx, %rsi
movq %r14, %rdx
callq 0x2b6d8
pushq $-0x1
popq %rbx
testl %eax, %eax
jne 0x27790
cmpl $0x0, 0x54(%r12)
movq 0x38(%r12), %rdi
je 0x276ff
movq (%r14), %rsi
callq 0x6be0a
testl %eax, %eax
js 0x27790
movq 0x38(%r12), %rdi
movq 0x68(%r12), %rax
testq %rax, %rax
je 0x276ee
cmpq $0x0, 0x48(%rdi)
jne 0x276ee
movq 0x18(%rdi), %rcx
shlq $0x10, %rcx
movzwl 0x10(%rdi), %esi
orq %rcx, %rsi
movq %rax, %rdi
callq 0xae67
movq 0x38(%r12), %rdi
movq 0x10(%r12), %rdx
movq 0x20(%r12), %rsi
callq 0x6be34
jmp 0x2770e
movq 0x10(%r12), %rdx
movq 0x20(%r12), %rsi
callq 0x27cb0
movq 0x68(%r12), %rbp
testq %rbp, %rbp
je 0x27786
cmpl $0x2, 0x54(%r12)
jne 0x27786
movq %rax, 0x10(%rsp)
movl 0x10(%r15), %eax
movl %eax, 0xc(%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x27650
movq %rbp, %rdi
movl 0xc(%rsp), %esi
movq %rax, %rdx
callq 0xaddb
testl %eax, %eax
js 0x27790
movq 0x38(%r12), %rdi
movq 0x68(%r12), %rsi
movq (%r15), %rcx
movq 0x8(%r15), %r8
addq %rcx, %r8
movq 0x18(%rdi), %rdx
shlq $0x10, %rdx
movzwl 0x10(%rdi), %r9d
orq %rdx, %r9
movl $0x1, (%rsp)
movl %eax, %edx
callq 0x69824
testl %eax, %eax
movq 0x10(%rsp), %rax
js 0x27790
xorl %ebx, %ebx
cmpq (%r14), %rax
setne %bl
negl %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_strerror
const char *bcf_strerror(int errorcode, char *buffer, size_t maxbuffer) {
    size_t usedup = 0;
    int ret = 0;
    int idx;

    if (!buffer || maxbuffer < 4)
        return NULL;           //invalid / insufficient buffer

    if (!errorcode) {
        buffer[0] = '\0';      //no error, set null
        return buffer;
    }

    for (idx = 0; idx < sizeof(errdesc_bcf) / sizeof(err_desc); ++idx) {
        if (errorcode & errdesc_bcf[idx].errorcode) {    //error is set, add description
            ret = add_desc_to_buffer(buffer, &usedup, maxbuffer, errdesc_bcf[idx].description);
            if (ret < 0)
                break;         //not enough space, ... added, no need to continue

            errorcode &= ~errdesc_bcf[idx].errorcode;    //reset the error
        }
    }

    if (errorcode && (ret >= 0))  {     //undescribed error is present in error code and had enough buffer, try to add unkonwn error as well§
        add_desc_to_buffer(buffer, &usedup, maxbuffer, "Unknown error");
    }
    return buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
andq $0x0, (%rsp)
testq %rsi, %rsi
sete %al
cmpq $0x4, %rdx
setb %cl
orb %al, %cl
je 0x277c6
xorl %ebx, %ebx
jmp 0x2782d
movq %rsi, %rbx
movl %edi, %ebp
testl %edi, %edi
je 0x2782a
movq %rdx, %r14
pushq $0x8
popq %r12
leaq 0x86f93(%rip), %r13     # 0xae770
cmpq $0x78, %r12
je 0x2780f
movl -0x8(%r12,%r13), %r15d
testl %ebp, %r15d
je 0x27809
movq (%r12,%r13), %rcx
movq %rbx, %rdi
movq %rsp, %rsi
movq %r14, %rdx
callq 0x3082e
testl %eax, %eax
js 0x2782d
notl %r15d
andl %r15d, %ebp
addq $0x10, %r12
jmp 0x277dd
testl %ebp, %ebp
je 0x2782d
leaq 0x5f95d(%rip), %rcx     # 0x87177
movq %rsp, %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x3082e
jmp 0x2782d
movb $0x0, (%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_hdr_set
int bcf_hdr_set(bcf_hdr_t *hdr, const char *fname)
{
    int i = 0, n = 0, save_errno;
    char **lines = hts_readlines(fname, &n);
    if ( !lines ) return 1;
    for (i=0; i<n-1; i++)
    {
        int k;
        bcf_hrec_t *hrec = bcf_hdr_parse_line(hdr,lines[i],&k);
        if (!hrec) goto fail;
        if (bcf_hdr_add_hrec(hdr, hrec) < 0) {
            bcf_hrec_destroy(hrec);
            goto fail;
        }
        free(lines[i]);
        lines[i] = NULL;
    }
    if (bcf_hdr_parse_sample_line(hdr, lines[n-1]) < 0) goto fail;
    if (bcf_hdr_sync(hdr) < 0) goto fail;
    free(lines[n-1]);
    free(lines);
    return 0;

 fail:
    save_errno = errno;
    for (; i < n; i++)
        free(lines[i]);
    free(lines);
    errno = save_errno;
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %r15
movq %rsp, %rsi
andl $0x0, (%rsi)
movq %rax, %rdi
callq 0x9e51
pushq $0x1
popq %rbx
testq %rax, %rax
je 0x279c3
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x4(%rsp), %r12
movslq (%rsp), %rax
leaq -0x1(%rax), %rcx
cmpq %rcx, %rbp
jge 0x27957
movq (%r14,%rbp,8), %rsi
movq %r12, %rdx
callq 0x22f44
testq %rax, %rax
je 0x27996
movq %rax, %r13
movq %r15, %rdi
movq %rax, %rsi
callq 0x238dd
testl %eax, %eax
js 0x2798e
movq (%r14,%rbp,8), %rdi
callq 0x45c0
andq $0x0, (%r14,%rbp,8)
incq %rbp
jmp 0x27914
movq -0x8(%r14,%rax,8), %rsi
movq %r15, %rdi
callq 0x22679
testl %eax, %eax
js 0x27996
movq %r15, %rdi
callq 0x2276e
testl %eax, %eax
js 0x27996
movslq (%rsp), %rax
movq -0x8(%r14,%rax,8), %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x45c0
xorl %ebx, %ebx
jmp 0x279c3
movq %r13, %rdi
callq 0x22854
callq 0x4050
movq %rax, %r15
movl (%rax), %r12d
movslq (%rsp), %rax
cmpq %rax, %rbp
jge 0x279b8
movq (%r14,%rbp,8), %rdi
callq 0x45c0
incq %rbp
jmp 0x279a1
movq %r14, %rdi
callq 0x45c0
movl %r12d, (%r15)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_hrec_format
static int _bcf_hrec_format(const bcf_hrec_t *hrec, int is_bcf, kstring_t *str)
{
    uint32_t e = 0;
    if ( !hrec->value )
    {
        int j, nout = 0;
        e |= ksprintf(str, "##%s=<", hrec->key) < 0;
        for (j=0; j<hrec->nkeys; j++)
        {
            // do not output IDX if output is VCF
            if ( !is_bcf && !strcmp("IDX",hrec->keys[j]) ) continue;
            if ( nout ) e |= kputc(',',str) < 0;
            e |= ksprintf(str,"%s=%s", hrec->keys[j], hrec->vals[j]) < 0;
            nout++;
        }
        e |= ksprintf(str,">\n") < 0;
    }
    else
        e |= ksprintf(str,"##%s=%s\n", hrec->key,hrec->value) < 0;

    return e == 0 ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
testq %rcx, %rcx
je 0x27a0f
leaq 0x5e903(%rip), %rsi     # 0x86300
movq %rbx, %rdi
xorl %eax, %eax
callq 0x69048
shrl $0x1f, %eax
jmp 0x27ab3
movl %esi, %ebp
movq %rdi, %r14
leaq 0x5e8d4(%rip), %rsi     # 0x862ef
movq %rbx, %rdi
xorl %eax, %eax
callq 0x69048
movl %eax, %r15d
shrl $0x1f, %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
movslq 0x18(%r14), %rax
cmpq %rax, %r12
jge 0x27a9c
testl %ebp, %ebp
jne 0x27a57
movq 0x20(%r14), %rax
movq (%rax,%r12,8), %rsi
leaq 0x5b07c(%rip), %rdi     # 0x82aca
callq 0x46e0
testl %eax, %eax
je 0x27a97
testl %r13d, %r13d
je 0x27a6d
pushq $0x2c
popq %rdi
movq %rbx, %rsi
callq 0x25f76
shrl $0x1f, %eax
orl %eax, %r15d
movq 0x20(%r14), %rax
movq 0x28(%r14), %rcx
movq (%rax,%r12,8), %rdx
movq (%rcx,%r12,8), %rcx
movq %rbx, %rdi
leaq 0x5ea0d(%rip), %rsi     # 0x86494
xorl %eax, %eax
callq 0x69048
shrl $0x1f, %eax
orl %eax, %r15d
incl %r13d
incq %r12
jmp 0x27a32
leaq 0x5e85a(%rip), %rsi     # 0x862fd
movq %rbx, %rdi
xorl %eax, %eax
callq 0x69048
shrl $0x1f, %eax
orl %r15d, %eax
xorl %ecx, %ecx
negl %eax
sbbl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_hdr_fmt_text
char *bcf_hdr_fmt_text(const bcf_hdr_t *hdr, int is_bcf, int *len)
{
    kstring_t txt = {0,0,0};
    if (bcf_hdr_format(hdr, is_bcf, &txt) < 0)
        return NULL;
    if ( len ) *len = txt.l;
    return txt.s;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
callq 0x25ea7
testl %eax, %eax
js 0x27afa
testq %rbx, %rbx
je 0x27af3
movl (%rsp), %eax
movl %eax, (%rbx)
movq 0x10(%rsp), %rax
jmp 0x27afc
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/vcf.h
// Function: bcf_enc_size
static inline int bcf_enc_size(kstring_t *s, int size, int type)
{
    // Most common case is first
    if (size < 15) {
        if (ks_resize(s, s->l + 1) < 0)
            return -1;
        uint8_t *p = (uint8_t *)s->s + s->l;
        *p++ = (size<<4) | type;
        s->l++;
        return 0;
    }

    if (ks_resize(s, s->l + 6) < 0)
        return -1;
    uint8_t *p = (uint8_t *)s->s + s->l;
    *p++ = 15<<4|type;

    if (size < 128) {
        *p++ = 1<<4|BCF_BT_INT8;
        *p++ = size;
        s->l += 3;
    } else {
        if (size < 32768) {
            *p++ = 1<<4|BCF_BT_INT16;
            i16_to_le(size, p);
            s->l += 4;
        } else {
            *p++ = 1<<4|BCF_BT_INT32;
            i32_to_le(size, p);
            s->l += 6;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rsi
cmpl $0xe, %ebp
jg 0x28023
incq %rsi
movq %rbx, %rdi
callq 0x2811b
testl %eax, %eax
js 0x28055
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
shll $0x4, %ebp
orl %r14d, %ebp
movb %bpl, (%rcx,%rax)
pushq $0x1
jmp 0x2807b
addq $0x6, %rsi
movq %rbx, %rdi
callq 0x2811b
testl %eax, %eax
js 0x28055
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
orb $-0x10, %r14b
movb %r14b, (%rcx,%rax)
cmpl $0x7f, %ebp
ja 0x2805a
movb $0x11, 0x1(%rcx,%rax)
movb %bpl, 0x2(%rcx,%rax)
pushq $0x3
jmp 0x2807b
pushq $-0x1
popq %rax
jmp 0x28081
cmpl $0x7fff, %ebp           # imm = 0x7FFF
ja 0x28070
movb $0x12, 0x1(%rcx,%rax)
movw %bp, 0x2(%rcx,%rax)
pushq $0x4
jmp 0x2807b
movb $0x13, 0x1(%rcx,%rax)
movl %ebp, 0x2(%rcx,%rax)
pushq $0x6
popq %rax
addq %rax, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/vcf.h
// Function: bcf_enc_int1
static inline int bcf_enc_int1(kstring_t *s, int32_t x)
{
    if (ks_resize(s, s->l + 5) < 0)
        return -1;
    uint8_t *p = (uint8_t *)s->s + s->l;

    if (x == bcf_int32_vector_end) {
        // An inline implementation of bcf_enc_size with size==1 and
        // memory allocation already accounted for.
        *p = (1<<4) | BCF_BT_INT8;
        p[1] = bcf_int8_vector_end;
        s->l+=2;
    } else if (x == bcf_int32_missing) {
        *p = (1<<4) | BCF_BT_INT8;
        p[1] = bcf_int8_missing;
        s->l+=2;
    } else if (x <= BCF_MAX_BT_INT8 && x >= BCF_MIN_BT_INT8) {
        *p = (1<<4) | BCF_BT_INT8;
        p[1] = x;
        s->l+=2;
    } else if (x <= BCF_MAX_BT_INT16 && x >= BCF_MIN_BT_INT16) {
        *p = (1<<4) | BCF_BT_INT16;
        i16_to_le(x, p+1);
        s->l+=3;
    } else {
        *p = (1<<4) | BCF_BT_INT32;
        i32_to_le(x, p+1);
        s->l+=5;
    }

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movq (%rdi), %rsi
addq $0x5, %rsi
callq 0x2811b
testl %eax, %eax
js 0x280bf
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movl %r14d, %edx
negl %edx
jo 0x280c4
cmpl $0x80000001, %r14d      # imm = 0x80000001
jne 0x280cc
movw $0x8111, (%rcx,%rax)    # imm = 0x8111
jmp 0x280e1
pushq $-0x1
popq %rax
jmp 0x280e9
movw $0x8011, (%rcx,%rax)    # imm = 0x8011
jmp 0x280e1
leal 0x78(%r14), %edx
cmpl $0xf7, %edx
ja 0x280f1
movb $0x11, (%rcx,%rax)
movb %r14b, 0x1(%rcx,%rax)
pushq $0x2
popq %rax
addq %rax, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leal 0x7ff8(%r14), %edx
cmpl $0xfff7, %edx           # imm = 0xFFF7
ja 0x2810e
movb $0x12, (%rcx,%rax)
movw %r14w, 0x1(%rcx,%rax)
pushq $0x3
jmp 0x280e3
movb $0x13, (%rcx,%rax)
movl %r14d, 0x1(%rcx,%rax)
pushq $0x5
jmp 0x280e3
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_enc_vfloat
int bcf_enc_vfloat(kstring_t *s, int n, float *a)
{
    assert(n >= 0);
    bcf_enc_size(s, n, BCF_BT_FLOAT);
    serialize_float_array(s, n, a);
    return 0; // FIXME: check for errs in this function
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testl %esi, %esi
js 0x2819c
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
pushq $0x5
popq %rdx
callq 0x27feb
movl %ebp, %esi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x281bb
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x5e7b6(%rip), %rdi     # 0x86959
leaq 0x5e179(%rip), %rsi     # 0x86323
leaq 0x5e7af(%rip), %rcx     # 0x86960
movl $0xaa4, %edx            # imm = 0xAA4
callq 0x42e0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: serialize_float_array
static inline int serialize_float_array(kstring_t *s, size_t n, const float *a) {
    uint8_t *p;
    size_t i;
    size_t bytes = n * sizeof(float);

    if (bytes / sizeof(float) != n) return -1;
    if (ks_resize(s, s->l + bytes) < 0) return -1;

    p = (uint8_t *) s->s + s->l;
    for (i = 0; i < n; i++) {
        float_to_le(a[i], p);
        p += sizeof(float);
    }
    s->l += bytes;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rax
shrq $0x3e, %rax
pushq $-0x1
popq %rbp
jne 0x28218
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq (,%rsi,4), %r12
movq (%rdi), %rsi
addq %r12, %rsi
callq 0x2811b
testl %eax, %eax
js 0x28218
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
addq %rax, %rcx
xorl %edx, %edx
cmpq %rdx, %r15
je 0x28210
movss (%r14,%rdx,4), %xmm0
movss %xmm0, (%rcx,%rdx,4)
incq %rdx
jmp 0x281fb
addq %r12, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/vcf.h
// Function: bcf_dec_size
static inline int32_t bcf_dec_size(const uint8_t *p, uint8_t **q, int *type)
{
    *type = *p & 0xf;
    if (*p>>4 != 15) {
        *q = (uint8_t*)p + 1;
        return *p>>4;
    } else return bcf_dec_typed_int1(p + 1, q);
}

// Assembly:
movzbl (%rdi), %eax
andl $0xf, %eax
movl %eax, (%rdx)
leaq 0x1(%rdi), %rax
cmpb $-0x11, (%rdi)
jbe 0x2857c
pushq %rax
movq %rax, %rdi
callq 0x2c18d
addq $0x8, %rsp
retq
movq %rax, (%rsi)
movzbl (%rdi), %eax
shrl $0x4, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: vcf_open_mode
int vcf_open_mode(char *mode, const char *fn, const char *format)
{
    if (format == NULL) {
        // Try to pick a format based on the filename extension
        char extension[HTS_MAX_EXT_LEN];
        if (find_file_extension(fn, extension) < 0) return -1;
        return vcf_open_mode(mode, fn, extension);
    }
    else if (strcasecmp(format, "bcf") == 0) strcpy(mode, "b");
    else if (strcasecmp(format, "vcf") == 0) strcpy(mode, "");
    else if (strcasecmp(format, "vcf.gz") == 0 || strcasecmp(format, "vcf.bgz") == 0) strcpy(mode, "z");
    else return -1;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
testq %rdx, %rdx
je 0x2b08d
movq %rdx, %r15
leaq 0x580a3(%rip), %rsi     # 0x830de
movq %rdx, %rdi
callq 0x4520
testl %eax, %eax
je 0x2b0da
leaq 0x58087(%rip), %rsi     # 0x830d9
movq %r15, %rdi
callq 0x4520
testl %eax, %eax
je 0x2b0e8
leaq 0x58068(%rip), %rsi     # 0x830d1
movq %r15, %rdi
callq 0x4520
testl %eax, %eax
je 0x2b0e1
leaq 0x5ba23(%rip), %rsi     # 0x86a9f
movq %r15, %rdi
callq 0x4520
testl %eax, %eax
je 0x2b0e1
pushq $-0x1
popq %rbp
jmp 0x2b0ed
movq %rsi, %r14
pushq $-0x1
popq %rbp
testq %rsi, %rsi
je 0x2b0ed
leaq 0x57b01(%rip), %rsi     # 0x82ba0
movq %r14, %rdi
callq 0x40d0
testq %rax, %rax
jne 0x2b0b7
movq %r14, %rdi
callq 0x41c0
addq %r14, %rax
xorl %r12d, %r12d
movq %rax, %rsi
movb (%rsi), %cl
cmpq %r14, %rsi
jbe 0x2b152
movl %ecx, %edx
andb $-0x2, %dl
cmpb $0x2e, %dl
je 0x2b0fc
decq %rsi
incq %r12
jmp 0x2b0bd
movw $0x62, (%rbx)
jmp 0x2b0eb
movw $0x7a, (%rbx)
jmp 0x2b0eb
movb $0x0, (%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x2e, %cl
jne 0x2b0ed
cmpq $0x3, %r12
je 0x2b125
cmpq $0x4, %r12
jne 0x2b15d
pushq $0x4
popq %r12
cmpb $0x62, 0x1(%rsi)
jne 0x2b168
cmpb $0x67, 0x2(%rsi)
jne 0x2b168
cmpb $0x7a, 0x3(%rsi)
je 0x2b135
jmp 0x2b168
pushq $0x3
popq %r12
cmpb $0x67, 0x1(%rsi)
jne 0x2b168
cmpb $0x7a, 0x2(%rsi)
jne 0x2b168
decq %rsi
movq %rsi, %rdx
movb (%rsi), %cl
decq %rsi
cmpq %r14, %rdx
jbe 0x2b14f
movl %ecx, %edx
andb $-0x2, %dl
cmpb $0x2e, %dl
jne 0x2b138
incq %rsi
cmpb $0x2e, %cl
jne 0x2b0ed
subq %rsi, %rax
movq %rax, %r12
leaq -0xa(%r12), %rax
cmpq $-0x7, %rax
jb 0x2b0ed
incq %rsi
leaq -0x1(%r12), %rdx
leaq 0x7(%rsp), %r15
movq %r15, %rdi
callq 0x43c0
movb $0x0, 0x6(%rsp,%r12)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2b01d
movl %eax, %ebp
jmp 0x2b0ed
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/vcf.h
// Function: bcf_dec_int1
static inline int64_t bcf_dec_int1(const uint8_t *p, int type, uint8_t **q)
{
    if (type == BCF_BT_INT8) {
        *q = (uint8_t*)p + 1;
        return le_to_i8(p);
    } else if (type == BCF_BT_INT16) {
        *q = (uint8_t*)p + 2;
        return le_to_i16(p);
    } else if (type == BCF_BT_INT32) {
        *q = (uint8_t*)p + 4;
        return le_to_i32(p);
    } else if (type == BCF_BT_INT64) {
        *q = (uint8_t*)p + 8;
        return le_to_i64(p);
    } else { // Invalid type.
        return 0;
    }
}

// Assembly:
decl %esi
cmpl $0x3, %esi
ja 0x2b604
leaq 0x5a64f(%rip), %rax     # 0x85c1c
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x1(%rdi), %rax
movq %rax, (%rdx)
movsbq (%rdi), %rax
retq
leaq 0x4(%rdi), %rax
movq %rax, (%rdx)
movslq (%rdi), %rax
retq
leaq 0x8(%rdi), %rax
movq %rax, (%rdx)
movq (%rdi), %rax
retq
leaq 0x2(%rdi), %rax
movq %rax, (%rdx)
movswq (%rdi), %rax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_unpack_info_core1
static inline uint8_t *bcf_unpack_info_core1(uint8_t *ptr, bcf_info_t *info)
{
    uint8_t *ptr_start = ptr;
    int64_t len = 0;
    info->key = bcf_dec_typed_int1(ptr, &ptr);
    len = info->len = bcf_dec_size(ptr, &ptr, &info->type);
    info->vptr = ptr;
    info->vptr_off  = ptr - ptr_start;
    info->vptr_free = 0;
    info->v1.i = 0;
    if (info->len == 1) {
        switch(info->type) {
        case BCF_BT_INT8:
        case BCF_BT_CHAR:
            info->v1.i = *(int8_t*)ptr;
            break;
        case BCF_BT_INT16:
            info->v1.i = le_to_i16(ptr);
            len <<= 1;
            break;
        case BCF_BT_INT32:
            info->v1.i = le_to_i32(ptr);
            len <<= 2;
            break;
        case BCF_BT_FLOAT:
            info->v1.f = le_to_float(ptr);
            len <<= 2;
            break;
        case BCF_BT_INT64:
            info->v1.i = le_to_i64(ptr);
            len <<= 3;
            break;
        }
    } else {
        len <<= bcf_type_shift[info->type];
    }
    ptr += len;

    info->vptr_len = ptr - info->vptr;
    return ptr;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
movq %rsp, %r12
movq %rdi, (%r12)
movq %r12, %rsi
callq 0x2c18d
movl %eax, (%rbx)
movq (%r12), %rdi
leaq 0x4(%rbx), %r14
movq %r12, %rsi
movq %r14, %rdx
callq 0x2855d
movl %eax, %ecx
movl %eax, 0x20(%rbx)
movq (%r12), %rax
movq %rax, 0x10(%rbx)
movl %eax, %edx
subl %r15d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl %edx, 0x1c(%rbx)
andq $0x0, 0x8(%rbx)
cmpl $0x1, %ecx
jne 0x2b685
movl (%r14), %ecx
pushq $0x1
popq %rdx
decl %ecx
cmpl $0x6, %ecx
ja 0x2b6c6
leaq 0x5a5ba(%rip), %rsi     # 0x85c2c
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movsbq (%rax), %rcx
movq %rcx, 0x8(%rbx)
jmp 0x2b6c6
movslq %ecx, %rdx
movslq (%r14), %rcx
leaq 0x83e8e(%rip), %rsi     # 0xaf520
movb (%rcx,%rsi), %cl
shlq %cl, %rdx
jmp 0x2b6c6
movswq (%rax), %rcx
movq %rcx, 0x8(%rbx)
pushq $0x2
jmp 0x2b6c5
movss (%rax), %xmm0
movss %xmm0, 0x8(%rbx)
jmp 0x2b6b8
movslq (%rax), %rcx
movq %rcx, 0x8(%rbx)
pushq $0x4
jmp 0x2b6c5
movq (%rax), %rcx
movq %rcx, 0x8(%rbx)
pushq $0x8
popq %rdx
addq %rdx, %rax
movl %edx, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_fmt_array1
static inline int bcf_fmt_array1(kstring_t *s, int type, void *data) {
    uint32_t e = 0;
    uint8_t *p = (uint8_t *)data;
    int32_t v;

    // helps gcc more than clang here. In billions of cycles:
    //          bcf_fmt_array1  bcf_fmt_array
    // gcc7:    23.2            24.3
    // gcc13:   21.6            23.0
    // clang13: 27.1            27.8
    switch (type) {
    case BCF_BT_CHAR:
        e |= kputc_(*p == bcf_str_missing ? '.' : *p, s) < 0;
        break;

    case BCF_BT_INT8:
        if (*(int8_t *)p != bcf_int8_vector_end) {
            e |= ((*(int8_t *)p == bcf_int8_missing)
                  ? kputc_('.', s)
                  : kputw(*(int8_t *)p, s)) < 0;
        }
        break;
    case BCF_BT_INT16:
        v = le_to_i16(p);
        if (v != bcf_int16_vector_end) {
            e |= (v == bcf_int16_missing
                  ? kputc_('.', s)
                  : kputw(v, s)) < 0;
        }
        break;

    case BCF_BT_INT32:
        v = le_to_i32(p);
        if (v != bcf_int32_vector_end) {
            e |= (v == bcf_int32_missing
                  ? kputc_('.', s)
                  : kputw(v, s)) < 0;
        }
        break;

    case BCF_BT_FLOAT:
        v = le_to_u32(p);
        if (v != bcf_float_vector_end) {
            e |= (v == bcf_float_missing
                  ? kputc_('.', s)
                  : kputd(le_to_float(p), s)) < 0;
        }
        break;

    default:
        hts_log_error("Unexpected type %d", type);
        return -1;
    }

    return e == 0 ? 0 : -1;
}

// Assembly:
movl %esi, %ecx
leal -0x1(%rcx), %eax
cmpl $0x6, %eax
ja 0x2c526
movq %rdi, %rsi
leaq 0x59754(%rip), %rdi     # 0x85c58
movslq (%rdi,%rax,4), %rax
addq %rdi, %rax
jmpq *%rax
movzbl (%rdx), %eax
cmpl $0x81, %eax
je 0x2c576
cmpl $0x80, %eax
je 0x2c592
movsbl %al, %edi
jmp 0x22eac
leaq 0x5b815(%rip), %rsi     # 0x87d42
leaq 0x5a468(%rip), %rdx     # 0x8699c
pushq $0x1
popq %rdi
xorl %eax, %eax
jmp 0x8132
movl (%rdx), %edi
cmpl $0x80000001, %edi       # imm = 0x80000001
je 0x2c576
movl %edi, %eax
negl %eax
jo 0x2c592
jmp 0x22eac
movzwl (%rdx), %eax
cmpl $0x8001, %eax           # imm = 0x8001
je 0x2c576
cmpl $0x8000, %eax           # imm = 0x8000
je 0x2c592
movswl %ax, %edi
jmp 0x22eac
movl (%rdx), %eax
cmpl 0x82fa0(%rip), %eax     # 0xaf514
jne 0x2c58a
retq
movzbl (%rdx), %eax
cmpb $0x7, %al
pushq $0x2e
popq %rcx
cmovnel %eax, %ecx
movzbl %cl, %edi
jmp 0x284c4
cmpl 0x82f80(%rip), %eax     # 0xaf510
jne 0x2c59a
pushq $0x2e
popq %rdi
jmp 0x284c4
movd %eax, %xmm0
cvtss2sd %xmm0, %xmm0
movq %rsi, %rdi
jmp 0x68b28
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: vcf_write_line
int vcf_write_line(htsFile *fp, kstring_t *line)
{
    int ret;
    if ( line->s[line->l-1]!='\n' ) kputc('\n',line);
    if ( fp->format.compression!=no_compression )
        ret = bgzf_write(fp->fp.bgzf, line->s, line->l);
    else
        ret = hwrite(fp->fp.hfile, line->s, line->l);
    return ret==line->l ? 0 : -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
movq 0x10(%rsi), %rcx
cmpb $0xa, -0x1(%rcx,%rax)
je 0x2c5cd
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x25f76
cmpl $0x0, 0x54(%r14)
movq 0x38(%r14), %rdi
movq (%rbx), %rdx
movq 0x10(%rbx), %rsi
je 0x2c5e6
callq 0x6be34
jmp 0x2c5eb
callq 0x27cb0
movslq %eax, %rcx
xorl %eax, %eax
cmpq (%rbx), %rcx
setne %al
negl %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_index
hts_idx_t *bcf_index(htsFile *fp, int min_shift)
{
    int n_lvls;
    bcf1_t *b = NULL;
    hts_idx_t *idx = NULL;
    bcf_hdr_t *h;
    int r;
    h = bcf_hdr_read(fp);
    if ( !h ) return NULL;
    int nids = 0;
    n_lvls = idx_calc_n_lvls_ids(h, min_shift, 0, &nids);
    idx = hts_idx_init(nids, HTS_FMT_CSI, bgzf_tell(fp->fp.bgzf), min_shift, n_lvls);
    if (!idx) goto fail;
    b = bcf_init1();
    if (!b) goto fail;
    while ((r = bcf_read1(fp,h, b)) >= 0) {
        int ret;
        ret = hts_idx_push(idx, b->rid, b->pos, b->pos + b->rlen, bgzf_tell(fp->fp.bgzf), 1);
        if (ret < 0) goto fail;
    }
    if (r < -1) goto fail;
    hts_idx_finish(idx, bgzf_tell(fp->fp.bgzf));
    bcf_destroy1(b);
    bcf_hdr_destroy(h);
    return idx;

 fail:
    hts_idx_destroy(idx);
    bcf_destroy1(b);
    bcf_hdr_destroy(h);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %r12
callq 0x256c6
testq %rax, %rax
je 0x2c6be
movq %rax, %rbx
leaq 0xc(%rsp), %r15
andl $0x0, (%r15)
xorl %r14d, %r14d
movq %rax, %rdi
movl %ebp, %esi
xorl %edx, %edx
movq %r15, %rcx
callq 0x2c71e
movl (%r15), %edi
movq 0x38(%r12), %rcx
movq 0x18(%rcx), %rsi
shlq $0x10, %rsi
movzwl 0x10(%rcx), %edx
orq %rsi, %rdx
xorl %esi, %esi
movl %ebp, %ecx
movl %eax, %r8d
callq 0xa1f3
movq %rax, %r15
testq %rax, %rax
je 0x2c6cd
callq 0x25fbe
testq %rax, %rax
je 0x2c6c3
movq %rax, %r14
pushq $0x1
popq %rbp
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x263ce
testl %eax, %eax
js 0x2c6c8
movl 0x10(%r14), %esi
movq (%r14), %rdx
movq 0x8(%r14), %rcx
addq %rdx, %rcx
movq 0x38(%r12), %rax
movq 0x18(%rax), %rdi
shlq $0x10, %rdi
movzwl 0x10(%rax), %r8d
orq %rdi, %r8
movq %r15, %rdi
movl %ebp, %r9d
callq 0xa97b
testl %eax, %eax
jns 0x2c678
jmp 0x2c6cd
xorl %r15d, %r15d
jmp 0x2c6e8
xorl %r14d, %r14d
jmp 0x2c6cd
cmpl $-0x1, %eax
je 0x2c6f8
movq %r15, %rdi
callq 0x956e
movq %r14, %rdi
callq 0x26150
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x25554
movq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r12), %rax
movq 0x18(%rax), %rcx
shlq $0x10, %rcx
movzwl 0x10(%rax), %esi
orq %rcx, %rsi
movq %r15, %rdi
callq 0xa2d1
movq %r14, %rdi
callq 0x26150
jmp 0x2c6e0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: idx_calc_n_lvls_ids
static int idx_calc_n_lvls_ids(const bcf_hdr_t *h, int min_shift,
                               int starting_n_lvls, int *nids_out)
{
    int n_lvls, i, nids = 0;
    int64_t max_len = 0, s;

    for (i = 0; i < h->n[BCF_DT_CTG]; ++i)
    {
        if ( !h->id[BCF_DT_CTG][i].val ) continue;
        if ( max_len < h->id[BCF_DT_CTG][i].val->info[0] )
            max_len = h->id[BCF_DT_CTG][i].val->info[0];
        nids++;
    }
    if ( !max_len ) max_len = (1LL<<31) - 1;  // In case contig line is broken.
    max_len += 256;
    s = hts_bin_maxpos(min_shift, starting_n_lvls);
    for (n_lvls = starting_n_lvls; max_len > s; ++n_lvls, s <<= 3);

    if (nids_out) *nids_out = nids;
    return n_lvls;
}

// Assembly:
movq %rcx, %r8
movl %edx, %eax
movl 0x4(%rdi), %ecx
xorl %r9d, %r9d
testl %ecx, %ecx
cmovlel %r9d, %ecx
shlq $0x4, %rcx
xorl %edx, %edx
xorl %r10d, %r10d
cmpq %r9, %rcx
je 0x2c75d
movq 0x18(%rdi), %r11
movq 0x8(%r11,%r9), %r11
testq %r11, %r11
je 0x2c757
movq (%r11), %r11
cmpq %r11, %r10
cmovbeq %r11, %r10
incl %edx
addq $0x10, %r9
jmp 0x2c738
leaq 0x100(%r10), %rcx
testq %r10, %r10
movl $0x800000ff, %edi       # imm = 0x800000FF
cmovneq %rcx, %rdi
leal (%rax,%rax,2), %ecx
addl %esi, %ecx
pushq $0x1
popq %rsi
shlq %cl, %rsi
cmpq %rsi, %rdi
jle 0x2c788
incl %eax
shlq $0x3, %rsi
jmp 0x2c77b
testq %r8, %r8
je 0x2c790
movl %edx, (%r8)
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_index_build3
int bcf_index_build3(const char *fn, const char *fnidx, int min_shift, int n_threads)
{
    htsFile *fp;
    hts_idx_t *idx;
    tbx_t *tbx;
    int ret;
    if ((fp = hts_open(fn, "rb")) == 0) return -2;
    if (n_threads)
        hts_set_threads(fp, n_threads);
    if ( fp->format.compression!=bgzf ) { hts_close(fp); return -3; }
    switch (fp->format.format) {
        case bcf:
            if (!min_shift) {
                hts_log_error("TBI indices for BCF files are not supported");
                ret = -1;
            } else {
                idx = bcf_index(fp, min_shift);
                if (idx) {
                    ret = hts_idx_save_as(idx, fn, fnidx, HTS_FMT_CSI);
                    if (ret < 0) ret = -4;
                    hts_idx_destroy(idx);
                }
                else ret = -1;
            }
            break;

        case vcf:
            tbx = tbx_index(hts_get_bgzfp(fp), min_shift, &tbx_conf_vcf);
            if (tbx) {
                ret = hts_idx_save_as(tbx->idx, fn, fnidx, min_shift > 0 ? HTS_FMT_CSI : HTS_FMT_TBI);
                if (ret < 0) ret = -4;
                tbx_destroy(tbx);
            }
            else ret = -1;
            break;

        default:
            ret = -3;
            break;
    }
    hts_close(fp);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r12d
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x5a43a(%rip), %rsi     # 0x86c02
callq 0x8233
testq %rax, %rax
je 0x2c846
movq %rax, %rbx
testl %r12d, %r12d
je 0x2c7e5
movq %rbx, %rdi
movl %r12d, %esi
callq 0x96d4
pushq $-0x3
popq %r12
cmpl $0x2, 0x54(%rbx)
jne 0x2c8b5
movl 0x4c(%rbx), %eax
cmpl $0x8, %eax
je 0x2c84c
cmpl $0x9, %eax
jne 0x2c8b5
testl %ebp, %ebp
je 0x2c899
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2c600
testq %rax, %rax
je 0x2c8b1
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xaf47
testl %eax, %eax
pushq $-0x4
popq %r12
cmovnsl %eax, %r12d
movq %r13, %rdi
callq 0x956e
jmp 0x2c8b5
pushq $-0x2
popq %r12
jmp 0x2c8bd
movq %rbx, %rdi
callq 0x97c0
leaq 0x65215(%rip), %rdx     # 0x91a70
movq %rax, %rdi
movl %ebp, %esi
callq 0x77ca7
testq %rax, %rax
je 0x2c8b1
movq %rax, %r13
movq 0x18(%rax), %rdi
xorl %ecx, %ecx
testl %ebp, %ebp
setle %cl
addl %ecx, %ecx
movq %r15, %rsi
movq %r14, %rdx
callq 0xaf47
testl %eax, %eax
pushq $-0x4
popq %r12
cmovnsl %eax, %r12d
movq %r13, %rdi
callq 0x780f1
jmp 0x2c8b5
leaq 0x5a365(%rip), %rsi     # 0x86c05
leaq 0x5a36f(%rip), %rdx     # 0x86c16
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x8132
pushq $-0x1
popq %r12
movq %rbx, %rdi
callq 0x9409
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq