// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/core/encseq.c
// Function: fillViaequallength
static int fillViaequallength(GtEncseq *encseq,
                              GtDustMasker *dust_masker, /* NULL if not used */
                              GT_UNUSED Gtssptaboutinfo *ssptaboutinfo,
                              GtSequenceBuffer *fb,
                              GtError *err)
{
  GtUchar cc;
  char orig;
  GtUword pos,
          fillexceptionrangeidx = 0,
          mapposition = 0,
          nextcheckpos = GT_UNDEF_UWORD,
          pagenumber = 0,
          lastexceptionrangelength = 0;
  int retval;
  GtSWtable_uint32 *exceptiontable = &(encseq->exceptiontable.st_uint32);
  DECLARESEQBUFFER(encseq->twobitencoding); /* in fillViaequallength */
  gt_error_check(err);

  if (encseq->has_exceptiontable) {
    exceptiontable->positions = gt_malloc(sizeof (*exceptiontable->positions) *
                                         exceptiontable->numofpositionstostore);
    exceptiontable->rangelengths =
                               gt_malloc(sizeof(*exceptiontable->rangelengths) *
                                         exceptiontable->numofpositionstostore);
    exceptiontable->endidxinpage =
                               gt_malloc(sizeof(*exceptiontable->endidxinpage) *
                                         exceptiontable->numofpages);
    exceptiontable->mappositions =
                              gt_malloc(sizeof (*exceptiontable->mappositions) *
                                        exceptiontable->numofpositionstostore);

    nextcheckpos = exceptiontable->maxrangevalue;
  }
  gt_assert(encseq->equallength.defined);
  for (pos=0; /* Nothing */; pos++) {
    retval = gt_sequence_buffer_next_with_original(fb, dust_masker, &cc,
                                                   &orig, err);
    if (retval == 1) {
      if (encseq->has_exceptiontable && cc != (GtUchar) GT_SEPARATOR) {
        if (orig == encseq->maxchars[cc]) {
          if (lastexceptionrangelength > 0) {
            exceptiontable->rangelengths[fillexceptionrangeidx-1]
              = (uint32_t) (lastexceptionrangelength-1);
            lastexceptionrangelength = 0;
          }
        }
        else {
          /* at beginning of exception range */
          if (lastexceptionrangelength == 0) {
            /* store remainder of currentposition: this value is not larger
               than maxrangevalue and this can be stored in a page */
            exceptiontable->positions[fillexceptionrangeidx++]
              = (uint32_t) (pos & exceptiontable->maxrangevalue);
            exceptiontable->mappositions[fillexceptionrangeidx-1]
              = mapposition;
            lastexceptionrangelength = 1UL;
          }
          else /* extend exception range */ {
            if (lastexceptionrangelength == exceptiontable->maxrangevalue) {
              gt_assert(fillexceptionrangeidx > 0);
              exceptiontable->rangelengths[fillexceptionrangeidx-1]
                = (uint32_t) exceptiontable->maxrangevalue;
              lastexceptionrangelength = 0;
            }
            else {
              lastexceptionrangelength++;
            }
          }
          bitpackarray_store_uint32(encseq->exceptions,
                                   (BitOffset) mapposition,
                                   (uint32_t) encseq->subsymbolmap[(int) orig]);
          mapposition++;
        }
      }
      bitwise <<= 2;
      if (GT_ISNOTSPECIAL(cc))
        bitwise |= (GtTwobitencoding) cc;
      else {
        gt_assert(cc == (GtUchar) GT_SEPARATOR);
        bitwise |= (GtTwobitencoding) encseq->leastprobablecharacter;
      }
      if (widthbuffer < (GtUword) (GT_UNITSIN2BITENC - 1))
        widthbuffer++;
      else {
        *twobitencodingptr++ = bitwise;
        widthbuffer = 0;
        bitwise = 0;
      }
    }
    else {
      if (retval < 0)
        return -1;
      gt_assert(retval == 0);

      if (encseq->has_exceptiontable && lastexceptionrangelength > 0) {
        /* note that we store one less than the length to prevent overflows */
        gt_assert(fillexceptionrangeidx > 0 &&
                  fillexceptionrangeidx <=
                  exceptiontable->numofpositionstostore);
        exceptiontable->rangelengths[fillexceptionrangeidx-1]
          = (uint32_t) (lastexceptionrangelength-1);
      }
      break;
    }
    if (encseq->has_exceptiontable && pos == nextcheckpos) {
      exceptiontable->endidxinpage[pagenumber] = fillexceptionrangeidx;
      pagenumber++;
      nextcheckpos += 1UL + exceptiontable->maxrangevalue;
    }
  }
  if (encseq->has_exceptiontable) {
    while (pagenumber < exceptiontable->numofpages) {
      exceptiontable->endidxinpage[pagenumber] = fillexceptionrangeidx;
      pagenumber++;
    }
  }
  UPDATESEQBUFFERFINAL(bitwise, twobitencodingptr); /* in fillViaequallength */
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r14
movq %rcx, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, %rbx
movq 0x30(%rdi), %rax
leaq -0x1(%rax), %rcx
shrq $0x5, %rcx
addq $0x2, %rcx
cmpq $0x20, %rax
movl $0x2, %edi
cmovaeq %rcx, %rdi
movq %rdi, 0x288(%rbx)
shlq $0x3, %rdi
leaq 0x31b86(%rip), %rsi     # 0x10291a
movl $0x9ed, %edx            # imm = 0x9ED
callq 0x35862
movq %rax, %r13
movq %rax, 0x280(%rbx)
movq 0x288(%rbx), %rax
movq $0x0, -0x8(%r13,%rax,8)
testq %r14, %r14
je 0xd0dcd
movq %r14, %rdi
callq 0x34fea
testb %al, %al
jne 0xd1160
movq $-0x1, %r15
cmpb $0x1, 0x2f0(%rbx)
jne 0xd0e6b
movq 0x320(%rbx), %rdi
shlq $0x2, %rdi
leaq 0x31b27(%rip), %rbp     # 0x10291a
movq %rbp, %rsi
movl $0x9f2, %edx            # imm = 0x9F2
callq 0x35862
movq %rax, 0x2f8(%rbx)
movq 0x320(%rbx), %rdi
shlq $0x2, %rdi
movq %rbp, %rsi
movl $0x9f5, %edx            # imm = 0x9F5
callq 0x35862
movq %rax, 0x300(%rbx)
movq 0x318(%rbx), %rdi
shlq $0x3, %rdi
movq %rbp, %rsi
movl $0x9f8, %edx            # imm = 0x9F8
callq 0x35862
movq %rax, 0x308(%rbx)
movq 0x320(%rbx), %rdi
shlq $0x3, %rdi
movq %rbp, %rsi
movl $0x9fb, %edx            # imm = 0x9FB
callq 0x35862
movq %rax, 0x310(%rbx)
movq 0x328(%rbx), %r15
cmpb $0x1, 0x1e8(%rbx)
jne 0xd115b
leaq 0x6(%rsp), %rdx
leaq 0x7(%rsp), %rcx
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r14, %r8
callq 0x7f610
cmpl $0x1, %eax
jne 0xd10b5
movq %r14, 0x40(%rsp)
movq %r13, 0x20(%rsp)
xorl %ebp, %ebp
xorl %r14d, %r14d
xorl %r13d, %r13d
movq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movb 0x6(%rsp), %cl
cmpb $-0x1, %cl
setne %al
andb 0x2f0(%rbx), %al
cmpb $0x1, %al
jne 0xd1009
movzbl %cl, %edx
movsbq 0x7(%rsp), %rax
movq 0x348(%rbx), %rsi
cmpb (%rsi,%rdx), %al
jne 0xd0f24
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xd0f16
decl %esi
movq 0x300(%rbx), %rax
movq 0x10(%rsp), %rdx
movl %esi, -0x4(%rax,%rdx,4)
movq $0x0, 0x8(%rsp)
jmp 0xd1009
movq 0x328(%rbx), %rcx
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
movq %rbp, 0x38(%rsp)
je 0xd0f72
cmpq %rcx, %rdx
jne 0xd0f68
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
je 0xd1156
movq 0x300(%rbx), %rcx
movq 0x8(%rsp), %rsi
movl %esi, -0x4(%rcx,%rdx,4)
movq $0x0, 0x8(%rsp)
jmp 0xd0fa7
incq %rdx
movq %rdx, 0x8(%rsp)
jmp 0xd0fa7
andl %r13d, %ecx
movq 0x2f8(%rbx), %rdx
movq 0x10(%rsp), %rsi
movl %ecx, (%rdx,%rsi,4)
movq 0x310(%rbx), %rcx
movq 0x18(%rsp), %rdx
movq %rdx, (%rcx,%rsi,8)
leaq 0x1(%rsi), %rcx
movl $0x1, %edx
movq %rdx, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x330(%rbx), %rsi
testq %rsi, %rsi
je 0xd114c
movq 0x18(%rsp), %rcx
cmpq %rcx, 0x8(%rsi)
jbe 0xd114c
movl 0x10(%rsi), %edx
cmpq $0x21, %rdx
jae 0xd114c
movq %r15, %rbp
movq 0x358(%rbx), %rcx
movzbl (%rcx,%rax), %ecx
movq (%rsi), %rdi
movq %rdx, %rsi
movq 0x18(%rsp), %r15
imulq %r15, %rsi
callq 0xde284
incq %r15
movq %r15, 0x18(%rsp)
movb 0x6(%rsp), %cl
movq %rbp, %r15
movq 0x38(%rsp), %rbp
cmpb $-0x3, %cl
ja 0xd1013
movzbl %cl, %eax
jmp 0xd1022
cmpb $-0x1, %cl
jne 0xd1151
movl 0x170(%rbx), %eax
shlq $0x2, %r14
orq %rax, %r14
cmpq $0x1e, %rbp
ja 0xd1034
incq %rbp
jmp 0xd104a
movq 0x20(%rsp), %rax
movq %r14, (%rax)
addq $0x8, %rax
movq %rax, 0x20(%rsp)
xorl %r14d, %r14d
xorl %ebp, %ebp
cmpb $0x1, 0x2f0(%rbx)
jne 0xd107a
cmpq %r15, %r13
jne 0xd107a
movq 0x308(%rbx), %rax
movq 0x10(%rsp), %rcx
movq %rcx, (%rax,%r12,8)
incq %r12
incq %r13
movq 0x328(%rbx), %r15
addq %r13, %r15
jmp 0xd107d
incq %r13
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
leaq 0x6(%rsp), %rdx
leaq 0x7(%rsp), %rcx
movq 0x40(%rsp), %r8
callq 0x7f610
cmpl $0x1, %eax
je 0xd0ecd
movq 0x20(%rsp), %r13
movq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rsi
jmp 0xd10c1
xorl %edx, %edx
xorl %r12d, %r12d
xorl %esi, %esi
xorl %r14d, %r14d
xorl %ebp, %ebp
testl %eax, %eax
js 0xd1138
jne 0xd1165
movb 0x2f0(%rbx), %al
testq %rsi, %rsi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xd10fd
testq %rdx, %rdx
je 0xd116a
cmpq 0x320(%rbx), %rdx
ja 0xd116a
decl %esi
movq 0x300(%rbx), %rcx
movl %esi, -0x4(%rcx,%rdx,4)
testb %al, %al
je 0xd1121
cmpq 0x318(%rbx), %r12
jae 0xd1121
movq 0x308(%rbx), %rax
movq %rdx, (%rax,%r12,8)
incq %r12
cmpq 0x318(%rbx), %r12
jb 0xd1111
xorl %eax, %eax
testq %rbp, %rbp
je 0xd113d
addl %ebp, %ebp
negb %bpl
movl %ebp, %ecx
shlq %cl, %r14
movq %r14, (%r13)
jmp 0xd113d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2f0b2
callq 0x2f0e9
callq 0x2f079
callq 0x2f040
callq 0x2f007
callq 0x2f122
callq 0x2f15b