// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/ltr/gt_ltrdigest.c
// Function: gt_ltrdigest_runner
static int gt_ltrdigest_runner(GT_UNUSED int argc, const char **argv,
                               int parsed_args, void *tool_arguments,
                               GtError *err)
{
  GtLTRdigestOptions *arguments = tool_arguments;
  GtNodeStream *gff3_in_stream  = NULL,
               *check_stream    = NULL,
               *gff3_out_stream = NULL,
               *pdom_stream     = NULL,
               *ppt_stream      = NULL,
               *pbs_stream      = NULL,
               *tab_out_stream  = NULL,
               *sa_stream       = NULL,
               *last_stream     = NULL;
  int had_err      = 0,
      tests_to_run = 0,
      arg = parsed_args;
  GtRegionMapping *rmap = NULL;
  GtPdomModelSet *ms = NULL;
  gt_error_check(err);
  gt_assert(arguments);

  /* determine and open sequence source */
  if (gt_seqid2file_option_used(arguments->s2fi)) {
    /* create region mapping */
    rmap = gt_seqid2file_region_mapping_new(arguments->s2fi, err);
    if (!rmap)
      had_err = -1;
  } else {
    GtEncseqLoader *el;
    GtEncseq *encseq;
    /* no new-style sequence source option given, fall back to legacy syntax */
    if (argc < 3) {
      gt_error_set(err, "missing mandatory argument(s)");
      had_err = -1;
    }
    if (!had_err) {
      el = gt_encseq_loader_new();
      gt_encseq_loader_disable_autosupport(el);
      gt_encseq_loader_require_md5_support(el);
      gt_encseq_loader_require_description_support(el);
      encseq = gt_encseq_loader_load(el, argv[argc-1], err);
      /* XXX: clip off terminal argument */
      gt_free((char*) argv[argc-1]);
      argv[argc-1] = NULL;
      argc--;
      gt_encseq_loader_delete(el);
      if (!encseq)
        had_err = -1;
      else {
        rmap = gt_region_mapping_new_encseq_seqno(encseq);
        gt_encseq_delete(encseq);
      }
    }
  }
  gt_assert(had_err || rmap);

  /* Always search for PPT. */
  tests_to_run |= GT_LTRDIGEST_RUN_PPT;

  /* Open tRNA library if given. */
  if (!had_err && arguments->trna_lib
        && gt_str_length(arguments->trna_lib) > 0)
  {
    tests_to_run |= GT_LTRDIGEST_RUN_PBS;
    arguments->trna_lib_bs = gt_bioseq_new(gt_str_get(arguments->trna_lib),
                                           err);
    if (gt_error_is_set(err))
      had_err = -1;
  }

  /* Set HMMER cutoffs. */
  if (!had_err && gt_str_array_size(arguments->hmm_files) > 0)
  {
    tests_to_run |= GT_LTRDIGEST_RUN_PDOM;
    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) {
    last_stream = gff3_in_stream  = gt_gff3_in_stream_new_sorted(argv[arg]);
  }

  if (!had_err) {
    GtNodeVisitor *check_v;
    check_v = gt_ltr_input_check_visitor_new();
    last_stream = check_stream = gt_visitor_stream_new(last_stream, check_v);
  }

  if (!had_err && gt_str_array_size(arguments->hmm_files) > 0) {
    GtNodeVisitor *pdom_v;
    ms = gt_pdom_model_set_new(arguments->hmm_files, arguments->force_recreate,
                               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) {
        gt_ltrdigest_pdom_visitor_set_source_tag((GtLTRdigestPdomVisitor*)
                                                                        pdom_v,
                                                 GT_LTRDIGEST_TAG);
        if (arguments->output_all_chains)
          gt_ltrdigest_pdom_visitor_output_all_chains((GtLTRdigestPdomVisitor*)
                                                                        pdom_v);
        last_stream = pdom_stream = gt_visitor_stream_new(last_stream, pdom_v);
      }
    } else had_err = -1;
  }

  if (!had_err && arguments->trna_lib_bs) {
    GtNodeVisitor *pbs_v;
    pbs_v = gt_ltrdigest_pbs_visitor_new(rmap, arguments->pbs_radius,
                                         arguments->max_edist,
                                         arguments->alilen,
                                         arguments->offsetlen,
                                         arguments->trnaoffsetlen,
                                         arguments->ali_score_match,
                                         arguments->ali_score_mismatch,
                                         arguments->ali_score_insertion,
                                         arguments->ali_score_deletion,
                                         arguments->trna_lib_bs, err);
    if (pbs_v != NULL)
      last_stream = pbs_stream = gt_visitor_stream_new(last_stream, pbs_v);
    else
      had_err = -1;
  }

  if (!had_err) {
    GtNodeVisitor *ppt_v;
    ppt_v = gt_ltrdigest_ppt_visitor_new(rmap, arguments->ppt_len,
                                         arguments->ubox_len,
                                         arguments->ppt_pyrimidine_prob,
                                         arguments->ppt_purine_prob,
                                         arguments->bkg_a_prob,
                                         arguments->bkg_g_prob,
                                         arguments->bkg_t_prob,
                                         arguments->bkg_c_prob,
                                         arguments->ubox_u_prob,
                                         arguments->ppt_radius,
                                         arguments->max_ubox_dist, err);
    if (ppt_v != NULL)
      last_stream = ppt_stream = gt_visitor_stream_new(last_stream, ppt_v);
    else
      had_err = -1;
  }

  if (!had_err) {
    GtNodeVisitor *sa_v;
    sa_v = gt_ltrdigest_strand_assign_visitor_new();
    gt_assert(sa_v);
    last_stream = sa_stream = gt_visitor_stream_new(last_stream, sa_v);
  }

  if (!had_err)
  {
    /* attach tabular output stream, if requested */
    if (gt_str_length(arguments->prefix) > 0)
    {
      last_stream = tab_out_stream = gt_ltrdigest_file_out_stream_new(
                                                  last_stream,
                                                  tests_to_run,
                                                  rmap,
                                                  gt_str_get(arguments->prefix),
                                                  arguments->seqnamelen,
                                                  err);
      if (!tab_out_stream)
        had_err = -1;
      if (!had_err && arguments->print_metadata)
      {
        had_err = gt_ltrdigest_file_out_stream_write_metadata(
                                           (GtLTRdigestFileOutStream*)
                                                                 tab_out_stream,
                                           tests_to_run,
                                           gt_str_get(arguments->trna_lib),
                                           argv[arg],
                                           arguments->ppt_len,
                                           arguments->ubox_len,
                                           arguments->ppt_radius,
                                           arguments->alilen,
                                           arguments->max_edist,
                                           arguments->offsetlen,
                                           arguments->trnaoffsetlen,
                                           arguments->pbs_radius,
                                           arguments->hmm_files,
                                           arguments->chain_max_gap_length,
                                           arguments->evalue_cutoff,
                                           err);
      }
      if (!had_err)
      {
        if (arguments->write_alignments)
          gt_ltrdigest_file_out_stream_enable_pdom_alignment_output(
                                                                tab_out_stream);
        if (arguments->write_aaseqs)
          gt_ltrdigest_file_out_stream_enable_aa_sequence_output(
                                                                tab_out_stream);
      }
    }

    if (!had_err) {
      last_stream = gff3_out_stream = gt_gff3_out_stream_new(last_stream,
                                                             arguments->outfp);
      gt_assert(last_stream);

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

  gt_pdom_model_set_delete(ms);
  gt_node_stream_delete(gff3_out_stream);
  gt_node_stream_delete(ppt_stream);
  gt_node_stream_delete(pbs_stream);
  gt_node_stream_delete(sa_stream);
  gt_node_stream_delete(pdom_stream);
  gt_node_stream_delete(tab_out_stream);
  gt_node_stream_delete(check_stream);
  gt_node_stream_delete(gff3_in_stream);
  gt_bioseq_delete(arguments->trna_lib_bs);
  gt_region_mapping_delete(rmap);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r8, %r15
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r13
movl %edi, %r14d
testq %r8, %r8
je 0x1b9350
movq %r15, %rdi
callq 0x89eb7
testb %al, %al
jne 0x1b9ae3
testq %rbx, %rbx
je 0x1b9ab5
movq 0x38(%rbx), %rdi
callq 0x116b18
pushq $-0x1
popq %rcx
movl %ecx, 0x9c(%rsp)
testb %al, %al
movq %rbx, 0xc8(%rsp)
je 0x1b9397
movq 0x38(%rbx), %rdi
movq %r15, %rsi
callq 0x116b63
movq %rax, 0x78(%rsp)
testq %rax, %rax
jne 0x1b942f
jmp 0x1b9484
cmpl $0x2, %r14d
jle 0x1b9492
movl %ebp, 0x80(%rsp)
callq 0x791cd
movq %rax, %r12
movq %rax, %rdi
callq 0x7d046
movq %r12, %rdi
callq 0x7cffe
movq %r12, %rdi
callq 0x7d470
movl %r14d, %ebp
movq -0x8(%r13,%rbp,8), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x7921d
movq %rax, %r14
movq -0x8(%r13,%rbp,8), %rdi
leaq 0x1a54a1(%rip), %rsi    # 0x35e88b
movl $0x1db, %edx            # imm = 0x1DB
callq 0x936f9
andq $0x0, -0x8(%r13,%rbp,8)
movq %r12, %rdi
callq 0x79f01
testq %r14, %r14
je 0x1b9484
movq %r14, %rdi
callq 0x10f9c4
movq %rax, %r12
movq %r14, %rdi
callq 0x735fd
movq %r12, 0x78(%rsp)
testq %r12, %r12
je 0x1b9b1b
movl 0x80(%rsp), %ebp
movq (%rbx), %rdi
pushq $0x1
popq %r14
testq %rdi, %rdi
je 0x1b94e2
callq 0xad289
testq %rax, %rax
je 0x1b94e2
movq (%rbx), %rdi
callq 0xad1fa
movq %rax, %rdi
movq %r15, %rsi
callq 0x5a868
movq %rax, 0x108(%rbx)
movq %r15, %rdi
callq 0x89eb7
testb %al, %al
je 0x1b94de
movq $0x0, 0x88(%rsp)
jmp 0x1b9565
movq $0x0, 0x88(%rsp)
jmp 0x1b94af
leaq 0x1a5b8d(%rip), %rsi    # 0x35f026
movq $0x0, 0x88(%rsp)
movq %r15, %rdi
xorl %eax, %eax
callq 0x89dbb
movq $0x0, 0x80(%rsp)
xorl %ebp, %ebp
xorl %r15d, %r15d
movq $0x0, 0xa0(%rsp)
xorl %edi, %edi
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r13d, %r13d
xorl %r12d, %r12d
jmp 0x1b9a2c
pushq $0x3
popq %r14
movq 0x30(%rbx), %rdi
callq 0xae61c
testq %rax, %rax
je 0x1b9592
movq 0x10(%rbx), %rdi
callq 0xad1fa
cmpb $0x47, (%rax)
jne 0x1b950e
cmpb $0x41, 0x1(%rax)
jne 0x1b950e
cmpb $0x0, 0x2(%rax)
je 0x1b9588
movq 0x10(%rbx), %rdi
callq 0xad1fa
cmpb $0x54, (%rax)
jne 0x1b952c
cmpb $0x43, 0x1(%rax)
jne 0x1b952c
cmpb $0x0, 0x2(%rax)
je 0x1b9a02
movq 0x10(%rbx), %rdi
callq 0xad1fa
leaq 0x143fef(%rip), %rsi    # 0x2fd52b
movq %rax, %rdi
callq 0x179e0
testl %eax, %eax
je 0x1b9584
leaq 0x144639(%rip), %rsi    # 0x2fdb88
movq $0x0, 0x88(%rsp)
movq %r15, %rdi
xorl %eax, %eax
callq 0x89dbb
movq $0x0, 0x80(%rsp)
xorl %ebp, %ebp
movq $0x0, 0xa0(%rsp)
jmp 0x1b9728
pushq $0x2
jmp 0x1b958a
pushq $0x1
popq %rax
orl $0x4, %r14d
movl %eax, 0x40(%rbx)
movslq %ebp, %r12
movq %r13, 0xd0(%rsp)
movq (%r13,%r12,8), %rdi
callq 0xdef57
movq %rax, %r13
callq 0x1bca33
movq %r13, %rdi
movq %rax, %rsi
callq 0x12bf59
movq %rax, %rbp
movq 0x30(%rbx), %rdi
callq 0xae61c
testq %rax, %rax
movq %r13, 0xa0(%rsp)
je 0x1b9650
movq 0x30(%rbx), %rdi
movzbl 0x1d(%rbx), %esi
movq %r15, %rdx
callq 0x1c6f24
testq %rax, %rax
je 0x1b9710
movl %r14d, 0xb4(%rsp)
movsd 0x48(%rbx), %xmm0
movl 0x58(%rbx), %esi
movl 0x40(%rbx), %edx
movq %rax, 0x90(%rsp)
movq %rax, %rdi
movq 0x78(%rsp), %rcx
movq %r15, %r8
callq 0x1c0af9
testq %rax, %rax
je 0x1b9938
movq %rax, %r14
leaq 0x1a5a1a(%rip), %rsi    # 0x35f044
movq %rax, %rdi
callq 0x1c0a86
cmpb $0x1, 0x1b(%rbx)
jne 0x1b9640
movq %r14, %rdi
callq 0x1c09e9
movq %rbp, %rdi
movq %r14, %rsi
callq 0x12bf59
movq %rax, %r14
jmp 0x1b9669
movl %r14d, 0xb4(%rsp)
movq $0x0, 0x90(%rsp)
movq %rbp, %r14
xorl %eax, %eax
movq %rax, 0xa8(%rsp)
movq 0x108(%rbx), %rax
testq %rax, %rax
je 0x1b973f
movl 0xc0(%rbx), %esi
movl 0xc4(%rbx), %edx
movl 0xf8(%rbx), %r9d
movl 0xfc(%rbx), %edi
movl 0x100(%rbx), %r10d
movl 0x104(%rbx), %r11d
movq 0xc8(%rbx), %rcx
movq 0xd0(%rbx), %r8
movups 0xd8(%rbx), %xmm0
movups 0xe8(%rbx), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movl %r11d, 0x30(%rsp)
movl %r10d, 0x28(%rsp)
movl %edi, 0x20(%rsp)
movq 0x78(%rsp), %rdi
callq 0x1bfe38
testq %rax, %rax
je 0x1b996d
movq %r14, %rdi
movq %rax, %rsi
callq 0x12bf59
movq %rax, %r14
movq %rax, 0x80(%rsp)
jmp 0x1b974b
movq $0x0, 0x88(%rsp)
movq $0x0, 0x80(%rsp)
xorl %edi, %edi
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x78(%rsp), %r15
jmp 0x1b9a2c
movq $0x0, 0x80(%rsp)
movsd 0x80(%rbx), %xmm0
movsd 0x88(%rbx), %xmm1
movsd 0x90(%rbx), %xmm2
movsd 0x98(%rbx), %xmm3
movsd 0xa0(%rbx), %xmm4
movsd 0xa8(%rbx), %xmm5
movsd 0xb0(%rbx), %xmm6
movl 0xb8(%rbx), %r9d
movl 0xbc(%rbx), %eax
movq 0x60(%rbx), %rsi
movq 0x68(%rbx), %rdx
movq 0x70(%rbx), %rcx
movq 0x78(%rbx), %r8
movq %r15, 0x8(%rsp)
movl %eax, (%rsp)
movq 0x78(%rsp), %rdi
callq 0x1c2bf1
testq %rax, %rax
je 0x1b992a
movq %r14, %rdi
movq %rax, %rsi
callq 0x12bf59
movq %rax, %rbx
callq 0x1c375b
testq %rax, %rax
je 0x1b9b49
movq %rbx, 0xc0(%rsp)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x12bf59
movq %rax, %r14
movq 0xc8(%rsp), %rbx
movq 0x8(%rbx), %rdi
callq 0xad289
testq %rax, %rax
movl 0xb4(%rsp), %r13d
movq %r14, 0x88(%rsp)
je 0x1b99a7
movq 0x8(%rbx), %rdi
callq 0xad1fa
movl 0x5c(%rbx), %r8d
movq %r14, %rdi
movl %r13d, %esi
movq 0x78(%rsp), %rdx
movq %rax, %rcx
movq %r15, %r9
callq 0x1bf142
movq %rax, 0xb8(%rsp)
testq %rax, %rax
je 0x1b9a09
cmpb $0x1, 0x1c(%rbx)
jne 0x1b99af
leaq 0x70(%rbx), %r14
movq (%rbx), %rdi
callq 0xad1fa
movq 0xd0(%rsp), %rcx
movq (%rcx,%r12,8), %rcx
movl 0xb8(%rbx), %edx
movl 0xc4(%rbx), %esi
movl 0xc0(%rbx), %edi
movq 0x30(%rbx), %r10
movl 0x58(%rbx), %r11d
movsd 0x48(%rbx), %xmm0
movq 0x60(%rbx), %r8
movq 0x68(%rbx), %r9
movups 0xc8(%rbx), %xmm1
movups 0xd8(%rbx), %xmm2
movups 0xe8(%rbx), %xmm3
movups %xmm3, 0x40(%rsp)
movups %xmm2, 0x30(%rsp)
movups %xmm1, 0x18(%rsp)
movups (%r14), %xmm1
movups %xmm1, (%rsp)
movq %r15, 0x68(%rsp)
movl %r11d, 0x60(%rsp)
movq %r10, 0x58(%rsp)
movl %edi, 0x50(%rsp)
movl %esi, 0x28(%rsp)
movl %edx, 0x10(%rsp)
movq 0xb8(%rsp), %rdi
movl %r13d, %esi
movq %rax, %rdx
callq 0x1bed88
testl %eax, %eax
je 0x1b99af
movl %eax, 0x9c(%rsp)
xorl %r12d, %r12d
movq 0x78(%rsp), %r15
movq 0x90(%rsp), %rdi
movq 0xa8(%rsp), %r14
movq 0xc0(%rsp), %rbx
movq 0xb8(%rsp), %r13
jmp 0x1b9a2c
movq $0x0, 0x88(%rsp)
jmp 0x1b9985
movq $0x0, 0x88(%rsp)
movq $0x0, 0x80(%rsp)
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x78(%rsp), %r15
movq 0x90(%rsp), %rdi
jmp 0x1b9a2c
movq $0x0, 0x88(%rsp)
movq $0x0, 0x80(%rsp)
xorl %ebx, %ebx
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x78(%rsp), %r15
movq 0x90(%rsp), %rdi
movq 0xa8(%rsp), %r14
jmp 0x1b9a2c
xorl %r13d, %r13d
movq %r14, %r12
jmp 0x1b99d6
cmpb $0x1, 0x19(%rbx)
movq 0xb8(%rsp), %r12
jne 0x1b99c5
movq %r12, %rdi
callq 0x1becd4
cmpb $0x1, 0x1a(%rbx)
jne 0x1b99d3
movq %r12, %rdi
callq 0x1bed2e
movq %r12, %r13
movq 0x28(%rbx), %rsi
movq %r12, %rdi
callq 0xe07df
testq %rax, %rax
je 0x1b9b77
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x102b93
movl %eax, 0x9c(%rsp)
jmp 0x1b9a0f
xorl %eax, %eax
jmp 0x1b958b
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x78(%rsp), %r15
movq 0x90(%rsp), %rdi
movq 0xa8(%rsp), %r14
movq 0xc0(%rsp), %rbx
callq 0x1c7542
movq %r12, %rdi
callq 0x10297b
movq %rbx, %rdi
callq 0x10297b
movq 0x80(%rsp), %rdi
callq 0x10297b
movq 0x88(%rsp), %rdi
callq 0x10297b
movq %r14, %rdi
callq 0x10297b
movq %r13, %rdi
callq 0x10297b
movq %rbp, %rdi
callq 0x10297b
movq 0xa0(%rsp), %rdi
callq 0x10297b
movq 0xc8(%rsp), %rax
movq 0x108(%rax), %rdi
callq 0x5af87
movq %r15, %rdi
callq 0x10f7de
movl 0x9c(%rsp), %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x27e4ac(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12b54d(%rip), %rsi    # 0x2e5013
leaq 0x18eb86(%rip), %rdx    # 0x348653
leaq 0x1a553e(%rip), %rcx    # 0x35f012
leaq 0x1a4db0(%rip), %r8     # 0x35e88b
movl $0x1c4, %r9d            # imm = 0x1C4
jmp 0x1b9b0f
movq 0x27e47e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12b51f(%rip), %rsi    # 0x2e5013
leaq 0x12b6c4(%rip), %rdx    # 0x2e51bf
leaq 0x1a5510(%rip), %rcx    # 0x35f012
leaq 0x1a4d82(%rip), %r8     # 0x35e88b
movl $0x1c3, %r9d            # imm = 0x1C3
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x27e446(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12b4e7(%rip), %rsi    # 0x2e5013
leaq 0x1378c6(%rip), %rdx    # 0x2f13f9
leaq 0x1a54d8(%rip), %rcx    # 0x35f012
leaq 0x1a4d4a(%rip), %r8     # 0x35e88b
movl $0x1e7, %r9d            # imm = 0x1E7
jmp 0x1b9b0f
movq 0x27e418(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12b4b9(%rip), %rsi    # 0x2e5013
leaq 0x1a54ed(%rip), %rdx    # 0x35f04e
leaq 0x1a54aa(%rip), %rcx    # 0x35f012
leaq 0x1a4d1c(%rip), %r8     # 0x35e88b
movl $0x24f, %r9d            # imm = 0x24F
jmp 0x1b9b0f
movq 0x27e3ea(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12b48b(%rip), %rsi    # 0x2e5013
leaq 0x134409(%rip), %rdx    # 0x2edf98
leaq 0x1a547c(%rip), %rcx    # 0x35f012
leaq 0x1a4cee(%rip), %r8     # 0x35e88b
movl $0x284, %r9d            # imm = 0x284
jmp 0x1b9b0f