// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
movq %rcx, 0x50(%rsp)
movq %r8, 0x48(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq $-0x1, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x68(%rsp), %rax
addq $0x2f8, %rax            # imm = 0x2F8
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x137e5a
movq 0x48(%rsp), %rdi
callq 0xc270
testb $0x1, %al
jne 0x137e22
jmp 0x137e5a
movq 0x7c1af(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x26233(%rip), %rsi     # 0x15e066
leaq 0x2680e(%rip), %rdx     # 0x15e648
leaq 0x524fe(%rip), %rcx     # 0x18a33f
leaq 0x4d816(%rip), %r8      # 0x18565e
movl $0x882, %r9d            # imm = 0x882
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x137e5c
movq 0x68(%rsp), %rax
testb $0x1, 0x2f0(%rax)
je 0x137f23
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rdi
shlq $0x2, %rdi
leaq 0x4d7dc(%rip), %rsi     # 0x18565e
movl $0x886, %edx            # imm = 0x886
callq 0xd2e0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rdi
shlq $0x2, %rdi
leaq 0x4d7b3(%rip), %rsi     # 0x18565e
movl $0x889, %edx            # imm = 0x889
callq 0xd2e0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdi
shlq $0x3, %rdi
leaq 0x4d789(%rip), %rsi     # 0x18565e
movl $0x88c, %edx            # imm = 0x88C
callq 0xd2e0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rdi
shlq $0x3, %rdi
leaq 0x4d75f(%rip), %rsi     # 0x18565e
movl $0x88f, %edx            # imm = 0x88F
callq 0xd2e0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rax
movq 0x30(%rax), %rdi
shlq $0x0, %rdi
leaq 0x4d727(%rip), %rsi     # 0x18565e
movl $0x895, %edx            # imm = 0x895
callq 0xd2e0
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x290(%rax)
movq 0x68(%rsp), %rax
movb $0x0, 0x298(%rax)
movq $0x0, 0x40(%rsp)
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x48(%rsp), %r8
leaq 0x13(%rsp), %rdx
leaq 0x12(%rsp), %rcx
callq 0x9bf60
movl %eax, 0x14(%rsp)
cmpl $0x1, 0x14(%rsp)
jne 0x138179
movq 0x68(%rsp), %rax
testb $0x1, 0x2f0(%rax)
je 0x138132
movzbl 0x13(%rsp), %eax
cmpl $0xff, %eax
je 0x138132
movsbl 0x12(%rsp), %eax
movq 0x68(%rsp), %rcx
movq 0x348(%rcx), %rcx
movzbl 0x13(%rsp), %edx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x138008
cmpq $0x0, 0x18(%rsp)
jbe 0x138003
movq 0x18(%rsp), %rax
subq $0x1, %rax
movl %eax, %edx
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movl %edx, (%rax,%rcx,4)
movq $0x0, 0x18(%rsp)
jmp 0x138130
cmpq $0x0, 0x18(%rsp)
jne 0x138065
movq 0x40(%rsp), %rax
movq 0x8(%rsp), %rcx
andq 0x30(%rcx), %rax
movl %eax, %edx
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x38(%rsp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x38(%rsp)
movl %edx, (%rax,%rcx,4)
movq 0x30(%rsp), %rdx
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movq %rdx, (%rax,%rcx,8)
movq $0x1, 0x18(%rsp)
jmp 0x1380f4
movq 0x18(%rsp), %rax
movq 0x8(%rsp), %rcx
cmpq 0x30(%rcx), %rax
jne 0x1380e4
jmp 0x138077
cmpq $0x0, 0x38(%rsp)
ja 0x1380b7
movq 0x7bf52(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x25fd6(%rip), %rsi     # 0x15e066
leaq 0x526bb(%rip), %rdx     # 0x18a752
leaq 0x522a1(%rip), %rcx     # 0x18a33f
leaq 0x4d5b9(%rip), %r8      # 0x18565e
movl $0x8b0, %r9d            # imm = 0x8B0
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x1380b9
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rax
movl %eax, %edx
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movl %edx, (%rax,%rcx,4)
movq $0x0, 0x18(%rsp)
jmp 0x1380f2
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x1380f4
movq 0x68(%rsp), %rax
movq 0x330(%rax), %rdi
movq 0x30(%rsp), %rsi
movq 0x68(%rsp), %rax
movq 0x358(%rax), %rax
movsbl 0x12(%rsp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edx
callq 0x13ca80
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x138132
movb 0x13(%rsp), %dl
movq 0x68(%rsp), %rax
movq 0x290(%rax), %rax
movq 0x40(%rsp), %rcx
movb %dl, (%rax,%rcx)
movzbl 0x13(%rsp), %eax
cmpl $0xff, %eax
jne 0x138165
movq 0x58(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x11ba00
movq 0x58(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x11bb30
jmp 0x138289
cmpl $0x0, 0x14(%rsp)
jge 0x1381ba
movq 0x68(%rsp), %rax
movq 0x290(%rax), %rdi
leaq 0x4d4cb(%rip), %rsi     # 0x18565e
movl $0x8c6, %edx            # imm = 0x8C6
callq 0xdab0
movq 0x68(%rsp), %rax
movq $0x0, 0x290(%rax)
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x13834f
jmp 0x1381bc
cmpl $0x0, 0x14(%rsp)
je 0x1381fb
movq 0x7be0e(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x25e92(%rip), %rsi     # 0x15e066
leaq 0x52591(%rip), %rdx     # 0x18a76c
leaq 0x5215d(%rip), %rcx     # 0x18a33f
leaq 0x4d475(%rip), %r8      # 0x18565e
movl $0x8ca, %r9d            # imm = 0x8CA
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x1381fd
movq 0x68(%rsp), %rax
testb $0x1, 0x2f0(%rax)
je 0x138287
cmpq $0x0, 0x18(%rsp)
jbe 0x138287
jmp 0x138215
cmpq $0x0, 0x38(%rsp)
jbe 0x13822d
movq 0x38(%rsp), %rax
movq 0x8(%rsp), %rcx
cmpq 0x28(%rcx), %rax
jbe 0x138265
movq 0x7bda4(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x25e28(%rip), %rsi     # 0x15e066
leaq 0x52533(%rip), %rdx     # 0x18a778
leaq 0x520f3(%rip), %rcx     # 0x18a33f
leaq 0x4d40b(%rip), %r8      # 0x18565e
movl $0x8cf, %r9d            # imm = 0x8CF
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x138267
movq 0x18(%rsp), %rax
subq $0x1, %rax
movl %eax, %edx
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1382f4
movq 0x68(%rsp), %rax
testb $0x1, 0x2f0(%rax)
je 0x1382df
movq 0x40(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x1382df
movq 0x38(%rsp), %rdx
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rax
addq $0x1, %rax
addq 0x28(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0x1382e1
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x137f65
movq 0x68(%rsp), %rax
testb $0x1, 0x2f0(%rax)
je 0x13833d
jmp 0x138304
movq 0x20(%rsp), %rax
movq 0x8(%rsp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x13833b
movq 0x38(%rsp), %rdx
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x138304
jmp 0x13833d
movq 0x58(%rsp), %rdi
callq 0x11bb80
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopl (%rax,%rax)