// File: EduBic[P]TSP-MetaheuristicSolvers/solversexecutor.cpp
// Function: SolversExecutor::executeAndMeasureTime(Solver&, TSPSolution&, TSPSolution&)
void SolversExecutor::executeAndMeasureTime(Solver& tspSolver, TSPSolution& initSol, TSPSolution& bestSol) {

    bestSol.solveBy = tspSolver.getSolverName();

    std::string tmp = "-----------------------------";
    std::cout << std::endl << tmp << tspSolver.getSolverName() << tmp << std::endl << std::endl;

    // initialize clocks for running time recording
    //   two ways:
    //   1) CPU time (t2 - t1)
    //   2) wall-clock time (tv2 - tv1)
    clock_t startClock, finishClock;
    timeval  tv1, tv2;

    startClock = clock();
    gettimeofday(&tv1, NULL);

    tspSolver.solve(mTspInstance, initSol, bestSol);

    finishClock = clock();
    gettimeofday(&tv2, NULL);

    bestSol.userTime = (double)(tv2.tv_sec+tv2.tv_usec*1e-6 - (tv1.tv_sec+tv1.tv_usec*1e-6));
    bestSol.cpuTime = (double)(finishClock - startClock) / CLOCKS_PER_SEC;
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movq %rdx, 0xf0(%rsp)
movq %rcx, 0xe8(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xf8(%rsp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq 0xc8(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq *%rax
movq 0x30(%rsp), %rsi
movq 0xe8(%rsp), %rdi
addq $0x18, %rdi
callq 0x32f0
movq 0x30(%rsp), %rdi
callq 0x31b0
leaq 0xa7(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x3430
movq 0x38(%rsp), %rdx
leaq 0x9a66(%rip), %rsi      # 0xe185
leaq 0xa8(%rsp), %rdi
callq 0x3320
jmp 0x472e
leaq 0xa7(%rsp), %rdi
callq 0x32c0
movq 0xf88e(%rip), %rdi      # 0x13fd0
movq 0xf867(%rip), %rsi      # 0x13fb0
callq 0x32b0
movq %rax, 0x20(%rsp)
jmp 0x4755
movq 0x20(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3240
movq %rax, 0x18(%rsp)
jmp 0x476e
movq 0xf8(%rsp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq 0x70(%rsp), %rdi
callq *%rax
jmp 0x4785
movq 0x18(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x3240
movq %rax, 0x10(%rsp)
jmp 0x479b
movq 0x10(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3240
movq %rax, 0x8(%rsp)
jmp 0x47b4
movq 0x8(%rsp), %rdi
movq 0xf7f0(%rip), %rsi      # 0x13fb0
callq 0x32b0
movq %rax, (%rsp)
jmp 0x47cb
movq (%rsp), %rdi
movq 0xf7da(%rip), %rsi      # 0x13fb0
callq 0x32b0
jmp 0x47dd
leaq 0x70(%rsp), %rdi
callq 0x31b0
callq 0x31c0
movq %rax, 0x68(%rsp)
xorl %eax, %eax
movl %eax, %esi
leaq 0x50(%rsp), %rdi
callq 0x33a0
movq 0x28(%rsp), %rsi
movq 0xf8(%rsp), %rdi
addq $0x8, %rsi
movq 0xf0(%rsp), %rdx
movq 0xe8(%rsp), %rcx
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
jmp 0x482b
callq 0x31c0
movq %rax, 0x60(%rsp)
leaq 0x40(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x33a0
cvtsi2sdq 0x40(%rsp), %xmm1
cvtsi2sdq 0x48(%rsp), %xmm0
movsd 0x97c7(%rip), %xmm2     # 0xe020
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsi2sdq 0x50(%rsp), %xmm2
cvtsi2sdq 0x58(%rsp), %xmm1
movsd 0x97a9(%rip), %xmm3     # 0xe020
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movq 0xe8(%rsp), %rax
movsd %xmm0, 0x38(%rax)
movq 0x60(%rsp), %rax
subq 0x68(%rsp), %rax
cvtsi2sd %rax, %xmm0
movsd 0x9771(%rip), %xmm1     # 0xe018
divsd %xmm1, %xmm0
movq 0xe8(%rsp), %rax
movsd %xmm0, 0x40(%rax)
leaq 0xa8(%rsp), %rdi
callq 0x31b0
addq $0x108, %rsp            # imm = 0x108
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
leaq 0xa7(%rsp), %rdi
callq 0x32c0
jmp 0x4931
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
jmp 0x4924
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x31b0
leaq 0xa8(%rsp), %rdi
callq 0x31b0
movq 0x98(%rsp), %rdi
callq 0x3420
nop