// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_byte_array_stop_encode_store
int cram_byte_array_stop_encode_store(cram_codec *c, cram_block *b,
                                      char *prefix, int version) {
    int len = 0;
    char buf[20], *cp = buf;

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

    cp += c->vv->varint_put32(cp, buf+20, c->codec);

    if (CRAM_MAJOR_VERS(version) == 1) {
        cp += c->vv->varint_put32(cp, buf+20, 5);
        *cp++ = c->u.e_byte_array_stop.stop;
        *cp++ = (c->u.e_byte_array_stop.content_id >>  0) & 0xff;
        *cp++ = (c->u.e_byte_array_stop.content_id >>  8) & 0xff;
        *cp++ = (c->u.e_byte_array_stop.content_id >> 16) & 0xff;
        *cp++ = (c->u.e_byte_array_stop.content_id >> 24) & 0xff;
    } else {
        cp += c->vv->varint_put32(cp, buf+20, 1 +
                                  c->vv->varint_size(c->u.e_byte_array_stop.content_id));
        *cp++ = c->u.e_byte_array_stop.stop;
        cp += c->vv->varint_put32(cp, buf+20, c->u.e_byte_array_stop.content_id);
    }

    BLOCK_APPEND(b, buf, cp-buf);
    len += cp-buf;

    return len;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebp
movq %rsi, %rbx
movq %rdi, %r15
testq %rdx, %rdx
je 0x92691
movq %rdx, %r12
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r14
movq 0x30(%rbx), %r13
addq %rax, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x9266e
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 0x927b0
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r14, %r14
je 0x92691
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x43c0
movq %r14, 0x8(%rsp)
addq %r14, 0x30(%rbx)
jmp 0x9269a
movq $0x0, 0x8(%rsp)
movq 0x10(%r15), %rax
leaq 0x24(%rsp), %r13
movl (%r15), %edx
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq *0x38(%rax)
cltq
leaq (%rsp,%rax), %r12
addq $0x10, %r12
andl $0xffffff00, %ebp       # imm = 0xFFFFFF00
movq 0x10(%r15), %rax
movq 0x38(%rax), %r14
cmpl $0x100, %ebp            # imm = 0x100
jne 0x926fb
movq %r12, %rdi
movq %r13, %rsi
movl $0x5, %edx
callq *%r14
cltq
movb 0x60(%r15), %cl
leaq (%r12,%rax), %r13
addq $0x5, %r13
movb %cl, -0x5(%r13)
movl 0x64(%r15), %eax
movl %eax, -0x4(%r13)
jmp 0x92739
movslq 0x64(%r15), %rdi
callq *0x78(%rax)
leal 0x1(%rax), %edx
movq %r12, %rdi
movq %r13, %rsi
callq *%r14
cltq
leaq (%r12,%rax), %r14
movb 0x60(%r15), %cl
leaq (%r12,%rax), %rdi
incq %rdi
movb %cl, -0x1(%rdi)
movq 0x10(%r15), %rax
movl 0x64(%r15), %edx
movq %r13, %rsi
callq *0x38(%rax)
cltq
leaq (%rax,%r14), %r13
incq %r13
movq %r13, %r15
leaq 0x10(%rsp), %rbp
subq %rbp, %r15
movq 0x30(%rbx), %r12
addq %r15, %r12
movq 0x28(%rbx), %rax
cmpq %r12, %rax
movq 0x8(%rsp), %r14
ja 0x9278d
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r12, %rax
cmovaq %rax, %r12
movq 0x20(%rbx), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0x927b0
movq %r12, 0x28(%rbx)
movq %rax, 0x20(%rbx)
cmpq %rbp, %r13
je 0x927ab
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
addl %r14d, %r15d
jmp 0x927b6
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq