// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r9, 0x58(%rsp)
movsd %xmm0, 0x48(%rsp)
movq %r8, 0x68(%rsp)
movq %rcx, %rbx
movq %rdx, 0x10(%rsp)
movq %rsi, 0x28(%rsp)
movl %edi, 0x24(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x50(%rsp)
callq 0x3058f8
movq %rax, 0x30(%rsp)
movq %rbx, 0x8(%rsp)
shlq $0x4, %rbx
leaq 0xded2a(%rip), %rsi     # 0x3e760a
movq %rbx, %rdi
movl $0x198, %edx            # imm = 0x198
callq 0x1092b2
movq %rax, 0x18(%rsp)
callq 0x108df6
testb %al, %al
je 0x308970
leaq 0xded26(%rip), %rdi     # 0x3e7628
xorl %eax, %eax
callq 0x108e02
cmpq $0x0, 0x8(%rsp)
je 0x308970
movq 0x10(%rsp), %rax
leaq 0x20(%rax), %r15
leaq 0xded1f(%rip), %rbx     # 0x3e7640
xorl %r14d, %r14d
movq -0x20(%r15), %rdx
movq -0x18(%r15), %rcx
movq %rcx, %r8
subq %rdx, %r8
incq %r8
movq -0x10(%r15), %r9
movq -0x8(%r15), %r10
movq %r10, %r11
subq %r9, %r11
incq %r11
subq $0x8, %rsp
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
pushq (%r15)
pushq %r11
pushq %r10
callq 0x108e02
addq $0x20, %rsp
incq %r14
addq $0x30, %r15
cmpq %r14, 0x8(%rsp)
jne 0x308924
cmpq $0x2, 0x8(%rsp)
jb 0x308991
cmpb $0x0, 0x24(%rsp)
je 0x308a49
movq $0x0, 0x38(%rsp)
jmp 0x308aa5
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x305929
cmpq $0x0, 0x8(%rsp)
je 0x3089c1
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rsi
movq %rbx, %rdi
callq 0x305954
movq %rbx, %rdi
xorl %esi, %esi
callq 0x305964
cmpb $0x0, 0x24(%rsp)
jne 0x308a27
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
movq %rax, %xmm0
movq 0x47eff(%rip), %xmm1    # 0x3508e0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x47f03(%rip), %xmm2    # 0x3508f0
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movq 0x68(%rsp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm3
ucomisd 0x48(%rsp), %xmm3
jb 0x308faf
movq 0x30(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x50(%rsp), %r8
callq *0x58(%rsp)
jmp 0x308faf
movq 0x8(%rsp), %rdi
shlq $0x5, %rdi
leaq 0xdebb1(%rip), %rsi     # 0x3e760a
movl $0x19e, %edx            # imm = 0x19E
callq 0x1092b2
movq %rax, %rcx
movq 0x10(%rsp), %rax
addq $0x8, %rax
movq %rcx, 0x38(%rsp)
addq $0x18, %rcx
xorl %edx, %edx
movb $0x1, -0x18(%rcx)
movq %rdx, -0x10(%rcx)
movq (%rax), %rsi
subq -0x8(%rax), %rsi
movq %rsi, -0x8(%rcx)
movq 0x8(%rsp), %rsi
movq %rsi, (%rcx)
incq %rdx
addq $0x30, %rax
addq $0x20, %rcx
cmpq %rdx, %rsi
jne 0x308a7a
movq 0x28(%rsp), %r8
movq 0x18(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rax, (%rcx)
movq 0x10(%rsp), %rdx
movq 0x20(%rdx), %rax
leaq 0x8(%rcx), %rsi
movq %rsi, 0x90(%rsp)
movq %rax, 0x8(%rcx)
leaq 0x18(%rdx), %rax
movq %rax, 0x88(%rsp)
movl $0x1, %ebx
movq $0x0, 0x60(%rsp)
movq $0x0, 0x40(%rsp)
leaq (%rbx,%rbx,2), %rax
shlq $0x4, %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax), %r14
movq 0x20(%rcx,%rax), %rdi
xorl %r9d, %r9d
movq 0x88(%rsp), %r12
movq 0x90(%rsp), %r13
xorl %r15d, %r15d
movq %rdi, 0x98(%rsp)
testq %r8, %r8
je 0x308b64
movq (%r14), %rax
movq -0x10(%r12), %rcx
cmpq %rcx, %rax
jbe 0x308b48
notq %rcx
addq %rcx, %rax
cmpq %r8, %rax
ja 0x308c36
movq 0x10(%r14), %rax
movq (%r12), %rcx
cmpq %rcx, %rax
jbe 0x308b64
notq %rcx
addq %rcx, %rax
cmpq %r8, %rax
ja 0x308c36
movq (%r14), %rax
cmpq %rax, -0x18(%r12)
jae 0x308c36
movq -0x10(%r12), %rdx
cmpq 0x8(%r14), %rdx
jae 0x308c36
movq 0x10(%r14), %rcx
cmpq %rcx, -0x8(%r12)
jae 0x308c36
movq (%r12), %rsi
cmpq 0x18(%r14), %rsi
jae 0x308c36
movq (%r13), %r8
movq %r8, 0xa0(%rsp)
subq %rax, %rdx
leaq 0x1(%rdx), %rax
movl $0x0, %edx
cmovbq %rdx, %rax
subq %rcx, %rsi
leaq 0x1(%rsi), %rbp
cmovbq %rdx, %rbp
addq %rax, %rbp
leaq 0xdeaad(%rip), %rdi     # 0x3e767c
movq %r15, %rsi
movq %rbx, %rdx
movq %rbp, %rcx
xorl %eax, %eax
movq %r9, 0x70(%rsp)
callq 0x108e02
movq 0xa0(%rsp), %rcx
movq 0x70(%rsp), %r9
movq 0x98(%rsp), %rdi
movq 0x28(%rsp), %r8
subq %rbp, %rcx
testq %rcx, %rcx
movl $0x0, %eax
cmovgq %rcx, %rax
addq %rdi, %rax
testb $0x1, %r9b
je 0x308c1d
cmpq %rax, 0x60(%rsp)
jge 0x308c36
testq %rcx, %rcx
movq 0x8(%rsp), %rcx
cmovgq %r15, %rcx
movq %rcx, 0x40(%rsp)
movb $0x1, %r9b
movq %rax, 0x60(%rsp)
incq %r15
addq $0x10, %r13
addq $0x30, %r12
cmpq %r15, %rbx
jne 0x308b27
movq %rbx, %rax
shlq $0x4, %rax
addq 0x18(%rsp), %rax
testb $0x1, %r9b
je 0x308ce2
movq 0x40(%rsp), %rcx
movq %rcx, (%rax)
movq 0x60(%rsp), %rcx
movq %rcx, 0x8(%rax)
cmpq $0x0, 0x38(%rsp)
je 0x308cee
movq 0x8(%rsp), %rax
cmpq %rax, 0x40(%rsp)
je 0x308cee
movq 0x40(%rsp), %rsi
movq %rsi, %rax
shlq $0x5, %rax
movq 0x38(%rsp), %r9
movb $0x0, (%r9,%rax)
movq 0x8(%r9,%rax), %rcx
movq %rbx, %rdx
shlq $0x5, %rdx
movq %rcx, 0x8(%r9,%rdx)
movq (%r14), %rcx
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
movq 0x10(%rsp), %rdi
movq 0x8(%rdi,%rsi), %rsi
movq %rsi, %rdi
notq %rdi
addq %rcx, %rdi
cmpq %rsi, %rcx
movl $0x0, %ecx
cmovbeq %rdi, %rcx
addq 0x10(%r9,%rax), %rcx
addq %rcx, 0x10(%r9,%rdx)
jmp 0x308cee
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
movq %rdi, 0x8(%rax)
incq %rbx
cmpq 0x8(%rsp), %rbx
jne 0x308af3
cmpb $0x0, 0x24(%rsp)
je 0x308ddf
movq 0x8(%rsp), %rax
leaq -0x1(%rax), %r14
movq 0x18(%rsp), %rax
addq $0x8, %rax
xorl %r15d, %r15d
xorl %edx, %edx
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x308d34
cmpq 0x8(%rax), %rcx
jne 0x308d34
movq 0x10(%rax), %rsi
cmpq (%rax), %rsi
jge 0x308d43
testb $0x1, %dl
je 0x308d3e
cmpq (%rax), %r15
jge 0x308d43
movq (%rax), %r15
movb $0x1, %dl
incq %rcx
addq $0x10, %rax
cmpq %rcx, 0x8(%rsp)
jne 0x308d20
testb $0x1, %dl
je 0x308faf
movq 0x18(%rsp), %r12
addq $0x8, %r12
xorl %ebx, %ebx
movq 0x30(%rsp), %r13
movq 0x8(%rsp), %rbp
cmpq %rbx, %r14
je 0x308d86
cmpq 0x8(%r12), %rbx
jne 0x308d86
movq 0x10(%r12), %rax
cmpq (%r12), %rax
jge 0x308dcc
cmpq %r15, (%r12)
jl 0x308dcc
movq %r13, %rdi
callq 0x305929
movq (%r12), %rsi
movq %r13, %rdi
callq 0x305954
movq %r13, %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x30902f
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
movq 0x28(%rsp), %rcx
movq 0x50(%rsp), %r8
callq *0x58(%rsp)
incq %rbx
addq $0x10, %r12
cmpq %rbx, 0x8(%rsp)
jne 0x308d6f
jmp 0x308faf
movq 0x68(%rsp), %rbx
cmpq $-0x1, %rbx
je 0x308fe5
movsd 0x48(%rsp), %xmm0
ucomisd 0x47f14(%rip), %xmm0    # 0x350d10
jne 0x308e04
jnp 0x308fea
movl $0x8, %edi
callq 0xd46fc
movq %rbx, %xmm0
punpckldq 0x47ac5(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x47acd(%rip), %xmm0    # 0x3508f0
movq %rax, %rbp
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
movq 0x38(%rsp), %rbx
leaq 0x8(%rbx), %r15
xorl %r14d, %r14d
movq 0x47a9a(%rip), %xmm3    # 0x3508e0
movapd 0x47aa2(%rip), %xmm4    # 0x3508f0
movapd %xmm2, 0x70(%rsp)
cmpb $0x1, -0x8(%r15)
jne 0x308eda
movq (%r15), %rax
movq 0x8(%r15), %rcx
shlq $0x5, %rax
addq %rbx, %rax
addq $0x18, %rax
movq (%rax), %rdx
cmpq 0x8(%rsp), %rdx
jne 0x308ecc
movq %rcx, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm4, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm2, %xmm1
ucomisd 0x48(%rsp), %xmm1
jb 0x308eda
movq %r14, (%rax)
movl $0x8, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0xd49ce
movapd 0x47a39(%rip), %xmm4    # 0x3508f0
movq 0x47a21(%rip), %xmm3    # 0x3508e0
movapd 0x70(%rsp), %xmm2
movq 0x38(%rsp), %rbx
jmp 0x308eda
shlq $0x5, %rdx
cmpq 0x10(%rbx,%rdx), %rcx
jbe 0x308eda
movq %r14, (%rax)
incq %r14
addq $0x20, %r15
cmpq %r14, 0x8(%rsp)
jne 0x308e54
movq %rbp, %rdi
callq 0xd4a9a
testq %rax, %rax
je 0x308f93
xorl %r15d, %r15d
movq 0x30(%rsp), %r12
movq 0x18(%rsp), %r13
movq %rbp, %rdi
movq %r15, %rsi
callq 0xd47ba
movq (%rax), %rax
shlq $0x5, %rax
movq 0x8(%rsp), %rcx
cmpq %rcx, 0x18(%rbx,%rax)
je 0x308fe0
leaq (%rbx,%rax), %r14
addq $0x18, %r14
movq %r12, %rdi
callq 0x305929
movq (%r14), %rax
shlq $0x4, %rax
movq 0x8(%r13,%rax), %rsi
movq %r12, %rdi
callq 0x305954
movq (%r14), %rcx
movq %r12, %rdi
movq %r13, %rsi
movq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x30902f
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
movq 0x28(%rsp), %rcx
movq 0x50(%rsp), %r8
callq *0x58(%rsp)
incq %r15
movq %rbp, %rdi
callq 0xd4a9a
cmpq %rax, %r15
jb 0x308f0a
movq %rbp, %rdi
callq 0xd4ef4
leaq 0xde668(%rip), %rsi     # 0x3e760a
movq %rbx, %rdi
movl $0x1ac, %edx            # imm = 0x1AC
callq 0x109670
leaq 0xde654(%rip), %rsi     # 0x3e760a
movq 0x18(%rsp), %rdi
movl $0x1b6, %edx            # imm = 0x1B6
callq 0x109670
movq 0x30(%rsp), %rdi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x305a10
callq 0x8dae0
callq 0x8db19
callq 0x8daa7