LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_flush
int bgzf_flush(BGZF *fp)
{
    if (!fp->is_write) return 0;
#ifdef BGZF_MT
    if (fp->mt) {
        if (fp->block_offset) mt_queue(fp); // guaranteed that assertion does not fail
        return mt_flush_queue(fp);
    }
#endif
    while (fp->block_offset > 0) {
        int block_length;
        if ( fp->idx_build_otf )
        {
            bgzf_index_add_block(fp);
            fp->idx->ublock_addr += fp->block_offset;
        }
        block_length = deflate_block(fp, fp->block_offset);
        if (block_length < 0) {
            if (hts_verbose >= 3) fprintf(stderr, "[E::%s] deflate_block error %d\n", __func__, block_length);
            return -1;
        }
        if (hwrite(fp->fp, fp->compressed_block, block_length) != block_length) {
            if (hts_verbose >= 1) fprintf(stderr, "[E::%s] hwrite error (wrong size)\n", __func__);
            fp->errcode |= BGZF_ERR_IO; // possibly truncated file
            return -1;
        }
        fp->block_address += block_length;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x650a9
movl $0x0, -0x4(%rbp)
jmp 0x651f9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x650d8
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x650c7
movq -0x10(%rbp), %rdi
callq 0x65210
movq -0x10(%rbp), %rdi
callq 0x652c0
movl %eax, -0x4(%rbp)
jmp 0x651f9
jmp 0x650da
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0x651f2
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
je 0x65113
movq -0x10(%rbp), %rdi
callq 0x64890
movq -0x10(%rbp), %rax
movslq 0xc(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %esi
callq 0x65480
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x65166
leaq 0x254ad(%rip), %rax     # 0x8a5e0
cmpl $0x3, (%rax)
jl 0x6515a
movq 0x24e91(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
movl -0x14(%rbp), %ecx
leaq 0x18e81(%rip), %rsi     # 0x7dfcd
leaq 0x18e9a(%rip), %rdx     # 0x7dfed
movb $0x0, %al
callq 0x4830
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x651f9
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movslq -0x14(%rbp), %rdx
callq 0x65590
movslq -0x14(%rbp), %rcx
cmpq %rcx, %rax
je 0x651dd
leaq 0x25451(%rip), %rax     # 0x8a5e0
cmpl $0x1, (%rax)
jl 0x651b3
movq 0x24e35(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
leaq 0x18e53(%rip), %rsi     # 0x7dff8
leaq 0x18e41(%rip), %rdx     # 0x7dfed
movb $0x0, %al
callq 0x4830
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x4, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x651f9
movslq -0x14(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
jmp 0x650da
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: mt_queue
static void mt_queue(BGZF *fp)
{
    mtaux_t *mt = fp->mt;
    assert(mt->curr < mt->n_blks); // guaranteed by the caller
    memcpy(mt->blk[mt->curr], fp->uncompressed_block, fp->block_offset);
    mt->len[mt->curr] = fp->block_offset;
    fp->block_offset = 0;
    ++mt->curr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x6523a
jmp 0x65259
leaq 0x19148(%rip), %rdi     # 0x7e389
leaq 0x18bcd(%rip), %rsi     # 0x7de15
movl $0x341, %edx            # imm = 0x341
leaq 0x1914b(%rip), %rcx     # 0x7e39f
callq 0x4360
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x8(%rbp), %rax
movslq 0xc(%rax), %rdx
callq 0x4460
movq -0x8(%rbp), %rax
movl 0xc(%rax), %edx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: deflate_block
static int deflate_block(BGZF *fp, int block_length)
{
    size_t comp_size = BGZF_MAX_BLOCK_SIZE;
    int ret;
    if ( !fp->is_gzip )
        ret = bgzf_compress(fp->compressed_block, &comp_size, fp->uncompressed_block, block_length, fp->compress_level);
    else
        ret = bgzf_gzip_compress(fp, fp->compressed_block, &comp_size, fp->uncompressed_block, block_length, fp->compress_level);

    if ( ret != 0 )
    {
        if (hts_verbose >= 3) {
            fprintf(stderr, "[E::%s] compression error %d\n", __func__, ret);
        }
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    fp->block_offset = 0;
    return comp_size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq $0x10000, -0x20(%rbp)   # imm = 0x10000
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x654d6
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
movslq -0x14(%rbp), %rcx
movq -0x10(%rbp), %rax
movl (%rax), %r8d
shll $0x3, %r8d
sarl $0x17, %r8d
leaq -0x20(%rbp), %rsi
callq 0x63640
movl %eax, -0x24(%rbp)
jmp 0x65509
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
movslq -0x14(%rbp), %r8
movq -0x10(%rbp), %rax
movl (%rax), %r9d
shll $0x3, %r9d
sarl $0x17, %r9d
leaq -0x20(%rbp), %rdx
callq 0x67cd0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x65567
leaq 0x250ca(%rip), %rax     # 0x8a5e0
cmpl $0x3, (%rax)
jl 0x6553d
movq 0x24aae(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
movl -0x24(%rbp), %ecx
leaq 0x18e86(%rip), %rsi     # 0x7e3b5
leaq 0x18e9d(%rip), %rdx     # 0x7e3d3
movb $0x0, %al
callq 0x4830
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x1, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x65579
movq -0x10(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x20(%rbp), %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: lazy_flush
static int lazy_flush(BGZF *fp)
{
    if (fp->mt) {
        if (fp->block_offset) mt_queue(fp);
        return (fp->mt->curr < fp->mt->n_blks)? 0 : mt_flush_queue(fp);
    }
    else return bgzf_flush(fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x656dd
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x656aa
movq -0x10(%rbp), %rdi
callq 0x65210
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x40(%rcx), %rcx
cmpl 0x4(%rcx), %eax
jge 0x656c9
xorl %eax, %eax
movl %eax, -0x14(%rbp)
jmp 0x656d5
movq -0x10(%rbp), %rdi
callq 0x652c0
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x656e9
movq -0x10(%rbp), %rdi
callq 0x65080
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x1d, %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x65743
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x65590
movq %rax, -0x8(%rbp)
jmp 0x6583f
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x65766
jmp 0x65785
leaq 0x188ae(%rip), %rdi     # 0x7e01b
leaq 0x186a1(%rip), %rsi     # 0x7de15
movl $0x3a9, %edx            # imm = 0x3A9
leaq 0x188a8(%rip), %rcx     # 0x7e028
callq 0x4360
jmp 0x65787
cmpq $0x0, -0x30(%rbp)
jle 0x65833
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rcx
movl $0xff00, %eax           # imm = 0xFF00
subl 0xc(%rcx), %eax
movl %eax, -0x3c(%rbp)
movslq -0x3c(%rbp), %rax
cmpq -0x30(%rbp), %rax
jle 0x657be
movq -0x30(%rbp), %rax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq 0xc(%rax), %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
movslq -0x3c(%rbp), %rdx
callq 0x4460
movl -0x3c(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl -0x3c(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movslq -0x3c(%rbp), %rcx
movq -0x30(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpl $0xff00, 0xc(%rax)      # imm = 0xFF00
jne 0x6582e
movq -0x10(%rbp), %rdi
callq 0x65680
cmpl $0x0, %eax
je 0x6582c
movq $-0x1, -0x8(%rbp)
jmp 0x6583f
jmp 0x6582e
jmp 0x65787
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
addq $0x38, %rdi
callq 0x4880
movq -0x8(%rbp), %rax
movl $0x1, 0xc(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x8(%rbp), %rdi
addq $0x60, %rdi
callq 0x41c0
movq -0x8(%rbp), %rdi
addq $0x38, %rdi
callq 0x4420
movl $0x1, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x65b6f
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x44e0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x65b40
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x65ba2
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x46a0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x65b76
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x65bdb
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x46a0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x65ba9
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rdi
addq $0x60, %rdi
callq 0x4b10
movq -0x8(%rbp), %rdi
addq $0x38, %rdi
callq 0x4670
movq -0x8(%rbp), %rdi
callq 0x46a0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x65c59
jmp 0x65c8e
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x50(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: free_cache
static void free_cache(BGZF *fp)
{
    khint_t k;
    khash_t(cache) *h = (khash_t(cache)*)fp->cache;
    if (fp->is_write) return;
    for (k = kh_begin(h); k < kh_end(h); ++k)
        if (kh_exist(h, k)) free(kh_val(h, k).block);
    kh_destroy(cache, h);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x65ccb
jmp 0x65d33
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jae 0x65d2a
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0xc(%rbp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x65d1d
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x46a0
jmp 0x65d1f
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x65cd2
movq -0x18(%rbp), %rdi
callq 0x67de0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x641a0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq $-0x1c, %rsi
movl $0x2, %edx
callq 0x6abd0
cmpq $0x0, %rax
jge 0x65dc5
callq 0x4070
cmpl $0x1d, (%rax)
jne 0x65dbc
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x65e40
movl $0x2, -0x4(%rbp)
jmp 0x65e33
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x65e33
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
leaq -0x30(%rbp), %rsi
movl $0x1c, %edx
callq 0x64100
cmpq $0x1c, %rax
je 0x65dea
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x65e33
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x38(%rbp), %rsi
xorl %edx, %edx
callq 0x6abd0
cmpq $0x0, %rax
jge 0x65e0c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x65e33
leaq -0x30(%rbp), %rsi
leaq 0x17f8c(%rip), %rdi     # 0x7dda3
movl $0x1c, %edx
callq 0x4240
movl %eax, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x65e8a
cmpl $0x0, -0x1c(%rbp)
je 0x65eb8
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x8, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movq $-0x1, -0x8(%rbp)
jmp 0x65f3e
movq -0x18(%rbp), %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rax
sarq $0x10, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x6abd0
cmpq $0x0, %rax
jge 0x65f15
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x4, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movq $-0x1, -0x8(%rbp)
jmp 0x65f3e
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x15a88(%rip), %rsi     # 0x7b9ef
callq 0x6b3f0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x65f7f
movl $0x0, -0x4(%rbp)
jmp 0x65feb
movq -0x30(%rbp), %rdi
leaq -0x20(%rbp), %rsi
movl $0x10, %edx
callq 0x64100
movl %eax, -0x24(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6ad60
cmpl $0x0, %eax
jge 0x65fab
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x65feb
cmpl $0x10, -0x24(%rbp)
je 0x65fba
movl $0x0, -0x4(%rbp)
jmp 0x65feb
leaq -0x20(%rbp), %rax
movups (%rax), %xmm0
movaps 0x17e08(%rip), %xmm1    # 0x7ddd0
pcmpeqb %xmm1, %xmm0
pmovmskb %xmm0, %eax
subl $0xffff, %eax           # imm = 0xFFFF
setne %al
movzbl %al, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jl 0x6604b
movq -0x10(%rbp), %rdi
callq 0x63aa0
cmpl $0x0, %eax
je 0x66036
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x660c0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x66049
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x660c0
jmp 0x6604b
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rdx
movl 0xc(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0xc(%rdx)
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x660aa
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x641a0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x65c40
movl $0x1, %edi
movl $0x18, %esi
callq 0x4370
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x66403
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x66415
movq -0x10(%rbp), %rax
movl $0x1, 0x50(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: mode2level
static int mode2level(const char *__restrict mode)
{
    int i, compress_level = -1;
    for (i = 0; mode[i]; ++i)
        if (mode[i] >= '0' && mode[i] <= '9') break;
    if (mode[i]) compress_level = (int)mode[i] - '0';
    if (strchr(mode, 'u')) compress_level = -2;
    return compress_level;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x66fe9
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x30, %eax
jl 0x66fdc
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x39, %eax
jg 0x66fdc
jmp 0x66fe9
jmp 0x66fde
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x66faa
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x67009
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x75, %esi
callq 0x41e0
cmpq $0x0, %rax
je 0x67024
movl $0xfffffffe, -0x10(%rbp) # imm = 0xFFFFFFFE
movl -0x10(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_gzip_compress
static int bgzf_gzip_compress(BGZF *fp, void *_dst, size_t *dlen, const void *src, size_t slen, int level)
{
    uint8_t *dst = (uint8_t*)_dst;
    z_stream *zs = fp->gz_stream;
    int flush = slen ? Z_NO_FLUSH : Z_FINISH;
    zs->next_in   = (Bytef*)src;
    zs->avail_in  = slen;
    zs->next_out  = dst;
    zs->avail_out = *dlen;
    int ret = deflate(zs, flush);
    if (ret == Z_STREAM_ERROR) {
        if (hts_verbose >= 1) {
            fprintf(stderr, "[E::%s] deflate failed: %s\n",
                    __func__, bgzf_zerr(ret, NULL));
        }
        return -1;
    }
    *dlen = *dlen - zs->avail_out;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rdx
movl $0x4, %eax
xorl %ecx, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
movl %eax, -0x4c(%rbp)
movq -0x28(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x48(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x4270
movl %eax, -0x50(%rbp)
cmpl $-0x2, -0x50(%rbp)
jne 0x67dad
leaq 0x22877(%rip), %rax     # 0x8a5e0
cmpl $0x1, (%rax)
jl 0x67da4
movq 0x2225b(%rip), %rax     # 0x89fd0
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movl -0x50(%rbp), %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x63940
movq -0x58(%rbp), %rdi
movq %rax, %rcx
leaq 0x1612d(%rip), %rsi     # 0x7dec3
leaq 0x16644(%rip), %rdx     # 0x7e3e1
movb $0x0, %al
callq 0x4830
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x67dcc
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x48(%rbp), %rax
movl 0x20(%rax), %eax
subq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x6855f
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x46a0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x68533
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x687b0
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x6858f
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x65880
movq -0x8(%rbp), %rdi
callq 0x46a0
addq $0x10, %rsp
popq %rbp
retq
nop
// File: 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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x68658
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x68660
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x28(%rbp), %rax
movl %eax, %ecx
movq -0x20(%rbp), %r8
movl -0x2c(%rbp), %r9d
movl -0x30(%rbp), %eax
leaq 0x15e65(%rip), %rsi     # 0x7e4a5
movl %eax, (%rsp)
movb $0x0, %al
callq 0x4830
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x685b7
addq $0x40, %rsp
popq %rbp
retq
nop
// File: karel-brinda[P]ococo/ext/htslib/faidx.c
// Function: fai_read
static faidx_t *fai_read(FILE *fp, const char *fname)
{
    faidx_t *fai;
    char *buf, *p;
    int len, line_len, line_blen;
#ifdef _WIN32
    long offset;
#else
    long long offset;
#endif
    fai = (faidx_t*)calloc(1, sizeof(faidx_t));
    fai->hash = kh_init(s);
    buf = (char*)calloc(0x10000, 1);
    while (fgets(buf, 0x10000, fp)) {
        for (p = buf; *p && isgraph_c(*p); ++p);
        *p = 0; ++p;
#ifdef _WIN32
        sscanf(p, "%d%ld%d%d", &len, &offset, &line_blen, &line_len);
#else
        sscanf(p, "%d%lld%d%d", &len, &offset, &line_blen, &line_len);
#endif
        if (fai_insert_index(fai, buf, len, line_len, line_blen, offset) != 0) {
            free(buf);
            return NULL;
        }
    }
    free(buf);
    if (ferror(fp)) {
        fprintf(stderr, "[fai_load] error while reading \"%s\": %s\n", fname, strerror(errno));
        fai_destroy(fai);
        return NULL;
    }
    return fai;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x1, %edi
movl $0x20, %esi
callq 0x4370
movq %rax, -0x20(%rbp)
callq 0x68250
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x10000, %edi          # imm = 0x10000
movl $0x1, %esi
callq 0x4370
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x10000, %esi          # imm = 0x10000
callq 0x4930
cmpq $0x0, %rax
je 0x68f87
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x49(%rbp)
je 0x68f00
movq -0x30(%rbp), %rax
movsbl (%rax), %edi
callq 0x6a310
cmpl $0x0, %eax
setne %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x68f09
jmp 0x68f19
jmp 0x68f0b
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x68eda
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x1599b(%rip), %rsi     # 0x7e8d2
leaq -0x34(%rbp), %rdx
leaq -0x48(%rbp), %rcx
leaq -0x3c(%rbp), %r8
leaq -0x38(%rbp), %r9
movb $0x0, %al
callq 0x4560
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movslq -0x34(%rbp), %rdx
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %r8d
movq -0x48(%rbp), %r9
callq 0x68270
cmpl $0x0, %eax
je 0x68f82
movq -0x28(%rbp), %rdi
callq 0x46a0
movq $0x0, -0x8(%rbp)
jmp 0x68ff4
jmp 0x68eb6
movq -0x28(%rbp), %rdi
callq 0x46a0
movq -0x10(%rbp), %rdi
callq 0x4ae0
cmpl $0x0, %eax
je 0x68fec
movq 0x2102b(%rip), %rax     # 0x89fd0
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
callq 0x4070
movl (%rax), %edi
callq 0x4190
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rdx
movq %rax, %rcx
leaq 0x1590b(%rip), %rsi     # 0x7e8dd
movb $0x0, %al
callq 0x4830
movq -0x20(%rbp), %rdi
callq 0x68520
movq $0x0, -0x8(%rbp)
jmp 0x68ff4
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x47a0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x6a36d
jmp 0x6a41c
cmpq $0x0, -0x20(%rbp)
jne 0x6a37c
movq $0x8000, -0x20(%rbp)    # imm = 0x8000
movq -0x18(%rbp), %rdi
movl $0x72, %esi
callq 0x41e0
cmpq $0x0, %rax
je 0x6a3a2
cmpq $0x8000, -0x20(%rbp)    # imm = 0x8000
jbe 0x6a3a2
movq $0x8000, -0x20(%rbp)    # imm = 0x8000
movq -0x20(%rbp), %rdi
callq 0x47a0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x6a3c1
jmp 0x6a41c
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rcx
addq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x28(%rbp), %rax
movb 0x30(%rax), %cl
andb $-0x2, %cl
orb $0x0, %cl
movb %cl, 0x30(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x34(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6a42d
movq -0x28(%rbp), %rdi
callq 0x6a440
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
callq 0x4070
movl (%rax), %eax
movl %eax, -0xc(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x6a469
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rdi
callq 0x46a0
movl -0xc(%rbp), %eax
movl %eax, -0x10(%rbp)
callq 0x4070
movl -0x10(%rbp), %ecx
movl %ecx, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jbe 0x6a576
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq %rax, %rcx
movq -0x10(%rbp), %rax
addq 0x28(%rax), %rcx
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
subq %rax, %rdx
callq 0x4970
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdx
movq 0x8(%rdx), %rdx
subq %rdx, %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movb 0x30(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x6a599
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jne 0x6a5a3
movq $0x0, -0x18(%rbp)
jmp 0x6a60d
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rsi
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rdx
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rdx
callq *%rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0x6a5f2
callq 0x4070
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6a625
cmpq $0x0, -0x18(%rbp)
jne 0x6a609
movq -0x10(%rbp), %rax
movb 0x30(%rax), %cl
andb $-0x2, %cl
orb $0x1, %cl
movb %cl, 0x30(%rax)
jmp 0x6a60b
jmp 0x6a60d
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x6a69c
movq -0x10(%rbp), %rdi
callq 0x6a4e0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x6a683
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6a6cb
cmpq $0x0, -0x30(%rbp)
jne 0x6a68c
jmp 0x6a69c
movq -0x30(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x6a69a
jmp 0x6a65b
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jbe 0x6a6ae
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x28(%rbp), %rdx
callq 0x4460
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6a960
cmpq $0x0, %rax
jge 0x6a904
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6a94a
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0x6a943
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
jge 0x6a941
callq 0x4070
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6a94a
jmp 0x6a943
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x6a9eb
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rdx
movq -0x18(%rbp), %rcx
subq %rcx, %rdx
callq *%rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jge 0x6a9cd
callq 0x4070
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6aa02
movq -0x20(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x28(%rax), %rcx
movq %rcx, 0x28(%rax)
jmp 0x6a977
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
subq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6a960
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jge 0x6aacf
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6ab75
jmp 0x6aad1
movq -0x48(%rbp), %rax
shlq %rax
cmpq -0x40(%rbp), %rax
jb 0x6ab48
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq *%rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jge 0x6ab1b
callq 0x4070
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6ab75
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x28(%rax), %rcx
movq %rcx, 0x28(%rax)
movq -0x50(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
jmp 0x6aad1
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x4460
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nop
// File: 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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6ad00
cmpl $0x0, %eax
je 0x6ac12
movq -0x10(%rbp), %rdi
callq 0x6a960
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0x6ac10
movslq -0x34(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6acf3
jmp 0x6ac12
movq -0x10(%rbp), %rdi
callq 0x6ad30
movq %rax, -0x28(%rbp)
cmpl $0x1, -0x1c(%rbp)
jne 0x6ac7c
movq -0x28(%rbp), %rax
addq -0x18(%rbp), %rax
cmpq $0x0, %rax
jge 0x6ac69
movq -0x18(%rbp), %rdx
movl $0x4b, %eax
movl $0x16, %ecx
cmpq $0x0, %rdx
cmovll %ecx, %eax
movl %eax, -0x38(%rbp)
callq 0x4070
movl -0x38(%rbp), %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movq $-0x1, -0x8(%rbp)
jmp 0x6acf3
movl $0x0, -0x1c(%rbp)
movq -0x28(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq *%rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x6acb8
callq 0x4070
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6acf3
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movb 0x30(%rax), %cl
andb $-0x2, %cl
orb $0x0, %cl
movb %cl, 0x30(%rax)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6ad00
cmpl $0x0, %eax
je 0x6ad9c
movq -0x10(%rbp), %rdi
callq 0x6a8e0
cmpl $0x0, %eax
jge 0x6ad9c
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
jge 0x6adbd
callq 0x4070
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6a440
cmpl $0x0, -0x14(%rbp)
je 0x6ade5
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
callq 0x4070
movl -0x18(%rbp), %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6adec
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
callq 0x4070
movl (%rax), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
jge 0x6ae2f
jmp 0x6ae2f
movq -0x8(%rbp), %rdi
callq 0x6a440
movl -0xc(%rbp), %eax
movl %eax, -0x10(%rbp)
callq 0x4070
movl -0x10(%rbp), %ecx
movl %ecx, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nop
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %edi
callq 0x6aef0
movq -0x28(%rbp), %rsi
movq %rax, %rdx
movl $0x40, %edi
callq 0x6a340
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x6ae95
movq $0x0, -0x8(%rbp)
jmp 0x6aee4
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x18(%rbp), %rdi
movl $0x73, %esi
callq 0x41e0
cmpq $0x0, %rax
setne %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x20(%rbp), %rax
movb %cl, %dl
movb 0x3c(%rax), %cl
andb $0x1, %dl
andb $-0x2, %cl
orb %dl, %cl
movb %cl, 0x3c(%rax)
movq -0x20(%rbp), %rax
leaq 0x1eda8(%rip), %rcx     # 0x89c80
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop