LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/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 0x11d56
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpl $0x3, (%rdi)
jne 0x11d57
movq 0x8(%rbx), %rdi
callq 0x30000
jmp 0x11e17
retq
cmpl $0x0, 0x18(%rbx)
jle 0x11dfc
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 0x11dec
cmpl $0x0, (%r14)
je 0x11dc9
xorl %ebp, %ebp
xorl %r12d, %r12d
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 0x11dbe
movq 0x20(%r14), %rax
movl %r12d, %ecx
leaq (%rcx,%rcx,2), %rcx
movq 0x10(%rax,%rcx,8), %rdi
callq 0x4610
incl %r12d
addl $0x2, %ebp
cmpl (%r14), %r12d
jne 0x11d91
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 0x11d64
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_O1/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 0x11e80
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x44e0
testl %ebx, %ebx
je 0x11e99
cmpl $0x2, %ebx
je 0x11e87
cmpl $0x1, %ebx
jne 0x11ee1
movq %r15, %rdi
callq 0x4230
movl $0x6961622e, (%r15,%rax) # imm = 0x6961622E
jmp 0x11ea9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x11ed8
movq %r15, %rdi
callq 0x4230
movl $0x6962742e, (%r15,%rax) # imm = 0x6962742E
jmp 0x11ea9
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 0x11ee6
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_O1/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 0x122e0
callq 0x4610
movl %ebp, 0x10(%r14)
testl %r15d, %r15d
je 0x12310
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_O1/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
pushq %rax
movq %rsi, %rbp
movq %rdi, %r13
movslq 0x14(%rdi), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x12395
movq %rcx, %r14
movq %rdx, %r15
movl $0x8, %esi
callq 0x4360
movq %rax, %r12
cmpl $0x0, 0x14(%r13)
jle 0x12398
movq %rbp, (%rsp)
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x28(%r13), %rax
cmpq $0x0, (%rax,%rbp,8)
je 0x12383
movq %r14, %rdi
movl %ebp, %esi
callq *%r15
movslq %ebx, %rcx
incl %ebx
movq %rax, (%r12,%rcx,8)
incq %rbp
movslq 0x14(%r13), %rax
cmpq %rax, %rbp
jl 0x12367
movq (%rsp), %rbp
jmp 0x12398
xorl %r12d, %r12d
movl %ebx, (%rbp)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x123c8
movq $0x0, (%rdx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
jmp 0x12482
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 0x12448
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 0x1243c
testb $0x1, %r15b
jne 0x1242c
movq 0x18(%rax), %r15
movl %edi, %r12d
cmpl %r9d, (%r15,%r12,4)
je 0x1243c
addl %ebp, %edi
andl %r10d, %edi
incl %ebp
cmpl %r11d, %edi
jne 0x123fe
movl %esi, %edi
jmp 0x1244a
shrl %cl, %r14d
testb $0x3, %r14b
cmovnel %esi, %edi
jmp 0x1244a
xorl %edi, %edi
cmpl %esi, %edi
jne 0x1245e
movq $0x0, (%rdx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
jmp 0x1247a
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_O1/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 0x12fb5
movq %rax, %r15
leaq 0x1(%rax), %rdi
movq %rsp, %r12
movq %r12, %rsi
movl $0x1, %edx
callq 0x12d0f
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 0x12fcf
cmpl $0x2d, %ecx
jne 0x12fdf
incq %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x12d0f
movq %rax, %rcx
jmp 0x12fd4
movl $0x0, (%rbx)
movl $0x7fffffff, (%r14)     # imm = 0x7FFFFFFF
movq %r12, %rdi
callq 0x4230
addq %r12, %rax
jmp 0x12fdf
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_O1/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, %r15
movq %r8, %r12
movq %rcx, -0x48(%rbp)
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
leaq 0x3ffa2(%rip), %rsi     # 0x52fb8
movq %r13, %rdi
callq 0x4750
testl %eax, %eax
je 0x13090
movq %r12, -0x40(%rbp)
leaq 0x4069c(%rip), %rsi     # 0x536c9
movq %r13, %rdi
callq 0x4750
testl %eax, %eax
je 0x130a4
movq %rbx, -0x38(%rbp)
leaq -0x30(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movq %r13, %rdi
callq 0x12f4c
testq %rax, %rax
je 0x130c7
movq %rax, %rbx
subq %r13, %rbx
leaq 0x10(%rbx), %rax
andq $-0x10, %rax
movq %r15, -0x50(%rbp)
movq %rsp, %r15
subq %rax, %r15
movq %r15, %rsp
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x42b0
movb $0x0, (%rbx,%r15)
movq -0x48(%rbp), %rdi
movq %r15, %rsi
movq -0x50(%rbp), %r15
callq *-0x38(%rbp)
jmp 0x130df
movq %r14, %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
xorl %edx, %edx
xorl %ecx, %ecx
movq %r15, %r8
movq %r12, %rax
jmp 0x130b7
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
xorl %edx, %edx
xorl %ecx, %ecx
movq %r15, %r8
movq -0x40(%rbp), %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq -0x48(%rbp), %rdi
movq %r13, %rsi
callq *-0x38(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x7fffffff, -0x2c(%rbp) # imm = 0x7FFFFFFF
testl %eax, %eax
movq -0x40(%rbp), %r9
js 0x130fa
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %ecx
movq %r14, %rdi
movl %eax, %esi
movq %r15, %r8
callq *%r9
jmp 0x130fc
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x133b7
movq %rax, %r12
testq %rax, %rax
jne 0x13366
movl %r15d, %eax
testl %r15d, %r15d
movl $0x1, %ecx
cmovlel %r15d, %ecx
decl %ecx
decq %rax
cmpl $0x2, %r15d
jl 0x13347
movl %eax, %edx
decl %r15d
decq %rax
cmpb $0x2e, (%rbx,%rdx)
jne 0x13331
jmp 0x1334a
movl %ecx, %r15d
movslq %r15d, %rax
movq %rbx, %rdi
addq %rax, %rdi
movq %r14, %rsi
callq 0x44e0
movq %rbx, %rdi
callq 0x133b7
movq %rax, %r12
testq %r12, %r12
je 0x133a1
movabsq $0x100000000, %r14      # imm = 0x100000000
movq %r12, %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_O1/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 0x3f983(%rip), %rsi     # 0x52f37
callq 0x132c1
movq %rax, %r14
testq %rax, %rax
jne 0x135e1
cmpl $0x1, %ebp
leaq 0x3f967(%rip), %rax     # 0x52f32
leaq 0x3f96a(%rip), %rsi     # 0x52f3c
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x132c1
movq %rax, %r14
testq %r14, %r14
je 0x13601
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13608
movq %rax, %rbx
movq %r14, %rdi
callq 0x4610
movq %rbx, %rax
jmp 0x13603
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x140f3
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x20(%rdi)
je 0x140c4
cmpl $0x0, (%rbx)
jle 0x140b2
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x4610
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x1409a
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 0x140e4
callq 0xdcfc
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4610
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x141c6
movq %rdi, %r15
movl $0x1, %edi
movl $0x38, %esi
callq 0x4360
testq %rax, %rax
je 0x141c6
movq %rax, %rbx
movslq (%r15), %r14
movl %r14d, (%rax)
movl 0x4(%r15), %eax
movl %eax, 0x4(%rbx)
movl 0x8(%r15), %r12d
movl %r12d, 0x8(%rbx)
xorl %eax, %eax
movq %rax, 0x18(%rbx)
movq %rax, 0x30(%rbx)
leal 0x1(%r12), %edi
movl $0x1, %esi
callq 0x4360
movq %rax, 0x28(%rbx)
movq 0x28(%r15), %rsi
movq %rax, %rdi
movq %r12, %rdx
callq 0x4420
movl $0x4, %esi
movq %r14, %rdi
callq 0x4360
movq %rax, %r12
movq %rax, 0x10(%rbx)
movl $0x8, %esi
movq %r14, %rdi
callq 0x4360
movq %rax, 0x20(%rbx)
testq %r14, %r14
jle 0x141c8
movq %rax, %r13
movq %rbx, (%rsp)
movq 0x10(%r15), %rbp
movq 0x20(%r15), %r15
xorl %ebx, %ebx
movl (%rbp,%rbx,4), %eax
movl %eax, (%r12,%rbx,4)
movq (%r15,%rbx,8), %rdi
callq 0x49c0
movq %rax, (%r13,%rbx,8)
incq %rbx
cmpq %rbx, %r14
jne 0x141a2
movq (%rsp), %rbx
jmp 0x141c8
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_O1/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 0x14740
movq %rdi, %r15
callq 0xdced
movq %rax, %rbx
cmpl $0x0, (%r15)
jle 0x1473c
xorl %r13d, %r13d
leaq 0xc(%rsp), %r12
movq 0x20(%r15), %rax
movq (%rax,%r13,8), %rsi
movq %rbx, %rdi
movq %r12, %rdx
callq 0xe123
movq 0x20(%rbx), %rcx
movl %eax, %eax
movq %r13, (%rcx,%rax,8)
incq %r13
movslq (%r15), %rax
cmpq %rax, %r13
jl 0x14714
movq %rbx, 0x30(%r15)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdd65
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl (%rbx), %ecx
je 0x1475f
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_O1/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_copy1
bam1_t *bam_copy1(bam1_t *bdst, const bam1_t *bsrc)
{
    uint8_t *data = bdst->data;
    int m_data = bdst->m_data;   // backup data and m_data
    if (m_data < bsrc->l_data) { // double the capacity
        m_data = bsrc->l_data; kroundup32(m_data);
        data = (uint8_t*)realloc(data, m_data);
    }
    memcpy(data, bsrc->data, bsrc->l_data); // copy var-len data
    *bdst = *bsrc; // copy the rest
    // restore the backup
    bdst->m_data = m_data;
    bdst->data = data;
    return bdst;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x28(%rdi), %r15
movl 0x24(%rdi), %ebp
movl 0x20(%rsi), %eax
cmpl %eax, %ebp
jge 0x147e7
decl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x8, %eax
orl %ecx, %eax
movl %eax, %ebp
sarl $0x10, %ebp
orl %eax, %ebp
incl %ebp
movslq %ebp, %rsi
movq %r15, %rdi
callq 0x48d0
movq %rax, %r15
movq 0x28(%r14), %rsi
movslq 0x20(%r14), %rdx
movq %r15, %rdi
callq 0x4420
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x20(%rbx)
movups %xmm0, (%rbx)
movups %xmm1, 0x10(%rbx)
movq 0x30(%r14), %rax
movq %rax, 0x30(%rbx)
movl %ebp, 0x24(%rbx)
movq %r15, 0x28(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1485d
movq %rdi, %r14
movl $0x1, %edi
movl $0x38, %esi
callq 0x4360
testq %rax, %rax
je 0x1485d
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x14798
jmp 0x1485f
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x148a1
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 0x14879
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x148da
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 0x148ae
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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, %r8
shrq $0x30, %r8
sete %cl
orb %al, %cl
movl 0x4(%rdi), %esi
je 0x14901
incl %esi
movl %esi, %eax
retq
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, %r8
jne 0x1490c
addl %esi, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_write1
int bam_write1(BGZF *fp, const bam1_t *b)
{
    const bam1_core_t *c = &b->core;
    uint32_t x[8], block_len = b->l_data + 32, y;
    int i, ok;
    x[0] = c->tid;
    x[1] = c->pos;
    x[2] = (uint32_t)c->bin<<16 | c->qual<<8 | c->l_qname;
    x[3] = (uint32_t)c->flag<<16 | c->n_cigar;
    x[4] = c->l_qseq;
    x[5] = c->mtid;
    x[6] = c->mpos;
    x[7] = c->isize;
    ok = (bgzf_flush_try(fp, 4 + block_len) >= 0);
    if (fp->is_be) {
        for (i = 0; i < 8; ++i) ed_swap_4p(x + i);
        y = block_len;
        if (ok) ok = (bgzf_write(fp, ed_swap_4p(&y), 4) >= 0);
        swap_data(c, b->l_data, b->data, 1);
    } else {
        if (ok) ok = (bgzf_write(fp, &block_len, 4) >= 0);
    }
    if (ok) ok = (bgzf_write(fp, x, 32) >= 0);
    if (ok) ok = (bgzf_write(fp, b->data, b->l_data) >= 0);
    if (fp->is_be) swap_data(c, b->l_data, b->data, 0);
    return ok? 4 + block_len : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x20(%rsi), %esi
leal 0x20(%rsi), %eax
movl %eax, 0x8(%rsp)
movl (%rbx), %eax
movl %eax, 0x10(%rsp)
movl 0x4(%rbx), %eax
movl %eax, 0x14(%rsp)
movq 0x8(%rbx), %rax
movl %eax, %ecx
shll $0x10, %ecx
movl %eax, %edx
shrl $0x8, %edx
andl $0xff00, %edx           # imm = 0xFF00
orl %ecx, %edx
movl %eax, %ecx
shrl $0x18, %ecx
orl %edx, %ecx
movl %ecx, 0x18(%rsp)
movq %rax, %rcx
shrq $0x10, %rcx
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
shrq $0x30, %rax
orl %ecx, %eax
movl %eax, 0x1c(%rsp)
movl 0x10(%rbx), %eax
movl %eax, 0x20(%rsp)
movl 0x14(%rbx), %eax
movl %eax, 0x24(%rsp)
movl 0x18(%rbx), %eax
movl %eax, 0x28(%rsp)
movl 0x1c(%rbx), %eax
movl %eax, 0x2c(%rsp)
addl $0x24, %esi
callq 0x44f97
movl %eax, %ebp
notl %ebp
shrl $0x1f, %ebp
testb $0xc, 0x2(%r14)
je 0x14e80
xorl %ecx, %ecx
movl 0x10(%rsp,%rcx,4), %edx
bswapl %edx
movl %edx, 0x10(%rsp,%rcx,4)
incq %rcx
cmpq $0x8, %rcx
jne 0x14e2c
movl 0x8(%rsp), %ecx
movl %ecx, 0xc(%rsp)
testl %eax, %eax
js 0x14e6a
bswapl %ecx
leaq 0xc(%rsp), %rsi
movl %ecx, (%rsi)
movl $0x4, %edx
movq %r14, %rdi
callq 0x44fe4
xorl %ebp, %ebp
testq %rax, %rax
setns %bpl
movl 0x20(%rbx), %esi
movq 0x28(%rbx), %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x14b0e
jmp 0x14e9f
testl %eax, %eax
js 0x14e9f
leaq 0x8(%rsp), %rsi
movl $0x4, %edx
movq %r14, %rdi
callq 0x44fe4
xorl %ebp, %ebp
testq %rax, %rax
setns %bpl
movb $0x1, %r15b
testl %ebp, %ebp
je 0x14ed4
leaq 0x10(%rsp), %rsi
movl $0x20, %edx
movq %r14, %rdi
callq 0x44fe4
testq %rax, %rax
js 0x14ed4
movq 0x28(%rbx), %rsi
movslq 0x20(%rbx), %rdx
movq %r14, %rdi
callq 0x44fe4
movq %rax, %r15
shrq $0x3f, %r15
testb $0xc, 0x2(%r14)
je 0x14eec
movl 0x20(%rbx), %esi
movq 0x28(%rbx), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x14b0e
movl 0x8(%rsp), %ecx
addl $0x4, %ecx
testb %r15b, %r15b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %ecx, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x15156
cmpl $0x4, %eax
jne 0x15185
movq %rsi, %rdi
testq %rdx, %rdx
je 0x15189
movq %rdx, %rsi
popq %rbx
jmp 0x13608
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
callq 0x2f800
testl %eax, %eax
js 0x15185
movl $0x10, %edi
callq 0x4700
testq %rax, %rax
je 0x15185
movl $0x3, (%rax)
movq 0x38(%rbx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x15187
xorl %eax, %eax
popq %rbx
retq
movl $0x1, %esi
popq %rbx
jmp 0x135a4
// File: /workspace/github_cpp_makefile_star2_O1/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 0x151ae
cmpl $0x3, (%rdi)
jne 0x151bc
leaq 0x140(%rip), %r8        # 0x152ec
jmp 0x151f6
leaq 0x13(%rip), %r8         # 0x151c8
xorl %edi, %edi
jmp 0x1248b
leaq 0x13e(%rip), %r8        # 0x15301
jmp 0x1248b
// File: /workspace/github_cpp_makefile_star2_O1/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 0x151e3
cmpl $0x4, %eax
jne 0x151f1
movq %rdx, %rsi
popq %rax
jmp 0x1493a
movq 0x38(%rsi), %rdi
movq %rsp, %rsi
callq 0x249d5
popq %rcx
retq
callq 0x4e64
// File: /workspace/github_cpp_makefile_star2_O1/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 0x152ac
movq %rax, %rbx
movl %r14d, %esi
movl (%rax), %r14d
movl %r14d, %eax
orl $0x1, %eax
movl %eax, (%rbx)
xorl %eax, %eax
movq %rax, 0x30(%rbx)
movq %rax, 0x48(%rbx)
movq %r13, 0x38(%rbx)
testl %ebp, %ebp
sets %al
cmpl $-0x2, %ebp
setne %cl
testb %cl, %al
jne 0x152b0
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 %esi, %r13d
movl %esi, 0x8(%rdx)
movq 0x8(%r12), %rdi
movl $0x5, %esi
xorl %eax, %eax
callq 0x3956d
movq $0x0, 0x28(%rbx)
movl %ebp, 0x4(%rbx)
movl %r15d, 0x8(%rbx)
movl %r13d, 0xc(%rbx)
testl %eax, %eax
je 0x152d3
cmpl $-0x2, %eax
je 0x152cc
movq %rbx, %rdi
callq 0x4610
xorl %ebx, %ebx
jmp 0x152d3
cmpl $-0x5, %ebp
je 0x152c4
cmpl $-0x4, %ebp
jne 0x152e5
movq $0x0, 0x28(%rbx)
jmp 0x152d3
movq $0x0, 0x28(%rbx)
orl $0x3, %r14d
movl %r14d, (%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %edi
callq 0x4e86
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1493a
movl %eax, %ebp
testl %eax, %eax
js 0x1533b
movl (%r14), %eax
movl %eax, (%r12)
movl 0x4(%r14), %eax
movl %eax, (%r15)
movq %r14, %rdi
callq 0x148dd
movl %eax, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
movslq %esi, %r14
movq (%rdx), %rax
addq %r14, %rax
cmpq %rax, 0x8(%rdx)
jae 0x16de4
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 0x16df9
movq %rax, 0x10(%rbx)
movq %r12, 0x8(%rbx)
movq 0x10(%rbx), %rdi
addq (%rbx), %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_O1/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 0x16e73
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 0x16e6c
movq %rax, 0x10(%rbx)
movq %r14, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
leaq 0x1(%rax), %rcx
cmpq %rcx, 0x8(%rsi)
jae 0x16ee2
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, %r15
shrq $0x20, %r15
orq %rcx, %r15
incq %r15
movq 0x10(%r14), %rdi
movq %r15, %rsi
callq 0x48d0
testq %rax, %rax
je 0x16ef3
movq %rax, 0x10(%r14)
movq %r15, 0x8(%r14)
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r14)
movb %bl, (%rcx,%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %rax
movq %rdi, %rbx
movq %rdx, (%rsp)
movl 0x44(%rdi), %eax
cmpl $0x6, %eax
je 0x16fd5
movq %rsi, %r14
cmpl $0x4, %eax
je 0x16f8f
cmpl $0x3, %eax
jne 0x17013
leaq 0x10(%rbx), %r15
leaq 0x8(%rbx), %r12
leaq 0x4d619(%rip), %r13     # 0x64550
cmpq $0x0, (%r15)
jne 0x16f55
movq %rbx, %rdi
movl $0x2, %esi
movq %r15, %rdx
callq 0xffc2
testl %eax, %eax
js 0x16ffd
movq (%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x15e0f
movl %eax, %ebp
movq $0x0, (%r15)
testl %eax, %eax
jns 0x17002
cmpl $0x0, (%r13)
jg 0x16f85
cmpl $0x0, 0x4(%r14)
jne 0x16f37
jmp 0x17002
movq %r12, %rdi
callq 0x5092
jmp 0x16f7c
movq 0x38(%rbx), %rdi
movq %rdx, %rsi
callq 0x1493a
testl %eax, %eax
js 0x16fd1
movq (%rsp), %rcx
movl (%rcx), %esi
movl (%r14), %edx
cmpl %edx, %esi
setge %dil
cmpl $-0x1, %esi
setl %sil
orb %dil, %sil
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jne 0x17002
movl 0x14(%rcx), %ecx
cmpl %edx, %ecx
setge %dl
cmpl $-0x1, %ecx
setl %cl
orb %dl, %cl
jne 0x17002
movl %eax, %ebp
jmp 0x17002
movq 0x38(%rbx), %rdi
movq %rsp, %rsi
callq 0x249d5
movl %eax, %ebp
testl %eax, %eax
jns 0x17002
movq 0x38(%rbx), %rdi
callq 0x39566
cmpl $0x1, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
sbbl $0x0, %ebp
jmp 0x17002
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x42e0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x19d3c
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 0x19c79
movl %r15d, %ecx
movq (%rbx), %rax
leaq (%rax,%rcx), %rdx
addq $0x2, %rdx
cmpq %rdx, 0x8(%rbx)
jae 0x19d14
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 0x19dc0
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 0x19d17
jmp 0x19db5
movq (%rbx), %rax
leaq 0x2(%rax), %rcx
cmpq %rcx, 0x8(%rbx)
jae 0x19da3
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 0x19dc0
movq %rax, 0x10(%rbx)
movq %r14, 0x8(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
movb $0x30, (%rcx,%rax)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movb $0x0, (%rcx,%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: sam_write1
int sam_write1(htsFile *fp, const bam_hdr_t *h, const bam1_t *b)
{
    switch (fp->format.format) {
    case binary_format:
        fp->format.category = sequence_data;
        fp->format.format = bam;
        /* fall-through */
    case bam:
        return bam_write1(fp->fp.bgzf, b);

    case cram:
        return cram_put_bam_seq(fp->fp.cram, (bam1_t *)b);

    case text_format:
        fp->format.category = sequence_data;
        fp->format.format = sam;
        /* fall-through */
    case sam:
        if (sam_format1(h, b, &fp->line) < 0) return -1;
        kputc('\n', &fp->line);
        if ( hwrite(fp->fp.hfile, fp->line.s, fp->line.l) != fp->line.l ) return -1;
        return fp->line.l;

    default:
        abort();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x44(%rdi), %eax
decl %eax
cmpl $0x5, %eax
ja 0x19f58
movq %rdi, %r14
leaq 0x3940f(%rip), %rcx     # 0x531fc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movabsq $0x400000001, %rax      # imm = 0x400000001
movq %rax, 0x40(%r14)
movq 0x38(%r14), %rdi
movq %rdx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x14d99
movq 0x38(%r14), %rdi
movq %rdx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2e20b
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, 0x40(%r14)
leaq 0x10(%r14), %rbx
movq %rsi, %rdi
movq %rdx, %rsi
movq %rbx, %rdx
callq 0x17018
testl %eax, %eax
js 0x19f44
movq 0x10(%r14), %rax
leaq 0x2(%rax), %rcx
cmpq %rcx, 0x18(%r14)
jae 0x19ec8
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, %r15
shrq $0x20, %r15
orq %rcx, %r15
incq %r15
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0x48d0
testq %rax, %rax
je 0x19ee8
movq %rax, 0x20(%r14)
movq %r15, 0x18(%r14)
movq 0x10(%r14), %rax
movq 0x20(%r14), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x10(%r14)
movb $0xa, (%rcx,%rax)
movq 0x10(%r14), %rax
movq 0x20(%r14), %rcx
movb $0x0, (%rcx,%rax)
movq 0x38(%r14), %r12
movq 0x10(%r14), %r15
movq 0x20(%r14), %r13
movq 0x8(%r12), %rdi
movq 0x18(%r12), %rbp
subq %rdi, %rbp
cmpq %r15, %rbp
movq %r15, %r14
cmovbq %rbp, %r14
movq %r13, %rsi
movq %r14, %rdx
callq 0x4420
addq %r14, 0x8(%r12)
cmpq %r15, %rbp
jae 0x19f34
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x48356
movq %rax, %r14
movq (%rbx), %rcx
cmpq %rcx, %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %ecx, %eax
jmp 0x19f49
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x42e0
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_aux_append
void bam_aux_append(bam1_t *b, const char tag[2], char type, int len, const uint8_t *data)
{
    int ori_len = b->l_data;
    b->l_data += 3 + len;
    if (b->m_data < b->l_data) {
        b->m_data = b->l_data;
        kroundup32(b->m_data);
        b->data = (uint8_t*)realloc(b->data, b->m_data);
    }
    b->data[ori_len] = tag[0]; b->data[ori_len + 1] = tag[1];
    b->data[ori_len + 2] = type;
    memcpy(b->data + ori_len + 3, data, len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movl %ecx, %r14d
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %r15
movslq 0x20(%rdi), %r13
leal (%r14,%r13), %eax
addl $0x3, %eax
movl %eax, 0x20(%rdi)
cmpl %eax, 0x24(%rdi)
jge 0x19fc3
decl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x8, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x10, %ecx
orl %eax, %ecx
incl %ecx
movl %ecx, 0x24(%r15)
movq 0x28(%r15), %rdi
movslq %ecx, %rsi
callq 0x48d0
movq %rax, 0x28(%r15)
movb (%r12), %al
movq 0x28(%r15), %rcx
movb %al, (%rcx,%r13)
movb 0x1(%r12), %al
movq 0x28(%r15), %rcx
movb %al, 0x1(%rcx,%r13)
movq 0x28(%r15), %rax
movb %bpl, 0x2(%rax,%r13)
movq 0x28(%r15), %rax
leaq (%rax,%r13), %rdi
addq $0x3, %rdi
movslq %r14d, %rdx
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4420
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_aux_get
uint8_t *bam_aux_get(const bam1_t *b, const char tag[2])
{
    uint8_t *s;
    int y = tag[0]<<8 | tag[1];
    s = bam_get_aux(b);
    while (s < b->data + b->l_data) {
        int x = (int)s[0]<<8 | s[1];
        s += 2;
        if (x == y) return s;
        s = skip_aux(s);
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movsbl (%rsi), %eax
shll $0x8, %eax
movsbl 0x1(%rsi), %ebp
orl %eax, %ebp
movq 0x8(%rdi), %rcx
movq %rcx, %rdx
shrq $0x30, %rdx
shlq $0x2, %rdx
addq 0x28(%rdi), %rdx
shrl $0x18, %ecx
movslq 0x10(%rdi), %rsi
leal 0x1(%rsi), %eax
sarl %eax
cltq
addq %rcx, %rax
addq %rsi, %rax
addq %rdx, %rax
movslq 0x20(%rbx), %rcx
addq 0x28(%rbx), %rcx
cmpq %rcx, %rax
jae 0x1a080
movzwl (%rax), %ecx
rolw $0x8, %cx
movzwl %cx, %r15d
addq $0x2, %rax
cmpl %ebp, %r15d
jne 0x1a071
movq %rax, %r14
jmp 0x1a079
movq %rax, %rdi
callq 0x1a091
cmpl %ebp, %r15d
jne 0x1a04b
jmp 0x1a083
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: skip_aux
static inline uint8_t *skip_aux(uint8_t *s)
{
    int size = aux_type2size(*s); ++s; // skip type
    uint32_t n;
    switch (size) {
    case 'Z':
    case 'H':
        while (*s) ++s;
        return s + 1;
    case 'B':
        size = aux_type2size(*s); ++s;
        memcpy(&n, s, 4); s += 4;
        return s + size * n;
    case 0:
        abort();
        break;
    default:
        return s + size;
    }
}

// Assembly:
pushq %rax
movzbl (%rdi), %ecx
movl $0x1, %eax
cmpl $0x59, %ecx
jg 0x1a0b7
leal -0x41(%rcx), %edx
cmpl $0x8, %edx
ja 0x1a0eb
leaq 0x39166(%rip), %rsi     # 0x53214
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
leal -0x63(%rcx), %edx
cmpl $0x6, %edx
ja 0x1a0d6
leaq 0x39172(%rip), %rcx     # 0x53238
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movl $0x4, %eax
jmp 0x1a0f9
cmpl $0x5a, %ecx
je 0x1a0e7
cmpl $0x73, %ecx
jne 0x1a0f0
movl $0x2, %eax
jmp 0x1a0f9
movl %ecx, %eax
jmp 0x1a0f9
cmpl $0x53, %ecx
je 0x1a0e0
xorl %eax, %eax
jmp 0x1a0f9
movl $0x8, %eax
leaq 0x1(%rdi), %rcx
cmpl $0x47, %eax
jle 0x1a11d
cmpl $0x5a, %eax
je 0x1a10c
cmpl $0x48, %eax
jne 0x1a14b
leaq 0x1(%rcx), %rax
cmpb $0x0, (%rcx)
movq %rax, %rcx
jne 0x1a10c
jmp 0x1a1a2
cmpl $0x42, %eax
jne 0x1a147
movzbl (%rcx), %ecx
movl $0x1, %eax
cmpl $0x59, %ecx
jg 0x1a155
leal -0x41(%rcx), %edx
cmpl $0x8, %edx
ja 0x1a189
leaq 0x39116(%rip), %rsi     # 0x53254
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
testl %eax, %eax
je 0x1a1a4
movl %eax, %eax
addq %rax, %rcx
movq %rcx, %rax
jmp 0x1a1a2
leal -0x63(%rcx), %edx
cmpl $0x6, %edx
ja 0x1a174
leaq 0x39114(%rip), %rcx     # 0x53278
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movl $0x4, %eax
jmp 0x1a197
cmpl $0x5a, %ecx
je 0x1a185
cmpl $0x73, %ecx
jne 0x1a18e
movl $0x2, %eax
jmp 0x1a197
movl %ecx, %eax
jmp 0x1a197
cmpl $0x53, %ecx
je 0x1a17e
xorl %eax, %eax
jmp 0x1a197
movl $0x8, %eax
imull 0x2(%rdi), %eax
addq %rdi, %rax
addq $0x6, %rax
popq %rcx
retq
callq 0x42e0