// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/globalchaining.c
// Function: findmaximalscores_withoverlaps
static void findmaximalscores_withoverlaps(GtChain *chain,
                                           GtChaininfo *chaininfo,
                                           GtFragment *fragments,
                                           GtUword num_of_fragments,
                                           GtUword max_gap_width,
                                           GtUword seqlen1,
                                           double mincoverage,
                                           GtChainProc chainprocessor,
                                           void *cpinfo,
                                           Overlapinfo *overlapinfo)
{
  GtUword i, startfrag;
  GtArray *startfragments;

  gt_assert(seqlen1 != GT_UNDEF_UWORD);
  gt_assert(mincoverage != GT_UNDEF_DOUBLE);
  startfragments = gt_array_new(sizeof (GtUword));

  /* compute chain array */
  for (i = 0; i < num_of_fragments; i++) {
    if (overlapinfo[i].active) {
      /* current fragment is active */
      if (overlapinfo[overlapinfo[i].startofchain].chainarray ==
          UNDEFPREVIOUS) {
        if (((double) overlapinfo[i].dim1lengthofchain / (double) seqlen1) >=
            mincoverage) {
          /* no other fragment has the same start fragment yet and coverage is
             high enough -> store end fragment */
          overlapinfo[overlapinfo[i].startofchain].chainarray = i;

          /* since this is the first time, store start fragment number
             to avoid additional scan of all fragments below */
          gt_array_add(startfragments, overlapinfo[i].startofchain);
        }
      }
      else if (overlapinfo[i].dim1lengthofchain >
               overlapinfo[overlapinfo[overlapinfo[i].startofchain].chainarray]
                          .dim1lengthofchain) {
        /* coverage is higher then coverage of earlier start fragment
           -> update end fragment */
        overlapinfo[overlapinfo[i].startofchain].chainarray = i;
      }
    }
  }

  /* retrieve maximal chains */
  for (i = 0; i < gt_array_size(startfragments); i++) {
    startfrag = *(GtUword*) gt_array_get(startfragments, i);
    gt_assert(overlapinfo[startfrag].chainarray != UNDEFPREVIOUS);
    gt_chain_reset(chain);
    gt_chain_set_score(chain,
                       chaininfo[overlapinfo[startfrag].chainarray].score);
    retracepreviousinchain(chain, chaininfo, num_of_fragments,
                           overlapinfo[startfrag].chainarray);
    chainprocessor(chain, fragments, num_of_fragments, max_gap_width, cpinfo);
  }

  gt_array_delete(startfragments);
}

// Assembly:
subq $0x58, %rsp
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rax
movq 0x60(%rsp), %rax
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x30(%rsp)
movq %r9, 0x28(%rsp)
movsd %xmm0, 0x20(%rsp)
cmpq $-0x1, 0x28(%rsp)
jne 0x491fa7
movq 0x1aa02a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x84093(%rip), %rsi     # 0x516013
leaq 0x121467(%rip), %rdx    # 0x5b33ee
leaq 0x12147a(%rip), %rcx    # 0x5b3408
leaq 0x121381(%rip), %r8     # 0x5b3316
movl $0x151, %r9d            # imm = 0x151
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x491fa9
jmp 0x491fab
movsd 0x20(%rsp), %xmm0
movsd 0x86d97(%rip), %xmm1    # 0x518d50
ucomisd %xmm1, %xmm0
jne 0x491ff9
jp 0x491ff9
movq 0x1a9fd8(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x84041(%rip), %rsi     # 0x516013
leaq 0x12144e(%rip), %rdx    # 0x5b3427
leaq 0x121428(%rip), %rcx    # 0x5b3408
leaq 0x12132f(%rip), %r8     # 0x5b3316
movl $0x152, %r9d            # imm = 0x152
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x491ffb
movl $0x8, %edi
callq 0x80990
movq %rax, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x4921a7
movq 0x70(%rsp), %rax
movq 0x18(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
testb $0x1, (%rax)
je 0x492192
movq 0x70(%rsp), %rax
movq 0x70(%rsp), %rcx
movq 0x18(%rsp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
cmpq 0x38(%rsp), %rax
jne 0x492118
movq 0x70(%rsp), %rax
movq 0x18(%rsp), %rcx
shlq $0x5, %rcx
movq 0x10(%rax,%rcx), %xmm0
movaps 0x868a8(%rip), %xmm3    # 0x518930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x868ac(%rip), %xmm2    # 0x518940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x28(%rsp), %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
divsd %xmm1, %xmm0
ucomisd 0x20(%rsp), %xmm0
jb 0x492116
movq 0x18(%rsp), %rcx
movq 0x70(%rsp), %rax
movq 0x70(%rsp), %rdx
movq 0x18(%rsp), %rsi
shlq $0x5, %rsi
addq %rsi, %rdx
movq 0x8(%rdx), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movq 0x8(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0x18(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rsi
addq $0x8, %rsi
movl $0x8, %edx
callq 0x81100
jmp 0x492190
movq 0x70(%rsp), %rax
movq 0x18(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq 0x70(%rsp), %rcx
movq 0x70(%rsp), %rdx
movq 0x70(%rsp), %rsi
movq 0x18(%rsp), %rdi
shlq $0x5, %rdi
addq %rdi, %rsi
movq 0x8(%rsi), %rsi
shlq $0x5, %rsi
addq %rsi, %rdx
movq 0x18(%rdx), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq 0x10(%rcx), %rax
jbe 0x49218e
movq 0x18(%rsp), %rcx
movq 0x70(%rsp), %rax
movq 0x70(%rsp), %rdx
movq 0x18(%rsp), %rsi
shlq $0x5, %rsi
addq %rsi, %rdx
movq 0x8(%rdx), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x492190
jmp 0x492192
jmp 0x492194
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x492013
movq $0x0, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x8(%rsp), %rdi
callq 0x81370
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jae 0x4922d5
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x80b60
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x70(%rsp), %rax
movq 0x10(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
cmpq 0x38(%rsp), %rax
jne 0x49223e
movq 0x1a9d93(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x83dfc(%rip), %rsi     # 0x516013
leaq 0x121228(%rip), %rdx    # 0x5b3446
leaq 0x1211e3(%rip), %rcx    # 0x5b3408
leaq 0x1210ea(%rip), %r8     # 0x5b3316
movl $0x173, %r9d            # imm = 0x173
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x492240
movq 0x50(%rsp), %rdi
callq 0x48b730
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq 0x10(%rsp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movq 0x18(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
callq 0x48b7e0
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x70(%rsp), %rax
movq 0x10(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rcx
callq 0x492870
movq 0x60(%rsp), %rax
movq 0x50(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq 0x68(%rsp), %r8
callq *%rax
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x4921b0
movq 0x8(%rsp), %rdi
callq 0x81f80
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)