// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %rbx
movl %edi, %r15d
testq %r8, %r8
je 0xac163
movq %r12, %rdi
callq 0x101a9a
testb %al, %al
jne 0xac717
testq %r14, %r14
je 0xac70d
movq %r12, 0x18(%rsp)
movzbl 0x1(%r14), %edi
movq 0x417d6b(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x2a374d(%rip), %rsi    # 0x34f8d4
callq 0x108ed0
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0xac712
cmpl %r15d, %ebp
jge 0xac1ba
movslq %ebp, %r12
movslq %r15d, %r15
movq 0x68(%r14), %rdi
movq (%rbx,%r12,8), %rsi
callq 0x121c30
incq %r12
cmpq %r12, %r15
jne 0xac1a5
callq 0x11ed94
testb %al, %al
je 0xac1e9
leaq 0x2ff527(%rip), %rdi    # 0x3ab6f1
callq 0x1226d6
movq %rax, %r15
movq %rax, %rdi
callq 0x122733
testq %r15, %r15
movq 0x18(%rsp), %r12
jne 0xac1f1
callq 0x1b6e1
xorl %r15d, %r15d
movq 0x18(%rsp), %r12
cmpb $0x1, 0x4(%r14)
jne 0xac217
movq 0x60(%r14), %rdi
callq 0x120d23
leaq 0x2aa288(%rip), %rsi    # 0x356490
movq 0x20(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10906e
testq %r15, %r15
je 0xac235
movq 0x417cc5(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x2aa713(%rip), %rsi    # 0x356940
movq %r15, %rdi
callq 0x1229c8
movq 0x68(%r14), %rdi
callq 0x121e78
cmpq $0x2, %rax
movq %r15, 0x38(%rsp)
jb 0xac2a1
callq 0xf444b
movq %rax, %rbx
movq %rax, %rdi
movq %r15, %rsi
callq 0xf486e
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0xf49aa
movq %rbx, %rdi
callq 0xf4711
movq 0x50(%r14), %rdi
movq 0x68(%r14), %r15
callq 0x120d23
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %r12, %rcx
callq 0xf49ba
movl %eax, %r15d
movq %rbx, %rdi
callq 0xf483d
xorl %ebx, %ebx
jmp 0xac4bc
movq 0x50(%r14), %rbx
movq 0x68(%r14), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x121d35
movq %rbx, %rdi
movq %rax, %rsi
callq 0x120a43
cmpb $0x0, 0x2(%r14)
jne 0xac2d5
cmpb $0x1, 0x3(%r14)
movl $0x0, %ebx
jne 0xac4bc
callq 0x1208f8
movq %rax, %rbp
movq 0x50(%r14), %rdi
callq 0x120d23
leaq 0x2aa664(%rip), %rsi    # 0x356951
leaq 0x3029cb(%rip), %rdx    # 0x3aecbf
leaq 0x2aa29b(%rip), %rcx    # 0x356596
movq %rax, %rdi
movl $0x12d, %r8d            # imm = 0x12D
movq %r12, %r9
callq 0x101dff
movq %rax, %rbx
movq $0x0, 0x30(%rsp)
testq %rax, %rax
sete %cl
je 0xac43f
movq %r14, 0x40(%rsp)
movb %cl, 0x17(%rsp)
movq $0x0, 0x28(%rsp)
leaq 0x2aa259(%rip), %r14    # 0x356596
leaq 0x325e8d(%rip), %r12    # 0x3d21d1
xorl %r15d, %r15d
movq %rbp, 0x48(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x120e88
cmpl $-0x1, %eax
je 0xac42f
movq %rbp, %rdi
movq %rbx, %rbp
movq %r14, %rbx
callq 0x120d23
movq %rax, %r13
testq %r15, %r15
je 0xac397
movq (%r15), %rdi
movq %rbx, %rsi
movl $0x133, %edx            # imm = 0x133
callq 0x109670
movq 0x8(%r15), %rdi
movq %rbx, %rsi
movl $0x134, %edx            # imm = 0x134
callq 0x109670
movq %r15, %rdi
movq %rbx, %r14
movq %rbx, %rsi
movl $0x136, %edx            # imm = 0x136
callq 0x109670
movq %r13, %rdi
movl $0x3d, %esi
callq 0xe8650
movq %rax, %r15
movq (%rax), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x108e02
movq (%r15), %rsi
leaq 0x2aa59e(%rip), %rdi    # 0x35696f
callq 0x17a40
testl %eax, %eax
je 0xac3df
movq %rbp, %rbx
jmp 0xac419
movq 0x8(%r15), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x108e02
movq 0x8(%r15), %rsi
leaq 0x2cb872(%rip), %rdi    # 0x377c6a
callq 0x17a40
testl %eax, %eax
movq %rbp, %rbx
jne 0xac419
leaq 0x2aa54b(%rip), %rdi    # 0x356956
xorl %eax, %eax
callq 0x108e02
movb $0x1, %al
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rbp
movq %rbp, %rdi
callq 0x120db4
testq %rbx, %rbx
jne 0xac34c
movq 0x18(%rsp), %r12
movb 0x17(%rsp), %cl
movq 0x40(%rsp), %r14
jmp 0xac44b
xorl %r15d, %r15d
movq $0x0, 0x28(%rsp)
movq 0x30(%rsp), %rax
movb %cl, %al
movq %rax, 0x30(%rsp)
movq %rbp, %rdi
callq 0x121b03
testq %r15, %r15
je 0xac491
movq (%r15), %rdi
leaq 0x2aa128(%rip), %r12    # 0x356596
movq %r12, %rsi
movl $0x144, %edx            # imm = 0x144
callq 0x109670
movq 0x8(%r15), %rdi
movq %r12, %rsi
movq 0x18(%rsp), %r12
movl $0x145, %edx            # imm = 0x145
callq 0x109670
movq 0x30(%rsp), %rax
negl %eax
leaq 0x2aa0f7(%rip), %rsi    # 0x356596
movq %r15, %rdi
movq %rax, %r15
movl $0x147, %edx            # imm = 0x147
callq 0x109670
movq %rbx, %rdi
callq 0x101f02
movq 0x28(%rsp), %rbx
xorl %ebp, %ebp
testl %r15d, %r15d
je 0xac4c7
xorl %ebx, %ebx
jmp 0xac50b
movq %r15, %r13
movq 0x38(%r14), %rdi
movq %r12, %rsi
callq 0xf6952
movq %rax, %r15
testb $0x1, %bl
je 0xac4e6
movq %r15, %rdi
callq 0xf69bc
movq 0x50(%r14), %rdi
callq 0x120d23
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0xf374b
movq %rax, %rbx
movq %r15, %rdi
callq 0xf424d
movq %r13, %r15
cmpq $0x1, %rbx
movl $0x0, %r12d
sbbl %r12d, %r12d
orl %r15d, %r12d
jne 0xac54b
movq %rbx, %rdi
callq 0x207fe7
movq %rax, %rbp
xorl %r12d, %r12d
cmpb $0x1, 0x4(%r14)
jne 0xac54b
movq 0x60(%r14), %rdi
movq %rbp, %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
callq 0x207bc8
movl %eax, %r12d
testl %r12d, %r12d
jne 0xac6ba
cmpb $0x0, 0x2(%r14)
jne 0xac562
cmpb $0x1, 0x3(%r14)
jne 0xac58e
movq %r14, %rdi
movq %rbp, %rsi
movq 0x20(%rsp), %rdx
movq 0x38(%rsp), %rcx
movq 0x18(%rsp), %r8
callq 0x206db8
movq %rax, %r15
xorl %r12d, %r12d
cmpq $0x1, %rax
sbbl %r12d, %r12d
jmp 0xac660
movb 0x1(%r14), %al
movb %al, 0x50(%rsp)
movq 0x50(%r14), %rax
movq %rax, 0x70(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x80(%rsp)
movq %rcx, 0x58(%rsp)
movq %rax, 0x78(%rsp)
movw $0x100, 0x51(%rsp)      # imm = 0x100
movups 0x38(%r14), %xmm0
movups %xmm0, 0x60(%rsp)
testq %rbp, %rbp
je 0xac71c
movq (%rbp), %rdi
shlq $0x3, %rdi
leaq 0x2a9fba(%rip), %r12    # 0x356596
movq %r12, %rsi
movl $0x176, %edx            # imm = 0x176
callq 0x1092b2
movq %rax, %r15
movq (%rbp), %rdi
imulq %rdi, %rdi
movl $0x8, %esi
movq %r12, %rdx
movl $0x176, %ecx            # imm = 0x176
callq 0x1093ef
movq %rax, (%r15)
movq (%rbp), %rax
cmpq $0x2, %rax
jb 0xac635
leaq (,%rax,8), %rcx
movq (%r15), %rdx
addq %rcx, %rdx
movl $0x1, %esi
movq %rdx, (%r15,%rsi,8)
incq %rsi
addq %rcx, %rdx
cmpq %rsi, %rax
jne 0xac626
leaq 0x88(%rsp), %rdx
movq %r15, 0x8(%rdx)
movq %rbp, (%rdx)
leaq 0x50(%rsp), %rsi
movl $0x1, %edi
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r8
callq 0x1f9b10
movl %eax, %r12d
testl %r12d, %r12d
jne 0xac6ba
testq %r15, %r15
je 0xac6ba
movzbl 0x3(%r14), %ecx
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq 0x20(%rsp), %r8
movq 0x38(%rsp), %r9
callq 0x207823
movl %eax, %r12d
movq (%r15), %rdi
leaq 0x2a9ef9(%rip), %r14    # 0x356596
movq %r14, %rsi
movl $0x17e, %edx            # imm = 0x17E
callq 0x109670
movq %r15, %rdi
movq %r14, %rsi
movl $0x17e, %edx            # imm = 0x17E
callq 0x109670
movq 0x38(%rsp), %r14
testq %r14, %r14
je 0xac6de
movq 0x41781d(%rip), %rax    # 0x4c3ee8
movq (%rax), %rsi
movq %r14, %rdi
callq 0x122c67
movq %r14, %rdi
callq 0x122d79
movq 0x20(%rsp), %rdi
callq 0x10916a
movq %rbx, %rdi
callq 0xee90c
movq %rbp, %rdi
callq 0x207fa2
movl %r12d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1b753
callq 0x1b71a
callq 0x1b66f
callq 0x1b6a8
nopl (%rax)