// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/ltr/ltrdigest_ppt_visitor.c
// Function: gt_group_hits
static void gt_group_hits(GtLTRdigestPPTVisitor *lv,
                          unsigned int *decoded, GtPPTResults *results,
                          GtUword radius, GT_UNUSED const char *seq,
                          GtStrand strand)
{
  GtPPTHit *cur_hit = NULL,
           *potential_ubox = NULL;
  GtUword i = 0;

  gt_assert(decoded && results && strand != GT_STRAND_UNKNOWN);

  /* group hits into stretches */
  cur_hit = gt_ppt_hit_new(strand, results);
  for (i = 0; i < 2 * radius - 1; i++)
  {
    gt_assert(cur_hit != NULL);
    cur_hit->state = (GtPPTStates) decoded[i];
    cur_hit->rng.end = i;
    if (decoded[i+1] != decoded[i] || i + 2 == 2 * radius)
    {
      switch (cur_hit->state)
      {
        case PPT_UBOX:
          if (gt_ubox_ok(cur_hit, lv->ubox_len)) {
            if (potential_ubox != NULL) {
              gt_free(potential_ubox);
              potential_ubox = NULL;
            }
            potential_ubox = cur_hit;
            cur_hit = NULL;
          }
          else
          {
            gt_free(cur_hit);
            cur_hit = NULL;
          }
          break;
        case PPT_IN:
          if (gt_ppt_ok(cur_hit, lv->ppt_len))
          {
            cur_hit->score = gt_ppt_score(radius, cur_hit->rng.end);
            gt_array_add(results->hits, cur_hit);
            if (potential_ubox != NULL)
            {
              if (cur_hit->rng.start - potential_ubox->rng.end
                    <= (GtUword) lv->max_ubox_dist)
              {
                /* this PPT has a U-box, handle accordingly */
                cur_hit->ubox = potential_ubox;
              } else {
                gt_free(potential_ubox);
              }
              potential_ubox = NULL;
            }
            cur_hit = NULL;
          }
          else
          {
            if (potential_ubox != NULL) {
              gt_free(potential_ubox);
              potential_ubox = NULL;
            }
            gt_free(cur_hit);
            cur_hit = NULL;
          }
          break;
        default:
          if (potential_ubox != NULL) {
                gt_free(potential_ubox);
                potential_ubox = NULL;
          }
          gt_free(cur_hit);
          cur_hit = NULL;
          break;
      }
      if (i+2!=2*radius)
      {
        /* we assume that the current hit has been processed */
        gt_assert(cur_hit == NULL);
        cur_hit = gt_ppt_hit_new(strand, results);
        cur_hit->rng.start = i+1;
      }
    }
  }
  if (cur_hit != NULL)
    cur_hit->rng.end++;
  gt_free(potential_ubox);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, 0xc(%rsp)
movq $0x0, (%rsp)
testq %rsi, %rsi
je 0x21877b
testq %rdx, %rdx
je 0x21877b
movq %rcx, %r13
movq %rsi, %r15
movq %rdi, %r12
movl 0xc(%rsp), %edi
movq %rdx, 0x10(%rsp)
movq %rdx, %rsi
callq 0x218795
movq %rsp, %rdx
movq %r13, %rcx
imulq %r13, %rcx
movq %rcx, %xmm0
punpckldq 0x1383a7(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1383af(%rip), %xmm0   # 0x3508f0
movq %rax, (%rdx)
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
movsd %xmm0, 0x18(%rsp)
leaq -0x1(,%r13,2), %rbx
movl $0x1, %ebp
xorl %r13d, %r13d
leaq 0x1b1beb(%rip), %rsi    # 0x3ca166
movq %rsi, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x218771
leaq -0x1(%rbp), %rax
movl -0x4(%r15,%rbp,4), %ecx
movl %ecx, 0x18(%rdi)
movq %rax, 0x8(%rdi)
cmpq $0x1, %rbx
je 0x2185b0
movl -0x4(%r15,%rbp,4), %edx
cmpl %edx, (%r15,%rbp,4)
je 0x21872d
testl %ecx, %ecx
je 0x2185f7
cmpl $0x2, %ecx
jne 0x2186a0
movq %rbp, %rax
subq (%rdi), %rax
cmpq 0x40(%r12), %rax
jb 0x2186c3
cmpq 0x48(%r12), %rax
ja 0x2186c3
testq %r13, %r13
je 0x2185ee
movq %r13, %rdi
movq %r14, %rsi
movl $0x13e, %edx            # imm = 0x13E
callq 0x109670
movq (%rsp), %r13
jmp 0x2186cd
movq %rbp, %rcx
subq (%rdi), %rcx
cmpq 0x30(%r12), %rcx
jb 0x2186d7
cmpq 0x38(%r12), %rcx
ja 0x2186d7
movq %rax, %xmm0
punpckldq 0x1382c0(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1382c8(%rip), %xmm0   # 0x3508f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
movapd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
divsd %xmm2, %xmm1
movsd %xmm1, 0x10(%rdi)
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movl $0x8, %edx
movq %rsp, %rsi
callq 0xd49ce
testq %r13, %r13
je 0x2186fd
movq (%rsp), %rax
movq (%rax), %rcx
subq 0x8(%r13), %rcx
movl 0x8c(%r12), %edx
cmpq %rdx, %rcx
jbe 0x21873b
movq %r13, %rdi
movq %r14, %rsi
movl $0x157, %edx            # imm = 0x157
jmp 0x2186f8
testq %r13, %r13
je 0x2186b8
movq %r13, %rdi
movq %r14, %rsi
movl $0x169, %edx            # imm = 0x169
callq 0x109670
movq %r14, %rsi
movq (%rsp), %rdi
movl $0x16c, %edx            # imm = 0x16C
jmp 0x2186f8
movl $0x146, %edx            # imm = 0x146
callq 0x109670
movq $0x0, (%rsp)
jmp 0x218708
testq %r13, %r13
je 0x2186ef
movq %r13, %rdi
movq %r14, %rsi
movl $0x160, %edx            # imm = 0x160
callq 0x109670
movq %r14, %rsi
movq (%rsp), %rdi
movl $0x163, %edx            # imm = 0x163
callq 0x109670
movq $0x0, (%rsp)
xorl %r13d, %r13d
cmpq $0x1, %rbx
je 0x21872a
cmpq $0x0, (%rsp)
jne 0x218776
movl 0xc(%rsp), %edi
movq 0x10(%rsp), %rsi
callq 0x218795
movq %rax, (%rsp)
movq %rbp, (%rax)
movq %r14, %rsi
incq %rbp
decq %rbx
jne 0x21857e
jmp 0x218741
movq %r13, 0x20(%rax)
jmp 0x2186fd
movq (%rsp), %rax
testq %rax, %rax
je 0x21874e
incq 0x8(%rax)
leaq 0x1b1a11(%rip), %rsi    # 0x3ca166
movq %r13, %rdi
movl $0x17b, %edx            # imm = 0x17B
callq 0x109670
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x836b4
callq 0x8367b
callq 0x83642