// File: ArashPartow[P]exprtk-extras/exprtk_vector_benchmark.cpp
// Function: void run_file_benchmark<double>(unsigned long const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void run_file_benchmark(const std::size_t& vec_size, const std::string& file_name)
{
   std::ifstream stream(file_name.c_str());

   if (!stream)
   {
      printf("run_file_benchmark() - Failed to open file: %s\n",
             file_name.c_str());
      return;
   }

   std::string line;
   std::vector<std::string> expr_list;

   while (std::getline(stream, line))
   {
      if (line.empty())
         continue;
      else if ('#' == line[0])
         continue;

      expr_list.push_back(line);
   }

   T total_time = T(0);

   for (std::size_t i = 0; i < expr_list.size(); ++i)
   {
      total_time += run_expression_benchmark<T>(vec_size,expr_list[i],0);
   }

   printf("Total Time:%10.7f\n", total_time);
}

// Assembly:
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, 0x2b0(%rsp)
movq %rsi, 0x2a8(%rsp)
movq 0x2a8(%rsp), %rdi
callq 0x113120
movq %rax, %rsi
leaq 0xa0(%rsp), %rdi
movl $0x8, %edx
callq 0x113080
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0xa0(%rsp,%rax), %rdi
callq 0x113060
movb %al, 0x3f(%rsp)
jmp 0x11ca98
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x11caa2
jmp 0x11caeb
movq 0x2a8(%rsp), %rdi
callq 0x113120
movq %rax, %rsi
leaq 0x342b70(%rip), %rdi    # 0x45f629
xorl %eax, %eax
callq 0x1130b0
jmp 0x11cac2
movl $0x1, 0x90(%rsp)
jmp 0x11cc90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
jmp 0x11cca5
leaq 0x70(%rsp), %rdi
callq 0x1132b0
leaq 0x58(%rsp), %rdi
callq 0x148e60
leaq 0xa0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x1133f0
movq %rax, 0x30(%rsp)
jmp 0x11cb18
movq 0x30(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x1132f0
movb %al, 0x2f(%rsp)
jmp 0x11cb32
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x11cb3f
jmp 0x11cbc1
leaq 0x70(%rsp), %rdi
callq 0x113250
testb $0x1, %al
jne 0x11cb4f
jmp 0x11cb7e
jmp 0x11caff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x2681d0
leaq 0x70(%rsp), %rdi
callq 0x113808
jmp 0x11cca5
xorl %eax, %eax
movl %eax, %esi
leaq 0x70(%rsp), %rdi
callq 0x113770
movq %rax, 0x20(%rsp)
jmp 0x11cb93
movq 0x20(%rsp), %rax
movsbl (%rax), %ecx
movl $0x23, %eax
cmpl %ecx, %eax
jne 0x11cba9
jmp 0x11caff
jmp 0x11cbab
leaq 0x58(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x413aa0
jmp 0x11cbbc
jmp 0x11caff
xorps %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x414450
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x11cc5b
movq 0x2b0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rsp), %rsi
leaq 0x58(%rsp), %rdi
callq 0x4472a0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
movq $0x0, 0x40(%rsp)
leaq 0x40(%rsp), %rdx
callq 0x11cf60
movsd %xmm0, 0x10(%rsp)
jmp 0x11cc36
movsd 0x10(%rsp), %xmm0
addsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x11cbd3
movsd 0x50(%rsp), %xmm0
leaq 0x3429f1(%rip), %rdi    # 0x45f659
movb $0x1, %al
callq 0x1130b0
jmp 0x11cc71
leaq 0x58(%rsp), %rdi
callq 0x2681d0
leaq 0x70(%rsp), %rdi
callq 0x113808
movl $0x0, 0x90(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x113070
addq $0x2b8, %rsp            # imm = 0x2B8
retq
leaq 0xa0(%rsp), %rdi
callq 0x113070
movq 0x98(%rsp), %rdi
callq 0x1134c0
nop