// File: /workspace/github_cpp_makefile_star2_O2/Kingsford-Group[P]ghost2/src/alignmentExtender.hpp
// Function: extendAlignment(D_alpha, Graph&, Graph&, 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>*, std::vector<D_alpha, std::allocator<D_alpha>>&, 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)
void extendAlignment(D_alpha seed, Graph& g1, Graph& g2, bmap *alignment, vector<D_alpha>& dalphas, distmap& d, int k)
{
  vector<D_alpha> maxP;
  maxP.push_back(seed);

  while(!maxP.empty()){
    D_alpha best = maxP.front();
    pop_heap(maxP.begin(), maxP.end(), CompareD_alphaL());
    maxP.pop_back();
    insertIfBetter(alignment, best, d);
    
    vlist *neighbors1 = g1.neighbors2(best.get_n1());
    vlist *neighbors2 = g2.neighbors2(best.get_n2());

    vector<D_alpha> matches = computePairwiseScores(neighbors1, neighbors2, *alignment, d, k);
    if(matches.size() == 0) continue;

    //Do the alignment problem
    matches = performMatching(matches);
    //Filter out matches that are already aligned or have D_seq>beta
    auto end = remove_if(matches.begin(), matches.end(), checkSeq);

    for(auto it = matches.begin(); it != end; ++it){
      alignment->insert(bmap::value_type(it->get_n1(), it->get_n2()));
      maxP.push_back(*it);
      push_heap(maxP.begin(), maxP.end(), CompareD_alphaL());
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %r9, 0x18(%rsp)
movq %rcx, %r14
movq %rdx, 0x38(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdi, %rsi
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0x19cbc
leaq 0x118(%rsp), %r15
leaq 0xd8(%rsp), %r12
leaq 0xb8(%rsp), %r13
movq (%rsp), %rsi
cmpq 0x8(%rsp), %rsi
je 0x15f75
leaq 0x68(%rsp), %rdi
callq 0x19f6e
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1a1d0
leaq 0x158(%rsp), %rbx
movq 0x8(%rsp), %rdi
addq $-0x50, %rdi
movq %rdi, 0x8(%rsp)
callq 0x19ce8
movq %rbx, %rdi
leaq 0x68(%rsp), %rsi
callq 0x19f6e
movq %r14, %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rdx
callq 0x15311
movq %rbx, %rdi
callq 0x19ce8
leaq 0xf8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x68(%rsp), %rsi
callq 0xe7a0
movq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0x1b558
movq %rax, %rbx
movq %rbp, %rdi
callq 0xe290
leaq 0x48(%rsp), %rbp
movq %rbp, %rdi
leaq 0x88(%rsp), %rsi
callq 0xe7a0
movq 0x38(%rsp), %rdi
movq %rbp, %rsi
callq 0x1b558
movq %rax, %rbp
addq $0x30, %rbx
addq $0x30, %rbp
leaq 0x48(%rsp), %rdi
callq 0xe290
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq 0x18(%rsp), %r8
movl 0x1e0(%rsp), %r9d
callq 0x155bc
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0x15f5c
movq %r15, %rdi
leaq 0x20(%rsp), %rbx
movq %rbx, %rsi
callq 0x15847
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3da8e
movq %r15, %rdi
callq 0x19cfe
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
leaq -0x191(%rip), %rdx      # 0x15d46
callq 0x3dadf
movq %rax, %rbp
movq 0x20(%rsp), %rbx
cmpq %rbp, %rbx
je 0x15f5c
movq %r12, %rdi
movq %rbx, %rsi
callq 0xe7a0
addq $0x20, %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0xe7a0
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3c3b8
movq 0x8(%r14), %rdi
addq $-0x10, %rdi
movq %r15, %rsi
callq 0x3c3ee
movq %r15, %rdi
callq 0x1a11c
movq %r13, %rdi
callq 0xe290
movq %r12, %rdi
callq 0xe290
addq $-0x20, %rbx
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x19cbc
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1a132
addq $0x50, %rbx
jmp 0x15ee4
leaq 0x20(%rsp), %rdi
callq 0x19cfe
leaq 0x68(%rsp), %rdi
callq 0x19ce8
jmp 0x15da8
movq %rsp, %rdi
callq 0x19cfe
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x15f95
jmp 0x1600e
jmp 0x1600e
movq %rax, %rbx
jmp 0x16025
jmp 0x15fd1
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
callq 0x19ce8
jmp 0x1601b
jmp 0x15fd1
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
jmp 0x15fca
jmp 0x15fd1
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xe290
jmp 0x1601b
movq %rax, %rbx
jmp 0x1601b
movq %rax, %rbx
jmp 0x15feb
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x1a11c
leaq 0xb8(%rsp), %rdi
callq 0xe290
jmp 0x15fff
jmp 0x1600e
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0xe290
jmp 0x16011
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x19cfe
leaq 0x68(%rsp), %rdi
callq 0x19ce8
movq %rsp, %rdi
callq 0x19cfe
movq %rbx, %rdi
callq 0xe9f0