// File: /workspace/github_c_makefile_star2_O1/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, 0x58(%rsp)
movq %rdi, 0x50(%rsp)
testl %ecx, %ecx
je 0x319fd5
movl %ecx, %r12d
movq %rdx, %r13
movl %ecx, %eax
movq %rax, 0x60(%rsp)
leaq (,%rax,8), %rdi
leaq 0xd176a(%rip), %rsi     # 0x3eb4b1
movl $0x29, %edx
callq 0x1092b2
movq %rax, %r14
decl %r12d
pxor %xmm0, %xmm0
movdqa %xmm0, (%rsp)
movq %r13, 0x48(%rsp)
xorl %r15d, %r15d
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq %r12, 0x40(%rsp)
xorl %ebp, %ebp
movq %rax, 0x18(%rsp)
testq %r15, %r15
movq %rbp, 0x38(%rsp)
je 0x319dbc
movq -0x100(%r13), %rdi
callq 0xec1d8
movq %rax, %rbx
movq -0x8(%r14,%r15,8), %rax
addq %rbx, %rax
incq %rax
movq %rax, (%r14,%r15,8)
decq %rbx
jmp 0x319dca
movq $0x0, (%r14)
movq $-0x1, %rbx
movq (%r13), %rdi
callq 0xec1e8
movq %rax, 0x80(%rsp)
movq (%r13), %rdi
callq 0xf0b87
movq %rax, 0x78(%rsp)
movq (%r13), %rdi
callq 0xf0c8a
movq %rax, 0x70(%rsp)
movq (%r13), %rdi
callq 0xf0b9f
movq %rax, %rbp
movq (%r13), %rdi
callq 0xf0c9b
movq %rax, 0x68(%rsp)
movq (%r13), %rdi
callq 0xf0c37
movq %rax, %r14
movq (%r13), %rdi
callq 0xf0cac
movq %rax, %rcx
movq %rbp, %xmm0
movq %r14, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movdqa (%rsp), %xmm1
paddq %xmm0, %xmm1
movdqa %xmm1, (%rsp)
testq %r15, %r15
je 0x319e96
movq %rcx, %r14
movq -0x100(%r13), %rdi
movl -0xb8(%r13), %edx
movq %rbx, %rsi
callq 0xec1f8
movl %eax, %ebx
movq (%r13), %rdi
movl 0x48(%r13), %edx
xorl %esi, %esi
callq 0xec1f8
cmpb $-0x2, %bl
movq 0x38(%rsp), %rbp
jb 0x319ea2
cmpb $-0x2, %al
movq 0x18(%rsp), %rax
jb 0x319ebd
movdqa (%rsp), %xmm0
paddq 0x4414c(%rip), %xmm0    # 0x35dfe0
jmp 0x319eb8
movq 0x18(%rsp), %r14
movq 0x38(%rsp), %rbp
jmp 0x319ec3
cmpb $-0x3, %al
movq 0x18(%rsp), %rax
ja 0x319ebd
movdqa (%rsp), %xmm0
psubq 0x44128(%rip), %xmm0    # 0x35dfe0
movdqa %xmm0, (%rsp)
movq %r14, %rcx
movq %rax, %r14
addq 0x80(%rsp), %rbp
addq 0x78(%rsp), %r12
movq 0x70(%rsp), %rax
addq %rax, 0x20(%rsp)
movq 0x68(%rsp), %rax
addq %rax, 0x28(%rsp)
addq %rcx, 0x30(%rsp)
movq (%r13), %rdi
callq 0xec1d8
movq (%r13), %rdi
callq 0xec1d8
leaq 0xd15c9(%rip), %rdi     # 0x3eb4cb
movl %r15d, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x17070
incq %r15
addq $0x100, %r13            # imm = 0x100
cmpq %r15, 0x60(%rsp)
jne 0x319d8f
movq 0x40(%rsp), %rbx
movq %rbx, %rax
shlq $0x8, %rax
movq 0x48(%rsp), %r15
movq (%r15,%rax), %rdi
callq 0xec1d8
addq (%r14,%rbx,8), %rax
movq 0x50(%rsp), %rcx
movq %rax, (%rcx)
movq 0x58(%rsp), %rbx
movq %r12, (%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x28(%rbx)
movq 0x28(%rsp), %rax
movq %rax, 0x30(%rbx)
movaps (%rsp), %xmm0
movups %xmm0, 0x8(%rbx)
movq 0x30(%rsp), %rax
movq %rax, 0x38(%rbx)
movq (%r15), %rdi
callq 0xf0c7a
movq %rax, 0x18(%rbx)
movq (%r15), %rdi
callq 0xf0cbd
movq %rax, 0x40(%rbx)
movq -0x100(%r13), %rdi
callq 0xf0c82
movq %rax, 0x20(%rbx)
movq -0x100(%r13), %rdi
callq 0xf0cc5
movq %rax, 0x48(%rbx)
testq %rbp, %rbp
je 0x319fda
decq %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xf0e46
movq %r14, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x92508
callq 0x924cf
nop