LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_idx_init
int bcf_idx_init(htsFile *fp, bcf_hdr_t *h, int min_shift, const char *fnidx) {
    int n_lvls, nids = 0;

    if (fp->format.compression != bgzf) {
        hts_log_error("Indexing is only supported on BGZF-compressed files");
        return -3; // Matches no-compression return for bcf_index_build3()
    }

    if (fp->format.format == vcf)
        return vcf_idx_init(fp, h, min_shift, fnidx);

    if (!min_shift)
        min_shift = 14;

    n_lvls = idx_calc_n_lvls_ids(h, min_shift, 0, &nids);

    fp->idx = hts_idx_init(nids, HTS_FMT_CSI, bgzf_tell(fp->fp.bgzf), min_shift, n_lvls);
    if (!fp->idx) return -1;
    fp->fnidx = fnidx;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
andl $0x0, 0xc(%rsp)
cmpl $0x2, 0x54(%rdi)
jne 0x2c932
movq %rcx, %r14
movl %edx, %ebp
movq %rdi, %rbx
cmpl $0x8, 0x4c(%rdi)
jne 0x2c952
testl %ebp, %ebp
je 0x2c9a9
pushq $0x21
popq %rax
subl %ebp, %eax
pushq $0x3
popq %rcx
cltd
idivl %ecx
xorl %r15d, %r15d
movq %rsi, %rdi
movl %ebp, %esi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x2c71e
movl %eax, %r8d
jmp 0x2c9b4
leaq 0x5a309(%rip), %rsi     # 0x86c42
leaq 0x5a30f(%rip), %rdx     # 0x86c4f
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x8132
pushq $-0x3
popq %rbp
jmp 0x2ca29
testl %ebp, %ebp
pushq $0xe
popq %r15
cmovnel %ebp, %r15d
xorl %ebp, %ebp
leaq 0xc(%rsp), %r12
movq %rsi, %rdi
movl %r15d, %esi
xorl %edx, %edx
movq %r12, %rcx
callq 0x2c71e
movl (%r12), %edi
movq 0x38(%rbx), %rcx
movq 0x18(%rcx), %rsi
shlq $0x10, %rsi
movzwl 0x10(%rcx), %edx
orq %rsi, %rdx
xorl %esi, %esi
movl %r15d, %ecx
movl %eax, %r8d
callq 0xa1f3
movq %rax, 0x68(%rbx)
testq %rax, %rax
je 0x2ca14
movq %r14, 0x70(%rbx)
jmp 0x2ca29
pushq $0x2
popq %r15
pushq $0x5
popq %r8
pushq $0xe
popq %rbp
movq 0x38(%rbx), %rax
movq 0x18(%rax), %rcx
shlq $0x10, %rcx
movzwl 0x10(%rax), %edx
orq %rcx, %rdx
xorl %edi, %edi
movl %r15d, %esi
movl %ebp, %ecx
callq 0xa1f3
movq %rax, 0x68(%rbx)
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x2ca29
movaps 0x591da(%rip), %xmm0    # 0x85bc0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x23, 0x10(%rdx)
andl $0x0, 0x18(%rdx)
pushq $0x1c
popq %rsi
pushq $0x1
popq %rcx
movq %rax, %rdi
callq 0xb35e
testl %eax, %eax
js 0x2ca1b
movq %r14, 0x70(%rbx)
xorl %ebp, %ebp
jmp 0x2ca29
pushq $-0x1
jmp 0x2c94c
movq 0x68(%rbx), %rdi
callq 0x956e
andq $0x0, 0x68(%rbx)
movl %ebp, %eax
addq $0x30, %rsp
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_hdr_dup
bcf_hdr_t *bcf_hdr_dup(const bcf_hdr_t *hdr)
{
    bcf_hdr_t *hout = bcf_hdr_init("r");
    if (!hout) {
        hts_log_error("Failed to allocate bcf header");
        return NULL;
    }
    kstring_t htxt = {0,0,0};
    if (bcf_hdr_format(hdr, 1, &htxt) < 0) {
        free(htxt.s);
        return NULL;
    }
    if ( bcf_hdr_parse(hout, htxt.s) < 0 ) {
        bcf_hdr_destroy(hout);
        hout = NULL;
    }
    free(htxt.s);
    return hout;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
leaq 0x57c5b(%rip), %rdi     # 0x851a5
callq 0x250c7
testq %rax, %rax
je 0x2d599
movq %rax, %rbx
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
pushq $0x1
popq %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x25ea7
movq 0x10(%r15), %rsi
testl %eax, %eax
js 0x2d5b5
movq %rbx, %rdi
callq 0x248c9
testl %eax, %eax
jns 0x2d592
movq %rbx, %rdi
callq 0x25554
xorl %ebx, %ebx
movq 0x10(%rsp), %rsi
jmp 0x2d5b7
leaq 0x59822(%rip), %rsi     # 0x86dc2
leaq 0x59164(%rip), %rdx     # 0x8670b
xorl %ebx, %ebx
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x8132
jmp 0x2d5bf
xorl %ebx, %ebx
movq %rsi, %rdi
callq 0x45c0
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_subset
int bcf_subset(const bcf_hdr_t *h, bcf1_t *v, int n, int *imap)
{
    kstring_t ind;
    ind.s = 0; ind.l = ind.m = 0;
    if (n) {
        bcf_fmt_t fmt[MAX_N_FMT];
        int i, j;
        uint8_t *ptr = (uint8_t*)v->indiv.s;
        for (i = 0; i < v->n_fmt; ++i)
            ptr = bcf_unpack_fmt_core1(ptr, v->n_sample, &fmt[i]);
        for (i = 0; i < (int)v->n_fmt; ++i) {
            bcf_fmt_t *f = &fmt[i];
            bcf_enc_int1(&ind, f->id);
            bcf_enc_size(&ind, f->n, f->type);
            for (j = 0; j < n; ++j)
                if (imap[j] >= 0) kputsn((char*)(f->p + imap[j] * f->size), f->size, &ind);
        }
        for (i = j = 0; j < n; ++j) if (imap[j] >= 0) ++i;
        v->n_sample = i;
    } else v->n_sample = 0;
    if ( !v->n_sample ) v->n_fmt = 0;
    free(v->indiv.s);
    v->indiv = ind;
    v->unpacked &= ~BCF_UN_FMT;    // only BCF is ready for output, VCF will need to unpack again
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2018, %rsp           # imm = 0x2018
andq $0x0, 0x20(%rsp)
movq %rsi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
testl %edx, %edx
je 0x2e344
movq %rcx, %r14
movl %edx, %r15d
movq 0x48(%rbx), %rax
leaq 0x30(%rsp), %r12
xorl %r13d, %r13d
movq 0x18(%rbx), %rsi
movq %rsi, %rcx
shrq $0x20, %rcx
movzbl %cl, %ecx
cmpq %rcx, %r13
jae 0x2e285
shrq $0x28, %rsi
movq %rax, %rdi
movq %r12, %rdx
callq 0x2635c
incq %r13
addq $0x20, %r12
jmp 0x2e25a
xorl %r13d, %r13d
testl %r15d, %r15d
cmovlel %r13d, %r15d
leaq 0x10(%rsp), %r12
movq %rbx, 0x8(%rsp)
movq %rsi, %rax
shrq $0x20, %rax
movzbl %al, %eax
cmpq %rax, %r13
jae 0x2e307
movq %r13, %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rbp
addq $0x30, %rbp
movl (%rbp), %esi
movq %r12, %rdi
callq 0x28086
movl 0x4(%rbp), %esi
movl 0xc(%rbp), %edx
movq %r12, %rdi
callq 0x27feb
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0x2e2f9
movslq (%r14,%rbx,4), %rdi
testq %rdi, %rdi
js 0x2e2f4
movslq 0x8(%rbp), %rsi
imulq %rsi, %rdi
addq 0x10(%rbp), %rdi
movq %r12, %rdx
callq 0x2787b
incq %rbx
jmp 0x2e2d2
incq %r13
movq 0x8(%rsp), %rbx
movq 0x18(%rbx), %rsi
jmp 0x2e299
xorl %ecx, %ecx
xorl %eax, %eax
cmpq %rcx, %r15
je 0x2e320
movl (%r14,%rcx,4), %edx
notl %edx
shrl $0x1f, %edx
addl %edx, %eax
incq %rcx
jmp 0x2e30b
movq %rax, %rcx
shlq $0x28, %rcx
movabsq $0xffffffffff, %rdx     # imm = 0xFFFFFFFFFF
andq %rdx, %rsi
orq %rcx, %rsi
movq %rsi, 0x18(%rbx)
testl $0xffffff, %eax         # imm = 0xFFFFFF
jne 0x2e358
jmp 0x2e352
movabsq $0xffffffffff, %rsi     # imm = 0xFFFFFFFFFF
andq 0x18(%rbx), %rsi
movl %esi, %eax
movq %rax, 0x18(%rbx)
movq 0x48(%rbx), %rdi
callq 0x45c0
movq 0x20(%rsp), %rax
movq %rax, 0x48(%rbx)
movaps 0x10(%rsp), %xmm0
movups %xmm0, 0x38(%rbx)
andb $-0x9, 0xbc(%rbx)
xorl %eax, %eax
addq $0x2018, %rsp           # imm = 0x2018
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_is_snp
int bcf_is_snp(bcf1_t *v)
{
    int i;
    bcf_unpack(v, BCF_UN_STR);
    for (i = 0; i < v->n_allele; ++i)
    {
        if ( v->d.allele[i][1]==0 && v->d.allele[i][0]!='*' ) continue;

        // mpileup's <X> allele, see also below. This is not completely satisfactory,
        // a general library is here narrowly tailored to fit samtools.
        if ( v->d.allele[i][0]=='<' && v->d.allele[i][1]=='X' && v->d.allele[i][2]=='>' ) continue;
        if ( v->d.allele[i][0]=='<' && v->d.allele[i][1]=='*' && v->d.allele[i][2]=='>' ) continue;

        break;
    }
    return i == v->n_allele;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x1
popq %rsi
callq 0x2b198
movl 0x18(%rbx), %ecx
shrl $0x10, %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x2e3e0
movq 0x88(%rbx), %rax
movq (%rax,%rdx,8), %rax
movzbl 0x1(%rax), %esi
movb (%rax), %dil
testl %esi, %esi
je 0x2e3d5
cmpb $0x3c, %dil
jne 0x2e3e2
cmpl $0x2a, %esi
je 0x2e3cd
cmpl $0x58, %esi
jne 0x2e3e2
cmpb $0x3e, 0x2(%rax)
je 0x2e3db
jmp 0x2e3e2
cmpb $0x2a, %dil
je 0x2e3e2
incq %rdx
jmp 0x2e3a2
movl %ecx, %edx
xorl %eax, %eax
cmpl %ecx, %edx
sete %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_get_variant_types
int bcf_get_variant_types(bcf1_t *rec)
{
    if ( rec->d.var_type==-1 ) {
        if (bcf_set_variant_types(rec) != 0) {
            hts_log_error("Couldn't get variant types: %s", strerror(errno));
            exit(1); // Due to legacy API having no way to report failures
        }
    }
    return rec->d.var_type & ORIG_VAR_TYPES;
}

// Assembly:
pushq %rbx
movl 0xac(%rdi), %eax
cmpl $-0x1, %eax
jne 0x2e409
movq %rdi, %rbx
callq 0x2e43e
testl %eax, %eax
jne 0x2e40e
movl 0xac(%rbx), %eax
andl $0x3f, %eax
popq %rbx
retq
callq 0x4050
movl (%rax), %edi
callq 0x4140
leaq 0x58a71(%rip), %rsi     # 0x86e92
leaq 0x58a80(%rip), %rdx     # 0x86ea8
pushq $0x1
popq %rbx
movl %ebx, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0x8132
movl %ebx, %edi
callq 0x45f0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_get_variant_type
int bcf_get_variant_type(bcf1_t *rec, int ith_allele)
{
    if ( rec->d.var_type==-1 ) {
        if (bcf_set_variant_types(rec) != 0) {
            hts_log_error("Couldn't get variant types: %s", strerror(errno));
            exit(1); // Due to legacy API having no way to report failures
        }
    }
    if (ith_allele < 0 || ith_allele >= rec->n_allele) {
        hts_log_error("Requested allele outside valid range");
        exit(1);
    }
    return rec->d.var[ith_allele].type & ORIG_VAR_TYPES;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
cmpl $-0x1, 0xac(%rdi)
jne 0x2e8a4
movq %r14, %rdi
callq 0x2e43e
testl %eax, %eax
jne 0x2e8e9
testl %ebx, %ebx
js 0x2e8c8
movzwl 0x1a(%r14), %eax
cmpl %ebx, %eax
jbe 0x2e8c8
movq 0xa0(%r14), %rax
movl %ebx, %ecx
movl (%rax,%rcx,8), %eax
andl $0x3f, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x585f8(%rip), %rsi     # 0x86ec7
leaq 0x58606(%rip), %rdx     # 0x86edc
pushq $0x1
popq %rbx
movl %ebx, %edi
xorl %eax, %eax
callq 0x8132
movl %ebx, %edi
callq 0x45f0
callq 0x4050
movl (%rax), %edi
callq 0x4140
leaq 0x585cb(%rip), %rsi     # 0x86ec7
leaq 0x585a5(%rip), %rdx     # 0x86ea8
pushq $0x1
popq %rbx
movl %ebx, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0x8132
jmp 0x2e8e2
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_has_variant_type
int bcf_has_variant_type(bcf1_t *rec, int ith_allele, uint32_t bitmask)
{
    if ( rec->d.var_type==-1 ) {
        if (bcf_set_variant_types(rec) != 0) return -1;
    }
    if (ith_allele < 0 || ith_allele >= rec->n_allele) return -1;
    if (bitmask == VCF_REF) {  // VCF_REF is 0, so handled as a special case
        return rec->d.var[ith_allele].type == VCF_REF;
    }
    return bitmask & rec->d.var[ith_allele].type;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
cmpl $-0x1, 0xac(%rdi)
pushq $-0x1
popq %rbx
je 0x2e936
testl %r14d, %r14d
jns 0x2e947
jmp 0x2e96f
movq %r15, %rdi
callq 0x2e43e
testl %r14d, %r14d
js 0x2e96f
testl %eax, %eax
jne 0x2e96f
movzwl 0x1a(%r15), %eax
cmpl %r14d, %eax
jbe 0x2e96f
movq 0xa0(%r15), %rax
movl %r14d, %ecx
movl (%rax,%rcx,8), %eax
testl %ebp, %ebp
je 0x2e968
andl %ebp, %eax
movl %eax, %ebx
jmp 0x2e96f
xorl %ebx, %ebx
testl %eax, %eax
sete %bl
movl %ebx, %eax
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_variant_length
int bcf_variant_length(bcf1_t *rec, int ith_allele)
{
    if ( rec->d.var_type==-1 ) {
        if (bcf_set_variant_types(rec) != 0) return bcf_int32_missing;
    }
    if (ith_allele < 0 || ith_allele >= rec->n_allele) return bcf_int32_missing;
    return rec->d.var[ith_allele].n;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
cmpl $-0x1, 0xac(%rdi)
je 0x2e999
testl %ebx, %ebx
jns 0x2e9b0
movl $0x80000000, %eax       # imm = 0x80000000
jmp 0x2e9cb
movq %r14, %rdi
callq 0x2e43e
movl %eax, %ecx
movl $0x80000000, %eax       # imm = 0x80000000
testl %ebx, %ebx
js 0x2e9cb
testl %ecx, %ecx
jne 0x2e9cb
movzwl 0x1a(%r14), %ecx
movl $0x80000000, %eax       # imm = 0x80000000
cmpl %ebx, %ecx
jbe 0x2e9cb
movq 0xa0(%r14), %rax
movl %ebx, %ecx
movl 0x4(%rax,%rcx,8), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_has_variant_types
int bcf_has_variant_types(bcf1_t *rec, uint32_t bitmask,
                          enum bcf_variant_match mode)
{
    if ( rec->d.var_type==-1 ) {
        if (bcf_set_variant_types(rec) != 0) return -1;
    }
    uint32_t type = rec->d.var_type;
    if ( mode==bcf_match_overlap ) return bitmask & type;

    // VCF_INDEL is always set with VCF_INS and VCF_DEL by bcf_set_variant_type[s], but the bitmask may
    // ask for say `VCF_INS` or `VCF_INDEL` only
    if ( bitmask&(VCF_INS|VCF_DEL) && !(bitmask&VCF_INDEL) ) type &= ~VCF_INDEL;
    else if ( bitmask&VCF_INDEL && !(bitmask&(VCF_INS|VCF_DEL)) ) type &= ~(VCF_INS|VCF_DEL);

    if ( mode==bcf_match_subset )
    {
        if ( ~bitmask & type ) return 0;
        else return bitmask & type;
    }
    // mode == bcf_match_exact
    if ( bitmask==VCF_REF ) return type==bitmask ? 1 : 0;
    return type==bitmask ? type : 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movl %esi, %ebx
movl 0xac(%rdi), %eax
cmpl $-0x1, %eax
je 0x2ea06
cmpl $0x1, %ebp
jne 0x2e9ef
andl %ebx, %eax
jmp 0x2ea5d
testb $-0x40, %bl
sete %cl
movl %ebx, %edx
andl $0x4, %edx
shrl $0x2, %edx
orb %cl, %dl
jne 0x2ea17
andl $-0x5, %eax
jmp 0x2ea2a
movq %rdi, %r14
callq 0x2e43e
testl %eax, %eax
je 0x2ea4d
pushq $-0x1
popq %rax
jmp 0x2ea5d
testb $0x4, %bl
je 0x2ea2a
movl %eax, %ecx
andl $0xffffff3f, %ecx       # imm = 0xFFFFFF3F
testb $-0x40, %bl
cmovel %ecx, %eax
cmpl $0x2, %ebp
jne 0x2ea40
movl %eax, %ecx
andl %ebx, %ecx
notl %ebx
xorl %edx, %edx
testl %ebx, %eax
cmovel %ecx, %edx
movl %edx, %eax
jmp 0x2ea5d
xorl %ecx, %ecx
testl %ebx, %ebx
je 0x2ea56
cmpl %ebx, %eax
cmovnel %ecx, %eax
jmp 0x2ea5d
movl 0xac(%r14), %eax
jmp 0x2e9e6
testl %eax, %eax
sete %cl
movl %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_update_format_string
int bcf_update_format_string(const bcf_hdr_t *hdr, bcf1_t *line, const char *key, const char **values, int n)
{
    if ( !n )
        return bcf_update_format(hdr,line,key,NULL,0,BCF_HT_STR);

    int i, max_len = 0;
    for (i=0; i<n; i++)
    {
        int len = strlen(values[i]);
        if ( len > max_len ) max_len = len;
    }
    char *out = (char*) malloc(max_len*n);
    if ( !out ) return -2;
    for (i=0; i<n; i++)
    {
        char *dst = out+i*max_len;
        const char *src = values[i];
        int j = 0;
        while ( src[j] ) { dst[j] = src[j]; j++; }
        for (; j<max_len; j++) dst[j] = 0;
    }
    int ret = bcf_update_format(hdr,line,key,out,max_len*n,BCF_HT_STR);
    free(out);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
testl %r8d, %r8d
je 0x2f05b
movl %r8d, %ebp
movq %rcx, %r12
movq %rsi, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
xorl %r13d, %r13d
testl %r8d, %r8d
movl $0x0, %ebx
cmovgl %r8d, %ebx
xorl %r14d, %r14d
cmpq %r13, %rbx
je 0x2efca
movq (%r12,%r13,8), %rdi
callq 0x41c0
cmpl %eax, %r14d
cmovgl %r14d, %eax
incq %r13
movl %eax, %r14d
jmp 0x2efad
imull %r14d, %ebp
movslq %ebp, %rdi
callq 0x46a0
testq %rax, %rax
je 0x2f07a
movq %rax, %r13
movl %r14d, %eax
xorl %ecx, %ecx
movq %r13, %rdx
cmpq %rbx, %rcx
je 0x2f031
movq (%r12,%rcx,8), %r9
xorl %esi, %esi
movq %rdx, %rdi
xorl %r8d, %r8d
movb (%r9,%r8), %r10b
testb %r10b, %r10b
je 0x2f012
movb %r10b, (%rdx,%r8)
incq %r8
incl %esi
incq %rdi
jmp 0x2effb
cmpl %esi, %r14d
cmovgl %r14d, %esi
cmpq %rsi, %r8
je 0x2f029
movb $0x0, (%rdi)
decq %rsi
incq %rdi
jmp 0x2f019
incq %rcx
addq %rax, %rdx
jmp 0x2efea
pushq $0x3
popq %r9
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rcx
movl %ebp, %r8d
callq 0x2f08c
movl %eax, %ebx
movq %r13, %rdi
callq 0x45c0
movl %ebx, %eax
jmp 0x2f07d
pushq $0x3
popq %r9
movq %r15, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2f08c
pushq $-0x2
popq %rax
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_update_filter
int bcf_update_filter(const bcf_hdr_t *hdr, bcf1_t *line, int *flt_ids, int n)
{
    if ( !(line->unpacked & BCF_UN_FLT) ) bcf_unpack(line, BCF_UN_FLT);
    line->d.shared_dirty |= BCF1_DIRTY_FLT;
    line->d.n_flt = n;
    if ( !n ) return 0;
    hts_expand(int, line->d.n_flt, line->d.m_flt, line->d.flt);
    int i;
    for (i=0; i<n; i++)
        line->d.flt[i] = flt_ids[i];
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
testb $0x2, 0xbc(%rsi)
jne 0x2f5e4
pushq $0x2
popq %rsi
movq %r15, %rdi
callq 0x2b198
orb $0x4, 0xb0(%r15)
movl %ebx, 0x68(%r15)
testl %ebx, %ebx
je 0x2f642
movslq 0x64(%r15), %rsi
cmpl %ebx, %esi
jge 0x2f626
cmpl $0x2, %ebx
pushq $0x1
popq %rdi
cmovgel %ebx, %edi
leaq 0x70(%r15), %r9
leaq 0x57a54(%rip), %rax     # 0x87064
movq %rax, (%rsp)
pushq $0x4
popq %rcx
movq %rcx, %rdx
xorl %r8d, %r8d
callq 0xef4f
movl %eax, 0x64(%r15)
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %ebx
cmpq %rax, %rbx
je 0x2f642
movl (%r14,%rax,4), %ecx
movq 0x70(%r15), %rdx
movl %ecx, (%rdx,%rax,4)
incq %rax
jmp 0x2f62d
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_add_filter
int bcf_add_filter(const bcf_hdr_t *hdr, bcf1_t *line, int flt_id)
{
    if ( !(line->unpacked & BCF_UN_FLT) ) bcf_unpack(line, BCF_UN_FLT);
    int i;
    for (i=0; i<line->d.n_flt; i++)
        if ( flt_id==line->d.flt[i] ) break;
    if ( i<line->d.n_flt ) return 0;    // this filter is already set
    line->d.shared_dirty |= BCF1_DIRTY_FLT;
    if ( flt_id==0 )    // set to PASS
        line->d.n_flt = 1;
    else if ( line->d.n_flt==1 && line->d.flt[0]==0 )
        line->d.n_flt = 1;
    else
        line->d.n_flt++;
    hts_expand(int, line->d.n_flt, line->d.m_flt, line->d.flt);
    line->d.flt[line->d.n_flt-1] = flt_id;
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
movq %rsi, %r14
testb $0x2, 0xbc(%rsi)
jne 0x2f670
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x2b198
movl 0x68(%r14), %eax
leaq 0x70(%r14), %r15
xorl %ecx, %ecx
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
cmpq %rcx, %rdx
je 0x2f69c
movq (%r15), %rsi
leaq 0x1(%rcx), %rdi
cmpl %ebx, (%rsi,%rcx,4)
movq %rdi, %rcx
jne 0x2f684
xorl %eax, %eax
jmp 0x2f702
orb $0x4, 0xb0(%r14)
pushq $0x1
popq %rcx
testl %ebx, %ebx
je 0x2f6bc
cmpl $0x1, %eax
jne 0x2f6b8
movq (%r15), %rdx
cmpl $0x0, (%rdx)
je 0x2f6bc
incl %eax
movl %eax, %ecx
movl %ecx, 0x68(%r14)
movslq 0x64(%r14), %rsi
cmpl %esi, %ecx
jle 0x2f6f5
cmpl $0x2, %ecx
pushq $0x1
popq %rdi
cmovgel %ecx, %edi
leaq 0x5799e(%rip), %rax     # 0x87076
movq %rax, (%rsp)
pushq $0x4
popq %rcx
movq %rcx, %rdx
xorl %r8d, %r8d
movq %r15, %r9
callq 0xef4f
movl %eax, 0x64(%r14)
movl 0x68(%r14), %ecx
movq (%r15), %rax
movslq %ecx, %rcx
movl %ebx, -0x4(%rax,%rcx,4)
pushq $0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_remove_filter
int bcf_remove_filter(const bcf_hdr_t *hdr, bcf1_t *line, int flt_id, int pass)
{
    if ( !(line->unpacked & BCF_UN_FLT) ) bcf_unpack(line, BCF_UN_FLT);
    int i;
    for (i=0; i<line->d.n_flt; i++)
        if ( flt_id==line->d.flt[i] ) break;
    if ( i==line->d.n_flt ) return 0;   // the filter is not present
    line->d.shared_dirty |= BCF1_DIRTY_FLT;
    if ( i!=line->d.n_flt-1 ) memmove(line->d.flt+i,line->d.flt+i+1,(line->d.n_flt-i-1)*sizeof(*line->d.flt));
    line->d.n_flt--;
    if ( !line->d.n_flt && pass ) bcf_add_filter(hdr,line,0);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %rbx
testb $0x2, 0xbc(%rsi)
jne 0x2f72c
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x2b198
movl 0x68(%rbx), %eax
xorl %edx, %edx
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
cmpq %rdx, %rcx
je 0x2f751
movq 0x70(%rbx), %rsi
cmpl %r14d, (%rsi,%rdx,4)
je 0x2f74f
incq %rdx
jmp 0x2f73b
movl %edx, %ecx
cmpl %eax, %ecx
je 0x2f7a3
orb $0x4, 0xb0(%rbx)
leal -0x1(%rax), %edx
cmpl %edx, %ecx
je 0x2f788
movq 0x70(%rbx), %rdx
movl %ecx, %esi
leaq (%rdx,%rsi,4), %rdi
leaq (%rdx,%rsi,4), %rsi
addq $0x4, %rsi
notl %ecx
addl %ecx, %eax
movslq %eax, %rdx
shlq $0x2, %rdx
callq 0x4850
movl 0x68(%rbx), %eax
decl %eax
movl %eax, 0x68(%rbx)
setne %al
testl %ebp, %ebp
sete %cl
orb %al, %cl
jne 0x2f7a3
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2f64e
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_has_filter
int bcf_has_filter(const bcf_hdr_t *hdr, bcf1_t *line, char *filter)
{
    if ( filter[0]=='.' && !filter[1] ) filter = "PASS";
    int id = bcf_hdr_id2int(hdr, BCF_DT_ID, filter);
    if ( !bcf_hdr_idinfo_exists(hdr,BCF_HL_FLT,id) ) return -1;  // not defined in the header

    if ( !(line->unpacked & BCF_UN_FLT) ) bcf_unpack(line, BCF_UN_FLT);
    if ( id==0 && !line->d.n_flt) return 1; // PASS

    int i;
    for (i=0; i<line->d.n_flt; i++)
        if ( line->d.flt[i]==id ) return 1;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x2e, (%rdx)
jne 0x2f7c8
cmpb $0x0, 0x1(%rdx)
leaq 0x578c1(%rip), %rax     # 0x87085
cmoveq %rax, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2489c
movl %eax, %ebp
pushq $-0x1
popq %rax
testl %ebp, %ebp
js 0x2f83d
cmpl (%r14), %ebp
jge 0x2f83d
movq 0x10(%r14), %rcx
movl %ebp, %edx
shlq $0x4, %rdx
movq 0x8(%rcx,%rdx), %rcx
testq %rcx, %rcx
je 0x2f83d
movl (%rcx), %ecx
notl %ecx
testb $0xf, %cl
je 0x2f83d
testb $0x2, 0xbc(%rbx)
jne 0x2f811
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x2b198
movl 0x68(%rbx), %ecx
pushq $0x1
popq %rax
movl %ebp, %edx
orl %ecx, %edx
je 0x2f83d
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpq %rdx, %rcx
je 0x2f83b
movq 0x70(%rbx), %rsi
leaq 0x1(%rdx), %rdi
cmpl %ebp, (%rsi,%rdx,4)
movq %rdi, %rdx
jne 0x2f824
jmp 0x2f83d
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf1_sync_alleles
static inline int _bcf1_sync_alleles(const bcf_hdr_t *hdr, bcf1_t *line, int nals)
{
    line->d.shared_dirty |= BCF1_DIRTY_ALS;
    line->d.var_type = -1;

    line->n_allele = nals;
    hts_expand(char*, line->n_allele, line->d.m_allele, line->d.allele);

    char *als = line->d.als;
    int n = 0;
    while (n<nals)
    {
        line->d.allele[n] = als;
        while ( *als ) als++;
        als++;
        n++;
    }
    // Update REF length. Note that END is 1-based while line->pos 0-based
    line->rlen = get_rlen(hdr, line);

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movq %rsi, %rbx
orb $0x2, 0xb0(%rsi)
movq %rdi, %r15
orl $-0x1, 0xac(%rsi)
movw %r14w, 0x1a(%rsi)
movzwl %r14w, %edi
movslq 0x60(%rsi), %rsi
cmpl %esi, %edi
jle 0x2faa5
cmpl $0x1, %edi
adcl $0x0, %edi
leaq 0x88(%rbx), %r9
leaq 0x582ca(%rip), %rax     # 0x87d5a
movq %rax, (%rsp)
pushq $0x4
popq %rdx
pushq $0x8
popq %rcx
xorl %r8d, %r8d
callq 0xef4f
movl %eax, 0x60(%rbx)
movq 0x80(%rbx), %rcx
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
cmpq %r14, %rax
je 0x2fad3
movq 0x88(%rbx), %rdx
movq %rcx, (%rdx,%rax,8)
cmpb $0x0, (%rcx)
leaq 0x1(%rcx), %rcx
jne 0x2fac5
incq %rax
jmp 0x2fab5
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2a765
movq %rax, 0x8(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_update_alleles_str
int bcf_update_alleles_str(const bcf_hdr_t *hdr, bcf1_t *line, const char *alleles_string)
{
    if ( !(line->unpacked & BCF_UN_STR) ) bcf_unpack(line, BCF_UN_STR);
    kstring_t tmp;
    tmp.l = 0; tmp.s = line->d.als; tmp.m = line->d.m_als;
    kputs(alleles_string, &tmp);
    line->d.als = tmp.s; line->d.m_als = tmp.m;

    int nals = 1;
    char *t = line->d.als;
    while (*t)
    {
        if ( *t==',' ) { *t = 0; nals++; }
        t++;
    }
    return _bcf1_sync_alleles(hdr, line, nals);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
testb $0x1, 0xbc(%rsi)
jne 0x2fb14
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x2b198
movq %rsp, %r12
andq $0x0, (%r12)
movq 0x80(%rbx), %rax
movq %rax, 0x10(%r12)
movslq 0x5c(%rbx), %rax
movq %rax, 0x8(%r12)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2783f
movq 0x10(%r12), %rax
movq %rax, 0x80(%rbx)
movl 0x8(%r12), %ecx
movl %ecx, 0x5c(%rbx)
pushq $0x1
popq %rdx
movzbl (%rax), %ecx
cmpl $0x2c, %ecx
je 0x2fb61
testl %ecx, %ecx
jne 0x2fb66
jmp 0x2fb6b
movb $0x0, (%rax)
incl %edx
incq %rax
jmp 0x2fb53
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2fa4b
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_update_id
int bcf_update_id(const bcf_hdr_t *hdr, bcf1_t *line, const char *id)
{
    if ( !(line->unpacked & BCF_UN_STR) ) bcf_unpack(line, BCF_UN_STR);
    kstring_t tmp;
    tmp.l = 0; tmp.s = line->d.id; tmp.m = line->d.m_id;
    if ( id )
        kputs(id, &tmp);
    else
        kputs(".", &tmp);
    line->d.id = tmp.s; line->d.m_id = tmp.m;
    line->d.shared_dirty |= BCF1_DIRTY_ID;
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r14
movq %rsi, %rbx
testb $0x1, 0xbc(%rsi)
jne 0x2fba7
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x2b198
leaq 0x8(%rsp), %r15
andq $0x0, (%r15)
movq 0x78(%rbx), %rax
movq %rax, 0x10(%r15)
movslq 0x58(%rbx), %rax
movq %rax, 0x8(%r15)
testq %r14, %r14
leaq 0x57001(%rip), %rdi     # 0x86bcb
cmovneq %r14, %rdi
movq %r15, %rsi
callq 0x2783f
movq 0x10(%r15), %rax
movq %rax, 0x78(%rbx)
movl 0x8(%r15), %eax
movl %eax, 0x58(%rbx)
orb $0x1, 0xb0(%rbx)
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_add_id
int bcf_add_id(const bcf_hdr_t *hdr, bcf1_t *line, const char *id)
{
    if ( !id ) return 0;
    if ( !(line->unpacked & BCF_UN_STR) ) bcf_unpack(line, BCF_UN_STR);

    kstring_t tmp;
    tmp.l = 0; tmp.s = line->d.id; tmp.m = line->d.m_id;

    int len = strlen(id);
    char *dst = line->d.id;
    while ( *dst && (dst=strstr(dst,id)) )
    {
        if ( dst[len]!=0 && dst[len]!=';' ) dst++;              // a prefix, not a match
        else if ( dst==line->d.id || dst[-1]==';' ) return 0;   // already present
        dst++;  // a suffix, not a match
    }
    if ( line->d.id && (line->d.id[0]!='.' || line->d.id[1]) )
    {
        tmp.l = strlen(line->d.id);
        kputc(';',&tmp);
    }
    kputs(id,&tmp);

    line->d.id = tmp.s; line->d.m_id = tmp.m;
    line->d.shared_dirty |= BCF1_DIRTY_ID;
    return 0;

}

// Assembly:
testq %rdx, %rdx
je 0x2fcda
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %rbx
testb $0x1, 0xbc(%rsi)
jne 0x2fc26
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x2b198
andq $0x0, (%rsp)
movq 0x78(%rbx), %r15
movq %r15, 0x10(%rsp)
movslq 0x58(%rbx), %rax
movq %rax, 0x8(%rsp)
movq %r14, %rdi
callq 0x41c0
movslq %eax, %r12
movq %r15, %rax
cmpb $0x0, (%rax)
je 0x2fc83
movq %rax, %rdi
movq %r14, %rsi
callq 0x40d0
testq %rax, %rax
je 0x2fc83
movzbl (%rax,%r12), %ecx
testl %ecx, %ecx
je 0x2fc6e
cmpl $0x3b, %ecx
jne 0x2fc7b
cmpq %r15, %rax
je 0x2fccf
cmpb $0x3b, -0x1(%rax)
jne 0x2fc7e
jmp 0x2fccf
incq %rax
incq %rax
jmp 0x2fc4b
testq %r15, %r15
je 0x2fcab
cmpb $0x2e, (%r15)
jne 0x2fc95
cmpb $0x0, 0x1(%r15)
je 0x2fcab
movq %r15, %rdi
callq 0x41c0
movq %rsp, %rsi
movq %rax, (%rsi)
pushq $0x3b
popq %rdi
callq 0x25f76
movq %rsp, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2783f
movq 0x10(%r15), %rax
movq %rax, 0x78(%rbx)
movl 0x8(%r15), %eax
movl %eax, 0x58(%rbx)
orb $0x1, 0xb0(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_get_fmt_id
bcf_fmt_t *bcf_get_fmt_id(bcf1_t *line, const int id)
{
    int i;
    if ( !(line->unpacked & BCF_UN_FMT) ) bcf_unpack(line, BCF_UN_FMT);
    for (i=0; i<line->n_fmt; i++)
    {
        if ( line->d.fmt[i].id==id ) return &line->d.fmt[i];
    }
    return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
testb $0x8, 0xbc(%rdi)
jne 0x2fd4d
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x2b198
movzbl 0x1c(%r14), %ecx
shll $0x5, %ecx
pushq $-0x20
popq %rdx
xorl %eax, %eax
leaq 0x20(%rdx), %rsi
cmpq %rsi, %rcx
je 0x2fd79
movq 0x98(%r14), %rdi
cmpl %ebx, 0x20(%rdi,%rdx)
movq %rsi, %rdx
jne 0x2fd5a
addq %rsi, %rdi
movq %rdi, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_get_info_id
bcf_info_t *bcf_get_info_id(bcf1_t *line, const int id)
{
    int i;
    if ( !(line->unpacked & BCF_UN_INFO) ) bcf_unpack(line, BCF_UN_INFO);
    for (i=0; i<line->n_info; i++)
    {
        if ( line->d.info[i].key==id ) return &line->d.info[i];
    }
    return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
testb $0x4, 0xbc(%rdi)
jne 0x2fdf1
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x2b198
movzwl 0x18(%r14), %eax
imulq $0x28, %rax, %rcx
pushq $-0x28
popq %rdx
xorl %eax, %eax
leaq 0x28(%rdx), %rsi
cmpq %rsi, %rcx
je 0x2fe1e
movq 0x90(%r14), %rdi
cmpl %ebx, 0x28(%rdi,%rdx)
movq %rsi, %rdx
jne 0x2fdff
addq %rsi, %rdi
movq %rdi, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: add_desc_to_buffer
static int add_desc_to_buffer(char *buffer, size_t *offset, size_t maxbuffer, const char *description) {

    if (!description || !buffer || !offset || (maxbuffer < 4))
        return -1;

    size_t rembuffer = maxbuffer - *offset;
    if (rembuffer > (strlen(description) + (rembuffer == maxbuffer ? 0 : 1))) {    //add description with optionally required ','
        *offset += snprintf(buffer + *offset, rembuffer, "%s%s", (rembuffer == maxbuffer)? "": ",", description);
    } else {    //not enough space for description, put ...
        size_t tmppos = (rembuffer <= 4) ? maxbuffer - 4 : *offset;
        snprintf(buffer + tmppos, 4, "...");    //ignore offset update
        return -1;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
testq %rcx, %rcx
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
pushq $-0x1
popq %rbp
jne 0x308c8
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, (%rsp)
movq (%rsi), %r15
movq %rdx, %r13
subq %r15, %r13
movq %r14, %rdi
callq 0x41c0
cmpq $0x1, %r15
sbbq $-0x1, %rax
cmpq %rax, %r13
jbe 0x308b0
movq (%rsp), %rdi
addq %r15, %rdi
testq %r15, %r15
leaq 0x54221(%rip), %rax     # 0x84aa9
leaq 0x52197(%rip), %rcx     # 0x82a26
cmovneq %rax, %rcx
leaq 0x52336(%rip), %rdx     # 0x82bd0
xorl %ebp, %ebp
movq %r13, %rsi
movq %r14, %r8
xorl %eax, %eax
callq 0x4820
cltq
addq %rax, (%rbx)
jmp 0x308c8
addq $-0x4, %r12
cmpq $0x5, %r13
cmovbq %r12, %r15
movq (%rsp), %rax
movl $0x2e2e2e, (%rax,%r15)  # imm = 0x2E2E2E
movl %ebp, %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/./htslib/kstring.h
// Function: kinsert_char
static inline int kinsert_char(char c, size_t pos, kstring_t *s)
{
    if (!s || pos > s->l)  {
        return EOF;
    }
    if (ks_resize(s, s->l + 2) < 0) {
        return EOF;
    }
    memmove(s->s + pos + 1, s->s + pos, s->l - pos);
    s->s[pos] = c;
    s->s[++s->l] = 0;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
pushq $-0x1
popq %r15
testq %rdx, %rdx
je 0x30940
movq %rdx, %rbx
movq %rsi, %r14
movq (%rdx), %rsi
cmpq %r14, %rsi
jb 0x30940
movl %edi, %ebp
addq $0x2, %rsi
movq %rbx, %rdi
callq 0x2811b
testl %eax, %eax
js 0x30940
movq (%rbx), %rdx
movq 0x10(%rbx), %rsi
leaq (%rsi,%r14), %rdi
incq %rdi
addq %r14, %rsi
subq %r14, %rdx
callq 0x4850
movq 0x10(%rbx), %rax
movb %bpl, (%rax,%r14)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
movb $0x0, 0x1(%rcx,%rax)
xorl %r15d, %r15d
movl %r15d, %eax
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_hrec_set_type
static void bcf_hrec_set_type(bcf_hrec_t *hrec)
{
    if ( !strcmp(hrec->key, "contig") ) hrec->type = BCF_HL_CTG;
    else if ( !strcmp(hrec->key, "INFO") ) hrec->type = BCF_HL_INFO;
    else if ( !strcmp(hrec->key, "FILTER") ) hrec->type = BCF_HL_FLT;
    else if ( !strcmp(hrec->key, "FORMAT") ) hrec->type = BCF_HL_FMT;
    else if ( hrec->nkeys>0 ) hrec->type = BCF_HL_STR;
    else hrec->type = BCF_HL_GEN;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
leaq 0x570f4(%rip), %rsi     # 0x87de9
movq %r14, %rdi
callq 0x46e0
testl %eax, %eax
je 0x30d48
leaq 0x554ba(%rip), %rsi     # 0x861c2
movq %r14, %rdi
callq 0x46e0
testl %eax, %eax
je 0x30d4c
leaq 0x52150(%rip), %rsi     # 0x82e6b
movq %r14, %rdi
callq 0x46e0
testl %eax, %eax
je 0x30d50
leaq 0x55bf9(%rip), %rsi     # 0x86927
movq %r14, %rdi
callq 0x46e0
testl %eax, %eax
je 0x30d54
xorl %eax, %eax
cmpl $0x0, 0x18(%rbx)
setg %al
xorl $0x5, %eax
jmp 0x30d57
pushq $0x3
jmp 0x30d56
pushq $0x1
jmp 0x30d56
xorl %eax, %eax
jmp 0x30d57
pushq $0x2
popq %rax
movl %eax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_hdr_set_idx
static int bcf_hdr_set_idx(bcf_hdr_t *hdr, int dict_type, const char *tag, bcf_idinfo_t *idinfo)
{
    size_t new_n;

    // If available, preserve existing IDX
    if ( idinfo->id==-1 )
        idinfo->id = hdr->n[dict_type];
    else if ( idinfo->id < hdr->n[dict_type] && hdr->id[dict_type][idinfo->id].key )
    {
        hts_log_error("Conflicting IDX=%d lines in the header dictionary, the new tag is %s",
            idinfo->id, tag);
        errno = EINVAL;
        return -1;
    }

    new_n = idinfo->id >= hdr->n[dict_type] ? idinfo->id+1 : hdr->n[dict_type];
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
    // hts_resize() can attempt to allocate up to 2 * requested items
    if (new_n > FUZZ_ALLOC_LIMIT/(2 * sizeof(bcf_idpair_t)))
        return -1;
#endif
    if (hts_resize(bcf_idpair_t, new_n, &hdr->m[dict_type],
                   &hdr->id[dict_type], HTS_RESIZE_CLEAR)) {
        return -1;
    }
    hdr->n[dict_type] = new_n;

    // NB: the next kh_put call can invalidate the idinfo pointer, therefore
    // we leave it unassigned here. It must be set explicitly in bcf_hdr_sync.
    hdr->id[dict_type][idinfo->id].key = tag;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movq %rdi, %r15
movslq 0x30(%rcx), %rcx
movl %esi, %r12d
movl (%rdi,%r12,4), %eax
cmpq $-0x1, %rcx
je 0x30dc6
cmpl %eax, %ecx
jge 0x30dcc
movq 0x10(%r15,%r12,8), %rdx
movq %rcx, %rsi
shlq $0x4, %rsi
cmpq $0x0, (%rdx,%rsi)
je 0x30dcc
leaq 0x56653(%rip), %rsi     # 0x873f8
leaq 0x5665c(%rip), %rdx     # 0x87408
pushq $0x1
popq %rdi
movq %rbx, %r8
xorl %eax, %eax
callq 0x8132
callq 0x4050
movl $0x16, (%rax)
jmp 0x30e0f
movl %eax, 0x30(%r14)
movl %eax, %ecx
leal 0x1(%rcx), %ebp
cmpl %eax, %ecx
cmovll %eax, %ebp
cmpl 0x98(%r15,%r12,4), %ebp
jbe 0x30e14
leaq (%r15,%r12,4), %rcx
addq $0x98, %rcx
movslq %ebp, %rsi
leaq 0x10(%r15,%r12,8), %r8
leaq 0x56600(%rip), %rax     # 0x873f8
movq %rax, (%rsp)
pushq $0x10
popq %rdi
pushq $0x4
popq %rdx
pushq $0x1
popq %r9
callq 0x9cc8
testl %eax, %eax
je 0x30e14
pushq $-0x1
popq %rax
jmp 0x30e2b
movl %ebp, (%r15,%r12,4)
movq 0x10(%r15,%r12,8), %rax
movslq 0x30(%r14), %rcx
shlq $0x4, %rcx
movq %rbx, (%rax,%rcx)
xorl %eax, %eax
addq $0x10, %rsp
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_dec_size_safe
static int bcf_dec_size_safe(uint8_t *p, uint8_t *end, uint8_t **q,
                             int *num, int *type) {
    int r;
    if (p >= end) return -1;
    *type = *p & 0xf;
    if (*p>>4 != 15) {
        *q = p + 1;
        *num = *p >> 4;
        return 0;
    }
    r = bcf_dec_typed_int1_safe(p + 1, end, q, num);
    if (r) return r;
    return *num >= 0 ? 0 : -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
pushq $-0x1
popq %rbx
cmpq %rsi, %rdi
jae 0x30e7e
movq %rcx, %r14
movzbl (%rdi), %eax
andl $0xf, %eax
movl %eax, (%r8)
leaq 0x1(%rdi), %rax
cmpb $-0x11, (%rdi)
jbe 0x30e70
movq %rax, %rdi
movq %r14, %rcx
callq 0x30e88
testl %eax, %eax
jne 0x30e7e
movl (%r14), %ebx
sarl $0x1f, %ebx
jmp 0x30e7e
movq %rax, (%rdx)
movzbl (%rdi), %eax
shrl $0x4, %eax
movl %eax, (%r14)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_dec_typed_int1_safe
static int bcf_dec_typed_int1_safe(uint8_t *p, uint8_t *end, uint8_t **q,
                                   int32_t *val) {
    uint32_t t;
    if (end - p < 2) return -1;
    t = *p++ & 0xf;
    /* Use if .. else if ... else instead of switch to force order.  Assumption
       is that small integers are more frequent than big ones. */
    if (t == BCF_BT_INT8) {
        *val = *(int8_t *) p++;
    } else {
        if (end - p < (1<<bcf_type_shift[t])) return -1;
        if (t == BCF_BT_INT16) {
            *val = le_to_i16(p);
            p += 2;
        } else if (t == BCF_BT_INT32) {
            *val = le_to_i32(p);
            p += 4;
#ifdef VCF_ALLOW_INT64
        } else if (t == BCF_BT_INT64) {
            // This case should never happen because there should be no
            // 64-bit BCFs at all, definitely not coming from htslib
            *val = le_to_i64(p);
            p += 8;
#endif
        } else {
            return -1;
        }
    }
    *q = p;
    return 0;
}

// Assembly:
movq %rcx, %r8
movq %rsi, %rcx
subq %rdi, %rcx
pushq $-0x1
popq %rax
cmpq $0x2, %rcx
jl 0x30ef7
movzbl (%rdi), %r9d
andl $0xf, %r9d
cmpq $0x1, %r9
jne 0x30eba
movsbl 0x1(%rdi), %eax
addq $0x2, %rdi
movl %eax, (%r8)
movq %rdi, (%rdx)
xorl %eax, %eax
jmp 0x30ef7
leaq 0x7e65f(%rip), %rcx     # 0xaf520
movb (%r9,%rcx), %cl
pushq $0x1
popq %r10
shll %cl, %r10d
leaq 0x1(%rdi), %rcx
subq %rcx, %rsi
movslq %r10d, %rcx
cmpq %rcx, %rsi
jl 0x30ef7
cmpb $0x3, %r9b
je 0x30ef8
movzbl %r9b, %ecx
cmpl $0x2, %ecx
jne 0x30ef7
movswl 0x1(%rdi), %eax
movl %eax, (%r8)
addq $0x3, %rdi
jmp 0x30eb3
retq
movl 0x1(%rdi), %eax
movl %eax, (%r8)
addq $0x5, %rdi
jmp 0x30eb3
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_record_check_err
static void bcf_record_check_err(const bcf_hdr_t *hdr, bcf1_t *rec,
                                 char *type, uint32_t *reports, int i) {
    if (*reports == 0 || hts_verbose >= HTS_LOG_DEBUG)
        hts_log_warning("Bad BCF record at %s:%"PRIhts_pos
                        ": Invalid FORMAT %s %d",
                        bcf_seqname_safe(hdr,rec), rec->pos+1, type, i);
    (*reports)++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movl (%rcx), %eax
testl %eax, %eax
je 0x30f29
leaq 0x7e5dc(%rip), %rcx     # 0xaf500
cmpl $0x5, (%rcx)
jl 0x30f5a
movq %r15, %rsi
callq 0x27650
movq (%r15), %r8
incq %r8
movl %ebp, (%rsp)
leaq 0x566e6(%rip), %rsi     # 0x87627
leaq 0x566f4(%rip), %rdx     # 0x8763c
pushq $0x3
popq %rdi
movq %rax, %rcx
movq %r14, %r9
xorl %eax, %eax
callq 0x8132
movl (%rbx), %eax
incl %eax
movl %eax, (%rbx)
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: bcf1_sync_id
static inline int bcf1_sync_id(bcf1_t *line, kstring_t *str)
{
    // single typed string
    if ( line->d.id && strcmp(line->d.id, ".") ) {
        return bcf_enc_vchar(str, strlen(line->d.id), line->d.id);
    } else {
        return bcf_enc_size(str, 0, BCF_BT_CHAR);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq 0x78(%rdi), %r14
testq %r14, %r14
je 0x30fa2
cmpb $0x2e, (%r14)
jne 0x30f86
cmpb $0x0, 0x1(%r14)
je 0x30fa2
movq %r14, %rdi
callq 0x41c0
movq %rbx, %rdi
movl %eax, %esi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x28223
pushq $0x7
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x27feb
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf1_sync_alleles
static inline int bcf1_sync_alleles(bcf1_t *line, kstring_t *str)
{
    // list of typed strings
    int i;
    for (i=0; i<line->n_allele; i++) {
        if (bcf_enc_vchar(str, strlen(line->d.allele[i]), line->d.allele[i]) < 0)
            return -1;
    }
    if ( !line->rlen && line->n_allele ) line->rlen = strlen(line->d.allele[0]);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movl %eax, %ecx
shrl $0x10, %ecx
cmpq %rcx, %r12
jae 0x30ffa
movq 0x88(%rbx), %rax
movq (%rax,%r12,8), %r15
movq %r15, %rdi
callq 0x41c0
movq %r14, %rdi
movl %eax, %esi
movq %r15, %rdx
callq 0x28223
incq %r12
jmp 0x30fc7
shrq $0x10, %rax
testw %ax, %ax
je 0x3101d
cmpq $0x0, 0x8(%rbx)
jne 0x3101d
movq 0x88(%rbx), %rax
movq (%rax), %rdi
callq 0x41c0
movq %rax, 0x8(%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: bcf1_sync_info
static inline int bcf1_sync_info(bcf1_t *line, kstring_t *str)
{
    // pairs of typed vectors
    int i, irm = -1, e = 0;
    for (i=0; i<line->n_info; i++)
    {
        bcf_info_t *info = &line->d.info[i];
        if ( !info->vptr )
        {
            // marked for removal
            if ( irm < 0 ) irm = i;
            continue;
        }
        e |= kputsn_(info->vptr - info->vptr_off, info->vptr_len + info->vptr_off, str) < 0;
        if ( irm >=0 )
        {
            bcf_info_t tmp = line->d.info[irm]; line->d.info[irm] = line->d.info[i]; line->d.info[i] = tmp;
            while ( irm<=i && line->d.info[irm].vptr ) irm++;
        }
    }
    if ( irm>=0 ) line->n_info = irm;
    return e == 0 ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
xorl %r15d, %r15d
pushq $-0x1
popq %rbp
pushq $0x1
popq %r8
movabsq $0x100000000, %r13      # imm = 0x100000000
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movzwl %ax, %ecx
cmpq %rcx, %r15
jae 0x311a3
movq 0x90(%rbx), %rax
imulq $0x28, %r15, %r14
movq 0x10(%rax,%r14), %rdi
testq %rdi, %rdi
je 0x31181
movl %r8d, 0x4(%rsp)
addq %r14, %rax
movl 0x1c(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
subq %rcx, %rdi
movl 0x18(%rax), %esi
addl %ecx, %esi
movq 0x8(%rsp), %rdx
callq 0x311c6
shrl $0x1f, %eax
orl %r12d, %eax
testl %ebp, %ebp
js 0x3118c
movq 0x90(%rbx), %rsi
movl %ebp, %ecx
imulq $0x28, %rcx, %rdx
movq 0x20(%rsi,%rdx), %rdi
movq %rdi, 0x30(%rsp)
movups (%rsi,%rdx), %xmm0
movups 0x10(%rsi,%rdx), %xmm1
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movups (%rsi,%r14), %xmm0
movups 0x10(%rsi,%r14), %xmm1
movups %xmm0, (%rsi,%rdx)
movups %xmm1, 0x10(%rsi,%rdx)
movq 0x20(%rsi,%r14), %rdi
movq %rdi, 0x20(%rsi,%rdx)
movq 0x90(%rbx), %rsi
movq 0x30(%rsp), %rdi
movq %rdi, 0x20(%rsi,%r14)
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movups %xmm1, 0x10(%rsi,%r14)
movups %xmm0, (%rsi,%r14)
movl 0x4(%rsp), %r8d
cmpl %r8d, %ebp
movl %r8d, %esi
cmovgl %ebp, %esi
shlq $0x20, %rcx
addq $0x10, %rdx
movq %rcx, %rdi
sarq $0x20, %rdi
cmpq %r15, %rdi
jg 0x31193
movq 0x90(%rbx), %rdi
cmpq $0x0, (%rdi,%rdx)
je 0x31195
incl %ebp
addq %r13, %rcx
addq $0x28, %rdx
jmp 0x3115c
testl %ebp, %ebp
cmovsl %r15d, %ebp
movl %r12d, %eax
jmp 0x31195
movl 0x4(%rsp), %r8d
jmp 0x31195
movl %esi, %ebp
incq %r15
incl %r8d
movl %eax, %r12d
jmp 0x3107e
testl %ebp, %ebp
js 0x311b7
movzwl %bp, %ecx
andq $-0x10000, %rax         # imm = 0xFFFF0000
orq %rcx, %rax
movq %rax, 0x18(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/tbx.c
// Function: get_tid
static inline int get_tid(tbx_t *tbx, const char *ss, int is_add)
{
    khint_t k;
    khash_t(s2i) *d;
    if ((tbx->conf.preset&0xffff) == TBX_GAF) return(0);
    if (tbx->dict == 0) tbx->dict = kh_init(s2i);
    if (!tbx->dict) return -1; // Out of memory
    d = (khash_t(s2i)*)tbx->dict;
    if (is_add) {
        int absent;
        k = kh_put(s2i, d, ss, &absent);
        if (absent < 0) {
            return -1; // Out of memory
        } else if (absent) {
            char *ss_dup = strdup(ss);
            if (ss_dup) {
                kh_key(d, k) = ss_dup;
                kh_val(d, k) = kh_size(d) - 1;
            } else {
                kh_del(s2i, d, k);
                return -1; // Out of memory
            }
        }
    } else k = kh_get(s2i, d, ss);
    return k == kh_end(d)? -1 : kh_val(d, k);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
xorl %ebx, %ebx
cmpw $0x3, (%rdi)
je 0x77286
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
movq 0x20(%rdi), %r14
pushq $-0x1
popq %rbx
testq %r14, %r14
jne 0x77216
callq 0x5fec
movq %rax, %r14
movq %rax, 0x20(%r12)
testq %rax, %rax
je 0x77286
testl %ebp, %ebp
je 0x7725f
leaq 0xc(%rsp), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x63c0
cmpl $0x0, (%r12)
js 0x77286
movl %eax, %ebp
je 0x7726c
movq %r15, %rdi
callq 0x4930
testq %rax, %rax
je 0x7727c
movq 0x18(%r14), %rcx
movl %ebp, %edx
movq %rax, (%rcx,%rdx,8)
movl 0x4(%r14), %eax
decl %eax
movq 0x20(%r14), %rcx
movq %rax, (%rcx,%rdx,8)
jmp 0x7726c
movq %r14, %rdi
movq %r15, %rsi
callq 0x605b
movl %eax, %ebp
cmpl (%r14), %ebp
je 0x77286
movq 0x20(%r14), %rax
movl %ebp, %ecx
movl (%rax,%rcx,8), %ebx
jmp 0x77286
movq %r14, %rdi
movl %ebp, %esi
callq 0x65a6
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq