LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_thread_pool
int bgzf_thread_pool(BGZF *fp, hts_tpool *pool, int qsize) {
    // No gain from multi-threading when not compressed
    if (!fp->is_compressed)
        return 0;

    mtaux_t *mt;
    mt = (mtaux_t*)calloc(1, sizeof(mtaux_t));
    if (!mt) return -1;
    fp->mt = mt;

    mt->pool = pool;
    mt->n_threads = hts_tpool_size(pool);
    if (!qsize)
        qsize = mt->n_threads*2;
    if (!(mt->out_queue = hts_tpool_process_init(mt->pool, qsize, 0)))
        goto err;
    hts_tpool_process_ref_incr(mt->out_queue);

    mt->job_pool = pool_create(sizeof(bgzf_job));
    if (!mt->job_pool)
        goto err;

    pthread_mutex_init(&mt->job_pool_m, NULL);
    pthread_mutex_init(&mt->command_m, NULL);
    pthread_mutex_init(&mt->idx_m, NULL);
    pthread_cond_init(&mt->command_c, NULL);
    mt->flush_pending = 0;
    mt->jobs_pending = 0;
    mt->free_block = fp->uncompressed_block; // currently in-use block
    mt->block_address = fp->block_address;
    pthread_create(&mt->io_task, NULL,
                   fp->is_write ? bgzf_mt_writer : bgzf_mt_reader, fp);

    return 0;

 err:
    free(mt);
    fp->mt = NULL;
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %r14d, %r14d
testb $0x40, 0x3(%rdi)
je 0xaf4e
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %rbx
pushq $0x1
popq %rdi
movl $0x130, %esi            # imm = 0x130
callq 0x4300
pushq $-0x1
popq %r14
testq %rax, %rax
je 0xaf4e
movq %rax, %r15
movq %rax, 0x48(%rbx)
movq %r12, 0x18(%rax)
movq %r12, %rdi
callq 0x2c89b
movl %eax, 0x10(%r15)
leal (%rax,%rax), %esi
testl %ebp, %ebp
cmovnel %ebp, %esi
movq 0x18(%r15), %rdi
xorl %edx, %edx
callq 0x2bfc7
movq %rax, 0x20(%r15)
testq %rax, %rax
je 0xaf41
movq %rax, %rdi
callq 0x2be56
movl $0x20030, %edi          # imm = 0x20030
callq 0x490b0
movq %rax, (%r15)
testq %rax, %rax
je 0xaf41
leaq 0x30(%r15), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x4780
leaq 0x80(%r15), %rdi
xorl %esi, %esi
callq 0x4780
leaq 0xe0(%r15), %rdi
xorl %esi, %esi
callq 0x4780
leaq 0xa8(%r15), %rdi
xorl %esi, %esi
callq 0x45d0
andq $0x0, 0x58(%r15)
movq 0x28(%rbx), %rax
movq %rax, 0x60(%r15)
movq 0x18(%rbx), %rax
movq %rax, 0x70(%r15)
addq $0x28, %r15
btl $0x11, (%rbx)
leaq 0x408(%rip), %rax       # 0xb32f
leaq 0x2c(%rip), %rdx        # 0xaf5a
cmovaeq %rax, %rdx
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x4920
jmp 0xaf4e
movq %r15, %rdi
callq 0x45c0
andq $0x0, 0x48(%rbx)
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_mt
int bgzf_mt(BGZF *fp, int n_threads, int n_sub_blks)
{
    // No gain from multi-threading when not compressed
    if (!fp->is_compressed || fp->is_gzip)
        return 0;

    if (n_threads < 1) return -1;
    hts_tpool *p = hts_tpool_init(n_threads);
    if (!p)
        return -1;

    if (bgzf_thread_pool(fp, p, 0) != 0) {
        hts_tpool_destroy(p);
        return -1;
    }

    fp->mt->own_pool = 1;

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl $0xc0000000, %eax       # imm = 0xC0000000
andl (%rdi), %eax
xorl %ebx, %ebx
cmpl $0x40000000, %eax       # imm = 0x40000000
jne 0xb601
pushq $-0x1
popq %rbx
testl %esi, %esi
jle 0xb601
movq %rdi, %r14
movl %esi, %edi
callq 0x2c2cf
testq %rax, %rax
je 0xb601
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xae43
testl %eax, %eax
je 0xb5f4
movq %r15, %rdi
callq 0x2cc8f
jmp 0xb601
movq 0x48(%r14), %rax
movl $0x1, 0x14(%rax)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: mt_queue
static int mt_queue(BGZF *fp)
{
    mtaux_t *mt = fp->mt;

    mt->block_number++;

    // Also updated by writer thread
    pthread_mutex_lock(&mt->job_pool_m);
    bgzf_job *j = pool_alloc(mt->job_pool);
    if (j) mt->jobs_pending++;
    pthread_mutex_unlock(&mt->job_pool_m);
    if (!j) return -1;

    j->fp = fp;
    j->errcode = 0;
    j->uncomp_len  = fp->block_offset;
    if (fp->compress_level == 0) {
        memcpy(j->comp_data + BLOCK_HEADER_LENGTH + 5, fp->uncompressed_block,
               j->uncomp_len);
        if (hts_tpool_dispatch3(mt->pool, mt->out_queue,
                                bgzf_encode_level0_func, j,
                                job_cleanup, job_cleanup, 0) < 0) {
            goto fail;
        }
    } else {
        memcpy(j->uncomp_data, fp->uncompressed_block, j->uncomp_len);

        // Need non-block vers & job_pending?
        if (hts_tpool_dispatch3(mt->pool, mt->out_queue, bgzf_encode_func, j,
                                job_cleanup, job_cleanup, 0) < 0) {
            goto fail;
        }
    }

    fp->block_offset = 0;
    return 0;

 fail:
    job_cleanup(j);
    pthread_mutex_lock(&mt->job_pool_m);
    mt->jobs_pending--;
    pthread_mutex_unlock(&mt->job_pool_m);
    return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x48(%rdi), %r12
incq 0x110(%r12)
leaq 0x30(%r12), %rbx
movq %rbx, %rdi
callq 0x4750
movq (%r12), %rdi
callq 0x49174
testq %rax, %rax
je 0xb899
movq %rax, %r15
incl 0x58(%r12)
movq %rbx, %rdi
callq 0x4340
movq %r14, (%r15)
andl $0x0, 0x20018(%r15)
movslq 0x10(%r14), %rdx
movq %rdx, 0x20010(%r15)
movzwl 0x2(%r14), %eax
movq 0x28(%r14), %rsi
movq %r15, %rdi
testw $0x1ff0, %ax            # imm = 0x1FF0
je 0xb847
addq $0x10010, %rdi          # imm = 0x10010
callq 0x43c0
movq 0x18(%r12), %rdi
movq 0x20(%r12), %rsi
andl $0x0, (%rsp)
leaq 0x188c(%rip), %rdx      # 0xd0d1
jmp 0xb865
addq $0x1f, %rdi
callq 0x43c0
movq 0x18(%r12), %rdi
movq 0x20(%r12), %rsi
andl $0x0, (%rsp)
leaq 0x1810(%rip), %rdx      # 0xd075
leaq 0x171c(%rip), %r8       # 0xcf88
movq %r15, %rcx
movq %r8, %r9
callq 0x2c8b1
testl %eax, %eax
js 0xb884
andl $0x0, 0x10(%r14)
xorl %eax, %eax
jmp 0xb8a4
movq %r15, %rdi
callq 0xcf88
movq %rbx, %rdi
callq 0x4750
decl 0x58(%r12)
movq %rbx, %rdi
callq 0x4340
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]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 )
    {
        hts_log_debug("Compression error %d", ret);
        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 0x30(%rdi), %rdi
movq 0x28(%rbx), %rdx
testl %r8d, %r8d
js 0xb8ef
movslq %esi, %rcx
shll $0x3, %r8d
sarl $0x17, %r8d
movq %rsp, %rsi
callq 0x9b4b
testl %eax, %eax
jne 0xb960
movq (%rsp), %r14
jmp 0xb991
movq 0x60(%rbx), %r14
xorl %eax, %eax
testl %esi, %esi
sete %al
leal 0x1(%rax,%rax,2), %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 0x41f0
cmpl $-0x2, %eax
jne 0xb941
leaq 0x6baac(%rip), %rsi     # 0x773d3
leaq 0x6b077(%rip), %rdx     # 0x769a5
leaq 0x6b7cf(%rip), %rcx     # 0x77104
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
jmp 0xb960
cmpl $0x0, 0x8(%r14)
je 0xb984
leaq 0x6ba84(%rip), %rsi     # 0x773d3
leaq 0x6ba90(%rip), %rdx     # 0x773e6
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
leaq 0x6ba49(%rip), %rsi     # 0x773b0
leaq 0x6ba50(%rip), %rdx     # 0x773be
pushq $0x5
popq %rdi
pushq $-0x1
popq %r14
movl %r14d, %ecx
xorl %eax, %eax
callq 0x110c6
orb $0x1, (%rbx)
jmp 0xb995
movl 0x20(%r14), %eax
movl $0x10000, %r14d         # imm = 0x10000
subq %rax, %r14
andl $0x0, 0x10(%rbx)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/hfile.h
// Function: hwrite
static inline ssize_t HTS_RESULT_USED
hwrite(hFILE *fp, const void *buffer, size_t nbytes)
{
    HTSLIB_EXPORT
    extern ssize_t hwrite2(hFILE *, const void *, size_t, size_t);
    HTSLIB_EXPORT
    extern int hfile_set_blksize(hFILE *fp, size_t bufsiz);

    if (!fp->mobile) {
        size_t n = fp->limit - fp->begin;
        if (n < nbytes) {
            hfile_set_blksize(fp, fp->limit - fp->buffer + nbytes);
            fp->end = fp->limit;
        }
    }

    size_t n = fp->limit - fp->begin;
    if (nbytes >= n && fp->begin == fp->buffer) {
        // Go straight to hwrite2 if the buffer is empty and the request
        // won't fit.
        return hwrite2(fp, buffer, nbytes, 0);
    }

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

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testb $0x2, 0x30(%rdi)
movq 0x18(%rdi), %r12
jne 0xb9e1
movq %r12, %rax
subq 0x8(%r15), %rax
cmpq %rbx, %rax
jae 0xb9e1
addq %rbx, %r12
subq (%r15), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xd26c
movq 0x18(%r15), %r12
movq %r12, 0x10(%r15)
movq 0x8(%r15), %rdi
subq %rdi, %r12
cmpq %rbx, %r12
ja 0xb9f2
cmpq (%r15), %rdi
je 0xba1d
cmpq %rbx, %r12
movq %rbx, %r13
cmovbq %r12, %r13
movq %r14, %rsi
movq %r13, %rdx
callq 0x43c0
addq %r13, 0x8(%r15)
cmpq %rbx, %r12
jb 0xba20
movq %r13, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorl %r13d, %r13d
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r13, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xd717
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_write
ssize_t bgzf_write(BGZF *fp, const void *data, size_t length)
{
    if ( !fp->is_compressed ) {
        size_t push = length + (size_t) fp->block_offset;
        fp->block_offset = push % BGZF_MAX_BLOCK_SIZE;
        fp->block_address += (push - fp->block_offset);
        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
btl $0x1e, %eax
jb 0xbab5
movslq 0x10(%r15), %rax
addq %rbx, %rax
movzwl %ax, %ecx
movl %ecx, 0x10(%r15)
andq $-0x10000, %rax         # imm = 0xFFFF0000
addq %rax, 0x18(%r15)
movq 0x40(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb9a0
btl $0x11, %eax
jae 0xbb2b
pushq $-0x1
popq %r12
movq %rbx, %rbp
testq %rbp, %rbp
jle 0xbb13
movslq 0x10(%r15), %rdi
movl $0xff00, %eax           # imm = 0xFF00
subq %rdi, %rax
cmpq %rax, %rbp
movl %ebp, %ecx
cmovgel %eax, %ecx
addq 0x28(%r15), %rdi
movslq %ecx, %r13
movq %r14, %rsi
movq %r13, %rdx
callq 0x43c0
movl 0x10(%r15), %eax
addl %r13d, %eax
movl %eax, 0x10(%r15)
addq %r13, %r14
subq %r13, %rbp
cmpl $0xff00, %eax           # imm = 0xFF00
jne 0xbac2
movq %r15, %rdi
callq 0xba4c
testl %eax, %eax
je 0xbac2
jmp 0xbb19
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
leaq 0x6b1c9(%rip), %rdi     # 0x76cfb
leaq 0x6b097(%rip), %rsi     # 0x76bd0
leaq 0x6b1c8(%rip), %rcx     # 0x76d08
movl $0x7d8, %edx            # imm = 0x7D8
callq 0x42f0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_block_write
ssize_t bgzf_block_write(BGZF *fp, const void *data, size_t length)
{
    if ( !fp->is_compressed ) {
        size_t push = length + (size_t) fp->block_offset;
        fp->block_offset = push % BGZF_MAX_BLOCK_SIZE;
        fp->block_address += (push - fp->block_offset);
        return hwrite(fp->fp, data, length);
    }

    const uint8_t *input = (const uint8_t*)data;
    ssize_t remaining = length;
    assert(fp->is_write);
    uint64_t current_block; //keep track of current block
    uint64_t ublock_size; // amount of uncompressed data to be fed into next block
    while (remaining > 0) {
        current_block = fp->idx->moffs - fp->idx->noffs;
        ublock_size = current_block + 1 < fp->idx->moffs ? fp->idx->offs[current_block+1].uaddr-fp->idx->offs[current_block].uaddr : BGZF_MAX_BLOCK_SIZE;
        uint8_t* buffer = (uint8_t*)fp->uncompressed_block;
        int copy_length = ublock_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 == ublock_size) {
            if (lazy_flush(fp) != 0) return -1;
            if (fp->idx->noffs > 0)
                fp->idx->noffs--;  // decrement noffs to track the blocks
        }
    }
    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
btl $0x1e, %eax
jb 0xbb9b
movslq 0x10(%r15), %rax
addq %rbx, %rax
movzwl %ax, %ecx
movl %ecx, 0x10(%r15)
andq $-0x10000, %rax         # imm = 0xFFFF0000
addq %rax, 0x18(%r15)
movq 0x40(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb9a0
btl $0x11, %eax
jae 0xbc60
movq %rbx, %rbp
testq %rbp, %rbp
jle 0xbc46
movq 0x50(%r15), %rcx
movslq 0x4(%rcx), %rax
movslq (%rcx), %rsi
movq %rsi, %rdx
negq %rdx
addq %rax, %rdx
incq %rdx
movl $0x10000, %r12d         # imm = 0x10000
cmpq %rax, %rdx
jae 0xbbea
subq %rsi, %rax
movq 0x8(%rcx), %rcx
shlq $0x4, %rdx
movq (%rcx,%rdx), %r12
shlq $0x4, %rax
subq (%rcx,%rax), %r12
movslq 0x10(%r15), %rdi
movl %r12d, %eax
subl %edi, %eax
cltq
cmpq %rax, %rbp
cmovll %ebp, %eax
addq 0x28(%r15), %rdi
movslq %eax, %r13
movq %r14, %rsi
movq %r13, %rdx
callq 0x43c0
movslq 0x10(%r15), %rax
addq %r13, %rax
movl %eax, 0x10(%r15)
addq %r13, %r14
subq %r13, %rbp
cmpq %rax, %r12
jne 0xbba8
movq %r15, %rdi
callq 0xba4c
testl %eax, %eax
jne 0xbc4e
movq 0x50(%r15), %rax
movl (%rax), %ecx
testl %ecx, %ecx
jle 0xbba8
decl %ecx
movl %ecx, (%rax)
jmp 0xbba8
subq %rbp, %rbx
movq %rbx, %rax
jmp 0xbc51
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6b094(%rip), %rdi     # 0x76cfb
leaq 0x6af62(%rip), %rsi     # 0x76bd0
leaq 0x6b0c4(%rip), %rcx     # 0x76d39
movl $0x7f3, %edx            # imm = 0x7F3
callq 0x42f0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_close_mt
static void bgzf_close_mt(BGZF *fp) {
    if (fp->mt) {
        if (!fp->mt->free_block)
            fp->uncompressed_block = NULL;
        if (mt_destroy(fp->mt) < 0)
            fp->errcode = BGZF_ERR_IO;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x48(%rdi), %rdi
testq %rdi, %rdi
je 0xbe99
cmpq $0x0, 0x60(%rdi)
jne 0xbe8b
andq $0x0, 0x28(%rbx)
callq 0xa64f
testl %eax, %eax
jns 0xbe99
movw $0x4, (%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_index_destroy
void bgzf_index_destroy(BGZF *fp)
{
    if ( !fp->idx ) return;
    free(fp->idx->offs);
    free(fp->idx);
    fp->idx = NULL;
    fp->idx_build_otf = 0;
}

// Assembly:
movq 0x50(%rdi), %rax
testq %rax, %rax
je 0xbec4
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rax), %rdi
callq 0x45c0
movq 0x50(%rbx), %rdi
callq 0x45c0
andq $0x0, 0x50(%rbx)
andl $0x0, 0x58(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_check_EOF
int bgzf_check_EOF(BGZF *fp) {
    int has_eof;

    if (fp->mt) {
        pthread_mutex_lock(&fp->mt->command_m);
        // fp->mt->command state transitions should be:
        // NONE -> HAS_EOF -> HAS_EOF_DONE -> NONE
        // (HAS_EOF -> HAS_EOF_DONE happens in bgzf_mt_reader thread)
        if (fp->mt->command != CLOSE)
            fp->mt->command = HAS_EOF;
        pthread_cond_signal(&fp->mt->command_c);
        hts_tpool_wake_dispatch(fp->mt->out_queue);
        do {
            if (fp->mt->command == CLOSE) {
                // possible error in bgzf_mt_reader
                pthread_mutex_unlock(&fp->mt->command_m);
                return 0;
            }
            pthread_cond_wait(&fp->mt->command_c, &fp->mt->command_m);
            switch (fp->mt->command) {
            case HAS_EOF_DONE: break;
            case HAS_EOF:
                // Resend signal intended for bgzf_mt_reader()
                pthread_cond_signal(&fp->mt->command_c);
                break;
            case CLOSE:
                continue;
            default:
                abort();  // Should not get to any other state
            }
        } while (fp->mt->command != HAS_EOF_DONE);
        fp->mt->command = NONE;
        has_eof = fp->mt->eof;
        pthread_mutex_unlock(&fp->mt->command_m);
    } else {
        has_eof = bgzf_check_EOF_common(fp);
    }

    fp->no_eof_block = (has_eof == 0);

    return has_eof;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x48(%rdi), %rdi
testq %rdi, %rdi
je 0xbf95
subq $-0x80, %rdi
callq 0x4750
movq 0x48(%rbx), %rdi
cmpl $0x5, 0xd8(%rdi)
je 0xbf10
movl $0x3, 0xd8(%rdi)
addq $0xa8, %rdi
callq 0x4040
movq 0x48(%rbx), %rax
movq 0x20(%rax), %rdi
callq 0x2caef
movq 0x48(%rbx), %rsi
movl 0xd8(%rsi), %eax
cmpl $0x5, %eax
je 0xbfb6
leaq 0xa8(%rsi), %rdi
subq $-0x80, %rsi
callq 0x47c0
movq 0x48(%rbx), %rsi
movl 0xd8(%rsi), %eax
leal -0x4(%rax), %ecx
cmpl $0x2, %ecx
jb 0xbf78
cmpl $0x3, %eax
jne 0xbfcd
addq $0xa8, %rsi
movq %rsi, %rdi
callq 0x4040
movq 0x48(%rbx), %rsi
movl 0xd8(%rsi), %eax
cmpl $0x4, %eax
jne 0xbf33
andl $0x0, 0xd8(%rsi)
movl 0x78(%rsi), %ebp
subq $-0x80, %rsi
movq %rsi, %rdi
callq 0x4340
jmp 0xbf9f
movq %rbx, %rdi
callq 0xbfd2
movl %eax, %ebp
xorl %eax, %eax
testl %ebp, %ebp
sete %al
shll $0x12, %eax
movl $0xfffbffff, %ecx       # imm = 0xFFFBFFFF
andl (%rbx), %ecx
orl %eax, %ecx
movl %ecx, (%rbx)
jmp 0xbfc4
subq $-0x80, %rsi
movq %rsi, %rdi
callq 0x4340
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0x4270
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_check_EOF_common
static int bgzf_check_EOF_common(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; }
#ifdef _WIN32
        if (errno == EINVAL) { hclearerr(fp->fp); return 2; }
#else
        // Assume that EINVAL was due to the file being less than 28 bytes
        // long, rather than being a random error return from an hfile backend.
        // This should be reported as "no EOF block" rather than an error.
        if (errno == EINVAL) { hclearerr(fp->fp); return 0; }
#endif
        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 0x40(%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 0xd7cb
testq %rax, %rax
js 0xc045
movq 0x40(%r14), %rdi
movq %rsp, %rsi
pushq $0x1c
popq %rdx
callq 0xa82f
pushq $-0x1
popq %rbx
cmpq $0x1c, %rax
jne 0xc06f
movq 0x40(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xd7cb
testq %rax, %rax
js 0xc06f
leaq 0x6a922(%rip), %rdi     # 0x76953
movq %rsp, %rsi
pushq $0x1c
popq %rdx
callq 0x44d0
xorl %ebx, %ebx
testl %eax, %eax
sete %bl
jmp 0xc06f
callq 0x4050
movl (%rax), %eax
cmpl $0x16, %eax
je 0xc060
cmpl $0x1d, %eax
jne 0xc06c
movq 0x40(%r14), %rax
andl $0x0, 0x34(%rax)
jmp 0xc06f
movq 0x40(%r14), %rax
andl $0x0, 0x34(%rax)
xorl %ebx, %ebx
jmp 0xc06f
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_seek
int64_t bgzf_seek(BGZF* fp, int64_t pos, int where)
{
    if (fp->is_write || where != SEEK_SET || fp->is_gzip) {
        fp->errcode |= BGZF_ERR_MISUSE;
        return -1;
    }

    // This is a flag to indicate we've jumped elsewhere in the stream, to act
    // as a hint to any other code which is wrapping up bgzf for its own
    // purposes.  We may not be able to tell when seek happens as it can be
    // done on our behalf, eg by the iterator.
    //
    // This is never cleared here.  Any tool that needs to handle it is also
    // responsible for clearing it.
    fp->seeked = pos;

    return bgzf_seek_common(fp, pos >> 16, pos & 0xFFFF);
}

// Assembly:
movl (%rdi), %eax
testl %eax, %eax
js 0xc0a0
movl %eax, %ecx
andl $0x20000, %ecx          # imm = 0x20000
orl %edx, %ecx
jne 0xc0a0
movq %rsi, 0x68(%rdi)
movq %rsi, %rax
sarq $0x10, %rax
movzwl %si, %edx
movq %rax, %rsi
jmp 0xc0a9
orl $0x8, %eax
movl %eax, (%rdi)
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]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 0;
    if (n != 16) return 0;
    return check_header(buf) == 0? 1 : 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x6e35f(%rip), %rsi     # 0x7a526
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xe19b
testq %rax, %rax
je 0xc20c
movq %rax, %r14
movq %rsp, %rsi
pushq $0x10
popq %rdx
movq %rax, %rdi
callq 0xa82f
movq %rax, %r15
movq %r14, %rdi
callq 0xd8ee
testl %eax, %eax
js 0xc20c
movl %r15d, %eax
cmpl $0x10, %eax
jne 0xc20c
movq %rsp, %rdi
callq 0xab58
xorl %ebx, %ebx
testl %eax, %eax
sete %bl
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_getc
int bgzf_getc(BGZF *fp)
{
    if (fp->block_offset+1 < fp->block_length) {
        fp->uncompressed_address++;
        return ((unsigned char*)fp->uncompressed_block)[fp->block_offset++];
    }

    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 = bgzf_htell(fp);
        fp->block_offset = 0;
        fp->block_length = 0;
    }
    fp->uncompressed_address++;
    return c;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movl 0x10(%rdi), %edx
leal 0x1(%rdx), %ecx
cmpl %eax, %ecx
jge 0xc250
incq 0x20(%rbx)
movslq %edx, %rax
movq 0x28(%rbx), %rdx
movl %ecx, 0x10(%rbx)
movzbl (%rdx,%rax), %ebp
jmp 0xc28f
cmpl %eax, %edx
jge 0xc280
movq 0x28(%rbx), %rsi
movl %ecx, 0x10(%rbx)
movslq %edx, %rdx
movzbl (%rsi,%rdx), %ebp
cmpl %eax, %ecx
jne 0xc27a
movq %rbx, %rdi
callq 0xa7e5
movq %rax, 0x18(%rbx)
andl $0x0, 0x10(%rbx)
andl $0x0, 0x8(%rbx)
incq 0x20(%rbx)
jmp 0xc28f
movq %rbx, %rdi
callq 0x9d84
testl %eax, %eax
je 0xc298
pushq $-0x2
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl 0x8(%rbx), %eax
testl %eax, %eax
je 0xc2a7
movl 0x10(%rbx), %edx
leal 0x1(%rdx), %ecx
jmp 0xc254
pushq $-0x1
jmp 0xc28e
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_index_build_init
int bgzf_index_build_init(BGZF *fp)
{
    bgzf_index_destroy(fp);
    fp->idx = (bgzidx_t*) calloc(1,sizeof(bgzidx_t));
    if ( !fp->idx ) return -1;
    fp->idx_build_otf = 1;  // build index on the fly
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0xbe9b
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x4300
movq %rax, 0x50(%rbx)
testq %rax, %rax
je 0xc4a3
movl $0x1, 0x58(%rbx)
xorl %eax, %eax
jmp 0xc4a6
pushq $-0x1
popq %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_index_dump_hfile
int bgzf_index_dump_hfile(BGZF *fp, struct hFILE *idx, const char *name)
{
    // Note that the index contains one extra record when indexing files opened
    // for reading. The terminating record is not present when opened for writing.
    // This is not a bug.

    int i;

    if (!fp->idx) {
        hts_log_error("Called for BGZF handle with no index");
        errno = EINVAL;
        return -1;
    }

    if (bgzf_flush(fp) != 0) return -1;

    // discard the entry marking the end of the file
    if (fp->mt && fp->idx)
        fp->idx->noffs--;

    if (hwrite_uint64(fp->idx->noffs - 1, idx) < 0) goto fail;
    for (i=1; i<fp->idx->noffs; i++)
    {
        if (hwrite_uint64(fp->idx->offs[i].caddr, idx) < 0) goto fail;
        if (hwrite_uint64(fp->idx->offs[i].uaddr, idx) < 0) goto fail;
    }
    return 0;

 fail:
    hts_log_error("Error writing to %s : %s", name ? name : "index", strerror(errno));
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0x50(%rdi)
je 0xc581
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
callq 0xb609
pushq $-0x1
popq %rbx
testl %eax, %eax
jne 0xc5a7
cmpq $0x0, 0x48(%r12)
movq 0x50(%r12), %rcx
movl (%rcx), %eax
je 0xc4ea
decl %eax
movl %eax, (%rcx)
decl %eax
movslq %eax, %rdi
movq %r15, %rsi
callq 0xc5bc
testl %eax, %eax
js 0xc547
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x50(%r12), %rax
movslq (%rax), %rcx
incq %r13
cmpq %rcx, %r13
jge 0xc5b8
movq 0x8(%rax), %rax
movq 0x18(%rax,%rbp), %rdi
movq %r15, %rsi
callq 0xc5bc
testl %eax, %eax
js 0xc547
movq 0x50(%r12), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax,%rbp), %rdi
addq $0x10, %rbp
movq %r15, %rsi
callq 0xc5bc
testl %eax, %eax
jns 0xc500
testq %r14, %r14
leaq 0x6de23(%rip), %r15     # 0x7a374
cmovneq %r14, %r15
callq 0x4050
movl (%rax), %edi
callq 0x4150
leaq 0x6a84e(%rip), %rsi     # 0x76db6
leaq 0x6a882(%rip), %rdx     # 0x76df1
pushq $0x1
popq %rdi
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x110c6
jmp 0xc5a7
leaq 0x6a82e(%rip), %rsi     # 0x76db6
leaq 0x6a83d(%rip), %rdx     # 0x76dcc
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
callq 0x4050
movl $0x16, (%rax)
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0xc5a7
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_index_dump
int bgzf_index_dump(BGZF *fp, const char *bname, const char *suffix)
{
    const char *name = bname, *msg = NULL;
    char *tmp = NULL;
    hFILE *idx = NULL;

    if (!fp->idx) {
        hts_log_error("Called for BGZF handle with no index");
        errno = EINVAL;
        return -1;
    }

    if ( suffix )
    {
        tmp = get_name_suffix(bname, suffix);
        if ( !tmp ) return -1;
        name = tmp;
    }

    idx = hopen(name, "wb");
    if ( !idx ) {
        msg = "Error opening";
        goto fail;
    }

    if (bgzf_index_dump_hfile(fp, idx, name) != 0) goto fail;

    if (hclose(idx) < 0)
    {
        idx = NULL;
        msg = "Error on closing";
        goto fail;
    }

    free(tmp);
    return 0;

 fail:
    if (msg != NULL) {
        hts_log_error("%s %s : %s", msg, name, strerror(errno));
    }
    if (idx) hclose_abruptly(idx);
    free(tmp);
    return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpq $0x0, 0x50(%rdi)
je 0xc619
movq %rsi, %r14
movq %rdi, %r12
pushq $-0x1
popq %rbx
testq %rdx, %rdx
je 0xc641
movq %r14, %rdi
movq %rdx, %rsi
callq 0xc6df
movq %rax, %r14
movq %rax, %r15
testq %rax, %rax
jne 0xc644
jmp 0xc6b5
leaq 0x6a7ea(%rip), %rsi     # 0x76e0a
leaq 0x6a7a5(%rip), %rdx     # 0x76dcc
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
callq 0x4050
movl $0x16, (%rax)
pushq $-0x1
popq %rbx
jmp 0xc6b5
xorl %r15d, %r15d
leaq 0x6a7cf(%rip), %rsi     # 0x76e1a
movq %r14, %rdi
xorl %eax, %eax
callq 0xe19b
testq %rax, %rax
je 0xc679
movq %rax, %r13
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xc4a8
movq %r13, %rdi
testl %eax, %eax
je 0xc6c1
callq 0xd94c
jmp 0xc6ad
leaq 0x6a79d(%rip), %r12     # 0x76e1d
callq 0x4050
movl (%rax), %edi
callq 0x4150
leaq 0x6a777(%rip), %rsi     # 0x76e0a
leaq 0x6a7a2(%rip), %rdx     # 0x76e3c
pushq $0x1
popq %rdi
movq %r12, %rcx
movq %r14, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0x110c6
movq %r15, %rdi
callq 0x45c0
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0xd8ee
testl %eax, %eax
js 0xc6d6
movq %r15, %rdi
callq 0x45c0
xorl %ebx, %ebx
jmp 0xc6b5
leaq 0x6a74e(%rip), %r12     # 0x76e2b
jmp 0xc680
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: get_name_suffix
static char * get_name_suffix(const char *bname, const char *suffix)
{
    size_t len = strlen(bname) + strlen(suffix) + 1;
    char *buff = malloc(len);
    if (!buff) return NULL;
    snprintf(buff, len, "%s%s", bname, suffix);
    return buff;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x41d0
movq %rax, %r15
movq %rbx, %rdi
callq 0x41d0
leaq (%r15,%rax), %r12
incq %r12
movq %r12, %rdi
callq 0x4680
movq %rax, %r15
testq %rax, %rax
je 0xc72e
leaq 0x6b7e6(%rip), %rdx     # 0x77f01
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x4800
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_index_load_hfile
int bgzf_index_load_hfile(BGZF *fp, struct hFILE *idx, const char *name)
{
    fp->idx = (bgzidx_t*) calloc(1,sizeof(bgzidx_t));
    if (fp->idx == NULL) goto fail;
    uint64_t x;
    if (hread_uint64(&x, idx) < 0) goto fail;

    fp->idx->noffs = fp->idx->moffs = x + 1;
    fp->idx->offs  = (bgzidx1_t*) malloc(fp->idx->moffs*sizeof(bgzidx1_t));
    if (fp->idx->offs == NULL) goto fail;
    fp->idx->offs[0].caddr = fp->idx->offs[0].uaddr = 0;

    int i;
    for (i=1; i<fp->idx->noffs; i++)
    {
        if (hread_uint64(&fp->idx->offs[i].caddr, idx) < 0) goto fail;
        if (hread_uint64(&fp->idx->offs[i].uaddr, idx) < 0) goto fail;
    }

    return 0;

 fail:
    hts_log_error("Error reading %s : %s", name ? name : "index", strerror(errno));
    if (fp->idx) {
        free(fp->idx->offs);
        free(fp->idx);
        fp->idx = NULL;
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x4300
movq %rax, 0x50(%rbx)
testq %rax, %rax
je 0xc804
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0xc877
testl %eax, %eax
js 0xc804
movl 0x10(%rsp), %eax
incl %eax
movq 0x50(%rbx), %r12
movl %eax, 0x4(%r12)
movl %eax, (%r12)
movslq %eax, %rdi
shlq $0x4, %rdi
callq 0x4680
movq %rax, 0x8(%r12)
testq %rax, %rax
je 0xc804
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
pushq $0x10
popq %r13
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x50(%rbx), %rax
movslq (%rax), %rcx
incq %rbp
cmpq %rcx, %rbp
jge 0xc865
movq 0x8(%rax), %rax
leaq (%rax,%r13), %rdi
addq $0x8, %rdi
movq %r15, %rsi
callq 0xc877
testl %eax, %eax
js 0xc804
leaq 0x10(%r13), %r14
movq 0x50(%rbx), %rax
addq 0x8(%rax), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0xc877
movq %r14, %r13
testl %eax, %eax
jns 0xc7bb
movq 0x8(%rsp), %rax
testq %rax, %rax
leaq 0x6db61(%rip), %r15     # 0x7a374
cmovneq %rax, %r15
callq 0x4050
movl (%rax), %edi
callq 0x4150
leaq 0x6a61d(%rip), %rsi     # 0x76e47
leaq 0x6a62c(%rip), %rdx     # 0x76e5d
pushq $0x1
popq %rdi
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x110c6
movq 0x50(%rbx), %rax
pushq $-0x1
popq %r12
testq %rax, %rax
je 0xc865
movq 0x8(%rax), %rdi
callq 0x45c0
movq 0x50(%rbx), %rdi
callq 0x45c0
andq $0x0, 0x50(%rbx)
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_index_load
int bgzf_index_load(BGZF *fp, const char *bname, const char *suffix)
{
    const char *name = bname, *msg = NULL;
    char *tmp = NULL;
    hFILE *idx = NULL;
    if ( suffix )
    {
        tmp = get_name_suffix(bname, suffix);
        if ( !tmp ) return -1;
        name = tmp;
    }

    idx = hopen(name, "rb");
    if ( !idx ) {
        msg = "Error opening";
        goto fail;
    }

    if (bgzf_index_load_hfile(fp, idx, name) != 0) goto fail;

    if (hclose(idx) != 0) {
        idx = NULL;
        msg = "Error closing";
        goto fail;
    }

    free(tmp);
    return 0;

 fail:
    if (msg != NULL) {
        hts_log_error("%s %s : %s", msg, name, strerror(errno));
    }
    if (idx) hclose_abruptly(idx);
    free(tmp);
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
testq %rdx, %rdx
je 0xc8c9
movq %r14, %rdi
movq %rdx, %rsi
callq 0xc6df
movq %rax, %r14
movq %rax, %rbx
testq %rax, %rax
jne 0xc8cb
pushq $-0x1
popq %rbp
jmp 0xc951
xorl %ebx, %ebx
leaq 0x6a5a1(%rip), %rsi     # 0x76e73
movq %r14, %rdi
xorl %eax, %eax
callq 0xe19b
testq %rax, %rax
je 0xc900
movq %rax, %r12
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xc73d
movq %r12, %rdi
testl %eax, %eax
je 0xc909
callq 0xd94c
jmp 0xc946
leaq 0x6a516(%rip), %r15     # 0x76e1d
jmp 0xc919
callq 0xd8ee
testl %eax, %eax
je 0xc95c
leaq 0x6a55d(%rip), %r15     # 0x76e76
callq 0x4050
movl (%rax), %edi
callq 0x4150
leaq 0x6a558(%rip), %rsi     # 0x76e84
leaq 0x6a509(%rip), %rdx     # 0x76e3c
pushq $0x1
popq %rdi
movq %r15, %rcx
movq %r14, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0x110c6
pushq $-0x1
popq %rbp
movq %rbx, %rdi
callq 0x45c0
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0xc949
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_decode_func
static void *bgzf_decode_func(void *arg) {
    bgzf_job *j = (bgzf_job *)arg;

    j->uncomp_len = BGZF_MAX_BLOCK_SIZE;
    uint32_t crc = le_to_u32((uint8_t *)j->comp_data + j->comp_len-8);
    int ret = bgzf_uncompress(j->uncomp_data, &j->uncomp_len,
                              j->comp_data+18, j->comp_len-18, crc);
    if (ret != 0)
        j->errcode |= BGZF_ERR_ZLIB;

    return arg;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x20010(%rdi), %rsi
movq $0x10000, 0x20010(%rdi) # imm = 0x10000
movq 0x10008(%rdi), %rcx
movl (%rdi,%rcx), %r8d
addq $0x10010, %rdi          # imm = 0x10010
leaq 0x1a(%rbx), %rdx
addq $-0x12, %rcx
callq 0xcaf7
testl %eax, %eax
je 0xcf83
orb $0x1, 0x20018(%rbx)
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: job_cleanup
static void job_cleanup(void *arg) {
    bgzf_job *j = (bgzf_job *)arg;
    mtaux_t *mt = j->fp->mt;
    pthread_mutex_lock(&mt->job_pool_m);
    pool_free(mt->job_pool, j);
    pthread_mutex_unlock(&mt->job_pool_m);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x48(%rax), %r15
leaq 0x30(%r15), %r14
movq %r14, %rdi
callq 0x4750
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x4924e
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4340
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_mt_seek
static void bgzf_mt_seek(BGZF *fp) {
    mtaux_t *mt = fp->mt;

    hts_tpool_process_reset(mt->out_queue, 0);
    pthread_mutex_lock(&mt->job_pool_m);
    mt->errcode = 0;

    if (hseek(fp->fp, mt->block_address, SEEK_SET) < 0)
        mt->errcode = errno;

    pthread_mutex_unlock(&mt->job_pool_m);
    mt->command = SEEK_DONE;
    pthread_cond_signal(&mt->command_c);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r15
movq 0x48(%rdi), %rbx
movq 0x20(%rbx), %rdi
xorl %esi, %esi
callq 0x2c10a
leaq 0x30(%rbx), %r14
movq %r14, %rdi
callq 0x4750
andl $0x0, 0x6c(%rbx)
movq 0x40(%r15), %rdi
movq 0x70(%rbx), %rsi
xorl %edx, %edx
callq 0xd7cb
testq %rax, %rax
jns 0xd000
callq 0x4050
movl (%rax), %eax
movl %eax, 0x6c(%rbx)
movq %r14, %rdi
callq 0x4340
movl $0x2, 0xd8(%rbx)
addq $0xa8, %rbx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4040
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_encode_level0_func
static void *bgzf_encode_level0_func(void *arg) {
    bgzf_job *j = (bgzf_job *)arg;
    uint32_t crc;
    j->comp_len = j->uncomp_len + BLOCK_HEADER_LENGTH + BLOCK_FOOTER_LENGTH + 5;

    // Data will have already been copied in to
    // j->comp_data + BLOCK_HEADER_LENGTH + 5

    // Add preamble
    memcpy(j->comp_data, g_magic, BLOCK_HEADER_LENGTH);
    u16_to_le(j->comp_len-1, j->comp_data + 16);

    // Deflate uncompressed data header
    j->comp_data[BLOCK_HEADER_LENGTH] = 1; // BFINAL=1, BTYPE=00; see RFC1951
    u16_to_le(j->uncomp_len, j->comp_data + BLOCK_HEADER_LENGTH + 1);
    u16_to_le(~j->uncomp_len, j->comp_data + BLOCK_HEADER_LENGTH + 3);

    // Trailer (CRC, uncompressed length)
    crc = hts_crc32(0, j->comp_data + BLOCK_HEADER_LENGTH + 5, j->uncomp_len);
    u32_to_le(crc, j->comp_data +  j->comp_len - 8);
    u32_to_le(j->uncomp_len, j->comp_data + j->comp_len - 4);

    return arg;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x20010(%rdi), %rdx
leaq 0x1f(%rdx), %rax
movq %rax, 0x10008(%rdi)
movaps 0x698ae(%rip), %xmm0    # 0x76940
movups %xmm0, 0x8(%rdi)
leal 0x1e(%rdx), %eax
movw %ax, 0x18(%rdi)
movb $0x1, 0x1a(%rdi)
movw %dx, 0x1b(%rdi)
movl %edx, %eax
notl %eax
movw %ax, 0x1d(%rdi)
leaq 0x1f(%rdi), %rsi
xorl %edi, %edi
callq 0x4320
movq 0x10008(%rbx), %rcx
movl %eax, (%rbx,%rcx)
movl 0x20010(%rbx), %eax
movl %eax, 0x4(%rbx,%rcx)
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_encode_func
static void *bgzf_encode_func(void *arg) {
    bgzf_job *j = (bgzf_job *)arg;

    j->comp_len = BGZF_MAX_BLOCK_SIZE;
    int ret = bgzf_compress(j->comp_data, &j->comp_len,
                            j->uncomp_data, j->uncomp_len,
                            j->fp->compress_level);
    if (ret != 0)
        j->errcode |= BGZF_ERR_ZLIB;

    return arg;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x10008(%rdi), %rsi
movq $0x10000, 0x10008(%rdi) # imm = 0x10000
addq $0x8, %rdi
leaq 0x10010(%rbx), %rdx
movq 0x20010(%rbx), %rcx
movq (%rbx), %rax
movl (%rax), %r8d
shll $0x3, %r8d
sarl $0x17, %r8d
callq 0x9b4b
testl %eax, %eax
je 0xd117
orb $0x1, 0x20018(%rbx)
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hfile.c
// Function: hfile_init
HTSLIB_EXPORT
hFILE *hfile_init(size_t struct_size, const char *mode, size_t capacity)
{
    hFILE *fp = (hFILE *) malloc(struct_size);
    if (fp == NULL) goto error;

    const int maxcap = 128*1024;

    if (capacity == 0) capacity = maxcap;
    // FIXME For now, clamp input buffer sizes so mpileup doesn't eat memory
    if (strchr(mode, 'r') && capacity > maxcap) capacity = maxcap;

#ifdef HAVE_POSIX_MEMALIGN
    fp->buffer = NULL;
    if (posix_memalign((void **)&fp->buffer, 256, capacity) < 0)
        goto error;
#else
    fp->buffer = (char *) malloc(capacity);
    if (fp->buffer == NULL) goto error;
#endif

    fp->begin = fp->end = fp->buffer;
    fp->limit = &fp->buffer[capacity];

    fp->offset = 0;
    fp->at_eof = 0;
    fp->mobile = 1;
    fp->readonly = (strchr(mode, 'r') && ! strchr(mode, '+'));
    fp->preserve = 0;
    fp->has_errno = 0;
    return fp;

error:
    hfile_destroy(fp);
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r12
movq %rsi, %r14
callq 0x4680
movq %rax, %rbx
testq %rax, %rax
je 0xd1a2
testq %r12, %r12
movl $0x20000, %r15d         # imm = 0x20000
cmoveq %r15, %r12
pushq $0x72
popq %rsi
movq %r14, %rdi
callq 0x4190
cmpq %r15, %r12
cmovbq %r12, %r15
movq %rax, %r13
testq %rax, %rax
cmoveq %r12, %r15
movq %r15, %rdi
callq 0x4680
movq %rax, (%rbx)
testq %rax, %rax
je 0xd1a2
addq %rax, %r15
andq $0x0, 0x28(%rbx)
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
movq %r15, 0x18(%rbx)
testq %r13, %r13
je 0xd1ae
pushq $0x2b
popq %rsi
movq %r14, %rdi
callq 0x4190
testq %rax, %rax
sete %al
shlb $0x2, %al
orb $0x2, %al
jmp 0xd1b0
movq %rbx, %rdi
callq 0xd1c4
xorl %ebx, %ebx
jmp 0xd1b7
movb $0x2, %al
movb %al, 0x30(%rbx)
andl $0x0, 0x34(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hfile.c
// Function: hfile_init_fixed
hFILE *hfile_init_fixed(size_t struct_size, const char *mode,
                        char *buffer, size_t buf_filled, size_t buf_size)
{
    hFILE *fp = (hFILE *) malloc(struct_size);
    if (fp == NULL) return NULL;

    fp->buffer = fp->begin = buffer;
    fp->end = &fp->buffer[buf_filled];
    fp->limit = &fp->buffer[buf_size];

    fp->offset = 0;
    fp->at_eof = 1;
    fp->mobile = 0;
    fp->readonly = (strchr(mode, 'r') && ! strchr(mode, '+'));
    fp->preserve = 0;
    fp->has_errno = 0;
    return fp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, %r15
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %r14
callq 0x4680
movq %rax, %rbx
testq %rax, %rax
je 0xd25f
movq %r12, 0x8(%rbx)
movq %r12, (%rbx)
addq %r12, %r13
movq %r13, 0x10(%rbx)
addq %r12, %r15
movq %r15, 0x18(%rbx)
andq $0x0, 0x28(%rbx)
pushq $0x72
popq %rsi
movq %r14, %rdi
callq 0x4190
testq %rax, %rax
je 0xd256
pushq $0x2b
popq %rsi
movq %r14, %rdi
callq 0x4190
testq %rax, %rax
sete %al
shlb $0x2, %al
incb %al
jmp 0xd258
movb $0x1, %al
movb %al, 0x30(%rbx)
andl $0x0, 0x34(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hfile.c
// Function: hfile_set_blksize
HTSLIB_EXPORT
int hfile_set_blksize(hFILE *fp, size_t bufsiz) {
    char *buffer;
    ptrdiff_t curr_used;
    if (!fp) return -1;
    curr_used = (fp->begin > fp->end ? fp->begin : fp->end) - fp->buffer;
    if (bufsiz == 0) bufsiz = 32768;

    // Ensure buffer resize will not erase live data
    if (bufsiz < curr_used)
        return -1;

    if (!(buffer = (char *) realloc(fp->buffer, bufsiz))) return -1;

    fp->begin  = buffer + (fp->begin - fp->buffer);
    fp->end    = buffer + (fp->end   - fp->buffer);
    fp->buffer = buffer;
    fp->limit  = &fp->buffer[bufsiz];

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
pushq $-0x1
popq %rbp
testq %rdi, %rdi
je 0xd2da
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rcx, %rax
cmovaq %rax, %rcx
movq (%rdi), %rdi
subq %rdi, %rcx
testq %rsi, %rsi
movl $0x8000, %r14d          # imm = 0x8000
cmovneq %rsi, %r14
cmpq %rcx, %r14
jb 0xd2da
movq %r14, %rsi
callq 0x4840
testq %rax, %rax
je 0xd2da
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
subq %rcx, %rdx
addq %rax, %rdx
movq %rdx, 0x8(%rbx)
movq 0x10(%rbx), %rdx
subq %rcx, %rdx
addq %rax, %rdx
movq %rdx, 0x10(%rbx)
movq %rax, (%rbx)
addq %rax, %r14
movq %r14, 0x18(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hfile.c
// Function: refill_buffer
static ssize_t refill_buffer(hFILE *fp)
{
    ssize_t n;

    // Move any unread characters to the start of the buffer
    if (fp->mobile && fp->begin > fp->buffer) {
        fp->offset += fp->begin - fp->buffer;
        memmove(fp->buffer, fp->begin, fp->end - fp->begin);
        fp->end = &fp->buffer[fp->end - fp->begin];
        fp->begin = fp->buffer;
    }

    // Read into the available buffer space at fp->[end,limit)
    if (fp->at_eof || fp->end == fp->limit) n = 0;
    else {
        n = fp->backend->read(fp, fp->end, fp->limit - fp->end);
        if (n < 0) { fp->has_errno = errno; return n; }
        else if (n == 0) fp->at_eof = 1;
    }

    fp->end += n;
    return n;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0x30(%rdi), %al
testb $0x2, %al
je 0xd34b
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
movq %rsi, %rcx
subq %rdi, %rcx
jbe 0xd34b
addq %rcx, 0x28(%rbx)
movq 0x10(%rbx), %rdx
subq %rsi, %rdx
callq 0x4830
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
subq 0x8(%rbx), %rcx
addq %rax, %rcx
movq %rcx, 0x10(%rbx)
movq %rax, 0x8(%rbx)
movb 0x30(%rbx), %al
testb $0x1, %al
jne 0xd376
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
cmpq %rdx, %rsi
je 0xd376
movq 0x20(%rbx), %rax
subq %rsi, %rdx
movq %rbx, %rdi
callq *(%rax)
movq %rax, %r14
testq %rax, %rax
js 0xd388
jne 0xd379
orb $0x1, 0x30(%rbx)
xorl %r14d, %r14d
addq %r14, 0x10(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x4050
movl (%rax), %eax
movl %eax, 0x34(%rbx)
jmp 0xd37d
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hfile.c
// Function: hgetdelim
ssize_t hgetdelim(char *buffer, size_t size, int delim, hFILE *fp)
{
    char *found;
    size_t n, copied = 0;
    ssize_t got;

    if (size < 1 || size > SSIZE_MAX) {
        fp->has_errno = errno = EINVAL;
        return -1;
    }
    if (writebuffer_is_nonempty(fp)) {
        fp->has_errno = errno = EBADF;
        return -1;
    }

    --size; /* to allow space for the NUL terminator */

    do {
        n = fp->end - fp->begin;
        if (n > size - copied) n = size - copied;

        /* Look in the hFILE buffer for the delimiter */
        found = memchr(fp->begin, delim, n);
        if (found != NULL) {
            n = found - fp->begin + 1;
            memcpy(buffer + copied, fp->begin, n);
            buffer[n + copied] = '\0';
            fp->begin += n;
            return n + copied;
        }

        /* No delimiter yet, copy as much as we can and refill if necessary */
        memcpy(buffer + copied, fp->begin, n);
        fp->begin += n;
        copied += n;

        if (copied == size) { /* Output buffer full */
            buffer[copied] = '\0';
            return copied;
        }

        got = refill_buffer(fp);
    } while (got > 0);

    if (got < 0) return -1; /* Error on refill. */

    buffer[copied] = '\0';  /* EOF, return anything that was copied. */
    return copied;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movl %edx, 0x14(%rsp)
movq %rdi, 0x8(%rsp)
testq %rsi, %rsi
jle 0xd3c6
movq 0x8(%rbx), %rax
cmpq 0x10(%rbx), %rax
jbe 0xd3e8
callq 0x4050
pushq $0x9
jmp 0xd3cd
callq 0x4050
pushq $0x16
popq %rcx
movl %ecx, (%rax)
movl %ecx, 0x34(%rbx)
pushq $-0x1
popq %rbp
movq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rbp
decq %rbp
xorl %r14d, %r14d
movq 0x8(%rbx), %r12
movq 0x10(%rbx), %rax
subq %r12, %rax
movq %rbp, %r13
subq %r14, %r13
cmpq %r13, %rax
cmovbq %rax, %r13
movq %r12, %rdi
movl 0x14(%rsp), %esi
movq %r13, %rdx
callq 0x4550
testq %rax, %rax
jne 0xd45e
movq 0x8(%rsp), %rax
leaq (%rax,%r14), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x43c0
addq %r13, 0x8(%rbx)
addq %r13, %r14
cmpq %rbp, %r14
je 0xd492
movq %rbx, %rdi
callq 0xd305
testq %rax, %rax
jg 0xd3f1
js 0xd3d3
movq 0x8(%rsp), %rax
movb $0x0, (%rax,%r14)
movq %r14, %rbp
jmp 0xd3d6
movq %rax, %r15
subq %r12, %r15
leaq 0x1(%r15), %rdx
movq 0x8(%rsp), %r13
leaq (%r14,%r13), %rdi
movq %r12, %rsi
movq %rdx, %r12
callq 0x43c0
leaq (%r15,%r14), %rbp
incq %rbp
movb $0x0, (%r13,%rbp)
addq %r12, 0x8(%rbx)
jmp 0xd3d6
movq 0x8(%rsp), %rax
movb $0x0, (%rax,%rbp)
jmp 0xd3d6