// File: /workspace/github_c_makefile_star2_O2/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 0x1c0cdc
movq %rcx, %r12
testq %rcx, %rcx
je 0x1c0cdc
movq %r8, %r15
movl %edx, %ebp
movl %esi, %r13d
movq %rdi, %r14
leaq 0x19fc70(%rip), %rdi    # 0x3607a0
callq 0x17670
cmpl $-0x1, %eax
je 0x1c0b49
testw $0xff00, %ax            # imm = 0xFF00
je 0x1c0b61
leaq 0x19fc90(%rip), %rsi    # 0x3607d7
jmp 0x1c0b50
leaq 0x19fc67(%rip), %rsi    # 0x3607b7
xorl %ebx, %ebx
movq %r15, %rdi
xorl %eax, %eax
callq 0x89dbb
jmp 0x1c0cca
callq 0x1c02c6
movq %rax, %rdi
callq 0x102da0
movq %rax, %rbx
callq 0x1c02c6
movq %rax, %rdi
movq %rbx, %rsi
callq 0x102dfe
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 0x16d0fc(%rip), %rdi    # 0x32dca3
callq 0xacbd1
movq %rax, 0x88(%r15)
leaq 0x17436c(%rip), %rdi    # 0x334f26
callq 0xaed4b
movq %rax, 0xa0(%r15)
pushq $-0x18
popq %r12
testq %r12, %r12
je 0x1c0be9
callq 0xacb84
movq %rax, 0x48(%r15,%r12)
callq 0xacb84
movq %rax, 0x60(%r15,%r12)
addq $0x8, %r12
jmp 0x1c0bca
leaq 0x19fc12(%rip), %rdi    # 0x360802
callq 0xacbd1
movq %rax, %r12
leaq 0x2781c9(%rip), %rax    # 0x438dc8
movl (%rax), %esi
movq %r12, %rdi
callq 0xad151
leaq 0x1a1920(%rip), %rsi    # 0x362530
movq %r12, %rdi
callq 0xacbfb
testl %ebp, %ebp
je 0x1c0c50
cmpl $0x2, %ebp
je 0x1c0c2f
cmpl $0x1, %ebp
jne 0x1c0c5f
leaq 0x19fbe4(%rip), %rsi    # 0x360811
jmp 0x1c0c57
leaq 0x19fbed(%rip), %rsi    # 0x360823
movq %r12, %rdi
callq 0xacbfb
pushq $0x32
popq %rsi
movq %r12, %rdi
movsd (%rsp), %xmm0
callq 0xacfff
jmp 0x1c0c5f
leaq 0x19fbc3(%rip), %rsi    # 0x36081a
movq %r12, %rdi
callq 0xacbfb
leaq 0x1a18ca(%rip), %rsi    # 0x362530
movq %r12, %rdi
callq 0xacbfb
movq %r14, %rdi
callq 0x1c7569
movq %r12, %rdi
movq %rax, %rsi
callq 0xacbfb
leaq 0x157249(%rip), %rsi    # 0x317ed1
movq %r12, %rdi
callq 0xacbfb
movq %r12, 0x80(%r15)
movq %r12, %rdi
callq 0xad1fa
pushq $0x20
popq %rsi
movq %rax, %rdi
callq 0x6c174
movq %rax, 0x98(%r15)
movq %r12, %rdi
callq 0xad1fa
leaq 0x19fb6b(%rip), %rdi    # 0x36082b
movq %rax, %rsi
xorl %eax, %eax
callq 0x92a82
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x277285(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x124326(%rip), %rsi    # 0x2e5013
leaq 0x19fa80(%rip), %rdx    # 0x360774
leaq 0x19fa87(%rip), %rcx    # 0x360782
leaq 0x19f9e0(%rip), %r8     # 0x3606e2
movl $0x41f, %r9d            # imm = 0x41F
xorl %eax, %eax
callq 0x17a50
callq 0x17390