// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movl %ecx, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, %r13
testq %rdx, %rdx
je 0x94681
movq %rdx, %r15
movq %rdx, %rdi
callq 0x41d0
movq %rax, %rbx
movq 0x30(%r14), %r12
addq %rax, %r12
movq 0x28(%r14), %rax
cmpq %r12, %rax
ja 0x94653
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r12, %rax
cmovaq %rax, %r12
movq 0x20(%r14), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0x94885
movq %r12, 0x28(%r14)
movq %rax, 0x20(%r14)
testq %rbx, %rbx
je 0x9466f
movq 0x20(%r14), %rdi
addq 0x30(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, 0x30(%r14)
xorl %eax, %eax
xorl %r15d, %r15d
testb %al, %al
cmovnel %r15d, %ebx
je 0x94683
jmp 0x9484d
xorl %ebx, %ebx
movq 0x78(%r13), %rbp
xorl %r12d, %r12d
xorl %edi, %edi
xorl %esi, %esi
callq 0x4ee42
testq %rax, %rax
je 0x94852
movq %rax, %r15
xorl %r12d, %r12d
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
movl 0x8(%rsp), %ecx
callq *0x38(%rbp)
testl %eax, %eax
js 0x94855
movq %rax, 0x20(%rsp)
movq 0x80(%r13), %rbp
xorl %edi, %edi
xorl %esi, %esi
callq 0x4ee42
testq %rax, %rax
je 0x9484d
movq %rax, %r12
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
movl 0x8(%rsp), %ecx
callq *0x38(%rbp)
testl %eax, %eax
js 0x94855
movl %eax, %ebp
movq 0x10(%r13), %rax
movl (%r13), %esi
movq %r14, %rdi
callq *0x58(%rax)
movl %eax, 0x8(%rsp)
movq 0x10(%r13), %rax
movq 0x20(%rsp), %rcx
leal (%rcx,%rbp), %esi
movq %r14, %rdi
callq *0x58(%rax)
movl %eax, 0xc(%rsp)
movq 0x20(%r15), %rsi
movq 0x30(%r15), %rcx
movq 0x30(%r14), %r13
addq %rcx, %r13
movq 0x28(%r14), %rax
cmpq %r13, %rax
ja 0x9477f
movq %rsi, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%r14), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x94855
movq %r13, 0x28(%r14)
movq %rax, 0x20(%r14)
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rsi
testq %rcx, %rcx
je 0x9479b
movq 0x20(%r14), %rdi
addq 0x30(%r14), %rdi
movq %rcx, %r13
movq %rcx, %rdx
callq 0x43c0
addq %r13, 0x30(%r14)
movq 0x20(%r12), %rsi
movq 0x30(%r12), %rcx
movq 0x30(%r14), %r13
addq %rcx, %r13
movq 0x28(%r14), %rax
cmpq %r13, %rax
movq %rcx, 0x10(%rsp)
ja 0x947fd
movq %rsi, 0x18(%rsp)
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%r14), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x94855
movq %r13, 0x28(%r14)
movq %rax, 0x20(%r14)
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %r13d
orl 0x8(%rsp), %r13d
testq %rcx, %rcx
je 0x94825
movq 0x20(%r14), %rdi
addq 0x30(%r14), %rdi
movq %rcx, %rdx
callq 0x43c0
movq 0x10(%rsp), %rax
addq %rax, 0x30(%r14)
movq %r15, %rdi
callq 0x4f82d
movq %r12, %rdi
callq 0x4f82d
testl %r13d, %r13d
jle 0x94855
movq 0x20(%rsp), %rax
addl %ebx, %eax
addl 0x8(%rsp), %ebp
addl %eax, %ebp
addl 0xc(%rsp), %ebp
jmp 0x94874
xorl %r12d, %r12d
jmp 0x94855
xorl %r15d, %r15d
testq %r15, %r15
je 0x94862
movq %r15, %rdi
callq 0x4f82d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %r12, %r12
je 0x94874
movq %r12, %rdi
callq 0x4f82d
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0x94671