// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_beta_encode_store
int cram_beta_encode_store(cram_codec *c, cram_block *b,
			   char *prefix, int version) {
    int len = 0;

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

    len += itf8_put_blk(b, c->codec);
    len += itf8_put_blk(b, itf8_size(c->e_beta.offset)
			+ itf8_size(c->e_beta.nbits)); // codec length
    len += itf8_put_blk(b, c->e_beta.offset);
    len += itf8_put_blk(b, c->e_beta.nbits);

    return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x6fa44
movq -0x18(%rbp), %rdi
callq 0x4230
movq %rax, -0x28(%rbp)
jmp 0x6f938
jmp 0x6f93a
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rcx
addq -0x28(%rbp), %rcx
cmpq %rcx, %rax
ja 0x6fa07
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x6f9a0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %xmm0
movaps 0xb16e(%rip), %xmm1     # 0x7aae0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xb172(%rip), %xmm1     # 0x7aaf0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0xc143(%rip), %xmm1     # 0x7bad8
mulsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x6f9af
movsd 0xc128(%rip), %xmm0     # 0x7bad0
movsd %xmm0, -0x30(%rbp)
jmp 0x6f9af
movsd -0x30(%rbp), %xmm0
movsd 0xb104(%rip), %xmm2     # 0x7aac0
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x4990
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x6f93a
jmp 0x6fa09
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
addq 0x30(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x4460
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x30(%rax), %rcx
movq %rcx, 0x30(%rax)
movq -0x28(%rbp), %rcx
movslq -0x20(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %esi
callq 0x45280
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x6fa7a
movl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x6fae4
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
andl $0xffffc000, %eax       # imm = 0xFFFFC000
cmpl $0x0, %eax
jne 0x6fa95
movl $0x2, %eax
movl %eax, -0x40(%rbp)
jmp 0x6fade
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
andl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x0, %eax
jne 0x6fab0
movl $0x3, %eax
movl %eax, -0x44(%rbp)
jmp 0x6fad8
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x6fb03
movl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x6fb6d
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
andl $0xffffc000, %eax       # imm = 0xFFFFC000
cmpl $0x0, %eax
jne 0x6fb1e
movl $0x2, %eax
movl %eax, -0x50(%rbp)
jmp 0x6fb67
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
andl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x0, %eax
jne 0x6fb39
movl $0x3, %eax
movl %eax, -0x54(%rbp)
jmp 0x6fb61
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rdi
movl -0x48(%rbp), %esi
movl -0x4c(%rbp), %eax
addl %eax, %esi
callq 0x45280
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x30(%rax), %esi
callq 0x45280
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x34(%rax), %esi
callq 0x45280
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)