LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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:
movl (%r8), %eax
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
cmpq %rdx, %rax
je 0x6f920
movq 0x60(%rsi), %rdi
movq %rdi, (%rcx,%rdx,8)
incq %rdx
jmp 0x6f90e
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x6fa19
movq %rax, %rbx
movq 0x40(%rsp), %rax
movl %r12d, (%rbx)
cmpl $0x2b, %r12d
jne 0x6f992
leaq -0xc8(%rip), %rcx       # 0x6f8c8
jmp 0x6f9a8
cmpl $0x1, %r15d
jne 0x6f9a1
leaq -0xb8(%rip), %rcx       # 0x6f8e7
jmp 0x6f9a8
leaq -0xa4(%rip), %rcx       # 0x6f904
movq %rcx, 0x28(%rbx)
leaq -0x90(%rip), %rcx       # 0x6f923
movq %rcx, 0x20(%rbx)
leaq -0x96(%rip), %rcx       # 0x6f928
movq %rcx, 0x40(%rbx)
andq $0x0, 0x50(%rbx)
leaq -0xa3(%rip), %rcx       # 0x6f92b
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 0x6fa1b
movq 0x2e5dc(%rip), %rax     # 0x9dfd8
movq (%rax), %rcx
leaq 0x14881(%rip), %rdi     # 0x84287
pushq $0x1e
popq %rsi
pushq $0x1
popq %rdx
callq 0x49b0
movq %rbx, %rdi
callq 0x45c0
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_O2/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 $0x68, %rsp
movq %rsi, %r14
movq %rdi, %r12
pushq $-0x1
popq %rbx
testq %rdx, %rdx
je 0x6fa72
movq %rdx, %r13
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r15
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x6f15a
xorl %ecx, %ecx
testl %eax, %eax
cmovsl %ecx, %r15d
jns 0x6fa75
jmp 0x6face
xorl %r15d, %r15d
movq 0x10(%r12), %rax
movq 0x60(%r12), %rdx
movq %rsp, %rdi
xorl %esi, %esi
callq *0x50(%rax)
movl %eax, %ebp
movslq %eax, %rbx
movq 0x10(%r12), %rax
movl (%r12), %esi
movq %r14, %rdi
callq *0x58(%rax)
movl %eax, %r13d
movq 0x10(%r12), %rax
movq %r14, %rdi
movl %ebx, %esi
callq *0x58(%rax)
movl %eax, %r12d
movq %r14, %rdi
movq %rsp, %rsi
movq %rbx, %rdx
pushq $-0x1
popq %rbx
callq 0x6f15a
testl %eax, %eax
js 0x6face
addl %r15d, %ebp
addl %r13d, %ebp
addl %r12d, %ebp
movl %ebp, %ebx
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_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 0x6fb29
movl %ebp, (%rax)
leaq -0x1dc(%rip), %rcx      # 0x6f923
movq %rcx, 0x20(%rax)
leaq -0xdf(%rip), %rcx       # 0x6fa2b
movq %rcx, 0x30(%rax)
leaq -0xe7(%rip), %rcx       # 0x6fa2e
movq %rcx, 0x38(%rax)
andq $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_O2/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), %esi
testl %esi, %esi
je 0x6fb74
movq %rdx, %r12
imull %r13d, %esi
movq %rdx, %rdi
callq 0x6fbc2
testl %eax, %eax
je 0x6fb95
pushq $-0x1
popq %r15
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
xorl %eax, %eax
cmpq %rax, %r13
je 0x6fb62
movslq 0x60(%r14), %rcx
negq %rcx
movq %rcx, (%rbx,%rax,8)
incq %rax
jmp 0x6fb80
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x6fb62
movl 0x64(%r14), %esi
movq %r12, %rdi
callq 0x6fbfe
movslq 0x60(%r14), %rcx
subq %rcx, %rax
movq %rax, (%rbx,%rbp,8)
incq %rbp
jmp 0x6fba1
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.h
// Function: cram_not_enough_bits
static inline int cram_not_enough_bits(cram_block *blk, int nbits) {
    if (nbits < 0 ||
        (blk->byte >= blk->uncomp_size && nbits > 0) ||
        (blk->uncomp_size - blk->byte <= INT32_MAX / 8 + 1 &&
         (blk->uncomp_size - blk->byte) * 8 + blk->bit - 7 < nbits)) {
        return 1;
    }
    return 0;
}

// Assembly:
pushq $0x1
popq %rax
testl %esi, %esi
js 0x6fbfd
movslq 0x14(%rdi), %rcx
subq 0x30(%rdi), %rcx
setbe %dl
testl %esi, %esi
setne %r8b
testb %dl, %r8b
jne 0x6fbfd
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x6fbfb
movslq 0x38(%rdi), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
movl %esi, %edx
cmpq %rdx, %rcx
jb 0x6fbfd
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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), %esi
testl %esi, %esi
je 0x6fea9
movq %rdx, %r12
imull %r13d, %esi
movq %rdx, %rdi
callq 0x6fbc2
testl %eax, %eax
je 0x6fec8
pushq $-0x1
popq %r15
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
xorl %eax, %eax
cmpq %rax, %r13
je 0x6fe97
xorl %ecx, %ecx
subl 0x60(%r14), %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
jmp 0x6feb5
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x6fe97
movl 0x64(%r14), %esi
movq %r12, %rdi
callq 0x6fbfe
subl 0x60(%r14), %eax
movl %eax, (%rbx,%rbp,4)
incq %rbp
jmp 0x6fed4
// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rsi, %rbx
movl (%r8), %r13d
movl 0x64(%rsi), %esi
testl %esi, %esi
je 0x6ff25
movq %rdx, %r15
imull %r13d, %esi
movq %rdx, %rdi
callq 0x6fbc2
testl %eax, %eax
je 0x6ff4b
pushq $-0x1
popq %r12
jmp 0x6ff90
testq %r14, %r14
je 0x6ff8d
xorl %r12d, %r12d
testl %r13d, %r13d
cmovlel %r12d, %r13d
xorl %eax, %eax
cmpq %rax, %r13
je 0x6ff90
movb 0x60(%rbx), %cl
xorl %edx, %edx
subb %cl, %dl
movb %dl, (%r14,%rax)
incq %rax
jmp 0x6ff36
xorl %ebp, %ebp
testl %r13d, %r13d
cmovgl %r13d, %ebp
testq %r14, %r14
je 0x6ff88
movl %ebp, %r13d
xorl %r12d, %r12d
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x6ff90
movl 0x64(%rbx), %esi
movq %r15, %rdi
callq 0x6fbfe
subl 0x60(%rbx), %eax
movb %al, (%r14,%rbp)
incq %rbp
jmp 0x6ff61
movl 0x64(%rbx), %esi
movq %r15, %rdi
callq 0x6fbfe
subl $0x1, %ebp
jae 0x6ff7d
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_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 0x700ce
movq %rax, %rbx
movl $0x6, (%rax)
leal -0x1(%r15), %eax
cmpl $0x7, %eax
jae 0x7001a
pushq $0x63
popq %rcx
btl %eax, %ecx
jae 0x7001a
movl %eax, %eax
leaq 0x2dcfc(%rip), %rcx     # 0x9dd10
movq (%rcx,%rax,8), %rax
jmp 0x7002f
addl $-0x3, %r15d
cmpl $0x2, %r15d
jae 0x700ae
leaq -0x13e(%rip), %rax      # 0x6fef1
movq %rax, 0x28(%rbx)
leaq -0x98(%rip), %rax       # 0x6ffa2
movq %rax, 0x20(%rbx)
leaq -0x9e(%rip), %rax       # 0x6ffa7
movq %rax, 0x58(%rbx)
orl $-0x1, 0x64(%rbx)
movq 0x40(%rsp), %rax
movslq %ebp, %r13
movq %rax, %rbp
leaq (%r14,%r13), %r15
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq *0x18(%rax)
movl %eax, 0x60(%rbx)
cmpq %r15, (%r12)
jae 0x7009e
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 0x700d0
leaq 0x1421b(%rip), %rsi     # 0x842c0
leaq 0x14252(%rip), %rdx     # 0x842fe
jmp 0x700bc
leaq 0x1420b(%rip), %rsi     # 0x842c0
leaq 0x1421a(%rip), %rdx     # 0x842d6
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
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_O2/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, %r15
movq %rdi, %r12
pushq $-0x1
popq %rbp
testq %rdx, %rdx
je 0x70126
movq %rdx, %rbx
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r14
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x6f15a
xorl %ecx, %ecx
testl %eax, %eax
cmovsl %ecx, %r14d
jns 0x70129
jmp 0x701ad
xorl %r14d, %r14d
movq %r14, (%rsp)
movq 0x10(%r12), %rax
movl (%r12), %esi
movq %r15, %rdi
callq *0x58(%rax)
movl %eax, %r14d
movq 0x10(%r12), %rax
movq 0x58(%rax), %r13
movslq 0x60(%r12), %rdi
callq *0x78(%rax)
movl %eax, %ebx
movq 0x10(%r12), %rax
movslq 0x64(%r12), %rdi
callq *0x78(%rax)
addl %eax, %ebx
movq %r15, %rdi
movl %ebx, %esi
callq *%r13
movl %eax, %r13d
movq 0x10(%r12), %rax
movl 0x60(%r12), %esi
movq %r15, %rdi
callq *0x58(%rax)
movl %eax, %ebx
movl %r14d, %ebp
orl %eax, %ebp
movq 0x10(%r12), %rax
movl 0x64(%r12), %esi
movq %r15, %rdi
callq *0x58(%rax)
orl %eax, %ebp
orl %r13d, %ebp
pushq $-0x1
popq %rbp
jle 0x701ad
addl (%rsp), %r14d
addl %ebx, %r14d
addl %r13d, %r14d
addl %eax, %r14d
movl %r14d, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_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
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
xorl %r12d, %r12d
testl %ecx, %ecx
cmovlel %r12d, %ebx
xorl %ebp, %ebp
cmpq %r12, %rbx
je 0x701fa
movq 0x8(%r15), %rdi
movslq 0x60(%r15), %rsi
addq (%r14,%r12,8), %rsi
movl 0x64(%r15), %edx
callq 0x70205
orl %eax, %ebp
incq %r12
jmp 0x701d9
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_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
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
xorl %r12d, %r12d
testl %ecx, %ecx
cmovlel %r12d, %ebx
xorl %ebp, %ebp
cmpq %r12, %rbx
je 0x70395
movq 0x8(%r15), %rdi
movslq (%r14,%r12,4), %rax
movslq 0x60(%r15), %rsi
addq %rax, %rsi
movl 0x64(%r15), %edx
callq 0x70205
orl %eax, %ebp
incq %r12
jmp 0x70371
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_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
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
xorl %r12d, %r12d
testl %ecx, %ecx
cmovlel %r12d, %ebx
xorl %ebp, %ebp
cmpq %r12, %rbx
je 0x703e0
movq 0x8(%r15), %rdi
movzbl (%r14,%r12), %eax
movslq 0x60(%r15), %rsi
addq %rax, %rsi
movl 0x64(%r15), %edx
callq 0x70205
orl %eax, %ebp
incq %r12
jmp 0x703bb
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_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), %eax
xorl %r12d, %r12d
testl %eax, %eax
cmovgl %eax, %r12d
cmpl $0x0, 0x60(%rsi)
je 0x705a3
movq %rdx, %r15
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x705b7
movl 0x60(%r14), %esi
movq %r15, %rdi
callq 0x6fbfe
movl 0x7c(%r14,%rax,4), %eax
movq %rax, (%rbx,%r13,8)
incq %r13
jmp 0x70584
xorl %eax, %eax
cmpq %rax, %r12
je 0x705b7
movl 0x7c(%r14), %ecx
movq %rcx, (%rbx,%rax,8)
incq %rax
jmp 0x705a5
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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), %esi
testl %esi, %esi
je 0x70607
movq %rdx, %r12
imull %r13d, %esi
movq %rdx, %rdi
callq 0x6fbc2
testl %eax, %eax
je 0x70624
pushq $-0x1
popq %r15
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
xorl %eax, %eax
cmpq %rax, %r13
je 0x705f5
movl 0x7c(%r14), %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
jmp 0x70613
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x705f5
movl 0x60(%r14), %esi
movq %r12, %rdi
callq 0x6fbfe
movl 0x7c(%r14,%rax,4), %eax
movl %eax, (%rbx,%rbp,4)
incq %rbp
jmp 0x70630
// File: /workspace/github_c_makefile_star2_O2/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 0x706a7
movq %rdi, %r12
movq %r15, %rsi
callq 0x706c9
movq 0x18(%r12), %rax
movslq 0x18(%r15), %rcx
movq 0x1000(%rax,%rcx,8), %r15
testq %r15, %r15
je 0x706c4
testq %r14, %r14
je 0x7069e
movq 0x20(%r15), %rsi
addq 0x30(%r15), %rsi
movslq (%rbx), %rdx
movq %r14, %rdi
callq 0x43c0
movslq (%rbx), %rax
addq %rax, 0x30(%r15)
jmp 0x706b6
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
pushq $-0x1
popq %rax
jmp 0x706b8
// File: /workspace/github_c_makefile_star2_O2/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 0x706fb
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 0x706eb
movq %rax, %r14
xorl %edi, %edi
xorl %esi, %esi
callq 0x3f426
movq %rax, %r15
movq 0x18(%r12), %rax
movslq 0x18(%rbx), %rcx
movq %r15, 0x1000(%rax,%rcx,8)
testq %r15, %r15
je 0x706eb
movl 0x14(%r14), %eax
shll $0x3, %eax
cltd
idivl 0x60(%rbx)
movl %eax, %ebp
movslq %eax, %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x741b0
testl %eax, %eax
js 0x706eb
movl %ebp, 0x14(%r15)
xorl %eax, %eax
cmpq $0x100, %rax            # imm = 0x100
je 0x7076b
movb 0x7c(%rbx,%rax,4), %cl
movb %cl, (%rsp,%rax)
incq %rax
jmp 0x70757
movq 0x20(%r14), %rdi
movslq 0x14(%r14), %rsi
movq 0x20(%r15), %rcx
pushq $0x8
popq %rax
xorl %edx, %edx
idivl 0x60(%rbx)
movq %rsp, %r9
movq %rcx, %rdx
movq %r12, %rcx
movl %eax, %r8d
callq 0x4e95d
jmp 0x706eb
// File: /workspace/github_c_makefile_star2_O2/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 0x707b3
pushq %rbx
movq %rdi, %rbx
movq 0x70(%rdi), %rdi
testq %rdi, %rdi
je 0x707aa
callq *0x20(%rdi)
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x70a69
movabsq $0x7e1fffffffd05, %rsi  # imm = 0x7E1FFFFFFFD05
btq %rax, %rsi
jb 0x70a69
movq %rdi, %rbx
movq 0x30(%rsp), %r15
movl %eax, %r10d
leaq 0x2cf77(%rip), %r11     # 0x9d9b0
movq %r15, (%rsp)
movq %rdx, %rsi
movl %ecx, %edx
movl %eax, %ecx
callq *(%r11,%r10,8)
testq %rax, %rax
je 0x70a9b
movq %rax, %r14
movq %r15, 0x10(%rax)
movl 0x410(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x410(%rbx)
movl %eax, 0x18(%r14)
jmp 0x70a8e
movl %eax, %edi
callq 0x7460e
leaq 0x13e82(%rip), %rsi     # 0x848f9
leaq 0x13e8d(%rip), %rdx     # 0x8490b
xorl %r14d, %r14d
pushq $0x1
popq %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x110c6
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
xorl %r14d, %r14d
jmp 0x70a8e
// File: /workspace/github_c_makefile_star2_O2/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, %r15
movq 0x8(%rdi), %rax
movq 0x20(%rax), %rdi
movq 0x30(%rax), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x4(%rsp), %rcx
leaq 0x8(%rsp), %r14
movq %r14, %r8
callq 0x4e5a4
movq %rax, %rbx
movq 0x70(%r15), %rsi
movl (%r14), %ecx
xorl %r14d, %r14d
xorl %edi, %edi
movq %rax, %rdx
callq *0x30(%rsi)
testl %eax, %eax
je 0x70af1
pushq $-0x1
popq %r14
jmp 0x70b0b
movq 0x70(%r15), %rdi
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x70b03
callq *%rax
movl %eax, %r14d
movq %rbx, %rdi
callq 0x45c0
movl %r14d, %eax
addq $0x410, %rsp            # imm = 0x410
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
xorl %r12d, %r12d
testl %ecx, %ecx
cmovlel %r12d, %ebx
xorl %ebp, %ebp
cmpq %r12, %rbx
je 0x70ce0
movq 0x8(%r15), %rdi
movq (%r14,%r12,8), %rax
movslq 0x47c(%r15,%rax,4), %rsi
movl 0x60(%r15), %edx
callq 0x70205
orl %eax, %ebp
incq %r12
jmp 0x70cbb
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_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
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
xorl %r12d, %r12d
testl %ecx, %ecx
cmovlel %r12d, %ebx
xorl %ebp, %ebp
cmpq %r12, %rbx
je 0x70d2b
movq 0x8(%r15), %rdi
movslq (%r14,%r12,4), %rax
movslq 0x47c(%r15,%rax,4), %rsi
movl 0x60(%r15), %edx
callq 0x70205
orl %eax, %ebp
incq %r12
jmp 0x70d06
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_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 0x70d6f
pushq %rbx
movq %rdi, %rbx
movq 0x70(%rdi), %rdi
testq %rdi, %rdi
je 0x70d5d
callq *0x20(%rdi)
movq 0x8(%rbx), %rdi
callq 0x3f8fc
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x70e79
movq %rax, %rbx
movl $0x33, (%rax)
cmpl $0x1, %r12d
leaq -0xc6(%rip), %rax       # 0x70ceb
leaq -0x82(%rip), %rcx       # 0x70d36
cmoveq %rax, %rcx
leaq -0x7b(%rip), %rax       # 0x70d48
cmpl $0x2, %r12d
leaq -0x12e(%rip), %rdx      # 0x70ca0
cmovneq %rcx, %rdx
movq %rax, 0x20(%rbx)
movq %rdx, 0x30(%rbx)
leaq -0x2c6(%rip), %rax      # 0x70b1b
movq %rax, 0x38(%rbx)
leaq -0x34c(%rip), %rax      # 0x70aa0
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
pushq $0x4
popq %rdx
xorl %esi, %esi
movl %ebp, %r8d
movq %r15, %r9
callq 0x70e8d
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
cmpq $0x100, %rax            # imm = 0x100
je 0x70e57
cmpl $-0x1, (%r15,%rax,4)
je 0x70e52
movslq %r13d, %rcx
incl %r13d
movl %eax, 0x7c(%rbx,%rcx,4)
incq %rax
jmp 0x70e39
cmpl 0x18(%r14), %r13d
je 0x70e7b
movq 0x2d174(%rip), %rax     # 0x9dfd8
movq (%rax), %rcx
leaq 0x134f5(%rip), %rdi     # 0x84363
pushq $0x32
popq %rsi
pushq $0x1
popq %rdx
callq 0x49b0
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_O2/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 0x70ea3
cmpl $0x0, 0x100c(%rsi)
je 0x70eb8
leal -0x3(%rdx), %eax
cmpl $0x2, %eax
ja 0x70ec8
leal -0x29(%rdi), %eax
cmpl $0x2, %eax
jae 0x70ebd
pushq $0x1
popq %rdi
jmp 0x70ec8
xorl %r15d, %r15d
jmp 0x70f28
cmpl $0x2c, %edi
pushq $0x2b
popq %rax
cmovnel %edi, %eax
movl %eax, %edi
movl %edi, %r14d
movabsq $0x7e1ffffffff85, %rax  # imm = 0x7E1FFFFFFFF85
btq %rdi, %rax
jb 0x70f31
leaq 0x2cc7e(%rip), %rax     # 0x9db60
movq %rsi, %rdi
movl %r14d, %esi
movq %rbx, %r9
callq *(%rax,%r14,8)
testq %rax, %rax
je 0x70f02
movq %rax, %r15
andq $0x0, 0x8(%rax)
movq %rbx, 0x10(%rax)
jmp 0x70f28
movl %r14d, %edi
callq 0x7460e
leaq 0x13a19(%rip), %rsi     # 0x8492a
leaq 0x13a24(%rip), %rdx     # 0x8493c
xorl %r15d, %r15d
pushq $0x1
popq %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x110c6
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
movl %r14d, %edi
callq 0x7460e
leaq 0x139ea(%rip), %rsi     # 0x8492a
leaq 0x139c4(%rip), %rdx     # 0x8490b
pushq $0x1
popq %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x110c6
callq 0x4270
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
xorl %ebx, %ebx
movslq (%r14), %rax
cmpq %rax, %rbx
jge 0x70fc1
movl $0x1, (%rsp)
movq 0x78(%r13), %rsi
movq %rbp, %rdi
movq %r12, %rdx
leaq 0x4(%rsp), %rcx
movq %rsp, %r8
callq *0x28(%rsi)
testl %eax, %eax
js 0x70fc5
movl 0x4(%rsp), %eax
movl %eax, %ecx
shrl %ecx
andl $0x1, %eax
negl %eax
xorl %ecx, %eax
addl 0x60(%r13), %eax
movl %eax, (%r15,%rbx,4)
movq %rax, 0x60(%r13)
incq %rbx
jmp 0x70f79
xorl %eax, %eax
jmp 0x70fc8
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xdelta_decode_block
int cram_xdelta_decode_block(cram_slice *slice, cram_codec *c, cram_block *in,
                             char *out_, int *out_size) {
    cram_block *out = (cram_block *)out_;
    cram_block *b = c->u.e_xdelta.sub_codec->get_block(slice, c->u.e_xdelta.sub_codec);
    int i = 0;

    const int w = c->u.xdelta.word_size;
    uint32_t npad = (w - *out_size%w)%w;
    uint32_t out_sz = *out_size + npad;
    c->u.xdelta.last = 0;  // reset for each new array

    for (i = 0; i < out_sz; i += w) {
        uint16_t v;
        // Need better interface
        char *cp = (char *)b->data + b->byte;
        char *cp_end = (char *)b->data + b->uncomp_size;
        int err = 0;
        v = c->vv->varint_get32(&cp, cp_end, &err);
        if (err)
            return -1;
        b->byte = cp - (char *)b->data;

        switch(w) {
        case 2: {
            int16_t d = unzigzag16(v), z;
            c->u.xdelta.last = d + c->u.xdelta.last;
            z = le_int2(c->u.xdelta.last);
            BLOCK_APPEND(out, &z, 2-npad);
            npad = 0;
            break;
        }
        default:
            fprintf(stderr, "Unsupported word size by XDELTA\n");
            return -1;
        }
    }

    return 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r13
movq %rcx, 0x10(%rsp)
movq %rsi, %r14
movq 0x78(%rsi), %rsi
callq *0x50(%rsi)
movq %rax, %r15
movzbl 0x68(%r14), %eax
movzwl %ax, %r12d
movl (%r13), %ebp
movl %ebp, %eax
cltd
idivl %r12d
movl %r12d, %eax
subl %edx, %eax
cwtd
idivw %r12w
movswl %dx, %eax
addl %eax, %ebp
andq $0x0, 0x60(%r14)
pushq $0x2
popq %r13
subl %eax, %r13d
xorl %ebx, %ebx
cmpl %ebp, %ebx
jae 0x710bd
movq 0x20(%r15), %rax
movq 0x30(%r15), %rcx
addq %rax, %rcx
movq %rcx, 0x8(%rsp)
movslq 0x14(%r15), %rsi
addq %rax, %rsi
andl $0x0, 0x4(%rsp)
movq 0x10(%r14), %rax
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq *0x18(%rax)
cmpl $0x0, 0x4(%rsp)
jne 0x710dd
movq 0x8(%rsp), %rcx
subq 0x20(%r15), %rcx
movq %rcx, 0x30(%r15)
cmpl $0x2, %r12d
jne 0x710c1
movzwl %ax, %ecx
shrl %ecx
andl $0x1, %eax
negl %eax
xorl %ecx, %eax
movswq %ax, %rax
addq 0x60(%r14), %rax
movq %rax, 0x60(%r14)
movw %ax, 0x2(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x2(%rsp), %rsi
movq %r13, %rdx
callq 0x6f15a
testl %eax, %eax
js 0x710dd
addl %r12d, %ebx
pushq $0x2
popq %r13
jmp 0x7102f
xorl %eax, %eax
jmp 0x710e0
movq 0x2cf10(%rip), %rax     # 0x9dfd8
movq (%rax), %rcx
leaq 0x132c4(%rip), %rdi     # 0x84396
pushq $0x20
popq %rsi
pushq $0x1
popq %rdx
callq 0x49b0
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xdelta_decode_free
void cram_xdelta_decode_free(cram_codec *c) {
    if (!c) return;

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

    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x7110d
pushq %rbx
movq %rdi, %rbx
movq 0x78(%rdi), %rdi
testq %rdi, %rdi
je 0x71104
callq *0x20(%rdi)
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xdelta_encode_store
int cram_xdelta_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;
    }

    // Store sub-codec
    cram_codec *tc = c->u.e_xdelta.sub_codec;
    cram_block *tb = cram_new_block(0, 0);
    if (!tb)
        return -1;
    int len2 = tc->store(tc, tb, NULL, version);

    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_xdelta.word_size)
                                        + len2)); r |= n;

    // This and sub-codec
    len += (n = c->vv->varint_put32_blk(b, c->u.e_xdelta.word_size)); r |= n;
    BLOCK_APPEND(b, BLOCK_DATA(tb), BLOCK_SIZE(tb));

    cram_free_block(tb);

    return r > 0 ? len + len2 : -1;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebp
movq %rsi, %r15
movq %rdi, %r12
pushq $-0x1
popq %rbx
testq %rdx, %rdx
je 0x714b9
movq %rdx, %r13
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r14
movq %r15, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x6f15a
xorl %ecx, %ecx
testl %eax, %eax
cmovsl %ecx, %r14d
jns 0x714bc
jmp 0x71574
xorl %r14d, %r14d
movq %r14, 0x10(%rsp)
movl %ebp, %r14d
movq 0x78(%r12), %rbp
xorl %edi, %edi
xorl %esi, %esi
callq 0x3f426
testq %rax, %rax
je 0x71574
movq %rax, %r13
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
movl %r14d, %ecx
callq *0x38(%rbp)
movl %eax, %ebp
movq 0x10(%r12), %rax
movl (%r12), %esi
movq %r15, %rdi
callq *0x58(%rax)
movl %eax, 0xc(%rsp)
movq 0x10(%r12), %rax
movq 0x58(%rax), %rbx
movzbl 0x68(%r12), %edi
callq *0x78(%rax)
leal (%rax,%rbp), %esi
movq %r15, %rdi
callq *%rbx
pushq $-0x1
popq %rbx
movl %eax, %r14d
movq 0x10(%r12), %rax
movzbl 0x68(%r12), %esi
movq %r15, %rdi
callq *0x58(%rax)
movl %eax, %r12d
movq 0x20(%r13), %rsi
movq 0x30(%r13), %rdx
movq %r15, %rdi
callq 0x6f15a
testl %eax, %eax
js 0x71574
movl %r14d, %ebx
movl 0xc(%rsp), %r15d
orl %r15d, %ebx
orl %r12d, %ebx
movq %r13, %rdi
callq 0x3f8fc
addl 0x10(%rsp), %ebp
addl %r15d, %ebp
addl %r14d, %ebp
addl %r12d, %ebp
testl %ebx, %ebx
pushq $-0x1
popq %rbx
cmovgl %ebp, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xdelta_encode_char
int cram_xdelta_encode_char(cram_slice *slice, cram_codec *c,
                            char *in, int in_size) {
    char *dat = malloc(in_size*5);
    if (!dat)
        return -1;
    char *cp = dat, *cp_end = dat + in_size*5;

    c->u.e_xdelta.last = 0; // reset for each new array
    if (c->u.e_xdelta.word_size == 2) {
        int i, part;

        part = in_size%2;
        if (part) {
            uint16_t z = in[0];
            c->u.e_xdelta.last = le_int2(z);
            cp += c->vv->varint_put32(cp, cp_end, zigzag16(c->u.e_xdelta.last));
        }

        uint16_t *in16 = (uint16_t *)(in+part);
        for (i = 0; i < in_size/2; i++) {
            uint16_t d = le_int2(in16[i]) - c->u.e_xdelta.last;
            c->u.e_xdelta.last = le_int2(in16[i]);
            cp += c->vv->varint_put32(cp, cp_end, zigzag16(d));
        }
    }
    if (c->u.e_xdelta.sub_codec->encode(slice, c->u.e_xdelta.sub_codec,
                                      (char *)dat, cp-dat)) {
        free(dat);
        return -1;
    }

    free(dat);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebp
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leal (%rbp,%rbp,4), %eax
movslq %eax, %r13
movq %r13, %rdi
callq 0x4680
testq %rax, %rax
je 0x71670
andq $0x0, 0x60(%r15)
cmpb $0x2, 0x68(%r15)
movq %rax, %r14
jne 0x7167f
movq %rbx, 0x10(%rsp)
addq %rax, %r13
pushq $0x2
popq %rcx
movq %rax, %rbx
movl %ebp, %eax
cltd
idivl %ecx
movq %rbp, %rcx
movl %eax, %ebp
leal (,%rbp,2), %eax
movq %rbx, %r14
subl %eax, %ecx
movq %rcx, (%rsp)
je 0x71624
movsbq (%r12), %rax
movq %rax, 0x60(%r15)
movq 0x10(%r15), %rcx
leal (%rax,%rax), %edx
sarl $0xf, %eax
xorl %edx, %eax
movzwl %ax, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq *0x38(%rcx)
cltq
movq %rbx, %r14
addq %rax, %r14
movq %rbx, 0x8(%rsp)
movslq (%rsp), %rax
addq %rax, %r12
xorl %ebx, %ebx
testl %ebp, %ebp
cmovlel %ebx, %ebp
cmpq %rbx, %rbp
je 0x71675
movswq (%r12,%rbx,2), %rax
movzwl 0x60(%r15), %ecx
movq %rax, 0x60(%r15)
subw %cx, %ax
cwtl
movq 0x10(%r15), %rcx
leal (%rax,%rax), %edx
sarl $0xf, %eax
xorl %edx, %eax
movzwl %ax, %edx
movq %r14, %rdi
movq %r13, %rsi
callq *0x38(%rcx)
cltq
addq %rax, %r14
incq %rbx
jmp 0x71637
pushq $-0x1
popq %rax
jmp 0x716a5
movq 0x10(%rsp), %rbx
movq 0x8(%rsp), %rax
movq 0x78(%r15), %rsi
subl %eax, %r14d
movq %rbx, %rdi
movq %rax, %rdx
movl %r14d, %ecx
movq %rax, %rbx
callq *0x30(%rsi)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x45c0
xorl %eax, %eax
negl %ebp
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_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xdelta_encode_free
void cram_xdelta_encode_free(cram_codec *c) {
    if (!c) return;

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

    cram_free_block(c->out);

    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x716db
pushq %rbx
movq %rdi, %rbx
movq 0x78(%rdi), %rdi
testq %rdi, %rdi
je 0x716c9
callq *0x20(%rdi)
movq 0x8(%rbx), %rdi
callq 0x3f8fc
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq