// File: Kingsford-Group[P]ghost2/src/alignmentExtender.hpp
// Function: computePairwiseScores(boost::unordered::unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, boost::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>*, boost::unordered::unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, boost::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>*, boost::bimaps::bimap<boost::bimaps::unordered_set_of<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, boost::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, boost::bimaps::unordered_set_of<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, boost::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, mpl_::na, mpl_::na, mpl_::na>&, boost::unordered::unordered_map<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, D_alpha, boost::hash<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::equal_to<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::allocator<std::pair<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>> const, D_alpha>>>&, int)
vector<D_alpha> computePairwiseScores(vlist *n1, vlist *n2, bmap& alignment, distmap& dalphas, int k)
{
  vector<D_alpha> ans;
  for(auto it1 = n1->begin(); it1 != n1->end(); ++it1){
    if(alignment.left.find(*it1) != alignment.left.end()) continue; //Skip if already aligned
    vector<D_alpha> maxheap;
    for(auto it2 = n2->begin(); it2 != n2->end(); ++it2){
      if(alignment.right.find(*it2) != alignment.right.end()) continue; //Skip if already aligned

      D_alpha d = dalphas.at(make_pair(*it1,*it2));
      //If we don't have k yet, add it
      if(maxheap.size() < k || k==-1){
        maxheap.push_back(d);
        push_heap(maxheap.begin(), maxheap.end(), CompareD_alphaL());
      //Otherwise add and trim back down to k
      } else if(d.get_da() < maxheap.front().get_da()){
        pop_heap(maxheap.begin(), maxheap.end(), CompareD_alphaL());
        maxheap.pop_back();
        maxheap.push_back(d);
        push_heap(maxheap.begin(), maxheap.end(), CompareD_alphaL());
      }
    }
    ans.reserve(ans.size()+maxheap.size());
    ans.insert(ans.end(), maxheap.begin(), maxheap.end());
  }
  return ans;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x1a8(%rbp)
movq %rdi, %rax
movq %rax, -0x1a0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movb $0x0, -0x2d(%rbp)
callq 0x27ed0
movq -0x10(%rbp), %rdi
callq 0x23730
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x23770
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x23800
testb $0x1, %al
jne 0x1d1fd
jmp 0x1d6b4
movq -0x20(%rbp), %rax
addq $0x98, %rax
movq %rax, -0x1b8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x23830
movq %rax, -0x1b0(%rbp)
jmp 0x1d220
movq -0x1b0(%rbp), %rsi
movq -0x1b8(%rbp), %rdi
callq 0x287f0
movq %rax, -0x1c0(%rbp)
jmp 0x1d23c
movq -0x1c0(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
addq $0x98, %rdi
callq 0x288f0
movq %rax, -0x1c8(%rbp)
jmp 0x1d260
movq -0x1c8(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x288b0
movb %al, -0x1c9(%rbp)
jmp 0x1d280
movb -0x1c9(%rbp), %al
testb $0x1, %al
jne 0x1d28c
jmp 0x1d2a2
jmp 0x1d699
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1d6da
leaq -0x78(%rbp), %rdi
callq 0x27ed0
movq -0x18(%rbp), %rdi
callq 0x23730
movq %rax, -0x80(%rbp)
movq -0x18(%rbp), %rdi
callq 0x23770
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x23800
testb $0x1, %al
jne 0x1d2e1
jmp 0x1d5d4
movq -0x20(%rbp), %rax
addq $0xa0, %rax
movq %rax, -0x1e0(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x23830
movq %rax, -0x1d8(%rbp)
jmp 0x1d304
movq -0x1d8(%rbp), %rsi
movq -0x1e0(%rbp), %rdi
callq 0x28a90
movq %rax, -0x1e8(%rbp)
jmp 0x1d320
movq -0x1e8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rdi
addq $0xa0, %rdi
callq 0x28d10
movq %rax, -0x1f0(%rbp)
jmp 0x1d347
movq -0x1f0(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x28f90
movb %al, -0x1f1(%rbp)
jmp 0x1d370
movb -0x1f1(%rbp), %al
testb $0x1, %al
jne 0x1d37c
jmp 0x1d392
jmp 0x1d5c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1d6a9
movq -0x28(%rbp), %rax
movq %rax, -0x208(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x23830
movq %rax, -0x200(%rbp)
jmp 0x1d3af
leaq -0x80(%rbp), %rdi
callq 0x23830
movq %rax, -0x210(%rbp)
jmp 0x1d3c1
movq -0x210(%rbp), %rdx
movq -0x200(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0x28c60
jmp 0x1d3dd
movq -0x208(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x28bd0
movq %rax, -0x218(%rbp)
jmp 0x1d3f9
movq -0x218(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x28950
jmp 0x1d40e
leaq -0x128(%rbp), %rdi
callq 0x267e0
leaq -0x78(%rbp), %rdi
callq 0x27750
movslq -0x2c(%rbp), %rcx
cmpq %rcx, %rax
jb 0x1d436
cmpl $-0x1, -0x2c(%rbp)
jne 0x1d4c6
leaq -0x78(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x27f30
jmp 0x1d448
leaq -0x78(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x275a0
movq -0x220(%rbp), %rdi
movq %rax, -0x130(%rbp)
callq 0x27610
movq %rax, -0x138(%rbp)
movq -0x130(%rbp), %rdi
movq -0x138(%rbp), %rsi
callq 0x28fd0
jmp 0x1d487
jmp 0x1d5b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x267e0
jmp 0x1d6a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x27fc0
jmp 0x1d6a9
leaq -0xe8(%rbp), %rdi
callq 0x27660
movsd %xmm0, -0x228(%rbp)
jmp 0x1d4dc
leaq -0x78(%rbp), %rdi
callq 0x290e0
movq %rax, %rdi
callq 0x27660
movsd %xmm0, -0x230(%rbp)
jmp 0x1d4f7
movsd -0x230(%rbp), %xmm0
movsd -0x228(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1d5b6
leaq -0x78(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x275a0
movq -0x238(%rbp), %rdi
movq %rax, -0x148(%rbp)
callq 0x27610
movq %rax, -0x150(%rbp)
movq -0x148(%rbp), %rdi
movq -0x150(%rbp), %rsi
callq 0x29110
jmp 0x1d550
leaq -0x78(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x29180
movq -0x240(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x27f30
jmp 0x1d575
leaq -0x78(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x275a0
movq -0x248(%rbp), %rdi
movq %rax, -0x160(%rbp)
callq 0x27610
movq %rax, -0x168(%rbp)
movq -0x160(%rbp), %rdi
movq -0x168(%rbp), %rsi
callq 0x28fd0
jmp 0x1d5b4
jmp 0x1d5b6
jmp 0x1d5b8
leaq -0xe8(%rbp), %rdi
callq 0x27fc0
leaq -0x80(%rbp), %rdi
callq 0x291b0
jmp 0x1d5cf
jmp 0x1d2b8
movq -0x1a8(%rbp), %rdi
callq 0x27750
movq %rax, -0x250(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x27750
movq -0x250(%rbp), %rsi
movq -0x1a8(%rbp), %rdi
addq %rax, %rsi
callq 0x291d0
jmp 0x1d608
movq -0x1a8(%rbp), %rdi
callq 0x27610
movq %rax, -0x180(%rbp)
leaq -0x178(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x29380
leaq -0x78(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x275a0
movq -0x260(%rbp), %rdi
movq %rax, -0x188(%rbp)
callq 0x27610
movq -0x1a8(%rbp), %rdi
movq %rax, -0x190(%rbp)
movq -0x178(%rbp), %rsi
movq -0x188(%rbp), %rdx
movq -0x190(%rbp), %rcx
callq 0x292d0
movq %rax, -0x258(%rbp)
jmp 0x1d682
movq -0x258(%rbp), %rax
movq %rax, -0x198(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x27ff0
leaq -0x38(%rbp), %rdi
callq 0x291b0
jmp 0x1d6a4
jmp 0x1d1da
leaq -0x78(%rbp), %rdi
callq 0x27ff0
jmp 0x1d6da
movb $0x1, -0x2d(%rbp)
testb $0x1, -0x2d(%rbp)
jne 0x1d6ca
movq -0x1a8(%rbp), %rdi
callq 0x27ff0
movq -0x1a0(%rbp), %rax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq -0x1a8(%rbp), %rdi
callq 0x27ff0
movq -0x50(%rbp), %rdi
callq 0x10cc0
nop