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

  gt_assert(nonspecials > 0);
  PUSH_ESA_BOTTOMUP(0,0);
  for (idx = 0; idx < nonspecials-1; idx++)
  {
    lcpvalue = (GtUword) lcptab_bucket[idx+1];
    previoussuffix = suftab[idx];
    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)
  {
    GtUword lastsuftabvalue = suftab[nonspecials-1];
    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;
      }
    }
  }
  stack->nextfreeGtBUItvinfo = 0; /* empty the stack */
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, 0x70(%rsp)
movq %rdi, 0x58(%rsp)
testq %rdx, %rdx
je 0x310d88
movq %r9, %rbp
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r15
movq 0x10(%rcx), %rsi
cmpq 0x8(%rcx), %rsi
jae 0x31092a
movq (%rbx), %rax
jmp 0x310947
jne 0x310d97
movq (%rbx), %rdi
leaq 0x20(%rsi), %rdx
movq %r14, %rcx
callq 0x310889
movq %rax, (%rbx)
addq $0x20, 0x8(%rbx)
testq %rax, %rax
je 0x310d8d
movq 0x10(%rbx), %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rdx)
movq $-0x1, 0x10(%rax,%rdx)
incq %rcx
movq %rcx, 0x10(%rbx)
movq %r15, %rax
decq %rax
movq %rax, 0x50(%rsp)
movq %r15, 0x68(%rsp)
je 0x310cb5
movq %rbp, 0x38(%rsp)
movb $0x1, %al
movl %eax, 0x2c(%rsp)
xorl %r13d, %r13d
xorl %ebp, %ebp
movq %r14, 0x30(%rsp)
movq 0x70(%rsp), %rax
movzwl 0x2(%rax,%r13,2), %esi
movq 0x58(%rsp), %rax
movq (%rax,%r13,8), %r12
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
shlq $0x5, %rcx
movq -0x20(%rax,%rcx), %rdx
movq %rsi, 0x40(%rsp)
cmpq %rsi, %rdx
jb 0x310a14
addq %rcx, %rax
testq %rdx, %rdx
sete %sil
movl 0x2c(%rsp), %edi
andb %dil, %sil
movzbl %dil, %edi
movl $0x0, %ecx
cmovnel %ecx, %edi
movl %edi, 0x2c(%rsp)
movq -0x18(%rax), %rcx
movq -0x8(%rax), %r8
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
movzbl %sil, %esi
movq %r14, %rdi
movq %r12, %r9
callq 0x1a8606
testl %eax, %eax
jne 0x310d6e
movq %r12, 0x48(%rsp)
testq %rbp, %rbp
jne 0x310d83
movq (%rbx), %r12
movq 0x10(%rbx), %r14
movq %r14, %rax
shlq $0x5, %rax
movq 0x40(%rsp), %rcx
cmpq %rcx, -0x20(%r12,%rax)
jbe 0x310b46
decq %r14
movq %r14, 0x10(%rbx)
shlq $0x5, %r14
movq %r13, %rcx
movq %r13, 0x10(%r12,%r14)
movq (%r12,%r14), %rsi
movq 0x8(%r12,%r14), %rdx
movq 0x18(%r12,%r14), %r8
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rbp
movq %rbp, %r9
callq 0x1a870e
movb $0x1, %r15b
testl %eax, %eax
jne 0x310caa
movq %r12, %rbp
addq %r14, %rbp
movq (%rbx), %r12
movq 0x10(%rbx), %r14
movq %r14, %rax
shlq $0x5, %rax
movq -0x20(%r12,%rax), %rdx
cmpq 0x40(%rsp), %rdx
jb 0x310b14
addq %rax, %r12
testq %rdx, %rdx
sete %r14b
andb 0x2c(%rsp), %r14b
movq -0x18(%r12), %rcx
movq -0x8(%r12), %r8
movq (%rbp), %r9
movups 0x8(%rbp), %xmm0
movq 0x18(%rbp), %rax
movq 0x38(%rsp), %rbp
movq %rbp, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movups %xmm0, (%rsp)
movzbl %r14b, %esi
movq 0x30(%rsp), %rdi
callq 0x1a868a
testl %eax, %eax
jne 0x310caa
xorl %ebp, %ebp
movl $0x0, %eax
testb %r14b, %r14b
jne 0x310afd
movzbl 0x2c(%rsp), %eax
movq (%rbx), %r12
movq 0x10(%rbx), %r14
movq %r14, %rcx
shlq $0x5, %rcx
movq -0x20(%r12,%rcx), %rdx
movl %eax, 0x2c(%rsp)
cmpq 0x40(%rsp), %rdx
ja 0x310a40
jae 0x310b5c
testq %rbp, %rbp
je 0x310b48
movq (%rbp), %r9
movq 0x8(%rbp), %rcx
movq 0x10(%rbp), %rdi
cmpq 0x8(%rbx), %r14
jae 0x310bfb
movq 0x30(%rsp), %r14
jmp 0x310c46
jae 0x310b5a
cmpq 0x8(%rbx), %r14
movq 0x38(%rsp), %rbp
jae 0x310b66
movq 0x30(%rsp), %r14
jmp 0x310b97
xorl %ebp, %ebp
movq 0x30(%rsp), %r14
jmp 0x310be8
jne 0x310d9c
leaq 0x20(%r14), %rdx
movq %r12, %rdi
movq %r14, %rsi
movq 0x30(%rsp), %r14
movq %r14, %rcx
callq 0x310889
movq %rax, %r12
movq %rax, (%rbx)
addq $0x20, 0x8(%rbx)
testq %rax, %rax
je 0x310da1
movq 0x10(%rbx), %rax
movq %rax, %rcx
shlq $0x5, %rcx
movq 0x40(%rsp), %rdx
movq %rdx, (%r12,%rcx)
movq %r13, 0x8(%r12,%rcx)
movq $-0x1, 0x10(%r12,%rcx)
incq %rax
movq %rax, 0x10(%rbx)
movq 0x18(%r12,%rcx), %r8
movq %rbp, (%rsp)
movq %r14, %rdi
movl $0x1, %esi
movq %r13, %rcx
movq 0x48(%rsp), %r9
callq 0x1a8606
testl %eax, %eax
jne 0x310d7b
xorl %ebp, %ebp
incq %r13
cmpq 0x50(%rsp), %r13
jne 0x31099d
jmp 0x310d64
movq %rdi, 0x60(%rsp)
movq %rcx, 0x48(%rsp)
jne 0x310da6
movq %r9, %rbp
leaq 0x20(%r14), %rdx
movq %r12, %rdi
movq %r14, %rsi
movq 0x30(%rsp), %r14
movq %r14, %rcx
callq 0x310889
movq %rax, %r12
movq %rax, (%rbx)
addq $0x20, 0x8(%rbx)
testq %rax, %rax
movq %rbp, %r9
movq 0x48(%rsp), %rcx
movq 0x60(%rsp), %rdi
je 0x310dab
movq 0x10(%rbx), %rax
movq %rax, %rsi
shlq $0x5, %rsi
movq 0x40(%rsp), %rdx
movq %rdx, (%r12,%rsi)
movq %rcx, 0x8(%r12,%rsi)
movq $-0x1, 0x10(%r12,%rsi)
incq %rax
movq %rax, 0x10(%rbx)
movq 0x18(%r12,%rsi), %r8
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
movq %rdi, 0x8(%rsp)
movq %rcx, (%rsp)
movq $0x0, 0x10(%rsp)
movq %r14, %rdi
movl $0x1, %esi
callq 0x1a868a
testl %eax, %eax
je 0x310be6
jmp 0x310d71
movq 0x30(%rsp), %r14
movq 0x10(%rbx), %rcx
jmp 0x310cbb
xorl %r13d, %r13d
xorl %r15d, %r15d
testq %rcx, %rcx
je 0x310d92
testb %r15b, %r15b
jne 0x310d45
movq (%rbx), %rax
shlq $0x5, %rcx
movq -0x20(%rax,%rcx), %rdx
testq %rdx, %rdx
je 0x310d45
addq %rcx, %rax
movq 0x68(%rsp), %rcx
movq 0x58(%rsp), %rsi
movq -0x8(%rsi,%rcx,8), %r9
movq -0x18(%rax), %rcx
movq -0x8(%rax), %r8
movq %rbp, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x1a8606
movb $0x1, %cl
testl %eax, %eax
jne 0x310d48
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
shlq $0x5, %rcx
movq %r13, -0x10(%rax,%rcx)
movq -0x20(%rax,%rcx), %rsi
movq -0x18(%rax,%rcx), %rdx
movq -0x8(%rax,%rcx), %r8
movq %r14, %rdi
movq %r13, %rcx
movq %rbp, %r9
callq 0x1a870e
testl %eax, %eax
movzbl %r15b, %eax
movl $0x1, %ecx
cmovel %eax, %ecx
jmp 0x310d48
movl %r15d, %ecx
movq $0x0, 0x10(%rbx)
movzbl %cl, %eax
negl %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
movq 0x50(%rsp), %r13
jmp 0x310d71
movb $0x1, %r15b
movq 0x38(%rsp), %rbp
jmp 0x310caf
movb $0x1, %r15b
jmp 0x310caf
callq 0x90996
callq 0x90b25
callq 0x90aec
callq 0x90ab3
callq 0x9095d
callq 0x90a41
callq 0x90a7a
callq 0x909cf
callq 0x90a08