LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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, %rbp
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %r14
subq (%rdi), %r14
callq 0x3a1cf
testq %rax, %rax
js 0x3a2b5
addq %rbp, %r15
movq %r12, (%rsp)
subq %rbp, %r12
leaq (%r12,%r12), %rax
cmpq %r14, %rax
jb 0x3a2ba
movq 0x20(%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x8(%rax)
movq %rax, %r13
testq %rax, %rax
js 0x3a2d3
addq %r13, 0x28(%rbx)
addq %r13, %r15
subq %r13, %r12
jmp 0x3a288
movq %rax, %r13
jmp 0x3a2dd
movq 0x8(%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4420
addq %r12, 0x8(%rbx)
movq (%rsp), %r13
jmp 0x3a2dd
callq 0x4060
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_O2/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 0x3a32c
movq %rbx, %rdi
callq 0x3a1cf
testl %eax, %eax
js 0x3a38b
cmpl $0x1, %ebp
jne 0x3a35f
movq 0x28(%rbx), %rsi
addq %r14, %rsi
addq 0x8(%rbx), %rsi
xorl %ebp, %ebp
subq (%rbx), %rsi
jns 0x3a362
testq %r14, %r14
pushq $0x16
popq %rax
pushq $0x4b
popq %rbp
cmovsl %eax, %ebp
callq 0x4060
movl %ebp, (%rax)
movl %ebp, 0x34(%rbx)
pushq $-0x1
popq %r14
jmp 0x3a39a
movq %r14, %rsi
movq 0x20(%rbx), %rax
movq %rbx, %rdi
movl %ebp, %edx
callq *0x10(%rax)
movq %rax, %r14
testq %rax, %rax
js 0x3a390
movq (%rbx), %rax
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
andb $-0x2, 0x30(%rbx)
movq %r14, 0x28(%rbx)
jmp 0x3a39a
movslq %eax, %r14
jmp 0x3a39a
callq 0x4060
movl (%rax), %eax
movl %eax, 0x34(%rbx)
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3a3c4
movq %rbx, %rdi
callq 0x3a18e
testl %eax, %eax
jns 0x3a3c4
movl 0x34(%rbx), %ebp
movq 0x20(%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
testl %eax, %eax
jns 0x3a3d9
callq 0x4060
movl (%rax), %ebp
movq %rbx, %rdi
callq 0x39f70
testl %ebp, %ebp
je 0x3a3f1
callq 0x4060
movl %ebp, (%rax)
pushq $-0x1
popq %rax
jmp 0x3a3f3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x4060
movq %rax, %r14
movl (%rax), %ebp
movq 0x20(%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movq %rbx, %rdi
callq 0x39f70
movl %ebp, (%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rsi, %r14
movl %edi, %ebp
callq 0x3a47b
pushq $0x40
popq %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x39ee8
movq %rax, %rbx
testq %rax, %rax
je 0x3a473
movl %ebp, 0x38(%rbx)
pushq $0x73
popq %rsi
movq %r14, %rdi
callq 0x41e0
testq %rax, %rax
setne %al
movb 0x3c(%rbx), %cl
andb $-0x2, %cl
orb %al, %cl
movb %cl, 0x3c(%rbx)
leaq 0x1c771(%rip), %rax     # 0x56be0
movq %rax, 0x20(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %esi, %esi
pushq $0x2
popq %rcx
pushq $0x1
popq %rdx
xorl %eax, %eax
movzbl (%rdi), %r8d
cmpl $0x2b, %r8d
je 0x3a4fc
cmpl $0x61, %r8d
je 0x3a4f3
cmpl $0x65, %r8d
je 0x3a4da
cmpl $0x72, %r8d
je 0x3a4e8
cmpl $0x77, %r8d
je 0x3a4e1
cmpl $0x78, %r8d
je 0x3a4ec
testl %r8d, %r8d
jne 0x3a4fe
jmp 0x3a503
orl $0x80000, %eax          # imm = 0x80000
jmp 0x3a4fe
orl $0x240, %eax            # imm = 0x240
jmp 0x3a4f8
xorl %esi, %esi
jmp 0x3a4fe
orl $0x80, %eax
jmp 0x3a4fe
orl $0x440, %eax            # imm = 0x440
movl %edx, %esi
jmp 0x3a4fe
movl %ecx, %esi
incq %rdi
jmp 0x3a4ab
orl %esi, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3a770
testq %rax, %rax
je 0x3a72e
movq (%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *%rax
cmpb $0x2d, (%r14)
jne 0x3a73b
cmpb $0x0, 0x1(%r14)
je 0x3a74d
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3a9f2
pushq $0x72
popq %rsi
movq %rbx, %rdi
callq 0x41e0
xorl %edi, %edi
testq %rax, %rax
sete %dil
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3a425
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x3a4a1
movq %rbx, %rdi
movl %eax, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x43c0
testl %eax, %eax
js 0x3aa60
movl %eax, %ebx
movl %eax, %edi
callq 0x3a47b
pushq $0x40
popq %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x39ee8
testq %rax, %rax
je 0x3aa4c
movq %rax, %r14
movl %ebx, 0x38(%rax)
andb $-0x2, 0x3c(%rax)
leaq 0x1c19a(%rip), %rax     # 0x56be0
movq %rax, 0x20(%r14)
jmp 0x3aa6a
callq 0x4060
movq %rax, %r14
movl (%rax), %ebp
movl %ebx, %edi
callq 0x4a40
movl %ebp, (%r14)
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x39f70
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3aabb
callq 0x4780
jmp 0x3aac2
xorl %ecx, %ecx
callq 0x4180
movq %rax, %r12
testq %rax, %rax
jns 0x3aad4
callq 0x4060
cmpl $0x4, (%rax)
je 0x3aaa3
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3ab0c
callq 0x41d0
jmp 0x3ab13
xorl %ecx, %ecx
callq 0x42a0
movq %rax, %r12
testq %rax, %rax
jns 0x3ab25
callq 0x4060
cmpl $0x4, (%rax)
je 0x3aaf4
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xc5ed(%rip), %rsi      # 0x47458
pushq $0x5
popq %rdx
callq 0x4280
xorl %r12d, %r12d
testl %eax, %eax
sete %bpl
pushq $0x72
popq %rsi
movq %r14, %rdi
callq 0x41e0
testq %rax, %rax
je 0x3aed3
xorl %r15d, %r15d
pushq $0x50
popq %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x39ee8
testq %rax, %rax
je 0x3aee1
movq %rax, %r14
movb %bpl, %r12b
leaq (%r12,%r12,4), %rax
addq %rax, %rbx
movq %rbx, 0x38(%r14)
movq %rbx, %rdi
callq 0x4210
movq %rax, 0x40(%r14)
andq $0x0, 0x48(%r14)
leaq 0x1bd9e(%rip), %rax     # 0x56c68
movq %rax, 0x20(%r14)
movq %r14, %r15
jmp 0x3aee1
callq 0x4060
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_O2/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 0xc560(%rip), %rsi      # 0x4745e
pushq $0x11
popq %rdx
callq 0x4280
testl %eax, %eax
je 0x3af35
leaq 0xc55f(%rip), %rsi      # 0x47470
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x4280
testl %eax, %eax
je 0x3af39
callq 0x4060
movl $0x5d, (%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
jmp 0x3af3b
pushq $0x7
popq %rax
addq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3a9f2
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3afb1
cmpl $0x1, %edx
je 0x3afa8
cmpl $0x2, %edx
jne 0x3afd6
pushq $0x40
jmp 0x3afaa
pushq $0x48
popq %rax
movq (%rdi,%rax), %rax
jmp 0x3afb3
movl %edx, %eax
testq %rsi, %rsi
sets %dl
cmpq %rax, %rcx
seta %r8b
testb %r8b, %dl
jne 0x3afd6
testq %rsi, %rsi
js 0x3afe6
movq 0x40(%rdi), %rdx
subq %rax, %rdx
cmpq %rdx, %rcx
jbe 0x3afe6
callq 0x4060
movl $0x16, (%rax)
pushq $-0x1
popq %rax
jmp 0x3afed
addq %rsi, %rax
movq %rax, 0x48(%rdi)
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1c5bb(%rip), %rdi     # 0x575b8
callq 0x47a0
movq 0x1c5a7(%rip), %rbx     # 0x575b0
testq %rbx, %rbx
je 0x3b031
movq 0x18(%rbx), %rdi
callq 0x4600
movq 0x10(%rbx), %rdi
callq 0x4600
movq 0x20(%rbx), %rdi
callq 0x4600
movq %rbx, %rdi
callq 0x4600
movq 0x1c5a8(%rip), %rbx     # 0x575e0
testq %rbx, %rbx
je 0x3b060
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x3b048
callq *%rax
movq 0x20(%rbx), %r14
movq %r14, 0x1c58d(%rip)     # 0x575e0
movq %rbx, %rdi
callq 0x4600
movq %r14, %rbx
jmp 0x3b038
leaq 0x1c551(%rip), %rbx     # 0x575b8
movq %rbx, %rdi
callq 0x43f0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x45d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x1c553(%rip)     # 0x575e8
jne 0x3b09e
movb $0x1, 0x1c54a(%rip)     # 0x575e8
xorl %r12d, %r12d
pushq $0x40
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x39ee8
testq %rax, %rax
je 0x3b0e5
movq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3ffde
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x3b0da
leaq 0x1bbbf(%rip), %rax     # 0x56c90
movq %rax, 0x20(%r15)
movq %r15, %r12
jmp 0x3b0e5
movq %r15, %rdi
callq 0x39f70
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xc353(%rip), %rax      # 0x4744f
movq %rax, 0x10(%rdi)
leaq 0xc3da(%rip), %rdi      # 0x474e1
leaq 0x1bbaa(%rip), %rbx     # 0x56cb8
movq %rbx, %rsi
callq 0x3a506
leaq 0xc3c9(%rip), %rdi      # 0x474e6
movq %rbx, %rsi
callq 0x3a506
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3b1a7
pushq $0x40
popq %r12
subq %rax, %r12
movq %rdx, %r15
leaq (%rbx,%rax), %rdi
addq $0x18, %rdi
subq %r12, %r15
jae 0x3b1ac
movq %r14, %rsi
jmp 0x3b1f8
movq %rdx, %r15
jmp 0x3b1cc
leaq 0x18(%rbx), %r13
movq %r14, %rsi
movq %r12, %rdx
callq 0x4420
addq %r12, %r14
pushq $0x40
popq %rdx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3b206
cmpq $0x40, %r15
jb 0x3b1eb
movq %r15, %rdx
andq $-0x40, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3b206
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_O2/karel-brinda[P]ococo/ext/htslib/md5.c
// Function: hts_md5_final
void hts_md5_final(unsigned char *result, hts_md5_context *ctx)
{
	unsigned long used, available;

	used = ctx->lo & 0x3f;

	ctx->buffer[used++] = 0x80;

	available = 64 - used;

	if (available < 8) {
		memset(&ctx->buffer[used], 0, available);
		body(ctx, ctx->buffer, 64);
		used = 0;
		available = 64;
	}

	memset(&ctx->buffer[used], 0, available - 8);

	ctx->lo <<= 3;
	ctx->buffer[56] = ctx->lo;
	ctx->buffer[57] = ctx->lo >> 8;
	ctx->buffer[58] = ctx->lo >> 16;
	ctx->buffer[59] = ctx->lo >> 24;
	ctx->buffer[60] = ctx->hi;
	ctx->buffer[61] = ctx->hi >> 8;
	ctx->buffer[62] = ctx->hi >> 16;
	ctx->buffer[63] = ctx->hi >> 24;

	body(ctx, ctx->buffer, 64);

	result[0] = ctx->a;
	result[1] = ctx->a >> 8;
	result[2] = ctx->a >> 16;
	result[3] = ctx->a >> 24;
	result[4] = ctx->b;
	result[5] = ctx->b >> 8;
	result[6] = ctx->b >> 16;
	result[7] = ctx->b >> 24;
	result[8] = ctx->c;
	result[9] = ctx->c >> 8;
	result[10] = ctx->c >> 16;
	result[11] = ctx->c >> 24;
	result[12] = ctx->d;
	result[13] = ctx->d >> 8;
	result[14] = ctx->d >> 16;
	result[15] = ctx->d >> 24;

	memset(ctx, 0, sizeof(*ctx));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %edx
andl $0x3f, %edx
leaq 0x18(%rsi), %r15
leaq 0x1(%rdx), %rdi
movb $-0x80, 0x18(%rsi,%rdx)
xorq $0x3f, %rdx
cmpq $0x7, %rdx
ja 0x3baab
pushq $0x40
popq %r12
addq %r15, %rdi
xorl %esi, %esi
callq 0x42e0
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3b206
xorl %edi, %edi
movq %r12, %rdx
addq %r15, %rdi
addq $-0x8, %rdx
xorl %esi, %esi
callq 0x42e0
movl (%rbx), %eax
movl 0x4(%rbx), %ecx
leal (,%rax,8), %edx
movl %edx, (%rbx)
movb %dl, 0x50(%rbx)
movl %eax, %edx
shrl $0x5, %edx
movb %dl, 0x51(%rbx)
movl %eax, %edx
shrl $0xd, %edx
movb %dl, 0x52(%rbx)
shrl $0x15, %eax
movb %al, 0x53(%rbx)
movl %ecx, 0x54(%rbx)
pushq $0x40
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3b206
movb 0x8(%rbx), %al
movb %al, (%r14)
movb 0x9(%rbx), %al
movb %al, 0x1(%r14)
movb 0xa(%rbx), %al
movb %al, 0x2(%r14)
movb 0xb(%rbx), %al
movb %al, 0x3(%r14)
movb 0xc(%rbx), %al
movb %al, 0x4(%r14)
movb 0xd(%rbx), %al
movb %al, 0x5(%r14)
movb 0xe(%rbx), %al
movb %al, 0x6(%r14)
movb 0xf(%rbx), %al
movb %al, 0x7(%r14)
movb 0x10(%rbx), %al
movb %al, 0x8(%r14)
movb 0x11(%rbx), %al
movb %al, 0x9(%r14)
movb 0x12(%rbx), %al
movb %al, 0xa(%r14)
movb 0x13(%rbx), %al
movb %al, 0xb(%r14)
movb 0x14(%rbx), %al
movb %al, 0xc(%r14)
movb 0x15(%rbx), %al
movb %al, 0xd(%r14)
movb 0x16(%rbx), %al
movb %al, 0xe(%r14)
movb 0x17(%rbx), %al
movb %al, 0xf(%r14)
movl $0x98, %edx
movq %rbx, %rdi
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x42e0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x46f0
testq %rax, %rax
je 0x3bba2
movabsq $0x1032547698badcfe, %rcx # imm = 0x1032547698BADCFE
movq %rcx, 0x10(%rax)
movaps 0xb951(%rip), %xmm0     # 0x474f0
movups %xmm0, (%rax)
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x90f4(%rip), %rcx      # 0x44ca6
cmpq $0x10, %rax
je 0x3bbd8
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
jmp 0x3bbb2
movb $0x0, 0x20(%rdi)
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_external_decode_int
int cram_external_decode_int(cram_slice *slice, cram_codec *c,
			     cram_block *in, char *out, int *out_size) {
    int l;
    char *cp;
    cram_block *b;

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

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

    return l > 0 ? 0 : -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %r8, %rbx
movq %rcx, %r14
movl 0x30(%rsi), %esi
callq 0x3bc37
testq %rax, %rax
je 0x3bc26
movq %rax, %r15
movq 0x20(%rax), %rax
movslq 0x1c(%r15), %rdi
addq %rax, %rdi
movslq 0x14(%r15), %rsi
addq %rax, %rsi
movq %r14, %rdx
callq 0x3bc89
addl %eax, 0x1c(%r15)
movl $0x1, (%rbx)
testl %eax, %eax
sete %al
jmp 0x3bc2c
cmpl $0x0, (%rbx)
setne %al
movzbl %al, %eax
negl %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_external_decode_char
int cram_external_decode_char(cram_slice *slice, cram_codec *c,
			      cram_block *in, char *out,
			      int *out_size) {
    char *cp;
    cram_block *b;

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

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

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

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %r8, %r14
movq %rcx, %rbx
movl 0x30(%rsi), %esi
callq 0x3bc37
movl (%r14), %edx
testq %rax, %rax
je 0x3bd8b
movq 0x20(%rax), %rsi
movslq 0x1c(%rax), %rcx
addl %ecx, %edx
movl %edx, 0x1c(%rax)
cmpl 0x14(%rax), %edx
setg %al
testq %rsi, %rsi
sete %dl
orb %al, %dl
je 0x3bd93
pushq $-0x1
popq %rbp
jmp 0x3bda8
xorl %ebp, %ebp
negl %edx
sbbl %ebp, %ebp
jmp 0x3bda8
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x3bda8
addq %rcx, %rsi
movslq (%r14), %rdx
movq %rbx, %rdi
callq 0x4420
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_external_decode_init
cram_codec *cram_external_decode_init(char *data, int size,
				      enum cram_external_type option,
				      int version) {
    cram_codec *c;
    char *cp = data;

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

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

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

    c->external.type = option;

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %r15
movl $0x240, %edi            # imm = 0x240
callq 0x46f0
testq %rax, %rax
je 0x3bed6
movq %rax, %rbx
movl $0x1, (%rax)
leal -0x1(%r14), %eax
cmpl $0x1, %eax
ja 0x3bdf1
leaq -0x20f(%rip), %rax      # 0x3bbe0
jmp 0x3be0a
leal -0x3(%r14), %eax
cmpl $0x1, %eax
ja 0x3be03
leaq -0xb2(%rip), %rax       # 0x3bd4f
jmp 0x3be0a
leaq 0xdc(%rip), %rax        # 0x3bee6
movq %rax, 0x18(%rbx)
leaq -0x66(%rip), %rax       # 0x3bdaf
movq %rax, 0x10(%rbx)
movzbl (%r15), %eax
testb %al, %al
js 0x3be25
pushq $0x1
jmp 0x3bea0
movzbl 0x1(%r15), %ecx
cmpb $-0x41, %al
ja 0x3be3a
andl $0x3f, %eax
shll $0x8, %eax
orl %ecx, %eax
pushq $0x2
jmp 0x3bea0
cmpb $-0x21, %al
ja 0x3be54
shll $0x8, %ecx
movzbl 0x2(%r15), %edx
andl $0x1f, %eax
shll $0x10, %eax
orl %ecx, %eax
orl %edx, %eax
pushq $0x3
jmp 0x3bea0
cmpb $-0x11, %al
ja 0x3be78
shll $0x10, %ecx
movzbl 0x2(%r15), %edx
shll $0x8, %edx
movzbl 0x3(%r15), %esi
andl $0xf, %eax
shll $0x18, %eax
orl %ecx, %eax
orl %edx, %eax
orl %esi, %eax
pushq $0x4
jmp 0x3bea0
shll $0x1c, %eax
shll $0x14, %ecx
orl %eax, %ecx
movzbl 0x2(%r15), %eax
shll $0xc, %eax
orl %ecx, %eax
movzbl 0x3(%r15), %ecx
shll $0x4, %ecx
orl %eax, %ecx
movzbl 0x4(%r15), %eax
andl $0xf, %eax
orl %ecx, %eax
pushq $0x5
popq %rcx
movl %eax, 0x30(%rbx)
movslq %ebp, %rax
cmpq %rax, %rcx
jne 0x3beb2
movl %r14d, 0x34(%rbx)
jmp 0x3bed8
movq 0x1b117(%rip), %rax     # 0x56fd0
movq (%rax), %rcx
leaq 0xb6c5(%rip), %rdi      # 0x47588
pushq $0x21
popq %rsi
pushq $0x1
popq %rdx
callq 0x4a20
movq %rbx, %rdi
callq 0x4600
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_external_decode_block
static int cram_external_decode_block(cram_slice *slice, cram_codec *c,
				      cram_block *in, char *out_,
				      int *out_size) {
    char *cp;
    cram_block *b = NULL;
    cram_block *out = (cram_block *)out_;

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

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

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %rbx
movl 0x30(%rsi), %esi
callq 0x3bc37
movl (%r14), %ecx
testq %rax, %rax
je 0x3bf29
movq 0x20(%rax), %r15
movslq 0x1c(%rax), %rdx
addl %edx, %ecx
movl %ecx, 0x1c(%rax)
cmpl 0x14(%rax), %ecx
setg %al
testq %r15, %r15
sete %cl
orb %al, %cl
je 0x3bf34
pushq $-0x1
popq %rax
jmp 0x3bfc8
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
jmp 0x3bfc8
addq %rdx, %r15
movl $0x400, %r12d           # imm = 0x400
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
movslq (%r14), %rdx
leaq (%rdi,%rdx), %rcx
cmpq %rcx, %rax
ja 0x3bfb3
movq %rax, %xmm0
punpckldq 0x7a32(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x7a3a(%rip), %xmm0     # 0x439a0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x8a66(%rip), %xmm1     # 0x449e0
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
subsd 0x798e(%rip), %xmm1     # 0x43918
cvttsd2si %xmm1, %rsi
sarq $0x3f, %rdx
andq %rdx, %rsi
orq %rcx, %rsi
testq %rax, %rax
cmoveq %r12, %rsi
movq %rsi, 0x28(%rbx)
movq 0x20(%rbx), %rdi
callq 0x48c0
movq %rax, 0x20(%rbx)
jmp 0x3bf3d
addq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x4420
movslq (%r14), %rax
addq %rax, 0x30(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_external_encode_init
cram_codec *cram_external_encode_init(cram_stats *st,
				      enum cram_external_type option,
				      void *dat,
				      int version) {
    cram_codec *c;

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

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

    return c;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %r14d
movl $0x240, %edi            # imm = 0x240
callq 0x46f0
testq %rax, %rax
je 0x3c318
movl $0x1, (%rax)
leaq -0x244(%rip), %rcx      # 0x3c09b
movq %rcx, 0x10(%rax)
leal -0x1(%r14), %ecx
cmpl $0x2, %ecx
jae 0x3c2f5
leaq -0x31f(%rip), %rcx      # 0x3bfd4
jmp 0x3c306
addl $-0x3, %r14d
cmpl $0x2, %r14d
jae 0x3c320
leaq -0x322(%rip), %rcx      # 0x3bfe4
movq %rcx, 0x20(%rax)
leaq -0x271(%rip), %rcx      # 0x3c0a0
movq %rcx, 0x28(%rax)
movl %ebx, 0x30(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x42f0
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_beta_decode_int
int cram_beta_decode_int(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int32_t *out_i = (int32_t *)out;
    int i, n;

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

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

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rcx, %rbx
movq %rsi, %r14
movl 0x34(%rsi), %esi
testl %esi, %esi
je 0x3c365
movq %rdx, %r12
movq %rdx, %rdi
callq 0x3c3b2
testl %eax, %eax
je 0x3c386
pushq $-0x1
popq %r15
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl (%r15), %eax
xorl %r15d, %r15d
testl %eax, %eax
cmovlel %r15d, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x3c353
xorl %edx, %edx
subl 0x30(%r14), %edx
movl %edx, (%rbx,%rcx,4)
incq %rcx
jmp 0x3c373
movl (%r15), %r13d
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x3c353
movl 0x34(%r14), %esi
movq %r12, %rdi
callq 0x3c3ee
subl 0x30(%r14), %eax
movl %eax, (%rbx,%rbp,4)
incq %rbp
jmp 0x3c395
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/./cram/cram_codecs.h
// Function: cram_not_enough_bits
static inline int cram_not_enough_bits(cram_block *blk, int nbits) {
    if (nbits < 0 ||
	(blk->byte >= blk->uncomp_size && nbits > 0) ||
	(blk->uncomp_size - blk->byte <= INT32_MAX / 8 + 1 &&
	 (blk->uncomp_size - blk->byte) * 8 + blk->bit - 7 < nbits)) {
        return 1;
    }
    return 0;
}

// Assembly:
pushq $0x1
popq %rax
testl %esi, %esi
js 0x3c3ed
movslq 0x14(%rdi), %rcx
subq 0x30(%rdi), %rcx
setbe %dl
testl %esi, %esi
setne %r8b
testb %dl, %r8b
jne 0x3c3ed
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x3c3eb
movslq 0x38(%rdi), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
movl %esi, %edx
cmpq %rdx, %rcx
jb 0x3c3ed
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_beta_decode_char
int cram_beta_decode_char(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int i, n;


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

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

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movq %rcx, %r14
movq %rsi, %rbx
movl 0x34(%rsi), %esi
testl %esi, %esi
je 0x3c685
movq %rdx, %r15
movq %rdx, %rdi
callq 0x3c3b2
testl %eax, %eax
je 0x3c6af
pushq $-0x1
popq %r12
jmp 0x3c6f6
testq %r14, %r14
je 0x3c6f3
movl (%r12), %eax
xorl %r12d, %r12d
testl %eax, %eax
cmovlel %r12d, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x3c6f6
movb 0x30(%rbx), %dl
xorl %esi, %esi
subb %dl, %sil
movb %sil, (%r14,%rcx)
incq %rcx
jmp 0x3c699
movl (%r12), %eax
xorl %ebp, %ebp
testl %eax, %eax
cmovgl %eax, %ebp
testq %r14, %r14
je 0x3c6ee
movl %ebp, %r13d
xorl %r12d, %r12d
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x3c6f6
movl 0x34(%rbx), %esi
movq %r15, %rdi
callq 0x3c3ee
subl 0x30(%rbx), %eax
movb %al, (%r14,%rbp)
incq %rbp
jmp 0x3c6c7
movl 0x34(%rbx), %esi
movq %r15, %rdi
callq 0x3c3ee
subl $0x1, %ebp
jae 0x3c6e3
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_beta_encode_store
int cram_beta_encode_store(cram_codec *c, cram_block *b,
			   char *prefix, int version) {
    int len = 0;

    if (prefix) {
	size_t l = strlen(prefix);
	BLOCK_APPEND(b, prefix, l);
	len += l;
    }

    len += itf8_put_blk(b, c->codec);
    len += itf8_put_blk(b, itf8_size(c->e_beta.offset)
			+ itf8_size(c->e_beta.nbits)); // codec length
    len += itf8_put_blk(b, c->e_beta.offset);
    len += itf8_put_blk(b, c->e_beta.nbits);

    return len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x3c99a
movq %rdx, %r12
movq %rdx, %rdi
callq 0x4210
movq %rax, %r15
movl $0x400, %r13d           # imm = 0x400
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
leaq (%rdi,%r15), %rcx
cmpq %rcx, %rax
ja 0x3c985
movq %rax, %xmm0
punpckldq 0x7060(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x7068(%rip), %xmm0     # 0x439a0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x8094(%rip), %xmm1     # 0x449e0
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
subsd 0x6fbc(%rip), %xmm1     # 0x43918
cvttsd2si %xmm1, %rsi
sarq $0x3f, %rdx
andq %rdx, %rsi
orq %rcx, %rsi
testq %rax, %rax
cmoveq %r13, %rsi
movq %rsi, 0x28(%rbx)
movq 0x20(%rbx), %rdi
callq 0x48c0
movq %rax, 0x20(%rbx)
jmp 0x3c912
addq 0x20(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4420
addq %r15, 0x30(%rbx)
jmp 0x3c99d
xorl %r15d, %r15d
movl (%r14), %esi
movq %rbx, %rdi
callq 0x27684
movl %eax, %ebp
movl 0x30(%r14), %edx
pushq $0x1
popq %rsi
pushq $0x5
popq %rcx
movl %esi, %eax
cmpl $0x80, %edx
jb 0x3c9e2
cmpl $0x4000, %edx           # imm = 0x4000
jae 0x3c9ca
pushq $0x2
jmp 0x3c9d4
cmpl $0x200000, %edx         # imm = 0x200000
jae 0x3c9d7
pushq $0x3
popq %rax
jmp 0x3c9e2
cmpl $0x10000000, %edx       # imm = 0x10000000
movl %ecx, %eax
sbbl $0x0, %eax
movl 0x34(%r14), %edx
cmpl $0x80, %edx
jb 0x3ca12
cmpl $0x4000, %edx           # imm = 0x4000
jae 0x3c9fa
pushq $0x2
jmp 0x3ca04
cmpl $0x200000, %edx         # imm = 0x200000
jae 0x3ca07
pushq $0x3
popq %rsi
jmp 0x3ca12
cmpl $0x10000000, %edx       # imm = 0x10000000
sbbl $0x0, %ecx
movl %ecx, %esi
addl %eax, %esi
addl %r15d, %ebp
movq %rbx, %rdi
callq 0x27684
movl %eax, %r15d
movl 0x30(%r14), %esi
movq %rbx, %rdi
callq 0x27684
movl %eax, %r12d
addl %r15d, %r12d
addl %ebp, %r12d
movl 0x34(%r14), %esi
movq %rbx, %rdi
callq 0x27684
addl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_beta_encode_int
int cram_beta_encode_int(cram_slice *slice, cram_codec *c,
			 char *in, int in_size) {
    int *syms = (int *)in;
    int i, r = 0;

    for (i = 0; i < in_size; i++)
	r |= store_bits_MSB(c->out, syms[i] + c->e_beta.offset,
			    c->e_beta.nbits);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
xorl %r12d, %r12d
testl %ecx, %ecx
cmovlel %r12d, %ebx
xorl %ebp, %ebp
cmpq %r12, %rbx
je 0x3ca91
movq 0x8(%r15), %rdi
movl 0x30(%r15), %esi
addl (%r14,%r12,4), %esi
movl 0x34(%r15), %edx
callq 0x3ca9c
orl %eax, %ebp
incq %r12
jmp 0x3ca70
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_beta_encode_char
int cram_beta_encode_char(cram_slice *slice, cram_codec *c,
			  char *in, int in_size) {
    unsigned char *syms = (unsigned char *)in;
    int i, r = 0;

    for (i = 0; i < in_size; i++)
	r |= store_bits_MSB(c->out, syms[i] + c->e_beta.offset,
			    c->e_beta.nbits);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
xorl %r12d, %r12d
testl %ecx, %ecx
cmovlel %r12d, %ebx
xorl %ebp, %ebp
cmpq %r12, %rbx
je 0x3cc2c
movq 0x8(%r15), %rdi
movzbl (%r14,%r12), %esi
addl 0x30(%r15), %esi
movl 0x34(%r15), %edx
callq 0x3ca9c
orl %eax, %ebp
incq %r12
jmp 0x3cc0a
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_beta_encode_init
cram_codec *cram_beta_encode_init(cram_stats *st,
				  enum cram_external_type option,
				  void *dat,
				  int version) {
    cram_codec *c;
    int min_val, max_val, len = 0;

    c = malloc(sizeof(*c));
    if (!c)
	return NULL;
    c->codec  = E_BETA;
    c->free   = cram_beta_encode_free;
    if (option == E_INT)
	c->encode = cram_beta_encode_int;
    else
	c->encode = cram_beta_encode_char;
    c->store  = cram_beta_encode_store;

    if (dat) {
	min_val = ((int *)dat)[0];
	max_val = ((int *)dat)[1];
    } else {
	min_val = INT_MAX;
	max_val = INT_MIN;
	int i;
	for (i = 0; i < MAX_STAT_VAL; i++) {
	    if (!st->freqs[i])
		continue;
	    if (min_val > i)
		min_val = i;
	    max_val = i;
	}
	if (st->h) {
	    khint_t k;

	    for (k = kh_begin(st->h); k != kh_end(st->h); k++) {
		if (!kh_exist(st->h, k))
		    continue;
	    
		i = kh_key(st->h, k);
		if (min_val > i)
		    min_val = i;
		if (max_val < i)
		    max_val = i;
	    }
	}
    }

    assert(max_val >= min_val);
    c->e_beta.offset = -min_val;
    max_val -= min_val;
    while (max_val) {
	len++;
	max_val >>= 1;
    }
    c->e_beta.nbits = len;

    return c;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movl $0x240, %edi            # imm = 0x240
callq 0x46f0
testq %rax, %rax
je 0x3ccb4
movl $0x6, (%rax)
leaq -0x2d(%rip), %rcx       # 0x3cc37
movq %rcx, 0x10(%rax)
cmpl $0x1, %ebp
leaq -0x21d(%rip), %rcx      # 0x3ca55
leaq -0x8a(%rip), %rdx       # 0x3cbef
cmoveq %rcx, %rdx
movq %rdx, 0x20(%rax)
leaq -0x3a4(%rip), %rcx      # 0x3c8e4
movq %rcx, 0x28(%rax)
testq %r14, %r14
je 0x3ccb9
movl (%r14), %esi
movl 0x4(%r14), %edx
subl %esi, %edx
jl 0x3cd37
negl %esi
movl %esi, 0x30(%rax)
xorl %ecx, %ecx
testl %edx, %edx
je 0x3ccb1
incl %ecx
sarl %edx
jmp 0x3cca7
movl %ecx, 0x34(%rax)
popq %rbx
popq %r14
popq %rbp
retq
movl $0x80000000, %edx       # imm = 0x80000000
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
cmpq $0x400, %rcx            # imm = 0x400
je 0x3cce4
cmpl %ecx, %esi
movl %ecx, %edi
cmovll %esi, %edi
cmpl $0x0, (%rbx,%rcx,4)
cmovnel %edi, %esi
cmovnel %ecx, %edx
incq %rcx
jmp 0x3ccc5
movq 0x1000(%rbx), %rdi
testq %rdi, %rdi
je 0x3cc98
movl (%rdi), %r8d
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpq %r10, %r8
je 0x3cc98
movq 0x10(%rdi), %rcx
movl %r10d, %r11d
shrl $0x4, %r11d
movl (%rcx,%r11,4), %r11d
movl %r9d, %ecx
andb $0x1e, %cl
shrl %cl, %r11d
testb $0x3, %r11b
jne 0x3cd2e
movq 0x18(%rdi), %rcx
movl (%rcx,%r10,4), %ecx
cmpl %ecx, %esi
cmovgel %ecx, %esi
cmpl %ecx, %edx
cmovlel %ecx, %edx
incq %r10
addl $0x2, %r9d
jmp 0x3ccf9
leaq 0xa88a(%rip), %rdi      # 0x475c8
leaq 0xa896(%rip), %rsi      # 0x475db
leaq 0xa8a2(%rip), %rcx      # 0x475ee
movl $0x288, %edx            # imm = 0x288
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_subexp_decode_init
cram_codec *cram_subexp_decode_init(char *data, int size,
				    enum cram_external_type option,
				    int version) {
    cram_codec *c;
    char *cp = data;

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

    c->codec  = E_SUBEXP;
    c->decode = cram_subexp_decode;
    c->free   = cram_subexp_decode_free;
    c->subexp.k = -1;

    cp += safe_itf8_get(cp, data + size, &c->subexp.offset);
    cp += safe_itf8_get(cp, data + size, &c->subexp.k);

    if (cp - data != size || c->subexp.k < 0) {
	fprintf(stderr, "Malformed subexp header stream\n");
	free(c);
	return NULL;
    }

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
movl $0x240, %edi            # imm = 0x240
callq 0x46f0
testq %rax, %rax
je 0x3cfa9
movq %rax, %rbx
movl $0x7, (%rax)
leaq -0x1dc(%rip), %rax      # 0x3cd56
movq %rax, 0x18(%rbx)
leaq -0x43(%rip), %rax       # 0x3cefa
movq %rax, 0x10(%rbx)
leaq 0x30(%rbx), %rdx
orl $-0x1, 0x34(%rbx)
movq %rbx, %r15
addq $0x34, %r15
movslq %ebp, %r13
leaq (%r14,%r13), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x3bc89
movl %eax, %ebp
addq %rbp, %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x3bc89
movl %eax, %eax
addq %rbp, %rax
cmpq %r13, %rax
jne 0x3cf85
cmpl $0x0, (%r15)
jns 0x3cfab
movq 0x1a044(%rip), %rax     # 0x56fd0
movq (%rax), %rcx
leaq 0xa6ae(%rip), %rdi      # 0x47644
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
callq 0x4a20
movq %rbx, %rdi
callq 0x4600
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_gamma_decode
int cram_gamma_decode(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int32_t *out_i = (int32_t *)out;
    int i, n;

    for (i = 0, n = *out_size; i < n; i++) {
	int nz = 0;
	int val;
	//while (get_bit_MSB(in) == 0) nz++;
	nz = get_zero_bits_MSB(in);
        if (cram_not_enough_bits(in, nz))
            return -1;
	val = 1;
	while (nz > 0) {
	    //val <<= 1; val |= get_bit_MSB(in);
	    GET_BIT_MSB(in, val);
	    nz--;
	}

	out_i[i] = val - c->gamma.offset;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, %r15
movq %rsi, 0x8(%rsp)
movl (%r8), %r13d
xorl %eax, %eax
testl %r13d, %r13d
cmovlel %eax, %r13d
pushq $0x7
popq %rbx
xorl %r14d, %r14d
cmpq %r13, %r14
je 0x3d0af
movq 0x30(%r15), %r12
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jae 0x3d048
movq 0x20(%r15), %rdx
movl 0x38(%r15), %ecx
pushq $-0x1
popq %rbp
movzbl (%rdx,%r12), %esi
shrl %cl, %esi
subl $0x1, %ecx
movl %ecx, 0x38(%r15)
jae 0x3d03a
movl $0x7, 0x38(%r15)
incq %r12
movq %r12, 0x30(%r15)
andl $0x1, %esi
movl %ebx, %ecx
cmpq %rax, %r12
jne 0x3d03d
testl %esi, %esi
jne 0x3d03d
jmp 0x3d045
andl $0x1, %esi
incl %ebp
testl %esi, %esi
je 0x3d00b
jmp 0x3d04b
movq %rax, %r12
pushq $-0x1
popq %rbp
movq %r15, %rdi
movl %ebp, %esi
callq 0x3c3b2
testl %eax, %eax
jne 0x3d0b3
pushq $0x1
popq %rax
testl %ebp, %ebp
jle 0x3d096
movq 0x20(%r15), %rcx
movzbl (%rcx,%r12), %ecx
movl 0x38(%r15), %edx
xorl %esi, %esi
btl %edx, %ecx
setb %sil
leal (%rsi,%rax,2), %eax
leal -0x1(%rdx), %ecx
xorl %esi, %esi
testl %edx, %edx
setle %sil
addq %rsi, %r12
movq %r12, 0x30(%r15)
andl $0x7, %ecx
movl %ecx, 0x38(%r15)
decl %ebp
jmp 0x3d05c
movq 0x8(%rsp), %rcx
subl 0x30(%rcx), %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx,%r14,4)
incq %r14
jmp 0x3cfea
xorl %eax, %eax
jmp 0x3d0b6
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq