// File: /workspace/github_cpp_makefile_star2_O3/Kingsford-Group[P]ghost2/src/localImprove.hpp
// Function: localImprove(Graph&, Graph&, 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>>>, double, 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, double>>>*, 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>*, int, double, int)
int localImprove(Graph& G, Graph& H, blastmap *dists, bmap *f, int iters, double ratio, int numP)
{
  if(iters == 0) return 0;
  vector<double> ratios;
  double sum = 0;
  int ri = iters;
  if(iters == -1) ri = 10;
  for(int i=0; i < ri; i++){
    double d = exp(-i);
    sum += d;
    ratios.push_back(d);
  }
  sum = ratio/sum;
  int totalDelt = 0;
  for(int i=0; i < iters || iters == -1; i++){
    ptime t = bclock::local_time();
    double unconstrained;
    if(i < ri) unconstrained = ratios[i] * sum;
    else unconstrained = ratios[ri-1] * sum;
    if(unconstrained > 1) unconstrained = 1;
    cout << "running PISWAP iteration, " << (unconstrained * 100) << "\% unconstrained\n";
    int d = searchIter(G, H, dists, f, unconstrained, numP);
    cout << "\nadded " << d << " edges in " << (bclock::local_time() - t).total_milliseconds() << "ms\n";
    totalDelt += d;
    if(d == 0) break;
  }
  return totalDelt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r9d, 0x2c(%rsp)
movsd %xmm0, 0x18(%rsp)
movq %rcx, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdi, 0x50(%rsp)
testl %r8d, %r8d
je 0x19d0f
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
cmpl $-0x1, %r8d
movl $0xa, %ebp
movl %r8d, 0xc(%rsp)
cmovnel %r8d, %ebp
testl %ebp, %ebp
jle 0x19d16
movl %ebp, %r15d
negl %r15d
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
xorl %r12d, %r12d
leaq 0x30(%rsp), %rbx
leaq 0x20(%rsp), %r14
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
callq 0xc9e0
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x20(%rsp)
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x19cea
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x19cf5
movq %rbx, %rdi
movq %r14, %rdx
callq 0x3365e
movsd (%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rsp)
decl %r12d
cmpl %r12d, %r15d
jne 0x19cb0
jmp 0x19d1f
xorl %ebx, %ebx
jmp 0x19ecd
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movl 0xc(%rsp), %ecx
cmpl $-0x1, %ecx
setne %al
testl %ecx, %ecx
setle %cl
xorl %ebx, %ebx
testb %cl, %al
jne 0x19eb6
movsd 0x18(%rsp), %xmm0
divsd (%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movslq %ebp, %rax
movq %rax, (%rsp)
xorl %r14d, %r14d
movq 0x5e23e(%rip), %r15     # 0x77f98
xorl %ebp, %ebp
xorl %ebx, %ebx
leaq 0xebb7(%rip), %rdi      # 0x2891c
callq 0x28826
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
leaq (%rax,%r14), %rcx
movq (%rsp), %rdx
cmpq %rdx, %rbp
leaq -0x8(%rax,%rdx,8), %rax
cmovlq %rcx, %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0x1a, %edx
movq %r15, %rdi
leaq 0x2ec75(%rip), %rsi     # 0x48a16
callq 0xc620
movsd 0x10(%rsp), %xmm1
mulsd 0x18(%rsp), %xmm1
movsd 0x2e2a6(%rip), %xmm0    # 0x48060
minsd %xmm1, %xmm0
mulsd 0x2e292(%rip), %xmm0    # 0x48058
movq %r15, %rdi
callq 0xc910
movl $0x10, %edx
movq %rax, %rdi
leaq 0x2ec54(%rip), %rsi     # 0x48a31
callq 0xc620
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq 0x68(%rsp), %rcx
movl 0x2c(%rsp), %r8d
callq 0x19200
movl %eax, %r12d
movl $0x7, %edx
movq %r15, %rdi
leaq 0x2ec30(%rip), %rsi     # 0x48a42
callq 0xc620
movq %r15, %rdi
movl %r12d, %esi
callq 0xc9a0
movq %rax, %r13
movl $0xa, %edx
movq %rax, %rdi
leaq 0x2ec16(%rip), %rsi     # 0x48a4a
callq 0xc620
leaq 0xeadc(%rip), %rdi      # 0x2891c
callq 0x28826
movq %rax, 0x70(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x20fc4
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
imulq %rcx
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x7, %rdx
addq %rdx, %rsi
movq %r13, %rdi
callq 0xc4c0
movl $0x3, %edx
movq %rax, %rdi
leaq 0x2ea84(%rip), %rsi     # 0x4890f
callq 0xc620
addl %r12d, %ebx
testl %r12d, %r12d
je 0x19eb6
movl 0xc(%rsp), %ecx
cmpl $-0x1, %ecx
setne %al
incq %rbp
cmpl %ecx, %ebp
setge %cl
addq $0x8, %r14
testb %cl, %al
je 0x19d5e
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x19ecd
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xc550
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x19ee6
jmp 0x19ee6
jmp 0x19ee6
jmp 0x19ee6
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x19f00
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xc550
movq %rbx, %rdi
callq 0xc9c0