LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_close
int hts_close(htsFile *fp)
{
    int ret, save;

    switch (fp->format.format) {
    case binary_format:
    case bam:
    case bcf:
        ret = bgzf_close(fp->fp.bgzf);
        break;

    case cram:
        if (!fp->is_write) {
            switch (cram_eof(fp->fp.cram)) {
            case 2:
                fprintf(stderr, "[W::%s] EOF marker is absent. The input is probably truncated.\n", __func__);
                break;
            case 0:  /* not at EOF, but may not have wanted all seqs */
            default: /* case 1, expected EOF */
                break;
            }
        }
        ret = cram_close(fp->fp.cram);
        break;

    case text_format:
    case sam:
    case vcf:
        if (!fp->is_write) {
        #if KS_BGZF
            BGZF *gzfp = ((kstream_t*)fp->fp.voidp)->f;
            ret = bgzf_close(gzfp);
        #else
            gzFile gzfp = ((kstream_t*)fp->fp.voidp)->f;
            ret = gzclose(gzfp);
        #endif
            ks_destroy((kstream_t*)fp->fp.voidp);
        }
        else if (fp->format.compression != no_compression)
            ret = bgzf_close(fp->fp.bgzf);
        else
            ret = hclose(fp->fp.hfile);
        break;

    default:
        ret = -1;
        break;
    }

    save = errno;
    free(fp->fn);
    free(fp->fn_aux);
    free(fp->line.s);
    free(fp);
    errno = save;
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x44(%rdi), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x9, %eax
ja 0xfdad
movl $0x10c, %ecx            # imm = 0x10C
btl %eax, %ecx
jb 0xfd5a
movl $0x212, %ecx            # imm = 0x212
btl %eax, %ecx
jae 0xfd79
movq 0x38(%rbx), %rdi
jmp 0xfda6
testb $0x2, (%rbx)
jne 0xfd9c
movq 0x38(%rbx), %rax
movq 0x18(%rax), %rdi
callq 0x441e8
movl %eax, %ebp
movq 0x38(%rbx), %rdi
callq 0xd971
jmp 0xfdad
cmpl $0x6, %eax
jne 0xfdad
testb $0x2, (%rbx)
jne 0xfd91
movq 0x38(%rbx), %rdi
callq 0x388f5
cmpl $0x2, %eax
je 0xfdf2
movq 0x38(%rbx), %rdi
callq 0x38666
jmp 0xfdab
cmpl $0x0, 0x4c(%rbx)
movq 0x38(%rbx), %rdi
je 0xfdeb
callq 0x441e8
movl %eax, %ebp
callq 0x4070
movq %rax, %r14
movl (%rax), %r15d
movq 0x28(%rbx), %rdi
callq 0x4610
movq 0x30(%rbx), %rdi
callq 0x4610
movq 0x20(%rbx), %rdi
callq 0x4610
movq %rbx, %rdi
callq 0x4610
movl %r15d, (%r14)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x4745b
jmp 0xfdab
callq 0x4da4
jmp 0xfd91
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_set_threads
int hts_set_threads(htsFile *fp, int n)
{
    if (fp->format.compression == bgzf) {
        return bgzf_mt(hts_get_bgzfp(fp), n, 256);
    } else if (fp->format.format == cram) {
        return hts_set_opt(fp, CRAM_OPT_NTHREADS, n);
    }
    else return 0;
}

// Assembly:
movl %esi, %edx
cmpl $0x2, 0x4c(%rdi)
jne 0xfe54
leaq 0x38(%rdi), %rax
testb $0x1, (%rdi)
jne 0xfe45
movq (%rax), %rax
addq $0x18, %rax
movq (%rax), %rdi
movl %edx, %esi
movl $0x100, %edx            # imm = 0x100
jmp 0x43a00
cmpl $0x6, 0x44(%rdi)
jne 0xfe66
movl $0xe, %esi
xorl %eax, %eax
jmp 0xfa59
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
callq 0x4610
testq %r14, %r14
je 0xfead
movq %r14, %rdi
callq 0x49c0
movq %rax, 0x30(%rbx)
testq %rax, %rax
jne 0xfeb7
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xfedd
movq $0x0, 0x30(%rbx)
xorl %eax, %eax
cmpl $0x6, 0x44(%rbx)
jne 0xfedb
movq 0x38(%rbx), %rdi
movl $0x9, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x388fc
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0xfedd
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_useek
int hts_useek(htsFile *fp, long uoffset, int where)
{
    if ( fp->is_bin )
        return bgzf_useek(fp->fp.bgzf, uoffset, where);
    else
    {
        ks_rewind((kstream_t*)fp->fp.voidp);
        ((kstream_t*)fp->fp.voidp)->seek_pos = uoffset;
        return bgzf_useek(((kstream_t*)fp->fp.voidp)->f, uoffset, where);
    }
}

// Assembly:
movq 0x38(%rdi), %rax
testb $0x1, (%rdi)
jne 0xff11
xorl %ecx, %ecx
movl %ecx, 0x4(%rax)
movq 0x38(%rdi), %rax
movl %ecx, (%rax)
movq 0x38(%rdi), %rax
andl $-0x4, 0x8(%rax)
movq 0x38(%rdi), %rax
movq %rsi, 0x10(%rax)
movq 0x38(%rdi), %rax
movq 0x18(%rax), %rax
movq %rax, %rdi
jmp 0x44e67
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_getline
int hts_getline(htsFile *fp, int delimiter, kstring_t *str)
{
    int ret, dret;
    ret = ks_getuntil((kstream_t*)fp->fp.voidp, delimiter, str, &dret);
    ++fp->lineno;
    return ret;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
leaq 0xc(%rsp), %rcx
xorl %r8d, %r8d
callq 0xd98d
incq 0x8(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/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_format(f, &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 %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
callq 0x4230
movslq %eax, %r14
leaq (%rbx,%r14), %rsi
addq $-0x7, %rsi
leaq 0x40abf(%rip), %rdi     # 0x50ea0
callq 0x4590
testl %eax, %eax
je 0x1047f
addq %rbx, %r14
addq $-0x4, %r14
leaq 0x40aac(%rip), %rdi     # 0x50ea8
movq %r14, %rsi
callq 0x4590
testl %eax, %eax
je 0x10486
leaq 0x40a9e(%rip), %rdi     # 0x50ead
movq %r14, %rsi
callq 0x4590
testl %eax, %eax
je 0x1048d
movzbl (%rbx), %eax
subl $0x2d, %eax
jne 0x10427
movzbl 0x1(%rbx), %eax
negl %eax
testl %eax, %eax
je 0x10494
leaq 0x4150d(%rip), %rsi     # 0x51941
movq %rbx, %rdi
callq 0x477e9
testq %rax, %rax
je 0x104a0
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0xe2bd
movq %rbx, %rdi
testl %eax, %eax
js 0x1049b
callq 0x4745b
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
js 0x104b1
movl 0xc(%rsp), %ecx
cmpl $0x9, %ecx
je 0x104a4
cmpl $0x8, %ecx
jne 0x104b1
cmpl $0x1, 0x14(%rsp)
movl $0x3, %eax
jmp 0x104ae
movl $0x3, %eax
jmp 0x104b1
movl $0x2, %eax
jmp 0x104b1
movl $0x5, %eax
jmp 0x104b1
movl $0x8, %eax
jmp 0x104b1
callq 0x474b5
xorl %eax, %eax
jmp 0x104b1
cmpl $0x1, 0x14(%rsp)
movl $0x5, %eax
sbbl $0x0, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/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, 0x4c(%rdi)
jne 0x104d7
leaq 0x38(%rdi), %rax
testb $0x1, (%rdi)
jne 0x104cf
movq (%rax), %rax
addq $0x18, %rax
movq (%rax), %rdi
jmp 0x4454c
cmpl $0x6, 0x44(%rdi)
jne 0x104e6
movq 0x38(%rdi), %rdi
jmp 0x39002
movl $0x3, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/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_bin = idx->z.save_tid = idx->z.last_tid = 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; }
    }
    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
movl $0x1, %edi
movl $0x88, %esi
callq 0x4360
testq %rax, %rax
je 0x10e8b
movq %rax, %rbx
movl %r13d, (%rax)
movl %r12d, 0x4(%rax)
movl %r15d, 0x8(%rax)
leal (%r15,%r15,2), %ecx
addb $0x3, %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
shll %cl, %edx
notl %edx
movl $0x92492493, %ecx       # imm = 0x92492493
imulq %rdx, %rcx
shrq $0x22, %rcx
movl %ecx, 0xc(%rbx)
movl %eax, 0x50(%rbx)
movq %r14, 0x70(%rbx)
movq %r14, 0x68(%rbx)
movq %r14, 0x58(%rbx)
movq %r14, 0x60(%rbx)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x40(%rbx)
testl %ebp, %ebp
je 0x10e8d
movl %ebp, 0x18(%rbx)
movl %ebp, 0x14(%rbx)
movslq %ebp, %r15
movl $0x8, %esi
movq %r15, %rdi
callq 0x4360
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x10e83
movq %rax, %r14
movl $0x10, %esi
movq %r15, %rdi
callq 0x4360
movq %rax, 0x30(%rbx)
testq %rax, %rax
jne 0x10e8d
movq %r14, %rdi
callq 0x4610
movq %rbx, %rdi
callq 0x4610
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_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/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 0x11e04
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpl $0x3, (%rdi)
jne 0x11e05
movq 0x8(%rbx), %rdi
callq 0x2f375
jmp 0x11eca
retq
cmpl $0x0, 0x18(%rbx)
jle 0x11eaf
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rcx
movq (%rax,%r15,8), %r14
movq %r15, %rax
shlq $0x4, %rax
movq 0x8(%rcx,%rax), %rdi
callq 0x4610
testq %r14, %r14
je 0x11e9f
movl (%r14), %eax
testl %eax, %eax
je 0x11e7c
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x10(%r14), %rcx
movl %r12d, %edx
shrl $0x4, %edx
movl (%rcx,%rdx,4), %edx
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %edx
testb $0x3, %dl
jne 0x11e71
movq 0x20(%r14), %rax
movl %r12d, %ecx
leaq (%rcx,%rcx,2), %rcx
movq 0x10(%rax,%rcx,8), %rdi
callq 0x4610
movl (%r14), %eax
incl %r12d
addl $0x2, %ebp
cmpl %eax, %r12d
jne 0x11e40
movq 0x18(%r14), %rdi
callq 0x4610
movq 0x10(%r14), %rdi
callq 0x4610
movq 0x20(%r14), %rdi
callq 0x4610
movq %r14, %rdi
callq 0x4610
incq %r15
movslq 0x18(%rbx), %rax
cmpq %rax, %r15
jl 0x11e12
movq 0x28(%rbx), %rdi
callq 0x4610
movq 0x30(%rbx), %rdi
callq 0x4610
movq 0x38(%rbx), %rdi
callq 0x4610
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4610
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_idx_save
int hts_idx_save(const hts_idx_t *idx, const char *fn, int fmt)
{
    int ret, save;
    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
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r12
movq %rsi, %rdi
callq 0x4230
leaq 0x5(%rax), %rsi
movl $0x1, %edi
callq 0x4360
testq %rax, %rax
je 0x11f33
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x44e0
testl %ebx, %ebx
je 0x11f4c
cmpl $0x2, %ebx
je 0x11f3a
cmpl $0x1, %ebx
jne 0x11f94
movq %r15, %rdi
callq 0x4230
movl $0x6961622e, (%r15,%rax) # imm = 0x6961622E
jmp 0x11f5c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x11f8b
movq %r15, %rdi
callq 0x4230
movl $0x6962742e, (%r15,%rax) # imm = 0x6962742E
jmp 0x11f5c
movq %r15, %rdi
callq 0x4230
movl $0x6973632e, (%r15,%rax) # imm = 0x6973632E
movb $0x0, 0x4(%r15,%rax)
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %ebx, %ecx
callq 0x11f99
movl %eax, %ebx
callq 0x4070
movq %rax, %r14
movl (%rax), %ebp
movq %r15, %rdi
callq 0x4610
movl %ebp, (%r14)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x42e0
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_idx_set_meta
void hts_idx_set_meta(hts_idx_t *idx, int l_meta, uint8_t *meta, int is_copy)
{
    if (idx->meta) free(idx->meta);
    idx->l_meta = l_meta;
    if (is_copy) {
        idx->meta = (uint8_t*)malloc(l_meta);
        memcpy(idx->meta, meta, l_meta);
    } else idx->meta = meta;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %r15d
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x123b1
callq 0x4610
movl %ebp, 0x10(%r14)
testl %r15d, %r15d
je 0x123e1
movslq %ebp, %r15
movq %r15, %rdi
callq 0x4700
movq %rax, 0x38(%r14)
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4420
movq %rbx, 0x38(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/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->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
movslq 0x14(%rdi), %rbp
xorl %r14d, %r14d
testq %rbp, %rbp
je 0x12478
movq %rdx, %r15
movq %rdi, %r12
movl $0x8, %esi
movq %rbp, %rdi
callq 0x4360
movq %rax, %r13
testl %ebp, %ebp
jle 0x1247b
movq %rbx, 0x8(%rsp)
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x28(%r12), %rax
cmpq $0x0, (%rax,%rbx,8)
je 0x12466
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 0x12440
movq 0x8(%rsp), %rbx
jmp 0x1247b
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_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/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->fmt == HTS_FMT_CRAI ) {
        *mapped = 0; *unmapped = 0;
        return -1;
    }

    bidx_t *h = idx->bidx[tid];
    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:
movq %rcx, %r8
cmpl $0x3, (%rdi)
jne 0x124ab
movq $0x0, (%rdx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
jmp 0x12563
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x28(%rdi), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %esi
testl %esi, %esi
je 0x12529
movl 0xc(%rdi), %r9d
incl %r9d
leal -0x1(%rsi), %r10d
movl %r10d, %r11d
andl %r9d, %r11d
movq 0x10(%rax), %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 0x1251d
testb $0x1, %r15b
jne 0x1250f
movq 0x18(%rax), %r15
movl %edi, %r12d
cmpl %r9d, (%r15,%r12,4)
je 0x1251d
addl %ebp, %edi
andl %r10d, %edi
incl %ebp
cmpl %r11d, %edi
jne 0x124e1
jmp 0x1252f
shrl %cl, %r14d
testb $0x3, %r14b
cmovnel %esi, %edi
jmp 0x1252b
xorl %edi, %edi
cmpl %esi, %edi
jne 0x1253f
movq $0x0, (%rdx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
jmp 0x1255b
movq 0x20(%rax), %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
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
movq %rcx, (%r8)
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_parse_reg
const char *hts_parse_reg(const char *s, int *beg, int *end)
{
    char *hyphen;
    const char *colon = strrchr(s, ':');
    if (colon == NULL) {
        *beg = 0; *end = INT_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 = INT_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 %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
movl $0x3a, %esi
callq 0x45a0
testq %rax, %rax
je 0x13076
movq %rax, %r15
leaq 0x1(%rax), %rdi
movq %rsp, %r12
movq %r12, %rsi
movl $0x1, %edx
callq 0x12db2
movq %rax, %rcx
decl %ecx
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %ecx
movl %ecx, (%rbx)
movq (%r12), %rdi
movzbl (%rdi), %ecx
testl %ecx, %ecx
je 0x13090
cmpl $0x2d, %ecx
jne 0x130a0
incq %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x12db2
movq %rax, %rcx
jmp 0x13095
movl $0x0, (%rbx)
movl $0x7fffffff, (%r14)     # imm = 0x7FFFFFFF
movq %r12, %rdi
callq 0x4230
addq %r12, %rax
jmp 0x130a0
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, (%r14)
xorl %eax, %eax
cmpl %ecx, (%rbx)
cmovlq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/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, beg, end;
    const char *q;

    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);

    q = hts_parse_reg(reg, &beg, &end);
    if (q) {
        char *tmp = (char*)alloca(q - reg + 1);
        strncpy(tmp, reg, q - reg);
        tmp[q - reg] = 0;
        tid = getid(hdr, tmp);
    }
    else {
        // not parsable as a region, but possibly a sequence named "foo:a"
        tid = getid(hdr, reg);
        beg = 0; end = INT_MAX;
    }

    if (tid < 0) return NULL;
    return itr_query(idx, tid, beg, end, readrec);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r14
movq %r8, %r9
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r15
movzbl (%rsi), %eax
cmpl $0x2a, %eax
je 0x130ed
cmpl $0x2e, %eax
jne 0x130f8
cmpb $0x0, 0x1(%r13)
jne 0x130f8
movq %r15, %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
jmp 0x131a7
cmpb $0x0, 0x1(%r13)
je 0x1319f
movq %rcx, -0x38(%rbp)
movq %r9, -0x48(%rbp)
leaq -0x30(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movq %r13, %rdi
callq 0x1300d
testq %rax, %rax
je 0x1315b
movq %rax, %rbx
subq %r13, %rbx
leaq 0x10(%rbx), %rax
andq $-0x10, %rax
movq %r12, -0x40(%rbp)
movq %r15, %r12
movq %r14, %r15
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x42b0
movb $0x0, (%rbx,%r14)
movq -0x38(%rbp), %rdi
movq %r14, %rsi
movq %r15, %r14
movq %r12, %r15
callq *-0x40(%rbp)
jmp 0x13173
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq *%r12
movl $0x0, -0x30(%rbp)
movl $0x7fffffff, -0x2c(%rbp) # imm = 0x7FFFFFFF
testl %eax, %eax
movq -0x48(%rbp), %r9
js 0x1318e
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %ecx
movq %r15, %rdi
movl %eax, %esi
movq %r14, %r8
callq *%r9
jmp 0x13190
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
xorl %edx, %edx
xorl %ecx, %ecx
movq %r14, %r8
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%r9
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_idx_getfn
char *hts_idx_getfn(const char *fn, const char *ext)
{
    int i, l_fn, l_ext;
    char *fnidx, *ret;
    l_fn = strlen(fn); l_ext = strlen(ext);
    fnidx = (char*)calloc(l_fn + l_ext + 1, 1);
    strcpy(fnidx, fn); strcpy(fnidx + l_fn, ext);
    if ((ret = test_and_fetch(fnidx)) == 0) {
        for (i = l_fn - 1; i > 0; --i)
            if (fnidx[i] == '.') break;
        strcpy(fnidx + i, ext);
        ret = test_and_fetch(fnidx);
    }
    if (ret == 0) {
        free(fnidx);
        return 0;
    }
    l_fn = strlen(ret);
    memmove(fnidx, ret, l_fn + 1);
    return fnidx;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r12
callq 0x4230
movq %rax, %r15
movq %r14, %rdi
callq 0x4230
addl %r15d, %eax
incl %eax
movslq %eax, %rdi
movl $0x1, %esi
callq 0x4360
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
callq 0x44e0
movslq %r15d, %rdi
addq %rbx, %rdi
movq %r14, %rsi
callq 0x44e0
movq %rbx, %rdi
callq 0x1346b
testq %rax, %rax
jne 0x1341c
movl %r15d, %eax
testl %r15d, %r15d
movl $0x1, %ecx
cmovlel %r15d, %ecx
decl %ecx
decq %rax
cmpl $0x2, %r15d
jl 0x133fb
movl %eax, %edx
decl %r15d
decq %rax
cmpb $0x2e, (%rbx,%rdx)
jne 0x133e5
jmp 0x133fe
movl %ecx, %r15d
movslq %r15d, %rax
movq %rbx, %rdi
addq %rax, %rdi
movq %r14, %rsi
callq 0x44e0
movq %rbx, %rdi
callq 0x1346b
testq %rax, %rax
je 0x13455
movq %rax, %r12
movabsq $0x100000000, %r14      # imm = 0x100000000
movq %rax, %rdi
callq 0x4230
shlq $0x20, %rax
addq %rax, %r14
sarq $0x20, %r14
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x48c0
movq %rbx, %rdi
callq 0x4610
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_idx_load
hts_idx_t *hts_idx_load(const char *fn, int fmt)
{
    char *fnidx;
    hts_idx_t *idx;
    fnidx = hts_idx_getfn(fn, ".csi");
    if (! fnidx) fnidx = hts_idx_getfn(fn, fmt == HTS_FMT_BAI? ".bai" : ".tbi");
    if (fnidx == 0) return 0;

    idx = hts_idx_load2(fn, fnidx);
    free(fnidx);
    return idx;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x3d8ec(%rip), %rsi     # 0x50f6b
callq 0x13378
testq %rax, %rax
jne 0x136ab
cmpl $0x1, %ebp
leaq 0x3d8d3(%rip), %rax     # 0x50f66
leaq 0x3d8d6(%rip), %rsi     # 0x50f70
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x13378
testq %rax, %rax
je 0x136cc
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x136d0
movq %rax, %rbx
movq %r14, %rdi
callq 0x4610
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
xorl %eax, %eax
jmp 0x136c7
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_hdr_destroy
void bam_hdr_destroy(bam_hdr_t *h)
{
    int32_t i;
    if (h == NULL) return;
    if (h->target_name) {
        for (i = 0; i < h->n_targets; ++i)
            free(h->target_name[i]);
        free(h->target_name);
        free(h->target_len);
    }
    free(h->text); free(h->cigar_tab);
    if (h->sdict) kh_destroy(s2i, (sdict_t*)h->sdict);
    free(h);
}

// Assembly:
testq %rdi, %rdi
je 0x14109
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0x140da
cmpl $0x0, (%rbx)
jle 0x140cc
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x4610
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x140b0
movq 0x20(%rbx), %rdi
callq 0x4610
movq 0x10(%rbx), %rdi
callq 0x4610
movq 0x28(%rbx), %rdi
callq 0x4610
movq 0x18(%rbx), %rdi
callq 0x4610
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x140fa
callq 0xdc7e
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4610
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_hdr_dup
bam_hdr_t *bam_hdr_dup(const bam_hdr_t *h0)
{
    if (h0 == NULL) return NULL;
    bam_hdr_t *h;
    if ((h = bam_hdr_init()) == NULL) return NULL;
    // copy the simple data
    h->n_targets = h0->n_targets;
    h->ignore_sam_err = h0->ignore_sam_err;
    h->l_text = h0->l_text;
    // Then the pointery stuff
    h->cigar_tab = NULL;
    h->sdict = NULL;
    // TODO Check for memory allocation failures
    h->text = (char*)calloc(h->l_text + 1, 1);
    memcpy(h->text, h0->text, h->l_text);
    h->target_len = (uint32_t*)calloc(h->n_targets, sizeof(uint32_t));
    h->target_name = (char**)calloc(h->n_targets, sizeof(char*));
    int i;
    for (i = 0; i < h->n_targets; ++i) {
        h->target_len[i] = h0->target_len[i];
        h->target_name[i] = strdup(h0->target_name[i]);
    }
    return h;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x141cf
movq %rdi, %r14
movl $0x1, %edi
movl $0x38, %esi
callq 0x4360
testq %rax, %rax
je 0x141cf
movq %rax, %rbx
movq (%r14), %rbp
movq %rbp, (%rax)
movl 0x8(%r14), %r15d
movl %r15d, 0x8(%rax)
leal 0x1(%r15), %edi
movl $0x1, %esi
callq 0x4360
movq %rax, 0x28(%rbx)
movq 0x28(%r14), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x4420
movslq %ebp, %r13
movl $0x4, %esi
movq %r13, %rdi
callq 0x4360
movq %rax, %r15
movq %rax, 0x10(%rbx)
movl $0x8, %esi
movq %r13, %rdi
callq 0x4360
movq %rax, 0x20(%rbx)
testl %r13d, %r13d
jle 0x141d1
movq %rax, %r12
movq %rbx, (%rsp)
movq 0x10(%r14), %r13
movq 0x20(%r14), %r14
movl %ebp, %ebp
xorl %ebx, %ebx
movl (%r13,%rbx,4), %eax
movl %eax, (%r15,%rbx,4)
movq (%r14,%rbx,8), %rdi
callq 0x49c0
movq %rax, (%r12,%rbx,8)
incq %rbx
cmpq %rbx, %rbp
jne 0x141ab
movq (%rsp), %rbx
jmp 0x141d1
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_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_name2id
int bam_name2id(bam_hdr_t *h, const char *ref)
{
    sdict_t *d = (sdict_t*)h->sdict;
    khint_t k;
    if (h->sdict == 0) {
        int i, absent;
        d = kh_init(s2i);
        for (i = 0; i < h->n_targets; ++i) {
            k = kh_put(s2i, d, h->target_name[i], &absent);
            kh_val(d, k) = i;
        }
        h->sdict = d;
    }
    k = kh_get(s2i, d, ref);
    return k == kh_end(d)? -1 : kh_val(d, k);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq 0x30(%rdi), %rbx
testq %rbx, %rbx
jne 0x1472d
movq %rdi, %r15
callq 0xdc6f
movq %rax, %rbx
cmpl $0x0, (%r15)
jle 0x14729
xorl %r13d, %r13d
leaq 0xc(%rsp), %r12
movq 0x20(%r15), %rax
movq (%rax,%r13,8), %rsi
movq %rbx, %rdi
movq %r12, %rdx
callq 0xe06f
movq 0x20(%rbx), %rcx
movl %eax, %eax
movq %r13, (%rcx,%rax,8)
incq %r13
movslq (%r15), %rax
cmpq %rax, %r13
jl 0x14701
movq %rbx, 0x30(%r15)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdce7
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl (%rbx), %ecx
je 0x1474c
movq 0x20(%rbx), %rax
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_dup1
bam1_t *bam_dup1(const bam1_t *bsrc)
{
    if (bsrc == NULL) return NULL;
    bam1_t *bdst = bam_init1();
    if (bdst == NULL) return NULL;
    return bam_copy1(bdst, bsrc);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x1484d
movq %rdi, %r14
movl $0x1, %edi
movl $0x38, %esi
callq 0x4360
testq %rax, %rax
je 0x1484d
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x14785
jmp 0x1484f
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_cigar2qlen
int bam_cigar2qlen(int n_cigar, const uint32_t *cigar)
{
    int k, l;
    for (k = l = 0; k < n_cigar; ++k)
        if (bam_cigar_type(bam_cigar_op(cigar[k]))&1)
            l += bam_cigar_oplen(cigar[k]);
    return l;
}

// Assembly:
testl %edi, %edi
jle 0x14891
movl %edi, %ecx
xorl %edx, %edx
movl $0x3c1a7, %edi          # imm = 0x3C1A7
xorl %eax, %eax
movl (%rsi,%rdx,4), %r8d
leal (%r8,%r8), %r9d
btl %r9d, %edi
movl $0x0, %r9d
sbbl %r9d, %r9d
shrl $0x4, %r8d
andl %r9d, %r8d
addl %r8d, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x14869
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_cigar2rlen
int bam_cigar2rlen(int n_cigar, const uint32_t *cigar)
{
    int k, l;
    for (k = l = 0; k < n_cigar; ++k)
        if (bam_cigar_type(bam_cigar_op(cigar[k]))&2)
            l += bam_cigar_oplen(cigar[k]);
    return l;
}

// Assembly:
testl %edi, %edi
jle 0x148ca
movl %edi, %edx
xorl %edi, %edi
xorl %eax, %eax
movl (%rsi,%rdi,4), %r8d
leal (%r8,%r8), %ecx
movl $0x3c1a7, %r9d          # imm = 0x3C1A7
shrl %cl, %r9d
shll $0x1e, %r9d
sarl $0x1f, %r9d
shrl $0x4, %r8d
andl %r9d, %r8d
addl %r8d, %eax
incq %rdi
cmpq %rdi, %rdx
jne 0x1489e
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_endpos
int32_t bam_endpos(const bam1_t *b)
{
    if (!(b->core.flag & BAM_FUNMAP) && b->core.n_cigar > 0)
        return b->core.pos + bam_cigar2rlen(b->core.n_cigar, bam_get_cigar(b));
    else
        return b->core.pos + 1;
}

// Assembly:
movq 0x8(%rdi), %rdx
movq %rdx, %rax
shrq $0x22, %rax
andl $0x1, %eax
movq %rdx, %rsi
shrq $0x30, %rsi
sete %cl
orb %al, %cl
je 0x148ef
movl 0x4(%rdi), %eax
incl %eax
retq
movl 0x4(%rdi), %r8d
shrl $0x18, %edx
addq 0x28(%rdi), %rdx
xorl %edi, %edi
xorl %eax, %eax
movl (%rdx,%rdi,4), %r9d
leal (%r9,%r9), %ecx
movl $0x3c1a7, %r10d         # imm = 0x3C1A7
shrl %cl, %r10d
shll $0x1e, %r10d
sarl $0x1f, %r10d
shrl $0x4, %r9d
andl %r10d, %r9d
addl %r9d, %eax
incq %rdi
cmpq %rdi, %rsi
jne 0x148fe
addl %r8d, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: sam_index_load2
hts_idx_t *sam_index_load2(htsFile *fp, const char *fn, const char *fnidx)
{
    switch (fp->format.format) {
    case bam:
        return fnidx? hts_idx_load2(fn, fnidx) : hts_idx_load(fn, HTS_FMT_BAI);

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

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

// Assembly:
pushq %rbx
movl 0x44(%rdi), %eax
cmpl $0x6, %eax
je 0x15119
cmpl $0x4, %eax
jne 0x15148
movq %rsi, %rdi
testq %rdx, %rdx
je 0x1514c
movq %rdx, %rsi
popq %rbx
jmp 0x136d0
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
callq 0x2eb9c
testl %eax, %eax
js 0x15148
movl $0x10, %edi
callq 0x4700
testq %rax, %rax
je 0x15148
movl $0x3, (%rax)
movq 0x38(%rbx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x1514a
xorl %eax, %eax
popq %rbx
retq
movl $0x1, %esi
popq %rbx
jmp 0x1366f
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: sam_itr_queryi
hts_itr_t *sam_itr_queryi(const hts_idx_t *idx, int tid, int beg, int end)
{
    const hts_cram_idx_t *cidx = (const hts_cram_idx_t *) idx;
    if (idx == NULL)
        return hts_itr_query(NULL, tid, beg, end, sam_bam_cram_readrec);
    else if (cidx->fmt == HTS_FMT_CRAI)
        return cram_itr_query(idx, tid, beg, end, cram_readrec);
    else
        return hts_itr_query(idx, tid, beg, end, bam_readrec);
}

// Assembly:
testq %rdi, %rdi
je 0x15171
cmpl $0x3, (%rdi)
jne 0x1517f
leaq 0x10d(%rip), %r8        # 0x1527c
jmp 0x151b9
leaq 0x13(%rip), %r8         # 0x1518b
xorl %edi, %edi
jmp 0x1256c
leaq 0x10b(%rip), %r8        # 0x15291
jmp 0x1256c
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: sam_bam_cram_readrec
static int sam_bam_cram_readrec(BGZF *bgzfp, void *fpv, void *bv, int *tid, int *beg, int *end)
{
    htsFile *fp = fpv;
    bam1_t *b = bv;
    switch (fp->format.format) {
    case bam:   return bam_read1(bgzfp, b);
    case cram:  return cram_get_bam_seq(fp->fp.cram, &b);
    default:
        // TODO Need headers available to implement this for SAM files
        fprintf(stderr, "[sam_bam_cram_readrec] Not implemented for SAM files -- Exiting\n");
        abort();
    }
}

// Assembly:
pushq %rax
movq %rdx, (%rsp)
movl 0x44(%rsi), %eax
cmpl $0x6, %eax
je 0x151a6
cmpl $0x4, %eax
jne 0x151b4
movq %rdx, %rsi
popq %rax
jmp 0x1492d
movq 0x38(%rsi), %rdi
movq %rsp, %rsi
callq 0x23f06
popq %rcx
retq
callq 0x4e70
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: cram_itr_query
static hts_itr_t *cram_itr_query(const hts_idx_t *idx, int tid, int beg, int end, hts_readrec_func *readrec)
{
    const hts_cram_idx_t *cidx = (const hts_cram_idx_t *) idx;
    hts_itr_t *iter = (hts_itr_t *) calloc(1, sizeof(hts_itr_t));
    if (iter == NULL) return NULL;

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

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

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

        switch (ret) {
        case 0:
            break;

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

        default:
            free(iter);
            return NULL;
        }
    }
    else switch (tid) {
    case HTS_IDX_REST:
        iter->curr_off = 0;
        break;
    case HTS_IDX_NONE:
        iter->curr_off = 0;
        iter->finished = 1;
        break;
    default:
        fprintf(stderr, "[cram_itr_query] tid=%d not implemented for CRAM files -- Exiting\n", tid);
        abort();
        break;
    }

    return iter;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r13
movl %ecx, %r14d
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r12
movl $0x1, %edi
movl $0x50, %esi
callq 0x4360
testq %rax, %rax
je 0x1524f
movq %rax, %rbx
movl $0x1, (%rax)
movq %r13, 0x38(%rax)
testl %ebp, %ebp
sets %al
cmpl $-0x2, %ebp
setne %cl
testb %cl, %al
jne 0x15253
cmpl $-0x2, %ebp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnel %ebp, %eax
leaq 0xc(%rsp), %rdx
movl %eax, (%rdx)
leal 0x1(%r15), %eax
movl %eax, 0x4(%rdx)
movl %r14d, 0x8(%rdx)
movq 0x8(%r12), %rdi
movl $0x5, %esi
xorl %eax, %eax
callq 0x388fc
movl %ebp, 0x4(%rbx)
movl %r15d, 0x8(%rbx)
movl %r14d, 0xc(%rbx)
testl %eax, %eax
je 0x15263
cmpl $-0x2, %eax
je 0x1525d
movq %rbx, %rdi
callq 0x4610
xorl %ebx, %ebx
jmp 0x15263
cmpl $-0x4, %ebp
je 0x15263
cmpl $-0x5, %ebp
jne 0x15275
movl $0x3, (%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %edi
callq 0x4e92
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_readrec
static int bam_readrec(BGZF *fp, void *ignored, void *bv, int *tid, int *beg, int *end)
{
    bam1_t *b = bv;
    int ret;
    if ((ret = bam_read1(fp, b)) >= 0) {
        *tid = b->core.tid;
        *beg = b->core.pos;
        *end = bam_endpos(b);
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r9, %rbx
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r14
movq %rdx, %rsi
callq 0x1492d
movl %eax, %ebp
testl %eax, %eax
js 0x152cb
movl (%r14), %eax
movl %eax, (%r12)
movl 0x4(%r14), %eax
movl %eax, (%r15)
movq %r14, %rdi
callq 0x148cd
movl %eax, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/./htslib/kstring.h
// Function: kputsn_
static inline int kputsn_(const void *p, int l, kstring_t *s)
{
	if (ks_resize(s, s->l + l) < 0)
		return EOF;
	memcpy(s->s + s->l, p, l);
	s->l += l;
	return l;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r15
movq (%rdx), %rdi
movslq %esi, %r14
leaq (%rdi,%r14), %rax
cmpq %rax, 0x8(%rdx)
jae 0x16d38
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %r12
shrq $0x20, %r12
orq %rcx, %r12
incq %r12
movq 0x10(%rbx), %rdi
movq %r12, %rsi
callq 0x48d0
testq %rax, %rax
je 0x16d4d
movq %rax, 0x10(%rbx)
movq %r12, 0x8(%rbx)
movq (%rbx), %rdi
jmp 0x16d3c
movq 0x10(%rbx), %rax
addq %rax, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x4420
addq %r14, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/./htslib/kstring.h
// Function: ks_resize
static inline int ks_resize(kstring_t *s, size_t size)
{
	if (s->m < size) {
		char *tmp;
		kroundup_size_t(size);
		tmp = (char*)realloc(s->s, size);
		if (!tmp)
			return -1;
		s->s = tmp;
		s->m = size;
	}
	return 0;
}

// Assembly:
cmpq %rsi, 0x8(%rdi)
jae 0x16dc7
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
decq %rsi
movq %rsi, %rax
shrq %rax
orq %rsi, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
movq %rax, %r14
shrq $0x20, %r14
orq %rax, %r14
incq %r14
movq 0x10(%rdi), %rdi
movq %r14, %rsi
callq 0x48d0
testq %rax, %rax
je 0x16dc0
movq %rax, 0x10(%rbx)
movq %r14, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/./htslib/kstring.h
// Function: kputc_
static inline int kputc_(int c, kstring_t *s)
{
	if (ks_resize(s, s->l + 1) < 0)
		return EOF;
	s->s[s->l++] = c;
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rcx
leaq 0x1(%rcx), %rdx
cmpq %rdx, 0x8(%rsi)
jae 0x16e3f
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
movq %rax, %r15
shrq $0x20, %r15
orq %rax, %r15
incq %r15
movq 0x10(%r14), %rdi
movq %r15, %rsi
callq 0x48d0
testq %rax, %rax
je 0x16e49
movq %rax, 0x10(%r14)
movq %r15, 0x8(%r14)
movq (%r14), %rcx
leaq 0x1(%rcx), %rdx
jmp 0x16e43
movq 0x10(%r14), %rax
movq %rdx, (%r14)
movb %bl, (%rax,%rcx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: sam_read1
int sam_read1(htsFile *fp, bam_hdr_t *h, bam1_t *b)
{
    switch (fp->format.format) {
    case bam: {
        int r = bam_read1(fp->fp.bgzf, b);
        if (r >= 0) {
            if (b->core.tid  >= h->n_targets || b->core.tid  < -1 ||
                b->core.mtid >= h->n_targets || b->core.mtid < -1)
                return -3;
        }
        return r;
        }

    case cram: {
        int ret = cram_get_bam_seq(fp->fp.cram, &b);
        return ret >= 0
            ? ret
            : (cram_eof(fp->fp.cram) ? -1 : -2);
    }

    case sam: {
        int ret;
err_recover:
        if (fp->line.l == 0) {
            ret = hts_getline(fp, KS_SEP_LINE, &fp->line);
            if (ret < 0) return -1;
        }
        ret = sam_parse1(&fp->line, h, b);
        fp->line.l = 0;
        if (ret < 0) {
            if (hts_verbose >= 1)
                fprintf(stderr, "[W::%s] parse error at line %lld\n", __func__, (long long)fp->lineno);
            if (h->ignore_sam_err) goto err_recover;
        }
        return ret;
        }

    default:
        abort();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq %rdx, 0x10(%rsp)
movl 0x44(%rdi), %eax
cmpl $0x6, %eax
je 0x16f35
movq %rdx, %rbx
movq %rsi, %r15
cmpl $0x4, %eax
je 0x16ef4
cmpl $0x3, %eax
jne 0x16f75
leaq 0x10(%r14), %r12
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
leaq 0x4b6b7(%rip), %r13     # 0x62550
cmpq $0x0, (%r12)
jne 0x16eb8
movq %r14, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0xff2b
testl %eax, %eax
js 0x16f5f
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x15dd6
movl %eax, %ebp
movq $0x0, (%r12)
testl %eax, %eax
jns 0x16f64
cmpl $0x0, (%r13)
jg 0x16ee8
cmpl $0x0, 0x4(%r15)
jne 0x16e99
jmp 0x16f64
movq 0x8(%rsp), %rdi
callq 0x5064
jmp 0x16edf
movq 0x38(%r14), %rdi
movq %rbx, %rsi
callq 0x1492d
testl %eax, %eax
js 0x16f31
movl (%rbx), %edx
movl (%r15), %ecx
cmpl %ecx, %edx
setge %sil
cmpl $-0x1, %edx
setl %dl
orb %sil, %dl
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jne 0x16f64
movl 0x14(%rbx), %edx
cmpl %ecx, %edx
setge %cl
cmpl $-0x1, %edx
setl %dl
orb %cl, %dl
jne 0x16f64
movl %eax, %ebp
jmp 0x16f64
movq 0x38(%r14), %rdi
leaq 0x10(%rsp), %rsi
callq 0x23f06
movl %eax, %ebp
testl %eax, %eax
jns 0x16f64
movq 0x38(%r14), %rdi
callq 0x388f5
cmpl $0x1, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
sbbl $0x0, %ebp
jmp 0x16f64
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x42e0
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/./htslib/kstring.h
// Function: kputuw
static inline int kputuw(unsigned c, kstring_t *s)
{
	char buf[16];
	int l, i;
	unsigned x;
	if (c == 0) return kputc('0', s);
	for (l = 0, x = c; x > 0; x /= 10) buf[l++] = x%10 + '0';
	if (ks_resize(s, s->l + l + 2) < 0)
		return EOF;
	for (i = l - 1; i >= 0; --i) s->s[s->l++] = buf[i];
	s->s[s->l] = 0;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
testl %edi, %edi
je 0x19b01
xorl %r15d, %r15d
movl $0xcccccccd, %eax       # imm = 0xCCCCCCCD
movl %edi, %ecx
imulq %rax, %rcx
shrq $0x23, %rcx
leal (%rcx,%rcx), %edx
leal (%rdx,%rdx,4), %edx
movl %edi, %esi
subl %edx, %esi
orb $0x30, %sil
movb %sil, (%rsp,%r15)
incq %r15
cmpl $0x9, %edi
movl %ecx, %edi
ja 0x19a3e
movl %r15d, %ecx
movq (%rbx), %rax
leaq (%rax,%rcx), %rdx
addq $0x2, %rdx
cmpq %rdx, 0x8(%rbx)
jae 0x19ad9
addq %rcx, %rax
incq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %r14
shrq $0x20, %r14
orq %rcx, %r14
incq %r14
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x48d0
testq %rax, %rax
je 0x19b87
movq %rax, 0x10(%rbx)
movq %r14, 0x8(%rbx)
decq %r15
movl %r15d, %eax
movb (%rsp,%rax), %al
movq (%rbx), %rcx
movq 0x10(%rbx), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%rbx)
movb %al, (%rdx,%rcx)
decq %r15
leal 0x2(%r15), %eax
cmpl $0x1, %eax
jg 0x19adc
jmp 0x19b7c
movq (%rbx), %rcx
leaq 0x2(%rcx), %rax
cmpq %rax, 0x8(%rbx)
jae 0x19b6d
incq %rcx
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
movq %rax, %r14
shrq $0x20, %r14
orq %rax, %r14
incq %r14
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x48d0
testq %rax, %rax
je 0x19b87
movq %rax, 0x10(%rbx)
movq %r14, 0x8(%rbx)
movq (%rbx), %rcx
jmp 0x19b71
movq 0x10(%rbx), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movb $0x30, (%rax,%rcx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movb $0x0, (%rcx,%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq