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

   std::vector<T> v0(vec_size, T(3.1234567890));
   std::vector<T> v1(vec_size, T(5.1234567890));
   std::vector<T> v2(vec_size, T(7.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(expression_string,expression))
   {
      printf("[load_expression] - Parser Error: %s\tExpression: %s\n",
             parser.error().c_str(),
             expression_string.c_str());

      return;
   }

   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()),
             expression_string.c_str());
   else
      printf("run_expression_benchmark() - Error running benchmark for expression: %s\n",
             expression_string.c_str());
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x12d8, %rsp           # imm = 0x12D8
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq (%rdi), %rsi
movabsq $0x4008fcd6e9b9cb1b, %rax # imm = 0x4008FCD6E9B9CB1B
leaq 0x1d0(%rsp), %r12
movq %rax, (%r12)
leaq 0x68(%rsp), %rdi
leaq 0xaf8(%rsp), %rcx
movq %r12, %rdx
callq 0x11c24c
movq (%r15), %rsi
movabsq $0x40147e6b74dce58d, %rax # imm = 0x40147E6B74DCE58D
movq %rax, (%r12)
leaq 0x50(%rsp), %rdi
leaq 0x1d0(%rsp), %rdx
leaq 0xaf8(%rsp), %rcx
callq 0x11c24c
movq (%r15), %rsi
movabsq $0x401c7e6b74dce58d, %rax # imm = 0x401C7E6B74DCE58D
leaq 0x1d0(%rsp), %rdx
movq %rax, (%rdx)
leaq 0x38(%rsp), %rdi
leaq 0xaf8(%rsp), %rcx
callq 0x11c24c
leaq 0xaf8(%rsp), %rdi
callq 0x11c36e
leaq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x11ca18
leaq 0x1e0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x196cc5(%rip), %rsi    # 0x2b2968
leaq 0x196cc0(%rip), %rdx    # 0x2b296a
leaq 0x1d0(%rsp), %rdi
callq 0x11b8ae
leaq 0x8(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x11ca60
movq 0x1d0(%rsp), %rdi
cmpq %r12, %rdi
je 0x11bceb
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x1d0(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x196cb6(%rip), %rsi    # 0x2b29b3
leaq 0x196cb1(%rip), %rdx    # 0x2b29b5
callq 0x11b8ae
leaq 0x8(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x11ca60
movq 0x1d0(%rsp), %rdi
cmpq %r12, %rdi
je 0x11bd3d
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x1d0(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x196c9e(%rip), %rsi    # 0x2b29ed
leaq 0x196c99(%rip), %rdx    # 0x2b29ef
callq 0x11b8ae
leaq 0x8(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x11ca60
movq 0x1d0(%rsp), %rdi
cmpq %r12, %rdi
je 0x11bd8f
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0xaf8(%rsp), %rdi
leaq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0x12644e
leaq 0x18(%rsp), %rdi
callq 0x11cc40
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
je 0x11bde1
sarq $0x3, %rcx
movq 0x8(%rsp), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
cmpq %r12, %rax
je 0x11bdf0
cmpq (%rax), %rdx
je 0x11bdf0
addq $0x8, %rax
decq %rcx
jne 0x11bdce
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x12851e
leaq 0x80(%rsp), %rdi
movl $0x7f, %esi
callq 0x11cccc
leaq 0x1d0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x11cdcc
leaq 0x180(%rsp), %rdi
callq 0x128720
leaq 0x150(%rsp), %rdi
callq 0x128720
leaq 0x120(%rsp), %rdi
callq 0x128720
leaq 0xf0(%rsp), %rdi
callq 0x128720
leaq 0xc0(%rsp), %rdi
callq 0x128720
leaq 0x90(%rsp), %r12
movq %r12, %rdi
callq 0x128720
leaq 0x1d0(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %rbx, %rsi
callq 0x11d5f0
testb %al, %al
je 0x11bf29
leaq 0x88(%rsp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rdi)
movupd %xmm0, (%rdi)
movb $0x1, -0x8(%rdi)
xorl %esi, %esi
callq 0x116270
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0x7d0, %r12d           # imm = 0x7D0
movq 0x18(%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 0x11beb5
leaq 0x98(%rsp), %rdi
xorl %esi, %esi
callq 0x116270
xorpd %xmm0, %xmm0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x11befe
jnp 0x11bfb7
movq 0x98(%rsp), %rax
subq 0x88(%rsp), %rax
jge 0x11c04b
movsd 0x1920ec(%rip), %xmm1   # 0x2ae008
movsd 0x1920ec(%rip), %xmm0   # 0x2ae010
jmp 0x11c097
movq 0x4e8(%rsp), %r8
cmpq %r8, 0x508(%rsp)
je 0x11bf84
movq 0x500(%rsp), %rsi
movq %r8, %rcx
subq 0x4f0(%rsp), %rcx
movq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rax # imm = 0xCF3CF3CF3CF3CF3D
imulq %rdx, %rax
cmpq $-0xa7, %rcx
jl 0x11bfcd
cmpq $0x3, %rax
jb 0x11bff1
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
shrq %rdx
jmp 0x11bfe3
movq %r12, 0x80(%rsp)
movabsq $0x726f727245206f4e, %rax # imm = 0x726F727245206F4E
movq %rax, 0x90(%rsp)
movq $0x8, 0x88(%rsp)
movb $0x0, 0x98(%rsp)
movq %r12, %rsi
jmp 0x11c014
movq (%rbx), %rsi
leaq 0x196d97(%rip), %rdi    # 0x2b2d58
xorl %eax, %eax
callq 0x116050
jmp 0x11c0e7
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 0x80(%rsp), %rdi
movq %r12, (%rdi)
movq 0x38(%r8), %rsi
movq 0x40(%r8), %rdx
addq %rsi, %rdx
callq 0x11b80e
movq 0x80(%rsp), %rsi
movq (%rbx), %rdx
leaq 0x196cbc(%rip), %rdi    # 0x2b2cda
xorl %eax, %eax
callq 0x116050
movq 0x80(%rsp), %rdi
cmpq %r12, %rdi
je 0x11c0e7
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x116090
jmp 0x11c0e7
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq 0xa0(%rsp), %rax
subq 0x90(%rsp), %rax
movq %rax, %xmm1
punpckldq 0x192081(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x192089(%rip), %xmm1   # 0x2ae100
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x191f8d(%rip), %xmm0   # 0x2ae018
movsd 0x191f8d(%rip), %xmm1   # 0x2ae020
mulsd %xmm0, %xmm1
movq (%r15), %rax
imulq (%r14), %rax
imulq $0x7d0, %rax, %rax      # imm = 0x7D0
movq %rax, %xmm3
punpckldq 0x19203e(%rip), %xmm3 # xmm3 = xmm3[0],mem[0],xmm3[1],mem[1]
subpd 0x192046(%rip), %xmm3   # 0x2ae100
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
divsd %xmm1, %xmm2
movsd 0x191f56(%rip), %xmm1   # 0x2ae028
divsd %xmm0, %xmm1
movq (%rbx), %rsi
leaq 0x196c2f(%rip), %rdi    # 0x2b2d0f
movb $0x3, %al
callq 0x116050
leaq 0x1d0(%rsp), %rdi
callq 0x11e18c
leaq 0x18(%rsp), %rdi
callq 0x11e44e
leaq 0x8(%rsp), %rdi
callq 0x11e49c
leaq 0xaf8(%rsp), %rdi
callq 0x11e532
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x11c12c
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x116090
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x11c143
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x116090
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x11c15a
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x116090
addq $0x12d8, %rsp           # imm = 0x12D8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x11c1cd
jmp 0x11c181
jmp 0x11c1cd
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x11d5a8
jmp 0x11c1dd
movq %rax, %rbx
jmp 0x11c1dd
jmp 0x11c1b4
jmp 0x11c1b4
jmp 0x11c192
jmp 0x11c1b4
jmp 0x11c192
jmp 0x11c1b4
movq %rax, %rbx
movq 0x1d0(%rsp), %rdi
cmpq %r12, %rdi
je 0x11c1e7
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x116090
jmp 0x11c1e7
movq %rax, %rbx
jmp 0x11c1e7
movq %rax, %rbx
jmp 0x11c1f1
movq %rax, %rbx
jmp 0x11c1fe
movq %rax, %rbx
jmp 0x11c215
movq %rax, %rbx
jmp 0x11c22c
movq %rax, %rbx
leaq 0x1d0(%rsp), %rdi
callq 0x11e18c
leaq 0x18(%rsp), %rdi
callq 0x11e44e
leaq 0x8(%rsp), %rdi
callq 0x11e49c
leaq 0xaf8(%rsp), %rdi
callq 0x11e532
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x11c215
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x116090
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x11c22c
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x116090
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x11c243
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x116090
movq %rbx, %rdi
callq 0x116320
nop