// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xpack_encode_store
int cram_xpack_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_xpack.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
    int len1 = 0, i;
    for (i = 0; i < c->u.e_xpack.nval; i++)
        len1 += (n = c->vv->varint_size(c->u.e_xpack.rmap[i])), r |= n;
    len += (n = c->vv->varint_put32_blk(b, c->vv->varint_size(c->u.e_xpack.nbits)
                                        +  c->vv->varint_size(c->u.e_xpack.nval)
                                        + len1 + len2)); r |= n;

    // The map and sub-codec
    len += (n = c->vv->varint_put32_blk(b, c->u.e_xpack.nbits)); r |= n;
    len += (n = c->vv->varint_put32_blk(b, c->u.e_xpack.nval));  r |= n;
    for (i = 0; i < c->u.e_xpack.nval; i++)
        len += (n = c->vv->varint_put32_blk(b, c->u.e_xpack.rmap[i])), 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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xe5472
movq -0x20(%rbp), %rdi
callq 0x41b0
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0xe2300
cmpl $0x0, %eax
jge 0xe5464
jmp 0xe5695
movq -0x38(%rbp), %rcx
movslq -0x28(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x40(%rbp)
xorl %esi, %esi
movl %esi, %edi
callq 0x6ede0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xe549e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe569c
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x24(%rbp), %ecx
xorl %edx, %edx
callq *%rax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x58(%rax), %rax
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl (%rcx), %esi
callq *%rax
movl %eax, -0x30(%rbp)
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x30(%rbp), %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jge 0xe5535
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x78(%rax), %rax
movq -0x10(%rbp), %rcx
movslq -0x54(%rbp), %rdx
movl 0x7c(%rcx,%rdx,4), %ecx
movl %ecx, %edi
callq *%rax
movl %eax, -0x30(%rbp)
addl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x30(%rbp), %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xe54f0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x58(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x78(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x60(%rcx), %rdi
callq *%rax
movl %eax, -0x6c(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x78(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x78(%rcx), %rdi
callq *%rax
movl -0x6c(%rbp), %esi
movq -0x68(%rbp), %rdi
movl %eax, %ecx
movq -0x60(%rbp), %rax
addl %ecx, %esi
addl -0x50(%rbp), %esi
addl -0x4c(%rbp), %esi
callq *%rax
movl %eax, -0x30(%rbp)
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x30(%rbp), %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x58(%rax), %rax
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl 0x60(%rcx), %esi
callq *%rax
movl %eax, -0x30(%rbp)
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x30(%rbp), %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x58(%rax), %rax
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl 0x78(%rcx), %esi
callq *%rax
movl %eax, -0x30(%rbp)
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x30(%rbp), %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jge 0xe5649
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x58(%rax), %rax
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rcx
movslq -0x54(%rbp), %rdx
movl 0x7c(%rcx,%rdx,4), %esi
callq *%rax
movl %eax, -0x30(%rbp)
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x30(%rbp), %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xe5602
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x48(%rbp), %rax
movq 0x30(%rax), %rdx
callq 0xe2300
cmpl $0x0, %eax
jge 0xe5669
jmp 0xe5695
movq -0x48(%rbp), %rdi
callq 0x6f940
cmpl $0x0, -0x2c(%rbp)
jle 0xe5683
movl -0x28(%rbp), %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x70(%rbp)
jmp 0xe568d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x70(%rbp)
jmp 0xe568d
movl -0x70(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe569c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)