LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_next_result_locked
static hts_tpool_result *hts_tpool_next_result_locked(hts_tpool_process *q) {
    hts_tpool_result *r, *last;

    if (q->shutdown)
        return NULL;

    for (last = NULL, r = q->output_head; r; last = r, r = r->next) {
        if (r->serial == q->next_serial)
            break;
    }

    if (r) {
        // Remove r from out linked list
        if (q->output_head == r)
            q->output_head = r->next;
        else
            last->next = r->next;

        if (q->output_tail == r)
            q->output_tail = last;

        if (!q->output_head)
            q->output_tail = NULL;

        q->next_serial++;
        q->n_output--;

        if (q->qsize && q->n_output < q->qsize) {
            // Not technically input full, but can guarantee there is
            // room for the input to go somewhere so we still signal.
            // The waiting code will then check the condition again.
            if (q->n_input < q->qsize)
                pthread_cond_signal(&q->input_not_full_c);
            if (!q->shutdown)
                wake_next_worker(q, 1);
        }
    }

    return r;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x0, 0x50(%rdi)
je 0x2bc0d
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rdi, %r14
leaq 0x18(%rdi), %rax
movq %rax, %rbx
xorl %esi, %esi
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x2bc00
movq %rsi, %rdx
movq 0x10(%rbx), %rcx
movq %rbx, %rsi
cmpq 0x30(%r14), %rcx
jne 0x2bc19
cmpq %rbx, 0x18(%r14)
movq %rdx, %rsi
cmoveq %rax, %rsi
movq (%rbx), %rdi
movq %rdi, (%rsi)
cmpq %rbx, 0x20(%r14)
jne 0x2bc4c
movq %rdx, 0x20(%r14)
cmpq $0x0, (%rax)
jne 0x2bc57
andq $0x0, 0x20(%r14)
incq %rcx
movq %rcx, 0x30(%r14)
movl 0x28(%r14), %eax
movl 0x48(%r14), %ecx
leal -0x1(%rcx), %edx
movl %edx, 0x48(%r14)
testl %eax, %eax
sete %dl
cmpl %eax, %ecx
setg %cl
orb %dl, %cl
jne 0x2bc02
cmpl %eax, 0x44(%r14)
jge 0x2bc98
leaq 0x90(%r14), %rdi
callq 0x4040
cmpl $0x0, 0x50(%r14)
jne 0x2bc02
movq %r14, %rdi
callq 0x2ca53
jmp 0x2bc02
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_next_result_wait
hts_tpool_result *hts_tpool_next_result_wait(hts_tpool_process *q) {
    hts_tpool_result *r;

    pthread_mutex_lock(&q->p->pool_m);
    while (!(r = hts_tpool_next_result_locked(q))) {
        /* Possible race here now avoided via _locked() call, but in case... */
        struct timeval now;
        struct timespec timeout;

        gettimeofday(&now, NULL);
        timeout.tv_sec = now.tv_sec + 10;
        timeout.tv_nsec = now.tv_usec * 1000;

        q->ref_count++;
        if (q->shutdown) {
            int rc = --q->ref_count;
            pthread_mutex_unlock(&q->p->pool_m);
            if (rc == 0)
                hts_tpool_process_destroy(q);
            return NULL;
        }
        pthread_cond_timedwait(&q->output_avail_c, &q->p->pool_m, &timeout);

        q->ref_count--;
    }
    pthread_mutex_unlock(&q->p->pool_m);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rdi), %rdi
addq $0x38, %rdi
callq 0x4750
leaq 0x60(%rbx), %r15
leaq 0x18(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %rbx, %rdi
callq 0x2bbf6
movq %rax, %r14
testq %rax, %rax
jne 0x2bd2c
movq %r12, %rdi
xorl %esi, %esi
callq 0x4810
movq 0x18(%rsp), %rax
addq $0xa, %rax
movq %rax, 0x8(%rsp)
imulq $0x3e8, 0x20(%rsp), %rax # imm = 0x3E8
movq %rax, 0x10(%rsp)
movl 0x5c(%rbx), %ebp
leal 0x1(%rbp), %eax
movl %eax, 0x5c(%rbx)
cmpl $0x0, 0x50(%rbx)
jne 0x2bd3a
movq (%rbx), %rsi
addq $0x38, %rsi
movq %r15, %rdi
movq %r13, %rdx
callq 0x47a0
decl 0x5c(%rbx)
jmp 0x2bcd0
movq (%rbx), %rdi
addq $0x38, %rdi
callq 0x4340
jmp 0x2bd55
movl %ebp, 0x5c(%rbx)
movq (%rbx), %rdi
addq $0x38, %rdi
callq 0x4340
testl %ebp, %ebp
jne 0x2bd55
movq %rbx, %rdi
callq 0x2bd67
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_process_destroy
void hts_tpool_process_destroy(hts_tpool_process *q) {
    DBG_OUT(stderr, "Destroying results queue %p\n", q);

    if (!q)
        return;

    // Prevent dispatch from queuing up any more jobs.
    // We want to reset (and flush) the queue here, before
    // we set the shutdown flag, but we need to avoid races
    // with queue more input during reset.
    pthread_mutex_lock(&q->p->pool_m);
    q->no_more_input = 1;
    pthread_mutex_unlock(&q->p->pool_m);

    // Ensure it's fully drained before destroying the queue
    hts_tpool_process_reset(q, 0);
    pthread_mutex_lock(&q->p->pool_m);
    hts_tpool_process_detach_locked(q->p, q);
    hts_tpool_process_shutdown_locked(q);

    // Maybe a worker is scanning this queue, so delay destruction
    if (--q->ref_count > 0) {
        pthread_mutex_unlock(&q->p->pool_m);
        return;
    }

    pthread_cond_destroy(&q->output_avail_c);
    pthread_cond_destroy(&q->input_not_full_c);
    pthread_cond_destroy(&q->input_empty_c);
    pthread_cond_destroy(&q->none_processing_c);
    pthread_mutex_unlock(&q->p->pool_m);

    free(q);

    DBG_OUT(stderr, "Destroyed results queue %p\n", q);
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x2bdd3
movq %rdi, %rbx
movq (%rdi), %rdi
addq $0x38, %rdi
callq 0x4750
movl $0x1, 0x40(%rbx)
movq (%rbx), %rdi
addq $0x38, %rdi
callq 0x4340
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2c10a
movq (%rbx), %rdi
addq $0x38, %rdi
callq 0x4750
movq (%rbx), %rdi
movq %rbx, %rsi
callq 0x2c230
movq %rbx, %rdi
callq 0x2bf3c
movl 0x5c(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x5c(%rbx)
cmpl $0x2, %eax
jl 0x2bdd5
movq (%rbx), %rdi
addq $0x38, %rdi
popq %rbx
jmp 0x4340
popq %rbx
retq
leaq 0x60(%rbx), %rdi
callq 0x49a0
leaq 0x90(%rbx), %rdi
callq 0x49a0
leaq 0xc0(%rbx), %rdi
callq 0x49a0
leaq 0xf0(%rbx), %rdi
callq 0x49a0
movq (%rbx), %rdi
addq $0x38, %rdi
callq 0x4340
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_process_empty
int hts_tpool_process_empty(hts_tpool_process *q) {
    int empty;

    pthread_mutex_lock(&q->p->pool_m);
    empty = q->n_input == 0 && q->n_processing == 0 && q->n_output == 0;
    pthread_mutex_unlock(&q->p->pool_m);

    return empty;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
addq $0x38, %rdi
callq 0x4750
xorl %ebp, %ebp
cmpl $0x0, 0x44(%rbx)
jne 0x2be41
cmpl $0x0, 0x4c(%rbx)
jne 0x2be41
xorl %ebp, %ebp
cmpl $0x0, 0x48(%rbx)
sete %bpl
movq (%rbx), %rdi
addq $0x38, %rdi
callq 0x4340
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_process_ref_decr
void hts_tpool_process_ref_decr(hts_tpool_process *q) {
    pthread_mutex_lock(&q->p->pool_m);
    if (--q->ref_count <= 0) {
        pthread_mutex_unlock(&q->p->pool_m);
        hts_tpool_process_destroy(q);
        return;
    }

    // maybe also call destroy here if needed?
    pthread_mutex_unlock(&q->p->pool_m);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
addq $0x38, %rdi
callq 0x4750
movl 0x5c(%rbx), %r14d
leal -0x1(%r14), %eax
movl %eax, 0x5c(%rbx)
movq (%rbx), %rdi
addq $0x38, %rdi
callq 0x4340
cmpl $0x1, %r14d
jg 0x2beb5
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2bd67
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_delete_result
void hts_tpool_delete_result(hts_tpool_result *r, int free_data) {
    if (!r)
        return;

    if (free_data && r->data)
        free(r->data);

    free(r);
}

// Assembly:
testq %rdi, %rdi
je 0x2bfc1
pushq %rbx
movq %rdi, %rbx
testl %esi, %esi
je 0x2bfb8
movq 0x18(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_process_init
hts_tpool_process *hts_tpool_process_init(hts_tpool *p, int qsize, int in_only) {
    hts_tpool_process *q = malloc(sizeof(*q));
    if (!q)
        return NULL;

    pthread_cond_init(&q->output_avail_c,   NULL);
    pthread_cond_init(&q->input_not_full_c, NULL);
    pthread_cond_init(&q->input_empty_c,    NULL);
    pthread_cond_init(&q->none_processing_c,NULL);

    q->p           = p;
    q->input_head  = NULL;
    q->input_tail  = NULL;
    q->output_head = NULL;
    q->output_tail = NULL;
    q->next_serial = 0;
    q->curr_serial = 0;
    q->no_more_input = 0;
    q->n_input     = 0;
    q->n_output    = 0;
    q->n_processing= 0;
    q->qsize       = qsize;
    q->in_only     = in_only;
    q->shutdown    = 0;
    q->wake_dispatch = 0;
    q->ref_count   = 1;

    q->next        = NULL;
    q->prev        = NULL;

    hts_tpool_process_attach(p, q);

    return q;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r14
movl $0x130, %edi            # imm = 0x130
callq 0x4680
movq %rax, %rbx
testq %rax, %rax
je 0x2c061
leaq 0x60(%rbx), %rdi
xorl %esi, %esi
callq 0x45d0
leaq 0x90(%rbx), %rdi
xorl %esi, %esi
callq 0x45d0
leaq 0xc0(%rbx), %rdi
xorl %esi, %esi
callq 0x45d0
movq %rbx, %rdi
addq $0xf0, %rdi
xorl %esi, %esi
callq 0x45d0
movq %r14, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x18(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x40(%rbx)
movl %r15d, 0x28(%rbx)
movl %ebp, 0x54(%rbx)
andl $0x0, 0x50(%rbx)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x58(%rbx)
movups %xmm0, 0x120(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2c06f
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_process_attach
void hts_tpool_process_attach(hts_tpool *p, hts_tpool_process *q) {
    pthread_mutex_lock(&p->pool_m);
    if (p->q_head) {
        q->next = p->q_head;
        q->prev = p->q_head->prev;
        p->q_head->prev->next = q;
        p->q_head->prev = q;
    } else {
        q->next = q;
        q->prev = q;
    }
    p->q_head = q;
    assert(p->q_head && p->q_head->prev && p->q_head->next);
    pthread_mutex_unlock(&p->pool_m);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x38(%rdi), %rbx
movq %rbx, %rdi
callq 0x4750
movq 0x10(%r15), %rax
testq %rax, %rax
je 0x2c0c2
movq %rax, 0x120(%r14)
movq 0x128(%rax), %rcx
movq %rcx, 0x128(%r14)
movq %r14, 0x120(%rcx)
movq %r14, 0x128(%rax)
cmpq $0x0, 0x128(%r14)
movq %r14, 0x10(%r15)
jne 0x2c0d4
jmp 0x2c0eb
movq %r14, 0x120(%r14)
movq %r14, 0x128(%r14)
movq %r14, 0x10(%r15)
cmpq $0x0, 0x120(%r14)
je 0x2c0eb
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4340
leaq 0x4ec7c(%rip), %rdi     # 0x7ad6e
leaq 0x4eca5(%rip), %rsi     # 0x7ad9e
leaq 0x4ecac(%rip), %rcx     # 0x7adac
movl $0x1d4, %edx            # imm = 0x1D4
callq 0x42f0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_process_detach_locked
static void hts_tpool_process_detach_locked(hts_tpool *p,
                                            hts_tpool_process *q) {
    if (!p->q_head || !q->prev || !q->next)
        return;

    hts_tpool_process *curr = p->q_head, *first = curr;
    do {
        if (curr == q) {
            q->next->prev = q->prev;
            q->prev->next = q->next;
            p->q_head = q->next;
            q->next = q->prev = NULL;

            // Last one
            if (p->q_head == q)
                p->q_head = NULL;
            break;
        }

        curr = curr->next;
    } while (curr != first);
}

// Assembly:
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x2c299
movq 0x128(%rsi), %rcx
testq %rcx, %rcx
je 0x2c299
movq 0x120(%rsi), %r8
testq %r8, %r8
je 0x2c299
leaq 0x120(%rsi), %rdx
movq %rax, %r9
cmpq %rsi, %r9
je 0x2c26e
movq 0x120(%r9), %r9
cmpq %rax, %r9
jne 0x2c25b
jmp 0x2c299
movq %rcx, 0x128(%r8)
movq 0x128(%rsi), %rax
movq %r8, 0x120(%rax)
movq 0x120(%rsi), %rax
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
cmpq %rsi, %rax
je 0x2c29a
retq
andq $0x0, 0x10(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_destroy
void hts_tpool_destroy(hts_tpool *p) {
    int i;

    DBG_OUT(stderr, "Destroying pool %p\n", p);

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

    DBG_OUT(stderr, "Sending shutdown request\n");

    for (i = 0; i < p->tsize; i++)
        pthread_cond_signal(&p->t[i].pending_c);

    pthread_mutex_unlock(&p->pool_m);

    DBG_OUT(stderr, "Shutdown complete\n");

    for (i = 0; i < p->tsize; i++)
        pthread_join(p->t[i].tid, NULL);

    pthread_mutex_destroy(&p->pool_m);
    for (i = 0; i < p->tsize; i++)
        pthread_cond_destroy(&p->t[i].pending_c);

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

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

    DBG_OUT(stderr, "Destroyed pool %p\n", p);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0x4750
movl $0x1, 0x8(%rbx)
pushq $0x18
popq %r15
xorl %r12d, %r12d
movslq 0x18(%rbx), %rax
cmpq %rax, %r12
jge 0x2ccd2
movq 0x20(%rbx), %rdi
addq %r15, %rdi
callq 0x4040
incq %r12
addq $0x48, %r15
jmp 0x2ccb4
movq %r14, %rdi
callq 0x4340
pushq $0x10
popq %r15
xorl %r12d, %r12d
movslq 0x18(%rbx), %rax
cmpq %rax, %r12
jge 0x2cd02
movq 0x20(%rbx), %rax
movq (%rax,%r15), %rdi
xorl %esi, %esi
callq 0x4410
incq %r12
addq $0x48, %r15
jmp 0x2cce1
movq %r14, %rdi
callq 0x4590
pushq $0x18
popq %r14
xorl %r15d, %r15d
movslq 0x18(%rbx), %rax
cmpq %rax, %r15
jge 0x2cd2f
movq 0x20(%rbx), %rdi
addq %r14, %rdi
callq 0x49a0
incq %r15
addq $0x48, %r14
jmp 0x2cd11
movq 0x28(%rbx), %rdi
callq 0x45c0
movq 0x20(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x45c0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/thread_pool.c
// Function: hts_tpool_kill
void hts_tpool_kill(hts_tpool *p) {
    int i;

    DBG_OUT(stderr, "Destroying pool %p, kill=%d\n", p, kill);

    for (i = 0; i < p->tsize; i++)
        pthread_kill(p->t[i].tid, SIGINT);

    pthread_mutex_destroy(&p->pool_m);
    for (i = 0; i < p->tsize; i++)
        pthread_cond_destroy(&p->t[i].pending_c);

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

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

    DBG_OUT(stderr, "Destroyed pool %p\n", p);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x10
popq %r14
xorl %r15d, %r15d
pushq $0x2
popq %rbp
movslq 0x18(%rbx), %rax
cmpq %rax, %r15
jge 0x2cd89
movq 0x20(%rbx), %rax
movq (%rax,%r14), %rdi
movl %ebp, %esi
callq 0x4660
incq %r15
addq $0x48, %r14
jmp 0x2cd68
leaq 0x38(%rbx), %rdi
callq 0x4590
pushq $0x18
popq %r14
xorl %r15d, %r15d
movslq 0x18(%rbx), %rax
cmpq %rax, %r15
jge 0x2cdb7
movq 0x20(%rbx), %rdi
addq %r14, %rdi
callq 0x49a0
incq %r15
addq $0x48, %r14
jmp 0x2cd99
movq 0x28(%rbx), %rdi
callq 0x45c0
movq 0x20(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x45c0
nop
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_io.h
// Function: block_append
static inline int block_append(cram_block *b, const void *s, size_t len) {
    if (block_grow(b, len) < 0)
        return -1;

    if (len) {
        memcpy(BLOCK_END(b), s, len);
        BLOCK_SIZE(b) += len;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x30(%rdi), %rsi
addq %rdx, %rsi
callq 0x44586
testl %eax, %eax
js 0x3f002
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x3f005
movq 0x20(%r14), %rdi
addq 0x30(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, 0x30(%r14)
jmp 0x3f005
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_decode.c
// Function: cram_decode_estimate_sizes
void cram_decode_estimate_sizes(cram_block_compression_hdr *hdr, cram_slice *s,
                                int *qual_size, int *name_size,
                                int *q_id) {
    int bnum1, bnum2;
    cram_codec *cd;

    *qual_size = 0;
    *name_size = 0;

    /* Qual */
    cd = hdr->codecs[DS_QS];
    if (cd == NULL) return;
    bnum1 = cram_codec_to_id(cd, &bnum2);
    if (bnum1 < 0 && bnum2 >= 0) bnum1 = bnum2;
    if (cram_ds_unique(hdr, cd, bnum1)) {
        cram_block *b = cram_get_block_by_id(s, bnum1);
        if (b) *qual_size = b->uncomp_size;
        if (q_id && cd->codec == E_EXTERNAL)
            *q_id = bnum1;
    }

    /* Name */
    cd = hdr->codecs[DS_RN];
    if (cd == NULL) return;
    bnum1 = cram_codec_to_id(cd, &bnum2);
    if (bnum1 < 0 && bnum2 >= 0) bnum1 = bnum2;
    if (cram_ds_unique(hdr, cd, bnum1)) {
        cram_block *b = cram_get_block_by_id(s, bnum1);
        if (b) *name_size = b->uncomp_size;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
andl $0x0, (%rdx)
andl $0x0, (%rcx)
movq %rsi, 0x10(%rsp)
movq 0x2e0(%rdi), %rbp
testq %rbp, %rbp
je 0x2e5b6
movq %r8, %r12
movq %rdx, %r13
movq %rcx, %rbx
movq %rdi, %r15
leaq 0xc(%rsp), %r14
movq %rbp, %rdi
movq %r14, %rsi
callq 0x746b5
movl (%r14), %r14d
testl %r14d, %r14d
cmovsl %eax, %r14d
testl %eax, %eax
cmovnsl %eax, %r14d
movq %r15, %rdi
movl %r14d, %esi
callq 0x2e5c5
testl %eax, %eax
je 0x2e56c
movq 0x10(%rsp), %rdi
movl %r14d, %esi
callq 0x2e646
testq %rax, %rax
je 0x2e55d
movl 0x14(%rax), %eax
movl %eax, (%r13)
testq %r12, %r12
je 0x2e56c
cmpl $0x1, (%rbp)
jne 0x2e56c
movl %r14d, (%r12)
movq 0x2d8(%r15), %rdi
testq %rdi, %rdi
je 0x2e5b6
leaq 0xc(%rsp), %r14
movq %r14, %rsi
callq 0x746b5
movl (%r14), %ebp
testl %ebp, %ebp
cmovsl %eax, %ebp
testl %eax, %eax
cmovnsl %eax, %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x2e5c5
testl %eax, %eax
je 0x2e5b6
movq 0x10(%rsp), %rdi
movl %ebp, %esi
callq 0x2e646
testq %rax, %rax
je 0x2e5b6
movl 0x14(%rax), %eax
movl %eax, (%rbx)
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/cram/cram_decode.c
// Function: cram_ds_unique
static int cram_ds_unique(cram_block_compression_hdr *hdr, cram_codec *c,
                          int id) {
    int i, n_id = 0;
    enum cram_encoding e_type = 0;

    for (i = 0; i < DS_END; i++) {
        cram_codec *c;
        int bnum1, bnum2, old_n_id;

        if (!(c = hdr->codecs[i]))
            continue;

        bnum1 = cram_codec_to_id(c, &bnum2);

        old_n_id = n_id;
        if (bnum1 == id) {
            n_id++;
            e_type = c->codec;
        }
        if (bnum2 == id) {
            n_id++;
            e_type = c->codec;
        }

        if (n_id == old_n_id+2)
            n_id--; // len/val in same place counts once only.
    }

    return n_id == 1 ? e_type : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
xorl %r13d, %r13d
xorl %ebp, %ebp
xorl %r15d, %r15d
cmpq $0x2f, %r13
je 0x2e62e
movq 0x280(%r14,%r13,8), %r12
testq %r12, %r12
je 0x2e629
movq %r12, %rdi
leaq 0x4(%rsp), %rsi
callq 0x746b5
movl %r15d, %ecx
cmpl %ebx, %eax
jne 0x2e60c
leal 0x1(%r15), %ecx
movl (%r12), %ebp
cmpl %ebx, 0x4(%rsp)
jne 0x2e618
incl %ecx
movl (%r12), %ebp
addl $0x2, %r15d
xorl %eax, %eax
cmpl %r15d, %ecx
sete %al
subl %eax, %ecx
movl %ecx, %r15d
incq %r13
jmp 0x2e5dd
xorl %eax, %eax
cmpl $0x1, %r15d
cmovel %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_io.h
// Function: cram_get_block_by_id
static inline cram_block *cram_get_block_by_id(cram_slice *slice, int id) {
  //fprintf(stderr, "%d\t%p\n", id, slice->block_by_id);
    uint32_t v = id;
    if (slice->block_by_id && v < 256) {
        return slice->block_by_id[v];
    } else {
        v = 256 + v % 251;
        if (slice->block_by_id &&
            slice->block_by_id[v] &&
            slice->block_by_id[v]->content_id == id)
            return slice->block_by_id[v];

        // Otherwise a linear search in case of collision
        int i;
        for (i = 0; i < slice->hdr->num_blocks; i++) {
            cram_block *b = slice->block[i];
            if (b && b->content_type == EXTERNAL && b->content_id == id)
                return b;
        }
    }
    return NULL;
}

// Assembly:
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
sete %al
cmpl $0x100, %esi            # imm = 0x100
setae %dl
orb %al, %dl
jne 0x2e664
movl %esi, %eax
movq (%rcx,%rax,8), %rax
retq
testq %rcx, %rcx
je 0x2e68b
movl $0xfb, %r8d
movl %esi, %eax
xorl %edx, %edx
divl %r8d
shll $0x3, %edx
movq 0x800(%rcx,%rdx), %rax
testq %rax, %rax
je 0x2e68b
cmpl %esi, 0xc(%rax)
je 0x2e663
movq (%rdi), %rax
movl 0x28(%rax), %ecx
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x2e6bc
movq 0x10(%rdi), %rax
movq (%rax,%rdx,8), %rax
testq %rax, %rax
je 0x2e6b7
cmpl $0x4, 0x8(%rax)
jne 0x2e6b7
cmpl %esi, 0xc(%rax)
je 0x2e663
incq %rdx
jmp 0x2e69a
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_io.h
// Function: block_resize_exact
static inline int block_resize_exact(cram_block *b, size_t len) {
    unsigned char *tmp = realloc(b->data, len);
    if (!tmp)
        return -1;
    b->alloc = len;
    b->data = tmp;
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
callq 0x4840
testq %rax, %rax
je 0x327a1
movq %r14, 0x28(%rbx)
movq %rax, 0x20(%rbx)
xorl %eax, %eax
jmp 0x327a4
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_decode.c
// Function: md5_print
static char *md5_print(unsigned char *md5, char *out) {
    int i;
    for (i = 0; i < 16; i++) {
        out[i*2+0] = "0123456789abcdef"[md5[i]>>4];
        out[i*2+1] = "0123456789abcdef"[md5[i]&15];
    }
    out[32] = 0;

    return out;
}

// Assembly:
movq %rsi, %rax
xorl %ecx, %ecx
leaq 0x48ccc(%rip), %rdx     # 0x7b484
cmpq $0x10, %rcx
je 0x327e2
movzbl (%rdi,%rcx), %esi
shrl $0x4, %esi
movb (%rsi,%rdx), %sil
movb %sil, (%rax,%rcx,2)
movzbl (%rdi,%rcx), %esi
andl $0xf, %esi
movb (%rsi,%rdx), %sil
movb %sil, 0x1(%rax,%rcx,2)
incq %rcx
jmp 0x327b8
movb $0x0, 0x20(%rax)
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_decode.c
// Function: cram_decode_tlen
static int cram_decode_tlen(cram_fd *fd, cram_container *c, cram_slice *s,
                            cram_block *blk, int64_t *tlen) {
    int out_sz = 1, r = 0;

    if (!c->comp_hdr->codecs[DS_TS]) return -1;
    if (CRAM_MAJOR_VERS(fd->version) < 4) {
        int32_t i32;
        r |= c->comp_hdr->codecs[DS_TS]
            ->decode(s, c->comp_hdr->codecs[DS_TS], blk,
                     (char *)&i32, &out_sz);
        *tlen = i32;
    } else {
        r |= c->comp_hdr->codecs[DS_TS]
            ->decode(s, c->comp_hdr->codecs[DS_TS], blk,
                     (char *)tlen, &out_sz);
    }
    return r;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x1, (%rsp)
movq 0x48(%rsi), %rax
movq 0x330(%rax), %rsi
testq %rsi, %rsi
je 0x3282a
movq %r8, %rbx
cmpl $0x3ff, 0xc(%rdi)       # imm = 0x3FF
jg 0x3282f
leaq 0x4(%rsp), %r14
movq %rsp, %r8
movq %rdx, %rdi
movq %rcx, %rdx
movq %r14, %rcx
callq *0x28(%rsi)
movslq (%r14), %rcx
movq %rcx, (%rbx)
jmp 0x3283e
pushq $-0x1
popq %rax
jmp 0x3283e
movq %rsp, %r8
movq %rdx, %rdi
movq %rcx, %rdx
movq %rbx, %rcx
callq *0x28(%rsi)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_decode.c
// Function: cram_decode_slice_mt
int cram_decode_slice_mt(cram_fd *fd, cram_container *c, cram_slice *s,
                         sam_hdr_t *bfd) {
    cram_decode_job *j;
    int nonblock;

    if (!fd->pool)
        return cram_decode_slice(fd, c, s, bfd);

    if (!(j = malloc(sizeof(*j))))
        return -1;

    j->fd = fd;
    j->c  = c;
    j->s  = s;
    j->h  = bfd;

    nonblock = hts_tpool_process_sz(fd->rqueue) ? 1 : 0;

    int saved_errno = errno;
    errno = 0;
    if (-1 == hts_tpool_dispatch2(fd->pool, fd->rqueue, cram_decode_slice_thread,
                                  j, nonblock)) {
        /* Would block */
        if (errno != EAGAIN)
            return -1;
        fd->job_pending = j;
    } else {
        fd->job_pending = NULL;
    }
    errno = saved_errno;

    // flush too
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
cmpq $0x0, 0x88b8(%rdi)
je 0x32926
pushq $0x28
popq %rdi
callq 0x4680
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x32957
movq %rax, %r14
movq %rbx, (%rax)
movq %r13, 0x8(%rax)
movq %r12, 0x10(%rax)
movq %r15, 0x18(%rax)
movq 0x88c0(%rbx), %rdi
callq 0x2bee7
xorl %r12d, %r12d
testl %eax, %eax
setne %r12b
callq 0x4050
movq %rax, %r15
movl (%rax), %r13d
andl $0x0, (%rax)
movq 0x88b8(%rbx), %rdi
movq 0x88c0(%rbx), %rsi
leaq -0x9f(%rip), %rdx       # 0x32872
movq %r14, %rcx
movl %r12d, %r8d
callq 0x2ca41
cmpl $-0x1, %eax
je 0x32945
xorl %r14d, %r14d
jmp 0x3294b
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2e93b
cmpl $0xb, (%r15)
jne 0x32957
movq %r14, 0x8970(%rbx)
movl %r13d, (%r15)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_io.h
// Function: append_uint64
static inline unsigned char *append_uint64(unsigned char *cp, uint64_t i) {
    uint64_t j;

    if (i <= 0xffffffff)
        return append_uint32(cp, i);

    if ((j = i/1000000000) > 1000000000) {
        cp = append_uint32(cp, j/1000000000);
        j %= 1000000000;
        cp = append_sub32(cp, j);
    } else {
        cp = append_uint32(cp, i / 1000000000);
    }
    cp = append_sub32(cp, i % 1000000000);

    return cp;
}

// Assembly:
movq %rsi, %rax
shrq $0x20, %rax
jne 0x32c90
jmp 0x3392b
pushq %r15
pushq %r14
pushq %rbx
movl $0x3b9aca00, %r15d      # imm = 0x3B9ACA00
movq %rsi, %rax
xorl %edx, %edx
divq %r15
movq %rax, %r14
movq %rdx, %rbx
movabsq $0xde0b6b3e2feca00, %rax # imm = 0xDE0B6B3E2FECA00
cmpq %rax, %rsi
jb 0x32ce5
movabsq $0xde0b6b3a7640000, %rcx # imm = 0xDE0B6B3A7640000
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
movl %eax, %esi
callq 0x3392b
movq %rax, %rdi
movq %r14, %rax
xorl %edx, %edx
divq %r15
movl %edx, %esi
callq 0x33b1e
jmp 0x32ced
movl %r14d, %esi
callq 0x3392b
movq %rax, %rdi
movl %ebx, %esi
popq %rbx
popq %r14
popq %r15
jmp 0x33b1e
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_decode.c
// Function: cram_get_bam_seq
int cram_get_bam_seq(cram_fd *fd, bam_seq_t **bam) {
    cram_record *cr;
    cram_container *c;
    cram_slice *s;

    if (!(cr = cram_get_seq(fd)))
        return -1;

    c = fd->ctr;
    s = c->slice;

    return cram_to_bam(fd->header, fd, s, cr, s->curr_rec-1, bam);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x33312
testq %rax, %rax
je 0x3344e
movq 0x18(%r14), %rdi
movq 0x38(%r14), %rcx
movq 0x90(%rcx), %rdx
movl 0xe4(%rdx), %r8d
decl %r8d
movq %r14, %rsi
movq %rax, %rcx
movq %rbx, %r9
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x32968
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_decode.c
// Function: map_find
static cram_map *map_find(cram_map **map, unsigned char *key, int id) {
    cram_map *m;

    m = map[CRAM_MAP(key[0],key[1])];
    while (m && m->key != id)
        m= m->next;

    return m;
}

// Assembly:
movzbl (%rsi), %eax
leal (%rax,%rax,2), %eax
movzbl 0x1(%rsi), %ecx
addl %eax, %ecx
andl $0x1f, %ecx
leaq (%rdi,%rcx,8), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x3389f
cmpl %edx, (%rax)
je 0x3389f
addq $0x18, %rax
jmp 0x3388d
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_decode.c
// Function: add_md_char
static inline int add_md_char(cram_slice *s, int decode_md, char c, int32_t *md_dist) {
    if (decode_md) {
        BLOCK_APPEND_UINT(s->aux_blk, *md_dist);
        BLOCK_APPEND_CHAR(s->aux_blk, c);
        *md_dist = 0;
    }
    return 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebp, %ebp
testl %esi, %esi
je 0x338e4
movq %rcx, %rbx
movl %edx, %r14d
movq %rdi, %r15
movq 0x90(%rdi), %rdi
movl (%rcx), %esi
callq 0x338f1
pushq $-0x1
popq %rbp
testl %eax, %eax
js 0x338e4
movq 0x90(%r15), %rdi
movsbl %r14b, %esi
callq 0x2cfc7
testl %eax, %eax
js 0x338e4
andl $0x0, (%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_io.h
// Function: block_append_uint
static inline int block_append_uint(cram_block *b, unsigned int i) {
    if (block_grow(b, 11) < 0)
        return -1;

    unsigned char *cp = &b->data[b->byte];
    b->byte += append_uint32(cp, i) - cp;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
pushq $0xb
popq %rsi
callq 0x335d9
testl %eax, %eax
js 0x33923
movq 0x20(%rbx), %r14
addq 0x30(%rbx), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0x3392b
subq %r14, %rax
addq %rax, 0x30(%rbx)
xorl %eax, %eax
jmp 0x33926
pushq $-0x1
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_io.h
// Function: append_sub32
static inline unsigned char *append_sub32(unsigned char *cp, uint32_t i) {
    *cp++ = i / 100000000 + '0', i %= 100000000;
    *cp++ = i / 10000000  + '0', i %= 10000000;
    *cp++ = i / 1000000   + '0', i %= 1000000;
    *cp++ = i / 100000    + '0', i %= 100000;
    *cp++ = i / 10000     + '0', i %= 10000;
    *cp++ = i / 1000      + '0', i %= 1000;
    *cp++ = i / 100       + '0', i %= 100;
    *cp++ = i / 10        + '0', i %= 10;
    *cp++ = i             + '0';

    return cp;
}

// Assembly:
movl %esi, %eax
movl $0x5f5e100, %ecx        # imm = 0x5F5E100
xorl %edx, %edx
divl %ecx
addb $0x30, %al
movb %al, (%rdi)
movl $0x989680, %ecx         # imm = 0x989680
movl %edx, %eax
xorl %edx, %edx
divl %ecx
orb $0x30, %al
movb %al, 0x1(%rdi)
movl $0xf4240, %ecx          # imm = 0xF4240
movl %edx, %eax
xorl %edx, %edx
divl %ecx
addb $0x30, %al
movb %al, 0x2(%rdi)
movl $0x186a0, %ecx          # imm = 0x186A0
movl %edx, %eax
xorl %edx, %edx
divl %ecx
orb $0x30, %al
movb %al, 0x3(%rdi)
movl $0x2710, %ecx           # imm = 0x2710
movl %edx, %eax
xorl %edx, %edx
divl %ecx
orb $0x30, %al
movb %al, 0x4(%rdi)
movw $0x3e8, %cx             # imm = 0x3E8
movl %edx, %eax
xorl %edx, %edx
divw %cx
addb $0x30, %al
movb %al, 0x5(%rdi)
movw $0x64, %cx
movl %edx, %eax
xorl %edx, %edx
divw %cx
orb $0x30, %al
movb %al, 0x6(%rdi)
movzbl %dl, %eax
movb $0xa, %cl
divb %cl
movzbl %ah, %ecx
orb $0x30, %al
movb %al, 0x7(%rdi)
orb $0x30, %cl
movb %cl, 0x8(%rdi)
leaq 0x9(%rdi), %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_encode.c
// Function: cram_update_curr_slice
void cram_update_curr_slice(cram_container *c, int version) {
    cram_slice *s = c->slice;
    if (c->multi_seq) {
        s->hdr->ref_seq_id    = -2;
        s->hdr->ref_seq_start = 0;
        s->hdr->ref_seq_span  = 0;
    } else if (c->curr_ref == -1 && CRAM_ge31(version)) {
        // Spec states span=0, but it broke our range queries.
        // See commit message for this and prior.
        s->hdr->ref_seq_id    = -1;
        s->hdr->ref_seq_start = 0;
        s->hdr->ref_seq_span  = 0;
    } else {
        s->hdr->ref_seq_id    = c->curr_ref;
        s->hdr->ref_seq_start = c->first_base;
        s->hdr->ref_seq_span  = MAX(0, c->last_base - c->first_base + 1);
    }
    s->hdr->num_records   = c->curr_rec;

    if (c->curr_slice == 0) {
        if (c->ref_seq_id != s->hdr->ref_seq_id)
            c->ref_seq_id  = s->hdr->ref_seq_id;
        c->ref_seq_start = c->first_base;
    }

    c->curr_slice++;
}

// Assembly:
movq 0x90(%rdi), %rcx
cmpl $0x0, 0xac(%rdi)
je 0x3affa
movq (%rcx), %rcx
movl $0xfffffffe, 0x4(%rcx)  # imm = 0xFFFFFFFE
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rcx)
pushq $-0x2
jmp 0x3b022
movl 0x78(%rdi), %eax
cmpl $-0x1, %eax
setne %dl
cmpl $0x301, %esi            # imm = 0x301
setl %sil
movq (%rcx), %rcx
orb %dl, %sil
jne 0x3b049
orl $-0x1, 0x4(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rcx)
pushq $-0x1
popq %rax
movl 0x68(%rdi), %edx
movl %edx, 0x18(%rcx)
movl 0x5c(%rdi), %ecx
testl %ecx, %ecx
jne 0x3b043
cmpl %eax, 0x4(%rdi)
je 0x3b038
movl %eax, 0x4(%rdi)
movq 0xc8(%rdi), %rax
movq %rax, 0x8(%rdi)
incl %ecx
movl %ecx, 0x5c(%rdi)
retq
movl %eax, 0x4(%rcx)
movq 0xc8(%rdi), %rdx
movq %rdx, 0x8(%rcx)
movq 0xd0(%rdi), %rsi
subq %rdx, %rsi
leaq 0x1(%rsi), %rdx
xorl %r8d, %r8d
cmpq $-0x1, %rsi
cmovgeq %rdx, %r8
movq %r8, 0x10(%rcx)
jmp 0x3b023
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_encode.c
// Function: bam_aux2i_end
static inline int bam_aux2i_end(const uint8_t *aux, const uint8_t *aux_end) {
    int type = *aux++;
    switch (type) {
        case 'c':
            if (aux_end - aux < 1) {
                errno = EINVAL;
                return 0;
            }
            return *(int8_t *)aux;
        case 'C':
            if (aux_end - aux < 1) {
                errno = EINVAL;
                return 0;
            }
            return *aux;
        case 's':
            if (aux_end - aux < 2) {
                errno = EINVAL;
                return 0;
            }
            return le_to_i16(aux);
        case 'S':
            if (aux_end - aux < 2) {
                errno = EINVAL;
                return 0;
            }
            return le_to_u16(aux);
        case 'i':
            if (aux_end - aux < 4) {
                errno = EINVAL;
                return 0;
            }
            return le_to_i32(aux);
        case 'I':
            if (aux_end - aux < 4) {
                errno = EINVAL;
                return 0;
            }
            return le_to_u32(aux);
        default:
            errno = EINVAL;
    }
    return 0;
}

// Assembly:
pushq %rax
movzbl (%rdi), %eax
incq %rdi
cmpl $0x43, %eax
je 0x3bbb4
cmpl $0x49, %eax
je 0x3bb8b
cmpl $0x53, %eax
je 0x3bb98
cmpl $0x73, %eax
je 0x3bba6
cmpl $0x69, %eax
je 0x3bb8b
cmpl $0x63, %eax
jne 0x3bbc1
subq %rdi, %rsi
testq %rsi, %rsi
jle 0x3bbc1
movsbl (%rdi), %eax
jmp 0x3bbce
subq %rdi, %rsi
cmpq $0x3, %rsi
jle 0x3bbc1
movl (%rdi), %eax
jmp 0x3bbce
subq %rdi, %rsi
cmpq $0x1, %rsi
jle 0x3bbc1
movzwl (%rdi), %eax
jmp 0x3bbce
subq %rdi, %rsi
cmpq $0x1, %rsi
jle 0x3bbc1
movswl (%rdi), %eax
jmp 0x3bbce
subq %rdi, %rsi
testq %rsi, %rsi
jle 0x3bbc1
movzbl (%rdi), %eax
jmp 0x3bbce
callq 0x4050
movl $0x16, (%rax)
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_encode.c
// Function: extend_ref
static inline int extend_ref(char **ref, uint32_t (**hist)[5], hts_pos_t pos,
                             hts_pos_t ref_start, hts_pos_t *ref_end) {
    if (pos < ref_start)
        return -1;
    if (pos < *ref_end)
        return 0;

    // realloc
    if (pos - ref_start > UINT_MAX)
        return -2; // protect overflow in new_end calculation

    hts_pos_t old_end = *ref_end ? *ref_end : ref_start;
    hts_pos_t new_end = ref_start + 1000 + (pos-ref_start)*1.5;

    // Refuse to work on excessively large blocks.
    // We'll just switch to referenceless encoding, which is probably better
    // here as this must be very sparse data anyway.
    if (new_end - ref_start > UINT_MAX/sizeof(**hist)/2)
        return -2;

    char *tmp = realloc(*ref, new_end-ref_start+1);
    if (!tmp)
        return -1;
    *ref = tmp;

    uint32_t (*tmp5)[5] = realloc(**hist,
                                  (new_end - ref_start)*sizeof(**hist));
    if (!tmp5)
        return -1;
    *hist = tmp5;
    *ref_end = new_end;

    // initialise
    old_end -= ref_start;
    new_end -= ref_start;
    memset(&(*ref)[old_end],  0,  new_end-old_end);
    memset(&(*hist)[old_end], 0, (new_end-old_end)*sizeof(**hist));

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
pushq $-0x1
popq %rbp
movq %rdx, %rax
subq %rcx, %rax
jl 0x3bf4f
movq %r8, %r14
movq (%r8), %r13
xorl %ebp, %ebp
cmpq %rdx, %r13
jg 0x3bf4f
movq %rcx, %r12
pushq $-0x2
popq %rbp
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jg 0x3bf4f
leaq 0x3e8(%r12), %rcx
cvtsi2sd %rcx, %xmm0
cvtsi2sd %rax, %xmm1
mulsd 0x3f99d(%rip), %xmm1    # 0x7b850
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
subq %r12, %rax
cmpq $0x6666666, %rax        # imm = 0x6666666
ja 0x3bf4f
movq %rsi, %rbx
movq %rdi, %r15
movq %rcx, (%rsp)
movq (%rdi), %rdi
movq %rax, %rbp
leaq 0x1(%rax), %rsi
callq 0x4840
testq %rax, %rax
je 0x3bf4c
movq %rax, (%r15)
movq (%rbx), %rdi
imulq $0x14, %rbp, %rsi
callq 0x4840
movq %rbp, %rcx
pushq $-0x1
popq %rbp
testq %rax, %rax
movq (%rsp), %rdx
je 0x3bf4f
movq %r13, %rsi
subq %r12, %rsi
testq %r13, %r13
movq %rax, (%rbx)
cmoveq %r13, %rsi
movq %rdx, (%r14)
movq (%r15), %rdi
addq %rsi, %rdi
subq %rsi, %rcx
movq %rsi, %r15
xorl %ebp, %ebp
xorl %esi, %esi
movq %rcx, %r14
movq %rcx, %rdx
callq 0x4260
imulq $0x14, %r15, %rdi
addq (%rbx), %rdi
imulq $0x14, %r14, %rdx
xorl %esi, %esi
callq 0x4260
jmp 0x3bf4f
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_encode.c
// Function: next_cigar_op
static inline
int next_cigar_op(uint32_t *cigar, uint32_t ncigar, int *skip, int *spos,
                  uint32_t *cig_ind, uint32_t *cig_op, uint32_t *cig_len) {
    for(;;) {
        while (*cig_len == 0) {
            if (*cig_ind < ncigar) {
                *cig_op  = cigar[*cig_ind] & BAM_CIGAR_MASK;
                *cig_len = cigar[*cig_ind] >> BAM_CIGAR_SHIFT;
                (*cig_ind)++;
            } else {
                return -1;
            }
        }

        if (skip[*cig_op]) {
            *spos += (bam_cigar_type(*cig_op)&1) * *cig_len;
            *cig_len = 0;
            continue;
        }

        (*cig_len)--;
        break;
    }

    return *cig_op;
}

// Assembly:
pushq %r14
pushq %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x3f791(%rip), %r10     # 0x7b700
movl $0x3c1a7, %r11d         # imm = 0x3C1A7
movl (%r9), %ebx
testl %ebx, %ebx
je 0x3bf99
movl (%r8), %r14d
cmpl $0x0, (%r10,%r14,4)
je 0x3bfb7
addl %r14d, %r14d
btl %r14d, %r11d
jb 0x3bf91
xorl %ebx, %ebx
addl %ebx, (%rdx)
andl $0x0, (%r9)
jmp 0x3bf75
movl (%rcx), %ebx
cmpl %esi, %ebx
jae 0x3bfbf
movl (%rdi,%rbx,4), %ebx
andl $0xf, %ebx
movl %ebx, (%r8)
movl (%rcx), %ebx
movl (%rdi,%rbx,4), %ebx
shrl $0x4, %ebx
movl %ebx, (%r9)
incl (%rcx)
jmp 0x3bf75
decl %ebx
movl %ebx, (%r9)
movl (%r8), %eax
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_encode.c
// Function: cram_add_base
static int cram_add_base(cram_fd *fd, cram_container *c,
                         cram_slice *s, cram_record *r,
                         int pos, char base, char qual) {
    cram_feature f;
    f.B.pos = pos+1;
    f.B.code = 'B';
    f.B.base = base;
    f.B.qual = qual;
    if (cram_stats_add(c->stats[DS_BA], base) < 0) return -1;
    if (cram_stats_add(c->stats[DS_QS], qual) < 0) return -1;
    BLOCK_APPEND_CHAR(s->qual_blk, qual);
    return cram_add_feature(c, s, r, &f);

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %r9d, %r12d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
incl %ecx
movl %ecx, (%rsp)
movl $0x42, 0x4(%rsp)
movl %r8d, 0x8(%rsp)
movl %r9d, 0xc(%rsp)
movq 0x1e8(%rdi), %rdi
movslq %r8d, %rsi
callq 0x47569
pushq $-0x1
popq %rbp
testl %eax, %eax
js 0x3c281
movq 0x158(%r15), %rdi
movsbq %r12b, %rsi
callq 0x47569
testl %eax, %eax
js 0x3c281
movq 0x78(%r14), %rdi
movsbl %r12b, %esi
callq 0x34c72
testl %eax, %eax
js 0x3c281
movq %rsp, %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3c536
movl %eax, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_encode.c
// Function: cram_add_quality
static int cram_add_quality(cram_fd *fd, cram_container *c,
                            cram_slice *s, cram_record *r,
                            int pos, char qual) {
    cram_feature f;
    f.Q.pos = pos+1;
    f.Q.code = 'Q';
    f.Q.qual = qual;
    if (cram_stats_add(c->stats[DS_QS], qual) < 0) return -1;
    BLOCK_APPEND_CHAR(s->qual_blk, qual);
    return cram_add_feature(c, s, r, &f);

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
incl %ecx
movl %ecx, 0x8(%rsp)
movl $0x51, 0xc(%rsp)
movl %r8d, 0x10(%rsp)
movq 0x158(%rdi), %rdi
movslq %r8d, %rsi
callq 0x47569
testl %eax, %eax
js 0x3c2f0
movq 0x78(%r14), %rdi
movsbl %bpl, %esi
callq 0x34c72
testl %eax, %eax
js 0x3c2f0
leaq 0x8(%rsp), %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3c536
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_encode.c
// Function: cram_add_feature
static int cram_add_feature(cram_container *c, cram_slice *s,
                            cram_record *r, cram_feature *f) {
    if (s->nfeatures >= s->afeatures) {
        s->afeatures = s->afeatures ? s->afeatures*2 : 1024;
        s->features = realloc(s->features, s->afeatures*sizeof(*s->features));
        if (!s->features)
            return -1;
    }

    if (!r->nfeature++) {
        r->feature = s->nfeatures;
        if (cram_stats_add(c->stats[DS_FP], f->X.pos) < 0)
            return -1;
    } else {
        if (cram_stats_add(c->stats[DS_FP],
                           f->X.pos - s->features[r->feature + r->nfeature-2].X.pos) < 0)
            return -1;

    }
    if (cram_stats_add(c->stats[DS_FC], f->X.code) < 0)
        return -1;

    s->features[s->nfeatures++] = *f;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
movl 0x54(%rsi), %eax
pushq $-0x1
popq %rbp
cmpl %eax, 0x50(%rsi)
jb 0x3c580
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x400, %esi            # imm = 0x400
cmovnel %ecx, %esi
movl %esi, 0x54(%r14)
movq 0x48(%r14), %rdi
shlq $0x4, %rsi
callq 0x4840
movq %rax, 0x48(%r14)
testq %rax, %rax
je 0x3c60d
movl 0x88(%r12), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x88(%r12)
testl %eax, %eax
je 0x3c5be
movq 0x1d8(%r15), %rdi
movslq (%rbx), %rsi
movq 0x48(%r14), %rcx
movl 0x84(%r12), %edx
addl %edx, %eax
decl %eax
shlq $0x4, %rax
movslq (%rcx,%rax), %rax
subq %rax, %rsi
jmp 0x3c5d4
movl 0x50(%r14), %eax
movl %eax, 0x84(%r12)
movq 0x1d8(%r15), %rdi
movslq (%rbx), %rsi
callq 0x47569
testl %eax, %eax
js 0x3c60d
movq 0x1d0(%r15), %rdi
movslq 0x4(%rbx), %rsi
callq 0x47569
testl %eax, %eax
js 0x3c60d
movq 0x48(%r14), %rax
movl 0x50(%r14), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x50(%r14)
shlq $0x4, %rcx
movups (%rbx), %xmm0
movups %xmm0, (%rax,%rcx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_index.c
// Function: kget_int32
static int kget_int32(kstring_t *k, size_t *pos, int32_t *val_p) {
    int sign = 1;
    int32_t val = 0;
    size_t p = *pos;

    while (p < k->l && (k->s[p] == ' ' || k->s[p] == '\t'))
        p++;

    if (p < k->l && k->s[p] == '-')
        sign = -1, p++;

    if (p >= k->l || !(k->s[p] >= '0' && k->s[p] <= '9'))
        return -1;

    while (p < k->l && k->s[p] >= '0' && k->s[p] <= '9') {
        int digit = k->s[p++]-'0';
        val = val*10 + digit;
    }

    *pos = p;
    *val_p = sign*val;

    return 0;
}

// Assembly:
movq (%rsi), %r10
movq (%rdi), %rcx
pushq $-0x1
popq %rax
cmpq %rcx, %r10
jae 0x3d573
movq 0x10(%rdi), %r8
movzbl (%r8,%r10), %r8d
cmpl $0x20, %r8d
je 0x3d50c
cmpl $0x9, %r8d
jne 0x3d511
incq %r10
jmp 0x3d4f2
xorl %r11d, %r11d
cmpb $0x2d, %r8b
sete %r11b
leaq (%r11,%r10), %r9
cmpq %rcx, %r9
jae 0x3d573
movq 0x10(%rdi), %rdi
addq %rdi, %r11
movb (%r10,%r11), %r10b
addb $-0x30, %r10b
cmpb $0x9, %r10b
ja 0x3d573
xorl %eax, %eax
cmpq %rcx, %r9
jae 0x3d561
movb (%rdi,%r9), %r10b
addb $-0x30, %r10b
cmpb $0x9, %r10b
ja 0x3d55e
incq %r9
movzbl %r10b, %r10d
imull $0xa, %eax, %eax
addl %r10d, %eax
jmp 0x3d53c
movq %r9, %rcx
movl %eax, %edi
negl %edi
cmpb $0x2d, %r8b
movq %rcx, (%rsi)
cmovnel %eax, %edi
movl %edi, (%rdx)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_index.c
// Function: cram_index_free
void cram_index_free(cram_fd *fd) {
    int i;

    if (!fd->index)
        return;

    for (i = 0; i < fd->index_sz; i++) {
        cram_index_free_recurse(&fd->index[i]);
    }
    free(fd->index);

    fd->index = NULL;
}

// Assembly:
cmpq $0x0, 0x8878(%rdi)
je 0x3d5c2
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq 0x8870(%rbx), %rax
movq 0x8878(%rbx), %rdi
cmpq %rax, %r15
jge 0x3d5b0
addq %r14, %rdi
callq 0x3d5c3
incq %r15
addq $0x38, %r14
jmp 0x3d58c
callq 0x45c0
andq $0x0, 0x8878(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_index.c
// Function: cram_index_free_recurse
static void cram_index_free_recurse(cram_index *e) {
    if (e->e) {
        int i;
        for (i = 0; i < e->nslice; i++) {
            cram_index_free_recurse(&e->e[i]);
        }
        free(e->e);
    }
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x3d5ff
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq (%rbx), %rax
movq 0x8(%rbx), %rdi
cmpq %rax, %r15
jge 0x3d5f5
addq %r14, %rdi
callq 0x3d5c3
incq %r15
addq $0x38, %r14
jmp 0x3d5d8
popq %rbx
popq %r14
popq %r15
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_index.c
// Function: cram_index_last
cram_index *cram_index_last(cram_fd *fd, int refid, cram_index *from) {
    int slice;

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

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

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

    slice = fd->index[refid+1].nslice - 1;

    // e is the last entry in the nested containment list, but it may
    // contain further slices within it.
    cram_index *e = &from->e[slice];
    while (e->e_next)
        e = e->e_next;

    return e;
}

// Assembly:
cmpl $-0x1, %esi
jl 0x3d849
incl %esi
cmpl 0x8870(%rdi), %esi
jge 0x3d849
movl %esi, %eax
testq %rdx, %rdx
jne 0x3d819
imulq $0x38, %rax, %rdx
addq 0x8878(%rdi), %rdx
movq 0x8(%rdx), %rcx
testq %rcx, %rcx
je 0x3d849
movq 0x8878(%rdi), %rdx
imulq $0x38, %rax, %rax
movslq (%rdx,%rax), %rax
imulq $0x38, %rax, %rax
addq %rax, %rcx
addq $-0x38, %rcx
movq %rcx, %rax
movq 0x30(%rcx), %rcx
testq %rcx, %rcx
jne 0x3d83c
retq
xorl %eax, %eax
retq