// File: /workspace/github_c_makefile_star2_O2/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, %rbp
movq %rcx, 0x28(%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, %rcx
movq %rdi, %rbx
movq 0xa0(%rsp), %r13
movq 0x90(%rsp), %r14
pushq $0x20
popq %r15
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %rcx, 0x48(%rsp)
movq %r13, %r8
callq 0x2b08de
movq %rax, %r12
andq $0x0, 0x8(%rax)
movb $0x1, (%rax)
testq %r14, %r14
je 0x2b0127
movq 0x10(%r12), %rdi
xorl %esi, %esi
movq %r13, %rdx
callq *%r14
movq %rbx, %rdi
callq 0x151d3d
movq %rax, %rcx
movb $0x1, 0x7(%rsp)
pushq $0x1
popq %r14
pushq $0x1
popq %rax
movl %eax, 0x1c(%rsp)
xorl %eax, %eax
movq $0x0, 0x8(%rsp)
movq %rbx, 0x30(%rsp)
movq %rbp, 0x20(%rsp)
movq %rcx, 0x50(%rsp)
cmpq %rcx, %rax
je 0x2b0707
movq %rax, 0x38(%rsp)
cmpb $0x1, 0x40(%rbx)
jne 0x2b027c
movq (%rbx), %r13
movl 0xd4(%r13), %eax
cmpl 0xd0(%r13), %eax
jb 0x2b01d7
movq 0xd8(%r13), %rdi
movq 0xe0(%r13), %rcx
movl $0x1000, %edx           # imm = 0x1000
pushq $0x1
popq %rsi
callq 0x17ad0
movq %rax, %rbx
movl %ebx, 0xd0(%r13)
movq 0xe0(%r13), %rdi
callq 0x17e70
testl %eax, %eax
jne 0x2b080a
andl $0x0, 0xd4(%r13)
xorl %eax, %eax
testl %ebx, %ebx
movq 0x30(%rsp), %rbx
je 0x2b06ff
movq 0xd8(%r13), %rcx
leal 0x1(%rax), %edx
movl %edx, 0xd4(%r13)
movl %eax, %eax
movzbl (%rcx,%rax), %ebp
cmpq $0xff, %rbp
jne 0x2b02cd
movq (%rbx), %r13
movl 0xec(%r13), %eax
cmpl 0xe8(%r13), %eax
jb 0x2b025e
movq 0xf0(%r13), %rdi
movq 0xf8(%r13), %rcx
movl $0x1000, %edx           # imm = 0x1000
pushq $0x10
popq %rsi
callq 0x17ad0
movq %rax, %rbx
movl %ebx, 0xe8(%r13)
movq 0xf8(%r13), %rdi
callq 0x17e70
testl %eax, %eax
jne 0x2b08b7
andl $0x0, 0xec(%r13)
xorl %eax, %eax
testl %ebx, %ebx
movq 0x30(%rsp), %rbx
je 0x2b071c
movq 0xf0(%r13), %rcx
leal 0x1(%rax), %edx
movl %edx, 0xec(%r13)
movl %eax, %eax
shlq $0x4, %rax
movq 0x8(%rcx,%rax), %rbp
jmp 0x2b02cd
movq 0x20(%rbx), %rax
cmpq 0x10(%rbx), %rax
jae 0x2b0707
movq (%rbx), %rcx
movq 0x60(%rcx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x20(%rbx)
movzbl (%rdx,%rax), %ebp
cmpq $0xff, %rbp
jne 0x2b02cd
movq 0x68(%rcx), %rcx
movq 0x28(%rbx), %rdx
movq %rdx, %rsi
shlq $0x4, %rsi
cmpq %rax, (%rcx,%rsi)
jne 0x2b0827
addq %rsi, %rcx
incq %rdx
movq %rdx, 0x28(%rbx)
movq 0x8(%rcx), %rbp
movq (%rbx), %r13
cmpb $0x1, 0x40(%rbx)
jne 0x2b0360
movq 0xb0(%r13), %rcx
testq %rcx, %rcx
je 0x2b0379
movl 0xa4(%r13), %eax
cmpl 0xa0(%r13), %eax
jb 0x2b0401
movq 0xa8(%r13), %rdi
movl $0x1000, %edx           # imm = 0x1000
pushq $0x8
popq %rsi
callq 0x17ad0
movq %rax, %rbx
movl %ebx, 0xa0(%r13)
movq 0xb0(%r13), %rdi
callq 0x17e70
testl %eax, %eax
je 0x2b03ef
movq 0xb0(%rsp), %rdi
leaq 0x4988a(%rip), %rsi     # 0x2f9bc9
leaq 0xd29e5(%rip), %rdx     # 0x382d2b
xorl %eax, %eax
callq 0x89dbb
movl 0xa4(%r13), %eax
movb $0x1, %cl
movq %rcx, 0x8(%rsp)
jmp 0x2b0401
movq 0x58(%r13), %rax
movq 0x18(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%rbx)
movq (%rax,%rcx,8), %rbx
jmp 0x2b0442
movl 0x8c(%r13), %eax
cmpl 0x88(%r13), %eax
jb 0x2b042c
movq 0x90(%r13), %rdi
movq 0x98(%r13), %rcx
movl $0x1000, %edx           # imm = 0x1000
pushq $0x4
popq %rsi
callq 0x17ad0
movq %rax, %rbx
movl %ebx, 0x88(%r13)
movq 0x98(%r13), %rdi
callq 0x17e70
testl %eax, %eax
je 0x2b041a
movq 0xb0(%rsp), %rdi
leaq 0x497f8(%rip), %rsi     # 0x2f9bc9
leaq 0x49bfb(%rip), %rdx     # 0x2f9fd3
xorl %eax, %eax
callq 0x89dbb
movl 0x8c(%r13), %eax
movb $0x1, %cl
movq %rcx, 0x8(%rsp)
jmp 0x2b042c
andl $0x0, 0xa4(%r13)
xorl %eax, %eax
testl %ebx, %ebx
je 0x2b0740
movq 0xa8(%r13), %rcx
leal 0x1(%rax), %edx
movl %edx, 0xa4(%r13)
movl %eax, %eax
movq (%rcx,%rax,8), %rbx
jmp 0x2b0442
andl $0x0, 0x8c(%r13)
xorl %eax, %eax
testl %ebx, %ebx
je 0x2b0740
movq 0x90(%r13), %rcx
leal 0x1(%rax), %edx
movl %edx, 0x8c(%r13)
movl %eax, %eax
movl (%rcx,%rax,4), %ebx
imulq $0x18, %r14, %r13
addq $0x10, %r13
movq 0x98(%rsp), %rax
movq -0x20(%r12,%r13), %rsi
cmpq %rsi, %rbp
jae 0x2b0557
cmpb $0x1, -0x28(%r12,%r13)
jne 0x2b0490
cmpq $0x0, 0x28(%rsp)
je 0x2b04d0
movq -0x18(%r12,%r13), %rdx
xorl %edi, %edi
movq %rbx, %rcx
movq 0xa0(%rsp), %r8
movq 0xb0(%rsp), %r9
callq *0x28(%rsp)
jmp 0x2b04c0
cmpq %r15, %r14
jae 0x2b07d2
cmpq $0x0, 0x20(%rsp)
je 0x2b04d0
movq -0x18(%r12,%r13), %rdx
movq (%r12,%r13), %rcx
xorl %edi, %edi
movq 0xa0(%rsp), %r8
movq 0xb0(%rsp), %r9
callq *0x20(%rsp)
testl %eax, %eax
movq 0x98(%rsp), %rax
jne 0x2b0756
testq %rax, %rax
je 0x2b04fc
movq -0x18(%r12,%r13), %rdi
movq 0x38(%rsp), %rsi
movq %rbx, %rdx
movq %rbp, %rcx
movq 0xa0(%rsp), %r8
callq *0x98(%rsp)
movq 0x98(%rsp), %rax
cmpq $0x0, 0x40(%rsp)
je 0x2b0541
cmpq $0x2, %r14
jb 0x2b0511
movq -0x38(%r12,%r13), %rdx
jmp 0x2b0513
xorl %edx, %edx
movq -0x20(%r12,%r13), %rdi
movq -0x18(%r12,%r13), %rsi
movq 0xa0(%rsp), %rcx
movq 0xb0(%rsp), %r8
callq *0x40(%rsp)
testl %eax, %eax
movq 0x98(%rsp), %rax
jne 0x2b0756
decq %r14
addq $-0x18, %r13
cmpq $-0x1, %r14
jne 0x2b0452
jmp 0x2b07a4
testb $0x1, 0x8(%rsp)
jne 0x2b06ff
cmpq %rsi, %rbp
jne 0x2b05bb
testq %rbp, %rbp
sete %al
movb 0x7(%rsp), %cl
andb %cl, %al
xorb %al, %cl
movb %cl, 0x7(%rsp)
cmpb $0x1, -0x28(%r12,%r13)
movzbl %al, %edi
jne 0x2b065d
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x2b06d0
movq -0x18(%r12,%r13), %rdx
movq %rbp, %rsi
movq %rbx, %rcx
movq 0xa0(%rsp), %r13
movq %r13, %r8
movq 0xb0(%rsp), %r9
callq *%rax
jmp 0x2b06ca
cmpq %r15, %r14
jb 0x2b05e8
jne 0x2b0855
leaq 0x20(%r15), %rdx
movq %r12, %rdi
movq %r15, %rsi
movq %rdx, %r15
movq 0x48(%rsp), %rcx
movq 0xa0(%rsp), %r8
callq 0x2b08de
movq %rax, %r12
movq %rbp, -0x8(%r12,%r13)
movb $0x1, -0x10(%r12,%r13)
incq %r14
cmpb $0x1, -0x28(%r12,%r13)
jne 0x2b069f
movq 0x90(%rsp), %rax
testq %rax, %rax
je 0x2b0622
movq (%r12,%r13), %rdi
movq 0x38(%rsp), %rsi
movq 0xa0(%rsp), %rdx
callq *%rax
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x2b0655
movq -0x8(%r12,%r13), %rsi
movq (%r12,%r13), %rdx
pushq $0x1
popq %rdi
movq %rbx, %rcx
movq 0xa0(%rsp), %r8
movq 0xb0(%rsp), %r9
callq *%rax
testl %eax, %eax
jne 0x2b06f8
movb $0x0, -0x28(%r12,%r13)
jmp 0x2b06d0
cmpq %r15, %r14
setb %cl
orb %cl, %al
je 0x2b0886
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x2b0697
movq -0x18(%r12,%r13), %rdx
movq (%r12,%r13), %rcx
movq %rbp, %rsi
movq 0xa0(%rsp), %r8
movq 0xb0(%rsp), %r9
callq *%rbx
testl %eax, %eax
jne 0x2b06f8
movb $0x1, -0x28(%r12,%r13)
jmp 0x2b06d0
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x2b06d0
movq (%r12,%r13), %rdx
pushq $0x1
popq %rdi
movq %rbp, %rsi
xorl %ecx, %ecx
movq 0xa0(%rsp), %r13
movq %r13, %r8
movq 0xb0(%rsp), %r9
callq *%rbx
testl %eax, %eax
je 0x2b06d8
jmp 0x2b06ef
movq 0xa0(%rsp), %r13
movq 0x38(%rsp), %rax
incq %rax
movq 0x30(%rsp), %rbx
movq 0x50(%rsp), %rcx
jmp 0x2b015c
movb $0x1, %al
movq %rax, 0x8(%rsp)
jmp 0x2b0707
movb $0x1, %al
movq %rax, 0x8(%rsp)
movq 0xa0(%rsp), %r13
movq 0x8(%rsp), %rax
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x1c(%rsp)
movq 0x10(%rsp), %r14
jmp 0x2b0763
leaq 0x493fa(%rip), %rsi     # 0x2f9b1d
leaq 0xd1b03(%rip), %rdx     # 0x38222d
movq 0xb0(%rsp), %rdi
movl $0x88, %ecx
xorl %eax, %eax
callq 0x89dbb
jmp 0x2b0756
leaq 0x49874(%rip), %rsi     # 0x2f9fbb
movq 0xb0(%rsp), %rdi
xorl %eax, %eax
callq 0x89dbb
movq 0x10(%rsp), %r14
movq 0xa0(%rsp), %r13
leaq 0x10(%r12), %rbx
subq $0x1, %r15
jb 0x2b077d
movq (%rbx), %rdi
movq %r13, %rsi
callq *%r14
addq $0x18, %rbx
jmp 0x2b0768
leaq 0xd1aa9(%rip), %rsi     # 0x38222d
pushq $0x57
popq %rdx
movq %r12, %rdi
callq 0x936f9
movl 0x1c(%rsp), %eax
negl %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1877bd(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3485e(%rip), %rsi     # 0x2e5013
leaq 0xd1aa8(%rip), %rdx     # 0x382264
leaq 0xd1a59(%rip), %rcx     # 0x38221c
leaq 0xd1a63(%rip), %r8      # 0x38222d
movl $0xb5, %r9d
jmp 0x2b07fe
movq 0x18778f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x34830(%rip), %rsi     # 0x2e5013
leaq 0xd1a57(%rip), %rdx     # 0x382241
leaq 0xd1a2b(%rip), %rcx     # 0x38221c
leaq 0xd1a35(%rip), %r8      # 0x38222d
movl $0x97, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x187757(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x493ae(%rip), %rsi     # 0x2f9bc9
leaq 0x493c9(%rip), %rdx     # 0x2f9beb
jmp 0x2b08cf
movq 0x18773a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x347db(%rip), %rsi     # 0x2e5013
leaq 0x4931b(%rip), %rdx     # 0x2f9b5a
leaq 0xd19d6(%rip), %rcx     # 0x38221c
leaq 0xd19e0(%rip), %r8      # 0x38222d
movl $0x88, %r9d
jmp 0x2b07fe
movq 0x18770c(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x347ad(%rip), %rsi     # 0x2e5013
leaq 0xd198b(%rip), %rdx     # 0x3821f8
leaq 0xd19a8(%rip), %rcx     # 0x38221c
leaq 0xd19b2(%rip), %r8      # 0x38222d
movl $0xe5, %r9d
jmp 0x2b07fe
movq 0x1876db(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3477c(%rip), %rsi     # 0x2e5013
leaq 0xd19a3(%rip), %rdx     # 0x382241
leaq 0xd1977(%rip), %rcx     # 0x38221c
leaq 0xd1981(%rip), %r8      # 0x38222d
movl $0xd3, %r9d
jmp 0x2b07fe
movq 0x1876aa(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x49301(%rip), %rsi     # 0x2f9bc9
leaq 0xa772a(%rip), %rdx     # 0x357ff9
xorl %eax, %eax
callq 0x17a50
pushq $0x2
popq %rdi
callq 0x178f0