// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/rdj-ovlfind-gusfield.c
// Function: gt_rdj_gusfield
void gt_rdj_gusfield(Sequentialsuffixarrayreader *ssar,
    GtUword min_length, bool find_submaximal, bool show_progressbar,
    GtUword firstrevcompl, GtSpmproc proc, void* procdata)
{

  /* index */
  const Suffixarray *sarr;
  const GtEncseq *encseq;
  const GtUword *suftab;
  GtUword nofsequences;
  GtReadmode readmode;
  GtUword totallength;
  unsigned int numofchars;
  GtBitsequence *sspbittab;

  /* splitting */
  GtArrayRdjGusfieldIndexBounds stack;
  GtArrayBoundswithchar bwci;
  RdjGusfieldIndexBounds parent, child, *parent_stack_ptr;
  GtUword seqpos_idx;
  GtUword idx;

  /* stacks for spm determination */
  GtArrayGtUword *matchlen_stacks;
  GtBitsequence *has_match;

  /* progressbar */
  GtUint64 progress;

  gt_assert(min_length>0);
  gt_assert(ssar != NULL);

  sarr             = gt_suffixarraySequentialsuffixarrayreader(ssar);
  encseq           = gt_encseqSequentialsuffixarrayreader(ssar);
  suftab           = gt_suftabSequentialsuffixarrayreader(ssar);
  nofsequences     = gt_encseq_num_of_sequences(encseq);
  readmode         = gt_readmodeSequentialsuffixarrayreader(ssar);
  totallength      = gt_encseq_total_length(encseq);
  numofchars       = gt_alphabet_num_of_chars(gt_encseq_alphabet(encseq));

  /* prepare sspbittab */
  GT_INITBITTAB(sspbittab, totallength+1);
  for (idx = 1UL; idx <= nofsequences - 1; idx++)
  {
    GT_SETIBIT(sspbittab, gt_encseq_seqstartpos(encseq, idx) - 1);
  }
  GT_SETIBIT(sspbittab, totallength);

  matchlen_stacks = gt_malloc(sizeof *matchlen_stacks * nofsequences);
  GT_INITBITTAB(has_match, nofsequences);

  for (idx = 0UL; idx < nofsequences; idx++)
  {
    GT_INITARRAY(&(matchlen_stacks[idx]), GtUword);
  }

  if (show_progressbar)
  {
    progress = 0ULL;
    gt_progressbar_start(&progress, (GtUint64)totallength);
  }

  GT_INITARRAY(&stack, RdjGusfieldIndexBounds);

  /* prepare bwci array */
  bwci.spaceBoundswithchar = gt_malloc(sizeof *bwci.spaceBoundswithchar *
                                       (numofchars + 1));
  bwci.nextfreeBoundswithchar = 0UL;
  bwci.allocatedBoundswithchar = (GtUword) (numofchars + 1);

  /* get rid of compiler warnings */
  parent.specials_leftbound = 0UL;
  child.specials_leftbound = 0UL;

  /* start at [0,n] */
  parent.offset = 0UL;
  parent.leftbound = 0UL;
  parent.rightbound = totallength;
  parent.visited = false;
  GT_STOREINARRAY(&stack, RdjGusfieldIndexBounds, 1UL, parent);

  while (stack.nextfreeRdjGusfieldIndexBounds > 0UL)
  {
    parent_stack_ptr = stack.spaceRdjGusfieldIndexBounds +
                          stack.nextfreeRdjGusfieldIndexBounds - 1;
    parent = *parent_stack_ptr;

    if (parent.visited)
    {
      /* search terminal edges and pop spm stacks */
      if (parent.specials_leftbound <= parent.rightbound &&
           parent.offset >= min_length)
        processspecials(parent.specials_leftbound, parent.rightbound,
                        parent.offset, parent.visited, suftab, encseq,
                        totallength, nofsequences, matchlen_stacks, has_match,
                        sspbittab);
      stack.nextfreeRdjGusfieldIndexBounds--;
      continue;
    }

    parent_stack_ptr->visited = true;

    /* split interval */
    gt_lcpintervalsplitwithoutspecial(&bwci, encseq, readmode,
                                   totallength, suftab,
                                   parent.offset,
                                   parent.leftbound,
                                   parent.rightbound);

    if (bwci.nextfreeBoundswithchar > 0)
    {
      parent.specials_leftbound = bwci.spaceBoundswithchar[
                                    bwci.nextfreeBoundswithchar-1].rbound+1;
    }
    else
    {
      parent.specials_leftbound = parent.leftbound;
    }
    parent_stack_ptr->specials_leftbound = parent.specials_leftbound;

    /* search terminal edges and push on spm stacks */
    if (parent.specials_leftbound <= parent.rightbound &&
         parent.offset >= min_length)
      processspecials(parent.specials_leftbound, parent.rightbound,
                      parent.offset, parent.visited, suftab, encseq,
                      totallength, nofsequences, matchlen_stacks, has_match,
                      sspbittab);

    for (idx = bwci.nextfreeBoundswithchar; idx > 0; idx--)
    {
      child.leftbound = bwci.spaceBoundswithchar[idx-1].lbound;
      child.rightbound = bwci.spaceBoundswithchar[idx-1].rbound;
      child.visited = false;

      if (child.leftbound == child.rightbound)
      {
        if (parent.offset >= min_length)
          rdj_gusfield_processleafedge(suftab[child.leftbound], encseq,
                          nofsequences, matchlen_stacks, has_match, sspbittab,
                          find_submaximal, firstrevcompl, proc, procdata);
        if (show_progressbar) progress++;
      }
      else
      {
        maximize_child_offset(&child, sarr);
        GT_STOREINARRAY(&stack, RdjGusfieldIndexBounds, 1, child);
      }
    }

    for (seqpos_idx = parent.specials_leftbound;
         seqpos_idx <= parent.rightbound;
         seqpos_idx++)
    {
      if (parent.offset >= min_length)
        rdj_gusfield_processleafedge(suftab[seqpos_idx], encseq,
                        nofsequences, matchlen_stacks, has_match, sspbittab,
                        find_submaximal, firstrevcompl, proc, procdata);
      if (show_progressbar) progress++;
    }
  }

  GT_FREEARRAY(&stack, RdjGusfieldIndexBounds);
  GT_FREEARRAY(&bwci,Boundswithchar);

  if (show_progressbar) gt_progressbar_stop();

  for (idx = 0; idx < nofsequences; idx++)
  {
    GT_FREEARRAY(&(matchlen_stacks[idx]), GtUword);
  }
  gt_free(has_match);
  gt_free(sspbittab);
  gt_free(matchlen_stacks);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r9, 0xa8(%rsp)
movq %r8, 0xa0(%rsp)
movl %ecx, 0x14(%rsp)
movl %edx, 0x68(%rsp)
testq %rsi, %rsi
je 0x1d30d8
movq %rdi, %rbx
movq %rsi, 0x40(%rsp)
testq %rdi, %rdi
je 0x1d30dd
movabsq $-0x8000000000000000, %rbp # imm = 0x8000000000000000
movq %rbx, %rdi
callq 0x1ae58a
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
callq 0x1ae549
movq %rax, %r14
movq %rbx, %rdi
callq 0x1ae568
movq %rax, 0x30(%rsp)
movq %r14, %rdi
callq 0xec1e8
movq %rax, %r12
movq %rbx, %rdi
callq 0x1ae559
movl %eax, 0x6c(%rsp)
movq %r14, %rdi
callq 0xec1d8
movq %rax, %r15
movq %r14, %rdi
callq 0xf02da
movq %rax, %rdi
callq 0xd3713
movq %rax, 0x20(%rsp)
leaq 0x1(%r15), %rax
movq %r15, 0x38(%rsp)
shrq $0x6, %r15
cmpq $0x40, %rax
movq %r15, (%rsp)
leaq 0x8(,%r15,8), %rbx
movl $0x8, %eax
cmovbq %rax, %rbx
leaq 0x1e4e50(%rip), %rdx    # 0x3b7746
xorl %edi, %edi
movq %rbx, %rsi
movl $0xe7, %ecx
callq 0x1094e6
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x173a0
movq %r12, 0x58(%rsp)
movq %r12, %r15
decq %r15
je 0x1d295a
movl $0x1, %ebx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xefce0
leal -0x1(%rax), %ecx
movq %rbp, %r12
shrq %cl, %r12
movq %r14, %rdi
movq %rbx, %rsi
callq 0xefce0
decq %rax
shrq $0x6, %rax
orq %r12, (%r13,%rax,8)
incq %rbx
cmpq %r15, %rbx
jbe 0x1d2927
movq %r14, 0x50(%rsp)
movq %rbp, %rax
movq 0x38(%rsp), %rcx
shrq %cl, %rax
movq %r13, 0x60(%rsp)
movq (%rsp), %rcx
orq %rax, (%r13,%rcx,8)
movq 0x58(%rsp), %rbp
leaq (,%rbp,8), %rax
leaq (%rax,%rax,2), %r12
leaq 0x1e4db6(%rip), %r13    # 0x3b7746
movq %r12, %rdi
movq %r13, %rsi
movl $0xee, %edx
callq 0x1092b2
movq %rax, %rbx
movq %r15, 0x8(%rsp)
shrq $0x3, %r15
movabsq $0x1ffffffffffffff8, %rax # imm = 0x1FFFFFFFFFFFFFF8
andq %rax, %r15
addq $0x8, %r15
cmpq $0x40, %rbp
movl $0x8, %eax
cmovbq %rax, %r15
xorl %edi, %edi
movq %r15, %rsi
movq %r13, %rdx
movl $0xef, %ecx
callq 0x1094e6
movq %rax, 0x48(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x173a0
testq %rbp, %rbp
je 0x1d2a00
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x173a0
movq %rbx, (%rsp)
cmpb $0x0, 0x14(%rsp)
movq 0x40(%rsp), %r13
je 0x1d2a29
leaq 0xc0(%rsp), %rdi
movq $0x0, (%rdi)
movq 0x38(%rsp), %rsi
callq 0x110c6c
movq 0x20(%rsp), %rbx
incl %ebx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,2), %rdi
leaq 0x1e4d03(%rip), %r15    # 0x3b7746
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x1092b2
movq %rax, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
movq %rbx, 0x78(%rsp)
movl $0x28, %esi
xorl %edi, %edi
movq %r15, %rdx
movl $0x10d, %ecx            # imm = 0x10D
callq 0x1094e6
testq %rax, %rax
movq 0x60(%rsp), %rbp
je 0x1d30e2
movq %rax, %rsi
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsi)
movq $0x0, 0x18(%rsi)
movb $0x0, 0x20(%rsi)
movl $0x1, %eax
movl $0x1, %ecx
movq %rcx, 0xb0(%rsp)
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq 0x30(%rsp), %r8
movq (%rsp), %r9
movq 0x8(%rsp), %r10
movq %rax, 0x20(%rsp)
leaq (%rax,%rax,4), %rax
movq %rsi, %rbx
leaq (%rsi,%rax,8), %r12
movq -0x28(%r12), %r15
movq -0x18(%r12), %r14
testb $0x1, -0x8(%r12)
je 0x1d2bb0
movq -0x10(%r12), %r12
cmpq %r14, %r12
seta %al
cmpq %r13, %r15
setb %cl
orb %al, %cl
jne 0x1d2b9a
movq (%r8,%r12,8), %rsi
leaq (%rsi,%r15), %rcx
movq %rdi, %rax
shrq %cl, %rax
shrq $0x6, %rcx
testq %rax, (%rbp,%rcx,8)
je 0x1d2b8e
movq %r10, %rax
cmpq 0x38(%rsp), %rsi
je 0x1d2b54
movq 0x50(%rsp), %rdi
callq 0xefc48
movq 0x8(%rsp), %r10
movq (%rsp), %r9
movq 0x30(%rsp), %r8
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
leaq (%rax,%rax,2), %rdx
movq 0x10(%r9,%rdx,8), %rcx
testq %rcx, %rcx
je 0x1d30c9
leaq (%r9,%rdx,8), %rdx
addq $0x10, %rdx
decq %rcx
movq %rcx, (%rdx)
jne 0x1d2b8e
movq %rdi, %rdx
movl %eax, %ecx
shrq %cl, %rdx
notq %rdx
shrq $0x6, %rax
movq 0x48(%rsp), %rcx
andq %rdx, (%rcx,%rax,8)
incq %r12
cmpq %r14, %r12
jbe 0x1d2b0f
movq 0x20(%rsp), %rax
decq %rax
movq %rbx, %rsi
jne 0x1d2ad0
jmp 0x1d2fe6
movq -0x20(%r12), %r13
movb $0x1, -0x8(%r12)
leaq 0x70(%rsp), %rdi
movq 0x50(%rsp), %rsi
movl 0x6c(%rsp), %edx
movq 0x38(%rsp), %rcx
movq %r15, %r9
pushq %r14
pushq %r13
callq 0x1b00aa
movq %r13, %rcx
addq $0x10, %rsp
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x1d2bff
movq 0x70(%rsp), %rcx
leaq (%rax,%rax,2), %rax
movq -0x10(%rcx,%rax,8), %rcx
incq %rcx
movq %rcx, -0x10(%r12)
movq %rcx, 0x90(%rsp)
cmpq %r14, %rcx
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq 0x18(%rsp), %r8
movq (%rsp), %r9
movq 0x8(%rsp), %r10
movq 0x40(%rsp), %r13
ja 0x1d2d2a
cmpq %r13, %r15
jb 0x1d2d2a
movq 0x90(%rsp), %r12
movq 0x30(%rsp), %rax
movq (%rax,%r12,8), %rsi
leaq (%rsi,%r15), %rcx
movq %rdi, %rax
shrq %cl, %rax
shrq $0x6, %rcx
testq %rax, (%rbp,%rcx,8)
je 0x1d2d1e
movq %r10, %rcx
cmpq 0x38(%rsp), %rsi
je 0x1d2c94
movq 0x50(%rsp), %rdi
callq 0xefc48
movq 0x8(%rsp), %r10
movq (%rsp), %r9
movq 0x18(%rsp), %r8
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq %rax, %rcx
movq %rdi, %rax
shrq %cl, %rax
leaq (%rcx,%rcx,2), %rdx
shrq $0x6, %rcx
movq 0x48(%rsp), %rsi
orq %rax, (%rsi,%rcx,8)
leaq (%r9,%rdx,8), %r13
movq 0x8(%r9,%rdx,8), %rax
cmpq %rax, 0x10(%r9,%rdx,8)
jb 0x1d2cfc
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%r13)
movq (%r13), %rdi
leaq 0x8(,%rax,8), %rsi
leaq 0x1e4a70(%rip), %rdx    # 0x3b7746
movl $0xaf, %ecx
callq 0x1094e6
movq 0x8(%rsp), %r10
movq (%rsp), %r9
movq 0x18(%rsp), %r8
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq %rax, (%r13)
movq (%r13), %rax
testq %rax, %rax
je 0x1d30ce
movq 0x10(%r13), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r13)
movq %r15, (%rax,%rcx,8)
movq 0x40(%rsp), %r13
incq %r12
cmpq %r14, %r12
jbe 0x1d2c43
movq 0x80(%rsp), %rdx
movzbl 0x68(%rsp), %eax
movq %rax, 0x98(%rsp)
testq %rdx, %rdx
movq 0x58(%rsp), %r12
movq %rbx, %rsi
je 0x1d2f35
movq 0x70(%rsp), %rax
decq %rdx
leaq (%rdx,%rdx,2), %rcx
movq (%rax,%rcx,8), %rbx
movq 0x8(%rax,%rcx,8), %rbp
cmpq %rbp, %rbx
jne 0x1d2dfa
cmpq %r13, %r15
movq 0x60(%rsp), %rbp
jb 0x1d2de2
movq 0x30(%rsp), %rax
movq (%rax,%rbx,8), %rdi
movq %rsi, 0x28(%rsp)
movq 0x50(%rsp), %rsi
movq %rdx, %rbx
movq %r12, %rdx
movq %r9, %rcx
movq 0x48(%rsp), %r8
movq %rbp, %r9
pushq 0x110(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
callq 0x1d30e7
movq %rbx, %rdx
movq 0x48(%rsp), %rsi
movq 0x28(%rsp), %r10
movq 0x20(%rsp), %r9
movq 0x38(%rsp), %r8
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
addq $0x20, %rsp
cmpb $0x0, 0x14(%rsp)
je 0x1d2f2c
incq 0xc0(%rsp)
jmp 0x1d2f2c
movq %rdx, 0xd0(%rsp)
movq %rsi, 0x28(%rsp)
leaq 0x1(%rbx), %rsi
movq %r8, %rdi
callq 0x1d33ea
movq %rax, %r12
movq %rbx, 0xb8(%rsp)
leaq 0x2(%rbx), %r13
cmpq %rbp, %r13
ja 0x1d2e46
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1d33ea
cmpq %r12, %rax
cmovbq %rax, %r12
incq %r13
cmpq %rbp, %r13
jbe 0x1d2e2c
movq 0xb0(%rsp), %rcx
cmpq %rcx, 0x20(%rsp)
jae 0x1d2e79
movq 0x40(%rsp), %r13
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq 0x18(%rsp), %r8
movq (%rsp), %r9
movq 0x8(%rsp), %r10
movq 0x28(%rsp), %rsi
jmp 0x1d2ec6
leaq 0x8(,%rcx,8), %rax
incq %rcx
movq %rcx, 0xb0(%rsp)
leaq (%rax,%rax,4), %rsi
movq 0x28(%rsp), %rdi
leaq 0x1e48aa(%rip), %rdx    # 0x3b7746
movl $0x14f, %ecx            # imm = 0x14F
callq 0x1094e6
movq %rax, %rsi
movq 0x40(%rsp), %r13
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq 0x18(%rsp), %r8
movq (%rsp), %r9
movq 0x8(%rsp), %r10
movq 0xb8(%rsp), %rdx
testq %rsi, %rsi
je 0x1d30d3
movq 0x20(%rsp), %rcx
leaq (%rcx,%rcx,4), %rax
incq %rcx
movq %rcx, 0x20(%rsp)
movq %r12, (%rsi,%rax,8)
movq %rdx, 0x8(%rsi,%rax,8)
movq %rbp, 0x10(%rsi,%rax,8)
movq $0x0, 0x18(%rsi,%rax,8)
movb $0x0, 0x20(%rsi,%rax,8)
movl 0xc9(%rsp), %ecx
movl 0xcc(%rsp), %edx
movl %ecx, 0x21(%rsi,%rax,8)
movl %edx, 0x24(%rsi,%rax,8)
movq 0x58(%rsp), %r12
movq 0x60(%rsp), %rbp
movq 0xd0(%rsp), %rdx
testq %rdx, %rdx
jne 0x1d2d50
movq 0x90(%rsp), %rax
cmpq %r14, %rax
movq 0x30(%rsp), %r8
movq %rsi, 0x28(%rsp)
ja 0x1d2fd6
cmpq %r13, %r15
jb 0x1d2fbb
movq (%r8,%rax,8), %rdi
movq 0x50(%rsp), %rsi
movq %r12, %rdx
movq %r13, %rbx
movq %rax, %r13
movq %r9, %rcx
movq 0x48(%rsp), %r8
movq %rbp, %r9
pushq 0x110(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
callq 0x1d30e7
movq %r13, %rax
movq %rbx, %r13
movq 0x48(%rsp), %rsi
movq 0x28(%rsp), %r10
movq 0x20(%rsp), %r9
movq 0x50(%rsp), %r8
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
addq $0x20, %rsp
cmpb $0x0, 0x14(%rsp)
je 0x1d2fca
incq 0xc0(%rsp)
incq %rax
cmpq %r14, %rax
jbe 0x1d2f50
movq 0x20(%rsp), %rax
testq %rax, %rax
jne 0x1d2ad0
jmp 0x1d2feb
movq 0x58(%rsp), %r12
movq %rsi, %rdi
leaq 0x1e4751(%rip), %rsi    # 0x3b7746
movl $0x15f, %edx            # imm = 0x15F
callq 0x109670
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x1d302e
leaq 0x1e4736(%rip), %rsi    # 0x3b7746
movl $0x160, %edx            # imm = 0x160
callq 0x109670
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
cmpb $0x0, 0x14(%rsp)
je 0x1d303a
callq 0x111189
testq %r12, %r12
movq (%rsp), %rbx
je 0x1d307e
leaq 0x1e46fc(%rip), %r15    # 0x3b7746
movq %rbx, %r14
movq (%r14), %rdi
testq %rdi, %rdi
je 0x1d3075
movq %r15, %rsi
movl $0x166, %edx            # imm = 0x166
callq 0x109670
movq (%rsp), %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x0, 0x10(%r14)
addq $0x18, %r14
decq %r12
jne 0x1d304d
leaq 0x1e46c1(%rip), %r15    # 0x3b7746
movq 0x48(%rsp), %rdi
movq %r15, %rsi
movl $0x168, %edx            # imm = 0x168
callq 0x109670
movq %rbp, %rdi
movq %r15, %rsi
movl $0x169, %edx            # imm = 0x169
callq 0x109670
movq %rbx, %rdi
movq %r15, %rsi
movl $0x16a, %edx            # imm = 0x16A
callq 0x109670
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6c353
callq 0x6c2e1
callq 0x6c31a
callq 0x6c3fe
callq 0x6c3c5
callq 0x6c38c