// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x88, %rsp
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x58(%rsp), %rax
movsd 0x28(%rax), %xmm0
movq 0x58(%rsp), %rax
movsd 0x20(%rax), %xmm1
callq 0xec290
cmpl $0x0, %eax
jg 0x30a7ef
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x30a7fd
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x30a7ff
cmpq $0x0, 0x40(%rsp)
jne 0x30a83f
movq 0x331792(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x20b7fb(%rip), %rsi    # 0x516013
leaq 0x20ff0f(%rip), %rdx    # 0x51a72e
leaq 0x2893bf(%rip), %rcx    # 0x593be5
leaq 0x288ccc(%rip), %r8     # 0x5934f9
movl $0x288, %r9d            # imm = 0x288
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x30a841
movq 0x40(%rsp), %rdi
callq 0x81370
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x30a868
movl $0x0, 0x84(%rsp)
jmp 0x30aae5
cmpq $0x1, 0x38(%rsp)
jbe 0x30aa92
imulq $0x30, 0x38(%rsp), %rdi
leaq 0x288c78(%rip), %rsi    # 0x5934f9
movl $0x28e, %edx            # imm = 0x28E
callq 0xe80f0
movq %rax, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x30a9d2
movq 0x40(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x80b60
movq (%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x30a900
movq 0x3316d1(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x20b73a(%rip), %rsi    # 0x516013
leaq 0x27489d(%rip), %rdx    # 0x57f17d
leaq 0x2892fe(%rip), %rcx    # 0x593be5
leaq 0x288c0b(%rip), %r8     # 0x5934f9
movl $0x291, %r9d            # imm = 0x291
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x30a902
movq 0x18(%rsp), %rax
movq (%rax), %rcx
movq 0x30(%rsp), %rax
imulq $0x30, 0x28(%rsp), %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x30(%rsp), %rax
imulq $0x30, 0x28(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x30(%rsp), %rax
imulq $0x30, 0x28(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x30(%rsp), %rax
imulq $0x30, 0x28(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rsp), %rcx
subq 0x10(%rcx), %rax
addq $0x1, %rax
cvtsi2sd %rax, %xmm0
movq 0x18(%rsp), %rax
mulsd 0x30(%rax), %xmm0
cvttsd2si %xmm0, %rcx
movq 0x30(%rsp), %rax
imulq $0x30, 0x28(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x20(%rax)
movq 0x18(%rsp), %rcx
movq 0x30(%rsp), %rax
imulq $0x30, 0x28(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x28(%rax)
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x30a899
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl $0x30, %edx
leaq 0x118(%rip), %rcx       # 0x30ab00
callq 0x19e70
movq 0x48(%rsp), %rsi
movq 0x38(%rsp), %rdx
leaq 0x28920d(%rip), %rdi    # 0x593c0b
movb $0x0, %al
callq 0xe7740
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x50(%rsp), %rax
movl 0x60(%rax), %eax
movl %eax, %edx
leaq 0x150(%rip), %rcx       # 0x30ab70
leaq 0x20(%rsp), %r8
callq 0x491650
movq 0x30(%rsp), %rdi
leaq 0x288ac3(%rip), %rsi    # 0x5934f9
movl $0x29f, %edx            # imm = 0x29F
callq 0xe88c0
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x30aa90
movq 0x40(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x80b60
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x30acb0
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x30aa49
jmp 0x30aada
movq $0x0, 0x8(%rsp)
movq 0x40(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x80b60
movq (%rax), %rax
movq %rax, (%rsp)
movq (%rsp), %rax
movq 0x40(%rax), %rdi
leaq 0x8(%rsp), %rsi
movl $0x8, %edx
callq 0x81100
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq (%rsp), %rdx
callq 0x30acb0
movl $0x0, 0x84(%rsp)
movl 0x84(%rsp), %eax
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)