LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/thread_pool.c
// Function: t_pool_dispatch
int t_pool_dispatch(t_pool *p, t_results_queue *q,
		    void *(*func)(void *arg), void *arg) {
    t_pool_job *j = malloc(sizeof(*j));

    if (!j)
	return -1;
    j->func = func;
    j->arg = arg;
    j->next = NULL;
    j->p = p;
    j->q = q;
    if (q) {
	pthread_mutex_lock(&q->result_m);
	j->serial = q->curr_serial++;
	q->pending++;
	pthread_mutex_unlock(&q->result_m);
    } else {
	j->serial = 0;
    }

#ifdef DEBUG
    fprintf(stderr, "Dispatching job %p for queue %p, serial %d\n", j, q, j->serial);
#endif

    pthread_mutex_lock(&p->pool_m);

    // Check if queue is full
    while (p->njobs >= p->qsize)
	pthread_cond_wait(&p->full_c, &p->pool_m);

    p->njobs++;

    if (p->tail) {
	p->tail->next = j;
	p->tail = j;
    } else {
	p->head = p->tail = j;
    }

    // Let a worker know we have data.
#ifdef IN_ORDER
    if (p->t_stack_top >= 0 && p->njobs > p->tsize - p->nwaiting)
	pthread_cond_signal(&p->t[p->t_stack_top].pending_c);
#else
    pthread_cond_signal(&p->pending_c);
#endif
    pthread_mutex_unlock(&p->pool_m);

#ifdef DEBUG
    fprintf(stderr, "Dispatched (serial %d)\n", j->serial);
#endif

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x30
popq %rdi
callq 0x69d0
testq %rax, %rax
je 0x5ab8a
movq %rax, %r14
movq %r13, (%rax)
movq %r12, 0x8(%rax)
andq $0x0, 0x10(%rax)
movq %rbx, 0x18(%rax)
movq %r15, 0x20(%rax)
testq %r15, %r15
je 0x5ab8f
leaq 0x20(%r15), %r12
movq %r12, %rdi
callq 0x6ae0
movl 0x14(%r15), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x14(%r15)
movl %eax, 0x28(%r14)
incl 0x1c(%r15)
movq %r12, %rdi
callq 0x64f0
jmp 0x5ab94
pushq $-0x1
popq %rax
jmp 0x5ac09
andl $0x0, 0x28(%r14)
leaq 0x30(%rbx), %r15
movq %r15, %rdi
callq 0x6ae0
leaq 0xb8(%rbx), %r12
movl 0x4(%rbx), %eax
cmpl (%rbx), %eax
jl 0x5abbb
movq %r12, %rdi
movq %r15, %rsi
callq 0x6b90
jmp 0x5aba7
leal 0x1(%rax), %ecx
movl %ecx, 0x4(%rbx)
movq 0x18(%rbx), %rcx
testq %rcx, %rcx
cmoveq %rbx, %rcx
movq %r14, 0x10(%rcx)
movq %r14, 0x18(%rbx)
movslq 0xf0(%rbx), %rcx
testq %rcx, %rcx
js 0x5abff
movl 0x20(%rbx), %edx
subl 0x8(%rbx), %edx
cmpl %edx, %eax
jl 0x5abff
movq 0x28(%rbx), %rax
imulq $0x50, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x18, %rdi
callq 0x6040
movq %r15, %rdi
callq 0x64f0
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/thread_pool.c
// Function: t_pool_flush
int t_pool_flush(t_pool *p) {
    int i;

#ifdef DEBUG
    fprintf(stderr, "Flushing pool %p\n", p);
#endif

    // Drains the queue
    pthread_mutex_lock(&p->pool_m);

    // Wake up everything for the final sprint!
    for (i = 0; i < p->tsize; i++)
	if (p->t_stack[i])
	    pthread_cond_signal(&p->t[i].pending_c);

    while (p->njobs || p->nwaiting != p->tsize)
	pthread_cond_wait(&p->empty_c, &p->pool_m);

    pthread_mutex_unlock(&p->pool_m);

#ifdef DEBUG
    fprintf(stderr, "Flushed complete for pool %p, njobs=%d, nwaiting=%d\n",
	    p, p->njobs, p->nwaiting);
#endif

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x30(%rdi), %rbx
movq %rbx, %rdi
callq 0x6ae0
pushq $0x18
popq %r15
xorl %r12d, %r12d
movslq 0x20(%r14), %rax
cmpq %rax, %r12
jge 0x5ada0
movq 0xe8(%r14), %rax
cmpl $0x0, (%rax,%r12,4)
je 0x5ad97
movq 0x28(%r14), %rdi
addq %r15, %rdi
callq 0x6040
incq %r12
addq $0x50, %r15
jmp 0x5ad74
leaq 0x58(%r14), %r15
cmpl $0x0, 0x4(%r14)
jne 0x5adb5
movl 0x8(%r14), %eax
cmpl 0x20(%r14), %eax
je 0x5adc2
movq %r15, %rdi
movq %rbx, %rsi
callq 0x6b90
jmp 0x5ada4
movq %rbx, %rdi
callq 0x64f0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/thread_pool.c
// Function: t_pool_destroy
void t_pool_destroy(t_pool *p, int kill) {
    int i;
    
#ifdef DEBUG
    fprintf(stderr, "Destroying pool %p, kill=%d\n", p, kill);
#endif

    /* Send shutdown message to worker threads */
    if (!kill) {
	pthread_mutex_lock(&p->pool_m);
	p->shutdown = 1;

#ifdef DEBUG
	fprintf(stderr, "Sending shutdown request\n");
#endif

#ifdef IN_ORDER
	for (i = 0; i < p->tsize; i++)
	    pthread_cond_signal(&p->t[i].pending_c);
#else
	pthread_cond_broadcast(&p->pending_c);
#endif
	pthread_mutex_unlock(&p->pool_m);

#ifdef DEBUG
	fprintf(stderr, "Shutdown complete\n");
#endif
	for (i = 0; i < p->tsize; i++)
	    pthread_join(p->t[i].tid, NULL);
    } else {
	for (i = 0; i < p->tsize; i++)
	    pthread_kill(p->t[i].tid, SIGINT);
    }

    pthread_mutex_destroy(&p->pool_m);
    pthread_cond_destroy(&p->empty_c);
    pthread_cond_destroy(&p->full_c);
#ifdef IN_ORDER
    for (i = 0; i < p->tsize; i++)
	pthread_cond_destroy(&p->t[i].pending_c);
#else
    pthread_cond_destroy(&p->pending_c);
#endif

#ifdef DEBUG_TIME
    fprintf(stderr, "Total time=%f\n", p->total_time / 1000000.0);
    fprintf(stderr, "Wait  time=%f\n", p->wait_time  / 1000000.0);
    fprintf(stderr, "%d%% utilisation\n",
	    (int)(100 - ((100.0 * p->wait_time) / p->total_time + 0.5)));
    for (i = 0; i < p->tsize; i++)
	fprintf(stderr, "%d: Wait time=%f\n", i,
		p->t[i].wait_time / 1000000.0);
#endif

    if (p->t_stack)
	free(p->t_stack);

    free(p->t);
    free(p);

#ifdef DEBUG
    fprintf(stderr, "Destroyed pool %p\n", p);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
testl %esi, %esi
je 0x5ae16
pushq $0x10
popq %r14
xorl %r15d, %r15d
pushq $0x2
popq %rbp
movslq 0x20(%rbx), %rax
cmpq %rax, %r15
jge 0x5ae7e
movq 0x28(%rbx), %rax
movq (%rax,%r14), %rdi
movl %ebp, %esi
callq 0x6990
incq %r15
addq $0x50, %r14
jmp 0x5adf1
leaq 0x30(%rbx), %r14
movq %r14, %rdi
callq 0x6ae0
movl $0x1, 0xc(%rbx)
pushq $0x18
popq %r15
xorl %r12d, %r12d
movslq 0x20(%rbx), %rax
cmpq %rax, %r12
jge 0x5ae4e
movq 0x28(%rbx), %rdi
addq %r15, %rdi
callq 0x6040
incq %r12
addq $0x50, %r15
jmp 0x5ae30
movq %r14, %rdi
callq 0x64f0
pushq $0x10
popq %r14
xorl %r15d, %r15d
movslq 0x20(%rbx), %rax
cmpq %rax, %r15
jge 0x5ae7e
movq 0x28(%rbx), %rax
movq (%rax,%r14), %rdi
xorl %esi, %esi
callq 0x6610
incq %r15
addq $0x50, %r14
jmp 0x5ae5d
pushq $0x18
popq %r14
leaq 0x30(%rbx), %rdi
callq 0x6860
leaq 0x58(%rbx), %rdi
callq 0x6e60
leaq 0xb8(%rbx), %rdi
callq 0x6e60
xorl %r15d, %r15d
movslq 0x20(%rbx), %rax
cmpq %rax, %r15
jge 0x5aec1
movq 0x28(%rbx), %rdi
addq %r14, %rdi
callq 0x6e60
incq %r15
addq $0x50, %r14
jmp 0x5aea3
movq 0xe8(%rbx), %rdi
callq 0x68a0
movq 0x28(%rbx), %rdi
callq 0x68a0
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x68a0
nop
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/zfio.c
// Function: zfgets
char *zfgets(char *line, int size, zfp *zf) {
    if (zf->fp)
	return fgets(line, size, zf->fp);
    else
	return gzgets(zf->gz, line, size);
}

// Assembly:
movl %esi, %eax
movq %rdi, %rsi
movq (%rdx), %rcx
testq %rcx, %rcx
je 0x5b32e
movq %rsi, %rdi
movl %eax, %esi
movq %rcx, %rdx
jmp 0x6c00
movq 0x8(%rdx), %rdi
movl %eax, %edx
jmp 0x6ce0
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/zfio.c
// Function: zfputs
int zfputs(char *line, zfp *zf) {
    if (zf->fp)
	return fputs(line, zf->fp);
    else
	return gzputs(zf->gz, line) ? 0 : EOF;
}

// Assembly:
movq %rdi, %rax
movq (%rsi), %rcx
testq %rcx, %rcx
je 0x5b34f
movq %rax, %rdi
movq %rcx, %rsi
jmp 0x6810
pushq %rax
movq 0x8(%rsi), %rdi
movq %rax, %rsi
callq 0x6e20
xorl %ecx, %ecx
cmpl $0x1, %eax
sbbl %ecx, %ecx
movl %ecx, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/zfio.c
// Function: zfpeek
int zfpeek(zfp *zf) {
    int c;

    if (zf->fp) {
	c = getc(zf->fp);
	if (c != EOF)
	    ungetc(c, zf->fp);
    } else {
	c = gzgetc(zf->gz);
	if (c != EOF)
	    gzungetc(c, zf->gz);
    }

    return c;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x5b38e
callq 0x61e0
cmpl $-0x1, %eax
je 0x5b3cd
movl %eax, %ebx
movq (%r14), %rsi
movl %eax, %edi
callq 0x6150
jmp 0x5b3d0
movq 0x8(%r14), %rsi
movl (%rsi), %eax
testl %eax, %eax
je 0x5b3b1
decl %eax
movl %eax, (%rsi)
incq 0x10(%rsi)
movq 0x8(%rsi), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rsi)
movzbl (%rax), %ebx
jmp 0x5b3c4
movq %rsi, %rdi
callq 0x6cf0
cmpl $-0x1, %eax
je 0x5b3cd
movl %eax, %ebx
movq 0x8(%r14), %rsi
movl %ebx, %edi
callq 0x6690
jmp 0x5b3d0
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/zfio.c
// Function: zfopen
zfp *zfopen(const char *path, const char *mode) {
    char path2[1024];
    zfp *zf;

    if (!(zf = (zfp *)malloc(sizeof(*zf))))
	return NULL;
    zf->fp = NULL;
    zf->gz = NULL;

    /* Try normal fopen */
    if (mode[0] != 'z' && mode[1] != 'z' &&
	NULL != (zf->fp = fopen(path, mode))) {
	unsigned char magic[2];
	if (2 != fread(magic, 1, 2, zf->fp)) {
	    free(zf);
	    return NULL;
	}
	if (!(magic[0] == 0x1f &&
	      magic[1] == 0x8b)) {
	    fseeko(zf->fp, 0, SEEK_SET);
	    return zf;
	}

	fclose(zf->fp);
	zf->fp = NULL;
    }

#ifdef HAVE_POPEN
    /*
     * I've no idea why, by gzgets is VERY slow, maybe because it handles
     * arbitrary seeks.
     * popen to gzip -cd is 3 times faster though.
     */
    if (*mode == 'w') {
    } else {
	if (access(path, R_OK) == 0) {
	    sprintf(path2, "gzip -cd < %.*s", 1000, path);
	    if (NULL != (zf->fp = popen(path2, "r")))
		return zf;
	}
	
	sprintf(path2, "gzip -cd < %.*s.gz", 1000, path);
	if (NULL != (zf->fp = popen(path2, "r")))
	    return zf;

	printf("Failed on %s\n", path);
    } else {
	sprintf(path2, "gzip > %.*s", 1000, path);
	if (NULL != (zf->fp = popen(path2, "w")))
	    return zf;
	}
	
	printf("Failed on %s\n", path);
    }
#else
    /* Gzopen instead */
    if ((zf->gz = gzopen(path, mode)))
	return zf;

    sprintf(path2, "%.*s.gz", 1020, path);
    if ((zf->gz = gzopen(path2, mode)))
	return zf;
#endif

    perror(path);

    free(zf);
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rsi, %r15
movq %rdi, %r14
pushq $0x1
popq %rdi
pushq $0x10
popq %rsi
callq 0x6470
testq %rax, %rax
je 0x5b4c5
movq %rax, %rbx
cmpb $0x7a, (%r15)
je 0x5b471
cmpb $0x7a, 0x1(%r15)
je 0x5b471
movq %r14, %rdi
movq %r15, %rsi
callq 0x6880
movq %rax, (%rbx)
testq %rax, %rax
je 0x5b471
movq %rax, %r12
movq %rsp, %rdi
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
movq %rax, %rcx
callq 0x6b20
cmpq $0x2, %rax
jne 0x5b4bd
cmpb $0x1f, (%rsp)
jne 0x5b4d9
cmpb $-0x75, 0x1(%rsp)
jne 0x5b4d9
movq %r12, %rdi
callq 0x66e0
andq $0x0, (%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x6b00
movq %rax, 0x8(%rbx)
testq %rax, %rax
jne 0x5b4c7
leaq 0x2d54c(%rip), %rsi     # 0x889d8
movq %rsp, %r12
movq %r12, %rdi
movl $0x3fc, %edx            # imm = 0x3FC
movq %r14, %rcx
xorl %eax, %eax
callq 0x6170
movq %r12, %rdi
movq %r15, %rsi
callq 0x6b00
movq %rax, 0x8(%rbx)
testq %rax, %rax
jne 0x5b4c7
movq %r14, %rdi
callq 0x6590
movq %rbx, %rdi
callq 0x68a0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6400
jmp 0x5b4c7
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/kstring.c
// Function: kgetline
int kgetline(kstring_t *s, kgets_func *fgets_fn, void *fp)
{
	size_t l0 = s->l;

	while (s->l == l0 || s->s[s->l-1] != '\n') {
		if (s->m - s->l < 200) ks_resize(s, s->m + 200);
		if (fgets_fn(s->s + s->l, s->m - s->l, fp) == NULL) break;
		s->l += strlen(s->s + s->l);
	}

	if (s->l == l0) return EOF;

	if (s->l > l0 && s->s[s->l-1] == '\n') {
		s->l--;
		if (s->l > l0 && s->s[s->l-1] == '\r') s->l--;
	}
	s->s[s->l] = '\0';
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %r13
movq 0x10(%rdi), %r12
movq %r13, %rax
cmpq %r13, %rax
je 0x5b94d
cmpb $0xa, -0x1(%r12,%rax)
je 0x5b9f9
movq 0x8(%rbx), %rcx
cmpq $-0xc9, %rcx
ja 0x5b9c2
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0xc7, %rdx
ja 0x5b9c2
addq $0xc7, %rcx
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq %r12, %rdi
callq 0x6c80
testq %rax, %rax
je 0x5b9be
movq %rax, %r12
movq %rax, 0x10(%rbx)
jmp 0x5b9c2
movq 0x10(%rbx), %r12
movq (%rbx), %rax
addq %rax, %r12
movl 0x8(%rbx), %esi
subl %eax, %esi
movq %r12, %rdi
movq %r14, %rdx
callq *%r15
movq (%rbx), %rbp
testq %rax, %rax
je 0x5b9f6
movq 0x10(%rbx), %r12
leaq (%r12,%rbp), %rdi
callq 0x62d0
addq %rbp, %rax
movq %rax, (%rbx)
jmp 0x5b93c
movq %rbp, %rax
cmpq %r13, %rax
jne 0x5ba03
pushq $-0x1
popq %rax
jmp 0x5ba33
movq 0x10(%rbx), %rcx
jbe 0x5ba2a
cmpb $0xa, -0x1(%rcx,%rax)
jne 0x5ba2a
leaq -0x1(%rax), %rdx
movq %rdx, (%rbx)
cmpq %r13, %rdx
jbe 0x5ba2d
cmpb $0xd, -0x2(%rcx,%rax)
jne 0x5ba2d
addq $-0x2, %rax
movq %rax, (%rbx)
movq %rax, %rdx
movb $0x0, (%rcx,%rdx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_read_init
static BGZF *bgzf_read_init(hFILE *hfpr)
{
    BGZF *fp;
    uint8_t magic[18];
    ssize_t n = hpeek(hfpr, magic, 18);
    if (n < 0) return NULL;

    fp = (BGZF*)calloc(1, sizeof(BGZF));
    if (fp == NULL) return NULL;

    fp->is_write = 0;
    fp->is_compressed = (n==2 && magic[0]==0x1f && magic[1]==0x8b);
    fp->uncompressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
    fp->compressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
    fp->is_compressed = (n==18 && magic[0]==0x1f && magic[1]==0x8b) ? 1 : 0;
    fp->is_gzip = ( !fp->is_compressed || ((magic[3]&4) && memcmp(&magic[12], "BC\2\0",4)==0) ) ? 0 : 1;
#ifdef BGZF_CACHE
    fp->cache = kh_init(cache);
#endif
    return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsp, %rsi
pushq $0x12
popq %rdx
callq 0x5f6f9
testq %rax, %rax
js 0x5be93
movq %rax, %r14
pushq $0x1
popq %rdi
pushq $0x60
popq %rsi
callq 0x6470
xorl %r15d, %r15d
testq %rax, %rax
je 0x5be93
movq %rax, %rbx
cmpb $0x1f, (%rsp)
setne %bpl
cmpb $-0x75, 0x1(%rsp)
setne %r12b
movl $0x10000, %edi          # imm = 0x10000
callq 0x69d0
movq %rax, 0x20(%rbx)
movl $0x10000, %edi          # imm = 0x10000
callq 0x69d0
movq %rax, 0x28(%rbx)
cmpq $0x12, %r14
setne %cl
orb %bpl, %cl
orb %r12b, %cl
movl %ecx, %eax
xorb $0x1, %al
movzbl %al, %eax
shll $0x1d, %eax
testb %cl, %cl
jne 0x5be7c
movl $0x80000000, %r15d      # imm = 0x80000000
testb $0x4, 0x3(%rsp)
je 0x5be7c
xorl %r15d, %r15d
cmpl $0x24342, 0xc(%rsp)     # imm = 0x24342
setne %r15b
shll $0x1f, %r15d
orl %eax, %r15d
movl %r15d, (%rbx)
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x6470
movq %rax, 0x30(%rbx)
jmp 0x5be95
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_write_init
static BGZF *bgzf_write_init(const char *mode)
{
    BGZF *fp;
    fp = (BGZF*)calloc(1, sizeof(BGZF));
    fp->is_write = 1;
    int compress_level = mode2level(mode);
    if ( compress_level==-2 )
    {
        fp->is_compressed = 0;
        return fp;
    }
    fp->is_compressed = 1;
    fp->uncompressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
    fp->compressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
    fp->compress_level = compress_level < 0? Z_DEFAULT_COMPRESSION : compress_level; // Z_DEFAULT_COMPRESSION==-1
    if (fp->compress_level > 9) fp->compress_level = Z_DEFAULT_COMPRESSION;
    if ( strchr(mode,'g') )
    {
        // gzip output
        fp->is_gzip = 1;
        fp->gz_stream = (z_stream*)calloc(1,sizeof(z_stream));
        fp->gz_stream->zalloc = NULL;
        fp->gz_stream->zfree  = NULL;
        if ( deflateInit2(fp->gz_stream, fp->compress_level, Z_DEFLATED, 15|16, 8, Z_DEFAULT_STRATEGY)!=Z_OK ) return NULL;
    }
    return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
pushq $0x1
popq %rdi
pushq $0x60
popq %rsi
callq 0x6470
movq %rax, %rbx
movq %r14, %rax
movzbl (%rax), %r12d
testl %r12d, %r12d
je 0x5bed7
leal -0x30(%r12), %ecx
incq %rax
cmpb $0x9, %cl
ja 0x5bec1
xorl %r15d, %r15d
cmpl $0x1, %r12d
sbbl %r15d, %r15d
pushq $0x75
popq %rsi
movq %r14, %rdi
callq 0x6270
testq %rax, %rax
jne 0x5bf9d
addl $-0x30, %r12d
orl %r12d, %r15d
cmpl $-0x2, %r15d
je 0x5bf9d
movl $0x10000, %edi          # imm = 0x10000
callq 0x69d0
movq %rax, 0x20(%rbx)
movl $0x10000, %edi          # imm = 0x10000
callq 0x69d0
movq %rax, 0x28(%rbx)
testl %r15d, %r15d
pushq $-0x1
popq %rbp
cmovnsl %r15d, %ebp
movl %ebp, %r15d
shll $0x14, %r15d
andl $0x1ff00000, %r15d      # imm = 0x1FF00000
leal 0x20010000(%r15), %eax
movl %eax, (%rbx)
pushq $0x67
popq %rsi
movq %r14, %rdi
callq 0x6270
testq %rax, %rax
je 0x5bfa3
orl $0xa0010000, %r15d      # imm = 0xA0010000
movl %r15d, (%rbx)
pushq $0x1
popq %rdi
pushq $0x70
popq %rsi
callq 0x6470
movq %rax, 0x58(%rbx)
shll $0x17, %ebp
sarl $0x17, %ebp
leaq 0x2b811(%rip), %r10     # 0x8778a
pushq $0x1f
popq %rcx
pushq $0x8
popq %rdx
movq %rax, %rdi
movl %ebp, %esi
movl %edx, %r8d
xorl %r9d, %r9d
pushq $0x70
pushq %r10
callq 0x6090
popq %rcx
popq %rdx
testl %eax, %eax
je 0x5bfa3
xorl %ebx, %ebx
jmp 0x5bfa3
movl $0x10000, (%rbx)        # imm = 0x10000
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_hopen
BGZF *bgzf_hopen(hFILE *hfp, const char *mode)
{
    BGZF *fp = NULL;
    assert(compressBound(BGZF_BLOCK_SIZE) < BGZF_MAX_BLOCK_SIZE);
    if (strchr(mode, 'r')) {
        fp = bgzf_read_init(hfp);
        if (fp == NULL) return NULL;
    } else if (strchr(mode, 'w') || strchr(mode, 'a')) {
        fp = bgzf_write_init(mode);
    }
    else { errno = EINVAL; return 0; }

    fp->fp = hfp;
    fp->is_be = ed_is_big();
    return fp;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl $0xff00, %edi           # imm = 0xFF00
callq 0x6c10
cmpq $0x10000, %rax          # imm = 0x10000
jae 0x5c0fe
pushq $0x72
popq %rsi
movq %r14, %rdi
callq 0x6270
testq %rax, %rax
je 0x5c0b9
movq %rbx, %rdi
callq 0x5bdd7
testq %rax, %rax
jne 0x5c0e1
xorl %eax, %eax
jmp 0x5c0e9
pushq $0x77
popq %rsi
movq %r14, %rdi
callq 0x6270
testq %rax, %rax
jne 0x5c0d9
pushq $0x61
popq %rsi
movq %r14, %rdi
callq 0x6270
testq %rax, %rax
je 0x5c0f1
movq %r14, %rdi
callq 0x5bea5
movq %rbx, 0x38(%rax)
andb $-0xd, 0x2(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x6060
movl $0x16, (%rax)
jmp 0x5c0b5
leaq 0x2c8eb(%rip), %rdi     # 0x889f0
leaq 0x2c919(%rip), %rsi     # 0x88a25
leaq 0x2c969(%rip), %rcx     # 0x88a7c
movl $0xda, %edx
callq 0x6460
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_compress
int bgzf_compress(void *_dst, size_t *dlen, const void *src, size_t slen, int level)
{
    uint32_t crc;
    z_stream zs;
    uint8_t *dst = (uint8_t*)_dst;

    // compress the body
    zs.zalloc = NULL; zs.zfree = NULL;
    zs.next_in  = (Bytef*)src;
    zs.avail_in = slen;
    zs.next_out = dst + BLOCK_HEADER_LENGTH;
    zs.avail_out = *dlen - BLOCK_HEADER_LENGTH - BLOCK_FOOTER_LENGTH;
    if (deflateInit2(&zs, level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) != Z_OK) return -1; // -15 to disable zlib header/footer
    if (deflate(&zs, Z_FINISH) != Z_STREAM_END) return -1;
    if (deflateEnd(&zs) != Z_OK) return -1;
    *dlen = zs.total_out + BLOCK_HEADER_LENGTH + BLOCK_FOOTER_LENGTH;
    // write the header
    memcpy(dst, g_magic, BLOCK_HEADER_LENGTH); // the last two bytes are a place holder for the length of the block
    packInt16(&dst[16], *dlen - 1); // write the compressed length; -1 to fit 2 bytes
    // write the footer
    crc = crc32(crc32(0L, NULL, 0L), (Bytef*)src, slen);
    packInt32((uint8_t*)&dst[*dlen - 8], crc);
    packInt32((uint8_t*)&dst[*dlen - 4], slen);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
movq %rsp, %rdi
movups %xmm0, 0x40(%rdi)
movq %rdx, (%rdi)
movl %ebx, 0x8(%rdi)
leaq 0x12(%r14), %rax
movq %rax, 0x18(%rdi)
movl (%rsi), %eax
addl $-0x1a, %eax
movl %eax, 0x20(%rdi)
leaq 0x2b62d(%rip), %rax     # 0x8778a
pushq $-0xf
popq %rcx
pushq $0x8
popq %rdx
movl %r8d, %esi
movl %edx, %r8d
xorl %r9d, %r9d
pushq $0x70
pushq %rax
callq 0x6090
popq %rcx
popq %rdx
pushq $-0x1
popq %r13
testl %eax, %eax
jne 0x5c1ec
movq %rsp, %rdi
pushq $0x4
popq %rsi
callq 0x6310
cmpl $0x1, %eax
jne 0x5c1ec
movq %rsp, %rdi
callq 0x6420
testl %eax, %eax
jne 0x5c1ec
movq 0x28(%rsp), %rax
addq $0x1a, %rax
movq %rax, (%r15)
movaps 0x2ca43(%rip), %xmm0    # 0x88bf0
andw $0x0, 0x10(%r14)
movups %xmm0, (%r14)
movl (%r15), %eax
decl %eax
movw %ax, 0x10(%r14)
xorl %r13d, %r13d
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x64b0
movq %rax, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x64b0
movq (%r15), %rcx
movl %eax, -0x8(%r14,%rcx)
movq (%r15), %rax
movl %ebx, -0x4(%r14,%rax)
movl %r13d, %eax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: inflate_gzip_block
static int inflate_gzip_block(BGZF *fp, int cached)
{
    int ret = Z_OK;
    do
    {
        if ( !cached && fp->gz_stream->avail_out!=0 )
        {
            fp->gz_stream->avail_in = hread(fp->fp, fp->compressed_block, BGZF_BLOCK_SIZE);
            if ( fp->gz_stream->avail_in<=0 ) return fp->gz_stream->avail_in;
            if ( fp->gz_stream->avail_in==0 ) break;
            fp->gz_stream->next_in = fp->compressed_block;
        }
        else cached = 0;
        do
        {
            fp->gz_stream->next_out = (Bytef*)fp->uncompressed_block + fp->block_offset;
            fp->gz_stream->avail_out = BGZF_MAX_BLOCK_SIZE - fp->block_offset;
            ret = inflate(fp->gz_stream, Z_NO_FLUSH);
            if ( ret==Z_BUF_ERROR ) continue;   // non-critical error
            if ( ret<0 ) return -1;
            unsigned int have = BGZF_MAX_BLOCK_SIZE - fp->gz_stream->avail_out;
            if ( have ) return have;
        }
        while ( fp->gz_stream->avail_out == 0 );
    }
    while (ret != Z_STREAM_END);
    return BGZF_MAX_BLOCK_SIZE - fp->gz_stream->avail_out;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x58(%rdi), %rdi
testl %esi, %esi
jne 0x5c965
cmpl $0x0, 0x20(%rdi)
sete %dl
testb $0x1, %dl
jne 0x5c965
movq 0x28(%rbx), %rsi
movq 0x38(%rbx), %rdi
movl $0xff00, %edx           # imm = 0xFF00
callq 0x5c8c7
movq 0x58(%rbx), %rdi
movl %eax, 0x8(%rdi)
testl %eax, %eax
je 0x5c9be
movq 0x28(%rbx), %rax
movq %rax, (%rdi)
movslq 0xc(%rbx), %rax
movl $0x10000, %ecx          # imm = 0x10000
subl %eax, %ecx
addq 0x20(%rbx), %rax
movq %rax, 0x18(%rdi)
movl %ecx, 0x20(%rdi)
xorl %esi, %esi
callq 0x6540
cmpl $-0x5, %eax
jne 0x5c99b
movq 0x58(%rbx), %rdi
movl 0x20(%rdi), %edx
testl %edx, %edx
je 0x5c965
movl $0x10000, %ecx          # imm = 0x10000
subl %edx, %ecx
jmp 0x5c9b0
testl %eax, %eax
js 0x5c9b9
movq 0x58(%rbx), %rdi
movl 0x20(%rdi), %edx
xorl %ecx, %ecx
cmpl $0x10000, %edx          # imm = 0x10000
jne 0x5c9c2
xorl %edx, %edx
cmpl $0x1, %eax
jne 0x5c93c
jmp 0x5c9c9
pushq $-0x1
popq %rcx
jmp 0x5c9c9
xorl %ecx, %ecx
jmp 0x5c9c9
movl $0x10000, %ecx          # imm = 0x10000
subl %edx, %ecx
movl %ecx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_read
ssize_t bgzf_read(BGZF *fp, void *data, size_t length)
{
    ssize_t bytes_read = 0;
    uint8_t *output = (uint8_t*)data;
    if (length <= 0) return 0;
    assert(fp->is_write == 0);
    while (bytes_read < length) {
        int copy_length, available = fp->block_length - fp->block_offset;
        uint8_t *buffer;
        if (available <= 0) {
            if (bgzf_read_block(fp) != 0) return -1;
            available = fp->block_length - fp->block_offset;
            if (available <= 0) break;
        }
        copy_length = length - bytes_read < available? length - bytes_read : available;
        buffer = (uint8_t*)fp->uncompressed_block;
        memcpy(output, buffer + fp->block_offset, copy_length);
        fp->block_offset += copy_length;
        output += copy_length;
        bytes_read += copy_length;
    }
    if (fp->block_offset == fp->block_length) {
        fp->block_address = htell(fp->fp);
        fp->block_offset = fp->block_length = 0;
    }
    fp->uncompressed_address += bytes_read;
    return bytes_read;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x5cad8
movq %rdi, %r14
testb $0x3, 0x2(%rdi)
jne 0x5cb15
movq %rdx, %rbp
movq %rsi, %r12
movl 0xc(%r14), %eax
xorl %ebx, %ebx
movq %rbp, %r15
movl 0x8(%r14), %ecx
subq %rbx, %r15
jbe 0x5cadc
subl %eax, %ecx
jg 0x5caa9
movq %r14, %rdi
callq 0x5c1fd
testl %eax, %eax
jne 0x5cb00
movl 0x8(%r14), %edx
movl 0xc(%r14), %eax
movl %edx, %ecx
subl %eax, %ecx
jle 0x5cade
movl %ecx, %r13d
cmpq %r13, %r15
cmovbq %r15, %r13
movslq %eax, %rsi
addq 0x20(%r14), %rsi
movq %r12, %rdi
movq %r13, %rdx
callq 0x6570
movl 0xc(%r14), %eax
addl %r13d, %eax
movl %eax, 0xc(%r14)
addq %r13, %r12
addq %r13, %rbx
jmp 0x5ca7f
xorl %ebx, %ebx
jmp 0x5cb03
movl %ecx, %edx
cmpl %edx, %eax
jne 0x5cafa
movq 0x38(%r14), %rax
movq 0x28(%rax), %rcx
addq 0x8(%rax), %rcx
subq (%rax), %rcx
movq %rcx, 0x10(%r14)
andq $0x0, 0x8(%r14)
addq %rbx, 0x18(%r14)
jmp 0x5cb03
pushq $-0x1
popq %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2bf88(%rip), %rdi     # 0x88aa4
leaq 0x2bf02(%rip), %rsi     # 0x88a25
leaq 0x2bf8c(%rip), %rcx     # 0x88ab6
movl $0x229, %edx            # imm = 0x229
callq 0x6460
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_flush
int bgzf_flush(BGZF *fp)
{
    if (!fp->is_write) return 0;
#ifdef BGZF_MT
    if (fp->mt) {
        if (fp->block_offset) mt_queue(fp); // guaranteed that assertion does not fail
        return mt_flush_queue(fp);
    }
#endif
    while (fp->block_offset > 0) {
        if ( fp->idx_build_otf )
        {
            bgzf_index_add_block(fp);
            fp->idx->ublock_addr += fp->block_offset;
        }
        int block_length = deflate_block(fp, fp->block_offset);
        if (block_length < 0) return -1;
        if (hwrite(fp->fp, fp->compressed_block, block_length) != block_length) {
            fp->errcode |= BGZF_ERR_IO; // possibly truncated file
            return -1;
        }
        fp->block_address += block_length;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testb $0x3, 0x2(%rdi)
je 0x5cd4d
movq %rdi, %rbx
cmpq $0x0, 0x40(%rdi)
je 0x5ccff
cmpl $0x0, 0xc(%rbx)
je 0x5ccf3
movq %rbx, %rdi
callq 0x5cd5b
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x5cdc2
pushq $-0x1
popq %rbp
movl 0xc(%rbx), %esi
testl %esi, %esi
jle 0x5cd4d
cmpl $0x0, 0x50(%rbx)
je 0x5cd23
movq %rbx, %rdi
callq 0x5c9cd
movslq 0xc(%rbx), %rsi
movq 0x48(%rbx), %rax
addq %rsi, 0x10(%rax)
movq %rbx, %rdi
callq 0x5ce99
testl %eax, %eax
js 0x5cd4f
movq 0x28(%rbx), %rsi
movq 0x38(%rbx), %rdi
movl %eax, %r14d
movq %r14, %rdx
callq 0x5cf25
cmpq %r14, %rax
jne 0x5cd56
addq %r14, 0x10(%rbx)
jmp 0x5cd02
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
orb $0x4, (%rbx)
jmp 0x5cd4f
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: mt_queue
static void mt_queue(BGZF *fp)
{
    mtaux_t *mt = fp->mt;
    assert(mt->curr < mt->n_blks); // guaranteed by the caller
    memcpy(mt->blk[mt->curr], fp->uncompressed_block, fp->block_offset);
    mt->len[mt->curr] = fp->block_offset;
    fp->block_offset = 0;
    ++mt->curr;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x40(%rdi), %r14
movslq 0x8(%r14), %rax
cmpl 0x4(%r14), %eax
jge 0x5cda3
movq %rdi, %rbx
movq 0x18(%r14), %rcx
movq (%rcx,%rax,8), %rdi
movq 0x20(%rbx), %rsi
movslq 0xc(%rbx), %rdx
callq 0x6570
movl 0xc(%rbx), %eax
movq 0x20(%r14), %rcx
movslq 0x8(%r14), %rdx
movl %eax, (%rcx,%rdx,4)
andl $0x0, 0xc(%rbx)
incl 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x2be13(%rip), %rdi     # 0x88bbd
leaq 0x2bc74(%rip), %rsi     # 0x88a25
leaq 0x2be1b(%rip), %rcx     # 0x88bd3
movl $0x2aa, %edx            # imm = 0x2AA
callq 0x6460
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: mt_flush_queue
static int mt_flush_queue(BGZF *fp)
{
    int i;
    mtaux_t *mt = fp->mt;
    // signal all the workers to compress
    pthread_mutex_lock(&mt->lock);
    for (i = 0; i < mt->n_threads; ++i) mt->w[i].toproc = 1;
    mt->proc_cnt = 0;
    pthread_cond_broadcast(&mt->cv);
    pthread_mutex_unlock(&mt->lock);
    // worker 0 is doing things here
    worker_aux(&mt->w[0]);
    // wait for all the threads to complete
    while (mt->proc_cnt < mt->n_threads);
    // dump data to disk
    for (i = 0; i < mt->n_threads; ++i) fp->errcode |= mt->w[i].errcode;
    for (i = 0; i < mt->curr; ++i)
        if (hwrite(fp->fp, mt->blk[i], mt->len[i]) != mt->len[i]) {
            fp->errcode |= BGZF_ERR_IO;
            break;
        }
    mt->curr = 0;
    return (fp->errcode == 0)? 0 : -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x40(%rdi), %r15
leaq 0x38(%r15), %r14
movq %r14, %rdi
callq 0x6ae0
movl (%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
shlq $0x5, %rax
cmpq %rcx, %rax
je 0x5cdff
movq 0x28(%r15), %rdx
movl $0x1, 0x18(%rdx,%rcx)
addq $0x20, %rcx
jmp 0x5cde8
movl $0x0, 0x10(%r15)
leaq 0x60(%r15), %rdi
callq 0x6250
movq %r14, %rdi
callq 0x64f0
movq 0x28(%r15), %rdi
callq 0x5df3b
movl (%r15), %edx
movl 0x10(%r15), %eax
cmpl %edx, %eax
jl 0x5ce24
pushq $0x14
popq %rax
xorl %ecx, %ecx
movslq %edx, %rdx
cmpq %rdx, %rcx
jge 0x5ce4f
movq 0x28(%r15), %rdx
movzwl (%rdx,%rax), %edx
orl %edx, (%rbx)
incq %rcx
movl (%r15), %edx
addq $0x20, %rax
jmp 0x5ce31
xorl %r14d, %r14d
movslq 0x8(%r15), %rax
cmpq %rax, %r14
jge 0x5ce87
movq 0x38(%rbx), %rdi
movq 0x18(%r15), %rax
movq 0x20(%r15), %rcx
movq (%rax,%r14,8), %rsi
movslq (%rcx,%r14,4), %rdx
callq 0x5cf25
movq 0x20(%r15), %rcx
movslq (%rcx,%r14,4), %rcx
incq %r14
cmpq %rcx, %rax
je 0x5ce52
orb $0x4, (%rbx)
andl $0x0, 0x8(%r15)
xorl %eax, %eax
cmpw (%rbx), %ax
sbbl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: deflate_block
static int deflate_block(BGZF *fp, int block_length)
{
    size_t comp_size = BGZF_MAX_BLOCK_SIZE;
    int ret;
    if ( !fp->is_gzip )
        ret = bgzf_compress(fp->compressed_block, &comp_size, fp->uncompressed_block, block_length, fp->compress_level);
    else
        ret = bgzf_gzip_compress(fp, fp->compressed_block, &comp_size, fp->uncompressed_block, block_length, fp->compress_level);

    if ( ret != 0 )
    {
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    fp->block_offset = 0;
    return comp_size;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq $0x10000, (%rsp)        # imm = 0x10000
movl (%rdi), %r8d
movq 0x28(%rdi), %rdi
movq 0x20(%rbx), %rdx
testl %r8d, %r8d
js 0x5ced5
movslq %esi, %rcx
shll $0x3, %r8d
sarl $0x17, %r8d
movq %rsp, %rsi
callq 0x5c11d
testl %eax, %eax
jne 0x5cf05
movq (%rsp), %rax
jmp 0x5cf19
movq 0x58(%rbx), %r14
xorl %eax, %eax
testl %esi, %esi
sete %al
shll $0x2, %eax
movq %rdx, (%r14)
movl %esi, 0x8(%r14)
movq %rdi, 0x18(%r14)
movl $0x10000, 0x20(%r14)    # imm = 0x10000
movq %r14, %rdi
movl %eax, %esi
callq 0x6310
cmpl $-0x2, %eax
jne 0x5cf0d
orb $0x1, (%rbx)
pushq $-0x1
popq %rax
jmp 0x5cf1d
movl 0x20(%r14), %ecx
movl $0x10000, %eax          # imm = 0x10000
subq %rcx, %rax
andl $0x0, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: lazy_flush
static int lazy_flush(BGZF *fp)
{
    if (fp->mt) {
        if (fp->block_offset) mt_queue(fp);
        return (fp->mt->curr < fp->mt->n_blks)? 0 : mt_flush_queue(fp);
    }
    else return bgzf_flush(fp);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x40(%rdi), %rax
testq %rax, %rax
je 0x5cfc1
cmpl $0x0, 0xc(%rbx)
je 0x5cfb5
movq %rbx, %rdi
callq 0x5cd5b
movq 0x40(%rbx), %rax
movl 0x8(%rax), %ecx
cmpl 0x4(%rax), %ecx
jge 0x5cfca
xorl %eax, %eax
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0x5ccd1
movq %rbx, %rdi
popq %rbx
jmp 0x5cdc2
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_write
ssize_t bgzf_write(BGZF *fp, const void *data, size_t length)
{
    if ( !fp->is_compressed )
        return hwrite(fp->fp, data, length);

    const uint8_t *input = (const uint8_t*)data;
    ssize_t remaining = length;
    assert(fp->is_write);
    while (remaining > 0) {
        uint8_t* buffer = (uint8_t*)fp->uncompressed_block;
        int copy_length = BGZF_BLOCK_SIZE - fp->block_offset;
        if (copy_length > remaining) copy_length = remaining;
        memcpy(buffer + fp->block_offset, input, copy_length);
        fp->block_offset += copy_length;
        input += copy_length;
        remaining -= copy_length;
        if (fp->block_offset == BGZF_BLOCK_SIZE) {
            if (lazy_flush(fp) != 0) return -1;
        }
    }
    return length - remaining;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl (%rdi), %eax
testl $0x60000000, %eax       # imm = 0x60000000
je 0x5d06b
testl $0x30000, %eax          # imm = 0x30000
je 0x5d088
pushq $-0x1
popq %r12
movq %rbx, %rbp
testq %rbp, %rbp
jle 0x5d053
movslq 0xc(%r15), %rdi
movl $0xff00, %eax           # imm = 0xFF00
subq %rdi, %rax
cmpq %rax, %rbp
movl %ebp, %ecx
cmovgel %eax, %ecx
addq 0x20(%r15), %rdi
movslq %ecx, %r13
movq %r14, %rsi
movq %r13, %rdx
callq 0x6570
movl 0xc(%r15), %eax
addl %r13d, %eax
movl %eax, 0xc(%r15)
addq %r13, %r14
subq %r13, %rbp
cmpl $0xff00, %eax           # imm = 0xFF00
jne 0x5d002
movq %r15, %rdi
callq 0x5cf96
testl %eax, %eax
je 0x5d002
jmp 0x5d059
subq %rbp, %rbx
movq %rbx, %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5cf25
leaq 0x2ba51(%rip), %rdi     # 0x88ae0
leaq 0x2b98f(%rip), %rsi     # 0x88a25
leaq 0x2ba50(%rip), %rcx     # 0x88aed
movl $0x308, %edx            # imm = 0x308
callq 0x6460
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_check_EOF
int bgzf_check_EOF(BGZF *fp)
{
    uint8_t buf[28];
    off_t offset = htell(fp->fp);
    if (hseek(fp->fp, -28, SEEK_END) < 0) {
        if (errno == ESPIPE) { hclearerr(fp->fp); return 2; }
        else return -1;
    }
    if ( hread(fp->fp, buf, 28) != 28 ) return -1;
    if ( hseek(fp->fp, offset, SEEK_SET) < 0 ) return -1;
    return (memcmp("\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\033\0\3\0\0\0\0\0\0\0\0\0", buf, 28) == 0)? 1 : 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
movq 0x38(%rdi), %rdi
movq 0x28(%rdi), %r15
addq 0x8(%rdi), %r15
subq (%rdi), %r15
pushq $-0x1c
popq %rsi
pushq $0x2
popq %rbx
movl %ebx, %edx
callq 0x5f9ba
testq %rax, %rax
js 0x5d396
movq 0x38(%r14), %rdi
movq %rsp, %rsi
pushq $0x1c
popq %rdx
callq 0x5c8c7
pushq $-0x1
popq %rbx
cmpq $0x1c, %rax
jne 0x5d3ad
movq 0x38(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x5f9ba
testq %rax, %rax
js 0x5d3ad
leaq 0x2b881(%rip), %rdi     # 0x88c03
movq %rsp, %rsi
pushq $0x1c
popq %rdx
callq 0x6710
xorl %ebx, %ebx
testl %eax, %eax
sete %bl
jmp 0x5d3ad
callq 0x6060
cmpl $0x1d, (%rax)
jne 0x5d3aa
movq 0x38(%r14), %rax
andl $0x0, 0x34(%rax)
jmp 0x5d3ad
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_seek
int64_t bgzf_seek(BGZF* fp, int64_t pos, int where)
{
    int block_offset;
    int64_t block_address;

    if (fp->is_write || where != SEEK_SET) {
        fp->errcode |= BGZF_ERR_MISUSE;
        return -1;
    }
    block_offset = pos & 0xFFFF;
    block_address = pos >> 16;
    if (hseek(fp->fp, block_address, SEEK_SET) < 0) {
        fp->errcode |= BGZF_ERR_IO;
        return -1;
    }
    fp->block_length = 0;  // indicates current block has not been loaded
    fp->block_address = block_address;
    fp->block_offset = block_offset;
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %eax
movl %eax, %ecx
andl $0x30000, %ecx          # imm = 0x30000
orl %edx, %ecx
je 0x5d3d9
orl $0x8, %eax
movl %eax, (%rbx)
pushq $-0x1
popq %rax
jmp 0x5d407
movq %rsi, %r14
movq %rsi, %r15
sarq $0x10, %r15
movq 0x38(%rbx), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x5f9ba
testq %rax, %rax
js 0x5d40d
andl $0x0, 0x8(%rbx)
movzwl %r14w, %eax
movq %r15, 0x10(%rbx)
movl %eax, 0xc(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
orb $0x4, (%rbx)
jmp 0x5d3d4
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_is_bgzf
int bgzf_is_bgzf(const char *fn)
{
    uint8_t buf[16];
    int n;
    hFILE *fp;
    if ((fp = hopen(fn, "r")) == 0) return 0;
    n = hread(fp, buf, 16);
    if ( hclose(fp) < 0 ) return -1;
    if (n != 16) return 0;
    return memcmp(g_magic, buf, 16) == 0? 1 : 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x279e7(%rip), %rsi     # 0x84e09
callq 0x5fdb8
xorl %ebx, %ebx
testq %rax, %rax
je 0x5d474
movq %rax, %r14
movq %rsp, %rsi
pushq $0x10
popq %rdx
movq %rax, %rdi
callq 0x5c8c7
movq %rax, %r15
movq %r14, %rdi
callq 0x5fa52
testl %eax, %eax
js 0x5d471
cmpl $0x10, %r15d
jne 0x5d474
movdqa (%rsp), %xmm0
pcmpeqb 0x2b57f(%rip), %xmm0    # 0x889e0
pmovmskb %xmm0, %eax
xorl %ebx, %ebx
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bl
jmp 0x5d474
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_getc
int bgzf_getc(BGZF *fp)
{
    int c;
    if (fp->block_offset >= fp->block_length) {
        if (bgzf_read_block(fp) != 0) return -2; /* error */
        if (fp->block_length == 0) return -1; /* end-of-file */
    }
    c = ((unsigned char*)fp->uncompressed_block)[fp->block_offset++];
    if (fp->block_offset == fp->block_length) {
        fp->block_address = htell(fp->fp);
        fp->block_offset = 0;
        fp->block_length = 0;
    }
    fp->uncompressed_address++;
    return c;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x8(%rdi), %ecx
movl 0xc(%rdi), %eax
cmpl %ecx, %eax
jge 0x5d4c0
movq 0x20(%rbx), %rdx
leal 0x1(%rax), %esi
movl %esi, 0xc(%rbx)
cltq
movzbl (%rdx,%rax), %eax
cmpl %ecx, %esi
jne 0x5d4ba
movq 0x38(%rbx), %rcx
movq 0x28(%rcx), %rdx
addq 0x8(%rcx), %rdx
subq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
andq $0x0, 0x8(%rbx)
incq 0x18(%rbx)
jmp 0x5d4cf
movq %rbx, %rdi
callq 0x5c1fd
testl %eax, %eax
je 0x5d4d1
pushq $-0x2
popq %rax
popq %rbx
retq
movl 0x8(%rbx), %ecx
testl %ecx, %ecx
je 0x5d4dd
movl 0xc(%rbx), %eax
jmp 0x5d48e
pushq $-0x1
jmp 0x5d4ce
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/bgzf.c
// Function: worker_aux
static int worker_aux(worker_t *w)
{
    int i, stop = 0;
    // wait for condition: to process or all done
    pthread_mutex_lock(&w->mt->lock);
    while (!w->toproc && !w->mt->done)
        pthread_cond_wait(&w->mt->cv, &w->mt->lock);
    if (w->mt->done) stop = 1;
    w->toproc = 0;
    pthread_mutex_unlock(&w->mt->lock);
    if (stop) return 1; // to quit the thread
    w->errcode = 0;
    for (i = w->i; i < w->mt->curr; i += w->mt->n_threads) {
        size_t clen = BGZF_MAX_BLOCK_SIZE;
        if (bgzf_compress(w->buf, &clen, w->mt->blk[i], w->mt->len[i], w->compress_level) != 0)
            w->errcode |= BGZF_ERR_ZLIB;
        memcpy(w->mt->blk[i], w->buf, clen);
        w->mt->len[i] = clen;
    }
    __sync_fetch_and_add(&w->mt->proc_cnt, 1);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq (%rdi), %rdi
addq $0x38, %rdi
callq 0x6ae0
cmpl $0x0, 0x18(%rbx)
movq (%rbx), %rdi
movl 0xc(%rdi), %ebp
jne 0x5df79
leaq 0x38(%rdi), %rsi
testl %ebp, %ebp
jne 0x5dffd
addq $0x60, %rdi
callq 0x6b90
jmp 0x5df56
andl $0x0, 0x18(%rbx)
addq $0x38, %rdi
callq 0x64f0
testl %ebp, %ebp
jne 0x5e009
andl $0x0, 0x14(%rbx)
movl 0x10(%rbx), %ebp
movq (%rbx), %rax
leaq 0x8(%rsp), %r14
cmpl 0x8(%rax), %ebp
jge 0x5e019
movq $0x10000, 0x8(%rsp)     # imm = 0x10000
movq 0x8(%rbx), %rdi
movslq %ebp, %r12
movq 0x18(%rax), %rcx
movq 0x20(%rax), %rax
movq (%rcx,%r12,8), %rdx
movslq (%rax,%r12,4), %rcx
movl 0x1c(%rbx), %r8d
movq %r14, %rsi
callq 0x5c11d
testl %eax, %eax
je 0x5dfd2
orb $0x1, 0x14(%rbx)
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movq 0x18(%rax), %rax
movq (%rax,%r12,8), %rdi
movq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0x6570
movq (%rbx), %rax
movq 0x20(%rax), %rcx
movl %r15d, (%rcx,%r12,4)
addl (%rax), %ebp
jmp 0x5df99
andl $0x0, 0x18(%rbx)
movq %rsi, %rdi
callq 0x64f0
pushq $0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
lock
incl 0x10(%rax)
xorl %eax, %eax
jmp 0x5e00c
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/faidx.c
// Function: fai_save
void fai_save(const faidx_t *fai, FILE *fp)
{
    khint_t k;
    int i;
    for (i = 0; i < fai->n; ++i) {
        faidx1_t x;
        k = kh_get(s, fai->hash, fai->name[i]);
        x = kh_value(fai->hash, k);
#ifdef _WIN32
        fprintf(fp, "%s\t%d\t%ld\t%d\t%d\n", fai->name[i], (int)x.len, (long)x.offset, (int)x.line_blen, (int)x.line_len);
#else
        fprintf(fp, "%s\t%d\t%lld\t%d\t%d\n", fai->name[i], (int)x.len, (long long)x.offset, (int)x.line_blen, (int)x.line_len);
#endif
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x2a5ec(%rip), %r15     # 0x88cd1
xorl %ebp, %ebp
movslq 0x8(%r14), %rax
cmpq %rax, %rbp
jge 0x5e73b
movq 0x10(%r14), %rax
movq 0x18(%r14), %r12
movq (%rax,%rbp,8), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x5e74a
movq 0x20(%r12), %rdx
movl %eax, %eax
imulq $0x18, %rax, %rax
movl (%rdx,%rax), %esi
movl 0x4(%rdx,%rax), %r9d
movl 0x8(%rdx,%rax), %ecx
movq 0x10(%rdx,%rax), %r8
movl %esi, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x6a90
incq %rbp
jmp 0x5e6e7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/faidx.c
// Function: fai_read
faidx_t *fai_read(FILE *fp)
{
    faidx_t *fai;
    char *buf, *p;
    int len, line_len, line_blen;
#ifdef _WIN32
    long offset;
#else
    long long offset;
#endif
    fai = (faidx_t*)calloc(1, sizeof(faidx_t));
    fai->hash = kh_init(s);
    buf = (char*)calloc(0x10000, 1);
    while (!feof(fp) && fgets(buf, 0x10000, fp)) {
        for (p = buf; *p && isgraph(*p); ++p);
        *p = 0; ++p;
#ifdef _WIN32
        sscanf(p, "%d%ld%d%d", &len, &offset, &line_blen, &line_len);
#else
        sscanf(p, "%d%lld%d%d", &len, &offset, &line_blen, &line_len);
#endif
        fai_insert_index(fai, buf, len, line_len, line_blen, offset);
    }
    free(buf);
    return fai;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
pushq $0x1
popq %r15
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x6470
movq %rax, %r14
callq 0x5e39c
movq %rax, 0x18(%r14)
movl $0x10000, %edi          # imm = 0x10000
movq %r15, %rsi
callq 0x6470
movq %rax, %r15
movq %rax, %r12
incq %r12
movq %rbx, %rdi
callq 0x6bc0
testl %eax, %eax
jne 0x5e8df
movq %r15, %rdi
movl $0x10000, %esi          # imm = 0x10000
movq %rbx, %rdx
callq 0x6c00
testq %rax, %rax
je 0x5e8df
movq %r12, %rbp
movsbq -0x1(%rbp), %r13
testq %r13, %r13
je 0x5e894
callq 0x6790
movq (%rax), %rax
cmpw $0x0, (%rax,%r13,2)
jns 0x5e894
incq %rbp
jmp 0x5e875
movb $0x0, -0x1(%rbp)
movq %rbp, %rdi
leaq 0x2a441(%rip), %rsi     # 0x88ce3
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x4(%rsp), %r8
leaq 0x8(%rsp), %r9
xorl %eax, %eax
callq 0x66d0
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %r8d
movq 0x10(%rsp), %r9
movq %r14, %rdi
movq %r15, %rsi
callq 0x5e3a7
jmp 0x5e84d
movq %r15, %rdi
callq 0x68a0
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/faidx.c
// Function: fai_build
int fai_build(const char *fn)
{
    char *str;
    BGZF *bgzf;
    FILE *fp;
    faidx_t *fai;
    str = (char*)calloc(strlen(fn) + 5, 1);
    sprintf(str, "%s.fai", fn);
    bgzf = bgzf_open(fn, "r");
    if ( !bgzf ) {
        fprintf(stderr, "[fai_build] fail to open the FASTA file %s\n",fn);
        free(str);
        return -1;
    }
    if ( bgzf->is_compressed ) bgzf_index_build_init(bgzf);
    fai = fai_build_core(bgzf);
    if ( !fai )
    {
        if ( bgzf->is_compressed && bgzf->is_gzip ) fprintf(stderr,"Cannot index files compressed with gzip, please use bgzip\n");
        bgzf_close(bgzf);
        free(str);
        return -1;
    }
    if ( bgzf->is_compressed ) bgzf_index_dump(bgzf, fn, ".gzi");
    bgzf_close(bgzf);
    fp = fopen(str, "wb");
    if ( !fp ) {
        fprintf(stderr, "[fai_build] fail to write FASTA index %s\n",str);
        fai_destroy(fai); free(str);
        return -1;
    }
    fai_save(fai, fp);
    fclose(fp);
    free(str);
    fai_destroy(fai);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x62d0
leaq 0x5(%rax), %rdi
pushq $0x1
popq %rsi
callq 0x6470
movq %rax, %rbx
leaq 0x297d7(%rip), %rsi     # 0x880f6
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x6170
leaq 0x264d6(%rip), %rsi     # 0x84e09
movq %r14, %rdi
callq 0x5bd04
testq %rax, %rax
je 0x5e9f7
movq %rax, %r15
testb $0x60, 0x3(%rax)
je 0x5e955
movq %r15, %rdi
callq 0x5d67f
movq %r15, %rdi
callq 0x5e024
movq %rax, %r12
movl (%r15), %eax
testq %r12, %r12
je 0x5e9c7
testl $0x60000000, %eax       # imm = 0x60000000
je 0x5e981
leaq 0x29787(%rip), %rdx     # 0x880fd
movq %r15, %rdi
movq %r14, %rsi
callq 0x5d6ac
movq %r15, %rdi
callq 0x5d0b0
leaq 0x231b6(%rip), %rsi     # 0x81b46
movq %rbx, %rdi
callq 0x6880
testq %rax, %rax
je 0x5ea14
movq %rax, %r14
movq %r12, %rdi
movq %rax, %rsi
callq 0x5e6cd
movq %r14, %rdi
callq 0x66e0
movq %rbx, %rdi
callq 0x68a0
movq %r12, %rdi
callq 0x5e65b
xorl %eax, %eax
jmp 0x5e9eb
testl $0x60000000, %eax       # imm = 0x60000000
sete %cl
testl %eax, %eax
setns %al
orb %cl, %al
je 0x5ea39
movq %r15, %rdi
callq 0x5d0b0
movq %rbx, %rdi
callq 0x68a0
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x545da(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
leaq 0x2a2e6(%rip), %rsi     # 0x88cee
movq %r14, %rdx
xorl %eax, %eax
callq 0x6a90
jmp 0x5e9e0
movq 0x545bd(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
leaq 0x2a330(%rip), %rsi     # 0x88d55
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6a90
movq %r12, %rdi
callq 0x5e65b
jmp 0x5e9e0
movq 0x54598(%rip), %rax     # 0xb2fd8
movq (%rax), %rcx
leaq 0x2a2d0(%rip), %rdi     # 0x88d1a
pushq $0x3a
popq %rsi
pushq $0x1
popq %rdx
callq 0x6e70
jmp 0x5e9d8