// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/editscript.c
// Function: editscript_space_add_length
static inline void editscript_space_add_length(GtEditscript *es,
                                               GtEditscriptPos *fillpos,
                                               GtBitsequence value)
{
  /* scheme: [1111][x][x][x][x] first store consecutive ones for each element
     needed, (like elias gamma) then store the value split up to chunks of
     element size */
  /* Idea: this could be made faster with lookup-tables for the filling of most
     significant bits. */
  uint32_t num_elems = 0,
           shift;
  GtBitsequence tmp = value;

  /* needs just one element not starting with 1, store it */
  if (tmp < GT_EDITSCRIPT_FIRSTMASK(es)) {
    editscript_space_add_next(es, fillpos, tmp);
  }
  else {
    /* count the number elements needed */
    while (tmp != 0) {
      num_elems++;
      tmp >>= es->entry_size;
    }

    /* write number of entries in unary */
    tmp = num_elems;
    /* write full 1-entries */
    while (tmp >= es->entry_size) {
      editscript_space_add_next(es, fillpos, GT_EDITSCRIPT_FULLMASK(es));
      tmp -= es->entry_size;
    }
    if (tmp != 0) {
      /* write tmp 1 bits at most siginficant positions, e.g. entry_size=4,
         tmp=3: [1110]
         left shift by number of zeros, mask with entry_size 1bits.
      */
      tmp = (GT_EDITSCRIPT_FULLMASK(es) << (es->entry_size - tmp)) &
        GT_EDITSCRIPT_FULLMASK(es);
    }
    /* tmp contains either the remaining bits or one zero element to seperated
     */
    editscript_space_add_next(es, fillpos, tmp);

    /* store actual value */
    shift = (num_elems * es->entry_size);
    while (num_elems != 0) {
      num_elems--;
      shift -= es->entry_size;
      editscript_space_add_next(es, fillpos, (value >> (GtBitsequence) shift) &
                                GT_EDITSCRIPT_FULLMASK(es));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rdi, %r8
movb 0x15(%rdi), %r14b
movzbl %r14b, %r12d
leal -0x1(%r12), %ecx
movq %rdx, %rax
shrq %cl, %rax
testq %rax, %rax
movq %rsi, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
je 0x13a683
xorl %r13d, %r13d
testq %r15, %r15
je 0x13a508
movq %r15, %rax
incl %r13d
movl %r12d, %ecx
shrq %cl, %rax
testq %rax, %rax
jne 0x13a4fa
movq %r15, 0x18(%rsp)
movl %r13d, %ebx
cmpq %r12, %rbx
jb 0x13a65d
movl (%rsi), %edx
movl 0x4(%rsi), %ebp
movb $0x40, %al
movzbl %al, %eax
movw %ax, (%rsp)
movq $-0x1, %r15
movl %r12d, %ecx
shlq %cl, %r15
cmpl $0x0, 0x8(%r8)
je 0x13a540
movq (%r8), %rdi
jmp 0x13a581
movzwl (%rsp), %eax
divb %r14b
incb %al
movzbl %al, %edi
movl %edi, 0x8(%r8)
shll $0x3, %edi
leaq 0x240fbe(%rip), %rsi    # 0x37b518
movq %rdx, %r12
movl $0x6f, %edx
callq 0x104226
movq %r12, %rdx
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rsi
movq %rax, %rdi
movq %rax, (%r8)
movq $0x0, (%rax)
incl 0xc(%r8)
notq %r15
movzbl %r14b, %r14d
movl %ebp, %eax
subl %r14d, %eax
jbe 0x13a5a3
movl %eax, %ecx
shlq %cl, %r15
movl %edx, %ecx
orq %r15, (%rdi,%rcx,8)
jmp 0x13a642
leal 0x1(%rdx), %r12d
movl 0x8(%r8), %ecx
cmpl %ecx, %r12d
jb 0x13a609
movzwl (%rsp), %eax
divb 0x15(%r8)
movzbl %al, %eax
addl %ecx, %eax
incl %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x20d749(%rip), %xmm0   # 0x347d18
cvttsd2si %xmm0, %rax
movl %eax, 0x8(%r8)
movl %eax, %esi
shlq $0x3, %rsi
movq %rdx, 0x20(%rsp)
leaq 0x240f2e(%rip), %rdx    # 0x37b518
movl $0x7b, %ecx
callq 0x104461
movq 0x20(%rsp), %rdx
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rsi
movq %rax, %rdi
movq %rax, (%r8)
movl %r14d, %ecx
subl %ebp, %ecx
movq %r15, %rax
shrq %cl, %rax
movl %edx, %ecx
orq %rax, (%rdi,%rcx,8)
movl %r12d, %edx
movq $0x0, (%rdi,%rdx,8)
movl $0x40, %eax
subl %ebp, %r14d
je 0x13a63f
subl %r14d, %eax
negl %r14d
movl %r14d, %ecx
shlq %cl, %r15
movq %r15, (%rdi,%rdx,8)
movl %r12d, %edx
movl %edx, (%rsi)
movl %eax, 0x4(%rsi)
movb 0x15(%r8), %r14b
movzbl %r14b, %r12d
subq %r12, %rbx
movl %eax, %ebp
cmpq %r12, %rbx
jae 0x13a527
testq %rbx, %rbx
je 0x13a69b
movq $-0x1, %rax
movl %r12d, %ecx
shlq %cl, %rax
notq %rax
subl %ebx, %r12d
movq %rax, %rbp
movl %r12d, %ecx
shlq %cl, %rbp
andq %rax, %rbp
jmp 0x13a69d
movl (%rsi), %ebx
movl 0x4(%rsi), %ebp
cmpl $0x0, 0x8(%r8)
je 0x13a942
movq (%r8), %rdi
jmp 0x13a97e
xorl %ebp, %ebp
movq 0x18(%rsp), %r15
movl (%rsi), %r9d
movl 0x4(%rsi), %ebx
movzbl %r14b, %r12d
cmpl $0x0, 0x8(%r8)
je 0x13a6b8
movq (%r8), %rdi
jmp 0x13a6fa
movb $0x40, %al
movzbl %al, %eax
divb %r14b
incb %al
movzbl %al, %edi
movl %edi, 0x8(%r8)
shll $0x3, %edi
leaq 0x240e45(%rip), %rsi    # 0x37b518
movl $0x6f, %edx
movq %r9, %r14
callq 0x104226
movq %r14, %r9
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rsi
movq %rax, %rdi
movq %rax, (%r8)
movq $0x0, (%rax)
incl 0xc(%r8)
movl %ebx, %r11d
subl %r12d, %r11d
jbe 0x13a715
movl %r11d, %ecx
shlq %cl, %rbp
orq %rbp, (%rdi,%r9,8)
jmp 0x13a7ba
movl %r9d, %r14d
incl %r14d
movl 0x8(%r8), %ecx
cmpl %ecx, %r14d
jb 0x13a782
movb $0x40, %al
movzbl %al, %eax
divb 0x15(%r8)
movzbl %al, %eax
addl %ecx, %eax
incl %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x20d5d4(%rip), %xmm0   # 0x347d18
cvttsd2si %xmm0, %rax
movl %eax, 0x8(%r8)
movl %eax, %esi
shlq $0x3, %rsi
leaq 0x240dbe(%rip), %rdx    # 0x37b518
movl $0x7b, %ecx
movq %rbp, (%rsp)
movq %r9, %rbp
callq 0x104461
movq %rbp, %r9
movq (%rsp), %rbp
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rsi
movq %rax, %rdi
movq %rax, (%r8)
movl %r12d, %ecx
subl %ebx, %ecx
movq %rbp, %rax
shrq %cl, %rax
orq %rax, (%rdi,%r9,8)
movl %r14d, %eax
movq $0x0, (%rdi,%rax,8)
movl $0x40, %r11d
subl %ebx, %r12d
je 0x13a7b7
subl %r12d, %r11d
negl %r12d
movl %r12d, %ecx
shlq %cl, %rbp
movq %rbp, (%rdi,%rax,8)
movl %r14d, %r9d
movl %r9d, (%rsi)
movl %r11d, 0x4(%rsi)
testl %r13d, %r13d
je 0x13aa2e
movzbl 0x15(%r8), %r10d
imull %r13d, %r10d
movb $0x40, %al
movzbl %al, %eax
movw %ax, 0x20(%rsp)
movzbl 0x15(%r8), %r14d
subl %r14d, %r10d
movq %r15, %rbx
movl %r10d, %ecx
shrq %cl, %rbx
movq $-0x1, %r15
movl %r14d, %ecx
shlq %cl, %r15
cmpl $0x0, 0x8(%r8)
jne 0x13a858
movzwl 0x20(%rsp), %eax
divb %r14b
incb %al
movzbl %al, %edi
movl %edi, 0x8(%r8)
shll $0x3, %edi
leaq 0x240cfb(%rip), %rsi    # 0x37b518
movl $0x6f, %edx
movq %r9, %r12
movl %r13d, (%rsp)
movl %r10d, %r13d
movl %r11d, %ebp
callq 0x104226
movl %ebp, %r11d
movl %r13d, %r10d
movl (%rsp), %r13d
movq %r12, %r9
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rsi
movq %rax, %rdi
movq %rax, (%r8)
movq $0x0, (%rax)
notq %r15
incl 0xc(%r8)
andq %r15, %rbx
movl %r11d, %eax
movl %r9d, %r15d
subl %r14d, %eax
jbe 0x13a87b
movl %eax, %ecx
shlq %cl, %rbx
orq %rbx, (%rdi,%r15,8)
jmp 0x13a926
incl %r9d
movl 0x8(%r8), %ecx
cmpl %ecx, %r9d
jb 0x13a8f1
movzwl 0x20(%rsp), %eax
divb 0x15(%r8)
movzbl %al, %eax
addl %ecx, %eax
incl %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x20d471(%rip), %xmm0   # 0x347d18
cvttsd2si %xmm0, %rax
movl %eax, 0x8(%r8)
movl %eax, %esi
shlq $0x3, %rsi
leaq 0x240c5b(%rip), %rdx    # 0x37b518
movl $0x7b, %ecx
movq %r9, %r12
movl %r13d, (%rsp)
movl %r10d, %r13d
movl %r11d, %ebp
callq 0x104461
movl %ebp, %r11d
movl %r13d, %r10d
movl (%rsp), %r13d
movq %r12, %r9
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rsi
movq %rax, %rdi
movq %rax, (%r8)
movl %r14d, %ecx
subl %r11d, %ecx
movq %rbx, %rax
shrq %cl, %rax
orq %rax, (%rdi,%r15,8)
movl %r9d, %edx
movq $0x0, (%rdi,%rdx,8)
movl $0x40, %eax
subl %r11d, %r14d
je 0x13a926
subl %r14d, %eax
negl %r14d
movl %r14d, %ecx
shlq %cl, %rbx
movq %rbx, (%rdi,%rdx,8)
movq 0x18(%rsp), %r15
movl %r9d, (%rsi)
movl %eax, 0x4(%rsi)
movl %eax, %r11d
decl %r13d
jne 0x13a7dd
jmp 0x13aa2e
movb $0x40, %al
movzbl %al, %eax
divb %r14b
incb %al
movzbl %al, %edi
movl %edi, 0x8(%r8)
shll $0x3, %edi
leaq 0x240bbb(%rip), %rsi    # 0x37b518
movl $0x6f, %edx
callq 0x104226
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rsi
movq %rax, %rdi
movq %rax, (%r8)
movq $0x0, (%rax)
incl 0xc(%r8)
movl %ebp, %eax
subl %r12d, %eax
jbe 0x13a997
movl %eax, %ecx
shlq %cl, %r15
orq %r15, (%rdi,%rbx,8)
jmp 0x13aa29
movl %ebx, %r14d
incl %r14d
movl 0x8(%r8), %ecx
cmpl %ecx, %r14d
jb 0x13a9f2
movb $0x40, %al
movzbl %al, %eax
divb 0x15(%r8)
movzbl %al, %eax
addl %ecx, %eax
incl %eax
cvtsi2sd %rax, %xmm0
mulsd 0x20d355(%rip), %xmm0   # 0x347d18
cvttsd2si %xmm0, %rax
movl %eax, 0x8(%r8)
movl %eax, %esi
shlq $0x3, %rsi
leaq 0x240b3f(%rip), %rdx    # 0x37b518
movl $0x7b, %ecx
movq %r8, %r13
callq 0x104461
movq 0x8(%rsp), %rsi
movq %rax, %rdi
movq %rax, (%r13)
movl %r12d, %ecx
subl %ebp, %ecx
movq %r15, %rax
shrq %cl, %rax
orq %rax, (%rdi,%rbx,8)
movl %r14d, %edx
movq $0x0, (%rdi,%rdx,8)
movl $0x40, %eax
subl %ebp, %r12d
je 0x13aa26
subl %r12d, %eax
negl %r12d
movl %r12d, %ecx
shlq %cl, %r15
movq %r15, (%rdi,%rdx,8)
movl %r14d, %ebx
movl %ebx, (%rsi)
movl %eax, 0x4(%rsi)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)