// File: /workspace/github_c_makefile_star2_O2/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 0x2aff7b
movq %r9, %r14
movq %r8, %r10
movq %rcx, %rbx
movq %rdx, %r15
movq 0x10(%rcx), %rsi
cmpq 0x8(%rcx), %rsi
movq %r8, 0x28(%rsp)
jae 0x2afb07
movq (%rbx), %rax
jmp 0x2afb29
jne 0x2afff1
movq (%rbx), %rdi
leaq 0x20(%rsi), %rdx
movq %r10, %rcx
callq 0x2af9fb
movq 0x28(%rsp), %r10
movq %rax, (%rbx)
addq $0x20, 0x8(%rbx)
movq %r14, 0x20(%rsp)
testq %rax, %rax
je 0x2affa9
movq 0x10(%rbx), %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rdx)
orq $-0x1, 0x10(%rax,%rdx)
incq %rcx
movq %rcx, 0x10(%rbx)
movq %r15, 0x68(%rsp)
leaq -0x1(%r15), %rax
movq %rax, 0x38(%rsp)
movb $0x1, %al
movl %eax, 0x34(%rsp)
xorl %r12d, %r12d
xorl %eax, %eax
cmpq 0x38(%rsp), %rax
je 0x2aff2b
movq %rax, %rbp
movq 0x70(%rsp), %rax
movzwl 0x2(%rax,%rbp,2), %r11d
movq 0x58(%rsp), %rax
movq (%rax,%rbp,8), %r14
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
shlq $0x5, %rcx
movq -0x20(%rax,%rcx), %rdx
cmpq %r11, %rdx
movq %r11, 0x40(%rsp)
jb 0x2afbfd
addq %rcx, %rax
testq %rdx, %rdx
sete %sil
movl 0x34(%rsp), %ecx
andb %cl, %sil
movzbl %cl, %ecx
movl $0x0, %edi
cmovnel %edi, %ecx
movl %ecx, 0x34(%rsp)
movq -0x18(%rax), %rcx
movq -0x8(%rax), %r8
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movzbl %sil, %esi
movq %r10, %rdi
movq %r14, %r9
callq 0x155181
testl %eax, %eax
jne 0x2aff38
movq 0x28(%rsp), %r10
movq 0x40(%rsp), %r11
movq %r14, 0x48(%rsp)
testq %r12, %r12
jne 0x2aff4a
leaq 0x1(%rbp), %rax
movq %rax, 0x50(%rsp)
xorl %r12d, %r12d
movq (%rbx), %r13
movq 0x10(%rbx), %r14
movq %r14, %rax
shlq $0x5, %rax
movq -0x20(%r13,%rax), %rsi
cmpq %r11, %rsi
jbe 0x2afcfb
decq %r14
movq %r14, 0x10(%rbx)
shlq $0x5, %r14
movq %rbp, 0x10(%r13,%r14)
movq 0x8(%r13,%r14), %rdx
movq 0x18(%r13,%r14), %r8
movq %r10, %rdi
movq %rbp, %rcx
movq 0x20(%rsp), %r12
movq %r12, %r9
callq 0x155335
movb $0x1, %r15b
testl %eax, %eax
jne 0x2afe74
addq %r14, %r13
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
shlq $0x5, %rcx
movq -0x20(%rax,%rcx), %rdx
movq %r13, %r12
movq 0x40(%rsp), %r11
cmpq %r11, %rdx
movq 0x28(%rsp), %r10
jb 0x2afc17
addq %rcx, %rax
testq %rdx, %rdx
sete %sil
movl 0x34(%rsp), %ecx
andb %cl, %sil
movzbl %cl, %ecx
movl $0x0, %edi
cmovnel %edi, %ecx
movl %ecx, 0x34(%rsp)
movq -0x18(%rax), %rcx
movq -0x8(%rax), %r8
movq (%r13), %r9
movups 0x8(%r13), %xmm0
movq 0x18(%r13), %rax
movq 0x20(%rsp), %rdi
movq %rdi, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movups %xmm0, (%rsp)
movzbl %sil, %esi
movq %r10, %rdi
callq 0x15525b
movq 0x40(%rsp), %r11
movq 0x28(%rsp), %r10
testl %eax, %eax
je 0x2afc14
jmp 0x2afe6a
movq 0x50(%rsp), %rax
jae 0x2afb6f
testq %r12, %r12
je 0x2afd2d
movq (%r12), %r15
movq 0x8(%r12), %rcx
movq 0x10(%r12), %rsi
cmpq 0x8(%rbx), %r14
jae 0x2afdb4
movq 0x20(%rsp), %r12
jmp 0x2afe03
cmpq 0x8(%rbx), %r14
movq 0x20(%rsp), %r15
jb 0x2afd6e
jne 0x2b0071
leaq 0x20(%r14), %rdx
movq %r13, %rdi
movq %r14, %rsi
movq %r10, %rcx
callq 0x2af9fb
movq 0x28(%rsp), %r10
movq %rax, %r13
movq %rax, (%rbx)
addq $0x20, 0x8(%rbx)
testq %rax, %rax
movq 0x40(%rsp), %r11
je 0x2b008b
movq 0x10(%rbx), %rax
movq %rax, %rcx
shlq $0x5, %rcx
movq %r11, (%r13,%rcx)
movq %rbp, 0x8(%r13,%rcx)
orq $-0x1, 0x10(%r13,%rcx)
incq %rax
movq %rax, 0x10(%rbx)
movq 0x18(%r13,%rcx), %r8
movq %r15, (%rsp)
movq %r10, %rdi
pushq $0x1
popq %rsi
movq %r11, %rdx
movq %rbp, %rcx
movq 0x48(%rsp), %r9
callq 0x155181
jmp 0x2afe4f
movq %rsi, 0x60(%rsp)
movq %rcx, 0x48(%rsp)
movq 0x20(%rsp), %r12
jne 0x2b0029
leaq 0x20(%r14), %rdx
movq %r13, %rdi
movq %r14, %rsi
movq %r10, %rcx
callq 0x2af9fb
movq 0x28(%rsp), %r10
movq %rax, %r13
movq %rax, (%rbx)
addq $0x20, 0x8(%rbx)
testq %rax, %rax
movq 0x40(%rsp), %r11
movq 0x48(%rsp), %rcx
movq 0x60(%rsp), %rsi
je 0x2b0043
movq 0x10(%rbx), %rax
movq %rax, %rdx
shlq $0x5, %rdx
movq %r11, (%r13,%rdx)
movq %rcx, 0x8(%r13,%rdx)
orq $-0x1, 0x10(%r13,%rdx)
incq %rax
movq %rax, 0x10(%rbx)
movq 0x18(%r13,%rdx), %r8
movq %r12, 0x18(%rsp)
andq $0x0, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rcx, (%rsp)
movq %r10, %rdi
pushq $0x1
popq %rsi
movq %r11, %rdx
movq %r15, %r9
callq 0x15525b
movq 0x28(%rsp), %r10
movl $0x0, %r12d
testl %eax, %eax
movq 0x50(%rsp), %rax
je 0x2afb6f
movb $0x1, %r15b
movq %rbp, 0x38(%rsp)
jmp 0x2aff2e
movq %rbp, 0x38(%rsp)
movq 0x28(%rsp), %r10
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x2affc3
testb %r15b, %r15b
jne 0x2aff0f
movq (%rbx), %rsi
shlq $0x5, %rax
movq -0x20(%rsi,%rax), %rdx
testq %rdx, %rdx
je 0x2aff0f
addq %rax, %rsi
movq 0x68(%rsp), %rax
movq 0x58(%rsp), %rcx
movq -0x8(%rcx,%rax,8), %r9
movq -0x18(%rsi), %rcx
movq -0x8(%rsi), %r8
movq %r12, (%rsp)
movq %r10, %rdi
xorl %esi, %esi
movq %r10, %r14
callq 0x155181
movb $0x1, %cl
testl %eax, %eax
jne 0x2aff12
movq (%rbx), %rax
movq 0x10(%rbx), %rdi
shlq $0x5, %rdi
movq 0x38(%rsp), %rcx
movq %rcx, -0x10(%rax,%rdi)
movq -0x20(%rax,%rdi), %rsi
movq -0x18(%rax,%rdi), %rdx
movq -0x8(%rax,%rdi), %r8
movq %r14, %rdi
movq %r12, %r9
callq 0x155335
testl %eax, %eax
movzbl %r15b, %eax
pushq $0x1
popq %rcx
cmovel %eax, %ecx
jmp 0x2aff12
movl %r15d, %ecx
andq $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 0x20(%rsp), %r12
jmp 0x2afe7e
movb $0x1, %r15b
movq %rbp, 0x38(%rsp)
movq 0x20(%rsp), %r12
jmp 0x2afe79
movq 0x188017(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x350b8(%rip), %rsi     # 0x2e5013
leaq 0x94ac7(%rip), %rdx     # 0x344a29
leaq 0xd226b(%rip), %rcx     # 0x3821d4
leaq 0xd222b(%rip), %r8      # 0x38219b
movl $0x13d, %r9d            # imm = 0x13D
jmp 0x2b001d
movq 0x187fe6(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x35087(%rip), %rsi     # 0x2e5013
leaq 0xd2231(%rip), %rdx     # 0x3821c4
leaq 0xd223a(%rip), %rcx     # 0x3821d4
leaq 0xd21fa(%rip), %r8      # 0x38219b
movl $0x121, %r9d            # imm = 0x121
jmp 0x2b001d
movq 0x187fb8(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x35059(%rip), %rsi     # 0x2e5013
leaq 0x94a29(%rip), %rdx     # 0x3449ea
jmp 0x2b0009
movq 0x187f9e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3503f(%rip), %rsi     # 0x2e5013
leaq 0x94a2f(%rip), %rdx     # 0x344a0a
leaq 0xd21f2(%rip), %rcx     # 0x3821d4
leaq 0xd21b2(%rip), %r8      # 0x38219b
movl $0x193, %r9d            # imm = 0x193
jmp 0x2b001d
movq 0x187f70(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x35011(%rip), %rsi     # 0x2e5013
leaq 0x9498e(%rip), %rdx     # 0x344997
leaq 0xd21c4(%rip), %rcx     # 0x3821d4
leaq 0xd2184(%rip), %r8      # 0x38219b
movl $0x122, %r9d            # imm = 0x122
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x187f38(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x34fd9(%rip), %rsi     # 0x2e5013
leaq 0x94956(%rip), %rdx     # 0x344997
jmp 0x2b005b
movq 0x187f1e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x34fbf(%rip), %rsi     # 0x2e5013
leaq 0x9498f(%rip), %rdx     # 0x3449ea
leaq 0xd2172(%rip), %rcx     # 0x3821d4
leaq 0xd2132(%rip), %r8      # 0x38219b
movl $0x172, %r9d            # imm = 0x172
jmp 0x2b001d
movq 0x187ef0(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x34f91(%rip), %rsi     # 0x2e5013
leaq 0x9490e(%rip), %rdx     # 0x344997
jmp 0x2b00a3
movq 0x187ed6(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x34f77(%rip), %rsi     # 0x2e5013
leaq 0x94947(%rip), %rdx     # 0x3449ea
leaq 0xd212a(%rip), %rcx     # 0x3821d4
leaq 0xd20ea(%rip), %r8      # 0x38219b
movl $0x184, %r9d            # imm = 0x184
jmp 0x2b001d