LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/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)
jne 0x48c90
movl 0x38(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x41f0
jmp 0x48ca1
movl 0x38(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x4290
movq %rax, %r12
testq %rax, %rax
jns 0x48cb3
callq 0x4070
cmpl $0x4, (%rax)
je 0x48c78
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: fd_flush
static int fd_flush(hFILE *fpv)
{
    hFILE_fd *fp = (hFILE_fd *) fpv;
    int ret;
    do {
#ifdef HAVE_FDATASYNC
        ret = fdatasync(fp->fd);
#else
        ret = fsync(fp->fd);
#endif
        // Ignore invalid-for-fsync(2) errors due to being, e.g., a pipe,
        // and operation-not-supported errors (Mac OS X)
        if (ret < 0 && (errno == EINVAL || errno == ENOTSUP)) ret = 0;
    } while (ret < 0 && errno == EINTR);
    return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x38(%rbx), %edi
callq 0x4450
movl %eax, %ebp
testl %eax, %eax
jns 0x48cf1
callq 0x4070
movl (%rax), %eax
cmpl $0x5f, %eax
je 0x48cef
cmpl $0x16, %eax
jne 0x48cf1
xorl %ebp, %ebp
testl %ebp, %ebp
jns 0x48cff
callq 0x4070
cmpl $0x4, (%rax)
je 0x48cd0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xd415(%rip), %rsi      # 0x56448
movl $0x5, %edx
callq 0x4280
xorl %r12d, %r12d
testl %eax, %eax
sete %bpl
movq %r14, %rdi
movl $0x72, %esi
callq 0x4200
testq %rax, %rax
je 0x490a4
xorl %r15d, %r15d
movl $0x50, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x47f9c
testq %rax, %rax
je 0x490b2
movq %rax, %r14
movb %bpl, %r12b
leaq (%r12,%r12,4), %rax
addq %rax, %rbx
movq %rbx, 0x38(%r14)
movq %rbx, %rdi
callq 0x4230
movq %rax, 0x40(%r14)
movq $0x0, 0x48(%r14)
leaq 0x1ab6d(%rip), %rax     # 0x63c08
movq %rax, 0x20(%r14)
movq %r14, %r15
jmp 0x490b2
callq 0x4070
movl $0x16, (%rax)
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xd37f(%rip), %rsi      # 0x5644e
movl $0x11, %edx
callq 0x4280
testl %eax, %eax
je 0x4910a
leaq 0xd37c(%rip), %rsi      # 0x56460
movl $0x8, %edx
movq %r14, %rdi
callq 0x4280
testl %eax, %eax
je 0x49111
callq 0x4070
movl $0x5d, (%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %eax
jmp 0x49116
movl $0x7, %eax
addq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x48b57
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: mem_read
static ssize_t mem_read(hFILE *fpv, void *buffer, size_t nbytes)
{
    hFILE_mem *fp = (hFILE_mem *) fpv;
    size_t avail = fp->length - fp->pos;
    if (nbytes > avail) nbytes = avail;
    memcpy(buffer, fp->buffer + fp->pos, nbytes);
    fp->pos += nbytes;
    return nbytes;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
movq 0x40(%rdi), %r14
movq 0x48(%rdi), %rsi
subq %rsi, %r14
cmpq %rdx, %r14
cmovaeq %rdx, %r14
addq 0x38(%rdi), %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x4420
addq %r14, 0x48(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x49190
cmpl $0x1, %edx
je 0x49185
cmpl $0x2, %edx
jne 0x491b5
movl $0x40, %eax
jmp 0x4918a
movl $0x48, %eax
movq (%rdi,%rax), %rax
jmp 0x49192
movl %edx, %eax
testq %rsi, %rsi
sets %dl
cmpq %rax, %rcx
seta %r8b
testb %r8b, %dl
jne 0x491b5
testq %rsi, %rsi
js 0x491c9
movq 0x40(%rdi), %rdx
subq %rax, %rdx
cmpq %rdx, %rcx
jbe 0x491c9
callq 0x4070
movl $0x16, (%rax)
movq $-0x1, %rax
jmp 0x491d0
addq %rsi, %rax
movq %rax, 0x48(%rdi)
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b3e8(%rip), %rdi     # 0x645c8
callq 0x47a0
movq 0x1b3d4(%rip), %rbx     # 0x645c0
testq %rbx, %rbx
je 0x49214
movq 0x18(%rbx), %rdi
callq 0x4610
movq 0x10(%rbx), %rdi
callq 0x4610
movq 0x20(%rbx), %rdi
callq 0x4610
movq %rbx, %rdi
callq 0x4610
movq 0x1b3d5(%rip), %rbx     # 0x645f0
testq %rbx, %rbx
je 0x49246
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x4922b
callq *%rax
movq 0x20(%rbx), %r14
movq %r14, 0x1b3ba(%rip)     # 0x645f0
movq %rbx, %rdi
callq 0x4610
movq %r14, %rbx
testq %r14, %r14
jne 0x49220
leaq 0x1b37b(%rip), %rbx     # 0x645c8
movq %rbx, %rdi
callq 0x43f0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x45e0
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x1b37f(%rip)     # 0x645f8
jne 0x49282
movb $0x1, 0x1b376(%rip)     # 0x645f8
xorl %r12d, %r12d
movl $0x40, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x47f9c
testq %rax, %rax
je 0x492cb
movq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4ed02
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x492c0
leaq 0x1a979(%rip), %rax     # 0x63c30
movq %rax, 0x20(%r15)
movq %r15, %r12
jmp 0x492cb
movq %r15, %rdi
callq 0x4802c
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xd15d(%rip), %rax      # 0x5643f
movq %rax, 0x10(%rdi)
leaq 0xd1e4(%rip), %rdi      # 0x564d1
leaq 0x1a964(%rip), %rbx     # 0x63c58
movq %rbx, %rsi
callq 0x48620
leaq 0xd1d3(%rip), %rdi      # 0x564d6
movq %rbx, %rsi
callq 0x48620
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %eax
leal (%rdx,%rax), %ecx
andl $0x1fffffff, %ecx       # imm = 0x1FFFFFFF
movl %ecx, (%rdi)
cmpl %eax, %ecx
jae 0x49363
incl 0x4(%r14)
movq %rdx, %rcx
shrq $0x1d, %rcx
addl %ecx, 0x4(%r14)
andq $0x3f, %rax
je 0x49392
movl $0x40, %r12d
subq %rax, %r12
movq %rdx, %r15
leaq (%r14,%rax), %rdi
addq $0x18, %rdi
subq %r12, %r15
jae 0x49397
movq %rbx, %rsi
jmp 0x493e5
movq %rdx, %r15
jmp 0x493b9
leaq 0x18(%r14), %r13
movq %rbx, %rsi
movq %r12, %rdx
callq 0x4420
addq %r12, %rbx
movl $0x40, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x493f3
cmpq $0x40, %r15
jb 0x493d8
movq %r15, %rdx
andq $-0x40, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x493f3
movq %rax, %rbx
andl $0x3f, %r15d
addq $0x18, %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4420
// File: /workspace/github_cpp_makefile_star2_O1/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), %r12d
andl $0x3f, %r12d
leaq 0x18(%rsi), %r15
leaq 0x1(%r12), %rdi
movb $-0x80, 0x18(%rsi,%r12)
xorq $0x3f, %r12
cmpq $0x7, %r12
ja 0x49ca0
addq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x42d0
movl $0x40, %r12d
movl $0x40, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x493f3
xorl %edi, %edi
addq %r15, %rdi
addq $-0x8, %r12
xorl %esi, %esi
movq %r12, %rdx
callq 0x42d0
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)
movl $0x40, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x493f3
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 0x42d0
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/md5.c
// Function: hts_md5_init
hts_md5_context *hts_md5_init(void)
{
    hts_md5_context *ctx = malloc(sizeof(*ctx));
    if (!ctx)
        return NULL;

    hts_md5_reset(ctx);
    return ctx;
}

// Assembly:
pushq %rax
movl $0x98, %edi
callq 0x4700
testq %rax, %rax
je 0x49d98
movaps 0xc755(%rip), %xmm0     # 0x564e0
movups %xmm0, 0x8(%rax)
movq $0x0, (%rax)
jmp 0x49d9a
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x9ec7(%rip), %rcx      # 0x53c76
movzbl (%rsi,%rax), %edx
shrl $0x4, %edx
movb (%rdx,%rcx), %dl
movb %dl, (%rdi,%rax,2)
movzbl (%rsi,%rax), %edx
andl $0xf, %edx
movb (%rdx,%rcx), %dl
movb %dl, 0x1(%rdi,%rax,2)
incq %rax
cmpq $0x10, %rax
jne 0x49daf
movb $0x0, 0x20(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
movl 0x30(%rsi), %edx
cmpq $0x400, %rdx            # imm = 0x400
setb %sil
movq 0x18(%rdi), %rax
testq %rax, %rax
setne %r9b
testb %r9b, %sil
je 0x49dfd
movq (%rax,%rdx,8), %rax
jmp 0x49e40
movq (%rdi), %rax
movslq 0x20(%rax), %rsi
testq %rsi, %rsi
jle 0x49e3e
movq 0x10(%rdi), %rdi
xorl %r9d, %r9d
movq (%rdi,%r9,8), %r10
testq %r10, %r10
je 0x49e2e
cmpl $0x4, 0x8(%r10)
jne 0x49e2e
cmpl %edx, 0xc(%r10)
jne 0x49e2e
xorl %r11d, %r11d
movq %r10, %rax
jmp 0x49e31
movb $0x1, %r11b
testb %r11b, %r11b
je 0x49e40
incq %r9
cmpq %r9, %rsi
jne 0x49e10
xorl %eax, %eax
testq %rax, %rax
je 0x49e9d
movq 0x20(%rax), %rsi
movslq 0x1c(%rax), %rdi
movslq 0x14(%rax), %r10
movq %r10, %r11
subq %rdi, %r11
cmpq $0x4, %r11
jg 0x49e8a
movb $0x1, %r9b
xorl %edx, %edx
cmpl %r10d, %edi
jge 0x49eaa
movzbl (%rsi,%rdi), %r10d
shrl $0x4, %r10d
leaq 0xa889(%rip), %rbx      # 0x54700
movslq (%rbx,%r10,4), %rbx
movl $0x0, %r10d
cmpq %rbx, %r11
jl 0x49f56
movzbl (%rsi,%rdi), %edx
testb %dl, %dl
js 0x49eb2
movl $0x1, %r10d
jmp 0x49f53
cmpl $0x0, (%r8)
setne %r9b
jmp 0x49f63
xorl %r10d, %r10d
jmp 0x49f56
movzbl 0x1(%rsi,%rdi), %r9d
cmpb $-0x41, %dl
ja 0x49ed1
andl $0x3f, %edx
shll $0x8, %edx
orl %r9d, %edx
movl $0x2, %r10d
jmp 0x49f53
cmpb $-0x21, %dl
ja 0x49ef2
shll $0x8, %r9d
movzbl 0x2(%rsi,%rdi), %esi
andl $0x1f, %edx
shll $0x10, %edx
orl %r9d, %edx
orl %esi, %edx
movl $0x3, %r10d
jmp 0x49f53
cmpb $-0x11, %dl
ja 0x49f20
shll $0x10, %r9d
movzbl 0x2(%rsi,%rdi), %r10d
shll $0x8, %r10d
movzbl 0x3(%rsi,%rdi), %esi
andl $0xf, %edx
shll $0x18, %edx
orl %r9d, %edx
orl %r10d, %edx
orl %esi, %edx
movl $0x4, %r10d
jmp 0x49f53
shll $0x1c, %edx
shll $0x14, %r9d
orl %edx, %r9d
movzbl 0x2(%rsi,%rdi), %edx
shll $0xc, %edx
orl %r9d, %edx
movzbl 0x3(%rsi,%rdi), %r9d
shll $0x4, %r9d
orl %edx, %r9d
movzbl 0x4(%rsi,%rdi), %edx
andl $0xf, %edx
orl %r9d, %edx
movl $0x5, %r10d
xorl %r9d, %r9d
movl %edx, (%rcx)
addl %r10d, 0x1c(%rax)
movl $0x1, (%r8)
movzbl %r9b, %eax
negl %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
movl 0x30(%rsi), %edx
cmpq $0x400, %rdx            # imm = 0x400
setb %sil
movq 0x18(%rdi), %rax
testq %rax, %rax
setne %r9b
testb %r9b, %sil
je 0x49f90
movq (%rax,%rdx,8), %rax
jmp 0x49fd3
movq (%rdi), %rax
movslq 0x20(%rax), %rsi
testq %rsi, %rsi
jle 0x49fd1
movq 0x10(%rdi), %rdi
xorl %r9d, %r9d
movq (%rdi,%r9,8), %r10
testq %r10, %r10
je 0x49fc1
cmpl $0x4, 0x8(%r10)
jne 0x49fc1
cmpl %edx, 0xc(%r10)
jne 0x49fc1
xorl %r11d, %r11d
movq %r10, %rax
jmp 0x49fc4
movb $0x1, %r11b
testb %r11b, %r11b
je 0x49fd3
incq %r9
cmpq %r9, %rsi
jne 0x49fa3
xorl %eax, %eax
movl (%r8), %edi
testq %rax, %rax
je 0x4a016
movq 0x20(%rax), %rsi
movslq 0x1c(%rax), %rdx
addl %edx, %edi
movl %edi, 0x1c(%rax)
cmpl 0x14(%rax), %edi
setg %al
testq %rsi, %rsi
sete %dil
orb %al, %dil
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jne 0x4a01c
xorl %ebx, %ebx
testq %rcx, %rcx
je 0x4a01c
addq %rdx, %rsi
movslq (%r8), %rdx
movq %rcx, %rdi
callq 0x4420
jmp 0x4a01c
xorl %ebx, %ebx
negl %edi
sbbl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movl $0x240, %edi            # imm = 0x240
callq 0x4700
testq %rax, %rax
je 0x4a139
movl $0x1, (%rax)
leal -0x1(%rbx), %ecx
cmpl $0x1, %ecx
ja 0x4a05f
leaq -0x285(%rip), %rcx      # 0x49dd8
jmp 0x4a077
leal -0x3(%rbx), %ecx
cmpl $0x1, %ecx
ja 0x4a070
leaq -0x103(%rip), %rcx      # 0x49f6b
jmp 0x4a077
leaq 0xc9(%rip), %rcx        # 0x4a140
movq %rcx, 0x18(%rax)
leaq -0x62(%rip), %rcx       # 0x4a020
movq %rcx, 0x10(%rax)
movzbl (%r14), %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x4a121
movzbl 0x1(%r14), %edx
cmpb $-0x41, %cl
ja 0x4a0b0
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x4a121
cmpb $-0x21, %cl
ja 0x4a0ce
shll $0x8, %edx
movzbl 0x2(%r14), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x4a121
cmpb $-0x11, %cl
ja 0x4a0f6
shll $0x10, %edx
movzbl 0x2(%r14), %esi
shll $0x8, %esi
movzbl 0x3(%r14), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl $0x4, %edx
jmp 0x4a121
shll $0x1c, %ecx
shll $0x14, %edx
orl %ecx, %edx
movzbl 0x2(%r14), %ecx
shll $0xc, %ecx
orl %edx, %ecx
movzbl 0x3(%r14), %edx
shll $0x4, %edx
orl %ecx, %edx
movzbl 0x4(%r14), %ecx
andl $0xf, %ecx
orl %edx, %ecx
movl $0x5, %edx
movl %ecx, 0x30(%rax)
movslq %ebp, %rcx
cmpq %rcx, %rdx
jne 0x4a131
movl %ebx, 0x34(%rax)
jmp 0x4a13b
movq %rax, %rdi
callq 0x614f
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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), %ecx
cmpq $0x400, %rcx            # imm = 0x400
setb %dl
movq 0x18(%rdi), %rax
testq %rax, %rax
setne %sil
testb %sil, %dl
je 0x4a171
movq (%rax,%rcx,8), %rax
jmp 0x4a1b3
movq (%rdi), %rax
movslq 0x20(%rax), %rdx
testq %rdx, %rdx
jle 0x4a1b1
movq 0x10(%rdi), %rsi
xorl %edi, %edi
movq (%rsi,%rdi,8), %r8
testq %r8, %r8
je 0x4a1a1
cmpl $0x4, 0x8(%r8)
jne 0x4a1a1
cmpl %ecx, 0xc(%r8)
jne 0x4a1a1
xorl %r9d, %r9d
movq %r8, %rax
jmp 0x4a1a4
movb $0x1, %r9b
testb %r9b, %r9b
je 0x4a1b3
incq %rdi
cmpq %rdi, %rdx
jne 0x4a183
xorl %eax, %eax
movl (%r14), %edx
testq %rax, %rax
je 0x4a28d
movq 0x20(%rax), %r15
movslq 0x1c(%rax), %rcx
addl %ecx, %edx
movl %edx, 0x1c(%rax)
cmpl 0x14(%rax), %edx
setg %al
testq %r15, %r15
sete %dl
orb %al, %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x4a293
addq %rcx, %r15
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
movslq (%r14), %rdx
leaq (%rdi,%rdx), %rcx
cmpq %rcx, %rax
ja 0x4a276
movl $0x400, %r12d           # imm = 0x400
movq %rax, %xmm0
punpckldq 0x8721(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x8729(%rip), %xmm0     # 0x52940
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x97dd(%rip), %xmm1     # 0x53a08
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
subsd 0x86cd(%rip), %xmm1     # 0x52908
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 0x48d0
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
movslq (%r14), %rdx
leaq (%rdi,%rdx), %rcx
cmpq %rcx, %rax
jbe 0x4a202
addq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x4420
movslq (%r14), %rax
addq %rax, 0x30(%rbx)
xorl %eax, %eax
jmp 0x4a293
xorl %eax, %eax
negl %edx
sbbl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x4700
testq %rax, %rax
je 0x4a604
movl $0x1, (%rax)
leaq -0x279(%rip), %rcx      # 0x4a375
movq %rcx, 0x10(%rax)
leal -0x1(%r14), %ecx
cmpl $0x2, %ecx
jae 0x4a608
leaq -0x363(%rip), %rcx      # 0x4a29f
jmp 0x4a619
xorl %eax, %eax
jmp 0x4a62b
addl $-0x3, %r14d
cmpl $0x2, %r14d
jae 0x4a633
leaq -0x36a(%rip), %rcx      # 0x4a2af
movq %rcx, 0x20(%rax)
leaq -0x2a5(%rip), %rcx      # 0x4a37f
movq %rcx, 0x28(%rax)
movl %ebx, 0x30(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x42e0
// File: /workspace/github_cpp_makefile_star2_O1/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 %rcx, %rbx
movq %rsi, %r15
movl 0x34(%rsi), %eax
testq %rax, %rax
je 0x4a6ad
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x4a6d0
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
jbe 0x4a6d0
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x4a683
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
cmpq %rax, %rcx
jb 0x4a6d0
movslq (%r8), %r13
testq %r13, %r13
jle 0x4a6cd
xorl %r14d, %r14d
xorl %ebp, %ebp
movl 0x34(%r15), %esi
movq %r12, %rdi
callq 0x4a6e2
subl 0x30(%r15), %eax
movl %eax, (%rbx,%rbp,4)
incq %rbp
cmpq %rbp, %r13
jne 0x4a690
jmp 0x4a6d0
movslq (%r8), %rax
testq %rax, %rax
jle 0x4a6cd
xorl %r14d, %r14d
xorl %ecx, %ecx
xorl %edx, %edx
subl 0x30(%r15), %edx
movl %edx, (%rbx,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x4a6ba
jmp 0x4a6d0
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %rcx, %r15
movq %rsi, %r14
movl 0x34(%rsi), %eax
testq %rax, %rax
je 0x4a9cf
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x4a9f7
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
jbe 0x4a9f7
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x4a9a0
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
cmpq %rax, %rcx
jb 0x4a9f7
movl (%r8), %r13d
xorl %ebx, %ebx
testq %r15, %r15
je 0x4aa08
testl %r13d, %r13d
jle 0x4a9f7
xorl %ebp, %ebp
movl 0x34(%r14), %esi
movq %r12, %rdi
callq 0x4a6e2
subl 0x30(%r14), %eax
movb %al, (%r15,%rbp)
incq %rbp
cmpq %rbp, %r13
jne 0x4a9b1
jmp 0x4a9f7
xorl %ebx, %ebx
testq %r15, %r15
je 0x4a9f7
movslq (%r8), %rax
testq %rax, %rax
jle 0x4a9f7
xorl %ebx, %ebx
xorl %ecx, %ecx
movb 0x30(%r14), %dl
xorl %esi, %esi
subb %dl, %sil
movb %sil, (%r15,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x4a9e2
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r13d, %r13d
jle 0x4a9f7
movl 0x34(%r14), %esi
movq %r12, %rdi
callq 0x4a6e2
decl %r13d
jne 0x4aa0d
jmp 0x4a9f7
// File: /workspace/github_cpp_makefile_star2_O1/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 0x4acb6
movq %rdx, %r12
movq %rdx, %rdi
callq 0x4230
movq %rax, %r15
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
leaq (%rdi,%r15), %rcx
cmpq %rcx, %rax
ja 0x4aca1
movl $0x400, %r13d           # imm = 0x400
movq %rax, %xmm0
punpckldq 0x7cf3(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x7cfb(%rip), %xmm0     # 0x52940
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x8daf(%rip), %xmm1     # 0x53a08
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
subsd 0x7c9f(%rip), %xmm1     # 0x52908
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 0x48d0
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
leaq (%rdi,%r15), %rcx
cmpq %rcx, %rax
jbe 0x4ac30
addq 0x20(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4420
addq %r15, 0x30(%rbx)
jmp 0x4acb9
xorl %r15d, %r15d
movl (%r14), %esi
movq %rbx, %rdi
callq 0x32062
movl %eax, %ebp
movl 0x30(%r14), %ecx
movl $0x1, %esi
movl $0x1, %eax
cmpl $0x80, %ecx
jb 0x4ad04
movl $0x2, %eax
cmpl $0x4000, %ecx           # imm = 0x4000
jb 0x4ad04
movl $0x3, %eax
cmpl $0x200000, %ecx         # imm = 0x200000
jb 0x4ad04
cmpl $0x10000000, %ecx       # imm = 0x10000000
movl $0x5, %eax
sbbl $0x0, %eax
movl 0x34(%r14), %ecx
cmpl $0x80, %ecx
jb 0x4ad38
movl $0x2, %esi
cmpl $0x4000, %ecx           # imm = 0x4000
jb 0x4ad38
movl $0x3, %esi
cmpl $0x200000, %ecx         # imm = 0x200000
jb 0x4ad38
cmpl $0x10000000, %ecx       # imm = 0x10000000
movl $0x5, %esi
sbbl $0x0, %esi
addl %eax, %esi
addl %r15d, %ebp
movq %rbx, %rdi
callq 0x32062
movl %eax, %r15d
movl 0x30(%r14), %esi
movq %rbx, %rdi
callq 0x32062
movl %eax, %r12d
addl %r15d, %r12d
addl %ebp, %r12d
movl 0x34(%r14), %esi
movq %rbx, %rdi
callq 0x32062
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_O1/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
testl %ecx, %ecx
jle 0x4adb6
movq %rdx, %rbx
movq %rsi, %r14
movl %ecx, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x8(%r14), %rdi
movl 0x30(%r14), %esi
addl (%rbx,%r12,4), %esi
movl 0x34(%r14), %edx
callq 0x4adc3
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x4ad95
jmp 0x4adb8
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
testl %ecx, %ecx
jle 0x4af51
movq %rdx, %rbx
movq %rsi, %r14
movl %ecx, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x8(%r14), %rdi
movzbl (%rbx,%r12), %esi
addl 0x30(%r14), %esi
movl 0x34(%r14), %edx
callq 0x4adc3
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x4af2f
jmp 0x4af53
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x4700
testq %rax, %rax
je 0x4afeb
movl $0x6, (%rax)
leaq -0x32(%rip), %rcx       # 0x4af5e
movq %rcx, 0x10(%rax)
cmpl $0x1, %ebp
leaq -0x223(%rip), %rcx      # 0x4ad7b
leaq -0x90(%rip), %rdx       # 0x4af15
cmoveq %rcx, %rdx
movq %rdx, 0x20(%rax)
leaq -0x3c3(%rip), %rcx      # 0x4abf1
movq %rcx, 0x28(%rax)
testq %r14, %r14
je 0x4aff2
movl (%r14), %esi
movl 0x4(%r14), %edx
cmpl %esi, %edx
jl 0x4b075
movl %esi, %ecx
negl %ecx
movl %ecx, 0x30(%rax)
xorl %ecx, %ecx
subl %esi, %edx
je 0x4afe6
movl %edx, %esi
incl %ecx
sarl %esi
cmpl $0x1, %edx
movl %esi, %edx
ja 0x4afdb
movl %ecx, 0x34(%rax)
jmp 0x4afed
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl $0x80000000, %edx       # imm = 0x80000000
xorl %ecx, %ecx
movl %esi, %edi
cmpl %ecx, %esi
movl %ecx, %esi
cmovll %edi, %esi
cmpl $0x0, (%rbx,%rcx,4)
cmovel %edi, %esi
cmovnel %ecx, %edx
incq %rcx
cmpq $0x400, %rcx            # imm = 0x400
jne 0x4affe
movq 0x1000(%rbx), %rdi
testq %rdi, %rdi
je 0x4afc4
movl (%rdi), %r8d
testq %r8, %r8
je 0x4afc4
movq 0x10(%rdi), %r9
xorl %r10d, %r10d
xorl %r11d, %r11d
movl %r11d, %ecx
shrl $0x4, %ecx
movl (%r9,%rcx,4), %ebx
movl %r10d, %ecx
andb $0x1e, %cl
shrl %cl, %ebx
testb $0x3, %bl
jne 0x4b064
movq 0x18(%rdi), %rcx
movl (%rcx,%r11,4), %ecx
cmpl %ecx, %esi
cmovgel %ecx, %esi
cmpl %ecx, %edx
cmovlel %ecx, %edx
incq %r11
addl $0x2, %r10d
cmpq %r11, %r8
jne 0x4b03b
jmp 0x4afc4
leaq 0xb514(%rip), %rdi      # 0x56590
leaq 0xb520(%rip), %rsi      # 0x565a3
leaq 0xb52c(%rip), %rcx      # 0x565b6
movl $0x288, %edx            # imm = 0x288
callq 0x4350
// File: /workspace/github_cpp_makefile_star2_O1/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:
movslq (%r8), %r8
testq %r8, %r8
jle 0x4b579
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rdi
xorl %r9d, %r9d
movq 0x30(%rdx), %r11
movslq 0x14(%rdx), %rax
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
cmpq %rax, %r11
jae 0x4b4b6
movq 0x20(%rdx), %rbx
movl 0x38(%rdx), %ecx
movzbl (%rbx,%r11), %ebp
shrl %cl, %ebp
subl $0x1, %ecx
movl %ecx, 0x38(%rdx)
jae 0x4b4a5
movl $0x7, 0x38(%rdx)
incq %r11
movq %r11, 0x30(%rdx)
movl $0x7, %ecx
cmpq %rax, %r11
jne 0x4b4a5
movl %ebp, %r14d
andl $0x1, %r14d
je 0x4b4b0
incl %r10d
testb $0x1, %bpl
je 0x4b475
jmp 0x4b4b6
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
testl %r10d, %r10d
js 0x4b4ce
subq 0x30(%rdx), %rax
setbe %cl
testl %r10d, %r10d
setne %r11b
testb %cl, %r11b
je 0x4b4d2
xorl %ecx, %ecx
jmp 0x4b4f0
cmpq $0x10000000, %rax       # imm = 0x10000000
ja 0x4b4ee
movslq 0x38(%rdx), %rcx
leaq (%rcx,%rax,8), %rax
addq $-0x7, %rax
movl %r10d, %ecx
cmpq %rcx, %rax
jb 0x4b4ce
movb $0x1, %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %cl, %cl
je 0x4b570
testl %r10d, %r10d
jle 0x4b550
movq 0x20(%rdx), %rbx
movq 0x30(%rdx), %r14
movl 0x38(%rdx), %r15d
incl %r10d
movl $0x1, %r11d
movzbl (%rbx,%r14), %ebp
xorl %r12d, %r12d
btl %r15d, %ebp
setb %r12b
leal (%r12,%r11,2), %r11d
xorl %r12d, %r12d
testl %r15d, %r15d
leal -0x1(%r15), %ebp
setle %r12b
addq %r12, %r14
movq %r14, 0x30(%rdx)
andl $0x7, %ebp
movl %ebp, 0x38(%rdx)
decl %r10d
movl %ebp, %r15d
cmpl $0x1, %r10d
jg 0x4b513
jmp 0x4b556
movl $0x1, %r11d
subl 0x30(%rsi), %r11d
movl %r11d, (%rdi,%r9,4)
testb %cl, %cl
je 0x4b570
incq %r9
cmpq %r8, %r9
jne 0x4b45b
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_gamma_decode_init
cram_codec *cram_gamma_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_GAMMA;
    c->decode = cram_gamma_decode;
    c->free   = cram_gamma_decode_free;
    
    cp += itf8_get(cp, &c->gamma.offset);

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

    return c;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl $0x240, %edi            # imm = 0x240
callq 0x4700
testq %rax, %rax
je 0x4b66c
movl $0x9, (%rax)
leaq -0x16e(%rip), %rcx      # 0x4b441
movq %rcx, 0x18(%rax)
leaq -0x3e(%rip), %rcx       # 0x4b57c
movq %rcx, 0x10(%rax)
movzbl (%r14), %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x4b659
movzbl 0x1(%r14), %edx
cmpb $-0x41, %cl
ja 0x4b5e8
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x4b659
cmpb $-0x21, %cl
ja 0x4b606
shll $0x8, %edx
movzbl 0x2(%r14), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x4b659
cmpb $-0x11, %cl
ja 0x4b62e
shll $0x10, %edx
movzbl 0x2(%r14), %esi
shll $0x8, %esi
movzbl 0x3(%r14), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl $0x4, %edx
jmp 0x4b659
shll $0x1c, %ecx
shll $0x14, %edx
orl %ecx, %edx
movzbl 0x2(%r14), %ecx
shll $0xc, %ecx
orl %edx, %ecx
movzbl 0x3(%r14), %edx
shll $0x4, %edx
orl %ecx, %edx
movzbl 0x4(%r14), %ecx
andl $0xf, %ecx
orl %edx, %ecx
movl $0x5, %edx
movl %ecx, 0x30(%rax)
movslq %ebx, %rcx
cmpq %rcx, %rdx
je 0x4b66e
movq %rax, %rdi
callq 0x61ca
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_free
void cram_huffman_decode_free(cram_codec *c) {
    if (!c)
	return;

    if (c->huffman.codes)
	free(c->huffman.codes);
    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x4b696
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x4b68d
callq 0x4610
movq %rbx, %rdi
popq %rbx
jmp 0x4610
retq
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_char0
int cram_huffman_decode_char0(cram_slice *slice, cram_codec *c,
			      cram_block *in, char *out, int *out_size) {
    int i, n;

    if (!out)
	return 0;

    /* Special case of 0 length codes */
    for (i = 0, n = *out_size; i < n; i++) {
	out[i] = c->huffman.codes[0].symbol;
    }
    return 0;
}

// Assembly:
testq %rcx, %rcx
je 0x4b6bf
movslq (%r8), %rax
testq %rax, %rax
jle 0x4b6bf
xorl %edx, %edx
movq 0x38(%rsi), %rdi
movb (%rdi), %dil
movb %dil, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x4b6ac
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_char
int cram_huffman_decode_char(cram_slice *slice, cram_codec *c,
			     cram_block *in, char *out, int *out_size) {
    int i, n, ncodes = c->huffman.ncodes;
    const cram_huffman_code * const codes = c->huffman.codes;

    for (i = 0, n = *out_size; i < n; i++) {
	int idx = 0;
	int val = 0, len = 0, last_len = 0;

	for (;;) {
	    int dlen = codes[idx].len - last_len;
	    if (cram_not_enough_bits(in, dlen))
		return -1;

	    //val <<= dlen;
	    //val  |= get_bits_MSB(in, dlen);
	    //last_len = (len += dlen);

	    last_len = (len += dlen);
	    for (; dlen; dlen--) GET_BIT_MSB(in, val);

	    idx = val - codes[idx].p;
	    if (idx >= ncodes || idx < 0)
		return -1;

	    if (codes[idx].code == val && codes[idx].len == len) {
		out[i] = codes[idx].symbol;
		break;
	    }
	}
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, -0x10(%rsp)
movslq (%r8), %rax
movq %rax, -0x8(%rsp)
testq %rax, %rax
jle 0x4b80e
movl 0x30(%rsi), %edi
movq 0x38(%rsi), %rsi
xorl %r8d, %r8d
xorl %ebp, %ebp
xorl %r9d, %r9d
xorl %eax, %eax
xorl %ebx, %ebx
movslq %ebp, %r15
shlq $0x4, %r15
movl 0xc(%rsi,%r15), %r14d
movl %r14d, %r11d
subl %ebx, %r11d
movl $0x1, %r10d
js 0x4b7a7
movslq 0x14(%rdx), %r12
subq 0x30(%rdx), %r12
setbe %r13b
testl %r11d, %r11d
setne %cl
testb %r13b, %cl
jne 0x4b7a7
cmpq $0x10000000, %r12       # imm = 0x10000000
ja 0x4b747
movslq 0x38(%rdx), %rcx
leaq (%rcx,%r12,8), %rcx
addq $-0x7, %rcx
movl %r11d, %r12d
cmpq %r12, %rcx
jb 0x4b7a7
testl %r11d, %r11d
je 0x4b788
movq 0x20(%rdx), %r12
movq 0x30(%rdx), %r13
movl 0x38(%rdx), %ebp
subl %r14d, %ebx
movzbl (%r12,%r13), %ecx
xorl %r14d, %r14d
btl %ebp, %ecx
setb %r14b
leal (%r14,%r9,2), %r9d
xorl %ecx, %ecx
testl %ebp, %ebp
leal -0x1(%rbp), %ebp
setle %cl
addq %rcx, %r13
movq %r13, 0x30(%rdx)
andl $0x7, %ebp
movl %ebp, 0x38(%rdx)
incl %ebx
jne 0x4b75a
addq %rsi, %r15
addl %eax, %r11d
movl %r9d, %ebp
subl 0x4(%r15), %ebp
sets %al
cmpl %edi, %ebp
setge %cl
orb %al, %cl
je 0x4b7b5
movl %r11d, %eax
movl %r11d, %ebx
xorl %r15d, %r15d
testl %r10d, %r10d
je 0x4b6f5
jmp 0x4b7f5
movl %ebp, %eax
shlq $0x4, %rax
movb $0x1, %r15b
cmpl %r9d, 0x8(%rsi,%rax)
jne 0x4b7ea
addq %rsi, %rax
cmpl %r11d, 0xc(%rax)
jne 0x4b7ea
movb (%rax), %al
movq -0x10(%rsp), %rcx
movb %al, (%rcx,%r8)
movl $0x5, %r10d
xorl %r15d, %r15d
movl %r11d, %eax
movl %r11d, %ebx
jmp 0x4b7aa
movl %r11d, %eax
movl %r11d, %ebx
xorl %r10d, %r10d
jmp 0x4b7aa
cmpl $0x5, %r10d
je 0x4b800
testb %r15b, %r15b
je 0x4b812
incq %r8
cmpq -0x8(%rsp), %r8
jne 0x4b6ec
xorl %eax, %eax
jmp 0x4b817
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_int0
int cram_huffman_decode_int0(cram_slice *slice, cram_codec *c,
			     cram_block *in, char *out, int *out_size) {
    int32_t *out_i = (int32_t *)out;
    int i, n;
    const cram_huffman_code * const codes = c->huffman.codes;

    /* Special case of 0 length codes */
    for (i = 0, n = *out_size; i < n; i++) {
	out_i[i] = codes[0].symbol;
    }
    return 0;
}

// Assembly:
movslq (%r8), %rax
testq %rax, %rax
jle 0x4b83d
movq 0x38(%rsi), %rdx
xorl %esi, %esi
movl (%rdx), %edi
movl %edi, (%rcx,%rsi,4)
incq %rsi
cmpq %rsi, %rax
jne 0x4b830
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_int
int cram_huffman_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, ncodes = c->huffman.ncodes;
    const cram_huffman_code * const codes = c->huffman.codes;

    for (i = 0, n = *out_size; i < n; i++) {
	int idx = 0;
	int val = 0, len = 0, last_len = 0;

	// Now one bit at a time for remaining checks
	for (;;) {
	    int dlen = codes[idx].len - last_len;
	    if (cram_not_enough_bits(in, dlen))
		return -1;
	    
	    //val <<= dlen;
	    //val  |= get_bits_MSB(in, dlen);
	    //last_len = (len += dlen);

	    last_len = (len += dlen);
	    for (; dlen; dlen--) GET_BIT_MSB(in, val);

	    idx = val - codes[idx].p;
	    if (idx >= ncodes || idx < 0)
		return -1;

	    if (codes[idx].code == val && codes[idx].len == len) {
		out_i[i] = codes[idx].symbol;
		break;
	    }
	}
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, -0x10(%rsp)
movslq (%r8), %rax
movq %rax, -0x8(%rsp)
testq %rax, %rax
jle 0x4b98c
movl 0x30(%rsi), %edi
movq 0x38(%rsi), %rsi
xorl %r8d, %r8d
xorl %ebp, %ebp
xorl %r9d, %r9d
xorl %eax, %eax
xorl %ebx, %ebx
movslq %ebp, %r15
shlq $0x4, %r15
movl 0xc(%rsi,%r15), %r14d
movl %r14d, %r11d
subl %ebx, %r11d
movl $0x1, %r10d
js 0x4b925
movslq 0x14(%rdx), %r12
subq 0x30(%rdx), %r12
setbe %r13b
testl %r11d, %r11d
setne %cl
testb %r13b, %cl
jne 0x4b925
cmpq $0x10000000, %r12       # imm = 0x10000000
ja 0x4b8c5
movslq 0x38(%rdx), %rcx
leaq (%rcx,%r12,8), %rcx
addq $-0x7, %rcx
movl %r11d, %r12d
cmpq %r12, %rcx
jb 0x4b925
testl %r11d, %r11d
je 0x4b906
movq 0x20(%rdx), %r12
movq 0x30(%rdx), %r13
movl 0x38(%rdx), %ebp
subl %r14d, %ebx
movzbl (%r12,%r13), %ecx
xorl %r14d, %r14d
btl %ebp, %ecx
setb %r14b
leal (%r14,%r9,2), %r9d
xorl %ecx, %ecx
testl %ebp, %ebp
leal -0x1(%rbp), %ebp
setle %cl
addq %rcx, %r13
movq %r13, 0x30(%rdx)
andl $0x7, %ebp
movl %ebp, 0x38(%rdx)
incl %ebx
jne 0x4b8d8
addq %rsi, %r15
addl %eax, %r11d
movl %r9d, %ebp
subl 0x4(%r15), %ebp
sets %al
cmpl %edi, %ebp
setge %cl
orb %al, %cl
je 0x4b933
movl %r11d, %eax
movl %r11d, %ebx
xorl %r15d, %r15d
testl %r10d, %r10d
je 0x4b873
jmp 0x4b973
movl %ebp, %eax
shlq $0x4, %rax
movb $0x1, %r15b
cmpl %r9d, 0x8(%rsi,%rax)
jne 0x4b968
addq %rsi, %rax
cmpl %r11d, 0xc(%rax)
jne 0x4b968
movl (%rax), %eax
movq -0x10(%rsp), %rcx
movl %eax, (%rcx,%r8,4)
movl $0x5, %r10d
xorl %r15d, %r15d
movl %r11d, %eax
movl %r11d, %ebx
jmp 0x4b928
movl %r11d, %eax
movl %r11d, %ebx
xorl %r10d, %r10d
jmp 0x4b928
cmpl $0x5, %r10d
je 0x4b97e
testb %r15b, %r15b
je 0x4b990
incq %r8
cmpq -0x8(%rsp), %r8
jne 0x4b86a
xorl %eax, %eax
jmp 0x4b995
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq