LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_kill
void hts_tpool_kill(hts_tpool *p) {
    int i;

    DBG_OUT(stderr, "Destroying pool %p, kill=%d\n", p, kill);

    for (i = 0; i < p->tsize; i++)
        pthread_kill(p->t[i].tid, SIGINT);

    pthread_mutex_destroy(&p->pool_m);
    for (i = 0; i < p->tsize; i++)
        pthread_cond_destroy(&p->t[i].pending_c);

    if (p->t_stack)
        free(p->t_stack);

    free(p->t);
    free(p);

    DBG_OUT(stderr, "Destroyed pool %p\n", p);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x18(%rdi)
jle 0x38431
movl $0x10, %r14d
xorl %r15d, %r15d
movq 0x20(%rbx), %rax
movq (%rax,%r14), %rdi
movl $0x2, %esi
callq 0x4660
incq %r15
movslq 0x18(%rbx), %rax
addq $0x48, %r14
cmpq %rax, %r15
jl 0x3840f
leaq 0x38(%rbx), %rdi
callq 0x4590
cmpl $0x0, 0x18(%rbx)
jle 0x38465
movl $0x18, %r14d
xorl %r15d, %r15d
movq 0x20(%rbx), %rdi
addq %r14, %rdi
callq 0x49a0
incq %r15
movslq 0x18(%rbx), %rax
addq $0x48, %r14
cmpq %rax, %r15
jl 0x38449
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x38473
callq 0x45c0
movq 0x20(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x45c0
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_io.h
// Function: block_append
static inline int block_append(cram_block *b, const void *s, size_t len) {
    if (block_grow(b, len) < 0)
        return -1;

    if (len) {
        memcpy(BLOCK_END(b), s, len);
        BLOCK_SIZE(b) += len;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x30(%rdi), %r12
addq %rdx, %r12
movq 0x28(%rdi), %rax
cmpq %r12, %rax
ja 0x38739
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r12, %rax
cmovaq %rax, %r12
movq 0x20(%r14), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0x38759
movq %r12, 0x28(%r14)
movq %rax, 0x20(%r14)
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x3875e
movq 0x20(%r14), %rdi
addq 0x30(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, 0x30(%r14)
jmp 0x3875e
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_io.h
// Function: block_append_char
static inline int block_append_char(cram_block *b, char c) {
    if (block_grow(b, 1) < 0)
        return -1;

    b->data[b->byte++] = c;
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq 0x28(%rdi), %rax
movq 0x30(%rdi), %r15
incq %r15
cmpq %r15, %rax
ja 0x387b7
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r15, %rax
cmovaq %rax, %r15
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x387d2
movq %r15, 0x28(%r14)
movq %rax, 0x20(%r14)
movq 0x20(%r14), %rax
movq 0x30(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x30(%r14)
movb %bl, (%rax,%rcx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x387cc
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_decode.c
// Function: cram_ds_unique
static int cram_ds_unique(cram_block_compression_hdr *hdr, cram_codec *c,
                          int id) {
    int i, n_id = 0;
    enum cram_encoding e_type = 0;

    for (i = 0; i < DS_END; i++) {
        cram_codec *c;
        int bnum1, bnum2, old_n_id;

        if (!(c = hdr->codecs[i]))
            continue;

        bnum1 = cram_codec_to_id(c, &bnum2);

        old_n_id = n_id;
        if (bnum1 == id) {
            n_id++;
            e_type = c->codec;
        }
        if (bnum2 == id) {
            n_id++;
            e_type = c->codec;
        }

        if (n_id == old_n_id+2)
            n_id--; // len/val in same place counts once only.
    }

    return n_id == 1 ? e_type : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
xorl %r13d, %r13d
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x280(%r14,%r13,8), %r12
testq %r12, %r12
je 0x3a20b
movq %r12, %rdi
leaq 0x4(%rsp), %rsi
callq 0x95214
movl %r15d, %ecx
cmpl %ebx, %eax
jne 0x3a1ee
leal 0x1(%r15), %ecx
movl (%r12), %ebp
cmpl %ebx, 0x4(%rsp)
jne 0x3a1fa
incl %ecx
movl (%r12), %ebp
addl $0x2, %r15d
xorl %eax, %eax
cmpl %r15d, %ecx
sete %al
subl %eax, %ecx
movl %ecx, %r15d
incq %r13
cmpq $0x2f, %r13
jne 0x3a1c5
xorl %eax, %eax
cmpl $0x1, %r15d
cmovel %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_io.h
// Function: cram_get_block_by_id
static inline cram_block *cram_get_block_by_id(cram_slice *slice, int id) {
  //fprintf(stderr, "%d\t%p\n", id, slice->block_by_id);
    uint32_t v = id;
    if (slice->block_by_id && v < 256) {
        return slice->block_by_id[v];
    } else {
        v = 256 + v % 251;
        if (slice->block_by_id &&
            slice->block_by_id[v] &&
            slice->block_by_id[v]->content_id == id)
            return slice->block_by_id[v];

        // Otherwise a linear search in case of collision
        int i;
        for (i = 0; i < slice->hdr->num_blocks; i++) {
            cram_block *b = slice->block[i];
            if (b && b->content_type == EXTERNAL && b->content_id == id)
                return b;
        }
    }
    return NULL;
}

// Assembly:
movq 0x18(%rdi), %rax
testq %rax, %rax
sete %cl
cmpl $0x100, %esi            # imm = 0x100
setae %dl
orb %cl, %dl
jne 0x3a24a
movl %esi, %ecx
movq (%rax,%rcx,8), %rax
retq
testq %rax, %rax
je 0x3a27e
movl %esi, %ecx
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rcx, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %ecx
movl %esi, %edx
subl %ecx, %edx
shll $0x3, %edx
movq 0x800(%rax,%rdx), %rax
testq %rax, %rax
je 0x3a27e
cmpl %esi, 0xc(%rax)
jne 0x3a27e
retq
movq (%rdi), %rax
movslq 0x28(%rax), %rcx
testq %rcx, %rcx
jle 0x3a2be
movq 0x10(%rdi), %rdx
xorl %edi, %edi
movq (%rdx,%rdi,8), %r8
testq %r8, %r8
je 0x3a2ae
cmpl $0x4, 0x8(%r8)
jne 0x3a2ae
cmpl %esi, 0xc(%r8)
jne 0x3a2ae
xorl %r9d, %r9d
movq %r8, %rax
jmp 0x3a2b1
movb $0x1, %r9b
testb %r9b, %r9b
je 0x3a27d
incq %rdi
cmpq %rdi, %rcx
jne 0x3a290
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_decode.c
// Function: cram_decode_tlen
static int cram_decode_tlen(cram_fd *fd, cram_container *c, cram_slice *s,
                            cram_block *blk, int64_t *tlen) {
    int out_sz = 1, r = 0;

    if (!c->comp_hdr->codecs[DS_TS]) return -1;
    if (CRAM_MAJOR_VERS(fd->version) < 4) {
        int32_t i32;
        r |= c->comp_hdr->codecs[DS_TS]
            ->decode(s, c->comp_hdr->codecs[DS_TS], blk,
                     (char *)&i32, &out_sz);
        *tlen = i32;
    } else {
        r |= c->comp_hdr->codecs[DS_TS]
            ->decode(s, c->comp_hdr->codecs[DS_TS], blk,
                     (char *)tlen, &out_sz);
    }
    return r;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x1, (%rsp)
movq 0x48(%rsi), %rax
movq 0x330(%rax), %rsi
testq %rsi, %rsi
je 0x3c04c
movq %r8, %rbx
cmpl $0x3ff, 0xc(%rdi)       # imm = 0x3FF
jg 0x3c053
leaq 0x4(%rsp), %r14
movq %rsp, %r8
movq %rdx, %rdi
movq %rcx, %rdx
movq %r14, %rcx
callq *0x28(%rsi)
movslq (%r14), %rcx
movq %rcx, (%rbx)
jmp 0x3c062
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3c062
movq %rsp, %r8
movq %rdx, %rdi
movq %rcx, %rdx
movq %rbx, %rcx
callq *0x28(%rsi)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_io.h
// Function: block_resize
static inline int block_resize(cram_block *b, size_t len) {
    if (b->alloc > len)
        return 0;

#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
    // Removal of extra padding causes many more reallocs, but detects
    // more buffer overruns.
    return block_resize_exact(b, len?len:1);
#endif

    size_t alloc = b->alloc+800;
    alloc = MAX(alloc + (alloc>>2), len);
    return block_resize_exact(b, alloc);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x28(%rdi), %rax
xorl %ebx, %ebx
cmpq %rsi, %rax
ja 0x3c95b
movq %rsi, %r14
movq %rdi, %r15
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %rsi, %rax
cmovaq %rax, %r14
movq 0x20(%rdi), %rdi
movq %r14, %rsi
callq 0x4840
testq %rax, %rax
je 0x3c956
movq %r14, 0x28(%r15)
movq %rax, 0x20(%r15)
jmp 0x3c95b
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_decode.c
// Function: cram_decode_slice_mt
int cram_decode_slice_mt(cram_fd *fd, cram_container *c, cram_slice *s,
                         sam_hdr_t *bfd) {
    cram_decode_job *j;
    int nonblock;

    if (!fd->pool)
        return cram_decode_slice(fd, c, s, bfd);

    if (!(j = malloc(sizeof(*j))))
        return -1;

    j->fd = fd;
    j->c  = c;
    j->s  = s;
    j->h  = bfd;

    nonblock = hts_tpool_process_sz(fd->rqueue) ? 1 : 0;

    int saved_errno = errno;
    errno = 0;
    if (-1 == hts_tpool_dispatch2(fd->pool, fd->rqueue, cram_decode_slice_thread,
                                  j, nonblock)) {
        /* Would block */
        if (errno != EAGAIN)
            return -1;
        fd->job_pending = j;
    } else {
        fd->job_pending = NULL;
    }
    errno = saved_errno;

    // flush too
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
cmpq $0x0, 0x88b8(%rdi)
je 0x3f42e
movl $0x28, %edi
callq 0x4680
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x3f45f
movq %rax, %r14
movq %rbx, (%rax)
movq %r13, 0x8(%rax)
movq %r12, 0x10(%rax)
movq %r15, 0x18(%rax)
movq 0x88c0(%rbx), %rdi
callq 0x37496
xorl %r12d, %r12d
testl %eax, %eax
setne %r12b
callq 0x4050
movq %rax, %r15
movl (%rax), %r13d
movl $0x0, (%rax)
movq 0x88b8(%rbx), %rdi
movq 0x88c0(%rbx), %rsi
leaq -0xa6(%rip), %rdx       # 0x3f373
movq %r14, %rcx
movl %r12d, %r8d
callq 0x380d0
cmpl $-0x1, %eax
je 0x3f44d
xorl %r14d, %r14d
jmp 0x3f453
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3a564
cmpl $0xb, (%r15)
jne 0x3f45f
movq %r14, 0x8970(%rbx)
movl %r13d, (%r15)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_decode.c
// Function: cram_get_bam_seq
int cram_get_bam_seq(cram_fd *fd, bam_seq_t **bam) {
    cram_record *cr;
    cram_container *c;
    cram_slice *s;

    if (!(cr = cram_get_seq(fd)))
        return -1;

    c = fd->ctr;
    s = c->slice;

    return cram_to_bam(fd->header, fd, s, cr, s->curr_rec-1, bam);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x40128
testq %rax, %rax
je 0x40286
movq 0x18(%r14), %rdi
movq 0x38(%r14), %rcx
movq 0x90(%rcx), %rdx
movl 0xe4(%rdx), %r8d
decl %r8d
movq %r14, %rsi
movq %rax, %rcx
movq %rbx, %r9
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3f470
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_decode.c
// Function: add_md_char
static inline int add_md_char(cram_slice *s, int decode_md, char c, int32_t *md_dist) {
    if (decode_md) {
        BLOCK_APPEND_UINT(s->aux_blk, *md_dist);
        BLOCK_APPEND_CHAR(s->aux_blk, c);
        *md_dist = 0;
    }
    return 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
testl %esi, %esi
je 0x407f3
movq %rcx, %r14
movq %rdi, %r15
movl %edx, 0x4(%rsp)
movq 0x90(%rdi), %rbp
movl (%rcx), %r12d
movq 0x28(%rbp), %rax
movq 0x30(%rbp), %r13
addq $0xb, %r13
cmpq %r13, %rax
ja 0x40761
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%rbp), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x407ee
movq %r13, 0x28(%rbp)
movq %rax, 0x20(%rbp)
movq 0x20(%rbp), %r13
addq 0x30(%rbp), %r13
movq %r13, %rdi
movl %r12d, %esi
callq 0x40879
subq %r13, %rax
addq %rax, 0x30(%rbp)
movq 0x90(%r15), %r12
movq 0x28(%r12), %rax
movq 0x30(%r12), %r15
incq %r15
cmpq %r15, %rax
ja 0x407cb
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r15, %rax
cmovaq %rax, %r15
movq 0x20(%r12), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x407ee
movq %r15, 0x28(%r12)
movq %rax, 0x20(%r12)
movq 0x20(%r12), %rax
movq 0x30(%r12), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x30(%r12)
movl 0x4(%rsp), %edx
movb %dl, (%rax,%rcx)
movl $0x0, (%r14)
jmp 0x407f3
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_io.h
// Function: block_append_uint
static inline int block_append_uint(cram_block *b, unsigned int i) {
    if (block_grow(b, 11) < 0)
        return -1;

    unsigned char *cp = &b->data[b->byte];
    b->byte += append_uint32(cp, i) - cp;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movq 0x30(%rdi), %r14
addq $0xb, %r14
cmpq %r14, %rax
ja 0x40852
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r14, %rax
cmovaq %rax, %r14
movq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x4840
testq %rax, %rax
je 0x40872
movq %r14, 0x28(%rbx)
movq %rax, 0x20(%rbx)
movq 0x20(%rbx), %r14
addq 0x30(%rbx), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0x40879
subq %r14, %rax
addq %rax, 0x30(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4086d
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_encode.c
// Function: cram_update_curr_slice
void cram_update_curr_slice(cram_container *c, int version) {
    cram_slice *s = c->slice;
    if (c->multi_seq) {
        s->hdr->ref_seq_id    = -2;
        s->hdr->ref_seq_start = 0;
        s->hdr->ref_seq_span  = 0;
    } else if (c->curr_ref == -1 && CRAM_ge31(version)) {
        // Spec states span=0, but it broke our range queries.
        // See commit message for this and prior.
        s->hdr->ref_seq_id    = -1;
        s->hdr->ref_seq_start = 0;
        s->hdr->ref_seq_span  = 0;
    } else {
        s->hdr->ref_seq_id    = c->curr_ref;
        s->hdr->ref_seq_start = c->first_base;
        s->hdr->ref_seq_span  = MAX(0, c->last_base - c->first_base + 1);
    }
    s->hdr->num_records   = c->curr_rec;

    if (c->curr_slice == 0) {
        if (c->ref_seq_id != s->hdr->ref_seq_id)
            c->ref_seq_id  = s->hdr->ref_seq_id;
        c->ref_seq_start = c->first_base;
    }

    c->curr_slice++;
}

// Assembly:
movq 0x90(%rdi), %rax
cmpl $0x0, 0xac(%rdi)
je 0x49de7
movq (%rax), %rcx
movl $0xfffffffe, 0x4(%rcx)  # imm = 0xFFFFFFFE
jmp 0x49e0a
movl 0x78(%rdi), %edx
cmpl $-0x1, %edx
setne %r8b
cmpl $0x301, %esi            # imm = 0x301
setl %sil
movq (%rax), %rcx
orb %r8b, %sil
jne 0x49e3d
movl $0xffffffff, 0x4(%rcx)  # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rcx)
movl 0x68(%rdi), %edx
movq (%rax), %rcx
movl %edx, 0x18(%rcx)
movl 0x5c(%rdi), %eax
testl %eax, %eax
jne 0x49e37
movl 0x4(%rcx), %ecx
cmpl %ecx, 0x4(%rdi)
je 0x49e2c
movl %ecx, 0x4(%rdi)
movq 0xc8(%rdi), %rcx
movq %rcx, 0x8(%rdi)
incl %eax
movl %eax, 0x5c(%rdi)
retq
movl %edx, 0x4(%rcx)
movq 0xc8(%rdi), %rdx
movq %rdx, 0x8(%rcx)
movq 0xd0(%rdi), %rsi
subq %rdx, %rsi
leaq 0x1(%rsi), %rdx
xorl %r8d, %r8d
cmpq $-0x1, %rsi
cmovgeq %rdx, %r8
movq %r8, 0x10(%rcx)
jmp 0x49e11
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_encode.c
// Function: bam_aux2i_end
static inline int bam_aux2i_end(const uint8_t *aux, const uint8_t *aux_end) {
    int type = *aux++;
    switch (type) {
        case 'c':
            if (aux_end - aux < 1) {
                errno = EINVAL;
                return 0;
            }
            return *(int8_t *)aux;
        case 'C':
            if (aux_end - aux < 1) {
                errno = EINVAL;
                return 0;
            }
            return *aux;
        case 's':
            if (aux_end - aux < 2) {
                errno = EINVAL;
                return 0;
            }
            return le_to_i16(aux);
        case 'S':
            if (aux_end - aux < 2) {
                errno = EINVAL;
                return 0;
            }
            return le_to_u16(aux);
        case 'i':
            if (aux_end - aux < 4) {
                errno = EINVAL;
                return 0;
            }
            return le_to_i32(aux);
        case 'I':
            if (aux_end - aux < 4) {
                errno = EINVAL;
                return 0;
            }
            return le_to_u32(aux);
        default:
            errno = EINVAL;
    }
    return 0;
}

// Assembly:
pushq %rax
movzbl (%rdi), %eax
incq %rdi
cmpl $0x62, %eax
jg 0x4a916
cmpl $0x43, %eax
je 0x4a93f
cmpl $0x49, %eax
je 0x4a932
cmpl $0x53, %eax
jne 0x4a955
subq %rdi, %rsi
cmpq $0x1, %rsi
jle 0x4a955
movzwl (%rdi), %eax
jmp 0x4a962
cmpl $0x73, %eax
je 0x4a94c
cmpl $0x69, %eax
je 0x4a932
cmpl $0x63, %eax
jne 0x4a955
subq %rdi, %rsi
testq %rsi, %rsi
jle 0x4a955
movsbl (%rdi), %eax
jmp 0x4a962
subq %rdi, %rsi
cmpq $0x3, %rsi
jle 0x4a955
movl (%rdi), %eax
jmp 0x4a962
subq %rdi, %rsi
testq %rsi, %rsi
jle 0x4a955
movzbl (%rdi), %eax
jmp 0x4a962
subq %rdi, %rsi
cmpq $0x1, %rsi
jg 0x4a964
callq 0x4050
movl $0x16, (%rax)
xorl %eax, %eax
popq %rcx
retq
movswl (%rdi), %eax
jmp 0x4a962
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_encode.c
// Function: cram_add_base
static int cram_add_base(cram_fd *fd, cram_container *c,
                         cram_slice *s, cram_record *r,
                         int pos, char base, char qual) {
    cram_feature f;
    f.B.pos = pos+1;
    f.B.code = 'B';
    f.B.base = base;
    f.B.qual = qual;
    if (cram_stats_add(c->stats[DS_BA], base) < 0) return -1;
    if (cram_stats_add(c->stats[DS_QS], qual) < 0) return -1;
    BLOCK_APPEND_CHAR(s->qual_blk, qual);
    return cram_add_feature(c, s, r, &f);

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
incl %ecx
movl %ecx, (%rsp)
movl $0x42, 0x4(%rsp)
movl %r8d, 0x8(%rsp)
movl %r9d, 0xc(%rsp)
movq 0x1e8(%rdi), %rdi
movslq %r8d, %rsi
callq 0x589bb
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x4afdc
movq 0x158(%r15), %rdi
movsbq %bpl, %rsi
callq 0x589bb
testl %eax, %eax
js 0x4afdc
movq %rbx, 0x10(%rsp)
movq 0x78(%r14), %rbx
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %r13
incq %r13
cmpq %r13, %rax
ja 0x4afb2
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x4afdc
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x30(%rbx)
movb %bpl, (%rax,%rcx)
movq %rsp, %rcx
movq %r15, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
callq 0x4b33c
movl %eax, %r12d
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_encode.c
// Function: cram_add_quality
static int cram_add_quality(cram_fd *fd, cram_container *c,
                            cram_slice *s, cram_record *r,
                            int pos, char qual) {
    cram_feature f;
    f.Q.pos = pos+1;
    f.Q.code = 'Q';
    f.Q.qual = qual;
    if (cram_stats_add(c->stats[DS_QS], qual) < 0) return -1;
    BLOCK_APPEND_CHAR(s->qual_blk, qual);
    return cram_add_feature(c, s, r, &f);

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
incl %ecx
movl %ecx, 0x8(%rsp)
movl $0x51, 0xc(%rsp)
movl %r8d, 0x10(%rsp)
movq 0x158(%rdi), %rdi
movslq %r8d, %rsi
callq 0x589bb
testl %eax, %eax
js 0x4b13a
movq 0x78(%r14), %r13
movq 0x28(%r13), %rax
movq 0x30(%r13), %r12
incq %r12
cmpq %r12, %rax
ja 0x4b113
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r12, %rax
cmovaq %rax, %r12
movq 0x20(%r13), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0x4b13a
movq %r12, 0x28(%r13)
movq %rax, 0x20(%r13)
movq 0x20(%r13), %rax
movq 0x30(%r13), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x30(%r13)
movb %bpl, (%rax,%rcx)
leaq 0x8(%rsp), %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x4b33c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_encode.c
// Function: cram_add_feature
static int cram_add_feature(cram_container *c, cram_slice *s,
                            cram_record *r, cram_feature *f) {
    if (s->nfeatures >= s->afeatures) {
        s->afeatures = s->afeatures ? s->afeatures*2 : 1024;
        s->features = realloc(s->features, s->afeatures*sizeof(*s->features));
        if (!s->features)
            return -1;
    }

    if (!r->nfeature++) {
        r->feature = s->nfeatures;
        if (cram_stats_add(c->stats[DS_FP], f->X.pos) < 0)
            return -1;
    } else {
        if (cram_stats_add(c->stats[DS_FP],
                           f->X.pos - s->features[r->feature + r->nfeature-2].X.pos) < 0)
            return -1;

    }
    if (cram_stats_add(c->stats[DS_FC], f->X.code) < 0)
        return -1;

    s->features[s->nfeatures++] = *f;

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
movl 0x54(%rsi), %eax
cmpl %eax, 0x50(%rsi)
jb 0x4b383
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x400, %esi            # imm = 0x400
cmovnel %ecx, %esi
movl %esi, 0x54(%r14)
movq 0x48(%r14), %rdi
shlq $0x4, %rsi
callq 0x4840
movq %rax, 0x48(%r14)
testq %rax, %rax
je 0x4b412
movl 0x88(%r12), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x88(%r12)
testl %eax, %eax
je 0x4b3c1
movq 0x1d8(%r15), %rdi
movslq (%rbx), %rsi
movq 0x48(%r14), %rcx
movl 0x84(%r12), %edx
addl %edx, %eax
decl %eax
shlq $0x4, %rax
movslq (%rcx,%rax), %rax
subq %rax, %rsi
jmp 0x4b3d7
movl 0x50(%r14), %eax
movl %eax, 0x84(%r12)
movq 0x1d8(%r15), %rdi
movslq (%rbx), %rsi
callq 0x589bb
testl %eax, %eax
js 0x4b412
movq 0x1d0(%r15), %rdi
movslq 0x4(%rbx), %rsi
callq 0x589bb
testl %eax, %eax
js 0x4b412
movq 0x48(%r14), %rax
movl 0x50(%r14), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x50(%r14)
shlq $0x4, %rcx
movups (%rbx), %xmm0
movups %xmm0, (%rax,%rcx)
xorl %eax, %eax
jmp 0x4b417
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: kget_int32
static int kget_int32(kstring_t *k, size_t *pos, int32_t *val_p) {
    int sign = 1;
    int32_t val = 0;
    size_t p = *pos;

    while (p < k->l && (k->s[p] == ' ' || k->s[p] == '\t'))
        p++;

    if (p < k->l && k->s[p] == '-')
        sign = -1, p++;

    if (p >= k->l || !(k->s[p] >= '0' && k->s[p] <= '9'))
        return -1;

    while (p < k->l && k->s[p] >= '0' && k->s[p] <= '9') {
        int digit = k->s[p++]-'0';
        val = val*10 + digit;
    }

    *pos = p;
    *val_p = sign*val;

    return 0;
}

// Assembly:
movq (%rsi), %rcx
movq (%rdi), %r8
movl $0x1, %r9d
cmpq %r8, %rcx
setb %r10b
jae 0x4c4c9
movq 0x10(%rdi), %rax
movzbl (%rax,%rcx), %r11d
cmpl $0x20, %r11d
je 0x4c499
cmpl $0x9, %r11d
jne 0x4c4aa
incq %rcx
cmpq %r8, %rcx
setb %r10b
jne 0x4c488
movq %r8, %rcx
jmp 0x4c4c9
testb $0x1, %r10b
je 0x4c4c9
movq 0x10(%rdi), %rax
xorl %r9d, %r9d
cmpb $0x2d, (%rax,%rcx)
sete %r9b
addq %r9, %rcx
negl %r9d
orl $0x1, %r9d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %r8, %rcx
jae 0x4c51e
movq 0x10(%rdi), %rdi
movb (%rdi,%rcx), %r10b
addb $-0x30, %r10b
cmpb $0x9, %r10b
ja 0x4c51e
xorl %eax, %eax
xorl %r10d, %r10d
cmpq %r8, %rcx
jae 0x4c514
movb (%rdi,%rcx), %r11b
addb $-0x30, %r11b
cmpb $0x9, %r11b
ja 0x4c514
incq %rcx
movzbl %r11b, %r11d
leal (%r10,%r10,4), %r10d
leal (%r11,%r10,2), %r10d
cmpq %rcx, %r8
jne 0x4c4ef
movq %r8, %rcx
imull %r9d, %r10d
movq %rcx, (%rsi)
movl %r10d, (%rdx)
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: link_index
static void link_index(cram_fd *fd) {
    int i;
    cram_index *e_last = NULL;

    for (i = 0; i < fd->index_sz; i++) {
        e_last = link_index_(&fd->index[i], e_last);
    }

    if (e_last)
        e_last->e_next = NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x0, 0x8870(%rdi)
jle 0x4c55f
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %eax, %eax
movq 0x8878(%rbx), %rdi
addq %r14, %rdi
movq %rax, %rsi
callq 0x4d501
incq %r15
movslq 0x8870(%rbx), %rcx
addq $0x38, %r14
cmpq %rcx, %r15
jl 0x4c538
jmp 0x4c561
xorl %eax, %eax
testq %rax, %rax
je 0x4c56e
movq $0x0, 0x30(%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_index_free
void cram_index_free(cram_fd *fd) {
    int i;

    if (!fd->index)
        return;

    for (i = 0; i < fd->index_sz; i++) {
        cram_index_free_recurse(&fd->index[i]);
    }
    free(fd->index);

    fd->index = NULL;
}

// Assembly:
cmpq $0x0, 0x8878(%rdi)
je 0x4c5d3
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x8870(%rdi)
jle 0x4c5b7
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x8878(%rbx), %rdi
addq %r14, %rdi
callq 0x4c5d4
incq %r15
movslq 0x8870(%rbx), %rax
addq $0x38, %r14
cmpq %rax, %r15
jl 0x4c595
movq 0x8878(%rbx), %rdi
callq 0x45c0
movq $0x0, 0x8878(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_index_free_recurse
static void cram_index_free_recurse(cram_index *e) {
    if (e->e) {
        int i;
        for (i = 0; i < e->nslice; i++) {
            cram_index_free_recurse(&e->e[i]);
        }
        free(e->e);
    }
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x4c617
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jle 0x4c609
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x8(%rbx), %rdi
addq %r14, %rdi
callq 0x4c5d4
incq %r15
movslq (%rbx), %rax
addq $0x38, %r14
cmpq %rax, %r15
jl 0x4c5ee
movq 0x8(%rbx), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_index_last
cram_index *cram_index_last(cram_fd *fd, int refid, cram_index *from) {
    int slice;

    if (refid+1 < 0 || refid+1 >= fd->index_sz)
        return NULL;

    if (!from)
        from = &fd->index[refid+1];

    // Ref with nothing aligned against it.
    if (!from->e)
        return NULL;

    slice = fd->index[refid+1].nslice - 1;

    // e is the last entry in the nested containment list, but it may
    // contain further slices within it.
    cram_index *e = &from->e[slice];
    while (e->e_next)
        e = e->e_next;

    return e;
}

// Assembly:
cmpl $-0x1, %esi
jl 0x4c84c
incl %esi
cmpl 0x8870(%rdi), %esi
jge 0x4c84c
movl %esi, %eax
testq %rdx, %rdx
jne 0x4c81c
imulq $0x38, %rax, %rdx
addq 0x8878(%rdi), %rdx
movq 0x8(%rdx), %rcx
testq %rcx, %rcx
je 0x4c84c
movq 0x8878(%rdi), %rdx
imulq $0x38, %rax, %rax
movslq (%rdx,%rax), %rax
imulq $0x38, %rax, %rax
addq %rax, %rcx
addq $-0x38, %rcx
movq %rcx, %rax
movq 0x30(%rcx), %rcx
testq %rcx, %rcx
jne 0x4c83f
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_index_query_last
cram_index *cram_index_query_last(cram_fd *fd, int refid, hts_pos_t end) {
    cram_index *e = NULL, *prev_e;
    do {
        prev_e = e;
        e = cram_index_query(fd, refid, end, prev_e);
    } while (e);

    if (!prev_e)
        return NULL;
    e = prev_e;

    // Note: offset of e and e->e_next may be the same if we're using a
    // multi-ref container where a single container generates multiple
    // index entries.
    //
    // We need to keep iterating until offset differs in order to find
    // the genuine file offset for the end of container.
    do {
        prev_e = e;
        e = e->e_next;
    } while (e && e->offset == prev_e->offset);

    return prev_e;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
xorl %eax, %eax
movq %rax, %rbx
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0x4c618
testq %rax, %rax
jne 0x4c860
testq %rbx, %rbx
je 0x4c895
movq %rbx, %rax
movq 0x30(%rbx), %rbx
testq %rbx, %rbx
je 0x4c897
movq 0x28(%rbx), %rcx
cmpq 0x28(%rax), %rcx
je 0x4c87d
jmp 0x4c897
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_seek_to_refpos
int cram_seek_to_refpos(cram_fd *fd, cram_range *r) {
    int ret = 0;
    cram_index *e;

    if (r->refid == HTS_IDX_NONE) {
        ret = -2; goto err;
    }

    // Ideally use an index, so see if we have one.
    if ((e = cram_index_query(fd, r->refid, r->start, NULL))) {
        if (0 != cram_seek(fd, e->offset, SEEK_SET)) {
            ret = -1; goto err;
        }
    } else {
        // Absent from index, but this most likely means it simply has no data.
        ret = -2; goto err;
    }

    pthread_mutex_lock(&fd->range_lock);
    fd->range = *r;
    if (r->refid == HTS_IDX_NOCOOR) {
        fd->range.refid = -1;
        fd->range.start = 0;
    } else if (r->refid == HTS_IDX_START || r->refid == HTS_IDX_REST) {
        fd->range.refid = -2; // special case in cram_next_slice
    }
    pthread_mutex_unlock(&fd->range_lock);

    if (fd->ctr) {
        cram_free_container(fd->ctr);
        if (fd->ctr_mt && fd->ctr_mt != fd->ctr)
            cram_free_container(fd->ctr_mt);
        fd->ctr = NULL;
        fd->ctr_mt = NULL;
        fd->ooc = 0;
        fd->eof = 0;
    }

    return 0;

 err:
    // It's unlikely fd->range will be accessed after EOF or error,
    // but this maintains identical behaviour to the previous code.
    pthread_mutex_lock(&fd->range_lock);
    fd->range = *r;
    pthread_mutex_unlock(&fd->range_lock);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %esi
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
cmpl $-0x5, %esi
je 0x4c8e5
movq 0x8(%r14), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x4c618
testq %rax, %rax
je 0x4c8e5
movq 0x28(%rax), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x55990
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0x4c91f
leaq 0x8918(%rbx), %r15
movq %r15, %rdi
callq 0x4750
movups (%r14), %xmm0
movups %xmm0, 0x258(%rbx)
movq 0x10(%r14), %rax
movq %rax, 0x268(%rbx)
movq %r15, %rdi
callq 0x4340
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8918(%rbx), %r15
movq %r15, %rdi
callq 0x4750
movq 0x10(%r14), %rax
movq %rax, 0x268(%rbx)
movups (%r14), %xmm0
movups %xmm0, 0x258(%rbx)
movl (%r14), %eax
leal 0x4(%rax), %ecx
cmpl $0x2, %ecx
jae 0x4c95e
leaq 0x258(%rbx), %rax
movl $0xfffffffe, (%rax)     # imm = 0xFFFFFFFE
jmp 0x4c978
cmpl $-0x2, %eax
jne 0x4c978
movl $0xffffffff, 0x258(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x260(%rbx)
movq %r15, %rdi
callq 0x4340
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x4c9bf
leaq 0x38(%rbx), %r14
callq 0x5295e
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x4c9a5
cmpq (%r14), %rdi
je 0x4c9a5
callq 0x5295e
xorl %ebp, %ebp
movl %ebp, 0x8978(%rbx)
movl %ebp, 0x8890(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
jmp 0x4c912
xorl %ebp, %ebp
jmp 0x4c912
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_num_containers_between
int64_t cram_num_containers_between(cram_fd *fd,
                                    off_t cstart, off_t cend,
                                    int64_t *first, int64_t *last) {
    int64_t nc = 0, i;
    int64_t last_pos = -99;
    int64_t l_first = -1, l_last = -1;

    for (i = 0; i < fd->index_sz; i++) {
        int j = i+1 == fd->index_sz ? 0 : i+1; // maps "*" to end
        nc += cram_num_containers_between_(&fd->index[j], &last_pos, nc,
                                           cstart, cend, &l_first, &l_last);
    }

    if (first)
        *first = l_first;
    if (last)
        *last = l_last;

    return l_last - l_first + 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq $-0x63, 0x30(%rsp)
movq $-0x1, %rax
movq %rax, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movslq 0x8870(%rdi), %rax
testq %rax, %rax
jle 0x4d11b
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
xorl %ebp, %ebp
leaq 0x18(%rsp), %r14
xorl %ebx, %ebx
incq %rbx
cmpq %rax, %rbx
movl $0x0, %eax
cmovneq %rbx, %rax
imulq $0x38, %rax, %rdi
addq 0x8878(%r13), %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
leaq 0x30(%rsp), %rsi
movq %rbp, %rdx
movq %r12, %rcx
movq %r15, %r8
movq %r14, %r9
callq 0x4d15b
addq %rax, %rbp
movslq 0x8870(%r13), %rax
cmpq %rax, %rbx
jl 0x4d0d3
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x4d12d
movq 0x18(%rsp), %rax
movq %rax, (%rcx)
movq 0x28(%rsp), %rcx
testq %rcx, %rcx
je 0x4d13f
movq 0x10(%rsp), %rax
movq %rax, (%rcx)
movq 0x10(%rsp), %rax
subq 0x18(%rsp), %rax
incq %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_num_containers_between_
static int64_t cram_num_containers_between_(cram_index *e, int64_t *last_pos,
                                            int64_t nct,
                                            off_t cstart, off_t cend,
                                            int64_t *first, int64_t *last) {
    int64_t nc = 0, i;

    if (e->offset) {
        if (e->offset != *last_pos) {
            if (e->offset >= cstart && (!cend || e->offset <= cend)) {
                if (first && *first < 0)
                    *first = nct;
                if (last)
                    *last = nct;
            }
            nc++;
        }
        // else a new multi-ref in same container
        *last_pos = e->offset;
    }

    for (i = 0; i < e->nslice; i++)
        nc += cram_num_containers_between_(&e->e[i], last_pos, nc + nct,
                                           cstart, cend, first, last);

    return nc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r15
movq %r8, %r13
movq %rdx, %r10
movq %rsi, %rbp
movq 0x60(%rsp), %r11
movq 0x28(%rdi), %rax
testq %rax, %rax
je 0x4d18d
cmpq (%rbp), %rax
jne 0x4d191
xorl %ebx, %ebx
jmp 0x4d1c1
xorl %ebx, %ebx
jmp 0x4d1c9
movl $0x1, %ebx
cmpq %rcx, %rax
jl 0x4d1c1
testq %r13, %r13
setne %dl
cmpq %r13, %rax
setg %al
testb %al, %dl
jne 0x4d1c1
testq %r15, %r15
je 0x4d1b9
cmpq $0x0, (%r15)
jns 0x4d1b9
movq %r10, (%r15)
testq %r11, %r11
je 0x4d1c1
movq %r10, (%r11)
movq 0x28(%rdi), %rax
movq %rax, (%rbp)
cmpl $0x0, (%rdi)
jle 0x4d231
xorl %r14d, %r14d
xorl %r12d, %r12d
movq %rcx, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
movq %rbx, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
addq %r14, %rdi
leaq (%rbx,%r10), %rdx
movq %r11, (%rsp)
movq %rbp, %rsi
movq %r13, %r8
movq %r15, %r9
movq %r10, %rbx
callq 0x4d15b
movq 0x60(%rsp), %r11
movq 0x10(%rsp), %rdi
movq %rbx, %r10
movq 0x20(%rsp), %rbx
movq 0x18(%rsp), %rcx
addq %rax, %rbx
incq %r12
movslq (%rdi), %rax
addq $0x38, %r14
cmpq %rax, %r12
jl 0x4d1de
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_container_num2offset
off_t cram_container_num2offset(cram_fd *fd, int64_t num) {
    int nc = 0, i;
    int64_t last_pos = -9;
    cram_index *e = NULL;

    for (i = 0; i < fd->index_sz; i++) {
        int j = i+1 == fd->index_sz ? 0 : i+1; // maps "*" to end
        if (!fd->index[j].nslice)
            continue;
        if ((e = cram_container_num2offset_(&fd->index[j], num,
                                            &last_pos, &nc)))
            break;
    }

    return e ? e->offset : -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4(%rsp), %r15
movl $0x0, (%r15)
leaq 0x8(%rsp), %r12
movq $-0x9, (%r12)
movl $0x1, %r13d
xorl %eax, %eax
leal -0x1(%r13), %ecx
movl 0x8870(%r14), %edx
cmpl %edx, %ecx
jge 0x4d2cd
xorl %ecx, %ecx
cmpl %edx, %r13d
movl %r13d, %edx
cmovel %ecx, %edx
movq 0x8878(%r14), %rdi
imulq $0x38, %rdx, %rdx
cmpl $0x0, (%rdi,%rdx)
je 0x4d2c6
addq %rdx, %rdi
movl %ebx, %esi
movq %r12, %rdx
movq %r15, %rcx
callq 0x4d2ed
testq %rax, %rax
setne %cl
incl %r13d
testb %cl, %cl
je 0x4d285
testq %rax, %rax
je 0x4d2d8
movq 0x28(%rax), %rax
jmp 0x4d2df
movq $-0x1, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_container_num2offset_
static cram_index *cram_container_num2offset_(cram_index *e, int num,
                                              int64_t *last_pos, int *nc) {
    if (e->offset) {
        if (e->offset != *last_pos) {
            if (*nc == num)
                return e;
            (*nc)++;
        }
        // else a new multi-ref in same container
        *last_pos = e->offset;
    }

    int i;
    for (i = 0; i < e->nslice; i++) {
        cram_index *tmp = cram_container_num2offset_(&e->e[i], num,
                                                     last_pos, nc);
        if (tmp)
            return tmp;
    }


    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movl %esi, 0x4(%rsp)
movq %rdi, %rbx
movq 0x28(%rdi), %rax
testq %rax, %rax
je 0x4d31f
cmpq (%r15), %rax
je 0x4d31c
movl (%rcx), %edx
cmpl 0x4(%rsp), %edx
je 0x4d362
incl %edx
movl %edx, (%rcx)
movq %rax, (%r15)
cmpl $0x0, (%rbx)
jle 0x4d35b
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x8(%rbx), %rdi
addq %r12, %rdi
movl 0x4(%rsp), %esi
movq %r15, %rdx
movq %rcx, %rbp
callq 0x4d2ed
testq %rax, %rax
cmovneq %rax, %r13
jne 0x4d35f
incq %r14
movslq (%rbx), %rax
addq $0x38, %r12
cmpq %rax, %r14
movq %rbp, %rcx
jl 0x4d32a
xorl %ebx, %ebx
jmp 0x4d362
movq %r13, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_container_offset2num
int64_t cram_container_offset2num(cram_fd *fd, off_t pos) {
    int nc = 0, i;
    int64_t last_pos = -9;
    cram_index *e = NULL;

    for (i = 0; i < fd->index_sz; i++) {
        int j = i+1 == fd->index_sz ? 0 : i+1; // maps "*" to end
        if (!fd->index[j].nslice)
            continue;
        if ((e = cram_container_offset2num_(&fd->index[j], pos,
                                            &last_pos, &nc)))
            break;
    }

    return e ? nc : -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4(%rsp), %r15
movl $0x0, (%r15)
leaq 0x8(%rsp), %r12
movq $-0x9, (%r12)
movl $0x1, %r13d
xorl %eax, %eax
leal -0x1(%r13), %ecx
movl 0x8870(%r14), %edx
cmpl %edx, %ecx
jge 0x4d3f1
xorl %ecx, %ecx
cmpl %edx, %r13d
movl %r13d, %edx
cmovel %ecx, %edx
movq 0x8878(%r14), %rdi
imulq $0x38, %rdx, %rdx
cmpl $0x0, (%rdi,%rdx)
je 0x4d3ea
addq %rdx, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x4d413
testq %rax, %rax
setne %cl
incl %r13d
testb %cl, %cl
je 0x4d3a8
movslq 0x4(%rsp), %rdx
xorl %ecx, %ecx
cmpq $0x1, %rax
sbbq %rcx, %rcx
orq %rdx, %rcx
movq %rcx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_container_offset2num_
static cram_index *cram_container_offset2num_(cram_index *e, off_t pos,
                                              int64_t *last_pos, int *nc) {
    if (e->offset) {
        if (e->offset != *last_pos) {
            if (e->offset >= pos)
                return e;
            (*nc)++;
        }
        // else a new multi-ref in same container
        *last_pos = e->offset;
    }

    int i;
    for (i = 0; i < e->nslice; i++) {
        cram_index *tmp = cram_container_offset2num_(&e->e[i], pos,
                                                     last_pos, nc);
        if (tmp)
            return tmp;
    }


    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, (%rsp)
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq 0x28(%rdi), %rax
testq %rax, %rax
je 0x4d447
cmpq (%r15), %rax
je 0x4d444
cmpq %r12, %rax
jge 0x4d487
movq (%rsp), %rcx
incl (%rcx)
movq %rax, (%r15)
cmpl $0x0, (%rbx)
jle 0x4d480
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x8(%rbx), %rdi
addq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq (%rsp), %rcx
callq 0x4d413
testq %rax, %rax
cmovneq %rax, %rbp
jne 0x4d484
incq %r14
movslq (%rbx), %rax
addq $0x38, %r13
cmpq %rax, %r14
jl 0x4d452
xorl %ebx, %ebx
jmp 0x4d487
movq %rbp, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: cram_index_extents
int cram_index_extents(cram_fd *fd, int refid, hts_pos_t start, hts_pos_t end,
                       off_t *first, off_t *last) {
    cram_index *ci;

    if (first) {
        if (!(ci = cram_index_query(fd, refid, start, NULL)))
            return -1;
        *first = ci->offset;
    }

    if (last) {
        if (!(ci = cram_index_query_last(fd, refid, end)))
            return -1;
        *last = ci->offset;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r9, %rbx
movq %rcx, %r14
movl %esi, %ebp
movq %rdi, %r12
testq %r8, %r8
je 0x4d4cc
movq %r8, %r15
movq %r12, %rdi
movl %ebp, %esi
xorl %ecx, %ecx
callq 0x4c618
testq %rax, %rax
je 0x4d4ef
movq 0x28(%rax), %rax
movq %rax, (%r15)
xorl %r15d, %r15d
testq %rbx, %rbx
je 0x4d4f5
movq %r12, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x4c84f
testq %rax, %rax
je 0x4d4ef
movq 0x28(%rax), %rax
movq %rax, (%rbx)
jmp 0x4d4f5
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_index.c
// Function: link_index_
static cram_index *link_index_(cram_index *e, cram_index *e_last) {
    int i;
    if (e_last)
        e_last->e_next = e;

    // We don't want to link in the top-level cram_index with
    // offset=0 and start/end = INT_MIN/INT_MAX.
    if (e->offset)
        e_last = e;

    for (i = 0; i < e->nslice; i++)
        e_last = link_index_(&e->e[i], e_last);

    return e_last;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x4d515
movq %rbx, 0x30(%rax)
cmpq $0x0, 0x28(%rbx)
cmovneq %rbx, %rax
cmpl $0x0, (%rbx)
jle 0x4d547
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x8(%rbx), %rdi
addq %r14, %rdi
movq %rax, %rsi
callq 0x4d501
incq %r15
movslq (%rbx), %rcx
addq $0x38, %r14
cmpq %rcx, %r15
jl 0x4d529
popq %rbx
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/../htslib/hfile.h
// Function: hwrite
static inline ssize_t HTS_RESULT_USED
hwrite(hFILE *fp, const void *buffer, size_t nbytes)
{
    HTSLIB_EXPORT
    extern ssize_t hwrite2(hFILE *, const void *, size_t, size_t);
    HTSLIB_EXPORT
    extern int hfile_set_blksize(hFILE *fp, size_t bufsiz);

    if (!fp->mobile) {
        size_t n = fp->limit - fp->begin;
        if (n < nbytes) {
            hfile_set_blksize(fp, fp->limit - fp->buffer + nbytes);
            fp->end = fp->limit;
        }
    }

    size_t n = fp->limit - fp->begin;
    if (nbytes >= n && fp->begin == fp->buffer) {
        // Go straight to hwrite2 if the buffer is empty and the request
        // won't fit.
        return hwrite2(fp, buffer, nbytes, 0);
    }

    if (n > nbytes) n = nbytes;
    memcpy(fp->begin, buffer, n);
    fp->begin += n;
    return (n==nbytes)? (ssize_t) n : hwrite2(fp, buffer, nbytes, n);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testb $0x2, 0x30(%rdi)
jne 0x4db67
movq 0x18(%r15), %rsi
movq %rsi, %rax
subq 0x8(%r15), %rax
cmpq %rbx, %rax
jae 0x4db67
addq %rbx, %rsi
subq (%r15), %rsi
movq %r15, %rdi
callq 0xefdd
movq 0x18(%r15), %rax
movq %rax, 0x10(%r15)
movq 0x8(%r15), %rdi
movq 0x18(%r15), %r13
subq %rdi, %r13
cmpq %rbx, %r13
ja 0x4db7c
cmpq (%r15), %rdi
je 0x4dbb5
cmpq %rbx, %r13
movq %rbx, %r12
cmovbq %r13, %r12
movq %r14, %rsi
movq %r12, %rdx
callq 0x43c0
addq %r12, 0x8(%r15)
cmpq %rbx, %r13
jae 0x4dba8
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
jmp 0x4dbc0
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xf4c6
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_io.c
// Function: itf8_put_blk
int itf8_put_blk(cram_block *blk, int32_t val) {
    char buf[5];
    int sz;

    sz = itf8_put(buf, val);
    BLOCK_APPEND(blk, buf, sz);
    return sz;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %eax
movq %rdi, %rbx
cmpl $0x7f, %esi
ja 0x4e768
movb %al, 0x3(%rsp)
movl $0x1, %ebp
jmp 0x4e7ff
movl %eax, %ecx
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x4e786
shrl $0x8, %ecx
orb $-0x80, %cl
movb %cl, 0x3(%rsp)
movb %al, 0x4(%rsp)
movl $0x2, %ebp
jmp 0x4e7ff
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x4e7a6
shrl $0x10, %ecx
orb $-0x40, %cl
movb %cl, 0x3(%rsp)
movb %ah, 0x4(%rsp)
movb %al, 0x5(%rsp)
movl $0x3, %ebp
jmp 0x4e7ff
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x4e7cf
shrl $0x18, %ecx
orb $-0x20, %cl
movb %cl, 0x3(%rsp)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x4(%rsp)
movb %ah, 0x5(%rsp)
movb %al, 0x6(%rsp)
movl $0x4, %ebp
jmp 0x4e7ff
shrl $0x1c, %ecx
orb $-0x10, %cl
movb %cl, 0x3(%rsp)
movl %eax, %ecx
shrl $0x14, %ecx
movb %cl, 0x4(%rsp)
movl %eax, %ecx
shrl $0xc, %ecx
movb %cl, 0x5(%rsp)
movl %eax, %ecx
shrl $0x4, %ecx
movb %cl, 0x6(%rsp)
andb $0xf, %al
movb %al, 0x7(%rsp)
movl $0x5, %ebp
movl %ebp, %r14d
movq 0x30(%rbx), %r15
addq %r14, %r15
movq 0x28(%rbx), %rax
cmpq %r15, %rax
ja 0x4e846
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r15, %rax
cmovaq %rax, %r15
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x4e86c
movq %r15, 0x28(%rbx)
movq %rax, 0x20(%rbx)
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
leaq 0x3(%rsp), %rsi
movq %r14, %rdx
callq 0x43c0
addq %r14, 0x30(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x4e85f