// File: /workspace/github_c_makefile_star2_O1/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 0x14ff38(%rip), %rbp    # 0x39bfe4
movq %rbp, %rsi
movl $0x7b, %edx
callq 0x2d5f0
movq %rax, 0x10(%rsp)
movl %r12d, %edi
movq %rdi, 0x28(%rsp)
shlq $0x4, %rdi
movq %rbp, %rsi
movl $0x7c, %edx
callq 0x2d5f0
movq %rax, %r15
incq %r13
movq -0x28(%rbx), %rax
cmpq %rax, -0x18(%rbx)
jne 0x24c197
movq 0x60(%rsp), %rcx
addq %rax, %rcx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rsi
cmpq 0x58(%rsp), %rax
je 0x24c10c
movq 0x2868(%rsp), %rdi
jmp 0x24c10e
xorl %edi, %edi
leaq 0x14fecf(%rip), %rdx    # 0x39bfe4
movl $0x86, %ecx
callq 0x2d900
movq %rax, 0x2868(%rsp)
movq 0x58(%rsp), %rcx
cmpq %rcx, 0x40(%rsp)
jne 0x24c148
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rdx
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x31c50
cmpq $0x0, 0x2870(%rsp)
je 0x24c18d
cmpq $0x0, 0x60(%rsp)
je 0x24c18d
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
addq $0x28, %rbx
cmpq 0x60(%rsp), %r14
jb 0x24c160
movq 0x60(%rsp), %rax
addq %rax, 0x40(%rsp)
movq 0x2868(%rsp), %rax
movq 0x50(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x50(%rsp)
leaq (%rcx,%rcx,4), %rcx
xorl %edx, %edx
movq %rdx, (%rax,%rcx,8)
movq $0x1, 0x8(%rax,%rcx,8)
movq %rdx, 0x10(%rax,%rcx,8)
movq %r13, 0x18(%rax,%rcx,8)
movl $0x0, 0x20(%rax,%rcx,8)
movw $0x0, 0x24(%rax,%rcx,8)
movq 0x50(%rsp), %rax
cmpq %rax, 0x48(%rsp)
jae 0x24c1ea
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x24c57d
movq %r15, 0x18(%rsp)
movq 0x2868(%rsp), %rcx
leaq (%rax,%rax,4), %rdx
cmpb $0x1, -0x4(%rcx,%rdx,8)
jne 0x24c247
decq %rax
movq %rax, 0x50(%rsp)
leaq (%rax,%rax,4), %rdx
leaq (%rcx,%rdx,8), %rsi
je 0x24c55a
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 0x24c56f
leaq (%rcx,%rdx,8), %rax
movq -0x18(%rax), %rcx
movq %rax, (%rsp)
movq -0x10(%rax), %r8
cmpq %r8, %rcx
jae 0x24c5ee
movq %r15, %rdi
movq 0x10(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x2228a6
cmpq 0x28(%rsp), %rax
ja 0x24c5e9
movq (%rsp), %rsi
movq -0x10(%rsi), %r9
subq -0x18(%rsi), %r9
testq %rax, %rax
je 0x24c550
xorl %ebx, %ebx
xorl %edx, %edx
movq %rax, 0x20(%rsp)
movq %rbx, %rcx
shlq $0x4, %rcx
movq (%r15,%rcx), %r12
movq 0x8(%r15,%rcx), %r13
leal 0x1(%rdx), %r14d
movq %r13, %rbp
subq %r12, %rbp
movq -0x10(%rsi), %rcx
subq -0x18(%rsi), %rcx
cmpq %rcx, %rbp
jne 0x24c2e7
decq -0x20(%rsi)
movq 0x40(%rsp), %rcx
cmpq %rcx, 0x50(%rsp)
jne 0x24c3b1
cmpq 0x58(%rsp), %rcx
je 0x24c30b
movq 0x2868(%rsp), %rdi
jmp 0x24c30d
leaq 0x1(%r12), %rcx
cmpq %r13, %rcx
jne 0x24c2fa
incq -0x28(%rsi)
decq %r9
jmp 0x24c303
cmpq %r12, %r13
jne 0x24c41a
movl %edx, %r14d
jmp 0x24c406
xorl %edi, %edi
addq 0x60(%rsp), %rcx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rsi
leaq 0x14fcc3(%rip), %rdx    # 0x39bfe4
movl $0x45, %ecx
callq 0x2d900
movq %rax, 0x2868(%rsp)
movq 0x58(%rsp), %rcx
cmpq %rcx, 0x40(%rsp)
jne 0x24c354
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rdx
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x31c50
cmpq $0x0, 0x2870(%rsp)
je 0x24c399
cmpq $0x0, 0x60(%rsp)
je 0x24c399
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x40(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq 0x2868(%rsp), %rdi
addq %rbp, %rdi
callq *0x2870(%rsp)
incq %r15
addq $0x28, %rbp
cmpq 0x60(%rsp), %r15
jb 0x24c36c
movq 0x60(%rsp), %rax
addq %rax, 0x40(%rsp)
movq 0x18(%rsp), %r15
movq (%rsp), %rsi
movq 0x20(%rsp), %rax
movq 0x2868(%rsp), %rdi
movq 0x50(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x50(%rsp)
leaq (%rcx,%rcx,4), %rcx
movq $0x0, (%rdi,%rcx,8)
movq $0x1, 0x8(%rdi,%rcx,8)
movq %r12, 0x10(%rdi,%rcx,8)
movq %r13, 0x18(%rdi,%rcx,8)
movl %r14d, 0x20(%rdi,%rcx,8)
movw $0x100, 0x24(%rdi,%rcx,8) # imm = 0x100
movq 0x50(%rsp), %rcx
cmpq %rcx, 0x48(%rsp)
jae 0x24c403
movq %rcx, 0x48(%rsp)
xorl %r9d, %r9d
incq %rbx
movl %r14d, %edx
cmpq %rax, %rbx
jne 0x24c29b
jmp 0x24c550
movq 0x40(%rsp), %rcx
cmpq %rcx, 0x50(%rsp)
jne 0x24c4f6
cmpq 0x58(%rsp), %rcx
movl %r14d, 0xc(%rsp)
movq %r9, 0x38(%rsp)
je 0x24c445
movq 0x2868(%rsp), %rdi
jmp 0x24c447
xorl %edi, %edi
addq 0x60(%rsp), %rcx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rsi
leaq 0x14fb89(%rip), %rdx    # 0x39bfe4
movl $0x5a, %ecx
callq 0x2d900
movq %rax, 0x2868(%rsp)
movq 0x58(%rsp), %rcx
cmpq %rcx, 0x40(%rsp)
jne 0x24c48e
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rdx
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x31c50
cmpq $0x0, 0x2870(%rsp)
je 0x24c4d4
cmpq $0x0, 0x60(%rsp)
je 0x24c4d4
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x40(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq 0x2868(%rsp), %rdi
addq %r15, %rdi
callq *0x2870(%rsp)
incq %r14
addq $0x28, %r15
cmpq 0x60(%rsp), %r14
jb 0x24c4a7
movq 0x60(%rsp), %rax
addq %rax, 0x40(%rsp)
movq 0x18(%rsp), %r15
movq (%rsp), %rsi
movq 0x20(%rsp), %rax
movl 0xc(%rsp), %r14d
movq 0x38(%rsp), %r9
movq 0x2868(%rsp), %rdi
movq 0x50(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x50(%rsp)
leaq (%rcx,%rcx,4), %rcx
movq $0x0, (%rdi,%rcx,8)
movq $0x1, 0x8(%rdi,%rcx,8)
movq %r12, 0x10(%rdi,%rcx,8)
movq %r13, 0x18(%rdi,%rcx,8)
movl %r14d, 0x20(%rdi,%rcx,8)
movw $0x0, 0x24(%rdi,%rcx,8)
movq 0x50(%rsp), %rcx
cmpq %rcx, 0x48(%rsp)
jae 0x24c548
movq %rcx, 0x48(%rsp)
subq %rbp, %r9
jmp 0x24c406
addq %r9, -0x28(%rsi)
movb $0x1, -0x4(%rsi)
jmp 0x24c56f
movq (%rsi), %rdx
movq 0x8(%rsi), %rsi
leaq 0x14fa98(%rip), %rdi    # 0x39c000
xorl %eax, %eax
callq 0x2ef80
movq 0x50(%rsp), %rax
testq %rax, %rax
jne 0x24c1fd
leaq 0x14fa60(%rip), %rbx    # 0x39bfe4
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movl $0xa0, %edx
callq 0x2feb0
movq %r15, %rdi
movq %rbx, %rsi
movl $0xa1, %edx
callq 0x2feb0
movq 0x40(%rsp), %rax
cmpq 0x58(%rsp), %rax
jbe 0x24c5d7
movq 0x2868(%rsp), %rdi
leaq 0x14fa23(%rip), %rsi    # 0x39bfe4
movl $0xa2, %edx
callq 0x2feb0
movq $0x0, 0x2868(%rsp)
addq $0x2878, %rsp           # imm = 0x2878
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8709e
callq 0x87067
nop