// File: /workspace/github_c_makefile_star2_O3/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, %r12d
movq %rsi, %r13
movl %edi, %r14d
testq %r8, %r8
je 0x20500b
movq %r15, %rdi
callq 0xfcc32
testb %al, %al
jne 0x205863
testq %rbx, %rbx
je 0x20585e
movq 0x38(%rbx), %rdi
callq 0x172f92
testb %al, %al
movq %rbx, 0xb8(%rsp)
je 0x20504b
movq 0x38(%rbx), %rdi
movq %r15, %rsi
callq 0x172fdd
movq %rax, 0x80(%rsp)
testq %rax, %rax
jne 0x2050ef
jmp 0x20520f
cmpl $0x2, %r14d
jle 0x205225
movl %r12d, 0x88(%rsp)
callq 0xef0cd
movq %rax, %r12
movq %rax, %rdi
callq 0xf238b
movq %r12, %rdi
callq 0xf2376
movq %r12, %rdi
callq 0xf2485
movl %r14d, %ebp
movq -0x8(%r13,%rbp,8), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0xef129
movq %rax, %r14
movq -0x8(%r13,%rbp,8), %rdi
leaq 0x1b939c(%rip), %rsi    # 0x3be43b
movl $0x1db, %edx            # imm = 0x1DB
callq 0x1045eb
movq $0x0, -0x8(%r13,%rbp,8)
movq %r12, %rdi
callq 0xefbe3
testq %r14, %r14
je 0x20520f
movq %r14, %rdi
callq 0x16d798
movq %rax, %r12
movq %r14, %rdi
callq 0xea375
movq %r12, 0x80(%rsp)
testq %r12, %r12
je 0x205868
movl 0x88(%rsp), %r12d
movq (%rbx), %rdi
movl $0x1, %ebp
testq %rdi, %rdi
je 0x20514a
callq 0x11b0ca
testq %rax, %rax
je 0x20514a
movq (%rbx), %rdi
callq 0x11b0a1
movq %rax, %rdi
movq %r15, %rsi
callq 0xd4388
movq %rax, 0x108(%rbx)
movq %r15, %rdi
callq 0xfcc32
movl $0x3, %ebp
testb %al, %al
je 0x20514a
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movq $0x0, 0x90(%rsp)
jmp 0x2051dd
movq 0x30(%rbx), %rdi
callq 0x11c131
testq %rax, %rax
je 0x2052fa
movq 0x10(%rbx), %rdi
callq 0x11b0a1
cmpb $0x47, (%rax)
jne 0x20517a
cmpb $0x41, 0x1(%rax)
jne 0x20517a
cmpb $0x0, 0x2(%rax)
je 0x205307
movq 0x10(%rbx), %rdi
callq 0x11b0a1
cmpb $0x54, (%rax)
jne 0x205198
cmpb $0x43, 0x1(%rax)
jne 0x205198
cmpb $0x0, 0x2(%rax)
je 0x20530e
movq 0x10(%rbx), %rdi
callq 0x11b0a1
leaq 0x1583fb(%rip), %rsi    # 0x35d5a3
movq %rax, %rdi
callq 0x17a40
testl %eax, %eax
je 0x205300
leaq 0x158a41(%rip), %rsi    # 0x35dc00
movq $0x0, 0x90(%rsp)
movq %r15, %rdi
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movq $0x0, 0x88(%rsp)
movq $0x0, 0xa8(%rsp)
xorl %r13d, %r13d
xorl %edi, %edi
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x80(%rsp), %rbp
jmp 0x205274
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movq $0x0, 0x90(%rsp)
jmp 0x20524a
leaq 0x1b99aa(%rip), %rsi    # 0x3bebd6
movq $0x0, 0x90(%rsp)
movq %r15, %rdi
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movq $0x0, 0x88(%rsp)
movq $0x0, 0xa8(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %edi, %edi
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %r12d, %r12d
callq 0x2127a0
movq %r12, %rdi
callq 0x162dee
movq %rbx, %rdi
callq 0x162dee
movq 0x88(%rsp), %rdi
callq 0x162dee
movq 0x90(%rsp), %rdi
callq 0x162dee
movq %r14, %rdi
callq 0x162dee
movq %r15, %rdi
callq 0x162dee
movq 0xa8(%rsp), %rdi
callq 0x162dee
movq %r13, %rdi
callq 0x162dee
movq 0xb8(%rsp), %rax
movq 0x108(%rax), %rdi
callq 0xd491d
movq %rbp, %rdi
callq 0x16d652
movl 0x7c(%rsp), %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, 0x7c(%rsp)
jmp 0x20531a
movl $0x2, %eax
jmp 0x205310
movl $0x1, %eax
jmp 0x205310
xorl %eax, %eax
orl $0x4, %ebp
movl %ebp, 0x7c(%rsp)
movl %eax, 0x40(%rbx)
movslq %r12d, %r12
movq %r13, 0xd0(%rsp)
movq (%r13,%r12,8), %rdi
callq 0x145d7c
movq %rax, %r14
callq 0x20865d
movq %r14, %rdi
movq %rax, %rsi
callq 0x1841d5
movq %rax, %rbp
movq 0x30(%rbx), %rdi
callq 0x11c131
testq %rax, %rax
movq %r14, 0xa0(%rsp)
movq %rbp, 0xa8(%rsp)
je 0x2053db
movq 0x30(%rbx), %rdi
movzbl 0x1d(%rbx), %esi
movq %r15, %rdx
callq 0x212168
testq %rax, %rax
je 0x205496
movsd 0x48(%rbx), %xmm0
movl 0x58(%rbx), %esi
movl 0x40(%rbx), %edx
movq %rax, 0x98(%rsp)
movq %rax, %rdi
movq 0x80(%rsp), %rcx
movq %r15, %r8
callq 0x20c151
testq %rax, %rax
je 0x205702
movq %rax, %r14
leaq 0x1b983f(%rip), %rsi    # 0x3bebf4
movq %rax, %rdi
callq 0x20c111
cmpb $0x1, 0x1b(%rbx)
jne 0x2053cb
movq %r14, %rdi
callq 0x20c0da
movq %rbp, %rdi
movq %r14, %rsi
callq 0x1841d5
movq %rax, %r14
jmp 0x2053ec
movq $0x0, 0x98(%rsp)
movq %rbp, %r14
xorl %eax, %eax
movq %rax, 0xb0(%rsp)
movq 0x108(%rbx), %rax
testq %rax, %rax
je 0x2054d8
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 0x80(%rsp), %rdi
callq 0x20b66b
testq %rax, %rax
je 0x20574a
movq %r14, %rdi
movq %rax, %rsi
callq 0x1841d5
movq %rax, %r14
movq %rax, 0x88(%rsp)
jmp 0x2054e4
movq $0x0, 0x90(%rsp)
movq $0x0, 0x88(%rsp)
xorl %edi, %edi
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x80(%rsp), %rbp
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movq 0xa0(%rsp), %r13
jmp 0x205274
movq $0x0, 0x88(%rsp)
movq 0xb8(%rsp), %rdi
movsd 0x80(%rdi), %xmm0
movsd 0x88(%rdi), %xmm1
movsd 0x90(%rdi), %xmm2
movsd 0x98(%rdi), %xmm3
movsd 0xa0(%rdi), %xmm4
movsd 0xa8(%rdi), %xmm5
movsd 0xb0(%rdi), %xmm6
movl 0xb8(%rdi), %r9d
movl 0xbc(%rdi), %eax
movq 0x60(%rdi), %rsi
movq 0x68(%rdi), %rdx
movq 0x70(%rdi), %rcx
movq 0x78(%rdi), %r8
movq %r15, 0x8(%rsp)
movl %eax, (%rsp)
movq 0x80(%rsp), %rdi
callq 0x20e567
testq %rax, %rax
je 0x2056dc
movq %r14, %rdi
movq %rax, %rsi
callq 0x1841d5
movq %rax, %rbx
callq 0x20efcd
testq %rax, %rax
je 0x20586d
movq %rbx, 0xc8(%rsp)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1841d5
movq %rax, %r14
movq 0xb8(%rsp), %r13
movq 0x8(%r13), %rdi
callq 0x11b0ca
testq %rax, %rax
movl 0x7c(%rsp), %ebx
movq %r14, 0x90(%rsp)
je 0x205797
movq 0x8(%r13), %rdi
callq 0x11b0a1
movl 0x5c(%r13), %r8d
movq %r14, %rdi
movl %ebx, %esi
movq 0x80(%rsp), %rdx
movq %rax, %rcx
movq %r15, %r9
callq 0x20aa91
movq %rax, 0xc0(%rsp)
testq %rax, %rax
je 0x205823
cmpb $0x1, 0x1c(%r13)
jne 0x20579f
leaq 0x70(%r13), %r14
movq (%r13), %rdi
callq 0x11b0a1
movq 0xd0(%rsp), %rcx
movq (%rcx,%r12,8), %rcx
movl 0xb8(%r13), %edx
movl 0xc4(%r13), %esi
movl 0xc0(%r13), %edi
movq 0x30(%r13), %r10
movl 0x58(%r13), %r11d
movsd 0x48(%r13), %xmm0
movq 0x60(%r13), %r8
movq 0x68(%r13), %r9
movups 0xc8(%r13), %xmm1
movups 0xd8(%r13), %xmm2
movups 0xe8(%r13), %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 0xc0(%rsp), %rdi
movl %ebx, %esi
movq %rax, %rdx
callq 0x20a6da
testl %eax, %eax
je 0x20579f
xorl %r12d, %r12d
movq 0x80(%rsp), %rbp
movq 0xa0(%rsp), %r13
movq 0x98(%rsp), %rdi
movq 0xb0(%rsp), %r14
movl %eax, 0x7c(%rsp)
movq 0xc8(%rsp), %rbx
movq 0xc0(%rsp), %r15
jmp 0x205274
movq $0x0, 0x90(%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x80(%rsp), %rbp
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
jmp 0x20577a
movq $0x0, 0x90(%rsp)
movq $0x0, 0x88(%rsp)
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x80(%rsp), %rbp
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movq 0xa0(%rsp), %r13
movq 0x98(%rsp), %rdi
jmp 0x205274
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movq $0x0, 0x90(%rsp)
movq $0x0, 0x88(%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x80(%rsp), %rbp
movq 0xa0(%rsp), %r13
movq 0x98(%rsp), %rdi
movq 0xb0(%rsp), %r14
jmp 0x205274
xorl %r13d, %r13d
movq %r14, %rbx
jmp 0x2057cf
cmpb $0x1, 0x19(%r13)
movq 0xc0(%rsp), %rbx
jne 0x2057b6
movq %rbx, %rdi
callq 0x20a68c
movq 0xb8(%rsp), %rax
cmpb $0x1, 0x1a(%rax)
jne 0x2057cc
movq %rbx, %rdi
callq 0x20a6b3
movq %rbx, %r13
movq 0xb8(%rsp), %rax
movq 0x28(%rax), %rsi
movq %rbx, %rdi
callq 0x146fc0
testq %rax, %rax
je 0x205872
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x162f5d
movl %eax, 0x7c(%rsp)
movq %r13, %r15
movq 0x80(%rsp), %rbp
movq 0xa0(%rsp), %r13
movq 0x98(%rsp), %rdi
movq 0xb0(%rsp), %r14
jmp 0x205851
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x80(%rsp), %rbp
movq 0xa0(%rsp), %r13
movq 0x98(%rsp), %rdi
movq 0xb0(%rsp), %r14
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movq 0xc8(%rsp), %rbx
jmp 0x205274
callq 0x8005c
callq 0x7ff78
callq 0x7ffb1
callq 0x80023
callq 0x7ffea
nop