// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/encseq2offset.c
// Function: gt_encseqtable2sequenceoffsets
GtUword *gt_encseqtable2sequenceoffsets(
                                    GtUword *totallength,
                                    GtSpecialcharinfo *specialcharinfo,
                                    const Suffixarray *suffixarraytable,
                                    unsigned int numofindexes)
{
  unsigned int idx;
  GtUchar lastofprevious, firstofcurrent;
  GtUword tmplength, GT_UNUSED numofsequences = 0, *sequenceoffsettable;
  uint64_t tmpspecialcharacters,
           tmpwildcards,
           tmpspecialranges,
           tmpwildcardranges,
           tmprealspecialranges,
           tmprealwildcardranges,
           tmpoffset;

  gt_assert(numofindexes > 0);
  sequenceoffsettable = gt_malloc(sizeof (*sequenceoffsettable) * numofindexes);
  tmpspecialcharacters = (uint64_t) (numofindexes-1);
  tmpwildcards = 0;
  tmpspecialranges = 0;
  tmpwildcardranges = 0;
  tmprealspecialranges = 0;
  tmprealwildcardranges = 0;
  for (idx=0; idx<numofindexes; idx++)
  {
    if (idx == 0)
    {
      tmplength = 0;
      sequenceoffsettable[idx] = 0;
    } else
    {
      tmplength = gt_encseq_total_length(suffixarraytable[idx - 1].encseq);
      sequenceoffsettable[idx] = sequenceoffsettable[idx-1] + tmplength + 1UL;
    }
    numofsequences += gt_encseq_num_of_sequences(suffixarraytable[idx].encseq);
    tmpspecialcharacters
      += (uint64_t) gt_encseq_specialcharacters(suffixarraytable[idx].encseq);
    tmpwildcards
      += (uint64_t) gt_encseq_wildcards(suffixarraytable[idx].encseq);
    tmpspecialranges
      += (uint64_t) gt_encseq_specialranges(suffixarraytable[idx].encseq);
    tmpwildcardranges
      += (uint64_t) gt_encseq_wildcardranges(suffixarraytable[idx].encseq);
    tmprealspecialranges
      += (uint64_t) gt_encseq_realspecialranges(suffixarraytable[idx].encseq);
    tmprealwildcardranges
      += (uint64_t) gt_encseq_realwildcardranges(suffixarraytable[idx].encseq);
    if (idx > 0)
    {
      /* Random access */
      lastofprevious
        = gt_encseq_get_encoded_char(suffixarraytable[idx-1].encseq,
                                     tmplength-1,
                                     suffixarraytable[idx - 1].readmode);
      /* Random access */
      firstofcurrent
        = gt_encseq_get_encoded_char(suffixarraytable[idx].encseq,
                                     0,
                                     suffixarraytable[idx].readmode);
      if (GT_ISSPECIAL(lastofprevious))
      {
        if (GT_ISSPECIAL(firstofcurrent))
        {
          tmpspecialranges--;
          tmprealspecialranges--;
        }
      } else
      {
        if (GT_ISNOTSPECIAL(firstofcurrent))
        {
          tmpspecialranges++;
          tmprealspecialranges++;
        }
      }
    }
    tmpoffset = (uint64_t) sequenceoffsettable[idx] +
       (uint64_t) gt_encseq_total_length(suffixarraytable[idx].encseq);
    (void) CALLCASTFUNC(uint64_t,unsigned_long,tmpoffset);
    (void) CALLCASTFUNC(uint64_t,unsigned_long,tmpspecialcharacters);
    (void) CALLCASTFUNC(uint64_t,unsigned_long,tmpwildcards);
    (void) CALLCASTFUNC(uint64_t,unsigned_long,tmpspecialranges);
    (void) CALLCASTFUNC(uint64_t,unsigned_long,tmpwildcardranges);
    (void) CALLCASTFUNC(uint64_t,unsigned_long,tmprealspecialranges);
    (void) CALLCASTFUNC(uint64_t,unsigned_long,tmprealwildcardranges);
    printf("# seqlen[%u] = "GT_WU"\n",
           idx,
           gt_encseq_total_length(suffixarraytable[idx].encseq));
  }
  tmplength = gt_encseq_total_length(suffixarraytable[numofindexes -1].encseq);
  *totallength = sequenceoffsettable[numofindexes-1] + tmplength;
  specialcharinfo->specialcharacters = (GtUword) tmpspecialcharacters;
  specialcharinfo->wildcards = (GtUword) tmpwildcards;
  specialcharinfo->specialranges = (GtUword) tmpspecialranges;
  specialcharinfo->wildcardranges = (GtUword) tmpwildcardranges;
  specialcharinfo->realspecialranges = (GtUword) tmprealspecialranges;
  specialcharinfo->realwildcardranges = (GtUword) tmprealwildcardranges;
  specialcharinfo->lengthofspecialprefix
    = gt_encseq_lengthofspecialprefix(suffixarraytable[0].encseq);
  specialcharinfo->lengthofwildcardprefix
    = gt_encseq_lengthofwildcardprefix(suffixarraytable[0].encseq);
  specialcharinfo->lengthofspecialsuffix
    = gt_encseq_lengthofspecialsuffix(suffixarraytable[idx-1].encseq);
  specialcharinfo->lengthofwildcardsuffix
    = gt_encseq_lengthofwildcardsuffix(suffixarraytable[idx-1].encseq);
  gt_assert(numofsequences > 0);
#ifndef NDEBUG
  gt_GtSpecialcharinfo_check(specialcharinfo,numofsequences - 1);
#endif
  return sequenceoffsettable;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, 0x50(%rsp)
movq %rdi, 0x48(%rsp)
testl %ecx, %ecx
je 0x2aee89
movl %ecx, %ebx
movq %rdx, %r14
movl %ecx, %eax
movq %rax, 0x60(%rsp)
leaq (,%rax,8), %rdi
leaq 0xd355f(%rip), %rsi     # 0x38216d
pushq $0x29
popq %rdx
callq 0x93160
movq %rax, %r12
decl %ebx
pxor %xmm0, %xmm0
movdqa %xmm0, (%rsp)
movq %r14, 0x40(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %rbx, 0x38(%rsp)
movq %rbx, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
xorl %ebp, %ebp
movq %rax, 0x58(%rsp)
cmpq %r15, 0x60(%rsp)
je 0x2aeddd
movq %r13, 0x10(%rsp)
testq %r15, %r15
movq %rbp, 0x30(%rsp)
je 0x2aec8f
movq -0x100(%r14), %rdi
callq 0x7055e
movq %rax, %r13
movq -0x8(%r12,%r15,8), %rax
addq %r13, %rax
incq %rax
movq %rax, (%r12,%r15,8)
decq %r13
jmp 0x2aec98
andq $0x0, (%r12)
pushq $-0x1
popq %r13
movq (%r14), %rdi
callq 0x705a1
movq %rax, 0x80(%rsp)
movq (%r14), %rdi
callq 0x760bc
movq %rax, 0x78(%rsp)
movq (%r14), %rdi
callq 0x7628b
movq %rax, 0x70(%rsp)
movq (%r14), %rdi
callq 0x760d4
movq %rax, %rbx
movq (%r14), %rdi
callq 0x7629c
movq %rax, 0x68(%rsp)
movq (%r14), %rdi
callq 0x76238
movq %rax, %rbp
movq (%r14), %rdi
callq 0x762ad
movq %rax, %r12
movq %rbx, %xmm1
movq %rbp, %xmm0
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
paddq (%rsp), %xmm1
movdqa %xmm1, (%rsp)
testq %r15, %r15
je 0x2aed55
movq -0x100(%r14), %rdi
movl -0xb8(%r14), %edx
movq %r13, %rsi
callq 0x705e4
movl %eax, %ebx
movq (%r14), %rdi
movl 0x48(%r14), %edx
xorl %esi, %esi
callq 0x705e4
cmpb $-0x2, %bl
movq 0x30(%rsp), %rbp
jb 0x2aed61
cmpb $-0x2, %al
movq 0x10(%rsp), %r13
jb 0x2aed7c
movdqa (%rsp), %xmm0
paddq 0x4626d(%rip), %xmm0    # 0x2f4fc0
jmp 0x2aed77
movq 0x10(%rsp), %r13
movq 0x30(%rsp), %rbp
jmp 0x2aed7c
cmpb $-0x3, %al
movq 0x10(%rsp), %r13
ja 0x2aed7c
movdqa (%rsp), %xmm0
psubq 0x46249(%rip), %xmm0    # 0x2f4fc0
movdqa %xmm0, (%rsp)
addq 0x80(%rsp), %r13
movq 0x78(%rsp), %rax
addq %rax, 0x28(%rsp)
movq 0x70(%rsp), %rax
addq %rax, 0x20(%rsp)
movq 0x68(%rsp), %rax
addq %rax, 0x18(%rsp)
addq %r12, %rbp
movq (%r14), %rdi
callq 0x7055e
movq (%r14), %rdi
callq 0x7055e
leaq 0xd33cb(%rip), %rdi     # 0x382187
movl %r15d, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x17070
incq %r15
addq $0x100, %r14            # imm = 0x100
movq 0x58(%rsp), %r12
jmp 0x2aec52
movq 0x38(%rsp), %r14
movq %r14, %rbx
shlq $0x8, %rbx
movq 0x40(%rsp), %r15
movq (%r15,%rbx), %rdi
callq 0x7055e
addq (%r12,%r14,8), %rax
movq 0x48(%rsp), %rcx
movq %rax, (%rcx)
movq 0x50(%rsp), %r14
movq 0x28(%rsp), %rax
movq %rax, (%r14)
movq 0x20(%rsp), %rax
movq %rax, 0x28(%r14)
movq 0x18(%rsp), %rax
movq %rax, 0x30(%r14)
movaps (%rsp), %xmm0
movups %xmm0, 0x8(%r14)
movq %rbp, 0x38(%r14)
movq (%r15), %rdi
callq 0x7627b
movq %rax, 0x18(%r14)
movq (%r15), %rdi
callq 0x762be
movq %rax, 0x40(%r14)
movq (%r15,%rbx), %rdi
callq 0x76283
movq %rax, 0x20(%r14)
movq (%r15,%rbx), %rdi
callq 0x762c6
movq %rax, 0x48(%r14)
testq %r13, %r13
je 0x2aeeb5
decq %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x7649a
movq %r12, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1890d8(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x36179(%rip), %rsi     # 0x2e5013
leaq 0xd329c(%rip), %rdx     # 0x38213d
leaq 0xd32a6(%rip), %rcx     # 0x38214e
leaq 0xd32be(%rip), %r8      # 0x38216d
pushq $0x28
popq %r9
jmp 0x2aeee1
movq 0x1890ac(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3614d(%rip), %rsi     # 0x2e5013
leaq 0x97102(%rip), %rdx     # 0x345fcf
leaq 0xd327a(%rip), %rcx     # 0x38214e
leaq 0xd3292(%rip), %r8      # 0x38216d
movl $0x81, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
nopl (%rax)