// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/tools/gt_tir.c
// Function: gt_tir_runner
static int gt_tir_runner(GT_UNUSED int argc, GT_UNUSED const char **argv,
                         GT_UNUSED int parsed_args, void *tool_arguments,
                         GtError *err)
{
  GtTirArguments *arguments = tool_arguments;
  GtNodeStream *tir_stream = NULL,
               *pdom_stream = NULL,
               *gff3_out_stream = NULL,
               *match_stream = NULL,
               *last_stream = NULL;
  GtPdomModelSet *ms = NULL;
  GtRegionMapping *rmap = NULL;
  int had_err = 0;

  gt_error_check(err);
  gt_assert(arguments);

  tir_stream = gt_tir_stream_new(arguments->str_indexname,
                                 arguments->min_seed_length,
                                 arguments->min_TIR_length,
                                 arguments->max_TIR_length,
                                 arguments->min_TIR_distance,
                                 arguments->max_TIR_distance,
                                 arguments->arbit_scores,
                                 arguments->xdrop_belowscore,
                                 arguments->similarity_threshold,
                                 arguments->best_overlaps,
                                 arguments->longest_overlaps,
                                 arguments->no_overlaps,
                                 arguments->min_TSD_length,
                                 arguments->max_TSD_length,
                                 arguments->vicinity,
                                 err);

  if (tir_stream == NULL)
    return -1;
  last_stream = tir_stream;

  if (!arguments->md5)
    gt_tir_stream_disable_md5_seqids((GtTIRStream*) tir_stream);
  else
    gt_tir_stream_enable_md5_seqids((GtTIRStream*) tir_stream);
  if (!arguments->seqids)
    gt_tir_stream_disable_seqids((GtTIRStream*) tir_stream);
  else
    gt_tir_stream_enable_seqids((GtTIRStream*) tir_stream);

  /* re-load unmirrored encseq */
  GtEncseqLoader *el = gt_encseq_loader_new();
  GtEncseq *unm_es = gt_encseq_loader_load(el,
                                           gt_str_get(arguments->str_indexname),
                                           err);
  rmap = gt_region_mapping_new_encseq(unm_es, true, false);
  gt_assert(rmap);

  if (!had_err && gt_str_array_size(arguments->hmm_files) > 0)
  {
    if (!strcmp(gt_str_get(arguments->cutoffs), "GA")) {
      arguments->cutoff = GT_PHMM_CUTOFF_GA;
    } else if (!strcmp(gt_str_get(arguments->cutoffs), "TC")) {
      arguments->cutoff = GT_PHMM_CUTOFF_TC;
    } else if (!strcmp(gt_str_get(arguments->cutoffs), "NONE")) {
      arguments->cutoff = GT_PHMM_CUTOFF_NONE;
    } else {
      gt_error_set(err, "invalid cutoff setting!");
      had_err = -1;
    }
  }

  if (!had_err && gt_str_array_size(arguments->hmm_files) > 0) {
    GtNodeVisitor *pdom_v;
    ms = gt_pdom_model_set_new(arguments->hmm_files, false, err);
    if (ms != NULL) {
      pdom_v = gt_ltrdigest_pdom_visitor_new(ms, arguments->evalue_cutoff,
                                             arguments->chain_max_gap_length,
                                             arguments->cutoff, rmap,
                                             err);
      if (pdom_v == NULL)
        had_err = -1;
      if (!had_err) {
        last_stream = pdom_stream = gt_visitor_stream_new(last_stream, pdom_v);
        gt_ltrdigest_pdom_visitor_set_root_type((GtLTRdigestPdomVisitor*)
                                                                        pdom_v,
                                        gt_ft_terminal_inverted_repeat_element);
        gt_ltrdigest_pdom_visitor_set_source_tag((GtLTRdigestPdomVisitor*)
                                                                        pdom_v,
                                                 "TIRvish");
      }
    } else had_err = -1;
  }

  if (!had_err && gt_str_length(arguments->refseq_file) > 0) {
    match_stream = gt_ltr_refseq_match_stream_new_with_mapping(
                                      last_stream,
                                      gt_str_get(arguments->refseq_file),
                                      rmap,
                                      0.0001, /* double evalue, */
                                      true, /* bool dust, */
                                      12, /* int word_size, */
                                      GT_UNDEF_INT, /* int gapopen, */
                                      GT_UNDEF_INT, /* int gapextend, */
                                      GT_UNDEF_INT, /* int penalty, */
                                      GT_UNDEF_INT, /* int reward, */
                                      2, /* int num_threads, */
                                      GT_UNDEF_DOUBLE, /* double xdrop, */
                                      GT_UNDEF_DOUBLE, /* double identity, */
                                      NULL, /* const char *moreblast, */
                                      false, /* bool flcands, */
                                      10, /* double min_ali_len_perc, */
                                      GT_UNDEF_UWORD, /* GtUword params_id, */
                                      "TIRvish",
                                      err);
    if (!match_stream)
      had_err = -1;
    else
      last_stream = match_stream;
  }

  gff3_out_stream = gt_gff3_out_stream_new(last_stream, NULL);
  last_stream = gff3_out_stream;

  /* pull the features through the stream and free them afterwards */
  if (!had_err)
    had_err = gt_node_stream_pull(last_stream, err);

  gt_node_stream_delete(tir_stream);
  gt_node_stream_delete(pdom_stream);
  gt_node_stream_delete(gff3_out_stream);
  gt_node_stream_delete(match_stream);
  gt_region_mapping_delete(rmap);
  gt_pdom_model_set_delete(ms);
  gt_encseq_delete(unm_es);
  gt_encseq_loader_delete(el);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %rbx
movq %rcx, %rbp
testq %r8, %r8
je 0x552c7
movq %rbx, %rdi
callq 0x89eb7
testb %al, %al
jne 0x5566d
testq %rbp, %rbp
je 0x5563f
movq (%rbp), %rdi
movq 0x20(%rbp), %rsi
movq 0x28(%rbp), %rdx
movq 0x30(%rbp), %rcx
movq 0x38(%rbp), %r8
movq 0x40(%rbp), %r9
movl 0x70(%rbp), %eax
movsd 0x78(%rbp), %xmm0
movzbl 0x88(%rbp), %r10d
movzbl 0x8a(%rbp), %r11d
movzbl 0x89(%rbp), %r14d
movups 0x48(%rbp), %xmm1
movq 0x58(%rbp), %r15
subq $0x50, %rsp
movups 0x60(%rbp), %xmm2
movups %xmm2, (%rsp)
movq %rbx, 0x48(%rsp)
movq %r15, 0x40(%rsp)
movups %xmm1, 0x30(%rsp)
movl %r14d, 0x28(%rsp)
movl %r11d, 0x20(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x10(%rsp)
callq 0x12913b
addq $0x50, %rsp
testq %rax, %rax
je 0x55362
movq %rax, %r13
cmpb $0x0, 0x8c(%rbp)
je 0x5536a
movq %r13, %rdi
callq 0x1293c1
jmp 0x55372
pushq $-0x1
popq %rbx
jmp 0x55620
movq %r13, %rdi
callq 0x12937b
cmpb $0x0, 0x8b(%rbp)
je 0x55385
movq %r13, %rdi
callq 0x12944d
jmp 0x5538d
movq %r13, %rdi
callq 0x129407
callq 0x791cd
movq %rax, %r15
movq (%rbp), %rdi
callq 0xad1fa
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x7921d
pushq $0x1
popq %r14
movq %rax, 0x20(%rsp)
movq %rax, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x10f90a
testq %rax, %rax
je 0x5569b
movq %rax, %r12
movq 0xa0(%rbp), %rdi
callq 0xae61c
testq %rax, %rax
movq %r15, 0x18(%rsp)
movq %r12, 0x10(%rsp)
je 0x55468
movq 0x8(%rbp), %rdi
callq 0xad1fa
cmpb $0x47, (%rax)
jne 0x55403
cmpb $0x41, 0x1(%rax)
jne 0x55403
cmpb $0x0, 0x2(%rax)
je 0x55461
movq 0x8(%rbp), %rdi
callq 0xad1fa
cmpb $0x54, (%rax)
jne 0x5541d
cmpb $0x43, 0x1(%rax)
jne 0x5541d
cmpb $0x0, 0x2(%rax)
je 0x5545e
movq 0x8(%rbp), %rdi
callq 0xad1fa
leaq 0x2a80fe(%rip), %rsi    # 0x2fd52b
movq %rax, %rdi
callq 0x179e0
testl %eax, %eax
je 0x55458
leaq 0x2a8748(%rip), %rsi    # 0x2fdb88
movq $0x0, 0x8(%rsp)
movq %rbx, %rdi
xorl %eax, %eax
callq 0x89dbb
jmp 0x5559f
pushq $0x2
popq %r14
jmp 0x55461
xorl %r14d, %r14d
movl %r14d, 0xa8(%rbp)
movq 0xa0(%rbp), %rdi
callq 0xae61c
testq %rax, %rax
je 0x55500
movq 0xa0(%rbp), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x1c6f24
testq %rax, %rax
je 0x55596
movq %rax, %r15
movsd 0x80(%rbp), %xmm0
movl 0x90(%rbp), %esi
movl 0xa8(%rbp), %edx
movq %rax, %rdi
movq %r12, %rcx
movq %rbx, %r8
callq 0x1c0af9
testq %rax, %rax
je 0x55631
movq %rax, %r12
movq %r13, %rdi
movq %rax, %rsi
callq 0x12bf59
movq %rax, %r14
leaq 0x2a86c3(%rip), %rsi    # 0x2fdba0
movq %r12, %rdi
callq 0x1c0a2f
leaq 0x2a86d5(%rip), %rsi    # 0x2fdbc1
movq %r12, %rdi
callq 0x1c0a86
movq %r14, 0x8(%rsp)
movq 0x10(%rsp), %r12
jmp 0x5550f
xorl %r15d, %r15d
movq %r13, %r14
movq $0x0, 0x8(%rsp)
movq 0x18(%rbp), %rdi
callq 0xad289
testq %rax, %rax
je 0x555ac
movq 0x18(%rbp), %rdi
callq 0xad1fa
subq $0x8, %rsp
leaq 0x2a868c(%rip), %r11    # 0x2fdbc1
movl $0x80000000, %r10d      # imm = 0x80000000
movsd 0x2a7fcd(%rip), %xmm0   # 0x2fd510
pushq $0x1
popq %rcx
pushq $0xc
popq %r8
movsd 0x2927be(%rip), %xmm1   # 0x2e7d10
movsd 0x29fa56(%rip), %xmm3   # 0x2f4fb0
movq %r14, %rdi
movq %rax, %rsi
movq %r12, %rdx
movl $0x80000000, %r9d       # imm = 0x80000000
movaps %xmm1, %xmm2
pushq %rbx
pushq %r11
pushq $-0x1
pushq $0x0
pushq $0x0
pushq $0x2
pushq %r10
pushq %r10
pushq %r10
callq 0x1bd3e7
addq $0x50, %rsp
movq %rax, %rbp
testq %rax, %rax
setne %r12b
cmovneq %rax, %r14
jmp 0x555b1
movq $0x0, 0x8(%rsp)
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %r13, %r14
xorl %r12d, %r12d
jmp 0x555b1
movb $0x1, %r12b
xorl %ebp, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0xe07df
movq %rax, %r14
testb %r12b, %r12b
je 0x555d2
movq %r14, %rdi
movq %rbx, %rsi
callq 0x102b93
movl %eax, %ebx
jmp 0x555d5
pushq $-0x1
popq %rbx
movq 0x10(%rsp), %r12
movq %r13, %rdi
callq 0x10297b
movq 0x8(%rsp), %rdi
callq 0x10297b
movq %r14, %rdi
callq 0x10297b
movq %rbp, %rdi
callq 0x10297b
movq %r12, %rdi
callq 0x10f7de
movq %r15, %rdi
callq 0x1c7542
movq 0x20(%rsp), %rdi
callq 0x735fd
movq 0x18(%rsp), %rdi
callq 0x79f01
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, 0x8(%rsp)
jmp 0x555a2
movq 0x3e2922(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x28f9c3(%rip), %rsi    # 0x2e5013
leaq 0x2f2ffc(%rip), %rdx    # 0x348653
leaq 0x2a851c(%rip), %rcx    # 0x2fdb7a
leaq 0x2a7eb3(%rip), %r8     # 0x2fd518
movl $0x187, %r9d            # imm = 0x187
jmp 0x556c7
movq 0x3e28f4(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x28f995(%rip), %rsi    # 0x2e5013
leaq 0x28fb3a(%rip), %rdx    # 0x2e51bf
leaq 0x2a84ee(%rip), %rcx    # 0x2fdb7a
leaq 0x2a7e85(%rip), %r8     # 0x2fd518
movl $0x186, %r9d            # imm = 0x186
jmp 0x556c7
movq 0x3e28c6(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x28f967(%rip), %rsi    # 0x2e5013
leaq 0x30b0ca(%rip), %rdx    # 0x36077d
leaq 0x2a84c0(%rip), %rcx    # 0x2fdb7a
leaq 0x2a7e57(%rip), %r8     # 0x2fd518
movl $0x1ad, %r9d            # imm = 0x1AD
xorl %eax, %eax
callq 0x17a50
callq 0x17390
nop