// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x9153e
movq %rdx, %r12
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r15
movq 0x30(%rbx), %r13
addq %rax, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x91508
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x9166f
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r15, %r15
je 0x91524
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
xorl %eax, %eax
xorl %ecx, %ecx
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testb %al, %al
cmovel %r15d, %ecx
movl %ecx, (%rsp)
je 0x91545
jmp 0x9165d
movl $0x0, (%rsp)
movq 0x78(%r14), %r12
xorl %edi, %edi
xorl %esi, %esi
callq 0x4ee42
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x9165d
movq %rax, %r15
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq *0x38(%r12)
movl %eax, %r12d
movq 0x10(%r14), %rax
movl (%r14), %esi
movq %rbx, %rdi
callq *0x58(%rax)
movl %eax, 0xc(%rsp)
movq 0x10(%r14), %rax
movq 0x58(%rax), %rbp
movzbl 0x68(%r14), %edi
callq *0x78(%rax)
leal (%rax,%r12), %esi
movq %rbx, %rdi
callq *%rbp
movl %eax, 0x8(%rsp)
movq 0x10(%r14), %rax
movzbl 0x68(%r14), %esi
movq %rbx, %rdi
callq *0x58(%rax)
movl %eax, 0x4(%rsp)
movq 0x20(%r15), %rsi
movq 0x30(%r15), %rbp
movq 0x30(%rbx), %r14
addq %rbp, %r14
movq 0x28(%rbx), %rax
cmpq %r14, %rax
ja 0x9160d
movq %rsi, 0x10(%rsp)
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r14, %rax
cmovaq %rax, %r14
movq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x4840
testq %rax, %rax
je 0x9165d
movq %r14, 0x28(%rbx)
movq %rax, 0x20(%rbx)
movq 0x10(%rsp), %rsi
testq %rbp, %rbp
je 0x91626
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %rbp, %rdx
callq 0x43c0
addq %rbp, 0x30(%rbx)
movl 0x8(%rsp), %r14d
movl %r14d, %ebx
movl 0xc(%rsp), %ebp
orl %ebp, %ebx
movl 0x4(%rsp), %r13d
orl %r13d, %ebx
movq %r15, %rdi
callq 0x4f82d
addl (%rsp), %r12d
addl %ebp, %r12d
addl %r14d, %r12d
addl %r13d, %r12d
testl %ebx, %ebx
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmovgl %r12d, %r13d
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0x91526