// File: /workspace/github_c_makefile_star2_O2/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
movq %rdi, 0x8(%rsp)
testq %rsi, %rsi
je 0x1c3460
movq %rdx, %r15
testq %rdx, %rdx
je 0x1c3460
movq %rcx, %r14
movq %rsi, %r12
movl %r8d, 0x14(%rsp)
movl %r8d, %edi
movq %r15, %rsi
callq 0x1c34a3
movq %rsp, %rdx
movq %r14, %rcx
imulq %r14, %rcx
movq %rcx, %xmm0
punpckldq 0x124714(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movq %rax, (%rdx)
subpd 0x124719(%rip), %xmm0   # 0x2e78f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
cvtsi2sd %r14, %xmm0
movsd %xmm0, 0x18(%rsp)
addq %r14, %r14
negq %r14
xorl %ebp, %ebp
xorl %r13d, %r13d
decq %r13
movq %r13, %rcx
leaq (%r14,%rcx), %rdx
cmpq $-0x2, %rdx
je 0x1c33fc
testq %rax, %rax
je 0x1c3428
leaq 0x1(%rcx), %r13
movl 0x4(%r12,%rcx,4), %edx
movl %edx, 0x18(%rax)
movq %r13, 0x8(%rax)
leaq (%r14,%rcx), %rbx
addq $0x2, %rbx
cmpq $-0x1, %rbx
je 0x1c3244
cmpl %edx, 0x8(%r12,%rcx,4)
movq %r13, %rcx
je 0x1c3205
testl %edx, %edx
je 0x1c329d
cmpl $0x2, %edx
jne 0x1c334c
movq %r13, %rcx
subq (%rax), %rcx
incq %rcx
movq 0x8(%rsp), %rdx
cmpq 0x40(%rdx), %rcx
jb 0x1c337a
cmpq 0x48(%rdx), %rcx
ja 0x1c337a
testq %rbp, %rbp
je 0x1c3290
movq %rbp, %rdi
leaq 0x19dc54(%rip), %rsi    # 0x360ed6
movl $0x13e, %edx            # imm = 0x13E
callq 0x936f9
movq (%rsp), %rax
andq $0x0, (%rsp)
movq %rax, %rbp
jmp 0x1c33cc
movq %r13, %rcx
subq (%rax), %rcx
incq %rcx
movq 0x8(%rsp), %rdx
cmpq 0x30(%rdx), %rcx
jb 0x1c3395
cmpq 0x38(%rdx), %rcx
ja 0x1c3395
movq %r13, %xmm0
punpckldq 0x124614(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x12461c(%rip), %xmm0   # 0x2e78f0
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(%rax)
movq (%r15), %rdi
movq %rsp, %rsi
pushq $0x8
popq %rdx
callq 0x5851d
testq %rbp, %rbp
je 0x1c33c5
movq (%rsp), %rax
movq (%rax), %rcx
subq 0x8(%rbp), %rcx
movq 0x8(%rsp), %rdx
movl 0x8c(%rdx), %edx
cmpq %rdx, %rcx
jbe 0x1c33f6
movq %rbp, %rdi
leaq 0x19db91(%rip), %rsi    # 0x360ed6
movl $0x157, %edx            # imm = 0x157
jmp 0x1c33c0
testq %rbp, %rbp
leaq 0x19db80(%rip), %rsi    # 0x360ed6
je 0x1c3370
movq %rbp, %rdi
movl $0x169, %edx            # imm = 0x169
callq 0x936f9
leaq 0x19db6a(%rip), %rsi    # 0x360ed6
movq (%rsp), %rax
movq %rax, %rdi
movl $0x16c, %edx            # imm = 0x16C
jmp 0x1c33c0
movq %rax, %rdi
leaq 0x19db52(%rip), %rsi    # 0x360ed6
movl $0x146, %edx            # imm = 0x146
callq 0x936f9
andq $0x0, (%rsp)
jmp 0x1c33cc
testq %rbp, %rbp
leaq 0x19db37(%rip), %rsi    # 0x360ed6
je 0x1c33b8
movq %rbp, %rdi
movq %rsi, %rbp
movl $0x160, %edx            # imm = 0x160
callq 0x936f9
movq %rbp, %rsi
movq (%rsp), %rax
movq %rax, %rdi
movl $0x163, %edx            # imm = 0x163
callq 0x936f9
andq $0x0, (%rsp)
xorl %ebp, %ebp
incq %r13
movl $0x0, %eax
cmpq $-0x1, %rbx
je 0x1c31ff
movl 0x14(%rsp), %edi
movq %r15, %rsi
callq 0x1c34a3
movq %rax, (%rsp)
movq %r13, (%rax)
jmp 0x1c31ff
movq %rbp, 0x20(%rax)
jmp 0x1c33c5
testq %rax, %rax
je 0x1c3405
incq 0x8(%rax)
leaq 0x19daca(%rip), %rsi    # 0x360ed6
movq %rbp, %rdi
movl $0x17b, %edx            # imm = 0x17B
callq 0x936f9
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x274b39(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x121bda(%rip), %rsi    # 0x2e5013
leaq 0x19dc0a(%rip), %rdx    # 0x36104a
leaq 0x19dbf5(%rip), %rcx    # 0x36103c
leaq 0x19da88(%rip), %r8     # 0x360ed6
movl $0x134, %r9d            # imm = 0x134
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x274b01(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x121ba2(%rip), %rsi    # 0x2e5013
leaq 0x19db92(%rip), %rdx    # 0x36100a
leaq 0x19dbbd(%rip), %rcx    # 0x36103c
leaq 0x19da50(%rip), %r8     # 0x360ed6
movl $0x12e, %r9d            # imm = 0x12E
jmp 0x1c3454