// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/shu-genomediff.c
// Function: gt_genomediff_shulen_sum
uint64_t **gt_genomediff_shulen_sum(const GtGenomediffArguments *arguments,
                                    GtShuUnitFileInfo *unit_info,
                                    GtLogger *logger,
                                    GtTimer *timer,
                                    GtError *err)
{
  int had_err = 0;
  GtUword i_idx, j_idx;
  uint64_t **shulensums = NULL;
  const GtEncseq *encseq = NULL;
  Genericindex *generic_index_subject = NULL;
  Sequentialsuffixarrayreader *ssar = NULL;

  gt_error_check(err);
  gt_assert(unit_info != NULL);

  /* prepare index */
  if (arguments->with_esa) {
    if (timer != NULL)
      gt_timer_show_progress(timer, "load sequential sa reader", stdout);

    ssar = gt_newSequentialsuffixarrayreaderfromfile(
                                    gt_str_array_get(arguments->filenames, 0),
                                    SARR_LCPTAB | SARR_SUFTAB | SARR_ESQTAB |
                                      SARR_SSPTAB,
                                    arguments->scanfile,
                                    logger, err);
    if (ssar == NULL)
      had_err = -1;

    if (!had_err) {
      encseq = gt_encseqSequentialsuffixarrayreader(ssar);
    }
  }
  else {
    gt_assert(arguments->with_pck);

    if (timer != NULL)
      gt_timer_show_progress(timer, "map generic index", stdout);

    generic_index_subject =
      genericindex_new(gt_str_array_get(arguments->filenames, 0),
                       false, true, false, true,
                       arguments->user_max_depth,
                       logger, err);
    if (generic_index_subject == NULL) {
      had_err = -1;
    }
    /*get num of genomes from unitfile or encseq and allocate shulen-matrix*/
    if (!had_err) {
      encseq = genericindex_getencseq(generic_index_subject);
    }
  }

  /*calculate sums of shulens*/
  if (!had_err) {
    gt_array2dim_calloc(shulensums,
                        unit_info->num_of_genomes,
                        unit_info->num_of_genomes);

    if (arguments->with_esa) {
      if (timer != NULL)
        gt_timer_show_progress(timer, "dfs esa index", stdout);

      had_err = gt_multiesa2shulengthdist(ssar, encseq, shulensums,
                                          unit_info, err);
    }
    else {
      const FMindex *subjectindex = NULL;
      GtUword num_of_chars,
                    total_length;
      const GtAlphabet *alphabet = gt_encseq_alphabet(unit_info->encseq);

      num_of_chars = (GtUword) gt_alphabet_num_of_chars(alphabet);
      total_length = genericindex_get_totallength(generic_index_subject);

      subjectindex = genericindex_get_packedindex(generic_index_subject);
      gt_assert(subjectindex != NULL);

      had_err = gt_pck_calculate_shulen(subjectindex,
                                        unit_info,
                                        shulensums,
                                        num_of_chars,
                                        total_length,
                                        timer,
                                        logger,
                                        err);
    }
  }

  if (arguments->with_esa) {
    if (ssar != NULL)
      gt_freeSequentialsuffixarrayreader(&ssar);
  }
  else
    genericindex_delete(generic_index_subject);

  if (had_err) {
    gt_log_log("foo");
    if (shulensums != NULL)
      gt_array2dim_delete(shulensums);
    shulensums = NULL;
  }
  else {
    gt_assert(shulensums != NULL);
    gt_log_log("sum of shulens");
    if (gt_log_enabled()) {
      for (i_idx = 0; i_idx < unit_info->num_of_genomes; i_idx++) {
        fprintf(stderr, "debug: %s\t",
                gt_str_array_get(unit_info->genome_names, i_idx));
        for (j_idx = 0; j_idx < unit_info->num_of_genomes; j_idx++) {
          if (i_idx == j_idx)
            fprintf(stderr, "0");
          else
            fprintf(stderr, Formatuint64_t"\t",
                    PRINTuint64_tcast(shulensums[i_idx][j_idx]));
        }
        fprintf(stderr, "\n");
      }
    }
  }
  return shulensums;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq %rdx, 0x90(%rsp)
movq %rcx, 0x88(%rsp)
movq %r8, 0x80(%rsp)
movl $0x0, 0x7c(%rsp)
movq $0x0, 0x60(%rsp)
movq $0x0, 0x58(%rsp)
movq $0x0, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0x2ec231
movq 0x80(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x2ec1f9
jmp 0x2ec231
movq 0x34fda0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x229e09(%rip), %rsi    # 0x516013
leaq 0x229fae(%rip), %rdx    # 0x5161bf
leaq 0x2a279d(%rip), %rcx    # 0x58e9b5
leaq 0x2a27af(%rip), %r8     # 0x58e9ce
movl $0xf3, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ec233
jmp 0x2ec235
cmpq $0x0, 0x98(%rsp)
jne 0x2ec278
movq 0x34fd59(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x229dc2(%rip), %rsi    # 0x516013
leaq 0x2322e3(%rip), %rdx    # 0x51e53b
leaq 0x2a2756(%rip), %rcx    # 0x58e9b5
leaq 0x2a2768(%rip), %r8     # 0x58e9ce
movl $0xf4, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ec27a
movq 0xa0(%rsp), %rax
testb $0x1, 0x2(%rax)
je 0x2ec326
cmpq $0x0, 0x88(%rsp)
je 0x2ec2b5
movq 0x88(%rsp), %rdi
movq 0x34fc92(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0x2a2739(%rip), %rsi    # 0x58e9e9
callq 0x121930
movq 0xa0(%rsp), %rax
movq 0x68(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x11f8c0
movq %rax, %rdi
movq 0xa0(%rsp), %rax
movb (%rax), %al
movq 0x90(%rsp), %rcx
movq 0x80(%rsp), %r8
movl $0x87, %esi
andb $0x1, %al
movzbl %al, %edx
callq 0x23b3e0
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jne 0x2ec30b
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x7c(%rsp)
jne 0x2ec321
movq 0x48(%rsp), %rdi
callq 0x23bd50
movq %rax, 0x58(%rsp)
jmp 0x2ec415
jmp 0x2ec328
movq 0xa0(%rsp), %rax
testb $0x1, 0x3(%rax)
jne 0x2ec36e
movq 0x34fc63(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x229ccc(%rip), %rsi    # 0x516013
leaq 0x2a26b5(%rip), %rdx    # 0x58ea03
leaq 0x2a2660(%rip), %rcx    # 0x58e9b5
leaq 0x2a2672(%rip), %r8     # 0x58e9ce
movl $0x109, %r9d            # imm = 0x109
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ec370
cmpq $0x0, 0x88(%rsp)
je 0x2ec399
movq 0x88(%rsp), %rdi
movq 0x34fbae(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0x2a2683(%rip), %rsi    # 0x58ea17
callq 0x121930
movq 0xa0(%rsp), %rax
movq 0x68(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x11f8c0
movq %rax, %rdi
movq 0xa0(%rsp), %rax
movl 0x8(%rax), %r9d
movq 0x90(%rsp), %r10
movq 0x80(%rsp), %rax
xorl %ecx, %ecx
movl $0x1, %r8d
movl %ecx, %esi
movl %r8d, %edx
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x254a90
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
jne 0x2ec3fd
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x7c(%rsp)
jne 0x2ec413
movq 0x50(%rsp), %rdi
callq 0x2549d0
movq %rax, 0x58(%rsp)
jmp 0x2ec415
cmpl $0x0, 0x7c(%rsp)
jne 0x2ec616
movq 0x98(%rsp), %rax
movq (%rax), %rdi
shlq $0x3, %rdi
leaq 0x2a2598(%rip), %rsi    # 0x58e9ce
movl $0x120, %edx            # imm = 0x120
callq 0xe80f0
movq %rax, 0x60(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
movq 0x98(%rsp), %rax
imulq (%rax), %rdi
movl $0x8, %esi
leaq 0x2a2566(%rip), %rdx    # 0x58e9ce
movl $0x120, %ecx            # imm = 0x120
callq 0xe83c0
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, (%rax)
movq $0x1, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x98(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2ec4da
movq 0x60(%rsp), %rax
movq 0x40(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq 0x98(%rsp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq 0x60(%rsp), %rax
movq 0x40(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x2ec486
movq 0xa0(%rsp), %rax
testb $0x1, 0x2(%rax)
je 0x2ec53e
cmpq $0x0, 0x88(%rsp)
je 0x2ec511
movq 0x88(%rsp), %rdi
movq 0x34fa36(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0x2a251d(%rip), %rsi    # 0x58ea29
callq 0x121930
movq 0x48(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq 0x98(%rsp), %rcx
movq 0x80(%rsp), %r8
callq 0x23d7f0
movl %eax, 0x7c(%rsp)
jmp 0x2ec614
movq $0x0, 0x38(%rsp)
movq 0x98(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0xb0f00
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
callq 0x7e8c0
movl %eax, %eax
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rdi
callq 0x2561e0
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rdi
callq 0x256180
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x2ec5cc
movq 0x34fa05(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x229a6e(%rip), %rsi    # 0x516013
leaq 0x2a248b(%rip), %rdx    # 0x58ea37
leaq 0x2a2402(%rip), %rcx    # 0x58e9b5
leaq 0x2a2414(%rip), %r8     # 0x58e9ce
movl $0x133, %r9d            # imm = 0x133
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ec5ce
movq 0x38(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %r8
movq 0x88(%rsp), %r9
movq 0x90(%rsp), %r10
movq 0x80(%rsp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x4e5100
movl %eax, 0x7c(%rsp)
jmp 0x2ec616
movq 0xa0(%rsp), %rax
testb $0x1, 0x2(%rax)
je 0x2ec638
cmpq $0x0, 0x48(%rsp)
je 0x2ec636
leaq 0x48(%rsp), %rdi
callq 0x23b5e0
jmp 0x2ec642
movq 0x50(%rsp), %rdi
callq 0x254960
cmpl $0x0, 0x7c(%rsp)
je 0x2ec69c
leaq 0x25184d(%rip), %rdi    # 0x53de9d
movb $0x0, %al
callq 0xe7740
cmpq $0x0, 0x60(%rsp)
je 0x2ec678
movq 0x60(%rsp), %rax
movq (%rax), %rdi
leaq 0x2a2360(%rip), %rsi    # 0x58e9ce
movl $0x14a, %edx            # imm = 0x14A
callq 0xe88c0
movq 0x60(%rsp), %rdi
leaq 0x2a234a(%rip), %rsi    # 0x58e9ce
movl $0x14a, %edx            # imm = 0x14A
callq 0xe88c0
movq $0x0, 0x60(%rsp)
jmp 0x2ec807
jmp 0x2ec69e
cmpq $0x0, 0x60(%rsp)
jne 0x2ec6de
movq 0x34f8f3(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x22995c(%rip), %rsi    # 0x516013
leaq 0x2a238e(%rip), %rdx    # 0x58ea4c
leaq 0x2a22f0(%rip), %rcx    # 0x58e9b5
leaq 0x2a2302(%rip), %r8     # 0x58e9ce
movl $0x14e, %r9d            # imm = 0x14E
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ec6e0
leaq 0x2a2378(%rip), %rdi    # 0x58ea5f
movb $0x0, %al
callq 0xe7740
callq 0xe7720
testb $0x1, %al
jne 0x2ec6fc
jmp 0x2ec805
movq $0x0, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq 0x98(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2ec803
movq 0x34f87e(%rip), %rax    # 0x63bfa0
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x70(%rsp), %rsi
callq 0x11f8c0
movq 0x18(%rsp), %rdi
movq %rax, %rdx
leaq 0x2a231f(%rip), %rsi    # 0x58ea6e
movb $0x0, %al
callq 0x199f0
movq $0x0, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq 0x98(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2ec7d8
movq 0x70(%rsp), %rax
cmpq 0x68(%rsp), %rax
jne 0x2ec797
movq 0x34f81c(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x253f5f(%rip), %rsi    # 0x5406ed
movb $0x0, %al
callq 0x199f0
jmp 0x2ec7c6
movq 0x34f802(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
movq 0x60(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x291ad1(%rip), %rsi    # 0x57e290
movb $0x0, %al
callq 0x199f0
jmp 0x2ec7c8
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
jmp 0x2ec75f
movq 0x34f7c1(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2a6a8a(%rip), %rsi    # 0x593273
movb $0x0, %al
callq 0x199f0
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x2ec705
jmp 0x2ec805
jmp 0x2ec807
movq 0x60(%rsp), %rax
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)