#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double exp(double);
double log(double);
double rq_pricing_blackscholes(short, double, double, double, double, double,
                               double, double);
double sqrt(double);
double rq_pricing_average_strike(short call, int num_ratesets,
                                 double *rateset_dates, double *rateset_weights,
                                 double S, double r_dom, double r_for,
                                 double sigma, double tau_e, double tau_d) {
  double ax = 0.0;
  double var_ax = 0.0;
  double vx;
  double rho = 0.0;
  int i;
  double b = r_dom - r_for;
  for (i = 0; i < num_ratesets; i++) {
    double ti = rateset_dates[i] / 2.0;
    double weight_i = rateset_weights[i];
    int j;
    double weight_f = weight_i * exp(b * ti);
    ax += weight_f;
    rho += weight_f * (exp(sigma * sigma * ti) - 1.0);
    for (j = 0; j < num_ratesets; j++) {
      double tj = rateset_dates[j] / 2.0;
      double weight_j = rateset_weights[j];
      var_ax += weight_i * weight_j * exp(b * (ti + tj)) *
                (exp(sigma * sigma * ((ti) < (tj) ? (ti) : (tj))) - 1.0);
    }
  }
  ax *= S;
  var_ax *= S * S;
  vx = sqrt(log(var_ax / (ax * ax) + 1) / tau_e);
  rho *= S / sqrt(var_ax * (exp(sigma * sigma * tau_e) - 1.0));
  vx = sqrt(vx * vx + sigma * sigma - 2 * rho * vx * sigma);
  return rq_pricing_blackscholes(call, S * exp(b * tau_d), ax, r_dom, r_for, vx,
                                 tau_e, tau_d);
}


x86 assembly (clang, -O0):
<rq_pricing_average_strike>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
movsd  %xmm4,-0x40(%rbp)
movsd  %xmm5,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13d0 <rq_pricing_average_strike+0x290>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xe36(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0xb0(%rbp),%xmm0
ff
movsd  0xda1(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13bd <rq_pricing_average_strike+0x27d>
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xd52(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x18(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
addsd  -0xa0(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x80(%rbp),%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1357 <rq_pricing_average_strike+0x217>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
jmp    1367 <rq_pricing_average_strike+0x227>
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0xd8(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0xc8(%rbp),%xmm0
ff
movsd  0xc75(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1287 <rq_pricing_average_strike+0x147>
jmp    13c2 <rq_pricing_average_strike+0x282>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    11a9 <rq_pricing_average_strike+0x69>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xbfa(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <log@plt>
divsd  -0x40(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xf8(%rbp),%xmm0
ff
movsd  0xba1(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xf0(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xb4f(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
mov    -0x2(%rbp),%ax
mov    %ax,-0xe2(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
movsd  -0x78(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
call   1030 <exp@plt>
mov    -0xe2(%rbp),%ax
movaps %xmm0,%xmm1
movsd  -0xe0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm4
movsd  -0x40(%rbp),%xmm5
movsd  -0x48(%rbp),%xmm6
movswl %ax,%edi
call   1040 <rq_pricing_blackscholes@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_pricing_average_strike>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
movsd  %xmm5,0x50(%rsp)
movsd  %xmm4,0x38(%rsp)
movsd  %xmm0,0x30(%rsp)
mov    %edi,%r14d
movsd  %xmm1,0x68(%rsp)
movsd  %xmm2,0x70(%rsp)
subsd  %xmm2,%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  %xmm3,0x60(%rsp)
mulsd  %xmm3,%xmm3
movsd  %xmm3,0x18(%rsp)
xorpd  %xmm1,%xmm1
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
test   %esi,%esi
jle    130d <rq_pricing_average_strike+0x1cd>
mov    %rcx,%r15
mov    %rdx,%r13
mov    %esi,%ebx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %r12d,%r12d
movsd  0xe3e(%rip),%xmm2
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
xorpd  %xmm1,%xmm1
xchg   %ax,%ax
movsd  %xmm1,0x20(%rsp)
movsd  0x0(%r13,%r12,8),%xmm1
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  (%r15,%r12,8),%xmm0
movsd  %xmm0,0x58(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm1
mulsd  0x58(%rsp),%xmm1
movsd  %xmm1,0x48(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1030 <exp@plt>
movsd  0xdcd(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  0x48(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
xor    %ebp,%ebp
movsd  (%rsp),%xmm0
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  0x0(%r13,%rbp,8),%xmm1
mulsd  0xd8c(%rip),%xmm1
movsd  %xmm1,0x48(%rsp)
movsd  (%r15,%rbp,8),%xmm0
mulsd  0x58(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
mulsd  0x28(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
minsd  0x48(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
call   1030 <exp@plt>
addsd  0xd3c(%rip),%xmm0
mulsd  0x20(%rsp),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1260 <rq_pricing_average_strike+0x120>
add    $0x1,%r12
cmp    %rbx,%r12
movsd  0x40(%rsp),%xmm1
movsd  0xcf9(%rip),%xmm2
jne    11d0 <rq_pricing_average_strike+0x90>
movsd  %xmm1,0x40(%rsp)
movsd  0x30(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm0
mulsd  (%rsp),%xmm0
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm0,(%rsp)
divsd  %xmm1,%xmm0
addsd  0xcc9(%rip),%xmm0
call   1050 <log@plt>
divsd  0x38(%rsp),%xmm0
ucomisd 0xcc6(%rip),%xmm0
jb     1362 <rq_pricing_average_strike+0x222>
sqrtsd %xmm0,%xmm0
jmp    1367 <rq_pricing_average_strike+0x227>
call   1060 <sqrt@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  0x38(%rsp),%xmm0
call   1030 <exp@plt>
addsd  0xc82(%rip),%xmm0
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm1
jb     13a3 <rq_pricing_average_strike+0x263>
sqrtsd %xmm0,%xmm0
jmp    13ac <rq_pricing_average_strike+0x26c>
call   1060 <sqrt@plt>
xorpd  %xmm3,%xmm3
movsd  0x30(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x40(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
addsd  0x18(%rsp),%xmm1
mulsd  0xc3c(%rip),%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x60(%rsp),%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm3,%xmm0
jb     13f6 <rq_pricing_average_strike+0x2b6>
sqrtsd %xmm0,%xmm0
jmp    13fb <rq_pricing_average_strike+0x2bb>
call   1060 <sqrt@plt>
movsd  %xmm0,(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  0x50(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x30(%rsp),%xmm0
movswl %r14w,%edi
movsd  0x8(%rsp),%xmm1
movsd  0x68(%rsp),%xmm2
movsd  0x70(%rsp),%xmm3
movsd  (%rsp),%xmm4
movsd  0x38(%rsp),%xmm5
movsd  0x50(%rsp),%xmm6
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <rq_pricing_blackscholes@plt>

LLVM IR (-O0):
define double @rq_pricing_average_strike(i16 signext %0, i32 %1, double* %2, double* %3, double %4, double %5, double %6, double %7, double %8, double %9) {
%11 = alloca i16
%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 double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca i32
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca i32
%30 = alloca double
%31 = alloca double
%32 = alloca double
store i16 %0, i16* %11
store i32 %1, i32* %12
store double* %2, double** %13
store double* %3, double** %14
store double %4, double* %15
store double %5, double* %16
store double %6, double* %17
store double %7, double* %18
store double %8, double* %19
store double %9, double* %20
store double 0.000000e+00, double* %21
store double 0.000000e+00, double* %22
store double 0.000000e+00, double* %24
%33 = load double, double* %16
%34 = load double, double* %17
%35 = fsub double %33, %34
store double %35, double* %26
store i32 0, i32* %25
br label %36
36: ; preds = %118, %10
%37 = load i32, i32* %25
%38 = load i32, i32* %12
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %121
40: ; preds = %36
%41 = load double*, double** %13
%42 = load i32, i32* %25
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
%45 = load double, double* %44
%46 = fdiv double %45, 2.000000e+00
store double %46, double* %27
%47 = load double*, double** %14
%48 = load i32, i32* %25
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
store double %51, double* %28
%52 = load double, double* %28
%53 = load double, double* %26
%54 = load double, double* %27
%55 = fmul double %53, %54
%56 = call double @exp(double %55)
%57 = fmul double %52, %56
store double %57, double* %30
%58 = load double, double* %30
%59 = load double, double* %21
%60 = fadd double %59, %58
store double %60, double* %21
%61 = load double, double* %30
%62 = load double, double* %18
%63 = load double, double* %18
%64 = fmul double %62, %63
%65 = load double, double* %27
%66 = fmul double %64, %65
%67 = call double @exp(double %66)
%68 = fsub double %67, 1.000000e+00
%69 = load double, double* %24
%70 = call double @llvm.fmuladd.f64(double %61, double %68, double %69)
store double %70, double* %24
store i32 0, i32* %29
br label %71
71: ; preds = %114, %40
%72 = load i32, i32* %29
%73 = load i32, i32* %12
%74 = icmp slt i32 %72, %73
br i1 %74, label %75, label %117
75: ; preds = %71
%76 = load double*, double** %13
%77 = load i32, i32* %29
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %76, i64 %78
%80 = load double, double* %79
%81 = fdiv double %80, 2.000000e+00
store double %81, double* %31
%82 = load double*, double** %14
%83 = load i32, i32* %29
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %82, i64 %84
%86 = load double, double* %85
store double %86, double* %32
%87 = load double, double* %28
%88 = load double, double* %32
%89 = fmul double %87, %88
%90 = load double, double* %26
%91 = load double, double* %27
%92 = load double, double* %31
%93 = fadd double %91, %92
%94 = fmul double %90, %93
%95 = call double @exp(double %94)
%96 = fmul double %89, %95
%97 = load double, double* %18
%98 = load double, double* %18
%99 = fmul double %97, %98
%100 = load double, double* %27
%101 = load double, double* %31
%102 = fcmp olt double %100, %101
br i1 %102, label %103, label %105
103: ; preds = %75
%104 = load double, double* %27
br label %107
105: ; preds = %75
%106 = load double, double* %31
br label %107
107: ; preds = %105, %103
%108 = phi double [ %104, %103 ], [ %106, %105 ]
%109 = fmul double %99, %108
%110 = call double @exp(double %109)
%111 = fsub double %110, 1.000000e+00
%112 = load double, double* %22
%113 = call double @llvm.fmuladd.f64(double %96, double %111, double %112)
store double %113, double* %22
br label %114
114: ; preds = %107
%115 = load i32, i32* %29
%116 = add nsw i32 %115, 1
store i32 %116, i32* %29
br label %71
117: ; preds = %71
br label %118
118: ; preds = %117
%119 = load i32, i32* %25
%120 = add nsw i32 %119, 1
store i32 %120, i32* %25
br label %36
121: ; preds = %36
%122 = load double, double* %15
%123 = load double, double* %21
%124 = fmul double %123, %122
store double %124, double* %21
%125 = load double, double* %15
%126 = load double, double* %15
%127 = fmul double %125, %126
%128 = load double, double* %22
%129 = fmul double %128, %127
store double %129, double* %22
%130 = load double, double* %22
%131 = load double, double* %21
%132 = load double, double* %21
%133 = fmul double %131, %132
%134 = fdiv double %130, %133
%135 = fadd double %134, 1.000000e+00
%136 = call double @log(double %135)
%137 = load double, double* %19
%138 = fdiv double %136, %137
%139 = call double @sqrt(double %138)
store double %139, double* %23
%140 = load double, double* %15
%141 = load double, double* %22
%142 = load double, double* %18
%143 = load double, double* %18
%144 = fmul double %142, %143
%145 = load double, double* %19
%146 = fmul double %144, %145
%147 = call double @exp(double %146)
%148 = fsub double %147, 1.000000e+00
%149 = fmul double %141, %148
%150 = call double @sqrt(double %149)
%151 = fdiv double %140, %150
%152 = load double, double* %24
%153 = fmul double %152, %151
store double %153, double* %24
%154 = load double, double* %23
%155 = load double, double* %23
%156 = load double, double* %18
%157 = load double, double* %18
%158 = fmul double %156, %157
%159 = call double @llvm.fmuladd.f64(double %154, double %155, double %158)
%160 = load double, double* %24
%161 = fmul double 2.000000e+00, %160
%162 = load double, double* %23
%163 = fmul double %161, %162
%164 = load double, double* %18
%165 = fneg double %163
%166 = call double @llvm.fmuladd.f64(double %165, double %164, double %159)
%167 = call double @sqrt(double %166)
store double %167, double* %23
%168 = load i16, i16* %11
%169 = load double, double* %15
%170 = load double, double* %26
%171 = load double, double* %20
%172 = fmul double %170, %171
%173 = call double @exp(double %172)
%174 = fmul double %169, %173
%175 = load double, double* %21
%176 = load double, double* %16
%177 = load double, double* %17
%178 = load double, double* %23
%179 = load double, double* %19
%180 = load double, double* %20
%181 = call double @rq_pricing_blackscholes(i16 signext %168, double %174, double %175, double %176, double %177, double %178, double %179, double %180)
ret double %181
}

LLVM IR (-O2):
define double @rq_pricing_average_strike(i16 signext %0, i32 %1, double* nocapture %2, double* nocapture %3, double %4, double %5, double %6, double %7, double %8, double %9) {
%11 = fsub double %5, %6
%12 = icmp sgt i32 %1, 0
%13 = fmul double %7, %7
br i1 %12, label %14, label %58
14: ; preds = %10
%15 = zext i32 %1 to i64
br label %16
16: ; preds = %55, %14
%17 = phi i64 [ 0, %14 ], [ %56, %55 ]
%18 = phi double [ 0.000000e+00, %14 ], [ %29, %55 ]
%19 = phi double [ 0.000000e+00, %14 ], [ %52, %55 ]
%20 = phi double [ 0.000000e+00, %14 ], [ %33, %55 ]
%21 = getelementptr inbounds double, double* %2, i64 %17
%22 = load double, double* %21
%23 = fmul double %22, 5.000000e-01
%24 = getelementptr inbounds double, double* %3, i64 %17
%25 = load double, double* %24
%26 = fmul double %11, %23
%27 = tail call double @exp(double %26)
%28 = fmul double %25, %27
%29 = fadd double %18, %28
%30 = fmul double %13, %23
%31 = tail call double @exp(double %30)
%32 = fadd double %31, -1.000000e+00
%33 = tail call double @llvm.fmuladd.f64(double %28, double %32, double %20)
br label %34
34: ; preds = %16, %34
%35 = phi i64 [ 0, %16 ], [ %53, %34 ]
%36 = phi double [ %19, %16 ], [ %52, %34 ]
%37 = getelementptr inbounds double, double* %2, i64 %35
%38 = load double, double* %37
%39 = fmul double %38, 5.000000e-01
%40 = getelementptr inbounds double, double* %3, i64 %35
%41 = load double, double* %40
%42 = fmul double %25, %41
%43 = fadd double %23, %39
%44 = fmul double %11, %43
%45 = tail call double @exp(double %44)
%46 = fmul double %42, %45
%47 = fcmp olt double %23, %39
%48 = select i1 %47, double %23, double %39
%49 = fmul double %13, %48
%50 = tail call double @exp(double %49)
%51 = fadd double %50, -1.000000e+00
%52 = tail call double @llvm.fmuladd.f64(double %46, double %51, double %36)
%53 = add nuw nsw i64 %35, 1
%54 = icmp eq i64 %53, %15
br i1 %54, label %55, label %34
55: ; preds = %34
%56 = add nuw nsw i64 %17, 1
%57 = icmp eq i64 %56, %15
br i1 %57, label %58, label %16
58: ; preds = %55, %10
%59 = phi double [ 0.000000e+00, %10 ], [ %33, %55 ]
%60 = phi double [ 0.000000e+00, %10 ], [ %52, %55 ]
%61 = phi double [ 0.000000e+00, %10 ], [ %29, %55 ]
%62 = fmul double %61, %4
%63 = fmul double %4, %4
%64 = fmul double %63, %60
%65 = fmul double %62, %62
%66 = fdiv double %64, %65
%67 = fadd double %66, 1.000000e+00
%68 = tail call double @log(double %67)
%69 = fdiv double %68, %8
%70 = tail call double @sqrt(double %69)
%71 = fmul double %13, %8
%72 = tail call double @exp(double %71)
%73 = fadd double %72, -1.000000e+00
%74 = fmul double %64, %73
%75 = tail call double @sqrt(double %74)
%76 = fdiv double %4, %75
%77 = fmul double %59, %76
%78 = tail call double @llvm.fmuladd.f64(double %70, double %70, double %13)
%79 = fmul double %77, -2.000000e+00
%80 = fmul double %70, %79
%81 = tail call double @llvm.fmuladd.f64(double %80, double %7, double %78)
%82 = tail call double @sqrt(double %81)
%83 = fmul double %11, %9
%84 = tail call double @exp(double %83)
%85 = fmul double %84, %4
%86 = tail call double @rq_pricing_blackscholes(i16 signext %0, double %85, double %62, double %5, double %6, double %82, double %8, double %9)
ret double %86
}