// File: /workspace/github_c_makefile_star2_O0/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
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)
leaq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xebf73
movq -0x20(%rbp), %rdi
callq 0x41b0
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0xe2300
cmpl $0x0, %eax
jge 0xebf65
jmp 0xec168
movq -0x50(%rbp), %rcx
movslq -0x28(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x38(%rax), %rax
movq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
addq $0x14, %rsi
movq -0x10(%rbp), %rcx
movl (%rcx), %edx
callq *%rax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl -0x24(%rbp), %eax
sarl $0x8, %eax
cmpl $0x1, %eax
jne 0xec086
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x38(%rax), %rax
movq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
addq $0x14, %rsi
movl $0x5, %edx
callq *%rax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movb 0x60(%rax), %cl
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x48(%rbp)
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movl 0x64(%rax), %eax
sarl $0x0, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x48(%rbp)
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movl 0x64(%rax), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x48(%rbp)
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movl 0x64(%rax), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x48(%rbp)
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movl 0x64(%rax), %eax
sarl $0x18, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x48(%rbp)
movb %cl, (%rax)
jmp 0xec12c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x38(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x40(%rbp), %rax
addq $0x14, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x78(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x64(%rcx), %rdi
callq *%rax
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl %eax, %edx
movq -0x58(%rbp), %rax
addl $0x1, %edx
callq *%rax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movb 0x60(%rax), %cl
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x48(%rbp)
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x38(%rax), %rax
movq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
addq $0x14, %rsi
movq -0x10(%rbp), %rcx
movl 0x64(%rcx), %edx
callq *%rax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x40(%rbp), %rax
subq %rax, %rdx
callq 0xe2300
cmpl $0x0, %eax
jge 0xec14b
jmp 0xec168
movq -0x48(%rbp), %rcx
leaq -0x40(%rbp), %rax
subq %rax, %rcx
movslq -0x28(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xec16f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)