LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_write
ssize_t bgzf_write(BGZF *fp, const void *data, size_t length)
{
    if ( !fp->is_compressed )
        return hwrite(fp->fp, data, length);

    const uint8_t *input = (const uint8_t*)data;
    ssize_t remaining = length;
    assert(fp->is_write);
    while (remaining > 0) {
        uint8_t* buffer = (uint8_t*)fp->uncompressed_block;
        int copy_length = BGZF_BLOCK_SIZE - fp->block_offset;
        if (copy_length > remaining) copy_length = remaining;
        memcpy(buffer + fp->block_offset, input, copy_length);
        fp->block_offset += copy_length;
        input += copy_length;
        remaining -= copy_length;
        if (fp->block_offset == BGZF_BLOCK_SIZE) {
            if (lazy_flush(fp) != 0) return -1;
        }
    }
    return length - remaining;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl (%rdi), %eax
testl $0x60000000, %eax       # imm = 0x60000000
je 0x4410b
testl $0x30000, %eax          # imm = 0x30000
je 0x44169
movq %rbx, %r13
testq %rbx, %rbx
jle 0x44103
movq %rbx, %r13
movslq 0xc(%r15), %rdi
movl $0xff00, %eax           # imm = 0xFF00
subq %rdi, %rax
cmpq %rax, %r13
movl %r13d, %ecx
cmovgel %eax, %ecx
addq 0x20(%r15), %rdi
movslq %ecx, %r12
movq %r14, %rsi
movq %r12, %rdx
callq 0x4420
movl 0xc(%r15), %eax
addl %r12d, %eax
movl %eax, 0xc(%r15)
cmpl $0xff00, %eax           # imm = 0xFF00
jne 0x440f8
movq %r15, %rdi
callq 0x44045
testl %eax, %eax
jne 0x44155
addq %r12, %r14
subq %r12, %r13
testq %r13, %r13
jg 0x440b3
subq %r13, %rbx
movq %rbx, %r15
jmp 0x4415c
movq 0x38(%r15), %r12
movq 0x8(%r12), %rdi
movq 0x18(%r12), %r13
subq %rdi, %r13
cmpq %rbx, %r13
movq %rbx, %r15
cmovbq %r13, %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x4420
addq %r15, 0x8(%r12)
cmpq %rbx, %r13
jae 0x4415c
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x47309
movq $-0x1, %r15
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0xfc9b(%rip), %rdi      # 0x53e0b
leaq 0xfa8e(%rip), %rsi      # 0x53c05
leaq 0xfc9a(%rip), %rcx      # 0x53e18
movl $0x3a9, %edx            # imm = 0x3A9
callq 0x4350
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: mt_destroy
static void mt_destroy(mtaux_t *mt)
{
    int i;
    // signal all workers to quit
    pthread_mutex_lock(&mt->lock);
    mt->done = 1; mt->proc_cnt = 0;
    pthread_cond_broadcast(&mt->cv);
    pthread_mutex_unlock(&mt->lock);
    for (i = 1; i < mt->n_threads; ++i) pthread_join(mt->tid[i], 0); // worker 0 is effectively launched by the master thread
    // free other data allocated on heap
    for (i = 0; i < mt->n_blks; ++i) free(mt->blk[i]);
    for (i = 0; i < mt->n_threads; ++i) free(mt->w[i].buf);
    free(mt->blk); free(mt->len); free(mt->w); free(mt->tid);
    pthread_cond_destroy(&mt->cv);
    pthread_mutex_destroy(&mt->lock);
    free(mt);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0x47a0
movl $0x1, 0xc(%rbx)
movl $0x0, 0x10(%rbx)
leaq 0x60(%rbx), %r15
movq %r15, %rdi
callq 0x41e0
movq %r14, %rdi
callq 0x43f0
movl (%rbx), %eax
cmpl $0x2, %eax
jl 0x44481
movl $0x1, %r12d
movq 0x30(%rbx), %rax
movq (%rax,%r12,8), %rdi
xorl %esi, %esi
callq 0x4490
incq %r12
movslq (%rbx), %rax
cmpq %rax, %r12
jl 0x44467
cmpl $0x0, 0x4(%rbx)
jle 0x444a5
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rdi
callq 0x4610
incq %r12
movslq 0x4(%rbx), %rax
cmpq %rax, %r12
jl 0x4448a
movl (%rbx), %eax
testl %eax, %eax
jle 0x444ce
movl $0x8, %r12d
xorl %r13d, %r13d
movq 0x28(%rbx), %rax
movq (%rax,%r12), %rdi
callq 0x4610
incq %r13
movslq (%rbx), %rax
addq $0x20, %r12
cmpq %rax, %r13
jl 0x444b2
movq 0x18(%rbx), %rdi
callq 0x4610
movq 0x20(%rbx), %rdi
callq 0x4610
movq 0x28(%rbx), %rdi
callq 0x4610
movq 0x30(%rbx), %rdi
callq 0x4610
movq %r15, %rdi
callq 0x4a20
movq %r14, %rdi
callq 0x45e0
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4610
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_index_destroy
void bgzf_index_destroy(BGZF *fp)
{
    if ( !fp->idx ) return;
    free(fp->idx->offs);
    free(fp->idx);
    fp->idx = NULL;
    fp->idx_build_otf = 0;
}

// Assembly:
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x44542
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rax), %rdi
callq 0x4610
movq 0x48(%rbx), %rdi
callq 0x4610
movq $0x0, 0x48(%rbx)
movl $0x0, 0x50(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_check_EOF
int bgzf_check_EOF(BGZF *fp)
{
    uint8_t buf[28];
    off_t offset = htell(fp->fp);
    if (hseek(fp->fp, -28, SEEK_END) < 0) {
        if (errno == ESPIPE) { hclearerr(fp->fp); return 2; }
        else return -1;
    }
    if ( hread(fp->fp, buf, 28) != 28 ) return -1;
    if ( hseek(fp->fp, offset, SEEK_SET) < 0 ) return -1;
    return (memcmp("\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\033\0\3\0\0\0\0\0\0\0\0\0", buf, 28) == 0)? 1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
movq 0x28(%rdi), %r14
addq 0x8(%rdi), %r14
subq (%rdi), %r14
movq $-0x1c, %rsi
movl $0x2, %edx
callq 0x473bc
testq %rax, %rax
js 0x44625
movq 0x38(%rbx), %r12
movq 0x8(%r12), %r13
movq 0x10(%r12), %rbp
subq %r13, %rbp
cmpq $0x1c, %rbp
movl $0x1c, %r15d
cmovbq %rbp, %r15
movq %rsp, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x4420
addq %r15, %r13
movq %r13, 0x8(%r12)
cmpq $0x1b, %rbp
ja 0x445d7
movq %rsp, %rsi
movl $0x1c, %edx
movq %r12, %rdi
movq %r15, %rcx
callq 0x4716b
movq %rax, %r15
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq $0x1c, %r15
jne 0x44644
movq 0x38(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x473bc
testq %rax, %rax
js 0x44644
movdqu 0xc(%rsp), %xmm0
pcmpeqb 0xf5ad(%rip), %xmm0     # 0x53bb0
movdqa (%rsp), %xmm1
pcmpeqb 0xf5b0(%rip), %xmm1     # 0x53bc0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
xorl %ebp, %ebp
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bpl
jmp 0x44644
callq 0x4070
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x1d, (%rax)
jne 0x44644
movq 0x38(%rbx), %rax
movl $0x0, 0x34(%rax)
movl $0x2, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_seek
int64_t bgzf_seek(BGZF* fp, int64_t pos, int where)
{
    int block_offset;
    int64_t block_address;

    if (fp->is_write || where != SEEK_SET) {
        fp->errcode |= BGZF_ERR_MISUSE;
        return -1;
    }
    block_offset = pos & 0xFFFF;
    block_address = pos >> 16;
    if (hseek(fp->fp, block_address, SEEK_SET) < 0) {
        fp->errcode |= BGZF_ERR_IO;
        return -1;
    }
    fp->block_length = 0;  // indicates current block has not been loaded
    fp->block_address = block_address;
    fp->block_offset = block_offset;
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %eax
movl %eax, %ecx
andl $0x30000, %ecx          # imm = 0x30000
orl %edx, %ecx
je 0x44679
orl $0x8, %eax
movl %eax, (%rbx)
movq $-0x1, %rax
jmp 0x446aa
movq %rsi, %r14
movq %rsi, %r15
sarq $0x10, %r15
movq 0x38(%rbx), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x473bc
testq %rax, %rax
js 0x446b0
movzwl %r14w, %eax
movl $0x0, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movl %eax, 0xc(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
orb $0x4, (%rbx)
jmp 0x44670
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_is_bgzf
int bgzf_is_bgzf(const char *fn)
{
    uint8_t buf[16];
    int n;
    hFILE *fp;
    if ((fp = hopen(fn, "r")) == 0) return 0;
    n = hread(fp, buf, 16);
    if ( hclose(fp) < 0 ) return -1;
    if (n != 16) return 0;
    return memcmp(g_magic, buf, 16) == 0? 1 : 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
leaq 0xd278(%rip), %rsi      # 0x51941
callq 0x477e9
xorl %ebx, %ebx
testq %rax, %rax
je 0x4475a
movq %rax, %r14
movq 0x8(%rax), %r12
movq 0x10(%rax), %r13
subq %r12, %r13
cmpq $0x10, %r13
movl $0x10, %r15d
cmovbq %r13, %r15
movq %rsp, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4420
addq %r15, %r12
movq %r12, 0x8(%r14)
cmpq $0xf, %r13
ja 0x44726
movq %rsp, %rsi
movl $0x10, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4716b
movq %rax, %r15
movq %r14, %rdi
callq 0x4745b
testl %eax, %eax
js 0x44755
cmpl $0x10, %r15d
jne 0x4475a
movdqa (%rsp), %xmm0
pcmpeqb 0xf47b(%rip), %xmm0     # 0x53bc0
pmovmskb %xmm0, %eax
xorl %ebx, %ebx
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bl
jmp 0x4475a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_getc
int bgzf_getc(BGZF *fp)
{
    int c;
    if (fp->block_offset >= fp->block_length) {
        if (bgzf_read_block(fp) != 0) return -2; /* error */
        if (fp->block_length == 0) return -1; /* end-of-file */
    }
    c = ((unsigned char*)fp->uncompressed_block)[fp->block_offset++];
    if (fp->block_offset == fp->block_length) {
        fp->block_address = htell(fp->fp);
        fp->block_offset = 0;
        fp->block_length = 0;
    }
    fp->uncompressed_address++;
    return c;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x8(%rdi), %ecx
movl 0xc(%rdi), %eax
cmpl %ecx, %eax
jge 0x447ad
movq 0x20(%rbx), %rdx
leal 0x1(%rax), %esi
movl %esi, 0xc(%rbx)
cltq
movzbl (%rdx,%rax), %eax
cmpl %ecx, %esi
jne 0x447a7
movq 0x38(%rbx), %rcx
movq 0x28(%rcx), %rdx
addq 0x8(%rcx), %rdx
subq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
movq $0x0, 0x8(%rbx)
incq 0x18(%rbx)
jmp 0x447c0
movq %rbx, %rdi
callq 0x42e17
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testl %ecx, %ecx
je 0x447c2
popq %rbx
retq
movl 0x8(%rbx), %ecx
testl %ecx, %ecx
je 0x447ce
movl 0xc(%rbx), %eax
jmp 0x44778
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x447c0
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_index_build_init
int bgzf_index_build_init(BGZF *fp)
{
    bgzf_index_destroy(fp);
    fp->idx = (bgzidx_t*) calloc(1,sizeof(bgzidx_t));
    if ( !fp->idx ) return -1;
    fp->idx_build_otf = 1;  // build index on the fly
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x44513
movl $0x1, %edi
movl $0x18, %esi
callq 0x4360
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x449c7
movl $0x1, 0x50(%rbx)
xorl %eax, %eax
jmp 0x449cc
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: worker_aux
static int worker_aux(worker_t *w)
{
    int i, stop = 0;
    // wait for condition: to process or all done
    pthread_mutex_lock(&w->mt->lock);
    while (!w->toproc && !w->mt->done)
        pthread_cond_wait(&w->mt->cv, &w->mt->lock);
    if (w->mt->done) stop = 1;
    w->toproc = 0;
    pthread_mutex_unlock(&w->mt->lock);
    if (stop) return 1; // to quit the thread
    w->errcode = 0;
    for (i = w->i; i < w->mt->curr; i += w->mt->n_threads) {
        size_t clen = BGZF_MAX_BLOCK_SIZE;
        int ret = bgzf_compress(w->buf, &clen, w->mt->blk[i], w->mt->len[i], w->compress_level);
        if (ret != 0) {
            if (hts_verbose >= 2) fprintf(stderr, "[E::%s] bgzf_compress error %d\n", __func__, ret);
            w->errcode |= BGZF_ERR_ZLIB; // Report error
            // We're not going to do any more, so set remaining lengths to 0
            for (; i < w->mt->curr; i += w->mt->n_threads) w->mt->len[i] = 0;
            break; // Give up
        } else {
            memcpy(w->mt->blk[i], w->buf, clen);
            w->mt->len[i] = clen;
        }
    }
    __sync_fetch_and_add(&w->mt->proc_cnt, 1);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
addq $0x38, %rdi
callq 0x47a0
cmpl $0x0, 0x18(%rbx)
jne 0x452c4
movq (%rbx), %rsi
cmpl $0x0, 0xc(%rsi)
jne 0x452c4
leaq 0x60(%rsi), %rdi
addq $0x38, %rsi
callq 0x47f0
jmp 0x452a6
movq (%rbx), %rdi
movl 0xc(%rdi), %ebp
movl $0x0, 0x18(%rbx)
addq $0x38, %rdi
callq 0x43f0
movl $0x1, %eax
testl %ebp, %ebp
jne 0x45399
movl $0x0, 0x14(%rbx)
movl 0x10(%rbx), %r12d
movq (%rbx), %rax
cmpl 0x8(%rax), %r12d
jge 0x45393
movq 0x20(%rax), %rcx
movq %rsp, %r14
movq $0x10000, (%rsp)        # imm = 0x10000
movq 0x8(%rbx), %rdi
movq 0x18(%rax), %rax
movslq %r12d, %r13
movq (%rax,%r13,8), %rdx
movslq (%rcx,%r13,4), %rcx
movl 0x1c(%rbx), %r8d
movq %r14, %rsi
callq 0x42c42
testl %eax, %eax
jne 0x45362
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movq 0x18(%rax), %rax
movq (%rax,%r13,8), %rdi
movq (%rsp), %r15
movq %r15, %rdx
callq 0x4420
movq (%rbx), %rax
movq 0x20(%rax), %rcx
movl %r15d, (%rcx,%r13,4)
addl (%rax), %r12d
cmpl 0x8(%rax), %r12d
jl 0x45306
jmp 0x45393
leaq 0x1d1e7(%rip), %rax     # 0x62550
cmpl $0x2, (%rax)
jge 0x453a8
orb $0x1, 0x14(%rbx)
movq (%rbx), %rax
cmpl 0x8(%rax), %r12d
jge 0x45393
movq 0x20(%rax), %rcx
movslq %r12d, %r12
movl $0x0, (%rcx,%r12,4)
addl (%rax), %r12d
cmpl 0x8(%rax), %r12d
jl 0x4537f
lock
incl 0x10(%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x5e5d
jmp 0x4536e
nop
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/faidx.c
// Function: fai_destroy
void fai_destroy(faidx_t *fai)
{
    int i;
    for (i = 0; i < fai->n; ++i) free(fai->name[i]);
    free(fai->name);
    kh_destroy(s, fai->hash);
    if (fai->bgzf) bgzf_close(fai->bgzf);
    free(fai);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x8(%rdi)
jle 0x45aae
xorl %r14d, %r14d
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x4610
incq %r14
movslq 0x8(%rbx), %rax
cmpq %rax, %r14
jl 0x45a95
movq 0x10(%rbx), %rdi
callq 0x4610
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0x45ae3
movq 0x18(%r14), %rdi
callq 0x4610
movq 0x10(%r14), %rdi
callq 0x4610
movq 0x20(%r14), %rdi
callq 0x4610
movq %r14, %rdi
callq 0x4610
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x45af0
callq 0x441e8
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4610
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/faidx.c
// Function: fai_save
void fai_save(const faidx_t *fai, FILE *fp)
{
    khint_t k;
    int i;
    for (i = 0; i < fai->n; ++i) {
        faidx1_t x;
        k = kh_get(s, fai->hash, fai->name[i]);
        x = kh_value(fai->hash, k);
#ifdef _WIN32
        fprintf(fp, "%s\t%d\t%ld\t%d\t%d\n", fai->name[i], (int)x.len, (long)x.offset, (int)x.line_blen, (int)x.line_len);
#else
        fprintf(fp, "%s\t%d\t%lld\t%d\t%d\n", fai->name[i], (int)x.len, (long long)x.offset, (int)x.line_blen, (int)x.line_len);
#endif
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, 0x30(%rsp)
cmpl $0x0, 0x8(%rdi)
jle 0x45c63
movq %rdi, %rbx
xorl %r14d, %r14d
movq %rdi, 0x18(%rsp)
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rax,%r14,8), %r10
movq %rcx, 0x10(%rsp)
movl (%rcx), %esi
movl $0x0, %eax
testl %esi, %esi
je 0x45c1a
movq %r14, 0x28(%rsp)
movsbl (%r10), %r14d
testl %r14d, %r14d
je 0x45b7c
movb 0x1(%r10), %al
testb %al, %al
je 0x45b7f
leaq 0x2(%r10), %rcx
movl %r14d, %edx
shll $0x5, %edx
subl %r14d, %edx
movsbl %al, %r14d
addl %edx, %r14d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x45b61
jmp 0x45b7f
xorl %r14d, %r14d
movq %rsi, 0x20(%rsp)
leal -0x1(%rsi), %r12d
andl %r12d, %r14d
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r15d
movl %r14d, %ebx
movq %r10, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r13d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r13d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x45bff
testb $0x1, %al
jne 0x45bea
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r10, %rsi
callq 0x4750
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %r10
testl %eax, %eax
je 0x45bff
addl %r15d, %ebx
andl %r12d, %ebx
incl %r15d
cmpl %r14d, %ebx
jne 0x45ba7
movq 0x20(%rsp), %rax
jmp 0x45c10
movl %ebp, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x20(%rsp), %rax
cmovel %ebx, %eax
movq 0x18(%rsp), %rbx
movq 0x28(%rsp), %r14
movq 0x10(%rsp), %rcx
movq 0x20(%rcx), %rdx
movl %eax, %eax
leaq (%rax,%rax,2), %rax
movl (%rdx,%rax,8), %esi
movl 0x4(%rdx,%rax,8), %r9d
movl 0x8(%rdx,%rax,8), %ecx
movq 0x10(%rdx,%rax,8), %r8
movl %esi, (%rsp)
movq 0x30(%rsp), %rdi
leaq 0xe64c(%rip), %rsi      # 0x54295
movq %r10, %rdx
xorl %eax, %eax
callq 0x4770
incq %r14
movslq 0x8(%rbx), %rax
cmpq %rax, %r14
jl 0x45b27
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hfile_init
hFILE *hfile_init(size_t struct_size, const char *mode, size_t capacity)
{
    hFILE *fp = (hFILE *) malloc(struct_size);
    if (fp == NULL) goto error;

    if (capacity == 0) capacity = 32768;
    // FIXME For now, clamp input buffer sizes so mpileup doesn't eat memory
    if (strchr(mode, 'r') && capacity > 32768) capacity = 32768;

    fp->buffer = (char *) malloc(capacity);
    if (fp->buffer == NULL) goto error;

    fp->begin = fp->end = fp->buffer;
    fp->limit = &fp->buffer[capacity];

    fp->offset = 0;
    fp->at_eof = 0;
    fp->has_errno = 0;
    return fp;

error:
    hfile_destroy(fp);
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
callq 0x4700
testq %rax, %rax
je 0x46fff
movq %rax, %rbx
testq %r15, %r15
movl $0x8000, %r14d          # imm = 0x8000
cmoveq %r14, %r15
movq %r12, %rdi
movl $0x72, %esi
callq 0x4200
cmpq %r14, %r15
cmovbq %r15, %r14
testq %rax, %rax
cmoveq %r15, %r14
movq %r14, %rdi
callq 0x4700
movq %rax, (%rbx)
testq %rax, %rax
je 0x46ff7
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
addq %rax, %r14
movq %r14, 0x18(%rbx)
movq $0x0, 0x28(%rbx)
movb $0x0, 0x30(%rbx)
movl $0x0, 0x34(%rbx)
jmp 0x47001
movq %rbx, %rdi
callq 0x47010
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hfile_destroy
void hfile_destroy(hFILE *fp)
{
    int save = errno;
    if (fp) free(fp->buffer);
    free(fp);
    errno = save;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x4070
movq %rax, %r14
movl (%rax), %ebp
testq %rbx, %rbx
je 0x4702e
movq (%rbx), %rdi
callq 0x4610
movq %rbx, %rdi
callq 0x4610
movl %ebp, (%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: refill_buffer
static ssize_t refill_buffer(hFILE *fp)
{
    ssize_t n;

    // Move any unread characters to the start of the buffer
    if (fp->begin > fp->buffer) {
        fp->offset += fp->begin - fp->buffer;
        memmove(fp->buffer, fp->begin, fp->end - fp->begin);
        fp->end = &fp->buffer[fp->end - fp->begin];
        fp->begin = fp->buffer;
    }

    // Read into the available buffer space at fp->[end,limit)
    if (fp->at_eof || fp->end == fp->limit) n = 0;
    else {
        n = fp->backend->read(fp, fp->end, fp->limit - fp->end);
        if (n < 0) { fp->has_errno = errno; return n; }
        else if (n == 0) fp->at_eof = 1;
    }

    fp->end += n;
    return n;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
movq 0x8(%rbx), %rsi
movq %rsi, %rax
subq %rdi, %rax
jbe 0x470a0
addq %rax, 0x28(%rbx)
movq 0x10(%rbx), %rdx
subq %rsi, %rdx
callq 0x48c0
movq 0x10(%rbx), %rax
subq 0x8(%rbx), %rax
movq (%rbx), %rcx
addq %rcx, %rax
movq %rax, 0x10(%rbx)
movq %rcx, 0x8(%rbx)
testb $0x1, 0x30(%rbx)
jne 0x470cd
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
cmpq %rdx, %rsi
je 0x470cd
movq 0x20(%rbx), %rax
subq %rsi, %rdx
movq %rbx, %rdi
callq *(%rax)
movq %rax, %r14
testq %rax, %rax
js 0x470df
jne 0x470d0
orb $0x1, 0x30(%rbx)
xorl %r14d, %r14d
addq %r14, 0x10(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x4070
movl (%rax), %eax
movl %eax, 0x34(%rbx)
jmp 0x470d4
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hpeek
ssize_t hpeek(hFILE *fp, void *buffer, size_t nbytes)
{
    size_t n = fp->end - fp->begin;
    while (n < nbytes) {
        ssize_t ret = refill_buffer(fp);
        if (ret < 0) return ret;
        else if (ret == 0) break;
        else n += ret;
    }

    if (n > nbytes) n = nbytes;
    memcpy(buffer, fp->begin, n);
    return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x10(%rdi), %r13
subq 0x8(%rdi), %r13
movl $0x1, %ebp
cmpq %rbx, %r13
jae 0x47140
movq %r15, %rdi
callq 0x47064
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
leal (%rcx,%rcx,2), %ecx
movl $0x0, %edx
cmovgq %rax, %rdx
cmovsq %rax, %r12
cmovsl %ebp, %ecx
addq %rdx, %r13
testl %ecx, %ecx
je 0x4710c
cmpl $0x3, %ecx
jne 0x47159
cmpq %rbx, %r13
cmovbq %r13, %rbx
movq 0x8(%r15), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x4420
movq %rbx, %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hread2
ssize_t hread2(hFILE *fp, void *destv, size_t nbytes, size_t nread)
{
    const size_t capacity = fp->limit - fp->buffer;
    char *dest = (char *) destv;
    dest += nread, nbytes -= nread;

    // Read large requests directly into the destination buffer
    while (nbytes * 2 >= capacity && !fp->at_eof) {
        ssize_t n = fp->backend->read(fp, dest, nbytes);
        if (n < 0) { fp->has_errno = errno; return n; }
        else if (n == 0) fp->at_eof = 1;
        fp->offset += n;
        dest += n, nbytes -= n;
        nread += n;
    }

    while (nbytes > 0 && !fp->at_eof) {
        size_t n;
        ssize_t ret = refill_buffer(fp);
        if (ret < 0) return ret;

        n = fp->end - fp->begin;
        if (n > nbytes) n = nbytes;
        memcpy(dest, fp->begin, n);
        fp->begin += n;
        dest += n, nbytes -= n;
        nread += n;
    }

    return nread;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rbp
subq (%rdi), %rbp
addq %rcx, %r15
subq %rcx, %r14
leaq (%r14,%r14), %rax
cmpq %rbp, %rax
jb 0x471ca
testb $0x1, 0x30(%rbx)
jne 0x471ca
movq 0x20(%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq *(%rax)
movq %rax, %r13
testq %rax, %rax
js 0x47218
jne 0x471bb
orb $0x1, 0x30(%rbx)
addq %r13, 0x28(%rbx)
addq %r13, %r15
subq %r13, %r14
addq %r13, %r12
jmp 0x4718f
movq %r12, %r13
testq %r14, %r14
je 0x47222
testb $0x1, 0x30(%rbx)
jne 0x47222
movq %rbx, %rdi
callq 0x47064
testq %rax, %rax
js 0x47213
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %r12
subq %rsi, %r12
cmpq %r14, %r12
cmovaeq %r14, %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x4420
addq %r12, 0x8(%rbx)
addq %r12, %r15
addq %r12, %r13
subq %r12, %r14
jne 0x471d2
jmp 0x47222
movq %rax, %r13
jmp 0x47222
callq 0x4070
movl (%rax), %eax
movl %eax, 0x34(%rbx)
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hflush
int hflush(hFILE *fp)
{
    if (flush_buffer(fp) < 0) return EOF;
    if (fp->backend->flush) {
        if (fp->backend->flush(fp) < 0) { fp->has_errno = errno; return EOF; }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x47279
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
js 0x47270
movq 0x20(%rbx), %rax
movq 0x18(%rax), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0x47270
movq %rbx, %rdi
callq *%rax
testl %eax, %eax
jns 0x47270
callq 0x4070
movl (%rax), %eax
movl %eax, 0x34(%rbx)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: flush_buffer
static ssize_t flush_buffer(hFILE *fp)
{
    const char *buffer = fp->buffer;
    while (buffer < fp->begin) {
        ssize_t n = fp->backend->write(fp, buffer, fp->begin - buffer);
        if (n < 0) { fp->has_errno = errno; return n; }
        buffer += n;
        fp->offset += n;
    }

    fp->begin = fp->buffer;  // Leave the buffer empty
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
movq 0x8(%rdi), %rdx
cmpq %rdx, %r14
jae 0x472b8
movq 0x20(%rbx), %rax
subq %r14, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rax)
movq %rax, %r15
testq %rax, %rax
js 0x472c1
addq %r15, 0x28(%rbx)
addq %r15, %r14
movq 0x8(%rbx), %rdx
cmpq %rdx, %r14
jb 0x4728d
movq (%rbx), %r14
movq %r14, 0x8(%rbx)
xorl %r15d, %r15d
jmp 0x472cb
callq 0x4070
movl (%rax), %eax
movl %eax, 0x34(%rbx)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hwrite2
ssize_t hwrite2(hFILE *fp, const void *srcv, size_t totalbytes, size_t ncopied)
{
    const char *src = (const char *) srcv;
    ssize_t ret;
    const size_t capacity = fp->limit - fp->buffer;
    size_t remaining = totalbytes - ncopied;
    src += ncopied;

    ret = flush_buffer(fp);
    if (ret < 0) return ret;

    // Write large blocks out directly from the source buffer
    while (remaining * 2 >= capacity) {
        ssize_t n = fp->backend->write(fp, src, remaining);
        if (n < 0) { fp->has_errno = errno; return n; }
        fp->offset += n;
        src += n, remaining -= n;
    }

    // Just buffer any remaining characters
    memcpy(fp->begin, src, remaining);
    fp->begin += remaining;

    return totalbytes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r13
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x18(%rdi), %rbp
subq (%rdi), %rbp
callq 0x47279
testq %rax, %rax
js 0x4737c
movq %rbx, %r12
subq %r13, %r12
addq %r13, %r15
leaq (%r12,%r12), %rax
cmpq %rbp, %rax
jb 0x47367
movq 0x20(%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x8(%rax)
movq %rax, %r13
testq %rax, %rax
js 0x47381
addq %r13, 0x28(%r14)
addq %r13, %r15
subq %r13, %r12
jmp 0x4733a
movq 0x8(%r14), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4420
addq %r12, 0x8(%r14)
jmp 0x4738f
movq %rax, %rbx
jmp 0x4738f
callq 0x4070
movl (%rax), %eax
movl %eax, 0x34(%r14)
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_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hseek
off_t hseek(hFILE *fp, off_t offset, int whence)
{
    off_t curpos, pos;

    if (writebuffer_is_nonempty(fp)) {
        int ret = flush_buffer(fp);
        if (ret < 0) return ret;
    }

    curpos = htell(fp);

    // Relative offsets are given relative to the hFILE's stream position,
    // which may differ from the backend's physical position due to buffering
    // read-ahead.  Correct for this by converting to an absolute position.
    if (whence == SEEK_CUR) {
        if (curpos + offset < 0) {
            // Either a negative offset resulted in a position before the
            // start of the file, or we overflowed when given a positive offset
            fp->has_errno = errno = (offset < 0)? EINVAL : EOVERFLOW;
            return -1;
        }

        whence = SEEK_SET;
        offset = curpos + offset;
    }

    // TODO Avoid seeking if the desired position is within our read buffer

    pos = fp->backend->seek(fp, offset, whence);
    if (pos < 0) { fp->has_errno = errno; return pos; }

    // Seeking succeeded, so discard any non-empty read buffer
    fp->begin = fp->end = fp->buffer;
    fp->at_eof = 0;

    fp->offset = pos;
    return pos;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rax
cmpq 0x10(%rdi), %rax
jbe 0x473de
movq %rbx, %rdi
callq 0x47279
testl %eax, %eax
js 0x47444
cmpl $0x1, %ebp
jne 0x47418
movq 0x28(%rbx), %rsi
addq %r14, %rsi
addq 0x8(%rbx), %rsi
xorl %ebp, %ebp
subq (%rbx), %rsi
jns 0x4741b
testq %r14, %r14
movl $0x16, %eax
movl $0x4b, %ebp
cmovsl %eax, %ebp
callq 0x4070
movl %ebp, (%rax)
movl %ebp, 0x34(%rbx)
movq $-0x1, %r14
jmp 0x47453
movq %r14, %rsi
movq 0x20(%rbx), %rax
movq %rbx, %rdi
movl %ebp, %edx
callq *0x10(%rax)
movq %rax, %r14
testq %rax, %rax
js 0x47449
movq (%rbx), %rax
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
andb $-0x2, 0x30(%rbx)
movq %r14, 0x28(%rbx)
jmp 0x47453
movslq %eax, %r14
jmp 0x47453
callq 0x4070
movl (%rax), %eax
movl %eax, 0x34(%rbx)
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hclose
int hclose(hFILE *fp)
{
    int err = fp->has_errno;

    if (writebuffer_is_nonempty(fp) && hflush(fp) < 0) err = fp->has_errno;
    if (fp->backend->close(fp) < 0) err = errno;
    hfile_destroy(fp);

    if (err) {
        errno = err;
        return EOF;
    }
    else return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x34(%rdi), %ebp
movq 0x8(%rdi), %rax
cmpq 0x10(%rdi), %rax
jbe 0x4747d
movq %rbx, %rdi
callq 0x47234
testl %eax, %eax
jns 0x4747d
movl 0x34(%rbx), %ebp
movq 0x20(%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
testl %eax, %eax
jns 0x47492
callq 0x4070
movl (%rax), %ebp
movq %rbx, %rdi
callq 0x47010
testl %ebp, %ebp
je 0x474ac
callq 0x4070
movl %ebp, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x474ae
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hclose_abruptly
void hclose_abruptly(hFILE *fp)
{
    int save = errno;
    if (fp->backend->close(fp) < 0) { /* Ignore subsequent errors */ }
    hfile_destroy(fp);
    errno = save;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x4070
movq %rax, %r14
movl (%rax), %ebp
movq 0x20(%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movq %rbx, %rdi
callq 0x47010
movl %ebp, (%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hdopen
hFILE *hdopen(int fd, const char *mode)
{
    hFILE_fd *fp = (hFILE_fd*) hfile_init(sizeof (hFILE_fd), mode, blksize(fd));
    if (fp == NULL) return NULL;

    fp->fd = fd;
    fp->is_socket = (strchr(mode, 's') != NULL);
    fp->base.backend = &fd_backend;
    return &fp->base;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rsi, %rbx
movl %edi, %ebp
movq %rsp, %rsi
callq 0x4910
testl %eax, %eax
jne 0x47503
movq 0x38(%rsp), %rdx
jmp 0x47505
xorl %edx, %edx
movl $0x40, %edi
movq %rbx, %rsi
callq 0x46f80
movq %rax, %r14
testq %rax, %rax
je 0x47549
movl %ebp, 0x38(%r14)
movq %rbx, %rdi
movl $0x73, %esi
callq 0x4200
testq %rax, %rax
setne %al
movb 0x3c(%r14), %cl
andb $-0x2, %cl
orb %al, %cl
movb %cl, 0x3c(%r14)
leaq 0x1a63b(%rip), %rax     # 0x61b80
movq %rax, 0x20(%r14)
movq %r14, %rax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hfile_oflags
int hfile_oflags(const char *mode)
{
    int rdwr = 0, flags = 0;
    const char *s;
    for (s = mode; *s; s++)
        switch (*s) {
        case 'r': rdwr = O_RDONLY;  break;
        case 'w': rdwr = O_WRONLY; flags |= O_CREAT | O_TRUNC;  break;
        case 'a': rdwr = O_WRONLY; flags |= O_CREAT | O_APPEND;  break;
        case '+': rdwr = O_RDWR;  break;
#ifdef O_CLOEXEC
        case 'e': flags |= O_CLOEXEC;  break;
#endif
#ifdef O_EXCL
        case 'x': flags |= O_EXCL;  break;
#endif
        default:  break;
        }

#ifdef O_BINARY
    flags |= O_BINARY;
#endif

    return rdwr | flags;
}

// Assembly:
xorl %ecx, %ecx
xorl %eax, %eax
movzbl (%rdi), %edx
cmpl $0x71, %edx
jg 0x4757a
cmpl $0x60, %edx
jle 0x4758d
cmpl $0x61, %edx
je 0x47599
cmpl $0x65, %edx
jne 0x475b1
orl $0x80000, %eax          # imm = 0x80000
jmp 0x475b1
cmpl $0x78, %edx
je 0x475a0
cmpl $0x77, %edx
je 0x475a7
cmpl $0x72, %edx
jne 0x475b1
xorl %ecx, %ecx
jmp 0x475b1
cmpl $0x2b, %edx
jne 0x475b6
movl $0x2, %ecx
jmp 0x475b1
orl $0x440, %eax            # imm = 0x440
jmp 0x475ac
orl $0x80, %eax
jmp 0x475b1
orl $0x240, %eax            # imm = 0x240
movl $0x1, %ecx
incq %rdi
jmp 0x4755c
testl %edx, %edx
jne 0x475b1
orl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hopen
hFILE *hopen(const char *fname, const char *mode)
{
    const struct hFILE_scheme_handler *handler = find_scheme_handler(fname);
    if (handler) return handler->open(fname, mode);
    else if (strcmp(fname, "-") == 0) return hopen_fd_stdinout(mode);
    else return hopen_fd(fname, mode);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x47853
testq %rax, %rax
je 0x4780f
movq (%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *%rax
cmpb $0x2d, (%r14)
jne 0x4781c
cmpb $0x0, 0x1(%r14)
je 0x4782e
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x47ae9
movq %rbx, %rdi
movl $0x72, %esi
callq 0x4200
xorl %edi, %edi
testq %rax, %rax
sete %dil
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x474e0
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hopen_fd
static hFILE *hopen_fd(const char *filename, const char *mode)
{
    hFILE_fd *fp = NULL;
    int fd = open(filename, hfile_oflags(mode), 0666);
    if (fd < 0) goto error;

    fp = (hFILE_fd *) hfile_init(sizeof (hFILE_fd), mode, blksize(fd));
    if (fp == NULL) goto error;

    fp->fd = fd;
    fp->is_socket = 0;
    fp->base.backend = &fd_backend;
    return &fp->base;

error:
    if (fd >= 0) { int save = errno; (void) close(fd); errno = save; }
    hfile_destroy((hFILE *) fp);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x47558
xorl %r15d, %r15d
movq %rbx, %rdi
movl %eax, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x43c0
testl %eax, %eax
js 0x47b77
movl %eax, %ebx
leaq 0x8(%rsp), %rsi
movl %eax, %edi
callq 0x4910
testl %eax, %eax
jne 0x47b35
movq 0x40(%rsp), %rdx
jmp 0x47b37
xorl %edx, %edx
movl $0x40, %edi
movq %r14, %rsi
callq 0x46f80
testq %rax, %rax
je 0x47b60
movq %rax, %r15
movl %ebx, 0x38(%rax)
andb $-0x2, 0x3c(%rax)
leaq 0x1a026(%rip), %rax     # 0x61b80
movq %rax, 0x20(%r15)
jmp 0x47b77
callq 0x4070
movq %rax, %r14
movl (%rax), %ebp
movl %ebx, %edi
callq 0x4a50
movl %ebp, (%r14)
xorl %r15d, %r15d
movq %r15, %rax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: fd_read
static ssize_t fd_read(hFILE *fpv, void *buffer, size_t nbytes)
{
    hFILE_fd *fp = (hFILE_fd *) fpv;
    ssize_t n;
    do {
        n = fp->is_socket? recv(fp->fd, buffer, nbytes, 0)
                         : read(fp->fd, buffer, nbytes);
    } while (n < 0 && errno == EINTR);
    return n;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testb $0x1, 0x3c(%r15)
movl 0x38(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
jne 0x47bd3
callq 0x4780
jmp 0x47bda
xorl %ecx, %ecx
callq 0x4190
movq %rax, %r12
testq %rax, %rax
jns 0x47bec
callq 0x4070
cmpl $0x4, (%rax)
je 0x47bbb
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: fd_write
static ssize_t fd_write(hFILE *fpv, const void *buffer, size_t nbytes)
{
    hFILE_fd *fp = (hFILE_fd *) fpv;
    ssize_t n;
    do {
        n = fp->is_socket?  send(fp->fd, buffer, nbytes, 0)
                         : write(fp->fd, buffer, nbytes);
    } while (n < 0 && errno == EINTR);
    return n;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testb $0x1, 0x3c(%r15)
movl 0x38(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
jne 0x47c24
callq 0x41f0
jmp 0x47c2b
xorl %ecx, %ecx
callq 0x4290
movq %rax, %r12
testq %rax, %rax
jns 0x47c3d
callq 0x4070
cmpl $0x4, (%rax)
je 0x47c0c
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hopen_mem
static hFILE *hopen_mem(const char *data, const char *mode)
{
    if (strncmp(data, "data:", 5) == 0) data += 5;

    // TODO Implement write modes, which will require memory allocation
    if (strchr(mode, 'r') == NULL) { errno = EINVAL; return NULL; }

    hFILE_mem *fp = (hFILE_mem *) hfile_init(sizeof (hFILE_mem), mode, 0);
    if (fp == NULL) return NULL;

    fp->buffer = data;
    fp->length = strlen(data);
    fp->pos = 0;
    fp->base.backend = &mem_backend;
    return &fp->base;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xc787(%rip), %rsi      # 0x54708
movl $0x5, %edx
callq 0x4280
xorl %r12d, %r12d
testl %eax, %eax
sete %bpl
movq %r14, %rdi
movl $0x72, %esi
callq 0x4200
testq %rax, %rax
je 0x47ff2
xorl %r15d, %r15d
movl $0x50, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x46f80
testq %rax, %rax
je 0x48000
movq %rax, %r14
movb %bpl, %r12b
leaq (%r12,%r12,4), %rax
addq %rax, %rbx
movq %rbx, 0x38(%r14)
movq %rbx, %rdi
callq 0x4230
movq %rax, 0x40(%r14)
movq $0x0, 0x48(%r14)
leaq 0x19c1f(%rip), %rax     # 0x61c08
movq %rax, 0x20(%r14)
movq %r14, %r15
jmp 0x48000
callq 0x4070
movl $0x16, (%rax)
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hopen_fd_fileuri
static hFILE *hopen_fd_fileuri(const char *url, const char *mode)
{
    if (strncmp(url, "file://localhost/", 17) == 0) url += 16;
    else if (strncmp(url, "file:///", 8) == 0) url += 7;
    else { errno = EPROTONOSUPPORT; return NULL; }

    return hopen_fd(url, mode);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc6f1(%rip), %rsi      # 0x5470e
movl $0x11, %edx
callq 0x4280
testl %eax, %eax
je 0x48058
leaq 0xc6ee(%rip), %rsi      # 0x54720
movl $0x8, %edx
movq %r14, %rdi
callq 0x4280
testl %eax, %eax
je 0x4805f
callq 0x4070
movl $0x5d, (%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %eax
jmp 0x48064
movl $0x7, %eax
addq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x47ae9
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: mem_seek
static off_t mem_seek(hFILE *fpv, off_t offset, int whence)
{
    hFILE_mem *fp = (hFILE_mem *) fpv;
    size_t absoffset = (offset >= 0)? offset : -offset;
    size_t origin;

    switch (whence) {
    case SEEK_SET: origin = 0; break;
    case SEEK_CUR: origin = fp->pos; break;
    case SEEK_END: origin = fp->length; break;
    default: errno = EINVAL; return -1;
    }

    if ((offset  < 0 && absoffset > origin) ||
        (offset >= 0 && absoffset > fp->length - origin)) {
        errno = EINVAL;
        return -1;
    }

    fp->pos = origin + offset;
    return fp->pos;
}

// Assembly:
pushq %rax
movq %rsi, %rcx
negq %rcx
cmovsq %rsi, %rcx
testl %edx, %edx
je 0x480de
cmpl $0x1, %edx
je 0x480d3
cmpl $0x2, %edx
jne 0x48103
movl $0x40, %eax
jmp 0x480d8
movl $0x48, %eax
movq (%rdi,%rax), %rax
jmp 0x480e0
movl %edx, %eax
testq %rsi, %rsi
sets %dl
cmpq %rax, %rcx
seta %r8b
testb %r8b, %dl
jne 0x48103
testq %rsi, %rsi
js 0x48117
movq 0x40(%rdi), %rdx
subq %rax, %rdx
cmpq %rdx, %rcx
jbe 0x48117
callq 0x4070
movl $0x16, (%rax)
movq $-0x1, %rax
jmp 0x4811e
addq %rsi, %rax
movq %rax, 0x48(%rdi)
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hfile_exit
static void hfile_exit()
{
    pthread_mutex_lock(&plugins_lock);

    kh_destroy(scheme_string, schemes);

    while (plugins != NULL) {
        struct hFILE_plugin_list *p = plugins;
        if (p->plugin.destroy) p->plugin.destroy();
#ifdef ENABLE_PLUGINS
        if (p->plugin.obj) close_plugin(p->plugin.obj);
#endif
        plugins = p->next;
        free(p);
    }

    pthread_mutex_unlock(&plugins_lock);
    pthread_mutex_destroy(&plugins_lock);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x1a49a(%rip), %rdi     # 0x625c8
callq 0x47a0
movq 0x1a486(%rip), %rbx     # 0x625c0
testq %rbx, %rbx
je 0x48162
movq 0x18(%rbx), %rdi
callq 0x4610
movq 0x10(%rbx), %rdi
callq 0x4610
movq 0x20(%rbx), %rdi
callq 0x4610
movq %rbx, %rdi
callq 0x4610
movq 0x1a487(%rip), %rbx     # 0x625f0
testq %rbx, %rbx
je 0x48194
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x48179
callq *%rax
movq 0x20(%rbx), %r14
movq %r14, 0x1a46c(%rip)     # 0x625f0
movq %rbx, %rdi
callq 0x4610
movq %r14, %rbx
testq %r14, %r14
jne 0x4816e
leaq 0x1a42d(%rip), %rbx     # 0x625c8
movq %rbx, %rdi
callq 0x43f0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x45e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile_net.c
// Function: hopen_net
hFILE *hopen_net(const char *filename, const char *mode)
{
    hFILE_net *fp;

    // Do any networking initialisation if this is the first use.
    if (! net_inited) { if (net_init() < 0) return NULL; }

    fp = (hFILE_net *) hfile_init(sizeof (hFILE_net), mode, 0);
    if (fp == NULL) return NULL;

    fp->netfp = knet_open(filename, mode);
    if (fp->netfp == NULL) { hfile_destroy((hFILE *) fp); return NULL; }

    fp->base.backend = &net_backend;
    return &fp->base;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x0, 0x1a42f(%rip)     # 0x625f8
jne 0x481d2
movb $0x1, 0x1a426(%rip)     # 0x625f8
xorl %r12d, %r12d
movl $0x40, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x46f80
testq %rax, %rax
je 0x4821b
movq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4dbe5
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x48210
leaq 0x19a29(%rip), %rax     # 0x61c30
movq %rax, 0x20(%r15)
movq %r15, %r12
jmp 0x4821b
movq %r15, %rdi
callq 0x47010
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hfile_net.c
// Function: hfile_plugin_init_net
int hfile_plugin_init_net(struct hFILE_plugin *self)
{
    static const struct hFILE_scheme_handler handler =
        { hopen_net, hfile_always_remote, "knetfile", 0 };

    self->name = "knetfile";
    hfile_add_scheme_handler("http", &handler);
    hfile_add_scheme_handler("ftp",  &handler);
    return 0;
}

// Assembly:
pushq %rbx
leaq 0xc4cd(%rip), %rax      # 0x546ff
movq %rax, 0x10(%rdi)
leaq 0xc554(%rip), %rdi      # 0x54791
leaq 0x19a14(%rip), %rbx     # 0x61c58
movq %rbx, %rsi
callq 0x475bd
leaq 0xc543(%rip), %rdi      # 0x54796
movq %rbx, %rsi
callq 0x475bd
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/md5.c
// Function: hts_md5_update
void hts_md5_update(hts_md5_context *ctx, const void *data, unsigned long size)
{
	hts_md5_u32plus saved_lo;
	unsigned long used, available;

	saved_lo = ctx->lo;
	if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
		ctx->hi++;
	ctx->hi += size >> 29;

	used = saved_lo & 0x3f;

	if (used) {
		available = 64 - used;

		if (size < available) {
			memcpy(&ctx->buffer[used], data, size);
			return;
		}

		memcpy(&ctx->buffer[used], data, available);
		data = (const unsigned char *)data + available;
		size -= available;
		body(ctx, ctx->buffer, 64);
	}

	if (size >= 64) {
		data = body(ctx, data, size & ~(unsigned long)0x3f);
		size &= 0x3f;
	}

	memcpy(ctx->buffer, data, size);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %eax
leal (%rdx,%rax), %ecx
andl $0x1fffffff, %ecx       # imm = 0x1FFFFFFF
movl %ecx, (%rdi)
movq %rdx, %rdi
shrq $0x1d, %rdi
cmpl %eax, %ecx
adcl %edi, 0x4(%rbx)
movq %rsi, %r14
andq $0x3f, %rax
je 0x482e1
movl $0x40, %r12d
subq %rax, %r12
movq %rdx, %r15
leaq (%rbx,%rax), %rdi
addq $0x18, %rdi
subq %r12, %r15
jae 0x482e6
movq %r14, %rsi
jmp 0x48334
movq %rdx, %r15
jmp 0x48308
leaq 0x18(%rbx), %r13
movq %r14, %rsi
movq %r12, %rdx
callq 0x4420
addq %r12, %r14
movl $0x40, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x48342
cmpq $0x40, %r15
jb 0x48327
movq %r15, %rdx
andq $-0x40, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x48342
movq %rax, %r14
andl $0x3f, %r15d
addq $0x18, %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4420
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/md5.c
// Function: hts_md5_init
hts_md5_context *hts_md5_init(void)
{
    hts_md5_context *ctx = malloc(sizeof(*ctx));
    if (!ctx)
        return NULL;

    hts_md5_reset(ctx);
    return ctx;
}

// Assembly:
pushq %rax
movl $0x98, %edi
callq 0x4700
testq %rax, %rax
je 0x48ceb
movabsq $0x1032547698badcfe, %rcx # imm = 0x1032547698BADCFE
movq %rcx, 0x10(%rax)
movaps 0xbab8(%rip), %xmm0     # 0x547a0
movups %xmm0, (%rax)
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/md5.c
// Function: hts_md5_hex
void hts_md5_hex(char *hex, const unsigned char *digest)
{
    int i;
    for (i = 0; i < 16; i++) {
        hex[i*2+0] = "0123456789abcdef"[(digest[i]>>4)&0xf];
        hex[i*2+1] = "0123456789abcdef"[digest[i]&0xf];
    }
    hex[32] = 0;
}

// Assembly:
xorl %eax, %eax
leaq 0x9026(%rip), %rcx      # 0x51d26
movzbl (%rsi,%rax), %edx
shrl $0x4, %edx
movb (%rdx,%rcx), %dl
movb %dl, (%rdi,%rax,2)
movzbl (%rsi,%rax), %edx
andl $0xf, %edx
movb (%rdx,%rcx), %dl
movb %dl, 0x1(%rdi,%rax,2)
incq %rax
cmpq $0x10, %rax
jne 0x48d00
movb $0x0, 0x20(%rdi)
retq
nopl (%rax)