double rq_pricing_spread_numeric(int call, double f1, double f2, double k,
                                 double T, double r, double v1, double v2,
                                 double rho, unsigned grid_size) {
  int i;
  double stddev = 4.0;
  double low = -(2.0 * stddev) / 2.0;
  double dx = (2.0 * stddev) / (grid_size - 1.0);
  double v1_sigma_sqrt_t = v1 * sqrt(T);
  double v2_sigma_sqrt_t = v2 * sqrt(T);
  double **s1_payoff_grid;
  double **s2_payoff_grid;
  double *z;
  double *probs;
  double result = 0.0;
  if (T == 0) {
    double payoff;
    if (call)
      payoff = f1 - f2 - k;
    else
      payoff = -f1 + f2 + k;
    return payoff > 0 ? payoff : 0.0;
  }
  s1_payoff_grid = (double **)calloc(grid_size, sizeof(double));
  s2_payoff_grid = (double **)calloc(grid_size, sizeof(double));
  z = (double *)calloc(grid_size, sizeof(double));
  probs = (double *)calloc(grid_size, sizeof(double));
  for (i = 0; i < grid_size; i++) {
    s1_payoff_grid[i] = (double *)calloc(grid_size, sizeof(double));
    s2_payoff_grid[i] = (double *)calloc(grid_size, sizeof(double));
  }
  for (i = 0; i < grid_size; ++i)
    z[i] = low + i * dx;
  for (i = 0; i < grid_size; ++i) {
    int j;
    for (j = 0; j < grid_size; ++j) {
      s1_payoff_grid[i][j] = exp(z[i] * v1_sigma_sqrt_t - 0.5 * v1 * v1 * T);
      s2_payoff_grid[i][j] =
          exp((rho * z[i] + sqrt((1.0 - rho * rho)) * z[j]) * v2_sigma_sqrt_t -
              0.5 * v2 * v2 * T);
    }
  }
  probs[0] = rq_pricing_cumul_norm_dist(-stddev + dx / 2.0);
  probs[grid_size - 1] = 1.0 - rq_pricing_cumul_norm_dist(stddev - dx / 2.0);
  for (i = 1; i < grid_size - 1; ++i) {
    double x = -stddev + i * dx;
    probs[i] = rq_pricing_cumul_norm_dist(x + dx / 2.0) -
               rq_pricing_cumul_norm_dist(x - dx / 2.0);
  }
  for (i = 0; i < grid_size; ++i) {
    int j;
    for (j = 0; j < grid_size; ++j) {
      double payoff;
      double prob;
      if (call)
        payoff = (f1 * s1_payoff_grid[i][j] - f2 * s2_payoff_grid[i][j] - k);
      else
        payoff = (-f1 * s1_payoff_grid[i][j] + f2 * s2_payoff_grid[i][j] + k);
      if (payoff < 0)
        payoff = 0.0;
      prob = probs[i] * probs[j];
      result += prob * payoff;
    }
  }
  free(probs);
  free(z);
  for (i = 0; i < grid_size; i++) {
    free(s1_payoff_grid[i]);
    free(s2_payoff_grid[i]);
  }
  free(s1_payoff_grid);
  free(s2_payoff_grid);
  return result;
}


x86 assembly (clang, -O0):
<rq_pricing_spread_numeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
movsd  %xmm5,-0x40(%rbp)
movsd  %xmm6,-0x48(%rbp)
movsd  %xmm7,-0x50(%rbp)
mov    %esi,-0x54(%rbp)
movabs $0x4010000000000000,%rax
mov    %rax,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
addsd  %xmm0,%xmm0
movaps 0xe79(%rip),%xmm1
pxor   %xmm1,%xmm0
movsd  0xe55(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
addsd  %xmm0,%xmm0
mov    -0x54(%rbp),%eax
cvtsi2sd %rax,%xmm1
movsd  0xe2b(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xe0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12fb <rq_pricing_spread_numeric+0x1ab>
jp     12fb <rq_pricing_spread_numeric+0x1ab>
cmpl   $0x0,-0xc(%rbp)
je     1281 <rq_pricing_spread_numeric+0x131>
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    12af <rq_pricing_spread_numeric+0x15f>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12d9 <rq_pricing_spread_numeric+0x189>
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xf0(%rbp)
ff
jmp    12e9 <rq_pricing_spread_numeric+0x199>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
jmp    12e9 <rq_pricing_spread_numeric+0x199>
movsd  -0xf0(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
jmp    1923 <rq_pricing_spread_numeric+0x7d3>
mov    -0x54(%rbp),%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x90(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x98(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0xa0(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jae    13b6 <rq_pricing_spread_numeric+0x266>
mov    -0x54(%rbp),%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%rdx
mov    -0x88(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%rdx
mov    -0x90(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    135a <rq_pricing_spread_numeric+0x20a>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jae    13fe <rq_pricing_spread_numeric+0x2ae>
movsd  -0x68(%rbp),%xmm1
cvtsi2sdl -0x58(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x98(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    13bd <rq_pricing_spread_numeric+0x26d>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jae    15a0 <rq_pricing_spread_numeric+0x450>
movl   $0x0,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0x54(%rbp),%eax
jae    158d <rq_pricing_spread_numeric+0x43d>
mov    -0x98(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x78(%rbp),%xmm2
movsd  0xbc9(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <exp@plt>
mov    -0x88(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xb4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
mov    -0x98(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xb19(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  -0x100(%rbp),%xmm2
ff
movaps %xmm0,%xmm1
movsd  -0xf8(%rbp),%xmm0
ff
mov    -0x98(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x80(%rbp),%xmm2
movsd  0xae5(%rip),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <exp@plt>
mov    -0x90(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xb4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    141b <rq_pricing_spread_numeric+0x2cb>
jmp    1592 <rq_pricing_spread_numeric+0x442>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1405 <rq_pricing_spread_numeric+0x2b5>
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x70(%rbp),%xmm1
movsd  0xa3f(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    $0x1,%al
call   1040 <rq_pricing_cumul_norm_dist@plt>
cvtsi2sd %eax,%xmm0
mov    -0xa0(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
movsd  0xa0f(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    $0x1,%al
call   1040 <rq_pricing_cumul_norm_dist@plt>
cvtsi2sd %eax,%xmm1
movsd  0x9ec(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    -0xa0(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jae    16f4 <rq_pricing_spread_numeric+0x5a4>
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
cvtsi2sdl -0x58(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0x70(%rbp),%xmm1
movsd  0x979(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    $0x1,%al
call   1040 <rq_pricing_cumul_norm_dist@plt>
mov    %eax,-0x104(%rbp)
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0x70(%rbp),%xmm1
movsd  0x94f(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    $0x1,%al
call   1040 <rq_pricing_cumul_norm_dist@plt>
mov    %eax,%ecx
mov    -0x104(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
mov    -0xa0(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1633 <rq_pricing_spread_numeric+0x4e3>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jae    189d <rq_pricing_spread_numeric+0x74d>
movl   $0x0,-0xc4(%rbp)
mov    -0xc4(%rbp),%eax
cmp    -0x54(%rbp),%eax
jae    188a <rq_pricing_spread_numeric+0x73a>
cmpl   $0x0,-0xc(%rbp)
je     179b <rq_pricing_spread_numeric+0x64b>
movsd  -0x18(%rbp),%xmm0
mov    -0x88(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x20(%rbp),%xmm1
mov    -0x90(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc4(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
jmp    1807 <rq_pricing_spread_numeric+0x6b7>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x88(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x20(%rbp),%xmm1
mov    -0x90(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc4(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
xorps  %xmm0,%xmm0
ucomisd -0xd0(%rbp),%xmm0
ff
jbe    1823 <rq_pricing_spread_numeric+0x6d3>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0xa0(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0xa0(%rbp),%rax
movslq -0xc4(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
movsd  -0xd0(%rbp),%xmm2
ff
movsd  -0xa8(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1711 <rq_pricing_spread_numeric+0x5c1>
jmp    188f <rq_pricing_spread_numeric+0x73f>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    16fb <rq_pricing_spread_numeric+0x5ab>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jae    18fe <rq_pricing_spread_numeric+0x7ae>
mov    -0x88(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x90(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    18bc <rq_pricing_spread_numeric+0x76c>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
movsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_pricing_spread_numeric>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %esi,%ebp
movsd  %xmm7,0x68(%rsp)
movq   %xmm6,0x10(%rsp)
movsd  %xmm5,0x30(%rsp)
movapd %xmm0,%xmm4
mov    %edi,%ebx
xorps  %xmm0,%xmm0
sqrtsd %xmm3,%xmm0
xorpd  %xmm5,%xmm5
ucomisd %xmm5,%xmm3
movsd  %xmm0,0x28(%rsp)
movsd  %xmm0,0x20(%rsp)
movsd  %xmm2,0x48(%rsp)
movsd  %xmm1,0x40(%rsp)
movapd %xmm4,0x80(%rsp)
movsd  %xmm3,0x8(%rsp)
jae    11e1 <rq_pricing_spread_numeric+0x91>
movapd %xmm3,%xmm0
call   1070 <sqrt@plt>
xorpd  %xmm5,%xmm5
movsd  0x8(%rsp),%xmm3
movapd 0x80(%rsp),%xmm4
movsd  0x40(%rsp),%xmm1
movsd  0x48(%rsp),%xmm2
movsd  %xmm0,0x20(%rsp)
ucomisd %xmm5,%xmm3
jae    1211 <rq_pricing_spread_numeric+0xc1>
movapd %xmm3,%xmm0
call   1070 <sqrt@plt>
movsd  0x8(%rsp),%xmm3
movapd 0x80(%rsp),%xmm4
movsd  0x40(%rsp),%xmm1
movsd  0x48(%rsp),%xmm2
movsd  %xmm0,0x28(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jne    1232 <rq_pricing_spread_numeric+0xe2>
jp     1232 <rq_pricing_spread_numeric+0xe2>
test   %ebx,%ebx
je     1331 <rq_pricing_spread_numeric+0x1e1>
subsd  %xmm1,%xmm4
subsd  %xmm2,%xmm4
jmp    133d <rq_pricing_spread_numeric+0x1ed>
mov    %ebx,0x64(%rsp)
mov    %ebp,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
addsd  0xdb8(%rip),%xmm0
movsd  0xdb8(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,0x70(%rsp)
mov    $0x8,%esi
mov    %rbx,%rdi
call   1050 <calloc@plt>
mov    %rax,%r12
mov    $0x8,%esi
mov    %rbx,%rdi
call   1050 <calloc@plt>
mov    %rax,%r13
mov    $0x8,%esi
mov    %rbx,%rdi
call   1050 <calloc@plt>
mov    %rax,0x18(%rsp)
mov    $0x8,%esi
mov    %rbx,%rdi
call   1050 <calloc@plt>
mov    %rax,%r14
mov    %rbp,0x38(%rsp)
test   %ebp,%ebp
mov    %r12,0x58(%rsp)
mov    %r13,0x50(%rsp)
je     15ee <rq_pricing_spread_numeric+0x49e>
mov    0x38(%rsp),%r15
movsd  0x20(%rsp),%xmm0
mulsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
xor    %ebp,%ebp
xchg   %ax,%ax
mov    $0x8,%esi
mov    %rbx,%rdi
call   1050 <calloc@plt>
mov    %rax,(%r12,%rbp,8)
mov    $0x8,%esi
mov    %rbx,%rdi
call   1050 <calloc@plt>
mov    %rax,0x0(%r13,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12e0 <rq_pricing_spread_numeric+0x190>
test   %r15d,%r15d
je     15ee <rq_pricing_spread_numeric+0x49e>
mov    0x38(%rsp),%rbp
cmp    $0x4,%ebp
jae    134a <rq_pricing_spread_numeric+0x1fa>
xor    %eax,%eax
mov    0x18(%rsp),%rdi
movapd 0x70(%rsp),%xmm4
jmp    146c <rq_pricing_spread_numeric+0x31c>
subsd  %xmm4,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,%xmm4
xorpd  %xmm0,%xmm0
maxsd  %xmm0,%xmm4
jmp    17e1 <rq_pricing_spread_numeric+0x691>
mov    %ebx,%eax
and    $0xfffffffc,%eax
movapd 0x70(%rsp),%xmm4
movapd %xmm4,%xmm0
unpcklpd %xmm4,%xmm0
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
mov    0x18(%rsp),%rdi
je     17f7 <rq_pricing_spread_numeric+0x6a7>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
movdqa 0xcb7(%rip),%xmm1
xor    %ecx,%ecx
movdqa 0xcbc(%rip),%xmm8
movapd 0xcc4(%rip),%xmm3
movdqa 0xccb(%rip),%xmm9
movdqa 0xcd3(%rip),%xmm5
movdqa 0xcdb(%rip),%xmm6
cs nopw 0x0(%rax,%rax,1)
nop
movdqa %xmm1,%xmm7
cvtdq2pd %xmm1,%xmm2
paddd  %xmm8,%xmm7
cvtdq2pd %xmm7,%xmm7
mulpd  %xmm0,%xmm2
addpd  %xmm3,%xmm2
mulpd  %xmm0,%xmm7
addpd  %xmm3,%xmm7
movupd %xmm2,(%rdi,%rcx,8)
movupd %xmm7,0x10(%rdi,%rcx,8)
movdqa %xmm1,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm1,%xmm7
cvtdq2pd %xmm2,%xmm2
paddd  %xmm5,%xmm7
cvtdq2pd %xmm7,%xmm7
mulpd  %xmm0,%xmm2
addpd  %xmm3,%xmm2
mulpd  %xmm0,%xmm7
addpd  %xmm3,%xmm7
movupd %xmm2,0x20(%rdi,%rcx,8)
movupd %xmm7,0x30(%rdi,%rcx,8)
add    $0x8,%rcx
paddd  %xmm6,%xmm1
add    $0xfffffffffffffffe,%rsi
jne    13c0 <rq_pricing_spread_numeric+0x270>
test   $0x1,%dl
je     1467 <rq_pricing_spread_numeric+0x317>
cvtdq2pd %xmm1,%xmm2
paddd  0xc10(%rip),%xmm1
cvtdq2pd %xmm1,%xmm1
mulpd  %xmm0,%xmm2
movapd 0xc10(%rip),%xmm3
addpd  %xmm3,%xmm2
mulpd  %xmm0,%xmm1
addpd  %xmm3,%xmm1
movupd %xmm2,(%rdi,%rcx,8)
movupd %xmm1,0x10(%rdi,%rcx,8)
cmp    %rbx,%rax
je     149d <rq_pricing_spread_numeric+0x34d>
movsd  0xb9c(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
add    $0x1,%rax
cmp    %rax,%rbx
jne    1480 <rq_pricing_spread_numeric+0x330>
test   %ebp,%ebp
je     15ee <rq_pricing_spread_numeric+0x49e>
movsd  0xb6b(%rip),%xmm2
movsd  0x30(%rsp),%xmm0
movapd %xmm0,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm3
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm3
movsd  %xmm3,0x90(%rsp)
movsd  0x68(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xb3c(%rip),%xmm3
subsd  %xmm0,%xmm3
movsd  0x10(%rsp),%xmm0
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0xa0(%rsp)
xor    %ecx,%ecx
movsd  %xmm3,0x8(%rsp)
xorps  %xmm0,%xmm0
sqrtsd %xmm3,%xmm0
movsd  %xmm0,0x98(%rsp)
jmp    153a <rq_pricing_spread_numeric+0x3ea>
nopl   (%rax)
mov    %rbp,%rcx
add    $0x1,%rcx
cmp    %rbx,%rcx
mov    0x58(%rsp),%r12
mov    0x50(%rsp),%r13
je     15ee <rq_pricing_spread_numeric+0x49e>
mov    0x18(%rsp),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  0x20(%rsp),%xmm0
addsd  0x90(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
mov    (%r12,%rcx,8),%r12
mov    %rcx,%rbp
mov    0x0(%r13,%rcx,8),%r13
xor    %r15d,%r15d
jmp    15b7 <rq_pricing_spread_numeric+0x467>
mov    0x18(%rsp),%rax
mulsd  (%rax,%r15,8),%xmm0
movsd  0x68(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
mulsd  0x28(%rsp),%xmm1
addsd  0xa0(%rsp),%xmm1
movapd %xmm1,%xmm0
call   1060 <exp@plt>
movsd  %xmm0,0x0(%r13,%r15,8)
add    $0x1,%r15
cmp    %r15,%rbx
je     1520 <rq_pricing_spread_numeric+0x3d0>
movsd  0x30(%rsp),%xmm0
call   1060 <exp@plt>
movsd  %xmm0,(%r12,%r15,8)
movsd  0x8(%rsp),%xmm0
ucomisd 0xa62(%rip),%xmm0
movsd  0x98(%rsp),%xmm0
jae    1570 <rq_pricing_spread_numeric+0x420>
movsd  0x8(%rsp),%xmm0
call   1070 <sqrt@plt>
jmp    1570 <rq_pricing_spread_numeric+0x420>
movsd  0xa32(%rip),%xmm1
mulsd  0x70(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xa06(%rip),%xmm0
addsd  %xmm1,%xmm0
mov    $0x1,%al
call   1040 <rq_pricing_cumul_norm_dist@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%r14)
movsd  0xa07(%rip),%xmm0
subsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <rq_pricing_cumul_norm_dist@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x9db(%rip),%xmm1
subsd  %xmm0,%xmm1
mov    0x38(%rsp),%rax
mov    %rax,%r13
lea    -0x1(%rax),%r12d
movsd  %xmm1,(%r14,%r12,8)
cmp    $0x2,%r12d
jb     16cc <rq_pricing_spread_numeric+0x57c>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
mulsd  0x70(%rsp),%xmm1
addsd  0x98b(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
mov    $0x1,%al
call   1040 <rq_pricing_cumul_norm_dist@plt>
mov    %eax,%r15d
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <rq_pricing_cumul_norm_dist@plt>
sub    %eax,%r15d
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
movsd  %xmm0,(%r14,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1670 <rq_pricing_spread_numeric+0x520>
mov    %r13,%rbp
test   %ebp,%ebp
je     177f <rq_pricing_spread_numeric+0x62f>
movapd 0x9c1(%rip),%xmm0
movapd 0x80(%rsp),%xmm6
xorpd  %xmm6,%xmm0
xorpd  %xmm7,%xmm7
xor    %eax,%eax
movsd  0x48(%rsp),%xmm4
movsd  0x40(%rsp),%xmm5
mov    0x64(%rsp),%edi
mov    0x58(%rsp),%r15
mov    0x50(%rsp),%r12
jmp    1719 <rq_pricing_spread_numeric+0x5c9>
xchg   %ax,%ax
add    $0x1,%rax
cmp    %rbx,%rax
je     178d <rq_pricing_spread_numeric+0x63d>
movsd  (%r14,%rax,8),%xmm1
mov    (%r15,%rax,8),%rcx
mov    (%r12,%rax,8),%rdx
xor    %esi,%esi
jmp    175f <rq_pricing_spread_numeric+0x60f>
nopl   0x0(%rax,%rax,1)
mulsd  %xmm0,%xmm2
addsd  %xmm3,%xmm2
addsd  %xmm4,%xmm2
xorpd  %xmm3,%xmm3
maxsd  %xmm2,%xmm3
movsd  (%r14,%rsi,8),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm2,%xmm7
add    $0x1,%rsi
cmp    %rsi,%rbx
je     1710 <rq_pricing_spread_numeric+0x5c0>
movsd  (%rcx,%rsi,8),%xmm2
movsd  (%rdx,%rsi,8),%xmm3
mulsd  %xmm5,%xmm3
test   %edi,%edi
je     1730 <rq_pricing_spread_numeric+0x5e0>
mulsd  %xmm6,%xmm2
subsd  %xmm3,%xmm2
subsd  %xmm4,%xmm2
jmp    173c <rq_pricing_spread_numeric+0x5ec>
xorpd  %xmm7,%xmm7
mov    0x58(%rsp),%r15
mov    0x50(%rsp),%r12
movsd  %xmm7,0x8(%rsp)
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
test   %ebp,%ebp
je     17cb <rq_pricing_spread_numeric+0x67b>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbp,8),%rdi
call   1030 <free@plt>
mov    (%r12,%rbp,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    17b0 <rq_pricing_spread_numeric+0x660>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
movsd  0x8(%rsp),%xmm4
movapd %xmm4,%xmm0
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movdqa 0x841(%rip),%xmm1
xor    %ecx,%ecx
test   $0x1,%dl
jne    1434 <rq_pricing_spread_numeric+0x2e4>
jmp    1467 <rq_pricing_spread_numeric+0x317>

LLVM IR (-O0):
define double @rq_pricing_spread_numeric(i32 %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, i32 %9) {
%11 = alloca double
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca i32
%22 = alloca i32
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double**
%29 = alloca double**
%30 = alloca double*
%31 = alloca double*
%32 = alloca double
%33 = alloca double
%34 = alloca i32
%35 = alloca double
%36 = alloca i32
%37 = alloca double
%38 = alloca double
store i32 %0, i32* %12
store double %1, double* %13
store double %2, double* %14
store double %3, double* %15
store double %4, double* %16
store double %5, double* %17
store double %6, double* %18
store double %7, double* %19
store double %8, double* %20
store i32 %9, i32* %21
store double 4.000000e+00, double* %23
%39 = load double, double* %23
%40 = fmul double 2.000000e+00, %39
%41 = fneg double %40
%42 = fdiv double %41, 2.000000e+00
store double %42, double* %24
%43 = load double, double* %23
%44 = fmul double 2.000000e+00, %43
%45 = load i32, i32* %21
%46 = uitofp i32 %45 to double
%47 = fsub double %46, 1.000000e+00
%48 = fdiv double %44, %47
store double %48, double* %25
%49 = load double, double* %18
%50 = load double, double* %16
%51 = call double @sqrt(double %50)
%52 = fmul double %49, %51
store double %52, double* %26
%53 = load double, double* %19
%54 = load double, double* %16
%55 = call double @sqrt(double %54)
%56 = fmul double %53, %55
store double %56, double* %27
store double 0.000000e+00, double* %32
%57 = load double, double* %16
%58 = fcmp oeq double %57, 0.000000e+00
br i1 %58, label %59, label %83
59: ; preds = %10
%60 = load i32, i32* %12
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %68
62: ; preds = %59
%63 = load double, double* %13
%64 = load double, double* %14
%65 = fsub double %63, %64
%66 = load double, double* %15
%67 = fsub double %65, %66
store double %67, double* %33
br label %75
68: ; preds = %59
%69 = load double, double* %13
%70 = fneg double %69
%71 = load double, double* %14
%72 = fadd double %70, %71
%73 = load double, double* %15
%74 = fadd double %72, %73
store double %74, double* %33
br label %75
75: ; preds = %68, %62
%76 = load double, double* %33
%77 = fcmp ogt double %76, 0.000000e+00
br i1 %77, label %78, label %80
78: ; preds = %75
%79 = load double, double* %33
br label %81
80: ; preds = %75
br label %81
81: ; preds = %80, %78
%82 = phi double [ %79, %78 ], [ 0.000000e+00, %80 ]
store double %82, double* %11
br label %395
83: ; preds = %10
%84 = load i32, i32* %21
%85 = zext i32 %84 to i64
%86 = call i8* @calloc(i64 %85, i64 8)
%87 = bitcast i8* %86 to double**
store double** %87, double*** %28
%88 = load i32, i32* %21
%89 = zext i32 %88 to i64
%90 = call i8* @calloc(i64 %89, i64 8)
%91 = bitcast i8* %90 to double**
store double** %91, double*** %29
%92 = load i32, i32* %21
%93 = zext i32 %92 to i64
%94 = call i8* @calloc(i64 %93, i64 8)
%95 = bitcast i8* %94 to double*
store double* %95, double** %30
%96 = load i32, i32* %21
%97 = zext i32 %96 to i64
%98 = call i8* @calloc(i64 %97, i64 8)
%99 = bitcast i8* %98 to double*
store double* %99, double** %31
store i32 0, i32* %22
br label %100
100: ; preds = %121, %83
%101 = load i32, i32* %22
%102 = load i32, i32* %21
%103 = icmp ult i32 %101, %102
br i1 %103, label %104, label %124
104: ; preds = %100
%105 = load i32, i32* %21
%106 = zext i32 %105 to i64
%107 = call i8* @calloc(i64 %106, i64 8)
%108 = bitcast i8* %107 to double*
%109 = load double**, double*** %28
%110 = load i32, i32* %22
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double*, double** %109, i64 %111
store double* %108, double** %112
%113 = load i32, i32* %21
%114 = zext i32 %113 to i64
%115 = call i8* @calloc(i64 %114, i64 8)
%116 = bitcast i8* %115 to double*
%117 = load double**, double*** %29
%118 = load i32, i32* %22
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double*, double** %117, i64 %119
store double* %116, double** %120
br label %121
121: ; preds = %104
%122 = load i32, i32* %22
%123 = add nsw i32 %122, 1
store i32 %123, i32* %22
br label %100
124: ; preds = %100
store i32 0, i32* %22
br label %125
125: ; preds = %139, %124
%126 = load i32, i32* %22
%127 = load i32, i32* %21
%128 = icmp ult i32 %126, %127
br i1 %128, label %129, label %142
129: ; preds = %125
%130 = load double, double* %24
%131 = load i32, i32* %22
%132 = sitofp i32 %131 to double
%133 = load double, double* %25
%134 = call double @llvm.fmuladd.f64(double %132, double %133, double %130)
%135 = load double*, double** %30
%136 = load i32, i32* %22
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds double, double* %135, i64 %137
store double %134, double* %138
br label %139
139: ; preds = %129
%140 = load i32, i32* %22
%141 = add nsw i32 %140, 1
store i32 %141, i32* %22
br label %125
142: ; preds = %125
store i32 0, i32* %22
br label %143
143: ; preds = %216, %142
%144 = load i32, i32* %22
%145 = load i32, i32* %21
%146 = icmp ult i32 %144, %145
br i1 %146, label %147, label %219
147: ; preds = %143
store i32 0, i32* %34
br label %148
148: ; preds = %212, %147
%149 = load i32, i32* %34
%150 = load i32, i32* %21
%151 = icmp ult i32 %149, %150
br i1 %151, label %152, label %215
152: ; preds = %148
%153 = load double*, double** %30
%154 = load i32, i32* %22
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds double, double* %153, i64 %155
%157 = load double, double* %156
%158 = load double, double* %26
%159 = load double, double* %18
%160 = fmul double 5.000000e-01, %159
%161 = load double, double* %18
%162 = fmul double %160, %161
%163 = load double, double* %16
%164 = fmul double %162, %163
%165 = fneg double %164
%166 = call double @llvm.fmuladd.f64(double %157, double %158, double %165)
%167 = call double @exp(double %166)
%168 = load double**, double*** %28
%169 = load i32, i32* %22
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds double*, double** %168, i64 %170
%172 = load double*, double** %171
%173 = load i32, i32* %34
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
store double %167, double* %175
%176 = load double, double* %20
%177 = load double*, double** %30
%178 = load i32, i32* %22
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds double, double* %177, i64 %179
%181 = load double, double* %180
%182 = load double, double* %20
%183 = load double, double* %20
%184 = fneg double %182
%185 = call double @llvm.fmuladd.f64(double %184, double %183, double 1.000000e+00)
%186 = call double @sqrt(double %185)
%187 = load double*, double** %30
%188 = load i32, i32* %34
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds double, double* %187, i64 %189
%191 = load double, double* %190
%192 = fmul double %186, %191
%193 = call double @llvm.fmuladd.f64(double %176, double %181, double %192)
%194 = load double, double* %27
%195 = load double, double* %19
%196 = fmul double 5.000000e-01, %195
%197 = load double, double* %19
%198 = fmul double %196, %197
%199 = load double, double* %16
%200 = fmul double %198, %199
%201 = fneg double %200
%202 = call double @llvm.fmuladd.f64(double %193, double %194, double %201)
%203 = call double @exp(double %202)
%204 = load double**, double*** %29
%205 = load i32, i32* %22
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds double*, double** %204, i64 %206
%208 = load double*, double** %207
%209 = load i32, i32* %34
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds double, double* %208, i64 %210
store double %203, double* %211
br label %212
212: ; preds = %152
%213 = load i32, i32* %34
%214 = add nsw i32 %213, 1
store i32 %214, i32* %34
br label %148
215: ; preds = %148
br label %216
216: ; preds = %215
%217 = load i32, i32* %22
%218 = add nsw i32 %217, 1
store i32 %218, i32* %22
br label %143
219: ; preds = %143
%220 = load double, double* %23
%221 = fneg double %220
%222 = load double, double* %25
%223 = fdiv double %222, 2.000000e+00
%224 = fadd double %221, %223
%225 = call i32 (double, ...) bitcast (i32 (...)* @rq_pricing_cumul_norm_dist to i32 (double, ...)*)(double %224)
%226 = sitofp i32 %225 to double
%227 = load double*, double** %31
%228 = getelementptr inbounds double, double* %227, i64 0
store double %226, double* %228
%229 = load double, double* %23
%230 = load double, double* %25
%231 = fdiv double %230, 2.000000e+00
%232 = fsub double %229, %231
%233 = call i32 (double, ...) bitcast (i32 (...)* @rq_pricing_cumul_norm_dist to i32 (double, ...)*)(double %232)
%234 = sitofp i32 %233 to double
%235 = fsub double 1.000000e+00, %234
%236 = load double*, double** %31
%237 = load i32, i32* %21
%238 = sub i32 %237, 1
%239 = zext i32 %238 to i64
%240 = getelementptr inbounds double, double* %236, i64 %239
store double %235, double* %240
store i32 1, i32* %22
br label %241
241: ; preds = %269, %219
%242 = load i32, i32* %22
%243 = load i32, i32* %21
%244 = sub i32 %243, 1
%245 = icmp ult i32 %242, %244
br i1 %245, label %246, label %272
246: ; preds = %241
%247 = load double, double* %23
%248 = fneg double %247
%249 = load i32, i32* %22
%250 = sitofp i32 %249 to double
%251 = load double, double* %25
%252 = call double @llvm.fmuladd.f64(double %250, double %251, double %248)
store double %252, double* %35
%253 = load double, double* %35
%254 = load double, double* %25
%255 = fdiv double %254, 2.000000e+00
%256 = fadd double %253, %255
%257 = call i32 (double, ...) bitcast (i32 (...)* @rq_pricing_cumul_norm_dist to i32 (double, ...)*)(double %256)
%258 = load double, double* %35
%259 = load double, double* %25
%260 = fdiv double %259, 2.000000e+00
%261 = fsub double %258, %260
%262 = call i32 (double, ...) bitcast (i32 (...)* @rq_pricing_cumul_norm_dist to i32 (double, ...)*)(double %261)
%263 = sub nsw i32 %257, %262
%264 = sitofp i32 %263 to double
%265 = load double*, double** %31
%266 = load i32, i32* %22
%267 = sext i32 %266 to i64
%268 = getelementptr inbounds double, double* %265, i64 %267
store double %264, double* %268
br label %269
269: ; preds = %246
%270 = load i32, i32* %22
%271 = add nsw i32 %270, 1
store i32 %271, i32* %22
br label %241
272: ; preds = %241
store i32 0, i32* %22
br label %273
273: ; preds = %361, %272
%274 = load i32, i32* %22
%275 = load i32, i32* %21
%276 = icmp ult i32 %274, %275
br i1 %276, label %277, label %364
277: ; preds = %273
store i32 0, i32* %36
br label %278
278: ; preds = %357, %277
%279 = load i32, i32* %36
%280 = load i32, i32* %21
%281 = icmp ult i32 %279, %280
br i1 %281, label %282, label %360
282: ; preds = %278
%283 = load i32, i32* %12
%284 = icmp ne i32 %283, 0
br i1 %284, label %285, label %311
285: ; preds = %282
%286 = load double, double* %13
%287 = load double**, double*** %28
%288 = load i32, i32* %22
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds double*, double** %287, i64 %289
%291 = load double*, double** %290
%292 = load i32, i32* %36
%293 = sext i32 %292 to i64
%294 = getelementptr inbounds double, double* %291, i64 %293
%295 = load double, double* %294
%296 = load double, double* %14
%297 = load double**, double*** %29
%298 = load i32, i32* %22
%299 = sext i32 %298 to i64
%300 = getelementptr inbounds double*, double** %297, i64 %299
%301 = load double*, double** %300
%302 = load i32, i32* %36
%303 = sext i32 %302 to i64
%304 = getelementptr inbounds double, double* %301, i64 %303
%305 = load double, double* %304
%306 = fmul double %296, %305
%307 = fneg double %306
%308 = call double @llvm.fmuladd.f64(double %286, double %295, double %307)
%309 = load double, double* %15
%310 = fsub double %308, %309
store double %310, double* %37
br label %337
311: ; preds = %282
%312 = load double, double* %13
%313 = fneg double %312
%314 = load double**, double*** %28
%315 = load i32, i32* %22
%316 = sext i32 %315 to i64
%317 = getelementptr inbounds double*, double** %314, i64 %316
%318 = load double*, double** %317
%319 = load i32, i32* %36
%320 = sext i32 %319 to i64
%321 = getelementptr inbounds double, double* %318, i64 %320
%322 = load double, double* %321
%323 = load double, double* %14
%324 = load double**, double*** %29
%325 = load i32, i32* %22
%326 = sext i32 %325 to i64
%327 = getelementptr inbounds double*, double** %324, i64 %326
%328 = load double*, double** %327
%329 = load i32, i32* %36
%330 = sext i32 %329 to i64
%331 = getelementptr inbounds double, double* %328, i64 %330
%332 = load double, double* %331
%333 = fmul double %323, %332
%334 = call double @llvm.fmuladd.f64(double %313, double %322, double %333)
%335 = load double, double* %15
%336 = fadd double %334, %335
store double %336, double* %37
br label %337
337: ; preds = %311, %285
%338 = load double, double* %37
%339 = fcmp olt double %338, 0.000000e+00
br i1 %339, label %340, label %341
340: ; preds = %337
store double 0.000000e+00, double* %37
br label %341
341: ; preds = %340, %337
%342 = load double*, double** %31
%343 = load i32, i32* %22
%344 = sext i32 %343 to i64
%345 = getelementptr inbounds double, double* %342, i64 %344
%346 = load double, double* %345
%347 = load double*, double** %31
%348 = load i32, i32* %36
%349 = sext i32 %348 to i64
%350 = getelementptr inbounds double, double* %347, i64 %349
%351 = load double, double* %350
%352 = fmul double %346, %351
store double %352, double* %38
%353 = load double, double* %38
%354 = load double, double* %37
%355 = load double, double* %32
%356 = call double @llvm.fmuladd.f64(double %353, double %354, double %355)
store double %356, double* %32
br label %357
357: ; preds = %341
%358 = load i32, i32* %36
%359 = add nsw i32 %358, 1
store i32 %359, i32* %36
br label %278
360: ; preds = %278
br label %361
361: ; preds = %360
%362 = load i32, i32* %22
%363 = add nsw i32 %362, 1
store i32 %363, i32* %22
br label %273
364: ; preds = %273
%365 = load double*, double** %31
%366 = bitcast double* %365 to i8*
%367 = load double*, double** %30
%368 = bitcast double* %367 to i8*
store i32 0, i32* %22
br label %369
369: ; preds = %386, %364
%370 = load i32, i32* %22
%371 = load i32, i32* %21
%372 = icmp ult i32 %370, %371
br i1 %372, label %373, label %389
373: ; preds = %369
%374 = load double**, double*** %28
%375 = load i32, i32* %22
%376 = sext i32 %375 to i64
%377 = getelementptr inbounds double*, double** %374, i64 %376
%378 = load double*, double** %377
%379 = bitcast double* %378 to i8*
%380 = load double**, double*** %29
%381 = load i32, i32* %22
%382 = sext i32 %381 to i64
%383 = getelementptr inbounds double*, double** %380, i64 %382
%384 = load double*, double** %383
%385 = bitcast double* %384 to i8*
br label %386
386: ; preds = %373
%387 = load i32, i32* %22
%388 = add nsw i32 %387, 1
store i32 %388, i32* %22
br label %369
389: ; preds = %369
%390 = load double**, double*** %28
%391 = bitcast double** %390 to i8*
%392 = load double**, double*** %29
%393 = bitcast double** %392 to i8*
%394 = load double, double* %32
store double %394, double* %11
br label %395
395: ; preds = %389, %81
%396 = load double, double* %11
ret double %396
}

LLVM IR (-O2):
define double @rq_pricing_spread_numeric(i32 %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, i32 %9) {
%11 = uitofp i32 %9 to double
%12 = fadd double %11, -1.000000e+00
%13 = fdiv double 8.000000e+00, %12
%14 = tail call double @sqrt(double %4)
%15 = fmul double %14, %6
%16 = tail call double @sqrt(double %4)
%17 = fmul double %16, %7
%18 = fcmp oeq double %4, 0.000000e+00
br i1 %18, label %19, label %28
19: ; preds = %10
%20 = icmp eq i32 %0, 0
%21 = fsub double %1, %2
%22 = fsub double %21, %3
%23 = fsub double %2, %1
%24 = fadd double %23, %3
%25 = select i1 %20, double %24, double %22
%26 = fcmp ogt double %25, 0.000000e+00
%27 = select i1 %26, double %25, double 0.000000e+00
br label %237
28: ; preds = %10
%29 = zext i32 %9 to i64
%30 = tail call i8* @calloc(i64 %29, i64 8)
%31 = bitcast i8* %30 to double**
%32 = tail call i8* @calloc(i64 %29, i64 8)
%33 = bitcast i8* %32 to double**
%34 = tail call i8* @calloc(i64 %29, i64 8)
%35 = bitcast i8* %34 to double*
%36 = tail call i8* @calloc(i64 %29, i64 8)
%37 = bitcast i8* %36 to double*
%38 = icmp eq i32 %9, 0
br i1 %38, label %155, label %101
39: ; preds = %101
br i1 %38, label %155, label %40
40: ; preds = %39
%41 = icmp ult i32 %9, 4
br i1 %41, label %99, label %42
42: ; preds = %40
%43 = and i64 %29, 4294967292
%44 = insertelement <2 x double> poison, double %13, i64 0
%45 = shufflevector <2 x double> %44, <2 x double> poison, <2 x i32> zeroinitializer
%46 = insertelement <2 x double> poison, double %13, i64 0
%47 = shufflevector <2 x double> %46, <2 x double> poison, <2 x i32> zeroinitializer
%48 = add nsw i64 %43, -4
%49 = lshr exact i64 %48, 2
%50 = add nuw nsw i64 %49, 1
%51 = and i64 %50, 1
%52 = icmp eq i64 %48, 0
br i1 %52, label %83, label %53
53: ; preds = %42
%54 = and i64 %50, 9223372036854775806
br label %55
55: ; preds = %55, %53
%56 = phi i64 [ 0, %53 ], [ %79, %55 ]
%57 = phi <2 x i32> [ <i32 0, i32 1>, %53 ], [ %80, %55 ]
%58 = phi i64 [ 0, %53 ], [ %81, %55 ]
%59 = add <2 x i32> %57, <i32 2, i32 2>
%60 = sitofp <2 x i32> %57 to <2 x double>
%61 = sitofp <2 x i32> %59 to <2 x double>
%62 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %60, <2 x double> %45, <2 x double> <double -4.000000e+00, double -4.000000e+00>)
%63 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %61, <2 x double> %47, <2 x double> <double -4.000000e+00, double -4.000000e+00>)
%64 = getelementptr inbounds double, double* %35, i64 %56
%65 = bitcast double* %64 to <2 x double>*
store <2 x double> %62, <2 x double>* %65
%66 = getelementptr inbounds double, double* %64, i64 2
%67 = bitcast double* %66 to <2 x double>*
store <2 x double> %63, <2 x double>* %67
%68 = or i64 %56, 4
%69 = add <2 x i32> %57, <i32 4, i32 4>
%70 = add <2 x i32> %57, <i32 6, i32 6>
%71 = sitofp <2 x i32> %69 to <2 x double>
%72 = sitofp <2 x i32> %70 to <2 x double>
%73 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %71, <2 x double> %45, <2 x double> <double -4.000000e+00, double -4.000000e+00>)
%74 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %72, <2 x double> %47, <2 x double> <double -4.000000e+00, double -4.000000e+00>)
%75 = getelementptr inbounds double, double* %35, i64 %68
%76 = bitcast double* %75 to <2 x double>*
store <2 x double> %73, <2 x double>* %76
%77 = getelementptr inbounds double, double* %75, i64 2
%78 = bitcast double* %77 to <2 x double>*
store <2 x double> %74, <2 x double>* %78
%79 = add nuw i64 %56, 8
%80 = add <2 x i32> %57, <i32 8, i32 8>
%81 = add i64 %58, 2
%82 = icmp eq i64 %81, %54
br i1 %82, label %83, label %55
83: ; preds = %55, %42
%84 = phi i64 [ 0, %42 ], [ %79, %55 ]
%85 = phi <2 x i32> [ <i32 0, i32 1>, %42 ], [ %80, %55 ]
%86 = icmp eq i64 %51, 0
br i1 %86, label %97, label %87
87: ; preds = %83
%88 = add <2 x i32> %85, <i32 2, i32 2>
%89 = sitofp <2 x i32> %85 to <2 x double>
%90 = sitofp <2 x i32> %88 to <2 x double>
%91 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %89, <2 x double> %45, <2 x double> <double -4.000000e+00, double -4.000000e+00>)
%92 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %90, <2 x double> %47, <2 x double> <double -4.000000e+00, double -4.000000e+00>)
%93 = getelementptr inbounds double, double* %35, i64 %84
%94 = bitcast double* %93 to <2 x double>*
store <2 x double> %91, <2 x double>* %94
%95 = getelementptr inbounds double, double* %93, i64 2
%96 = bitcast double* %95 to <2 x double>*
store <2 x double> %92, <2 x double>* %96
br label %97
97: ; preds = %83, %87
%98 = icmp eq i64 %43, %29
br i1 %98, label %111, label %99
99: ; preds = %40, %97
%100 = phi i64 [ 0, %40 ], [ %43, %97 ]
br label %121
101: ; preds = %28, %101
%102 = phi i64 [ %109, %101 ], [ 0, %28 ]
%103 = tail call i8* @calloc(i64 %29, i64 8)
%104 = getelementptr inbounds double*, double** %31, i64 %102
%105 = bitcast double** %104 to i8**
store i8* %103, i8** %105
%106 = tail call i8* @calloc(i64 %29, i64 8)
%107 = getelementptr inbounds double*, double** %33, i64 %102
%108 = bitcast double** %107 to i8**
store i8* %106, i8** %108
%109 = add nuw nsw i64 %102, 1
%110 = icmp eq i64 %109, %29
br i1 %110, label %39, label %101
111: ; preds = %121, %97
br i1 %38, label %155, label %112
112: ; preds = %111
%113 = fmul double %6, -5.000000e-01
%114 = fmul double %113, %6
%115 = fmul double %114, %4
%116 = fneg double %8
%117 = tail call double @llvm.fmuladd.f64(double %116, double %8, double 1.000000e+00)
%118 = fmul double %7, -5.000000e-01
%119 = fmul double %118, %7
%120 = fmul double %119, %4
br label %129
121: ; preds = %99, %121
%122 = phi i64 [ %127, %121 ], [ %100, %99 ]
%123 = trunc i64 %122 to i32
%124 = sitofp i32 %123 to double
%125 = tail call double @llvm.fmuladd.f64(double %124, double %13, double -4.000000e+00)
%126 = getelementptr inbounds double, double* %35, i64 %122
store double %125, double* %126
%127 = add nuw nsw i64 %122, 1
%128 = icmp eq i64 %127, %29
br i1 %128, label %111, label %121
129: ; preds = %112, %152
%130 = phi i64 [ 0, %112 ], [ %153, %152 ]
%131 = getelementptr inbounds double, double* %35, i64 %130
%132 = load double, double* %131
%133 = tail call double @llvm.fmuladd.f64(double %132, double %15, double %115)
%134 = getelementptr inbounds double*, double** %31, i64 %130
%135 = load double*, double** %134
%136 = getelementptr inbounds double*, double** %33, i64 %130
%137 = load double*, double** %136
br label %138
138: ; preds = %129, %138
%139 = phi i64 [ 0, %129 ], [ %150, %138 ]
%140 = tail call double @exp(double %133)
%141 = getelementptr inbounds double, double* %135, i64 %139
store double %140, double* %141
%142 = tail call double @sqrt(double %117)
%143 = getelementptr inbounds double, double* %35, i64 %139
%144 = load double, double* %143
%145 = fmul double %142, %144
%146 = tail call double @llvm.fmuladd.f64(double %8, double %132, double %145)
%147 = tail call double @llvm.fmuladd.f64(double %146, double %17, double %120)
%148 = tail call double @exp(double %147)
%149 = getelementptr inbounds double, double* %137, i64 %139
store double %148, double* %149
%150 = add nuw nsw i64 %139, 1
%151 = icmp eq i64 %150, %29
br i1 %151, label %152, label %138
152: ; preds = %138
%153 = add nuw nsw i64 %130, 1
%154 = icmp eq i64 %153, %29
br i1 %154, label %155, label %129
155: ; preds = %152, %28, %39, %111
%156 = fmul double %13, 5.000000e-01
%157 = fadd double %156, -4.000000e+00
%158 = tail call i32 (double, ...) bitcast (i32 (...)* @rq_pricing_cumul_norm_dist to i32 (double, ...)*)(double %157)
%159 = sitofp i32 %158 to double
store double %159, double* %37
%160 = fsub double 4.000000e+00, %156
%161 = tail call i32 (double, ...) bitcast (i32 (...)* @rq_pricing_cumul_norm_dist to i32 (double, ...)*)(double %160)
%162 = sitofp i32 %161 to double
%163 = fsub double 1.000000e+00, %162
%164 = add i32 %9, -1
%165 = zext i32 %164 to i64
%166 = getelementptr inbounds double, double* %37, i64 %165
store double %163, double* %166
%167 = icmp ugt i32 %164, 1
br i1 %167, label %172, label %168
168: ; preds = %172, %155
br i1 %38, label %224, label %169
169: ; preds = %168
%170 = icmp eq i32 %0, 0
%171 = fneg double %1
br label %186
172: ; preds = %155, %172
%173 = phi i64 [ %184, %172 ], [ 1, %155 ]
%174 = trunc i64 %173 to i32
%175 = sitofp i32 %174 to double
%176 = tail call double @llvm.fmuladd.f64(double %175, double %13, double -4.000000e+00)
%177 = fadd double %156, %176
%178 = tail call i32 (double, ...) bitcast (i32 (...)* @rq_pricing_cumul_norm_dist to i32 (double, ...)*)(double %177)
%179 = fsub double %176, %156
%180 = tail call i32 (double, ...) bitcast (i32 (...)* @rq_pricing_cumul_norm_dist to i32 (double, ...)*)(double %179)
%181 = sub nsw i32 %178, %180
%182 = sitofp i32 %181 to double
%183 = getelementptr inbounds double, double* %37, i64 %173
store double %182, double* %183
%184 = add nuw nsw i64 %173, 1
%185 = icmp eq i64 %184, %165
br i1 %185, label %168, label %172
186: ; preds = %169, %221
%187 = phi i64 [ 0, %169 ], [ %222, %221 ]
%188 = phi double [ 0.000000e+00, %169 ], [ %218, %221 ]
%189 = getelementptr inbounds double, double* %37, i64 %187
%190 = load double, double* %189
%191 = getelementptr inbounds double*, double** %31, i64 %187
%192 = getelementptr inbounds double*, double** %33, i64 %187
%193 = load double*, double** %191
%194 = load double*, double** %192
br label %195
195: ; preds = %186, %211
%196 = phi i64 [ 0, %186 ], [ %219, %211 ]
%197 = phi double [ %188, %186 ], [ %218, %211 ]
%198 = getelementptr inbounds double, double* %193, i64 %196
%199 = load double, double* %198
%200 = getelementptr inbounds double, double* %194, i64 %196
%201 = load double, double* %200
br i1 %170, label %207, label %202
202: ; preds = %195
%203 = fneg double %201
%204 = fmul double %203, %2
%205 = tail call double @llvm.fmuladd.f64(double %1, double %199, double %204)
%206 = fsub double %205, %3
br label %211
207: ; preds = %195
%208 = fmul double %201, %2
%209 = tail call double @llvm.fmuladd.f64(double %171, double %199, double %208)
%210 = fadd double %209, %3
br label %211
211: ; preds = %207, %202
%212 = phi double [ %206, %202 ], [ %210, %207 ]
%213 = fcmp olt double %212, 0.000000e+00
%214 = select i1 %213, double 0.000000e+00, double %212
%215 = getelementptr inbounds double, double* %37, i64 %196
%216 = load double, double* %215
%217 = fmul double %190, %216
%218 = tail call double @llvm.fmuladd.f64(double %217, double %214, double %197)
%219 = add nuw nsw i64 %196, 1
%220 = icmp eq i64 %219, %29
br i1 %220, label %221, label %195
221: ; preds = %211
%222 = add nuw nsw i64 %187, 1
%223 = icmp eq i64 %222, %29
br i1 %223, label %224, label %186
224: ; preds = %221, %168
%225 = phi double [ 0.000000e+00, %168 ], [ %218, %221 ]
tail call void @free(i8* %36)
tail call void @free(i8* %34)
br i1 %38, label %236, label %226
226: ; preds = %224, %226
%227 = phi i64 [ %234, %226 ], [ 0, %224 ]
%228 = getelementptr inbounds double*, double** %31, i64 %227
%229 = bitcast double** %228 to i8**
%230 = load i8*, i8** %229
tail call void @free(i8* %230)
%231 = getelementptr inbounds double*, double** %33, i64 %227
%232 = bitcast double** %231 to i8**
%233 = load i8*, i8** %232
tail call void @free(i8* %233)
%234 = add nuw nsw i64 %227, 1
%235 = icmp eq i64 %234, %29
br i1 %235, label %236, label %226
236: ; preds = %226, %224
tail call void @free(i8* %30)
tail call void @free(i8* %32)
br label %237
237: ; preds = %236, %19
%238 = phi double [ %27, %19 ], [ %225, %236 ]
ret double %238
}