// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/ltr/ltrdigest_pdom_visitor.c
// Function: gt_ltrdigest_pdom_visitor_process_hit
static int gt_ltrdigest_pdom_visitor_process_hit(GT_UNUSED void *key, void *val,
                                                 void *data,
                                                 GT_UNUSED GtError *err)
{
  GtHMMERModelHit *mh = (GtHMMERModelHit*) val;
  GtLTRdigestPdomVisitor *lv = (GtLTRdigestPdomVisitor*) data;
  const char *mdl = (const char*) key;
  GtArray *hits = NULL;
  GtUword nof_hits;
  GtFragment *frags;

  if (gt_double_compare(mh->best_fwd, mh->best_rev) <= 0)
    hits = mh->fwd_hits;
  else
    hits = mh->rev_hits;
  gt_assert(hits);
  nof_hits = gt_array_size(hits);
  if (nof_hits == 0) return 0;

  if (nof_hits > 1UL) {
    GtUword i, chainno;
    frags = gt_malloc((size_t) nof_hits * sizeof (GtFragment));
    for (i = 0; i < nof_hits; i++) {
      GtHMMERSingleHit *h = *(GtHMMERSingleHit**) gt_array_get(hits, i);
      gt_assert(h);
      frags[i].startpos1 = h->hmmfrom;
      frags[i].endpos1   = h->hmmto;
      frags[i].startpos2 = h->alifrom;
      frags[i].endpos2   = h->alito;
      frags[i].weight    = (GtWord) (h->alito - h->alifrom + 1) * h->score;
      frags[i].data      = h;
    }
    qsort(frags, (size_t) nof_hits, sizeof (GtFragment),
          gt_ltrdigest_pdom_visitor_fragcmp);
    gt_log_log("%s: chaining "GT_WU" frags", mdl, nof_hits);
    gt_globalchaining_max(frags, nof_hits,
                         (GtUword) lv->chain_max_gap_length,
                         gt_ltrdigest_pdom_visitor_chainproc, &chainno);
    gt_free(frags);
    for (i = 0; i < nof_hits; i++) {
      GtHMMERSingleHit *h = *(GtHMMERSingleHit**) gt_array_get(hits, i);
      (void) gt_ltrdigest_pdom_visitor_attach_hit(lv, mh, h);
    }
  } else {
    GtUword chainno = 0UL;
    GtHMMERSingleHit *h = *(GtHMMERSingleHit**) gt_array_get(hits, 0);
    gt_array_add(h->chains, chainno);
    (void) gt_ltrdigest_pdom_visitor_attach_hit(lv, mh, h);
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r13
movsd 0x20(%rsi), %xmm1
movsd 0x28(%rsi), %xmm0
callq 0x10acd4
xorl %ecx, %ecx
testl %eax, %eax
setg %cl
movq (%rbx,%rcx,8), %r15
testq %r15, %r15
je 0x21733e
movq %r15, %rdi
callq 0xd4a9a
testq %rax, %rax
je 0x217328
movq %rax, %r12
cmpq $0x1, %rax
jne 0x21721b
leaq 0x10(%rsp), %r12
movq $0x0, (%r12)
movq %r15, %rdi
xorl %esi, %esi
callq 0xd47ba
movq (%rax), %r15
movq 0x40(%r15), %rdi
movl $0x8, %edx
movq %r12, %rsi
callq 0xd49ce
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x217425
jmp 0x217328
movq %r13, 0x8(%rsp)
movq %r12, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
leaq 0x1b272a(%rip), %rsi    # 0x3c995c
movl $0x28e, %edx            # imm = 0x28E
callq 0x1092b2
movq %rax, %rbp
movq %rax, (%rsp)
addq $0x28, %rbp
xorl %r13d, %r13d
movq %r15, %rdi
movq %r13, %rsi
callq 0xd47ba
movq (%rax), %rax
testq %rax, %rax
je 0x217339
movups (%rax), %xmm0
movups %xmm0, -0x28(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq 0x18(%rax), %rdx
movq %rdx, -0x10(%rbp)
subq %rcx, %rdx
incq %rdx
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
mulsd 0x30(%rax), %xmm0
cvttsd2si %xmm0, %rcx
movq %rcx, -0x8(%rbp)
movq %rax, (%rbp)
incq %r13
addq $0x30, %rbp
cmpq %r13, %r12
jne 0x21724a
leaq 0x98(%rip), %rcx        # 0x217343
movl $0x30, %edx
movq (%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x17f60
leaq 0x1b2d76(%rip), %rdi    # 0x3ca03c
xorl %r13d, %r13d
movq 0x8(%rsp), %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x108e02
movl 0x60(%r14), %edx
leaq 0x7e(%rip), %rcx        # 0x217361
leaq 0x10(%rsp), %r8
movq %rbp, %rdi
movq %r12, %rsi
callq 0x308858
leaq 0x1b2662(%rip), %rsi    # 0x3c995c
movq %rbp, %rdi
movl $0x29f, %edx            # imm = 0x29F
callq 0x109670
movq %r15, %rdi
movq %r13, %rsi
callq 0xd47ba
movq (%rax), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x217425
incq %r13
cmpq %r13, %r12
jne 0x217307
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8335f
callq 0x83398