// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/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 += itf8_put(cp, c->codec);

    if (CRAM_MAJOR_VERS(version) == 1) {
	cp += itf8_put(cp, 5);
	*cp++ = c->e_byte_array_stop.stop;
	*cp++ = (c->e_byte_array_stop.content_id >>  0) & 0xff;
	*cp++ = (c->e_byte_array_stop.content_id >>  8) & 0xff;
	*cp++ = (c->e_byte_array_stop.content_id >> 16) & 0xff;
	*cp++ = (c->e_byte_array_stop.content_id >> 24) & 0xff;
    } else {
	cp += itf8_put(cp, 1 + itf8_size(c->e_byte_array_stop.content_id));
	*cp++ = c->e_byte_array_stop.stop;
	cp += itf8_put(cp, c->e_byte_array_stop.content_id);
    }

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

    return len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x8b488
movq %rdx, %r12
movq %rdx, %rdi
callq 0x62d0
movq %rax, %r13
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rcx
movq 0x30(%rbx), %rdx
leaq (%rdx,%r13), %rsi
cmpq %rsi, %rcx
ja 0x8b46e
movl $0x400, %ebp            # imm = 0x400
movq %rcx, %xmm0
punpckldq 0xc05(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xc0d(%rip), %xmm0      # 0x8c020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x54c1(%rip), %xmm1     # 0x908e8
cvttsd2si %xmm1, %rdx
movq %rdx, %rdi
sarq $0x3f, %rdi
subsd 0xcd95(%rip), %xmm1     # 0x981d0
cvttsd2si %xmm1, %rsi
andq %rdi, %rsi
orq %rdx, %rsi
testq %rcx, %rcx
cmoveq %rbp, %rsi
movq %rsi, 0x28(%rbx)
movq %rax, %rdi
callq 0x6c80
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rcx
movq 0x30(%rbx), %rdx
leaq (%rdx,%r13), %rsi
cmpq %rsi, %rcx
jbe 0x8b3fe
addq %rdx, %rax
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x6570
addq %r13, 0x30(%rbx)
movslq %r13d, %r12
jmp 0x8b48b
xorl %r12d, %r12d
movl (%r14), %eax
cmpl $0x7f, %eax
ja 0x8b49d
leaq 0x1(%rsp), %rbp
jmp 0x8b522
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x8b4b6
leaq 0x2(%rsp), %rbp
movl %eax, %ecx
shrl $0x8, %ecx
orb $-0x80, %cl
movb %cl, -0x2(%rbp)
jmp 0x8b522
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x8b4d3
leaq 0x3(%rsp), %rbp
movl %eax, %ecx
shrl $0x10, %ecx
orb $-0x40, %cl
movb %cl, -0x3(%rbp)
movb %ah, 0x1(%rsp)
jmp 0x8b522
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x8b4f8
leaq 0x4(%rsp), %rbp
movl %eax, %ecx
shrl $0x18, %ecx
orb $-0x20, %cl
movb %cl, -0x4(%rbp)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, -0x3(%rbp)
movb %ah, 0x2(%rsp)
jmp 0x8b522
leaq 0x5(%rsp), %rbp
movl %eax, %ecx
shrl $0x1c, %ecx
orb $-0x10, %cl
movb %cl, -0x5(%rbp)
movl %eax, %ecx
shrl $0x14, %ecx
movb %cl, -0x4(%rbp)
movl %eax, %ecx
shrl $0xc, %ecx
movb %cl, -0x3(%rbp)
movl %eax, %ecx
shrl $0x4, %ecx
movb %cl, -0x2(%rbp)
andb $0xf, %al
movb %al, -0x1(%rbp)
andl $0xffffff00, %r15d      # imm = 0xFFFFFF00
cmpl $0x100, %r15d           # imm = 0x100
jne 0x8b550
movb $0x5, (%rbp)
movb 0x30(%r14), %al
movb %al, 0x1(%rbp)
movl 0x34(%r14), %eax
movl %eax, 0x2(%rbp)
addq $0x6, %rbp
jmp 0x8b634
movl 0x34(%r14), %eax
cmpl $0x80, %eax
jae 0x8b573
movb $0x2, (%rbp)
movb 0x30(%r14), %cl
movb %cl, 0x1(%rbp)
movb %al, 0x2(%rbp)
movl $0x1, %eax
jmp 0x8b62d
cmpl $0x4000, %eax           # imm = 0x4000
jae 0x8b59d
movb $0x3, (%rbp)
movb 0x30(%r14), %cl
movb %cl, 0x1(%rbp)
movl %eax, %ecx
shrl $0x8, %ecx
orb $-0x80, %cl
movb %cl, 0x2(%rbp)
movb %al, 0x3(%rbp)
movl $0x2, %eax
jmp 0x8b62d
cmpl $0x200000, %eax         # imm = 0x200000
jae 0x8b5c7
movb $0x4, (%rbp)
movb 0x30(%r14), %cl
movb %cl, 0x1(%rbp)
movl %eax, %ecx
shrl $0x10, %ecx
orb $-0x40, %cl
movb %cl, 0x2(%rbp)
movb %ah, 0x3(%rbp)
movb %al, 0x4(%rbp)
movl $0x3, %eax
jmp 0x8b62d
cmpl $0x10000000, %eax       # imm = 0x10000000
movb $0x6, %cl
sbbb $0x0, %cl
movb %cl, (%rbp)
movb 0x30(%r14), %cl
movb %cl, 0x1(%rbp)
movl %eax, %ecx
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x8b602
shrl $0x18, %ecx
orb $-0x20, %cl
movb %cl, 0x2(%rbp)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x3(%rbp)
movb %ah, 0x4(%rbp)
movb %al, 0x5(%rbp)
movl $0x4, %eax
jmp 0x8b62d
shrl $0x1c, %ecx
orb $-0x10, %cl
movb %cl, 0x2(%rbp)
movl %eax, %ecx
shrl $0x14, %ecx
movb %cl, 0x3(%rbp)
movl %eax, %ecx
shrl $0xc, %ecx
movb %cl, 0x4(%rbp)
movl %eax, %ecx
shrl $0x4, %ecx
movb %cl, 0x5(%rbp)
andb $0xf, %al
movb %al, 0x6(%rbp)
movl $0x5, %eax
addq %rax, %rbp
addq $0x2, %rbp
movq %rsp, %rax
subq %rax, %rbp
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rcx
movq 0x30(%rbx), %rdx
leaq (%rdx,%rbp), %rsi
cmpq %rsi, %rcx
ja 0x8b6c5
movl $0x400, %r14d           # imm = 0x400
movq %rcx, %xmm0
punpckldq 0x9ae(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x9b6(%rip), %xmm0      # 0x8c020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x526a(%rip), %xmm1     # 0x908e8
cvttsd2si %xmm1, %rdx
movq %rdx, %rdi
sarq $0x3f, %rdi
subsd 0xcb3e(%rip), %xmm1     # 0x981d0
cvttsd2si %xmm1, %rsi
andq %rdi, %rsi
orq %rdx, %rsi
testq %rcx, %rcx
cmoveq %r14, %rsi
movq %rsi, 0x28(%rbx)
movq %rax, %rdi
callq 0x6c80
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rcx
movq 0x30(%rbx), %rdx
leaq (%rdx,%rbp), %rsi
cmpq %rsi, %rcx
jbe 0x8b655
addq %rdx, %rax
movq %rsp, %rsi
movq %rax, %rdi
movq %rbp, %rdx
callq 0x6570
addq %rbp, 0x30(%rbx)
addl %r12d, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq