// File: /workspace/github_c_makefile_star2_O0/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
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 0xe65c2
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 0xe65b4
jmp 0xe66fb
movq -0x38(%rbp), %rcx
movslq -0x28(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x40(%rbp)
xorl %esi, %esi
movl %esi, %edi
callq 0x6ede0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xe65ee
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe6702
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)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x58(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x78(%rax), %rax
movq -0x10(%rbp), %rcx
movzbl 0x68(%rcx), %ecx
movl %ecx, %edi
callq *%rax
movq -0x60(%rbp), %rdi
movl %eax, %esi
movq -0x58(%rbp), %rax
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
movzbl 0x68(%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 -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 0xe66cf
jmp 0xe66fb
movq -0x48(%rbp), %rdi
callq 0x6f940
cmpl $0x0, -0x2c(%rbp)
jle 0xe66e9
movl -0x28(%rbp), %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x64(%rbp)
jmp 0xe66f3
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x64(%rbp)
jmp 0xe66f3
movl -0x64(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe6702
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)