// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/globalchaining.c
// Function: globalchaining_generic
static void globalchaining_generic(bool maxscore_chains,
                                   GtUword max_gap_width,
                                   GtFragment *fragments,
                                   GtUword num_of_fragments,
                                   GtUword seqlen1, double mincoverage,
                                   GtChainProc chainprocessor, void *cpinfo)
{
  Overlapinfo *overlapinfo = NULL;
  GtChaininfo *chaininfo;
  GtChain *chain;
  chain = gt_chain_new();
  chaininfo = gt_malloc(sizeof (GtChaininfo) * num_of_fragments);
  if (gt_log_enabled())
    log_fragments(fragments, num_of_fragments);
  if (num_of_fragments > 1UL) {
    /* compute chains */
    if (!maxscore_chains) {
      overlapinfo = gt_malloc(sizeof (Overlapinfo) * num_of_fragments);
      initoverlapinfo(overlapinfo, fragments, num_of_fragments);
    }
    bruteforcechainingscores(chaininfo, max_gap_width, fragments,
                             num_of_fragments, overlapinfo);
    if (maxscore_chains) {
      findmaximalscores(chain, chaininfo, fragments, num_of_fragments,
                        max_gap_width, chainprocessor, cpinfo);
    }
    else {
      findmaximalscores_withoverlaps(chain, chaininfo, fragments,
                                     num_of_fragments, max_gap_width, seqlen1,
                                     mincoverage, chainprocessor, cpinfo,
                                     overlapinfo);
      gt_free(overlapinfo);
    }
  }
  else {
    chainingboundarycases(chain, fragments, num_of_fragments);
    if (maxscore_chains ||
        ((double) GETSTOREDLENGTH(1, 0) / (double) seqlen1) >= mincoverage) {
      chainprocessor(chain, fragments, num_of_fragments, max_gap_width, cpinfo);
    }
  }
  gt_free(chaininfo);
  gt_chain_delete(chain);
}

// Assembly:
subq $0x68, %rsp
movb %dil, %al
movq 0x70(%rsp), %rdi
andb $0x1, %al
movb %al, 0x67(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq %r8, 0x40(%rsp)
movsd %xmm0, 0x38(%rsp)
movq %r9, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
callq 0x48b6f0
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rdi
shlq $0x4, %rdi
leaq 0x121c12(%rip), %rsi    # 0x5b3316
movl $0x198, %edx            # imm = 0x198
callq 0xe80f0
movq %rax, 0x20(%rsp)
callq 0xe7720
testb $0x1, %al
jne 0x49171e
jmp 0x49172d
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x4919b0
cmpq $0x1, 0x48(%rsp)
jbe 0x491827
testb $0x1, 0x67(%rsp)
jne 0x491773
movq 0x48(%rsp), %rdi
shlq $0x5, %rdi
leaq 0x121bc6(%rip), %rsi    # 0x5b3316
movl $0x19e, %edx            # imm = 0x19E
callq 0xe80f0
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x491a90
movq 0x20(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq 0x28(%rsp), %r8
callq 0x491b50
testb $0x1, 0x67(%rsp)
je 0x4917c6
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %r8
movq 0x30(%rsp), %r9
movq 0x70(%rsp), %rax
movq %rax, (%rsp)
callq 0x491ea0
jmp 0x491822
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %r8
movq 0x40(%rsp), %r9
movsd 0x38(%rsp), %xmm0
movq 0x30(%rsp), %r11
movq 0x70(%rsp), %r10
movq 0x28(%rsp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x491f30
movq 0x28(%rsp), %rdi
leaq 0x121afe(%rip), %rsi    # 0x5b3316
movl $0x1ac, %edx            # imm = 0x1AC
callq 0xe88c0
jmp 0x4918bf
movq 0x18(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x4922f0
testb $0x1, 0x67(%rsp)
jne 0x49189d
movq 0x50(%rsp), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
subq %rcx, %rax
movq %rax, %xmm0
movaps 0x870d3(%rip), %xmm3    # 0x518930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x870d7(%rip), %xmm2    # 0x518940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x40(%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 0x38(%rsp), %xmm0
jb 0x4918bd
movq 0x30(%rsp), %rax
movq 0x18(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x58(%rsp), %rcx
movq 0x70(%rsp), %r8
callq *%rax
jmp 0x4918bf
movq 0x20(%rsp), %rdi
leaq 0x121a4b(%rip), %rsi    # 0x5b3316
movl $0x1b6, %edx            # imm = 0x1B6
callq 0xe88c0
movq 0x18(%rsp), %rdi
callq 0x48bad0
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)