// File: /workspace/github_c_makefile_star2_O1/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 $0x18, %rsp
movl %ecx, %ebp
movq %rsi, %rbx
movq %rdi, %r15
testq %rdx, %rdx
je 0x94fec
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 0x94fb9
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 0x95113
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r14, %r14
je 0x94fd5
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x43c0
addq %r14, 0x30(%rbx)
xorl %eax, %eax
xorl %ecx, %ecx
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testb %al, %al
cmovneq %rcx, %r14
je 0x94fef
jmp 0x950f9
xorl %r14d, %r14d
movq 0x10(%r15), %rax
leaq 0x14(%rsp), %rsi
movl (%r15), %edx
movq %rsp, %rdi
callq *0x38(%rax)
cltq
leaq (%rsp,%rax), %r12
andl $0xffffff00, %ebp       # imm = 0xFFFFFF00
movq 0x10(%r15), %rax
movq 0x38(%rax), %r13
cmpl $0x100, %ebp            # imm = 0x100
jne 0x9504a
movq %r12, %rdi
leaq 0x14(%rsp), %rsi
movl $0x5, %edx
callq *%r13
cltq
movb 0x60(%r15), %cl
addq %rax, %r12
addq $0x5, %r12
movb %cl, -0x5(%r12)
movl 0x64(%r15), %eax
movl %eax, -0x4(%r12)
jmp 0x9508d
movslq 0x64(%r15), %rdi
callq *0x78(%rax)
leal 0x1(%rax), %edx
movq %r12, %rdi
leaq 0x14(%rsp), %rbp
movq %rbp, %rsi
callq *%r13
cltq
leaq (%r12,%rax), %r13
movb 0x60(%r15), %cl
leaq (%r12,%rax), %rdi
incq %rdi
movb %cl, -0x1(%rdi)
movq 0x10(%r15), %rax
movl 0x64(%r15), %edx
movq %rbp, %rsi
callq *0x38(%rax)
cltq
leaq (%rax,%r13), %r12
incq %r12
movq %r12, %r13
movq %rsp, %rbp
subq %rbp, %r13
movq 0x30(%rbx), %r15
addq %r13, %r15
movq 0x28(%rbx), %rax
cmpq %r15, %rax
ja 0x950da
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r15, %rax
cmovaq %rax, %r15
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x9510b
movq %r15, 0x28(%rbx)
movq %rax, 0x20(%rbx)
cmpq %rbp, %r12
je 0x950f6
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %rsp, %rsi
movq %r13, %rdx
callq 0x43c0
addq %r13, 0x30(%rbx)
addl %r14d, %r13d
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x950f9
movb $0x1, %al
jmp 0x94fd7