LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_new_slice
cram_slice *cram_new_slice(enum cram_content_type type, int nrecs) {
    cram_slice *s = calloc(1, sizeof(*s));
    if (!s)
	return NULL;

    if (!(s->hdr = (cram_block_slice_hdr *)calloc(1, sizeof(*s->hdr))))
	goto err;
    s->hdr->content_type = type;

    s->hdr_block = NULL;
    s->block = NULL;
    s->block_by_id = NULL;
    s->last_apos = 0;
    if (!(s->crecs = malloc(nrecs * sizeof(cram_record))))  goto err;
    s->cigar = NULL;
    s->cigar_alloc = 0;
    s->ncigar = 0;

    if (!(s->seqs_blk = cram_new_block(EXTERNAL, 0)))       goto err;
    if (!(s->qual_blk = cram_new_block(EXTERNAL, DS_QS)))   goto err;
    if (!(s->name_blk = cram_new_block(EXTERNAL, DS_RN)))   goto err;
    if (!(s->aux_blk  = cram_new_block(EXTERNAL, DS_aux)))  goto err;
    if (!(s->base_blk = cram_new_block(EXTERNAL, DS_IN)))   goto err;
    if (!(s->soft_blk = cram_new_block(EXTERNAL, DS_SC)))   goto err;

    s->features = NULL;
    s->nfeatures = s->afeatures = 0;

#ifndef TN_external
    s->TN = NULL;
    s->nTN = s->aTN = 0;
#endif

    // Volatile keys as we do realloc in dstring
    if (!(s->pair_keys = string_pool_create(8192))) goto err;
    if (!(s->pair[0] = kh_init(m_s2i)))             goto err;
    if (!(s->pair[1] = kh_init(m_s2i)))             goto err;
    
#ifdef BA_external
    s->BA_len = 0;
#endif

    return s;

 err:
    if (s)
	cram_free_slice(s);

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movl %edi, %r14d
pushq $0x1
popq %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x4370
testq %rax, %rax
je 0x2c3f8
movq %rax, %rbx
pushq $0x1
popq %rdi
pushq $0x48
popq %rsi
callq 0x4370
movq %rax, (%rbx)
testq %rax, %rax
je 0x2c3f0
movl %r14d, (%rax)
movslq %ebp, %rax
imulq $0x70, %rax, %rdi
callq 0x46f0
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x2c3f0
pushq $0x4
popq %rdi
xorl %esi, %esi
callq 0x27b0e
movq %rax, 0x68(%rbx)
testq %rax, %rax
je 0x2c3f0
pushq $0x4
popq %rdi
pushq $0xc
popq %rsi
callq 0x27b0e
movq %rax, 0x70(%rbx)
testq %rax, %rax
je 0x2c3f0
pushq $0x4
popq %rdi
pushq $0xb
popq %rsi
callq 0x27b0e
movq %rax, 0x60(%rbx)
testq %rax, %rax
je 0x2c3f0
pushq $0x4
popq %rdi
pushq $0x1
popq %rsi
callq 0x27b0e
movq %rax, 0x88(%rbx)
testq %rax, %rax
je 0x2c3f0
pushq $0x4
popq %rdi
pushq $0xd
popq %rsi
callq 0x27b0e
movq %rax, 0x78(%rbx)
testq %rax, %rax
je 0x2c3f0
pushq $0x4
popq %rdi
pushq $0xe
popq %rsi
callq 0x27b0e
movq %rax, 0x80(%rbx)
testq %rax, %rax
je 0x2c3f0
movl $0x2000, %edi           # imm = 0x2000
callq 0x34760
movq %rax, 0xd0(%rbx)
testq %rax, %rax
je 0x2c3f0
callq 0x2c289
movq %rax, 0xd8(%rbx)
testq %rax, %rax
je 0x2c3f0
callq 0x2c289
movq %rax, 0xe0(%rbx)
testq %rax, %rax
jne 0x2c3fa
movq %rbx, %rdi
callq 0x2ab94
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_read_file_def
cram_file_def *cram_read_file_def(cram_fd *fd) {
    cram_file_def *def = malloc(sizeof(*def));
    if (!def)
	return NULL;

    if (26 != hread(fd->fp, &def->magic[0], 26)) {
	free(def);
	return NULL;
    }

    if (memcmp(def->magic, "CRAM", 4) != 0) {
	free(def);
	return NULL;
    }

    if (def->major_version > 3) {
	fprintf(stderr, "CRAM version number mismatch\n"
		"Expected 1.x, 2.x or 3.x, got %d.%d\n",
		def->major_version, def->minor_version);
	free(def);
	return NULL;
    }

    fd->first_container += 26;
    fd->last_slice = 0;

    return def;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $0x1a
popq %rdi
callq 0x46f0
testq %rax, %rax
je 0x2c699
movq %rax, %rbx
movq (%r14), %rdi
pushq $0x1a
popq %rdx
movq %rax, %rsi
callq 0x277fd
cmpq $0x1a, %rax
jne 0x2c691
cmpl $0x4d415243, (%rbx)     # imm = 0x4D415243
je 0x2c6a6
movq %rbx, %rdi
callq 0x4600
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movzbl 0x4(%rbx), %edx
cmpl $0x4, %edx
jae 0x2c6c1
addq $0x1a, 0x8840(%r14)
andl $0x0, 0x884c(%r14)
jmp 0x2c69b
movq 0x2a908(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
movzbl 0x5(%rbx), %ecx
leaq 0x195a9(%rip), %rsi     # 0x45c7f
xorl %eax, %eax
callq 0x4770
jmp 0x2c691
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_open
cram_fd *cram_open(const char *filename, const char *mode) {
    hFILE *fp;
    cram_fd *fd;
    char fmode[3]= { mode[0], '\0', '\0' };

    if (strlen(mode) > 1 && (mode[1] == 'b' || mode[1] == 'c')) {
	fmode[1] = 'b';
    }

    fp = hopen(filename, fmode);
    if (!fp)
	return NULL;

    fd = cram_dopen(fp, filename, mode);
    if (!fd)
	hclose_abruptly(fp);

    return fd;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movb (%rsi), %al
movb %al, 0xd(%rsp)
andw $0x0, 0xe(%rsp)
movq %rsi, %rdi
callq 0x4210
cmpq $0x2, %rax
jb 0x2d462
movb 0x1(%rbx), %al
andb $-0x2, %al
cmpb $0x62, %al
jne 0x2d462
movb $0x62, 0xe(%rsp)
leaq 0xd(%rsp), %rsi
movq %r14, %rdi
callq 0x3a708
testq %rax, %rax
je 0x2d492
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2d49e
testq %rax, %rax
jne 0x2d494
movq %r15, %rdi
callq 0x3a3fa
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_seek
int cram_seek(cram_fd *fd, off_t offset, int whence) {
    char buf[65536];

    fd->ooc = 0;

    if (hseek(fd->fp, offset, whence) >= 0)
	return 0;

    if (!(whence == SEEK_CUR && offset >= 0))
	return -1;

    /* Couldn't fseek, but we're in SEEK_CUR mode so read instead */
    while (offset > 0) {
	int len = MIN(65536, offset);
	if (len != hread(fd->fp, buf, len))
	    return -1;
	offset -= len;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10008, %rsp          # imm = 0x10008
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
andl $0x0, 0x88f8(%rdi)
movq (%rdi), %rdi
callq 0x3a30a
xorl %ebp, %ebp
testq %rax, %rax
jns 0x2da5f
cmpl $0x1, %r15d
setne %al
testq %rbx, %rbx
sets %cl
pushq $-0x1
popq %rdx
orb %al, %cl
jne 0x2da5d
movl $0x10000, %r13d         # imm = 0x10000
movq %rsp, %r15
testq %rbx, %rbx
jle 0x2da5f
cmpq %r13, %rbx
movl $0x10000, %r12d         # imm = 0x10000
cmovbq %rbx, %r12
movq (%r14), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x277fd
subq %r12, %rbx
cmpq %rax, %r12
je 0x2da30
pushq $-0x1
popq %rbp
jmp 0x2da5f
movl %edx, %ebp
movl %ebp, %eax
addq $0x10008, %rsp          # imm = 0x10008
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_io.c
// Function: cram_flush
int cram_flush(cram_fd *fd) {
    if (!fd)
	return -1;

    if (fd->mode == 'w' && fd->ctr) {
	if(fd->ctr->slice)
	    cram_update_curr_slice(fd->ctr);

	if (-1 == cram_flush_container_mt(fd, fd->ctr))
	    return -1;
    }

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
pushq $-0x1
popq %rbx
testq %rdi, %rdi
je 0x2dab6
movq %rdi, %r14
cmpl $0x77, 0x8(%rdi)
jne 0x2dab4
movq 0x38(%r14), %rsi
testq %rsi, %rsi
je 0x2dab4
cmpq $0x0, 0x80(%rsi)
je 0x2daa7
movq %rsi, %rdi
callq 0x24391
movq 0x38(%r14), %rsi
movq %r14, %rdi
callq 0x2c153
cmpl $-0x1, %eax
je 0x2dab6
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_set_option
int cram_set_option(cram_fd *fd, enum hts_fmt_option opt, ...) {
    int r;
    va_list args;

    va_start(args, opt);
    r = cram_set_voption(fd, opt, args);
    va_end(args);

    return r;
}

// Assembly:
subq $0xd8, %rsp
leaq 0x20(%rsp), %r10
movq %rdx, 0x10(%r10)
movq %rcx, 0x18(%r10)
movq %r8, 0x20(%r10)
movq %r9, 0x28(%r10)
testb %al, %al
je 0x2dd29
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rdx
movq %r10, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
callq 0x2dd56
addq $0xd8, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_check_EOF
int cram_check_EOF(cram_fd *fd)
{
    // Byte 9 in these templates is & with 0x0f to resolve differences
    // between ITF-8 interpretations between early Java and C
    // implementations of CRAM
    static const unsigned char TEMPLATE_2_1[30] = {
        0x0b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0,
        0x45, 0x4f, 0x46, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
        0x01, 0x00, 0x06, 0x06, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00
    };
    static const unsigned char TEMPLATE_3[38] = {
        0x0f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0,
        0x45, 0x4f, 0x46, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05,
        0xbd, 0xd9, 0x4f, 0x00, 0x01, 0x00, 0x06, 0x06, 0x01, 0x00,
        0x01, 0x00, 0x01, 0x00, 0xee, 0x63, 0x01, 0x4b
    };

    unsigned char buf[38]; // max(sizeof TEMPLATE_*)

    uint8_t major = CRAM_MAJOR_VERS(fd->version);
    uint8_t minor = CRAM_MINOR_VERS(fd->version);

    const unsigned char *template;
    ssize_t template_len;
    if ((major < 2) ||
        (major == 2 && minor == 0)) {
        return 3; // No EOF support in cram versions less than 2.1
    } else if (major == 2 && minor == 1) {
        template = TEMPLATE_2_1;
        template_len = sizeof TEMPLATE_2_1;
    } else {
        template = TEMPLATE_3;
        template_len = sizeof TEMPLATE_3;
    }

    off_t offset = htell(fd->fp);
    if (hseek(fd->fp, -template_len, SEEK_END) < 0) {
        if (errno == ESPIPE) {
            hclearerr(fd->fp);
            return 2;
        }
        else {
            return -1;
        }
    }
    if (hread(fd->fp, buf, template_len) != template_len) return -1;
    if (hseek(fd->fp, offset, SEEK_SET) < 0) return -1;
    buf[8] &= 0x0f;
    return (memcmp(template, buf, template_len) == 0)? 1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl 0xc(%rdi), %ecx
movzbl %ch, %eax
pushq $0x3
popq %rbp
cmpl $0x2, %eax
jb 0x2e4de
xorl $0x2, %eax
movzbl %cl, %ecx
movl %ecx, %edx
orl %eax, %edx
je 0x2e4de
movq %rdi, %rbx
xorl $0x1, %ecx
xorl %r12d, %r12d
xorl %edx, %edx
orl %eax, %ecx
setne %r13b
leaq 0x173da(%rip), %rax     # 0x45820
leaq 0x173f3(%rip), %r14     # 0x45840
cmoveq %rax, %r14
sete %dl
leaq -0x26(,%rdx,8), %rsi
movq (%rdi), %rdi
movq 0x28(%rdi), %r15
addq 0x8(%rdi), %r15
subq (%rdi), %r15
pushq $0x2
popq %rbp
movl %ebp, %edx
callq 0x3a30a
testq %rax, %rax
js 0x2e4c8
movb %r13b, %r12b
leaq 0x1e(,%r12,8), %r12
movq (%rbx), %rdi
movq %rsp, %rsi
movq %r12, %rdx
callq 0x277fd
pushq $-0x1
popq %rbp
cmpq %r12, %rax
jne 0x2e4de
movq (%rbx), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3a30a
testq %rax, %rax
js 0x2e4de
movq %rsp, %rsi
andb $0xf, 0x8(%rsi)
movq %r14, %rdi
movq %r12, %rdx
callq 0x4550
xorl %ebp, %ebp
testl %eax, %eax
sete %bpl
jmp 0x2e4de
callq 0x4060
cmpl $0x1d, (%rax)
jne 0x2e4db
movq (%rbx), %rax
andl $0x0, 0x34(%rax)
jmp 0x2e4de
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_samtools.c
// Function: cram_header_to_bam
bam_hdr_t *cram_header_to_bam(SAM_hdr *h) {
    int i;
    bam_hdr_t *header = bam_hdr_init();

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

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

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

    return header;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x10b38
movq %rax, %r14
movq (%rbx), %r12
movl %r12d, 0x8(%rax)
leal 0x1(%r12), %edi
callq 0x46f0
movq %rax, %r15
movq %rax, 0x28(%r14)
movq 0x10(%rbx), %rsi
movl %r12d, %r12d
movq %rax, %rdi
movq %r12, %rdx
callq 0x4420
movb $0x0, (%r15,%r12)
movl 0x38(%rbx), %ebp
movl %ebp, (%r14)
movslq %ebp, %r15
pushq $0x8
popq %rsi
movq %r15, %rdi
callq 0x4370
movq %rax, 0x20(%r14)
pushq $0x4
popq %rsi
movq %r15, %rdi
callq 0x4370
movq %rax, 0x10(%r14)
xorl %r15d, %r15d
xorl %r12d, %r12d
movslq %ebp, %rax
cmpq %rax, %r12
jge 0x2ec99
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x49a0
movq 0x20(%r14), %rcx
movq %rax, (%rcx,%r15,2)
movq 0x40(%rbx), %rax
movl 0x8(%rax,%r15,8), %eax
movq 0x10(%r14), %rcx
movl %eax, (%rcx,%r15)
incq %r12
movl 0x38(%rbx), %ebp
addq $0x4, %r15
jmp 0x2ec5f
movq %r14, %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/cram/cram_stats.c
// Function: cram_stats_add
void cram_stats_add(cram_stats *st, int32_t val) {
    st->nsamp++;

    //assert(val >= 0);

    if (val < MAX_STAT_VAL && val >= 0) {
	st->freqs[val]++;
    } else {
	khint_t k;
	int r;

	if (!st->h) {
	    st->h = kh_init(m_i2i);
	}

	k = kh_put(m_i2i, st->h, val, &r);
	if (r == 0)
	    kh_val(st->h, k)++;
	else if (r != -1)
	    kh_val(st->h, k) = 1;
	else
	    ; // FIXME: handle error
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
incl 0x1008(%rdi)
cmpl $0x3ff, %esi            # imm = 0x3FF
ja 0x2ece6
movl %ebp, %eax
incl (%rbx,%rax,4)
jmp 0x2ee54
movq 0x1000(%rbx), %r14
testq %r14, %r14
jne 0x2ed07
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x4370
movq %rax, %r14
movq %rax, 0x1000(%rbx)
movl 0x8(%r14), %eax
cmpl 0xc(%r14), %eax
jb 0x2ed34
movl (%r14), %esi
movl 0x4(%r14), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x2ed22
decl %esi
jmp 0x2ed24
incl %esi
movq %r14, %rdi
callq 0x2f275
testl %eax, %eax
js 0x2ee54
movl (%r14), %esi
leal -0x1(%rsi), %r8d
movl %r8d, %edi
andl %ebp, %edi
movq 0x10(%r14), %rax
movl %edi, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %edx
leal (%rdi,%rdi), %ecx
shrl %cl, %edx
testb $0x2, %dl
je 0x2ed5a
movl %edi, %edx
jmp 0x2edd4
pushq $0x1
popq %r10
movl %edi, %r9d
movl %esi, %edx
movl %r9d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %r11d
leal (%r9,%r9), %ecx
andl $0x1e, %ecx
movl %r11d, %r15d
shrl %cl, %r15d
testb $0x2, %r15b
jne 0x2edb4
testb $0x1, %r15b
jne 0x2ed93
movq 0x18(%r14), %r15
movl %r9d, %r12d
cmpl %ebp, (%r15,%r12,4)
je 0x2edb4
btl %ecx, %r11d
cmovbl %r9d, %edx
addl %r10d, %r9d
andl %r8d, %r9d
incl %r10d
cmpl %edi, %r9d
jne 0x2ed63
movb $0x1, %cl
movl %esi, %r8d
cmpl %esi, %edx
je 0x2edc4
jmp 0x2edd4
shrl %cl, %r11d
testb $0x2, %r11b
sete %cl
movl %edx, %r8d
movl %r9d, %edi
cmpl %esi, %r8d
cmovel %edi, %r8d
testb %cl, %cl
cmovnel %edi, %r8d
movl %r8d, %edx
movl %edx, %esi
shrl $0x4, %esi
movl (%rax,%rsi,4), %edi
leal (%rdx,%rdx), %ecx
andl $0x1e, %ecx
shrl %cl, %edi
testb $0x2, %dil
jne 0x2ee02
testb $0x1, %dil
jne 0x2ee2b
movq 0x1000(%rbx), %rax
movq 0x20(%rax), %rax
movl %edx, %ecx
incl (%rax,%rcx,4)
jmp 0x2ee54
movq 0x18(%r14), %rdi
movl %edx, %edx
movl %ebp, (%rdi,%rdx,4)
pushq $0x3
popq %rdi
shll %cl, %edi
notl %edi
andl %edi, (%rax,%rsi,4)
movq 0x4(%r14), %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x4(%r14)
jmp 0x2ee42
movq 0x18(%r14), %rdi
movl %edx, %edx
movl %ebp, (%rdi,%rdx,4)
pushq $0x3
popq %rdi
shll %cl, %edi
notl %edi
andl %edi, (%rax,%rsi,4)
incl 0x4(%r14)
movq 0x1000(%rbx), %rax
movq 0x20(%rax), %rax
movl $0x1, (%rax,%rdx,4)
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_stats.c
// Function: cram_stats_del
void cram_stats_del(cram_stats *st, int32_t val) {
    st->nsamp--;

    //assert(val >= 0);

    if (val < MAX_STAT_VAL && val >= 0) {
	st->freqs[val]--;
	assert(st->freqs[val] >= 0);
    } else if (st->h) {
	khint_t k = kh_get(m_i2i, st->h, val);

	if (k != kh_end(st->h)) {
	    if (--kh_val(st->h, k) == 0)
		kh_del(m_i2i, st->h, k);
	} else {
	    fprintf(stderr, "Failed to remove val %d from cram_stats\n", val);
	    st->nsamp++;
	}
    } else {
	fprintf(stderr, "Failed to remove val %d from cram_stats\n", val);
	st->nsamp++;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %edx
movq %rdi, %rbx
decl 0x1008(%rdi)
cmpl $0x3ff, %esi            # imm = 0x3FF
ja 0x2eea7
movl %edx, %eax
movl (%rbx,%rax,4), %ecx
leal -0x1(%rcx), %edx
movl %edx, (%rbx,%rax,4)
testl %ecx, %ecx
jg 0x2ef7b
leaq 0x1735f(%rip), %rdi     # 0x461f0
leaq 0x1736c(%rip), %rsi     # 0x46204
leaq 0x17377(%rip), %rcx     # 0x46216
pushq $0x52
popq %rdx
callq 0x4360
movq 0x1000(%rbx), %rsi
testq %rsi, %rsi
je 0x2ef5d
movl (%rsi), %edi
testl %edi, %edi
je 0x2ef1b
leal -0x1(%rdi), %r8d
movl %r8d, %r9d
andl %edx, %r9d
movq 0x10(%rsi), %r10
pushq $0x1
popq %r11
movl %r9d, %eax
movl %eax, %ecx
shrl $0x4, %ecx
movl (%r10,%rcx,4), %ebp
leal (%rax,%rax), %ecx
andl $0x1e, %ecx
movl %ebp, %r14d
shrl %cl, %r14d
testb $0x2, %r14b
jne 0x2ef10
testb $0x1, %r14b
jne 0x2ef00
movq 0x18(%rsi), %r14
movl %eax, %r15d
cmpl %edx, (%r14,%r15,4)
je 0x2ef10
addl %r11d, %eax
andl %r8d, %eax
incl %r11d
cmpl %r9d, %eax
jne 0x2eed2
jmp 0x2ef5d
shrl %cl, %ebp
testb $0x3, %bpl
cmovnel %edi, %eax
jmp 0x2ef1d
xorl %eax, %eax
cmpl %edi, %eax
je 0x2ef5d
movq 0x20(%rsi), %rcx
movl %eax, %edx
decl (%rcx,%rdx,4)
jne 0x2ef7b
cmpl %eax, (%rsi)
je 0x2ef7b
movq 0x10(%rsi), %rdx
movl %eax, %edi
shrl $0x4, %edi
movl (%rdx,%rdi,4), %r8d
addl %eax, %eax
andl $0x1e, %eax
movl %r8d, %r9d
movl %eax, %ecx
shrl %cl, %r9d
testb $0x3, %r9b
jne 0x2ef7b
btsl %eax, %r8d
movl %r8d, (%rdx,%rdi,4)
decl 0x4(%rsi)
jmp 0x2ef7b
movq 0x2806c(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
leaq 0x172d3(%rip), %rsi     # 0x46241
xorl %eax, %eax
callq 0x4770
incl 0x1008(%rbx)
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_stats.c
// Function: cram_stats_dump
void cram_stats_dump(cram_stats *st) {
    int i;
    fprintf(stderr, "cram_stats:\n");
    for (i = 0; i < MAX_STAT_VAL; i++) {
	if (!st->freqs[i])
	    continue;
	fprintf(stderr, "\t%d\t%d\n", i, st->freqs[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;

	    fprintf(stderr, "\t%d\t%d\n", kh_key(st->h, k), kh_val(st->h, k));
	}
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x28038(%rip), %r12     # 0x56fd0
movq (%r12), %rcx
leaq 0x172c7(%rip), %rdi     # 0x4626a
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
callq 0x4a20
leaq 0x1669c(%rip), %r14     # 0x45651
xorl %r15d, %r15d
cmpq $0x400, %r15            # imm = 0x400
je 0x2efe1
movl (%rbx,%r15,4), %ecx
testl %ecx, %ecx
jne 0x2efce
incq %r15
jmp 0x2efb8
movq (%r12), %rdi
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x4770
jmp 0x2efc9
movq 0x1000(%rbx), %rax
testq %rax, %rax
je 0x2f047
leaq 0x1665d(%rip), %r14     # 0x45651
xorl %ebp, %ebp
xorl %r15d, %r15d
cmpl (%rax), %r15d
je 0x2f047
movq 0x10(%rax), %rcx
movl %r15d, %edx
shrl $0x4, %edx
movl (%rcx,%rdx,4), %edx
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %edx
testb $0x3, %dl
je 0x2f01f
incl %r15d
addl $0x2, %ebp
jmp 0x2eff9
movq (%r12), %rdi
movl %r15d, %ecx
movq 0x18(%rax), %rdx
movq 0x20(%rax), %rax
movl (%rdx,%rcx,4), %edx
movl (%rax,%rcx,4), %ecx
movq %r14, %rsi
xorl %eax, %eax
callq 0x4770
movq 0x1000(%rbx), %rax
jmp 0x2f017
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/mFILE.c
// Function: mstdin
mFILE *mstdin(void) {
    if (m_channel[0])
	return m_channel[0];

    m_channel[0] = mfcreate(NULL, 0);
    if (NULL == m_channel[0]) return NULL;
    m_channel[0]->fp = stdin;
    return m_channel[0];
}

// Assembly:
pushq %rbx
movq 0x27fec(%rip), %rbx     # 0x57560
testq %rbx, %rbx
jne 0x2f5a0
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x2f5a5
movq %rax, 0x27fd5(%rip)     # 0x57560
testq %rax, %rax
je 0x2f5a0
movq 0x27a31(%rip), %rcx     # 0x56fc8
movq (%rcx), %rcx
movq %rcx, (%rax)
movq %rax, %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfcreate
mFILE *mfcreate(char *data, int size) {
    mFILE *mf = (mFILE *)malloc(sizeof(*mf));
    if (NULL == mf) return NULL;
    mf->fp = NULL;
    mf->data = data;
    mf->alloced = size;
    mf->size = size;
    mf->eof = 0;
    mf->offset = 0;
    mf->flush_pos = 0;
    mf->mode = MF_READ | MF_WRITE;
    return mf;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
pushq $0x38
popq %rdi
callq 0x46f0
testq %rax, %rax
je 0x2f5e3
andq $0x0, (%rax)
movq %r14, 0x8(%rax)
movslq %ebx, %rcx
movq %rcx, 0x10(%rax)
movq %rcx, 0x20(%rax)
movabsq $0x300000000, %rcx      # imm = 0x300000000
movq %rcx, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mstdout
mFILE *mstdout(void) {
    if (m_channel[1])
	return m_channel[1];

    m_channel[1] = mfcreate(NULL, 0);
    if (NULL == m_channel[1]) return NULL;
    m_channel[1]->fp = stdout;
    m_channel[1]->mode = MF_WRITE;
    return m_channel[1];
}

// Assembly:
pushq %rbx
movq 0x27f7d(%rip), %rbx     # 0x57570
testq %rbx, %rbx
jne 0x2f626
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x2f5a5
movq %rax, 0x27f66(%rip)     # 0x57570
testq %rax, %rax
je 0x2f626
movq 0x2798a(%rip), %rcx     # 0x56fa0
movq (%rcx), %rcx
movq %rcx, (%rax)
movl $0x2, 0x1c(%rax)
movq %rax, %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mstderr
mFILE *mstderr(void) {
    if (m_channel[2])
	return m_channel[2];

    m_channel[2] = mfcreate(NULL, 0);
    if (NULL == m_channel[2]) return NULL;
    m_channel[2]->fp = stderr;
    m_channel[2]->mode = MF_WRITE;
    return m_channel[2];
}

// Assembly:
pushq %rbx
movq 0x27f4d(%rip), %rbx     # 0x57580
testq %rbx, %rbx
jne 0x2f666
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x2f5a5
movq %rax, 0x27f36(%rip)     # 0x57580
testq %rax, %rax
je 0x2f666
movq 0x2797a(%rip), %rcx     # 0x56fd0
movq (%rcx), %rcx
movq %rcx, (%rax)
movl $0x2, 0x1c(%rax)
movq %rax, %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfrecreate
void mfrecreate(mFILE *mf, char *data, int size) {
    if (mf->data)
	free(mf->data);
    mf->data = data;
    mf->size = size;
    mf->alloced = size;
    mf->eof = 0;
    mf->offset = 0;
    mf->flush_pos = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %rdi
callq 0x4600
movq %r14, 0x8(%r15)
movslq %ebx, %rax
movq %rax, 0x20(%r15)
movq %rax, 0x10(%r15)
andl $0x0, 0x18(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r15)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfload
static char *mfload(FILE *fp, const char *fn, size_t *size, int binary) {
    struct stat sb;
    char *data = NULL;
    size_t allocated = 0, used = 0;
    int bufsize = 8192;

#ifdef _WIN32
    if (binary)
	_setmode(_fileno(fp), _O_BINARY);
    else 
	_setmode(_fileno(fp), _O_TEXT);
#endif

    if (fn && -1 != stat(fn, &sb)) {
	data = malloc(allocated = sb.st_size);
	bufsize = sb.st_size;
    } else {
	fn = NULL;
    }

    do {
	size_t len;
	if (used + bufsize > allocated) {
	    allocated += bufsize;
	    data = realloc(data, allocated);
	}
	len = fread(data + used, 1, allocated - used, fp);
	if (len > 0)
	    used += len;
    } while (!feof(fp) && (fn == NULL || used < sb.st_size));

    *size = used;

    return data;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, 0x10(%rsp)
movq %rdi, %r14
movb $0x1, %al
movl %eax, 0xc(%rsp)
movl $0x2000, %ebp           # imm = 0x2000
testq %rsi, %rsi
je 0x2f8a8
leaq 0x18(%rsp), %r15
movq %rsi, %rdi
movq %r15, %rsi
callq 0x44a0
movq 0x30(%r15), %r15
cmpl $-0x1, %eax
je 0x2f8ad
movq %r15, %rdi
callq 0x46f0
movq %rax, %r12
movslq %r15d, %rbp
movl $0x0, 0xc(%rsp)
movq %r15, %r13
jmp 0x2f8b3
xorl %r12d, %r12d
jmp 0x2f8b0
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ebx, %ebx
leaq (%rbx,%rbp), %rax
cmpq %r13, %rax
jbe 0x2f8cf
addq %rbp, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x48c0
movq %rax, %r12
leaq (%r12,%rbx), %rdi
movq %r13, %rdx
subq %rbx, %rdx
pushq $0x1
popq %rsi
movq %r14, %rcx
callq 0x47d0
addq %rax, %rbx
movq %r14, %rdi
callq 0x4820
cmpq %r15, %rbx
setb %cl
testl %eax, %eax
jne 0x2f8ff
orb 0xc(%rsp), %cl
jne 0x2f8b5
movq 0x10(%rsp), %rax
movq %rbx, (%rax)
movq %r12, %rax
addq $0xa8, %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/mFILE.c
// Function: mfflush
int mfflush(mFILE *mf) {
    if (!mf->fp)
	return 0;

    /* FIXME: only do this when opened in write mode */
    if (mf == m_channel[1] || mf == m_channel[2]) {
	if (mf->flush_pos < mf->size) {
	    size_t bytes = mf->size - mf->flush_pos;
	    if (fwrite(mf->data + mf->flush_pos, 1, bytes, mf->fp) < bytes)
		return -1;
	    if (0 != fflush(mf->fp))
		return -1;
	}

	/* Stdout & stderr are non-seekable streams so throw away the data */
	mf->offset = mf->size = mf->flush_pos = 0;
    }

    /* only flush when opened in write mode */
    if (mf->mode & MF_WRITE) {
	if (mf->flush_pos < mf->size) {
	    size_t bytes = mf->size - mf->flush_pos;
	    if (!(mf->mode & MF_MODEX)) {
		fseek(mf->fp, mf->flush_pos, SEEK_SET);
	    }
	    if (fwrite(mf->data + mf->flush_pos, 1, bytes, mf->fp) < bytes)
		return -1;
	    if (0 != fflush(mf->fp))
		return -1;
	}
	if (ftell(mf->fp) != -1 &&
	    ftruncate(fileno(mf->fp), ftell(mf->fp)) == -1)
		return -1;
	mf->flush_pos = mf->size;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x2fa7c
movq %rdi, %r14
pushq $-0x1
popq %rbx
cmpq %rdi, 0x27bd6(%rip)     # 0x57570
je 0x2f9a5
cmpq %r14, 0x27bdd(%rip)     # 0x57580
jne 0x2f9e9
movq 0x20(%r14), %r15
movq 0x30(%r14), %rdi
subq %rdi, %r15
jbe 0x2f9da
addq 0x8(%r14), %rdi
pushq $0x1
popq %rsi
movq %r15, %rdx
callq 0x4a20
cmpq %r15, %rax
jb 0x2fa7e
movq (%r14), %rdi
callq 0x45e0
testl %eax, %eax
jne 0x2fa7e
leaq 0x20(%r14), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movl 0x1c(%r14), %edx
testb $0x2, %dl
je 0x2fa7c
movq 0x30(%r14), %rax
movq (%r14), %rcx
movq 0x20(%r14), %r15
subq %rax, %r15
jbe 0x2fa45
testb $0x20, %dl
jne 0x2fa1f
movq %rcx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x45b0
movq (%r14), %rcx
movq 0x30(%r14), %rax
addq 0x8(%r14), %rax
pushq $0x1
popq %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x4a20
cmpq %r15, %rax
jb 0x2fa7e
movq (%r14), %rdi
callq 0x45e0
testl %eax, %eax
jne 0x2fa7e
movq (%r14), %rcx
movq %rcx, %rdi
callq 0x4030
cmpq $-0x1, %rax
je 0x2fa74
movq (%r14), %rdi
callq 0x4570
movl %eax, %ebp
movq (%r14), %rdi
callq 0x4030
movl %ebp, %edi
movq %rax, %rsi
callq 0x4720
cmpl $-0x1, %eax
je 0x2fa7e
movq 0x20(%r14), %rax
movq %rax, 0x30(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
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/mFILE.c
// Function: mfdestroy
int mfdestroy(mFILE *mf) {
    if (!mf)
	return -1;

    if (mf->data)
	free(mf->data);
    free(mf);

    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x2faa9
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x4600
movq %rbx, %rdi
callq 0x4600
xorl %eax, %eax
popq %rbx
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfdetach
int mfdetach(mFILE *mf) {
    if (!mf)
	return -1;

    mfflush(mf);
    if (mf->mode & MF_MMAP)
	return -1;

    if (mf->fp) {
	fclose(mf->fp);
	mf->fp = NULL;
    }

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
pushq $-0x1
popq %rbx
testq %rdi, %rdi
je 0x2fadb
movq %rdi, %r14
callq 0x2f97a
testb $0x40, 0x1c(%r14)
jne 0x2fadb
movq (%r14), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x2fadb
callq 0x4530
andq $0x0, (%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfsteal
void *mfsteal(mFILE *mf, size_t *size_out) {
    void *data;

    if (!mf) return NULL;

    data = mf->data;
    
    if (NULL != size_out) *size_out = mf->size;

    if (mfdetach(mf) != 0)
	return NULL;

    mf->data = NULL;
    mfdestroy(mf);

    return data;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x2fb0d
movq %rdi, %r14
movq 0x8(%rdi), %rbx
testq %rsi, %rsi
je 0x2fb01
movq 0x20(%r14), %rax
movq %rax, (%rsi)
movq %r14, %rdi
callq 0x2faad
testl %eax, %eax
je 0x2fb11
xorl %ebx, %ebx
jmp 0x2fb1e
andq $0x0, 0x8(%r14)
movq %r14, %rdi
callq 0x2fa8b
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfseek
int mfseek(mFILE *mf, long offset, int whence) {
    switch (whence) {
    case SEEK_SET:
	mf->offset = offset;
	break;
    case SEEK_CUR:
	mf->offset += offset;
	break;
    case SEEK_END:
	mf->offset = mf->size + offset;
	break;
    default:
	errno = EINVAL;
	return -1;
    }

    mf->eof = 0;
    return 0;
}

// Assembly:
cmpl $0x2, %edx
je 0x2fb51
cmpl $0x1, %edx
je 0x2fb4b
testl %edx, %edx
je 0x2fb55
pushq %rax
callq 0x4060
movl $0x16, (%rax)
pushq $-0x1
popq %rax
addq $0x8, %rsp
retq
addq %rsi, 0x28(%rdi)
jmp 0x2fb59
addq 0x20(%rdi), %rsi
movq %rsi, 0x28(%rdi)
andl $0x0, 0x18(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfread
size_t mfread(void *ptr, size_t size, size_t nmemb, mFILE *mf) {
    size_t len;
    char *cptr = (char *)ptr;
    
    if (mf == m_channel[0]) init_mstdin();

    if (mf->size <= mf->offset)
	return 0;

    len = size * nmemb <= mf->size - mf->offset
	? size * nmemb
	: mf->size - mf->offset;
    if (!size)
	return 0;

    memcpy(cptr, &mf->data[mf->offset], len);
    mf->offset += len;
    
    if (len != size * nmemb) {
	mf->eof = 1;
    }

    return len / size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r12
cmpq %rcx, 0x279b2(%rip)     # 0x57560
jne 0x2fbb5
callq 0x2fc10
movq 0x20(%r14), %rbp
movq 0x28(%r14), %rsi
subq %rsi, %rbp
jbe 0x2fbff
imulq %rbx, %r15
cmpq %rbp, %r15
movq %rbp, %r13
cmovbq %r15, %r13
testq %rbx, %rbx
je 0x2fbff
addq 0x8(%r14), %rsi
movq %r12, %rdi
movq %r13, %rdx
callq 0x4420
addq %r13, 0x28(%r14)
cmpq %rbp, %r15
jbe 0x2fbf5
movl $0x1, 0x18(%r14)
movq %r13, %rax
xorl %edx, %edx
divq %rbx
jmp 0x2fc01
xorl %eax, %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/mFILE.c
// Function: init_mstdin
static void init_mstdin(void) {
    static int done_stdin = 0;
    if (done_stdin)
	return;

    m_channel[0]->data = mfload(stdin, NULL, &m_channel[0]->size, 1);
    m_channel[0]->mode = MF_READ;
    done_stdin = 1;
}

// Assembly:
cmpb $0x0, 0x27971(%rip)     # 0x57588
jne 0x2fc53
pushq %rax
movq 0x273a7(%rip), %rax     # 0x56fc8
movq (%rax), %rdi
movq 0x27935(%rip), %rdx     # 0x57560
addq $0x20, %rdx
xorl %esi, %esi
callq 0x2f84b
movq 0x27923(%rip), %rcx     # 0x57560
movq %rax, 0x8(%rcx)
movl $0x1, 0x1c(%rcx)
movb $0x1, 0x27939(%rip)     # 0x57588
addq $0x8, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfwrite
size_t mfwrite(void *ptr, size_t size, size_t nmemb, mFILE *mf) {
    if (!(mf->mode & MF_WRITE))
	return 0;

    /* Append mode => forced all writes to end of file */
    if (mf->mode & MF_APPEND)
	mf->offset = mf->size;

    /* Make sure we have enough room */
    while (size * nmemb + mf->offset > mf->alloced) {
	size_t new_alloced = mf->alloced ? mf->alloced * 2 : 1024;
	void * new_data = realloc(mf->data, new_alloced);
	if (NULL == new_data) return 0;
	mf->alloced = new_alloced;
	mf->data    = new_data;
    }

    /* Record where we need to reflush from */
    if (mf->offset < mf->flush_pos)
	mf->flush_pos = mf->offset;

    /* Copy the data over */
    memcpy(&mf->data[mf->offset], ptr, size * nmemb);
    mf->offset += size * nmemb;
    if (mf->size < mf->offset)
	mf->size = mf->offset;

    return nmemb;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x1c(%rcx), %eax
testb $0x2, %al
jne 0x2fc7a
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
testb $0x4, %al
je 0x2fc92
movq 0x20(%r14), %rax
movq %rax, 0x28(%r14)
imulq %rbx, %r15
movq 0x10(%r14), %r13
movl $0x400, %ebp            # imm = 0x400
movq 0x28(%r14), %rdi
leaq (%rdi,%r15), %rax
cmpq %r13, %rax
jbe 0x2fcd3
testq %r13, %r13
leaq (%r13,%r13), %r13
cmoveq %rbp, %r13
movq 0x8(%r14), %rdi
movq %r13, %rsi
callq 0x48c0
testq %rax, %rax
je 0x2fc66
movq %r13, 0x10(%r14)
movq %rax, 0x8(%r14)
jmp 0x2fc9f
cmpq 0x30(%r14), %rdi
jae 0x2fcdd
movq %rdi, 0x30(%r14)
addq 0x8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4420
addq 0x28(%r14), %r15
movq %r15, 0x28(%r14)
cmpq %r15, 0x20(%r14)
jae 0x2fc68
movq %r15, 0x20(%r14)
jmp 0x2fc68
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfgetc
int mfgetc(mFILE *mf) {
    if (mf == m_channel[0]) init_mstdin();
    if (mf->offset < mf->size) {
	return (unsigned char)mf->data[mf->offset++];
    }

    mf->eof = 1;
    return -1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq %rdi, 0x2784e(%rip)     # 0x57560
jne 0x2fd19
callq 0x2fc10
movq 0x28(%rbx), %rax
cmpq 0x20(%rbx), %rax
jae 0x2fd35
movq 0x8(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x28(%rbx)
movzbl (%rcx,%rax), %eax
jmp 0x2fd3f
movl $0x1, 0x18(%rbx)
pushq $-0x1
popq %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfgets
char *mfgets(char *s, int size, mFILE *mf) {
    int i;

    if (mf == m_channel[0]) init_mstdin();
    *s = 0;
    for (i = 0; i < size-1;) {
	if (mf->offset < mf->size) {
	    s[i] = mf->data[mf->offset++];
	    if (s[i++] == '\n')
		break;
	} else {
	    mf->eof = 1;
	    break;
	}
    }

    s[i] = 0;
    return i ? s : NULL;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
cmpq %rdx, 0x277e5(%rip)     # 0x57560
jne 0x2fd82
callq 0x2fc10
movb $0x0, (%rbx)
cmpl $0x2, %ebp
pushq $0x1
popq %rax
cmovgel %ebp, %eax
decl %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x2fdc7
movq 0x28(%r14), %rdx
cmpq 0x20(%r14), %rdx
jae 0x2fdbd
movq 0x8(%r14), %rsi
leaq 0x1(%rdx), %rdi
movq %rdi, 0x28(%r14)
movb (%rsi,%rdx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
cmpb $0xa, %dl
jne 0x2fd92
jmp 0x2fdc5
movl $0x1, 0x18(%r14)
movl %ecx, %eax
movslq %eax, %rcx
movb $0x0, (%rbx,%rcx)
xorl %eax, %eax
testl %ecx, %ecx
cmovneq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfprintf
int mfprintf(mFILE *mf, char *fmt, ...) {
    int ret;
    size_t est_length;
    va_list args;

    va_start(args, fmt);
    est_length = vflen(fmt, args);
    va_end(args);
    while (est_length + mf->offset > mf->alloced) {
	size_t new_alloced = mf->alloced ? mf->alloced * 2 : 1024;
	void * new_data    = realloc(mf->data, new_alloced);
	if (NULL == new_data) return -1;
	mf->alloced = new_alloced;
	mf->data    = new_data;
    }

    va_start(args, fmt);
    ret = vsprintf(&mf->data[mf->offset], fmt, args);
    va_end(args);

    if (ret > 0) {
	mf->offset += ret;
	if (mf->size < mf->offset)
	    mf->size = mf->offset;
    }

    if (mf->fp == stderr) {
	/* Auto-flush for stderr */
	if (0 != mfflush(mf)) return -1;
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rsp), %r12
movq %rdx, 0x10(%r12)
movq %rcx, 0x18(%r12)
movq %r8, 0x20(%r12)
movq %r9, 0x28(%r12)
testb %al, %al
je 0x2fe46
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rsi
movq %r12, 0x10(%rsi)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rsi)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsi)
movq %r14, %rdi
callq 0x3513c
movslq %eax, %r13
movq 0x10(%rbx), %r15
movl $0x400, %ebp            # imm = 0x400
movq 0x28(%rbx), %rax
addq %r13, %rax
cmpq %r15, %rax
jbe 0x2feac
testq %r15, %r15
leaq (%r15,%r15), %r15
cmoveq %rbp, %r15
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0x48c0
testq %rax, %rax
je 0x2ff0f
movq %r15, 0x10(%rbx)
movq %rax, 0x8(%rbx)
jmp 0x2fe7a
movq %rsp, %rdx
movq %r12, 0x10(%rdx)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq 0x8(%rbx), %rdi
addq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0x4250
movl %eax, %r14d
testl %eax, %eax
pushq $-0x1
popq %rbp
jle 0x2fefb
movl %r14d, %eax
addq 0x28(%rbx), %rax
movq %rax, 0x28(%rbx)
cmpq %rax, 0x20(%rbx)
jae 0x2fefb
movq %rax, 0x20(%rbx)
movq (%rbx), %rax
movq 0x270cb(%rip), %rcx     # 0x56fd0
cmpq (%rcx), %rax
je 0x2ff26
movl %r14d, %ebp
jmp 0x2ff12
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x2f97a
testl %eax, %eax
jne 0x2ff12
jmp 0x2ff0a
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/mFILE.c
// Function: mfascii
void mfascii(mFILE *mf) {
    size_t p1, p2;

    for (p1 = p2 = 1; p1 < mf->size; p1++, p2++) {
	if (mf->data[p1] == '\n' && mf->data[p1-1] == '\r') {
	    p2--; /* delete the \r */
	}
	mf->data[p2] = mf->data[p1];
    }
    mf->size = p2;

    mf->offset = mf->flush_pos = 0;
}

// Assembly:
pushq $0x1
popq %rax
movq %rax, %rcx
cmpq 0x20(%rdi), %rax
jae 0x2ff69
movq 0x8(%rdi), %rdx
movb (%rdx,%rax), %sil
cmpb $0xa, %sil
jne 0x2ff5d
xorl %r8d, %r8d
cmpb $0xd, -0x1(%rdx,%rax)
sete %r8b
subq %r8, %rcx
movb %sil, (%rdx,%rcx)
incq %rax
incq %rcx
jmp 0x2ff3a
movq %rcx, 0x20(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rdi)
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/open_trace_file.c
// Function: find_file_url
mFILE *find_file_url(char *file, char *url) {
    char buf[8192], *cp;
    mFILE *mf = NULL;
    int maxlen = 8190 - strlen(file), len;
    hFILE *hf;

    /* Expand %s for the trace name */
    for (cp = buf; *url && cp - buf < maxlen; url++) {
	if (*url == '%' && *(url+1) == 's') {
	    url++;
	    cp += strlen(strcpy(cp, file));
	} else {
	    *cp++ = *url;
	}
    }
    *cp++ = 0;

    if (!(hf = hopen(buf, "r")))
	return NULL;

    if (NULL == (mf = mfcreate(NULL, 0)))
	return NULL;
    while ((len = hread(hf, buf, 8192)) > 0) {
	if (mfwrite(buf, len, 1, mf) <= 0) {
	    hclose_abruptly(hf);
	    mfdestroy(mf);
	    return NULL;
	}
    }
    if (hclose(hf) < 0 || len < 0) {
	mfdestroy(mf);
	return NULL;
    }

    mrewind(mf);
    return mf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2008, %rsp           # imm = 0x2008
movq %rsi, %rbx
movq %rdi, %r14
callq 0x4210
movl $0x1ffe, %ecx           # imm = 0x1FFE
subl %eax, %ecx
movslq %ecx, %r12
movq %rsp, %r13
movq %r13, %r15
movb (%rbx), %al
testb %al, %al
je 0x30232
movq %r15, %rcx
subq %r13, %rcx
cmpq %r12, %rcx
jge 0x30232
cmpb $0x25, %al
jne 0x30227
cmpb $0x73, 0x1(%rbx)
jne 0x30227
incq %rbx
movq %r15, %rdi
movq %r14, %rsi
callq 0x44e0
movq %r15, %rdi
callq 0x4210
addq %rax, %r15
jmp 0x3022d
movb %al, (%r15)
incq %r15
incq %rbx
jmp 0x301f1
movb $0x0, (%r15)
leaq 0x14678(%rip), %rsi     # 0x448b5
movq %rsp, %rdi
callq 0x3a708
testq %rax, %rax
je 0x302ee
movq %rax, %r14
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
callq 0x2f5a5
testq %rax, %rax
je 0x302f1
movq %rax, %rbx
movq %rsp, %r15
movq 0x8(%r14), %rsi
movq 0x10(%r14), %r12
subq %rsi, %r12
movl $0x2000, %eax           # imm = 0x2000
cmpq %rax, %r12
movl $0x2000, %ebp           # imm = 0x2000
cmovbq %r12, %rbp
movq %r15, %rdi
movq %rbp, %rdx
callq 0x4420
addq %rbp, 0x8(%r14)
movl $0x2000, %r13d          # imm = 0x2000
cmpq $0x1fff, %r12           # imm = 0x1FFF
ja 0x302c1
movl $0x2000, %edx           # imm = 0x2000
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rcx
callq 0x3a0c7
movq %rax, %r13
testl %r13d, %r13d
jle 0x30306
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
movq %r15, %rdi
movq %r13, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2fc54
testq %rax, %rax
jne 0x3026c
movq %r14, %rdi
callq 0x3a3fa
movq %rbx, %rdi
callq 0x2fa8b
xorl %r15d, %r15d
movq %r15, %rax
addq $0x2008, %rsp           # imm = 0x2008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x3a3a2
testl %r13d, %r13d
jne 0x302e6
testl %eax, %eax
js 0x302e6
movq %rbx, %rdi
callq 0x2fb65
movq %rbx, %r15
jmp 0x302f1
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/open_trace_file.c
// Function: find_file_dir
static mFILE *find_file_dir(char *file, char *dirname) {
    char *path;
    mFILE *mf = NULL;

    path = expand_path(file, dirname);

    if (is_file(path))
	mf = mfopen(path, "rbm");

    free(path);
    return mf;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
callq 0x305aa
movq %rax, %rbx
movq %rax, %rdi
callq 0x2f4f0
testl %eax, %eax
je 0x304a0
leaq 0x15e8b(%rip), %rsi     # 0x4631e
movq %rbx, %rdi
callq 0x2f91c
movq %rax, %r14
jmp 0x304a3
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x4600
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/open_trace_file.c
// Function: find_path
char *find_path(char *file, char *path) {
    char *newsearch;
    char *ele;
    char *outpath = NULL;

    /* Use path first */
    if (!path)
	path = getenv("RAWDATA");
    if (NULL == (newsearch = tokenise_search_path(path)))
	return NULL;
    
    for (ele = newsearch; *ele; ele += strlen(ele)+1) {
	char *ele2 = (*ele == '|') ? ele+1 : ele;

	if (!strncmp(ele2, "URL=", 4) ||
	    !strncmp(ele2, "http:", 5) ||
	    !strncmp(ele2, "ftp:", 4)) {
	    continue;
	} else {
	    outpath = expand_path(file, ele2);
	    if (is_file(outpath)) {
		free(newsearch);
		return outpath;
	    } else {
		free(outpath);
	    }
	} 
    }

    free(newsearch);

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
testq %rsi, %rsi
jne 0x304dd
leaq 0x15e3c(%rip), %rdi     # 0x46311
callq 0x4640
movq %rax, %rsi
movq %rsi, %rdi
callq 0x2ff78
testq %rax, %rax
je 0x30596
leaq 0x15e24(%rip), %r15     # 0x46319
pushq $0x4
popq %r12
leaq 0x15e02(%rip), %r13     # 0x46302
pushq $0x5
popq %rbp
movq %rax, 0x8(%rsp)
movq %rax, %r14
movb (%r14), %al
xorl %ebx, %ebx
testb %al, %al
je 0x3058a
cmpb $0x7c, %al
sete %bl
addq %r14, %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4280
testl %eax, %eax
je 0x3057a
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x4280
testl %eax, %eax
je 0x3057a
movq %rbx, %rdi
leaq 0x15dc2(%rip), %rsi     # 0x4630c
movq %r12, %rdx
callq 0x4280
testl %eax, %eax
je 0x3057a
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x305aa
movq %rax, %rbx
movq %rax, %rdi
callq 0x2f4f0
testl %eax, %eax
jne 0x3058a
movq %rbx, %rdi
callq 0x4600
movq %r14, %rdi
callq 0x4210
addq %rax, %r14
incq %r14
jmp 0x3050b
movq 0x8(%rsp), %rdi
callq 0x4600
jmp 0x30598
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %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/rANS_byte.h
// Function: RansEncPutSymbol
static inline void RansEncPutSymbol(RansState* r, uint8_t** pptr, RansEncSymbol const* sym)
{
    RansAssert(sym->x_max != 0); // can't encode symbol with freq=0

    // renormalize
    uint32_t x = *r;
    uint32_t x_max = sym->x_max;

    if (x >= x_max) {
	uint8_t* ptr = *pptr;
	do {
	    *--ptr = (uint8_t) (x & 0xff);
	    x >>= 8;
	} while (x >= x_max);
	*pptr = ptr;
    }

    // x = C(s,x)
    // NOTE: written this way so we get a 32-bit "multiply high" when
    // available. If you're on a 64-bit platform with cheap multiplies
    // (e.g. x64), just bake the +32 into rcp_shift.
    //uint32_t q = (uint32_t) (((uint64_t)x * sym->rcp_freq) >> 32) >> sym->rcp_shift;

    // The extra >>32 has already been added to RansEncSymbolInit
    uint32_t q = (uint32_t) (((uint64_t)x * sym->rcp_freq) >> sym->rcp_shift);
    *r = x + sym->bias + q * sym->cmpl_freq;
}

// Assembly:
pushq %rax
movl (%rdx), %ecx
testl %ecx, %ecx
je 0x30ca9
movl (%rdi), %eax
cmpl %ecx, %eax
jb 0x30c8a
movq (%rsi), %r8
movb %al, -0x1(%r8)
decq %r8
shrl $0x8, %eax
cmpl %ecx, %eax
jae 0x30c79
movq %r8, (%rsi)
movl %eax, %ecx
movl 0x4(%rdx), %esi
imulq %rcx, %rsi
movb 0xe(%rdx), %cl
shrq %cl, %rsi
addl 0x8(%rdx), %eax
movzwl 0xc(%rdx), %ecx
imull %esi, %ecx
addl %eax, %ecx
movl %ecx, (%rdi)
popq %rax
retq
leaq 0x158d0(%rip), %rdi     # 0x46580
leaq 0x15831(%rip), %rsi     # 0x464e8
leaq 0x158d2(%rip), %rcx     # 0x46590
movl $0x10f, %edx            # imm = 0x10F
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/./cram/rANS_byte.h
// Function: RansDecSymbolInit
static inline void RansDecSymbolInit(RansDecSymbol* s, uint32_t start, uint32_t freq)
{
    RansAssert(start <= (1 << 16));
    RansAssert(freq <= (1 << 16) - start);
    s->start = (uint16_t) start;
    s->freq = (uint16_t) freq;
}

// Assembly:
pushq %rax
cmpl $0x10001, %esi          # imm = 0x10001
jae 0x31110
movl $0x10000, %eax          # imm = 0x10000
subl %esi, %eax
cmpl %edx, %eax
jb 0x3112f
movw %si, (%rdi)
movw %dx, 0x2(%rdi)
popq %rax
retq
leaq 0x154bf(%rip), %rdi     # 0x465d6
leaq 0x153ca(%rip), %rsi     # 0x464e8
leaq 0x154c4(%rip), %rcx     # 0x465e9
movl $0x103, %edx            # imm = 0x103
callq 0x4360
leaq 0x154ef(%rip), %rdi     # 0x46625
leaq 0x153ab(%rip), %rsi     # 0x464e8
leaq 0x154a5(%rip), %rcx     # 0x465e9
movl $0x104, %edx            # imm = 0x104
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/./cram/rANS_byte.h
// Function: RansDecRenorm
static inline void RansDecRenorm(RansState* r, uint8_t** pptr)
{
    // renormalize
    uint32_t x = *r;

    if (x < RANS_BYTE_L) {
        uint8_t* ptr = *pptr;
        do x = (x << 8) | *ptr++; while (x < RANS_BYTE_L);
        *pptr = ptr;
    }

    *r = x;
}

// Assembly:
movl (%rdi), %eax
cmpl $0x7fffff, %eax         # imm = 0x7FFFFF
ja 0x31177
movq (%rsi), %rcx
movl %eax, %edx
movl %eax, %r8d
shll $0x8, %r8d
movzbl (%rcx), %eax
incq %rcx
orl %r8d, %eax
cmpl $0x8000, %edx           # imm = 0x8000
jb 0x3115a
movq %rcx, (%rsi)
movl %eax, (%rdi)
retq