// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/esa-dfs.c
// Function: gt_depthfirstesa
int gt_depthfirstesa(Sequentialsuffixarrayreader *ssar,
                  Dfsinfo *(*allocateDfsinfo)(Dfsstate *),
                  void(*freeDfsinfo)(Dfsinfo *,Dfsstate *),
                  int(*processleafedge)(bool,GtUword,Dfsinfo *,
                                        GtUword,Dfsstate *,
                                        GtError *),
                  int(*processbranchedge)(bool,
                                          GtUword,
                                          Dfsinfo *,
                                          Dfsinfo *,
                                          Dfsstate *,
                                          GtError *),
                  int(*processcompletenode)(GtUword,
                                            Dfsinfo *,GtUword,
                                            Dfsstate *,GtError *),
                  void (*assignleftmostleaf)(Dfsinfo *,GtUword,
                                             Dfsstate *),
                  void (*assignrightmostleaf)(Dfsinfo *,GtUword,
                                              GtUword,
                                              GtUword,Dfsstate *),
                  Dfsstate *state,
                  GT_UNUSED GtLogger *logger,
                  GtError *err)
{
  bool firstedge,
       firstrootedge;
  GtUword previoussuffix = 0,
         previouslcp,
         currentindex,
         currentlcp = 0, /* May be necessary if currentlcp is used after the
                            outer while loop */
         nonspecials,
         allocatedItvinfo = 0,
         nextfreeItvinfo = 0;
  Itvinfo *stackspace = NULL;
  bool haserr = false;

  firstrootedge = true;
  PUSHDFS(0,true);
  if (assignleftmostleaf != NULL)
  {
    assignleftmostleaf(TOP.dfsinfo,0,state);
  }
  nonspecials = gt_Sequentialsuffixarrayreader_nonspecials(ssar);
  for (currentindex = 0; currentindex < nonspecials; currentindex++)
  {
    SSAR_NEXTSEQUENTIALLCPTABVALUE(currentlcp,ssar);
    SSAR_NEXTSEQUENTIALSUFTABVALUE(previoussuffix,ssar);
    while (currentlcp < TOP.depth)
    {
      if (TOP.lastisleafedge)
      {
        if (processleafedge != NULL &&
            processleafedge(false,TOP.depth,TOP.dfsinfo,
                            previoussuffix,state,err) != 0)
        {
          haserr = true;
          break;
        }
      } else
      {
        gt_assert(nextfreeItvinfo < allocatedItvinfo);
        if (processbranchedge != NULL &&
            processbranchedge(false,
                              TOP.depth,
                              TOP.dfsinfo,
                              ABOVETOP.dfsinfo,
                              state,
                              err) != 0)
        {
          haserr = true;
          break;
        }
      }
      if (assignrightmostleaf != NULL)
      {
        assignrightmostleaf(TOP.dfsinfo,
                            currentindex,
                            previoussuffix,
                            currentlcp,
                            state);
      }
      if (processcompletenode != NULL &&
          processcompletenode(TOP.depth,TOP.dfsinfo,
                              nextfreeItvinfo >= 2UL ? BELOWTOP.depth
                                                     : 0,
                              state,err) != 0)
      {
        haserr = true;
        break;
      }
      gt_assert(nextfreeItvinfo > 0);
      nextfreeItvinfo--;
    }
    if (haserr)
    {
      break;
    }
    if (currentlcp == TOP.depth)
    {
      if (firstrootedge && TOP.depth == 0)
      {
        firstedge = true;
        firstrootedge = false;
      } else
      {
        firstedge = false;
      }
      if (TOP.lastisleafedge)
      {
        if (processleafedge != NULL &&
            processleafedge(firstedge,TOP.depth,TOP.dfsinfo,
                            previoussuffix,state,err) != 0)
        {
          haserr = true;
          break;
        }
      } else
      {
        if (!firstedge)
        {
          gt_assert(nextfreeItvinfo < allocatedItvinfo);
        }
        if (processbranchedge != NULL &&
            processbranchedge(firstedge,
                              TOP.depth,
                              TOP.dfsinfo,
                              /*firstedge ? NULL : ABOVETOP.dfsinfo,*/
                              ABOVETOP.dfsinfo,
                              state,
                              err) != 0)
        {
          haserr = true;
          break;
        }
        TOP.lastisleafedge = true;
      }
    } else
    {
      PUSHDFS(currentlcp,true);
      if (BELOWTOP.lastisleafedge)
      {
        if (assignleftmostleaf != NULL)
        {
          assignleftmostleaf(TOP.dfsinfo,currentindex,state);
        }
        if (processleafedge != NULL &&
            processleafedge(true,
                            TOP.depth,
                            TOP.dfsinfo,
                            previoussuffix,
                            state,
                            err) != 0)
        {
          haserr = true;
          break;
        }
        BELOWTOP.lastisleafedge = false;
      } else
      {
        previouslcp = TOP.depth;
        if (processbranchedge != NULL &&
            processbranchedge(true,
                              previouslcp,
                              TOP.dfsinfo,
                              NULL, /* not used since firstsucc = true */
                              state,
                              err) != 0)
        {
          haserr = true;
          break;
        }
      }
    }
    gt_assert(!haserr);
  }
  freeItvinfo(stackspace,
              allocatedItvinfo,
              freeDfsinfo,
              state);
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x40(%rsp)
movq %r8, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %rdx, %r13
movq %rsi, %rcx
movq %rdi, 0x18(%rsp)
movq 0xa0(%rsp), %rbp
movq 0x90(%rsp), %r14
xorl %ebx, %ebx
movl $0x20, %r12d
movl $0x20, %edx
xorl %edi, %edi
xorl %esi, %esi
movq %rcx, 0x48(%rsp)
movq %rbp, %r8
callq 0x31153c
movq %rax, %r15
movq $0x0, 0x8(%rax)
movb $0x1, (%rax)
testq %r14, %r14
je 0x310e25
movq 0x10(%r15), %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq *%r14
movq 0x18(%rsp), %rdi
callq 0x1a5a46
movq %rax, 0x50(%rsp)
testq %rax, %rax
je 0x3114bc
movl $0x20, %r12d
movl $0x1, %r14d
movb $0x1, 0xf(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x18(%rsp), %rbx
movq %r13, 0x10(%rsp)
cmpb $0x1, 0x40(%rbx)
jne 0x310f86
movq (%rbx), %r13
movl 0xd4(%r13), %eax
cmpl 0xd0(%r13), %eax
jb 0x310edc
movq 0xd8(%r13), %rdi
movq 0xe0(%r13), %rcx
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %rbx
movl %ebx, 0xd0(%r13)
movq 0xe0(%r13), %rdi
callq 0x17f00
testl %eax, %eax
jne 0x311523
movl $0x0, 0xd4(%r13)
xorl %eax, %eax
testl %ebx, %ebx
movq 0x18(%rsp), %rbx
je 0x311461
movq 0xd8(%r13), %rcx
leal 0x1(%rax), %edx
movl %edx, 0xd4(%r13)
movl %eax, %eax
movzbl (%rcx,%rax), %ebp
cmpq $0xff, %rbp
jne 0x310fd7
movq (%rbx), %r13
movl 0xec(%r13), %eax
cmpl 0xe8(%r13), %eax
jb 0x310f68
movq 0xf0(%r13), %rdi
movq 0xf8(%r13), %rcx
movl $0x10, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %rbx
movl %ebx, 0xe8(%r13)
movq 0xf8(%r13), %rdi
callq 0x17f00
testl %eax, %eax
jne 0x311537
movl $0x0, 0xec(%r13)
xorl %eax, %eax
testl %ebx, %ebx
movq 0x18(%rsp), %rbx
je 0x31146b
movq 0xf0(%r13), %rcx
leal 0x1(%rax), %edx
movl %edx, 0xec(%r13)
movl %eax, %eax
shlq $0x4, %rax
movq 0x8(%rcx,%rax), %rbp
jmp 0x310fd7
movq 0x20(%rbx), %rax
cmpq 0x10(%rbx), %rax
jae 0x31150d
movq (%rbx), %rcx
movq 0x60(%rcx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x20(%rbx)
movzbl (%rdx,%rax), %ebp
cmpq $0xff, %rbp
jne 0x310fd7
movq 0x68(%rcx), %rcx
movq 0x28(%rbx), %rdx
movq %rdx, %rsi
shlq $0x4, %rsi
cmpq %rax, (%rcx,%rsi)
jne 0x311528
addq %rsi, %rcx
incq %rdx
movq %rdx, 0x28(%rbx)
movq 0x8(%rcx), %rbp
movq (%rbx), %r13
cmpb $0x1, 0x40(%rbx)
jne 0x31106c
movq 0xb0(%r13), %rcx
testq %rcx, %rcx
je 0x311085
movl 0xa4(%r13), %eax
cmpl 0xa0(%r13), %eax
jb 0x311112
movq 0xa8(%r13), %rdi
movl $0x8, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %rbx
movl %ebx, 0xa0(%r13)
movq 0xb0(%r13), %rdi
callq 0x17f00
testl %eax, %eax
je 0x3110fd
movq 0xb0(%rsp), %rdi
leaq 0x48ba6(%rip), %rsi     # 0x359bf1
leaq 0xd18f9(%rip), %rdx     # 0x3e294b
xorl %eax, %eax
callq 0xfcb67
movl 0xa4(%r13), %eax
movb $0x1, %cl
movq %rcx, 0x20(%rsp)
jmp 0x311112
movq 0x58(%r13), %rax
movq 0x18(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%rbx)
movq (%rax,%rcx,8), %rbx
jmp 0x311156
movl 0x8c(%r13), %eax
cmpl 0x88(%r13), %eax
jb 0x311140
movq 0x90(%r13), %rdi
movq 0x98(%r13), %rcx
movl $0x4, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %rbx
movl %ebx, 0x88(%r13)
movq 0x98(%r13), %rdi
callq 0x17f00
testl %eax, %eax
je 0x31112b
movq 0xb0(%rsp), %rdi
leaq 0x48b12(%rip), %rsi     # 0x359bf1
leaq 0x48f15(%rip), %rdx     # 0x359ffb
xorl %eax, %eax
callq 0xfcb67
movl 0x8c(%r13), %eax
movb $0x1, %cl
movq %rcx, 0x20(%rsp)
jmp 0x311140
movl $0x0, 0xa4(%r13)
xorl %eax, %eax
testl %ebx, %ebx
je 0x31148f
movq 0xa8(%r13), %rcx
leal 0x1(%rax), %edx
movl %edx, 0xa4(%r13)
movl %eax, %eax
movq (%rcx,%rax,8), %rbx
jmp 0x311156
movl $0x0, 0x8c(%r13)
xorl %eax, %eax
testl %ebx, %ebx
je 0x31148f
movq 0x90(%r13), %rcx
leal 0x1(%rax), %edx
movl %edx, 0x8c(%r13)
movl %eax, %eax
movl (%rcx,%rax,4), %ebx
leaq (%r14,%r14,2), %rax
leaq 0x10(,%rax,8), %r13
movq -0x20(%r15,%r13), %rsi
cmpq %rsi, %rbp
jae 0x311259
cmpb $0x1, -0x28(%r15,%r13)
jne 0x3111a7
cmpq $0x0, 0x38(%rsp)
je 0x3111df
movq -0x18(%r15,%r13), %rdx
xorl %edi, %edi
movq %rbx, %rcx
movq 0xa0(%rsp), %r8
movq 0xb0(%rsp), %r9
callq *0x38(%rsp)
testl %eax, %eax
je 0x3111df
jmp 0x3114a5
cmpq %r12, %r14
jae 0x31151e
cmpq $0x0, 0x30(%rsp)
je 0x3111df
movq -0x18(%r15,%r13), %rdx
movq (%r15,%r13), %rcx
xorl %edi, %edi
movq 0xa0(%rsp), %r8
movq 0xb0(%rsp), %r9
callq *0x30(%rsp)
testl %eax, %eax
jne 0x311446
movq 0x98(%rsp), %rax
testq %rax, %rax
je 0x311206
movq -0x18(%r15,%r13), %rdi
movq 0x28(%rsp), %rsi
movq %rbx, %rdx
movq %rbp, %rcx
movq 0xa0(%rsp), %r8
callq *%rax
cmpq $0x0, 0x40(%rsp)
je 0x311243
cmpq $0x2, %r14
jb 0x31121b
movq -0x38(%r15,%r13), %rdx
jmp 0x31121d
xorl %edx, %edx
movq -0x20(%r15,%r13), %rdi
movq -0x18(%r15,%r13), %rsi
movq 0xa0(%rsp), %rcx
movq 0xb0(%rsp), %r8
callq *0x40(%rsp)
testl %eax, %eax
jne 0x3114a5
decq %r14
addq $-0x18, %r13
cmpq $-0x1, %r14
jne 0x311162
jmp 0x311519
testb $0x1, 0x20(%rsp)
jne 0x311500
cmpq %rsi, %rbp
jne 0x3112c6
testq %rbp, %rbp
sete %al
movb 0xf(%rsp), %cl
andb %cl, %al
xorb %al, %cl
movb %cl, 0xf(%rsp)
cmpb $0x1, -0x28(%r15,%r13)
jne 0x31137e
movq 0x38(%rsp), %r10
testq %r10, %r10
je 0x311417
movq -0x18(%r15,%r13), %rdx
movzbl %al, %edi
movq %rbp, %rsi
movq %rbx, %rcx
movq 0xa0(%rsp), %rbp
movq %rbp, %r8
movq 0xb0(%rsp), %r9
callq *%r10
testl %eax, %eax
je 0x311374
jmp 0x31145a
cmpq %r12, %r14
movq 0x90(%rsp), %rax
jb 0x311304
jne 0x31152d
leaq 0x20(%r12), %rdx
movq %r15, %rdi
movq %r12, %rsi
movq %rdx, %r12
movq 0x48(%rsp), %rcx
movq 0xa0(%rsp), %r8
callq 0x31153c
movq %rax, %r15
movq 0x90(%rsp), %rax
movq %rbp, -0x8(%r15,%r13)
movb $0x1, -0x10(%r15,%r13)
incq %r14
cmpb $0x1, -0x28(%r15,%r13)
jne 0x3113da
testq %rax, %rax
movq 0xa0(%rsp), %rbp
je 0x31133e
movq (%r15,%r13), %rdi
movq 0x28(%rsp), %rsi
movq %rbp, %rdx
callq *0x90(%rsp)
movq 0x38(%rsp), %rax
testq %rax, %rax
je 0x31136e
movq -0x8(%r15,%r13), %rsi
movq (%r15,%r13), %rdx
movl $0x1, %edi
movq %rbx, %rcx
movq %rbp, %r8
movq 0xb0(%rsp), %r9
callq *%rax
testl %eax, %eax
jne 0x31145a
movb $0x0, -0x28(%r15,%r13)
movq 0x10(%rsp), %r13
jmp 0x311424
cmpq %r12, %r14
setb %cl
orb %al, %cl
je 0x311532
movq 0x30(%rsp), %r10
testq %r10, %r10
movq 0x18(%rsp), %rbx
je 0x3113c5
movq -0x18(%r15,%r13), %rdx
movq (%r15,%r13), %rcx
movzbl %al, %edi
movq %rbp, %rsi
movq 0xa0(%rsp), %r8
movq 0xb0(%rsp), %r9
callq *%r10
testl %eax, %eax
jne 0x3114f9
movb $0x1, -0x28(%r15,%r13)
movq 0x10(%rsp), %r13
movq 0xa0(%rsp), %rbp
jmp 0x311429
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x311417
movq (%r15,%r13), %rdx
movl $0x1, %edi
movq %rbp, %rsi
xorl %ecx, %ecx
movq 0xa0(%rsp), %rbp
movq %rbp, %r8
movq 0xb0(%rsp), %r9
callq *%rax
testl %eax, %eax
movq 0x18(%rsp), %rbx
jne 0x31145a
movq 0x10(%rsp), %r13
jmp 0x311429
movq 0x10(%rsp), %r13
movq 0xa0(%rsp), %rbp
movq 0x18(%rsp), %rbx
movq 0x28(%rsp), %rcx
incq %rcx
movq %rcx, 0x28(%rsp)
cmpq 0x50(%rsp), %rcx
jne 0x310e6a
jmp 0x31150d
movl $0x1, %ebx
movq 0x10(%rsp), %r13
movq 0xa0(%rsp), %rbp
jmp 0x3114bc
movb $0x1, %al
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %r13
jmp 0x31150d
leaq 0x486d3(%rip), %rsi     # 0x359b45
leaq 0xd09d5(%rip), %rdx     # 0x3e1e4e
movq 0xb0(%rsp), %rdi
movl $0x88, %ecx
xorl %eax, %eax
callq 0xfcb67
jmp 0x3114a5
leaq 0x48b4d(%rip), %rsi     # 0x359fe3
movq 0xb0(%rsp), %rdi
xorl %eax, %eax
callq 0xfcb67
movl $0x1, %ebx
movq 0x10(%rsp), %r13
movq 0xa0(%rsp), %rbp
testq %r12, %r12
je 0x3114d2
leaq 0x10(%r15), %r14
movq (%r14), %rdi
movq %rbp, %rsi
callq *%r13
addq $0x18, %r14
decq %r12
jne 0x3114c0
leaq 0xd0975(%rip), %rsi     # 0x3e1e4e
movq %r15, %rdi
movl $0x57, %edx
callq 0x1045eb
negl %ebx
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %r13
movq 0xa0(%rsp), %rbp
movq 0x20(%rsp), %rax
andb $0x1, %al
movzbl %al, %ebx
jmp 0x3114b7
callq 0x90c92
callq 0x90c59
callq 0x90b97
callq 0x90b5e
callq 0x90be7
callq 0x90c20
callq 0x90bbf