// File: ArashPartow[P]exprtk-extras/exprtk_bsm_benchmark.cpp
// Function: void bsm_native<double>()
void bsm_native()
{
   bsm_parameters<T> parameters;

   std::string callput_flag;

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

   T total = T(0);

   for (std::size_t i = 0; i < rounds; ++i)
   {
      const bsm_parameters<T>& current_parameters = bsm_list[i % bsm_list_size];

      parameters = current_parameters;

      callput_flag = "call";
      total += bsm_model(callput_flag, parameters.s, parameters.k, parameters.t, parameters.r, parameters.v);

      callput_flag = "put";
      total += bsm_model(callput_flag, parameters.s, parameters.k, parameters.t, parameters.r, parameters.v);
   }

   timer.stop();

   printf("[native ] Total: %13.5f Time:%6.3fsec Rate:%13.3fbsm/sec execrt: %6.3fns\n",
          total,
          timer.time(),
          (2.0 * rounds) / timer.time(),
          1e9 / ((2.0 * rounds) / timer.time()));
}

// Assembly:
subq $0xd8, %rsp
leaq 0x90(%rsp), %rdi
callq 0x111260
leaq 0x68(%rsp), %rdi
callq 0x11bab0
jmp 0x119b70
leaq 0x68(%rsp), %rdi
callq 0x11bae0
xorps %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
cmpq $0x1312d00, 0x48(%rsp)  # imm = 0x1312D00
jae 0x119cea
movq 0x48(%rsp), %rax
andl $0xf, %eax
leaq (%rax,%rax,4), %rcx
leaq 0x337e12(%rip), %rax    # 0x4519c0
leaq (%rax,%rcx,8), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x20(%rax), %rcx
movq %rcx, 0xd0(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm1, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
leaq 0x336b88(%rip), %rsi    # 0x45076e
leaq 0x90(%rsp), %rdi
callq 0x1112e0
jmp 0x119bf5
movsd 0xb0(%rsp), %xmm0
movsd 0xb8(%rsp), %xmm1
movsd 0xc8(%rsp), %xmm2
movsd 0xd0(%rsp), %xmm3
movsd 0xc0(%rsp), %xmm4
leaq 0x90(%rsp), %rdi
callq 0x446750
movsd %xmm0, 0x38(%rsp)
jmp 0x119c37
movsd 0x38(%rsp), %xmm1
movsd 0x50(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
leaq 0x3330d5(%rip), %rsi    # 0x44cd29
leaq 0x90(%rsp), %rdi
callq 0x1112e0
jmp 0x119c63
movsd 0xb0(%rsp), %xmm0
movsd 0xb8(%rsp), %xmm1
movsd 0xc8(%rsp), %xmm2
movsd 0xd0(%rsp), %xmm3
movsd 0xc0(%rsp), %xmm4
leaq 0x90(%rsp), %rdi
callq 0x446750
movsd %xmm0, 0x30(%rsp)
jmp 0x119ca5
movsd 0x30(%rsp), %xmm0
addsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x119b8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x111788
jmp 0x119da6
leaq 0x68(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x11bb20
movq 0x18(%rsp), %rdi
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
callq 0x11bb50
movsd %xmm0, 0x28(%rsp)
jmp 0x119d17
leaq 0x68(%rsp), %rdi
callq 0x11bb50
movsd %xmm0, 0x10(%rsp)
jmp 0x119d29
movsd 0x10(%rsp), %xmm1
movsd 0x32d2d1(%rip), %xmm0   # 0x447008
divsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
leaq 0x68(%rsp), %rdi
callq 0x11bb50
movsd %xmm0, 0x8(%rsp)
jmp 0x119d52
movsd (%rsp), %xmm2
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm0
movsd 0x8(%rsp), %xmm3
movsd 0x32d297(%rip), %xmm4   # 0x447008
divsd %xmm3, %xmm4
movsd 0x32d293(%rip), %xmm3   # 0x447010
divsd %xmm4, %xmm3
leaq 0x337bde(%rip), %rdi    # 0x451966
movb $0x4, %al
callq 0x111080
jmp 0x119d91
leaq 0x90(%rsp), %rdi
callq 0x111788
addq $0xd8, %rsp
retq
movq 0x60(%rsp), %rdi
callq 0x111450