LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_io.c
// Function: int32_put_blk
int int32_put_blk(cram_block *b, int32_t val) {
    unsigned char cp[4];
    cp[0] = ( val      & 0xff);
    cp[1] = ((val>>8)  & 0xff);
    cp[2] = ((val>>16) & 0xff);
    cp[3] = ((val>>24) & 0xff);

    BLOCK_APPEND(b, cp, 4);
    return b->data ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movq 0x30(%rdi), %rcx
leaq 0x4(%rcx), %rdx
cmpq %rdx, %rax
ja 0x55cf4
movl $0x400, %r14d           # imm = 0x400
movq %rax, %xmm0
punpckldq 0x36380(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x36388(%rip), %xmm0    # 0x8c020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x3ab4c(%rip), %xmm1    # 0x907f8
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
subsd 0x4245c(%rip), %xmm1    # 0x98118
cvttsd2si %xmm1, %rsi
sarq $0x3f, %rdx
andq %rdx, %rsi
orq %rcx, %rsi
testq %rax, %rax
cmoveq %r14, %rsi
movq %rsi, 0x28(%rbx)
movq 0x20(%rbx), %rdi
callq 0x6c80
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rcx
leaq 0x4(%rcx), %rdx
cmpq %rdx, %rax
jbe 0x55c83
movq 0x20(%rbx), %rax
movl %ebp, (%rax,%rcx)
addq $0x4, 0x30(%rbx)
xorl %eax, %eax
cmpq $0x1, 0x20(%rbx)
sbbl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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
movl $0x40, %edi
callq 0x69d0
testq %rax, %rax
je 0x55f40
xorl %ecx, %ecx
movq %rcx, (%rax)
movl %ebp, 0x8(%rax)
movl %ebx, 0xc(%rax)
movq %rcx, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movq %rcx, 0x30(%rax)
movl $0x7, 0x38(%rax)
jmp 0x55f42
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x567e0
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0x567d7
callq 0x68a0
movq %rbx, %rdi
popq %rbx
jmp 0x68a0
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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
movl $0x1, %edi
movl $0x78, %esi
callq 0x6470
testq %rax, %rax
je 0x57430
movabsq $0x3200000002, %rcx     # imm = 0x3200000002
movq %rcx, (%rax)
movq $0x0, 0x20(%rax)
movl $0x0, 0x40(%rax)
jmp 0x57432
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_io.c
// Function: paranoid_fclose
int paranoid_fclose(FILE *fp) {
    if (-1 == fflush(fp) && errno != EBADF) {
	fclose(fp);
	return -1;
    }

    errno = 0;
    if (-1 == fsync(fileno(fp))) {
	if (errno != EINVAL) { // eg pipe
	    fclose(fp);
	    return -1;
	}
    }
    return fclose(fp);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x6870
cmpl $-0x1, %eax
jne 0x5746a
callq 0x6060
cmpl $0x9, (%rax)
jne 0x574a1
callq 0x6060
movq %rax, %r14
movl $0x0, (%rax)
movq %rbx, %rdi
callq 0x6750
movl %eax, %edi
callq 0x65c0
cmpl $-0x1, %eax
jne 0x57492
cmpl $0x16, (%r14)
jne 0x574a1
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x66e0
movq %rbx, %rdi
callq 0x66e0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x575a1
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x574ea
callq 0x65093
cmpq $0x0, 0x8(%rbx)
je 0x5756a
movq 0x8(%rbx), %r14
cmpl $0x0, (%r14)
je 0x57547
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x10(%r14), %rax
movl %r15d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x57538
movq 0x20(%r14), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %r14
testq %r14, %r14
je 0x57538
movq %r14, %rdi
callq 0x575a2
movq %r14, %rdi
callq 0x68a0
incl %r15d
movq 0x8(%rbx), %r14
addl $0x2, %ebp
cmpl (%r14), %r15d
jne 0x57500
movq 0x18(%r14), %rdi
callq 0x68a0
movq 0x10(%r14), %rdi
callq 0x68a0
movq 0x20(%r14), %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x68a0
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x57578
callq 0x68a0
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x57586
callq 0x68168
leaq 0x38(%rbx), %rdi
callq 0x6860
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x68a0
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x575b7
callq 0x5e70b
leaq 0x30(%rbx), %r14
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x575d0
cmpq $0x0, 0x38(%rbx)
jne 0x575d0
callq 0x68a0
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %r15
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x57601
callq 0x68a0
cmpq $0x0, 0x60(%r15)
je 0x57610
movq $0x0, 0x60(%r15)
movl 0x38(%r14), %ebx
movslq %ebx, %rdi
movl $0x8, %esi
callq 0x6470
movq %rax, 0x10(%r15)
testq %rax, %rax
je 0x57795
movl %ebx, 0x18(%r15)
cmpl $0x0, 0x38(%r14)
jle 0x57791
xorl %r12d, %r12d
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq 0x8(%r15), %rdx
movq 0x40(%r14), %rax
movq %r12, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %r8
movq %rdx, (%rsp)
movl (%rdx), %esi
movl $0x0, %ebx
testl %esi, %esi
je 0x57748
movsbl (%r8), %r14d
testl %r14d, %r14d
movq %r12, 0x20(%rsp)
je 0x576a5
movb 0x1(%r8), %al
testb %al, %al
je 0x576a8
leaq 0x2(%r8), %rcx
movl %r14d, %edx
shll $0x5, %edx
subl %r14d, %edx
movsbl %al, %r14d
addl %edx, %r14d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x5768a
jmp 0x576a8
xorl %r14d, %r14d
movq %rsi, 0x18(%rsp)
leal -0x1(%rsi), %r15d
andl %r15d, %r14d
movq (%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r13d
movl %r14d, %ebx
movq %r8, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r12d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r12d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x57728
testb $0x1, %al
jne 0x57711
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r8, %rsi
callq 0x6a50
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %r8
testl %eax, %eax
je 0x57728
addl %r13d, %ebx
andl %r15d, %ebx
incl %r13d
cmpl %r14d, %ebx
jne 0x576cf
movq 0x18(%rsp), %rsi
movl %esi, %ebx
jmp 0x57739
movl %ebp, %ecx
shrl %cl, %r12d
testb $0x3, %r12b
movq 0x18(%rsp), %rsi
cmovnel %esi, %ebx
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %r15
movq 0x20(%rsp), %r12
cmpl %esi, %ebx
je 0x57774
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rax
movq 0x10(%r15), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
movslq 0x38(%r14), %rax
cmpq %rax, %r12
jl 0x5764a
jmp 0x57791
movq 0x6785d(%rip), %rax     # 0xbefd8
movq (%rax), %rdi
leaq 0x416bc(%rip), %rsi     # 0x98e41
movq %r8, %rdx
xorl %eax, %eax
callq 0x6a90
jmp 0x57762
xorl %eax, %eax
jmp 0x5779a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x577c1
callq 0x63d6a
movq %rbx, 0x18(%r14)
movq 0x48(%r14), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x577d5
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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, %rbp
movq %rdi, %r12
movq %rsi, %rdi
movl $0x25, %esi
callq 0x6270
testq %rax, %rax
je 0x57ba2
movq %rax, %r15
movq %rsp, %r14
movq %r15, %r13
subq %rbp, %r13
movq %r12, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x6380
addq %r12, %r13
movb 0x1(%r15), %al
cmpb $0x73, %al
jne 0x57b15
movq %r13, %rdi
movq %rbx, %rsi
callq 0x6680
movq %rbx, %rdi
callq 0x62d0
addq %rax, %r13
addq %rax, %rbx
addq $0x2, %r15
jmp 0x57b83
addb $-0x30, %al
cmpb $0x9, %al
ja 0x57b6e
leaq 0x1(%r15), %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x6a60
movq %rax, %r12
movq (%rsp), %rax
cmpb $0x73, (%rax)
jne 0x57b6e
movq %rbx, %rdi
callq 0x62d0
movq %rax, %r15
cmpq %rax, %r12
cmovbq %r12, %r15
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x6380
leaq (%r15,%r13), %r12
addq %r15, %rbx
movb $0x0, (%r13,%r15)
movq (%rsp), %rbp
incq %rbp
jmp 0x57b89
movb $0x25, (%r13)
movb 0x1(%r15), %al
addq $0x2, %r15
movb %al, 0x1(%r13)
addq $0x2, %r13
movq %r13, %r12
movq %r15, %rbp
movq %rbp, %rdi
movl $0x25, %esi
callq 0x6270
movq %rax, %r15
testq %rax, %rax
jne 0x57ad7
movq %r12, %rdi
movq %rbp, %rsi
callq 0x6680
movq %rbp, %rdi
callq 0x62d0
addq %r12, %rax
cmpb $0x0, (%rbx)
je 0x57bc9
cmpb $0x2f, -0x1(%rax)
je 0x57bc9
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 0x6680
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 %rbx
pushq %rax
movq 0x10(%rdi), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rbx
cmpq $0x0, 0x30(%rbx)
jne 0x57e48
cmpq $0x0, 0x28(%rbx)
jne 0x57e56
movl %edx, %r15d
movq %rdi, %r14
movl 0x10(%rbx), %ebp
movq 0x60(%rdi), %rdi
testq %rdi, %rdi
je 0x57dc3
movq 0x28(%rdi), %rax
testq %rax, %rax
jle 0x57e75
leaq -0x1(%rax), %rcx
movq %rcx, 0x28(%rdi)
cmpq $0x1, %rax
jne 0x57dc3
cmpq $0x0, 0x30(%rdi)
je 0x57dc3
callq 0x575a2
movq 0x20(%r14), %rdi
movq 0x8(%rbx), %rsi
callq 0x6a50
testl %eax, %eax
je 0x57e01
movq 0x28(%r14), %rdi
testq %rdi, %rdi
je 0x57de6
callq 0x68168
testl %eax, %eax
jne 0x57e46
movq 0x8(%rbx), %rdi
movq %rdi, 0x20(%r14)
movl %r15d, %esi
callq 0x57e94
movq %rax, 0x28(%r14)
testq %rax, %rax
jne 0x57e08
jmp 0x57e46
cmpq $0x0, 0x28(%r14)
je 0x57dd4
movq 0x28(%r14), %rdi
movq %rbx, %rsi
movl $0x1, %edx
movl %ebp, %ecx
callq 0x57f69
testq %rax, %rax
je 0x57e46
movq %rax, 0x30(%rbx)
movq $0x0, 0x38(%rbx)
movq 0x28(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x28(%rbx)
movq %rbx, 0x60(%r14)
addq $0x2, %rax
movq %rax, 0x28(%rbx)
jmp 0x57e48
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x41002(%rip), %rdi     # 0x98e5f
leaq 0x40e6a(%rip), %rsi     # 0x98cce
leaq 0x41002(%rip), %rcx     # 0x98e6d
movl $0x9ea, %edx            # imm = 0x9EA
callq 0x6460
leaq 0x4101e(%rip), %rdi     # 0x98e9a
leaq 0x40e4b(%rip), %rsi     # 0x98cce
leaq 0x40fe3(%rip), %rcx     # 0x98e6d
movl $0x9f4, %edx            # imm = 0x9F4
callq 0x6460
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x57f0e
leaq 0x3df7d(%rip), %rsi     # 0x95e29
movq %rbx, %rdi
callq 0x66a24
testq %rax, %rax
je 0x57f50
movq %rax, %r14
movl $0x60000000, %eax       # imm = 0x60000000
andl (%r14), %eax
cmpl $0x20000000, %eax       # imm = 0x20000000
jne 0x57f5b
leaq 0x4126d(%rip), %rdx     # 0x99147
movq %r14, %rdi
movq %rbx, %rsi
callq 0x68b10
testl %eax, %eax
jns 0x57f5b
movq 0x670e8(%rip), %rax     # 0xbefd8
movq (%rax), %rdi
leaq 0x41252(%rip), %rsi     # 0x9914c
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6a90
movq %r14, %rdi
callq 0x68168
jmp 0x57f58
leaq 0x4122b(%rip), %rdx     # 0x99140
movq %rsp, %r14
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x6c20
movq %r14, %rdi
movl $0x4, %esi
callq 0x6cb0
testl %eax, %eax
je 0x57ea5
movq %rbx, %rdi
callq 0x69c50
testl %eax, %eax
jne 0x57f58
jmp 0x57ea5
movq %rbx, %rdi
callq 0x6590
xorl %r14d, %r14d
movq %r14, %rax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x58ab2
movq 0x48(%rbx), %rdi
cmpl $0x0, 0x208(%rbx)
je 0x58aba
xorl %edx, %edx
cmpl $0x72, 0x8(%rbx)
setne %dl
jmp 0x58abf
xorl %r15d, %r15d
xorl %r14d, %r14d
jmp 0x58ae8
movl $0x1, %edx
callq 0x58b63
movq %rax, 0x48(%rbx)
xorl %r14d, %r14d
testq %rax, %rax
je 0x58ad6
movq 0x20(%rax), %r15
jmp 0x58ad9
xorl %r15d, %r15d
cmpq $0x1, %r15
sbbl %r14d, %r14d
movq %rbx, %rdi
callq 0x58f7b
movq %r15, 0x70(%rbx)
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x58b00
testq %r15, %r15
jne 0x58b35
cmpl $0x0, 0x18(%rdi)
jne 0x58b35
cmpq $0x0, 0x18(%rbx)
je 0x58b35
testq %rdi, %rdi
je 0x58b11
callq 0x574b6
callq 0x59189
movq %rax, 0x48(%rbx)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x58b56
movq 0x18(%rbx), %rsi
movq %rax, %rdi
callq 0x577d5
cmpl $-0x1, %eax
je 0x58b56
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0x58b4c
movq 0x48(%rbx), %rdi
callq 0x575df
cmpl $-0x1, %eax
je 0x58b51
movl %r14d, %ebp
jmp 0x58b56
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 %r14
pushq %rbx
movl %esi, %ebp
movl %edi, %r14d
movl $0x1, %edi
movl $0x250, %esi            # imm = 0x250
callq 0x6470
movq %rax, %rbx
xorl %eax, %eax
testq %rbx, %rbx
je 0x592fa
movl $0xfffffffe, 0x6c(%rbx) # imm = 0xFFFFFFFE
movl %ebp, %ecx
imull %r14d, %ecx
movl %ecx, 0x60(%rbx)
movl %eax, 0x64(%rbx)
movl %r14d, 0x58(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movl %ebp, 0x50(%rbx)
movl %eax, 0x54(%rbx)
movq $0x1, 0x88(%rbx)
movl %eax, 0x94(%rbx)
movq $0x0, 0xb8(%rbx)
movslq %ebp, %rdi
movl $0x8, %esi
callq 0x6470
movq %rax, 0x78(%rbx)
testq %rax, %rax
je 0x592e4
movq $0x0, 0x80(%rbx)
callq 0x59304
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0x592e4
movq $0x0, 0x48(%rbx)
movl $0x23, %r14d
callq 0x5d7e8
movq %rax, (%rbx,%r14,8)
testq %rax, %rax
je 0x592e4
incq %r14
cmpq $0x3f, %r14
jne 0x592a5
movl $0x1, %edi
movl $0x28, %esi
callq 0x6470
movq %rax, 0x238(%rbx)
testq %rax, %rax
je 0x592e4
movq $0x0, 0x240(%rbx)
jmp 0x592fc
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x592f2
callq 0x68a0
movq %rbx, %rdi
callq 0x68a0
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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
movl $0x1, %edi
movl $0x418, %esi            # imm = 0x418
callq 0x6470
testq %rax, %rax
je 0x593c9
movq %rax, %rbx
movl $0x40, %edi
callq 0x69d0
testq %rax, %rax
je 0x5935c
movq %rax, %r14
movaps 0x3f833(%rip), %xmm0    # 0x98b70
movups %xmm0, (%rax)
xorl %eax, %eax
movq %rax, 0x10(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
movq %rax, 0x30(%r14)
movl $0x7, 0x38(%r14)
jmp 0x5935f
xorl %r14d, %r14d
movq %r14, 0x50(%rbx)
testq %r14, %r14
je 0x593c1
movl $0x1, %edi
movl $0x28, %esi
callq 0x6470
movq %rax, 0x68(%rbx)
testq %rax, %rax
je 0x593b9
movq %rax, %r15
movl $0x2000, %edi           # imm = 0x2000
callq 0x65060
movq %rax, 0x70(%rbx)
testq %rax, %rax
jne 0x593cb
movq 0x18(%r15), %rdi
callq 0x68a0
movq 0x10(%r15), %rdi
callq 0x68a0
movq 0x20(%r15), %rdi
callq 0x68a0
movq %r15, %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x567c0
movq %rbx, %rdi
callq 0x68a0
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x594b1
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x240(%rdi), %rdi
testq %rdi, %rdi
je 0x593f5
callq 0x68a0
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x59403
callq 0x68a0
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x59411
callq 0x594b2
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x5941f
callq 0x567c0
cmpq $0x0, 0x78(%rbx)
je 0x59456
cmpl $0x0, 0x50(%rbx)
jle 0x5944d
xorl %r14d, %r14d
movq 0x78(%rbx), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x59441
callq 0x595ed
incq %r14
movslq 0x50(%rbx), %rax
cmpq %rax, %r14
jl 0x5942f
movq 0x78(%rbx), %rdi
callq 0x68a0
movl $0x23, %r14d
movq (%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x5946a
callq 0x5dde3
incq %r14
cmpq $0x3f, %r14
jne 0x5945c
movq 0x238(%rbx), %r14
testq %r14, %r14
je 0x594a2
movq 0x18(%r14), %rdi
callq 0x68a0
movq 0x10(%r14), %rdi
callq 0x68a0
movq 0x20(%r14), %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x68a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x68a0
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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
testq %rdi, %rdi
je 0x594cb
callq 0x68a0
movq 0x78(%rbx), %r14
testq %r14, %r14
je 0x594f7
movq 0x18(%r14), %rdi
callq 0x68a0
movq 0x10(%r14), %rdi
callq 0x68a0
movq 0x20(%r14), %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x68a0
xorl %r15d, %r15d
movq 0x80(%rbx,%r15,8), %r14
testq %r14, %r14
je 0x59527
movq 0x10(%r14), %rdi
movq 0x18(%r14), %r12
testq %rdi, %rdi
je 0x59517
callq *0x10(%rdi)
movq %r14, %rdi
callq 0x68a0
movq %r12, %r14
testq %r12, %r12
jne 0x59507
incq %r15
cmpq $0x20, %r15
jne 0x594fa
xorl %r15d, %r15d
movq 0x180(%rbx,%r15,8), %r14
testq %r14, %r14
je 0x59560
movq 0x10(%r14), %rdi
movq 0x18(%r14), %r12
testq %rdi, %rdi
je 0x59550
callq *0x10(%rdi)
movq %r14, %rdi
callq 0x68a0
movq %r12, %r14
testq %r12, %r12
jne 0x59540
incq %r15
cmpq $0x20, %r15
jne 0x59533
movl $0x50, %r14d
movq (%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x5957b
callq *0x10(%rdi)
incq %r14
cmpq $0x7f, %r14
jne 0x5956f
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x59592
callq 0x68a0
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x595a0
callq 0x567c0
movq 0x68(%rbx), %r14
testq %r14, %r14
je 0x595cc
movq 0x18(%r14), %rdi
callq 0x68a0
movq 0x10(%r14), %rdi
callq 0x68a0
movq 0x20(%r14), %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x68a0
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x595da
callq 0x65093
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x68a0
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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)
jle 0x5ac0a
cmpq $0x0, 0x78(%r15)
je 0x5aca0
movq %r14, %rdi
movq %r15, %rsi
callq 0x5a3af
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x5aca5
movq 0x48(%r15), %rsi
movq %r14, %rdi
callq 0x563d2
testl %eax, %eax
jne 0x5aca5
cmpl $0x0, 0x54(%r15)
jle 0x5ac90
xorl %r12d, %r12d
movq 0x78(%r15), %rax
movq (%rax,%r12,8), %r13
movq 0x8(%r13), %rsi
movq %r14, %rdi
callq 0x563d2
testl %eax, %eax
jne 0x5aca5
movq (%r13), %rax
cmpl $0x0, 0x20(%rax)
jle 0x5ac84
xorl %ebp, %ebp
movq 0x10(%r13), %rax
movq (%rax,%rbp,8), %rsi
movq %r14, %rdi
callq 0x563d2
testl %eax, %eax
jne 0x5aca5
incq %rbp
movq (%r13), %rax
movslq 0x20(%rax), %rax
cmpq %rax, %rbp
jl 0x5ac60
incq %r12
movslq 0x54(%r15), %rax
cmpq %rax, %r12
jl 0x5ac3c
movq (%r14), %rdi
callq 0x6b143
xorl %ebx, %ebx
negl %eax
sbbl %ebx, %ebx
jmp 0x5aca5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x5ad28
movl $0x10, %edi
callq 0x69d0
testq %rax, %rax
je 0x5ad38
movq %rbx, (%rax)
movq %r14, 0x8(%rax)
movq 0x8868(%rbx), %rsi
leaq -0x5d(%rip), %rdx       # 0x5acb6
movq %r15, %rdi
movq %rax, %rcx
callq 0x6577e
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x5ad43
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x5abb9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 %ebx, %ebx
movq 0x8868(%r14), %rdi
callq 0x651f8
testq %rax, %rax
je 0x5ae14
movq %rax, %r15
movq 0x10(%rax), %rax
testq %rax, %rax
setne %bpl
je 0x5ad92
movq (%rax), %r14
movq 0x8(%rax), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x5abe8
testl %eax, %eax
je 0x5ad96
xorl %ebp, %ebp
jmp 0x5ae06
xorl %esi, %esi
jmp 0x5adfe
cmpl $0x0, 0x50(%r12)
jle 0x5adc9
xorl %r13d, %r13d
movq 0x78(%r12), %rax
movq (%rax,%r13,8), %rdi
callq 0x595ed
movq 0x78(%r12), %rax
movq $0x0, (%rax,%r13,8)
incq %r13
movslq 0x50(%r12), %rax
cmpq %rax, %r13
jl 0x5ada1
movq $0x0, 0x80(%r12)
movl $0x0, 0x54(%r12)
movq %r12, %rdi
callq 0x593d4
movq (%r14), %rdi
callq 0x6b143
negl %eax
movl $0x0, %eax
sbbl %eax, %eax
orl %eax, %ebx
movl $0x1, %esi
movq %r15, %rdi
callq 0x65391
testb %bpl, %bpl
jne 0x5ad53
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x5ae45
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
testq %rdi, %rdi
je 0x5ae3c
callq 0x68a0
movq %rbx, %rdi
popq %rbx
jmp 0x68a0
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
movl $0x1a, %r15d
movl $0x1a, %edi
callq 0x69d0
testq %rax, %rax
je 0x5b3d1
movq %rax, %rbx
movq (%r14), %r12
movq 0x8(%r12), %rsi
movq 0x10(%r12), %r13
subq %rsi, %r13
cmpq $0x1a, %r13
cmovbq %r13, %r15
movq %rax, %rdi
movq %r15, %rdx
callq 0x6570
addq %r15, 0x8(%r12)
cmpq $0x19, %r13
ja 0x5b3bb
movl $0x1a, %edx
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x6b053
movq %rax, %r15
cmpq $0x1a, %r15
jne 0x5b3c9
cmpl $0x4d415243, (%rbx)     # imm = 0x4D415243
je 0x5b3e0
movq %rbx, %rdi
callq 0x68a0
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movb 0x4(%rbx), %al
cmpb $0x4, %al
jae 0x5b3fc
addq $0x1a, 0x8840(%r14)
movl $0x0, 0x884c(%r14)
jmp 0x5b3d3
movzbl %al, %edi
movq %rbx, %rsi
callq 0x79b3
jmp 0x5b3d1
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 $0x10018, %rsp          # imm = 0x10018
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
movl $0x0, 0x88f8(%rdi)
movq (%rdi), %rdi
callq 0x6b2df
xorl %edx, %edx
testq %rax, %rax
jns 0x5c973
cmpl $0x1, %ebp
setne %al
testq %r15, %r15
sets %cl
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
orb %al, %cl
jne 0x5c973
leaq 0x10(%rsp), %r14
movq %r12, 0x8(%rsp)
testq %r15, %r15
jle 0x5c971
movl $0x10000, %eax          # imm = 0x10000
movq %r15, %rbx
cmpq %rax, %r15
jl 0x5c90c
movl $0x10000, %ebx          # imm = 0x10000
movq (%r12), %rbp
movq 0x8(%rbp), %rsi
movq 0x10(%rbp), %r13
subq %rsi, %r13
movq %r13, %r12
cmpq %rbx, %r13
jb 0x5c926
movq %rbx, %r12
movq %r14, %rdi
movq %r12, %rdx
callq 0x6570
addq %r12, 0x8(%rbp)
cmpq %rbx, %r13
jae 0x5c94e
movq %rbp, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x6b053
movq %rax, %r12
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rbx, %rax
cmpq %r12, %rbx
je 0x5c95d
xorl %eax, %eax
subq %rax, %r15
cmpq %r12, %rbx
leaq 0x10(%rsp), %r14
movq 0x8(%rsp), %r12
je 0x5c8f5
jmp 0x5c973
xorl %edx, %edx
movl %edx, %eax
addq $0x10018, %rsp          # imm = 0x10018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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)
	    fd->ctr->curr_slice++;
	if (-1 == cram_flush_container_mt(fd, fd->ctr))
	    return -1;
    }

    return 0;
}

// Assembly:
pushq %rbx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x5c9ba
cmpl $0x77, 0x8(%rdi)
jne 0x5c9b8
movq 0x38(%rdi), %rsi
testq %rsi, %rsi
je 0x5c9b8
cmpq $0x0, 0x80(%rsi)
je 0x5c9ae
incl 0x54(%rsi)
callq 0x5acd8
cmpl $-0x1, %eax
je 0x5c9ba
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x5d81c
movl %ebp, %eax
incl (%rbx,%rax,4)
jmp 0x5d9af
cmpq $0x0, 0x1000(%rbx)
jne 0x5d83c
movl $0x1, %edi
movl $0x28, %esi
callq 0x6470
movq %rax, 0x1000(%rbx)
movq 0x1000(%rbx), %r14
movl 0x8(%r14), %eax
cmpl 0xc(%r14), %eax
jb 0x5d86c
movl (%r14), %esi
movl 0x4(%r14), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x5d85e
decl %esi
jmp 0x5d860
incl %esi
movq %r14, %rdi
callq 0x5de28
testl %eax, %eax
js 0x5d8e8
movl (%r14), %esi
leal -0x1(%rsi), %r9d
movl %r9d, %eax
andl %ebp, %eax
movq 0x10(%r14), %rdx
movl %eax, %ecx
shrl $0x4, %ecx
movl (%rdx,%rcx,4), %edi
leal (%rax,%rax), %ecx
shrl %cl, %edi
testb $0x2, %dil
jne 0x5d91a
movl $0x1, %r10d
movl %eax, %r8d
movl %esi, %edi
movl %r8d, %ecx
shrl $0x4, %ecx
movl (%rdx,%rcx,4), %r11d
leal (%r8,%r8), %ecx
andl $0x1e, %ecx
movl %r11d, %r15d
shrl %cl, %r15d
testb $0x2, %r15b
jne 0x5d8f5
testb $0x1, %r15b
jne 0x5d8ce
movq 0x18(%r14), %r15
movl %r8d, %r12d
cmpl %ebp, (%r15,%r12,4)
je 0x5d8f5
btl %ecx, %r11d
cmovbl %r8d, %edi
addl %r10d, %r8d
andl %r9d, %r8d
incl %r10d
movl %edi, %ecx
cmpl %eax, %r8d
jne 0x5d89e
jmp 0x5d8f7
movl (%r14), %eax
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
jmp 0x5d980
movl %esi, %ecx
movl %ecx, %eax
cmpl %esi, %ecx
jne 0x5d91a
movl %r8d, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %eax
leal (%r8,%r8), %ecx
shrl %cl, %eax
cmpl %esi, %edi
cmovel %r8d, %edi
testb $0x2, %al
cmovel %r8d, %edi
movl %edi, %eax
movl %eax, %esi
shrl $0x4, %esi
movl (%rdx,%rsi,4), %r8d
leal (%rax,%rax), %ecx
andl $0x1e, %ecx
shrl %cl, %r8d
testb $0x2, %r8b
jne 0x5d95c
xorl %edi, %edi
testb $0x1, %r8b
je 0x5d980
movq 0x18(%r14), %rdi
movl %eax, %r8d
movl %ebp, (%rdi,%r8,4)
movl $0x3, %edi
shll %cl, %edi
notl %edi
andl %edi, (%rdx,%rsi,4)
incl 0x4(%r14)
movl $0x2, %edi
jmp 0x5d980
movq 0x18(%r14), %rdi
movl %eax, %r8d
movl %ebp, (%rdi,%r8,4)
movl $0x3, %edi
shll %cl, %edi
notl %edi
andl %edi, (%rdx,%rsi,4)
incl 0x4(%r14)
incl 0x8(%r14)
movl $0x1, %edi
cmpl $-0x1, %edi
je 0x5d9af
testl %edi, %edi
jne 0x5d99b
movq 0x1000(%rbx), %rcx
movq 0x20(%rcx), %rcx
movl %eax, %eax
incl (%rcx,%rax,4)
jmp 0x5d9af
movq 0x1000(%rbx), %rcx
movq 0x20(%rcx), %rcx
movl %eax, %eax
movl $0x1, (%rcx,%rax,4)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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
movq %rdi, %rdx
decl 0x1008(%rdi)
cmpl $0x3ff, %esi            # imm = 0x3FF
ja 0x5da02
movl %esi, %eax
movl (%rdx,%rax,4), %ecx
leal -0x1(%rcx), %esi
movl %esi, (%rdx,%rax,4)
testl %ecx, %ecx
jg 0x5dadb
leaq 0x3b95f(%rip), %rdi     # 0x99349
leaq 0x3b96c(%rip), %rsi     # 0x9935d
leaq 0x3b977(%rip), %rcx     # 0x9936f
movl $0x53, %edx
callq 0x6460
movq 0x1000(%rdx), %rdi
addq $0x1008, %rdx           # imm = 0x1008
testq %rdi, %rdi
je 0x5dac5
movl (%rdi), %r8d
testl %r8d, %r8d
je 0x5da82
leal -0x1(%r8), %r9d
movl %r9d, %r10d
andl %esi, %r10d
movq 0x10(%rdi), %r11
movl $0x1, %ebx
movl %r10d, %eax
movl %eax, %ecx
shrl $0x4, %ecx
movl (%r11,%rcx,4), %ebp
leal (%rax,%rax), %ecx
andl $0x1e, %ecx
movl %ebp, %r14d
shrl %cl, %r14d
testb $0x2, %r14b
jne 0x5da76
testb $0x1, %r14b
jne 0x5da65
movq 0x18(%rdi), %r14
movl %eax, %r15d
cmpl %esi, (%r14,%r15,4)
je 0x5da76
addl %ebx, %eax
andl %r9d, %eax
incl %ebx
cmpl %r10d, %eax
jne 0x5da37
movl %r8d, %eax
jmp 0x5da84
shrl %cl, %ebp
testb $0x3, %bpl
cmovnel %r8d, %eax
jmp 0x5da84
xorl %eax, %eax
cmpl %r8d, %eax
je 0x5dad1
movq 0x20(%rdi), %rcx
movl %eax, %edx
decl (%rcx,%rdx,4)
jne 0x5dadb
cmpl %eax, (%rdi)
je 0x5dadb
movq 0x10(%rdi), %rdx
movl %eax, %esi
shrl $0x4, %esi
movl (%rdx,%rsi,4), %r8d
addl %eax, %eax
andl $0x1e, %eax
movl %r8d, %r9d
movl %eax, %ecx
shrl %cl, %r9d
testb $0x3, %r9b
jne 0x5dadb
btsl %eax, %r8d
movl %r8d, (%rdx,%rsi,4)
decl 0x4(%rdi)
jmp 0x5dadb
movl %esi, %edi
movq %rdx, %rsi
callq 0x7b2e
jmp 0x5dadb
movl %esi, %edi
movq %rdx, %rsi
callq 0x7b0c
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/mFILE.c
// Function: mfmmap
int mfmmap(mFILE *mf, FILE *fp, const char *fn) {
    struct stat sb;

    if (stat(fn, &sb) != 0)
	return -1;

    mf->size = sb.st_size;
    mf->data = mmap(NULL, mf->size, PROT_READ, MAP_SHARED,
		    fileno(fp), 0);

    if (!mf->data)
	return -1;

    mf->alloced = 0;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %rsi
movq %rdx, %rdi
callq 0x6630
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x5e1eb
movq 0x38(%rsp), %r15
movq %r15, 0x20(%rbx)
movq %r14, %rdi
callq 0x6750
xorl %edi, %edi
movq %r15, %rsi
movl $0x1, %edx
movl $0x1, %ecx
movl %eax, %r8d
xorl %r9d, %r9d
callq 0x6d70
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x5e1eb
movq $0x0, 0x10(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 $0x98, %rsp
movq %rdx, (%rsp)
movq %rdi, %r14
movb $0x1, %bpl
movl $0x2000, %r13d          # imm = 0x2000
testq %rsi, %rsi
je 0x5e667
leaq 0x8(%rsp), %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x6630
cmpl $-0x1, %eax
je 0x5e667
movq 0x38(%rsp), %r12
movq %r12, %rdi
callq 0x69d0
movq %rax, %r15
movslq %r12d, %r13
xorl %ebp, %ebp
jmp 0x5e66d
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %ebx, %ebx
leaq (%rbx,%r13), %rax
cmpq %r12, %rax
jbe 0x5e689
addq %r13, %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x6c80
movq %rax, %r15
leaq (%r15,%rbx), %rdi
movq %r12, %rdx
subq %rbx, %rdx
movl $0x1, %esi
movq %r14, %rcx
callq 0x6b20
addq %rax, %rbx
movq %r14, %rdi
callq 0x6bc0
testl %eax, %eax
jne 0x5e6bc
cmpq 0x38(%rsp), %rbx
setb %al
orb %bpl, %al
jne 0x5e66f
movq (%rsp), %rax
movq %rbx, (%rax)
movq %r15, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/mFILE.c
// Function: mfclose
int mfclose(mFILE *mf) {
    if (!mf)
	return -1;

    mfflush(mf);

#ifdef HAVE_MMAP
    if ((mf->mode & MF_MMAP) && mf->data) {
	/* Mmaped */
	munmap(mf->data, mf->size);
	mf->data = NULL;
    }
#endif

    if (mf->fp)
	fclose(mf->fp);

    mfdestroy(mf);

    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x5e752
pushq %rbx
movq %rdi, %rbx
callq 0x5e758
testb $0x40, 0x1c(%rbx)
je 0x5e739
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x5e739
movq 0x20(%rbx), %rsi
callq 0x63d0
movq $0x0, 0x8(%rbx)
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x5e746
callq 0x66e0
movq %rbx, %rdi
callq 0x5e866
xorl %eax, %eax
popq %rbx
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x5e889
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x5e87d
callq 0x68a0
movq %rbx, %rdi
callq 0x68a0
xorl %eax, %eax
popq %rbx
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x5e8c2
movq %rdi, %r14
callq 0x5e758
testb $0x40, 0x1c(%r14)
jne 0x5e8c2
movq (%r14), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x5e8c2
callq 0x66e0
movq $0x0, (%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x5e93d
cmpl $0x1, %edx
je 0x5e937
testl %edx, %edx
je 0x5e941
pushq %rax
callq 0x6060
movl $0x16, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
retq
addq %rsi, 0x28(%rdi)
jmp 0x5e945
addq 0x20(%rdi), %rsi
movq %rsi, 0x28(%rdi)
movl $0x0, 0x18(%rdi)
xorl %eax, %eax
retq