// File: /workspace/github_c_makefile_star2_O2/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, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, %rbx
movq 0x30(%rdi), %rax
leaq -0x1(%rax), %rcx
shrq $0x5, %rcx
addq $0x2, %rcx
cmpq $0x20, %rax
pushq $0x2
popq %rdi
cmovaeq %rcx, %rdi
movq %rdi, 0x288(%rbx)
shlq $0x3, %rdi
leaq 0x358cc(%rip), %rsi     # 0xebb9a
movl $0x9ed, %edx            # imm = 0x9ED
callq 0xccb0
movq %rax, %r15
movq %rax, 0x280(%rbx)
movq 0x288(%rbx), %rax
andq $0x0, -0x8(%r15,%rax,8)
testq %r14, %r14
je 0xb6304
movq %r14, %rdi
callq 0xc103
testb %al, %al
jne 0xb66a5
cmpb $0x1, 0x2f0(%rbx)
movq %r14, 0x40(%rsp)
jne 0xb63a2
movq 0x320(%rbx), %rdi
shlq $0x2, %rdi
leaq 0x35872(%rip), %r14     # 0xebb9a
movq %r14, %rsi
movl $0x9f2, %edx            # imm = 0x9F2
callq 0xccb0
movq %rax, 0x2f8(%rbx)
movq 0x320(%rbx), %rdi
shlq $0x2, %rdi
movq %r14, %rsi
movl $0x9f5, %edx            # imm = 0x9F5
callq 0xccb0
movq %rax, 0x300(%rbx)
movq 0x318(%rbx), %rdi
shlq $0x3, %rdi
movq %r14, %rsi
movl $0x9f8, %edx            # imm = 0x9F8
callq 0xccb0
movq %rax, 0x308(%rbx)
movq 0x320(%rbx), %rdi
shlq $0x3, %rdi
movq %r14, %rsi
movl $0x9fb, %edx            # imm = 0x9FB
callq 0xccb0
movq %rax, 0x310(%rbx)
movq 0x328(%rbx), %r13
jmp 0xb63a6
pushq $-0x1
popq %r13
movq %r15, 0x20(%rsp)
cmpb $0x1, 0x1e8(%rbx)
jne 0xb6677
movq $0x0, 0x18(%rsp)
xorl %r15d, %r15d
movq $0x0, 0x28(%rsp)
movq $0x0, 0x10(%rsp)
xorl %r14d, %r14d
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
leaq 0xe(%rsp), %rdx
leaq 0xf(%rsp), %rcx
movq 0x40(%rsp), %r8
callq 0x5ecab
cmpl $0x1, %eax
jne 0xb6571
movb 0xe(%rsp), %al
cmpb $-0x1, %al
setne %cl
andb 0x2f0(%rbx), %cl
cmpb $0x1, %cl
jne 0xb64f2
movzbl %al, %edx
movsbq 0xf(%rsp), %rcx
movq 0x348(%rbx), %rsi
cmpb (%rsi,%rdx), %cl
jne 0xb645c
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0xb644e
decl %esi
movq 0x300(%rbx), %rcx
movq 0x18(%rsp), %rdx
movl %esi, -0x4(%rcx,%rdx,4)
movq $0x0, 0x10(%rsp)
jmp 0xb64f2
movq 0x328(%rbx), %rax
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
je 0xb64a3
cmpq %rax, %rdx
jne 0xb649b
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0xb6649
movq 0x300(%rbx), %rax
movq 0x10(%rsp), %rsi
movl %esi, -0x4(%rax,%rdx,4)
movq $0x0, 0x10(%rsp)
jmp 0xb64d1
movq %rdx, %rax
incq %rax
jmp 0xb64cc
andl %r14d, %eax
movq 0x2f8(%rbx), %rdx
movq 0x18(%rsp), %rsi
movl %eax, (%rdx,%rsi,4)
movq 0x310(%rbx), %rax
movq %r15, (%rax,%rsi,8)
leaq 0x1(%rsi), %rax
movq %rax, 0x18(%rsp)
pushq $0x1
popq %rax
movq %rax, 0x10(%rsp)
movq 0x330(%rbx), %rdi
movq 0x358(%rbx), %rax
movzbl (%rax,%rcx), %edx
movq %r15, %rsi
callq 0xb8e42
incq %r15
movb 0xe(%rsp), %al
cmpb $-0x3, %al
ja 0xb64fb
movzbl %al, %eax
jmp 0xb6509
cmpb $-0x1, %al
jne 0xb6611
movl 0x170(%rbx), %eax
shlq $0x2, %r12
orq %rax, %r12
cmpq $0x1e, %rbp
ja 0xb651b
incq %rbp
jmp 0xb6531
movq 0x20(%rsp), %rax
movq %r12, (%rax)
addq $0x8, %rax
movq %rax, 0x20(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
cmpb $0x1, 0x2f0(%rbx)
jne 0xb6569
cmpq %r13, %r14
jne 0xb6569
movq 0x308(%rbx), %rax
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rdx
movq %rcx, (%rax,%rdx,8)
incq %rdx
movq %rdx, 0x28(%rsp)
movq 0x328(%rbx), %rax
addq %rax, %r13
incq %r13
incq %r14
jmp 0xb63de
testl %eax, %eax
js 0xb65ff
jne 0xb66d6
movb 0x2f0(%rbx), %al
cmpq $0x0, 0x10(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
movq 0x18(%rsp), %rdx
movq 0x28(%rsp), %rsi
jne 0xb65c7
testq %rdx, %rdx
je 0xb6707
cmpq 0x320(%rbx), %rdx
ja 0xb6707
movq 0x10(%rsp), %rdi
decl %edi
movq 0x300(%rbx), %rcx
movl %edi, -0x4(%rcx,%rdx,4)
testb %al, %al
je 0xb65e4
cmpq 0x318(%rbx), %rsi
jae 0xb65e4
movq 0x308(%rbx), %rax
movq %rdx, (%rax,%rsi,8)
incq %rsi
jmp 0xb65cb
xorl %eax, %eax
testq %rbp, %rbp
je 0xb6602
addl %ebp, %ebp
negb %bpl
movl %ebp, %ecx
shlq %cl, %r12
movq 0x20(%rsp), %rcx
movq %r12, (%rcx)
jmp 0xb6602
pushq $-0x1
popq %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x779a0(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x13a44(%rip), %rsi     # 0xca066
leaq 0x3a648(%rip), %rdx     # 0xf0c71
leaq 0x3a18c(%rip), %rcx     # 0xf07bc
leaq 0x35563(%rip), %r8      # 0xebb9a
movl $0xa2c, %r9d            # imm = 0xA2C
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0x77968(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x13a0c(%rip), %rsi     # 0xca066
leaq 0x3a3f2(%rip), %rdx     # 0xf0a53
leaq 0x3a154(%rip), %rcx     # 0xf07bc
leaq 0x3552b(%rip), %r8      # 0xebb9a
movl $0xa19, %r9d            # imm = 0xA19
jmp 0xb663d
movq 0x7793a(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x139de(%rip), %rsi     # 0xca066
leaq 0x36bff(%rip), %rdx     # 0xed28e
leaq 0x3a126(%rip), %rcx     # 0xf07bc
leaq 0x354fd(%rip), %r8      # 0xebb9a
movl $0x9ff, %r9d            # imm = 0x9FF
jmp 0xb663d
movq 0x7790c(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x139b0(%rip), %rsi     # 0xca066
leaq 0x13f9c(%rip), %rdx     # 0xca659
leaq 0x3a0f8(%rip), %rcx     # 0xf07bc
leaq 0x354cf(%rip), %r8      # 0xebb9a
movl $0x9ee, %r9d            # imm = 0x9EE
jmp 0xb663d
movq 0x778db(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x1397f(%rip), %rsi     # 0xca066
leaq 0x3a37f(%rip), %rdx     # 0xf0a6d
leaq 0x3a0c7(%rip), %rcx     # 0xf07bc
leaq 0x3549e(%rip), %r8      # 0xebb9a
movl $0xa3a, %r9d            # imm = 0xA3A
jmp 0xb663d
movq 0x778aa(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x1394e(%rip), %rsi     # 0xca066
leaq 0x3a35a(%rip), %rdx     # 0xf0a79
leaq 0x3a096(%rip), %rcx     # 0xf07bc
leaq 0x3546d(%rip), %r8      # 0xebb9a
movl $0xa40, %r9d            # imm = 0xA40
jmp 0xb663d