#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 */
int exp(double);
double phi(double, double, int, double, double, double, double, double);
double pow(double, double);
double rq_pricing_blackscholes_gen(int, double, double, double, double, double,
                                   double);
int sqrt(double);
double rq_pricing_bjerksund_stensland_approx(double S, double X, double T,
                                             double r, double b, double v) {
  double ret = 0.0;
  if (b >= r)
    ret = rq_pricing_blackscholes_gen(1, S, X, T, r, b, v);
  else {
    double betaA = (0.5 - b / (v * v));
    double betaB = sqrt(pow((b / (v * v) - 0.5), 2) + 2 * r / (v * v));
    double beta = betaA + betaB;
    double b_inf = beta / (beta - 1) * X;
    double B0 = ((X) > (r / (r - b) * X) ? (X) : (r / (r - b) * X));
    double ht = -(b * T + 2 * v * sqrt(T)) * B0 / (b_inf - B0);
    double I = B0 + (b_inf - B0) * (1 - exp(ht));
    double alpha = (I - X) * pow(I, -beta);
    if (S >= I)
      ret = S - X;
    else {
      double r1 = alpha * pow(S, beta);
      double r2 = alpha * phi(S, T, beta, I, I, r, b, v);
      double r3 = phi(S, T, 1, I, I, r, b, v);
      double r4 = phi(S, T, 1, X, I, r, b, v);
      double r5 = X * phi(S, T, 0, I, I, r, b, v);
      double r6 = X * phi(S, T, 0, X, I, r, b, v);
      ret = r1 - r2 + r3 - r4 - r5 + r6;
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<rq_pricing_bjerksund_stensland_approx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     11c3 <rq_pricing_bjerksund_stensland_approx+0x73>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
movsd  -0x30(%rbp),%xmm5
mov    $0x1,%edi
call   1050 <rq_pricing_blackscholes_gen@plt>
movsd  %xmm0,-0x38(%rbp)
jmp    15ea <rq_pricing_bjerksund_stensland_approx+0x49a>
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe32(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe0e(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xdfa(%rip),%xmm1
call   1060 <pow@plt>
movsd  0xded(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mulsd  -0x30(%rbp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  0xd9f(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
subsd  -0x28(%rbp),%xmm2
divsd  %xmm2,%xmm1
mulsd  -0x10(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    12ac <rq_pricing_bjerksund_stensland_approx+0x15c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    12cc <rq_pricing_bjerksund_stensland_approx+0x17c>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  0xd0d(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  -0xe0(%rbp),%xmm1
ff
movsd  -0xd8(%rbp),%xmm0
ff
movsd  -0xd0(%rbp),%xmm2
ff
cvtsi2sd %eax,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
subsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
call   1040 <exp@plt>
movsd  -0xc8(%rbp),%xmm0
ff
movsd  -0xc0(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x70(%rbp),%xmm0
jb     142c <rq_pricing_bjerksund_stensland_approx+0x2dc>
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    15e5 <rq_pricing_bjerksund_stensland_approx+0x495>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x100(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
cvttsd2si -0x50(%rbp),%edi
movsd  -0x70(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movsd  -0x28(%rbp),%xmm5
movsd  -0x30(%rbp),%xmm6
call   1030 <phi@plt>
movaps %xmm0,%xmm1
movsd  -0xf8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movsd  -0x28(%rbp),%xmm5
movsd  -0x30(%rbp),%xmm6
mov    $0x1,%edi
call   1030 <phi@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movsd  -0x28(%rbp),%xmm5
movsd  -0x30(%rbp),%xmm6
mov    $0x1,%edi
call   1030 <phi@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movsd  -0x28(%rbp),%xmm5
movsd  -0x30(%rbp),%xmm6
xor    %edi,%edi
call   1030 <phi@plt>
movaps %xmm0,%xmm1
movsd  -0xf0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movsd  -0x28(%rbp),%xmm5
movsd  -0x30(%rbp),%xmm6
xor    %edi,%edi
call   1030 <phi@plt>
movaps %xmm0,%xmm1
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
subsd  -0x88(%rbp),%xmm0
ff
addsd  -0x90(%rbp),%xmm0
ff
subsd  -0x98(%rbp),%xmm0
ff
subsd  -0xa0(%rbp),%xmm0
ff
addsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x38(%rbp)
jmp    15ea <rq_pricing_bjerksund_stensland_approx+0x49a>
movsd  -0x38(%rbp),%xmm0
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_pricing_bjerksund_stensland_approx>:
ucomisd %xmm3,%xmm4
jae    1438 <rq_pricing_bjerksund_stensland_approx+0x2e8>
sub    $0x68,%rsp
movsd  %xmm1,0x10(%rsp)
movapd %xmm5,%xmm1
mulsd  %xmm5,%xmm1
movsd  %xmm0,0x28(%rsp)
movsd  %xmm2,(%rsp)
movapd %xmm4,%xmm2
divsd  %xmm1,%xmm2
movsd  0xe79(%rip),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x40(%rsp)
addsd  0xe6f(%rip),%xmm2
mulsd  %xmm2,%xmm2
movapd %xmm3,%xmm0
addsd  %xmm3,%xmm0
divsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm5,0x38(%rsp)
movsd  %xmm4,0x8(%rsp)
movsd  %xmm3,0x30(%rsp)
call   1070 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  0x40(%rsp),%xmm1
movapd %xmm1,0x50(%rsp)
movsd  0xe31(%rip),%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movapd %xmm1,0x40(%rsp)
movsd  0x30(%rsp),%xmm1
movapd %xmm1,%xmm0
subsd  0x8(%rsp),%xmm0
divsd  %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
maxsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x38(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
call   1070 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0x18(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
xorpd  0xdc5(%rip),%xmm0
movsd  0x20(%rsp),%xmm2
mulsd  %xmm2,%xmm0
movapd 0x40(%rsp),%xmm1
subsd  %xmm2,%xmm1
movapd %xmm1,0x40(%rsp)
divsd  %xmm1,%xmm0
call   1040 <exp@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  0x40(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
movaps 0xd7b(%rip),%xmm1
xorps  0x50(%rsp),%xmm1
call   1060 <pow@plt>
movsd  0x28(%rsp),%xmm2
movsd  0x10(%rsp),%xmm1
movsd  0x40(%rsp),%xmm4
ucomisd %xmm4,%xmm2
jae    1442 <rq_pricing_bjerksund_stensland_approx+0x2f2>
movapd %xmm4,%xmm3
subsd  %xmm1,%xmm3
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x18(%rsp)
movapd %xmm2,%xmm0
movaps 0x50(%rsp),%xmm1
call   1060 <pow@plt>
mulsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
cvttsd2si 0x50(%rsp),%edi
movsd  0x28(%rsp),%xmm0
movsd  (%rsp),%xmm1
movsd  0x40(%rsp),%xmm2
movaps %xmm2,%xmm3
movsd  0x30(%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
movsd  0x38(%rsp),%xmm6
call   1030 <phi@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  (%rsp),%xmm1
mov    $0x1,%edi
movsd  0x40(%rsp),%xmm2
movaps %xmm2,%xmm3
movsd  0x30(%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
movsd  0x38(%rsp),%xmm6
call   1030 <phi@plt>
movsd  %xmm0,0x50(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  (%rsp),%xmm1
mov    $0x1,%edi
movsd  0x10(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
movsd  0x30(%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
movsd  0x38(%rsp),%xmm6
call   1030 <phi@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  (%rsp),%xmm1
xor    %edi,%edi
movsd  0x40(%rsp),%xmm2
movaps %xmm2,%xmm3
movsd  0x30(%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
movsd  0x38(%rsp),%xmm6
call   1030 <phi@plt>
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x60(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  (%rsp),%xmm1
xor    %edi,%edi
movsd  0x40(%rsp),%xmm3
movsd  0x30(%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
movsd  0x38(%rsp),%xmm6
call   1030 <phi@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x50(%rsp),%xmm2
addsd  0x20(%rsp),%xmm2
subsd  0x18(%rsp),%xmm2
subsd  0x60(%rsp),%xmm2
addsd  %xmm0,%xmm2
jmp    1446 <rq_pricing_bjerksund_stensland_approx+0x2f6>
mov    $0x1,%edi
jmp    1050 <rq_pricing_blackscholes_gen@plt>
subsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
add    $0x68,%rsp
ret

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

LLVM IR (-O2):
define double @rq_pricing_bjerksund_stensland_approx(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fcmp ult double %4, %3
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call double @rq_pricing_blackscholes_gen(i32 1, double %0, double %1, double %2, double %3, double %4, double %5)
br label %67
10: ; preds = %6
%11 = fmul double %5, %5
%12 = fdiv double %4, %11
%13 = fsub double 5.000000e-01, %12
%14 = fadd double %12, -5.000000e-01
%15 = fmul double %14, %14
%16 = fmul double %3, 2.000000e+00
%17 = fdiv double %16, %11
%18 = fadd double %17, %15
%19 = tail call i32 @sqrt(double %18)
%20 = sitofp i32 %19 to double
%21 = fadd double %13, %20
%22 = fadd double %21, -1.000000e+00
%23 = fdiv double %21, %22
%24 = fmul double %23, %1
%25 = fsub double %3, %4
%26 = fdiv double %3, %25
%27 = fmul double %26, %1
%28 = fcmp olt double %27, %1
%29 = select i1 %28, double %1, double %27
%30 = fmul double %5, 2.000000e+00
%31 = tail call i32 @sqrt(double %2)
%32 = sitofp i32 %31 to double
%33 = fmul double %30, %32
%34 = tail call double @llvm.fmuladd.f64(double %4, double %2, double %33)
%35 = fneg double %34
%36 = fmul double %29, %35
%37 = fsub double %24, %29
%38 = fdiv double %36, %37
%39 = tail call i32 @exp(double %38)
%40 = sub nsw i32 1, %39
%41 = sitofp i32 %40 to double
%42 = tail call double @llvm.fmuladd.f64(double %37, double %41, double %29)
%43 = fsub double %42, %1
%44 = fneg double %21
%45 = tail call double @pow(double %42, double %44)
%46 = fmul double %45, %43
%47 = fcmp ugt double %42, %0
br i1 %47, label %50, label %48
48: ; preds = %10
%49 = fsub double %0, %1
br label %67
50: ; preds = %10
%51 = tail call double @pow(double %0, double %21)
%52 = fmul double %46, %51
%53 = fptosi double %21 to i32
%54 = tail call double @phi(double %0, double %2, i32 %53, double %42, double %42, double %3, double %4, double %5)
%55 = fmul double %46, %54
%56 = tail call double @phi(double %0, double %2, i32 1, double %42, double %42, double %3, double %4, double %5)
%57 = tail call double @phi(double %0, double %2, i32 1, double %1, double %42, double %3, double %4, double %5)
%58 = tail call double @phi(double %0, double %2, i32 0, double %42, double %42, double %3, double %4, double %5)
%59 = fmul double %58, %1
%60 = tail call double @phi(double %0, double %2, i32 0, double %1, double %42, double %3, double %4, double %5)
%61 = fmul double %60, %1
%62 = fsub double %52, %55
%63 = fadd double %56, %62
%64 = fsub double %63, %57
%65 = fsub double %64, %59
%66 = fadd double %65, %61
br label %67
67: ; preds = %48, %50, %8
%68 = phi double [ %9, %8 ], [ %49, %48 ], [ %66, %50 ]
ret double %68
}