LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xdelta_encode_init
cram_codec *cram_xdelta_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_XDELTA;
    c->free   = cram_xdelta_encode_free;
    if (option == E_LONG)
        c->encode = cram_xdelta_encode_long;
    else if (option == E_INT)
        c->encode = cram_xdelta_encode_int;
    else
        c->encode = cram_xdelta_encode_char;
    c->store  = cram_xdelta_encode_store;
    c->flush  = cram_xdelta_encode_flush;

    cram_xdelta_encoder *e = (cram_xdelta_encoder *)dat;
    c->u.e_xdelta.word_size = e->word_size;
    c->u.e_xdelta.last = 0;
    c->u.e_xdelta.sub_codec = cram_encoder_init(e->sub_encoding, NULL,
                                                E_BYTE_ARRAY,
                                                e->sub_codec_dat,
                                                version, vv);

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r9, %rbx
movl %r8d, %ebp
movq %rcx, %r15
movl %edx, %r12d
movl $0x880, %edi            # imm = 0x880
callq 0x4680
movq %rax, %r14
testq %rax, %rax
je 0x7177c
movl $0x35, (%r14)
leaq -0x5c(%rip), %rax       # 0x716b4
movq %rax, 0x20(%r14)
cmpl $0x1, %r12d
leaq -0x196(%rip), %rax      # 0x71589
leaq -0x199(%rip), %rcx      # 0x7158d
cmoveq %rax, %rcx
cmpl $0x2, %r12d
leaq -0x1b0(%rip), %rax      # 0x71585
cmovneq %rcx, %rax
movq %rax, 0x30(%r14)
leaq -0x2d4(%rip), %rax      # 0x71470
movq %rax, 0x38(%r14)
leaq -0x488(%rip), %rax      # 0x712c7
movq %rax, 0x48(%r14)
movb 0x8(%r15), %al
movb %al, 0x68(%r14)
andq $0x0, 0x60(%r14)
movl 0xc(%r15), %edi
movq 0x10(%r15), %rcx
pushq $0x4
popq %rdx
xorl %esi, %esi
movl %ebp, %r8d
movq %rbx, %r9
callq 0x70e8d
movq %rax, 0x78(%r14)
movq %r14, %rax
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_xrle_decode_free
void cram_xrle_decode_free(cram_codec *c) {
    if (!c) return;

    if (c->u.xrle.len_codec)
        c->u.xrle.len_codec->free(c->u.xrle.len_codec);

    if (c->u.xrle.lit_codec)
        c->u.xrle.lit_codec->free(c->u.xrle.lit_codec);

    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x719e5
pushq %rbx
movq %rdi, %rbx
movq 0x78(%rdi), %rdi
testq %rdi, %rdi
je 0x719cd
callq *0x20(%rdi)
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x719dc
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_xrle_encode_char
int cram_xrle_encode_char(cram_slice *slice, cram_codec *c,
                          char *in, int in_size) {
    if (c->u.e_xrle.to_flush) {
        if (!c->out && !(c->out = cram_new_block(0, 0)))
            return -1;
        BLOCK_APPEND(c->out, c->u.e_xrle.to_flush, c->u.e_xrle.to_flush_size);
        c->u.e_xrle.to_flush = NULL;
        c->u.e_xrle.to_flush_size = 0;
    }

    if (c->out && BLOCK_SIZE(c->out) > 0) {
        // Gathering data
        BLOCK_APPEND(c->out, in, in_size);
        return 0;
    }

    // else cache copy of the data we're about to send to flush instead.
    c->u.e_xrle.to_flush = in;
    c->u.e_xrle.to_flush_size = in_size;
    return 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movq 0x490(%rsi), %rsi
pushq $-0x1
popq %r15
testq %rsi, %rsi
je 0x722a8
leaq 0x490(%r14), %r12
movq 0x8(%r14), %rdi
testq %rdi, %rdi
jne 0x72290
xorl %edi, %edi
xorl %esi, %esi
callq 0x3f426
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x722cb
movq %rax, %rdi
movq (%r12), %rsi
movq 0x498(%r14), %rdx
callq 0x6f15a
testl %eax, %eax
js 0x722cb
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x722d0
cmpq $0x0, 0x30(%rdi)
je 0x722d0
movslq %ebp, %rdx
movq %rbx, %rsi
callq 0x6f15a
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jns 0x722e3
movl %r15d, %eax
jmp 0x722e3
movq %rbx, 0x490(%r14)
movslq %ebp, %rax
movq %rax, 0x498(%r14)
xorl %eax, %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_xrle_encode_free
void cram_xrle_encode_free(cram_codec *c) {
    if (!c) return;

    if (c->u.e_xrle.len_codec)
        c->u.e_xrle.len_codec->free(c->u.e_xrle.len_codec);
    if (c->u.e_xrle.lit_codec)
        c->u.e_xrle.lit_codec->free(c->u.e_xrle.lit_codec);

    cram_free_block(c->out);

    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x72322
pushq %rbx
movq %rdi, %rbx
movq 0x78(%rdi), %rdi
testq %rdi, %rdi
je 0x72301
callq *0x20(%rdi)
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x72310
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_xrle_encode_init
cram_codec *cram_xrle_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_XRLE;
    c->free   = cram_xrle_encode_free;
    if (option == E_LONG)
        c->encode = cram_xrle_encode_long;
    else if (option == E_INT)
        c->encode = cram_xrle_encode_int;
    else
        c->encode = cram_xrle_encode_char;
    c->store  = cram_xrle_encode_store;
    c->flush  = cram_xrle_encode_flush;

    cram_xrle_encoder *e = (cram_xrle_encoder *)dat;

    c->u.e_xrle.len_codec = cram_encoder_init(e->len_encoding, NULL,
                                              E_BYTE, e->len_dat,
                                              version, vv);
    c->u.e_xrle.lit_codec = cram_encoder_init(e->lit_encoding, NULL,
                                              E_BYTE, e->lit_dat,
                                              version, vv);
    c->u.e_xrle.cur_lit = -1;
    c->u.e_xrle.cur_len = -1;
    c->u.e_xrle.to_flush = NULL;
    c->u.e_xrle.to_flush_size = 0;

    memcpy(c->u.e_xrle.rep_score, e->rep_score, 256*sizeof(*c->u.e_xrle.rep_score));

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r9, %r15
movl %r8d, %ebp
movq %rcx, %rbx
movl %edx, %r12d
movl $0x880, %edi            # imm = 0x880
callq 0x4680
movq %rax, %r14
testq %rax, %rax
je 0x72408
movl $0x34, (%r14)
cmpl $0x1, %r12d
leaq -0x11c(%rip), %rax      # 0x72243
leaq -0x11f(%rip), %rcx      # 0x72247
cmoveq %rax, %rcx
leaq -0x85(%rip), %rax       # 0x722ec
cmpl $0x2, %r12d
leaq -0x13d(%rip), %rdx      # 0x7223f
cmovneq %rcx, %rdx
movq %rax, 0x20(%r14)
movq %rdx, 0x30(%r14)
leaq -0x370(%rip), %rax      # 0x7201f
movq %rax, 0x38(%r14)
leaq -0x730(%rip), %rax      # 0x71c6a
movq %rax, 0x48(%r14)
movl (%rbx), %edi
movq 0x8(%rbx), %rcx
pushq $0x3
popq %r12
xorl %esi, %esi
movl %r12d, %edx
movl %ebp, %r8d
movq %r15, %r9
callq 0x70e8d
movq %rax, 0x78(%r14)
movl 0x4(%rbx), %edi
movq 0x10(%rbx), %rcx
xorl %esi, %esi
movl %r12d, %edx
movl %ebp, %r8d
movq %r15, %r9
callq 0x70e8d
movq %rax, 0x80(%r14)
orq $-0x1, 0x88(%r14)
movq %r14, %rdi
addq $0x90, %rdi
addq $0x30, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x490(%r14)
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rsi
callq 0x43c0
movq %r14, %rax
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_subexp_describe
int cram_subexp_describe(cram_codec *c, kstring_t *ks) {
    return ksprintf(ks, "SUBEXP(offset=%d,k=%d)",
                    c->u.subexp.offset,
                    c->u.subexp.k)
        < 0 ? -1 : 0;
}

// Assembly:
pushq %rax
movq %rsi, %rax
movl 0x60(%rdi), %edx
movl 0x64(%rdi), %ecx
leaq 0x11e27(%rip), %rsi     # 0x843f5
movq %rax, %rdi
xorl %eax, %eax
callq 0x8c78
sarl $0x1f, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_subexp_decode_init
cram_codec *cram_subexp_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 (option != E_INT) {
        hts_log_error("This codec only supports INT encodings");
        return NULL;
    }

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

    c->codec  = E_SUBEXP;
    c->decode = cram_subexp_decode;
    c->free   = cram_subexp_decode_free;
    c->describe = cram_subexp_describe;
    c->u.subexp.k = -1;

    c->u.subexp.offset = vv->varint_get32(&cp, data + size, NULL);
    c->u.subexp.k      = vv->varint_get32(&cp, data + size, NULL);

    if (cp - data != size || c->u.subexp.k < 0) {
        hts_log_error("Malformed subexp header stream");
        free(c);
        return NULL;
    }

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
cmpl $0x1, %r8d
jne 0x726a1
movl %edx, %ebp
movq %rsi, %r14
movl $0x880, %edi            # imm = 0x880
callq 0x4680
testq %rax, %rax
je 0x7269d
movq %rax, %rbx
movq 0x40(%rsp), %r13
movl $0x7, (%rax)
leaq -0x20f(%rip), %rax      # 0x72414
movq %rax, 0x28(%rbx)
leaq -0x76(%rip), %rax       # 0x725b8
movq %rax, 0x20(%rbx)
leaq -0x7c(%rip), %rax       # 0x725bd
movq %rax, 0x58(%rbx)
movslq %ebp, %rbp
leaq (%r14,%rbp), %r15
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq *0x18(%r13)
movl %eax, 0x60(%rbx)
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq *0x18(%r13)
movl %eax, 0x64(%rbx)
movq (%r12), %rcx
subq %r14, %rcx
cmpq %rbp, %rcx
setne %cl
testl %eax, %eax
sets %al
orb %cl, %al
cmpb $0x1, %al
jne 0x726bb
leaq 0x11d88(%rip), %rsi     # 0x8440c
leaq 0x11dc0(%rip), %rdx     # 0x8444b
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
movq %rbx, %rdi
callq 0x45c0
xorl %ebx, %ebx
jmp 0x726bb
leaq 0x11d64(%rip), %rsi     # 0x8440c
leaq 0x11d75(%rip), %rdx     # 0x84424
xorl %ebx, %ebx
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
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_gamma_decode
int cram_gamma_decode(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++) {
        int nz = 0;
        int val;
        //while (get_bit_MSB(in) == 0) nz++;
        nz = get_zero_bits_MSB(in);
        if (cram_not_enough_bits(in, nz))
            return -1;
        val = 1;
        while (nz > 0) {
            //val <<= 1; val |= get_bit_MSB(in);
            GET_BIT_MSB(in, val);
            nz--;
        }

        out_i[i] = val - c->u.gamma.offset;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, %r15
movq %rsi, 0x8(%rsp)
movl (%r8), %r13d
xorl %eax, %eax
testl %r13d, %r13d
cmovlel %eax, %r13d
pushq $0x7
popq %rbx
xorl %r14d, %r14d
cmpq %r13, %r14
je 0x727bf
movq 0x30(%r15), %r12
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jae 0x72758
movq 0x20(%r15), %rdx
movl 0x38(%r15), %ecx
pushq $-0x1
popq %rbp
movzbl (%rdx,%r12), %esi
shrl %cl, %esi
subl $0x1, %ecx
movl %ecx, 0x38(%r15)
jae 0x7274a
movl $0x7, 0x38(%r15)
incq %r12
movq %r12, 0x30(%r15)
andl $0x1, %esi
movl %ebx, %ecx
cmpq %rax, %r12
jne 0x7274d
testl %esi, %esi
jne 0x7274d
jmp 0x72755
andl $0x1, %esi
incl %ebp
testl %esi, %esi
je 0x7271b
jmp 0x7275b
movq %rax, %r12
pushq $-0x1
popq %rbp
movq %r15, %rdi
movl %ebp, %esi
callq 0x6fbc2
testl %eax, %eax
jne 0x727c3
pushq $0x1
popq %rax
testl %ebp, %ebp
jle 0x727a6
movq 0x20(%r15), %rcx
movzbl (%rcx,%r12), %ecx
movl 0x38(%r15), %edx
xorl %esi, %esi
btl %edx, %ecx
setb %sil
leal (%rsi,%rax,2), %eax
leal -0x1(%rdx), %ecx
xorl %esi, %esi
testl %edx, %edx
setle %sil
addq %rsi, %r12
movq %r12, 0x30(%r15)
andl $0x7, %ecx
movl %ecx, 0x38(%r15)
decl %ebp
jmp 0x7276c
movq 0x8(%rsp), %rcx
subl 0x60(%rcx), %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx,%r14,4)
incq %r14
jmp 0x726fa
xorl %eax, %eax
jmp 0x727c6
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_gamma_decode_init
cram_codec *cram_gamma_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 = NULL;
    char *cp = data;

    if (option != E_INT) {
        hts_log_error("This codec only supports INT encodings");
        return NULL;
    }

    if (size < 1)
        goto malformed;

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

    c->codec  = E_GAMMA;
    c->decode = cram_gamma_decode;
    c->free   = cram_gamma_decode_free;
    c->describe = cram_gamma_describe;

    c->u.gamma.offset = vv->varint_get32(&cp, data+size, NULL);

    if (cp - data != size)
        goto malformed;

    return c;

 malformed:
    hts_log_error("Malformed gamma header stream");
    free(c);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, 0x8(%rsp)
cmpl $0x1, %r8d
jne 0x72881
movl %edx, %ebp
testl %edx, %edx
jle 0x7289d
movq %rsi, %r14
movl $0x880, %edi            # imm = 0x880
callq 0x4680
testq %rax, %rax
je 0x728bf
movq %rax, %rbx
movq 0x40(%rsp), %rax
movl $0x9, (%rbx)
leaq -0x176(%rip), %rcx      # 0x726cd
movq %rcx, 0x28(%rbx)
leaq -0x79(%rip), %rcx       # 0x727d5
movq %rcx, 0x20(%rbx)
leaq -0x7f(%rip), %rcx       # 0x727da
movq %rcx, 0x58(%rbx)
movl %ebp, %r12d
leaq (%r14,%r12), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
xorl %edx, %edx
callq *0x18(%rax)
movl %eax, 0x60(%rbx)
movq (%r15), %rax
subq %r14, %rax
cmpq %r12, %rax
jne 0x7289f
jmp 0x728c1
leaq 0x11bf3(%rip), %rsi     # 0x8447b
leaq 0x11b95(%rip), %rdx     # 0x84424
xorl %ebx, %ebx
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
jmp 0x728c1
xorl %ebx, %ebx
leaq 0x11bd5(%rip), %rsi     # 0x8447b
leaq 0x11be5(%rip), %rdx     # 0x84492
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
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_huffman_decode_free
void cram_huffman_decode_free(cram_codec *c) {
    if (!c)
        return;

    if (c->u.huffman.codes)
        free(c->u.huffman.codes);
    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x728ec
pushq %rbx
movq %rdi, %rbx
movq 0x68(%rdi), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_char0
int cram_huffman_decode_char0(cram_slice *slice, cram_codec *c,
                              cram_block *in, char *out, int *out_size) {
    int i, n;

    if (!out)
        return 0;

    /* Special case of 0 length codes */
    for (i = 0, n = *out_size; i < n; i++) {
        out[i] = c->u.huffman.codes[0].symbol;
    }
    return 0;
}

// Assembly:
testq %rcx, %rcx
je 0x72915
movl (%r8), %eax
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
cmpq %rdx, %rax
je 0x72915
movq 0x68(%rsi), %rdi
movb (%rdi), %dil
movb %dil, (%rcx,%rdx)
incq %rdx
jmp 0x72900
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_char
int cram_huffman_decode_char(cram_slice *slice, cram_codec *c,
                             cram_block *in, char *out, int *out_size) {
    int i, n, ncodes = c->u.huffman.ncodes;
    const cram_huffman_code * const codes = c->u.huffman.codes;

    for (i = 0, n = *out_size; i < n; i++) {
        int idx = 0;
        int val = 0, len = 0, last_len = 0;

        for (;;) {
            int dlen = codes[idx].len - last_len;
            if (cram_not_enough_bits(in, dlen))
                return -1;

            //val <<= dlen;
            //val  |= get_bits_MSB(in, dlen);
            //last_len = (len += dlen);

            last_len = (len += dlen);
            for (; dlen; dlen--) GET_BIT_MSB(in, val);

            idx = val - codes[idx].p;
            if (idx >= ncodes || idx < 0)
                return -1;

            if (codes[idx].code == val && codes[idx].len == len) {
                if (out) out[i] = codes[idx].symbol;
                break;
            }
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movl 0x60(%rsi), %eax
movl %eax, 0xc(%rsp)
movq 0x68(%rsi), %r12
movl (%r8), %edx
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
xorl %esi, %esi
movq %rcx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
cmpq %rdx, %rsi
je 0x72a28
movq %rsi, 0x20(%rsp)
xorl %eax, %eax
xorl %r14d, %r14d
xorl %ebx, %ebx
movl %eax, %eax
imulq $0x18, %rax, %rbp
movl 0x10(%r12,%rbp), %r13d
movl %r13d, %esi
subl %ebx, %esi
movq %r15, %rdi
callq 0x6fbc2
testl %eax, %eax
jne 0x72a16
addq %r12, %rbp
cmpl %ebx, %r13d
je 0x729c1
movq 0x20(%r15), %rax
movq 0x30(%r15), %rcx
movzbl (%rax,%rcx), %eax
movl 0x38(%r15), %edx
xorl %esi, %esi
btl %edx, %eax
setb %sil
leal (%rsi,%r14,2), %r14d
leal -0x1(%rdx), %eax
xorl %esi, %esi
testl %edx, %edx
setle %sil
addq %rcx, %rsi
movq %rsi, 0x30(%r15)
andl $0x7, %eax
movl %eax, 0x38(%r15)
incl %ebx
jmp 0x72982
movl %r14d, %eax
subl 0x8(%rbp), %eax
cmpl 0xc(%rsp), %eax
jge 0x72a16
testl %eax, %eax
js 0x72a16
movl %eax, %ecx
imulq $0x18, %rcx, %rdx
movl %r13d, %ebx
cmpl %r14d, 0xc(%r12,%rdx)
jne 0x7295f
addq %r12, %rdx
movl %r13d, %ebx
cmpl %r13d, 0x10(%rdx)
jne 0x7295f
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
movq 0x20(%rsp), %rsi
je 0x72a09
movb (%rdx), %al
movb %al, (%rcx,%rsi)
incq %rsi
movq 0x10(%rsp), %rdx
jmp 0x7294a
pushq $-0x1
popq %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x72a19
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_int0
int cram_huffman_decode_int0(cram_slice *slice, cram_codec *c,
                             cram_block *in, char *out, int *out_size) {
    int32_t *out_i = (int32_t *)out;
    int i, n;
    const cram_huffman_code * const codes = c->u.huffman.codes;

    /* Special case of 0 length codes */
    for (i = 0, n = *out_size; i < n; i++) {
        out_i[i] = codes[0].symbol;
    }
    return 0;
}

// Assembly:
movq 0x68(%rsi), %rax
movl (%r8), %edx
xorl %esi, %esi
testl %edx, %edx
cmovlel %esi, %edx
cmpq %rsi, %rdx
je 0x72a49
movl (%rax), %edi
movl %edi, (%rcx,%rsi,4)
incq %rsi
jmp 0x72a3a
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_int
int cram_huffman_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, ncodes = c->u.huffman.ncodes;
    const cram_huffman_code * const codes = c->u.huffman.codes;

    for (i = 0, n = *out_size; i < n; i++) {
        int idx = 0;
        int val = 0, len = 0, last_len = 0;

        // Now one bit at a time for remaining checks
        for (;;) {
            int dlen = codes[idx].len - last_len;
            if (cram_not_enough_bits(in, dlen))
                return -1;

            //val <<= dlen;
            //val  |= get_bits_MSB(in, dlen);
            //last_len = (len += dlen);

            last_len = (len += dlen);
            for (; dlen; dlen--) GET_BIT_MSB(in, val);

            idx = val - codes[idx].p;
            if (idx >= ncodes || idx < 0)
                return -1;

            if (codes[idx].code == val && codes[idx].len == len) {
                out_i[i] = codes[idx].symbol;
                break;
            }
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, 0x18(%rsp)
movq %rdx, %r15
movl 0x60(%rsi), %eax
movl %eax, 0xc(%rsp)
movq 0x68(%rsi), %r12
movl (%r8), %ecx
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %ecx
xorl %eax, %eax
movq %rcx, 0x10(%rsp)
cmpq %rcx, %rax
je 0x72b5a
movq %rax, 0x20(%rsp)
xorl %eax, %eax
xorl %r14d, %r14d
xorl %ebx, %ebx
movl %eax, %eax
imulq $0x18, %rax, %rbp
movl 0x10(%r12,%rbp), %r13d
movl %r13d, %esi
subl %ebx, %esi
movq %r15, %rdi
callq 0x6fbc2
testl %eax, %eax
jne 0x72b48
addq %r12, %rbp
cmpl %ebx, %r13d
je 0x72af5
movq 0x20(%r15), %rax
movq 0x30(%r15), %rcx
movzbl (%rax,%rcx), %eax
movl 0x38(%r15), %edx
xorl %esi, %esi
btl %edx, %eax
setb %sil
leal (%rsi,%r14,2), %r14d
leal -0x1(%rdx), %eax
xorl %esi, %esi
testl %edx, %edx
setle %sil
addq %rcx, %rsi
movq %rsi, 0x30(%r15)
andl $0x7, %eax
movl %eax, 0x38(%r15)
incl %ebx
jmp 0x72ab6
movl %r14d, %eax
subl 0x8(%rbp), %eax
cmpl 0xc(%rsp), %eax
jge 0x72b48
testl %eax, %eax
js 0x72b48
movl %eax, %ecx
imulq $0x18, %rcx, %rcx
movl %r13d, %ebx
cmpl %r14d, 0xc(%r12,%rcx)
jne 0x72a93
addq %r12, %rcx
movl %r13d, %ebx
cmpl %r13d, 0x10(%rcx)
jne 0x72a93
movl (%rcx), %eax
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rdx
movl %eax, (%rcx,%rdx,4)
movq %rdx, %rax
incq %rax
movq 0x10(%rsp), %rcx
jmp 0x72a7e
pushq $-0x1
popq %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x72b4b
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_long0
int cram_huffman_decode_long0(cram_slice *slice, cram_codec *c,
                              cram_block *in, char *out, int *out_size) {
    int64_t *out_i = (int64_t *)out;
    int i, n;
    const cram_huffman_code * const codes = c->u.huffman.codes;

    /* Special case of 0 length codes */
    for (i = 0, n = *out_size; i < n; i++) {
        out_i[i] = codes[0].symbol;
    }
    return 0;
}

// Assembly:
movq 0x68(%rsi), %rax
movl (%r8), %edx
xorl %esi, %esi
testl %edx, %edx
cmovlel %esi, %edx
cmpq %rsi, %rdx
je 0x72b7d
movq (%rax), %rdi
movq %rdi, (%rcx,%rsi,8)
incq %rsi
jmp 0x72b6c
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_huffman_describe
int cram_huffman_describe(cram_codec *c, kstring_t *ks) {
    int r = 0, n;
    r |= ksprintf(ks, "HUFFMAN(codes={") < 0;
    for (n = 0; n < c->u.huffman.ncodes; n++) {
        r |= ksprintf(ks, "%s%"PRId64, n?",":"",
                      c->u.huffman.codes[n].symbol);
    }
    r |= ksprintf(ks, "},lengths={") < 0;
    for (n = 0; n < c->u.huffman.ncodes; n++) {
        r |= ksprintf(ks, "%s%d", n?",":"",
                      c->u.huffman.codes[n].len);
    }
    r |= ksprintf(ks, "})") < 0;
    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x11804(%rip), %rsi     # 0x844b0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8c78
movl %eax, %ebp
shrl $0x1f, %ebp
leaq 0x7164(%rip), %r12      # 0x79e26
xorl %r15d, %r15d
xorl %r13d, %r13d
movslq 0x60(%r14), %rax
cmpq %rax, %r13
jge 0x72d06
testq %r15, %r15
movq %r12, %rdx
leaq 0x5078(%rip), %rax      # 0x77d56
cmoveq %rax, %rdx
movq 0x68(%r14), %rax
movq (%rax,%r15), %rcx
movq %rbx, %rdi
leaq 0x117cc(%rip), %rsi     # 0x844c0
xorl %eax, %eax
callq 0x8c78
orl %eax, %ebp
incq %r13
addq $0x18, %r15
jmp 0x72cc8
leaq 0x117b9(%rip), %rsi     # 0x844c6
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8c78
movl %eax, %r15d
shrl $0x1f, %r15d
orl %ebp, %r15d
xorl %ebp, %ebp
xorl %r13d, %r13d
movslq 0x60(%r14), %rax
cmpq %rax, %r13
jge 0x72d65
testq %rbp, %rbp
movq %r12, %rdx
leaq 0x501a(%rip), %rax      # 0x77d56
cmoveq %rax, %rdx
movq 0x68(%r14), %rax
movl 0x10(%rax,%rbp), %ecx
movq %rbx, %rdi
leaq 0x11780(%rip), %rsi     # 0x844d2
xorl %eax, %eax
callq 0x8c78
orl %eax, %r15d
incq %r13
addq $0x18, %rbp
jmp 0x72d26
leaq 0x1176b(%rip), %rsi     # 0x844d7
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8c78
shrl $0x1f, %eax
orl %r15d, %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_huffman_encode_char
int cram_huffman_encode_char(cram_slice *slice, cram_codec *c,
                             char *in, int in_size) {
    int i, code, len, r = 0;
    unsigned char *syms = (unsigned char *)in;

    while (in_size--) {
        int sym = *syms++;
        if (sym >= -1 && sym < MAX_HUFF) {
            i = c->u.e_huffman.val2code[sym+1];
            assert(c->u.e_huffman.codes[i].symbol == sym);
            code = c->u.e_huffman.codes[i].code;
            len  = c->u.e_huffman.codes[i].len;
        } else {
            /* Slow - use a lookup table for when sym < MAX_HUFF? */
            for (i = 0; i < c->u.e_huffman.nvals; i++) {
                if (c->u.e_huffman.codes[i].symbol == sym)
                    break;
            }
            if (i == c->u.e_huffman.nvals)
                return -1;

            code = c->u.e_huffman.codes[i].code;
            len  = c->u.e_huffman.codes[i].len;
        }

        r |= store_bits_MSB(c->out, code, len);
    }

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
xorl %ebx, %ebx
pushq $-0x1
popq %r12
subl $0x1, %ebp
jb 0x7322a
movzbl (%r14), %eax
testb %al, %al
js 0x731d6
movslq 0x70(%r15,%rax,4), %rdx
movq 0x60(%r15), %rcx
imulq $0x18, %rdx, %rdx
cmpq %rax, (%rcx,%rdx)
jne 0x73235
addq %rdx, %rcx
jmp 0x73210
movl 0x68(%r15), %ecx
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
xorl %edi, %edi
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x73202
movq 0x60(%r15), %r8
cmpq %rax, (%r8,%rdi)
je 0x73200
incq %rsi
addq $0x18, %rdi
jmp 0x731e8
movl %esi, %edx
cmpl %ecx, %edx
je 0x73227
movl %edx, %eax
imulq $0x18, %rax, %rcx
addq 0x60(%r15), %rcx
incq %r14
movl 0x10(%rcx), %edx
movslq 0xc(%rcx), %rsi
movq 0x8(%r15), %rdi
callq 0x70205
orl %eax, %ebx
jmp 0x731b1
movl %r12d, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11368(%rip), %rdi     # 0x845a4
leaq 0x11387(%rip), %rsi     # 0x845ca
leaq 0x11393(%rip), %rcx     # 0x845dd
movl $0xba9, %edx            # imm = 0xBA9
callq 0x42f0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_huffman_encode_long
int cram_huffman_encode_long(cram_slice *slice, cram_codec *c,
                             char *in, int in_size) {
    int i, code, len, r = 0;
    int64_t *syms = (int64_t *)in;

    while (in_size--) {
        int sym = *syms++;

        if (sym >= -1 && sym < MAX_HUFF) {
            i = c->u.e_huffman.val2code[sym+1];
            assert(c->u.e_huffman.codes[i].symbol == sym);
            code = c->u.e_huffman.codes[i].code;
            len  = c->u.e_huffman.codes[i].len;
        } else {
            /* Slow - use a lookup table for when sym < MAX_HUFFMAN_SYM? */
            for (i = 0; i < c->u.e_huffman.nvals; i++) {
                if (c->u.e_huffman.codes[i].symbol == sym)
                    break;
            }
            if (i == c->u.e_huffman.nvals)
                return -1;

            code = c->u.e_huffman.codes[i].code;
            len  = c->u.e_huffman.codes[i].len;
        }

        r |= store_bits_MSB(c->out, code, len);
    }

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
xorl %ebx, %ebx
pushq $-0x1
popq %r12
subl $0x1, %ebp
jb 0x733c1
movq (%r14), %rcx
leal 0x1(%rcx), %eax
cmpl $0x81, %eax
jae 0x73366
leal 0x1(%rcx), %eax
movslq 0x6c(%r15,%rax,4), %rdx
movq 0x60(%r15), %rax
imulq $0x18, %rdx, %rdx
movslq %ecx, %rcx
cmpq %rcx, (%rax,%rdx)
jne 0x733cc
addq %rdx, %rax
jmp 0x733a3
movl 0x68(%r15), %eax
movslq %ecx, %rdx
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
xorl %edi, %edi
xorl %esi, %esi
cmpq %rsi, %rcx
je 0x73395
movq 0x60(%r15), %r8
cmpq %rdx, (%r8,%rdi)
je 0x73393
incq %rsi
addq $0x18, %rdi
jmp 0x7337b
movl %esi, %ecx
cmpl %eax, %ecx
je 0x733be
movl %ecx, %eax
imulq $0x18, %rax, %rax
addq 0x60(%r15), %rax
addq $0x8, %r14
movl 0x10(%rax), %edx
movslq 0xc(%rax), %rsi
movq 0x8(%r15), %rdi
callq 0x70205
orl %eax, %ebx
jmp 0x73332
movl %r12d, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x111d1(%rip), %rdi     # 0x845a4
leaq 0x111f0(%rip), %rsi     # 0x845ca
leaq 0x11287(%rip), %rcx     # 0x84668
movl $0xbf3, %edx            # imm = 0xBF3
callq 0x42f0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_huffman_encode_free
void cram_huffman_encode_free(cram_codec *c) {
    if (!c)
        return;

    if (c->u.e_huffman.codes)
        free(c->u.e_huffman.codes);
    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x73406
pushq %rbx
movq %rdi, %rbx
movq 0x60(%rdi), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_byte_array_len_decode
int cram_byte_array_len_decode(cram_slice *slice, cram_codec *c,
                               cram_block *in, char *out,
                               int *out_size) {
    /* Fetch length */
    int32_t len = 0, one = 1;
    int r;

    r = c->u.byte_array_len.len_codec->decode(slice, c->u.byte_array_len.len_codec,
                                              in, (char *)&len, &one);
    //printf("ByteArray Len=%d\n", len);

    if (!r && c->u.byte_array_len.val_codec && len >= 0) {
        r = c->u.byte_array_len.val_codec->decode(slice,
                                                  c->u.byte_array_len.val_codec,
                                                  in, out, &len);
    } else {
        return -1;
    }

    *out_size = len;

    return r;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r13
leaq 0x8(%rsp), %rcx
andl $0x0, (%rcx)
movq %rdi, %r12
leaq 0xc(%rsp), %r8
movl $0x1, (%r8)
movq 0x60(%rsi), %rsi
callq *0x28(%rsi)
movl %eax, %ecx
pushq $-0x1
popq %rax
testl %ecx, %ecx
jne 0x73b45
movq 0x68(%r13), %rsi
testq %rsi, %rsi
je 0x73b45
cmpl $0x0, 0x8(%rsp)
js 0x73b45
leaq 0x8(%rsp), %r13
movq %r12, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %r13, %r8
callq *0x28(%rsi)
movl (%r13), %ecx
movl %ecx, (%rbx)
addq $0x10, %rsp
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_byte_array_len_decode_free
void cram_byte_array_len_decode_free(cram_codec *c) {
    if (!c) return;

    if (c->u.byte_array_len.len_codec)
        c->u.byte_array_len.len_codec->free(c->u.byte_array_len.len_codec);

    if (c->u.byte_array_len.val_codec)
        c->u.byte_array_len.val_codec->free(c->u.byte_array_len.val_codec);

    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x73b7d
pushq %rbx
movq %rdi, %rbx
movq 0x60(%rdi), %rdi
testq %rdi, %rdi
je 0x73b68
callq *0x20(%rdi)
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x73b74
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_byte_array_len_describe
int cram_byte_array_len_describe(cram_codec *c, kstring_t *ks) {
    int r = 0;
    r |= ksprintf(ks, "BYTE_ARRAY_LEN(len_codec={") < 0;
    cram_byte_array_len_decoder *l = &c->u.byte_array_len;
    r |=  l->len_codec->describe
        ? l->len_codec->describe(l->len_codec, ks)
        : (ksprintf(ks, "?")<0);
    r |= ksprintf(ks, "},val_codec={") < 0;
    r |=  l->val_codec->describe
        ? l->val_codec->describe(l->val_codec, ks)
        : (ksprintf(ks, "?")<0);
    r |= ksprintf(ks, "}") < 0;

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x10bdb(%rip), %rsi     # 0x8476e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8c78
movl %eax, %ebp
movq 0x60(%r12), %rdi
movq 0x58(%rdi), %rax
testq %rax, %rax
je 0x73bb7
movq %rbx, %rsi
callq *%rax
movl %eax, %r14d
jmp 0x73bcf
leaq 0x639c(%rip), %rsi      # 0x79f5a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8c78
movl %eax, %r14d
shrl $0x1f, %r14d
leaq 0x10bb3(%rip), %rsi     # 0x84789
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8c78
movl %eax, %r15d
movq 0x68(%r12), %rdi
movq 0x58(%rdi), %rax
testq %rax, %rax
je 0x73bfb
movq %rbx, %rsi
callq *%rax
movl %eax, %r12d
jmp 0x73c13
leaq 0x6358(%rip), %rsi      # 0x79f5a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8c78
movl %eax, %r12d
shrl $0x1f, %r12d
orl %ebp, %r15d
shrl $0x1f, %r15d
orl %r14d, %r15d
leaq 0x7137(%rip), %rsi      # 0x7ad5b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8c78
shrl $0x1f, %eax
orl %r12d, %eax
orl %r15d, %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_byte_array_len_encode
int cram_byte_array_len_encode(cram_slice *slice, cram_codec *c,
                               char *in, int in_size) {
    int32_t i32 = in_size;
    int r = 0;

    r |= c->u.e_byte_array_len.len_codec->encode(slice,
                                                 c->u.e_byte_array_len.len_codec,
                                                 (char *)&i32, 1);
    r |= c->u.e_byte_array_len.val_codec->encode(slice,
                                                 c->u.e_byte_array_len.val_codec,
                                                 in, in_size);
    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0xc(%rsp), %rdx
movl %ecx, (%rdx)
movq 0x78(%rsi), %rsi
pushq $0x1
popq %rcx
callq *0x30(%rsi)
movl %eax, %ebp
movq 0x80(%r15), %rsi
movq %r12, %rdi
movq %r14, %rdx
movl %ebx, %ecx
callq *0x30(%rsi)
orl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_byte_array_len_encode_free
void cram_byte_array_len_encode_free(cram_codec *c) {
    if (!c)
        return;

    if (c->u.e_byte_array_len.len_codec)
        c->u.e_byte_array_len.len_codec->free(c->u.e_byte_array_len.len_codec);

    if (c->u.e_byte_array_len.val_codec)
        c->u.e_byte_array_len.val_codec->free(c->u.e_byte_array_len.val_codec);

    free(c);
}

// Assembly:
testq %rdi, %rdi
je 0x73e7b
pushq %rbx
movq %rdi, %rbx
movq 0x78(%rdi), %rdi
testq %rdi, %rdi
je 0x73e63
callq *0x20(%rdi)
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x73e72
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_byte_array_len_encode_store
int cram_byte_array_len_encode_store(cram_codec *c, cram_block *b,
                                     char *prefix, int version) {
    int len = 0, len2, len3, r = 0, n;
    cram_codec *tc;
    cram_block *b_len = NULL, *b_val = NULL;

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

    tc = c->u.e_byte_array_len.len_codec;
    b_len = cram_new_block(0, 0);
    if (!b_len) goto block_err;
    len2 = tc->store(tc, b_len, NULL, version);
    if (len2 < 0) goto block_err;

    tc = c->u.e_byte_array_len.val_codec;
    b_val = cram_new_block(0, 0);
    if (!b_val) goto block_err;
    len3 = tc->store(tc, b_val, NULL, version);
    if (len3 < 0) goto block_err;

    len += (n = c->vv->varint_put32_blk(b, c->codec));  r |= n;
    len += (n = c->vv->varint_put32_blk(b, len2+len3)); r |= n;
    BLOCK_APPEND(b, BLOCK_DATA(b_len), BLOCK_SIZE(b_len));
    BLOCK_APPEND(b, BLOCK_DATA(b_val), BLOCK_SIZE(b_val));

    cram_free_block(b_len);
    cram_free_block(b_val);

    if (r > 0)
        return len + len2 + len3;

 block_err:
    if (b_len) cram_free_block(b_len);
    if (b_val) cram_free_block(b_val);
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movq %rsi, %r12
movq %rdi, %rbp
pushq $-0x1
popq %r13
testq %rdx, %rdx
je 0x73ec0
movq %rdx, %r14
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r15
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x6f15a
testl %eax, %eax
jns 0x73ec3
jmp 0x73fd1
xorl %r15d, %r15d
movq %r15, 0x10(%rsp)
movq 0x78(%rbp), %r14
xorl %edi, %edi
xorl %esi, %esi
callq 0x3f426
testq %rax, %rax
je 0x73fd1
movq %rax, %r15
xorl %r13d, %r13d
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
movl %ebx, %ecx
callq *0x38(%r14)
testl %eax, %eax
js 0x73fb8
movq %rax, 0x8(%rsp)
movq 0x80(%rbp), %r14
xorl %edi, %edi
xorl %esi, %esi
callq 0x3f426
testq %rax, %rax
je 0x73fb5
movq %rax, %r13
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
movl %ebx, %ecx
callq *0x38(%r14)
testl %eax, %eax
js 0x73fb8
movl %eax, %ebx
movq 0x10(%rbp), %rax
movl (%rbp), %esi
movq %r12, %rdi
callq *0x58(%rax)
movl %eax, 0x4(%rsp)
movq 0x10(%rbp), %rax
movq 0x8(%rsp), %rcx
leal (%rbx,%rcx), %esi
movq %r12, %rdi
callq *0x58(%rax)
movl %eax, %ebp
movq 0x20(%r15), %rsi
movq 0x30(%r15), %rdx
movq %r12, %rdi
callq 0x6f15a
testl %eax, %eax
js 0x73fb8
movq 0x20(%r13), %rsi
movq 0x30(%r13), %rdx
movq %r12, %rdi
callq 0x6f15a
testl %eax, %eax
js 0x73fb8
movl %ebp, %r14d
movl 0x4(%rsp), %r12d
orl %r12d, %r14d
movq %r15, %rdi
callq 0x3f8fc
movq %r13, %rdi
callq 0x3f8fc
testl %r14d, %r14d
movq 0x8(%rsp), %rax
jle 0x73fb8
addl 0x10(%rsp), %eax
addl %r12d, %ebx
addl %eax, %ebx
addl %ebp, %ebx
movl %ebx, %r13d
jmp 0x73fd1
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x3f8fc
testq %r13, %r13
je 0x73fcd
movq %r13, %rdi
callq 0x3f8fc
pushq $-0x1
popq %r13
movl %r13d, %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_byte_array_len_encode_init
cram_codec *cram_byte_array_len_encode_init(cram_stats *st,
                                            enum cram_encoding codec,
                                            enum cram_external_type option,
                                            void *dat,
                                            int version, varint_vec *vv) {
    cram_codec *c;
    cram_byte_array_len_encoder *e = (cram_byte_array_len_encoder *)dat;

    c = malloc(sizeof(*c));
    if (!c)
        return NULL;
    c->codec = E_BYTE_ARRAY_LEN;
    c->free = cram_byte_array_len_encode_free;
    c->encode = cram_byte_array_len_encode;
    c->store = cram_byte_array_len_encode_store;
    c->flush = NULL;

    c->u.e_byte_array_len.len_codec = cram_encoder_init(e->len_encoding,
                                                        st, E_INT,
                                                        e->len_dat,
                                                        version, vv);
    c->u.e_byte_array_len.val_codec = cram_encoder_init(e->val_encoding,
                                                        NULL, E_BYTE_ARRAY,
                                                        e->val_dat,
                                                        version, vv);

    if (!c->u.e_byte_array_len.len_codec ||
        !c->u.e_byte_array_len.val_codec) {
        cram_byte_array_len_encode_free(c);
        return NULL;
    }

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r9, %r14
movl %r8d, %ebp
movq %rcx, %r15
movq %rdi, %r12
movl $0x880, %edi            # imm = 0x880
callq 0x4680
testq %rax, %rax
je 0x74091
movq %rax, %rbx
movl $0x4, (%rax)
leaq -0x1cc(%rip), %rax      # 0x73e4e
movq %rax, 0x20(%rbx)
leaq -0x222(%rip), %rax      # 0x73e03
movq %rax, 0x30(%rbx)
leaq -0x1b4(%rip), %rax      # 0x73e7c
movq %rax, 0x38(%rbx)
andq $0x0, 0x48(%rbx)
movl (%r15), %edi
movq 0x8(%r15), %rcx
pushq $0x1
popq %rdx
movq %r12, %rsi
movl %ebp, %r8d
movq %r14, %r9
callq 0x70e8d
movq %rax, %r12
movq %rax, 0x78(%rbx)
movl 0x4(%r15), %edi
movq 0x10(%r15), %rcx
pushq $0x4
popq %rdx
xorl %esi, %esi
movl %ebp, %r8d
movq %r14, %r9
callq 0x70e8d
movq %rax, 0x80(%rbx)
testq %r12, %r12
sete %cl
testq %rax, %rax
sete %al
orb %cl, %al
cmpb $0x1, %al
jne 0x74093
movq %rbx, %rdi
callq 0x73e4e
xorl %ebx, %ebx
movq %rbx, %rax
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_byte_array_stop_decode_block
int cram_byte_array_stop_decode_block(cram_slice *slice, cram_codec *c,
                                      cram_block *in, char *out_,
                                      int *out_size) {
    cram_block *b;
    cram_block *out = (cram_block *)out_;
    unsigned char *cp, *cp_end;
    unsigned char stop;

    b = cram_get_block_by_id(slice, c->u.byte_array_stop.content_id);
    if (!b)
        return *out_size?-1:0;

    if (b->idx >= b->uncomp_size)
        return -1;
    cp = b->data + b->idx;
    cp_end = b->data + b->uncomp_size;

    // STOP byte is hard-coded as zero by our name tokeniser decoder
    // implementation, so we may ignore what was requested.
    stop = b->orig_method == TOK3 ? 0 : c->u.byte_array_stop.stop;

    if (cp_end - cp < out->alloc - out->byte) {
        unsigned char *out_cp = BLOCK_END(out);
        while (cp != cp_end && *cp != stop)
            *out_cp++ = *cp++;
        BLOCK_SIZE(out) = out_cp - BLOCK_DATA(out);
    } else {
        unsigned char *cp_start;
        for (cp_start = cp; cp != cp_end && *cp != stop; cp++)
            ;
        BLOCK_APPEND(out, cp_start, cp - cp_start);
        BLOCK_GROW(out, cp - cp_start);
    }

    *out_size = cp - (b->data + b->idx);
    b->idx = cp - b->data + 1;

    return 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r15
movq %rsi, %r12
movl 0x64(%rsi), %esi
callq 0x6edca
testq %rax, %rax
je 0x7412c
movq %rax, %r14
movslq 0x1c(%rax), %rdx
movslq 0x14(%rax), %rax
pushq $-0x1
popq %rbp
cmpl %eax, %edx
jge 0x7419f
movq 0x20(%r14), %r13
xorl %ecx, %ecx
cmpl $0x8, 0x4(%r14)
je 0x740e9
movzbl 0x60(%r12), %ecx
leaq (%rdx,%r13), %rsi
addq %rax, %r13
subq %rdx, %rax
movq 0x28(%r15), %rdx
movq 0x30(%r15), %rdi
subq %rdi, %rdx
cmpq %rdx, %rax
jae 0x74134
addq 0x20(%r15), %rdi
movq %rdi, %rdx
negq %rdx
testq %rax, %rax
je 0x7414e
movzbl (%rsi), %r8d
cmpl %r8d, %ecx
je 0x7414b
incq %rsi
movb %r8b, (%rdi)
incq %rdi
decq %rax
decq %rdx
jmp 0x7410d
xorl %ebp, %ebp
cmpl (%rbx), %ebp
sbbl %ebp, %ebp
jmp 0x7419f
movq %rsi, %rdx
testq %rax, %rax
je 0x7415e
movzbl (%rdx), %edi
cmpl %edi, %ecx
je 0x7415b
incq %rdx
decq %rax
jmp 0x74137
movq %rsi, %r13
addq 0x20(%r15), %rdx
negq %rdx
movq %rdx, 0x30(%r15)
jmp 0x74182
movq %rdx, %r13
movq %r13, %r12
subq %rsi, %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x6f15a
testl %eax, %eax
js 0x7419f
movq %r15, %rdi
movq %r12, %rsi
callq 0x741b0
testl %eax, %eax
js 0x7419f
movl 0x20(%r14), %eax
movl 0x1c(%r14), %ecx
addl %eax, %ecx
movl %r13d, %edx
subl %ecx, %edx
movl %edx, (%rbx)
subl %eax, %r13d
incl %r13d
movl %r13d, 0x1c(%r14)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_byte_array_stop_describe
int cram_byte_array_stop_describe(cram_codec *c, kstring_t *ks) {
    return ksprintf(ks, "BYTE_ARRAY_STOP(stop=%d,id=%d)",
                    c->u.byte_array_stop.stop,
                    c->u.byte_array_stop.content_id)
        < 0 ? -1 : 0;
}

// Assembly:
pushq %rax
movq %rsi, %rax
movzbl 0x60(%rdi), %edx
movl 0x64(%rdi), %ecx
leaq 0x105bc(%rip), %rsi     # 0x847de
movq %rax, %rdi
xorl %eax, %eax
callq 0x8c78
sarl $0x1f, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_byte_array_stop_decode_char
static int cram_byte_array_stop_decode_char(cram_slice *slice, cram_codec *c,
                                            cram_block *in, char *out,
                                            int *out_size) {
    char *cp, ch;
    cram_block *b = NULL;

    b = cram_get_block_by_id(slice, c->u.byte_array_stop.content_id);
    if (!b)
        return *out_size?-1:0;

    if (b->idx >= b->uncomp_size)
        return -1;

    cp = (char *)b->data + b->idx;
    if (out) {
       // memccpy equivalent but without copying the terminating byte
        ssize_t term = MIN(*out_size, b->uncomp_size - b->idx);
        while ((ch = *cp) != (char)c->u.byte_array_stop.stop) {
            if (term-- < 0)
                break;
            *out++ = ch;
            cp++;
        }

        // Attempted overrun on input or output
        if (ch != (char)c->u.byte_array_stop.stop)
            return -1;
    } else {
        // Consume input, but produce no output
        while ((ch = *cp) != (char)c->u.byte_array_stop.stop) {
            if (cp - (char *)b->data >= b->uncomp_size)
                return -1;
            cp++;
        }
    }

    *out_size = cp - (char *)(b->data + b->idx);
    b->idx = cp - (char *)b->data + 1;

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %r8, %rbx
movq %rcx, %r15
movq %rsi, %r14
movl 0x64(%rsi), %esi
callq 0x6edca
testq %rax, %rax
je 0x743ec
movslq 0x1c(%rax), %rsi
movslq 0x14(%rax), %r8
pushq $-0x1
popq %rcx
cmpl %esi, %r8d
jle 0x74434
movq 0x20(%rax), %rdi
testq %r15, %r15
je 0x74406
addq %rsi, %rdi
movl (%rbx), %edx
subl %esi, %r8d
cmpl %r8d, %edx
cmovll %edx, %r8d
movslq %r8d, %rsi
movq %rdi, %rdx
movb (%rdx), %dil
movb 0x60(%r14), %r8b
cmpb %r8b, %dil
je 0x743f4
testq %rsi, %rsi
js 0x743f4
decq %rsi
movb %dil, (%r15)
incq %r15
incq %rdx
jmp 0x743cd
xorl %ecx, %ecx
cmpl (%rbx), %ecx
sbbl %ecx, %ecx
jmp 0x74434
cmpb %r8b, %dil
jne 0x74434
movq 0x20(%rax), %rcx
movslq 0x1c(%rax), %rsi
movq %rcx, %rdi
jmp 0x74423
movb 0x60(%r14), %r9b
movq %rsi, %rdx
cmpb %r9b, (%rdi,%rdx)
je 0x7441d
cmpq %r8, %rdx
jge 0x74434
incq %rdx
jmp 0x7440d
addq %rdi, %rdx
movq %rdi, %rcx
addl %esi, %edi
movl %edx, %esi
subl %edi, %esi
movl %esi, (%rbx)
subl %ecx, %edx
incl %edx
movl %edx, 0x1c(%rax)
xorl %ecx, %ecx
movl %ecx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_byte_array_stop_encode
int cram_byte_array_stop_encode(cram_slice *slice, cram_codec *c,
                                char *in, int in_size) {
    BLOCK_APPEND(c->out, in, in_size);
    BLOCK_APPEND_CHAR(c->out, c->u.e_byte_array_stop.stop);
    return 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq 0x8(%rsi), %rdi
movslq %ecx, %rax
movq %rdx, %rsi
movq %rax, %rdx
callq 0x6f15a
pushq $-0x1
popq %rbx
testl %eax, %eax
js 0x7448c
movq 0x8(%r15), %r14
movb 0x60(%r15), %bpl
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x741b0
testl %eax, %eax
js 0x7448c
movq 0x20(%r14), %rax
movq 0x30(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x30(%r14)
movb %bpl, (%rax,%rcx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq