LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_idx_check_range
int hts_idx_check_range(hts_idx_t *idx, int tid, hts_pos_t beg, hts_pos_t end)
{
    hts_pos_t maxpos = hts_idx_maxpos(idx);
    if (tid < 0 || (beg <= maxpos && end <= maxpos))
        return 0;

    if (idx->fmt == HTS_FMT_CSI) {
        hts_log_error("Region %"PRIhts_pos"..%"PRIhts_pos" "
                      "cannot be stored in a csi index with these parameters. "
                      "Please use a larger min_shift or depth",
                      beg, end);
    } else {
        hts_log_error("Region %"PRIhts_pos"..%"PRIhts_pos
                      " cannot be stored in a %s index. Try using a csi index",
                      beg, end, idx_format_name(idx->fmt));
    }
    errno = ERANGE;
    return -1;
}

// Assembly:
xorl %eax, %eax
testl %esi, %esi
js 0x16999
movq %rcx, %r8
movq %rdx, %r10
movl 0x8(%rdi), %ecx
leal (%rcx,%rcx,2), %ecx
addl 0x4(%rdi), %ecx
movl $0x1, %edx
shlq %cl, %rdx
cmpq %r10, %rdx
setge %cl
cmpq %r8, %rdx
setge %dl
testb %dl, %cl
jne 0x16999
pushq %rax
movl (%rdi), %eax
cmpq $0x3, %rax
ja 0x16961
leaq 0x7efb2(%rip), %rcx     # 0x958d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x7faf0(%rip), %rsi     # 0x9641e
leaq 0x7fafd(%rip), %rdx     # 0x96432
movl $0x1, %edi
movq %r10, %rcx
xorl %eax, %eax
callq 0x13de5
jmp 0x16985
leaq 0x7fc73(%rip), %r9      # 0x965c0
jmp 0x16968
leaq 0x7fff8(%rip), %r9      # 0x9694e
jmp 0x16968
leaq 0x7fc57(%rip), %r9      # 0x965b6
jmp 0x16968
leaq 0x7e8dc(%rip), %r9      # 0x95244
leaq 0x7faaf(%rip), %rsi     # 0x9641e
leaq 0x7fb2a(%rip), %rdx     # 0x964a0
movl $0x1, %edi
movq %r10, %rcx
xorl %eax, %eax
callq 0x13de5
callq 0x4050
movl $0x22, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_idx_tbi_name
int hts_idx_tbi_name(hts_idx_t *idx, int tid, const char *name) {
    // Horrid - we have to map incoming tid to a tbi alternative tid.
    // This is because TBI counts tids by "covered" refs while everything
    // else counts by Nth SQ/contig record in header.
    if (tid == idx->last_tbi_tid || tid < 0 || !name)
        return idx->tbi_n;

    uint32_t len = strlen(name)+1;
    uint8_t *tmp = (uint8_t *)realloc(idx->meta, idx->l_meta + len);
    if (!tmp)
        return -1;

    // Append name
    idx->meta = tmp;
    strcpy((char *)idx->meta + idx->l_meta, name);
    idx->l_meta += len;

    // Update seq length
    u32_to_le(le_to_u32(idx->meta+24)+len, idx->meta+24);

    idx->last_tbi_tid = tid;
    return ++idx->tbi_n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdx, %rdx
je 0x16e99
movl %esi, %ebp
testl %esi, %esi
js 0x16e99
cmpl %ebp, 0x44(%rbx)
je 0x16e99
movq %rdx, %r14
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r15
incl %r15d
movq 0x38(%rbx), %rdi
movl 0x10(%rbx), %esi
addl %r15d, %esi
callq 0x4840
testq %rax, %rax
je 0x16e9e
movq %rax, %r12
movq %rax, 0x38(%rbx)
movl 0x10(%rbx), %r13d
movq %rax, %rdi
addq %r13, %rdi
movq %r14, %rsi
callq 0x4460
leal (%r15,%r13), %eax
movl %eax, 0x10(%rbx)
addl %r15d, 0x18(%r12)
movl %ebp, 0x44(%rbx)
movl 0x40(%rbx), %eax
incl %eax
movl %eax, 0x40(%rbx)
jmp 0x16ea3
movl 0x40(%rbx), %eax
jmp 0x16ea3
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_O3/samtools[P]htslib/hts.c
// Function: hts_idx_save
int hts_idx_save(const hts_idx_t *idx, const char *fn, int fmt)
{
    int ret, save;
    if (idx == NULL || fn == NULL) { errno = EINVAL; return -1; }
    char *fnidx = (char*)calloc(1, strlen(fn) + 5);
    if (fnidx == NULL) return -1;

    strcpy(fnidx, fn);
    switch (fmt) {
    case HTS_FMT_BAI: strcat(fnidx, ".bai"); break;
    case HTS_FMT_CSI: strcat(fnidx, ".csi"); break;
    case HTS_FMT_TBI: strcat(fnidx, ".tbi"); break;
    default: abort();
    }

    ret = hts_idx_save_as(idx, fn, fnidx, fmt);
    save = errno;
    free(fnidx);
    errno = save;
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
setne %al
testq %rsi, %rsi
setne %cl
testb %cl, %al
jne 0x16edf
callq 0x4050
movl $0x16, (%rax)
jmp 0x16f30
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %rdi
callq 0x41d0
leaq 0x5(%rax), %rsi
movl $0x1, %edi
callq 0x4300
testq %rax, %rax
je 0x16f30
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x4460
testl %ebx, %ebx
je 0x16f49
cmpl $0x2, %ebx
je 0x16f37
cmpl $0x1, %ebx
jne 0x16f91
movq %r12, %rdi
callq 0x41d0
movl $0x6961622e, (%r12,%rax) # imm = 0x6961622E
jmp 0x16f59
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x16f88
movq %r12, %rdi
callq 0x41d0
movl $0x6962742e, (%r12,%rax) # imm = 0x6962742E
jmp 0x16f59
movq %r12, %rdi
callq 0x41d0
movl $0x6973632e, (%r12,%rax) # imm = 0x6973632E
movb $0x0, 0x4(%r12,%rax)
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movl %ebx, %ecx
callq 0x16f96
movl %eax, %ebx
callq 0x4050
movq %rax, %r14
movl (%rax), %ebp
movq %r12, %rdi
callq 0x45c0
movl %ebp, (%r14)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x4270
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_idx_save_as
int hts_idx_save_as(const hts_idx_t *idx, const char *fn, const char *fnidx, int fmt)
{
    BGZF *fp;

    if (fnidx == NULL)
        return hts_idx_save(idx, fn, fmt);

    fp = bgzf_open(fnidx, (fmt == HTS_FMT_BAI)? "wu" : "w");
    if (fp == NULL) return -1;

    if (hts_idx_write_out(idx, fp, fmt) < 0) {
        int save_errno = errno;
        bgzf_close(fp);
        errno = save_errno;
        return -1;
    }

    return bgzf_close(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdi, %r15
testq %rdx, %rdx
je 0x16fef
cmpl $0x1, %ebx
leaq 0x7c585(%rip), %rax     # 0x93536
leaq 0x80839(%rip), %rsi     # 0x977f1
cmoveq %rax, %rsi
movq %rdx, %rdi
callq 0xa550
testq %rax, %rax
je 0x17017
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
movl %ebx, %edx
callq 0x17027
testl %eax, %eax
js 0x17003
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xd3cd
movq %r15, %rdi
movl %ebx, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x16eba
callq 0x4050
movq %rax, %rbx
movl (%rax), %ebp
movq %r14, %rdi
callq 0xd3cd
movl %ebp, (%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_idx_save_but_not_close
int hts_idx_save_but_not_close(hts_idx_t *idx, const char *fnidx, int fmt)
{
    idx->otf_fp = bgzf_open(fnidx, (fmt == HTS_FMT_BAI)? "wu" : "w");
    if (idx->otf_fp == NULL) return -1;

    if (hts_idx_write_out(idx, idx->otf_fp, fmt) < 0) {
        int save_errno = errno;
        bgzf_close(idx->otf_fp);
        idx->otf_fp = NULL;
        errno = save_errno;
        return -1;
    }

    return bgzf_flush(idx->otf_fp);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %rax
movq %rdi, %rbx
cmpl $0x1, %edx
leaq 0x7c0a4(%rip), %rcx     # 0x93536
leaq 0x80358(%rip), %rsi     # 0x977f1
cmoveq %rcx, %rsi
movq %rax, %rdi
callq 0xa550
movq %rax, 0x98(%rbx)
testq %rax, %rax
je 0x174f6
movq %rbx, %rdi
movq %rax, %rsi
movl %ebp, %edx
callq 0x17027
testl %eax, %eax
js 0x174d2
movq 0x98(%rbx), %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0xcb85
callq 0x4050
movq %rax, %r14
movl (%rax), %ebp
movq 0x98(%rbx), %rdi
callq 0xd3cd
movq $0x0, 0x98(%rbx)
movl %ebp, (%r14)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_idx_set_meta
int hts_idx_set_meta(hts_idx_t *idx, uint32_t l_meta, uint8_t *meta,
                      int is_copy)
{
    uint8_t *new_meta = meta;
    if (is_copy) {
        size_t l = l_meta;
        if (l > SIZE_MAX - 1) {
            errno = ENOMEM;
            return -1;
        }
        new_meta = malloc(l + 1);
        if (!new_meta) return -1;
        memcpy(new_meta, meta, l);
        // Prevent possible strlen past the end in tbx_index_load2
        new_meta[l] = '\0';
    }
    if (idx->meta) free(idx->meta);
    idx->l_meta = l_meta;
    idx->meta = new_meta;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
testl %ecx, %ecx
je 0x1753e
movl %ebp, %r15d
leaq 0x1(%r15), %rdi
callq 0x4680
testq %rax, %rax
je 0x17557
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x43c0
movb $0x0, (%r12,%r15)
movq %r12, %r14
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x1754c
callq 0x45c0
movl %ebp, 0x10(%rbx)
movq %r14, 0x38(%rbx)
xorl %eax, %eax
jmp 0x1755c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_idx_seqnames
const char **hts_idx_seqnames(const hts_idx_t *idx, int *n, hts_id2name_f getid, void *hdr)
{
    if ( !idx || !idx->n )
    {
        *n = 0;
        return NULL;
    }

    int tid = 0, i;
    const char **names = (const char**) calloc(idx->n,sizeof(const char*));
    for (i=0; i<idx->n; i++)
    {
        bidx_t *bidx = idx->bidx[i];
        if ( !bidx ) continue;
        names[tid++] = getid(hdr,i);
    }
    *n = tid;
    return names;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
movq %rsi, %rbx
testq %rdi, %rdi
je 0x175f2
movq %rdi, %r12
movslq 0x14(%rdi), %rbp
xorl %r14d, %r14d
testq %rbp, %rbp
je 0x175f5
movq %rdx, %r15
movl $0x8, %esi
movq %rbp, %rdi
callq 0x4300
movq %rax, %r13
testl %ebp, %ebp
jle 0x175f8
movq %rbx, 0x8(%rsp)
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x28(%r12), %rax
cmpq $0x0, (%rax,%rbx,8)
je 0x175e0
movq 0x10(%rsp), %rdi
movl %ebx, %esi
callq *%r15
movslq %r14d, %rcx
incl %r14d
movq %rax, (%r13,%rcx,8)
movl 0x14(%r12), %ebp
incq %rbx
movslq %ebp, %rax
cmpq %rax, %rbx
jl 0x175ba
movq 0x8(%rsp), %rbx
jmp 0x175f8
xorl %r14d, %r14d
xorl %r13d, %r13d
movl %r14d, (%rbx)
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_idx_get_stat
int hts_idx_get_stat(const hts_idx_t* idx, int tid, uint64_t* mapped, uint64_t* unmapped)
{
    if (!idx) return -1;
    if ( idx->fmt == HTS_FMT_CRAI ) {
        *mapped = 0; *unmapped = 0;
        return -1;
    }

    bidx_t *h = idx->bidx[tid];
    if (!h) return -1;
    khint_t k = kh_get(bin, h, META_BIN(idx));
    if (k != kh_end(h)) {
        *mapped = kh_val(h, k).list[1].u;
        *unmapped = kh_val(h, k).list[1].v;
        return 0;
    } else {
        *mapped = 0; *unmapped = 0;
        return -1;
    }
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x1764f
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r8
cmpl $0x3, (%rdi)
jne 0x17650
movq $0x0, (%rdx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movq %rcx, (%r8)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rdi), %rcx
movslq %esi, %rsi
movq (%rcx,%rsi,8), %rsi
testq %rsi, %rsi
je 0x17647
movl (%rsi), %eax
testl %eax, %eax
je 0x176ce
movl 0xc(%rdi), %r9d
incl %r9d
leal -0x1(%rax), %r10d
movl %r10d, %r11d
andl %r9d, %r11d
movq 0x10(%rsi), %rbx
movl $0x1, %ebp
movl %r11d, %edi
movl %edi, %ecx
shrl $0x4, %ecx
movl (%rbx,%rcx,4), %r14d
leal (%rdi,%rdi), %ecx
andl $0x1e, %ecx
movl %r14d, %r15d
shrl %cl, %r15d
testb $0x2, %r15b
jne 0x176c2
testb $0x1, %r15b
jne 0x176b1
movq 0x18(%rsi), %r15
movl %edi, %r12d
cmpl %r9d, (%r15,%r12,4)
je 0x176c2
addl %ebp, %edi
andl %r10d, %edi
incl %ebp
cmpl %r11d, %edi
jne 0x17683
jmp 0x17636
shrl %cl, %r14d
testb $0x3, %r14b
cmovnel %eax, %edi
jmp 0x176d0
xorl %edi, %edi
cmpl %eax, %edi
je 0x17636
movq 0x20(%rsi), %rax
movl %edi, %ecx
leaq (%rcx,%rcx,2), %rcx
movq 0x10(%rax,%rcx,8), %rax
movq 0x10(%rax), %rcx
movq %rcx, (%rdx)
movq 0x18(%rax), %rcx
xorl %eax, %eax
jmp 0x17644
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_itr_destroy
void hts_itr_destroy(hts_itr_t *iter)
{
    if (iter) {
        if (iter->multi) {
            hts_reglist_free(iter->reg_list, iter->n_reg);
        } else {
            free(iter->bins.a);
        }

        if (iter->off)
            free(iter->off);
        free(iter);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x18541
pushq %rbx
movq %rdi, %rbx
testb $0x10, (%rdi)
jne 0x18542
movq 0x88(%rbx), %rdi
callq 0x45c0
jmp 0x1854e
retq
movq 0x28(%rbx), %rdi
movl 0x10(%rbx), %esi
callq 0x21d90
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x1855c
callq 0x45c0
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_parse_reg64
const char *hts_parse_reg64(const char *s, hts_pos_t *beg, hts_pos_t *end)
{
    char *hyphen;
    const char *colon = strrchr(s, ':');
    if (colon == NULL) {
        *beg = 0; *end = HTS_POS_MAX;
        return s + strlen(s);
    }

    *beg = hts_parse_decimal(colon+1, &hyphen, HTS_PARSE_THOUSANDS_SEP) - 1;
    if (*beg < 0) *beg = 0;

    if (*hyphen == '\0') *end = HTS_POS_MAX;
    else if (*hyphen == '-') *end = hts_parse_decimal(hyphen+1, NULL, HTS_PARSE_THOUSANDS_SEP);
    else return NULL;

    if (*beg >= *end) return NULL;
    return colon;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r13
movabsq $0x7fffffff7fffffff, %r12 # imm = 0x7FFFFFFF7FFFFFFF
movl $0x3a, %esi
callq 0x4530
testq %rax, %rax
je 0x1a317
movq %rax, %r15
leaq 0x1(%rax), %rdi
leaq 0x8(%rsp), %r13
movq %r13, %rsi
movl $0x1, %edx
callq 0x19927
movq %rax, %rcx
leaq -0x1(%rax), %rdx
xorl %eax, %eax
testq %rcx, %rcx
cmovleq %rax, %rdx
movq %rdx, (%rbx)
movq (%r13), %rdi
movzbl (%rdi), %ecx
testl %ecx, %ecx
je 0x1a309
cmpl $0x2d, %ecx
jne 0x1a32c
incq %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x19927
movq %rax, %r12
movq %r12, (%r14)
xorl %eax, %eax
cmpq %r12, (%rbx)
cmovlq %r15, %rax
jmp 0x1a32c
movq $0x0, (%rbx)
movq %r12, (%r14)
movq %r13, %rdi
callq 0x41d0
addq %r13, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_parse_reg
const char *hts_parse_reg(const char *s, int *beg, int *end)
{
    hts_pos_t beg64 = 0, end64 = 0;
    const char *colon = hts_parse_reg64(s, &beg64, &end64);
    if (beg64 > INT_MAX) {
        hts_log_error("Position %"PRId64" too large", beg64);
        return NULL;
    }
    if (end64 > INT_MAX) {
        if (end64 == HTS_POS_MAX) {
            end64 = INT_MAX;
        } else {
            hts_log_error("Position %"PRId64" too large", end64);
            return NULL;
        }
    }
    *beg = beg64;
    *end = end64;
    return colon;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %r15
xorl %eax, %eax
leaq 0x10(%rsp), %r12
movq %rax, (%r12)
leaq 0x8(%rsp), %rdx
movq %rax, (%rdx)
movq %r12, %rsi
callq 0x1a28c
movq (%r12), %rcx
movl $0x80000000, %edx       # imm = 0x80000000
cmpq %rdx, %rcx
jl 0x1a392
leaq 0x7c417(%rip), %rsi     # 0x96792
leaq 0x7c41e(%rip), %rdx     # 0x967a0
xorl %ebx, %ebx
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
jmp 0x1a3d6
movq %rax, %rbx
movq 0x8(%rsp), %rax
cmpq %rdx, %rax
jl 0x1a3cd
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movabsq $0x7fffffff7fffffff, %rsi # imm = 0x7FFFFFFF7FFFFFFF
cmpq %rsi, %rax
je 0x1a3d0
leaq 0x7c3d8(%rip), %rsi     # 0x96792
leaq 0x7c3df(%rip), %rdx     # 0x967a0
xorl %ebx, %ebx
movl $0x1, %edi
movq %rax, %rcx
jmp 0x1a389
movq %rax, %rdx
movl %ecx, (%r15)
movl %edx, (%r14)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_itr_querys
hts_itr_t *hts_itr_querys(const hts_idx_t *idx, const char *reg, hts_name2id_f getid, void *hdr, hts_itr_query_func *itr_query, hts_readrec_func *readrec)
{
    int tid;
    hts_pos_t beg, end;

    if (strcmp(reg, ".") == 0)
        return itr_query(idx, HTS_IDX_START, 0, 0, readrec);
    else if (strcmp(reg, "*") == 0)
        return itr_query(idx, HTS_IDX_NOCOOR, 0, 0, readrec);

    if (!hts_parse_region(reg, &tid, &beg, &end, getid, hdr, HTS_PARSE_THOUSANDS_SEP))
        return NULL;

    return itr_query(idx, tid, beg, end, readrec);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %r9, %rbx
movq %r8, %r11
movq %rcx, %r9
movq %rdx, %r8
movq %rdi, %r14
movzbl (%rsi), %eax
cmpl $0x2a, %eax
je 0x1a41a
cmpl $0x2e, %eax
jne 0x1a420
cmpb $0x0, 0x1(%rsi)
jne 0x1a420
movq %r14, %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
jmp 0x1a476
cmpb $0x0, 0x1(%rsi)
je 0x1a46e
movq %r11, %r15
movl $0x1, (%rsp)
leaq 0xc(%rsp), %rax
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rsi, %rdi
movq %rax, %rsi
callq 0x19c07
testq %rax, %rax
je 0x1a462
movl 0xc(%rsp), %esi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq %r14, %rdi
movq %rbx, %r8
callq *%r15
jmp 0x1a464
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
xorl %edx, %edx
xorl %ecx, %ecx
movq %rbx, %r8
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
jmpq *%r11
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: compare_regions
static int compare_regions(const void *r1, const void *r2) {
    hts_reglist_t *reg1 = (hts_reglist_t *)r1;
    hts_reglist_t *reg2 = (hts_reglist_t *)r2;

    if (reg1->tid < 0 && reg2->tid >= 0)
        return 1;
    else if (reg1->tid >= 0 && reg2->tid < 0)
        return -1;
    else
        return reg1->tid - reg2->tid;
}

// Assembly:
movl 0x10(%rdi), %ecx
movl 0x10(%rsi), %edx
testl %ecx, %ecx
js 0x1a623
testl %edx, %edx
jns 0x1a62d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movl $0x1, %eax
testl %edx, %edx
js 0x1a62d
retq
subl %edx, %ecx
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: idx_filename
static char *idx_filename(const char *fn, const char *ext, int download) {
    int ret, local_len;
    char *fnidx;
    const char *local_fn = NULL;
    kstring_t buffer = KS_INITIALIZE;

    // First try : append `ext` to `fn`
    if (!(fnidx = haddextension(&buffer, fn, 0, ext))) {
        free(buffer.s);
        return NULL;
    }
    if ((ret = idx_test_and_fetch(fnidx, &local_fn, &local_len, download)) == -1) {
        // Second try : replace suffix of `fn` with `ext`
        if (!(fnidx = haddextension(&buffer, fn, 1, ext))) {
            free(buffer.s);
            return NULL;
        }
        ret = idx_test_and_fetch(fnidx, &local_fn, &local_len, download);
    }

    if (ret < 0) {
        free(buffer.s);
        return NULL;
    }

    memmove(fnidx, local_fn, local_len);
    fnidx[local_len] = 0;
    return fnidx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
xorl %eax, %eax
movq %rax, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movq %r15, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x10205
testq %rax, %rax
je 0x1b278
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
movq %rax, %rdi
movl %ebp, %ecx
callq 0x1b5c8
cmpl $-0x1, %eax
jne 0x1b258
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movl $0x1, %edx
movq %r14, %rcx
callq 0x10205
testq %rax, %rax
je 0x1b278
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
movq %rax, %rdi
movl %ebp, %ecx
callq 0x1b5c8
testl %eax, %eax
js 0x1b278
movq 0x8(%rsp), %rsi
movslq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x4830
movb $0x0, (%rbx,%r14)
jmp 0x1b284
movq 0x20(%rsp), %rdi
callq 0x45c0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_idx_load3
hts_idx_t *hts_idx_load3(const char *fn, const char *fnidx, int fmt, int flags)
{
    const char *local_fn = NULL;
    char *local_fnidx = NULL;
    int local_len;
    if (!fnidx)
        return idx_find_and_load(fn, fmt, flags);

    // Check that the index file is up to date, the main file might have changed
    struct stat stat_idx,stat_main;
    int remote_fn = hisremote(fn), remote_fnidx = hisremote(fnidx);
    if ( !remote_fn && !remote_fnidx
         && !stat(fn, &stat_main) && !stat(fnidx, &stat_idx) )
    {
        if ( stat_idx.st_mtime < stat_main.st_mtime )
            hts_log_warning("The index file is older than the data file: %s", fnidx);
    }

    if (remote_fnidx && (flags & HTS_IDX_SAVE_REMOTE))
    {
        int ret = idx_test_and_fetch(fnidx, &local_fn, &local_len, 1);
        if (ret == 0) {
            local_fnidx = strdup(local_fn);
            if (local_fnidx) {
                local_fnidx[local_len] = '\0';
                fnidx = local_fnidx;
            }
        }
    }

    hts_idx_t *idx = idx_read(fnidx);
    if (!idx && !(flags & HTS_IDX_SILENT_FAIL))
        hts_log_error("Could not load local index file '%s'%s%s", fnidx,
                      errno ? " : " : "", errno ? strerror(errno) : "");


    free(local_fnidx);

    return idx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
movl %ecx, %ebp
movq %rdi, %r14
movq $0x0, 0x8(%rsp)
testq %rsi, %rsi
je 0x1b4de
movq %rsi, %rbx
movq %r14, %rdi
callq 0x101ec
movl %eax, %r15d
movq %rbx, %rdi
callq 0x101ec
orl %eax, %r15d
je 0x1b4f9
testl %eax, %eax
sete %al
testb $0x1, %bpl
sete %cl
orb %al, %cl
jne 0x1b54f
leaq 0x8(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x1b5c8
testl %eax, %eax
jne 0x1b54f
movq 0x8(%rsp), %rdi
callq 0x4930
testq %rax, %rax
je 0x1b54f
movq %rax, %r14
movslq 0x10(%rsp), %rax
movb $0x0, (%r14,%rax)
movq %r14, %rbx
jmp 0x1b552
movq %r14, %rdi
movl %edx, %esi
movl %ebp, %edx
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1b2a0
leaq 0xa0(%rsp), %rsi
movq %r14, %rdi
callq 0x4420
testl %eax, %eax
jne 0x1b54f
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x4420
testl %eax, %eax
jne 0x1b54f
movq 0x68(%rsp), %rax
cmpq 0xf8(%rsp), %rax
jge 0x1b54f
leaq 0x7b453(%rip), %rsi     # 0x96987
leaq 0x7b45a(%rip), %rdx     # 0x96995
xorl %r14d, %r14d
movl $0x3, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x13de5
jmp 0x1b552
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x1bbcc
movq %rax, %r15
testb $0x2, %bpl
jne 0x1b5ad
testq %r15, %r15
jne 0x1b5ad
callq 0x4050
movl (%rax), %edi
leaq 0x7a7f7(%rip), %r9      # 0x95d6d
leaq 0x7a998(%rip), %r12     # 0x95f15
testl %edi, %edi
cmoveq %r9, %r12
je 0x1b58d
callq 0x4150
movq %rax, %r9
leaq 0x7b3f3(%rip), %rsi     # 0x96987
leaq 0x7b429(%rip), %rdx     # 0x969c4
movl $0x1, %edi
movq %rbx, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x13de5
movq %r14, %rdi
callq 0x45c0
movq %r15, %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_realloc_or_die
HTSLIB_EXPORT
size_t hts_realloc_or_die(size_t n, size_t m, size_t m_sz, size_t size,
                          int clear, void **ptr, const char *func) {
    /* If new_m and size are both below this limit, multiplying them
       together can't overflow */
    const size_t safe = (size_t) 1 << (sizeof(size_t) * 4);
    void *new_ptr;
    size_t bytes, new_m;

    new_m = n;
    kroundup_size_t(new_m);

    bytes = size * new_m;

    /* Check for overflow.  Both ensure that new_m will fit in m (we make the
       pessimistic assumption that m is signed), and that bytes has not
       wrapped around. */
    if (new_m > (((size_t) 1 << (m_sz * 8 - 1)) - 1)
        || ((size > safe || new_m > safe)
            && bytes / new_m != size)) {
        errno = ENOMEM;
        goto die;
    }

    new_ptr = realloc(*ptr, bytes);
    if (new_ptr == NULL) goto die;

    if (clear) {
        if (new_m > m) {
            memset((char *) new_ptr + m * size, 0, (new_m - m) * size);
        }
    }

    *ptr = new_ptr;

    return new_m;

 die:
    hts_log_error("%s", strerror(errno));
    exit(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movl %r8d, %ebp
movq %rcx, %r15
movq %rdx, %rcx
movq %rsi, %r12
testq %rdi, %rdi
je 0x1bed6
movq %rdi, %r14
leaq -0x1(%rdi), %rax
movq %rax, %rdx
shrq %rdx
orq %rax, %rdx
movq %rdx, %rax
shrq $0x2, %rax
orq %rdx, %rax
movq %rax, %rdx
shrq $0x4, %rdx
orq %rax, %rdx
movq %rdx, %rax
shrq $0x8, %rax
orq %rdx, %rax
movq %rax, %rdx
shrq $0x10, %rdx
orq %rax, %rdx
movq %rdx, %rax
shrq $0x20, %rax
orq %rdx, %rax
negq %r14
shrq $0x3f, %r14
addq %rax, %r14
jmp 0x1bed9
xorl %r14d, %r14d
movq %r14, %rax
mulq %r15
seto %dl
shll $0x3, %ecx
decb %cl
movq %r14, %rsi
shrq %cl, %rsi
testq %rsi, %rsi
jne 0x1bf5c
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, %r15
seta %sil
cmpq %rcx, %r14
seta %cl
orb %sil, %cl
andb %dl, %cl
cmpb $0x1, %cl
je 0x1bf5c
movq (%rbx), %rdi
movq %rax, %rsi
callq 0x4840
testq %rax, %rax
je 0x1bf69
movq %rax, %r13
testl %ebp, %ebp
je 0x1bf47
movq %r14, %rdx
subq %r12, %rdx
jbe 0x1bf47
imulq %r15, %r12
movq %r13, %rdi
addq %r12, %rdi
imulq %r15, %rdx
xorl %esi, %esi
callq 0x4260
movq %r13, (%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4050
movl $0xc, (%rax)
jmp 0x1bf6e
callq 0x4050
movl (%rax), %edi
callq 0x4150
leaq 0x7aa71(%rip), %rsi     # 0x969ed
leaq 0x7c54b(%rip), %rdx     # 0x984ce
movl $0x1, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0x13de5
movl $0x1, %edi
callq 0x45e0
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts_expr.c
// Function: hts_filter_init
hts_filter_t *hts_filter_init(const char *str) {
    hts_filter_t *f = calloc(1, sizeof(*f));
    if (!f) return NULL;

    // Oversize to permit faster comparisons with memcmp over strcmp
    size_t len = strlen(str)+100;
    if (!(f->str = malloc(len))) {
        free(f);
        return NULL;
    }
    strcpy(f->str, str);
    return f;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x1, %edi
movl $0x298, %esi            # imm = 0x298
callq 0x4300
testq %rax, %rax
je 0x1cb5c
movq %rax, %rbx
movq %r14, %rdi
callq 0x41d0
leaq 0x64(%rax), %rdi
callq 0x4680
movq %rax, (%rbx)
testq %rax, %rax
je 0x1cb54
movq %rax, %rdi
movq %r14, %rsi
callq 0x4460
jmp 0x1cb5e
movq %rbx, %rdi
callq 0x45c0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts_expr.c
// Function: hts_filter_free
void hts_filter_free(hts_filter_t *filt) {
    if (!filt)
        return;

    int i;
    for (i = 0; i < filt->max_regex; i++)
        regfree(&filt->preg[i]);

    free(filt->str);
    free(filt);
}

// Assembly:
testq %rdi, %rdi
je 0x1cbb0
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x10(%rdi)
jle 0x1cb9b
leaq 0x18(%rbx), %r14
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x44c0
incq %r15
movslq 0x10(%rbx), %rax
addq $0x40, %r14
cmpq %rax, %r15
jl 0x1cb83
movq (%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts_expr.c
// Function: hts_filter_eval
int hts_filter_eval(hts_filter_t *filt,
                    void *data, hts_expr_sym_func *fn,
                    hts_expr_val_t *res) {
    if (res->s.l != 0 || res->s.m != 0 || res->s.s != NULL) {
        // As *res is cleared below, it's not safe to call this function
        // with res->s.s set, as memory would be leaked.  It's also not
        // possible to know is res was initialised correctly, so in
        // either case we fail.
        hts_log_error("Results structure must be cleared before calling this function");
        return -1;
    }

    memset(res, 0, sizeof(*res));

    return hts_filter_eval_(filt, data, fn, res);
}

// Assembly:
cmpq $0x0, 0x8(%rcx)
jne 0x1cbc6
cmpq $0x0, 0x10(%rcx)
jne 0x1cbc6
cmpq $0x0, 0x18(%rcx)
je 0x1cbe8
pushq %rax
leaq 0x7a192(%rip), %rsi     # 0x96d60
leaq 0x7a19b(%rip), %rdx     # 0x96d70
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rcx
retq
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rcx)
movups %xmm0, (%rcx)
movq $0x0, 0x20(%rcx)
jmp 0x1cbfc
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts_expr.c
// Function: hts_filter_eval_
static int hts_filter_eval_(hts_filter_t *filt,
                            void *data, hts_expr_sym_func *fn,
                            hts_expr_val_t *res) {
    char *end = NULL;

    filt->curr_regex = 0;
    if (expression(filt, data, fn, filt->str, &end, res))
        return -1;

    if (end && *ws(end)) {
        fprintf(stderr, "Unable to parse expression at %s\n", filt->str);
        return -1;
    }

    // Strings evaluate to true.  An empty string is also true, but an
    // absent (null) string is false, unless overriden by is_true.  An
    // empty string has kstring length of zero, but a pointer as it's
    // nul-terminated.
    if (res->is_str) {
        res->is_true |= res->s.s != NULL;
        res->d = res->is_true;
    } else if (hts_expr_val_exists(res)) {
        res->is_true |= res->d != 0;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdi, %r14
leaq 0x8(%rsp), %r8
movq $0x0, (%r8)
movl $0x0, 0xc(%rdi)
movq (%rdi), %rcx
movq %rbx, %r9
callq 0x1ccf4
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1cc94
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x1cc51
movzbl (%rax), %ecx
cmpl $0x9, %ecx
je 0x1cc48
cmpl $0x20, %ecx
jne 0x1cc4d
incq %rax
jmp 0x1cc3b
testl %ecx, %ecx
jne 0x1cc9f
cmpb $0x0, (%rbx)
je 0x1cc74
cmpq $0x0, 0x18(%rbx)
setne %al
orb 0x1(%rbx), %al
movb %al, 0x1(%rbx)
movsbl %al, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x20(%rbx)
xorl %ebp, %ebp
jmp 0x1cc94
movsd 0x20(%rbx), %xmm0
xorl %ebp, %ebp
ucomisd %xmm0, %xmm0
jp 0x1cc94
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
setp %al
setne %cl
orb %al, %cl
orb %cl, 0x1(%rbx)
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %r14, %rdi
callq 0x49e0
jmp 0x1cc94
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts_expr.c
// Function: bitxor_expr
static int bitxor_expr(hts_filter_t *filt, void *data, hts_expr_sym_func *fn,
                       char *str, char **end, hts_expr_val_t *res) {
    if (bitand_expr(filt, data, fn, str, end, res)) return -1;

    hts_expr_val_t val = HTS_EXPR_VAL_INIT;
    int undef = 0;
    for (;;) {
        str = ws(*end);
        if (*str == '^') {
            if (bitand_expr(filt, data, fn, str+1, end, &val)) return -1;
            if (!hts_expr_val_exists(&val) || !hts_expr_val_exists(res)) {
                undef = 1;
            } else if (res->is_str || val.is_str) {
                hts_expr_val_free(&val);
                return -1;
            } else {
                res->is_true =
                    (res->d = ((int64_t)res->d ^ (int64_t)val.d)) != 0;
            }
        } else {
            break;
        }
    }
    hts_expr_val_free(&val);
    if (undef)
        hts_expr_val_undef(res);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %rbx
movq %r8, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
callq 0x1dd5b
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1dd3e
xorpd %xmm0, %xmm0
leaq 0x10(%rsp), %r9
movapd %xmm0, 0x10(%r9)
movapd %xmm0, (%r9)
movq $0x0, 0x20(%r9)
movb $0x1, %cl
movb %cl, 0x7(%rsp)
movq (%r14), %rcx
incq %rcx
movzbl -0x1(%rcx), %eax
cmpl $0x9, %eax
je 0x1dc17
cmpl $0x20, %eax
je 0x1dc17
cmpl $0x5e, %eax
jne 0x1dd10
movq %r14, %r8
movq %r13, 0x8(%rsp)
movq %r13, %rdi
movq %r12, %r13
movq %r12, %rsi
movq %r15, %r12
movq %r15, %rdx
movq %r9, %r15
callq 0x1dd5b
testl %eax, %eax
jne 0x1dd3e
movzbl 0x10(%rsp), %eax
testl %eax, %eax
je 0x1dc74
cmpl $0x1, %eax
movq %r15, %r9
jne 0x1dc9f
cmpq $0x0, 0x28(%rsp)
setne %dl
jmp 0x1dc84
movsd 0x30(%rsp), %xmm0
ucomisd %xmm0, %xmm0
setnp %dl
movq %r15, %r9
movq %r12, %r15
xorl %ecx, %ecx
testq %rbx, %rbx
movq %r13, %r12
je 0x1dd06
testb %dl, %dl
movq 0x8(%rsp), %r13
jne 0x1dcaf
jmp 0x1dc10
testq %rbx, %rbx
movq %r12, %r15
movq %r13, %r12
movq 0x8(%rsp), %r13
je 0x1dcff
movzbl (%rbx), %ecx
cmpl $0x1, %ecx
je 0x1dcc8
testl %ecx, %ecx
jne 0x1dccf
movsd 0x20(%rbx), %xmm0
ucomisd %xmm0, %xmm0
jnp 0x1dccf
jmp 0x1dcff
cmpq $0x0, 0x18(%rbx)
je 0x1dcff
orb %al, %cl
jne 0x1dd4f
cvttsd2si 0x20(%rbx), %rax
cvttsd2si 0x30(%rsp), %rcx
movq %rcx, %rdx
xorq %rax, %rdx
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
movsd %xmm0, 0x20(%rbx)
cmpq %rcx, %rax
setne 0x1(%rbx)
jmp 0x1dc14
xorl %ecx, %ecx
jmp 0x1dc10
movq 0x8(%rsp), %r13
jmp 0x1dc10
movq 0x28(%rsp), %rdi
callq 0x45c0
xorl %ebp, %ebp
testb $0x1, 0x7(%rsp)
jne 0x1dd3e
movq $0x0, 0x8(%rbx)
movw $0x0, (%rbx)
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
movq %rax, 0x20(%rbx)
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rsp), %rdi
callq 0x45c0
jmp 0x1dd3e
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts_expr.c
// Function: expr_func_avg
static int expr_func_avg(hts_expr_val_t *res) {
    if (!res->is_str)
        return -1;

    size_t l = res->s.l;
    double v = 0;
    const uint8_t *x = (uint8_t *)res->s.s;
    for (l = 0; l < res->s.l; l++)
        v += x[l];
    if (l)
        v /= l;

    res->is_str = 0;
    res->d = v;

    return 0;
}

// Assembly:
cmpb $0x0, (%rdi)
je 0x1eff8
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x1effe
movq 0x18(%rdi), %rcx
xorpd %xmm0, %xmm0
xorl %edx, %edx
movzbl (%rcx,%rdx), %esi
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
addsd %xmm1, %xmm0
incq %rdx
cmpq %rdx, %rax
jne 0x1efba
movq %rax, %xmm1
punpckldq 0x767d2(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x767da(%rip), %xmm1    # 0x957c0
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
jmp 0x1f002
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
xorpd %xmm0, %xmm0
movb $0x0, (%rdi)
movsd %xmm0, 0x20(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts_expr.c
// Function: expr_func_min
static int expr_func_min(hts_expr_val_t *res) {
    if (!res->is_str)
        return -1;

    size_t l = res->s.l;
    int v = INT_MAX;
    const uint8_t *x = (uint8_t *)res->s.s;
    for (l = 0; l < res->s.l; l++)
        if (v > x[l])
            v = x[l];

    res->is_str = 0;
    res->d = v == INT_MAX ? NAN : v;

    return 0;
}

// Assembly:
cmpb $0x0, (%rdi)
je 0x1f049
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x1f04f
movq 0x18(%rdi), %rdx
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %esi, %esi
movl %ecx, %r8d
movzbl (%rdx,%rsi), %ecx
cmpl %ecx, %r8d
cmovll %r8d, %ecx
incq %rsi
cmpq %rsi, %rax
jne 0x1f026
movb $0x0, (%rdi)
cvtsi2ss %ecx, %xmm0
cvtss2sd %xmm0, %xmm0
jmp 0x1f05a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movb $0x0, (%rdi)
movsd 0x77c26(%rip), %xmm0    # 0x96c80
movsd %xmm0, 0x20(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts_expr.c
// Function: expr_func_max
static int expr_func_max(hts_expr_val_t *res) {
    if (!res->is_str)
        return -1;

    size_t l = res->s.l;
    int v = INT_MIN;
    const uint8_t *x = (uint8_t *)res->s.s;
    for (l = 0; l < res->s.l; l++)
        if (v < x[l])
            v = x[l];

    res->is_str = 0;
    res->d = v == INT_MIN ? NAN : v;

    return 0;
}

// Assembly:
cmpb $0x0, (%rdi)
je 0x1f09e
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x1f0a4
movq 0x18(%rdi), %rdx
movl $0x80000000, %ecx       # imm = 0x80000000
xorl %esi, %esi
movl %ecx, %r8d
movzbl (%rdx,%rsi), %ecx
cmpl %ecx, %r8d
cmovgl %r8d, %ecx
incq %rsi
cmpq %rsi, %rax
jne 0x1f07b
movb $0x0, (%rdi)
cvtsi2ss %ecx, %xmm0
cvtss2sd %xmm0, %xmm0
jmp 0x1f0af
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movb $0x0, (%rdi)
movsd 0x77bd1(%rip), %xmm0    # 0x96c80
movsd %xmm0, 0x20(%rdi)
xorl %eax, %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/multipart.c
// Function: free_part
static void free_part(hfile_part *p)
{
    free(p->url);
    if (p->headers) {
        char **hdr;
        for (hdr = p->headers; *hdr; hdr++) free(*hdr);
        free(p->headers);
    }

    p->url = NULL;
    p->headers = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x45c0
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0x1f70a
movq (%r14), %rdi
testq %rdi, %rdi
je 0x1f702
addq $0x8, %r14
callq 0x45c0
movq (%r14), %rdi
addq $0x8, %r14
testq %rdi, %rdi
jne 0x1f6ed
movq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x45c0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/regidx.c
// Function: regidx_insert_list
int regidx_insert_list(regidx_t *idx, char *line, char delim)
{
    kstring_t tmp = KS_INITIALIZE;
    char *ss = line;
    while ( *ss )
    {
        char *se = ss;
        while ( *se && *se!=delim ) se++;
        kputsn(ss, se-ss, ks_clear(&tmp));
        if ( regidx_insert(idx,tmp.s) < 0 )
        {
            ks_free(&tmp);
            return -1;
        }
        if ( !*se ) break;
        ss = se+1;
    }
    ks_free(&tmp);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
cmpb $0x0, (%r14)
je 0x1fb40
xorl %r15d, %r15d
movb (%r14,%r15), %al
incq %r15
testb %al, %al
je 0x1faae
cmpb %bpl, %al
jne 0x1fa9e
movq %r15, %rax
incq %rax
jne 0x1fac3
callq 0x4050
movl $0x4b, (%rax)
jmp 0x1fb21
cmpq %rax, %r13
jae 0x1fafc
movq %rax, %rcx
shrq $0x3e, %rcx
shrq %rax
testq %rcx, %rcx
movl $0x0, %ecx
cmoveq %rax, %rcx
leaq (%rcx,%r15), %rsi
incq %rsi
movq %r12, %rdi
movq %rsi, 0x8(%rsp)
callq 0x4840
movq %rax, %rbx
testq %rax, %rax
jne 0x1fb04
jmp 0x1fb21
movq %r13, 0x8(%rsp)
movq %r12, %rbx
leaq -0x1(%r15), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43c0
movb $0x0, -0x1(%rbx,%r15)
movq 0x8(%rsp), %r13
movq %rbx, %r12
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x1fb65
testl %eax, %eax
js 0x1fb45
addq %r15, %r14
cmpb $0x0, -0x1(%r14)
jne 0x1fa91
xorl %r14d, %r14d
jmp 0x1fb4b
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq %r12, %rdi
callq 0x45c0
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/regidx.c
// Function: regidx_insert
int regidx_insert(regidx_t *idx, char *line)
{
    if ( !line ) return 0;
    char *chr_from, *chr_to;
    hts_pos_t beg,end;
    int ret = idx->parse(line,&chr_from,&chr_to,&beg,&end,idx->payload,idx->usr);
    if ( ret==-2 ) return -1;   // error
    if ( ret==-1 ) return 0;    // skip the line
    return regidx_push(idx, chr_from,chr_to,beg,end,idx->payload);
}

// Assembly:
testq %rsi, %rsi
je 0x1fba9
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movq 0x30(%rdi), %rax
movq 0x40(%rdi), %r9
movq %rax, (%rsp)
leaq 0x28(%rsp), %rax
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %rsi, %rdi
movq %rax, %rsi
callq *0x28(%rbx)
cmpl $-0x2, %eax
je 0x1fbac
cmpl $-0x1, %eax
jne 0x1fbb3
xorl %eax, %eax
jmp 0x1fbd3
xorl %eax, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1fbd3
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %r8
movq 0x40(%rbx), %r9
movq %rbx, %rdi
callq 0x1fbd9
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/regidx.c
// Function: regidx_destroy
void regidx_destroy(regidx_t *idx)
{
    int i, j;
    if (!idx) return;
    for (i=0; i<idx->nseq; i++)
    {
        reglist_t *list = &idx->seq[i];
        if ( idx->free )
        {
            for (j=0; j<list->nreg; j++)
                idx->free((char *)list->dat + idx->payload_size*j);
        }
        free(list->dat);
        free(list->reg);
        free(list->idx);
    }
    free(idx->seq_names);
    free(idx->seq);
    free(idx->str.s);
    free(idx->payload);
    khash_str2int_destroy_free(idx->seq2regs);
    free(idx);
}

// Assembly:
testq %rdi, %rdi
je 0x2066a
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jle 0x205c1
xorl %r14d, %r14d
imulq $0x38, %r14, %r15
addq 0x8(%rbx), %r15
cmpq $0x0, 0x20(%rbx)
je 0x2059c
cmpl $0x0, 0xc(%r15)
je 0x2059c
xorl %r12d, %r12d
movslq 0x38(%rbx), %rdi
movslq %r12d, %r12
imulq %r12, %rdi
addq 0x20(%r15), %rdi
callq *0x20(%rbx)
incl %r12d
cmpl 0xc(%r15), %r12d
jb 0x20581
movq 0x20(%r15), %rdi
callq 0x45c0
movq 0x18(%r15), %rdi
callq 0x45c0
movq (%r15), %rdi
callq 0x45c0
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x20568
movq 0x18(%rbx), %rdi
callq 0x45c0
movq 0x8(%rbx), %rdi
callq 0x45c0
movq 0x58(%rbx), %rdi
callq 0x45c0
movq 0x40(%rbx), %rdi
callq 0x45c0
movq 0x10(%rbx), %r14
testq %r14, %r14
je 0x20657
movl (%r14), %eax
testl %eax, %eax
je 0x20634
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x10(%r14), %rcx
movq %r12, %rdx
shrq $0x4, %rdx
movl (%rcx,%rdx,4), %edx
movl %r15d, %ecx
andb $0x1e, %cl
shrl %cl, %edx
testb $0x3, %dl
jne 0x20626
movq 0x18(%r14), %rax
movq (%rax,%r12,8), %rdi
callq 0x45c0
movl (%r14), %eax
incq %r12
movl %eax, %ecx
addl $0x2, %r15d
cmpq %rcx, %r12
jb 0x205fb
movq 0x18(%r14), %rdi
callq 0x45c0
movq 0x10(%r14), %rdi
callq 0x45c0
movq 0x20(%r14), %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x45c0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/regidx.c
// Function: regidx_parse_bed
int regidx_parse_bed(const char *line, char **chr_beg, char **chr_end, hts_pos_t *beg, hts_pos_t *end, void *payload, void *usr)
{
    char *ss = (char*) line;
    while ( *ss && isspace_c(*ss) ) ss++;
    if ( !*ss ) return -1;      // skip blank lines
    if ( *ss=='#' ) return -1;  // skip comments

    char *se = ss;
    while ( *se && !isspace_c(*se) ) se++;

    *chr_beg = ss;
    *chr_end = se-1;

    if ( !*se )
    {
        // just the chromosome name
        *beg = 0;
        *end = MAX_COOR_0;
        return 0;
    }

    ss = se+1;
    *beg = hts_parse_decimal(ss, &se, 0);
    if ( ss==se ) { hts_log_error("Could not parse bed line: %s", line); return -2; }

    ss = se+1;
    *end = hts_parse_decimal(ss, &se, 0) - 1;
    if ( ss==se ) { hts_log_error("Could not parse bed line: %s", line); return -2; }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movb (%rdi), %r15b
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %r15b, %r15b
je 0x209fe
movq %r8, %r14
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
movq %rcx, 0x10(%rsp)
callq 0x4510
movq (%rax), %rcx
movq %rbx, %rax
movzbl %r15b, %edx
testb $0x20, 0x1(%rcx,%rdx,2)
je 0x2092e
movb 0x1(%rax), %r15b
incq %rax
testb %r15b, %r15b
jne 0x20912
jmp 0x209fe
cmpb $0x23, %r15b
je 0x209fe
movq %r14, 0x8(%rsp)
movq %rax, (%rsp)
movq %rax, %r14
movzbl %r15b, %edx
testb $0x20, 0x1(%rcx,%rdx,2)
jne 0x2095b
movb 0x1(%r14), %r15b
incq %r14
testb %r15b, %r15b
jne 0x20944
movq %r14, (%rsp)
movq %rax, (%r13)
leaq -0x1(%r14), %rax
movq %rax, (%r12)
cmpb $0x0, (%r14)
je 0x209de
incq %r14
movq %rsp, %r12
xorl %ebp, %ebp
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x19927
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq (%r12), %r15
cmpq %r15, %r14
je 0x209ba
incq %r15
movq %rsp, %r14
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x19927
decq %rax
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
cmpq (%r14), %r15
jne 0x209fe
leaq 0x765e9(%rip), %rsi     # 0x96faa
leaq 0x765f3(%rip), %rdx     # 0x96fbb
movl $0x1, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x13de5
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
jmp 0x209fe
movq 0x10(%rsp), %rax
movq $0x0, (%rax)
movabsq $0x800000000, %rax      # imm = 0x800000000
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
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_O3/samtools[P]htslib/regidx.c
// Function: regidx_parse_reg
int regidx_parse_reg(const char *line, char **chr_beg, char **chr_end, hts_pos_t *beg, hts_pos_t *end, void *payload, void *usr)
{
    char *ss = (char*) line;
    while ( *ss && isspace_c(*ss) ) ss++;
    if ( !*ss ) return -1;      // skip blank lines
    if ( *ss=='#' ) return -1;  // skip comments

    char *se = ss;
    while ( *se && *se!=':' ) se++;

    *chr_beg = ss;
    *chr_end = se-1;

    if ( !*se )
    {
        *beg = 0;
        *end = MAX_COOR_0;
        return 0;
    }

    ss = se+1;
    *beg = hts_parse_decimal(ss, &se, 0);
    if ( ss==se ) { hts_log_error("Could not parse reg line: %s", line); return -2; }
    if ( *beg==0 ) { hts_log_error("Could not parse reg line, expected 1-based coordinate: %s", line); return -2; }
    (*beg)--;

    if ( !se[0] || !se[1] )
        *end = se[0]=='-' ? MAX_COOR_0 : *beg;
    else
    {
        ss = se+1;
        *end = hts_parse_decimal(ss, &se, 0);
        if ( ss==se ) *end = *beg;
        else if ( *end==0 ) { hts_log_error("Could not parse reg line, expected 1-based coordinate: %s", line); return -2; }
        else (*end)--;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movb (%rdi), %r15b
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %r15b, %r15b
je 0x21162
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbx
movq %rcx, 0x8(%rsp)
movq %r8, (%rsp)
callq 0x4510
movq (%rax), %rax
leaq 0x1(%rbx), %r12
movzbl %r15b, %ecx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x2105e
movb (%r12), %r15b
incq %r12
testb %r15b, %r15b
jne 0x21042
jmp 0x21162
cmpb $0x23, %r15b
je 0x21162
leaq -0x1(%r12), %rax
testb %r15b, %r15b
je 0x21084
movzbl %r15b, %ecx
cmpl $0x3a, %ecx
je 0x21084
movb (%r12), %r15b
incq %r12
jmp 0x2106d
leaq -0x1(%r12), %rcx
movq %rcx, 0x10(%rsp)
movq %rax, (%r14)
leaq -0x2(%r12), %rax
movq %rax, (%r13)
cmpb $0x0, -0x1(%r12)
je 0x2110f
leaq 0x10(%rsp), %r14
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x19927
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq (%r14), %r14
cmpq %r14, %r12
je 0x21130
testq %rax, %rax
je 0x21140
decq %rax
movq %rax, (%rcx)
movb (%r14), %cl
testb %cl, %cl
je 0x21125
cmpb $0x0, 0x1(%r14)
je 0x21173
incq %r14
leaq 0x10(%rsp), %r12
xorl %ebp, %ebp
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x19927
movq (%rsp), %rcx
movq %rax, (%rcx)
cmpq (%r12), %r14
je 0x2117a
testq %rax, %rax
je 0x21140
decq %rax
jmp 0x21125
movq 0x8(%rsp), %rax
movq $0x0, (%rax)
movabsq $0x800000000, %rax      # imm = 0x800000000
movq (%rsp), %rcx
movq %rax, (%rcx)
xorl %ebp, %ebp
jmp 0x21162
leaq 0x75f09(%rip), %rsi     # 0x97040
leaq 0x75f13(%rip), %rdx     # 0x97051
jmp 0x2114e
leaq 0x75ef9(%rip), %rsi     # 0x97040
leaq 0x75f20(%rip), %rdx     # 0x9706e
movl $0x1, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x13de5
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x2d, %cl
je 0x2111b
jmp 0x21125
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, (%rcx)
jmp 0x21162
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/regidx.c
// Function: regitr_init
regitr_t *regitr_init(regidx_t *regidx)
{
    regitr_t *regitr = (regitr_t*) calloc(1,sizeof(regitr_t));
    if (!regitr) return NULL;
    regitr->itr  = (itr_t_*) calloc(1,sizeof(itr_t_));
    if (!regitr->itr) {
        free(regitr);
        return NULL;
    }
    itr_t_ *itr = (itr_t_*) regitr->itr;
    itr->ridx = regidx;
    itr->list = NULL;
    return regitr;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x1, %edi
movl $0x28, %esi
callq 0x4300
testq %rax, %rax
je 0x211cb
movq %rax, %rbx
movl $0x1, %edi
movl $0x30, %esi
callq 0x4300
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x211c3
movq %r14, 0x18(%rax)
jmp 0x211cd
movq %rbx, %rdi
callq 0x45c0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq