// File: /workspace/github_c_makefile_star2_O3/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 %edx, 0x78(%rsp)
testq %rsi, %rsi
je 0x1c9ebf
movq %rdi, %rbx
movq %rsi, 0x48(%rsp)
movl %ecx, 0x1c(%rsp)
testq %rdi, %rdi
je 0x1c9ec4
movabsq $-0x8000000000000000, %rbp # imm = 0x8000000000000000
movq %rbx, %rdi
callq 0x1a5a37
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
callq 0x1a59f6
movq %rax, %r12
movq %rbx, %rdi
callq 0x1a5a15
movq %rax, 0x38(%rsp)
movq %r12, %rdi
callq 0xe7bac
movq %rax, %r15
movq %rbx, %rdi
callq 0x1a5a06
movl %eax, 0x7c(%rsp)
movq %r12, %rdi
callq 0xe7b9c
movq %rax, %rbx
movq %r12, %rdi
callq 0xebcd9
movq %rax, %rdi
callq 0xd11be
movq %rax, 0x30(%rsp)
leaq 0x1(%rbx), %rax
movq %rbx, 0x40(%rsp)
shrq $0x6, %rbx
cmpq $0x40, %rax
movq %rbx, 0x8(%rsp)
leaq 0x8(,%rbx,8), %r14
movl $0x8, %eax
cmovbq %rax, %r14
leaq 0x1e4a97(%rip), %rdx    # 0x3ae146
xorl %edi, %edi
movq %r14, %rsi
movl $0xe7, %ecx
callq 0x104461
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x173a0
movq %r15, 0x60(%rsp)
movq %r15, %rbx
decq %rbx
je 0x1c9714
movl $0x1, %r14d
movq %r12, %rdi
movq %r14, %rsi
callq 0xeb6ee
leal -0x1(%rax), %ecx
movq %rbp, %r15
shrq %cl, %r15
movq %r12, %rdi
movq %r14, %rsi
callq 0xeb6ee
decq %rax
shrq $0x6, %rax
orq %r15, (%r13,%rax,8)
incq %r14
cmpq %rbx, %r14
jbe 0x1c96e1
movq %r12, 0x58(%rsp)
movq %rbp, %rax
movq 0x40(%rsp), %rcx
shrq %cl, %rax
movq %r13, 0x70(%rsp)
movq 0x8(%rsp), %rcx
orq %rax, (%r13,%rcx,8)
movq 0x60(%rsp), %rbp
leaq (,%rbp,8), %rax
leaq (%rax,%rax,2), %r15
leaq 0x1e49fb(%rip), %r13    # 0x3ae146
movq %r15, %rdi
movq %r13, %rsi
movl $0xee, %edx
callq 0x104226
movq %rax, %r14
movq %rbx, 0x10(%rsp)
shrq $0x3, %rbx
movabsq $0x1ffffffffffffff8, %rax # imm = 0x1FFFFFFFFFFFFFF8
andq %rax, %rbx
addq $0x8, %rbx
cmpq $0x40, %rbp
movl $0x8, %eax
cmovbq %rax, %rbx
xorl %edi, %edi
movq %rbx, %rsi
movq %r13, %rdx
movl $0xef, %ecx
callq 0x104461
movq %rax, 0x50(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x173a0
movq %r14, 0x8(%rsp)
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x173a0
cmpb $0x0, 0x1c(%rsp)
je 0x1c97db
leaq 0xc0(%rsp), %rdi
movq $0x0, (%rdi)
movq 0x40(%rsp), %rsi
callq 0x10ba28
movq 0x30(%rsp), %r14
incl %r14d
leaq (,%r14,8), %rax
leaq (%rax,%rax,2), %rdi
leaq 0x1e4950(%rip), %rbx    # 0x3ae146
movq %rbx, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x104226
movq %rax, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
movq %r14, 0x88(%rsp)
movl $0x28, %esi
xorl %edi, %edi
movq %rbx, %rdx
movl $0x10d, %ecx            # imm = 0x10D
callq 0x104461
testq %rax, %rax
movq 0x48(%rsp), %r13
je 0x1c9ec9
movq %rax, %rsi
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsi)
movq $0x0, 0x18(%rsi)
movb $0x0, 0x20(%rsi)
movl $0x1, %eax
movl $0x1, %ecx
movq %rcx, 0xb0(%rsp)
movq 0x70(%rsp), %rbp
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq 0x38(%rsp), %r8
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %r10
movq %rax, 0x30(%rsp)
leaq (%rax,%rax,4), %rax
movq %rsi, %r14
leaq (%rsi,%rax,8), %r15
movq -0x28(%r15), %rbx
movq -0x18(%r15), %r12
testb $0x1, -0x8(%r15)
je 0x1c996c
movq -0x10(%r15), %r15
cmpq %r12, %r15
seta %al
cmpq %r13, %rbx
setb %cl
orb %al, %cl
jne 0x1c9956
movq (%r8,%r15,8), %rsi
leaq (%rsi,%rbx), %rcx
movq %rdi, %rax
shrq %cl, %rax
shrq $0x6, %rcx
testq %rax, (%rbp,%rcx,8)
je 0x1c994a
movq %r10, %rax
cmpq 0x40(%rsp), %rsi
je 0x1c9910
movq 0x58(%rsp), %rdi
callq 0xeb655
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %r9
movq 0x38(%rsp), %r8
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
leaq (%rax,%rax,2), %rdx
movq 0x10(%r9,%rdx,8), %rcx
testq %rcx, %rcx
je 0x1c9eb0
leaq (%r9,%rdx,8), %rdx
addq $0x10, %rdx
decq %rcx
movq %rcx, (%rdx)
jne 0x1c994a
movq %rdi, %rdx
movl %eax, %ecx
shrq %cl, %rdx
notq %rdx
shrq $0x6, %rax
movq 0x50(%rsp), %rcx
andq %rdx, (%rcx,%rax,8)
incq %r15
cmpq %r12, %r15
jbe 0x1c98ca
movq 0x30(%rsp), %rax
decq %rax
movq %r14, %rsi
jne 0x1c988f
jmp 0x1c9dcd
movq -0x20(%r15), %rax
movq %rax, 0x20(%rsp)
movb $0x1, -0x8(%r15)
leaq 0x80(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl 0x7c(%rsp), %edx
movq 0x40(%rsp), %rcx
movq %rbx, %r9
pushq %r12
pushq %rax
callq 0x1a7496
movq 0x30(%rsp), %rax
addq $0x10, %rsp
movq 0x90(%rsp), %rdx
testq %rdx, %rdx
je 0x1c99c5
movq 0x80(%rsp), %rax
leaq (%rdx,%rdx,2), %rcx
movq -0x10(%rax,%rcx,8), %rax
incq %rax
movq %rax, -0x10(%r15)
movq %rax, 0x20(%rsp)
cmpq %r12, %rax
movq 0x28(%rsp), %r8
ja 0x1c9af6
cmpq %r13, %rbx
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %r10
movq %rdx, %r15
jb 0x1c9b0d
movq 0x20(%rsp), %r15
movq 0x38(%rsp), %rax
movq (%rax,%r15,8), %rsi
leaq (%rsi,%rbx), %rcx
movq %rdi, %rax
shrq %cl, %rax
shrq $0x6, %rcx
testq %rax, (%rbp,%rcx,8)
je 0x1c9ae0
movq %r10, %rcx
cmpq 0x40(%rsp), %rsi
je 0x1c9a53
movq 0x58(%rsp), %rdi
callq 0xeb655
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %r9
movq 0x28(%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 0x50(%rsp), %rsi
orq %rax, (%rsi,%rcx,8)
leaq (%r9,%rdx,8), %r13
movq 0x8(%r9,%rdx,8), %rax
cmpq %rax, 0x10(%r9,%rdx,8)
jae 0x1c9a80
movq (%r13), %rax
jmp 0x1c9ac2
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%r13)
movq (%r13), %rdi
leaq 0x8(,%rax,8), %rsi
leaq 0x1e46ab(%rip), %rdx    # 0x3ae146
movl $0xaf, %ecx
callq 0x104461
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %r9
movq 0x28(%rsp), %r8
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq %rax, (%r13)
testq %rax, %rax
je 0x1c9eb5
movq 0x10(%r13), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r13)
movq %rbx, (%rax,%rcx,8)
movq 0x48(%rsp), %r13
incq %r15
cmpq %r12, %r15
jbe 0x1c9a01
movq 0x90(%rsp), %r15
jmp 0x1c9b0d
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %r10
movq %rdx, %r15
movzbl 0x78(%rsp), %eax
movq %rax, 0x98(%rsp)
testq %r15, %r15
movl 0x1c(%rsp), %edx
movq %r14, %rsi
movq 0x20(%rsp), %r11
je 0x1c9d24
movq 0x80(%rsp), %rax
decq %r15
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %r14
movq 0x8(%rax,%rcx,8), %rbp
cmpq %rbp, %r14
jne 0x1c9be3
cmpq %r13, %rbx
movq 0x70(%rsp), %rbp
jb 0x1c9bce
movq 0x38(%rsp), %rax
movq (%rax,%r14,8), %rdi
movq %rsi, 0x68(%rsp)
movq 0x58(%rsp), %rsi
movl %edx, %r14d
movq 0x60(%rsp), %rdx
movq %r9, %rcx
movq 0x50(%rsp), %r8
movq %rbp, %r9
pushq 0x110(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
callq 0x1c9ece
movl %r14d, %edx
movq 0x88(%rsp), %rsi
movq 0x40(%rsp), %r11
movq 0x30(%rsp), %r10
movq 0x28(%rsp), %r9
movq 0x48(%rsp), %r8
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
addq $0x20, %rsp
testb %dl, %dl
je 0x1c9d1b
incq 0xc0(%rsp)
jmp 0x1c9d1b
movq %r15, 0xd0(%rsp)
movq %rsi, 0x68(%rsp)
leaq 0x1(%r14), %rsi
movq %r8, %rdi
callq 0x1ca198
movq %rax, %r15
movq %r14, 0xb8(%rsp)
leaq 0x2(%r14), %r13
cmpq %rbp, %r13
ja 0x1c9c2f
movq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x1ca198
cmpq %r15, %rax
cmovbq %rax, %r15
incq %r13
cmpq %rbp, %r13
jbe 0x1c9c15
movq 0xb0(%rsp), %rcx
cmpq %rcx, 0x30(%rsp)
jae 0x1c9c63
movq 0x48(%rsp), %r13
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq 0x28(%rsp), %r8
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %r10
movq 0x68(%rsp), %rsi
jmp 0x1c9cb1
leaq 0x8(,%rcx,8), %rax
incq %rcx
movq %rcx, 0xb0(%rsp)
leaq (%rax,%rax,4), %rsi
movq 0x68(%rsp), %rdi
leaq 0x1e44c0(%rip), %rdx    # 0x3ae146
movl $0x14f, %ecx            # imm = 0x14F
callq 0x104461
movq %rax, %rsi
movq 0x48(%rsp), %r13
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq 0x28(%rsp), %r8
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %r10
movq 0x20(%rsp), %r11
movq 0xb8(%rsp), %rdx
testq %rsi, %rsi
je 0x1c9eba
movq 0x30(%rsp), %rcx
leaq (%rcx,%rcx,4), %rax
incq %rcx
movq %rcx, 0x30(%rsp)
movq %r15, (%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)
movl 0x1c(%rsp), %edx
movq 0x70(%rsp), %rbp
movq 0xd0(%rsp), %r15
testq %r15, %r15
jne 0x1c9b2f
cmpq %r12, %r11
movq 0x38(%rsp), %r8
ja 0x1c9dbd
cmpq %r13, %rbx
jb 0x1c9da5
movq (%r8,%r11,8), %rdi
movq %r11, %r13
movq %rsi, %r14
movq 0x58(%rsp), %rsi
movl %edx, %r15d
movq 0x60(%rsp), %rdx
movq %r9, %rcx
movq 0x50(%rsp), %r8
movq %rbp, %r9
pushq 0x110(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
callq 0x1c9ece
movl %r15d, %edx
movq %r14, %rsi
movq %r13, %r11
movq 0x68(%rsp), %r13
movq 0x30(%rsp), %r10
movq 0x28(%rsp), %r9
movq 0x58(%rsp), %r8
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
addq $0x20, %rsp
testb %dl, %dl
je 0x1c9db1
incq 0xc0(%rsp)
incq %r11
cmpq %r12, %r11
jbe 0x1c9d32
movq 0x30(%rsp), %rax
testq %rax, %rax
jne 0x1c988f
jmp 0x1c9dd1
movl 0x1c(%rsp), %edx
movl %edx, %ebx
movq %rsi, %rdi
leaq 0x1e4369(%rip), %rsi    # 0x3ae146
movl $0x15f, %edx            # imm = 0x15F
callq 0x1045eb
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1c9e1c
leaq 0x1e434b(%rip), %rsi    # 0x3ae146
movl $0x160, %edx            # imm = 0x160
callq 0x1045eb
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
testb %bl, %bl
movq 0x60(%rsp), %r12
je 0x1c9e2a
callq 0x10bf8a
leaq 0x1e4315(%rip), %rbx    # 0x3ae146
movq 0x8(%rsp), %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0x1c9e5a
movq %rbx, %rsi
movl $0x166, %edx            # imm = 0x166
callq 0x1045eb
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movq $0x0, 0x10(%r15)
addq $0x18, %r15
decq %r12
jne 0x1c9e36
leaq 0x1e42dc(%rip), %rbx    # 0x3ae146
movq 0x50(%rsp), %rdi
movq %rbx, %rsi
movl $0x168, %edx            # imm = 0x168
callq 0x1045eb
movq %rbp, %rdi
movq %rbx, %rsi
movl $0x169, %edx            # imm = 0x169
callq 0x1045eb
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl $0x16a, %edx            # imm = 0x16A
callq 0x1045eb
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6aa40
callq 0x6a9ce
callq 0x6aa07
callq 0x6aaeb
callq 0x6aab2
callq 0x6aa79