#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);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
double pow(double, int);
double sqrt(double);
double rq_pricing_binomial(short call, double S, double X, double r_dom,
                           double r_for, double sigma, double tau_e,
                           double tau_d, int num_iters, double *passed_vals) {
  double *vals =
      (passed_vals ? passed_vals
                   : (double *)malloc(sizeof(double) * (num_iters + 1)));
  double xy_d = tau_d / num_iters;
  double xy_e = tau_e / num_iters;
  double rr = pow(1.0 + (r_dom - r_for), xy_d);
  double rd = pow(1.0 + r_dom, xy_d);
  double rr_sqr = rr * rr;
  double bb = rr_sqr * (exp(sigma * sigma * xy_e) - 1.0);
  double ab = rr_sqr + bb + 1.0;
  double u = (ab + sqrt((ab * ab) - (4.0 * rr_sqr))) / (2.0 * rr);
  double d = 1 / u;
  double p = (rr - d) / (u - d);
  double q = 1 - p;
  double upr = pow(d, num_iters);
  double uinc = u / d;
  double value = 0.0;
  int i;
  for (i = 0; i <= num_iters; i++) {
    double oval = (call ? ((S * upr) - X) : (X - (S * upr)));
    if (oval < 0.0)
      oval = 0.0;
    vals[i] = oval;
    upr *= uinc;
  }
  for (num_iters--; num_iters >= 0; num_iters--) {
    for (i = 0; i <= num_iters; i++) {
      vals[i] = ((p * vals[i + 1]) + (q * vals[i])) / rd;
      if (vals[i] < 0)
        vals[i] = 0.0;
    }
  }
  value = vals[0];
  if (!passed_vals)
    free(vals);
  return value;
}


x86 assembly (clang, -O0):
<rq_pricing_binomial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  %xmm6,-0x40(%rbp)
mov    %esi,-0x44(%rbp)
mov    %rdx,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     11a7 <rq_pricing_binomial+0x57>
mov    -0x50(%rbp),%rax
mov    %rax,-0xe0(%rbp)
jmp    11c1 <rq_pricing_binomial+0x71>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rax
mov    %rax,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x44(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x44(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
movsd  0xdfc(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si -0x60(%rbp),%edi
call   1060 <pow@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  0xde1(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
cvttsd2si -0x60(%rbp),%edi
call   1060 <pow@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
call   1050 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xf0(%rbp),%xmm0
ff
movsd  0xd8a(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  0xd65(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm2
ff
movsd  0xd41(%rip),%xmm1
mulsd  -0x80(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xe8(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  0xcf9(%rip),%xmm1
mulsd  -0x70(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xcd8(%rip),%xmm0
divsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
subsd  -0xa0(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm1
ff
subsd  -0xa0(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0xc97(%rip),%xmm0
subsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x44(%rbp),%edi
call   1060 <pow@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
divsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movl   $0x0,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     14c1 <rq_pricing_binomial+0x371>
movswl -0x2(%rbp),%eax
cmp    $0x0,%eax
je     1418 <rq_pricing_binomial+0x2c8>
movsd  -0x10(%rbp),%xmm0
movsd  -0xb8(%rbp),%xmm2
ff
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
jmp    1451 <rq_pricing_binomial+0x301>
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  -0xb8(%rbp),%xmm2
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0xf8(%rbp),%xmm0
ff
movsd  %xmm0,-0xd8(%rbp)
ff
xorps  %xmm0,%xmm0
ucomisd -0xd8(%rbp),%xmm0
ff
jbe    147d <rq_pricing_binomial+0x32d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
mov    -0x58(%rbp),%rax
movslq -0xcc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    13be <rq_pricing_binomial+0x26e>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jl     1597 <rq_pricing_binomial+0x447>
movl   $0x0,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     1584 <rq_pricing_binomial+0x434>
movsd  -0xa8(%rbp),%xmm0
ff
mov    -0x58(%rbp),%rax
mov    -0xcc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0xb0(%rbp),%xmm1
ff
mov    -0x58(%rbp),%rax
movslq -0xcc(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x78(%rbp),%xmm0
mov    -0x58(%rbp),%rax
movslq -0xcc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%rax
movslq -0xcc(%rbp),%rcx
xorps  %xmm0,%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    156b <rq_pricing_binomial+0x41b>
mov    -0x58(%rbp),%rax
movslq -0xcc(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1570 <rq_pricing_binomial+0x420>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    14de <rq_pricing_binomial+0x38e>
jmp    1589 <rq_pricing_binomial+0x439>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    14ca <rq_pricing_binomial+0x37a>
mov    -0x58(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
cmpq   $0x0,-0x50(%rbp)
jne    15bb <rq_pricing_binomial+0x46b>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
movsd  -0xc8(%rbp),%xmm0
ff
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_pricing_binomial>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %rdx,%r14
mov    %esi,%r15d
movsd  %xmm4,0x8(%rsp)
movaps %xmm1,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
mov    %edi,%r12d
mov    %rdx,%rbx
test   %rdx,%rdx
movsd  %xmm2,0x30(%rsp)
jne    11bb <rq_pricing_binomial+0x6b>
lea    0x8(,%r15,8),%edi
movsd  %xmm5,(%rsp)
movsd  %xmm6,0x10(%rsp)
movsd  %xmm3,0x28(%rsp)
call   1040 <malloc@plt>
movsd  0x28(%rsp),%xmm3
movsd  0x10(%rsp),%xmm6
movsd  0x30(%rsp),%xmm2
movsd  (%rsp),%xmm5
mov    %rax,%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
divsd  %xmm0,%xmm6
divsd  %xmm0,%xmm5
movsd  %xmm5,(%rsp)
movapd %xmm2,%xmm0
subsd  %xmm3,%xmm0
movsd  0xe20(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm6,%ebp
mov    %ebp,%edi
call   1060 <pow@plt>
movapd %xmm0,0x10(%rsp)
movsd  0xe03(%rip),%xmm0
movsd  0x30(%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
mov    %ebp,%edi
call   1060 <pow@plt>
movapd %xmm0,0x30(%rsp)
movapd 0x10(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
mulsd  (%rsp),%xmm0
call   1050 <exp@plt>
movsd  0xdbc(%rip),%xmm2
movapd %xmm0,%xmm3
addsd  0xdb8(%rip),%xmm3
movsd  0x28(%rsp),%xmm0
mulsd  %xmm0,%xmm3
addsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
mulsd  0xda6(%rip),%xmm0
movapd %xmm0,%xmm1
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     128d <rq_pricing_binomial+0x13d>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    12a8 <rq_pricing_binomial+0x158>
movsd  %xmm3,(%rsp)
call   1070 <sqrt@plt>
movsd  (%rsp),%xmm3
movsd  0xd5c(%rip),%xmm2
movapd %xmm0,%xmm1
movapd 0x10(%rsp),%xmm0
addsd  %xmm3,%xmm1
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r15d,%edi
call   1060 <pow@plt>
movsd  (%rsp),%xmm11
movapd 0x10(%rsp),%xmm7
movsd  0xd16(%rip),%xmm8
test   %r15d,%r15d
movapd 0x30(%rsp),%xmm6
js     150d <rq_pricing_binomial+0x3bd>
movapd 0xd1f(%rip),%xmm1
movapd 0x40(%rsp),%xmm10
movapd %xmm10,%xmm9
xorpd  %xmm1,%xmm9
movapd 0x50(%rsp),%xmm2
xorpd  %xmm2,%xmm1
lea    0x1(%r15),%ecx
test   %r15d,%r15d
je     13af <rq_pricing_binomial+0x25f>
movapd %xmm11,%xmm3
divsd  0x8(%rsp),%xmm3
mov    %ecx,%edx
and    $0xfffffffe,%edx
xor    %eax,%eax
jmp    1368 <rq_pricing_binomial+0x218>
nopl   (%rax)
movapd %xmm2,%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm9,%xmm4
xorpd  %xmm5,%xmm5
maxsd  %xmm4,%xmm5
movsd  %xmm5,0x8(%rbx,%rax,8)
mulsd  %xmm3,%xmm0
add    $0x2,%rax
cmp    %rax,%rdx
je     13b1 <rq_pricing_binomial+0x261>
test   %r12w,%r12w
je     1380 <rq_pricing_binomial+0x230>
movapd %xmm2,%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm9,%xmm4
jmp    138d <rq_pricing_binomial+0x23d>
nopl   (%rax)
movapd %xmm1,%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm10,%xmm4
xorpd  %xmm5,%xmm5
maxsd  %xmm4,%xmm5
movsd  %xmm5,(%rbx,%rax,8)
mulsd  %xmm3,%xmm0
jne    1340 <rq_pricing_binomial+0x1f0>
movapd %xmm1,%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm10,%xmm4
jmp    134d <rq_pricing_binomial+0x1fd>
xor    %eax,%eax
test   $0x1,%cl
je     13e1 <rq_pricing_binomial+0x291>
test   %r12w,%r12w
je     13cb <rq_pricing_binomial+0x27b>
mulsd  %xmm0,%xmm2
addsd  %xmm9,%xmm2
movapd %xmm2,%xmm1
jmp    13d4 <rq_pricing_binomial+0x284>
mulsd  %xmm0,%xmm1
addsd  %xmm10,%xmm1
xorpd  %xmm0,%xmm0
maxsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx,%rax,8)
test   %r15d,%r15d
jle    150d <rq_pricing_binomial+0x3bd>
movsd  0x8(%rsp),%xmm0
subsd  %xmm0,%xmm7
subsd  %xmm0,%xmm11
divsd  %xmm11,%xmm7
subsd  %xmm7,%xmm8
mov    %r15d,%r8d
movapd %xmm8,%xmm0
unpcklpd %xmm8,%xmm0
movapd %xmm7,%xmm1
unpcklpd %xmm7,%xmm1
movapd %xmm6,%xmm2
unpcklpd %xmm6,%xmm2
xor    %ecx,%ecx
mov    %r8,%rax
jmp    1445 <rq_pricing_binomial+0x2f5>
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rax),%rdx
add    $0x1,%rcx
cmp    $0x2,%rax
mov    %rdx,%rax
jl     150d <rq_pricing_binomial+0x3bd>
mov    %r8,%rdi
sub    %rcx,%rdi
movsd  (%rbx),%xmm3
cmp    $0x2,%rdi
jae    1460 <rq_pricing_binomial+0x310>
xor    %esi,%esi
jmp    14d0 <rq_pricing_binomial+0x380>
nopl   0x0(%rax)
mov    %rax,%rdx
and    $0xfffffffffffffffe,%rdx
mov    %rdi,%rsi
and    $0xfffffffffffffffe,%rsi
unpcklpd %xmm3,%xmm3
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm3,%xmm4
movupd 0x8(%rbx,%rbp,8),%xmm3
shufpd $0x1,%xmm3,%xmm4
mulpd  %xmm0,%xmm4
movapd %xmm1,%xmm5
mulpd  %xmm3,%xmm5
addpd  %xmm4,%xmm5
divpd  %xmm2,%xmm5
xorpd  %xmm4,%xmm4
maxpd  %xmm5,%xmm4
movupd %xmm4,(%rbx,%rbp,8)
add    $0x2,%rbp
cmp    %rbp,%rdx
jne    1480 <rq_pricing_binomial+0x330>
cmp    %rsi,%rdi
je     1430 <rq_pricing_binomial+0x2e0>
unpckhpd %xmm3,%xmm3
cs nopw 0x0(%rax,%rax,1)
movsd  0x8(%rbx,%rsi,8),%xmm4
mulsd  %xmm8,%xmm3
movapd %xmm7,%xmm5
mulsd  %xmm4,%xmm5
addsd  %xmm3,%xmm5
divsd  %xmm6,%xmm5
xorpd  %xmm3,%xmm3
maxsd  %xmm5,%xmm3
movsd  %xmm3,(%rbx,%rsi,8)
lea    0x1(%rsi),%rdx
movapd %xmm4,%xmm3
mov    %rdx,%rsi
cmp    %rdx,%rax
jne    14d0 <rq_pricing_binomial+0x380>
jmp    1430 <rq_pricing_binomial+0x2e0>
movsd  (%rbx),%xmm0
test   %r14,%r14
jne    152a <rq_pricing_binomial+0x3da>
mov    %rbx,%rdi
movsd  %xmm0,0x10(%rsp)
call   1030 <free@plt>
movsd  0x10(%rsp),%xmm0
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define double @rq_pricing_binomial(i16 signext %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i32 %8, double* %9) {
%11 = icmp eq double* %9, null
br i1 %11, label %12, label %17
12: ; preds = %10
%13 = shl i32 %8, 3
%14 = add i32 %13, 8
%15 = tail call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to double*
br label %17
17: ; preds = %10, %12
%18 = phi double* [ %16, %12 ], [ %9, %10 ]
%19 = sitofp i32 %8 to double
%20 = fdiv double %7, %19
%21 = fdiv double %6, %19
%22 = fsub double %3, %4
%23 = fadd double %22, 1.000000e+00
%24 = fptosi double %20 to i32
%25 = tail call double @pow(double %23, i32 %24)
%26 = fadd double %3, 1.000000e+00
%27 = tail call double @pow(double %26, i32 %24)
%28 = fmul double %25, %25
%29 = fmul double %5, %5
%30 = fmul double %29, %21
%31 = tail call double @exp(double %30)
%32 = fadd double %31, -1.000000e+00
%33 = fmul double %28, %32
%34 = fadd double %28, %33
%35 = fadd double %34, 1.000000e+00
%36 = fmul double %28, -4.000000e+00
%37 = tail call double @llvm.fmuladd.f64(double %35, double %35, double %36)
%38 = tail call double @sqrt(double %37)
%39 = fadd double %38, %35
%40 = fmul double %25, 2.000000e+00
%41 = fdiv double %39, %40
%42 = fdiv double 1.000000e+00, %41
%43 = fsub double %25, %42
%44 = fsub double %41, %42
%45 = fdiv double %43, %44
%46 = fsub double 1.000000e+00, %45
%47 = tail call double @pow(double %42, i32 %8)
%48 = fdiv double %41, %42
%49 = icmp slt i32 %8, 0
br i1 %49, label %152, label %50
50: ; preds = %17
%51 = icmp eq i16 %0, 0
%52 = fneg double %2
%53 = fneg double %1
%54 = add nuw i32 %8, 1
%55 = zext i32 %54 to i64
%56 = and i64 %55, 1
%57 = icmp eq i32 %8, 0
br i1 %57, label %60, label %58
58: ; preds = %50
%59 = and i64 %55, 4294967294
br label %81
60: ; preds = %81, %50
%61 = phi i64 [ 0, %50 ], [ %100, %81 ]
%62 = phi double [ %47, %50 ], [ %99, %81 ]
%63 = icmp eq i64 %56, 0
br i1 %63, label %71, label %64
64: ; preds = %60
%65 = tail call double @llvm.fmuladd.f64(double %1, double %62, double %52)
%66 = tail call double @llvm.fmuladd.f64(double %53, double %62, double %2)
%67 = select i1 %51, double %66, double %65
%68 = fcmp olt double %67, 0.000000e+00
%69 = select i1 %68, double 0.000000e+00, double %67
%70 = getelementptr inbounds double, double* %18, i64 %61
store double %69, double* %70
br label %71
71: ; preds = %60, %64
%72 = icmp sgt i32 %8, 0
br i1 %72, label %73, label %152
73: ; preds = %71
%74 = zext i32 %8 to i64
%75 = insertelement <2 x double> poison, double %46, i64 0
%76 = shufflevector <2 x double> %75, <2 x double> poison, <2 x i32> zeroinitializer
%77 = insertelement <2 x double> poison, double %45, i64 0
%78 = shufflevector <2 x double> %77, <2 x double> poison, <2 x i32> zeroinitializer
%79 = insertelement <2 x double> poison, double %27, i64 0
%80 = shufflevector <2 x double> %79, <2 x double> poison, <2 x i32> zeroinitializer
br label %106
81: ; preds = %81, %58
%82 = phi i64 [ 0, %58 ], [ %100, %81 ]
%83 = phi double [ %47, %58 ], [ %99, %81 ]
%84 = phi i64 [ 0, %58 ], [ %101, %81 ]
%85 = tail call double @llvm.fmuladd.f64(double %1, double %83, double %52)
%86 = tail call double @llvm.fmuladd.f64(double %53, double %83, double %2)
%87 = select i1 %51, double %86, double %85
%88 = fcmp olt double %87, 0.000000e+00
%89 = select i1 %88, double 0.000000e+00, double %87
%90 = getelementptr inbounds double, double* %18, i64 %82
store double %89, double* %90
%91 = fmul double %48, %83
%92 = or i64 %82, 1
%93 = tail call double @llvm.fmuladd.f64(double %1, double %91, double %52)
%94 = tail call double @llvm.fmuladd.f64(double %53, double %91, double %2)
%95 = select i1 %51, double %94, double %93
%96 = fcmp olt double %95, 0.000000e+00
%97 = select i1 %96, double 0.000000e+00, double %95
%98 = getelementptr inbounds double, double* %18, i64 %92
store double %97, double* %98
%99 = fmul double %48, %91
%100 = add nuw nsw i64 %82, 2
%101 = add i64 %84, 2
%102 = icmp eq i64 %101, %59
br i1 %102, label %60, label %81
103: ; preds = %139, %133
%104 = icmp sgt i64 %108, 1
%105 = add i64 %107, 1
br i1 %104, label %106, label %152
106: ; preds = %103, %73
%107 = phi i64 [ %105, %103 ], [ 0, %73 ]
%108 = phi i64 [ %110, %103 ], [ %74, %73 ]
%109 = sub i64 %74, %107
%110 = add nsw i64 %108, -1
%111 = load double, double* %18
%112 = icmp ult i64 %109, 2
br i1 %112, label %136, label %113
113: ; preds = %106
%114 = and i64 %109, -2
%115 = insertelement <2 x double> poison, double %111, i64 1
br label %116
116: ; preds = %116, %113
%117 = phi i64 [ 0, %113 ], [ %131, %116 ]
%118 = phi <2 x double> [ %115, %113 ], [ %122, %116 ]
%119 = or i64 %117, 1
%120 = getelementptr inbounds double, double* %18, i64 %119
%121 = bitcast double* %120 to <2 x double>*
%122 = load <2 x double>, <2 x double>* %121
%123 = shufflevector <2 x double> %118, <2 x double> %122, <2 x i32> <i32 1, i32 2>
%124 = getelementptr inbounds double, double* %18, i64 %117
%125 = fmul <2 x double> %76, %123
%126 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %78, <2 x double> %122, <2 x double> %125)
%127 = fdiv <2 x double> %126, %80
%128 = fcmp olt <2 x double> %127, zeroinitializer
%129 = select <2 x i1> %128, <2 x double> zeroinitializer, <2 x double> %127
%130 = bitcast double* %124 to <2 x double>*
store <2 x double> %129, <2 x double>* %130
%131 = add nuw i64 %117, 2
%132 = icmp eq i64 %131, %114
br i1 %132, label %133, label %116
133: ; preds = %116
%134 = icmp eq i64 %109, %114
%135 = extractelement <2 x double> %122, i64 1
br i1 %134, label %103, label %136
136: ; preds = %106, %133
%137 = phi double [ %135, %133 ], [ %111, %106 ]
%138 = phi i64 [ %114, %133 ], [ 0, %106 ]
br label %139
139: ; preds = %136, %139
%140 = phi double [ %144, %139 ], [ %137, %136 ]
%141 = phi i64 [ %142, %139 ], [ %138, %136 ]
%142 = add nuw nsw i64 %141, 1
%143 = getelementptr inbounds double, double* %18, i64 %142
%144 = load double, double* %143
%145 = getelementptr inbounds double, double* %18, i64 %141
%146 = fmul double %46, %140
%147 = tail call double @llvm.fmuladd.f64(double %45, double %144, double %146)
%148 = fdiv double %147, %27
%149 = fcmp olt double %148, 0.000000e+00
%150 = select i1 %149, double 0.000000e+00, double %148
store double %150, double* %145
%151 = icmp eq i64 %142, %108
br i1 %151, label %103, label %139
152: ; preds = %103, %17, %71
%153 = load double, double* %18
br i1 %11, label %154, label %156
154: ; preds = %152
%155 = tail call i32 @free(double* %18)
br label %156
156: ; preds = %154, %152
ret double %153
}