// File: /workspace/github_c_makefile_star2_O1/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, %r12
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r15d
testq %r8, %r8
je 0xab71d
movq %rbx, %rdi
callq 0x101a9a
testb %al, %al
jne 0xabc02
testq %r12, %r12
je 0xabbf8
movq %rbx, 0x20(%rsp)
movq %r12, 0x18(%rsp)
movzbl 0x1(%r12), %edi
movq 0x4187ab(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x2a418d(%rip), %rsi    # 0x34f8d4
callq 0x108ed0
testq %rax, %rax
je 0xabbfd
movq %rax, %rbx
cmpl %r15d, %ebp
movq 0x18(%rsp), %r13
jge 0xab77d
movslq %ebp, %r12
movslq %r15d, %r15
movq 0x68(%r13), %rdi
movq (%r14,%r12,8), %rsi
callq 0x121c30
incq %r12
cmpq %r12, %r15
jne 0xab768
callq 0x11ed94
testb %al, %al
je 0xab7b1
leaq 0x2a510e(%rip), %rdi    # 0x35089b
callq 0x1226d6
movq %rax, %rbp
movq %rax, %rdi
callq 0x122733
testq %rbp, %rbp
movq 0x20(%rsp), %r15
movq 0x18(%rsp), %r12
jne 0xab7bd
callq 0x1b51b
xorl %ebp, %ebp
movq 0x20(%rsp), %r15
movq 0x18(%rsp), %r12
cmpb $0x1, 0x4(%r12)
jne 0xab7e3
movq 0x60(%r12), %rdi
callq 0x120d23
leaq 0x2aacba(%rip), %rsi    # 0x356490
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10906e
movq 0x38(%r12), %rdi
movq %r15, %rsi
callq 0xf6952
movq %rax, %r14
movq 0x50(%r12), %rdi
callq 0x120d23
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xf374b
movq %rax, %r13
movq %r14, %rdi
callq 0xf424d
testq %rbp, %rbp
je 0xab834
movq 0x4186c6(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x2aac89(%rip), %rsi    # 0x3564b5
movq %rbp, %rdi
callq 0x1229c8
movq %rbp, 0x28(%rsp)
xorl %ebp, %ebp
testq %r13, %r13
je 0xab86a
movq %r13, %rdi
callq 0x207fe7
movq %rax, %r14
cmpb $0x1, 0x4(%r12)
jne 0xab872
movq 0x60(%r12), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x207bc8
movl %eax, %ebp
jmp 0xab872
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movq %r13, 0x40(%rsp)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0xab897
movq 0x418660(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x2aac2e(%rip), %rsi    # 0x3564c0
callq 0x1229c8
movq %r14, 0x8(%rsp)
xorl %r13d, %r13d
movl $0x0, %r15d
movl $0x0, %r12d
testl %ebp, %ebp
movq %rbx, 0x38(%rsp)
jne 0xaba84
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0xabc07
movq (%rax), %rdi
shlq $0x3, %rdi
movq %rax, %r15
leaq 0x2aa921(%rip), %r14    # 0x3561f8
movq %r14, %rsi
movl $0xf7, %edx
callq 0x1092b2
movq %rax, %r13
movq (%r15), %rdi
imulq %rdi, %rdi
movl $0x8, %esi
movq %r14, %rdx
movl $0xf7, %ecx
callq 0x1093ef
movq %rax, (%r13)
movq (%r15), %rax
cmpq $0x2, %rax
movq 0x18(%rsp), %rdi
jb 0xab936
leaq (,%rax,8), %rcx
movq (%r13), %rdx
addq %rcx, %rdx
movl $0x1, %esi
movq %rdx, (%r13,%rsi,8)
incq %rsi
addq %rcx, %rdx
cmpq %rsi, %rax
jne 0xab926
movq 0x68(%rdi), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x121cfa
leaq 0x2b857e(%rip), %rsi    # 0x363ec9
movq %rax, %rdi
callq 0x108aa8
movq %rax, %rdi
callq 0x122db8
movq %rax, 0x30(%rsp)
movq %rax, %rdi
callq 0x122df6
testq %rax, %rax
je 0xaba7f
movq %rax, %r14
leaq 0x326887(%rip), %rbp    # 0x3d2202
movq $0x0, 0x10(%rsp)
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x120d23
movq %rax, %rdi
movq %rbp, %rsi
callq 0x17c10
xorl %r15d, %r15d
testq %rax, %rax
je 0xaba2c
cmpb $0x23, (%rax)
jne 0xab9c1
movq %rbx, %rdi
leaq 0x337c8e(%rip), %rsi    # 0x3e3643
movq %rax, %rdx
xorl %eax, %eax
callq 0x10906e
jmp 0xaba03
leaq (,%r15,8), %rdx
addq (%r13,%r12,8), %rdx
movq %rax, %rdi
leaq 0x2aab19(%rip), %rsi    # 0x3564f1
xorl %eax, %eax
callq 0x177f0
cmpl $0x1, %eax
jne 0xaba0f
movq (%r13,%r12,8), %rax
movsd (%rax,%r15,8), %xmm0
movq %rbx, %rdi
leaq 0x2aaaf2(%rip), %rsi    # 0x3564eb
movb $0x1, %al
callq 0x10906e
incq %r15
xorl %edi, %edi
movq %rbp, %rsi
callq 0x17c10
jmp 0xab99d
movq 0x20(%rsp), %rdi
leaq 0x2aaac2(%rip), %rsi    # 0x3564dd
xorl %eax, %eax
callq 0x1019cf
movl $0x1, %eax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x122f7e
movq %r14, %rdi
callq 0x121b03
movq %rbx, %rdi
callq 0x122df6
movq %rax, %r14
incq %r12
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
leaq 0x2aaa97(%rip), %rsi    # 0x3564f5
movq %r12, %rdx
xorl %eax, %eax
callq 0x10906e
testq %r14, %r14
je 0xaba78
cmpl $0x0, 0x10(%rsp)
je 0xab987
movq 0x10(%rsp), %rbp
jmp 0xaba84
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %rbp, 0x10(%rsp)
testl %ebp, %ebp
jne 0xabb2e
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0xabc0c
cmpq %r15, %r12
jne 0xabc11
cmpq (%rax), %r12
jne 0xabc16
movq 0x28(%rax), %rdi
callq 0xec1e8
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0xabb2e
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x8(%rsp), %rbx
movq 0x28(%rbx), %rdi
movq %r12, %rsi
callq 0xefce0
movq %rax, %rbp
movq 0x28(%rbx), %rdi
movq %rax, %rsi
callq 0xfab4f
movq %rax, %r15
movq 0x10(%rbx), %rdi
movq 0x20(%rbx), %rax
movq (%rax,%r15,8), %rsi
callq 0x121cfa
leaq 0x2aaa34(%rip), %rdi    # 0x356539
movq %r12, %rsi
movq %rbp, %rdx
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x108e02
cmpq %rbp, %r14
ja 0xabbf3
incq %r12
movq %rbp, %r14
cmpq %r12, 0x30(%rsp)
jne 0xabacf
movq 0x10(%rsp), %r12
testl %r12d, %r12d
jne 0xabb99
testq %r13, %r13
movq 0x28(%rsp), %r15
movq 0x8(%rsp), %r14
movq 0x38(%rsp), %rbx
je 0xabba8
movq %r13, %rdi
movq 0x18(%rsp), %rsi
movq %r14, %rdx
movq %rbx, %rcx
movq %r15, %r8
movq 0x20(%rsp), %r9
callq 0x2070d1
movl %eax, %r12d
movq (%r13), %rdi
leaq 0x2aa683(%rip), %r14    # 0x3561f8
movq %r14, %rsi
movl $0x131, %edx            # imm = 0x131
callq 0x109670
movq %r13, %rdi
movq %r14, %rsi
movq 0x8(%rsp), %r14
movl $0x131, %edx            # imm = 0x131
callq 0x109670
jmp 0xabba8
movq 0x28(%rsp), %r15
movq 0x8(%rsp), %r14
movq 0x38(%rsp), %rbx
testq %r15, %r15
je 0xabbc7
movq 0x418334(%rip), %rax    # 0x4c3ee8
movq (%rax), %rsi
movq %r15, %rdi
callq 0x122c67
movq %r15, %rdi
callq 0x122d79
movq %rbx, %rdi
callq 0x10916a
movq 0x40(%rsp), %rdi
callq 0xee90c
movq %r14, %rdi
callq 0x207fa2
movl %r12d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1b470
callq 0x1b58d
callq 0x1b554
callq 0x1b3c5
callq 0x1b4e2
callq 0x1b4a9
callq 0x1b3fe
callq 0x1b437
nop