LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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, %r15
testq %rdx, %rdx
je 0x8c8e7
movq %rdx, %r12
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r14
movq 0x30(%rbx), %r13
addq %rax, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x8c8c4
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 0x8c9ba
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r14, %r14
je 0x8c8e0
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x43c0
addq %r14, 0x30(%rbx)
movq %r14, 0x8(%rsp)
jmp 0x8c8f0
movq $0x0, 0x8(%rsp)
movq 0x10(%r15), %rax
movl 0x60(%r15), %edx
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq *0x38(%rax)
movslq %eax, %r12
leaq (%rsp,%r12), %r13
addq $0x10, %r13
movq 0x10(%r15), %rax
movq 0x68(%r15), %rdx
movq %r13, %rdi
xorl %esi, %esi
callq *0x50(%rax)
movslq %eax, %r14
movq 0x10(%r15), %rax
movl (%r15), %esi
movq %rbx, %rdi
callq *0x58(%rax)
movl %eax, %ebp
movq 0x10(%r15), %rax
addq %r14, %r12
movq %rbx, %rdi
movl %r12d, %esi
callq *0x58(%rax)
movl %eax, 0x4(%rsp)
movq 0x30(%rbx), %r15
addq %r12, %r15
movq 0x28(%rbx), %rax
cmpq %r15, %rax
ja 0x8c987
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r15, %rax
cmovaq %rax, %r15
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x8c9ba
movq %r15, 0x28(%rbx)
movq %rax, 0x20(%rbx)
addq %r14, %r13
leaq 0x10(%rsp), %rax
cmpq %rax, %r13
je 0x8c9ad
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x43c0
addq %r12, 0x30(%rbx)
addl 0x8(%rsp), %ebp
addl %r12d, %ebp
addl 0x4(%rsp), %ebp
jmp 0x8c9bf
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8ca77
movq %rax, %rcx
movq $0x0, 0x68(%rax)
testq %r15, %r15
je 0x8ca4a
movq 0x1010(%r15), %rsi
cmpq $-0x7f, %rsi
jb 0x8ca3e
movq 0x1018(%r15), %rax
negq %rsi
cqto
idivq %rsi
cmpq $0x65, %rax
jl 0x8ca4a
movq %rsi, 0x68(%rcx)
movl $0x29, (%rcx)
leaq -0x1ed(%rip), %rax      # 0x8c84b
movq %rax, 0x20(%rcx)
jmp 0x8ca64
testq %rsi, %rsi
jle 0x8ca4a
negq %rsi
movq %rsi, 0x68(%rcx)
movl %r14d, (%rcx)
leaq -0x209(%rip), %rax      # 0x8c84b
movq %rax, 0x20(%rcx)
cmpl $0x2a, %r14d
je 0x8ca7b
cmpl $0x29, %r14d
jne 0x8ca77
cmpl $0x1, %ebp
leaq -0x289(%rip), %rdx      # 0x8c7e5
leaq -0x260(%rip), %rax      # 0x8c815
jmp 0x8ca8c
xorl %ecx, %ecx
jmp 0x8caaa
cmpl $0x1, %ebp
leaq -0x288(%rip), %rdx      # 0x8c7fd
leaq -0x25c(%rip), %rax      # 0x8c830
cmoveq %rdx, %rax
movq %rax, 0x30(%rcx)
leaq -0x246(%rip), %rax      # 0x8c855
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_O3/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 0x8cad2
xorl %edx, %edx
movb 0x60(%rsi), %dil
movb %dil, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x8cac2
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8caed
xorl %edx, %edx
movl 0x60(%rsi), %edi
movl %edi, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %rax
jne 0x8cadf
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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), %rdi
testq %rdi, %rdi
jle 0x8cb8f
movq 0x60(%rsi), %rax
leal 0x1(%rdi), %edx
decq %rdi
movq %rdi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl %edx
shlq $0x4, %rdx
movdqa 0x7d62(%rip), %xmm1     # 0x94880
xorl %esi, %esi
movdqa 0x7d68(%rip), %xmm2     # 0x94890
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0xa3c8(%rip), %xmm4     # 0x96f00
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %edi
notl %edi
testb $0x1, %dil
je 0x8cb6e
movq %rax, (%rcx,%rsi)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edi
testb $0x1, %dil
je 0x8cb82
movq %rax, 0x8(%rcx,%rsi)
paddq %xmm4, %xmm1
addq $0x10, %rsi
cmpq %rsi, %rdx
jne 0x8cb38
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8cc74
movq %rax, %rbx
movq 0x40(%rsp), %rax
movl %r12d, (%rbx)
cmpl $0x2b, %r12d
jne 0x8cc06
leaq -0x14c(%rip), %rcx      # 0x8cab8
jmp 0x8cc1c
cmpl $0x1, %r15d
jne 0x8cc15
leaq -0x13e(%rip), %rcx      # 0x8cad5
jmp 0x8cc1c
leaq -0x12c(%rip), %rcx      # 0x8caf0
movq %rcx, 0x28(%rbx)
leaq -0x95(%rip), %rcx       # 0x8cb92
movq %rcx, 0x20(%rbx)
leaq -0x96(%rip), %rcx       # 0x8cb9c
movq %rcx, 0x40(%rbx)
movq $0x0, 0x50(%rbx)
leaq -0xa6(%rip), %rcx       # 0x8cb9f
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 0x8cc76
movq %rbx, %rdi
callq 0x4ba3
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_O3/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, %r15
testq %rdx, %rdx
je 0x8cd16
movq %rdx, %r12
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r14
movq 0x30(%rbx), %r13
addq %rax, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x8ccf8
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 0x8cdbe
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r14, %r14
je 0x8cd19
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x43c0
addq %r14, 0x30(%rbx)
jmp 0x8cd19
xorl %r14d, %r14d
movq 0x10(%r15), %rax
movq 0x60(%r15), %rdx
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq *0x50(%rax)
movl %eax, %ebp
movslq %eax, %r12
movq 0x10(%r15), %rax
movl (%r15), %esi
movq %rbx, %rdi
callq *0x58(%rax)
movl %eax, 0xc(%rsp)
movq 0x10(%r15), %rax
movq %rbx, %rdi
movl %r12d, %esi
callq *0x58(%rax)
movl %eax, %r15d
movq 0x30(%rbx), %r13
addq %r12, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x8cd95
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 0x8cdbe
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testl %ebp, %ebp
je 0x8cdb2
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x43c0
addq %r12, 0x30(%rbx)
addl %r14d, %ebp
addl 0xc(%rsp), %ebp
addl %r15d, %ebp
jmp 0x8cdc3
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8ce21
movl %ebp, (%rax)
leaq -0x262(%rip), %rcx      # 0x8cb92
movq %rcx, 0x20(%rax)
leaq -0x179(%rip), %rcx      # 0x8cc86
movq %rcx, 0x30(%rax)
leaq -0x181(%rip), %rcx      # 0x8cc89
movq %rcx, 0x38(%rax)
movq $0x0, 0x48(%rax)
movq 0x1010(%rbx), %rcx
movq %rcx, 0x60(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8ceb7
imull %r13d, %eax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x8ced9
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
setbe %dl
testq %r13, %r13
setne %sil
testb %dl, %sil
jne 0x8ced9
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x8ce8c
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
movl %eax, %eax
cmpq %rax, %rcx
jb 0x8ced9
testl %r13d, %r13d
jle 0x8ced6
xorl %r15d, %r15d
xorl %ebp, %ebp
movl 0x64(%r14), %esi
movq %r12, %rdi
callq 0x8ceeb
movslq 0x60(%r14), %rcx
subq %rcx, %rax
movq %rax, (%rbx,%rbp,8)
incq %rbp
cmpq %rbp, %r13
jne 0x8ce96
jmp 0x8ced9
testl %r13d, %r13d
jle 0x8ced6
xorl %r15d, %r15d
xorl %eax, %eax
movslq 0x60(%r14), %rcx
negq %rcx
movq %rcx, (%rbx,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x8cec1
jmp 0x8ced9
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_O3/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 0x8d1de
imull %r13d, %eax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x8d1fe
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
setbe %dl
testq %r13, %r13
setne %sil
testb %dl, %sil
jne 0x8d1fe
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x8d1b7
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
movl %eax, %eax
cmpq %rax, %rcx
jb 0x8d1fe
testl %r13d, %r13d
jle 0x8d1fb
xorl %r15d, %r15d
xorl %ebp, %ebp
movl 0x64(%r14), %esi
movq %r12, %rdi
callq 0x8ceeb
subl 0x60(%r14), %eax
movl %eax, (%rbx,%rbp,4)
incq %rbp
cmpq %rbp, %r13
jne 0x8d1c1
jmp 0x8d1fe
testl %r13d, %r13d
jle 0x8d1fb
xorl %r15d, %r15d
xorl %eax, %eax
xorl %ecx, %ecx
subl 0x60(%r14), %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq %rax, %r13
jne 0x8d1e8
jmp 0x8d1fe
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_O3/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 0x8d29f
imull %r13d, %eax
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x8d2cf
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
setbe %dl
testl %r13d, %r13d
setne %sil
testb %dl, %sil
jne 0x8d2cf
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x8d274
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
movl %eax, %eax
cmpq %rax, %rcx
jb 0x8d2cf
testq %r15, %r15
je 0x8d2e1
testl %r13d, %r13d
jle 0x8d2cc
xorl %r14d, %r14d
xorl %ebp, %ebp
movl 0x64(%rbx), %esi
movq %r12, %rdi
callq 0x8ceeb
subl 0x60(%rbx), %eax
movb %al, (%r15,%rbp)
incq %rbp
cmpq %rbp, %r13
jne 0x8d283
jmp 0x8d2cf
testq %r15, %r15
setne %al
testl %r13d, %r13d
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x8d2cc
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 0x8d2b7
jmp 0x8d2cf
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 0x8d2cf
movl 0x64(%rbx), %esi
movq %r12, %rdi
callq 0x8ceeb
decl %r13d
jne 0x8d2e9
jmp 0x8d2cf
// File: /workspace/github_c_makefile_star2_O3/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 0x8d433
movq %rax, %rbx
movl $0x6, (%rax)
leal -0x1(%r15), %eax
cmpl $0x7, %eax
jae 0x8d37a
movl $0x63, %ecx
btl %eax, %ecx
jae 0x8d37a
movl %eax, %eax
leaq 0x2899c(%rip), %rcx     # 0xb5d10
movq (%rcx,%rax,8), %rax
jmp 0x8d38f
addl $-0x3, %r15d
cmpl $0x2, %r15d
jae 0x8d411
leaq -0x17f(%rip), %rax      # 0x8d210
movq 0x40(%rsp), %rcx
movq %rax, 0x28(%rbx)
leaq -0xa4(%rip), %rax       # 0x8d2fb
movq %rax, 0x20(%rbx)
leaq -0xa5(%rip), %rax       # 0x8d305
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 0x8d401
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq *0x18(%rbp)
movl %eax, 0x64(%rbx)
movq (%r12), %rcx
cmpl $0x21, %eax
setae %al
subq %r14, %rcx
cmpq %r13, %rcx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x8d435
leaq 0x155c8(%rip), %rsi     # 0xa29d0
leaq 0x155ff(%rip), %rdx     # 0xa2a0e
jmp 0x8d41f
leaq 0x155b8(%rip), %rsi     # 0xa29d0
leaq 0x155c7(%rip), %rdx     # 0xa29e6
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
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_O3/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, %r14
movq %rdi, %r15
testq %rdx, %rdx
je 0x8d4d5
movq %rdx, %r12
movq %rdx, %rdi
callq 0x41d0
movq %rax, %rbx
movq 0x30(%r14), %r13
addq %rax, %r13
movq 0x28(%r14), %rax
cmpq %r13, %rax
ja 0x8d4b3
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%r14), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x8d54f
movq %r13, 0x28(%r14)
movq %rax, 0x20(%r14)
testq %rbx, %rbx
je 0x8d4cf
movq 0x20(%r14), %rdi
addq 0x30(%r14), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, 0x30(%r14)
movq %rbx, (%rsp)
jmp 0x8d4dd
movq $0x0, (%rsp)
movq 0x10(%r15), %rax
movl (%r15), %esi
movq %r14, %rdi
callq *0x58(%rax)
movl %eax, %ebx
movq 0x10(%r15), %rax
movq 0x58(%rax), %r13
movslq 0x60(%r15), %rdi
callq *0x78(%rax)
movl %eax, %r12d
movq 0x10(%r15), %rax
movslq 0x64(%r15), %rdi
callq *0x78(%rax)
addl %eax, %r12d
movq %r14, %rdi
movl %r12d, %esi
callq *%r13
movl %eax, %r12d
movq 0x10(%r15), %rax
movl 0x60(%r15), %esi
movq %r14, %rdi
callq *0x58(%rax)
movl %eax, %r13d
movl %ebx, %ebp
orl %eax, %ebp
movq 0x10(%r15), %rax
movl 0x64(%r15), %esi
movq %r14, %rdi
callq *0x58(%rax)
orl %eax, %ebp
orl %r12d, %ebp
jle 0x8d54f
addl (%rsp), %ebx
addl %r13d, %ebx
addl %r12d, %ebx
addl %eax, %ebx
jmp 0x8d554
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8d5a0
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 0x8d5ad
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x8d57f
jmp 0x8d5a2
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8d740
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 0x8d5ad
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x8d71c
jmp 0x8d742
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8d971
testl %r12d, %r12d
jle 0x8d988
movq %rdx, %r15
xorl %r13d, %r13d
movl 0x60(%r14), %esi
movq %r15, %rdi
callq 0x8ceeb
movl 0x7c(%r14,%rax,4), %eax
movq %rax, (%rbx,%r13,8)
incq %r13
cmpq %r13, %r12
jne 0x8d952
jmp 0x8d988
testl %r12d, %r12d
jle 0x8d988
xorl %eax, %eax
movl 0x7c(%r14), %ecx
movq %rcx, (%rbx,%rax,8)
incq %rax
cmpq %rax, %r12
jne 0x8d978
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8da33
imull %r13d, %eax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x8db30
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
setbe %dl
testq %r13, %r13
setne %sil
testb %dl, %sil
jne 0x8db30
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x8da04
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
movl %eax, %eax
cmpq %rax, %rcx
jb 0x8db30
testl %r13d, %r13d
jle 0x8db2d
xorl %r15d, %r15d
xorl %ebp, %ebp
movl 0x60(%r14), %esi
movq %r12, %rdi
callq 0x8ceeb
movl 0x7c(%r14,%rax,4), %eax
movl %eax, (%rbx,%rbp,4)
incq %rbp
cmpq %rbp, %r13
jne 0x8da12
jmp 0x8db30
testl %r13d, %r13d
jle 0x8db2d
movl 0x7c(%r14), %eax
leal 0x3(%r13), %ecx
decq %r13
movq %r13, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %ecx
shlq $0x4, %rcx
movdqa 0x6e10(%rip), %xmm1     # 0x94870
movdqa 0x6e18(%rip), %xmm2     # 0x94880
xorl %edx, %edx
movdqa 0x6e1e(%rip), %xmm3     # 0x94890
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x6e1e(%rip), %xmm5     # 0x948a0
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %esi
notl %esi
testb $0x1, %sil
je 0x8daba
movl %eax, (%rbx,%rdx)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0x8dacd
movl %eax, 0x4(%rbx,%rdx)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %esi
testb $0x1, %sil
je 0x8db09
movl %eax, 0x8(%rbx,%rdx)
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0x8db18
movl %eax, 0xc(%rbx,%rdx)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x10, %rdx
cmpq %rdx, %rcx
jne 0x8da82
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_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r15
cmpl $0x2, 0x78(%rsi)
jl 0x8db9b
movq %rdi, %r12
movq %r15, %rsi
callq 0x8dbbf
movq 0x18(%r12), %rax
movslq 0x18(%r15), %rcx
movq 0x1000(%rax,%rcx,8), %r15
testq %r15, %r15
je 0x8dbb8
testq %r14, %r14
je 0x8db92
movq 0x20(%r15), %rsi
addq 0x30(%r15), %rsi
movslq (%rbx), %rdx
movq %r14, %rdi
callq 0x43c0
movslq (%rbx), %rax
addq %rax, 0x30(%r15)
jmp 0x8dbaa
movl 0x7c(%r15), %esi
movslq (%rbx), %rdx
movq %r14, %rdi
callq 0x4260
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x8dbac
// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq 0x18(%rdi), %rax
movslq 0x18(%rsi), %rcx
cmpq $0x0, 0x1000(%rax,%rcx,8)
je 0x8dbf5
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rbx
movq %rdi, %r12
movq 0x70(%rsi), %rsi
callq *0x50(%rsi)
testq %rax, %rax
je 0x8dbe3
movq %rax, %r14
xorl %edi, %edi
xorl %esi, %esi
callq 0x4c675
movq %rax, %r15
movq 0x18(%r12), %rax
movslq 0x18(%rbx), %rcx
movq %r15, 0x1000(%rax,%rcx,8)
testq %r15, %r15
je 0x8dbe3
movl 0x14(%r14), %eax
shll $0x3, %eax
cltd
idivl 0x60(%rbx)
movl %eax, %ebp
movslq %eax, %r12
movq 0x30(%r15), %r13
addq %r12, %r13
movq 0x28(%r15), %rax
cmpq %r13, %rax
ja 0x8dc84
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%r15), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x8dbe3
movq %r13, 0x28(%r15)
movq %rax, 0x20(%r15)
movl %ebp, 0x14(%r15)
xorl %eax, %eax
movdqa 0x127ce(%rip), %xmm0    # 0xa0460
movdqu 0x7c(%rbx,%rax,4), %xmm1
pand %xmm0, %xmm1
packuswb %xmm1, %xmm1
packuswb %xmm1, %xmm1
movd %xmm1, (%rsp,%rax)
addq $0x4, %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x8dc92
movq 0x20(%r14), %rdi
movslq 0x14(%r14), %rsi
movq 0x20(%r15), %rcx
movl $0x8, %eax
xorl %edx, %edx
idivl 0x60(%rbx)
movq %rsp, %r9
movq %rcx, %rdx
movq %r12, %rcx
movl %eax, %r8d
callq 0x61913
jmp 0x8dbe3
// File: /workspace/github_c_makefile_star2_O3/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 0x8dcff
pushq %rbx
movq %rdi, %rbx
movq 0x70(%rdi), %rdi
testq %rdi, %rdi
je 0x8dcf6
callq *0x20(%rdi)
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8df8e
movabsq $0x7e1fffffffd05, %rsi  # imm = 0x7E1FFFFFFFD05
btq %rax, %rsi
jb 0x8df8e
movq %rdi, %rbx
movq 0x30(%rsp), %r15
movl %eax, %r10d
leaq 0x27a52(%rip), %r11     # 0xb59b0
movq %r15, (%rsp)
movq %rdx, %rsi
movl %ecx, %edx
movl %eax, %ecx
callq *(%r11,%r10,8)
testq %rax, %rax
je 0x8dfc2
movq %rax, %r14
movq %r15, 0x10(%rax)
movl 0x410(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x410(%rbx)
movl %eax, 0x18(%r14)
jmp 0x8dfb5
movl %eax, %edi
callq 0x92817
leaq 0x1506d(%rip), %rsi     # 0xa3009
leaq 0x15078(%rip), %rdx     # 0xa301b
xorl %r14d, %r14d
movl $0x1, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0x13de5
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
xorl %r14d, %r14d
jmp 0x8dfb5
// File: /workspace/github_c_makefile_star2_O3/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 0x61528
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 0x8e036
movq 0x70(%r14), %rdi
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x8e02b
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_O3/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 0x8e2b2
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 0x8d5ad
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x8e28d
jmp 0x8e2b4
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8e2fe
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 0x8d5ad
orl %eax, %ebp
incq %r12
cmpq %r12, %r15
jne 0x8e2d9
jmp 0x8e300
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_encode_free
void cram_xpack_encode_free(cram_codec *c) {
    if (!c) return;

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

    cram_free_block(c->out);

    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x8e3c4
pushq %rbx
movq %rdi, %rbx
movq 0x70(%rdi), %rdi
testq %rdi, %rdi
je 0x8e3b2
callq *0x20(%rdi)
movq 0x8(%rbx), %rdi
callq 0x4ceb6
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_encode_init
cram_codec *cram_xpack_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  = E_XPACK;
    c->free   = cram_xpack_encode_free;
    if (option == E_LONG)
        c->encode = cram_xpack_encode_long;
    else if (option == E_INT)
        c->encode = cram_xpack_encode_int;
    else
        c->encode = cram_xpack_encode_char;
    c->store  = cram_xpack_encode_store;
    c->flush  = cram_xpack_encode_flush;

    cram_xpack_encoder *e = (cram_xpack_encoder *)dat;
    c->u.e_xpack.nbits = e->nbits;
    c->u.e_xpack.nval = e->nval;
    c->u.e_xpack.sub_codec = cram_encoder_init(e->sub_encoding, NULL,
                                               E_BYTE_ARRAY, e->sub_codec_dat,
                                               version, vv);

    // Initialise fwd and rev maps
    memcpy(c->u.e_xpack.map, e->map, sizeof(e->map)); // P,A,C,K to 0,1,2,3
    int i, n;
    for (i = n = 0; i < 256; i++)
        if (e->map[i] != -1)
            c->u.e_xpack.rmap[n++] = i;               // 0,1,2,3 to P,A,C,K
    if (n != e->nval) {
        fprintf(stderr, "Incorrectly specified number of map items in PACK\n");
        return NULL;
    }

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r15
movl %r8d, %ebp
movq %rcx, %r14
movl %edx, %r12d
movl $0x880, %edi            # imm = 0x880
callq 0x4680
xorl %r13d, %r13d
testq %rax, %rax
je 0x8e4b7
movq %rax, %rbx
movl $0x33, (%rax)
cmpl $0x1, %r12d
leaq -0x147(%rip), %rax      # 0x8e2bf
leaq -0x102(%rip), %rcx      # 0x8e30b
cmoveq %rax, %rcx
leaq -0x7b(%rip), %rax       # 0x8e39d
cmpl $0x2, %r12d
leaq -0x1b0(%rip), %rdx      # 0x8e273
cmovneq %rcx, %rdx
movq %rax, 0x20(%rbx)
movq %rdx, 0x30(%rbx)
leaq -0x3f3(%rip), %rax      # 0x8e043
movq %rax, 0x38(%rbx)
leaq -0x47a(%rip), %rax      # 0x8dfc7
movq %rax, 0x48(%rbx)
movl (%r14), %eax
movl %eax, 0x60(%rbx)
movl 0x18(%r14), %eax
movl %eax, 0x78(%rbx)
movl 0x4(%r14), %edi
movq 0x8(%r14), %rcx
xorl %esi, %esi
movl $0x4, %edx
movl %ebp, %r8d
movq %r15, %r9
callq 0x8e4cb
movq %rax, 0x70(%rbx)
movq %rbx, %rdi
addq $0x47c, %rdi            # imm = 0x47C
leaq 0x41c(%r14), %r15
movl $0x400, %edx            # imm = 0x400
movq %r15, %rsi
callq 0x43c0
xorl %eax, %eax
cmpl $-0x1, (%r15,%rax,4)
je 0x8e4a1
movslq %r13d, %rcx
incl %r13d
movl %eax, 0x7c(%rbx,%rcx,4)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x8e490
cmpl 0x18(%r14), %r13d
je 0x8e4b9
callq 0x4c33
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_O3/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_encoder_init
cram_codec *cram_encoder_init(enum cram_encoding codec,
                              cram_stats *st,
                              enum cram_external_type option,
                              void *dat,
                              int version, varint_vec *vv) {
    if (st && !st->nvals)
        return NULL;

    // cram_stats_encoding assumes integer data, but if option
    // is E_BYTE then tweak the requested encoding.  This ought
    // to be fixed in cram_stats_encoding instead.
    if (option == E_BYTE || option == E_BYTE_ARRAY ||
       option == E_BYTE_ARRAY_BLOCK) {
       if (codec == E_VARINT_SIGNED || codec == E_VARINT_UNSIGNED)
           codec = E_EXTERNAL;
       else if (codec == E_CONST_INT)
           codec = E_CONST_BYTE;
    }

    if (encode_init[codec]) {
        cram_codec *r;
        if ((r = encode_init[codec](st, codec, option, dat, version, vv)))
            r->out = NULL;
        if (!r) {
            hts_log_error("Unable to initialise codec of type %s", cram_encoding2str(codec));
            return NULL;
        }
        r->vv = vv;
        return r;
    } else {
        hts_log_error("Unimplemented codec of type %s", cram_encoding2str(codec));
        abort();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %r9, %rbx
testq %rsi, %rsi
je 0x8e4e5
cmpl $0x0, 0x100c(%rsi)
je 0x8e572
leal -0x3(%rdx), %eax
cmpl $0x2, %eax
ja 0x8e509
leal -0x29(%rdi), %r9d
movl $0x1, %eax
cmpl $0x2, %r9d
jb 0x8e50b
cmpl $0x2c, %edi
movl $0x2b, %eax
cmovnel %edi, %eax
jmp 0x8e50b
movl %edi, %eax
movl %eax, %r14d
movabsq $0x7e1ffffffff85, %rdi  # imm = 0x7E1FFFFFFFF85
btq %rax, %rdi
jb 0x8e57e
leaq 0x2763b(%rip), %rax     # 0xb5b60
movq %rsi, %rdi
movl %r14d, %esi
movq %rbx, %r9
callq *(%rax,%r14,8)
testq %rax, %rax
je 0x8e548
movq %rax, %r15
movq $0x0, 0x8(%rax)
movq %rbx, 0x10(%rax)
jmp 0x8e575
movl %r14d, %edi
callq 0x92817
leaq 0x14ae3(%rip), %rsi     # 0xa303a
leaq 0x14aee(%rip), %rdx     # 0xa304c
xorl %r15d, %r15d
movl $0x1, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0x13de5
jmp 0x8e575
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
movl %r14d, %edi
callq 0x92817
leaq 0x14aad(%rip), %rsi     # 0xa303a
leaq 0x14a87(%rip), %rdx     # 0xa301b
movl $0x1, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0x13de5
callq 0x4270
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xdelta_decode_int
int cram_xdelta_decode_int(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    // Slow value-by-value method for now
    uint32_t *out32 = (uint32_t *)out;
    int i;
    for (i = 0; i < *out_size; i++) {
        uint32_t v;
        int one = 1;
        if (c->u.e_xdelta.sub_codec->decode(slice, c->u.e_xdelta.sub_codec, in,
                                          (char *)&v, &one) < 0)
            return -1;
        uint32_t d = unzigzag32(v);
        c->u.xdelta.last = out32[i] = d + c->u.xdelta.last;
    }

    return 0;
}

// Assembly:
cmpl $0x0, (%r8)
jle 0x8e61d
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
xorl %ebp, %ebp
movl $0x1, (%rsp)
movq 0x78(%r12), %rsi
movq %r13, %rdi
movq %r15, %rdx
leaq 0x4(%rsp), %rcx
movq %rsp, %r8
callq *0x28(%rsi)
testl %eax, %eax
js 0x8e620
movl 0x4(%rsp), %eax
movl %eax, %ecx
shrl %ecx
andl $0x1, %eax
negl %eax
xorl %ecx, %eax
addl 0x60(%r12), %eax
movl %eax, (%r14,%rbp,4)
movq %rax, 0x60(%r12)
incq %rbp
movslq (%rbx), %rax
cmpq %rax, %rbp
jl 0x8e5d0
xorl %eax, %eax
jmp 0x8e625
xorl %eax, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq