// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/encseq.c
// Function: fillViadirectaccess
static int fillViadirectaccess(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;
  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;
  }

  encseq->plainseq = gt_malloc(sizeof (*encseq->plainseq) *
                               encseq->totallength);
  encseq->hasplainseqptr = false;
  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++;
        }
      }
      encseq->plainseq[currentposition] = cc;
      if (cc == (GtUchar) GT_SEPARATOR)
        ssptaboutinfo_processseppos(ssptaboutinfo, currentposition);
      ssptaboutinfo_processanyposition(ssptaboutinfo, currentposition);
    }
    else {
      if (retval < 0) {
        gt_free(encseq->plainseq);
        encseq->plainseq = NULL;
        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 && 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 $0x38, %rsp
movq %r8, %r14
movq %rcx, 0x28(%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, %rbx
testq %r8, %r8
je 0xb5843
movq %r14, %rdi
callq 0xc103
testb %al, %al
jne 0xb5b31
cmpb $0x1, 0x2f0(%rbx)
movq %r14, 0x30(%rsp)
jne 0xb58e1
movq 0x320(%rbx), %rdi
shlq $0x2, %rdi
leaq 0x36333(%rip), %r12     # 0xebb9a
movq %r12, %rsi
movl $0x886, %edx            # imm = 0x886
callq 0xccb0
movq %rax, 0x2f8(%rbx)
movq 0x320(%rbx), %rdi
shlq $0x2, %rdi
movq %r12, %rsi
movl $0x889, %edx            # imm = 0x889
callq 0xccb0
movq %rax, 0x300(%rbx)
movq 0x318(%rbx), %rdi
shlq $0x3, %rdi
movq %r12, %rsi
movl $0x88c, %edx            # imm = 0x88C
callq 0xccb0
movq %rax, 0x308(%rbx)
movq 0x320(%rbx), %rdi
shlq $0x3, %rdi
movq %r12, %rsi
movl $0x88f, %edx            # imm = 0x88F
callq 0xccb0
movq %rax, 0x310(%rbx)
movq 0x328(%rbx), %rax
jmp 0xb58e4
pushq $-0x1
popq %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rbx), %rdi
leaq 0x362a6(%rip), %rsi     # 0xebb9a
movl $0x895, %edx            # imm = 0x895
callq 0xccb0
movq %rax, 0x290(%rbx)
movb $0x0, 0x298(%rbx)
xorl %r13d, %r13d
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
leaq 0xe(%rsp), %rdx
leaq 0xf(%rsp), %rcx
movq 0x30(%rsp), %r8
callq 0x5ecab
cmpl $0x1, %eax
jne 0xb5a5b
movb 0xe(%rsp), %al
cmpb $-0x1, %al
setne %cl
andb 0x2f0(%rbx), %cl
cmpb $0x1, %cl
jne 0xb59f4
movzbl %al, %edx
movsbq 0xf(%rsp), %rcx
movq 0x348(%rbx), %rsi
cmpb (%rsi,%rdx), %cl
jne 0xb5985
testq %rbp, %rbp
je 0xb5981
decl %ebp
movq 0x300(%rbx), %rcx
movl %ebp, -0x4(%rcx,%r13,4)
xorl %ebp, %ebp
jmp 0xb59f4
movq 0x328(%rbx), %rax
testq %rbp, %rbp
je 0xb59b4
cmpq %rax, %rbp
jne 0xb59af
testq %r13, %r13
je 0xb5af9
movq 0x300(%rbx), %rax
movl %ebp, -0x4(%rax,%r13,4)
xorl %ebp, %ebp
jmp 0xb59d3
incq %rbp
jmp 0xb59d3
andl %r12d, %eax
movq 0x2f8(%rbx), %rdx
movl %eax, (%rdx,%r13,4)
movq 0x310(%rbx), %rax
movq %r14, (%rax,%r13,8)
incq %r13
pushq $0x1
popq %rbp
movq 0x330(%rbx), %rdi
movq 0x358(%rbx), %rax
movzbl (%rax,%rcx), %edx
movq %r14, %rsi
callq 0xb8e42
incq %r14
movb 0xe(%rsp), %al
movq 0x290(%rbx), %rcx
movb %al, (%rcx,%r12)
cmpb $-0x1, 0xe(%rsp)
jne 0xb5a13
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0xa734f
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0xa73d4
cmpb $0x1, 0x2f0(%rbx)
jne 0xb5a53
movq 0x10(%rsp), %rcx
cmpq %rcx, %r12
jne 0xb5a53
movq 0x308(%rbx), %rax
movq %r13, (%rax,%r15,8)
incq %r15
movq 0x328(%rbx), %rax
addq %rax, %rcx
incq %rcx
movq %rcx, 0x10(%rsp)
incq %r12
jmp 0xb591a
testl %eax, %eax
js 0xb5ac7
jne 0xb5b5f
movb 0x2f0(%rbx), %al
testq %rbp, %rbp
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xb5a9c
testq %r13, %r13
je 0xb5b8d
cmpq 0x320(%rbx), %r13
ja 0xb5b8d
decl %ebp
movq 0x300(%rbx), %rcx
movl %ebp, -0x4(%rcx,%r13,4)
testb %al, %al
je 0xb5ab9
cmpq 0x318(%rbx), %r15
jae 0xb5ab9
movq 0x308(%rbx), %rax
movq %r13, (%rax,%r15,8)
incq %r15
jmp 0xb5aa0
movq 0x18(%rsp), %rdi
callq 0xa73f5
xorl %eax, %eax
jmp 0xb5aea
movq 0x290(%rbx), %rdi
leaq 0x360c5(%rip), %rsi     # 0xebb9a
movl $0x8c6, %edx            # imm = 0x8C6
callq 0xd249
andq $0x0, 0x290(%rbx)
pushq $-0x1
popq %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x784b8(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x1455c(%rip), %rsi     # 0xca066
leaq 0x3af42(%rip), %rdx     # 0xf0a53
leaq 0x3ab28(%rip), %rcx     # 0xf0640
leaq 0x3607b(%rip), %r8      # 0xebb9a
movl $0x8b0, %r9d            # imm = 0x8B0
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0x78480(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x14524(%rip), %rsi     # 0xca066
leaq 0x14b10(%rip), %rdx     # 0xca659
leaq 0x3aaf0(%rip), %rcx     # 0xf0640
leaq 0x36043(%rip), %r8      # 0xebb9a
movl $0x882, %r9d            # imm = 0x882
jmp 0xb5b25
movq 0x78452(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x144f6(%rip), %rsi     # 0xca066
leaq 0x3aef6(%rip), %rdx     # 0xf0a6d
leaq 0x3aac2(%rip), %rcx     # 0xf0640
leaq 0x36015(%rip), %r8      # 0xebb9a
movl $0x8ca, %r9d            # imm = 0x8CA
jmp 0xb5b25
movq 0x78424(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x144c8(%rip), %rsi     # 0xca066
leaq 0x3aed4(%rip), %rdx     # 0xf0a79
leaq 0x3aa94(%rip), %rcx     # 0xf0640
leaq 0x35fe7(%rip), %r8      # 0xebb9a
movl $0x8cf, %r9d            # imm = 0x8CF
jmp 0xb5b25