// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b01e
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 0x1b025
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 0xd9e0
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x20(%rsp)
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x1aff9
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x1b004
movq %rbx, %rdi
movq %r14, %rdx
callq 0x3479e
movsd (%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rsp)
decl %r12d
cmpl %r12d, %r15d
jne 0x1afbf
jmp 0x1b02e
xorl %ebx, %ebx
jmp 0x1b1dc
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 0x1b1c5
movsd 0x18(%rsp), %xmm0
divsd (%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movslq %ebp, %rax
movq %rax, (%rsp)
xorl %r14d, %r14d
movq 0x5df2f(%rip), %r15     # 0x78f98
xorl %ebp, %ebp
xorl %ebx, %ebx
leaq 0xede0(%rip), %rdi      # 0x29e54
callq 0x29d5e
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 0x2e936(%rip), %rsi     # 0x499e6
callq 0xd620
movsd 0x10(%rsp), %xmm1
mulsd 0x18(%rsp), %xmm1
movsd 0x2df97(%rip), %xmm0    # 0x49060
minsd %xmm1, %xmm0
mulsd 0x2df83(%rip), %xmm0    # 0x49058
movq %r15, %rdi
callq 0xd910
movl $0x10, %edx
movq %rax, %rdi
leaq 0x2e915(%rip), %rsi     # 0x49a01
callq 0xd620
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq 0x68(%rsp), %rcx
movl 0x2c(%rsp), %r8d
callq 0x1a48c
movl %eax, %r12d
movl $0x7, %edx
movq %r15, %rdi
leaq 0x2e8f1(%rip), %rsi     # 0x49a12
callq 0xd620
movq %r15, %rdi
movl %r12d, %esi
callq 0xd9a0
movq %rax, %r13
movl $0xa, %edx
movq %rax, %rdi
leaq 0x2e8d7(%rip), %rsi     # 0x49a1a
callq 0xd620
leaq 0xed05(%rip), %rdi      # 0x29e54
callq 0x29d5e
movq %rax, 0x70(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x223a0
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
imulq %rcx
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x7, %rdx
addq %rdx, %rsi
movq %r13, %rdi
callq 0xd4c0
movl $0x3, %edx
movq %rax, %rdi
leaq 0x2e745(%rip), %rsi     # 0x498df
callq 0xd620
addl %r12d, %ebx
testl %r12d, %r12d
je 0x1b1c5
movl 0xc(%rsp), %ecx
cmpl $-0x1, %ecx
setne %al
incq %rbp
cmpl %ecx, %ebp
setge %cl
addq $0x8, %r14
testb %cl, %al
je 0x1b06d
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1b1dc
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xd550
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1b1f5
jmp 0x1b1f5
jmp 0x1b1f5
jmp 0x1b1f5
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1b20f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xd550
movq %rbx, %rdi
callq 0xd9c0