// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/encseq.c
// Function: fillViabytecompress
static int fillViabytecompress(GtEncseq *encseq,
                               GtDustMasker *dust_masker, /* NULL if not used */
                               Gtssptaboutinfo *ssptaboutinfo,
                               GtSequenceBuffer *fb,
                               GtError *err)
{
  GtUword currentposition,
          fillexceptionrangeidx = 0,
          mapposition = 0,
          nextcheckpos = GT_UNDEF_UWORD,
          pagenumber = 0,
          lastexceptionrangelength = 0;
  int retval;
  unsigned int numofchars;
  GtUchar cc;
  char orig;
  GtSWtable_uint32 *exceptiontable = &(encseq->exceptiontable.st_uint32);
  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;
  }
  numofchars = gt_alphabet_num_of_chars(encseq->alpha);
  encseq->bitpackarray
    = bitpackarray_new(gt_alphabet_bits_per_symbol(encseq->alpha),
                       (BitOffset) encseq->totallength, true);
  for (currentposition=0; /* Nothing */; currentposition++) {
    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) (currentposition & 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++;
        }
      }
      if (GT_ISSPECIAL(cc)) {
        if (cc == (GtUchar) GT_SEPARATOR) {
          ssptaboutinfo_processseppos(ssptaboutinfo, currentposition);
          cc = (GtUchar) (numofchars+1);
        }
        else {
          cc = (GtUchar) numofchars;
        }
      }
      else {
        gt_assert(cc < (GtUchar) numofchars);
      }
      gt_assert(currentposition < encseq->totallength);
      ssptaboutinfo_processanyposition(ssptaboutinfo, currentposition);
      bitpackarray_store_uint32(encseq->bitpackarray,
                                (BitOffset) currentposition,
                                (uint32_t) cc);
    }
    else {
      if (retval < 0) {
        bitpackarray_delete(encseq->bitpackarray);
        encseq->bitpackarray = NULL;
        return -1;
      }
      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);
      }
      gt_assert(retval == 0);
      break;
    }
    if (encseq->has_exceptiontable && currentposition == nextcheckpos) {
      exceptiontable->endidxinpage[pagenumber] = fillexceptionrangeidx;
      pagenumber++;
      nextcheckpos += 1UL + exceptiontable->maxrangevalue;
    }
  }
  if (encseq->has_exceptiontable) {
    while (pagenumber < exceptiontable->numofpages) {
      exceptiontable->endidxinpage[pagenumber] = fillexceptionrangeidx;
      pagenumber++;
    }
  }
  ssptaboutinfo_finalize(ssptaboutinfo);
  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 %rdx, 0x18(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, %rbx
testq %r8, %r8
je 0xb5d35
movq %r14, %rdi
callq 0xc103
testb %al, %al
jne 0xb60df
cmpb $0x1, 0x2f0(%rbx)
movq %r14, 0x40(%rsp)
jne 0xb5dd3
movq 0x320(%rbx), %rdi
shlq $0x2, %rdi
leaq 0x35e41(%rip), %r12     # 0xebb9a
movq %r12, %rsi
movl $0x92b, %edx            # imm = 0x92B
callq 0xccb0
movq %rax, 0x2f8(%rbx)
movq 0x320(%rbx), %rdi
shlq $0x2, %rdi
movq %r12, %rsi
movl $0x92e, %edx            # imm = 0x92E
callq 0xccb0
movq %rax, 0x300(%rbx)
movq 0x318(%rbx), %rdi
shlq $0x3, %rdi
movq %r12, %rsi
movl $0x931, %edx            # imm = 0x931
callq 0xccb0
movq %rax, 0x308(%rbx)
movq 0x320(%rbx), %rdi
shlq $0x3, %rdi
movq %r12, %rsi
movl $0x934, %edx            # imm = 0x934
callq 0xccb0
movq %rax, 0x310(%rbx)
movq 0x328(%rbx), %r15
jmp 0xb5dd7
pushq $-0x1
popq %r15
movq 0x220(%rbx), %rdi
callq 0x9b59a
movl %eax, %r14d
movq 0x220(%rbx), %rdi
callq 0x9b6a8
movq 0x30(%rbx), %rsi
pushq $0x1
popq %rdx
movl %eax, %edi
callq 0xb3a03
movq %rax, 0x2a0(%rbx)
movq %r14, 0x28(%rsp)
leal 0x1(%r14), %eax
movl %eax, 0x24(%rsp)
xorl %ebp, %ebp
xorl %r14d, %r14d
xorl %r12d, %r12d
movq $0x0, 0x10(%rsp)
xorl %r13d, %r13d
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 0xb5fb1
movb 0xe(%rsp), %al
cmpb $-0x1, %al
setne %cl
andb 0x2f0(%rbx), %cl
cmpb $0x1, %cl
jne 0xb5f1d
movzbl %al, %edx
movsbq 0xf(%rsp), %rcx
movq 0x348(%rbx), %rsi
cmpb (%rsi,%rdx), %cl
jne 0xb5e9d
testq %r12, %r12
je 0xb5e95
decl %r12d
movq 0x300(%rbx), %rcx
movq 0x10(%rsp), %rdx
movl %r12d, -0x4(%rcx,%rdx,4)
xorl %r12d, %r12d
jmp 0xb5f1d
movq 0x328(%rbx), %rax
testq %r12, %r12
je 0xb5ed2
cmpq %rax, %r12
jne 0xb5ecd
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
je 0xb60b1
movq 0x300(%rbx), %rax
movl %r12d, -0x4(%rax,%rdx,4)
xorl %r12d, %r12d
jmp 0xb5efc
incq %r12
jmp 0xb5efc
andl %r13d, %eax
movq 0x2f8(%rbx), %rdx
movq 0x10(%rsp), %rsi
movl %eax, (%rdx,%rsi,4)
movq 0x310(%rbx), %rax
movq %rbp, (%rax,%rsi,8)
leaq 0x1(%rsi), %rax
pushq $0x1
popq %r12
movq %rax, 0x10(%rsp)
movq 0x330(%rbx), %rdi
movq 0x358(%rbx), %rax
movzbl (%rax,%rcx), %edx
movq %rbp, %rsi
callq 0xb8e42
incq %rbp
movb 0xe(%rsp), %al
cmpb $-0x2, %al
jb 0xb5f30
cmpb $-0x1, %al
je 0xb5f3b
movq 0x28(%rsp), %rax
movb %al, 0xe(%rsp)
jmp 0xb5f50
cmpb 0x28(%rsp), %al
jb 0xb5f50
jmp 0xb6079
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0xa734f
movl 0x24(%rsp), %eax
movb %al, 0xe(%rsp)
cmpq 0x30(%rbx), %r13
jae 0xb604b
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0xa73d4
movq 0x2a0(%rbx), %rdi
movzbl 0xe(%rsp), %edx
movq %r13, %rsi
callq 0xb8e42
cmpb $0x1, 0x2f0(%rbx)
jne 0xb5fa9
cmpq %r15, %r13
jne 0xb5fa9
movq 0x308(%rbx), %rax
movq 0x10(%rsp), %rcx
movq %rcx, (%rax,%r14,8)
incq %r14
movq 0x328(%rbx), %rax
addq %rax, %r15
incq %r15
incq %r13
jmp 0xb5e28
testl %eax, %eax
js 0xb6025
movb 0x2f0(%rbx), %cl
testq %r12, %r12
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
movq 0x10(%rsp), %rsi
jne 0xb5ff2
testq %rsi, %rsi
je 0xb610d
cmpq 0x320(%rbx), %rsi
ja 0xb610d
decl %r12d
movq 0x300(%rbx), %rdx
movl %r12d, -0x4(%rdx,%rsi,4)
testl %eax, %eax
jne 0xb613e
testb %cl, %cl
je 0xb6017
cmpq 0x318(%rbx), %r14
jae 0xb6017
movq 0x308(%rbx), %rax
movq %rsi, (%rax,%r14,8)
incq %r14
jmp 0xb5ffe
movq 0x18(%rsp), %rdi
callq 0xa73f5
xorl %eax, %eax
jmp 0xb603c
movq 0x2a0(%rbx), %rdi
callq 0xa5527
andq $0x0, 0x2a0(%rbx)
pushq $-0x1
popq %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x77f66(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x1400a(%rip), %rsi     # 0xca066
leaq 0x3abe8(%rip), %rdx     # 0xf0c4b
leaq 0x3a6a9(%rip), %rcx     # 0xf0713
leaq 0x35b29(%rip), %r8      # 0xebb9a
movl $0x96e, %r9d            # imm = 0x96E
jmp 0xb60a5
movq 0x77f38(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x13fdc(%rip), %rsi     # 0xca066
leaq 0x3aba0(%rip), %rdx     # 0xf0c31
leaq 0x3a67b(%rip), %rcx     # 0xf0713
leaq 0x35afb(%rip), %r8      # 0xebb9a
movl $0x96c, %r9d            # imm = 0x96C
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0x77f00(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x13fa4(%rip), %rsi     # 0xca066
leaq 0x3a98a(%rip), %rdx     # 0xf0a53
leaq 0x3a643(%rip), %rcx     # 0xf0713
leaq 0x35ac3(%rip), %r8      # 0xebb9a
movl $0x954, %r9d            # imm = 0x954
jmp 0xb60a5
movq 0x77ed2(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x13f76(%rip), %rsi     # 0xca066
leaq 0x14562(%rip), %rdx     # 0xca659
leaq 0x3a615(%rip), %rcx     # 0xf0713
leaq 0x35a95(%rip), %r8      # 0xebb9a
movl $0x927, %r9d            # imm = 0x927
jmp 0xb60a5
movq 0x77ea4(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x13f48(%rip), %rsi     # 0xca066
leaq 0x3a954(%rip), %rdx     # 0xf0a79
leaq 0x3a5e7(%rip), %rcx     # 0xf0713
leaq 0x35a67(%rip), %r8      # 0xebb9a
movl $0x97e, %r9d            # imm = 0x97E
jmp 0xb60a5
movq 0x77e73(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x13f17(%rip), %rsi     # 0xca066
leaq 0x3a917(%rip), %rdx     # 0xf0a6d
leaq 0x3a5b6(%rip), %rcx     # 0xf0713
leaq 0x35a36(%rip), %r8      # 0xebb9a
movl $0x982, %r9d            # imm = 0x982
jmp 0xb60a5