// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/tools/gt_gdiffcalc.c
// Function: gt_gdiffcalc_runner
static int gt_gdiffcalc_runner(int argc, const char **argv, int parsed_args,
                              void *tool_arguments, GT_UNUSED GtError *err)
{
  GtGenomediffArguments *arguments = tool_arguments;
  int had_err = 0, i;
  GtUword lcounter = 0, zcounter = 0;
  double **shusums = NULL;
  GtEncseq              *encseq = NULL;
  GtLogger              *logger;
  GtShuUnitFileInfo     *unit_info = NULL;
  GtTimer               *timer = NULL;

  gt_error_check(err);
  gt_assert(arguments);

  logger = gt_logger_new(arguments->verbose,
                         GT_LOGGER_DEFLT_PREFIX,
                         stdout);
  gt_assert(logger);

  for (i = parsed_args; i < argc; i++) {
    gt_str_array_add_cstr(arguments->filenames, argv[i]);
  }

  if (gt_showtime_enabled()) {
    timer = gt_timer_new_with_progress_description("load encseq");
    gt_timer_start(timer);
    gt_assert(timer);
  }

  if (arguments->with_units) {
    gt_logger_log(logger, "unitfile option set, filename is %s\n",
                  gt_str_get(arguments->unitfile));
  }

  if (!had_err) {
    GtEncseqLoader *el = gt_encseq_loader_new_from_options(arguments->loadopts,
                                                           err);
    encseq =
      gt_encseq_loader_load(el, gt_str_get(arguments->indexname), err);
    gt_encseq_loader_delete(el);
  }
  if (encseq == NULL)
    had_err = -1;

  if (timer != NULL)
    gt_timer_show_progress(timer, "load units", stdout);

  if (!had_err) {
    unit_info = gt_shu_unit_info_new(encseq);
    if (arguments->with_units)
      had_err = gt_shu_unit_file_info_read(arguments->unitfile, unit_info,
                                           logger, err);
  }

  if (timer != NULL)
    gt_timer_show_progress(timer, "read table", stdout);

  if (!had_err) {
    GtIO *table_file = NULL;
    GtTokenizer *tokenizer = NULL;
    GtStr *line = NULL;

    gt_assert(unit_info != NULL);
    gt_array2dim_calloc(shusums, unit_info->num_of_genomes,
                        unit_info->num_of_genomes);

    table_file = gt_io_new(gt_str_array_get(arguments->filenames, 0), "r");
    tokenizer = gt_tokenizer_new(table_file);
    line = gt_tokenizer_get_token(tokenizer);
    while (line != NULL && !had_err) {
      char *cline = gt_str_get(line);
      char *elem = strtok(cline, ";");
      zcounter = 0;
      while (elem != NULL && !had_err) {
        if (*elem != '#') {
          if (1 != sscanf(elem, "%lf",
                          &shusums[lcounter][zcounter])) {
            had_err = 1;
            gt_error_set(err, "couldn't scan");
            break;
          }
          gt_logger_log(logger,"wert: %lf", shusums[lcounter][zcounter]);
          zcounter++;
        }
        else {
          gt_logger_log(logger, "name: %s", elem++);
        }
        elem = strtok(NULL, ";");
      }
      gt_tokenizer_next_token(tokenizer);
      gt_str_delete(line);
      line = gt_tokenizer_get_token(tokenizer);
      lcounter++;
      gt_logger_log(logger, "line "GT_WD"", lcounter);
    }
  }
  if (!had_err) {
    GtUword num_of_seq, file_idx, seq_idx, startpos;
    GT_UNUSED GtUword oldpos = 0;

    gt_assert(unit_info != NULL);
    gt_assert(lcounter == zcounter);
    gt_assert(lcounter == unit_info->num_of_genomes);

    num_of_seq = gt_encseq_num_of_sequences(unit_info->encseq);

    for (seq_idx = 0; seq_idx < num_of_seq; seq_idx++) {
      startpos = gt_encseq_seqstartpos(unit_info->encseq, seq_idx);
      file_idx = gt_encseq_filenum(unit_info->encseq, startpos);
      gt_log_log("seq: "GT_WU" starts at: "GT_WU"\n"
                 "belonges to file: "GT_WU" which is part of genome: %s",
                 seq_idx, startpos, file_idx,
                 gt_str_array_get(unit_info->genome_names,
                                  unit_info->map_files[file_idx]));
      gt_assert(oldpos <= startpos);
      oldpos = startpos;
    }
  }
  if (!had_err && shusums != NULL) {
    had_err = gt_genomediff_calculate_div_from_avg(shusums, arguments,
                                                   unit_info,
                                                   logger, timer, err);
    gt_array2dim_delete(shusums);
  }

  if (timer != NULL) {
    gt_timer_show_progress_final(timer, stdout);
    gt_timer_delete(timer);
  }
  gt_logger_delete(logger);
  gt_encseq_delete(encseq);
  gt_shu_unit_info_delete(unit_info);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbx
movq %rcx, 0x20(%rsp)
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r15d
testq %r8, %r8
je 0x2ba90
movq %rbx, %rdi
callq 0x89eb7
testb %al, %al
jne 0x2bfc5
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2bf63
movq %rbx, 0x18(%rsp)
movzbl 0x1(%rax), %edi
movq 0x40c402(%rip), %r13    # 0x437eb0
movq (%r13), %rdx
leaq 0x2bae1b(%rip), %rsi    # 0x2e68d4
callq 0x92b50
testq %rax, %rax
je 0x2bf94
movq %rax, %rbx
movslq %ebp, %r12
movslq %r15d, %r15
movq 0x20(%rsp), %rbp
cmpq %r15, %r12
jge 0x2baec
movq 0x68(%rbp), %rdi
movq (%r14,%r12,8), %rsi
callq 0xae22f
incq %r12
jmp 0x2bad5
callq 0xaaf34
testb %al, %al
je 0x2bb47
leaq 0x2bbd9f(%rip), %rdi    # 0x2e789b
callq 0xaf4a5
movq %rax, %r12
movq %rax, %rdi
callq 0xaf4d6
testq %r12, %r12
movq 0x18(%rsp), %r15
jne 0x2bb4f
movq 0x40c44b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b94ec(%rip), %rsi    # 0x2e5013
leaq 0x2d969c(%rip), %rdx    # 0x3051ca
leaq 0x2c1917(%rip), %rcx    # 0x2ed44c
leaq 0x2c168c(%rip), %r8     # 0x2ed1c8
movl $0xd1, %r9d
jmp 0x2bebe
xorl %r12d, %r12d
movq 0x18(%rsp), %r15
cmpb $0x1, 0x4(%rbp)
jne 0x2bb72
movq 0x60(%rbp), %rdi
callq 0xad1fa
leaq 0x2c18fb(%rip), %rsi    # 0x2ed460
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x92e71
movq 0x38(%rbp), %rdi
movq %r15, %rsi
callq 0x7cf66
movq %rax, %r14
movq 0x50(%rbp), %rdi
callq 0xad1fa
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x7921d
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x79f01
testq %r12, %r12
je 0x2bbbd
movq (%r13), %rdx
leaq 0x2c18d0(%rip), %rsi    # 0x2ed485
movq %r12, %rdi
callq 0xaf86f
xorl %r14d, %r14d
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2bbf1
callq 0x1b21dd
cmpb $0x1, 0x4(%rbp)
movq %rax, 0x8(%rsp)
jne 0x2bbfe
movq 0x60(%rbp), %rdi
movq %rax, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x1b1da4
movl %eax, %r14d
jmp 0x2bbfe
pushq $-0x1
popq %r14
movq $0x0, 0x8(%rsp)
testq %r12, %r12
movq 0x10(%rsp), %r15
je 0x2bc1b
movq (%r13), %rdx
leaq 0x2c187d(%rip), %rsi    # 0x2ed490
movq %r12, %rdi
callq 0xaf86f
testl %r14d, %r14d
jne 0x2bf1e
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0x2bff6
movq (%r15), %rdi
shlq $0x3, %rdi
leaq 0x2c1588(%rip), %r14    # 0x2ed1c8
movq %r14, %rsi
movl $0xf7, %edx
callq 0x93160
movq %rax, %r13
movq (%r15), %rdi
imulq %rdi, %rdi
pushq $0x8
popq %rsi
movq %r14, %rdx
movl $0xf7, %ecx
callq 0x9334a
movq %rax, (%r13)
movq (%r15), %rax
pushq $0x1
popq %rcx
leaq (,%rax,8), %rdx
cmpq %rax, %rcx
jae 0x2bc90
movq -0x8(%r13,%rcx,8), %rsi
addq %rdx, %rsi
movq %rsi, (%r13,%rcx,8)
incq %rcx
jmp 0x2bc79
movq %r12, 0x38(%rsp)
movq 0x68(%rbp), %rdi
xorl %esi, %esi
callq 0xae386
leaq 0x2cf186(%rip), %rsi    # 0x2fae2d
movq %rax, %rdi
callq 0x924fc
movq %rax, %rdi
callq 0xafc98
movq %rax, 0x40(%rsp)
movq %rax, %rdi
callq 0xafd32
leaq 0x33d20f(%rip), %r14    # 0x368eda
leaq 0x34e63c(%rip), %r15    # 0x37a30e
xorl %ebp, %ebp
xorl %r12d, %r12d
xorl %ecx, %ecx
testq %rax, %rax
je 0x2bddd
testl %ecx, %ecx
jne 0x2bddd
movq %rax, 0x30(%rsp)
movq %rax, %rdi
callq 0xad1fa
movq %rax, %rdi
movq %r14, %rsi
callq 0x17ba0
xorl %ebp, %ebp
testq %rax, %rax
je 0x2bd6d
cmpb $0x23, (%rax)
jne 0x2bd20
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x92e71
jmp 0x2bd61
leaq (,%rbp,8), %rdx
addq (%r13,%r12,8), %rdx
movq %rax, %rdi
leaq 0x2c178a(%rip), %rsi    # 0x2ed4c1
xorl %eax, %eax
callq 0x177b0
cmpl $0x1, %eax
jne 0x2bd77
movq (%r13,%r12,8), %rax
movsd (%rax,%rbp,8), %xmm0
movq %rbx, %rdi
leaq 0x2c1764(%rip), %rsi    # 0x2ed4bb
movb $0x1, %al
callq 0x92e71
incq %rbp
xorl %edi, %edi
movq %r14, %rsi
callq 0x17ba0
jmp 0x2bd04
movl $0x0, 0x28(%rsp)
jmp 0x2bd91
movq 0x18(%rsp), %rdi
leaq 0x2c172a(%rip), %rsi    # 0x2ed4ad
xorl %eax, %eax
callq 0x89dbb
pushq $0x1
popq %rax
movl %eax, 0x28(%rsp)
movq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0xaff9c
movq 0x30(%rsp), %rdi
callq 0xae103
movq %r15, %rdi
callq 0xafd32
movq %rax, %r15
incq %r12
movq %rbx, %rdi
leaq 0x2c1705(%rip), %rsi    # 0x2ed4c5
movq %r12, %rdx
xorl %eax, %eax
callq 0x92e71
movq %r15, %rax
leaq 0x34e53a(%rip), %r15    # 0x37a30e
movl 0x28(%rsp), %ecx
jmp 0x2bcd9
testl %ecx, %ecx
je 0x2bdf6
pushq $0x1
popq %r14
movq 0x40c0c4(%rip), %r13    # 0x437eb0
movq 0x38(%rsp), %r12
jmp 0x2bf19
cmpq %rbp, %r12
jne 0x2c027
movq 0x8(%rsp), %rax
cmpq (%rax), %rbp
jne 0x2c058
movq 0x28(%rax), %rdi
callq 0x705a1
movq %rax, 0x28(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x20(%rsp), %rsi
movq 0x8(%rsp), %r14
cmpq %r12, 0x28(%rsp)
je 0x2beca
movq 0x28(%r14), %rdi
movq %r12, %rsi
callq 0x74d9c
movq %rbp, 0x30(%rsp)
movq %rax, %rbp
movq 0x28(%r14), %rdi
movq %rax, %rsi
callq 0x81b97
movq %rax, %r15
movq 0x10(%r14), %rdi
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rsi
callq 0xae386
leaq 0x2c1699(%rip), %rdi    # 0x2ed509
movq %r12, %rsi
movq %rbp, %rdx
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x92a82
incq %r12
cmpq %rbp, 0x30(%rsp)
movq 0x20(%rsp), %rsi
jbe 0x2be2a
movq 0x40c0cf(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b9170(%rip), %rsi    # 0x2e5013
leaq 0x2c16a9(%rip), %rdx    # 0x2ed553
leaq 0x2c159b(%rip), %rcx    # 0x2ed44c
leaq 0x2c1310(%rip), %r8     # 0x2ed1c8
movl $0x129, %r9d            # imm = 0x129
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq %r13, %rdi
movq 0x8(%rsp), %rdx
movq %rbx, %rcx
movq 0x38(%rsp), %r12
movq %r12, %r8
movq 0x18(%rsp), %r9
callq 0x1b1271
movl %eax, %r14d
movq (%r13), %rdi
leaq 0x2c12d3(%rip), %r15    # 0x2ed1c8
movq %r15, %rsi
movl $0x131, %edx            # imm = 0x131
callq 0x936f9
movq %r13, %rdi
movq %r15, %rsi
movl $0x131, %edx            # imm = 0x131
callq 0x936f9
movq 0x40bf97(%rip), %r13    # 0x437eb0
movq 0x10(%rsp), %r15
testq %r12, %r12
je 0x2bf37
movq (%r13), %rsi
movq %r12, %rdi
callq 0xafb49
movq %r12, %rdi
callq 0xafc5b
movq %rbx, %rdi
callq 0x92fd0
movq %r15, %rdi
callq 0x735fd
movq 0x8(%rsp), %rdi
callq 0x1b2198
movl %r14d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x40bffe(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b909f(%rip), %rsi    # 0x2e5013
leaq 0x31c6d8(%rip), %rdx    # 0x348653
leaq 0x2c14ca(%rip), %rcx    # 0x2ed44c
leaq 0x2c123f(%rip), %r8     # 0x2ed1c8
movl $0xc3, %r9d
jmp 0x2bebe
movq 0x40bfcd(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b906e(%rip), %rsi    # 0x2e5013
leaq 0x2d9a6d(%rip), %rdx    # 0x305a19
leaq 0x2c1499(%rip), %rcx    # 0x2ed44c
leaq 0x2c120e(%rip), %r8     # 0x2ed1c8
movl $0xc8, %r9d
jmp 0x2bebe
movq 0x40bf9c(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b903d(%rip), %rsi    # 0x2e5013
leaq 0x2b91e2(%rip), %rdx    # 0x2e51bf
leaq 0x2c1468(%rip), %rcx    # 0x2ed44c
leaq 0x2c11dd(%rip), %r8     # 0x2ed1c8
movl $0xc2, %r9d
jmp 0x2bebe
movq 0x40bf6b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b900c(%rip), %rsi    # 0x2e5013
leaq 0x2c148d(%rip), %rdx    # 0x2ed49b
leaq 0x2c1437(%rip), %rcx    # 0x2ed44c
leaq 0x2c11ac(%rip), %r8     # 0x2ed1c8
movl $0xf5, %r9d
jmp 0x2bebe
movq 0x40bf3a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b8fdb(%rip), %rsi    # 0x2e5013
leaq 0x2c148f(%rip), %rdx    # 0x2ed4ce
leaq 0x2c1406(%rip), %rcx    # 0x2ed44c
leaq 0x2c117b(%rip), %r8     # 0x2ed1c8
movl $0x11c, %r9d            # imm = 0x11C
jmp 0x2bebe
movq 0x40bf09(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b8faa(%rip), %rsi    # 0x2e5013
leaq 0x2c1473(%rip), %rdx    # 0x2ed4e3
leaq 0x2c13d5(%rip), %rcx    # 0x2ed44c
leaq 0x2c114a(%rip), %r8     # 0x2ed1c8
movl $0x11d, %r9d            # imm = 0x11D
jmp 0x2bebe
nopl (%rax)