// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x12e8, %rsp           # imm = 0x12E8
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movabsq $0x4000fcd6e9b9cb1b, %rax # imm = 0x4000FCD6E9B9CB1B
leaq 0x1e0(%rsp), %r12
movq %rax, (%r12)
leaq 0x78(%rsp), %rdi
leaq 0xb08(%rsp), %rcx
movq %r14, %rsi
movq %r12, %rdx
callq 0x11e294
movabsq $0x4008fcd6e9b9cb1b, %rax # imm = 0x4008FCD6E9B9CB1B
movq %rax, (%r12)
leaq 0x60(%rsp), %rdi
leaq 0x1e0(%rsp), %rdx
leaq 0xb08(%rsp), %rcx
movq %r14, %rsi
callq 0x11e294
movabsq $0x40147e6b74dce58d, %rax # imm = 0x40147E6B74DCE58D
leaq 0x1e0(%rsp), %rdx
movq %rax, (%rdx)
leaq 0x48(%rsp), %rdi
leaq 0xb08(%rsp), %rcx
movq %r14, %rsi
callq 0x11e294
leaq 0xb08(%rsp), %rdi
callq 0x11e3ac
leaq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x11ea56
leaq 0x1f0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1b7d74(%rip), %rsi    # 0x2d5908
leaq 0x1b7d6f(%rip), %rdx    # 0x2d590a
leaq 0x1e0(%rsp), %rdi
callq 0x11da3a
leaq 0x8(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x11ea9e
movq 0x1e0(%rsp), %rdi
cmpq %r12, %rdi
je 0x11dbdc
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x1180c0
leaq 0x1e0(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x1b7d65(%rip), %rsi    # 0x2d5953
leaq 0x1b7d60(%rip), %rdx    # 0x2d5955
callq 0x11da3a
leaq 0x8(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x11ea9e
movq 0x1e0(%rsp), %rdi
cmpq %r12, %rdi
je 0x11dc2e
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x1180c0
leaq 0x1e0(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x1b7d4d(%rip), %rsi    # 0x2d598d
leaq 0x1b7d48(%rip), %rdx    # 0x2d598f
callq 0x11da3a
leaq 0x8(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x11ea9e
movq 0x1e0(%rsp), %rdi
cmpq %r12, %rdi
je 0x11dc80
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x1180c0
leaq 0xb08(%rsp), %rdi
leaq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0x128b92
leaq 0x28(%rsp), %rdi
callq 0x11ebb6
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
subq %rcx, %rax
je 0x11dcfb
sarq $0x3, %rax
cmpq $0x1, %rax
movq %rax, %rsi
adcq $0x0, %rsi
cmpq %r12, %rcx
je 0x11dd0a
movq 0x8(%rsp), %rdx
cmpq (%rcx), %rdx
je 0x11dd0a
addq $0x8, %rcx
movl $0x1, %edi
subq %rsi, %rdi
xorl %esi, %esi
cmpq %rsi, %rdi
je 0x11dcfb
decq %rsi
cmpq %r12, %rcx
je 0x11dcf3
leaq 0x8(%rcx), %r8
cmpq (%rcx), %rdx
movq %r8, %rcx
jne 0x11dcda
negq %rsi
cmpq %rax, %rsi
jb 0x11dd0a
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x12b1a8
leaq 0x90(%rsp), %rdi
movl $0x7f, %esi
callq 0x11ec50
leaq 0x1e0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x11ed50
leaq 0x190(%rsp), %rdi
callq 0x12b3aa
leaq 0x160(%rsp), %rdi
callq 0x12b3aa
leaq 0x130(%rsp), %rdi
callq 0x12b3aa
leaq 0x100(%rsp), %rdi
callq 0x12b3aa
leaq 0xd0(%rsp), %rdi
callq 0x12b3aa
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
callq 0x12b3aa
leaq 0x1e0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rbx, %rsi
callq 0x11f574
testb %al, %al
je 0x11def7
leaq 0x98(%rsp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rdi)
movupd %xmm0, (%rdi)
movb $0x1, -0x8(%rdi)
xorl %esi, %esi
callq 0x118280
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0x7d0, %r12d           # imm = 0x7D0
movq 0x28(%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 0x11ddcf
leaq 0xa8(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x118280
movb $0x0, -0x18(%r12)
xorpd %xmm0, %xmm0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x11de21
jnp 0x11df8c
movq 0xa8(%rsp), %rax
movsd 0x1b32bf(%rip), %xmm3   # 0x2d10f0
movapd %xmm3, %xmm0
subq 0x98(%rsp), %rax
jl 0x11de7f
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq 0xb0(%rsp), %rax
subq 0xa0(%rsp), %rax
movq %rax, %xmm1
punpckldq 0x1b31ad(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x1b31b5(%rip), %xmm1   # 0x2d1020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x1b3279(%rip), %xmm0   # 0x2d10f8
movq 0xa8(%rsp), %rax
subq 0x98(%rsp), %rax
jl 0x11ded1
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq 0xb0(%rsp), %rax
subq 0xa0(%rsp), %rax
movq %rax, %xmm1
punpckldq 0x1b315b(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x1b3163(%rip), %xmm1   # 0x2d1020
movapd %xmm1, %xmm3
unpckhpd %xmm1, %xmm3            # xmm3 = xmm3[1],xmm1[1]
addsd %xmm1, %xmm3
mulsd 0x1b3227(%rip), %xmm3   # 0x2d10f8
movq (%r15), %rax
movq 0xa8(%rsp), %rcx
subq 0x98(%rsp), %rcx
jge 0x11dfa2
movsd 0x1b320e(%rip), %xmm1   # 0x2d1100
jmp 0x11dfea
movq 0x4f8(%rsp), %r8
cmpq %r8, 0x518(%rsp)
je 0x11df59
movq %r8, %rcx
subq 0x500(%rsp), %rcx
movq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rax # imm = 0xCF3CF3CF3CF3CF3D
imulq %rdx, %rax
cmpq $0x3, %rax
jb 0x11e0c5
movq 0x510(%rsp), %rsi
testq %rcx, %rcx
jle 0x11e0a1
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
shrq %rdx
jmp 0x11e0b7
movq %r12, 0x90(%rsp)
movabsq $0x726f727245206f4e, %rax # imm = 0x726F727245206F4E
movq %rax, 0xa0(%rsp)
movq $0x8, 0x98(%rsp)
movb $0x0, 0xa8(%rsp)
jmp 0x11e0e0
movq (%rbx), %rsi
leaq 0x1b7d48(%rip), %rdi    # 0x2d5cde
xorl %eax, %eax
callq 0x118080
jmp 0x11e037
imulq $0xf4240, %rcx, %rcx    # imm = 0xF4240
addq 0xb0(%rsp), %rcx
subq 0xa0(%rsp), %rcx
movq %rcx, %xmm2
punpckldq 0x1b304a(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x1b3052(%rip), %xmm2   # 0x2d1020
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
mulsd 0x1b3116(%rip), %xmm1   # 0x2d10f8
mulsd 0x1b30f6(%rip), %xmm1   # 0x2d10e0
imulq %rax, %r14
imulq $0x7d0, %r14, %rax      # imm = 0x7D0
movq %rax, %xmm4
punpckldq 0x1b300e(%rip), %xmm4 # xmm4 = xmm4[0],mem[0],xmm4[1],mem[1]
subpd 0x1b3016(%rip), %xmm4   # 0x2d1020
movapd %xmm4, %xmm2
unpckhpd %xmm4, %xmm2            # xmm2 = xmm2[1],xmm4[1]
addsd %xmm4, %xmm2
divsd %xmm1, %xmm2
movsd 0x1b30e6(%rip), %xmm1   # 0x2d1108
divsd %xmm3, %xmm1
movq (%rbx), %rsi
leaq 0x1b7c65(%rip), %rdi    # 0x2d5c95
movb $0x3, %al
callq 0x118080
movq 0xa8(%rsp), %rax
subq 0x98(%rsp), %rax
jge 0x11e056
movsd 0x1b309f(%rip), %xmm0   # 0x2d10f0
jmp 0x11e11e
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq 0xb0(%rsp), %rax
subq 0xa0(%rsp), %rax
movq %rax, %xmm0
punpckldq 0x1b2f96(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1b2f9e(%rip), %xmm0   # 0x2d1020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x1b3062(%rip), %xmm1   # 0x2d10f8
movapd %xmm1, 0x10(%rsp)
jmp 0x11e124
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 0x90(%rsp), %rdi
movq %r12, (%rdi)
movq 0x38(%r8), %rsi
movq 0x40(%r8), %rdx
addq %rsi, %rdx
callq 0x11d99e
movq 0x90(%rsp), %rsi
movq (%rbx), %rdx
leaq 0x1b7b6e(%rip), %rdi    # 0x2d5c60
xorl %eax, %eax
callq 0x118080
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x11e116
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x1180c0
movsd 0x1b2fca(%rip), %xmm0   # 0x2d10e8
movapd %xmm0, 0x10(%rsp)
leaq 0x1e0(%rsp), %rdi
callq 0x11ff46
leaq 0x28(%rsp), %rdi
callq 0x120208
leaq 0x8(%rsp), %rdi
callq 0x120256
leaq 0xb08(%rsp), %rdi
callq 0x1202ec
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x11e169
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x1180c0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x11e180
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x1180c0
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x11e19a
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x1180c0
movaps 0x10(%rsp), %xmm0
addq $0x12e8, %rsp           # imm = 0x12E8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x11e212
jmp 0x11e1c6
jmp 0x11e212
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x11f52c
jmp 0x11e222
movq %rax, %rbx
jmp 0x11e222
jmp 0x11e1f9
jmp 0x11e1f9
jmp 0x11e1d7
jmp 0x11e1f9
jmp 0x11e1d7
jmp 0x11e1f9
movq %rax, %rbx
movq 0x1e0(%rsp), %rdi
cmpq %r12, %rdi
je 0x11e22c
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x1180c0
jmp 0x11e22c
movq %rax, %rbx
jmp 0x11e22c
movq %rax, %rbx
jmp 0x11e236
movq %rax, %rbx
jmp 0x11e243
movq %rax, %rbx
jmp 0x11e25a
movq %rax, %rbx
jmp 0x11e271
movq %rax, %rbx
leaq 0x1e0(%rsp), %rdi
callq 0x11ff46
leaq 0x28(%rsp), %rdi
callq 0x120208
leaq 0x8(%rsp), %rdi
callq 0x120256
leaq 0xb08(%rsp), %rdi
callq 0x1202ec
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x11e25a
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x1180c0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x11e271
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x1180c0
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x11e28b
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x1180c0
movq %rbx, %rdi
callq 0x118330
nop