// File: /workspace/github_cpp_makefile_star2_O3/ArashPartow[P]exprtk-extras/exprtk_vector_benchmark.cpp
// Function: double run_expression_benchmark<double>(unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long const&)
T run_expression_benchmark(const std::size_t  vec_size,
                           const std::string& expr_string,
                           const std::size_t& cost)
{
   typedef exprtk::symbol_table<T> symbol_table_t;
   typedef exprtk::expression<T>   expression_t;
   typedef exprtk::parser<T>       parser_t;

   std::vector<T> v0(vec_size, T(2.1234567890));
   std::vector<T> v1(vec_size, T(3.1234567890));
   std::vector<T> v2(vec_size, T(5.1234567890));

   exprtk::rtl::vecops::package<T> vecops_package;

   symbol_table_t symbol_table;
   symbol_table.add_vector("v0",v0);
   symbol_table.add_vector("v1",v1);
   symbol_table.add_vector("v2",v2);
   symbol_table.add_package(vecops_package);

   expression_t expression;
   expression.register_symbol_table(symbol_table);

   parser_t parser;

   if (!parser.compile(expr_string,expression))
   {
      printf("[load_expression] - Parser Error: %s\tExpression: %s\n",
             parser.error().c_str(),
             expr_string.c_str());

      return std::numeric_limits<T>::quiet_NaN();
   }

   exprtk::timer timer;

   T total = T(0);

   timer.start();

   for (std::size_t r = 0; r < rounds; ++r)
   {
      total += expression.value();
   }

   timer.stop();

   if (T(0) != total)
      printf("Total Time:%10.7f Rate:%11.3fevals/sec Perf: %5.3fGFLOPS Expression: %s\n",
             timer.time(),
             rounds / timer.time(),
             (rounds * vec_size * cost) / (1e+9 * timer.time()),
             expr_string.c_str());
   else
      printf("run_expression_benchmark() - Error running benchmark for expression: %s\n",
             expr_string.c_str());

   return timer.time();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x12e0, %rsp           # imm = 0x12E0
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movabsq $0x4000fcd6e9b9cb1b, %rax # imm = 0x4000FCD6E9B9CB1B
leaq 0x1d8(%rsp), %r12
movq %rax, (%r12)
leaq 0x70(%rsp), %rdi
leaq 0xb00(%rsp), %rcx
movq %r15, %rsi
movq %r12, %rdx
callq 0x11c17e
movabsq $0x4008fcd6e9b9cb1b, %rax # imm = 0x4008FCD6E9B9CB1B
movq %rax, (%r12)
leaq 0x58(%rsp), %rdi
leaq 0x1d8(%rsp), %rdx
leaq 0xb00(%rsp), %rcx
movq %r15, %rsi
callq 0x11c17e
movabsq $0x40147e6b74dce58d, %rax # imm = 0x40147E6B74DCE58D
leaq 0x1d8(%rsp), %rdx
movq %rax, (%rdx)
leaq 0x40(%rsp), %rdi
leaq 0xb00(%rsp), %rcx
movq %r15, %rsi
callq 0x11c17e
leaq 0xb00(%rsp), %rdi
callq 0x11c2a0
leaq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x11c94a
leaq 0x1e8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x196e1d(%rip), %rsi    # 0x2b2970
leaq 0x196e18(%rip), %rdx    # 0x2b2972
leaq 0x1d8(%rsp), %rdi
callq 0x11b9f2
leaq 0x8(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x11c992
movq 0x1d8(%rsp), %rdi
cmpq %r12, %rdi
je 0x11bb9b
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x1160c0
leaq 0x1d8(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x196e0e(%rip), %rsi    # 0x2b29bb
leaq 0x196e09(%rip), %rdx    # 0x2b29bd
callq 0x11b9f2
leaq 0x8(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x11c992
movq 0x1d8(%rsp), %rdi
cmpq %r12, %rdi
je 0x11bbed
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x1160c0
leaq 0x1d8(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x196df6(%rip), %rsi    # 0x2b29f5
leaq 0x196df1(%rip), %rdx    # 0x2b29f7
callq 0x11b9f2
leaq 0x8(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x11c992
movq 0x1d8(%rsp), %rdi
cmpq %r12, %rdi
je 0x11bc3f
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x1160c0
leaq 0xb00(%rsp), %rdi
leaq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0x126380
leaq 0x20(%rsp), %rdi
callq 0x11cb72
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
subq %rax, %rcx
je 0x11bc91
sarq $0x3, %rcx
movq 0x8(%rsp), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
cmpq %r12, %rax
je 0x11bca0
cmpq (%rax), %rdx
je 0x11bca0
addq $0x8, %rax
decq %rcx
jne 0x11bc7e
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x128450
leaq 0x88(%rsp), %rdi
movl $0x7f, %esi
callq 0x11cbfe
leaq 0x1d8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x11ccfe
leaq 0x188(%rsp), %rdi
callq 0x128652
leaq 0x158(%rsp), %rdi
callq 0x128652
leaq 0x128(%rsp), %rdi
callq 0x128652
leaq 0xf8(%rsp), %rdi
callq 0x128652
leaq 0xc8(%rsp), %rdi
callq 0x128652
leaq 0x98(%rsp), %r12
movq %r12, %rdi
callq 0x128652
leaq 0x1d8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %rbx, %rsi
callq 0x11d522
testb %al, %al
je 0x11bddf
leaq 0x90(%rsp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rdi)
movupd %xmm0, (%rdi)
movb $0x1, -0x8(%rdi)
xorl %esi, %esi
callq 0x116280
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0x7d0, %r12d           # imm = 0x7D0
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
decq %r12
jne 0x11bd65
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
callq 0x116280
xorpd %xmm0, %xmm0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x11bdae
jnp 0x11be71
movq 0x90(%rsp), %r13
movq 0xa0(%rsp), %r12
movq %r12, %rax
subq %r13, %rax
jge 0x11bf19
movsd 0x19231e(%rip), %xmm1   # 0x2ae0f0
movsd 0x19231e(%rip), %xmm0   # 0x2ae0f8
jmp 0x11bf65
movq 0x4f0(%rsp), %r8
cmpq %r8, 0x510(%rsp)
je 0x11be3e
movq 0x508(%rsp), %rsi
movq %r8, %rcx
subq 0x4f8(%rsp), %rcx
movq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rax # imm = 0xCF3CF3CF3CF3CF3D
imulq %rdx, %rax
cmpq $-0xa7, %rcx
jl 0x11be97
cmpq $0x3, %rax
jb 0x11bebb
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
shrq %rdx
jmp 0x11bead
movq %r12, 0x88(%rsp)
movabsq $0x726f727245206f4e, %rax # imm = 0x726F727245206F4E
movq %rax, 0x98(%rsp)
movq $0x8, 0x90(%rsp)
movb $0x0, 0xa0(%rsp)
movq %r12, %rsi
jmp 0x11bede
movq (%rbx), %rsi
leaq 0x196ecb(%rip), %rdi    # 0x2b2d46
xorl %eax, %eax
callq 0x116080
movq 0x90(%rsp), %r13
movq 0xa0(%rsp), %r12
jmp 0x11bfb2
notq %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
shrq %rdx
notq %rdx
imulq $-0x1f8, %rdx, %r8      # imm = 0xFE08
addq (%rsi,%rdx,8), %r8
addq %rcx, %r8
leaq 0x88(%rsp), %rdi
movq %r12, (%rdi)
movq 0x38(%r8), %rsi
movq 0x40(%r8), %rdx
addq %rsi, %rdx
callq 0x11b952
movq 0x88(%rsp), %rsi
movq (%rbx), %rdx
leaq 0x196de0(%rip), %rdi    # 0x2b2cc8
xorl %eax, %eax
callq 0x116080
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x11bf0c
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x1160c0
movsd 0x1921d4(%rip), %xmm0   # 0x2ae0e8
jmp 0x11bfbf
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq 0xa8(%rsp), %rax
subq 0x98(%rsp), %rax
movq %rax, %xmm1
punpckldq 0x1920d3(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x1920db(%rip), %xmm1   # 0x2ae020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x1921a7(%rip), %xmm0   # 0x2ae100
movsd 0x19217f(%rip), %xmm1   # 0x2ae0e0
mulsd %xmm0, %xmm1
imulq (%r14), %r15
imulq $0x7d0, %r15, %rax      # imm = 0x7D0
movq %rax, %xmm3
punpckldq 0x192093(%rip), %xmm3 # xmm3 = xmm3[0],mem[0],xmm3[1],mem[1]
subpd 0x19209b(%rip), %xmm3   # 0x2ae020
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
divsd %xmm1, %xmm2
movsd 0x19216b(%rip), %xmm1   # 0x2ae108
divsd %xmm0, %xmm1
movq (%rbx), %rsi
leaq 0x196d52(%rip), %rdi    # 0x2b2cfd
movb $0x3, %al
callq 0x116080
subq %r13, %r12
jge 0x11bfc7
movsd 0x192139(%rip), %xmm0   # 0x2ae0f8
movapd %xmm0, 0x10(%rsp)
jmp 0x11c00d
imulq $0xf4240, %r12, %rax    # imm = 0xF4240
addq 0xa8(%rsp), %rax
subq 0x98(%rsp), %rax
movq %rax, %xmm0
punpckldq 0x192025(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x19202d(%rip), %xmm0   # 0x2ae020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x1920f9(%rip), %xmm1   # 0x2ae100
movapd %xmm1, 0x10(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x11e0be
leaq 0x20(%rsp), %rdi
callq 0x11e380
leaq 0x8(%rsp), %rdi
callq 0x11e3ce
leaq 0xb00(%rsp), %rdi
callq 0x11e464
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x11c052
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160c0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x11c069
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160c0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x11c083
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160c0
movaps 0x10(%rsp), %xmm0
addq $0x12e0, %rsp           # imm = 0x12E0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x11c0fd
jmp 0x11c0b1
jmp 0x11c0fd
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x11d4da
jmp 0x11c10d
movq %rax, %rbx
jmp 0x11c10d
jmp 0x11c0e4
jmp 0x11c0e4
jmp 0x11c0c2
jmp 0x11c0e4
jmp 0x11c0c2
jmp 0x11c0e4
movq %rax, %rbx
movq 0x1d8(%rsp), %rdi
cmpq %r12, %rdi
je 0x11c117
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x1160c0
jmp 0x11c117
movq %rax, %rbx
jmp 0x11c117
movq %rax, %rbx
jmp 0x11c121
movq %rax, %rbx
jmp 0x11c12e
movq %rax, %rbx
jmp 0x11c145
movq %rax, %rbx
jmp 0x11c15c
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x11e0be
leaq 0x20(%rsp), %rdi
callq 0x11e380
leaq 0x8(%rsp), %rdi
callq 0x11e3ce
leaq 0xb00(%rsp), %rdi
callq 0x11e464
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x11c145
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160c0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x11c15c
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160c0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x11c176
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160c0
movq %rbx, %rdi
callq 0x116330