// File: /workspace/github_cpp_makefile_star2_O1/ArashPartow[P]exprtk/exprtk_benchmark.cpp
// Function: void run_exprtk_benchmark<double>(double&, double&, exprtk::expression<double>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void run_exprtk_benchmark(T& x, T& y,
                          exprtk::expression<T>& expression,
                          const std::string& expr_string)
{
   T total = T(0);
   unsigned int count = 0;

   exprtk::timer timer;
   timer.start();

   for (x = global_lower_bound_x; x <= global_upper_bound_x; x += global_delta)
   {
      for (y = global_lower_bound_y; y <= global_upper_bound_y; y += global_delta)
      {
         total += expression.value();
         ++count;
      }
   }

   timer.stop();

   if (T(0) != total)
      printf("[exprtk] Total Time:%12.8f  Rate:%14.3fevals/sec Expression: %s\n",
             timer.time(),
             count / timer.time(),
             expr_string.c_str());
   else
      printf("run_exprtk_benchmark() - Error running benchmark for expression: %s\n",expr_string.c_str());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x18(%rsp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rdi)
movupd %xmm0, (%rdi)
movb $0x1, -0x8(%rdi)
xorl %r13d, %r13d
xorl %esi, %esi
callq 0x11a280
movabsq $-0x3fa7000000000000, %rbp # imm = 0xC059000000000000
movq %rbp, (%r12)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbp, (%r15)
movsd 0x8(%rsp), %xmm3
movsd %xmm3, 0x8(%rsp)
movq (%r14), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movsd 0x8(%rsp), %xmm3
movsd 0x1b523b(%rip), %xmm2   # 0x2d7018
movsd 0x1b522b(%rip), %xmm1   # 0x2d7010
addsd %xmm0, %xmm3
incl %r13d
movsd (%r15), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%r15)
ucomisd %xmm0, %xmm2
jae 0x121dbc
movsd %xmm3, 0x8(%rsp)
movsd (%r12), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%r12)
ucomisd %xmm0, %xmm2
jae 0x121db3
leaq 0x28(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x11a280
movb $0x0, -0x18(%r14)
xorpd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x121e46
jnp 0x121f0c
movq 0x28(%rsp), %rax
movsd 0x1b51cd(%rip), %xmm2   # 0x2d7020
movapd %xmm2, %xmm0
subq 0x18(%rsp), %rax
jl 0x121e98
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq 0x30(%rsp), %rax
subq 0x20(%rsp), %rax
movq %rax, %xmm1
punpckldq 0x1b5354(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x1b535c(%rip), %xmm1   # 0x2d71e0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x1b5190(%rip), %xmm0   # 0x2d7028
movl %r13d, %eax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
movq 0x28(%rsp), %rax
subq 0x18(%rsp), %rax
jl 0x121ee9
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq 0x30(%rsp), %rax
subq 0x20(%rsp), %rax
movq %rax, %xmm3
punpckldq 0x1b5303(%rip), %xmm3 # xmm3 = xmm3[0],mem[0],xmm3[1],mem[1]
subpd 0x1b530b(%rip), %xmm3   # 0x2d71e0
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
mulsd 0x1b513f(%rip), %xmm2   # 0x2d7028
divsd %xmm2, %xmm1
movq (%rbx), %rsi
leaq 0x1ba03a(%rip), %rdi    # 0x2dbf31
movb $0x2, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a080
movq (%rbx), %rsi
leaq 0x1ba05c(%rip), %rdi    # 0x2dbf72
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a080