// File: /workspace/github_c_makefile_star2_O2/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 $0xc8, %rsp
movq %r9, 0xa8(%rsp)
movq %r8, 0xa0(%rsp)
movl %ecx, 0x14(%rsp)
movl %edx, 0x6c(%rsp)
movq %rsi, 0x50(%rsp)
testq %rsi, %rsi
je 0x17a4d9
movq %rdi, %r14
testq %rdi, %rdi
je 0x17a50a
movabsq $-0x8000000000000000, %rbp # imm = 0x8000000000000000
movq %r14, %rdi
callq 0x151cfb
movq %rax, 0xb0(%rsp)
movq %r14, %rdi
callq 0x151c21
movq %rax, %rbx
movq %r14, %rdi
callq 0x151ca6
movq %rax, 0x38(%rsp)
movq %rbx, %rdi
callq 0x705a1
movq %rax, %r12
movq %r14, %rdi
callq 0x151c64
movl %eax, 0x68(%rsp)
movq %rbx, %rdi
callq 0x7055e
movq %rax, %r14
movq %rbx, 0x30(%rsp)
movq %rbx, %rdi
callq 0x754dd
movq %rax, %rdi
callq 0x56c8e
movq %rax, 0x8(%rsp)
leaq 0x1(%r14), %rax
movq %r14, 0x20(%rsp)
movq %r14, %rbx
shrq $0x6, %rbx
cmpq $0x40, %rax
leaq 0x8(,%rbx,8), %r15
pushq $0x8
popq %rax
cmovbq %rax, %r15
leaq 0x1d4573(%rip), %rdx    # 0x34e496
xorl %edi, %edi
movq %r15, %rsi
movl $0xe7, %ecx
callq 0x93472
movq %rax, 0x18(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x17380
movq %r12, 0x60(%rsp)
leaq -0x1(%r12), %r15
pushq $0x1
popq %r13
movq 0x30(%rsp), %r14
cmpq %r15, %r13
ja 0x179f90
movq %r14, %rdi
movq %r13, %rsi
callq 0x74d9c
leal -0x1(%rax), %ecx
movq %rbp, %r12
shrq %cl, %r12
movq %r14, %rdi
movq %r13, %rsi
callq 0x74d9c
decq %rax
shrq $0x6, %rax
movq 0x18(%rsp), %rcx
orq %r12, (%rcx,%rax,8)
incq %r13
jmp 0x179f57
movq 0x20(%rsp), %rcx
shrq %cl, %rbp
movq 0x18(%rsp), %rax
orq %rbp, (%rax,%rbx,8)
movq 0x60(%rsp), %r13
imulq $0x18, %r13, %rdi
leaq 0x1d44e5(%rip), %r12    # 0x34e496
movq %r12, %rsi
movl $0xee, %edx
callq 0x93160
movq %rax, %rbx
shrq $0x3, %r15
movabsq $0x1ffffffffffffff8, %rax # imm = 0x1FFFFFFFFFFFFFF8
andq %rax, %r15
addq $0x8, %r15
cmpq $0x40, %r13
pushq $0x8
popq %rax
cmovbq %rax, %r15
xorl %edi, %edi
movq %r15, %rsi
movq %r12, %rdx
movl $0xef, %ecx
callq 0x93472
movq %rax, 0x40(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x17380
xorps %xmm0, %xmm0
movq %rbx, 0x28(%rsp)
movq %r13, %rcx
subq $0x1, %rcx
jb 0x17a024
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
addq $0x18, %rbx
jmp 0x17a010
cmpb $0x0, 0x14(%rsp)
je 0x17a041
leaq 0xb8(%rsp), %rdi
andq $0x0, (%rdi)
movq 0x20(%rsp), %rsi
callq 0x9c79c
movq 0x8(%rsp), %rbx
incl %ebx
imulq $0x18, %rbx, %rdi
leaq 0x1d4443(%rip), %r15    # 0x34e496
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x93160
movq %rax, 0x70(%rsp)
andq $0x0, 0x80(%rsp)
movq %rbx, 0x78(%rsp)
pushq $0x28
popq %rsi
xorl %edi, %edi
movq %r15, %rdx
movl $0x10d, %ecx            # imm = 0x10D
callq 0x93472
testq %rax, %rax
je 0x17a538
movq %rax, %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rcx)
andq $0x0, 0x18(%rcx)
movb $0x0, 0x20(%rcx)
pushq $0x1
popq %rax
movq %rax, 0x90(%rsp)
movq %rax, %rdx
imulq $0x28, %rdx, %rax
movq %rcx, %r14
leaq (%rcx,%rax), %r12
addq $-0x8, %r12
movq %rdx, %rbx
movq %rdx, %rax
subq $0x1, %rbx
jb 0x17a406
movq -0x20(%r12), %r9
movq -0x10(%r12), %r15
testb $0x1, (%r12)
je 0x17a139
movq -0x8(%r12), %rdi
cmpq %r15, %rdi
seta %al
cmpq 0x50(%rsp), %r9
setb %cl
orb %al, %cl
jne 0x17a130
subq $0x8, %rsp
movq %r15, %rsi
movq %r9, %rdx
pushq $0x1
popq %rcx
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %r9
pushq 0x20(%rsp)
pushq 0x50(%rsp)
pushq 0x40(%rsp)
pushq %r13
pushq 0x48(%rsp)
callq 0x17a59e
addq $0x30, %rsp
addq $-0x28, %r12
movq %rbx, %rax
jmp 0x17a0cc
movq %rax, 0x48(%rsp)
movq -0x18(%r12), %rbx
movb $0x1, (%r12)
leaq 0x70(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl 0x68(%rsp), %edx
movq 0x20(%rsp), %rcx
movq 0x38(%rsp), %r8
movq %r9, 0x8(%rsp)
pushq %r15
pushq %rbx
callq 0x153b5f
popq %rax
popq %rcx
movq 0x80(%rsp), %rcx
testq %rcx, %rcx
je 0x17a193
movq 0x70(%rsp), %rax
movq %rcx, %rdx
imulq $0x18, %rcx, %rcx
movq -0x10(%rax,%rcx), %rbx
movq %rdx, %rcx
incq %rbx
movq %rbx, -0x8(%r12)
cmpq %r15, %rbx
ja 0x17a1ec
movq 0x8(%rsp), %rdx
cmpq 0x50(%rsp), %rdx
movq %r14, %r12
jb 0x17a1f4
subq $0x8, %rsp
movq %rbx, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %r9
pushq 0x20(%rsp)
pushq 0x50(%rsp)
pushq 0x40(%rsp)
pushq %r13
pushq 0x48(%rsp)
callq 0x17a59e
movq 0x38(%rsp), %rdx
addq $0x30, %rsp
movq 0x80(%rsp), %rcx
jmp 0x17a1f4
movq %r14, %r12
movq 0x8(%rsp), %rdx
movq %r12, 0x58(%rsp)
pushq $0x1
popq %rax
subq %rcx, %rax
imulq $0x18, %rcx, %r13
addq $-0x10, %r13
movq %rax, %rcx
movzbl 0x6c(%rsp), %r12d
cmpq $0x1, %rcx
je 0x17a38d
movq %rbx, %rbp
movq 0x70(%rsp), %rax
movq -0x8(%rax,%r13), %r14
movq (%rax,%r13), %rbx
cmpq %rbx, %r14
jne 0x17a2a2
cmpq 0x50(%rsp), %rdx
jb 0x17a284
movq 0x38(%rsp), %rax
movq (%rax,%r14,8), %rdi
movq 0x30(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %rcx, %rbx
movq 0x28(%rsp), %rcx
movq 0x40(%rsp), %r8
movq 0x18(%rsp), %r9
pushq 0x100(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
pushq %r12
callq 0x17a790
movq %rbx, %rcx
movq 0x28(%rsp), %rdx
addq $0x20, %rsp
cmpb $0x0, 0x14(%rsp)
movq %rbp, %rbx
je 0x17a296
incq 0xb8(%rsp)
incq %rcx
addq $-0x18, %r13
jmp 0x17a20a
leaq 0x1(%r14), %rsi
movq 0xb0(%rsp), %rdi
movq %rcx, 0x98(%rsp)
callq 0x17aac3
movq %rax, %r13
leaq 0x2(%r14), %r12
negq 0x98(%rsp)
cmpq %rbx, %r12
ja 0x17a2eb
movq 0xb0(%rsp), %rdi
movq %r12, %rsi
callq 0x17aac3
cmpq %r13, %rax
cmovbq %rax, %r13
incq %r12
jmp 0x17a2ca
movq 0x90(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq %rax, %rcx
jae 0x17a304
movq 0x58(%rsp), %r12
jmp 0x17a331
incq %rax
movq %rax, 0x90(%rsp)
imulq $0x28, %rax, %rsi
movq 0x58(%rsp), %rdi
leaq 0x1d4177(%rip), %rdx    # 0x34e496
movl $0x14f, %ecx            # imm = 0x14F
callq 0x93472
movq 0x48(%rsp), %rcx
movq %rax, %r12
movq 0x8(%rsp), %rdx
testq %r12, %r12
je 0x17a566
imulq $0x28, %rcx, %rax
incq %rcx
movq %rcx, 0x48(%rsp)
movq %r13, (%r12,%rax)
movq %r14, 0x8(%r12,%rax)
movq %rbx, 0x10(%r12,%rax)
andq $0x0, 0x18(%r12,%rax)
movb $0x0, 0x20(%r12,%rax)
movl 0xc1(%rsp), %ecx
movl 0xc4(%rsp), %esi
movl %ecx, 0x21(%r12,%rax)
movl %esi, 0x24(%r12,%rax)
movq %rbp, %rbx
movq 0x98(%rsp), %rcx
jmp 0x17a1f4
movq 0x60(%rsp), %r13
cmpq %r15, %rbx
ja 0x17a3f7
cmpq 0x50(%rsp), %rdx
jb 0x17a3e3
movq 0x38(%rsp), %rax
movq (%rax,%rbx,8), %rdi
movq 0x30(%rsp), %rsi
movq %r13, %rdx
movq 0x28(%rsp), %rcx
movq 0x40(%rsp), %r8
movq 0x18(%rsp), %r9
pushq 0x100(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
pushq %r12
callq 0x17a790
movq 0x28(%rsp), %rdx
addq $0x20, %rsp
cmpb $0x0, 0x14(%rsp)
je 0x17a3f2
incq 0xb8(%rsp)
incq %rbx
jmp 0x17a392
movq 0x58(%rsp), %rcx
movq 0x48(%rsp), %rdx
jmp 0x17a0b7
leaq 0x1d4089(%rip), %rsi    # 0x34e496
movq %r14, %rdi
movl $0x15f, %edx            # imm = 0x15F
callq 0x936f9
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x17a446
leaq 0x1d406b(%rip), %rsi    # 0x34e496
movl $0x160, %edx            # imm = 0x160
callq 0x936f9
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
andq $0x0, 0x80(%rsp)
cmpb $0x0, 0x14(%rsp)
je 0x17a452
callq 0x9cce9
leaq 0x1d403d(%rip), %r14    # 0x34e496
movq 0x28(%rsp), %rbx
subq $0x1, %r13
jb 0x17a48a
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x17a484
movq %r14, %rsi
movl $0x166, %edx            # imm = 0x166
callq 0x936f9
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
addq $0x18, %rbx
jmp 0x17a45e
leaq 0x1d4005(%rip), %rbx    # 0x34e496
movq 0x40(%rsp), %rdi
movq %rbx, %rsi
movl $0x168, %edx            # imm = 0x168
callq 0x936f9
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl $0x169, %edx            # imm = 0x169
callq 0x936f9
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movl $0x16a, %edx            # imm = 0x16A
callq 0x936f9
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2bda88(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16ab29(%rip), %rsi    # 0x2e5013
leaq 0x1d3f88(%rip), %rdx    # 0x34e479
leaq 0x1d3f8e(%rip), %rcx    # 0x34e486
leaq 0x1d3f97(%rip), %r8     # 0x34e496
movl $0xdb, %r9d
jmp 0x17a592
movq 0x2bda57(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16aaf8(%rip), %rsi    # 0x2e5013
leaq 0x1ca416(%rip), %rdx    # 0x344938
leaq 0x1d3f5d(%rip), %rcx    # 0x34e486
leaq 0x1d3f66(%rip), %r8     # 0x34e496
movl $0xdc, %r9d
jmp 0x17a592
movq 0x2bda29(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16aaca(%rip), %rsi    # 0x2e5013
leaq 0x1d3f67(%rip), %rdx    # 0x34e4b7
leaq 0x1d3f2f(%rip), %rcx    # 0x34e486
leaq 0x1d3f38(%rip), %r8     # 0x34e496
movl $0x10d, %r9d            # imm = 0x10D
jmp 0x17a592
movq 0x2bd9fb(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16aa9c(%rip), %rsi    # 0x2e5013
leaq 0x1d3f39(%rip), %rdx    # 0x34e4b7
leaq 0x1d3f01(%rip), %rcx    # 0x34e486
leaq 0x1d3f0a(%rip), %r8     # 0x34e496
movl $0x14f, %r9d            # imm = 0x14F
xorl %eax, %eax
callq 0x17a50
callq 0x17390