LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_index.c
// Function: cram_index_query
cram_index *cram_index_query(cram_fd *fd, int refid, int pos, 
			     cram_index *from) {
    int i, j, k;
    cram_index *e;

    if (refid+1 < 0 || refid+1 >= fd->index_sz)
	return NULL;

    if (!from)
	from = &fd->index[refid+1];

    // Ref with nothing aligned against it.
    if (!from->e)
	return NULL;

    // This sequence is covered by the index, so binary search to find
    // the optimal starting block.
    i = 0, j = fd->index[refid+1].nslice-1;
    for (k = j/2; k != i; k = (j-i)/2 + i) {
	if (from->e[k].refid > refid) {
	    j = k;
	    continue;
	}

	if (from->e[k].refid < refid) {
	    i = k;
	    continue;
	}

	if (from->e[k].start >= pos) {
	    j = k;
	    continue;
	}

	if (from->e[k].start < pos) {
	    i = k;
	    continue;
	}
    }
    // i==j or i==j-1. Check if j is better.
    if (j >= 0 && from->e[j].start < pos && from->e[j].refid == refid)
	i = j;

    /* The above found *a* bin overlapping, but not necessarily the first */
    while (i > 0 && from->e[i-1].end >= pos)
	i--;

    /* We may be one bin before the optimum, so check */
    while (i+1 < from->nslice &&
	   (from->e[i].refid < refid ||
	    from->e[i].end < pos))
	i++;

    e = &from->e[i];

    return e;
}

// Assembly:
cmpl $-0x1, %esi
jl 0x2607f
leal 0x1(%rsi), %eax
cmpl 0x8834(%rdi), %eax
jge 0x2607f
movl %edx, %r8d
movl %eax, %eax
testq %rcx, %rcx
jne 0x2601a
imulq $0x30, %rax, %rcx
addq 0x8838(%rdi), %rcx
movq 0x8(%rcx), %r10
xorl %r11d, %r11d
testq %r10, %r10
je 0x2607f
pushq %rbx
movq 0x8838(%rdi), %rdx
imulq $0x30, %rax, %rax
movl (%rdx,%rax), %r9d
decl %r9d
movl $0x2, %edi
movl %r9d, %eax
cltd
idivl %edi
cmpl %r11d, %eax
je 0x26086
movslq %eax, %rdx
imulq $0x30, %rdx, %rbx
leaq (%r10,%rbx), %rdx
cmpl %esi, 0x10(%r10,%rbx)
jg 0x26071
jge 0x26065
movl %eax, %r11d
movl %r9d, %eax
jmp 0x26071
cmpl %r8d, 0x14(%rdx)
cmovll %eax, %r11d
cmovll %r9d, %eax
movl %eax, %r9d
subl %r11d, %eax
cltd
idivl %edi
addl %r11d, %eax
jmp 0x26044
xorl %r10d, %r10d
movq %r10, %rax
retq
testl %r9d, %r9d
js 0x260a3
movl %r9d, %eax
imulq $0x30, %rax, %rax
cmpl %r8d, 0x14(%r10,%rax)
jge 0x260a3
addq %r10, %rax
cmpl %esi, 0x10(%rax)
cmovel %r9d, %r11d
leaq -0x18(%r10), %rdx
movl %r11d, %eax
sarl $0x1f, %eax
andl %r11d, %eax
testl %r11d, %r11d
jle 0x260ca
movl %r11d, %edi
imulq $0x30, %rdi, %rdi
cmpl %r8d, (%rdx,%rdi)
jl 0x260c7
decl %r11d
jmp 0x260b0
movl %r11d, %eax
movslq (%rcx), %rcx
movslq %eax, %rdx
movq %rdx, %rax
shlq $0x20, %rax
imulq $0x30, %rdx, %rdi
addq %r10, %rdi
addq $0x18, %rdi
incq %rdx
movabsq $0x100000000, %r9       # imm = 0x100000000
cmpq %rcx, %rdx
jge 0x2610a
cmpl %esi, -0x8(%rdi)
jl 0x260fe
cmpl %r8d, (%rdi)
jge 0x2610a
addq %r9, %rax
addq $0x30, %rdi
incq %rdx
jmp 0x260ef
sarq $0x20, %rax
imulq $0x30, %rax, %rax
addq %rax, %r10
popq %rbx
jmp 0x26082
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_index.c
// Function: cram_seek_to_refpos
int cram_seek_to_refpos(cram_fd *fd, cram_range *r) {
    cram_index *e;

    // Ideally use an index, so see if we have one.
    if ((e = cram_index_query(fd, r->refid, r->start, NULL))) {
	if (0 != cram_seek(fd, e->offset, SEEK_SET))
	    if (0 != cram_seek(fd, e->offset - fd->first_container, SEEK_CUR))
		return -1;
    } else {
	// Absent from index, but this most likely means it simply has no data.
	return -2;
    }

    if (fd->ctr) {
	cram_free_container(fd->ctr);
	fd->ctr = NULL;
	fd->ooc = 0;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl (%rsi), %eax
movl 0x4(%rsi), %edx
movl %eax, %esi
xorl %ecx, %ecx
callq 0x25ff1
testq %rax, %rax
je 0x26186
movq %rax, %r14
movq 0x28(%rax), %rsi
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2d9e3
testl %eax, %eax
je 0x2616a
movq 0x28(%r14), %rsi
subq 0x8840(%rbx), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x2d9e3
testl %eax, %eax
je 0x2616a
pushq $-0x1
jmp 0x26188
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x26189
callq 0x2a9b7
andq $0x0, 0x38(%rbx)
andl $0x0, 0x88f8(%rbx)
jmp 0x26189
pushq $-0x2
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: itf8_put_blk
int itf8_put_blk(cram_block *blk, int val) {
    char buf[5];
    int sz;

    sz = itf8_put(buf, val);
    BLOCK_APPEND(blk, buf, sz);
    return sz;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %eax
movq %rdi, %rbx
cmpl $0x7f, %esi
ja 0x276a2
movb %al, 0xb(%rsp)
pushq $0x1
jmp 0x2772d
movl %eax, %ecx
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x276bd
shrl $0x8, %ecx
orb $-0x80, %cl
movb %cl, 0xb(%rsp)
movb %al, 0xc(%rsp)
pushq $0x2
jmp 0x2772d
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x276da
shrl $0x10, %ecx
orb $-0x40, %cl
movb %cl, 0xb(%rsp)
movb %ah, 0xc(%rsp)
movb %al, 0xd(%rsp)
pushq $0x3
jmp 0x2772d
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x27700
shrl $0x18, %ecx
orb $-0x20, %cl
movb %cl, 0xb(%rsp)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0xc(%rsp)
movb %ah, 0xd(%rsp)
movb %al, 0xe(%rsp)
pushq $0x4
jmp 0x2772d
shrl $0x1c, %ecx
orb $-0x10, %cl
movb %cl, 0xb(%rsp)
movl %eax, %ecx
shrl $0x14, %ecx
movb %cl, 0xc(%rsp)
movl %eax, %ecx
shrl $0xc, %ecx
movb %cl, 0xd(%rsp)
movl %eax, %ecx
shrl $0x4, %ecx
movb %cl, 0xe(%rsp)
andb $0xf, %al
movb %al, 0xf(%rsp)
pushq $0x5
popq %rax
movl %eax, %r14d
movl $0x400, %r15d           # imm = 0x400
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
leaq (%rdi,%r14), %rcx
cmpq %rcx, %rax
ja 0x277aa
movq %rax, %xmm0
punpckldq 0x1c23b(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1c243(%rip), %xmm0    # 0x439a0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x1d26f(%rip), %xmm1    # 0x449e0
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
subsd 0x1c197(%rip), %xmm1    # 0x43918
cvttsd2si %xmm1, %rsi
sarq $0x3f, %rdx
andq %rdx, %rsi
orq %rcx, %rsi
testq %rax, %rax
cmoveq %r15, %rsi
movq %rsi, 0x28(%rbx)
movq 0x20(%rbx), %rdi
callq 0x48c0
movq %rax, 0x20(%rbx)
jmp 0x27737
addq 0x20(%rbx), %rdi
leaq 0xb(%rsp), %rsi
movq %r14, %rdx
callq 0x4420
addq %r14, 0x30(%rbx)
movl %r14d, %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: int32_decode
int int32_decode(cram_fd *fd, int32_t *val) {
    int32_t i;
    if (4 != hread(fd->fp, &i, 4))
	return -1;

    *val = le_int4(i);
    return 4;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq (%rdi), %rdi
leaq 0xc(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x277fd
cmpq $0x4, %rax
jne 0x277f4
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
pushq $0x4
jmp 0x277f6
pushq $-0x1
popq %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/./htslib/hfile.h
// Function: hread
static inline ssize_t HTS_RESULT_USED
hread(hFILE *fp, void *buffer, size_t nbytes)
{
    extern ssize_t hread2(hFILE *, void *, size_t, size_t);

    size_t n = fp->end - fp->begin;
    if (n > nbytes) n = nbytes;
    memcpy(buffer, fp->begin, n);
    fp->begin += n;
    return (n == nbytes)? (ssize_t) n : hread2(fp, buffer, nbytes, n);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %r13
subq %rsi, %r13
cmpq %rdx, %r13
movq %rdx, %r12
cmovbq %r13, %r12
movq %r14, %rdi
movq %r12, %rdx
callq 0x4420
addq %r12, 0x8(%r15)
cmpq %rbx, %r13
jae 0x27852
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3a0c7
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: int32_encode
int int32_encode(cram_fd *fd, int32_t val) {
    val = le_int4(val);
    if (4 != hwrite(fd->fp, &val, 4))
	return -1;

    return 4;
}

// Assembly:
pushq %rax
leaq 0x4(%rsp), %rax
movl %esi, (%rax)
movq (%rdi), %rdi
pushq $0x4
popq %rdx
movq %rax, %rsi
callq 0x2691f
xorl %ecx, %ecx
cmpq $0x4, %rax
sete %cl
leal (%rcx,%rcx,4), %eax
decl %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: int32_get_blk
int int32_get_blk(cram_block *b, int32_t *val) {
    if (b->uncomp_size - BLOCK_SIZE(b) < 4)
	return -1;

    *val =
	 b->data[b->byte  ]        |
	(b->data[b->byte+1] <<  8) |
	(b->data[b->byte+2] << 16) |
	(b->data[b->byte+3] << 24);
    BLOCK_SIZE(b) += 4;
    return 4;
}

// Assembly:
movslq 0x14(%rdi), %rcx
movq 0x30(%rdi), %rax
subq %rax, %rcx
cmpq $0x4, %rcx
jae 0x2789a
pushq $-0x1
popq %rax
retq
movq 0x20(%rdi), %rcx
movl (%rcx,%rax), %ecx
movl %ecx, (%rsi)
addq $0x4, %rax
movq %rax, 0x30(%rdi)
pushq $0x4
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_new_block
cram_block *cram_new_block(enum cram_content_type content_type,
			   int content_id) {
    cram_block *b = malloc(sizeof(*b));
    if (!b)
	return NULL;
    b->method = b->orig_method = RAW;
    b->content_type = content_type;
    b->content_id = content_id;
    b->comp_size = 0;
    b->uncomp_size = 0;
    b->data = NULL;
    b->alloc = 0;
    b->byte = 0;
    b->bit = 7; // MSB

    return b;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
pushq $0x40
popq %rdi
callq 0x46f0
testq %rax, %rax
je 0x27b44
andq $0x0, (%rax)
movl %ebp, 0x8(%rax)
movl %ebx, 0xc(%rax)
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
andq $0x0, 0x30(%rax)
movl $0x7, 0x38(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_block_size
uint32_t cram_block_size(cram_block *b) {
    unsigned char dat[100], *cp = dat;;
    uint32_t sz;

    *cp++ = b->method;
    *cp++ = b->content_type;
    cp += itf8_put(cp, b->content_id);
    cp += itf8_put(cp, b->comp_size);
    cp += itf8_put(cp, b->uncomp_size);

    sz = cp-dat + 4;
    sz += b->method == RAW ? b->uncomp_size : b->comp_size;

    return sz;
}

// Assembly:
movl 0xc(%rdi), %esi
movabsq $0x1, %rax
movabsq $0x5, %rdx
movq %rax, %rcx
cmpl $0x80, %esi
jb 0x27d38
cmpl $0x4000, %esi           # imm = 0x4000
jae 0x27d17
movabsq $0x2, %rcx
jmp 0x27d38
cmpl $0x200000, %esi         # imm = 0x200000
jae 0x27d2b
movabsq $0x3, %rcx
jmp 0x27d38
cmpl $0x10000000, %esi       # imm = 0x10000000
movq %rdx, %rcx
sbbq $0x0, %rcx
movl 0x10(%rdi), %r8d
movq %rax, %rsi
cmpl $0x80, %r8d
jb 0x27d80
cmpl $0x4000, %r8d           # imm = 0x4000
jae 0x27d5d
movabsq $0x2, %rsi
jmp 0x27d80
cmpl $0x200000, %r8d         # imm = 0x200000
jae 0x27d72
movabsq $0x3, %rsi
jmp 0x27d80
cmpl $0x10000000, %r8d       # imm = 0x10000000
movq %rdx, %rsi
sbbq $0x0, %rsi
movl (%rdi), %r9d
leaq 0x10(%rdi), %r8
movl 0x14(%rdi), %r10d
addq $0x14, %rdi
cmpl $0x80, %r10d
jb 0x27dd0
cmpl $0x4000, %r10d          # imm = 0x4000
jae 0x27dad
movabsq $0x2, %rax
jmp 0x27dd0
cmpl $0x200000, %r10d        # imm = 0x200000
jae 0x27dc2
movabsq $0x3, %rax
jmp 0x27dd0
cmpl $0x10000000, %r10d      # imm = 0x10000000
sbbq $0x0, %rdx
movq %rdx, %rax
leaq -0x68(%rsp), %rdx
addl %edx, %ecx
addl %esi, %eax
addl %ecx, %eax
testl %r9d, %r9d
cmoveq %rdi, %r8
movl (%r8), %ecx
subl %edx, %eax
addl %ecx, %eax
addl $0x6, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_free_block
void cram_free_block(cram_block *b) {
    if (!b)
	return;
    if (b->data)
	free(b->data);
    free(b);
}

// Assembly:
testq %rdi, %rdi
je 0x28142
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
callq 0x4600
movq %rbx, %rdi
popq %rbx
jmp 0x4600
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_new_metrics
cram_metrics *cram_new_metrics(void) {
    cram_metrics *m = calloc(1, sizeof(*m));
    if (!m)
	return NULL;
    m->trial = NTRIALS-1;
    m->next_trial = TRIAL_SPAN;
    m->method = RAW;
    m->strat = 0;
    m->revised_method = 0;

    return m;
}

// Assembly:
pushq %rax
pushq $0x1
popq %rdi
pushq $0x78
popq %rsi
callq 0x4370
testq %rax, %rax
je 0x28d74
movabsq $0x3200000002, %rcx     # imm = 0x3200000002
movq %rcx, (%rax)
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: refs_free
void refs_free(refs_t *r) {
    RP("refs_free()\n");

    if (--r->count > 0)
	return;

    if (!r)
	return;

    if (r->pool)
	string_pool_destroy(r->pool);

    if (r->h_meta) {
	khint_t k;

	for (k = kh_begin(r->h_meta); k != kh_end(r->h_meta); k++) {
	    ref_entry *e;

	    if (!kh_exist(r->h_meta, k))
		continue;
	    if (!(e = kh_val(r->h_meta, k)))
		continue;
	    ref_entry_free_seq(e);
	    free(e);
	}

	kh_destroy(refs, r->h_meta);
    }
    
    if (r->ref_id)
	free(r->ref_id);

    if (r->fp)
	bgzf_close(r->fp);

    pthread_mutex_destroy(&r->lock);

    free(r);
}

// Assembly:
movl 0x30(%rdi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x30(%rdi)
cmpl $0x2, %eax
setge %al
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x28e1c
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x28dc5
callq 0x3478d
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0x28e40
xorl %ebp, %ebp
xorl %r12d, %r12d
cmpl (%r14), %r12d
je 0x28e1d
movq 0x10(%r14), %rax
movl %r12d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x28e14
movq 0x20(%r14), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %r15
testq %r15, %r15
je 0x28e14
movq %r15, %rdi
callq 0x28e70
movq %r15, %rdi
callq 0x4600
movq 0x8(%rbx), %r14
incl %r12d
addl $0x2, %ebp
jmp 0x28dd3
retq
movq 0x18(%r14), %rdi
callq 0x4600
movq 0x10(%r14), %rdi
callq 0x4600
movq 0x20(%r14), %rdi
callq 0x4600
movq %r14, %rdi
callq 0x4600
movq 0x10(%rbx), %rdi
callq 0x4600
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x28e57
callq 0x377bc
leaq 0x38(%rbx), %rdi
callq 0x45d0
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4600
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: ref_entry_free_seq
static void ref_entry_free_seq(ref_entry *e) {
    if (e->mf)
	mfclose(e->mf);
    if (e->seq && !e->mf)
	free(e->seq);

    e->seq = NULL;
    e->mf = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x28e85
callq 0x2f94f
leaq 0x30(%rbx), %r14
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x28e9e
cmpq $0x0, 0x38(%rbx)
jne 0x28e9e
callq 0x4600
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
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: refs2id
int refs2id(refs_t *r, SAM_hdr *h) {
    int i;

    if (r->ref_id)
	free(r->ref_id);
    if (r->last)
	r->last = NULL;

    r->ref_id = calloc(h->nref, sizeof(*r->ref_id));
    if (!r->ref_id)
	return -1;

    r->nref = h->nref;
    for (i = 0; i < h->nref; i++) {
	khint_t k = kh_get(refs, r->h_meta, h->ref[i].name);
	if (k != kh_end(r->h_meta)) {
	    r->ref_id[i] = kh_val(r->h_meta, k);
	} else {
	    fprintf(stderr, "Unable to find ref name '%s'\n",
		    h->ref[i].name);
	}
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
movq %rdi, %r14
movq 0x10(%rdi), %rdi
callq 0x4600
cmpq $0x0, 0x60(%r14)
je 0x28ed4
andq $0x0, 0x60(%r14)
movq (%rsp), %rax
movl 0x38(%rax), %r12d
movslq %r12d, %rdi
pushq $0x8
popq %rsi
callq 0x4370
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x28f65
movl %r12d, 0x18(%r14)
xorl %r15d, %r15d
xorl %ebx, %ebx
movslq %r12d, %rax
cmpq %rax, %rbx
jge 0x28f61
movq 0x8(%r14), %rbp
movq (%rsp), %rax
movq 0x40(%rax), %rax
movq (%rax,%r15,4), %r13
movq %rbp, %rdi
movq %r13, %rsi
callq 0x28f77
cmpl (%rbp), %eax
je 0x28f3c
movq 0x20(%rbp), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rax
movq 0x10(%r14), %rcx
movq %rax, (%rcx,%r15)
incq %rbx
addq $0x8, %r15
jmp 0x28ef9
movq 0x2e08d(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
leaq 0x1cbc4(%rip), %rsi     # 0x45b11
movq %r13, %rdx
xorl %eax, %eax
callq 0x4770
movq (%rsp), %rax
movl 0x38(%rax), %r12d
jmp 0x28f33
xorl %eax, %eax
jmp 0x28f68
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_set_header
int cram_set_header(cram_fd *fd, SAM_hdr *hdr) {
    if (fd->header)
	sam_hdr_free(fd->header);
    fd->header = hdr;
    return refs_from_header(fd->refs, fd, hdr);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x29050
callq 0x33a02
movq %rbx, 0x18(%r14)
movq 0x48(%r14), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x29064
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: expand_cache_path
void expand_cache_path(char *path, char *dir, char *fn) {
    char *cp;

    while ((cp = strchr(dir, '%'))) {
	strncpy(path, dir, cp-dir);
	path += cp-dir;

	if (*++cp == 's') {
	    strcpy(path, fn);
	    path += strlen(fn);
	    fn += strlen(fn);
	    cp++;
	} else if (*cp >= '0' && *cp <= '9') {
	    char *endp;
	    long l;

	    l = strtol(cp, &endp, 10);
	    l = MIN(l, strlen(fn));
	    if (*endp == 's') {
		strncpy(path, fn, l);
		path += l;
		fn += l;
		*path = 0;
		cp = endp+1;
	    } else {
		*path++ = '%';
		*path++ = *cp++;
	    }
	} else {
	    *path++ = '%';
	    *path++ = *cp++;
	}
	dir = cp;
    }
    strcpy(path, dir);
    path += strlen(dir);
    if (*fn && path[-1] != '/')
	*path++ = '/';
    strcpy(path, fn);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r13
pushq $0x25
popq %rbp
movq %r15, %rdi
movl %ebp, %esi
callq 0x41e0
testq %rax, %rax
je 0x292dd
movq %rax, %r14
movq %rax, %r12
subq %r15, %r12
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x42c0
addq %r13, %r12
movb 0x1(%r14), %al
cmpb $0x73, %al
je 0x29265
addb $-0x30, %al
cmpb $0x9, %al
jbe 0x2928a
movb $0x25, (%r12)
movq %r14, %r15
addq $0x2, %r15
movb 0x1(%r14), %al
movb %al, 0x1(%r12)
addq $0x2, %r12
movq %r12, %r13
jmp 0x2920c
movq %r12, %rdi
movq %rbx, %rsi
callq 0x44e0
movq %rbx, %rdi
callq 0x4210
addq %rax, %r12
addq %rax, %rbx
addq $0x2, %r14
movq %r12, %r13
movq %r14, %r15
jmp 0x2920c
leaq 0x1(%r14), %rdi
movq %rsp, %rsi
pushq $0xa
popq %rdx
callq 0x4760
movq %rax, %r15
movq (%rsp), %rax
cmpb $0x73, (%rax)
jne 0x29247
movq %rbx, %rdi
callq 0x4210
movq %rax, %r14
cmpq %rax, %r15
cmovbq %r15, %r14
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x42c0
leaq (%r12,%r14), %r13
addq %r14, %rbx
movb $0x0, (%r12,%r14)
movq (%rsp), %r15
incq %r15
jmp 0x2920c
movq %r13, %rdi
movq %r15, %rsi
callq 0x44e0
movq %r15, %rdi
callq 0x4210
addq %r13, %rax
cmpb $0x0, (%rbx)
je 0x29304
cmpb $0x2f, -0x1(%rax)
je 0x29304
movb $0x2f, (%rax)
incq %rax
movq %rax, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x44e0
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: mkdir_prefix
void mkdir_prefix(char *path, int mode) {
    char *cp = strrchr(path, '/');
    if (!cp)
	return;

    *cp = 0;
    if (is_directory(path)) {
	*cp = '/';
	return;
    }

    if (mkdir(path, mode) == 0) {
	chmod(path, mode);
	*cp = '/';
	return;
    }

    mkdir_prefix(path, mode);
    mkdir(path, mode);
    chmod(path, mode);
    *cp = '/';
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
pushq $0x2f
popq %rsi
callq 0x45a0
testq %rax, %rax
je 0x29376
movq %rax, %r15
movb $0x0, (%rax)
movq %r14, %rdi
callq 0x2f4bc
testl %eax, %eax
jne 0x29372
movq %r14, %rdi
movl %ebx, %esi
callq 0x4240
testl %eax, %eax
je 0x29368
movq %r14, %rdi
movl %ebx, %esi
callq 0x2931d
movq %r14, %rdi
movl %ebx, %esi
callq 0x4240
movq %r14, %rdi
movl %ebx, %esi
callq 0x44b0
movb $0x2f, (%r15)
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_ref_incr_locked
static void cram_ref_incr_locked(refs_t *r, int id) {
    RP("%d INC REF %d, %d %p\n", gettid(), id, (int)(id>=0?r->ref_id[id]->count+1:-999), id>=0?r->ref_id[id]->seq:(char *)1);

    if (id < 0 || !r->ref_id[id]->seq)
	return;

    if (r->last_id == id)
	r->last_id = -1;

    ++r->ref_id[id]->count;
}

// Assembly:
testl %esi, %esi
js 0x293cb
movq 0x10(%rdi), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x30(%rax)
je 0x293cb
cmpl %esi, 0x68(%rdi)
jne 0x293c7
orl $-0x1, 0x68(%rdi)
incq 0x28(%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_ref_load
ref_entry *cram_ref_load(refs_t *r, int id, int is_md5) {
    ref_entry *e = r->ref_id[id];
    int start = 1, end = e->length;
    char *seq;

    if (e->seq) {
	return e;
    }

    assert(e->count == 0);

    if (r->last) {
#ifdef REF_DEBUG
	int idx = 0;
	for (idx = 0; idx < r->nref; idx++)
	    if (r->last == r->ref_id[idx])
		break;
	RP("%d cram_ref_load DECR %d\n", gettid(), idx);
#endif
	assert(r->last->count > 0);
	if (--r->last->count <= 0) {
	    RP("%d FREE REF %d (%p)\n", gettid(), id, r->ref_id[id]->seq);
	    if (r->last->seq)
		ref_entry_free_seq(r->last);
	}
    }

    /* Open file if it's not already the current open reference */
    if (strcmp(r->fn, e->fn) || r->fp == NULL) {
	if (r->fp)
	    if (bgzf_close(r->fp) != 0)
		return NULL;
	r->fn = e->fn;
	if (!(r->fp = bgzf_open_ref(r->fn, "r", is_md5)))
	    return NULL;
    }

    RP("%d Loading ref %d (%d..%d)\n", gettid(), id, start, end);

    if (!(seq = load_ref_portion(r->fp, e, start, end))) {
	return NULL;
    }

    RP("%d Loaded ref %d (%d..%d) = %p\n", gettid(), id, start, end, seq);

    RP("%d INC REF %d, %d\n", gettid(), id, (int)(e->count+1));
    e->seq = seq;
    e->mf = NULL;
    e->count++;

    /*
     * Also keep track of last used ref so incr/decr loops on the same
     * sequence don't cause load/free loops.
     */
    RP("%d cram_ref_load INCR %d => %d\n", gettid(), id, e->count+1);
    r->last = e;
    e->count++; 

    return e;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x10(%rdi), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rbx
cmpq $0x0, 0x30(%rbx)
jne 0x29579
cmpq $0x0, 0x28(%rbx)
jne 0x29585
movl %edx, %r15d
movq %rdi, %r14
movl 0x10(%rbx), %ebp
movq 0x60(%rdi), %rdi
testq %rdi, %rdi
je 0x294fe
movq 0x28(%rdi), %rax
testq %rax, %rax
jle 0x295a4
leaq -0x1(%rax), %rcx
movq %rcx, 0x28(%rdi)
cmpq $0x1, %rax
jne 0x294fe
cmpq $0x0, 0x30(%rdi)
je 0x294fe
callq 0x28e70
movq 0x20(%r14), %rdi
movq 0x8(%rbx), %r12
movq %r12, %rsi
callq 0x4750
movq 0x28(%r14), %rdi
testl %eax, %eax
je 0x2952a
testq %rdi, %rdi
je 0x2952f
callq 0x377bc
testl %eax, %eax
jne 0x29577
movq 0x8(%rbx), %r12
jmp 0x2952f
testq %rdi, %rdi
jne 0x2954a
movq %r12, 0x20(%r14)
movq %r12, %rdi
movl %r15d, %esi
callq 0x295c3
movq %rax, %rdi
movq %rax, 0x28(%r14)
testq %rax, %rax
je 0x29577
pushq $0x1
popq %rdx
movq %rbx, %rsi
movl %ebp, %ecx
callq 0x29696
testq %rax, %rax
je 0x29577
movq %rax, 0x30(%rbx)
andq $0x0, 0x38(%rbx)
movq 0x28(%rbx), %rax
movq %rbx, 0x60(%r14)
addq $0x2, %rax
movq %rax, 0x28(%rbx)
jmp 0x29579
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c5a3(%rip), %rdi     # 0x45b2f
leaq 0x1c40b(%rip), %rsi     # 0x4599e
leaq 0x1c5a3(%rip), %rcx     # 0x45b3d
movl $0x9d8, %edx            # imm = 0x9D8
callq 0x4360
leaq 0x1c5bf(%rip), %rdi     # 0x45b6a
leaq 0x1c3ec(%rip), %rsi     # 0x4599e
leaq 0x1c584(%rip), %rcx     # 0x45b3d
movl $0x9e2, %edx            # imm = 0x9E2
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: bgzf_open_ref
static BGZF *bgzf_open_ref(char *fn, char *mode, int is_md5) {
    BGZF *fp;

    if (!is_md5) {
	char fai_file[PATH_MAX];

	snprintf(fai_file, PATH_MAX, "%s.fai", fn);
	if (access(fai_file, R_OK) != 0)
	    if (fai_build(fn) != 0)
		return NULL;
    }

    if (!(fp = bgzf_open(fn, mode))) {
	perror(fn);
	return NULL;
    }

    if (fp->is_compressed == 1 && bgzf_index_load(fp, fn, ".gzi") < 0) {
	fprintf(stderr, "Unable to load .gzi index '%s.gzi'\n", fn);
	bgzf_close(fp);
	return NULL;
    }

    return fp;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdi, %rbx
testl %esi, %esi
je 0x2963d
leaq 0x1b2da(%rip), %rsi     # 0x448b5
movq %rbx, %rdi
callq 0x35ed4
testq %rax, %rax
je 0x2967d
movq %rax, %r14
movl $0x60000000, %eax       # imm = 0x60000000
andl (%r14), %eax
cmpl $0x20000000, %eax       # imm = 0x20000000
jne 0x29688
leaq 0x1c801(%rip), %rdx     # 0x45e0a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x380f4
testl %eax, %eax
jns 0x29688
movq 0x2d9b1(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
leaq 0x1c7e6(%rip), %rsi     # 0x45e0f
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4770
movq %r14, %rdi
callq 0x377bc
jmp 0x29685
leaq 0x1c7bf(%rip), %rdx     # 0x45e03
movq %rsp, %r14
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4880
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x48f0
testl %eax, %eax
je 0x295d4
movq %rbx, %rdi
callq 0x39056
testl %eax, %eax
jne 0x29685
jmp 0x295d4
movq %rbx, %rdi
callq 0x4440
xorl %r14d, %r14d
movq %r14, %rax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_load_reference
int cram_load_reference(cram_fd *fd, char *fn) {
    int ret = 0;

    if (fn) {
	fd->refs = refs_load_fai(fd->refs, fn,
				 !(fd->embed_ref && fd->mode == 'r'));
	fn = fd->refs ? fd->refs->fn : NULL;
	if (!fn)
	    ret = -1;
	sanitise_SQ_lines(fd);
    }
    fd->ref_fn = fn;

    if ((!fd->refs || (fd->refs->nref == 0 && !fn)) && fd->header) {
	if (fd->refs)
	    refs_free(fd->refs);
	if (!(fd->refs = refs_create()))
	    return -1;
	if (-1 == refs_from_header(fd->refs, fd, fd->header))
	    return -1;
    }

    if (fd->header)
	if (-1 == refs2id(fd->refs, fd->header))
	    return -1;

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x2a2a7
movq 0x48(%rbx), %rdi
cmpl $0x0, 0x208(%rbx)
je 0x2a2af
xorl %edx, %edx
cmpl $0x72, 0x8(%rbx)
setne %dl
jmp 0x2a2b2
xorl %r15d, %r15d
xorl %r14d, %r14d
jmp 0x2a2db
pushq $0x1
popq %rdx
callq 0x2a358
movq %rax, 0x48(%rbx)
xorl %r14d, %r14d
testq %rax, %rax
je 0x2a2c9
movq 0x20(%rax), %r15
jmp 0x2a2cc
xorl %r15d, %r15d
cmpq $0x1, %r15
sbbl %r14d, %r14d
movq %rbx, %rdi
callq 0x2a6ec
movq %r15, 0x70(%rbx)
movq 0x48(%rbx), %rdi
pushq $-0x1
popq %rbp
testq %rdi, %rdi
je 0x2a308
testq %r15, %r15
jne 0x2a331
cmpl $0x0, 0x18(%rdi)
jne 0x2a331
cmpq $0x0, 0x18(%rbx)
je 0x2a331
leaq 0x18(%rbx), %r15
callq 0x28d94
jmp 0x2a313
cmpq $0x0, 0x18(%rbx)
je 0x2a331
leaq 0x18(%rbx), %r15
callq 0x2a813
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x2a34b
movq (%r15), %rsi
movq %rax, %rdi
callq 0x29064
cmpl $-0x1, %eax
je 0x2a34b
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0x2a348
movq 0x48(%rbx), %rdi
callq 0x28ead
cmpl $-0x1, %eax
je 0x2a34b
movl %r14d, %ebp
movl %ebp, %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/cram_io.c
// Function: sanitise_SQ_lines
static void sanitise_SQ_lines(cram_fd *fd) {
    int i;

    if (!fd->header)
	return;

    if (!fd->refs || !fd->refs->h_meta)
	return;

    for (i = 0; i < fd->header->nref; i++) {
	char *name = fd->header->ref[i].name;
	khint_t k = kh_get(refs, fd->refs->h_meta, name);
	ref_entry *r;

	// We may have @SQ lines which have no known .fai, but do not
	// in themselves pose a problem because they are unused in the file.
	if (k == kh_end(fd->refs->h_meta))
	    continue;

	if (!(r = (ref_entry *)kh_val(fd->refs->h_meta, k)))
	    continue;

	if (r->length && r->length != fd->header->ref[i].len) {
	    assert(strcmp(r->name, fd->header->ref[i].name) == 0);

	    // Should we also check MD5sums here to ensure the correct
	    // reference was given?
	    fprintf(stderr, "WARNING: Header @SQ length mismatch for "
		    "ref %s, %d vs %d\n",
		    r->name, fd->header->ref[i].len, (int)r->length);

	    // Fixing the parsed @SQ header will make MD:Z: strings work
	    // and also stop it producing N for the sequence.
	    fd->header->ref[i].len = r->length;
	}
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movq 0x18(%rdi), %r13
testq %r13, %r13
je 0x2a7e5
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rax
testq %rax, %rax
je 0x2a7e5
cmpq $0x0, 0x8(%rax)
je 0x2a7e5
pushq $0x8
popq %r14
xorl %ebp, %ebp
movslq 0x38(%r13), %rax
cmpq %rax, %rbp
jge 0x2a7e5
movq 0x40(%r13), %rbx
movq -0x8(%rbx,%r14), %r15
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x28f77
cmpl (%r12), %eax
je 0x2a786
movq 0x20(%r12), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %r12
testq %r12, %r12
je 0x2a786
movq 0x10(%r12), %rax
testq %rax, %rax
je 0x2a786
movl (%rbx,%r14), %ecx
cmpq %rcx, %rax
jne 0x2a78f
incq %rbp
addq $0x20, %r14
jmp 0x2a72f
movq %rcx, %r13
movq %rax, 0x10(%rsp)
movq (%r12), %rdi
movq %rdi, %rbx
movq %r15, %rsi
callq 0x4750
testl %eax, %eax
jne 0x2a7f4
movq 0x2c81f(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
leaq 0x1b8f1(%rip), %rsi     # 0x460ac
movq %rbx, %rdx
movl %r13d, %ecx
movq 0x10(%rsp), %r8
xorl %eax, %eax
callq 0x4770
movl 0x10(%r12), %eax
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %r13
movq 0x40(%r13), %rcx
movl %eax, (%rcx,%r14)
jmp 0x2a786
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b861(%rip), %rdi     # 0x4605c
leaq 0x1b19c(%rip), %rsi     # 0x4599e
leaq 0x1b881(%rip), %rcx     # 0x4608a
movl $0x790, %edx            # imm = 0x790
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: refs_create
static refs_t *refs_create(void) {
    refs_t *r = calloc(1, sizeof(*r));

    RP("refs_create()\n");

    if (!r)
	return NULL;

    if (!(r->pool = string_pool_create(8192)))
	goto err;

    r->ref_id = NULL; // see refs2id() to populate.
    r->count = 1;
    r->last = NULL;
    r->last_id = -1;

    if (!(r->h_meta = kh_init(refs)))
	goto err;

    pthread_mutex_init(&r->lock, NULL);

    return r;

 err:
    refs_free(r);
    return NULL;
}

// Assembly:
pushq %rbx
pushq $0x1
popq %rdi
pushq $0x70
popq %rsi
callq 0x4370
testq %rax, %rax
je 0x2a870
movq %rax, %rbx
movl $0x2000, %edi           # imm = 0x2000
callq 0x34760
movq %rax, (%rbx)
testq %rax, %rax
je 0x2a868
movl $0x1, 0x30(%rbx)
orl $-0x1, 0x68(%rbx)
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x4370
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x2a868
movq %rbx, %rdi
addq $0x38, %rdi
xorl %esi, %esi
callq 0x47c0
jmp 0x2a872
movq %rbx, %rdi
callq 0x28d94
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_new_container
cram_container *cram_new_container(int nrec, int nslice) {
    cram_container *c = calloc(1, sizeof(*c));
    enum cram_DS_ID id;

    if (!c)
	return NULL;

    c->curr_ref = -2;

    c->max_c_rec = nrec * nslice;
    c->curr_c_rec = 0;

    c->max_rec = nrec;
    c->record_counter = 0;
    c->num_bases = 0;

    c->max_slice = nslice;
    c->curr_slice = 0;

    c->pos_sorted = 1;
    c->max_apos   = 0;
    c->multi_seq  = 0;

    c->bams = NULL;

    if (!(c->slices = (cram_slice **)calloc(nslice, sizeof(cram_slice *))))
	goto err;
    c->slice = NULL;

    if (!(c->comp_hdr = cram_new_compression_header()))
	goto err;
    c->comp_hdr_block = NULL;

    for (id = DS_RN; id < DS_TN; id++)
	if (!(c->stats[id] = cram_stats_create())) goto err;
    
    //c->aux_B_stats = cram_stats_create();

    if (!(c->tags_used = kh_init(s_i2i)))
	goto err;
    c->refs_used = 0;

    return c;

 err:
    if (c) {
	if (c->slices)
	    free(c->slices);
	free(c);
    }
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movl %edi, %r14d
pushq $0x1
popq %rdi
movl $0x250, %esi            # imm = 0x250
callq 0x4370
testq %rax, %rax
je 0x2a930
movq %rax, %rbx
movl $0xfffffffe, 0x6c(%rax) # imm = 0xFFFFFFFE
movl %ebp, %eax
imull %r14d, %eax
movl %eax, 0x60(%rbx)
movl %r14d, 0x58(%rbx)
movl %ebp, 0x50(%rbx)
movl $0x1, 0x88(%rbx)
movslq %ebp, %rdi
pushq $0x8
popq %rsi
callq 0x4370
movq %rax, %r14
movq %rax, 0x78(%rbx)
testq %rax, %rax
je 0x2a920
callq 0x2a940
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0x2a920
pushq $0x23
popq %r15
cmpq $0x3f, %r15
je 0x2a8ff
callq 0x2ecb4
movq %rax, (%rbx,%r15,8)
incq %r15
testq %rax, %rax
jne 0x2a8e6
jmp 0x2a920
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x4370
movq %rax, 0x238(%rbx)
testq %rax, %rax
je 0x2a920
andq $0x0, 0x240(%rbx)
jmp 0x2a932
movq %r14, %rdi
callq 0x4600
movq %rbx, %rdi
callq 0x4600
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_new_compression_header
cram_block_compression_hdr *cram_new_compression_header(void) {
    cram_block_compression_hdr *hdr = calloc(1, sizeof(*hdr));
    if (!hdr)
	return NULL;

    if (!(hdr->TD_blk = cram_new_block(CORE, 0))) {
	free(hdr);
	return NULL;
    }

    if (!(hdr->TD_hash = kh_init(m_s2i))) {
	cram_free_block(hdr->TD_blk);
	free(hdr);
	return NULL;
    }

    if (!(hdr->TD_keys = string_pool_create(8192))) {
	kh_destroy(m_s2i, hdr->TD_hash);
	cram_free_block(hdr->TD_blk);
	free(hdr);
	return NULL;
    }

    return hdr;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
pushq $0x1
popq %rdi
movl $0x418, %esi            # imm = 0x418
callq 0x4370
testq %rax, %rax
je 0x2a9ac
movq %rax, %rbx
pushq $0x5
popq %rdi
xorl %esi, %esi
callq 0x27b0e
movq %rax, 0x50(%rbx)
testq %rax, %rax
je 0x2a9a4
movq %rax, %r14
callq 0x2c289
movq %rax, 0x68(%rbx)
testq %rax, %rax
je 0x2a99c
movq %rax, %r15
movl $0x2000, %edi           # imm = 0x2000
callq 0x34760
movq %rax, 0x70(%rbx)
testq %rax, %rax
jne 0x2a9ae
movq %r15, %rdi
callq 0x2c294
movq %r14, %rdi
callq 0x28127
movq %rbx, %rdi
callq 0x4600
xorl %ebx, %ebx
movq %rbx, %rax
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_free_container
void cram_free_container(cram_container *c) {
    enum cram_DS_ID id;
    int i;

    if (!c)
	return;

    if (c->refs_used)
	free(c->refs_used);

    if (c->landmark)
	free(c->landmark);

    if (c->comp_hdr)
	cram_free_compression_header(c->comp_hdr);

    if (c->comp_hdr_block)
	cram_free_block(c->comp_hdr_block);

    if (c->slices) {
	for (i = 0; i < c->max_slice; i++)
	    if (c->slices[i])
		cram_free_slice(c->slices[i]);
	free(c->slices);
    }

    for (id = DS_RN; id < DS_TN; id++)
	if (c->stats[id]) cram_stats_free(c->stats[id]);

    //if (c->aux_B_stats) cram_stats_free(c->aux_B_stats);
    
    if (c->tags_used) kh_destroy(s_i2i, c->tags_used);

    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x2aa82
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x240(%rdi), %rdi
callq 0x4600
movq 0x30(%rbx), %rdi
callq 0x4600
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x2a9ea
callq 0x2aa83
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x2a9f8
callq 0x28127
cmpq $0x0, 0x78(%rbx)
je 0x2aa27
xorl %r14d, %r14d
movslq 0x50(%rbx), %rax
movq 0x78(%rbx), %rdi
cmpq %rax, %r14
jge 0x2aa22
movq (%rdi,%r14,8), %rdi
testq %rdi, %rdi
je 0x2aa1d
callq 0x2ab94
incq %r14
jmp 0x2aa02
callq 0x4600
pushq $0x23
popq %r14
cmpq $0x3f, %r14
je 0x2aa44
movq (%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x2aa3f
callq 0x2f230
incq %r14
jmp 0x2aa2b
movq 0x238(%rbx), %r14
testq %r14, %r14
je 0x2aa73
movq 0x18(%r14), %rdi
callq 0x4600
movq 0x10(%r14), %rdi
callq 0x4600
movq 0x20(%r14), %rdi
callq 0x4600
movq %r14, %rdi
callq 0x4600
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4600
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_free_compression_header
void cram_free_compression_header(cram_block_compression_hdr *hdr) {
    int i;

    if (hdr->landmark)
	free(hdr->landmark);

    if (hdr->preservation_map)
	kh_destroy(map, hdr->preservation_map);

    for (i = 0; i < CRAM_MAP_HASH; i++) {
	cram_map *m, *m2;
	for (m = hdr->rec_encoding_map[i]; m; m = m2) {
	    m2 = m->next;
	    if (m->codec)
		m->codec->free(m->codec);
	    free(m);
	}
    }

    for (i = 0; i < CRAM_MAP_HASH; i++) {
	cram_map *m, *m2;
	for (m = hdr->tag_encoding_map[i]; m; m = m2) {
	    m2 = m->next;
	    if (m->codec)
		m->codec->free(m->codec);
	    free(m);
	}
    }

    for (i = 0; i < DS_END; i++) {
	if (hdr->codecs[i])
	    hdr->codecs[i]->free(hdr->codecs[i]);
    }

    if (hdr->TL)
	free(hdr->TL);
    if (hdr->TD_blk)
	cram_free_block(hdr->TD_blk);
    if (hdr->TD_hash)
	kh_destroy(m_s2i, hdr->TD_hash);
    if (hdr->TD_keys)
	string_pool_destroy(hdr->TD_keys);

    free(hdr);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x4600
movq 0x78(%rbx), %r14
testq %r14, %r14
je 0x2aac3
movq 0x18(%r14), %rdi
callq 0x4600
movq 0x10(%r14), %rdi
callq 0x4600
movq 0x20(%r14), %rdi
callq 0x4600
movq %r14, %rdi
callq 0x4600
xorl %r15d, %r15d
cmpq $0x20, %r15
je 0x2aafb
movq 0x80(%rbx,%r15,8), %r14
testq %r14, %r14
je 0x2aaf6
movq 0x10(%r14), %rdi
movq 0x18(%r14), %r12
testq %rdi, %rdi
je 0x2aae9
callq *0x10(%rdi)
movq %r14, %rdi
callq 0x4600
movq %r12, %r14
jmp 0x2aad4
incq %r15
jmp 0x2aac6
xorl %r15d, %r15d
cmpq $0x20, %r15
je 0x2ab33
movq 0x180(%rbx,%r15,8), %r14
testq %r14, %r14
je 0x2ab2e
movq 0x10(%r14), %rdi
movq 0x18(%r14), %r12
testq %rdi, %rdi
je 0x2ab21
callq *0x10(%rdi)
movq %r14, %rdi
callq 0x4600
movq %r12, %r14
jmp 0x2ab0c
incq %r15
jmp 0x2aafe
pushq $0x50
popq %r14
cmpq $0x7f, %r14
je 0x2ab4e
movq (%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x2ab49
callq *0x10(%rdi)
incq %r14
jmp 0x2ab37
movq 0x60(%rbx), %rdi
callq 0x4600
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x2ab65
callq 0x28127
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x2ab73
callq 0x2c294
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x2ab81
callq 0x3478d
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4600
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_free_slice
void cram_free_slice(cram_slice *s) {
    if (!s)
	return;

    if (s->hdr_block)
	cram_free_block(s->hdr_block);

    if (s->block) {
	int i;

	if (s->hdr) {
	    for (i = 0; i < s->hdr->num_blocks; i++) {
		cram_free_block(s->block[i]);
	    }
	}
	free(s->block);
    }

    if (s->block_by_id)
	free(s->block_by_id);

    if (s->hdr)
	cram_free_slice_header(s->hdr);

    if (s->seqs_blk)
	cram_free_block(s->seqs_blk);

    if (s->qual_blk)
	cram_free_block(s->qual_blk);

    if (s->name_blk)
	cram_free_block(s->name_blk);

    if (s->aux_blk)
	cram_free_block(s->aux_blk);

    if (s->aux_OQ_blk)
	cram_free_block(s->aux_OQ_blk);

    if (s->aux_BQ_blk)
	cram_free_block(s->aux_BQ_blk);

    if (s->aux_FZ_blk)
	cram_free_block(s->aux_FZ_blk);

    if (s->aux_oq_blk)
	cram_free_block(s->aux_oq_blk);

    if (s->aux_os_blk)
	cram_free_block(s->aux_os_blk);

    if (s->aux_oz_blk)
	cram_free_block(s->aux_oz_blk);

    if (s->base_blk)
	cram_free_block(s->base_blk);

    if (s->soft_blk)
	cram_free_block(s->soft_blk);

    if (s->cigar)
	free(s->cigar);

    if (s->crecs)
	free(s->crecs);

    if (s->features)
	free(s->features);

    if (s->TN)
	free(s->TN);

    if (s->pair_keys)
	string_pool_destroy(s->pair_keys);

    if (s->pair[0])
	kh_destroy(m_s2i, s->pair[0]);
    if (s->pair[1])
	kh_destroy(m_s2i, s->pair[1]);

    free(s);
}

// Assembly:
testq %rdi, %rdi
je 0x2ad25
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x2abb2
callq 0x28127
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x2abe9
movq (%rbx), %rax
testq %rax, %rax
je 0x2abe4
xorl %r14d, %r14d
movslq 0x20(%rax), %rax
movq 0x10(%rbx), %rdi
cmpq %rax, %r14
jge 0x2abe4
movq (%rdi,%r14,8), %rdi
callq 0x28127
incq %r14
movq (%rbx), %rax
jmp 0x2abc6
callq 0x4600
movq 0x18(%rbx), %rdi
callq 0x4600
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x2abff
callq 0x2c2c2
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x2ac0d
callq 0x28127
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x2ac1b
callq 0x28127
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x2ac29
callq 0x28127
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x2ac3a
callq 0x28127
movq 0x90(%rbx), %rdi
testq %rdi, %rdi
je 0x2ac4b
callq 0x28127
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x2ac5c
callq 0x28127
movq 0xb0(%rbx), %rdi
testq %rdi, %rdi
je 0x2ac6d
callq 0x28127
movq 0xb8(%rbx), %rdi
testq %rdi, %rdi
je 0x2ac7e
callq 0x28127
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x2ac8f
callq 0x28127
movq 0xc8(%rbx), %rdi
testq %rdi, %rdi
je 0x2aca0
callq 0x28127
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x2acae
callq 0x28127
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x2acbf
callq 0x28127
movq 0x30(%rbx), %rdi
callq 0x4600
movq 0x28(%rbx), %rdi
callq 0x4600
movq 0x40(%rbx), %rdi
callq 0x4600
movq 0x50(%rbx), %rdi
callq 0x4600
movq 0xd0(%rbx), %rdi
testq %rdi, %rdi
je 0x2acf4
callq 0x3478d
movq 0xd8(%rbx), %rdi
testq %rdi, %rdi
je 0x2ad05
callq 0x2c294
movq 0xe0(%rbx), %rdi
testq %rdi, %rdi
je 0x2ad16
callq 0x2c294
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4600
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_flush_container2
static int cram_flush_container2(cram_fd *fd, cram_container *c) {
    int i, j;

    if (c->curr_slice > 0 && !c->slices)
	return -1;

    //fprintf(stderr, "Writing container %d, sum %u\n", c->record_counter, sum);

    /* Write the container struct itself */
    if (0 != cram_write_container(fd, c))
	return -1;

    /* And the compression header */
    if (0 != cram_write_block(fd, c->comp_hdr_block))
	return -1;

    /* Followed by the slice blocks */
    for (i = 0; i < c->curr_slice; i++) {
	cram_slice *s = c->slices[i];

	if (0 != cram_write_block(fd, s->hdr_block))
	    return -1;

	for (j = 0; j < s->hdr->num_blocks; j++) {
	    if (0 != cram_write_block(fd, s->block[j]))
		return -1;
	}
    }

    return hflush(fd->fp) == 0 ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
cmpl $0x0, 0x54(%rsi)
pushq $-0x1
popq %rbx
jle 0x2c089
cmpq $0x0, 0x78(%r15)
je 0x2c0a8
movq %r14, %rdi
movq %r15, %rsi
callq 0x2b8b6
testl %eax, %eax
jne 0x2c0a8
movq 0x48(%r15), %rsi
movq %r14, %rdi
callq 0x27ded
testl %eax, %eax
je 0x2c0b9
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
movslq 0x54(%r15), %rax
cmpq %rax, %r12
jge 0x2c10a
movq 0x78(%r15), %rax
movq (%rax,%r12,8), %r13
movq 0x8(%r13), %rsi
movq %r14, %rdi
callq 0x27ded
testl %eax, %eax
jne 0x2c0a8
xorl %ebp, %ebp
movq (%r13), %rax
movslq 0x20(%rax), %rax
cmpq %rax, %rbp
jge 0x2c105
movq 0x10(%r13), %rax
movq (%rax,%rbp,8), %rsi
movq %r14, %rdi
callq 0x27ded
incq %rbp
testl %eax, %eax
je 0x2c0df
jmp 0x2c0a8
incq %r12
jmp 0x2c0bc
movq (%r14), %rdi
callq 0x3a18e
xorl %ebx, %ebx
negl %eax
sbbl %ebx, %ebx
jmp 0x2c0a8
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_flush_container_mt
int cram_flush_container_mt(cram_fd *fd, cram_container *c) {
    cram_job *j;

    if (!fd->pool)
	return cram_flush_container(fd, c);

    if (!(j = malloc(sizeof(*j))))
	return -1;
    j->fd = fd;
    j->c = c;
    
    t_pool_dispatch(fd->pool, fd->rqueue, cram_flush_thread, j);

    return cram_flush_result(fd);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8860(%rdi), %r15
testq %r15, %r15
je 0x2c1a1
pushq $0x10
popq %rdi
callq 0x46f0
testq %rax, %rax
je 0x2c1b1
movq %rbx, (%rax)
movq %r14, 0x8(%rax)
movq 0x8868(%rbx), %rsi
leaq -0x72(%rip), %rdx       # 0x2c11a
movq %r15, %rdi
movq %rax, %rcx
callq 0x34de3
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2c1ba
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2c03b
pushq $-0x1
popq %rax
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_flush_result
static int cram_flush_result(cram_fd *fd) {
    int i, ret = 0;
    t_pool_result *r;

    while ((r = t_pool_next_result(fd->rqueue))) {
	cram_job *j = (cram_job *)r->data;
	cram_container *c;

	if (!j) {
	    t_pool_delete_result(r, 0);
	    return -1;
	}

	fd = j->fd;
	c = j->c;

	if (0 != cram_flush_container2(fd, c))
	    return -1;

	/* Free the container */
	for (i = 0; i < c->max_slice; i++) {
	    cram_free_slice(c->slices[i]);
	    c->slices[i] = NULL;
	}

	c->slice = NULL;
	c->curr_slice = 0;

	cram_free_container(c);

	ret |= hflush(fd->fp) == 0 ? 0 : -1;

	t_pool_delete_result(r, 1);
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
xorl %r13d, %r13d
pushq $0x1
popq %rbp
movq 0x8868(%r14), %rdi
callq 0x348d4
testq %rax, %rax
je 0x2c268
movq %rax, %r15
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x2c26d
movq (%rax), %r14
movq 0x8(%rax), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x2c068
testl %eax, %eax
jne 0x2c277
xorl %ebx, %ebx
movslq 0x50(%r12), %rax
cmpq %rax, %rbx
jge 0x2c22e
movq 0x78(%r12), %rax
movq (%rax,%rbx,8), %rdi
callq 0x2ab94
movq 0x78(%r12), %rax
andq $0x0, (%rax,%rbx,8)
incq %rbx
jmp 0x2c207
andq $0x0, 0x80(%r12)
andl $0x0, 0x54(%r12)
movq %r12, %rdi
callq 0x2a9b7
movq (%r14), %rdi
callq 0x3a18e
negl %eax
movl $0x0, %eax
sbbl %eax, %eax
orl %eax, %r13d
movq %r15, %rdi
movl %ebp, %esi
callq 0x34a5f
jmp 0x2c1ce
movl %r13d, %eax
jmp 0x2c27a
movq %r15, %rdi
xorl %esi, %esi
callq 0x34a5f
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_free_slice_header
void cram_free_slice_header(cram_block_slice_hdr *hdr) {
    if (!hdr)
	return;

    if (hdr->block_content_ids)
	free(hdr->block_content_ids);

    free(hdr);

    return;
}

// Assembly:
testq %rdi, %rdi
je 0x2c2dd
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
callq 0x4600
movq %rbx, %rdi
popq %rbx
jmp 0x4600
retq