LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_opt_free
void hts_opt_free(hts_opt *opts) {
    hts_opt *last = NULL;
    while (opts) {
        opts = (last=opts)->next;
        free(last->arg);
        free(last);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rbx, %rbx
je 0x120a6
movq (%rbx), %rdi
movq 0x18(%rbx), %r14
callq 0x45c0
movq %rbx, %rdi
callq 0x45c0
movq %r14, %rbx
jmp 0x12088
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_parse_opt_list
int hts_parse_opt_list(htsFormat *fmt, const char *str) {
    while (str && *str) {
        const char *str_start;
        int len;
        char arg[8001];

        while (*str && *str == ',')
            str++;

        for (str_start = str; *str && *str != ','; str++);
        len = str - str_start;

        // Produce a nul terminated copy of the option
        strncpy(arg, str_start, len < 8000 ? len : 8000);
        arg[len < 8000 ? len : 8000] = '\0';

        if (hts_opt_add((hts_opt **)&fmt->specific, arg) != 0)
            return -1;

        if (*str)
            str++;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f48, %rsp           # imm = 0x1F48
movq %rsi, %r15
movq %rdi, %r14
addq $0x18, %r14
movl $0x1f40, %ebp           # imm = 0x1F40
movq %rsp, %r12
testq %r15, %r15
je 0x12140
cmpb $0x0, (%r15)
je 0x12140
decq %r15
movb 0x1(%r15), %al
incq %r15
cmpb $0x2c, %al
je 0x120df
xorl %ebx, %ebx
testb %al, %al
je 0x12102
movzbl %al, %eax
cmpl $0x2c, %eax
je 0x12102
movb 0x1(%r15,%rbx), %al
incq %rbx
jmp 0x120ec
cmpl %ebp, %ebx
movl $0x1f40, %eax           # imm = 0x1F40
cmovll %ebx, %eax
movslq %eax, %r13
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x4250
movb $0x0, (%rsp,%r13)
movq %r14, %rdi
movq %r12, %rsi
callq 0x111ce
testl %eax, %eax
jne 0x12144
cmpb $0x1, (%r15,%rbx)
leaq (%r15,%rbx), %r15
sbbq $-0x1, %r15
jmp 0x120d1
xorl %eax, %eax
jmp 0x12147
pushq $-0x1
popq %rax
addq $0x1f48, %rsp           # imm = 0x1F48
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_idx_destroy
void hts_idx_destroy(hts_idx_t *idx)
{
    khint_t k;
    int i;
    if (idx == 0) return;

    // For HTS_FMT_CRAI, idx actually points to a different type -- see sam.c
    if (idx->fmt == HTS_FMT_CRAI) {
        hts_cram_idx_t *cidx = (hts_cram_idx_t *) idx;
        cram_index_free(cidx->cram);
        free(cidx);
        return;
    }

    for (i = 0; i < idx->m; ++i) {
        bidx_t *bidx = idx->bidx[i];
        free(idx->lidx[i].offset);
        if (bidx == 0) continue;
        for (k = kh_begin(bidx); k != kh_end(bidx); ++k)
            if (kh_exist(bidx, k))
                free(kh_value(bidx, k).list);
        kh_destroy(bin, bidx);
    }
    free(idx->bidx); free(idx->lidx); free(idx->meta);
    free(idx);
}

// Assembly:
testq %rdi, %rdi
je 0x12525
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpl $0x3, (%rdi)
jne 0x12526
movq 0x8(%rbx), %rdi
callq 0x3d574
jmp 0x125d6
retq
xorl %r15d, %r15d
movslq 0x18(%rbx), %rax
movq 0x28(%rbx), %rdi
cmpq %rax, %r15
jge 0x125bf
movq (%rdi,%r15,8), %r14
movq 0x30(%rbx), %rax
imulq $0x18, %r15, %rcx
movq 0x10(%rax,%rcx), %rdi
callq 0x45c0
testq %r14, %r14
je 0x125b7
xorl %ebp, %ebp
xorl %r12d, %r12d
cmpl (%r14), %r12d
je 0x12594
movq 0x10(%r14), %rax
movl %r12d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x1258c
movq 0x20(%r14), %rax
movl %r12d, %ecx
imulq $0x18, %rcx, %rcx
movq 0x10(%rax,%rcx), %rdi
callq 0x45c0
incl %r12d
addl $0x2, %ebp
jmp 0x1255a
movq 0x18(%r14), %rdi
callq 0x45c0
movq 0x10(%r14), %rdi
callq 0x45c0
movq 0x20(%r14), %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x45c0
incq %r15
jmp 0x12529
callq 0x45c0
movq 0x30(%rbx), %rdi
callq 0x45c0
movq 0x38(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x45c0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_set_threads
int hts_set_threads(htsFile *fp, int n)
{
    if (fp->format.format == sam) {
        return sam_set_threads(fp, n);
    } else if (fp->format.compression == bgzf) {
        return bgzf_mt(hts_get_bgzfp(fp), n, 256/*unused*/);
    } else if (fp->format.format == cram) {
        return hts_set_opt(fp, CRAM_OPT_NTHREADS, n);
    }
    else return 0;
}

// Assembly:
movl %esi, %edx
movl 0x4c(%rdi), %eax
cmpl $0x3, %eax
jne 0x12679
movl %edx, %esi
jmp 0x22f3b
cmpl $0x2, 0x54(%rdi)
jne 0x12688
testb $0x10, (%rdi)
jne 0x12697
xorl %edi, %edi
jmp 0x1269b
cmpl $0x6, %eax
jne 0x126a7
pushq $0xe
popq %rsi
xorl %eax, %eax
jmp 0x11b3f
movq 0x38(%rdi), %rdi
movl %edx, %esi
movl $0x100, %edx            # imm = 0x100
jmp 0xb5ab
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_set_thread_pool
int hts_set_thread_pool(htsFile *fp, htsThreadPool *p) {
    if (fp->format.format == sam || fp->format.format == text_format) {
        return sam_set_thread_pool(fp, p);
    } else if (fp->format.compression == bgzf) {
        return bgzf_thread_pool(hts_get_bgzfp(fp), p->pool, p->qsize);
    } else if (fp->format.format == cram) {
        return hts_set_opt(fp, CRAM_OPT_THREAD_POOL, p);
    }
    else return 0;
}

// Assembly:
movq %rsi, %rdx
movl 0x4c(%rdi), %eax
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x2, %ecx
jne 0x126c2
movq %rdx, %rsi
jmp 0x22e5a
cmpl $0x2, 0x54(%rdi)
jne 0x126d1
testb $0x10, (%rdi)
jne 0x126e0
xorl %edi, %edi
jmp 0x126e4
cmpl $0x6, %eax
jne 0x126ef
pushq $0xf
popq %rsi
xorl %eax, %eax
jmp 0x11b3f
movq 0x38(%rdi), %rdi
movq (%rdx), %rsi
movl 0x8(%rdx), %edx
jmp 0xae43
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_set_filter_expression
int hts_set_filter_expression(htsFile *fp, const char *expr)
{
    if (fp->filter)
        hts_filter_free(fp->filter);

    if (!expr)
        return 0;

    return (fp->filter = hts_filter_init(expr))
        ? 0 : -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x80(%rdi), %rdi
testq %rdi, %rdi
je 0x12729
callq 0x18cf7
testq %r14, %r14
je 0x1274a
movq %r14, %rdi
callq 0x18ca0
movq %rax, %rcx
movq %rax, 0x80(%rbx)
xorl %eax, %eax
cmpq $0x1, %rcx
sbbl %eax, %eax
jmp 0x1274c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_set_fai_filename
int hts_set_fai_filename(htsFile *fp, const char *fn_aux)
{
    free(fp->fn_aux);
    if (fn_aux) {
        fp->fn_aux = strdup(fn_aux);
        if (fp->fn_aux == NULL) return -1;
    }
    else fp->fn_aux = NULL;

    if (fp->format.format == cram)
        if (cram_set_option(fp->fp.cram, CRAM_OPT_REFERENCE, fp->fn_aux))
            return -1;

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x30(%rdi), %rdi
callq 0x45c0
pushq $-0x1
popq %rbx
testq %r15, %r15
je 0x12790
movq %r15, %rdi
callq 0x4930
movq %rax, 0x30(%r14)
testq %rax, %rax
jne 0x12797
jmp 0x127b5
andq $0x0, 0x30(%r14)
xorl %eax, %eax
cmpl $0x6, 0x4c(%r14)
jne 0x127b3
movq 0x38(%r14), %rdi
pushq $0x9
popq %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x451f7
testl %eax, %eax
jne 0x127b5
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_open_tmpfile
hFILE *hts_open_tmpfile(const char *fname, const char *mode, kstring_t *tmpname)
{
    int pid = (int) getpid();
    unsigned ptr = (uintptr_t) tmpname;
    int n = 0;
    hFILE *fp = NULL;

    do {
        // Attempt to further uniquify the temporary filename
        unsigned t = ((unsigned) time(NULL)) ^ ((unsigned) clock()) ^ ptr;
        n++;

        ks_clear(tmpname);
        if (ksprintf(tmpname, "%s.tmp_%d_%d_%u", fname, pid, n, t) < 0) break;

        fp = hopen(tmpname->s, mode);
    } while (fp == NULL && errno == EEXIST && n < 100);

    return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, 0x10(%rsp)
movq %rdi, %r12
movq $0x0, 0x8(%rsp)
callq 0x4740
movl %eax, %ebp
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x4450
movq %rax, %r13
callq 0x4310
xorl %r14d, %eax
xorl %eax, %r13d
leal 0x1(%r15), %ebx
andq $0x0, (%r14)
movq %r14, %rdi
leaq 0x65b0f(%rip), %rsi     # 0x7831f
movq %r12, %rdx
movl %ebp, %ecx
movl %ebx, %r8d
movl %r13d, %r9d
xorl %eax, %eax
callq 0x8c78
testl %eax, %eax
js 0x12855
movq 0x10(%r14), %rdi
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0xe19b
testq %rax, %rax
jne 0x12850
callq 0x4050
cmpl $0x62, %r15d
ja 0x12855
cmpl $0x11, (%rax)
movl %ebx, %r15d
je 0x127e9
jmp 0x12855
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_getline
int hts_getline(htsFile *fp, int delimiter, kstring_t *str)
{
    int ret;
    if (! (delimiter == KS_SEP_LINE || delimiter == '\n')) {
        hts_log_error("Unexpected delimiter %d", delimiter);
        abort();
    }

    switch (fp->format.compression) {
    case no_compression:
        str->l = 0;
        ret = kgetline2(str, (kgets_func2 *) hgetln, fp->fp.hfile);
        if (ret >= 0) ret = (str->l <= INT_MAX)? (int) str->l : INT_MAX;
        else if (herrno(fp->fp.hfile)) ret = -2, errno = herrno(fp->fp.hfile);
        else ret = -1;
        break;

    case gzip:
    case bgzf:
        ret = bgzf_getline(fp->fp.bgzf, '\n', str);
        break;

    default:
        abort();
    }

    ++fp->lineno;
    return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %eax
andl $-0x9, %eax
cmpl $0x2, %eax
jne 0x129bd
movq %rdx, %r14
movq %rdi, %rbx
movl 0x54(%rdi), %eax
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jae 0x12968
movq 0x38(%rbx), %rdi
pushq $0xa
popq %rsi
movq %r14, %rdx
callq 0xc2ab
jmp 0x129b4
testl %eax, %eax
jne 0x129d7
andq $0x0, (%r14)
movq 0x38(%rbx), %rdx
leaq 0x61(%rip), %rsi        # 0x129dc
movq %r14, %rdi
callq 0x9094
testl %eax, %eax
js 0x1299b
movq (%r14), %rcx
testq $-0x80000000, %rcx      # imm = 0x80000000
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmovel %ecx, %eax
jmp 0x129b4
movq 0x38(%rbx), %rax
movl 0x34(%rax), %ebp
testl %ebp, %ebp
je 0x129b1
callq 0x4050
movl %ebp, (%rax)
pushq $-0x2
jmp 0x129b3
pushq $-0x1
popq %rax
incq 0x8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
movl %esi, %ecx
leaq 0x65969(%rip), %rsi     # 0x7832f
leaq 0x6596e(%rip), %rdx     # 0x7833b
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
callq 0x4270
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_file_type
int hts_file_type(const char *fname)
{
    int len = strlen(fname);
    if ( !strcasecmp(".vcf.gz",fname+len-7) ) return FT_VCF_GZ;
    if ( !strcasecmp(".vcf",fname+len-4) ) return FT_VCF;
    if ( !strcasecmp(".bcf",fname+len-4) ) return FT_BCF_GZ;
    if ( !strcmp("-",fname) ) return FT_STDIN;

    hFILE *f = hopen(fname, "r");
    if (f == NULL) return 0;

    htsFormat fmt;
    if (hts_detect_format2(f, fname, &fmt) < 0) { hclose_abruptly(f); return 0; }
    if (hclose(f) < 0) return 0;

    switch (fmt.format) {
    case vcf: return (fmt.compression == no_compression)? FT_VCF : FT_VCF_GZ;
    case bcf: return (fmt.compression == no_compression)? FT_BCF : FT_BCF_GZ;
    default:  return 0;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
callq 0x41d0
movslq %eax, %r14
leaq (%rbx,%r14), %rsi
addq $-0x7, %rsi
leaq 0x65372(%rip), %rdi     # 0x783fd
callq 0x4520
testl %eax, %eax
je 0x13129
addq %rbx, %r14
addq $-0x4, %r14
leaq 0x6535f(%rip), %rdi     # 0x78405
movq %r14, %rsi
callq 0x4520
testl %eax, %eax
je 0x1312d
leaq 0x65351(%rip), %rdi     # 0x7840a
movq %r14, %rsi
callq 0x4520
testl %eax, %eax
je 0x13131
movzbl (%rbx), %eax
subl $0x2d, %eax
jne 0x130d1
movzbl 0x1(%rbx), %eax
negl %eax
testl %eax, %eax
je 0x13135
leaq 0x67448(%rip), %rsi     # 0x7a526
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe19b
testq %rax, %rax
je 0x13138
movq %rax, %r14
movq %rsp, %rdx
movq %rax, %rdi
movq %rbx, %rsi
callq 0xf79d
movq %r14, %rdi
testl %eax, %eax
js 0x13143
callq 0xd8ee
xorl %ebp, %ebp
testl %eax, %eax
js 0x13138
movl 0x4(%rsp), %eax
cmpl $0x9, %eax
je 0x1314c
cmpl $0x8, %eax
jne 0x13138
cmpl $0x1, 0xc(%rsp)
pushq $0x3
jmp 0x13153
pushq $0x3
jmp 0x13137
pushq $0x2
jmp 0x13137
pushq $0x5
jmp 0x13137
pushq $0x8
popq %rbp
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
callq 0xd94c
xorl %ebp, %ebp
jmp 0x13138
cmpl $0x1, 0xc(%rsp)
pushq $0x5
popq %rbp
sbbl $0x0, %ebp
jmp 0x13138
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_check_EOF
int hts_check_EOF(htsFile *fp)
{
    if (fp->format.compression == bgzf)
        return bgzf_check_EOF(hts_get_bgzfp(fp));
    else if (fp->format.format == cram)
        return cram_check_EOF(fp->fp.cram);
    else
        return 3;
}

// Assembly:
cmpl $0x2, 0x54(%rdi)
jne 0x1316b
testb $0x10, (%rdi)
jne 0x1317a
xorl %edi, %edi
jmp 0xbedd
cmpl $0x6, 0x4c(%rdi)
jne 0x13183
movq 0x38(%rdi), %rdi
jmp 0x45cd3
movq 0x38(%rdi), %rdi
jmp 0xbedd
pushq $0x3
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_idx_init
hts_idx_t *hts_idx_init(int n, int fmt, uint64_t offset0, int min_shift, int n_lvls)
{
    hts_idx_t *idx;
    idx = (hts_idx_t*)calloc(1, sizeof(hts_idx_t));
    if (idx == NULL) return NULL;
    idx->fmt = fmt;
    idx->min_shift = min_shift;
    idx->n_lvls = n_lvls;
    idx->n_bins = ((1<<(3 * n_lvls + 3)) - 1) / 7;
    idx->z.save_tid = idx->z.last_tid = -1;
    idx->z.save_bin = idx->z.last_bin = 0xffffffffu;
    idx->z.save_off = idx->z.last_off = idx->z.off_beg = idx->z.off_end = offset0;
    idx->z.last_coor = 0xffffffffu;
    if (n) {
        idx->n = idx->m = n;
        idx->bidx = (bidx_t**)calloc(n, sizeof(bidx_t*));
        if (idx->bidx == NULL) { free(idx); return NULL; }
        idx->lidx = (lidx_t*) calloc(n, sizeof(lidx_t));
        if (idx->lidx == NULL) { free(idx->bidx); free(idx); return NULL; }
    }
    idx->tbi_n = -1;
    idx->last_tbi_tid = -1;
    idx->otf_fp = NULL;
    return idx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r15d
movl %ecx, %r12d
movq %rdx, %r14
movl %esi, %r13d
movl %edi, %ebp
pushq $0x1
popq %rdi
movl $0xa0, %esi
callq 0x4300
testq %rax, %rax
je 0x13251
movq %rax, %rbx
movl %r13d, (%rax)
leal (%r15,%r15,2), %ecx
addb $0x3, %cl
pushq $-0x1
popq %rax
shll %cl, %eax
movl %r12d, 0x4(%rbx)
movl %r15d, 0x8(%rbx)
notl %eax
pushq $0x7
popq %rcx
xorl %edx, %edx
divl %ecx
movl %eax, 0xc(%rbx)
orq $-0x1, 0x58(%rbx)
orq $-0x1, 0x48(%rbx)
movq %r14, 0x80(%rbx)
movq %r14, 0x78(%rbx)
movq %r14, 0x68(%rbx)
movq %r14, 0x70(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x50(%rbx)
testl %ebp, %ebp
je 0x1323a
movl %ebp, 0x18(%rbx)
movl %ebp, 0x14(%rbx)
movslq %ebp, %r15
pushq $0x8
popq %rsi
movq %r15, %rdi
callq 0x4300
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x13249
movq %rax, %r14
pushq $0x18
popq %rsi
movq %r15, %rdi
callq 0x4300
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x13241
orq $-0x1, 0x40(%rbx)
jmp 0x13253
movq %r14, %rdi
callq 0x45c0
movq %rbx, %rdi
callq 0x45c0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: insert_to_b
static inline int insert_to_b(bidx_t *b, int bin, uint64_t beg, uint64_t end)
{
    khint_t k;
    bins_t *l;
    int absent;
    k = kh_put(bin, b, bin, &absent);
    if (absent < 0) return -1; // Out of memory
    l = &kh_value(b, k);
    if (absent) {
        l->m = 1; l->n = 0;
        l->list = (hts_pair64_t*)calloc(l->m, sizeof(hts_pair64_t));
        if (!l->list) {
            kh_del(bin, b, k);
            return -1;
        }
    } else if (l->n == l->m) {
        uint32_t new_m = l->m ? l->m << 1 : 1;
        hts_pair64_t *new_list = realloc(l->list, new_m * sizeof(hts_pair64_t));
        if (!new_list) return -1;
        l->list = new_list;
        l->m = new_m;
    }
    l->list[l->n].u = beg;
    l->list[l->n++].v = end;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
leaq 0x4(%rsp), %r13
movq %r13, %rdx
callq 0x18097
movl %eax, %r12d
movl (%r13), %eax
pushq $-0x1
popq %rbp
testl %eax, %eax
js 0x13712
movl %r12d, %ecx
imulq $0x18, %rcx, %r13
addq 0x20(%r15), %r13
testl %eax, %eax
je 0x136ac
movq $0x1, (%r13)
pushq $0x1
popq %rdi
pushq $0x10
popq %rsi
callq 0x4300
movq %rax, 0x10(%r13)
testq %rax, %rax
je 0x136e6
xorl %ecx, %ecx
jmp 0x136f7
movl 0x4(%r13), %ecx
cmpl (%r13), %ecx
jne 0x136f3
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
pushq $0x1
popq %r15
cmovnel %eax, %r15d
movq 0x10(%r13), %rdi
movq %r15, %rsi
shlq $0x4, %rsi
callq 0x4840
testq %rax, %rax
je 0x13712
movq %rax, 0x10(%r13)
movl %r15d, (%r13)
movl 0x4(%r13), %ecx
jmp 0x136f7
movq %r15, %rdi
movl %r12d, %esi
callq 0x181f9
jmp 0x13712
movq 0x10(%r13), %rax
movslq %ecx, %rcx
movq %rcx, %rdx
shlq $0x4, %rdx
movq %r14, (%rax,%rdx)
incl %ecx
movl %ecx, 0x4(%r13)
movq %rbx, 0x8(%rax,%rdx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: update_loff
static void update_loff(hts_idx_t *idx, int i, int free_lidx)
{
    bidx_t *bidx = idx->bidx[i];
    lidx_t *lidx = &idx->lidx[i];
    khint_t k;
    int l;
    // the last entry is always valid
    for (l=lidx->n-2; l >= 0; l--) {
        if (lidx->offset[l] == (uint64_t)-1)
            lidx->offset[l] = lidx->offset[l+1];
    }
    if (bidx == 0) return;
    for (k = kh_begin(bidx); k != kh_end(bidx); ++k) // set loff
        if (kh_exist(bidx, k))
        {
            if ( kh_key(bidx, k) < idx->n_bins )
            {
                int bot_bin = hts_bin_bot(kh_key(bidx, k), idx->n_lvls);
                // disable linear index if bot_bin out of bounds
                kh_val(bidx, k).loff = bot_bin < lidx->n ? lidx->offset[bot_bin] : 0;
            }
            else
                kh_val(bidx, k).loff = 0;
        }
    if (free_lidx) {
        free(lidx->offset);
        lidx->m = lidx->n = 0;
        lidx->offset = 0;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movslq %esi, %rax
movq 0x28(%rdi), %rcx
movq 0x30(%rdi), %rsi
movq (%rcx,%rax,8), %r12
imulq $0x18, %rax, %rax
leaq (%rsi,%rax), %r15
movl (%rsi,%rax), %eax
addl $-0x2, %eax
testl %eax, %eax
js 0x1376d
movq 0x10(%r15), %rcx
movl %eax, %r8d
cmpq $-0x1, (%rcx,%r8,8)
jne 0x13769
movq 0x8(%rcx,%r8,8), %rsi
movq %rsi, (%rcx,%r8,8)
decl %eax
jmp 0x1374e
testq %r12, %r12
je 0x13849
movl %edx, 0xc(%rsp)
movl (%r12), %edx
xorl %ebx, %ebx
pushq $0x2
popq %r14
xorl %r13d, %r13d
movq %r15, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
cmpl %ebx, %edx
je 0x1382d
movq 0x10(%r12), %rax
movl %ebx, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %r13d, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x1381d
movq 0x18(%r12), %rax
movl (%rax,%rbx,4), %ebp
cmpl 0xc(%rdi), %ebp
jae 0x13804
movl 0x8(%rdi), %r15d
movl %ebp, %edi
callq 0x184dd
movl %eax, %esi
leal (%rsi,%rsi,2), %ecx
pushq $-0x1
popq %rax
shll %cl, %eax
notl %eax
xorl %edx, %edx
pushq $0x7
popq %rcx
divl %ecx
subl %eax, %ebp
subl %esi, %r15d
leal (%r15,%r15,2), %ecx
movq 0x20(%rsp), %r15
shll %cl, %ebp
movslq %ebp, %rax
cmpq %rax, (%r15)
jle 0x13808
movq 0x10(%r15), %rcx
movq (%rcx,%rax,8), %rax
jmp 0x1380a
xorl %eax, %eax
jmp 0x13814
xorl %eax, %eax
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rdx
movq 0x20(%r12), %rcx
movq %rax, (%rcx,%r14,4)
addl $0x2, %r13d
incq %rbx
addq $0x6, %r14
jmp 0x13796
cmpl $0x0, 0xc(%rsp)
je 0x13849
movq 0x10(%r15), %rdi
callq 0x45c0
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
andq $0x0, 0x10(%r15)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1390e
movq %rcx, %r8
movq %rdx, %r10
imull $0x3, 0x8(%rdi), %ecx
addl 0x4(%rdi), %ecx
pushq $0x1
popq %rdx
shlq %cl, %rdx
cmpq %r10, %rdx
setge %cl
cmpq %r8, %rdx
setge %dl
testb %dl, %cl
jne 0x1390e
pushq %rax
movl (%rdi), %eax
cmpq $0x3, %rax
ja 0x138da
leaq 0x63fe7(%rip), %rcx     # 0x77880
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x64b66(%rip), %rsi     # 0x7840f
leaq 0x64b73(%rip), %rdx     # 0x78423
pushq $0x1
popq %rdi
movq %r10, %rcx
xorl %eax, %eax
callq 0x110c6
jmp 0x138fc
leaq 0x64ceb(%rip), %r9      # 0x785b1
jmp 0x138e1
leaq 0x65070(%rip), %r9      # 0x7893f
jmp 0x138e1
leaq 0x64ccf(%rip), %r9      # 0x785a7
jmp 0x138e1
leaq 0x63913(%rip), %r9      # 0x771f4
leaq 0x64b27(%rip), %rsi     # 0x7840f
leaq 0x64ba2(%rip), %rdx     # 0x78491
pushq $0x1
popq %rdi
movq %r10, %rcx
xorl %eax, %eax
callq 0x110c6
callq 0x4050
movl $0x22, (%rax)
pushq $-0x1
popq %rax
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x13de4
movl %esi, %ebp
testl %esi, %esi
js 0x13de4
cmpl %ebp, 0x44(%rbx)
je 0x13de4
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 0x13de9
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 0x13dec
movl 0x40(%rbx), %eax
jmp 0x13dec
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/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 0x13e28
callq 0x4050
movl $0x16, (%rax)
jmp 0x13e77
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %rdi
callq 0x41d0
leaq 0x5(%rax), %rsi
pushq $0x1
popq %rdi
callq 0x4300
testq %rax, %rax
je 0x13e77
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x4460
testl %ebx, %ebx
je 0x13e8e
cmpl $0x2, %ebx
je 0x13e7c
cmpl $0x1, %ebx
jne 0x13ed6
movq %r12, %rdi
callq 0x41d0
movl $0x6961622e, (%r12,%rax) # imm = 0x6961622E
jmp 0x13e9e
pushq $-0x1
popq %rax
jmp 0x13ecd
movq %r12, %rdi
callq 0x41d0
movl $0x6962742e, (%r12,%rax) # imm = 0x6962742E
jmp 0x13e9e
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 0x13edb
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_O2/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 0x13f34
cmpl $0x1, %ebx
leaq 0x61640(%rip), %rax     # 0x75536
leaq 0x65844(%rip), %rsi     # 0x79741
cmoveq %rax, %rsi
movq %rdx, %rdi
callq 0x9596
testq %rax, %rax
je 0x13f5c
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
movl %ebx, %edx
callq 0x13f6a
testl %eax, %eax
js 0x13f48
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xbc96
movq %r15, %rdi
movl %ebx, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x13e03
callq 0x4050
movq %rax, %rbx
movl (%rax), %ebp
movq %r14, %rdi
callq 0xbc96
movl %ebp, (%rbx)
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x612ad(%rip), %rcx     # 0x75536
leaq 0x654b1(%rip), %rsi     # 0x79741
cmoveq %rcx, %rsi
movq %rax, %rdi
callq 0x9596
movq %rax, 0x98(%rbx)
testq %rax, %rax
je 0x142ea
movq %rbx, %rdi
movq %rax, %rsi
movl %ebp, %edx
callq 0x13f6a
testl %eax, %eax
js 0x142c9
movq 0x98(%rbx), %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0xb609
callq 0x4050
movq %rax, %r14
movl (%rax), %ebp
movq 0x98(%rbx), %rdi
callq 0xbc96
andq $0x0, 0x98(%rbx)
movl %ebp, (%r14)
pushq $-0x1
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x14330
movl %ebp, %r15d
leaq 0x1(%r15), %rdi
callq 0x4680
testq %rax, %rax
je 0x14344
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
callq 0x45c0
movl %ebp, 0x10(%rbx)
movq %r14, 0x38(%rbx)
xorl %eax, %eax
jmp 0x14347
pushq $-0x1
popq %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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)
testq %rdi, %rdi
je 0x143cc
movq %rdi, %r12
movslq 0x14(%rdi), %rbx
testq %rbx, %rbx
je 0x143cc
movq %rdx, %r15
movq %rsi, 0x8(%rsp)
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x4300
movq %rax, %r13
xorl %ebp, %ebp
xorl %r14d, %r14d
movslq %ebx, %rax
cmpq %rax, %rbp
jge 0x143d4
movq 0x28(%r12), %rax
cmpq $0x0, (%rax,%rbp,8)
je 0x143c7
movq 0x10(%rsp), %rdi
movl %ebp, %esi
callq *%r15
movslq %r14d, %rcx
incl %r14d
movq %rax, (%r13,%rcx,8)
movl 0x14(%r12), %ebx
incq %rbp
jmp 0x14399
xorl %r14d, %r14d
xorl %r13d, %r13d
jmp 0x143d9
movq 0x8(%rsp), %rsi
movl %r14d, (%rsi)
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_O2/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:
pushq $-0x1
popq %rax
testq %rdi, %rdi
je 0x14446
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
cmpl $0x3, (%rdi)
je 0x14435
movq 0x28(%rdi), %rcx
movslq %esi, %rdx
movq (%rcx,%rdx,8), %r15
testq %r15, %r15
je 0x14441
movl 0xc(%rdi), %esi
incl %esi
movq %r15, %rdi
callq 0x14465
cmpl (%r15), %eax
jne 0x14447
andq $0x0, (%r14)
pushq $-0x1
popq %rax
xorl %ecx, %ecx
movq %rcx, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
movq 0x20(%r15), %rcx
movl %eax, %eax
imulq $0x18, %rax, %rax
movq 0x10(%rcx,%rax), %rax
movq 0x10(%rax), %rcx
movq %rcx, (%r14)
movq 0x18(%rax), %rcx
xorl %eax, %eax
jmp 0x1443e
// File: /workspace/github_c_makefile_star2_O2/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 0x14dc1
pushq %rbx
movq %rdi, %rbx
testb $0x10, (%rdi)
jne 0x14dc2
movq 0x88(%rbx), %rdi
callq 0x45c0
jmp 0x14dce
retq
movq 0x28(%rbx), %rdi
movl 0x10(%rbx), %esi
callq 0x1d2dd
movq 0x60(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x3a
popq %rsi
callq 0x4530
testq %rax, %rax
je 0x164be
movq %rax, %r15
leaq 0x1(%rax), %rdi
leaq 0x8(%rsp), %r13
pushq $0x1
popq %rdx
movq %r13, %rsi
callq 0x15c0a
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 0x164b0
cmpl $0x2d, %ecx
jne 0x164d0
incq %rdi
pushq $0x1
popq %rdx
xorl %esi, %esi
callq 0x15c0a
movq %rax, %r12
movq %r12, (%r14)
xorl %eax, %eax
cmpq %r12, (%rbx)
cmovlq %r15, %rax
jmp 0x164d0
andq $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_O2/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
leaq 0x10(%rsp), %r12
andq $0x0, (%r12)
leaq 0x8(%rsp), %rdx
andq $0x0, (%rdx)
movq %r12, %rsi
callq 0x16439
movq (%r12), %rcx
movl $0x80000000, %edx       # imm = 0x80000000
cmpq %rdx, %rcx
jl 0x16534
leaq 0x62264(%rip), %rsi     # 0x78783
leaq 0x6226b(%rip), %rdx     # 0x78791
xorl %ebx, %ebx
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
jmp 0x16576
movq %rax, %rbx
movq 0x8(%rsp), %rax
cmpq %rdx, %rax
jl 0x1656d
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movabsq $0x7fffffff7fffffff, %rsi # imm = 0x7FFFFFFF7FFFFFFF
cmpq %rsi, %rax
je 0x16570
leaq 0x62227(%rip), %rsi     # 0x78783
leaq 0x6222e(%rip), %rdx     # 0x78791
xorl %ebx, %ebx
pushq $0x1
popq %rdi
movq %rax, %rcx
jmp 0x1652b
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_O2/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 0x165b4
cmpl $0x2e, %eax
jne 0x165ba
cmpb $0x0, 0x1(%rsi)
jne 0x165ba
pushq $-0x3
jmp 0x1660a
cmpb $0x0, 0x1(%rsi)
je 0x16608
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 0x15efd
testq %rax, %rax
je 0x165fc
movl 0xc(%rsp), %esi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq %r14, %rdi
movq %rbx, %r8
callq *%r15
jmp 0x165fe
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
pushq $-0x2
popq %rsi
movq %r14, %rdi
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_O2/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), %eax
movl 0x10(%rsi), %ecx
testl %eax, %eax
js 0x1679e
testl %ecx, %ecx
jns 0x167a6
pushq $-0x1
jmp 0x167a4
testl %ecx, %ecx
js 0x167a6
pushq $0x1
popq %rax
retq
subl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq %r15, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0xe50b
testq %rax, %rax
je 0x17393
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
movq %rax, %rdi
movl %ebp, %ecx
callq 0x176d3
cmpl $-0x1, %eax
jne 0x17373
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rdx
movq %r15, %rsi
movq %r14, %rcx
callq 0xe50b
testq %rax, %rax
je 0x17393
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
movq %rax, %rdi
movl %ebp, %ecx
callq 0x176d3
testl %eax, %eax
js 0x17393
movq 0x8(%rsp), %rsi
movslq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x4830
movb $0x0, (%rbx,%r14)
jmp 0x1739f
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_O2/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 0x17f50
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 0x17f53
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 0x17fd6
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 0x17fd6
movq (%rbx), %rdi
movq %rax, %rsi
callq 0x4840
testq %rax, %rax
je 0x17fe3
movq %rax, %r13
testl %ebp, %ebp
je 0x17fc1
movq %r14, %rdx
subq %r12, %rdx
jbe 0x17fc1
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 0x17fe8
callq 0x4050
movl (%rax), %edi
callq 0x4150
leaq 0x609e8(%rip), %rsi     # 0x789de
leaq 0x6242c(%rip), %rdx     # 0x7a429
pushq $0x1
popq %rbx
movl %ebx, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0x110c6
movl %ebx, %edi
callq 0x45e0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: add_to_interval
static inline int add_to_interval(hts_itr_t *iter, bins_t *bin,
                                  int tid, uint32_t interval,
                                  uint64_t min_off, uint64_t max_off)
{
    hts_pair64_max_t *off;
    int j;

    if (!bin->n)
        return 0;
    off = realloc(iter->off, (iter->n_off + bin->n) * sizeof(*off));
    if (!off)
        return -2;

    iter->off = off;
    for (j = 0; j < bin->n; ++j) {
        if (bin->list[j].v > min_off && bin->list[j].u < max_off) {
            iter->off[iter->n_off].u = min_off > bin->list[j].u
                ? min_off : bin->list[j].u;
            iter->off[iter->n_off].v = max_off < bin->list[j].v
                ? max_off : bin->list[j].v;
            // hts_pair64_max_t::max is now used to link
            // file offsets to region list entries.
            // The iterator can use this to decide if it
            // can skip some file regions.
            iter->off[iter->n_off].max = ((uint64_t) tid << 32) | interval;
            iter->n_off++;
        }
    }
    return 0;
}

// Assembly:
movslq 0x4(%rsi), %rax
testq %rax, %rax
je 0x189ca
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r14
movl %ecx, %ebp
movl %edx, %r13d
movq %rsi, %r15
movq %rdi, %r12
movq 0x60(%rdi), %rdi
movslq 0x8(%r12), %rcx
addq %rax, %rcx
imulq $0x18, %rcx, %rsi
callq 0x4840
testq %rax, %rax
je 0x189ce
movq %rax, 0x60(%r12)
movl 0x4(%r15), %edx
shlq $0x20, %r13
movl %ebp, %esi
orq %r13, %rsi
xorl %ecx, %ecx
testl %edx, %edx
cmovlel %ecx, %edx
shlq $0x4, %rdx
xorl %edi, %edi
cmpq %rdi, %rdx
je 0x189d1
movq 0x10(%r15), %r9
movq 0x8(%r9,%rdi), %r8
cmpq %r14, %r8
jbe 0x189c4
movq (%r9,%rdi), %r9
cmpq %rbx, %r9
jae 0x189c4
cmpq %r14, %r9
cmovbeq %r14, %r9
movslq 0x8(%r12), %r10
imulq $0x18, %r10, %r11
movq %r9, (%rax,%r11)
cmpq %rbx, %r8
cmovaeq %rbx, %r8
movq %r8, 0x8(%rax,%r11)
movq %rsi, 0x10(%rax,%r11)
leal 0x1(%r10), %r8d
movl %r8d, 0x8(%r12)
addq $0x10, %rdi
jmp 0x1897a
xorl %ecx, %ecx
jmp 0x189df
pushq $-0x2
popq %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rdi
movl $0x298, %esi            # imm = 0x298
callq 0x4300
testq %rax, %rax
je 0x18cea
movq %rax, %rbx
movq %r14, %rdi
callq 0x41d0
leaq 0x64(%rax), %rdi
callq 0x4680
movq %rax, (%rbx)
testq %rax, %rax
je 0x18ce2
movq %rax, %rdi
movq %r14, %rsi
callq 0x4460
jmp 0x18cec
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_O2/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 0x18d3a
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
xorl %r15d, %r15d
movslq 0x10(%rbx), %rax
cmpq %rax, %r15
jge 0x18d25
movq %r14, %rdi
callq 0x44c0
incq %r15
addq $0x40, %r14
jmp 0x18d0b
movq (%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x18d50
cmpq $0x0, 0x10(%rcx)
jne 0x18d50
cmpq $0x0, 0x18(%rcx)
je 0x18d6e
pushq %rax
leaq 0x5fff8(%rip), %rsi     # 0x78d50
leaq 0x60001(%rip), %rdx     # 0x78d60
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
pushq $-0x1
popq %rax
popq %rcx
retq
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rcx)
movups %xmm0, (%rcx)
andq $0x0, 0x20(%rcx)
jmp 0x18d7f