// File: /workspace/github_c_makefile_star2_O2/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, %r15d
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)
andq $0x0, 0x2808(%rbx)
movq %rsi, %r14
movq %rdi, 0x28(%rsp)
leal (%r15,%r15), %edi
shlq $0x3, %rdi
leaq 0x14acff(%rip), %r12    # 0x335d90
pushq $0x7b
popq %rdx
movq %r12, %rsi
callq 0x2e5f0
movq %rax, 0x18(%rsp)
movl %r15d, %edi
movq %rdi, 0x20(%rsp)
shlq $0x4, %rdi
pushq $0x7c
popq %rdx
movq %r12, %rsi
callq 0x2e5f0
movq %rax, 0x8(%rsp)
incq %r14
movq -0x18(%rbx), %rax
movq 0x2800(%rbx), %rdi
cmpq -0x28(%rbx), %rax
jne 0x1eb174
movq 0x60(%rsp), %rcx
addq %rax, %rcx
imulq $0x28, %rcx, %rsi
xorl %ecx, %ecx
cmpq 0x58(%rsp), %rax
cmoveq %rcx, %rdi
leaq 0x14ac9d(%rip), %rdx    # 0x335d90
movl $0x86, %ecx
callq 0x2e900
movq %rax, 0x2868(%rsp)
movq 0x40(%rsp), %rcx
cmpq 0x58(%rsp), %rcx
jne 0x1eb122
imulq $0x28, %rcx, %rdx
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x32ca0
cmpq $0x0, 0x2870(%rsp)
je 0x1eb15d
xorl %ebx, %ebx
xorl %r15d, %r15d
movq 0x60(%rsp), %rax
cmpq %rax, %r15
jae 0x1eb162
imulq $0x28, 0x40(%rsp), %rdi
addq 0x2868(%rsp), %rdi
addq %rbx, %rdi
callq *0x2870(%rsp)
incq %r15
addq $0x28, %rbx
jmp 0x1eb132
movq 0x60(%rsp), %rax
addq %rax, 0x40(%rsp)
movq 0x2868(%rsp), %rdi
movq 0x50(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x50(%rsp)
imulq $0x28, %rax, %rax
andq $0x0, (%rdi,%rax)
movq $0x1, 0x8(%rdi,%rax)
andq $0x0, 0x10(%rdi,%rax)
movq %r14, 0x18(%rdi,%rax)
andl $0x0, 0x20(%rdi,%rax)
andw $0x0, 0x24(%rdi,%rax)
movq 0x50(%rsp), %rax
cmpq %rax, 0x48(%rsp)
jae 0x1eb1b6
movq %rax, 0x48(%rsp)
leaq 0x68(%rsp), %r14
testq %rax, %rax
je 0x1eb519
movq 0x2868(%rsp), %rsi
imulq $0x28, %rax, %rcx
cmpb $0x1, -0x4(%rsi,%rcx)
jne 0x1eb210
decq %rax
movq %rax, 0x50(%rsp)
imulq $0x28, %rax, %rcx
addq %rsi, %rcx
testq %rax, %rax
je 0x1eb4fa
movl 0x20(%rcx), %edx
subq %rdx, %rax
imulq $0x28, %rax, %rax
movdqu (%rcx), %xmm0
movdqu (%rsi,%rax), %xmm1
paddq %xmm0, %xmm1
movdqu %xmm1, (%rsi,%rax)
jmp 0x1eb50f
addq %rcx, %rsi
movq -0x18(%rsi), %rcx
movq %rsi, 0x10(%rsp)
movq -0x10(%rsi), %r8
cmpq %r8, %rcx
jae 0x1eb5a5
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x1bc77b
movq %rax, 0x38(%rsp)
cmpq 0x20(%rsp), %rax
ja 0x1eb57b
movq 0x10(%rsp), %rdx
movq -0x10(%rdx), %rsi
subq -0x18(%rdx), %rsi
xorl %eax, %eax
xorl %r13d, %r13d
cmpq 0x38(%rsp), %r13
je 0x1eb4f0
movq %r13, %rcx
shlq $0x4, %rcx
movq (%rbx,%rcx), %r15
movq 0x8(%rbx,%rcx), %r12
leal 0x1(%rax), %ecx
movl %ecx, 0x4(%rsp)
movq %r12, %rbp
subq %r15, %rbp
movq -0x10(%rdx), %rcx
subq -0x18(%rdx), %rcx
cmpq %rcx, %rbp
jne 0x1eb345
decq -0x20(%rdx)
movq 0x50(%rsp), %rax
movq 0x2868(%rsp), %rdi
cmpq 0x40(%rsp), %rax
jne 0x1eb42b
movq 0x60(%rsp), %rcx
addq %rax, %rcx
imulq $0x28, %rcx, %rsi
cmpq 0x58(%rsp), %rax
movl $0x0, %eax
cmoveq %rax, %rdi
leaq 0x14aab8(%rip), %rdx    # 0x335d90
pushq $0x45
popq %rcx
callq 0x2e900
movq %rax, 0x2868(%rsp)
movq 0x40(%rsp), %rcx
cmpq 0x58(%rsp), %rcx
jne 0x1eb303
imulq $0x28, %rcx, %rdx
movq %rax, %rdi
movq %r14, %rsi
callq 0x32ca0
cmpq $0x0, 0x2870(%rsp)
je 0x1eb40f
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x60(%rsp), %rax
cmpq %rax, %rbx
jae 0x1eb414
imulq $0x28, 0x40(%rsp), %rdi
addq 0x2868(%rsp), %rdi
addq %rbp, %rdi
callq *0x2870(%rsp)
incq %rbx
addq $0x28, %rbp
jmp 0x1eb316
leaq 0x1(%r15), %rcx
cmpq %r12, %rcx
jne 0x1eb357
incq -0x28(%rdx)
decq %rsi
jmp 0x1eb35c
cmpq %r15, %r12
jne 0x1eb363
movl %eax, %ecx
jmp 0x1eb477
movq %rsi, 0x30(%rsp)
movq 0x50(%rsp), %rax
movq 0x2868(%rsp), %rdi
cmpq 0x40(%rsp), %rax
jne 0x1eb4a2
movq 0x60(%rsp), %rcx
addq %rax, %rcx
imulq $0x28, %rcx, %rsi
cmpq 0x58(%rsp), %rax
movl $0x0, %eax
cmoveq %rax, %rdi
leaq 0x14a9ef(%rip), %rdx    # 0x335d90
pushq $0x5a
popq %rcx
callq 0x2e900
movq %rax, 0x2868(%rsp)
movq 0x40(%rsp), %rcx
cmpq 0x58(%rsp), %rcx
jne 0x1eb3cc
imulq $0x28, %rcx, %rdx
movq %rax, %rdi
movq %r14, %rsi
callq 0x32ca0
cmpq $0x0, 0x2870(%rsp)
je 0x1eb481
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x60(%rsp), %rax
cmpq %rax, %r14
jae 0x1eb486
imulq $0x28, 0x40(%rsp), %rdi
addq 0x2868(%rsp), %rdi
addq %rbx, %rdi
callq *0x2870(%rsp)
incq %r14
addq $0x28, %rbx
jmp 0x1eb3e0
movq 0x60(%rsp), %rax
addq %rax, 0x40(%rsp)
movq 0x50(%rsp), %rax
movq 0x2868(%rsp), %rdi
movq 0x8(%rsp), %rbx
leaq 0x1(%rax), %rcx
movq %rcx, 0x50(%rsp)
imulq $0x28, %rax, %rax
andq $0x0, (%rdi,%rax)
movq $0x1, 0x8(%rdi,%rax)
movq %r15, 0x10(%rdi,%rax)
movq %r12, 0x18(%rdi,%rax)
movl 0x4(%rsp), %ecx
movl %ecx, 0x20(%rdi,%rax)
movw $0x100, 0x24(%rdi,%rax) # imm = 0x100
movq 0x50(%rsp), %rax
cmpq %rax, 0x48(%rsp)
jae 0x1eb470
movq %rax, 0x48(%rsp)
xorl %esi, %esi
movq 0x10(%rsp), %rdx
incq %r13
movl %ecx, %eax
jmp 0x1eb262
movq 0x60(%rsp), %rax
addq %rax, 0x40(%rsp)
movq 0x50(%rsp), %rax
movq 0x2868(%rsp), %rdi
leaq 0x68(%rsp), %r14
movq 0x8(%rsp), %rbx
leaq 0x1(%rax), %rcx
movq %rcx, 0x50(%rsp)
imulq $0x28, %rax, %rax
andq $0x0, (%rdi,%rax)
movq $0x1, 0x8(%rdi,%rax)
movq %r15, 0x10(%rdi,%rax)
movq %r12, 0x18(%rdi,%rax)
movl 0x4(%rsp), %ecx
movl %ecx, 0x20(%rdi,%rax)
andw $0x0, 0x24(%rdi,%rax)
movq 0x50(%rsp), %rax
cmpq %rax, 0x48(%rsp)
jae 0x1eb4e6
movq %rax, 0x48(%rsp)
movq 0x30(%rsp), %rsi
subq %rbp, %rsi
jmp 0x1eb472
addq %rsi, -0x28(%rdx)
movb $0x1, -0x4(%rdx)
jmp 0x1eb50f
movq (%rcx), %rdx
movq 0x8(%rcx), %rsi
leaq 0x14a8a4(%rip), %rdi    # 0x335dac
xorl %eax, %eax
callq 0x2ff90
movq 0x50(%rsp), %rax
jmp 0x1eb1bb
leaq 0x14a870(%rip), %rbx    # 0x335d90
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl $0xa0, %edx
callq 0x30f00
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl $0xa1, %edx
callq 0x30f00
movq 0x40(%rsp), %rax
cmpq 0x58(%rsp), %rax
jbe 0x1eb569
movq 0x2868(%rsp), %rdi
leaq 0x14a831(%rip), %rsi    # 0x335d90
movl $0xa2, %edx
callq 0x30f00
addq $0x2878, %rsp           # imm = 0x2878
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x21fa2e(%rip), %rax    # 0x40afb0
movq (%rax), %rdi
leaq 0xf3264(%rip), %rsi     # 0x2de7f0
leaq 0x14a877(%rip), %rdx    # 0x335e0a
leaq 0x14a85b(%rip), %rcx    # 0x335df5
leaq 0x14a7ef(%rip), %r8     # 0x335d90
pushq $0x31
jmp 0x1eb5cd
movq 0x21fa04(%rip), %rax    # 0x40afb0
movq (%rax), %rdi
leaq 0xf323a(%rip), %rsi     # 0x2de7f0
leaq 0x14a81a(%rip), %rdx    # 0x335dd7
leaq 0x14a831(%rip), %rcx    # 0x335df5
leaq 0x14a7c5(%rip), %r8     # 0x335d90
pushq $0x2b
popq %r9
xorl %eax, %eax
callq 0x32960
callq 0x2e820
nop