// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/pck-count-nodes.c
// Function: gt_pck_count_nodes_dfs
void gt_pck_count_nodes_dfs(const FMindex *index,
                        GtUword totallength,
                        unsigned int numofchars)
{
  GtStackNodecount stack;
  Nodecount root;
  Nodecount *current;
  Mbtab *tmpmbtab;
  GtUword *rangeOccs;
  GtUword resize = 128UL; /* TODO DW make this user definable, or dependable
                             on input data */

  GT_STACK_INIT(&stack, resize);
  rangeOccs = gt_malloc(sizeof (*rangeOccs) * GT_MULT2(numofchars));
  tmpmbtab = gt_malloc(sizeof (*tmpmbtab) * numofchars);

  root.lower = 0UL;
  root.upper = totallength + 1;
  root.leaves = 0UL;
  root.branching = 1UL;
  root.parentOffset = 0U;
  root.visited = false;
  root.on_branch = false;

  GT_STACK_PUSH(&stack, root);

  while (!GT_STACK_ISEMPTY(&stack))
  {
    current = &(stack.space[stack.nextfree -1]);
    if (current->visited)
    {
      current = &(GT_STACK_POP(&stack));
      if GT_STACK_ISEMPTY(&stack)
      {
        /* TODO DW change to gt_loger_log */
        gt_log_log("on root:\n "GT_WU" branching nodes\n "GT_WU" leaves\n",
           current->branching, current->leaves);
      }
      else
      {
        process_count_node(&stack, current);
      }
    }
    else
    {
      visit_count_children(index, current, &stack,
                     tmpmbtab, rangeOccs, numofchars);
      current->visited = true;
    }
  }
  gt_free(rangeOccs);
  gt_free(tmpmbtab);
  GT_STACK_DELETE(&stack);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2878, %rsp           # imm = 0x2878
movl %edx, %r12d
movq %rsi, %r13
movq %rdi, 0x30(%rsp)
movl $0x100, %eax            # imm = 0x100
leaq 0x68(%rsp), %rbx
movq %rax, -0x10(%rbx)
movq $0x80, -0x8(%rbx)
movq %rax, -0x28(%rbx)
pxor %xmm0, %xmm0
movdqu %xmm0, -0x20(%rbx)
movq %rbx, 0x2800(%rbx)
movq $0x0, 0x2808(%rbx)
leal (%r12,%r12), %edi
shlq $0x3, %rdi
leaq 0x14f728(%rip), %rbp    # 0x392a30
movq %rbp, %rsi
movl $0x7b, %edx
callq 0x2d5f0
movq %rax, 0x18(%rsp)
movl %r12d, %edi
movq %rdi, 0x28(%rsp)
shlq $0x4, %rdi
movq %rbp, %rsi
movl $0x7c, %edx
callq 0x2d5f0
movq %rax, (%rsp)
incq %r13
movq -0x18(%rbx), %rax
movq 0x2800(%rbx), %rdi
cmpq -0x28(%rbx), %rax
jne 0x243409
movq 0x60(%rsp), %rcx
addq %rax, %rcx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rsi
xorl %ecx, %ecx
cmpq 0x58(%rsp), %rax
cmoveq %rcx, %rdi
leaq 0x14f6bf(%rip), %rdx    # 0x392a30
movl $0x86, %ecx
callq 0x2d900
movq %rax, 0x2868(%rsp)
movq 0x40(%rsp), %rcx
cmpq 0x58(%rsp), %rcx
jne 0x2433a4
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rdx
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x31c50
cmpq $0x0, 0x2870(%rsp)
setne %cl
movq 0x60(%rsp), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x2433f7
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x40(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq 0x2868(%rsp), %rdi
addq %rbx, %rdi
callq *0x2870(%rsp)
incq %r14
movq 0x60(%rsp), %rax
addq $0x28, %rbx
cmpq %rax, %r14
jb 0x2433c7
addq %rax, 0x40(%rsp)
movq 0x2868(%rsp), %rdi
movq 0x50(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x50(%rsp)
leaq (%rax,%rax,4), %rax
xorl %ecx, %ecx
movq %rcx, (%rdi,%rax,8)
movq $0x1, 0x8(%rdi,%rax,8)
movq %rcx, 0x10(%rdi,%rax,8)
movq %r13, 0x18(%rdi,%rax,8)
movl $0x0, 0x20(%rdi,%rax,8)
movw $0x0, 0x24(%rdi,%rax,8)
movq 0x50(%rsp), %rax
cmpq %rax, 0x48(%rsp)
jae 0x243451
movq %rax, 0x48(%rsp)
jmp 0x24345a
testq %rax, %rax
je 0x2437fe
movq 0x2868(%rsp), %rcx
leaq (%rax,%rax,4), %rdx
cmpb $0x1, -0x4(%rcx,%rdx,8)
jne 0x2434a4
decq %rax
movq %rax, 0x50(%rsp)
leaq (%rax,%rax,4), %rdx
leaq (%rcx,%rdx,8), %rsi
je 0x2437df
movl 0x20(%rsi), %edx
subq %rdx, %rax
leaq (%rax,%rax,4), %rax
movdqu (%rsi), %xmm0
movdqu (%rcx,%rax,8), %xmm1
paddq %xmm0, %xmm1
movdqu %xmm1, (%rcx,%rax,8)
jmp 0x2437f4
leaq (%rcx,%rdx,8), %rax
movq -0x18(%rax), %rcx
movq %rax, 0x8(%rsp)
movq -0x10(%rax), %r8
cmpq %r8, %rcx
jae 0x243864
movq (%rsp), %rbx
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x219f93
cmpq 0x28(%rsp), %rax
ja 0x24385f
movq 0x8(%rsp), %rdx
movq -0x10(%rdx), %r10
subq -0x18(%rdx), %r10
testq %rax, %rax
je 0x2437d5
xorl %r14d, %r14d
xorl %esi, %esi
movq %rax, 0x20(%rsp)
movq %r14, %rcx
shlq $0x4, %rcx
movq (%rbx,%rcx), %r13
movq 0x8(%rbx,%rcx), %r12
leal 0x1(%rsi), %r15d
movq %r12, %rbp
subq %r13, %rbp
movq -0x10(%rdx), %rcx
subq -0x18(%rdx), %rcx
cmpq %rcx, %rbp
jne 0x2435f4
decq -0x20(%rdx)
movq 0x50(%rsp), %r8
movq 0x2868(%rsp), %rdi
cmpq 0x40(%rsp), %r8
jne 0x243703
movq 0x60(%rsp), %rcx
addq %r8, %rcx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rsi
cmpq 0x58(%rsp), %r8
movl $0x0, %eax
cmoveq %rax, %rdi
leaq 0x14f4c5(%rip), %rdx    # 0x392a30
movl $0x45, %ecx
callq 0x2d900
movq %rax, 0x2868(%rsp)
movq 0x40(%rsp), %rcx
cmpq 0x58(%rsp), %rcx
jne 0x24359e
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rdx
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x31c50
cmpq $0x0, 0x2870(%rsp)
movq 0x60(%rsp), %rax
je 0x2436e3
testq %rax, %rax
je 0x2436e1
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x40(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq 0x2868(%rsp), %rdi
addq %rbp, %rdi
callq *0x2870(%rsp)
incq %rbx
movq 0x60(%rsp), %rax
addq $0x28, %rbp
cmpq %rax, %rbx
jb 0x2435bf
jmp 0x2436e3
leaq 0x1(%r13), %rcx
cmpq %r12, %rcx
jne 0x243606
incq -0x28(%rdx)
decq %r10
jmp 0x24360b
cmpq %r13, %r12
jne 0x243613
movl %esi, %r15d
jmp 0x24374b
movq 0x50(%rsp), %r8
movq 0x2868(%rsp), %rdi
cmpq 0x40(%rsp), %r8
jne 0x243788
movq %r10, 0x38(%rsp)
movl %r15d, 0x14(%rsp)
movq 0x60(%rsp), %rcx
addq %r8, %rcx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rsi
cmpq 0x58(%rsp), %r8
movl $0x0, %eax
cmoveq %rax, %rdi
leaq 0x14f3d6(%rip), %rdx    # 0x392a30
movl $0x5a, %ecx
callq 0x2d900
movq %rax, 0x2868(%rsp)
movq 0x40(%rsp), %rcx
cmpq 0x58(%rsp), %rcx
jne 0x24368d
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rdx
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x31c50
cmpq $0x0, 0x2870(%rsp)
movq 0x60(%rsp), %rax
je 0x24375e
testq %rax, %rax
je 0x24375c
xorl %ebx, %ebx
xorl %r15d, %r15d
movq 0x40(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq 0x2868(%rsp), %rdi
addq %rbx, %rdi
callq *0x2870(%rsp)
incq %r15
movq 0x60(%rsp), %rax
addq $0x28, %rbx
cmpq %rax, %r15
jb 0x2436af
jmp 0x24375e
xorl %eax, %eax
addq %rax, 0x40(%rsp)
movq 0x50(%rsp), %r8
movq 0x2868(%rsp), %rdi
movq (%rsp), %rbx
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %rax
leaq 0x1(%r8), %rcx
movq %rcx, 0x50(%rsp)
leaq (%r8,%r8,4), %rcx
movq $0x0, (%rdi,%rcx,8)
movq $0x1, 0x8(%rdi,%rcx,8)
movq %r13, 0x10(%rdi,%rcx,8)
movq %r12, 0x18(%rdi,%rcx,8)
movl %r15d, 0x20(%rdi,%rcx,8)
movw $0x100, 0x24(%rdi,%rcx,8) # imm = 0x100
movq 0x50(%rsp), %rcx
cmpq %rcx, 0x48(%rsp)
jae 0x243748
movq %rcx, 0x48(%rsp)
xorl %r10d, %r10d
incq %r14
movl %r15d, %esi
cmpq %rax, %r14
jne 0x2434ff
jmp 0x2437d5
xorl %eax, %eax
addq %rax, 0x40(%rsp)
movq 0x50(%rsp), %r8
movq 0x2868(%rsp), %rdi
movq (%rsp), %rbx
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %rax
movl 0x14(%rsp), %r15d
movq 0x38(%rsp), %r10
leaq 0x1(%r8), %rcx
movq %rcx, 0x50(%rsp)
leaq (%r8,%r8,4), %rcx
movq $0x0, (%rdi,%rcx,8)
movq $0x1, 0x8(%rdi,%rcx,8)
movq %r13, 0x10(%rdi,%rcx,8)
movq %r12, 0x18(%rdi,%rcx,8)
movl %r15d, 0x20(%rdi,%rcx,8)
movw $0x0, 0x24(%rdi,%rcx,8)
movq 0x50(%rsp), %rcx
cmpq %rcx, 0x48(%rsp)
jae 0x2437cd
movq %rcx, 0x48(%rsp)
subq %rbp, %r10
jmp 0x24374b
addq %r10, -0x28(%rdx)
movb $0x1, -0x4(%rdx)
jmp 0x2437f4
movq (%rsi), %rdx
movq 0x8(%rsi), %rsi
leaq 0x14f25f(%rip), %rdi    # 0x392a4c
xorl %eax, %eax
callq 0x2ef80
movq 0x50(%rsp), %rax
jmp 0x243451
leaq 0x14f22b(%rip), %rbx    # 0x392a30
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl $0xa0, %edx
callq 0x2feb0
movq (%rsp), %rdi
movq %rbx, %rsi
movl $0xa1, %edx
callq 0x2feb0
movq 0x40(%rsp), %rax
cmpq 0x58(%rsp), %rax
jbe 0x24384d
movq 0x2868(%rsp), %rdi
leaq 0x14f1ed(%rip), %rsi    # 0x392a30
movl $0xa2, %edx
callq 0x2feb0
addq $0x2878, %rsp           # imm = 0x2878
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x85a13
callq 0x859dc
nopl (%rax)