// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/ltr/ltrdigest_pdom_visitor.c
// Function: gt_ltrdigest_pdom_visitor_new
GtNodeVisitor* gt_ltrdigest_pdom_visitor_new(GtPdomModelSet *model,
                                             double eval_cutoff,
                                             unsigned int chain_max_gap_length,
                                             GtPdomCutoff cutoff,
                                             GtRegionMapping *rmap,
                                             GtError *err)
{
  GtNodeVisitor *nv;
  GtLTRdigestPdomVisitor *lv;
  GtStr *cmd;
  int had_err = 0, i, rval;
  gt_assert(model && rmap);

  rval = system("hmmscan -h > /dev/null");
  if (rval == -1) {
    gt_error_set(err, "error executing system(hmmscan)");
    return NULL;
  }
#ifndef _WIN32
  if (WEXITSTATUS(rval) != 0) {
    gt_error_set(err, "cannot find the hmmscan executable in PATH");
    return NULL;
  }
#else
  /* XXX */
  gt_error_set(err, "hmmscan for Windows not implemented");
  return NULL;
#endif

  nv = gt_node_visitor_create(gt_ltrdigest_pdom_visitor_class());
  lv = gt_ltrdigest_pdom_visitor_cast(nv);
  lv->eval_cutoff = eval_cutoff;
  lv->cutoff = cutoff;
  lv->chain_max_gap_length = chain_max_gap_length;
  lv->rmap = rmap;
  lv->output_all_chains = false;
  lv->tag = gt_str_new_cstr("GenomeTools");
  lv->root_type = gt_symbol(gt_ft_LTR_retrotransposon);

  for (i = 0; i < 3; i++) {
    lv->fwd[i] = gt_str_new();
    lv->rev[i] = gt_str_new();
  }

  if (!had_err) {
    cmd = gt_str_new_cstr("hmmscan --cpu ");
    gt_str_append_uint(cmd, gt_jobs);
    gt_str_append_cstr(cmd, " ");
    switch (cutoff) {
      case GT_PHMM_CUTOFF_GA:
        gt_str_append_cstr(cmd, "--cut_ga");
        break;
      case GT_PHMM_CUTOFF_TC:
        gt_str_append_cstr(cmd, "--cut_tc");
        break;
      case GT_PHMM_CUTOFF_NONE:
        gt_str_append_cstr(cmd, "--domE ");
        gt_str_append_double(cmd, eval_cutoff, 50);
        break;
    }
    gt_str_append_cstr(cmd, " ");
    gt_str_append_cstr(cmd, gt_pdom_model_set_get_filename(model));
    gt_str_append_cstr(cmd, " -"); /* stdin */
    lv->cmdline = cmd;
    lv->args = gt_cstr_split(gt_str_get(lv->cmdline), ' ');
    gt_log_log("HMMER cmdline: %s", gt_str_get(cmd));
  }
  return nv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movsd %xmm0, (%rsp)
testq %rdi, %rdi
je 0x215d08
movq %rcx, %r12
testq %rcx, %rcx
je 0x215d08
movq %r8, %r15
movl %edx, %ebp
movl %esi, %r13d
movq %rdi, %r14
leaq 0x1b3ec0(%rip), %rdi    # 0x3c9a1a
callq 0x176a0
cmpl $-0x1, %eax
je 0x215b74
testl $0xff00, %eax           # imm = 0xFF00
je 0x215b8c
leaq 0x1b3edf(%rip), %rsi    # 0x3c9a51
jmp 0x215b7b
leaq 0x1b3eb6(%rip), %rsi    # 0x3c9a31
xorl %ebx, %ebx
movq %r15, %rdi
xorl %eax, %eax
callq 0x1019cf
jmp 0x215cf6
callq 0x2153dc
movq %rax, %rdi
callq 0x16aef0
movq %rax, %rbx
callq 0x2153dc
movq %rax, %rdi
movq %rbx, %rsi
callq 0x16af21
movq %rax, %r15
movsd (%rsp), %xmm0
movsd %xmm0, 0x20(%rax)
movl %ebp, 0x78(%rax)
movl %r13d, 0x60(%rax)
movq %r12, 0x18(%rax)
movb $0x0, 0x90(%rax)
leaq 0x1810c1(%rip), %rdi    # 0x396c93
callq 0x120955
movq %rax, 0x88(%r15)
leaq 0x188479(%rip), %rdi    # 0x39e05e
callq 0x12234f
movq %rax, 0xa0(%r15)
movq $-0x3, %r12
callq 0x1208f8
movq %rax, 0x48(%r15,%r12,8)
callq 0x1208f8
movq %rax, 0x60(%r15,%r12,8)
incq %r12
jne 0x215bf8
leaq 0x1b3e64(%rip), %rdi    # 0x3c9a7c
callq 0x120955
movq %rax, %r12
leaq 0x2af1f1(%rip), %rax    # 0x4c4e18
movl (%rax), %esi
movq %r12, %rdi
callq 0x120cd6
leaq 0x1b5c10(%rip), %rsi    # 0x3cb848
movq %r12, %rdi
callq 0x12097f
testl %ebp, %ebp
je 0x215c7a
cmpl $0x2, %ebp
je 0x215c57
cmpl $0x1, %ebp
jne 0x215c89
leaq 0x1b3e36(%rip), %rsi    # 0x3c9a8b
jmp 0x215c81
leaq 0x1b3e3f(%rip), %rsi    # 0x3c9a9d
movq %r12, %rdi
callq 0x12097f
movq %r12, %rdi
movsd (%rsp), %xmm0
movl $0x32, %esi
callq 0x120c3c
jmp 0x215c89
leaq 0x1b3e13(%rip), %rsi    # 0x3c9a94
movq %r12, %rdi
callq 0x12097f
leaq 0x1b5bb8(%rip), %rsi    # 0x3cb848
movq %r12, %rdi
callq 0x12097f
movq %r14, %rdi
callq 0x21c4c8
movq %r12, %rdi
movq %rax, %rsi
callq 0x12097f
leaq 0x16b1ad(%rip), %rsi    # 0x380e5f
movq %r12, %rdi
callq 0x12097f
movq %r12, 0x80(%r15)
movq %r12, %rdi
callq 0x120d23
movq %rax, %rdi
movl $0x20, %esi
callq 0xe8650
movq %rax, 0x98(%r15)
movq %r12, %rdi
callq 0x120d23
leaq 0x1b3db9(%rip), %rdi    # 0x3c9aa5
movq %rax, %rsi
xorl %eax, %eax
callq 0x108e02
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x82e9d