// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/tools/gt_genomediff.c
// Function: gt_genomediff_runner
static int gt_genomediff_runner(int argc, const char **argv,
                                int parsed_args, void *tool_arguments,
                                GtError *err)
{
  bool mirrored = false;
  int had_err = 0,
      i;
  GtEncseq              *encseq = NULL;
  GtGenomediffArguments *arguments = tool_arguments;
  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("start");
    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 (timer != NULL)
    gt_timer_show_progress(timer, "start shu search", stdout);

  if (gt_str_array_size(arguments->filenames) > 1UL) {
    GtEncseqEncoder *ee = gt_encseq_encoder_new();
    gt_encseq_encoder_set_timer(ee, timer);
    gt_encseq_encoder_set_logger(ee, logger);
    /* kr only makes sense for dna, so we can check this already with ee */
    gt_encseq_encoder_set_input_dna(ee);
    had_err = gt_encseq_encoder_encode(ee, arguments->filenames,
                                       gt_str_get(arguments->indexname), err);
    gt_encseq_encoder_delete(ee);
  }
  else {
    gt_str_append_str(arguments->indexname,
                      gt_str_array_get_str(arguments->filenames, 0));
    if (arguments->with_esa || arguments->with_pck) {
      GtStr *current_line = gt_str_new();
      FILE *prj_fp;
      const char *buffer;
      char **elements = NULL;

      prj_fp = gt_fa_fopen_with_suffix(gt_str_get(arguments->indexname),
                                       GT_PROJECTFILESUFFIX,"rb",err);
      if (prj_fp == NULL)
        had_err = -1;
      while (!had_err && gt_str_read_next_line(current_line, prj_fp) != EOF) {
        buffer = gt_str_get(current_line);
        if (elements != NULL) {
          gt_free(elements[0]);
          gt_free(elements[1]);
        }
        gt_free(elements);
        elements = gt_cstr_split(buffer, '=');
        gt_log_log("%s", elements[0]);
        if (strcmp("mirrored", elements[0]) == 0) {
          gt_log_log("%s", elements[1]);
          if (strcmp("1", elements[1]) == 0) {
            mirrored = true;
            gt_log_log("sequences are treated as mirrored");
          }
        }
        gt_str_reset(current_line);
      }
      gt_str_delete(current_line);
      if (elements != NULL) {
        gt_free(elements[0]);
        gt_free(elements[1]);
      }
      gt_free(elements);
      gt_fa_xfclose(prj_fp);
    }
  }

  if (!had_err) {
    GtEncseqLoader *el = gt_encseq_loader_new_from_options(arguments->loadopts,
                                                           err);
    if (mirrored)
      gt_encseq_loader_mirror(el);
    encseq =
      gt_encseq_loader_load(el, gt_str_get(arguments->indexname), err);
    gt_encseq_loader_delete(el);
  }
  if (encseq == NULL)
    had_err = -1;
  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 (!had_err) {
    uint64_t **shusums = NULL;
    if (arguments->with_esa || arguments->with_pck) {
      shusums = gt_genomediff_shulen_sum(arguments, unit_info,
                                         logger, timer, err);
      if (shusums == NULL)
        had_err = -1;
    }
    else {
      const bool doesa = true;
      GenomediffInfo gd_info;
      Suffixeratoroptions sopts;
      sopts.beverbose = arguments->verbose;
      sopts.indexname = arguments->indexname;
      sopts.db = NULL;
      sopts.encopts = NULL;
      sopts.genomediff = true;
      sopts.inputindex = arguments->indexname;
      sopts.loadopts = arguments->loadopts;
      sopts.showprogress = false;
      sopts.idxopts = arguments->idxopts;

      gt_assert(unit_info != NULL);
      gt_array2dim_calloc(shusums, unit_info->num_of_genomes,
                          unit_info->num_of_genomes);
      gd_info.shulensums = shusums;
      gd_info.unit_info = unit_info;
      had_err = gt_runsuffixerator(doesa, &sopts, &gd_info, logger, err);
    }
    if (!had_err && shusums != NULL) {
      had_err = gt_genomediff_kr_calc(shusums, arguments, unit_info,
                                      arguments->with_pck, 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 $0x98, %rsp
movq %r8, %r13
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %rbx
movl %edi, %r15d
testq %r8, %r8
je 0x2c62d
movq %r13, %rdi
callq 0x89eb7
testb %al, %al
jne 0x2cc36
testq %r14, %r14
je 0x2cbda
movzbl 0x1(%r14), %edi
movq 0x40b86e(%rip), %rax    # 0x437eb0
movq (%rax), %rdx
leaq 0x2ba288(%rip), %rsi    # 0x2e68d4
callq 0x92b50
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x2cc08
movslq %ebp, %r12
movslq %r15d, %r15
movq 0x38(%rsp), %rbp
cmpq %r15, %r12
jge 0x2c681
movq 0x68(%r14), %rdi
movq (%rbx,%r12,8), %rsi
callq 0xae22f
incq %r12
jmp 0x2c66a
callq 0xaaf34
testb %al, %al
je 0x2c6d7
leaq 0x2d2c5c(%rip), %rdi    # 0x2ff2ed
callq 0xaf4a5
movq %rax, %r12
movq %rax, %rdi
callq 0xaf4d6
testq %r12, %r12
jne 0x2c6da
movq 0x40b8bb(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b895c(%rip), %rsi    # 0x2e5013
leaq 0x2d8b0c(%rip), %rdx    # 0x3051ca
leaq 0x2c1236(%rip), %rcx    # 0x2ed8fb
leaq 0x2c0e9a(%rip), %r8     # 0x2ed566
movl $0x10e, %r9d            # imm = 0x10E
jmp 0x2cc62
xorl %r12d, %r12d
cmpb $0x1, 0x4(%r14)
jne 0x2c6fe
movq 0x60(%r14), %rdi
callq 0xad1fa
leaq 0x2c0d6f(%rip), %rsi    # 0x2ed460
movq %rbp, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x92e71
testq %r12, %r12
je 0x2c71c
movq 0x40b7a6(%rip), %rax    # 0x437eb0
movq (%rax), %rdx
leaq 0x2c11fc(%rip), %rsi    # 0x2ed910
movq %r12, %rdi
callq 0xaf86f
movq 0x68(%r14), %rdi
callq 0xae61c
pushq $-0x1
popq %rcx
movl %ecx, 0x14(%rsp)
cmpq $0x2, %rax
jb 0x2c78f
callq 0x7a05b
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
callq 0x7a83d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x7ad75
movq %rbx, %rdi
callq 0x7a54b
movq 0x50(%r14), %rdi
movq 0x68(%r14), %r15
callq 0xad1fa
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %r13, %rcx
callq 0x7adb8
movl %eax, %r15d
movq %rbx, %rdi
callq 0x7a80c
movq $0x0, 0x20(%rsp)
jmp 0x2c99f
movq 0x50(%r14), %rbx
movq 0x68(%r14), %rdi
xorl %esi, %esi
callq 0xae3f2
movq %rbx, %rdi
movq %rax, %rsi
callq 0xacd13
cmpb $0x0, 0x2(%r14)
jne 0x2c7bb
cmpb $0x1, 0x3(%r14)
jne 0x2c9ae
movq %r12, 0x18(%rsp)
callq 0xacb84
movq %rax, %rbp
movq 0x50(%r14), %rdi
callq 0xad1fa
leaq 0x2c1149(%rip), %rsi    # 0x2ed921
leaq 0x3192be(%rip), %rdx    # 0x345a9d
leaq 0x2c0d80(%rip), %r12    # 0x2ed566
movq %rax, %rdi
movq %r12, %rcx
movl $0x12d, %r8d            # imm = 0x12D
movq %r13, 0x48(%rsp)
movq %r13, %r9
callq 0x8a449
movq %rax, %r13
cmpq $0x1, %rax
movl $0x0, %eax
sbbl %eax, %eax
movl %eax, 0x34(%rsp)
leaq 0x33c691(%rip), %rbx    # 0x368ea9
xorl %r15d, %r15d
movq $0x0, 0x20(%rsp)
movq %r14, 0x40(%rsp)
movq %rbp, 0x28(%rsp)
testq %r13, %r13
je 0x2c92e
movq %rbp, %rdi
movq %r13, %rsi
callq 0xad4de
cmpl $-0x1, %eax
je 0x2c93a
movq %rbp, %rdi
movq %r13, %rbp
movq %rbx, %r13
callq 0xad1fa
movq %rax, %rbx
testq %r15, %r15
je 0x2c882
movq (%r15), %rdi
movq %r12, %rsi
movl $0x133, %edx            # imm = 0x133
callq 0x936f9
movq 0x8(%r15), %rdi
movq %r12, %rsi
movl $0x134, %edx            # imm = 0x134
callq 0x936f9
movq %r15, %rdi
movq %r12, %r14
movq %r12, %rsi
movl $0x136, %edx            # imm = 0x136
callq 0x936f9
movq %rbx, %rdi
pushq $0x3d
popq %rsi
callq 0x6c174
movq %rax, %r15
movq (%rax), %rsi
movq %r13, %rbx
movq %r13, %rdi
xorl %eax, %eax
callq 0x92a82
movq (%r15), %rsi
leaq 0x2c1082(%rip), %rdi    # 0x2ed93f
callq 0x179e0
testl %eax, %eax
je 0x2c8d8
movq %r14, %r12
movq 0x40(%rsp), %r14
movq %rbp, %r13
movq 0x28(%rsp), %rbp
jmp 0x2c921
movq 0x8(%r15), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x92a82
movq 0x8(%r15), %rcx
movzbl (%rcx), %eax
subl $0x31, %eax
movq %rbp, %r13
jne 0x2c8f9
movzbl 0x1(%rcx), %eax
negl %eax
movq %r14, %r12
movq 0x28(%rsp), %rbp
testl %eax, %eax
movq 0x40(%rsp), %r14
jne 0x2c921
leaq 0x2c1013(%rip), %rdi    # 0x2ed926
xorl %eax, %eax
callq 0x92a82
movb $0x1, %al
movq %rax, 0x20(%rsp)
movq %rbp, %rdi
callq 0xad357
jmp 0x2c82e
xorl %r15d, %r15d
movq $0x0, 0x20(%rsp)
movq %rbp, %rdi
callq 0xae103
testq %r15, %r15
movq 0x18(%rsp), %r12
je 0x2c974
movq (%r15), %rdi
leaq 0x2c0c10(%rip), %rbx    # 0x2ed566
movq %rbx, %rsi
movl $0x144, %edx            # imm = 0x144
callq 0x936f9
movq 0x8(%r15), %rdi
movq %rbx, %rsi
movl $0x145, %edx            # imm = 0x145
callq 0x936f9
leaq 0x2c0beb(%rip), %rsi    # 0x2ed566
movq %r15, %rdi
movl $0x147, %edx            # imm = 0x147
callq 0x936f9
movq %r13, %rdi
callq 0x8a5e5
movq 0x38(%rsp), %rbp
movq 0x48(%rsp), %r13
movl 0x34(%rsp), %r15d
testl %r15d, %r15d
je 0x2c9b7
xorl %ebx, %ebx
xorl %r13d, %r13d
jmp 0x2cb8d
movq $0x0, 0x20(%rsp)
movq %r12, 0x18(%rsp)
movq 0x38(%r14), %rdi
movq %r13, %rsi
callq 0x7cf66
movq %rax, %rbx
testb $0x1, 0x20(%rsp)
je 0x2c9da
movq %rbx, %rdi
callq 0x7d003
movq 0x50(%r14), %rdi
callq 0xad1fa
movq %rbx, %rdi
movq %rax, %rsi
movq %r13, %r12
movq %r13, %rdx
callq 0x7921d
movq %rax, %r13
movq %rbx, %rdi
callq 0x79f01
testq %r13, %r13
je 0x2ca64
movq %r13, %rdi
callq 0x1b21dd
movq %rax, %rbx
cmpb $0x1, 0x4(%r14)
jne 0x2ca30
movq 0x60(%r14), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x1b1da4
testl %eax, %eax
jne 0x2cb84
cmpb $0x0, 0x2(%r14)
jne 0x2ca3e
cmpb $0x1, 0x3(%r14)
jne 0x2ca6e
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq 0x18(%rsp), %rcx
movq %r12, %r8
callq 0x1b0e00
movq %rax, %r15
xorl %eax, %eax
cmpq $0x1, %r15
sbbl %eax, %eax
jmp 0x2cb2c
xorl %ebx, %ebx
xorl %r13d, %r13d
jmp 0x2cb88
movb 0x1(%r14), %al
movb %al, 0x50(%rsp)
movq 0x50(%r14), %rax
movq %rax, 0x70(%rsp)
andq $0x0, 0x80(%rsp)
andq $0x0, 0x58(%rsp)
movq %rax, 0x78(%rsp)
movw $0x100, 0x51(%rsp)      # imm = 0x100
movups 0x38(%r14), %xmm0
movups %xmm0, 0x60(%rsp)
testq %rbx, %rbx
je 0x2cc6e
movq (%rbx), %rdi
shlq $0x3, %rdi
leaq 0x2c0aab(%rip), %rsi    # 0x2ed566
movl $0x176, %edx            # imm = 0x176
callq 0x93160
movq %rax, %r15
movq (%rbx), %rdi
imulq %rdi, %rdi
pushq $0x8
popq %rsi
leaq 0x2c0a8d(%rip), %rdx    # 0x2ed566
movl $0x176, %ecx            # imm = 0x176
callq 0x9334a
movq %rax, (%r15)
movq (%rbx), %rax
pushq $0x1
popq %rcx
leaq (,%rax,8), %rdx
cmpq %rax, %rcx
jae 0x2cb0a
movq -0x8(%r15,%rcx,8), %rsi
addq %rdx, %rsi
movq %rsi, (%r15,%rcx,8)
incq %rcx
jmp 0x2caf4
leaq 0x88(%rsp), %rdx
movq %r15, 0x8(%rdx)
movq %rbx, (%rdx)
pushq $0x1
popq %rdi
leaq 0x50(%rsp), %rsi
movq %rbp, %rcx
movq %r12, %r8
callq 0x1a1860
testl %eax, %eax
jne 0x2cb84
testq %r15, %r15
je 0x2cb84
movzbl 0x3(%r14), %ecx
movq %r12, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rbp, %r8
movq 0x18(%rsp), %r12
movq %r12, %r9
callq 0x1b19f8
movl %eax, 0x14(%rsp)
movq (%r15), %rdi
leaq 0x2c0a01(%rip), %r14    # 0x2ed566
movq %r14, %rsi
movl $0x17e, %edx            # imm = 0x17E
callq 0x936f9
movq %r15, %rdi
movq %r14, %rsi
movl $0x17e, %edx            # imm = 0x17E
callq 0x936f9
jmp 0x2cb8d
movl %eax, 0x14(%rsp)
movq 0x18(%rsp), %r12
testq %r12, %r12
je 0x2cbac
movq 0x40b317(%rip), %rax    # 0x437eb0
movq (%rax), %rsi
movq %r12, %rdi
callq 0xafb49
movq %r12, %rdi
callq 0xafc5b
movq %rbp, %rdi
callq 0x92fd0
movq %r13, %rdi
callq 0x735fd
movq %rbx, %rdi
callq 0x1b2198
movl 0x14(%rsp), %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x40b387(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b8428(%rip), %rsi    # 0x2e5013
leaq 0x31ba61(%rip), %rdx    # 0x348653
leaq 0x2c0d02(%rip), %rcx    # 0x2ed8fb
leaq 0x2c0966(%rip), %r8     # 0x2ed566
movl $0x100, %r9d            # imm = 0x100
jmp 0x2cc62
movq 0x40b359(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b83fa(%rip), %rsi    # 0x2e5013
leaq 0x2d8df9(%rip), %rdx    # 0x305a19
leaq 0x2c0cd4(%rip), %rcx    # 0x2ed8fb
leaq 0x2c0938(%rip), %r8     # 0x2ed566
movl $0x105, %r9d            # imm = 0x105
jmp 0x2cc62
movq 0x40b32b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b83cc(%rip), %rsi    # 0x2e5013
leaq 0x2b8571(%rip), %rdx    # 0x2e51bf
leaq 0x2c0ca6(%rip), %rcx    # 0x2ed8fb
leaq 0x2c090a(%rip), %r8     # 0x2ed566
movl $0xff, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x40b2f3(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b8394(%rip), %rsi    # 0x2e5013
leaq 0x2c0815(%rip), %rdx    # 0x2ed49b
leaq 0x2c0c6e(%rip), %rcx    # 0x2ed8fb
leaq 0x2c08d2(%rip), %r8     # 0x2ed566
movl $0x174, %r9d            # imm = 0x174
jmp 0x2cc62