// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq %rcx, 0x18(%rsp)
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r15d
testq %r8, %r8
je 0xa93b3
movq %r12, %rdi
callq 0xfcc32
testb %al, %al
jne 0xa9841
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0xa9837
movzbl 0x1(%rax), %edi
movq 0x40fb0c(%rip), %rax    # 0x4b8ed8
movq (%rax), %rdx
leaq 0x29d4fe(%rip), %rsi    # 0x3468d4
callq 0x103e40
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xa983c
cmpl %r15d, %ebp
movq 0x18(%rsp), %r13
jge 0xa940e
movslq %ebp, %rbx
movslq %r15d, %r15
movq 0x68(%r13), %rdi
movq (%r14,%rbx,8), %rsi
callq 0x11bee9
incq %rbx
cmpq %rbx, %r15
jne 0xa93f9
callq 0x119160
testb %al, %al
je 0xa9442
leaq 0x29e47d(%rip), %rdi    # 0x34789b
callq 0x11c986
movq %rax, %r13
movq %rax, %rdi
callq 0x11c9e3
testq %r13, %r13
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
jne 0xa944f
callq 0x1b41f
xorl %r13d, %r13d
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
cmpb $0x1, 0x4(%r15)
jne 0xa9473
movq 0x60(%r15), %rdi
callq 0x11b0a1
leaq 0x2a3ffa(%rip), %rsi    # 0x34d460
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x103fe1
movq 0x38(%r15), %rdi
movq %r12, %rsi
callq 0xf2311
movq %rax, %r14
movq 0x50(%r15), %rdi
callq 0x11b0a1
movq %r14, %rdi
movq %rax, %rsi
movq %r12, 0x28(%rsp)
movq %r12, %rdx
callq 0xef129
movq %rax, %rbp
movq %r14, %rdi
callq 0xefbe3
testq %r13, %r13
movq 0x40fa25(%rip), %r14    # 0x4b8ed8
je 0xa94c7
movq (%r14), %rdx
leaq 0x2a3fc6(%rip), %rsi    # 0x34d485
movq %r13, %rdi
callq 0x11cc90
xorl %r12d, %r12d
testq %rbp, %rbp
je 0xa94fc
movq %rbp, %rdi
callq 0x1fe855
cmpb $0x1, 0x4(%r15)
movq %rax, 0x8(%rsp)
jne 0xa950b
movq 0x60(%r15), %rdi
movq %rax, %rsi
movq %rbx, %rdx
movq 0x28(%rsp), %rcx
callq 0x1fe498
movl %eax, %r12d
jmp 0xa950b
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rsp)
movq %rbp, 0x38(%rsp)
testq %r13, %r13
je 0xa9527
movq (%r14), %rdx
leaq 0x2a3f71(%rip), %rsi    # 0x34d490
movq %r13, %rdi
callq 0x11cc90
movq %r13, 0x30(%rsp)
testl %r12d, %r12d
jne 0xa97e0
movq 0x8(%rsp), %rbx
testq %rbx, %rbx
je 0xa9846
movq (%rbx), %rdi
shlq $0x3, %rdi
leaq 0x2a3c77(%rip), %r14    # 0x34d1c8
movq %r14, %rsi
movl $0xf7, %edx
callq 0x104226
movq %rax, %r13
movq (%rbx), %rdi
imulq %rdi, %rdi
movl $0x8, %esi
movq %r14, %rdx
movl $0xf7, %ecx
callq 0x10436a
movq %rax, (%r13)
movq (%rbx), %rax
cmpq $0x2, %rax
jb 0xa95ab
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 0xa959b
movq 0x68(%r15), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x11bfb3
leaq 0x2b1895(%rip), %rsi    # 0x35ae55
movq %rax, %rdi
callq 0x103a1c
movq %rax, %rdi
callq 0x11d090
movq %rax, 0x40(%rsp)
movq %rax, %rdi
callq 0x11d0ce
testq %rax, %rax
je 0xa970c
movq %rax, %r12
leaq 0x31f4ea(%rip), %r15    # 0x3c8ada
xorl %ebp, %ebp
movq %r12, %rdi
callq 0x11b0a1
movq %rax, %rdi
movq %r15, %rsi
callq 0x17c10
xorl %r14d, %r14d
testq %rax, %rax
je 0xa967e
movq 0x10(%rsp), %rbx
cmpb $0x23, (%rax)
jne 0xa962d
movq %rbx, %rdi
leaq 0x3308cd(%rip), %rsi    # 0x3d9eee
movq %rax, %rdx
xorl %eax, %eax
callq 0x103fe1
jmp 0xa966f
leaq (,%r14,8), %rdx
addq (%r13,%rbp,8), %rdx
movq %rax, %rdi
leaq 0x2a3e7d(%rip), %rsi    # 0x34d4c1
xorl %eax, %eax
callq 0x177f0
cmpl $0x1, %eax
jne 0xa9686
movq (%r13,%rbp,8), %rax
movsd (%rax,%r14,8), %xmm0
movq %rbx, %rdi
leaq 0x2a3e56(%rip), %rsi    # 0x34d4bb
movb $0x1, %al
callq 0x103fe1
incq %r14
xorl %edi, %edi
movq %r15, %rsi
callq 0x17c10
testq %rax, %rax
jne 0xa9612
movb $0x1, %al
movl %eax, 0x20(%rsp)
jmp 0xa96a1
movl $0x0, 0x20(%rsp)
movq 0x28(%rsp), %rdi
leaq 0x2a3e13(%rip), %rsi    # 0x34d4ad
xorl %eax, %eax
callq 0xfcb67
movq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0x11d25d
movq %r12, %rdi
callq 0x11bdbf
movq %rbx, %rdi
callq 0x11d0ce
movq %rax, %r12
incq %rbp
movq 0x10(%rsp), %rdi
leaq 0x2a3df5(%rip), %rsi    # 0x34d4c5
movq %rbp, %rdx
xorl %eax, %eax
callq 0x103fe1
testq %r12, %r12
movl 0x20(%rsp), %eax
je 0xa96eb
testb %al, %al
jne 0xa95f2
movl $0x1, %r12d
testb %al, %al
movq 0x10(%rsp), %rbx
je 0xa97e0
cmpq %r14, %rbp
movq 0x8(%rsp), %rbx
jne 0xa9850
cmpq (%rbx), %r14
jne 0xa984b
movq 0x28(%rbx), %rdi
callq 0xe7bac
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0xa9791
xorl %ebx, %ebx
xorl %r12d, %r12d
movq 0x8(%rsp), %r14
movq 0x28(%r14), %rdi
movq %r12, %rsi
callq 0xeb6ee
movq %rax, %rbp
movq 0x28(%r14), %rdi
movq %rax, %rsi
callq 0xf6438
movq %rax, %r15
movq 0x10(%r14), %rdi
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rsi
callq 0x11bfb3
leaq 0x2a3da1(%rip), %rdi    # 0x34d509
movq %r12, %rsi
movq %rbp, %rdx
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x103d72
cmpq %rbp, %rbx
ja 0xa9832
incq %r12
movq %rbp, %rbx
cmpq %r12, 0x20(%rsp)
jne 0xa9732
movq %r13, %rdi
movq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
movq 0x30(%rsp), %r8
movq 0x28(%rsp), %r9
callq 0x1fd9fb
movl %eax, %r12d
movq (%r13), %rdi
leaq 0x2a3a05(%rip), %r15    # 0x34d1c8
movq %r15, %rsi
movl $0x131, %edx            # imm = 0x131
callq 0x1045eb
movq %r13, %rdi
movq %r15, %rsi
movl $0x131, %edx            # imm = 0x131
callq 0x1045eb
movq 0x30(%rsp), %r14
testq %r14, %r14
je 0xa9804
movq 0x40f6e7(%rip), %rax    # 0x4b8ed8
movq (%rax), %rsi
movq %r14, %rdi
callq 0x11cf39
movq %r14, %rdi
callq 0x11d054
movq %rbx, %rdi
callq 0x1040e0
movq 0x38(%rsp), %rdi
callq 0xea375
movq 0x8(%rsp), %rdi
callq 0x1fe810
movl %r12d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1b3ad
callq 0x1b491
callq 0x1b458
callq 0x1b302
callq 0x1b3e6
callq 0x1b374
callq 0x1b33b
nopl (%rax)