LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x30, %edi
callq 0x69d0
testq %rax, %rax
je 0x657f0
movq %rax, %r14
movq %r13, (%rax)
movq %r12, 0x8(%rax)
movq $0x0, 0x10(%rax)
movq %rbx, 0x18(%rax)
movq %r15, 0x20(%rax)
testq %r15, %r15
je 0x657fa
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 0x65802
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x65880
movl $0x0, 0x28(%r14)
leaq 0x30(%rbx), %r15
movq %r15, %rdi
callq 0x6ae0
movl 0x4(%rbx), %eax
cmpl (%rbx), %eax
jl 0x6582e
leaq 0xb8(%rbx), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x6b90
movl 0x4(%rbx), %eax
cmpl (%rbx), %eax
jge 0x6581c
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 0x65876
movl 0x20(%rbx), %edx
subl 0x8(%rbx), %edx
cmpl %edx, %eax
jl 0x65876
movq 0x28(%rbx), %rax
leaq (%rcx,%rcx,4), %rcx
shlq $0x4, %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_O3/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
movl 0x20(%r14), %eax
testl %eax, %eax
jle 0x65a41
movl $0x18, %r15d
xorl %r12d, %r12d
movq 0xe8(%r14), %rcx
cmpl $0x0, (%rcx,%r12,4)
je 0x65a32
movq 0x28(%r14), %rdi
addq %r15, %rdi
callq 0x6040
movl 0x20(%r14), %eax
incq %r12
movslq %eax, %rcx
addq $0x50, %r15
cmpq %rcx, %r12
jl 0x65a14
leaq 0x58(%r14), %r15
cmpl $0x0, 0x4(%r14)
jne 0x65a56
movl 0x8(%r14), %eax
cmpl 0x20(%r14), %eax
je 0x65a63
movq %r15, %rdi
movq %rbx, %rsi
callq 0x6b90
jmp 0x65a45
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_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x65abf
cmpl $0x0, 0x20(%rbx)
jle 0x65b33
movl $0x10, %r14d
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq (%rax,%r14), %rdi
movl $0x2, %esi
callq 0x6990
incq %r15
movslq 0x20(%rbx), %rax
addq $0x50, %r14
cmpq %rax, %r15
jl 0x65a9b
jmp 0x65b33
leaq 0x30(%rbx), %r14
movq %r14, %rdi
callq 0x6ae0
movl $0x1, 0xc(%rbx)
cmpl $0x0, 0x20(%rbx)
jle 0x65afd
movl $0x18, %r15d
xorl %r12d, %r12d
movq 0x28(%rbx), %rdi
addq %r15, %rdi
callq 0x6040
incq %r12
movslq 0x20(%rbx), %rax
addq $0x50, %r15
cmpq %rax, %r12
jl 0x65ae1
movq %r14, %rdi
callq 0x64f0
cmpl $0x0, 0x20(%rbx)
jle 0x65b33
movl $0x10, %r14d
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq (%rax,%r14), %rdi
xorl %esi, %esi
callq 0x6610
incq %r15
movslq 0x20(%rbx), %rax
addq $0x50, %r14
cmpq %rax, %r15
jl 0x65b14
leaq 0x30(%rbx), %rdi
callq 0x6860
leaq 0x58(%rbx), %rdi
callq 0x6e60
leaq 0xb8(%rbx), %rdi
callq 0x6e60
cmpl $0x0, 0x20(%rbx)
jle 0x65b7c
movl $0x18, %r14d
xorl %r15d, %r15d
movq 0x28(%rbx), %rdi
addq %r14, %rdi
callq 0x6e60
incq %r15
movslq 0x20(%rbx), %rax
addq $0x50, %r14
cmpq %rax, %r15
jl 0x65b60
movq 0xe8(%rbx), %rdi
testq %rdi, %rdi
je 0x65b8d
callq 0x68a0
movq 0x28(%rbx), %rdi
callq 0x68a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x68a0
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 0x65fc4
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_O3/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 0x65fe5
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_O3/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 0x66024
callq 0x61e0
cmpl $-0x1, %eax
je 0x66063
movl %eax, %ebx
movq (%r14), %rsi
movl %eax, %edi
callq 0x6150
jmp 0x66068
movq 0x8(%r14), %rsi
movl (%rsi), %eax
testl %eax, %eax
je 0x66047
decl %eax
movl %eax, (%rsi)
incq 0x10(%rsi)
movq 0x8(%rsi), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rsi)
movzbl (%rax), %ebx
jmp 0x6605a
movq %rsi, %rdi
callq 0x6cf0
cmpl $-0x1, %eax
je 0x66063
movl %eax, %ebx
movq 0x8(%r14), %rsi
movl %ebx, %edi
callq 0x6690
jmp 0x66068
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %edi
movl $0x10, %esi
callq 0x6470
testq %rax, %rax
je 0x66168
movq %rax, %rbx
cmpb $0x7a, (%r15)
je 0x66114
cmpb $0x7a, 0x1(%r15)
je 0x66114
movq %r14, %rdi
movq %r15, %rsi
callq 0x6880
movq %rax, (%rbx)
testq %rax, %rax
je 0x66114
movq %rax, %r12
movq %rsp, %rdi
movl $0x1, %esi
movl $0x2, %edx
movq %rax, %rcx
callq 0x6b20
cmpq $0x2, %rax
jne 0x66160
cmpb $0x1f, (%rsp)
jne 0x6617c
cmpb $-0x75, 0x1(%rsp)
jne 0x6617c
movq %r12, %rdi
callq 0x66e0
movq $0x0, (%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x6b00
movq %rax, 0x8(%rbx)
testq %rax, %rax
jne 0x6616a
leaq 0x33b19(%rip), %rsi     # 0x99c48
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 0x6616a
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 0x6616a
// File: /workspace/github_c_makefile_star2_O3/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 0x665f7
cmpb $0xa, -0x1(%r12,%rax)
je 0x666a3
movq 0x8(%rbx), %rcx
cmpq $-0xc9, %rcx
ja 0x6666c
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0xc7, %rdx
ja 0x6666c
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 0x66668
movq %rax, %r12
movq %rax, 0x10(%rbx)
jmp 0x6666c
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 0x666a0
movq 0x10(%rbx), %r12
leaq (%r12,%rbp), %rdi
callq 0x62d0
addq %rbp, %rax
movq %rax, (%rbx)
jmp 0x665e6
movq %rbp, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %r13, %rax
je 0x666dd
movq 0x10(%rbx), %rcx
jbe 0x666d4
cmpb $0xa, -0x1(%rcx,%rax)
jne 0x666d4
leaq -0x1(%rax), %rdx
movq %rdx, (%rbx)
cmpq %r13, %rdx
jbe 0x666d7
cmpb $0xd, -0x2(%rcx,%rax)
jne 0x666d7
addq $-0x2, %rax
movq %rax, (%rbx)
movq %rax, %rdx
movb $0x0, (%rcx,%rdx)
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x12, %edx
callq 0x6b023
testq %rax, %rax
js 0x66c5b
movq %rax, %r14
movl $0x1, %edi
movl $0x60, %esi
callq 0x6470
xorl %r15d, %r15d
testq %rax, %rax
je 0x66c5b
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 0x66c40
movl $0x80000000, %r15d      # imm = 0x80000000
testb $0x4, 0x3(%rsp)
je 0x66c40
xorl %r15d, %r15d
cmpl $0x24342, 0xc(%rsp)     # imm = 0x24342
setne %r15b
shll $0x1f, %r15d
orl %eax, %r15d
movl %r15d, (%rbx)
movl $0x1, %edi
movl $0x28, %esi
callq 0x6470
movq %rax, 0x30(%rbx)
jmp 0x66c5d
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_O3/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
movl $0x1, %edi
movl $0x60, %esi
callq 0x6470
movq %rax, %rbx
movq %r14, %rax
movzbl (%rax), %r12d
testl %r12d, %r12d
je 0x66ca3
leal -0x30(%r12), %ecx
incq %rax
cmpb $0x9, %cl
ja 0x66c8d
xorl %r15d, %r15d
cmpl $0x1, %r12d
sbbl %r15d, %r15d
movq %r14, %rdi
movl $0x75, %esi
callq 0x6270
testq %rax, %rax
jne 0x66d7c
addl $-0x30, %r12d
orl %r12d, %r15d
cmpl $-0x2, %r15d
je 0x66d7c
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
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmovnsl %r15d, %ebp
movl %ebp, %r15d
shll $0x14, %r15d
andl $0x1ff00000, %r15d      # imm = 0x1FF00000
leal 0x20010000(%r15), %eax
movl %eax, (%rbx)
movq %r14, %rdi
movl $0x67, %esi
callq 0x6270
testq %rax, %rax
je 0x66d82
orl $0xa0010000, %r15d      # imm = 0xA0010000
movl %r15d, (%rbx)
movl $0x1, %edi
movl $0x70, %esi
callq 0x6470
movq %rax, 0x58(%rbx)
shll $0x17, %ebp
sarl $0x17, %ebp
leaq 0x31b0d(%rip), %r10     # 0x9885c
movq %rax, %rdi
movl %ebp, %esi
movl $0x8, %edx
movl $0x1f, %ecx
movl $0x8, %r8d
xorl %r9d, %r9d
pushq $0x70
pushq %r10
callq 0x6090
addq $0x10, %rsp
testl %eax, %eax
je 0x66d82
xorl %ebx, %ebx
jmp 0x66d82
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_O3/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 0x66ee9
movq %r14, %rdi
movl $0x72, %esi
callq 0x6270
testq %rax, %rax
je 0x66ea0
movq %rbx, %rdi
callq 0x66b95
testq %rax, %rax
jne 0x66ecc
xorl %eax, %eax
jmp 0x66ed4
movq %r14, %rdi
movl $0x77, %esi
callq 0x6270
testq %rax, %rax
jne 0x66ec4
movq %r14, %rdi
movl $0x61, %esi
callq 0x6270
testq %rax, %rax
je 0x66edc
movq %r14, %rdi
callq 0x66c6d
movq %rbx, 0x38(%rax)
andb $-0xd, 0x2(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x6060
movl $0x16, (%rax)
jmp 0x66e9c
leaq 0x32d80(%rip), %rdi     # 0x99c70
leaq 0x32dae(%rip), %rsi     # 0x99ca5
leaq 0x32dfe(%rip), %rcx     # 0x99cfc
movl $0xda, %edx
callq 0x6460
// File: /workspace/github_c_makefile_star2_O3/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 0x31914(%rip), %rax     # 0x9885c
movl %r8d, %esi
movl $0x8, %edx
movl $0xfffffff1, %ecx       # imm = 0xFFFFFFF1
movl $0x8, %r8d
xorl %r9d, %r9d
pushq $0x70
pushq %rax
callq 0x6090
addq $0x10, %rsp
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x66fe5
movq %rsp, %rdi
movl $0x4, %esi
callq 0x6310
cmpl $0x1, %eax
jne 0x66fe5
movq %rsp, %rdi
callq 0x6420
testl %eax, %eax
jne 0x66fe5
movq 0x28(%rsp), %rax
addq $0x1a, %rax
movq %rax, (%r15)
movaps 0x32ecb(%rip), %xmm0    # 0x99e70
movups %xmm0, (%r14)
movw $0x0, 0x10(%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_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x58(%rdi), %rdi
testl %esi, %esi
jne 0x67560
cmpl $0x0, 0x20(%rdi)
sete %dl
testb $0x1, %dl
jne 0x67560
movq 0x28(%rbx), %r15
movq 0x38(%rbx), %r12
movq 0x8(%r12), %rsi
movq 0x10(%r12), %r13
subq %rsi, %r13
movl $0xff00, %r14d          # imm = 0xFF00
cmpq %r14, %r13
cmovbq %r13, %r14
movq %r15, %rdi
movq %r14, %rdx
callq 0x6570
addq %r14, 0x8(%r12)
cmpq $0xfeff, %r13           # imm = 0xFEFF
ja 0x6754c
movl $0xff00, %edx           # imm = 0xFF00
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq 0x6b0a3
movq %rax, %r14
movq 0x58(%rbx), %rdi
movl %r14d, 0x8(%rdi)
testl %r14d, %r14d
je 0x675bf
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 0x67596
movq 0x58(%rbx), %rdi
movl 0x20(%rdi), %edx
testl %edx, %edx
je 0x67560
movl $0x10000, %ecx          # imm = 0x10000
subl %edx, %ecx
jmp 0x675ab
testl %eax, %eax
js 0x675b8
movq 0x58(%rbx), %rdi
movl 0x20(%rdi), %edx
xorl %ecx, %ecx
cmpl $0x10000, %edx          # imm = 0x10000
jne 0x675c3
xorl %edx, %edx
cmpl $0x1, %eax
jne 0x674f6
jmp 0x675ca
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x675ca
xorl %ecx, %ecx
jmp 0x675ca
movl $0x10000, %ecx          # imm = 0x10000
subl %edx, %ecx
movl %ecx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/bgzf.c
// Function: inflate_block
static int inflate_block(BGZF* fp, int block_length)
{
    z_stream zs;
    zs.zalloc = NULL;
    zs.zfree = NULL;
    zs.next_in = (Bytef*)fp->compressed_block + 18;
    zs.avail_in = block_length - 16;
    zs.next_out = (Bytef*)fp->uncompressed_block;
    zs.avail_out = BGZF_MAX_BLOCK_SIZE;

    if (inflateInit2(&zs, -15) != Z_OK) {
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    if (inflate(&zs, Z_FINISH) != Z_STREAM_END) {
        inflateEnd(&zs);
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    if (inflateEnd(&zs) != Z_OK) {
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    return zs.total_out;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %rdi
movups %xmm0, 0x40(%rdi)
movq 0x28(%rbx), %rax
addq $0x12, %rax
movq %rax, (%rdi)
addl $-0x10, %esi
movl %esi, 0x8(%rdi)
movq 0x20(%rbx), %rax
movq %rax, 0x18(%rdi)
movl $0x10000, 0x20(%rdi)    # imm = 0x10000
leaq 0x3124a(%rip), %rdx     # 0x9885c
movl $0xfffffff1, %esi       # imm = 0xFFFFFFF1
movl $0x70, %ecx
callq 0x65d0
testl %eax, %eax
jne 0x67648
movq %rsp, %r14
movq %r14, %rdi
movl $0x4, %esi
callq 0x6540
movl %eax, %ebp
movq %r14, %rdi
callq 0x6730
cmpl $0x1, %ebp
jne 0x67648
testl %eax, %eax
je 0x67659
orb $0x1, (%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl 0x28(%rsp), %eax
jmp 0x67650
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdx, %rdx
je 0x67a10
movq %rdi, %r14
testb $0x3, 0x2(%rdi)
jne 0x67a28
movq %rdx, %r15
movq %rsi, %r12
movl 0xc(%r14), %eax
xorl %ebx, %ebx
movl 0x8(%r14), %edx
subl %eax, %edx
jg 0x679b0
movq %r14, %rdi
callq 0x66ff6
testl %eax, %eax
jne 0x67a14
movl 0x8(%r14), %ecx
movl 0xc(%r14), %eax
movl %ecx, %edx
subl %eax, %edx
jle 0x679eb
movq %r15, %r13
subq %rbx, %r13
movl %edx, %ecx
cmpq %rcx, %r13
cmovaeq %rcx, %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
cmpq %r15, %rbx
jb 0x6798e
movl 0x8(%r14), %ecx
cmpl %ecx, %eax
jne 0x67a0a
movq 0x38(%r14), %rax
movq 0x28(%rax), %rcx
addq 0x8(%rax), %rcx
subq (%rax), %rcx
movq %rcx, 0x10(%r14)
movq $0x0, 0x8(%r14)
addq %rbx, 0x18(%r14)
jmp 0x67a1b
xorl %ebx, %ebx
jmp 0x67a1b
movq $-0x1, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x322f5(%rip), %rdi     # 0x99d24
leaq 0x3226f(%rip), %rsi     # 0x99ca5
leaq 0x322f9(%rip), %rcx     # 0x99d36
movl $0x229, %edx            # imm = 0x229
callq 0x6460
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testb $0x3, 0x2(%rdi)
je 0x67d23
movq %rdi, %rbx
cmpq $0x0, 0x40(%rdi)
movl 0xc(%rdi), %esi
je 0x67d1b
testl %esi, %esi
je 0x67c86
movq %rbx, %rdi
callq 0x67d40
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x67daa
cmpl $0x0, 0x50(%rbx)
je 0x67cb6
movq %rbx, %rdi
callq 0x6765f
movslq 0xc(%rbx), %rsi
movq 0x48(%rbx), %rax
addq %rsi, 0x10(%rax)
movq %rbx, %rdi
callq 0x67fef
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x67d25
movq 0x28(%rbx), %r12
movq 0x38(%rbx), %r13
movl %eax, %r14d
movq 0x8(%r13), %rdi
movq 0x18(%r13), %rbp
subq %rdi, %rbp
cmpq %r14, %rbp
movq %r14, %r15
cmovbq %rbp, %r15
movq %r12, %rsi
movq %r15, %rdx
callq 0x6570
addq %r15, 0x8(%r13)
cmpq %r14, %rbp
jae 0x67d0f
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x6b241
movq %rax, %r15
cmpq %r14, %r15
jne 0x67d36
addq %r14, 0x10(%rbx)
movl 0xc(%rbx), %esi
testl %esi, %esi
jg 0x67c9c
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
orb $0x4, (%rbx)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x67d25
// File: /workspace/github_c_makefile_star2_O3/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 0x67d8b
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)
movl $0x0, 0xc(%rbx)
incl 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x320ab(%rip), %rdi     # 0x99e3d
leaq 0x31f0c(%rip), %rsi     # 0x99ca5
leaq 0x320b3(%rip), %rcx     # 0x99e53
movl $0x2aa, %edx            # imm = 0x2AA
callq 0x6460
// File: /workspace/github_c_makefile_star2_O3/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 0x6802b
movslq %esi, %rcx
shll $0x3, %r8d
sarl $0x17, %r8d
movq %rsp, %rsi
callq 0x66f08
testl %eax, %eax
jne 0x6805b
movq (%rsp), %rax
jmp 0x68071
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 0x68065
orb $0x1, (%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x68078
movl 0x20(%r14), %ecx
movl $0x10000, %eax          # imm = 0x10000
subq %rcx, %rax
movl $0x0, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x680bd
cmpl $0x0, 0xc(%rbx)
je 0x680b1
movq %rbx, %rdi
callq 0x67d40
movq 0x40(%rbx), %rax
movl 0x8(%rax), %ecx
cmpl 0x4(%rax), %ecx
jge 0x680c6
xorl %eax, %eax
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0x67c54
movq %rbx, %rdi
popq %rbx
jmp 0x67daa
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl (%rdi), %eax
testl $0x60000000, %eax       # imm = 0x60000000
je 0x68158
testl $0x30000, %eax          # imm = 0x30000
je 0x681b6
movq %rbx, %r13
testq %rbx, %rbx
jle 0x68150
movq %rbx, %r13
movslq 0xc(%r15), %rdi
movl $0xff00, %eax           # imm = 0xFF00
subq %rdi, %rax
cmpq %rax, %r13
movl %r13d, %ecx
cmovgel %eax, %ecx
addq 0x20(%r15), %rdi
movslq %ecx, %r12
movq %r14, %rsi
movq %r12, %rdx
callq 0x6570
movl 0xc(%r15), %eax
addl %r12d, %eax
movl %eax, 0xc(%r15)
cmpl $0xff00, %eax           # imm = 0xFF00
jne 0x68145
movq %r15, %rdi
callq 0x68092
testl %eax, %eax
jne 0x681a2
addq %r12, %r14
subq %r12, %r13
testq %r13, %r13
jg 0x68100
subq %r13, %rbx
movq %rbx, %r15
jmp 0x681a9
movq 0x38(%r15), %r12
movq 0x8(%r12), %rdi
movq 0x18(%r12), %r13
subq %rdi, %r13
cmpq %rbx, %r13
movq %rbx, %r15
cmovbq %r13, %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x6570
addq %r15, 0x8(%r12)
cmpq %rbx, %r13
jae 0x681a9
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x6b241
movq $-0x1, %r15
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x31ba3(%rip), %rdi     # 0x99d60
leaq 0x31ae1(%rip), %rsi     # 0x99ca5
leaq 0x31ba2(%rip), %rcx     # 0x99d6d
movl $0x308, %edx            # imm = 0x308
callq 0x6460
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_close
int bgzf_close(BGZF* fp)
{
    int ret, block_length;
    if (fp == 0) return -1;
    if (fp->is_write && fp->is_compressed) {
        if (bgzf_flush(fp) != 0) return -1;
        fp->compress_level = -1;
        block_length = deflate_block(fp, 0); // write an empty block
        if (hwrite(fp->fp, fp->compressed_block, block_length) < 0
            || hflush(fp->fp) != 0) {
            fp->errcode |= BGZF_ERR_IO;
            return -1;
        }
#ifdef BGZF_MT
        if (fp->mt) mt_destroy(fp->mt);
#endif
    }
    if ( fp->is_gzip )
    {
        if (!fp->is_write) (void)inflateEnd(fp->gz_stream);
        else (void)deflateEnd(fp->gz_stream);
        free(fp->gz_stream);
    }
    ret = hclose(fp->fp);
    if (ret != 0) return -1;
    bgzf_index_destroy(fp);
    free(fp->uncompressed_block);
    free(fp->compressed_block);
    free_cache(fp);
    free(fp);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x683d2
movq %rdi, %rbx
movl (%rdi), %eax
testl $0x30000, %eax          # imm = 0x30000
sete %cl
testl $0x60000000, %eax       # imm = 0x60000000
sete %al
orb %cl, %al
je 0x6828a
movl (%rbx), %eax
testl %eax, %eax
jns 0x68320
movq 0x58(%rbx), %rdi
testl $0x30000, %eax          # imm = 0x30000
je 0x68312
callq 0x6420
jmp 0x68317
movq %rbx, %rdi
callq 0x67c54
testl %eax, %eax
jne 0x683d2
orl $0x1ff00000, (%rbx)     # imm = 0x1FF00000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x67fef
movq 0x28(%rbx), %rsi
movq 0x38(%rbx), %r13
movslq %eax, %r12
movq 0x8(%r13), %rdi
movq 0x18(%r13), %r15
subq %rdi, %r15
cmpq %r12, %r15
movq %r12, %r14
cmovbq %r15, %r14
movq %rsi, (%rsp)
movq %r14, %rdx
callq 0x6570
addq %r14, 0x8(%r13)
cmpq %r12, %r15
jae 0x682f4
movq %r13, %rdi
movq (%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x6b241
movq %rax, %r14
testq %r14, %r14
js 0x6830a
movq 0x38(%rbx), %rdi
callq 0x6b16c
testl %eax, %eax
je 0x683e3
orb $0x4, (%rbx)
jmp 0x683d2
callq 0x6730
movq 0x58(%rbx), %rdi
callq 0x68a0
movq 0x38(%rbx), %rdi
callq 0x6b393
testl %eax, %eax
jne 0x683d2
movq %rbx, %rdi
callq 0x684ed
movq 0x20(%rbx), %rdi
callq 0x68a0
movq 0x28(%rbx), %rdi
callq 0x68a0
testb $0x3, 0x2(%rbx)
jne 0x683c8
movq 0x30(%rbx), %r14
movl (%r14), %eax
testl %eax, %eax
je 0x683a5
movl $0x4, %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x10(%r14), %rcx
movq %r13, %rdx
shrq $0x4, %rdx
movl (%rcx,%rdx,4), %edx
movl %r12d, %ecx
andb $0x1e, %cl
shrl %cl, %edx
testb $0x3, %dl
jne 0x68393
movq 0x20(%r14), %rax
movq (%rax,%r15,2), %rdi
callq 0x68a0
movl (%r14), %eax
incq %r13
movl %eax, %ecx
addq $0xc, %r15
addl $0x2, %r12d
cmpq %rcx, %r13
jb 0x68368
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
callq 0x68a0
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x68267
callq 0x683fa
jmp 0x68267
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/bgzf.c
// Function: mt_destroy
static void mt_destroy(mtaux_t *mt)
{
    int i;
    // signal all workers to quit
    pthread_mutex_lock(&mt->lock);
    mt->done = 1; mt->proc_cnt = 0;
    pthread_cond_broadcast(&mt->cv);
    pthread_mutex_unlock(&mt->lock);
    for (i = 1; i < mt->n_threads; ++i) pthread_join(mt->tid[i], 0); // worker 0 is effectively launched by the master thread
    // free other data allocated on heap
    for (i = 0; i < mt->n_blks; ++i) free(mt->blk[i]);
    for (i = 0; i < mt->n_threads; ++i) free(mt->w[i].buf);
    free(mt->blk); free(mt->len); free(mt->w); free(mt->tid);
    pthread_cond_destroy(&mt->cv);
    pthread_mutex_destroy(&mt->lock);
    free(mt);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0x6ae0
movl $0x1, 0xc(%rbx)
movl $0x0, 0x10(%rbx)
leaq 0x60(%rbx), %r15
movq %r15, %rdi
callq 0x6250
movq %r14, %rdi
callq 0x64f0
movl (%rbx), %eax
cmpl $0x2, %eax
jl 0x6845b
movl $0x1, %r12d
movq 0x30(%rbx), %rax
movq (%rax,%r12,8), %rdi
xorl %esi, %esi
callq 0x6610
incq %r12
movslq (%rbx), %rax
cmpq %rax, %r12
jl 0x68441
cmpl $0x0, 0x4(%rbx)
jle 0x6847f
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rdi
callq 0x68a0
incq %r12
movslq 0x4(%rbx), %rax
cmpq %rax, %r12
jl 0x68464
movl (%rbx), %eax
testl %eax, %eax
jle 0x684a8
movl $0x8, %r12d
xorl %r13d, %r13d
movq 0x28(%rbx), %rax
movq (%rax,%r12), %rdi
callq 0x68a0
incq %r13
movslq (%rbx), %rax
addq $0x20, %r12
cmpq %rax, %r13
jl 0x6848c
movq 0x18(%rbx), %rdi
callq 0x68a0
movq 0x20(%rbx), %rdi
callq 0x68a0
movq 0x28(%rbx), %rdi
callq 0x68a0
movq 0x30(%rbx), %rdi
callq 0x68a0
movq %r15, %rdi
callq 0x6e60
movq %r14, %rdi
callq 0x6860
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x68a0
// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
movq 0x28(%rdi), %r14
addq 0x8(%rdi), %r14
subq (%rdi), %r14
movq $-0x1c, %rsi
movl $0x2, %edx
callq 0x6b2f4
testq %rax, %rax
js 0x685ff
movq 0x38(%rbx), %r12
movq 0x8(%r12), %r13
movq 0x10(%r12), %rbp
subq %r13, %rbp
cmpq $0x1c, %rbp
movl $0x1c, %r15d
cmovbq %rbp, %r15
movq %rsp, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x6570
addq %r15, %r13
movq %r13, 0x8(%r12)
cmpq $0x1b, %rbp
ja 0x685b1
movq %rsp, %rsi
movl $0x1c, %edx
movq %r12, %rdi
movq %r15, %rcx
callq 0x6b0a3
movq %rax, %r15
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq $0x1c, %r15
jne 0x6861e
movq 0x38(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6b2f4
testq %rax, %rax
js 0x6861e
movdqu 0xc(%rsp), %xmm0
pcmpeqb 0x31673(%rip), %xmm0    # 0x99c50
movdqa (%rsp), %xmm1
pcmpeqb 0x31676(%rip), %xmm1    # 0x99c60
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
xorl %ebp, %ebp
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bpl
jmp 0x6861e
callq 0x6060
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x1d, (%rax)
jne 0x6861e
movq 0x38(%rbx), %rax
movl $0x0, 0x34(%rax)
movl $0x2, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x68653
orl $0x8, %eax
movl %eax, (%rbx)
movq $-0x1, %rax
jmp 0x68684
movq %rsi, %r14
movq %rsi, %r15
sarq $0x10, %r15
movq 0x38(%rbx), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x6b2f4
testq %rax, %rax
js 0x6868a
movzwl %r14w, %eax
movl $0x0, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movl %eax, 0xc(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
orb $0x4, (%rbx)
jmp 0x6864a
// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
leaq 0x2d866(%rip), %rsi     # 0x95f09
callq 0x6b721
xorl %ebx, %ebx
testq %rax, %rax
je 0x68734
movq %rax, %r14
movq 0x8(%rax), %r12
movq 0x10(%rax), %r13
subq %r12, %r13
cmpq $0x10, %r13
movl $0x10, %r15d
cmovbq %r13, %r15
movq %rsp, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x6570
addq %r15, %r12
movq %r12, 0x8(%r14)
cmpq $0xf, %r13
ja 0x68700
movq %rsp, %rsi
movl $0x10, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x6b0a3
movq %rax, %r15
movq %r14, %rdi
callq 0x6b393
testl %eax, %eax
js 0x6872f
cmpl $0x10, %r15d
jne 0x68734
movdqa (%rsp), %xmm0
pcmpeqb 0x31541(%rip), %xmm0    # 0x99c60
pmovmskb %xmm0, %eax
xorl %ebx, %ebx
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bl
jmp 0x68734
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x68787
movq 0x20(%rbx), %rdx
leal 0x1(%rax), %esi
movl %esi, 0xc(%rbx)
cltq
movzbl (%rdx,%rax), %eax
cmpl %ecx, %esi
jne 0x68781
movq 0x38(%rbx), %rcx
movq 0x28(%rcx), %rdx
addq 0x8(%rcx), %rdx
subq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
movq $0x0, 0x8(%rbx)
incq 0x18(%rbx)
jmp 0x6879a
movq %rbx, %rdi
callq 0x66ff6
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testl %ecx, %ecx
je 0x6879c
popq %rbx
retq
movl 0x8(%rbx), %ecx
testl %ecx, %ecx
je 0x687a8
movl 0xc(%rbx), %eax
jmp 0x68752
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6879a
// File: /workspace/github_c_makefile_star2_O3/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)
jne 0x69305
movq (%rbx), %rsi
cmpl $0x0, 0xc(%rsi)
jne 0x69305
leaq 0x60(%rsi), %rdi
addq $0x38, %rsi
callq 0x6b90
jmp 0x692e7
movq (%rbx), %rdi
movl 0xc(%rdi), %ebp
movl $0x0, 0x18(%rbx)
addq $0x38, %rdi
callq 0x64f0
movl $0x1, %eax
testl %ebp, %ebp
jne 0x693aa
movl $0x0, 0x14(%rbx)
movl 0x10(%rbx), %ecx
movq (%rbx), %rax
cmpl 0x8(%rax), %ecx
jge 0x693a4
movq 0x20(%rax), %rsi
leaq 0x8(%rsp), %r14
movq $0x10000, 0x8(%rsp)     # imm = 0x10000
movq 0x8(%rbx), %rdi
movq 0x18(%rax), %rax
movslq %ecx, %r12
movq (%rax,%r12,8), %rdx
movslq (%rsi,%r12,4), %rcx
movl 0x1c(%rbx), %r8d
movq %r14, %rsi
callq 0x66f08
testl %eax, %eax
je 0x69373
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), %rsi
movl %r15d, (%rsi,%r12,4)
movl (%rax), %ecx
addl %r12d, %ecx
cmpl 0x8(%rax), %ecx
jl 0x69343
lock
incl 0x10(%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop