// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/esa-bottomup.c
// Function: gt_esa_bottomup
int gt_esa_bottomup(Sequentialsuffixarrayreader *ssar,
                    GtESAVisitor *ev,
                    GtError *err)
{
  const GtUword incrementstacksize = 32UL;
  GtUword lcpvalue,
                previoussuffix = 0,
                idx,
                nonspecials,
                lastsuftabvalue = 0;
  GtBUItvinfo *lastinterval = NULL;
  bool haserr = false, firstedge, firstedgefromroot = true;
  GtArrayGtBUItvinfo *stack;

  stack = gt_GtArrayGtBUItvinfo_new();
  PUSH_ESA_BOTTOMUP(0,0);
  nonspecials = gt_Sequentialsuffixarrayreader_nonspecials(ssar);
  for (idx = 0; idx < nonspecials; idx++)
  {
    SSAR_NEXTSEQUENTIALLCPTABVALUEWITHLAST(lcpvalue,lastsuftabvalue,ssar);
    SSAR_NEXTSEQUENTIALSUFTABVALUE(previoussuffix,ssar);
    if (lcpvalue <= TOP_ESA_BOTTOMUP.lcp)
    {
      if (TOP_ESA_BOTTOMUP.lcp > 0 || !firstedgefromroot)
      {
        firstedge = false;
      } else
      {
        firstedge = true;
        firstedgefromroot = false;
      }
      if (gt_esa_visitor_visit_leaf_edge(ev,
                                         firstedge,
                                         TOP_ESA_BOTTOMUP.lcp,
                                         TOP_ESA_BOTTOMUP.lb,
                                         TOP_ESA_BOTTOMUP.info,
                                         previoussuffix,
                                         err) != 0)
      {
        haserr = true;
        break;
      }
    }
    gt_assert(lastinterval == NULL);
    while (lcpvalue < TOP_ESA_BOTTOMUP.lcp)
    {
      lastinterval = POP_ESA_BOTTOMUP;
      lastinterval->rb = idx;
      if (gt_esa_visitor_visit_lcp_interval(ev,
                                            lastinterval->lcp,
                                            lastinterval->lb,
                                            lastinterval->rb,
                                            lastinterval->info,
                                            err) != 0)
      {
        haserr = true;
        break;
      }
      if (lcpvalue <= TOP_ESA_BOTTOMUP.lcp)
      {
        if (TOP_ESA_BOTTOMUP.lcp > 0 || !firstedgefromroot)
        {
          firstedge = false;
        } else
        {
          firstedge = true;
          firstedgefromroot = false;
        }
        if (gt_esa_visitor_visit_branching_edge(ev,
                                                firstedge,
                                                TOP_ESA_BOTTOMUP.lcp,
                                                TOP_ESA_BOTTOMUP.lb,
                                                TOP_ESA_BOTTOMUP.info,
                                                lastinterval->lcp,
                                                lastinterval->lb,
                                                lastinterval->rb,
                                                lastinterval->info,
                                                err) != 0)
        {
          haserr = true;
          break;
        }
        lastinterval = NULL;
      }
    }
    if (haserr)
    {
      break;
    }
    if (lcpvalue > TOP_ESA_BOTTOMUP.lcp)
    {
      if (lastinterval != NULL)
      {
        GtUword lastintervallcp = lastinterval->lcp,
                      lastintervallb = lastinterval->lb,
                      lastintervalrb = lastinterval->rb;
        PUSH_ESA_BOTTOMUP(lcpvalue,lastintervallb);
        if (gt_esa_visitor_visit_branching_edge(ev,
                                                true,
                                                TOP_ESA_BOTTOMUP.lcp,
                                                TOP_ESA_BOTTOMUP.lb,
                                                TOP_ESA_BOTTOMUP.info,
                                                lastintervallcp,
                                                lastintervallb,
                                                lastintervalrb,
                                                NULL,
                                                err) != 0)
        {
          haserr = true;
          break;
        }
        lastinterval = NULL;
      } else
      {
        PUSH_ESA_BOTTOMUP(lcpvalue,idx);
        if (gt_esa_visitor_visit_leaf_edge(ev,
                                           true,
                                           TOP_ESA_BOTTOMUP.lcp,
                                           TOP_ESA_BOTTOMUP.lb,
                                           TOP_ESA_BOTTOMUP.info,
                                           previoussuffix,
                                           err) != 0)
        {
          haserr = true;
          break;
        }
      }
    }
  }
  gt_assert(stack->nextfreeGtBUItvinfo > 0);
  if (!haserr && TOP_ESA_BOTTOMUP.lcp > 0)
  {
    if (gt_esa_visitor_visit_leaf_edge(ev,
                                       false,
                                       TOP_ESA_BOTTOMUP.lcp,
                                       TOP_ESA_BOTTOMUP.lb,
                                       TOP_ESA_BOTTOMUP.info,
                                       lastsuftabvalue,
                                       err) != 0)
    {
      haserr = true;
    } else
    {
      TOP_ESA_BOTTOMUP.rb = idx;
      if (gt_esa_visitor_visit_lcp_interval(ev,
                                            TOP_ESA_BOTTOMUP.lcp,
                                            TOP_ESA_BOTTOMUP.lb,
                                            TOP_ESA_BOTTOMUP.rb,
                                            TOP_ESA_BOTTOMUP.info,
                                            err) != 0)
      {
        haserr = true;
      }
    }
  }
  gt_GtArrayGtBUItvinfo_delete(stack, ev);
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %rbx
leaq 0xd1ed3(%rip), %rsi     # 0x3e1dbc
movl $0x18, %edi
movl $0x3e, %edx
callq 0x104226
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x20, %edx
xorl %edi, %edi
xorl %esi, %esi
movq %r12, %rcx
callq 0x310889
movq %rax, (%r14)
addq $0x20, 0x8(%r14)
testq %rax, %rax
je 0x31085c
movq 0x10(%r14), %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rdx)
movq $-0x1, 0x10(%rax,%rdx)
incq %rcx
movq %rcx, 0x10(%r14)
movq %rbx, %rdi
callq 0x1a5a46
movq $0x0, 0x30(%rsp)
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x310576
movq %r13, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movb $0x1, %bpl
movq $0x0, 0x48(%rsp)
xorl %r12d, %r12d
movq $0x0, 0x38(%rsp)
movq %rbx, 0x40(%rsp)
cmpb $0x1, 0x40(%rbx)
jne 0x3100aa
movq (%rbx), %rbx
movl 0xd4(%rbx), %eax
cmpl 0xd0(%rbx), %eax
jb 0x30fffe
movq 0xd8(%rbx), %rdi
movq 0xe0(%rbx), %rcx
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %r15
movl %r15d, 0xd0(%rbx)
movq 0xe0(%rbx), %rdi
callq 0x17f00
testl %eax, %eax
jne 0x310866
movl $0x0, 0xd4(%rbx)
xorl %eax, %eax
testl %r15d, %r15d
je 0x310672
movq 0xd8(%rbx), %rcx
leal 0x1(%rax), %edx
movl %edx, 0xd4(%rbx)
movl %eax, %eax
movzbl (%rcx,%rax), %r13d
cmpq $0xff, %r13
movq 0x40(%rsp), %rbx
jne 0x3100fc
movq (%rbx), %rbx
movl 0xec(%rbx), %eax
cmpl 0xe8(%rbx), %eax
jb 0x310088
movq 0xf0(%rbx), %rdi
movq 0xf8(%rbx), %rcx
movl $0x10, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %r15
movl %r15d, 0xe8(%rbx)
movq 0xf8(%rbx), %rdi
callq 0x17f00
testl %eax, %eax
jne 0x31087a
movl $0x0, 0xec(%rbx)
xorl %eax, %eax
testl %r15d, %r15d
je 0x310783
movq 0xf0(%rbx), %rcx
leal 0x1(%rax), %edx
movl %edx, 0xec(%rbx)
movl %eax, %eax
shlq $0x4, %rax
movq 0x8(%rcx,%rax), %r13
movq 0x40(%rsp), %rbx
jmp 0x3100fc
movq (%rbx), %rcx
movq 0x20(%rbx), %rax
cmpq 0x10(%rbx), %rax
jae 0x310638
movq 0x60(%rcx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x20(%rbx)
movzbl (%rdx,%rax), %r13d
cmpq $0xff, %r13
jne 0x3100fc
movq 0x68(%rcx), %rcx
movq 0x28(%rbx), %rdx
movq %rdx, %rsi
shlq $0x4, %rsi
cmpq %rax, (%rcx,%rsi)
jne 0x31086b
addq %rsi, %rcx
incq %rdx
movq %rdx, 0x28(%rbx)
movq 0x8(%rcx), %r13
movq (%rbx), %r15
cmpb $0x1, 0x40(%rbx)
jne 0x31018e
movq 0xb0(%r15), %rcx
testq %rcx, %rcx
je 0x3101a7
movl 0xa4(%r15), %eax
cmpl 0xa0(%r15), %eax
jb 0x310231
movq 0xa8(%r15), %rdi
movl $0x8, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %rbx
movl %ebx, 0xa0(%r15)
movq 0xb0(%r15), %rdi
callq 0x17f00
testl %eax, %eax
je 0x31021c
movq 0x20(%rsp), %rdi
leaq 0x49a84(%rip), %rsi     # 0x359bf1
leaq 0xd27d7(%rip), %rdx     # 0x3e294b
xorl %eax, %eax
callq 0xfcb67
movl 0xa4(%r15), %eax
movb $0x1, %cl
movq %rcx, 0x38(%rsp)
jmp 0x310231
movq 0x58(%r15), %rax
movq 0x18(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%rbx)
movq (%rax,%rcx,8), %rbx
jmp 0x310275
movl 0x8c(%r15), %eax
cmpl 0x88(%r15), %eax
jb 0x31025f
movq 0x90(%r15), %rdi
movq 0x98(%r15), %rcx
movl $0x4, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %rbx
movl %ebx, 0x88(%r15)
movq 0x98(%r15), %rdi
callq 0x17f00
testl %eax, %eax
je 0x31024a
movq 0x20(%rsp), %rdi
leaq 0x499f3(%rip), %rsi     # 0x359bf1
leaq 0x49df6(%rip), %rdx     # 0x359ffb
xorl %eax, %eax
callq 0xfcb67
movl 0x8c(%r15), %eax
movb $0x1, %cl
movq %rcx, 0x38(%rsp)
jmp 0x31025f
movl $0x0, 0xa4(%r15)
xorl %eax, %eax
testl %ebx, %ebx
je 0x3107b0
movq 0xa8(%r15), %rcx
leal 0x1(%rax), %edx
movl %edx, 0xa4(%r15)
movl %eax, %eax
movq (%rcx,%rax,8), %rbx
jmp 0x310275
movl $0x0, 0x8c(%r15)
xorl %eax, %eax
testl %ebx, %ebx
je 0x3107b0
movq 0x90(%r15), %rcx
leal 0x1(%rax), %edx
movl %edx, 0x8c(%r15)
movl %eax, %eax
movl (%rcx,%rax,4), %ebx
movq (%r14), %rax
movq 0x10(%r14), %rcx
shlq $0x5, %rcx
movq -0x20(%rax,%rcx), %rdx
cmpq %rdx, %r13
ja 0x3102cd
addq %rcx, %rax
testq %rdx, %rdx
sete %sil
andb %bpl, %sil
movzbl %bpl, %ebp
movl $0x0, %ecx
cmovnel %ecx, %ebp
movq -0x18(%rax), %rcx
movq -0x8(%rax), %r8
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movzbl %sil, %esi
movq 0x28(%rsp), %rdi
movq %rbx, %r9
callq 0x1a8606
testl %eax, %eax
jne 0x310665
testq %r12, %r12
jne 0x310857
movq %rbx, 0x50(%rsp)
movq (%r14), %rax
movq 0x10(%r14), %r15
movq %r15, %rcx
shlq $0x5, %rcx
movq -0x20(%rax,%rcx), %rdx
cmpq %rdx, %r13
jae 0x3103cf
movq %rax, %rbx
decq %r15
movq %r15, 0x10(%r14)
shlq $0x5, %r15
movq 0x48(%rsp), %rcx
movq %rcx, 0x10(%rbx,%r15)
movq (%rbx,%r15), %rsi
movq 0x8(%rbx,%r15), %rdx
movq 0x18(%rbx,%r15), %r8
movq 0x28(%rsp), %r12
movq %r12, %rdi
movq 0x20(%rsp), %r9
callq 0x1a870e
testl %eax, %eax
jne 0x31056c
addq %r15, %rbx
movq (%r14), %rax
movq 0x10(%r14), %r15
movq %r15, %rcx
shlq $0x5, %rcx
movq -0x20(%rax,%rcx), %rdx
cmpq %rdx, %r13
ja 0x3103be
addq %rcx, %rax
testq %rdx, %rdx
sete %r15b
andb %bpl, %r15b
movq -0x18(%rax), %rcx
movq -0x8(%rax), %r8
movq (%rbx), %r9
movups 0x8(%rbx), %xmm0
movq 0x18(%rbx), %rax
movq 0x20(%rsp), %rsi
movq %rsi, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movups %xmm0, (%rsp)
movzbl %r15b, %esi
movq %r12, %rdi
callq 0x1a868a
testl %eax, %eax
jne 0x31056c
xorl %ebx, %ebx
movl $0x0, %ecx
testb %r15b, %r15b
jne 0x3103a9
movzbl %bpl, %ecx
movq (%r14), %rax
movq 0x10(%r14), %r15
movq %r15, %rdx
shlq $0x5, %rdx
movq -0x20(%rax,%rdx), %rdx
movl %ecx, %ebp
movq %rbx, %r12
movq %rax, %rbx
cmpq %rdx, %r13
jb 0x3102fa
jmp 0x3103d2
xorl %r12d, %r12d
testb $0x1, 0x38(%rsp)
jne 0x310651
cmpq %rdx, %r13
jbe 0x3104c4
testq %r12, %r12
je 0x310406
movq (%r12), %rbx
movq 0x8(%r12), %rcx
movq 0x10(%r12), %rdi
cmpq 0x8(%r14), %r15
jae 0x31041f
movq 0x28(%rsp), %r12
jmp 0x310461
cmpq 0x8(%r14), %r15
movq 0x28(%rsp), %r12
jae 0x3104e6
movq 0x40(%rsp), %rbx
jmp 0x310514
movq %rdi, 0x60(%rsp)
movq %rcx, 0x50(%rsp)
movq 0x28(%rsp), %r12
jne 0x310870
leaq 0x20(%r15), %rdx
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x310889
movq %rax, (%r14)
addq $0x20, 0x8(%r14)
testq %rax, %rax
movq 0x50(%rsp), %rcx
movq 0x60(%rsp), %rdi
je 0x310875
movq 0x10(%r14), %rsi
movq %rsi, %rdx
shlq $0x5, %rdx
movq %r13, (%rax,%rdx)
movq %rcx, 0x8(%rax,%rdx)
movq $-0x1, 0x10(%rax,%rdx)
incq %rsi
movq %rsi, 0x10(%r14)
movq 0x18(%rax,%rdx), %r8
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
movq %rdi, 0x8(%rsp)
movq %rcx, (%rsp)
movq $0x0, 0x10(%rsp)
movq %r12, %rdi
movl $0x1, %esi
movq %r13, %rdx
movq %rbx, %r9
callq 0x1a868a
testl %eax, %eax
jne 0x31056c
xorl %r12d, %r12d
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %rcx
incq %rcx
movq %rcx, 0x48(%rsp)
cmpq 0x58(%rsp), %rcx
jne 0x30ff93
jmp 0x31062c
movq 0x40(%rsp), %rbx
jne 0x31087f
leaq 0x20(%r15), %rdx
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x310889
movq %rax, (%r14)
addq $0x20, 0x8(%r14)
testq %rax, %rax
je 0x310884
movq 0x10(%r14), %rsi
movq %rsi, %rdx
shlq $0x5, %rdx
movq %r13, (%rax,%rdx)
movq 0x48(%rsp), %rcx
movq %rcx, 0x8(%rax,%rdx)
movq $-0x1, 0x10(%rax,%rdx)
incq %rsi
movq %rsi, 0x10(%r14)
movq 0x18(%rax,%rdx), %r8
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movq %r12, %rdi
movl $0x1, %esi
movq %r13, %rdx
movq 0x50(%rsp), %r9
callq 0x1a8606
testl %eax, %eax
jne 0x31056c
xorl %r12d, %r12d
jmp 0x3104c9
movb $0x1, %bpl
movq 0x20(%rsp), %r13
jmp 0x310581
movq $0x0, 0x48(%rsp)
xorl %ebp, %ebp
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x310861
testb $0x1, %bpl
jne 0x310608
movq (%r14), %rsi
shlq $0x5, %rax
movq -0x20(%rsi,%rax), %rdx
testq %rdx, %rdx
je 0x310608
addq %rax, %rsi
movq -0x18(%rsi), %rcx
movq -0x8(%rsi), %r8
movq %r13, (%rsp)
movq %r12, %rdi
xorl %esi, %esi
movq 0x30(%rsp), %r9
callq 0x1a8606
movb $0x1, %bl
testl %eax, %eax
jne 0x31060a
movq (%r14), %rax
movq 0x10(%r14), %rdi
shlq $0x5, %rdi
movq 0x48(%rsp), %rcx
movq %rcx, -0x10(%rax,%rdi)
movq -0x20(%rax,%rdi), %rsi
movq -0x18(%rax,%rdi), %rdx
movq -0x8(%rax,%rdi), %r8
movq %r12, %rdi
movq %r13, %r9
callq 0x1a870e
testl %eax, %eax
movzbl %bpl, %eax
movl $0x1, %ebx
cmovel %eax, %ebx
jmp 0x31060a
movl %ebp, %ebx
movq %r14, %rdi
movq %r12, %rsi
callq 0x30fe5f
andb $0x1, %bl
movzbl %bl, %eax
negl %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
jmp 0x310651
movq 0x58(%rcx), %rax
movq 0x18(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%rbx)
movq (%rax,%rcx,8), %rax
movq %rax, 0x30(%rsp)
movq 0x28(%rsp), %r12
movq 0x20(%rsp), %r13
movq 0x38(%rsp), %rbp
jmp 0x310581
movb $0x1, %bpl
movq 0x28(%rsp), %r12
jmp 0x31056f
movq 0x40(%rsp), %rax
movq (%rax), %rbx
movq 0xb0(%rbx), %rcx
testq %rcx, %rcx
je 0x310701
movl 0xa4(%rbx), %eax
cmpl 0xa0(%rbx), %eax
movq 0x28(%rsp), %r12
movq 0x20(%rsp), %r13
movq 0x38(%rsp), %rbp
jb 0x3107ed
movq 0xa8(%rbx), %rdi
movl $0x8, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %r15
movl %r15d, 0xa0(%rbx)
movq 0xb0(%rbx), %rdi
callq 0x17f00
testl %eax, %eax
je 0x3107dc
leaq 0x4950f(%rip), %rsi     # 0x359bf1
leaq 0xd2262(%rip), %rdx     # 0x3e294b
movq %r13, %rdi
xorl %eax, %eax
callq 0xfcb67
movl 0xa4(%rbx), %eax
movb $0x1, %bpl
jmp 0x3107ed
movl 0x8c(%rbx), %eax
cmpl 0x88(%rbx), %eax
movq 0x28(%rsp), %r12
movq 0x20(%rsp), %r13
movq 0x38(%rsp), %rbp
jb 0x310816
movq 0x90(%rbx), %rdi
movq 0x98(%rbx), %rcx
movl $0x4, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %r15
movl %r15d, 0x88(%rbx)
movq 0x98(%rbx), %rdi
callq 0x17f00
testl %eax, %eax
je 0x310805
leaq 0x4948d(%rip), %rsi     # 0x359bf1
leaq 0x49890(%rip), %rdx     # 0x359ffb
movq %r13, %rdi
xorl %eax, %eax
callq 0xfcb67
movl 0x8c(%rbx), %eax
movb $0x1, %bpl
jmp 0x310816
leaq 0x493bb(%rip), %rsi     # 0x359b45
leaq 0xd162b(%rip), %rdx     # 0x3e1dbc
movq $0x0, 0x30(%rsp)
movq 0x20(%rsp), %r13
movq %r13, %rdi
movl $0x87, %ecx
xorl %eax, %eax
callq 0xfcb67
jmp 0x3107cf
leaq 0x4982c(%rip), %rsi     # 0x359fe3
movq $0x0, 0x30(%rsp)
movq 0x20(%rsp), %r13
movq %r13, %rdi
xorl %eax, %eax
callq 0xfcb67
movb $0x1, %bpl
movq 0x28(%rsp), %r12
jmp 0x310581
movl $0x0, 0xa4(%rbx)
xorl %eax, %eax
testl %r15d, %r15d
je 0x310835
movq 0xa8(%rbx), %rcx
leal 0x1(%rax), %edx
movl %edx, 0xa4(%rbx)
movl %eax, %eax
movq (%rcx,%rax,8), %rax
jmp 0x31082b
movl $0x0, 0x8c(%rbx)
xorl %eax, %eax
testl %r15d, %r15d
je 0x310835
movq 0x90(%rbx), %rcx
leal 0x1(%rax), %edx
movl %edx, 0x8c(%rbx)
movl %eax, %eax
movl (%rcx,%rax,4), %eax
movq %rax, 0x30(%rsp)
jmp 0x310581
leaq 0x497a7(%rip), %rsi     # 0x359fe3
movq $0x0, 0x30(%rsp)
movq %r13, %rdi
xorl %eax, %eax
callq 0xfcb67
movb $0x1, %bpl
jmp 0x310581
callq 0x90797
callq 0x908ed
callq 0x908b4
callq 0x90747
callq 0x9070e
callq 0x907d0
callq 0x90809
callq 0x9076f
callq 0x90842
callq 0x9087b