// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %rsp
movq %rsi, 0x60(%rsp)
movq %rdi, 0x38(%rsp)
testq %rdx, %rdx
je 0x31afe9
movq %r9, %r14
movq %r8, %r15
movq %rcx, %rbx
movq %rdx, %r12
movq 0x8(%rcx), %rsi
cmpq %rsi, 0x10(%rcx)
jb 0x31abb1
jne 0x31affd
movq (%rbx), %rdi
leaq 0x20(%rsi), %rdx
movq %r15, %rcx
callq 0x31aaee
movq %rax, (%rbx)
addq $0x20, 0x8(%rbx)
movq (%rbx), %rax
testq %rax, %rax
je 0x31afee
movq %r15, 0x28(%rsp)
movq %r14, 0x30(%rsp)
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 %r12, 0x40(%rsp)
decq %r12
movq %r12, 0x58(%rsp)
je 0x31af07
movb $0x1, %r12b
xorl %ebp, %ebp
xorl %r14d, %r14d
xorl %esi, %esi
movq 0x60(%rsp), %rax
movzwl 0x2(%rax,%rbp,2), %r13d
movq 0x38(%rsp), %rax
movq (%rax,%rbp,8), %r15
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
shlq $0x5, %rcx
movq -0x20(%rax,%rcx), %rdx
cmpq %r13, %rdx
movl %esi, 0x24(%rsp)
jb 0x31ac7b
movq %r15, %r9
addq %rcx, %rax
testq %rdx, %rdx
sete %sil
andb %r12b, %sil
movzbl %r12b, %r12d
movl $0x0, %ecx
cmovnel %ecx, %r12d
movq -0x18(%rax), %rcx
movq -0x8(%rax), %r8
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
movzbl %sil, %esi
movq 0x28(%rsp), %rdi
callq 0x1b119a
testl %eax, %eax
jne 0x31af0d
movl 0x24(%rsp), %esi
testq %r14, %r14
jne 0x31afd5
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
cmpq %r13, -0x20(%rax,%rdx)
jbe 0x31ad64
decq %rcx
movq %rcx, 0x10(%rbx)
shlq $0x5, %rcx
leaq (%rax,%rcx), %r14
movq %rbp, 0x10(%rax,%rcx)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq 0x18(%rax,%rcx), %r8
movq 0x28(%rsp), %rdi
movq %rbp, %rcx
movq 0x30(%rsp), %r9
callq 0x1b12a2
testl %eax, %eax
jne 0x31ad69
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
shlq $0x5, %rcx
movq -0x20(%rax,%rcx), %rdx
cmpq %r13, %rdx
jb 0x31ad45
testq %rdx, %rdx
sete %sil
movl $0x0, %edi
andb %r12b, %sil
jne 0x31ad03
movzbl %r12b, %edi
addq %rcx, %rax
movl %edi, %r12d
movq -0x18(%rax), %rcx
movq -0x8(%rax), %r8
movq (%r14), %r9
movups 0x8(%r14), %xmm0
movq 0x18(%r14), %rax
movq 0x30(%rsp), %rdi
movq %rdi, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movups %xmm0, (%rsp)
movzbl %sil, %esi
movq 0x28(%rsp), %rdi
callq 0x1b121e
testl %eax, %eax
jne 0x31ad69
xorl %r14d, %r14d
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
cmpq %r13, -0x20(%rax,%rdx)
ja 0x31ac9d
movl 0x24(%rsp), %esi
jmp 0x31ad6c
xorl %r14d, %r14d
jmp 0x31ad6c
movb $0x1, %sil
testb $0x1, %sil
jne 0x31af10
movq (%rbx), %rdi
movq 0x10(%rbx), %rax
movq %rax, %rcx
shlq $0x5, %rcx
cmpq %r13, -0x20(%rdi,%rcx)
jae 0x31aef7
movl %esi, 0x24(%rsp)
testq %r14, %r14
je 0x31ae6e
movq (%r14), %r9
movq 0x8(%r14), %r10
movq 0x10(%r14), %r11
movq 0x8(%rbx), %rsi
cmpq %rsi, %rax
jb 0x31ade6
movq %r11, 0x48(%rsp)
movq %r10, 0x50(%rsp)
jne 0x31afe4
movq %r9, %r15
leaq 0x20(%rsi), %rdx
movq 0x28(%rsp), %rcx
callq 0x31aaee
movq %rax, (%rbx)
addq $0x20, 0x8(%rbx)
movq %r15, %r9
movq 0x50(%rsp), %r10
movq 0x48(%rsp), %r11
movq (%rbx), %rax
testq %rax, %rax
je 0x31afda
movq 0x10(%rbx), %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
movq %r13, (%rax,%rdx)
movq %r10, 0x8(%rax,%rdx)
movq $-0x1, 0x10(%rax,%rdx)
incq %rcx
movq %rcx, 0x10(%rbx)
movq 0x8(%rax,%rdx), %rcx
movq 0x18(%rax,%rdx), %r8
movq 0x30(%rsp), %rax
movq %rax, 0x18(%rsp)
xorl %r15d, %r15d
movq %r15, 0x10(%rsp)
movq %r11, 0x8(%rsp)
movq %r10, (%rsp)
movq 0x28(%rsp), %rdi
movl $0x1, %esi
movq %r13, %rdx
callq 0x1b121e
movl 0x24(%rsp), %esi
movzbl %sil, %esi
testl %eax, %eax
movl $0x1, %eax
cmovnel %eax, %esi
cmoveq %r15, %r14
je 0x31aef7
jmp 0x31af10
movq 0x8(%rbx), %rsi
cmpq %rsi, %rax
movq 0x28(%rsp), %r14
jb 0x31ae96
jne 0x31aff8
leaq 0x20(%rsi), %rdx
movq %r14, %rcx
callq 0x31aaee
movq %rax, (%rbx)
addq $0x20, 0x8(%rbx)
movq (%rbx), %rax
testq %rax, %rax
je 0x31afdf
movq 0x10(%rbx), %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
movq %r13, (%rax,%rdx)
movq %rbp, 0x8(%rax,%rdx)
movq $-0x1, 0x10(%rax,%rdx)
incq %rcx
movq %rcx, 0x10(%rbx)
movq 0x8(%rax,%rdx), %rcx
movq 0x18(%rax,%rdx), %r8
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movl $0x1, %esi
movq %r13, %rdx
movq %r15, %r9
callq 0x1b119a
testl %eax, %eax
jne 0x31af0d
xorl %r14d, %r14d
movl 0x24(%rsp), %esi
incq %rbp
cmpq 0x58(%rsp), %rbp
jne 0x31ac06
jmp 0x31af10
xorl %ebp, %ebp
xorl %esi, %esi
jmp 0x31af10
movb $0x1, %sil
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x31aff3
testb $0x1, %sil
movq 0x28(%rsp), %r14
je 0x31af2f
movl %esi, %ecx
jmp 0x31afb6
movl %esi, %r12d
movq (%rbx), %rsi
shlq $0x5, %rax
movq -0x20(%rsi,%rax), %rdx
testq %rdx, %rdx
je 0x31afb3
addq %rax, %rsi
movq 0x40(%rsp), %rax
movq 0x38(%rsp), %rcx
movq -0x8(%rcx,%rax,8), %r9
movq -0x18(%rsi), %rcx
movq -0x8(%rsi), %r8
movq 0x30(%rsp), %r15
movq %r15, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x1b119a
movb $0x1, %cl
testl %eax, %eax
jne 0x31afb6
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
shlq $0x5, %rcx
movq %rbp, -0x10(%rax,%rcx)
movq -0x20(%rax,%rcx), %rsi
movq -0x18(%rax,%rcx), %rdx
movq -0x8(%rax,%rcx), %r8
movq %r14, %rdi
movq %rbp, %rcx
movq %r15, %r9
callq 0x1b12a2
testl %eax, %eax
movzbl %r12b, %eax
movl $0x1, %ecx
cmovel %eax, %ecx
jmp 0x31afb6
movl %r12d, %ecx
movq $0x0, 0x10(%rbx)
andb $0x1, %cl
movzbl %cl, %eax
negl %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x92837
callq 0x928a9
callq 0x9291b
callq 0x92870
callq 0x929c6
callq 0x9298d
callq 0x92954
callq 0x928e2
callq 0x927fe
nop