// File: /workspace/github_c_makefile_star2_O1/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, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x8b953
movq %rdx, %r15
movq %rdx, %rdi
callq 0x62d0
movq %rax, %r12
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
leaq (%rdi,%r12), %rcx
cmpq %rcx, %rax
ja 0x8b93b
movl $0x400, %r13d           # imm = 0x400
movq %rax, %xmm0
punpckldq 0x739(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x741(%rip), %xmm0      # 0x8c020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x4f05(%rip), %xmm1     # 0x907f8
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
subsd 0xc815(%rip), %xmm1     # 0x98118
cvttsd2si %xmm1, %rsi
sarq $0x3f, %rdx
andq %rdx, %rsi
orq %rcx, %rsi
testq %rax, %rax
cmoveq %r13, %rsi
movq %rsi, 0x28(%rbx)
movq 0x20(%rbx), %rdi
callq 0x6c80
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
leaq (%rdi,%r12), %rcx
cmpq %rcx, %rax
jbe 0x8b8ca
addq 0x20(%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6570
addq %r12, 0x30(%rbx)
movslq %r12d, %r12
jmp 0x8b956
xorl %r12d, %r12d
movl (%r14), %ecx
cmpl $0x7f, %ecx
ja 0x8b968
leaq 0x1(%rsp), %rax
jmp 0x8b9f1
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x8b982
leaq 0x2(%rsp), %rax
movl %ecx, %edx
shrl $0x8, %edx
orb $-0x80, %dl
movb %dl, -0x2(%rax)
jmp 0x8b9f1
cmpl $0x1fffff, %ecx         # imm = 0x1FFFFF
ja 0x8b9a0
leaq 0x3(%rsp), %rax
movl %ecx, %edx
shrl $0x10, %edx
orb $-0x40, %dl
movb %dl, -0x3(%rax)
movb %ch, 0x1(%rsp)
jmp 0x8b9f1
cmpl $0xfffffff, %ecx        # imm = 0xFFFFFFF
ja 0x8b9c6
leaq 0x4(%rsp), %rax
movl %ecx, %edx
shrl $0x18, %edx
orb $-0x20, %dl
movb %dl, -0x4(%rax)
movl %ecx, %edx
shrl $0x10, %edx
movb %dl, -0x3(%rax)
movb %ch, 0x2(%rsp)
jmp 0x8b9f1
leaq 0x5(%rsp), %rax
movl %ecx, %edx
shrl $0x1c, %edx
orb $-0x10, %dl
movb %dl, -0x5(%rax)
movl %ecx, %edx
shrl $0x14, %edx
movb %dl, -0x4(%rax)
movl %ecx, %edx
shrl $0xc, %edx
movb %dl, -0x3(%rax)
movl %ecx, %edx
shrl $0x4, %edx
movb %dl, -0x2(%rax)
andb $0xf, %cl
movb %cl, -0x1(%rax)
andl $0xffffff00, %ebp       # imm = 0xFFFFFF00
cmpl $0x100, %ebp            # imm = 0x100
jne 0x8ba1f
movb $0x5, (%rax)
movb 0x30(%r14), %cl
movb %cl, 0x1(%rax)
movl 0x34(%r14), %ecx
movl %ecx, 0x2(%rax)
addq $0x6, %rax
movq %rax, %r15
jmp 0x8bb06
movl 0x34(%r14), %ecx
cmpl $0x80, %ecx
setb %dl
xorb $0x3, %dl
cmpl $0x4000, %ecx           # imm = 0x4000
movzbl %dl, %edx
movl $0x4, %esi
cmovbl %edx, %esi
cmpl $0x10000000, %ecx       # imm = 0x10000000
movb $0x6, %dl
sbbb $0x0, %dl
cmpl $0x200000, %ecx         # imm = 0x200000
movzbl %dl, %edx
cmovbl %esi, %edx
leaq 0x2(%rax), %r15
movb %dl, (%rax)
movb 0x30(%r14), %dl
movb %dl, 0x1(%rax)
cmpl $0x7f, %ecx
ja 0x8ba76
movb %cl, (%r15)
movl $0x1, %eax
jmp 0x8bb03
movl %ecx, %edx
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x8ba93
shrl $0x8, %edx
orb $-0x80, %dl
movb %dl, 0x2(%rax)
movb %cl, 0x3(%rax)
movl $0x2, %eax
jmp 0x8bb03
cmpl $0x1fffff, %ecx         # imm = 0x1FFFFF
ja 0x8bab1
shrl $0x10, %edx
orb $-0x40, %dl
movb %dl, 0x2(%rax)
movb %ch, 0x3(%rax)
movb %cl, 0x4(%rax)
movl $0x3, %eax
jmp 0x8bb03
cmpl $0xfffffff, %ecx        # imm = 0xFFFFFFF
ja 0x8bad7
shrl $0x18, %edx
orb $-0x20, %dl
movb %dl, 0x2(%rax)
movl %ecx, %edx
shrl $0x10, %edx
movb %dl, 0x3(%rax)
movb %ch, 0x4(%rax)
movb %cl, 0x5(%rax)
movl $0x4, %eax
jmp 0x8bb03
shrl $0x1c, %edx
orb $-0x10, %dl
movb %dl, 0x2(%rax)
movl %ecx, %edx
shrl $0x14, %edx
movb %dl, 0x3(%rax)
movl %ecx, %edx
shrl $0xc, %edx
movb %dl, 0x4(%rax)
movl %ecx, %edx
shrl $0x4, %edx
movb %dl, 0x5(%rax)
andb $0xf, %cl
movb %cl, 0x6(%rax)
movl $0x5, %eax
addq %rax, %r15
movq %rsp, %rax
subq %rax, %r15
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
leaq (%rdi,%r15), %rcx
cmpq %rcx, %rax
ja 0x8bb94
movl $0x400, %r14d           # imm = 0x400
movq %rax, %xmm0
punpckldq 0x4e0(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x4e8(%rip), %xmm0      # 0x8c020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x4cac(%rip), %xmm1     # 0x907f8
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
subsd 0xc5bc(%rip), %xmm1     # 0x98118
cvttsd2si %xmm1, %rsi
sarq $0x3f, %rdx
andq %rdx, %rsi
orq %rcx, %rsi
testq %rax, %rax
cmoveq %r14, %rsi
movq %rsi, 0x28(%rbx)
movq 0x20(%rbx), %rdi
callq 0x6c80
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
leaq (%rdi,%r15), %rcx
cmpq %rcx, %rax
jbe 0x8bb23
addq 0x20(%rbx), %rdi
movq %rsp, %rsi
movq %r15, %rdx
callq 0x6570
addq %r15, 0x30(%rbx)
addl %r12d, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq