// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/shu-dfs.c
// Function: gt_pck_calculate_shulen
int gt_pck_calculate_shulen(const FMindex *index,
                            const GtShuUnitFileInfo *unit_info,
                            uint64_t **shulen,
                            GtUword numofchars,
                            GtUword total_length,
                            GtTimer *timer,
                            GtLogger *logger,
                            GtError *err)
{
  int had_err = 0;
  GtStackShuNode stack;
  ShuNode *root;
  Mbtab *tmpmbtab;
  const GtUword resize = 64UL;
  GtUword *rangeOccs,
                **special_char_rows_and_pos,
                depth_idx,
                processed_nodes,
                max_idx = gt_pck_special_occ_in_nonspecial_intervals(index) - 1;
  BwtSeqpositionextractor *pos_extractor;
  const GtEncseq *encseq = unit_info->encseq;

  gt_assert(max_idx < total_length);
  rangeOccs = gt_calloc((size_t) GT_MULT2(numofchars), sizeof (*rangeOccs));
  tmpmbtab = gt_calloc((size_t) (numofchars + 3), sizeof (*tmpmbtab ));
  GT_STACK_INIT_WITH_INITFUNC(&stack, resize, initialise_node);
  pos_extractor = gt_newBwtSeqpositionextractor(index, total_length + 1);
  if (timer != NULL)
  {
    gt_timer_show_progress(timer, "obtain special pos", stdout);
  }
  special_char_rows_and_pos = get_special_pos(index,
                                              pos_extractor,
                                              max_idx + 1);
  GT_STACK_NEXT_FREE(&stack,root);
  gt_array2dim_calloc(root->countTermSubtree,
                      numofchars+1UL,
                      unit_info->num_of_genomes);
  root->process = false;
  root->parentOffset = 0;
  root->depth = 0;
  root->lower = 0;
  root->upper = total_length + 1;

  if (timer != NULL)
  {
    gt_timer_show_progress(timer, "traverse virtual tree", stdout);
  }
  processed_nodes = 0;
  while (!had_err && !GT_STACK_ISEMPTY(&stack))
  {
    ShuNode *current;

    gt_assert(stack.nextfree > 0);
    current = stack.space + stack.nextfree -1;
    if (current->process)
    {
      GT_STACK_DECREMENTTOP(&stack);
        had_err = process_shu_node(current,
                                   &stack,
                                   shulen,
                                   unit_info->num_of_genomes,
                                   numofchars,
                                   logger,
                                   err);
      processed_nodes++;
    }
    else
    {
      had_err = visit_shu_children(index,
                                   current,
                                   &stack,
                                   encseq,
                                   tmpmbtab,
                                   pos_extractor,
                                   rangeOccs,
                                   special_char_rows_and_pos,
                                   numofchars,
                                   unit_info,
                                   total_length,
                                   max_idx,
                                   logger,
                                   err);
    }
  }
  gt_logger_log(logger, "max stack depth = "GT_WU"", GT_STACK_MAXSIZE(&stack));
  gt_log_log("processed nodes= "GT_WU"", processed_nodes);
  for (depth_idx = 0; depth_idx < GT_STACK_MAXSIZE(&stack); depth_idx++)
  {
    gt_array2dim_delete(stack.space[depth_idx].countTermSubtree);
  }
  GT_STACK_DELETE(&stack);
  gt_free(rangeOccs);
  gt_free(tmpmbtab);
  gt_freeBwtSeqpositionextractor(pos_extractor);
  gt_array2dim_delete(special_char_rows_and_pos);
  return had_err;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2940, %rsp           # imm = 0x2940
movq 0x2978(%rsp), %rax
movq 0x2970(%rsp), %rax
movq %rdi, 0x2938(%rsp)
movq %rsi, 0x2930(%rsp)
movq %rdx, 0x2928(%rsp)
movq %rcx, 0x2920(%rsp)
movq %r8, 0x2918(%rsp)
movq %r9, 0x2910(%rsp)
movl $0x0, 0x290c(%rsp)
movq $0x40, 0xb8(%rsp)
movq 0x2938(%rsp), %rdi
callq 0x231360
subq $0x1, %rax
movq %rax, 0x90(%rsp)
movq 0x2930(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x80(%rsp)
movq 0x90(%rsp), %rax
cmpq 0x2918(%rsp), %rax
jb 0x4e51de
movq 0x156df3(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x30e5c(%rip), %rsi     # 0x516013
leaq 0xd5fd3(%rip), %rdx     # 0x5bb191
leaq 0xd5fe3(%rip), %rcx     # 0x5bb1a8
leaq 0xd5ff4(%rip), %r8      # 0x5bb1c0
movl $0x1a2, %r9d            # imm = 0x1A2
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4e51e0
movq 0x2920(%rsp), %rdi
shlq %rdi
movl $0x8, %esi
leaq 0xd5fc9(%rip), %rdx     # 0x5bb1c0
movl $0x1a3, %ecx            # imm = 0x1A3
callq 0xe83c0
movq %rax, 0xb0(%rsp)
movq 0x2920(%rsp), %rdi
addq $0x3, %rdi
movl $0x10, %esi
leaq 0xd5f9f(%rip), %rdx     # 0x5bb1c0
movl $0x1a4, %ecx            # imm = 0x1A4
callq 0xe83c0
movq %rax, 0xc0(%rsp)
movq $0x100, 0xe8(%rsp) # imm = 0x100
movq $0x40, 0xf0(%rsp)
movq 0xe8(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq $0x0, 0xe0(%rsp)
movq $0x0, 0xd8(%rsp)
leaq 0xd0(%rsp), %rax
addq $0x28, %rax
movq %rax, 0x28f8(%rsp)
leaq 0x712(%rip), %rax       # 0x4e59a0
movq %rax, 0x2900(%rsp)
cmpq $0x0, 0x2900(%rsp)
je 0x4e52f5
leaq 0x6f8(%rip), %rax       # 0x4e59a0
movq %rax, 0x2900(%rsp)
movq $0x0, 0x78(%rsp)
movq 0x78(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jae 0x4e52f3
movq 0x2900(%rsp), %rax
movq 0x28f8(%rsp), %rdi
imulq $0x28, 0x78(%rsp), %rcx
addq %rcx, %rdi
callq *%rax
movq 0x78(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x78(%rsp)
jmp 0x4e52b9
jmp 0x4e52f5
movq 0x2938(%rsp), %rdi
movq 0x2918(%rsp), %rsi
addq $0x1, %rsi
callq 0x22f610
movq %rax, 0x88(%rsp)
cmpq $0x0, 0x2910(%rsp)
je 0x4e533f
movq 0x2910(%rsp), %rdi
movq 0x156c08(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0xd5e9a(%rip), %rsi     # 0x5bb1d4
callq 0x121930
movq 0x2938(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
addq $0x1, %rdx
callq 0x4e59d0
movq %rax, 0xa8(%rsp)
movq 0xe0(%rsp), %rax
cmpq 0xd0(%rsp), %rax
jne 0x4e549d
movq $0x28, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq 0xd0(%rsp), %rcx
addq 0xf0(%rsp), %rcx
imulq %rcx, %rax
movq %rax, 0x68(%rsp)
movq 0xd0(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jne 0x4e53c0
xorl %eax, %eax
movq %rax, 0x48(%rsp)
jmp 0x4e53cd
movq 0x28f8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
movq 0x68(%rsp), %rsi
leaq 0xd5de2(%rip), %rdx     # 0x5bb1c0
movl $0x1ae, %ecx            # imm = 0x1AE
callq 0xe8540
movq %rax, 0x28f8(%rsp)
movq 0xd0(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jne 0x4e5429
movq 0x28f8(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
addq $0x28, %rsi
movq 0x70(%rsp), %rdx
imulq 0xe8(%rsp), %rdx
callq 0x19610
cmpq $0x0, 0x2900(%rsp)
je 0x4e5485
movq $0x0, 0x60(%rsp)
movq 0x60(%rsp), %rax
cmpq 0xf0(%rsp), %rax
jae 0x4e5483
movq 0x2900(%rsp), %rax
movq 0x28f8(%rsp), %rdi
imulq $0x28, 0xd0(%rsp), %rcx
addq %rcx, %rdi
imulq $0x28, 0x60(%rsp), %rcx
addq %rcx, %rdi
callq *%rax
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x4e543d
jmp 0x4e5485
movq 0xf0(%rsp), %rax
addq 0xd0(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0x28f8(%rsp), %rax
movq 0xe0(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0xe0(%rsp)
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0xc8(%rsp)
movq 0xd8(%rsp), %rax
cmpq 0xe0(%rsp), %rax
jae 0x4e54ed
movq 0xe0(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0x2920(%rsp), %rdi
addq $0x1, %rdi
shlq $0x3, %rdi
leaq 0xd5cbc(%rip), %rsi     # 0x5bb1c0
movl $0x1b1, %edx            # imm = 0x1B1
callq 0xe80f0
movq %rax, %rcx
movq 0xc8(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x2920(%rsp), %rdi
addq $0x1, %rdi
movq 0x2930(%rsp), %rax
imulq (%rax), %rdi
movl $0x8, %esi
leaq 0xd5c7f(%rip), %rdx     # 0x5bb1c0
movl $0x1b1, %ecx            # imm = 0x1B1
callq 0xe83c0
movq %rax, %rcx
movq 0xc8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq $0x1, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq 0x2920(%rsp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jae 0x4e55cc
movq 0xc8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x58(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq 0x2930(%rsp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq 0xc8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x58(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x4e5566
movq 0xc8(%rsp), %rax
movb $0x0, (%rax)
movq 0xc8(%rsp), %rax
movl $0x0, 0x4(%rax)
movq 0xc8(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0xc8(%rsp), %rax
movq $0x0, 0x18(%rax)
movq 0x2918(%rsp), %rcx
addq $0x1, %rcx
movq 0xc8(%rsp), %rax
movq %rcx, 0x20(%rax)
cmpq $0x0, 0x2910(%rsp)
je 0x4e5647
movq 0x2910(%rsp), %rdi
movq 0x156900(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0xd5ba5(%rip), %rsi     # 0x5bb1e7
callq 0x121930
movq $0x0, 0x98(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x290c(%rsp)
movb %al, 0x47(%rsp)
jne 0x4e5685
movq 0xe0(%rsp), %rdx
xorl %eax, %eax
movl $0x1, %ecx
cmpq $0x0, %rdx
cmovel %ecx, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, 0x47(%rsp)
movb 0x47(%rsp), %al
testb $0x1, %al
jne 0x4e5692
jmp 0x4e581a
jmp 0x4e5694
cmpq $0x0, 0xe0(%rsp)
ja 0x4e56d7
movq 0x1568fa(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x30963(%rip), %rsi     # 0x516013
leaq 0xd5b46(%rip), %rdx     # 0x5bb1fd
leaq 0xd5aea(%rip), %rcx     # 0x5bb1a8
leaq 0xd5afb(%rip), %r8      # 0x5bb1c0
movl $0x1c1, %r9d            # imm = 0x1C1
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4e56d9
movq 0x28f8(%rsp), %rax
imulq $0x28, 0xe0(%rsp), %rcx
addq %rcx, %rax
addq $-0x28, %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
testb $0x1, (%rax)
je 0x4e5775
movq 0xe0(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0xe0(%rsp)
movq 0x50(%rsp), %rdi
movq 0x2928(%rsp), %rdx
movq 0x2930(%rsp), %rax
movq (%rax), %rcx
movq 0x2920(%rsp), %r8
movq 0x2970(%rsp), %r9
movq 0x2978(%rsp), %rax
leaq 0xd0(%rsp), %rsi
movq %rax, (%rsp)
callq 0x4e5b70
movl %eax, 0x290c(%rsp)
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x98(%rsp)
jmp 0x4e5815
movq 0x2938(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x80(%rsp), %rcx
movq 0xc0(%rsp), %r8
movq 0x88(%rsp), %r9
movq 0xb0(%rsp), %r13
movq 0xa8(%rsp), %r12
movq 0x2920(%rsp), %r15
movq 0x2930(%rsp), %r14
movq 0x2918(%rsp), %rbx
movq 0x90(%rsp), %r11
movq 0x2970(%rsp), %r10
movq 0x2978(%rsp), %rax
leaq 0xd0(%rsp), %rdx
movq %r13, (%rsp)
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movq %r11, 0x28(%rsp)
movq %r10, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x4e60d0
movl %eax, 0x290c(%rsp)
jmp 0x4e5653
movq 0x2970(%rsp), %rdi
movq 0xd8(%rsp), %rdx
leaq 0xd59df(%rip), %rsi     # 0x5bb210
movb $0x0, %al
callq 0xe7cd0
movq 0x98(%rsp), %rsi
leaq 0xd59df(%rip), %rdi     # 0x5bb226
movb $0x0, %al
callq 0xe7740
movq $0x0, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
cmpq 0xd8(%rsp), %rax
jae 0x4e58d7
movq 0x28f8(%rsp), %rax
imulq $0x28, 0xa0(%rsp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0xd5932(%rip), %rsi     # 0x5bb1c0
movl $0x1e5, %edx            # imm = 0x1E5
callq 0xe88c0
movq 0x28f8(%rsp), %rax
imulq $0x28, 0xa0(%rsp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
leaq 0xd5909(%rip), %rsi     # 0x5bb1c0
movl $0x1e5, %edx            # imm = 0x1E5
callq 0xe88c0
movq 0xa0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa0(%rsp)
jmp 0x4e585a
movq 0xd0(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jbe 0x4e590e
movq 0x28f8(%rsp), %rdi
leaq 0xd58c8(%rip), %rsi     # 0x5bb1c0
movl $0x1e7, %edx            # imm = 0x1E7
callq 0xe88c0
movq $0x0, 0x28f8(%rsp)
movq 0xb0(%rsp), %rdi
leaq 0xd58a3(%rip), %rsi     # 0x5bb1c0
movl $0x1e8, %edx            # imm = 0x1E8
callq 0xe88c0
movq 0xc0(%rsp), %rdi
leaq 0xd588a(%rip), %rsi     # 0x5bb1c0
movl $0x1e9, %edx            # imm = 0x1E9
callq 0xe88c0
movq 0x88(%rsp), %rdi
callq 0x22f6f0
movq 0xa8(%rsp), %rax
movq (%rax), %rdi
leaq 0xd5861(%rip), %rsi     # 0x5bb1c0
movl $0x1eb, %edx            # imm = 0x1EB
callq 0xe88c0
movq 0xa8(%rsp), %rdi
leaq 0xd5848(%rip), %rsi     # 0x5bb1c0
movl $0x1eb, %edx            # imm = 0x1EB
callq 0xe88c0
movl 0x290c(%rsp), %eax
addq $0x2940, %rsp           # imm = 0x2940
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nopw (%rax,%rax)