LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/sam.c
// Function: bam_plp_destroy
void bam_plp_destroy(bam_plp_t iter)
{
    if ( iter->overlaps ) kh_destroy(olap_hash, iter->overlaps);
    mp_free(iter->mp, iter->dummy);
    mp_free(iter->mp, iter->head);
    if (iter->mp->cnt != 0)
        fprintf(stderr, "[bam_plp_destroy] memory leak: %d. Continue anyway.\n", iter->mp->cnt);
    mp_destroy(iter->mp);
    if (iter->b) bam_destroy1(iter->b);
    free(iter->plp);
    free(iter);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x68(%rdi), %r14
testq %r14, %r14
je 0x73201
movq 0x18(%r14), %rdi
callq 0x68a0
movq 0x10(%r14), %rdi
callq 0x68a0
movq 0x20(%r14), %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x68a0
movq (%rbx), %r14
movq 0x18(%rbx), %r15
decl (%r14)
movq $0x0, 0x50(%r15)
movl 0x8(%r14), %eax
cmpl %eax, 0x4(%r14)
jne 0x73242
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x100, %eax            # imm = 0x100
cmovnel %ecx, %eax
movl %eax, 0x8(%r14)
movq 0x10(%r14), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x6c80
movq %rax, 0x10(%r14)
movq 0x10(%r14), %rax
movslq 0x4(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r14)
movq %r15, (%rax,%rcx,8)
movq (%rbx), %r14
movq 0x8(%rbx), %r15
decl (%r14)
movq $0x0, 0x50(%r15)
movl 0x8(%r14), %eax
cmpl %eax, 0x4(%r14)
jne 0x73296
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x100, %eax            # imm = 0x100
cmovnel %ecx, %eax
movl %eax, 0x8(%r14)
movq 0x10(%r14), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x6c80
movq %rax, 0x10(%r14)
movq 0x10(%r14), %rax
movslq 0x4(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r14)
movq %r15, (%rax,%rcx,8)
movq (%rbx), %rax
movl (%rax), %edx
testl %edx, %edx
jne 0x7332a
movq (%rbx), %r14
cmpl $0x0, 0x4(%r14)
jle 0x732e9
xorl %r15d, %r15d
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rax
movq 0x28(%rax), %rdi
callq 0x68a0
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x68a0
incq %r15
movslq 0x4(%r14), %rax
cmpq %rax, %r15
jl 0x732bf
movq 0x10(%r14), %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x68a0
movq 0x50(%rbx), %r14
testq %r14, %r14
je 0x73314
movq 0x28(%r14), %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x68a0
movq 0x48(%rbx), %rdi
callq 0x68a0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x68a0
movq 0x4bca7(%rip), %rax     # 0xbefd8
movq (%rax), %rdi
leaq 0x274c4(%rip), %rsi     # 0x9a7ff
xorl %eax, %eax
callq 0x6a90
jmp 0x732b2
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/sam.c
// Function: bam_plp_auto
const bam_pileup1_t *bam_plp_auto(bam_plp_t iter, int *_tid, int *_pos, int *_n_plp)
{
    const bam_pileup1_t *plp;
    if (iter->func == 0 || iter->error) { *_n_plp = -1; return 0; }
    if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
    else { // no pileup line can be obtained; read alignments
        *_n_plp = 0;
        if (iter->is_eof) return 0;
        int ret;
        while ( (ret=iter->func(iter->data, iter->b)) >= 0) {
            if (bam_plp_push(iter, iter->b) < 0) {
                *_n_plp = -1;
                return 0;
            }
            if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
            // otherwise no pileup line can be returned; read the next alignment.
        }
        if ( ret < -1 ) { iter->error = ret; *_n_plp = -1; return 0; }
        bam_plp_push(iter, 0);
        if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
        return 0;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
cmpq $0x0, 0x58(%rdi)
je 0x74585
movq %rdi, %r15
cmpl $0x0, 0x38(%rdi)
je 0x74599
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rdx, %r14
movq %rsi, %r12
movq %r15, %rdi
movq %rbx, %rcx
callq 0x73347
testq %rax, %rax
jne 0x7458d
movl $0x0, (%rbx)
cmpl $0x0, 0x30(%r15)
jne 0x7458b
jmp 0x745e4
movq 0x50(%r15), %rsi
movq %r15, %rdi
callq 0x73af6
testl %eax, %eax
js 0x74585
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x73347
testq %rax, %rax
jne 0x7458d
movq 0x50(%r15), %rsi
movq 0x60(%r15), %rdi
callq *0x58(%r15)
testl %eax, %eax
jns 0x745be
cmpl $-0x1, %eax
je 0x745ff
movl %eax, 0x38(%r15)
jmp 0x74585
cmpl $0x0, 0x38(%r15)
jne 0x7460e
movl $0x1, 0x30(%r15)
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x73347
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/sam.c
// Function: bam_plp_reset
void bam_plp_reset(bam_plp_t iter)
{
    lbnode_t *p, *q;
    iter->max_tid = iter->max_pos = -1;
    iter->tid = iter->pos = 0;
    iter->is_eof = 0;
    for (p = iter->head; p->next;) {
        overlap_remove(iter, NULL);
        q = p->next;
        mp_free(iter->mp, p);
        p = q;
    }
    iter->head = iter->tail;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x2c(%rdi)
movl $0xffffffff, 0x28(%rdi) # imm = 0xFFFFFFFF
movq $0x0, 0x20(%rdi)
movq 0x8(%rdi), %r14
cmpq $0x0, 0x50(%r14)
je 0x746c9
movl $0x100, %ebp            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
callq 0x73974
movq 0x50(%r14), %r15
movq (%rbx), %r12
decl (%r12)
movq $0x0, 0x50(%r14)
movl 0x8(%r12), %eax
cmpl %eax, 0x4(%r12)
jne 0x746a9
leal (%rax,%rax), %ecx
testl %eax, %eax
cmovel %ebp, %ecx
movl %ecx, 0x8(%r12)
movq 0x10(%r12), %rdi
movslq %ecx, %rsi
shlq $0x3, %rsi
callq 0x6c80
movq %rax, 0x10(%r12)
movq 0x10(%r12), %rax
movslq 0x4(%r12), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r12)
movq %r14, (%rax,%rcx,8)
cmpq $0x0, 0x50(%r15)
movq %r15, %r14
jne 0x7465d
movq 0x10(%rbx), %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/sam.c
// Function: bam_mplp_auto
int bam_mplp_auto(bam_mplp_t iter, int *_tid, int *_pos, int *n_plp, const bam_pileup1_t **plp)
{
    int i, ret = 0;
    uint64_t new_min = (uint64_t)-1;
    for (i = 0; i < iter->n; ++i) {
        if (iter->pos[i] == iter->min) {
            int tid, pos;
            iter->plp[i] = bam_plp_auto(iter->iter[i], &tid, &pos, &iter->n_plp[i]);
            if ( iter->iter[i]->error ) return -1;
            iter->pos[i] = iter->plp[i] ? (uint64_t)tid<<32 | pos : 0;
        }
        if (iter->plp[i] && iter->pos[i] < new_min) new_min = iter->pos[i];
    }
    iter->min = new_min;
    if (new_min == (uint64_t)-1) return 0;
    *_tid = new_min>>32; *_pos = (uint32_t)new_min;
    for (i = 0; i < iter->n; ++i) {
        if (iter->pos[i] == iter->min) { // FIXME: valgrind reports "uninitialised value(s) at this line"
            n_plp[i] = iter->n_plp[i], plp[i] = iter->plp[i];
            ++ret;
        } else n_plp[i] = 0, plp[i] = 0;
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %r15
cmpl $0x0, (%rdi)
jle 0x74933
movq $-0x1, %r13
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x10(%r15), %rax
movq (%rax,%rbp,2), %rax
cmpq 0x8(%r15), %rax
jne 0x74904
movq 0x18(%r15), %rax
movq (%rax,%rbp,2), %rdi
movq 0x20(%r15), %rcx
addq %rbp, %rcx
leaq 0x4(%rsp), %rsi
movq %rsp, %rdx
callq 0x7456a
movq 0x28(%r15), %rcx
movq %rax, (%rcx,%rbp,2)
movq 0x18(%r15), %rax
movq (%rax,%rbp,2), %rax
cmpl $0x0, 0x38(%rax)
jne 0x749a8
movq 0x10(%r15), %rax
movq 0x28(%r15), %rcx
movq (%rcx,%rbp,2), %rcx
movl 0x4(%rsp), %edx
shlq $0x20, %rdx
movslq (%rsp), %rsi
orq %rdx, %rsi
testq %rcx, %rcx
cmoveq %rcx, %rsi
movq %rsi, (%rax,%rbp,2)
movq 0x28(%r15), %rax
cmpq $0x0, (%rax,%rbp,2)
je 0x7491e
movq 0x10(%r15), %rax
movq (%rax,%rbp,2), %rax
cmpq %r13, %rax
cmovbq %rax, %r13
incq %r12
movslq (%r15), %rax
addq $0x4, %rbp
cmpq %rax, %r12
jl 0x7489a
jmp 0x7493a
movq $-0x1, %r13
movq %r13, 0x8(%r15)
xorl %eax, %eax
cmpq $-0x1, %r13
je 0x749ad
movq %r13, %rcx
shrq $0x20, %rcx
movq 0x8(%rsp), %rdx
movl %ecx, (%rdx)
movq 0x10(%rsp), %rcx
movl %r13d, (%rcx)
cmpl $0x0, (%r15)
jle 0x749ad
xorl %ecx, %ecx
xorl %eax, %eax
movq 0x10(%r15), %rdx
cmpq %r13, (%rdx,%rcx,8)
jne 0x7498b
movq 0x20(%r15), %rdx
movl (%rdx,%rcx,4), %edx
movl %edx, (%r14,%rcx,4)
movq 0x28(%r15), %rdx
movq (%rdx,%rcx,8), %rdx
movq %rdx, (%rbx,%rcx,8)
incl %eax
jmp 0x7499b
movl $0x0, (%r14,%rcx,4)
movq $0x0, (%rbx,%rcx,8)
incq %rcx
movslq (%r15), %rdx
cmpq %rdx, %rcx
jl 0x74966
jmp 0x749ad
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/./cram/cram_io.h
// Function: safe_itf8_get
static inline int safe_itf8_get(const char *cp, const char *endp,
                                int32_t *val_p) {
    const unsigned char *up = (unsigned char *)cp;

    if (endp - cp < 5 &&
        (cp >= endp || endp - cp < itf8_bytes[up[0]>>4])) {
        *val_p = 0;
        return 0;
    }

    if (up[0] < 0x80) {
        *val_p =   up[0];
        return 1;
    } else if (up[0] < 0xc0) {
        *val_p = ((up[0] <<8) |  up[1])                           & 0x3fff;
        return 2;
    } else if (up[0] < 0xe0) {
        *val_p = ((up[0]<<16) | (up[1]<< 8) |  up[2])             & 0x1fffff;
        return 3;
    } else if (up[0] < 0xf0) {
        *val_p = ((up[0]<<24) | (up[1]<<16) | (up[2]<<8) | up[3]) & 0x0fffffff;
        return 4;
    } else {
        *val_p = ((up[0] & 0x0f)<<28) | (up[1]<<20) | (up[2]<<12) | (up[3]<<4) | (up[4] & 0x0f);
        return 5;
    }
}

// Assembly:
movq %rsi, %r8
subq %rdi, %r8
cmpq $0x4, %r8
jg 0x74ff7
xorl %ecx, %ecx
cmpq %rsi, %rdi
jae 0x7501b
movzbl (%rdi), %eax
shrl $0x4, %eax
leaq 0x23ac7(%rip), %rsi     # 0x98ab0
movslq (%rsi,%rax,4), %rsi
movl $0x0, %eax
cmpq %rsi, %r8
jl 0x7501d
movzbl (%rdi), %ecx
movl $0x1, %eax
testb %cl, %cl
jns 0x7501d
movzbl 0x1(%rdi), %eax
cmpb $-0x41, %cl
ja 0x75020
andl $0x3f, %ecx
shll $0x8, %ecx
orl %eax, %ecx
movl $0x2, %eax
jmp 0x7501d
xorl %eax, %eax
movl %ecx, (%rdx)
retq
cmpb $-0x21, %cl
ja 0x7503d
shll $0x8, %eax
movzbl 0x2(%rdi), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %eax, %ecx
orl %esi, %ecx
movl $0x3, %eax
jmp 0x7501d
cmpb $-0x11, %cl
ja 0x75063
shll $0x10, %eax
movzbl 0x2(%rdi), %esi
shll $0x8, %esi
movzbl 0x3(%rdi), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %eax, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl $0x4, %eax
jmp 0x7501d
shll $0x1c, %ecx
shll $0x14, %eax
orl %ecx, %eax
movzbl 0x2(%rdi), %ecx
shll $0xc, %ecx
orl %eax, %ecx
movzbl 0x3(%rdi), %eax
shll $0x4, %eax
orl %ecx, %eax
movzbl 0x4(%rdi), %ecx
andl $0xf, %ecx
orl %eax, %ecx
movl $0x5, %eax
jmp 0x7501d
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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) {
    if (slice->block_by_id && id >= 0 && id < 1024) {
        return slice->block_by_id[id];
    } else {
        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
setne %cl
cmpl $0x400, %esi            # imm = 0x400
setb %dl
testb %cl, %dl
je 0x7757f
movl %esi, %ecx
movq (%rax,%rcx,8), %rax
retq
movq (%rdi), %rax
movslq 0x20(%rax), %rcx
testq %rcx, %rcx
jle 0x775bf
movq 0x10(%rdi), %rdx
xorl %edi, %edi
movq (%rdx,%rdi,8), %r8
testq %r8, %r8
je 0x775af
cmpl $0x4, 0x8(%r8)
jne 0x775af
cmpl %esi, 0xc(%r8)
jne 0x775af
xorl %r9d, %r9d
movq %r8, %rax
jmp 0x775b2
movb $0x1, %r9b
testb %r9b, %r9b
je 0x775c1
incq %rdi
cmpq %rdi, %rcx
jne 0x77591
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 *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 = t_pool_results_queue_sz(fd->rqueue) ? 1 : 0;

    if (-1 == t_pool_dispatch2(fd->pool, fd->rqueue, cram_decode_slice_thread,
			       j, nonblock)) {
	/* Would block */
	fd->job_pending = j;
    } else {
	fd->job_pending = NULL;
    }

    // flush too
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
cmpq $0x0, 0x8860(%rdi)
je 0x7c2c2
movl $0x28, %edi
callq 0x69d0
testq %rax, %rax
je 0x7c2dc
movq %rax, %r14
movq %rbx, (%rax)
movq %r13, 0x8(%rax)
movq %r12, 0x10(%rax)
movq %r15, 0x18(%rax)
movq 0x8868(%rbx), %rdi
callq 0x65369
xorl %r8d, %r8d
testl %eax, %eax
setne %r8b
movq 0x8860(%rbx), %rdi
movq 0x8868(%rbx), %rsi
leaq -0x8a(%rip), %rdx       # 0x7c21e
movq %r14, %rcx
callq 0x6588f
cmpl $-0x1, %eax
je 0x7c2e3
movq $0x0, 0x88f0(%rbx)
jmp 0x7c2ea
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x77ea5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x7c2ec
movq %r14, 0x88f0(%rbx)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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;
    cram_stats_add(c->stats[DS_BA], base);
    cram_stats_add(c->stats[DS_QS], qual);
    BLOCK_APPEND_CHAR(s->qual_blk, qual);
    return cram_add_feature(c, s, r, &f);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %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 0x1b0(%rdi), %rdi
movl %r8d, %esi
callq 0x5d7f7
movq 0x120(%r15), %rdi
movl %ebp, %esi
callq 0x5d7f7
movq 0x70(%r14), %rcx
movq 0x28(%rcx), %rax
movq 0x30(%rcx), %rdx
leaq 0x1(%rdx), %rsi
cmpq %rsi, %rax
ja 0x85f76
movl $0x400, %r12d           # imm = 0x400
movq %rax, %xmm0
punpckldq 0x6102(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x610a(%rip), %xmm0     # 0x8c020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0xa8ce(%rip), %xmm1     # 0x907f8
cvttsd2si %xmm1, %rdx
movq %rdx, %rdi
subsd 0x121de(%rip), %xmm1    # 0x98118
cvttsd2si %xmm1, %rsi
sarq $0x3f, %rdi
andq %rdi, %rsi
orq %rdx, %rsi
testq %rax, %rax
cmoveq %r12, %rsi
movq %rsi, 0x28(%rcx)
movq 0x20(%rcx), %rdi
callq 0x6c80
movq 0x70(%r14), %rcx
movq %rax, 0x20(%rcx)
movq 0x28(%rcx), %rax
movq 0x30(%rcx), %rdx
leaq 0x1(%rdx), %rsi
cmpq %rsi, %rax
jbe 0x85f01
movq 0x20(%rcx), %rax
movq %rsi, 0x30(%rcx)
movb %bpl, (%rax,%rdx)
movq %rsp, %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x86606
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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;
    cram_stats_add(c->stats[DS_QS], qual);
    BLOCK_APPEND_CHAR(s->qual_blk, qual);
    return cram_add_feature(c, s, r, &f);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %r8d, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
incl %ecx
movl %ecx, (%rsp)
movl $0x51, 0x4(%rsp)
movl %r8d, 0x8(%rsp)
movq 0x120(%rdi), %rdi
movl %r8d, %esi
callq 0x5d7f7
movq 0x70(%r14), %rcx
movq 0x28(%rcx), %rax
movq 0x30(%rcx), %rdx
leaq 0x1(%rdx), %rsi
cmpq %rsi, %rax
ja 0x86069
movl $0x400, %r12d           # imm = 0x400
movq %rax, %xmm0
punpckldq 0x600f(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x6017(%rip), %xmm0     # 0x8c020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0xa7db(%rip), %xmm1     # 0x907f8
cvttsd2si %xmm1, %rdx
movq %rdx, %rdi
subsd 0x120eb(%rip), %xmm1    # 0x98118
cvttsd2si %xmm1, %rsi
sarq $0x3f, %rdi
andq %rdi, %rsi
orq %rdx, %rsi
testq %rax, %rax
cmoveq %r12, %rsi
movq %rsi, 0x28(%rcx)
movq 0x20(%rcx), %rdi
callq 0x6c80
movq 0x70(%r14), %rcx
movq %rax, 0x20(%rcx)
movq 0x28(%rcx), %rax
movq 0x30(%rcx), %rdx
leaq 0x1(%rdx), %rsi
cmpq %rsi, %rax
jbe 0x85ff4
movq 0x20(%rcx), %rax
movq %rsi, 0x30(%rcx)
movb %bpl, (%rax,%rdx)
movq %rsp, %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x86606
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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;
	cram_stats_add(c->stats[DS_FP], f->X.pos);
    } else {
	cram_stats_add(c->stats[DS_FP],
		       f->X.pos - s->features[r->feature + r->nfeature-2].X.pos);
    }
    cram_stats_add(c->stats[DS_FC], f->X.code);

    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 0x4c(%rsi), %eax
cmpl %eax, 0x48(%rsi)
jl 0x86650
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x400, %eax            # imm = 0x400
cmovnel %ecx, %eax
movl %eax, 0x4c(%r14)
movq 0x40(%r14), %rdi
movslq %eax, %rsi
shlq $0x4, %rsi
callq 0x6c80
movq %rax, 0x40(%r14)
testq %rax, %rax
je 0x866d0
movslq 0x68(%r12), %rcx
leaq 0x1(%rcx), %rax
movl %eax, 0x68(%r12)
testq %rcx, %rcx
je 0x86682
movq 0x1a0(%r15), %rdi
movl (%rbx), %esi
movq 0x40(%r14), %rcx
movslq 0x64(%r12), %rdx
addq %rax, %rdx
shlq $0x4, %rdx
subl -0x20(%rcx,%rdx), %esi
jmp 0x86694
movl 0x48(%r14), %eax
movl %eax, 0x64(%r12)
movq 0x1a0(%r15), %rdi
movl (%rbx), %esi
callq 0x5d7f7
movq 0x198(%r15), %rdi
movl 0x4(%rbx), %esi
callq 0x5d7f7
movq 0x40(%r14), %rax
movslq 0x48(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x48(%r14)
shlq $0x4, %rcx
movups (%rbx), %xmm0
movups %xmm0, (%rax,%rcx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x866c4
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_samtools.c
// Function: cram_header_to_bam
bam_hdr_t *cram_header_to_bam(SAM_hdr *h) {
    int i;
    bam_hdr_t *header = bam_hdr_init();

    header->l_text = ks_len(&h->text);
    header->text = malloc(header->l_text+1);
    memcpy(header->text, ks_str(&h->text), header->l_text);
    header->text[header->l_text] = 0;

    header->n_targets = h->nref;
    header->target_name = (char **)calloc(header->n_targets,
					  sizeof(char *));
    header->target_len = (uint32_t *)calloc(header->n_targets, 4);

    for (i = 0; i < h->nref; i++) {
	header->target_name[i] = strdup(h->ref[i].name);
	header->target_len[i] = h->ref[i].len;
    }

    return header;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x6cc94
movq %rax, %r14
movq (%rbx), %r15
movl %r15d, 0x8(%rax)
leal 0x1(%r15), %edi
callq 0x69d0
movq %rax, 0x28(%r14)
movq 0x10(%rbx), %rsi
movl %r15d, %edx
movq %rax, %rdi
callq 0x6570
movq 0x28(%r14), %rax
movl 0x8(%r14), %ecx
movb $0x0, (%rax,%rcx)
movslq 0x38(%rbx), %r15
movl %r15d, (%r14)
movl $0x8, %esi
movq %r15, %rdi
callq 0x6470
movq %rax, 0x20(%r14)
movl $0x4, %esi
movq %r15, %rdi
callq 0x6470
movq %rax, 0x10(%r14)
cmpl $0x0, 0x38(%rbx)
jle 0x86cbf
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x6dd0
movq 0x20(%r14), %rcx
movq %rax, (%rcx,%r15,2)
movq 0x40(%rbx), %rax
movl 0x8(%rax,%r15,8), %eax
movq 0x10(%r14), %rcx
movl %eax, (%rcx,%r15)
incq %r12
movslq 0x38(%rbx), %rax
addq $0x4, %r15
cmpq %rax, %r12
jl 0x86c89
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/knetfile.c
// Function: socket_connect
static int socket_connect(const char *host, const char *port)
{
#define __err_connect(func) do { perror(func); freeaddrinfo(res); return -1; } while (0)

	int ai_err, on = 1, fd;
	struct linger lng = { 0, 0 };
	struct addrinfo hints, *res = 0;
	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;
	/* In Unix/Mac, getaddrinfo() is the most convenient way to get
	 * server information. */
	if ((ai_err = getaddrinfo(host, port, &hints, &res)) != 0) { fprintf(stderr, "can't resolve %s:%s: %s\n", host, port, gai_strerror(ai_err)); return -1; }
	if ((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) __err_connect("socket");
	/* The following two setsockopt() are used by ftplib
	 * (http://nbpfaus.net/~pfau/ftplib/). I am not sure if they
	 * necessary. */
	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) __err_connect("setsockopt");
	if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1) __err_connect("setsockopt");
	if (connect(fd, res->ai_addr, res->ai_addrlen) != 0) __err_connect("connect");
	freeaddrinfo(res);
	return fd;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1, %eax
movl %eax, 0x14(%rsp)
xorl %edx, %edx
movq %rdx, 0x18(%rsp)
leaq 0x8(%rsp), %rcx
movq %rdx, (%rcx)
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movl %eax, 0x8(%rdx)
callq 0x6960
testl %eax, %eax
jne 0x86fc1
movq 0x8(%rsp), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x6190
cmpl $-0x1, %eax
je 0x86fee
movl %eax, %ebx
leaq 0x14(%rsp), %rcx
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x6d80
cmpl $-0x1, %eax
je 0x86ffa
leaq 0x18(%rsp), %rcx
movl %ebx, %edi
movl $0x1, %esi
movl $0xd, %edx
movl $0x8, %r8d
callq 0x6d80
cmpl $-0x1, %eax
je 0x87006
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
movl %ebx, %edi
callq 0x6580
testl %eax, %eax
jne 0x87012
movq 0x8(%rsp), %rdi
callq 0x69a0
jmp 0x87021
movq 0x38010(%rip), %rcx     # 0xbefd8
movq (%rcx), %r15
movl %eax, %edi
callq 0x6a30
leaq 0x14768(%rip), %rsi     # 0x9b741
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x6a90
jmp 0x8701c
leaq 0x8(%rsp), %rdi
callq 0x849a
jmp 0x8701c
leaq 0x8(%rsp), %rdi
callq 0x8480
jmp 0x8701c
leaq 0x8(%rsp), %rdi
callq 0x8466
jmp 0x8701c
leaq 0x8(%rsp), %rdi
callq 0x844c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/knetfile.c
// Function: kftp_send_cmd
static int kftp_send_cmd(knetFile *ftp, const char *cmd, int is_get)
{
	if (socket_wait(ftp->ctrl_fd, 0) <= 0) return -1; // socket is not ready for writing
    int len = strlen(cmd);
	if ( netwrite(ftp->ctrl_fd, cmd, len) != len ) return -1;
	return is_get? kftp_get_response(ftp) : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x20(%rdi), %edi
xorl %esi, %esi
callq 0x87be0
testl %eax, %eax
jle 0x8719a
movq %r14, %rdi
callq 0x62d0
movl 0x20(%rbx), %edi
movslq %eax, %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x6260
cmpq %r15, %rax
setne %al
testl %ebp, %ebp
sete %cl
orb %al, %cl
je 0x871a5
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x8702d
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/knetfile.c
// Function: kftp_parse_url
knetFile *kftp_parse_url(const char *fn, const char *mode)
{
	knetFile *fp;
	char *p;
	int l;
	if (strstr(fn, "ftp://") != fn) return 0;
	for (p = (char*)fn + 6; *p && *p != '/'; ++p);
	if (*p != '/') return 0;
	l = p - fn - 6;
	fp = (knetFile*)calloc(1, sizeof(knetFile));
	fp->type = KNF_TYPE_FTP;
	fp->fd = -1;
	/* the Linux/Mac version of socket_connect() also recognizes a port
	 * like "ftp", but the Windows version does not. */
	fp->port = strdup("21");
	fp->host = (char*)calloc(l + 1, 1);
	if (strchr(mode, 'c')) fp->no_reconnect = 1;
	strncpy(fp->host, fn + 6, l);
	fp->retr = (char*)calloc(strlen(p) + 8, 1);
	sprintf(fp->retr, "RETR %s\r\n", p);
    fp->size_cmd = (char*)calloc(strlen(p) + 8, 1);
    sprintf(fp->size_cmd, "SIZE %s\r\n", p);
	fp->seek_offset = 0;
	return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %r15
leaq 0xa3ca(%rip), %rsi      # 0x915c9
movl $0x6, %edx
callq 0x6330
testl %eax, %eax
je 0x87222
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movabsq $0x100000000, %rbp      # imm = 0x100000000
addq $0x6, %r15
xorl %r13d, %r13d
movq %r15, %rbx
movzbl (%rbx), %eax
testl %eax, %eax
je 0x8720d
cmpl $0x2f, %eax
je 0x8724a
incq %rbx
addq %rbp, %r13
jmp 0x87236
movl $0x1, %edi
movl $0x88, %esi
callq 0x6470
movq %rax, %r14
movabsq $-0xfffffffe, %rax      # imm = 0xFFFFFFFF00000002
movq %rax, (%r14)
leaq 0xac64(%rip), %rdi      # 0x91ed4
callq 0x6dd0
movq %rax, 0x18(%r14)
addq %r13, %rbp
sarq $0x20, %rbp
movl $0x1, %esi
movq %rbp, %rdi
callq 0x6470
movq %rax, %rbp
movq %rax, 0x10(%r14)
movq %r12, %rdi
movl $0x63, %esi
callq 0x6270
testq %rax, %rax
je 0x872ae
movl $0x1, 0x3c(%r14)
sarq $0x20, %r13
movq %rbp, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x6380
movq %rbx, %rdi
callq 0x62d0
leaq 0x8(%rax), %rdi
movl $0x1, %esi
callq 0x6470
movq %rax, 0x50(%r14)
leaq 0x14395(%rip), %rsi     # 0x9b676
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6170
movq %rbx, %rdi
callq 0x62d0
leaq 0x8(%rax), %rdi
movl $0x1, %esi
callq 0x6470
movq %rax, 0x58(%r14)
leaq 0xac1d(%rip), %rsi      # 0x91f2c
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6170
movq $0x0, 0x60(%r14)
jmp 0x87210
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/knetfile.c
// Function: my_netread
static off_t my_netread(int fd, void *buf, off_t len)
{
	off_t rest = len, curr, l = 0;
	/* recv() and read() may not read the required length of data with
	 * one call. They have to be called repeatedly. */
	while (rest) {
		if (socket_wait(fd, 1) <= 0) break; // socket is not ready for reading
		curr = netread(fd, (void*)((char*)buf + l), rest);
		/* According to the glibc manual, section 13.2, a zero returned
		 * value indicates end-of-file (EOF), which should mean that
		 * read() will not return zero if EOF has not been met but data
		 * are not immediately available. */
		if (curr == 0) break;
		l += curr; rest -= curr;
	}
	return l;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x8790c
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
xorl %ebx, %ebx
movl %ebp, %edi
movl $0x1, %esi
callq 0x87be0
testl %eax, %eax
jle 0x8790e
leaq (%r15,%rbx), %rsi
movl %ebp, %edi
movq %r14, %rdx
callq 0x6aa0
testq %rax, %rax
je 0x8790e
addq %rax, %rbx
subq %rax, %r14
jne 0x878df
jmp 0x8790e
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/knetfile.c
// Function: knet_open
knetFile *knet_open(const char *fn, const char *mode)
{
#ifdef KNETFILE_HOOKS
    if (alt_open)
        return alt_open(fn, mode);
#endif
	knetFile *fp = 0;
	if (mode[0] != 'r') {
		fprintf(stderr, "[kftp_open] only mode \"r\" is supported.\n");
		return 0;
	}
	if (strstr(fn, "ftp://") == fn) {
		fp = kftp_parse_url(fn, mode);
		if (fp == 0) return 0;
		if (kftp_connect(fp) == -1) {
			knet_close(fp);
			return 0;
		}
		kftp_connect_file(fp);
	} else if (strstr(fn, "http://") == fn) {
		fp = khttp_parse_url(fn, mode);
		if (fp == 0) return 0;
		khttp_connect_file(fp);
	} else { // local file
#ifdef _WIN32
		/* In windows, O_BINARY is necessary. In Linux/Mac, O_BINARY may
		 * be undefined on some systems, although it is defined on my
		 * Mac and the Linux I have tested on. */
		int fd = open(fn, O_RDONLY | O_BINARY);
#else		
		int fd = open(fn, O_RDONLY);
#endif
		if (fd == -1) {
			perror("open");
			return 0;
		}
		fp = (knetFile*)calloc(1, sizeof(knetFile));
		fp->type = KNF_TYPE_LOCAL;
		fp->fd = fd;
		fp->ctrl_fd = -1;
	}
	if (fp && fp->fd == -1) {
		knet_close(fp);
		return 0;
	}
	return fp;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpb $0x72, (%rsi)
jne 0x879f0
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x9c93(%rip), %rsi      # 0x915c9
movl $0x6, %edx
callq 0x6330
testl %eax, %eax
je 0x8799c
leaq 0x9c6d(%rip), %rsi      # 0x915b8
movl $0x7, %edx
movq %rbx, %rdi
callq 0x6330
movq %rbx, %rdi
testl %eax, %eax
je 0x879c6
xorl %esi, %esi
xorl %eax, %eax
callq 0x64c0
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x879ff
movl $0x1, %edi
movl $0x88, %esi
callq 0x6470
movq %rax, %rbx
movl $0x1, (%rax)
movl %ebp, 0x4(%rax)
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
cmpl $-0x1, %ebp
jne 0x879db
jmp 0x879f5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x871e7
testq %rax, %rax
je 0x879f5
movq %rax, %rbx
movq %rax, %rdi
callq 0x86e8c
cmpl $-0x1, %eax
je 0x879e6
movq %rbx, %rdi
callq 0x87329
jmp 0x879db
callq 0x874e2
testq %rax, %rax
je 0x879f5
movq %rax, %rbx
movq %rax, %rdi
callq 0x8767b
testq %rbx, %rbx
je 0x879f7
cmpl $-0x1, 0x4(%rbx)
jne 0x879f7
movq %rbx, %rdi
callq 0x87a0f
jmp 0x879f5
callq 0x8504
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x9d20(%rip), %rdi      # 0x91726
callq 0x6590
xorl %ebx, %ebx
jmp 0x87995
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/knetfile.c
// Function: knet_read
ssize_t knet_read(knetFile *fp, void *buf, size_t len)
{
#ifdef KNETFILE_HOOKS
       if (alt_read)  
               return alt_read(fp, buf, len);
#endif  

	off_t l = 0;
	if (fp->fd == -1) return 0;
	if (fp->type == KNF_TYPE_FTP) {
		if (fp->is_ready == 0) {
			if (!fp->no_reconnect) kftp_reconnect(fp);
			kftp_connect_file(fp);
		}
	} else if (fp->type == KNF_TYPE_HTTP) {
		if (fp->is_ready == 0)
			khttp_connect_file(fp);
	}
	if (fp->type == KNF_TYPE_LOCAL) { // on Windows, the following block is necessary; not on UNIX
		size_t rest = len;
		ssize_t curr;
		while (rest) {
			do {
				curr = read(fp->fd, (void*)((char*)buf + l), rest);
			} while (curr < 0 && EINTR == errno);
			if (curr < 0) return -1;
			if (curr == 0) break;
			l += curr; rest -= curr;
		}
	} else l = my_netread(fp->fd, buf, len);
	fp->offset += l;
	return l;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpl $-0x1, 0x4(%rdi)
je 0x87ad3
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl (%rdi), %eax
cmpl $0x3, %eax
je 0x87ad8
cmpl $0x2, %eax
jne 0x87ae6
cmpl $0x0, 0x40(%rbx)
jne 0x87ae6
cmpl $0x0, 0x3c(%rbx)
jne 0x87ac9
movq %rbx, %rdi
callq 0x871b7
movq %rbx, %rdi
callq 0x87329
jmp 0x87ae6
xorl %r12d, %r12d
jmp 0x87b40
cmpl $0x0, 0x40(%rbx)
jne 0x87ae6
movq %rbx, %rdi
callq 0x8767b
cmpl $0x1, (%rbx)
jne 0x87b22
xorl %r12d, %r12d
testq %r14, %r14
je 0x87b33
leaq (%r15,%r12), %r13
movl 0x4(%rbx), %edi
movq %r13, %rsi
movq %r14, %rdx
callq 0x6aa0
testq %rax, %rax
jns 0x87b16
callq 0x6060
cmpl $0x4, (%rax)
je 0x87af7
jmp 0x87b39
je 0x87b33
addq %rax, %r12
subq %rax, %r14
jne 0x87af3
jmp 0x87b33
movl 0x4(%rbx), %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x878c9
movq %rax, %r12
addq %r12, 0x8(%rbx)
jmp 0x87b40
movq $-0x1, %r12
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/knetfile.c
// Function: knet_seek
off_t knet_seek(knetFile *fp, off_t off, int whence)
{
#ifdef KNETFILE_HOOKS
       if (alt_seek)
               return alt_seek(fp, off, whence);
#endif

	if (whence == SEEK_SET && off == fp->offset) return 0;
	if (fp->type == KNF_TYPE_LOCAL) {
		/* Be aware that lseek() returns the offset after seeking, while fseek() returns zero on success. */
		off_t offset = lseek(fp->fd, off, whence);
		if (offset == -1) return -1;
		fp->offset = offset;
		return fp->offset;
	} else if (fp->type == KNF_TYPE_FTP) {
		if (whence == SEEK_CUR) fp->offset += off;
		else if (whence == SEEK_SET) fp->offset = off;
		else if (whence == SEEK_END) fp->offset = fp->file_size + off;
		else return -1;
		fp->is_ready = 0;
		return fp->offset;
	} else if (fp->type == KNF_TYPE_HTTP) {
		if (whence == SEEK_END) { // FIXME: can we allow SEEK_END in future?
			fprintf(stderr, "[knet_seek] SEEK_END is not supported for HTTP. Offset is unchanged.\n");
			errno = ESPIPE;
			return -1;
		}
		if (whence == SEEK_CUR) fp->offset += off;
		else if (whence == SEEK_SET) fp->offset = off;
		else return -1;
		fp->is_ready = 0;
		return fp->offset;
	}
	errno = EINVAL;
	fprintf(stderr,"[knet_seek] %s\n", strerror(errno));
	return -1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testl %edx, %edx
jne 0x87b5f
cmpq %rsi, 0x8(%rbx)
jne 0x87b5f
xorl %eax, %eax
jmp 0x87bde
movl (%rbx), %eax
cmpl $0x3, %eax
je 0x87b84
cmpl $0x2, %eax
je 0x87b9b
cmpl $0x1, %eax
jne 0x87bcb
movl 0x4(%rbx), %edi
callq 0x6df0
cmpq $-0x1, %rax
je 0x87bd7
movq %rax, 0x8(%rbx)
jmp 0x87bde
cmpl $0x1, %edx
je 0x87ba0
cmpl $0x2, %edx
je 0x87bd2
movq $-0x1, %rax
testl %edx, %edx
jne 0x87bde
jmp 0x87bba
cmpl $0x1, %edx
jne 0x87ba6
addq %rsi, 0x8(%rbx)
jmp 0x87bbe
testl %edx, %edx
je 0x87bba
movq $-0x1, %rax
cmpl $0x2, %edx
jne 0x87bde
addq 0x68(%rbx), %rsi
movq %rsi, 0x8(%rbx)
movl $0x0, 0x40(%rbx)
movq 0x8(%rbx), %rax
jmp 0x87bde
callq 0x854d
jmp 0x87bd7
callq 0x8520
movq $-0x1, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_codecs.c
// Function: cram_external_decode_int
int cram_external_decode_int(cram_slice *slice, cram_codec *c,
			     cram_block *in, char *out, int *out_size) {
    int l;
    char *cp;
    cram_block *b;

    /* Find the external block */
    b = cram_get_block_by_id(slice, c->external.content_id);
    if (!b)
        return *out_size?-1:0;

    cp = (char *)b->data + b->idx;
    // E_INT and E_LONG are guaranteed single item queries
    l = safe_itf8_get(cp, (char *)b->data + b->uncomp_size, (int32_t *)out);
    b->idx += l;
    *out_size = 1;

    return l > 0 ? 0 : -1;
}

// Assembly:
pushq %rbx
movl 0x30(%rsi), %edx
cmpq $0x400, %rdx            # imm = 0x400
setb %sil
movq 0x18(%rdi), %rax
testq %rax, %rax
setne %r9b
testb %r9b, %sil
je 0x87cad
movq (%rax,%rdx,8), %rax
jmp 0x87cf0
movq (%rdi), %rax
movslq 0x20(%rax), %rsi
testq %rsi, %rsi
jle 0x87cee
movq 0x10(%rdi), %rdi
xorl %r9d, %r9d
movq (%rdi,%r9,8), %r10
testq %r10, %r10
je 0x87cde
cmpl $0x4, 0x8(%r10)
jne 0x87cde
cmpl %edx, 0xc(%r10)
jne 0x87cde
xorl %r11d, %r11d
movq %r10, %rax
jmp 0x87ce1
movb $0x1, %r11b
testb %r11b, %r11b
je 0x87cf0
incq %r9
cmpq %r9, %rsi
jne 0x87cc0
xorl %eax, %eax
testq %rax, %rax
je 0x87d4d
movq 0x20(%rax), %rsi
movslq 0x1c(%rax), %rdi
movslq 0x14(%rax), %r10
movq %r10, %r11
subq %rdi, %r11
cmpq $0x4, %r11
jg 0x87d3a
movb $0x1, %r9b
xorl %edx, %edx
cmpl %r10d, %edi
jge 0x87d5a
movzbl (%rsi,%rdi), %r10d
shrl $0x4, %r10d
leaq 0x10d89(%rip), %rbx     # 0x98ab0
movslq (%rbx,%r10,4), %rbx
movl $0x0, %r10d
cmpq %rbx, %r11
jl 0x87e06
movzbl (%rsi,%rdi), %edx
testb %dl, %dl
js 0x87d62
movl $0x1, %r10d
jmp 0x87e03
cmpl $0x0, (%r8)
setne %r9b
jmp 0x87e13
xorl %r10d, %r10d
jmp 0x87e06
movzbl 0x1(%rsi,%rdi), %r9d
cmpb $-0x41, %dl
ja 0x87d81
andl $0x3f, %edx
shll $0x8, %edx
orl %r9d, %edx
movl $0x2, %r10d
jmp 0x87e03
cmpb $-0x21, %dl
ja 0x87da2
shll $0x8, %r9d
movzbl 0x2(%rsi,%rdi), %esi
andl $0x1f, %edx
shll $0x10, %edx
orl %r9d, %edx
orl %esi, %edx
movl $0x3, %r10d
jmp 0x87e03
cmpb $-0x11, %dl
ja 0x87dd0
shll $0x10, %r9d
movzbl 0x2(%rsi,%rdi), %r10d
shll $0x8, %r10d
movzbl 0x3(%rsi,%rdi), %esi
andl $0xf, %edx
shll $0x18, %edx
orl %r9d, %edx
orl %r10d, %edx
orl %esi, %edx
movl $0x4, %r10d
jmp 0x87e03
shll $0x1c, %edx
shll $0x14, %r9d
orl %edx, %r9d
movzbl 0x2(%rsi,%rdi), %edx
shll $0xc, %edx
orl %r9d, %edx
movzbl 0x3(%rsi,%rdi), %r9d
shll $0x4, %r9d
orl %edx, %r9d
movzbl 0x4(%rsi,%rdi), %edx
andl $0xf, %edx
orl %r9d, %edx
movl $0x5, %r10d
xorl %r9d, %r9d
movl %edx, (%rcx)
addl %r10d, 0x1c(%rax)
movl $0x1, (%r8)
movzbl %r9b, %eax
negl %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_codecs.c
// Function: cram_external_decode_char
int cram_external_decode_char(cram_slice *slice, cram_codec *c,
			      cram_block *in, char *out,
			      int *out_size) {
    char *cp;
    cram_block *b;

    /* Find the external block */
    b = cram_get_block_by_id(slice, c->external.content_id);
    if (!b)
        return *out_size?-1:0;

    cp = cram_extract_block(b, *out_size);
    if (!cp)
	return -1;

    memcpy(out, cp, *out_size);
    return 0;
}

// Assembly:
pushq %rax
movl 0x30(%rsi), %edx
cmpq $0x400, %rdx            # imm = 0x400
setb %sil
movq 0x18(%rdi), %rax
testq %rax, %rax
setne %r9b
testb %r9b, %sil
je 0x87e40
movq (%rax,%rdx,8), %rax
jmp 0x87e83
movq (%rdi), %rax
movslq 0x20(%rax), %rsi
testq %rsi, %rsi
jle 0x87e81
movq 0x10(%rdi), %rdi
xorl %r9d, %r9d
movq (%rdi,%r9,8), %r10
testq %r10, %r10
je 0x87e71
cmpl $0x4, 0x8(%r10)
jne 0x87e71
cmpl %edx, 0xc(%r10)
jne 0x87e71
xorl %r11d, %r11d
movq %r10, %rax
jmp 0x87e74
movb $0x1, %r11b
testb %r11b, %r11b
je 0x87e83
incq %r9
cmpq %r9, %rsi
jne 0x87e53
xorl %eax, %eax
movl (%r8), %edi
testq %rax, %rax
je 0x87ec1
movq 0x20(%rax), %rsi
movslq 0x1c(%rax), %rdx
addl %edx, %edi
movl %edi, 0x1c(%rax)
cmpl 0x14(%rax), %edi
setg %al
testq %rsi, %rsi
sete %dil
orb %al, %dil
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x87ec7
addq %rdx, %rsi
movslq (%r8), %rdx
movq %rcx, %rdi
callq 0x6570
xorl %eax, %eax
jmp 0x87ec7
xorl %eax, %eax
negl %edi
sbbl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_codecs.c
// Function: cram_external_decode_init
cram_codec *cram_external_decode_init(char *data, int size,
				      enum cram_external_type option,
				      int version) {
    cram_codec *c;
    char *cp = data;

    if (!(c = malloc(sizeof(*c))))
	return NULL;

    c->codec  = E_EXTERNAL;
    if (option == E_INT || option == E_LONG)
	c->decode = cram_external_decode_int;
    else if (option == E_BYTE_ARRAY || option == E_BYTE)
	c->decode = cram_external_decode_char;
    else
	c->decode = cram_external_decode_block;
    c->free   = cram_external_decode_free;
    
    cp += itf8_get(cp, &c->external.content_id);

    if (cp - data != size) {
	fprintf(stderr, "Malformed external header stream\n");
	free(c);
	return NULL;
    }

    c->external.type = option;

    return c;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movl $0x240, %edi            # imm = 0x240
callq 0x69d0
testq %rax, %rax
je 0x87fe2
movl $0x1, (%rax)
leal -0x1(%rbx), %ecx
cmpl $0x1, %ecx
ja 0x87f08
leaq -0x27e(%rip), %rcx      # 0x87c88
jmp 0x87f20
leal -0x3(%rbx), %ecx
cmpl $0x1, %ecx
ja 0x87f19
leaq -0xfc(%rip), %rcx       # 0x87e1b
jmp 0x87f20
leaq 0xc9(%rip), %rcx        # 0x87fe9
movq %rcx, 0x18(%rax)
leaq -0x62(%rip), %rcx       # 0x87ec9
movq %rcx, 0x10(%rax)
movzbl (%r14), %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x87fca
movzbl 0x1(%r14), %edx
cmpb $-0x41, %cl
ja 0x87f59
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x87fca
cmpb $-0x21, %cl
ja 0x87f77
shll $0x8, %edx
movzbl 0x2(%r14), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x87fca
cmpb $-0x11, %cl
ja 0x87f9f
shll $0x10, %edx
movzbl 0x2(%r14), %esi
shll $0x8, %esi
movzbl 0x3(%r14), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl $0x4, %edx
jmp 0x87fca
shll $0x1c, %ecx
shll $0x14, %edx
orl %ecx, %edx
movzbl 0x2(%r14), %ecx
shll $0xc, %ecx
orl %edx, %ecx
movzbl 0x3(%r14), %edx
shll $0x4, %edx
orl %ecx, %edx
movzbl 0x4(%r14), %ecx
andl $0xf, %ecx
orl %edx, %ecx
movl $0x5, %edx
movl %ecx, 0x30(%rax)
movslq %ebp, %rcx
cmpq %rcx, %rdx
jne 0x87fda
movl %ebx, 0x34(%rax)
jmp 0x87fe4
movq %rax, %rdi
callq 0x8580
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_codecs.c
// Function: cram_external_decode_block
static int cram_external_decode_block(cram_slice *slice, cram_codec *c,
				      cram_block *in, char *out_,
				      int *out_size) {
    char *cp;
    cram_block *b = NULL;
    cram_block *out = (cram_block *)out_;

    /* Find the external block */
    b = cram_get_block_by_id(slice, c->external.content_id);
    if (!b)
        return *out_size?-1:0;

    cp = cram_extract_block(b, *out_size);
    if (!cp)
	return -1;

    BLOCK_APPEND(out, cp, *out_size);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %rbx
movl 0x30(%rsi), %ecx
cmpq $0x400, %rcx            # imm = 0x400
setb %dl
movq 0x18(%rdi), %rax
testq %rax, %rax
setne %sil
testb %sil, %dl
je 0x8801a
movq (%rax,%rcx,8), %rax
jmp 0x8805c
movq (%rdi), %rax
movslq 0x20(%rax), %rdx
testq %rdx, %rdx
jle 0x8805a
movq 0x10(%rdi), %rsi
xorl %edi, %edi
movq (%rsi,%rdi,8), %r8
testq %r8, %r8
je 0x8804a
cmpl $0x4, 0x8(%r8)
jne 0x8804a
cmpl %ecx, 0xc(%r8)
jne 0x8804a
xorl %r9d, %r9d
movq %r8, %rax
jmp 0x8804d
movb $0x1, %r9b
testb %r9b, %r9b
je 0x8805c
incq %rdi
cmpq %rdi, %rdx
jne 0x8802c
xorl %eax, %eax
movl (%r14), %edx
testq %rax, %rax
je 0x88136
movq 0x20(%rax), %r15
movslq 0x1c(%rax), %rcx
addl %ecx, %edx
movl %edx, 0x1c(%rax)
cmpl 0x14(%rax), %edx
setg %al
testq %r15, %r15
sete %dl
orb %al, %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x8813c
addq %rcx, %r15
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
movslq (%r14), %rdx
leaq (%rdi,%rdx), %rcx
cmpq %rcx, %rax
ja 0x8811f
movl $0x400, %r12d           # imm = 0x400
movq %rax, %xmm0
punpckldq 0x3f58(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x3f60(%rip), %xmm0     # 0x8c020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x8724(%rip), %xmm1     # 0x907f8
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
subsd 0x10034(%rip), %xmm1    # 0x98118
cvttsd2si %xmm1, %rsi
sarq $0x3f, %rdx
andq %rdx, %rsi
orq %rcx, %rsi
testq %rax, %rax
cmoveq %r12, %rsi
movq %rsi, 0x28(%rbx)
movq 0x20(%rbx), %rdi
callq 0x6c80
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
movslq (%r14), %rdx
leaq (%rdi,%rdx), %rcx
cmpq %rcx, %rax
jbe 0x880ab
addq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x6570
movslq (%r14), %rax
addq %rax, 0x30(%rbx)
xorl %eax, %eax
jmp 0x8813c
xorl %eax, %eax
negl %edx
sbbl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_codecs.c
// Function: cram_external_encode_init
cram_codec *cram_external_encode_init(cram_stats *st,
				      enum cram_external_type option,
				      void *dat,
				      int version) {
    cram_codec *c;

    c = malloc(sizeof(*c));
    if (!c)
	return NULL;
    c->codec = E_EXTERNAL;
    c->free = cram_external_encode_free;
    if (option == E_INT || option == E_LONG)
	c->encode = cram_external_encode_int;
    else if (option == E_BYTE_ARRAY || option == E_BYTE)
	c->encode = cram_external_encode_char;
    else
	abort();
    c->store = cram_external_encode_store;

    c->e_external.content_id = (size_t)dat;

    return c;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %r14d
movl $0x240, %edi            # imm = 0x240
callq 0x69d0
testq %rax, %rax
je 0x884ad
movl $0x1, (%rax)
leaq -0x279(%rip), %rcx      # 0x8821e
movq %rcx, 0x10(%rax)
leal -0x1(%r14), %ecx
cmpl $0x2, %ecx
jae 0x884b1
leaq -0x363(%rip), %rcx      # 0x88148
jmp 0x884c2
xorl %eax, %eax
jmp 0x884d4
addl $-0x3, %r14d
cmpl $0x2, %r14d
jae 0x884dc
leaq -0x36a(%rip), %rcx      # 0x88158
movq %rcx, 0x20(%rax)
leaq -0x2a5(%rip), %rcx      # 0x88228
movq %rcx, 0x28(%rax)
movl %ebx, 0x30(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x63c0
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_codecs.c
// Function: cram_beta_decode_int
int cram_beta_decode_int(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int32_t *out_i = (int32_t *)out;
    int i, n;

    if (c->beta.nbits) {
        if (cram_not_enough_bits(in, c->beta.nbits))
            return -1;

	for (i = 0, n = *out_size; i < n; i++)
	    out_i[i] = get_bits_MSB(in, c->beta.nbits) - c->beta.offset;
    } else {
	for (i = 0, n = *out_size; i < n; i++)
	    out_i[i] = -c->beta.offset;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rsi, %r15
movl 0x34(%rsi), %eax
testq %rax, %rax
je 0x88556
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x88579
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
jbe 0x88579
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x8852c
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
cmpq %rax, %rcx
jb 0x88579
movslq (%r8), %r13
testq %r13, %r13
jle 0x88576
xorl %r14d, %r14d
xorl %ebp, %ebp
movl 0x34(%r15), %esi
movq %r12, %rdi
callq 0x8858b
subl 0x30(%r15), %eax
movl %eax, (%rbx,%rbp,4)
incq %rbp
cmpq %rbp, %r13
jne 0x88539
jmp 0x88579
movslq (%r8), %rax
testq %rax, %rax
jle 0x88576
xorl %r14d, %r14d
xorl %ecx, %ecx
xorl %edx, %edx
subl 0x30(%r15), %edx
movl %edx, (%rbx,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x88563
jmp 0x88579
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_codecs.c
// Function: cram_beta_decode_char
int cram_beta_decode_char(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int i, n;


    if (c->beta.nbits) {
        if (cram_not_enough_bits(in, c->beta.nbits))
            return -1;

	for (i = 0, n = *out_size; i < n; i++)
	    out[i] = get_bits_MSB(in, c->beta.nbits) - c->beta.offset;
    } else {
	for (i = 0, n = *out_size; i < n; i++)
	    out[i] = -c->beta.offset;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rsi, %r15
movl 0x34(%rsi), %eax
testq %rax, %rax
je 0x88874
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x8889b
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
jbe 0x8889b
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x8884a
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
cmpq %rax, %rcx
jb 0x8889b
movslq (%r8), %r13
testq %r13, %r13
jle 0x88898
xorl %r14d, %r14d
xorl %ebp, %ebp
movl 0x34(%r15), %esi
movq %r12, %rdi
callq 0x8858b
subl 0x30(%r15), %eax
movb %al, (%rbx,%rbp)
incq %rbp
cmpq %rbp, %r13
jne 0x88857
jmp 0x8889b
movslq (%r8), %rax
testq %rax, %rax
jle 0x88898
xorl %r14d, %r14d
xorl %ecx, %ecx
movb 0x30(%r15), %dl
xorl %esi, %esi
subb %dl, %sil
movb %sil, (%rbx,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x88881
jmp 0x8889b
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq