// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/tir_stream.c
// Function: gt_tir_remove_overlaps
static void gt_tir_remove_overlaps(GtArrayTIRPair *arrayTIRPair,
                                   bool nooverlapallowed, bool keeplongest)
{
  GtUword i;
  TIRPair *boundaries, *oldboundaries, *maxsimboundaries = NULL,
          *maxlenboundaries = NULL;
  GtRange refrng;
  gt_assert(arrayTIRPair != NULL);

  if (arrayTIRPair->spaceTIRPair == NULL)
    return;
  gt_assert(arrayTIRPair->spaceTIRPair != NULL);
  maxlenboundaries = maxsimboundaries = oldboundaries =
                                                     arrayTIRPair->spaceTIRPair;
  refrng.start = oldboundaries->left_tir_start;
  refrng.end = oldboundaries->right_transformed_end;
  for (i = 1UL; i < arrayTIRPair->nextfreeTIRPair; i++) {
    boundaries = arrayTIRPair->spaceTIRPair + i;
    if (boundaries->skip)
      continue;
    if (tirboundaries_overlap(&refrng, boundaries)) {
      /* due to sortedness of the array, the left border shouldn't change... */
      gt_assert(refrng.start <= boundaries->left_tir_start);
      /* ...so only update the right border */
      refrng.end = GT_MAX(boundaries->right_transformed_end, refrng.end);
      if (nooverlapallowed) {
        oldboundaries->skip = true;
        boundaries->skip = true;
      } else {
        if (keeplongest) {
          if (gt_double_smaller_double(maxlenboundaries->right_tir_end
                                             - maxlenboundaries->left_tir_start,
                                       boundaries->right_tir_end
                                             - boundaries->left_tir_start)) {
            maxlenboundaries->skip = true;
            maxlenboundaries = boundaries;
          } else {
            boundaries->skip = true;
          }
        } else {
          if (gt_double_smaller_double(maxsimboundaries->similarity,
                                       boundaries->similarity)) {
            maxsimboundaries->skip = true;
            maxsimboundaries = boundaries;
          } else {
            boundaries->skip = true;
          }
        }
      }
    } else {
      /* no more overlapping with cluster, reset */
      oldboundaries = boundaries;
      refrng.start = boundaries->left_tir_start;
      refrng.end = boundaries->right_transformed_end;
      maxsimboundaries = boundaries;
      maxlenboundaries = boundaries;
    }
  }
}

// Assembly:
subq $0x58, %rsp
movb %dl, %al
movb %sil, %cl
movq %rdi, 0x50(%rsp)
andb $0x1, %cl
movb %cl, 0x4f(%rsp)
andb $0x1, %al
movb %al, 0x4e(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
cmpq $0x0, 0x50(%rsp)
jne 0x1f231d
movq 0x449cb4(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x323d1d(%rip), %rsi    # 0x516013
leaq 0x377208(%rip), %rdx    # 0x569505
leaq 0x377216(%rip), %rcx    # 0x56951a
leaq 0x376f24(%rip), %r8     # 0x56922f
movl $0xe3, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1f231f
movq 0x50(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x1f232f
jmp 0x1f25c9
jmp 0x1f2331
movq 0x50(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x1f2374
movq 0x449c5d(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x323cc6(%rip), %rsi    # 0x516013
leaq 0x3771dd(%rip), %rdx    # 0x569531
leaq 0x3771bf(%rip), %rcx    # 0x56951a
leaq 0x376ecd(%rip), %r8     # 0x56922f
movl $0xe7, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1f2376
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movq %rax, 0x28(%rsp)
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rax
movq 0x48(%rax), %rax
movq %rax, 0x18(%rsp)
movq $0x1, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x50(%rsp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x1f25c9
movq 0x50(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
testb $0x1, 0x30(%rax)
je 0x1f23ec
jmp 0x1f25b6
movq 0x38(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x1f2bf0
testb $0x1, %al
jne 0x1f2404
jmp 0x1f257a
jmp 0x1f2406
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jbe 0x1f244e
movq 0x449b83(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x323bec(%rip), %rsi    # 0x516013
leaq 0x377126(%rip), %rdx    # 0x569554
leaq 0x3770e5(%rip), %rcx    # 0x56951a
leaq 0x376df3(%rip), %r8     # 0x56922f
movl $0xf2, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1f2450
movq 0x38(%rsp), %rax
movq 0x48(%rax), %rax
cmpq 0x18(%rsp), %rax
jbe 0x1f2470
movq 0x38(%rsp), %rax
movq 0x48(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x1f247a
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x18(%rsp)
testb $0x1, 0x4f(%rsp)
je 0x1f24a2
movq 0x30(%rsp), %rax
movb $0x1, 0x30(%rax)
movq 0x38(%rsp), %rax
movb $0x1, 0x30(%rax)
jmp 0x1f2578
testb $0x1, 0x4e(%rsp)
je 0x1f2537
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x20(%rax), %rax
subq %rcx, %rax
movq %rax, %xmm0
movaps 0x326467(%rip), %xmm3   # 0x518930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x32646b(%rip), %xmm2   # 0x518940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x20(%rax), %rax
subq %rcx, %rax
movq %rax, %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
callq 0xec2f0
testb $0x1, %al
jne 0x1f2517
jmp 0x1f252c
movq 0x20(%rsp), %rax
movb $0x1, 0x30(%rax)
movq 0x38(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x1f2535
movq 0x38(%rsp), %rax
movb $0x1, 0x30(%rax)
jmp 0x1f2576
movq 0x28(%rsp), %rax
movsd 0x28(%rax), %xmm0
movq 0x38(%rsp), %rax
movsd 0x28(%rax), %xmm1
callq 0xec2f0
testb $0x1, %al
jne 0x1f2556
jmp 0x1f256b
movq 0x28(%rsp), %rax
movb $0x1, 0x30(%rax)
movq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0x1f2574
movq 0x38(%rsp), %rax
movb $0x1, 0x30(%rax)
jmp 0x1f2576
jmp 0x1f2578
jmp 0x1f25b4
movq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq 0x48(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x1f25b6
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x1f23b2
addq $0x58, %rsp
retq
nop