// File: /workspace/github_c_makefile_star2_O1/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, %r13
movq %rcx, 0x38(%rsp)
movq %rdx, %r14
movq %rsi, 0x30(%rsp)
movq %rdi, %rbx
testq %r8, %r8
je 0xcf972
movq %r13, %rdi
callq 0x3566a
testb %al, %al
jne 0xcfe04
movq $-0x1, %r12
cmpb $0x1, 0x2f0(%rbx)
jne 0xcfa10
movq 0x320(%rbx), %rdi
shlq $0x2, %rdi
leaq 0x33092(%rip), %rbp     # 0x102a2a
movq %rbp, %rsi
movl $0x92b, %edx            # imm = 0x92B
callq 0x35ee2
movq %rax, 0x2f8(%rbx)
movq 0x320(%rbx), %rdi
shlq $0x2, %rdi
movq %rbp, %rsi
movl $0x92e, %edx            # imm = 0x92E
callq 0x35ee2
movq %rax, 0x300(%rbx)
movq 0x318(%rbx), %rdi
shlq $0x3, %rdi
movq %rbp, %rsi
movl $0x931, %edx            # imm = 0x931
callq 0x35ee2
movq %rax, 0x308(%rbx)
movq 0x320(%rbx), %rdi
shlq $0x3, %rdi
movq %rbp, %rsi
movl $0x934, %edx            # imm = 0x934
callq 0x35ee2
movq %rax, 0x310(%rbx)
movq 0x328(%rbx), %r12
movq 0x220(%rbx), %rdi
callq 0xb96b7
movq %rax, 0x20(%rsp)
movq 0x220(%rbx), %rdi
callq 0xb96f9
movl %eax, 0x18(%rsp)
movq 0x30(%rbx), %r15
leaq 0x363a1(%rip), %rsi     # 0x105ddd
movl $0x18, %edi
movl $0x48, %edx
callq 0x35ee2
movq %rax, %rbp
testq %rax, %rax
je 0xcfaaf
movl 0x18(%rsp), %eax
imulq %r15, %rax
movq %rax, %rdi
shrq $0x3, %rdi
andl $0x7, %eax
cmpq $0x1, %rax
sbbq $-0x1, %rdi
leaq 0x36369(%rip), %rdx     # 0x105ddd
movl $0x1, %esi
movl $0x4c, %ecx
callq 0x3601f
movq %rax, (%rbp)
testq %rax, %rax
je 0xcfa99
movl 0x18(%rsp), %eax
movl %eax, 0x10(%rbp)
movq %r15, 0x8(%rbp)
jmp 0xcfaaf
leaq 0x3633d(%rip), %rsi     # 0x105ddd
movq %rbp, %rdi
movl $0x4d, %edx
callq 0x362a0
xorl %ebp, %ebp
movq %rbp, 0x2a0(%rbx)
leaq 0x6(%rsp), %rdx
leaq 0x7(%rsp), %rcx
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq %r13, %r8
callq 0x7f59b
cmpl $0x1, %eax
jne 0xcfd0f
movq %r13, 0x18(%rsp)
movq 0x20(%rsp), %rax
incl %eax
movl %eax, 0x2c(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq $0x0, 0x10(%rsp)
movq %r14, 0x40(%rsp)
movb 0x6(%rsp), %al
cmpb $-0x1, %al
setne %cl
andb 0x2f0(%rbx), %cl
cmpb $0x1, %cl
jne 0xcfc20
movzbl %al, %ecx
movsbq 0x7(%rsp), %rax
movq 0x348(%rbx), %rdx
cmpb (%rdx,%rcx), %al
jne 0xcfb58
testq %r15, %r15
je 0xcfb50
decl %r15d
movq 0x300(%rbx), %rax
movq 0x8(%rsp), %rcx
movl %r15d, -0x4(%rax,%rcx,4)
xorl %r15d, %r15d
jmp 0xcfc20
testq %r15, %r15
je 0xcfb8c
movq 0x328(%rbx), %rcx
cmpq %rcx, %r15
jne 0xcfb87
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xcfdff
movq 0x300(%rbx), %rdx
movl %ecx, -0x4(%rdx,%rsi,4)
xorl %r15d, %r15d
jmp 0xcfbc2
incq %r15
jmp 0xcfbc2
movl 0x328(%rbx), %ecx
andl %ebp, %ecx
movq 0x2f8(%rbx), %rdx
movq 0x8(%rsp), %rsi
movl %ecx, (%rdx,%rsi,4)
movq 0x310(%rbx), %rcx
movq 0x10(%rsp), %rdx
movq %rdx, (%rcx,%rsi,8)
leaq 0x1(%rsi), %rcx
movl $0x1, %r15d
movq %rcx, 0x8(%rsp)
movq 0x330(%rbx), %rsi
testq %rsi, %rsi
je 0xcfdf5
movq 0x10(%rsp), %rcx
cmpq %rcx, 0x8(%rsi)
jbe 0xcfdf5
movl 0x10(%rsi), %edx
cmpq $0x21, %rdx
jae 0xcfdf5
movq %r12, %r14
movq 0x358(%rbx), %rcx
movzbl (%rcx,%rax), %ecx
movq (%rsi), %rdi
movq %rdx, %rsi
movq 0x10(%rsp), %r12
imulq %r12, %rsi
callq 0xddb77
incq %r12
movq %r12, 0x10(%rsp)
movq %r14, %r12
movq 0x40(%rsp), %r14
movb 0x6(%rsp), %al
cmpb $-0x2, %al
jb 0xcfc37
cmpb $-0x1, %al
je 0xcfc42
movq 0x20(%rsp), %rax
movb %al, 0x6(%rsp)
jmp 0xcfc55
cmpb 0x20(%rsp), %al
jb 0xcfc55
jmp 0xcfdfa
movq %r14, %rdi
movq %rbp, %rsi
callq 0xc33e4
movl 0x2c(%rsp), %eax
movb %al, 0x6(%rsp)
cmpq 0x30(%rbx), %rbp
jae 0xcfdf0
testq %r14, %r14
je 0xcfc7a
cmpq 0x10(%r14), %rbp
jne 0xcfc7a
movq %r14, %rdi
callq 0xce5a4
movq 0x18(%r14), %rax
addq %rax, 0x10(%r14)
movq 0x2a0(%rbx), %rax
testq %rax, %rax
je 0xcfdeb
cmpq %rbp, 0x8(%rax)
jbe 0xcfdeb
movl 0x10(%rax), %edx
cmpq $0x21, %rdx
jae 0xcfdeb
movzbl 0x6(%rsp), %ecx
movq (%rax), %rdi
movq %rdx, %rsi
imulq %rbp, %rsi
callq 0xddb77
cmpb $0x1, 0x2f0(%rbx)
jne 0xcfce3
cmpq %r12, %rbp
jne 0xcfce3
movq 0x308(%rbx), %rax
movq 0x8(%rsp), %rcx
movq %rcx, (%rax,%r13,8)
incq %r13
movq 0x328(%rbx), %rax
addq %rax, %r12
incq %r12
incq %rbp
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
leaq 0x6(%rsp), %rdx
leaq 0x7(%rsp), %rcx
movq 0x18(%rsp), %r8
callq 0x7f59b
cmpl $0x1, %eax
je 0xcfb0a
jmp 0xcfd1e
xorl %r13d, %r13d
xorl %r15d, %r15d
movq $0x0, 0x8(%rsp)
testl %eax, %eax
js 0xcfd99
movb 0x2f0(%rbx), %cl
cmpb $0x1, %cl
jne 0xcfd5c
testq %r15, %r15
je 0xcfd5c
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0xcfe09
cmpq 0x320(%rbx), %rsi
ja 0xcfe09
decl %r15d
movq 0x300(%rbx), %rdx
movl %r15d, -0x4(%rdx,%rsi,4)
testl %eax, %eax
jne 0xcfe0e
testb %cl, %cl
movq 0x8(%rsp), %rcx
je 0xcfd8d
cmpq 0x318(%rbx), %r13
jae 0xcfd8d
movq 0x308(%rbx), %rax
movq %rcx, (%rax,%r13,8)
incq %r13
cmpq 0x318(%rbx), %r13
jb 0xcfd7d
movq %r14, %rdi
callq 0xc3450
xorl %eax, %eax
jmp 0xcfddc
movq 0x2a0(%rbx), %r14
testq %r14, %r14
je 0xcfdcc
movq (%r14), %rdi
leaq 0x3602e(%rip), %r15     # 0x105ddd
movq %r15, %rsi
movl $0x5d, %edx
callq 0x362a0
movq %r14, %rdi
movq %r15, %rsi
movl $0x5e, %edx
callq 0x362a0
movq $0x0, 0x2a0(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2f55b
callq 0x2f4b0
callq 0x2f440
callq 0x2f477
callq 0x2f407
callq 0x2f3ce
callq 0x2f522
callq 0x2f4e9