LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_decode_int
int cram_varint_decode_int(cram_slice *slice, cram_codec *c,
                           cram_block *in, char *out, int *out_size) {
    char *cp;
    cram_block *b;

    /* Find the data block */
    b = cram_get_block_by_id(slice, c->u.varint.content_id);
    if (!b)
        return *out_size?-1:0;

    cp = (char *)b->data + b->idx;
    // E_INT and E_LONG are guaranteed single item queries
    int err = 0;
    *(int32_t *)out = c->vv->varint_get32(&cp,
                                          (char *)b->data + b->uncomp_size,
                                          &err) + c->u.varint.offset;
    b->idx = cp - (char *)b->data;
    *out_size = 1;

    return err ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r15
movl 0x60(%rsi), %eax
cmpq $0x100, %rax            # imm = 0x100
setae %dl
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
sete %sil
orb %dl, %sil
jne 0x8ec10
movq (%rcx,%rax,8), %rbp
jmp 0x8ec81
testq %rcx, %rcx
je 0x8ec41
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rax, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %edx
movl %eax, %esi
subl %edx, %esi
shll $0x3, %esi
movq 0x800(%rcx,%rsi), %rbp
testq %rbp, %rbp
je 0x8ec41
cmpl %eax, 0xc(%rbp)
je 0x8ec81
movq (%rdi), %rcx
movslq 0x28(%rcx), %rcx
testq %rcx, %rcx
jle 0x8ec7f
movq 0x10(%rdi), %rdx
xorl %esi, %esi
movq (%rdx,%rsi,8), %rdi
testq %rdi, %rdi
je 0x8ec6f
cmpl $0x4, 0x8(%rdi)
jne 0x8ec6f
cmpl %eax, 0xc(%rdi)
jne 0x8ec6f
xorl %r8d, %r8d
movq %rdi, %rbp
jmp 0x8ec72
movb $0x1, %r8b
testb %r8b, %r8b
je 0x8ec81
incq %rsi
cmpq %rsi, %rcx
jne 0x8ec53
xorl %ebp, %ebp
testq %rbp, %rbp
je 0x8ecd8
movq 0x20(%rbp), %rax
movslq 0x1c(%rbp), %rcx
addq %rax, %rcx
leaq 0x10(%rsp), %r12
movq %rcx, (%r12)
leaq 0xc(%rsp), %r13
movl $0x0, (%r13)
movq 0x10(%r15), %rcx
movslq 0x14(%rbp), %rsi
addq %rax, %rsi
movq %r12, %rdi
movq %r13, %rdx
callq *0x18(%rcx)
addl 0x68(%r15), %eax
movl %eax, (%r14)
movl (%r12), %eax
subl 0x20(%rbp), %eax
movl %eax, 0x1c(%rbp)
movl $0x1, (%rbx)
movl (%r13), %ecx
jmp 0x8ecda
movl (%rbx), %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_decode_slong
int cram_varint_decode_slong(cram_slice *slice, cram_codec *c,
                             cram_block *in, char *out, int *out_size) {
    char *cp;
    cram_block *b;

    /* Find the data block */
    b = cram_get_block_by_id(slice, c->u.varint.content_id);
    if (!b)
        return *out_size?-1:0;

    cp = (char *)b->data + b->idx;
    // E_INT and E_LONG are guaranteed single item queries
    int err = 0;
    *(int64_t *)out = c->vv->varint_get64s(&cp,
                                           (char *)b->data + b->uncomp_size,
                                           &err) + c->u.varint.offset;
    b->idx = cp - (char *)b->data;
    *out_size = 1;

    return err ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r15
movl 0x60(%rsi), %eax
cmpq $0x100, %rax            # imm = 0x100
setae %dl
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
sete %sil
orb %dl, %sil
jne 0x8ef58
movq (%rcx,%rax,8), %rbp
jmp 0x8efc9
testq %rcx, %rcx
je 0x8ef89
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rax, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %edx
movl %eax, %esi
subl %edx, %esi
shll $0x3, %esi
movq 0x800(%rcx,%rsi), %rbp
testq %rbp, %rbp
je 0x8ef89
cmpl %eax, 0xc(%rbp)
je 0x8efc9
movq (%rdi), %rcx
movslq 0x28(%rcx), %rcx
testq %rcx, %rcx
jle 0x8efc7
movq 0x10(%rdi), %rdx
xorl %esi, %esi
movq (%rdx,%rsi,8), %rdi
testq %rdi, %rdi
je 0x8efb7
cmpl $0x4, 0x8(%rdi)
jne 0x8efb7
cmpl %eax, 0xc(%rdi)
jne 0x8efb7
xorl %r8d, %r8d
movq %rdi, %rbp
jmp 0x8efba
movb $0x1, %r8b
testb %r8b, %r8b
je 0x8efc9
incq %rsi
cmpq %rsi, %rcx
jne 0x8ef9b
xorl %ebp, %ebp
testq %rbp, %rbp
je 0x8f020
movq 0x20(%rbp), %rax
movslq 0x1c(%rbp), %rcx
addq %rax, %rcx
leaq 0x10(%rsp), %r12
movq %rcx, (%r12)
leaq 0xc(%rsp), %r13
movl $0x0, (%r13)
movq 0x10(%r15), %rcx
movslq 0x14(%rbp), %rsi
addq %rax, %rsi
movq %r12, %rdi
movq %r13, %rdx
callq *0x30(%rcx)
addq 0x68(%r15), %rax
movq %rax, (%r14)
movl (%r12), %eax
subl 0x20(%rbp), %eax
movl %eax, 0x1c(%rbp)
movl $0x1, (%rbx)
movl (%r13), %ecx
jmp 0x8f022
movl (%rbx), %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_decode_size
int cram_varint_decode_size(cram_slice *slice, cram_codec *c) {
    cram_block *b;

    /* Find the data block */
    b = cram_get_block_by_id(slice, c->u.varint.content_id);
    if (!b)
        return -1;

    return b->uncomp_size;
}

// Assembly:
movl 0x60(%rsi), %eax
cmpq $0x100, %rax            # imm = 0x100
setae %dl
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
sete %sil
orb %dl, %sil
jne 0x8f063
movq (%rcx,%rax,8), %rcx
jmp 0x8f0d6
testq %rcx, %rcx
je 0x8f094
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rax, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %edx
movl %eax, %esi
subl %edx, %esi
shll $0x3, %esi
movq 0x800(%rcx,%rsi), %rcx
testq %rcx, %rcx
je 0x8f094
cmpl %eax, 0xc(%rcx)
je 0x8f0d6
movq (%rdi), %rcx
movslq 0x28(%rcx), %rdx
testq %rdx, %rdx
jle 0x8f0d4
movq 0x10(%rdi), %rsi
xorl %edi, %edi
movq (%rsi,%rdi,8), %r8
testq %r8, %r8
je 0x8f0c4
cmpl $0x4, 0x8(%r8)
jne 0x8f0c4
cmpl %eax, 0xc(%r8)
jne 0x8f0c4
xorl %r9d, %r9d
movq %r8, %rcx
jmp 0x8f0c7
movb $0x1, %r9b
testb %r9b, %r9b
je 0x8f0d6
incq %rdi
cmpq %rdi, %rdx
jne 0x8f0a6
xorl %ecx, %ecx
testq %rcx, %rcx
je 0x8f0df
movl 0x14(%rcx), %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_describe
int cram_varint_describe(cram_codec *c, kstring_t *ks) {
    return ksprintf(ks, "VARINT(id=%d,offset=%"PRId64",type=%d)",
                    c->u.varint.content_id,
                    c->u.varint.offset,
                    c->u.varint.type)
        < 0 ? -1 : 0;
}

// Assembly:
pushq %rax
movq %rsi, %rax
movl 0x60(%rdi), %edx
movq 0x68(%rdi), %rcx
movl 0x70(%rdi), %r8d
leaq 0x16035(%rip), %rsi     # 0xa51c7
movq %rax, %rdi
xorl %eax, %eax
callq 0x9aab
sarl $0x1f, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_decode_init
cram_codec *cram_varint_decode_init(cram_block_compression_hdr *hdr,
                                    char *data, int size,
                                    enum cram_encoding codec,
                                    enum cram_external_type option,
                                    int version, varint_vec *vv) {
    cram_codec *c;
    char *cp = data, *cp_end = data+size;

    if (!(c = malloc(sizeof(*c))))
        return NULL;

    c->codec  = codec;

    // Function pointer choice is theoretically by codec type.
    // Given we have some vars as int32 and some as int64 we
    // use option too for sizing, although on disk format
    // does not change.
    switch(codec) {
    case E_VARINT_UNSIGNED:
        c->decode = (option == E_INT)
            ? cram_varint_decode_int
            : cram_varint_decode_long;
        break;
    case E_VARINT_SIGNED:
        c->decode = (option == E_INT)
            ? cram_varint_decode_sint
            : cram_varint_decode_slong;
        break;
    default:
        return NULL;
    }

    c->free   = cram_varint_decode_free;
    c->size   = cram_varint_decode_size;
    c->get_block = cram_varint_get_block;
    c->describe = cram_varint_describe;

    c->u.varint.content_id = vv->varint_get32 (&cp, cp_end, NULL);
    c->u.varint.offset     = vv->varint_get64s(&cp, cp_end, NULL);

    if (cp - data != size) {
        fprintf(stderr, "Malformed varint header stream\n");
        free(c);
        return NULL;
    }

    c->u.varint.type = option;

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %ecx, %r12d
movl %edx, %r15d
movq %rsi, %r14
movq %rsi, (%rsp)
movl $0x880, %edi            # imm = 0x880
callq 0x4680
testq %rax, %rax
je 0x8f287
movq %rax, %rbx
movl %r12d, (%rax)
cmpl $0x2a, %r12d
je 0x8f1f8
cmpl $0x29, %r12d
jne 0x8f287
cmpl $0x1, %ebp
leaq -0x618(%rip), %rcx      # 0x8ebd7
leaq -0x3ef(%rip), %rax      # 0x8ee07
jmp 0x8f209
cmpl $0x1, %ebp
leaq -0x513(%rip), %rcx      # 0x8ecef
leaq -0x2ea(%rip), %rax      # 0x8ef1f
cmoveq %rcx, %rax
movslq %r15d, %r13
leaq (%r14,%r13), %r15
movq %rax, 0x28(%rbx)
leaq -0x1e8(%rip), %rax      # 0x8f037
movq %rax, 0x20(%rbx)
leaq -0x1e9(%rip), %rax      # 0x8f041
movq %rax, 0x40(%rbx)
leaq -0x150(%rip), %rax      # 0x8f0e5
movq %rax, 0x50(%rbx)
leaq -0xc4(%rip), %rax       # 0x8f17c
movq %rax, 0x58(%rbx)
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq 0x40(%rsp), %rax
callq *0x18(%rax)
movl %eax, 0x60(%rbx)
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq 0x40(%rsp), %rax
callq *0x30(%rax)
movq %rax, 0x68(%rbx)
movq (%r12), %rax
subq %r14, %rax
cmpq %r13, %rax
jne 0x8f27f
movl %ebp, 0x70(%rbx)
jmp 0x8f289
movq %rbx, %rdi
callq 0x4b91
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_encode_store
int cram_varint_encode_store(cram_codec *c, cram_block *b, char *prefix,
                             int version) {
    char tmp[99], *tp = tmp;
    int len = 0;

    if (prefix) {
        size_t l = strlen(prefix);
        BLOCK_APPEND(b, prefix, l);
        len += l;
    }

    tp += c->vv->varint_put32 (tp, NULL, c->u.e_varint.content_id);
    tp += c->vv->varint_put64s(tp, NULL, c->u.e_varint.offset);
    len += c->vv->varint_put32_blk(b, c->codec);
    len += c->vv->varint_put32_blk(b, tp-tmp);
    BLOCK_APPEND(b, tmp, tp-tmp);
    len += tp-tmp;

    return len;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r12
testq %rdx, %rdx
je 0x8f3b0
movq %rdx, %r14
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r15
movq 0x30(%rbx), %r13
addq %rax, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x8f37e
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x8f49d
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r15, %r15
je 0x8f39a
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
xorl %eax, %eax
xorl %ecx, %ecx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %al, %al
cmovel %r15d, %ecx
je 0x8f3b2
jmp 0x8f485
xorl %ecx, %ecx
movl %ecx, 0xc(%rsp)
movq 0x10(%r12), %rax
movl 0x60(%r12), %edx
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq *0x38(%rax)
movslq %eax, %r15
leaq (%rsp,%r15), %r14
addq $0x10, %r14
movq 0x10(%r12), %rax
movq 0x68(%r12), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq *0x50(%rax)
movslq %eax, %r13
movq 0x10(%r12), %rax
movl (%r12), %esi
movq %rbx, %rdi
callq *0x58(%rax)
movl %eax, %ebp
movq 0x10(%r12), %rax
addq %r13, %r15
movq %rbx, %rdi
movl %r15d, %esi
callq *0x58(%rax)
movl %eax, 0x8(%rsp)
movq 0x30(%rbx), %r12
addq %r15, %r12
movq 0x28(%rbx), %rax
cmpq %r12, %rax
ja 0x8f454
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r12, %rax
cmovaq %rax, %r12
movq 0x20(%rbx), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0x8f496
movq %r12, 0x28(%rbx)
movq %rax, 0x20(%rbx)
addq %r13, %r14
leaq 0x10(%rsp), %rax
cmpq %rax, %r14
je 0x8f47a
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
addl 0xc(%rsp), %ebp
addl %r15d, %ebp
addl 0x8(%rsp), %ebp
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x8f485
movb $0x1, %al
jmp 0x8f39c
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_encode_init
cram_codec *cram_varint_encode_init(cram_stats *st,
                                    enum cram_encoding codec,
                                    enum cram_external_type option,
                                    void *dat,
                                    int version, varint_vec *vv) {
    cram_codec *c;

    if (!(c = malloc(sizeof(*c))))
        return NULL;

    c->u.e_varint.offset = 0;
    if (st) {
        // Marginal difference so far! Not worth the hassle?
        if (st->min_val < 0 && st->min_val >= -127
            && st->max_val / -st->min_val > 100) {
            c->u.e_varint.offset = -st->min_val;
            codec = E_VARINT_UNSIGNED;
        } else if (st->min_val > 0) {
            c->u.e_varint.offset = -st->min_val;
        }
    }

    c->codec = codec;
    c->free = cram_varint_encode_free;

    // Function pointer choice is theoretically by codec type.
    // Given we have some vars as int32 and some as int64 we
    // use option too for sizing, although on disk format
    // does not change.
    switch (codec) {
    case E_VARINT_UNSIGNED:
        c->encode = (option == E_INT)
            ? cram_varint_encode_int
            : cram_varint_encode_long;
        break;
    case E_VARINT_SIGNED:
        c->encode = (option == E_INT)
            ? cram_varint_encode_sint
            : cram_varint_encode_slong;
        break;
    default:
        return NULL;
    }
    c->store = cram_varint_encode_store;
    c->flush = NULL;

    c->u.e_varint.content_id = (size_t)dat;

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
movl $0x880, %edi            # imm = 0x880
callq 0x4680
testq %rax, %rax
je 0x8f541
movq %rax, %rcx
movq $0x0, 0x68(%rax)
testq %r15, %r15
je 0x8f514
movq 0x1010(%r15), %rsi
cmpq $-0x7f, %rsi
jb 0x8f4ff
movq 0x1018(%r15), %rax
movq %rsi, %rdi
negq %rdi
cqto
idivq %rdi
movl $0x29, %edx
cmpq $0x64, %rax
jg 0x8f50d
testq %rsi, %rsi
jle 0x8f514
negq %rsi
movq %rsi, %rdi
movl %r14d, %edx
movq %rdi, 0x68(%rcx)
movl %edx, %r14d
movl %r14d, (%rcx)
leaq -0x21d(%rip), %rax      # 0x8f301
movq %rax, 0x20(%rcx)
cmpl $0x2a, %r14d
je 0x8f545
cmpl $0x29, %r14d
jne 0x8f541
cmpl $0x1, %ebp
leaq -0x29d(%rip), %rdx      # 0x8f29b
leaq -0x274(%rip), %rax      # 0x8f2cb
jmp 0x8f556
xorl %ecx, %ecx
jmp 0x8f574
cmpl $0x1, %ebp
leaq -0x29c(%rip), %rdx      # 0x8f2b3
leaq -0x270(%rip), %rax      # 0x8f2e6
cmoveq %rdx, %rax
movq %rax, 0x30(%rcx)
leaq -0x25a(%rip), %rax      # 0x8f30b
movq %rax, 0x38(%rcx)
movq $0x0, 0x48(%rcx)
movl %ebx, 0x60(%rcx)
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_const_decode_byte
int cram_const_decode_byte(cram_slice *slice, cram_codec *c,
                           cram_block *in, char *out, int *out_size) {
    int i, n;

    for (i = 0, n = *out_size; i < n; i++)
        out[i] = c->u.xconst.val;

    return 0;
}

// Assembly:
movslq (%r8), %rax
testq %rax, %rax
jle 0x8f59c
xorl %edx, %edx
movb 0x60(%rsi), %dil
movb %dil, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x8f58c
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_const_decode_int
int cram_const_decode_int(cram_slice *slice, cram_codec *c,
                          cram_block *in, char *out, int *out_size) {
    int32_t *out_i = (int32_t *)out;
    int i, n;

    for (i = 0, n = *out_size; i < n; i++)
        out_i[i] = c->u.xconst.val;

    return 0;
}

// Assembly:
movslq (%r8), %rax
testq %rax, %rax
jle 0x8f5b7
xorl %edx, %edx
movl 0x60(%rsi), %edi
movl %edi, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %rax
jne 0x8f5a9
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_const_decode_long
int cram_const_decode_long(cram_slice *slice, cram_codec *c,
                           cram_block *in, char *out, int *out_size) {
    int64_t *out_i = (int64_t *)out;
    int i, n;

    for (i = 0, n = *out_size; i < n; i++)
        out_i[i] = c->u.xconst.val;

    return 0;
}

// Assembly:
movslq (%r8), %rax
testq %rax, %rax
jle 0x8f5d4
xorl %edx, %edx
movq 0x60(%rsi), %rdi
movq %rdi, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x8f5c4
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_const_decode_init
cram_codec *cram_const_decode_init(cram_block_compression_hdr *hdr,
                                   char *data, int size,
                                   enum cram_encoding codec,
                                   enum cram_external_type option,
                                   int version, varint_vec *vv) {
    cram_codec *c;
    char *cp = data;

    if (!(c = malloc(sizeof(*c))))
        return NULL;

    c->codec  = codec;
    if (codec == E_CONST_BYTE)
        c->decode = cram_const_decode_byte;
    else if (option == E_INT)
        c->decode = cram_const_decode_int;
    else
        c->decode = cram_const_decode_long;
    c->free   = cram_const_decode_free;
    c->size   = cram_const_decode_size;
    c->get_block = NULL;
    c->describe = cram_const_describe;

    c->u.xconst.val = vv->varint_get64s(&cp, data+size, NULL);

    if (cp - data != size) {
        fprintf(stderr, "Malformed const header stream\n");
        free(c);
        return NULL;
    }

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %r8d, %r15d
movl %ecx, %r12d
movl %edx, %ebp
movq %rsi, %r14
movq %rsi, 0x8(%rsp)
movl $0x880, %edi            # imm = 0x880
callq 0x4680
testq %rax, %rax
je 0x8f6b9
movq %rax, %rbx
movq 0x40(%rsp), %rax
movl %r12d, (%rbx)
cmpl $0x2b, %r12d
jne 0x8f64b
leaq -0xc7(%rip), %rcx       # 0x8f582
jmp 0x8f661
cmpl $0x1, %r15d
jne 0x8f65a
leaq -0xb9(%rip), %rcx       # 0x8f59f
jmp 0x8f661
leaq -0xa7(%rip), %rcx       # 0x8f5ba
movq %rcx, 0x28(%rbx)
leaq -0x95(%rip), %rcx       # 0x8f5d7
movq %rcx, 0x20(%rbx)
leaq -0x96(%rip), %rcx       # 0x8f5e1
movq %rcx, 0x40(%rbx)
movq $0x0, 0x50(%rbx)
leaq -0xa6(%rip), %rcx       # 0x8f5e4
movq %rcx, 0x58(%rbx)
movslq %ebp, %r12
leaq (%r14,%r12), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
xorl %edx, %edx
callq *0x30(%rax)
movq %rax, 0x60(%rbx)
movq (%r15), %rax
subq %r14, %rax
cmpq %r12, %rax
je 0x8f6bb
movq %rbx, %rdi
callq 0x4bbb
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_const_encode_store
int cram_const_encode_store(cram_codec *c, cram_block *b, char *prefix,
                            int version) {
    char tmp[99], *tp = tmp;
    int len = 0;

    if (prefix) {
        size_t l = strlen(prefix);
        BLOCK_APPEND(b, prefix, l);
        len += l;
    }

    tp += c->vv->varint_put64s(tp, NULL, c->u.xconst.val);
    len += c->vv->varint_put32_blk(b, c->codec);
    len += c->vv->varint_put32_blk(b, tp-tmp);
    BLOCK_APPEND(b, tmp, tp-tmp);
    len += tp-tmp;

    return len;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x8f774
movq %rdx, %r12
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r15
movq 0x30(%rbx), %r13
addq %rax, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x8f741
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x8f832
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r15, %r15
je 0x8f75d
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
xorl %eax, %eax
xorl %r12d, %r12d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %al, %al
cmovel %r15d, %r12d
je 0x8f777
jmp 0x8f81a
xorl %r12d, %r12d
movq 0x10(%r14), %rax
movq 0x60(%r14), %rdx
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq *0x50(%rax)
movl %eax, %ebp
movslq %eax, %r15
movq 0x10(%r14), %rax
movl (%r14), %esi
movq %rbx, %rdi
callq *0x58(%rax)
movl %eax, 0xc(%rsp)
movq 0x10(%r14), %rax
movq %rbx, %rdi
movl %r15d, %esi
callq *0x58(%rax)
movl %eax, %r14d
movq 0x30(%rbx), %r13
addq %r15, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x8f7f3
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x8f82b
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testl %ebp, %ebp
je 0x8f810
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
addl %r12d, %ebp
addl 0xc(%rsp), %ebp
addl %r14d, %ebp
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x8f81a
movb $0x1, %al
jmp 0x8f75f
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_const_encode_init
cram_codec *cram_const_encode_init(cram_stats *st,
                                   enum cram_encoding codec,
                                   enum cram_external_type option,
                                   void *dat,
                                   int version, varint_vec *vv) {
    cram_codec *c;

    if (!(c = malloc(sizeof(*c))))
        return NULL;

    c->codec = codec;
    c->free = cram_const_decode_free; // as as decode
    c->encode = cram_const_encode; // a nop
    c->store = cram_const_encode_store;
    c->flush = NULL;
    c->u.e_xconst.val = st->min_val;

    return c;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl $0x880, %edi            # imm = 0x880
callq 0x4680
testq %rax, %rax
je 0x8f888
movl %ebp, (%rax)
leaq -0x282(%rip), %rcx      # 0x8f5d7
movq %rcx, 0x20(%rax)
leaq -0x199(%rip), %rcx      # 0x8f6cb
movq %rcx, 0x30(%rax)
leaq -0x1a1(%rip), %rcx      # 0x8f6ce
movq %rcx, 0x38(%rax)
movq $0x0, 0x48(%rax)
movq 0x1010(%rbx), %rcx
movq %rcx, 0x60(%rax)
jmp 0x8f88a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_beta_decode_long
int cram_beta_decode_long(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int64_t *out_i = (int64_t *)out;
    int i, n = *out_size;

    if (c->u.beta.nbits) {
        if (cram_not_enough_bits(in, c->u.beta.nbits * n))
            return -1;

        for (i = 0; i < n; i++)
            out_i[i] = get_bits_MSB(in, c->u.beta.nbits) - c->u.beta.offset;
    } else {
        for (i = 0; i < n; i++)
            out_i[i] = -c->u.beta.offset;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rsi, %r14
movl (%r8), %r13d
movl 0x64(%rsi), %eax
testl %eax, %eax
je 0x8f920
imull %r13d, %eax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x8f942
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
setbe %dl
testq %r13, %r13
setne %sil
testb %dl, %sil
jne 0x8f942
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x8f8f5
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
movl %eax, %eax
cmpq %rax, %rcx
jb 0x8f942
testl %r13d, %r13d
jle 0x8f93f
xorl %r15d, %r15d
xorl %ebp, %ebp
movl 0x64(%r14), %esi
movq %r12, %rdi
callq 0x8f954
movslq 0x60(%r14), %rcx
subq %rcx, %rax
movq %rax, (%rbx,%rbp,8)
incq %rbp
cmpq %rbp, %r13
jne 0x8f8ff
jmp 0x8f942
testl %r13d, %r13d
jle 0x8f93f
xorl %r15d, %r15d
xorl %eax, %eax
movslq 0x60(%r14), %rcx
negq %rcx
movq %rcx, (%rbx,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x8f92a
jmp 0x8f942
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_beta_decode_int
int cram_beta_decode_int(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int32_t *out_i = (int32_t *)out;
    int i, n = *out_size;

    if (c->u.beta.nbits) {
        if (cram_not_enough_bits(in, c->u.beta.nbits * n))
            return -1;

        for (i = 0; i < n; i++)
            out_i[i] = get_bits_MSB(in, c->u.beta.nbits) - c->u.beta.offset;
    } else {
        for (i = 0; i < n; i++)
            out_i[i] = -c->u.beta.offset;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rsi, %r14
movl (%r8), %r13d
movl 0x64(%rsi), %eax
testl %eax, %eax
je 0x8fc3c
imull %r13d, %eax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x8fc5c
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
setbe %dl
testq %r13, %r13
setne %sil
testb %dl, %sil
jne 0x8fc5c
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x8fc15
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
movl %eax, %eax
cmpq %rax, %rcx
jb 0x8fc5c
testl %r13d, %r13d
jle 0x8fc59
xorl %r15d, %r15d
xorl %ebp, %ebp
movl 0x64(%r14), %esi
movq %r12, %rdi
callq 0x8f954
subl 0x60(%r14), %eax
movl %eax, (%rbx,%rbp,4)
incq %rbp
cmpq %rbp, %r13
jne 0x8fc1f
jmp 0x8fc5c
testl %r13d, %r13d
jle 0x8fc59
xorl %r15d, %r15d
xorl %eax, %eax
xorl %ecx, %ecx
subl 0x60(%r14), %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq %rax, %r13
jne 0x8fc46
jmp 0x8fc5c
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_beta_decode_char
int cram_beta_decode_char(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int i, n = *out_size;


    if (c->u.beta.nbits) {
        if (cram_not_enough_bits(in, c->u.beta.nbits * n))
            return -1;

        if (out)
            for (i = 0; i < n; i++)
                out[i] = get_bits_MSB(in, c->u.beta.nbits) - c->u.beta.offset;
        else
            for (i = 0; i < n; i++)
                get_bits_MSB(in, c->u.beta.nbits);
    } else {
        if (out)
            for (i = 0; i < n; i++)
                out[i] = -c->u.beta.offset;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rsi, %rbx
movl (%r8), %r13d
movl 0x64(%rsi), %eax
testl %eax, %eax
je 0x8fcfd
imull %r13d, %eax
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x8fd2d
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
setbe %dl
testl %r13d, %r13d
setne %sil
testb %dl, %sil
jne 0x8fd2d
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x8fcd2
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
movl %eax, %eax
cmpq %rax, %rcx
jb 0x8fd2d
testq %r15, %r15
je 0x8fd3f
testl %r13d, %r13d
jle 0x8fd2a
xorl %r14d, %r14d
xorl %ebp, %ebp
movl 0x64(%rbx), %esi
movq %r12, %rdi
callq 0x8f954
subl 0x60(%rbx), %eax
movb %al, (%r15,%rbp)
incq %rbp
cmpq %rbp, %r13
jne 0x8fce1
jmp 0x8fd2d
testq %r15, %r15
setne %al
testl %r13d, %r13d
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x8fd2a
xorl %r14d, %r14d
xorl %eax, %eax
movb 0x60(%rbx), %cl
xorl %edx, %edx
subb %cl, %dl
movb %dl, (%r15,%rax)
incq %rax
cmpq %rax, %r13
jne 0x8fd15
jmp 0x8fd2d
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
testl %r13d, %r13d
jle 0x8fd2d
movl 0x64(%rbx), %esi
movq %r12, %rdi
callq 0x8f954
decl %r13d
jne 0x8fd47
jmp 0x8fd2d
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_beta_decode_init
cram_codec *cram_beta_decode_init(cram_block_compression_hdr *hdr,
                                  char *data, int size,
                                  enum cram_encoding codec,
                                  enum cram_external_type option,
                                  int version, varint_vec *vv) {
    cram_codec *c;
    char *cp = data;

    if (!(c = malloc(sizeof(*c))))
        return NULL;

    c->codec  = E_BETA;
    if (option == E_INT || option == E_SINT)
        c->decode = cram_beta_decode_int;
    else if (option == E_LONG || option == E_SLONG)
        c->decode = cram_beta_decode_long;
    else if (option == E_BYTE_ARRAY || option == E_BYTE)
        c->decode = cram_beta_decode_char;
    else {
        hts_log_error("BYTE_ARRAYs not supported by this codec");
        free(c);
        return NULL;
    }
    c->free   = cram_beta_decode_free;
    c->describe = cram_beta_describe;

    c->u.beta.nbits = -1;
    c->u.beta.offset = vv->varint_get32(&cp, data + size, NULL);
    if (cp < data + size) // Ensure test below works
        c->u.beta.nbits  = vv->varint_get32(&cp, data + size, NULL);

    if (cp - data != size
        || c->u.beta.nbits < 0 || c->u.beta.nbits > 8 * sizeof(int)) {
        hts_log_error("Malformed beta header stream");
        free(c);
        return NULL;
    }

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r15d
movl %edx, %ebp
movq %rsi, %r14
movq %rsi, (%rsp)
movl $0x880, %edi            # imm = 0x880
callq 0x4680
testq %rax, %rax
je 0x8fe7b
movq %rax, %rbx
movl $0x6, (%rax)
leal -0x1(%r15), %eax
cmpl $0x7, %eax
jae 0x8fdd8
movl $0x63, %ecx
btl %eax, %ecx
jae 0x8fdd8
movl %eax, %eax
leaq 0x28f3e(%rip), %rcx     # 0xb8d10
movq (%rcx,%rax,8), %rax
jmp 0x8fde9
addl $-0x3, %r15d
cmpl $0x2, %r15d
jae 0x8fe59
leaq -0x17b(%rip), %rax      # 0x8fc6e
movq 0x40(%rsp), %rcx
movq %rax, 0x28(%rbx)
leaq -0xa0(%rip), %rax       # 0x8fd59
movq %rax, 0x20(%rbx)
leaq -0xa1(%rip), %rax       # 0x8fd63
movq %rax, 0x58(%rbx)
movl $0xffffffff, 0x64(%rbx) # imm = 0xFFFFFFFF
movslq %ebp, %r13
movq %rcx, %rbp
leaq (%r14,%r13), %r15
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq *0x18(%rcx)
movl %eax, 0x60(%rbx)
cmpq %r15, (%r12)
jae 0x8fe3e
movq %rsp, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq *0x18(%rbp)
movl %eax, 0x64(%rbx)
movq (%rsp), %rax
subq %r14, %rax
leaq 0x15442(%rip), %rdx     # 0xa528e
cmpq %r13, %rax
jne 0x8fe60
cmpl $0x21, 0x64(%rbx)
jae 0x8fe60
jmp 0x8fe7d
leaq 0x15406(%rip), %rdx     # 0xa5266
leaq 0x153e9(%rip), %rsi     # 0xa5250
movl $0x1, %edi
xorl %eax, %eax
callq 0x14378
movq %rbx, %rdi
callq 0x45c0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_beta_encode_store
int cram_beta_encode_store(cram_codec *c, cram_block *b,
                           char *prefix, int version) {
    int len = 0, r = 0, n;

    if (prefix) {
        size_t l = strlen(prefix);
        BLOCK_APPEND(b, prefix, l);
        len += l;
    }

    len += (n = c->vv->varint_put32_blk(b, c->codec)); r |= n;
    // codec length
    len += (n = c->vv->varint_put32_blk(b, c->vv->varint_size(c->u.e_beta.offset)
                                         + c->vv->varint_size(c->u.e_beta.nbits)));
    r |= n;
    len += (n = c->vv->varint_put32_blk(b, c->u.e_beta.offset)); r |= n;
    len += (n = c->vv->varint_put32_blk(b, c->u.e_beta.nbits));  r |= n;

    if (r > 0) return len;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x8ff32
movq %rdx, %r12
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r15
movq 0x30(%rbx), %r13
addq %rax, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x8feff
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x8ffc7
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r15, %r15
je 0x8ff1b
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
xorl %eax, %eax
xorl %ecx, %ecx
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testb %al, %al
cmovel %r15d, %ecx
je 0x8ff34
jmp 0x8ffb5
xorl %ecx, %ecx
movl %ecx, 0x4(%rsp)
movq 0x10(%r14), %rax
movl (%r14), %esi
movq %rbx, %rdi
callq *0x58(%rax)
movl %eax, %r13d
movq 0x10(%r14), %rax
movq 0x58(%rax), %r12
movslq 0x60(%r14), %rdi
callq *0x78(%rax)
movl %eax, %r15d
movq 0x10(%r14), %rax
movslq 0x64(%r14), %rdi
callq *0x78(%rax)
addl %eax, %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq *%r12
movl %eax, %r15d
movq 0x10(%r14), %rax
movl 0x60(%r14), %esi
movq %rbx, %rdi
callq *0x58(%rax)
movl %eax, %r12d
movl %r13d, %ebp
orl %eax, %ebp
movq 0x10(%r14), %rax
movl 0x64(%r14), %esi
movq %rbx, %rdi
callq *0x58(%rax)
orl %eax, %ebp
orl %r15d, %ebp
jle 0x8ffaf
addl 0x4(%rsp), %r13d
addl %r12d, %r13d
addl %r15d, %r13d
addl %eax, %r13d
jmp 0x8ffb5
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0x8ff1d
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_beta_encode_long
int cram_beta_encode_long(cram_slice *slice, cram_codec *c,
                          char *in, int in_size) {
    int64_t *syms = (int64_t *)in;
    int i, r = 0;

    for (i = 0; i < in_size; i++)
        r |= store_bits_MSB(c->out, syms[i] + c->u.e_beta.offset,
                            c->u.e_beta.nbits);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %ecx, %ecx
jle 0x90009
movq %rdx, %rbx
movq %rsi, %r14
movl %ecx, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x8(%r14), %rdi
movslq 0x60(%r14), %rsi
addq (%rbx,%r12,8), %rsi
movl 0x64(%r14), %edx
callq 0x90016
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x8ffe8
jmp 0x9000b
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_beta_encode_int
int cram_beta_encode_int(cram_slice *slice, cram_codec *c,
                         char *in, int in_size) {
    int *syms = (int *)in;
    int i, r = 0;

    for (i = 0; i < in_size; i++)
        r |= store_bits_MSB(c->out, syms[i] + c->u.e_beta.offset,
                            c->u.e_beta.nbits);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %ecx, %ecx
jle 0x901a4
movq %rdx, %rbx
movq %rsi, %r14
movl %ecx, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x8(%r14), %rdi
movslq (%rbx,%r12,4), %rax
movslq 0x60(%r14), %rsi
addq %rax, %rsi
movl 0x64(%r14), %edx
callq 0x90016
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x90180
jmp 0x901a6
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_beta_encode_char
int cram_beta_encode_char(cram_slice *slice, cram_codec *c,
                          char *in, int in_size) {
    unsigned char *syms = (unsigned char *)in;
    int i, r = 0;

    for (i = 0; i < in_size; i++)
        r |= store_bits_MSB(c->out, syms[i] + c->u.e_beta.offset,
                            c->u.e_beta.nbits);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %ecx, %ecx
jle 0x901f0
movq %rdx, %rbx
movq %rsi, %r14
movl %ecx, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x8(%r14), %rdi
movzbl (%rbx,%r12), %eax
movslq 0x60(%r14), %rsi
addq %rax, %rsi
movl 0x64(%r14), %edx
callq 0x90016
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x901cb
jmp 0x901f2
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_decode_long
int cram_xpack_decode_long(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int64_t *out_i = (int64_t *)out;
    int i, n = *out_size;

    if (c->u.xpack.nbits) {
        for (i = 0; i < n; i++)
            out_i[i] = c->u.xpack.rmap[get_bits_MSB(in, c->u.xpack.nbits)];
    } else {
        for (i = 0; i < n; i++)
            out_i[i] = c->u.xpack.rmap[0];
    }

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rsi, %r14
movl (%r8), %r12d
cmpl $0x0, 0x60(%rsi)
je 0x903d5
testl %r12d, %r12d
jle 0x903ec
movq %rdx, %r15
xorl %r13d, %r13d
movl 0x60(%r14), %esi
movq %r15, %rdi
callq 0x8f954
movl 0x7c(%r14,%rax,4), %eax
movq %rax, (%rbx,%r13,8)
incq %r13
cmpq %r13, %r12
jne 0x903b6
jmp 0x903ec
testl %r12d, %r12d
jle 0x903ec
xorl %eax, %eax
movl 0x7c(%r14), %ecx
movq %rcx, (%rbx,%rax,8)
incq %rax
cmpq %rax, %r12
jne 0x903dc
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_decode_int
int cram_xpack_decode_int(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int32_t *out_i = (int32_t *)out;
    int i, n = *out_size;

    if (c->u.xpack.nbits) {
        if (cram_not_enough_bits(in, c->u.xpack.nbits * n))
            return -1;

        for (i = 0; i < n; i++)
            out_i[i] = c->u.xpack.rmap[get_bits_MSB(in, c->u.xpack.nbits)];
    } else {
        for (i = 0; i < n; i++)
            out_i[i] = c->u.xpack.rmap[0];
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rsi, %r14
movl (%r8), %r13d
movl 0x60(%rsi), %eax
testl %eax, %eax
je 0x90480
imull %r13d, %eax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x9049e
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
setbe %dl
testq %r13, %r13
setne %sil
testb %dl, %sil
jne 0x9049e
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x90458
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
movl %eax, %eax
cmpq %rax, %rcx
jb 0x9049e
testl %r13d, %r13d
jle 0x9049b
xorl %r15d, %r15d
xorl %ebp, %ebp
movl 0x60(%r14), %esi
movq %r12, %rdi
callq 0x8f954
movl 0x7c(%r14,%rax,4), %eax
movl %eax, (%rbx,%rbp,4)
incq %rbp
cmpq %rbp, %r13
jne 0x90462
jmp 0x9049e
testl %r13d, %r13d
jle 0x9049b
xorl %r15d, %r15d
xorl %eax, %eax
movl 0x7c(%r14), %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq %rax, %r13
jne 0x9048a
jmp 0x9049e
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_decode_char
int cram_xpack_decode_char(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    // FIXME: we need to ban data-series interleaving in the spec for this to work.

    // Remember this may be called when threaded and multi-slice per container.
    // Hence one cram_codec instance, multiple slices, multiple blocks.
    // We therefore have to cache appropriate block info in slice and not codec.
    //    b = cram_get_block_by_id(slice, c->external.content_id);
    if (c->u.xpack.nval > 1) {
        cram_xpack_decode_expand_char(slice, c);
        cram_block *b = slice->block_by_id[512 + c->codec_id];
        if (!b)
            return -1;

        if (out)
            memcpy(out, b->data + b->byte, *out_size);
        b->byte += *out_size;
    } else {
        memset(out, c->u.xpack.rmap[0], *out_size);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r15
cmpl $0x2, 0x78(%rsi)
jl 0x90513
movq %rdi, %r12
movq %r15, %rsi
callq 0x9052f
movq 0x18(%r12), %rax
movslq 0x18(%r15), %rcx
movq 0x1000(%rax,%rcx,8), %r15
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x90524
testq %r14, %r14
je 0x90505
movq 0x20(%r15), %rsi
addq 0x30(%r15), %rsi
movslq (%rbx), %rdx
movq %r14, %rdi
callq 0x43c0
movslq (%rbx), %rax
addq %rax, 0x30(%r15)
testq %r15, %r15
jne 0x90522
jmp 0x90524
movl 0x7c(%r15), %esi
movslq (%rbx), %rdx
movq %r14, %rdi
callq 0x4260
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_decode_expand_char
static int cram_xpack_decode_expand_char(cram_slice *slice, cram_codec *c) {
    cram_block *b = slice->block_by_id[512 + c->codec_id];
    if (b)
        return 0;

    // get sub-codec data.
    cram_block *sub_b = c->u.xpack.sub_codec->get_block(slice, c->u.xpack.sub_codec);
    if (!sub_b)
        return -1;

    // Allocate local block to expand into
    b = slice->block_by_id[512 + c->codec_id] = cram_new_block(0, 0);
    if (!b)
        return -1;
    int n = sub_b->uncomp_size * 8/c->u.xpack.nbits;
    BLOCK_GROW(b, n);
    b->uncomp_size = n;

    uint8_t p[256];
    int z;
    for (z = 0; z < 256; z++)
        p[z] = c->u.xpack.rmap[z];
    hts_unpack(sub_b->data, sub_b->uncomp_size, b->data, b->uncomp_size,
               8 / c->u.xpack.nbits, p);

    return 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq 0x18(%rdi), %rax
movslq 0x18(%rsi), %rcx
cmpq $0x0, 0x1000(%rax,%rcx,8)
je 0x90561
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rbx
movq %rdi, %r12
movq 0x70(%rsi), %rsi
callq *0x50(%rsi)
testq %rax, %rax
je 0x90551
movq %rax, %r14
xorl %edi, %edi
xorl %esi, %esi
callq 0x4ee42
movq %rax, %r15
movq 0x18(%r12), %rax
movslq 0x18(%rbx), %rcx
movq %r15, 0x1000(%rax,%rcx,8)
testq %r15, %r15
je 0x90551
movl 0x14(%r14), %eax
shll $0x3, %eax
cltd
idivl 0x60(%rbx)
movl %eax, %ebp
movslq %eax, %r12
addq 0x30(%r15), %r12
movq 0x28(%r15), %rax
cmpq %r12, %rax
ja 0x905ed
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r12, %rax
cmovaq %rax, %r12
movq 0x20(%r15), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0x90551
movq %r12, 0x28(%r15)
movq %rax, 0x20(%r15)
movl %ebp, 0x14(%r15)
xorl %eax, %eax
movb 0x7c(%rbx,%rax,4), %cl
movb %cl, (%rsp,%rax)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x905f3
movq 0x20(%r14), %rdi
movslq 0x14(%r14), %rsi
movq 0x20(%r15), %r8
movslq 0x14(%r15), %rcx
movl $0x8, %eax
xorl %edx, %edx
idivl 0x60(%rbx)
movq %rsp, %r9
movq %r8, %rdx
movl %eax, %r8d
callq 0x642ae
jmp 0x90551
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_decode_free
void cram_xpack_decode_free(cram_codec *c) {
    if (!c) return;

    if (c->u.xpack.sub_codec)
        c->u.xpack.sub_codec->free(c->u.xpack.sub_codec);

    //free(slice->block_by_id[512 + c->codec_id]);
    //slice->block_by_id[512 + c->codec_id] = 0;

    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x90650
pushq %rbx
movq %rdi, %rbx
movq 0x70(%rdi), %rdi
testq %rdi, %rdi
je 0x90647
callq *0x20(%rdi)
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_decoder_init
cram_codec *cram_decoder_init(cram_block_compression_hdr *hdr,
                              enum cram_encoding codec,
                              char *data, int size,
                              enum cram_external_type option,
                              int version, varint_vec *vv) {
    if (codec >= E_NULL && codec < E_NUM_CODECS && decode_init[codec]) {
        cram_codec *r = decode_init[codec](hdr, data, size, codec,
                                           option, version, vv);
        if (r) {
            r->vv = vv;
            r->codec_id = hdr->ncodecs++;
        }
        return r;
    } else {
        hts_log_error("Unimplemented codec of type %s", cram_encoding2str(codec));
        return NULL;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %eax
cmpl $0x35, %esi
ja 0x908d4
movabsq $0x7e1fffffffd05, %rsi  # imm = 0x7E1FFFFFFFD05
btq %rax, %rsi
jb 0x908d4
movq %rdi, %rbx
movq 0x30(%rsp), %r15
movl %eax, %r10d
leaq 0x2810c(%rip), %r11     # 0xb89b0
movq %r15, (%rsp)
movq %rdx, %rsi
movl %ecx, %edx
movl %eax, %ecx
callq *(%r11,%r10,8)
movq %rax, %r14
testq %rax, %rax
je 0x908fb
movq %r15, 0x10(%r14)
movl 0x410(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x410(%rbx)
movl %eax, 0x18(%r14)
jmp 0x908fb
movl %eax, %edi
callq 0x9516d
leaq 0x14fa7(%rip), %rsi     # 0xa5889
leaq 0x14fb2(%rip), %rdx     # 0xa589b
xorl %r14d, %r14d
movl $0x1, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0x14378
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_encode_flush
int cram_xpack_encode_flush(cram_codec *c) {
    // Pack the buffered up data
    int meta_len;
    uint64_t out_len;
    uint8_t out_meta[1024];
    uint8_t *out = hts_pack(BLOCK_DATA(c->out), BLOCK_SIZE(c->out),
                            out_meta, &meta_len, &out_len);

    // We now need to pass this through the next layer of transform
    if (c->u.e_xpack.sub_codec->encode(NULL, // also indicates flush incoming
                                     c->u.e_xpack.sub_codec,
                                     (char *)out, out_len))
        return -1;

    int r = 0;
    if (c->u.e_xpack.sub_codec->flush)
        r = c->u.e_xpack.sub_codec->flush(c->u.e_xpack.sub_codec);

    free(out);
    return r;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x410, %rsp            # imm = 0x410
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq 0x20(%rax), %rdi
movq 0x30(%rax), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x4(%rsp), %rcx
leaq 0x8(%rsp), %r15
movq %r15, %r8
callq 0x63eb0
movq %rax, %rbx
movq 0x70(%r14), %rsi
movl (%r15), %ecx
xorl %r15d, %r15d
xorl %edi, %edi
movq %rax, %rdx
callq *0x30(%rsi)
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x90977
movq 0x70(%r14), %rdi
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x9096c
callq *%rax
movl %eax, %r15d
movq %rbx, %rdi
callq 0x45c0
movl %r15d, %eax
addq $0x410, %rsp            # imm = 0x410
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_encode_long
int cram_xpack_encode_long(cram_slice *slice, cram_codec *c,
                           char *in, int in_size) {
    int64_t *syms = (int64_t *)in;
    int i, r = 0;

    for (i = 0; i < in_size; i++)
        r |= store_bits_MSB(c->out, c->u.e_xpack.map[syms[i]], c->u.e_xpack.nbits);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %ecx, %ecx
jle 0x90c13
movq %rdx, %rbx
movq %rsi, %r14
movl %ecx, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x8(%r14), %rdi
movq (%rbx,%r12,8), %rax
movslq 0x47c(%r14,%rax,4), %rsi
movl 0x60(%r14), %edx
callq 0x90016
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x90bee
jmp 0x90c15
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_encode_int
int cram_xpack_encode_int(cram_slice *slice, cram_codec *c,
                          char *in, int in_size) {
    int *syms = (int *)in;
    int i, r = 0;

    for (i = 0; i < in_size; i++)
        r |= store_bits_MSB(c->out, c->u.e_xpack.map[syms[i]], c->u.e_xpack.nbits);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %ecx, %ecx
jle 0x90c5f
movq %rdx, %rbx
movq %rsi, %r14
movl %ecx, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x8(%r14), %rdi
movslq (%rbx,%r12,4), %rax
movslq 0x47c(%r14,%rax,4), %rsi
movl 0x60(%r14), %edx
callq 0x90016
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x90c3a
jmp 0x90c61
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq