LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/regidx.c
// Function: regitr_loop
int regitr_loop(regitr_t *regitr)
{
    if ( !regitr || !regitr->itr ) return 0;

    itr_t_ *itr = (itr_t_*) regitr->itr;
    regidx_t *regidx = itr->ridx;

    if ( !itr->list )    // first time here
    {
        itr->list = regidx->seq;
        itr->ireg = 0;
    }

    size_t iseq = itr->list - regidx->seq;
    if ( iseq >= regidx->nseq ) return 0;

    if ( itr->ireg >= itr->list->nreg )
    {
        iseq++;
        if ( iseq >= regidx->nseq ) return 0; // no more sequences, done
        itr->ireg = 0;
        itr->list = &regidx->seq[iseq];
    }

    regitr->seq = itr->list->seq;
    regitr->beg = itr->list->reg[itr->ireg].beg;
    regitr->end = itr->list->reg[itr->ireg].end;
    if ( regidx->payload_size )
        regitr->payload = (char *)itr->list->dat + regidx->payload_size*itr->ireg;
    itr->ireg++;

    return 1;
}

// Assembly:
xorl %eax, %eax
testq %rdi, %rdi
je 0x21d18
movq 0x20(%rdi), %rcx
testq %rcx, %rcx
je 0x21d18
movq 0x18(%rcx), %rdx
cmpq $0x0, 0x20(%rcx)
jne 0x21c85
movq 0x8(%rdx), %rsi
movq %rsi, 0x20(%rcx)
movl $0x0, 0x10(%rcx)
movq 0x20(%rcx), %r9
movq 0x8(%rdx), %rsi
movq %r9, %r10
subq %rsi, %r10
sarq $0x3, %r10
movabsq $0x6db6db6db6db6db7, %r8 # imm = 0x6DB6DB6DB6DB6DB7
imulq %r10, %r8
movslq (%rdx), %r10
cmpq %r10, %r8
jae 0x21d18
movl 0x10(%rcx), %r11d
cmpl 0xc(%r9), %r11d
jb 0x21cd1
incq %r8
cmpq %r10, %r8
jae 0x21d18
movl $0x0, 0x10(%rcx)
imulq $0x38, %r8, %rax
addq %rax, %rsi
movq %rsi, 0x20(%rcx)
movq 0x20(%rcx), %rax
movq 0x28(%rax), %rsi
movq %rsi, 0x18(%rdi)
movq 0x18(%rax), %r8
movl 0x10(%rcx), %esi
movq %rsi, %r9
shlq $0x4, %r9
movq (%r8,%r9), %r10
movq %r10, (%rdi)
movq 0x8(%r8,%r9), %r8
movq %r8, 0x8(%rdi)
movl 0x38(%rdx), %edx
testl %edx, %edx
je 0x21d0d
imull %esi, %edx
addq 0x20(%rax), %rdx
movq %rdx, 0x10(%rdi)
leal 0x1(%rsi), %eax
movl %eax, 0x10(%rcx)
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/regidx.c
// Function: regitr_copy
void regitr_copy(regitr_t *dst, regitr_t *src)
{
    itr_t_ *dst_itr = (itr_t_*) dst->itr;
    itr_t_ *src_itr = (itr_t_*) src->itr;
    *dst_itr = *src_itr;
    *dst = *src;
    dst->itr = dst_itr;
}

// Assembly:
movq 0x20(%rdi), %rax
movq 0x20(%rsi), %rcx
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq 0x20(%rsi), %rcx
movq %rcx, 0x20(%rdi)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups %xmm1, 0x10(%rdi)
movups %xmm0, (%rdi)
movq %rax, 0x20(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/regidx.c
// Function: cmp_reg_ptrs
static inline int cmp_regs(reg_t *a, reg_t *b)
{
    if ( a->beg < b->beg ) return -1;
    if ( a->beg > b->beg ) return 1;
    if ( a->end < b->end ) return 1;    // longer intervals come first
    if ( a->end > b->end ) return -1;
    if ( a < b ) return -1; // this is are just for qsort reproducibility across platforms
    if ( a > b ) return 1;
    return 0;
}

// Assembly:
movq (%rsi), %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rcx, (%rdi)
jl 0x2206d
movl $0x1, %eax
jg 0x2206d
movq 0x8(%rsi), %rcx
cmpq %rcx, 0x8(%rdi)
jl 0x2206d
setg %al
cmpq %rsi, %rdi
setb %cl
orb %al, %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x2206d
xorl %eax, %eax
cmpq %rsi, %rdi
seta %al
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/region.c
// Function: reg_destroy
static void reg_destroy(reghash_t *h) {

    khint_t k;

    if (!h)
        return;

    for (k = 0; k < kh_end(h); ++k) {
        if (kh_exist(h, k)) {
            free(kh_val(h, k).a);
        }
    }
    kh_destroy(reg, h);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, (%rdi)
je 0x226fe
movl $0x4, %r14d
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x10(%rbx), %rax
movl %r12d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %r15d, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x226ec
movq 0x20(%rbx), %rax
movq (%rax,%r14,2), %rdi
callq 0x45c0
incq %r12
movl (%rbx), %eax
addq $0xc, %r14
addl $0x2, %r15d
cmpq %rax, %r12
jb 0x226c6
movq 0x18(%rbx), %rdi
callq 0x45c0
movq 0x10(%rbx), %rdi
callq 0x45c0
movq 0x20(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x45c0
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/region.c
// Function: hts_reglist_free
void hts_reglist_free(hts_reglist_t *reglist, int count) {

    int i;
    if(reglist) {
        for (i = 0; i < count; i++) {
            if (reglist[i].intervals)
                free(reglist[i].intervals);
        }
        free(reglist);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x2276f
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
testl %esi, %esi
jle 0x22762
movl %esi, %eax
shlq $0x3, %rax
leaq (%rax,%rax,4), %r14
xorl %r15d, %r15d
movq 0x8(%rbx,%r15), %rdi
testq %rdi, %rdi
je 0x22759
callq 0x45c0
addq $0x28, %r15
cmpq %r15, %r14
jne 0x2274a
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_hdr_destroy
void sam_hdr_destroy(sam_hdr_t *bh)
{
    int32_t i;

    if (bh == NULL) return;

    if (bh->ref_count > 0) {
        --bh->ref_count;
        return;
    }

    if (bh->target_name) {
        for (i = 0; i < bh->n_targets; ++i)
            free(bh->target_name[i]);
        free(bh->target_name);
        free(bh->target_len);
    }
    free(bh->text);
    if (bh->hrecs)
        sam_hrecs_free(bh->hrecs);
    if (bh->sdict)
        kh_destroy(s2i, (khash_t(s2i) *) bh->sdict);
    free(bh);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x22afe
movq %rdi, %rbx
movl 0x40(%rdi), %eax
testl %eax, %eax
je 0x22b06
decl %eax
movl %eax, 0x40(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
cmpq $0x0, 0x20(%rbx)
je 0x22b3f
cmpl $0x0, (%rbx)
jle 0x22b2d
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x45c0
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x22b15
movq 0x20(%rbx), %rdi
callq 0x45c0
movq 0x10(%rbx), %rdi
callq 0x45c0
movq 0x28(%rbx), %rdi
callq 0x45c0
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x22b56
callq 0x86cce
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x22b64
callq 0x1100b
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x45c0
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_hdr_dup_sdict
int sam_hdr_dup_sdict(const sam_hdr_t *h0, sam_hdr_t *h)
{
    const khash_t(s2i) *src_long_refs = (khash_t(s2i) *) h0->sdict;
    khash_t(s2i) *dest_long_refs = kh_init(s2i);
    int i;
    if (!dest_long_refs) return -1;

    for (i = 0; i < h->n_targets; i++) {
        int ret;
        khiter_t ksrc, kdest;
        if (h->target_len[i] < UINT32_MAX) continue;
        ksrc = kh_get(s2i, src_long_refs, h->target_name[i]);
        if (ksrc == kh_end(src_long_refs)) continue;
        kdest = kh_put(s2i, dest_long_refs, h->target_name[i], &ret);
        if (ret < 0) {
            kh_destroy(s2i, dest_long_refs);
            return -1;
        }
        kh_val(dest_long_refs, kdest) = kh_val(src_long_refs, ksrc);
    }

    h->sdict = dest_long_refs;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq 0x30(%rdi), %r15
callq 0x10ffc
movq %rax, %r12
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r12, %r12
je 0x22c2a
cmpl $0x0, (%r14)
jle 0x22c1d
xorl %r13d, %r13d
movq 0x10(%r14), %rax
movl $0x4, %ebx
cmpl $-0x1, (%rax,%r13,4)
jne 0x22c0d
movq 0x20(%r14), %rax
movq (%rax,%r13,8), %rsi
movq %r15, %rdi
callq 0x11074
cmpl (%r15), %eax
je 0x22c0d
movl %eax, %ebp
movq 0x20(%r14), %rax
movq (%rax,%r13,8), %rsi
movq %r12, %rdi
leaq 0x4(%rsp), %rdx
callq 0x1143a
cmpl $0x0, 0x4(%rsp)
js 0x22c00
movq 0x20(%r15), %rcx
movl %ebp, %edx
movq (%rcx,%rdx,8), %rcx
movq 0x20(%r12), %rdx
movl %eax, %eax
movq %rcx, (%rdx,%rax,8)
xorl %ebx, %ebx
jmp 0x22c0d
movq %r12, %rdi
callq 0x1100b
movl $0x1, %ebx
testb $0x3, %bl
jne 0x22c25
incq %r13
movslq (%r14), %rax
cmpq %rax, %r13
jl 0x22ba4
movq %r12, 0x30(%r14)
xorl %eax, %eax
jmp 0x22c2a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_realloc_bam_data
int sam_realloc_bam_data(bam1_t *b, size_t desired)
{
    uint32_t new_m_data;
    uint8_t *new_data;
    new_m_data = desired;
    kroundup32(new_m_data); // next power of 2
    new_m_data += 32; // reduces malloc arena migrations?
    if (new_m_data < desired) {
        errno = ENOMEM; // Not strictly true but we can't store the size
        return -1;
    }
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
    if (new_m_data > FUZZ_ALLOC_LIMIT) {
        errno = ENOMEM;
        return -1;
    }
#endif
    if ((bam_get_mempolicy(b) & BAM_USER_OWNS_DATA) == 0) {
        new_data = realloc(b->data, new_m_data);
    } else {
        if ((new_data = malloc(new_m_data)) != NULL) {
            if (b->l_data > 0)
                memcpy(new_data, b->data,
                       b->l_data < b->m_data ? b->l_data : b->m_data);
            bam_set_mempolicy(b, bam_get_mempolicy(b) & (~BAM_USER_OWNS_DATA));
        }
    }
    if (!new_data) return -1;
    b->data = new_data;
    b->m_data = new_m_data;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x234b8
leal -0x1(%rsi), %eax
movl %eax, %ecx
shrl %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x10, %ecx
orl %eax, %ecx
movl %esi, %eax
negl %eax
shrl $0x1f, %eax
leal (%rcx,%rax), %ebp
addl $0x20, %ebp
jmp 0x234bd
movl $0x20, %ebp
movl %ebp, %eax
cmpq %rsi, %rax
jae 0x234d1
callq 0x4050
movl $0xc, (%rax)
jmp 0x23534
movl 0x48(%rbx), %r15d
testb $0x2, %r15b
jne 0x234ec
movq 0x38(%rbx), %rdi
movq %rax, %rsi
callq 0x4840
movq %rax, %r14
jmp 0x23524
movq %rax, %rdi
callq 0x4680
testq %rax, %rax
je 0x23521
movq %rax, %r14
movl 0x40(%rbx), %eax
testl %eax, %eax
jle 0x23517
movq 0x38(%rbx), %rsi
movl 0x44(%rbx), %edx
cmpl %edx, %eax
cmovbl %eax, %edx
movq %r14, %rdi
callq 0x43c0
andl $-0x3, %r15d
movl %r15d, 0x48(%rbx)
jmp 0x23524
xorl %r14d, %r14d
testq %r14, %r14
je 0x23534
movq %r14, 0x38(%rbx)
movl %ebp, 0x44(%rbx)
xorl %eax, %eax
jmp 0x23539
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: bam_destroy1
void bam_destroy1(bam1_t *b)
{
    if (b == 0) return;
    if ((bam_get_mempolicy(b) & BAM_USER_OWNS_DATA) == 0) {
        free(b->data);
        if ((bam_get_mempolicy(b) & BAM_USER_OWNS_STRUCT) != 0) {
            // In case of reuse
            b->data = NULL;
            b->m_data = 0;
            b->l_data = 0;
        }
    }

    if ((bam_get_mempolicy(b) & BAM_USER_OWNS_STRUCT) == 0)
        free(b);
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x2357b
movq %rdi, %rbx
testb $0x2, 0x48(%rdi)
jne 0x2356c
movq 0x38(%rbx), %rdi
callq 0x45c0
testb $0x1, 0x48(%rbx)
je 0x2356c
leaq 0x38(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
testb $0x1, 0x48(%rbx)
jne 0x2357b
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: bam_copy1
bam1_t *bam_copy1(bam1_t *bdst, const bam1_t *bsrc)
{
    if (realloc_bam_data(bdst, bsrc->l_data) < 0) return NULL;
    memcpy(bdst->data, bsrc->data, bsrc->l_data); // copy var-len data
    memcpy(&bdst->core, &bsrc->core, sizeof(bsrc->core)); // copy the rest
    bdst->l_data = bsrc->l_data;
    bdst->id = bsrc->id;
    return bdst;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x40(%rsi), %rsi
movl 0x44(%rdi), %eax
cmpq %rsi, %rax
jae 0x2359f
movq %rbx, %rdi
callq 0x23476
testl %eax, %eax
js 0x235e3
movq 0x38(%rbx), %rdi
movq 0x38(%r14), %rsi
movslq 0x40(%r14), %rdx
callq 0x43c0
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm0, (%rbx)
movups %xmm1, 0x10(%rbx)
movups %xmm2, 0x20(%rbx)
movl 0x40(%r14), %eax
movl %eax, 0x40(%rbx)
movq 0x30(%r14), %rax
movq %rax, 0x30(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %ebx, %ebx
jmp 0x235d8
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: bam_dup1
bam1_t *bam_dup1(const bam1_t *bsrc)
{
    if (bsrc == NULL) return NULL;
    bam1_t *bdst = bam_init1();
    if (bdst == NULL) return NULL;
    if (bam_copy1(bdst, bsrc) == NULL) {
        bam_destroy1(bdst);
        return NULL;
    }
    return bdst;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x23622
movq %rdi, %r14
movl $0x1, %edi
movl $0x50, %esi
callq 0x4300
testq %rax, %rax
je 0x23622
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2357d
testq %rax, %rax
jne 0x23624
movq %rbx, %rdi
callq 0x23544
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: bam_cigar2qlen
hts_pos_t bam_cigar2qlen(int n_cigar, const uint32_t *cigar)
{
    int k;
    hts_pos_t l;
    for (k = l = 0; k < n_cigar; ++k)
        if (bam_cigar_type(bam_cigar_op(cigar[k]))&1)
            l += bam_cigar_oplen(cigar[k]);
    return l;
}

// Assembly:
xorl %eax, %eax
testl %edi, %edi
jle 0x23ad0
movl %edi, %ecx
movl $0x3c1a7, %edx          # imm = 0x3C1A7
xorl %edi, %edi
movl (%rsi,%rdi,4), %r8d
leal (%r8,%r8), %r9d
btl %r9d, %edx
movl $0x0, %r9d
sbbl %r9d, %r9d
shrl $0x4, %r8d
andl %r9d, %r8d
addq %r8, %rax
incq %rdi
cmpq %rdi, %rcx
jne 0x23aa9
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: bam_cigar2rlen
hts_pos_t bam_cigar2rlen(int n_cigar, const uint32_t *cigar)
{
    int k;
    hts_pos_t l;
    for (k = l = 0; k < n_cigar; ++k)
        if (bam_cigar_type(bam_cigar_op(cigar[k]))&2)
            l += bam_cigar_oplen(cigar[k]);
    return l;
}

// Assembly:
testl %edi, %edi
jle 0x23b07
movl %edi, %edx
xorl %edi, %edi
xorl %eax, %eax
movl (%rsi,%rdi,4), %r8d
leal (%r8,%r8), %ecx
movl $0x3c1a7, %r9d          # imm = 0x3C1A7
shrl %cl, %r9d
shll $0x1e, %r9d
sarl $0x1f, %r9d
shrl $0x4, %r8d
andl %r9d, %r8d
addq %r8, %rax
incq %rdi
cmpq %rdi, %rdx
jne 0x23adb
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/./htslib/bgzf.h
// Function: bgzf_read_small
static inline ssize_t bgzf_read_small(BGZF *fp, void *data, size_t length) {
    // A block length of 0 implies current block isn't loaded (see
    // bgzf_seek_common).  That gives negative available so careful on types
    if ((ssize_t)length < fp->block_length - fp->block_offset) {
        // Short cut the common and easy mode
        memcpy((uint8_t *)data,
               (uint8_t *)fp->uncompressed_block + fp->block_offset,
               length);
        fp->block_offset += length;
        fp->uncompressed_address += length;
        return length;
    } else {
        return bgzf_read(fp, data, length);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movslq 0x8(%rdi), %rcx
movslq 0x10(%rdi), %rax
subq %rax, %rcx
cmpq %rdx, %rcx
jle 0x23f25
addq 0x28(%r14), %rax
movq %rsi, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x43c0
addl %ebx, 0x10(%r14)
addq %rbx, 0x20(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xbf5d
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: fixup_missing_qname_nul
static int fixup_missing_qname_nul(bam1_t *b) {
    bam1_core_t *c = &b->core;

    // Note this is called before c->l_extranul is added to c->l_qname
    if (c->l_extranul > 0) {
        b->data[c->l_qname++] = '\0';
        c->l_extranul--;
    } else {
        if (b->l_data > INT_MAX - 4) return -1;
        if (realloc_bam_data(b, b->l_data + 4) < 0) return -1;
        b->l_data += 4;
        b->data[c->l_qname++] = '\0';
        c->l_extranul = 3;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x0, 0xf(%rdi)
je 0x23f69
movq 0x38(%rbx), %rax
movzwl 0x12(%rbx), %ecx
leal 0x1(%rcx), %edx
movw %dx, 0x12(%rbx)
movb $0x0, (%rax,%rcx)
movb 0xf(%rbx), %al
decb %al
movb %al, 0xf(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movslq 0x40(%rbx), %rsi
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq $0x7ffffffb, %rsi       # imm = 0x7FFFFFFB
jg 0x23f60
addq $0x4, %rsi
movl 0x44(%rbx), %eax
cmpq %rsi, %rax
jae 0x23f93
movq %rbx, %rdi
callq 0x23476
testl %eax, %eax
js 0x23f60
addl $0x4, 0x40(%rbx)
movq 0x38(%rbx), %rax
movzwl 0x12(%rbx), %ecx
leal 0x1(%rcx), %edx
movw %dx, 0x12(%rbx)
movb $0x0, (%rax,%rcx)
movb $0x3, %al
jmp 0x23f5b
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/./htslib/bgzf.h
// Function: bgzf_write_small
static inline
ssize_t bgzf_write_small(BGZF *fp, const void *data, size_t length) {
    if (fp->is_compressed
        && (size_t) (BGZF_BLOCK_SIZE - fp->block_offset) > length) {
        // Short cut the common and easy mode
        memcpy((uint8_t *)fp->uncompressed_block + fp->block_offset,
               data, length);
        fp->block_offset += length;
        return length;
    } else {
        return bgzf_write(fp, data, length);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
testb $0x40, 0x3(%rdi)
je 0x2465c
movslq 0x10(%r14), %rdi
movl $0xff00, %eax           # imm = 0xFF00
subq %rdi, %rax
cmpq %rbx, %rax
jbe 0x2465c
addq 0x28(%r14), %rdi
movq %rbx, %rdx
callq 0x43c0
addl %ebx, 0x10(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xd0bb
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: bam_set_qname
int bam_set_qname(bam1_t *rec, const char *qname)
{
    if (!rec) return -1;
    if (!qname || !*qname) return -1;

    size_t old_len = rec->core.l_qname;
    size_t new_len = strlen(qname) + 1;
    if (new_len < 1 || new_len > 255) return -1;

    int extranul = (new_len%4 != 0) ? (4 - new_len%4) : 0;

    size_t new_data_len = rec->l_data - old_len + new_len + extranul;
    if (realloc_bam_data(rec, new_data_len) < 0) return -1;

    // Make room
    if (new_len + extranul != rec->core.l_qname)
        memmove(rec->data + new_len + extranul, rec->data + rec->core.l_qname, rec->l_data - rec->core.l_qname);
    // Copy in new name and pad if needed
    memcpy(rec->data, qname, new_len);
    int n;
    for (n = 0; n < extranul; n++) rec->data[new_len + n] = '\0';

    rec->l_data = new_data_len;
    rec->core.l_qname = new_len + extranul;
    rec->core.l_extranul = extranul;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jne 0x24788
movq %rsi, %r15
cmpb $0x0, (%rsi)
je 0x24788
movq %rdi, %rbx
movq %r15, %rdi
callq 0x41d0
cmpq $0xfe, %rax
ja 0x24788
movq %rax, %r14
leaq 0x1(%rax), %r8
movl %r8d, %r13d
andl $0x3, %r13d
movl $0x4, %eax
subl %r13d, %eax
xorl %edx, %edx
testq %r13, %r13
cmovnel %eax, %edx
movzwl 0x12(%rbx), %eax
movslq 0x40(%rbx), %rcx
movq %rdx, 0x10(%rsp)
addq %r8, %rdx
movq %rdx, %r12
subq %rax, %r12
addq %rcx, %r12
movl 0x44(%rbx), %eax
cmpq %rax, %r12
movq %rdx, 0x8(%rsp)
movq %r8, (%rsp)
jbe 0x24718
movq %rbx, %rdi
movq %r12, %rsi
callq 0x23476
movq (%rsp), %r8
movq 0x8(%rsp), %rdx
testl %eax, %eax
js 0x24788
movzwl 0x12(%rbx), %eax
cmpq %rax, %rdx
movq 0x10(%rsp), %rbp
je 0x24744
movq 0x38(%rbx), %rsi
leaq (%rsi,%r8), %rdi
addq %rbp, %rdi
addq %rax, %rsi
movslq 0x40(%rbx), %rdx
subq %rax, %rdx
callq 0x4830
movq (%rsp), %r8
movq 0x38(%rbx), %rdi
movq %r15, %rsi
movq %r8, %rdx
callq 0x43c0
testq %r13, %r13
je 0x24775
cmpl $0x2, %ebp
movl $0x1, %eax
cmovael %ebp, %eax
movq 0x38(%rbx), %rcx
movb $0x0, 0x1(%rcx,%r14)
incq %r14
decq %rax
jne 0x24763
movl %r12d, 0x40(%rbx)
movq 0x8(%rsp), %rax
movw %ax, 0x12(%rbx)
movb %bpl, 0xf(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_idx_init
int sam_idx_init(htsFile *fp, sam_hdr_t *h, int min_shift, const char *fnidx) {
    fp->fnidx = fnidx;
    if (fp->format.format == bam || fp->format.format == bcf ||
        (fp->format.format == sam && fp->format.compression == bgzf)) {
        int n_lvls, fmt = HTS_FMT_CSI;
        if (min_shift > 0) {
            int64_t max_len = 0, s;
            int i;
            for (i = 0; i < h->n_targets; ++i)
                if (max_len < h->target_len[i]) max_len = h->target_len[i];
            max_len += 256;
            for (n_lvls = 0, s = 1<<min_shift; max_len > s; ++n_lvls, s <<= 3);

        } else min_shift = 14, n_lvls = 5, fmt = HTS_FMT_BAI;

        fp->idx = hts_idx_init(h->n_targets, fmt, bgzf_tell(fp->fp.bgzf), min_shift, n_lvls);
        return fp->idx ? 0 : -1;
    }

    if (fp->format.format == cram) {
        fp->fp.cram->idxfp = bgzf_open(fnidx, "wg");
        return fp->fp.cram->idxfp ? 0 : -1;
    }

    return -1;
}

// Assembly:
pushq %rbx
movl %edx, %r9d
movq %rdi, %rbx
movq %rcx, 0x70(%rdi)
movl 0x4c(%rdi), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leal -0x3(%rdx), %edi
cmpl $0x6, %edi
ja 0x24ba2
leaq 0x755af(%rip), %r8      # 0x9a070
movslq (%r8,%rdi,4), %rdi
addq %r8, %rdi
jmpq *%rdi
cmpl $0x2, 0x54(%rbx)
jne 0x24b73
testl %r9d, %r9d
jle 0x24b07
movslq (%rsi), %rax
testq %rax, %rax
jle 0x24b1a
movq 0x10(%rsi), %rcx
xorl %edi, %edi
xorl %edx, %edx
movq %rdx, %r8
movl (%rcx,%rdi,4), %edx
cmpq %rdx, %r8
cmovgq %r8, %rdx
incq %rdi
cmpq %rdi, %rax
jne 0x24ae9
addq $0x100, %rdx            # imm = 0x100
jmp 0x24b1f
movl $0x1, %eax
movl $0x5, %r8d
movl $0xe, %r9d
jmp 0x24b45
movl $0x100, %edx            # imm = 0x100
movl $0x1, %eax
movl %r9d, %ecx
shll %cl, %eax
movslq %eax, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
cmpq %rcx, %rdx
jle 0x24b45
xorl %r8d, %r8d
incl %r8d
shlq $0x3, %rcx
cmpq %rcx, %rdx
jg 0x24b39
movl (%rsi), %edi
movq 0x38(%rbx), %rcx
movq 0x18(%rcx), %rsi
shlq $0x10, %rsi
movzwl 0x10(%rcx), %edx
orq %rsi, %rdx
movl %eax, %esi
movl %r9d, %ecx
callq 0x16550
movq %rax, %rcx
movq %rax, 0x68(%rbx)
xorl %eax, %eax
cmpq $0x1, %rcx
jmp 0x24ba0
cmpl $0x6, %edx
jne 0x24ba2
leaq 0x719b4(%rip), %rsi     # 0x96533
movq %rcx, %rdi
callq 0xa4a5
movq 0x38(%rbx), %rcx
movq %rax, 0x8988(%rcx)
movq 0x38(%rbx), %rcx
xorl %eax, %eax
cmpq $0x1, 0x8988(%rcx)
sbbl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_idx_save
int sam_idx_save(htsFile *fp) {
    if (fp->format.format == bam || fp->format.format == bcf ||
        fp->format.format == vcf || fp->format.format == sam) {
        int ret;
        if ((ret = sam_state_destroy(fp)) < 0) {
            errno = -ret;
            return -1;
        }
        if (!fp->is_bgzf || bgzf_flush(fp->fp.bgzf) < 0)
            return -1;
        hts_idx_amend_last(fp->idx, bgzf_tell(fp->fp.bgzf));

        if (hts_idx_finish(fp->idx, bgzf_tell(fp->fp.bgzf)) < 0)
            return -1;

        return hts_idx_save_but_not_close(fp->idx, fp->fnidx, hts_idx_fmt(fp->idx));

    } else if (fp->format.format == cram) {
        // flushed and closed by cram_close
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl 0x4c(%rdi), %eax
xorl %ebp, %ebp
cmpl $0x9, %eax
ja 0x24c54
movl $0x318, %ecx            # imm = 0x318
btl %eax, %ecx
jae 0x24c54
movq %rdi, %rbx
callq 0x24c5b
testl %eax, %eax
js 0x24c44
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb $0x10, (%rbx)
je 0x24c54
movq 0x38(%rbx), %rdi
callq 0xcc29
testl %eax, %eax
js 0x24c54
movq 0x38(%rbx), %rax
movq 0x68(%rbx), %rdi
movq 0x18(%rax), %rcx
shlq $0x10, %rcx
movzwl 0x10(%rax), %esi
orq %rcx, %rsi
callq 0x173e3
movq 0x38(%rbx), %rax
movq 0x68(%rbx), %rdi
movq 0x18(%rax), %rcx
shlq $0x10, %rcx
movzwl 0x10(%rax), %esi
orq %rcx, %rsi
callq 0x1664f
testl %eax, %eax
js 0x24c54
movq 0x68(%rbx), %r14
movq 0x70(%rbx), %rbx
movq %r14, %rdi
callq 0x173e8
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x1798e
movl %eax, %ebp
negl %ebp
callq 0x4050
movl %ebp, (%rax)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_passes_filter
int sam_passes_filter(const sam_hdr_t *h, const bam1_t *b, hts_filter_t *filt)
{
    hb_pair hb = {h, b};
    hts_expr_val_t res = HTS_EXPR_VAL_INIT;
    if (hts_filter_eval2(filt, &hb, bam_sym_lookup, &res)) {
        hts_log_error("Couldn't process filter expression");
        hts_expr_val_free(&res);
        return -1;
    }

    int t = res.is_true;
    hts_expr_val_free(&res);

    return t;
}

// Assembly:
pushq %rbx
subq $0x40, %rsp
movq %rdx, %r8
leaq 0x30(%rsp), %rax
movq %rdi, (%rax)
movq %rsi, 0x8(%rax)
xorps %xmm0, %xmm0
movq %rsp, %rcx
movaps %xmm0, 0x10(%rcx)
movaps %xmm0, (%rcx)
movq $0x0, 0x20(%rcx)
leaq 0x47(%rip), %rdx        # 0x24fea
movq %r8, %rdi
movq %rax, %rsi
callq 0x1d27e
testl %eax, %eax
je 0x24fd3
leaq 0x75966(%rip), %rsi     # 0x9a91f
leaq 0x75971(%rip), %rdx     # 0x9a931
movl $0x1, %edi
xorl %eax, %eax
callq 0x14378
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x24fd8
movsbl 0x1(%rsp), %ebx
movq 0x18(%rsp), %rdi
callq 0x45c0
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: index_load
static hts_idx_t *index_load(htsFile *fp, const char *fn, const char *fnidx, int flags)
{
    switch (fp->format.format) {
    case bam:
    case sam:
        return hts_idx_load3(fn, fnidx, HTS_FMT_BAI, flags);

    case cram: {
        if (cram_index_load(fp->fp.cram, fn, fnidx) < 0) return NULL;

        // Cons up a fake "index" just pointing at the associated cram_fd:
        hts_cram_idx_t *idx = malloc(sizeof (hts_cram_idx_t));
        if (idx == NULL) return NULL;
        idx->fmt = HTS_FMT_CRAI;
        idx->cram = fp->fp.cram;
        return (hts_idx_t *) idx;
        }

    default:
        return NULL; // TODO Would use tbx_index_load if it returned hts_idx_t
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x4c(%rdi), %eax
leal -0x3(%rax), %edi
cmpl $0x2, %edi
jae 0x25c26
movq %rsi, %rdi
movq %rdx, %rsi
movl $0x1, %edx
popq %rbx
jmp 0x1b9ba
cmpl $0x6, %eax
jne 0x25c57
movq 0x38(%rbx), %rdi
callq 0x4bc64
testl %eax, %eax
js 0x25c57
movl $0x10, %edi
callq 0x4680
testq %rax, %rax
je 0x25c57
movl $0x3, (%rax)
movq 0x38(%rbx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x25c59
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_itr_queryi
hts_itr_t *sam_itr_queryi(const hts_idx_t *idx, int tid, hts_pos_t beg, hts_pos_t end)
{
    const hts_cram_idx_t *cidx = (const hts_cram_idx_t *) idx;
    if (idx == NULL)
        return hts_itr_query(NULL, tid, beg, end, sam_readrec_rest);
    else if (cidx->fmt == HTS_FMT_CRAI)
        return cram_itr_query(idx, tid, beg, end, sam_readrec);
    else
        return hts_itr_query(idx, tid, beg, end, sam_readrec);
}

// Assembly:
testq %rdi, %rdi
je 0x25c7e
cmpl $0x3, (%rdi)
jne 0x25c8c
leaq 0x143(%rip), %r8        # 0x25dbf
jmp 0x25cac
leaq 0x13(%rip), %r8         # 0x25c98
xorl %edi, %edi
jmp 0x17e99
leaq 0x12c(%rip), %r8        # 0x25dbf
jmp 0x17e99
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: cram_itr_query
static hts_itr_t *cram_itr_query(const hts_idx_t *idx, int tid, hts_pos_t beg, hts_pos_t end, hts_readrec_func *readrec)
{
    const hts_cram_idx_t *cidx = (const hts_cram_idx_t *) idx;
    hts_itr_t *iter = (hts_itr_t *) calloc(1, sizeof(hts_itr_t));
    if (iter == NULL) return NULL;

    // Cons up a dummy iterator for which hts_itr_next() will simply invoke
    // the readrec function:
    iter->is_cram = 1;
    iter->read_rest = 1;
    iter->off = NULL;
    iter->bins.a = NULL;
    iter->readrec = readrec;

    if (tid >= 0 || tid == HTS_IDX_NOCOOR || tid == HTS_IDX_START) {
        cram_range r = { tid, beg+1, end };
        int ret = cram_set_option(cidx->cram, CRAM_OPT_RANGE, &r);

        iter->curr_off = 0;
        // The following fields are not required by hts_itr_next(), but are
        // filled in in case user code wants to look at them.
        iter->tid = tid;
        iter->beg = beg;
        iter->end = end;

        switch (ret) {
        case 0:
            break;

        case -2:
            // No data vs this ref, so mark iterator as completed.
            // Same as HTS_IDX_NONE.
            iter->finished = 1;
            break;

        default:
            free(iter);
            return NULL;
        }
    }
    else switch (tid) {
    case HTS_IDX_REST:
        iter->curr_off = 0;
        break;
    case HTS_IDX_NONE:
        iter->curr_off = 0;
        iter->finished = 1;
        break;
    default:
        hts_log_error("Query with tid=%d not implemented for CRAM files", tid);
        abort();
        break;
    }

    return iter;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbp
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %r14d
movq %rdi, %r13
movl $0x1, %edi
movl $0x90, %esi
callq 0x4300
testq %rax, %rax
je 0x25d62
movq %rax, %rbx
movq %r15, %rsi
movl (%rax), %r15d
movl %r15d, %eax
orl $0x5, %eax
movl %eax, (%rbx)
xorl %eax, %eax
movq %rax, 0x60(%rbx)
movq %rax, 0x88(%rbx)
movq %rbp, 0x68(%rbx)
testl %r14d, %r14d
sets %al
leal 0x3(%r14), %ecx
cmpl $0x2, %ecx
setae %cl
testb %cl, %al
jne 0x25d66
movq %rsp, %rdx
movl %r14d, (%rdx)
leaq 0x1(%r12), %rax
movq %rax, 0x8(%rdx)
movq %rsi, %rbp
movq %rsi, 0x10(%rdx)
movq 0x8(%r13), %rdi
movl $0x5, %esi
xorl %eax, %eax
callq 0x55e0e
movq $0x0, 0x50(%rbx)
movl %r14d, 0x4(%rbx)
movq %r12, 0x18(%rbx)
movq %rbp, 0x20(%rbx)
testl %eax, %eax
je 0x25d8b
cmpl $-0x2, %eax
je 0x25d84
movq %rbx, %rdi
callq 0x45c0
xorl %ebx, %ebx
jmp 0x25d8b
cmpl $-0x5, %r14d
je 0x25d7c
cmpl $-0x4, %r14d
jne 0x25d9d
movq $0x0, 0x50(%rbx)
jmp 0x25d8b
movq $0x0, 0x50(%rbx)
orl $0x7, %r15d
movl %r15d, (%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7534a(%rip), %rsi     # 0x9b0ee
leaq 0x737f7(%rip), %rdx     # 0x995a2
movl $0x1, %edi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x14378
callq 0x4270
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_readrec
static int sam_readrec(BGZF *ignored, void *fpv, void *bv, int *tid, hts_pos_t *beg, hts_pos_t *end)
{
    htsFile *fp = (htsFile *)fpv;
    bam1_t *b = bv;
    fp->line.l = 0;
    int ret = sam_read1(fp, fp->bam_header, b);
    if (ret >= 0) {
        *tid = b->core.tid;
        *beg = b->core.pos;
        *end = bam_endpos(b);
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r9, %rbx
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %rdi
movq $0x0, 0x10(%rsi)
movq 0x78(%rsi), %rsi
callq 0x2a3f9
movl %eax, %ebp
testl %eax, %eax
js 0x25e06
movl 0x8(%r14), %eax
movl %eax, (%r12)
movq (%r14), %rax
movq %rax, (%r15)
movq %r14, %rdi
callq 0x23b0a
movq %rax, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_itr_regarray
hts_itr_t *sam_itr_regarray(const hts_idx_t *idx, sam_hdr_t *hdr, char **regarray, unsigned int regcount)
{
    const hts_cram_idx_t *cidx = (const hts_cram_idx_t *) idx;
    hts_reglist_t *r_list = NULL;
    int r_count = 0;

    if (!cidx || !hdr)
        return NULL;

    hts_itr_t *itr = NULL;
    if (cidx->fmt == HTS_FMT_CRAI) {
        r_list = hts_reglist_create(regarray, regcount, &r_count, cidx->cram, cram_name2id);
        if (!r_list)
            return NULL;
        itr = hts_itr_regions(idx, r_list, r_count, cram_name2id, cidx->cram,
                   hts_itr_multi_cram, cram_readrec, cram_pseek, cram_ptell);
    } else {
        r_list = hts_reglist_create(regarray, regcount, &r_count, hdr, (hts_name2id_f)(bam_name2id));
        if (!r_list)
            return NULL;
        itr = hts_itr_regions(idx, r_list, r_count, (hts_name2id_f)(bam_name2id), hdr,
                   hts_itr_multi_bam, sam_readrec, bam_pseek, bam_ptell);
    }

    if (!itr)
        hts_reglist_free(r_list, r_count);

    return itr;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movl $0x0, 0xc(%rsp)
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %sil
orb %al, %sil
jne 0x25f53
movq %rdi, %r14
cmpl $0x3, (%rdi)
jne 0x25ed7
movq 0x8(%r14), %rax
leaq 0xe4(%rip), %r8         # 0x25f63
leaq 0xc(%rsp), %r9
movq %rdx, %rdi
movl %ecx, %esi
movq %r9, %rdx
movq %rax, %rcx
callq 0x220b0
testq %rax, %rax
je 0x25f53
movq %rax, %rbx
movl 0xc(%rsp), %edx
movq 0x8(%r14), %r8
subq $0x8, %rsp
leaq 0x206(%rip), %rax       # 0x260b9
leaq 0x181(%rip), %r10       # 0x2603b
leaq 0xab(%rip), %r11        # 0x25f6c
leaq 0x9b(%rip), %rcx        # 0x25f63
leaq -0xc3a7(%rip), %r9      # 0x19b28
movq %r14, %rdi
movq %rbx, %rsi
jmp 0x25f2f
leaq -0x2a7c(%rip), %r8      # 0x23462
leaq 0xc(%rsp), %rax
movq %rdx, %rdi
movl %ecx, %esi
movq %rax, %rdx
movq %r15, %rcx
callq 0x220b0
testq %rax, %rax
je 0x25f53
movq %rax, %rbx
movl 0xc(%rsp), %edx
subq $0x8, %rsp
leaq 0x207(%rip), %rax       # 0x26111
leaq 0x1fb(%rip), %r10       # 0x2610c
leaq -0x159(%rip), %r11      # 0x25dbf
leaq -0x2abd(%rip), %rcx     # 0x23462
leaq -0xcf74(%rip), %r9      # 0x18fb2
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %r8
pushq %rax
pushq %r10
pushq %r11
callq 0x1a9f5
addq $0x20, %rsp
movq %rax, %r14
testq %rax, %rax
jne 0x25f56
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0x2272c
jmp 0x25f56
xorl %r14d, %r14d
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: cram_readrec
static int cram_readrec(BGZF *ignored, void *fpv, void *bv, int *tid, hts_pos_t *beg, hts_pos_t *end)
{
    htsFile *fp = fpv;
    bam1_t *b = bv;
    int pass_filter, ret;

    do {
        ret = cram_get_bam_seq(fp->fp.cram, &b);
        if (ret < 0)
            return cram_eof(fp->fp.cram) ? -1 : -2;

        if (bam_tag2cigar(b, 1, 1) < 0)
            return -2;

        *tid = b->core.tid;
        *beg = b->core.pos;
        *end = bam_endpos(b);

        if (fp->filter) {
            pass_filter = sam_passes_filter(fp->bam_header, b, fp->filter);
            if (pass_filter < 0)
                return -2;
        } else {
            pass_filter = 1;
        }
    } while (pass_filter == 0);

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x10(%rsp)
movq %r8, %r14
movq %rcx, %r15
movq %rsi, %r12
leaq 0x8(%rsp), %rax
movq %rdx, (%rax)
movl $0xfffffffe, %r13d      # imm = 0xFFFFFFFE
movq 0x38(%r12), %rdi
leaq 0x8(%rsp), %rsi
callq 0x40244
testl %eax, %eax
js 0x26012
movl %eax, %ebp
movq 0x8(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x23fae
testl %eax, %eax
js 0x26029
movq 0x8(%rsp), %rbx
movl 0x8(%rbx), %eax
movl %eax, (%r15)
movq (%rbx), %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0x23b0a
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq 0x80(%r12), %rdx
testq %rdx, %rdx
je 0x26004
movq 0x78(%r12), %rdi
movq %rbx, %rsi
callq 0x24f73
testl %eax, %eax
jns 0x26009
jmp 0x26029
movl $0x1, %eax
testl %eax, %eax
je 0x25f96
movl %ebp, %r13d
jmp 0x26029
movq 0x38(%r12), %rdi
callq 0x55e07
cmpl $0x1, %eax
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
sbbl $0x0, %r13d
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: cram_pseek
static int cram_pseek(void *fp, int64_t offset, int whence)
{
    cram_fd *fd =  (cram_fd *)fp;

    if ((0 != cram_seek(fd, offset, SEEK_SET))
     && (0 != cram_seek(fd, offset - fd->first_container, SEEK_CUR)))
        return -1;

    fd->curr_position = offset;

    if (fd->ctr) {
        cram_free_container(fd->ctr);
        if (fd->ctr_mt && fd->ctr_mt != fd->ctr)
            cram_free_container(fd->ctr_mt);

        fd->ctr = NULL;
        fd->ctr_mt = NULL;
        fd->ooc = 0;
    }

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorl %edx, %edx
callq 0x55990
testl %eax, %eax
je 0x26072
movq %r14, %rsi
subq 0x8880(%rbx), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x55990
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x260b1
movq %r14, 0x8888(%rbx)
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x260af
leaq 0x38(%rbx), %r14
callq 0x5295e
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x2609e
cmpq (%r14), %rdi
je 0x2609e
callq 0x5295e
movl $0x0, 0x8978(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: cram_ptell
static int64_t cram_ptell(void *fp)
{
    cram_fd *fd = (cram_fd *)fp;
    cram_container *c;
    cram_slice *s;
    int64_t ret = -1L;

    if (fd) {
        if ((c = fd->ctr) != NULL) {
            if ((s = c->slice) != NULL && s->max_rec) {
                if ((c->curr_slice + s->curr_rec/s->max_rec) >= (c->max_slice + 1))
                    fd->curr_position += c->offset + c->length;
            }
        }
        ret = fd->curr_position;
    }

    return ret;
}

// Assembly:
testq %rdi, %rdi
je 0x26104
movq 0x38(%rdi), %rcx
testq %rcx, %rcx
je 0x260fc
movq 0x90(%rcx), %rax
testq %rax, %rax
je 0x260fc
movl 0xe0(%rax), %esi
testl %esi, %esi
je 0x260fc
movl 0xe4(%rax), %eax
cltd
idivl %esi
addl 0x5c(%rcx), %eax
cmpl 0x58(%rcx), %eax
jle 0x260fc
movslq (%rcx), %rax
addq 0x40(%rcx), %rax
addq %rax, 0x8888(%rdi)
movq 0x8888(%rdi), %rax
retq
movq $-0x1, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_itr_regions
hts_itr_t *sam_itr_regions(const hts_idx_t *idx, sam_hdr_t *hdr, hts_reglist_t *reglist, unsigned int regcount)
{
    const hts_cram_idx_t *cidx = (const hts_cram_idx_t *) idx;

    if(!cidx || !hdr || !reglist)
        return NULL;

    if (cidx->fmt == HTS_FMT_CRAI)
        return hts_itr_regions(idx, reglist, regcount, cram_name2id, cidx->cram,
                   hts_itr_multi_cram, cram_readrec, cram_pseek, cram_ptell);
    else
        return hts_itr_regions(idx, reglist, regcount, (hts_name2id_f)(bam_name2id), hdr,
                   hts_itr_multi_bam, sam_readrec, bam_pseek, bam_ptell);
}

// Assembly:
pushq %rbx
movq %rsi, %r8
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %sil
orb %al, %sil
testq %rdx, %rdx
sete %al
orb %sil, %al
jne 0x2617f
cmpl $0x3, (%rdi)
jne 0x26183
movq 0x8(%rdi), %r8
subq $0x8, %rsp
leaq -0xa8(%rip), %r10       # 0x260b9
leaq -0x12d(%rip), %r11      # 0x2603b
leaq -0x203(%rip), %rbx      # 0x25f6c
leaq -0x213(%rip), %rax      # 0x25f63
leaq -0xc655(%rip), %r9      # 0x19b28
jmp 0x261aa
xorl %eax, %eax
jmp 0x261c0
subq $0x8, %rsp
leaq -0x7d(%rip), %r10       # 0x26111
leaq -0x89(%rip), %r11       # 0x2610c
leaq -0x3dd(%rip), %rbx      # 0x25dbf
leaq -0x2d41(%rip), %rax     # 0x23462
leaq -0xd1f8(%rip), %r9      # 0x18fb2
movq %rdx, %rsi
movl %ecx, %edx
movq %rax, %rcx
pushq %r10
pushq %r11
pushq %rbx
callq 0x1a9f5
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_hdr_parse
sam_hdr_t *sam_hdr_parse(size_t l_text, const char *text)
{
    sam_hdr_t *bh = sam_hdr_init();
    if (!bh) return NULL;

    if (sam_hdr_add_lines(bh, text, l_text) != 0) {
        sam_hdr_destroy(bh);
        return NULL;
    }

    return bh;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
movl $0x1, %edi
movl $0x48, %esi
callq 0x4300
testq %rax, %rax
je 0x261f1
movq %rax, %rbx
leaq 0x74215(%rip), %rax     # 0x9a400
movq %rax, 0x18(%rbx)
jmp 0x261f3
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x26212
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x87942
testl %eax, %eax
je 0x26214
movq %rbx, %rdi
callq 0x22ae6
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/./htslib/kstring.h
// Function: kputsn
static inline int kputsn(const char *p, size_t l, kstring_t *s)
{
	size_t new_sz = s->l + l + 2;
	if (new_sz <= s->l) { errno = EOVERFLOW; return EOF; }
	if (ks_resize(s, new_sz) < 0) return EOF;
	memcpy(s->s + s->l, p, l);
	s->l += l;
	s->s[s->l] = 0;
	return l;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq (%rdx), %rcx
leaq (%rsi,%rcx), %rax
addq $0x2, %rax
cmpq %rcx, %rax
jbe 0x27c58
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
cmpq %rax, 0x8(%rdx)
jae 0x27c33
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %r12d, %r12d
testq %rcx, %rcx
cmoveq %rdx, %r12
addq %rax, %r12
movq 0x10(%r14), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0x27c63
movq %rax, 0x10(%r14)
movq %r12, 0x8(%r14)
movq 0x10(%r14), %rdi
addq (%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x43c0
movq (%r14), %rax
addq %rbx, %rax
movq %rax, (%r14)
movq 0x10(%r14), %rcx
movb $0x0, (%rcx,%rax)
jmp 0x27c68
callq 0x4050
movl $0x4b, (%rax)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/./htslib/kstring.h
// Function: kputc
static inline int kputc(int c, kstring_t *s)
{
	if (ks_resize(s, s->l + 2) < 0)
		return EOF;
	s->s[s->l++] = c;
	s->s[s->l] = 0;
	return (unsigned char)c;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rax
addq $0x2, %rax
cmpq %rax, 0x8(%rsi)
jae 0x27d73
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %r15d, %r15d
testq %rcx, %rcx
cmoveq %rdx, %r15
addq %rax, %r15
movq 0x10(%r14), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x27d98
movq %rax, 0x10(%r14)
movq %r15, 0x8(%r14)
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r14)
movb %bl, (%rcx,%rax)
movq (%r14), %rax
movq 0x10(%r14), %rcx
movb $0x0, (%rcx,%rax)
movzbl %bl, %eax
popq %rbx
popq %r14
popq %r15
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x27d92
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/./sam_internal.h
// Function: possibly_expand_bam_data
static inline int possibly_expand_bam_data(bam1_t *b, size_t bytes) {
    size_t new_len = (size_t) b->l_data + bytes;

    if (new_len > INT32_MAX || new_len < bytes) { // Too big or overflow
        errno = ENOMEM;
        return -1;
    }
    if (new_len <= b->m_data) return 0;
    return sam_realloc_bam_data(b, new_len);
}

// Assembly:
movq %rsi, %rax
movslq 0x40(%rdi), %rsi
addq %rax, %rsi
setae %al
testq $-0x80000000, %rsi      # imm = 0x80000000
sete %cl
testb %al, %cl
jne 0x28af5
pushq %rax
callq 0x4050
movl $0xc, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
retq
movl 0x44(%rdi), %ecx
xorl %eax, %eax
cmpq %rcx, %rsi
ja 0x23476
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/./textutils_internal.h
// Function: hts_str2uint
static inline uint64_t hts_str2uint(const char *in, char **end, int bits,
                                    int *failed) {
    uint64_t n = 0, limit = (bits < 64 ? (1ULL << bits) : 0) - 1;
    const unsigned char *v = (const unsigned char *) in;
    const unsigned int ascii_zero = '0'; // Prevents conversion to signed
    uint32_t fast = bits * 1000 / 3322 + 1; // log(10)/log(2) ~= 3.322
    unsigned int d;

    if (*v == '+')
        v++;

    while (--fast && *v>='0' && *v<='9')
        n = n*10 + *v++ - ascii_zero;

    if ((unsigned)(*v - ascii_zero) < 10 && !fast) {
        uint64_t limit_d_10 = limit / 10;
        uint64_t limit_m_10 = limit - 10 * limit_d_10;
        while ((d = *v - ascii_zero) < 10) {
            if (n < limit_d_10 || (n == limit_d_10 && d <= limit_m_10)) {
                n = n*10 + d;
                v++;
            } else {
                do { v++; } while (*v - ascii_zero < 10);
                n = limit;
                *failed = 1;
                break;
            }
        }
    }

    *end = (char *)v;
    return n;
}

// Assembly:
pushq %rbx
movq %rcx, %r8
movl %edx, %ecx
movq $-0x1, %r9
shlq %cl, %r9
xorl %ebx, %ebx
cmpb $0x2b, (%rdi)
sete %bl
leaq (%rdi,%rbx), %r10
cmpl $0x4, %edx
setae %al
jb 0x28b84
movb (%rdi,%rbx), %dl
leal -0x30(%rdx), %r11d
cmpb $0x9, %r11b
ja 0x28b84
imull $0x3e8, %ecx, %eax      # imm = 0x3E8
movl $0x9dd2b003, %r11d      # imm = 0x9DD2B003
imulq %rax, %r11
shrq $0x2b, %r11
decl %r11d
addq %rbx, %rdi
addq %r11, %rdi
incq %rdi
xorl %ecx, %ecx
leaq (%rcx,%rcx,4), %rax
movzbl %dl, %ecx
leaq (%rcx,%rax,2), %rcx
addq $-0x30, %rcx
addl $-0x1, %r11d
setb %al
jae 0x28c11
movb 0x1(%r10), %dl
incq %r10
leal -0x30(%rdx), %ebx
cmpb $0x9, %bl
jbe 0x28b57
jmp 0x28b86
xorl %ecx, %ecx
testb %al, %al
jne 0x28c09
movzbl (%r10), %eax
addl $-0x3a, %eax
cmpl $-0xa, %eax
jb 0x28c09
notq %r9
movabsq $0x6666666666666667, %rdx # imm = 0x6666666666666667
movq %r9, %rax
mulq %rdx
movzbl (%r10), %edi
addl $-0x30, %edi
cmpl $0x9, %edi
ja 0x28c09
shrq $0x2, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %r11
movq %r9, %rax
subq %r11, %rax
movl %edi, %edi
cmpq %rdx, %rcx
jb 0x28bd5
jne 0x28bef
cmpq %rdi, %rax
jb 0x28bef
leaq (%rcx,%rcx,4), %rcx
leaq (%rdi,%rcx,2), %rcx
movzbl 0x1(%r10), %edi
incq %r10
addl $-0x30, %edi
cmpl $0xa, %edi
jb 0x28bc7
jmp 0x28c09
movzbl 0x1(%r10), %eax
incq %r10
addl $-0x30, %eax
cmpl $0xa, %eax
jb 0x28bef
movl $0x1, (%r8)
movq %r9, %rcx
movq %r10, (%rsi)
movq %rcx, %rax
popq %rbx
retq
movq %rdi, %r10
jmp 0x28b86