double BAWAmericanPutApprox(double S, double X, double T, double r, double b,
                            double v) {
  double Sk, result;
  assert(((S) == (S)) && (S) >= 0.000001 && (S) <= 1000000000000.0);
  assert(((X) == (X)) && (X) >= 0.000001 && (X) <= 1000000000000.0);
  assert(((T) == (T)) && (T) >= (1.0 / (253.0 * 24.0)) && (T) <= (20.0));
  assert(((r) == (r)) && (r) >= 0.0 && (r) <= 1000.0);
  assert(((b) == (b)) && (b) >= -1000.0 && (b) <= 1000.0);
  assert(((v) == (v)) && (v) >= 0.0000001 && v <= 100.99999);
  Sk = Kp(X, T, r, b, v);
  if (S > Sk) {
    const double p2v = ((v) * (v));
    const double n = 2.0 * b / p2v;
    const double K = 2.0 * r / (p2v * (1.0 - exp(-r * T)));
    const double d1 = (log(Sk / X) + (b + p2v / 2.0) * T) / (v * sqrt(T));
    const double Q1 =
        (-(n - 1.0) - sqrt(((n - 1.0) * (n - 1.0)) + 4.0 * K)) / 2.0;
    const double a1 = -(Sk / Q1) * (1.0 - exp((b - r) * T) * cnd(-d1));
    result = gbs_put(S, X, T, r, b, v) + a1 * pow((S / Sk), Q1);
  } else
    result = X - S;
  assert(((result) == (result)));
  return result;
}


x86 assembly (clang, -O0):
<BAWAmericanPutApprox>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%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)
movsd  -0x8(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x8(%rbp),%xmm0
mov    %al,-0x71(%rbp)
jne    11f3 <BAWAmericanPutApprox+0x73>
jp     11f3 <BAWAmericanPutApprox+0x73>
movsd  -0x8(%rbp),%xmm0
xor    %eax,%eax
movsd  0xe2d(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x71(%rbp)
jb     11f3 <BAWAmericanPutApprox+0x73>
movsd  0xe20(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
setae  %al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1050 <assert@plt>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x72(%rbp)
jne    124c <BAWAmericanPutApprox+0xcc>
jp     124c <BAWAmericanPutApprox+0xcc>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
movsd  0xdd4(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x72(%rbp)
jb     124c <BAWAmericanPutApprox+0xcc>
movsd  0xdc7(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
setae  %al
mov    %al,-0x72(%rbp)
mov    -0x72(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1050 <assert@plt>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x18(%rbp),%xmm0
mov    %al,-0x73(%rbp)
jne    12a5 <BAWAmericanPutApprox+0x125>
jp     12a5 <BAWAmericanPutApprox+0x125>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
movsd  0xd8b(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x73(%rbp)
jb     12a5 <BAWAmericanPutApprox+0x125>
movsd  0xd7e(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
setae  %al
mov    %al,-0x73(%rbp)
mov    -0x73(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1050 <assert@plt>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x20(%rbp),%xmm0
mov    %al,-0x74(%rbp)
jne    12f9 <BAWAmericanPutApprox+0x179>
jp     12f9 <BAWAmericanPutApprox+0x179>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x74(%rbp)
jb     12f9 <BAWAmericanPutApprox+0x179>
movsd  0xd32(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
setae  %al
mov    %al,-0x74(%rbp)
mov    -0x74(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1050 <assert@plt>
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x28(%rbp),%xmm0
mov    %al,-0x75(%rbp)
jne    1352 <BAWAmericanPutApprox+0x1d2>
jp     1352 <BAWAmericanPutApprox+0x1d2>
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
movsd  0xcf6(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x75(%rbp)
jb     1352 <BAWAmericanPutApprox+0x1d2>
movsd  0xcd9(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
setae  %al
mov    %al,-0x75(%rbp)
mov    -0x75(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1050 <assert@plt>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x30(%rbp),%xmm0
mov    %al,-0x76(%rbp)
jne    13ab <BAWAmericanPutApprox+0x22b>
jp     13ab <BAWAmericanPutApprox+0x22b>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
movsd  0xca5(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x76(%rbp)
jb     13ab <BAWAmericanPutApprox+0x22b>
movsd  0xc98(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
setae  %al
mov    %al,-0x76(%rbp)
mov    -0x76(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1050 <assert@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
mov    $0x5,%al
call   1030 <Kp@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    16ae <BAWAmericanPutApprox+0x52e>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xc3e(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xc27(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1060 <exp@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movaps %xmm0,%xmm3
movsd  -0xb8(%rbp),%xmm0
ff
movsd  0xbc4(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1070 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  0xb97(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   10a0 <sqrt@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xb2e(%rip),%xmm1
subsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  0xafe(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  0xaed(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xaf1(%rip),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   10a0 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  0xac0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
divsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1060 <exp@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    $0x1,%al
call   1080 <cnd@plt>
movsd  -0x98(%rbp),%xmm1
movsd  -0x90(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xa10(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
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    $0x6,%al
call   1040 <gbs_put@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
call   1090 <pow@plt>
movsd  -0x88(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    16bd <BAWAmericanPutApprox+0x53d>
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1050 <assert@plt>
movsd  -0x40(%rbp),%xmm0
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BAWAmericanPutApprox>:
sub    $0x88,%rsp
movsd  %xmm0,0x48(%rsp)
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xe64(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xe5f(%rip),%xmm6
ucomisd %xmm0,%xmm6
movsd  %xmm5,0x18(%rsp)
movsd  %xmm4,0x10(%rsp)
movaps %xmm3,0x50(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1050 <assert@plt>
movsd  (%rsp),%xmm0
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xe14(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xe0f(%rip),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1050 <assert@plt>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xdef(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xdea(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1050 <assert@plt>
xorpd  %xmm0,%xmm0
movapd 0x50(%rsp),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
movsd  0xdc6(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %cl
and    %al,%cl
movzbl %cl,%edi
xor    %eax,%eax
call   1050 <assert@plt>
movsd  0x10(%rsp),%xmm0
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xda6(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xd91(%rip),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1050 <assert@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xd79(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xd74(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1050 <assert@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movaps 0x50(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
movsd  0x18(%rsp),%xmm4
mov    $0x5,%al
call   1030 <Kp@plt>
movsd  0x48(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
ucomisd %xmm1,%xmm0
jbe    1534 <BAWAmericanPutApprox+0x3b4>
movsd  0x18(%rsp),%xmm2
mulsd  %xmm2,%xmm2
movapd %xmm2,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm2,%xmm0
movapd %xmm0,0x70(%rsp)
movapd 0x50(%rsp),%xmm2
movapd %xmm2,%xmm0
addsd  %xmm2,%xmm0
movapd %xmm0,0x60(%rsp)
movapd 0xd1f(%rip),%xmm0
xorpd  %xmm2,%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm1,0x40(%rsp)
call   1060 <exp@plt>
movsd  0xcd2(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x20(%rsp),%xmm1
movapd 0x60(%rsp),%xmm0
divsd  %xmm1,%xmm0
movapd %xmm0,0x60(%rsp)
movsd  0x40(%rsp),%xmm0
divsd  (%rsp),%xmm0
call   1070 <log@plt>
movapd %xmm0,%xmm2
movapd 0x20(%rsp),%xmm0
mulsd  0xc9e(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
ucomisd 0xc98(%rip),%xmm1
movapd %xmm1,%xmm0
jb     13d7 <BAWAmericanPutApprox+0x257>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    13ec <BAWAmericanPutApprox+0x26c>
movsd  %xmm2,0x38(%rsp)
call   10a0 <sqrt@plt>
movsd  0x38(%rsp),%xmm2
movapd %xmm0,%xmm1
movapd 0x20(%rsp),%xmm0
addsd  %xmm2,%xmm0
movapd %xmm0,0x20(%rsp)
mulsd  0x18(%rsp),%xmm1
movsd  %xmm1,0x38(%rsp)
movapd 0x70(%rsp),%xmm0
addsd  0xc3a(%rip),%xmm0
movapd 0xc52(%rip),%xmm1
xorpd  %xmm0,%xmm1
movapd %xmm1,0x70(%rsp)
movapd 0x60(%rsp),%xmm1
mulsd  0xc22(%rip),%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     144e <BAWAmericanPutApprox+0x2ce>
sqrtsd %xmm0,%xmm0
jmp    1453 <BAWAmericanPutApprox+0x2d3>
call   10a0 <sqrt@plt>
movapd 0x50(%rsp),%xmm1
movapd 0x70(%rsp),%xmm2
subsd  %xmm0,%xmm2
mulsd  0xbdd(%rip),%xmm2
movapd %xmm2,0x70(%rsp)
movsd  0x40(%rsp),%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,0x60(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  %xmm1,%xmm0
mulsd  0x8(%rsp),%xmm0
call   1060 <exp@plt>
movsd  %xmm0,0x80(%rsp)
movapd 0x20(%rsp),%xmm0
xorpd  0xbc3(%rip),%xmm0
divsd  0x38(%rsp),%xmm0
mov    $0x1,%al
call   1080 <cnd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x80(%rsp),%xmm0
movsd  0xb6e(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x60(%rsp),%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x48(%rsp),%xmm0
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movaps 0x50(%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
movsd  0x18(%rsp),%xmm5
mov    $0x6,%al
call   1040 <gbs_put@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x48(%rsp),%xmm0
divsd  0x40(%rsp),%xmm0
movapd 0x70(%rsp),%xmm1
call   1090 <pow@plt>
mulsd  0x20(%rsp),%xmm0
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
xor    %edi,%edi
ucomisd %xmm1,%xmm1
setnp  %dil
xor    %eax,%eax
call   1050 <assert@plt>
movsd  (%rsp),%xmm0
add    $0x88,%rsp
ret

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

LLVM IR (-O2):
define double @BAWAmericanPutApprox(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fcmp ord double %0, 0.000000e+00
%8 = fcmp oge double %0, 0x3EB0C6F7A0B5ED8D
%9 = and i1 %7, %8
%10 = fcmp ole double %0, 1.000000e+12
%11 = and i1 %10, %9
%12 = zext i1 %11 to i32
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %12)
%14 = fcmp ord double %1, 0.000000e+00
%15 = fcmp oge double %1, 0x3EB0C6F7A0B5ED8D
%16 = and i1 %14, %15
%17 = fcmp ole double %1, 1.000000e+12
%18 = and i1 %17, %16
%19 = zext i1 %18 to i32
%20 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %19)
%21 = fcmp ord double %2, 0.000000e+00
%22 = fcmp oge double %2, 0x3F2596179C29D2CE
%23 = and i1 %21, %22
%24 = fcmp ole double %2, 2.000000e+01
%25 = and i1 %24, %23
%26 = zext i1 %25 to i32
%27 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %26)
%28 = fcmp oge double %3, 0.000000e+00
%29 = fcmp ole double %3, 1.000000e+03
%30 = and i1 %28, %29
%31 = zext i1 %30 to i32
%32 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %31)
%33 = fcmp ord double %4, 0.000000e+00
%34 = fcmp oge double %4, -1.000000e+03
%35 = and i1 %33, %34
%36 = fcmp ole double %4, 1.000000e+03
%37 = and i1 %36, %35
%38 = zext i1 %37 to i32
%39 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %38)
%40 = fcmp ord double %5, 0.000000e+00
%41 = fcmp oge double %5, 0x3E7AD7F29ABCAF48
%42 = and i1 %40, %41
%43 = fcmp ole double %5, 0x40593FFFD60E94EE
%44 = and i1 %43, %42
%45 = zext i1 %44 to i32
%46 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %45)
%47 = tail call i32 (double, double, double, double, double, ...) bitcast (i32 (...)* @Kp to i32 (double, double, double, double, double, ...)*)(double %1, double %2, double %3, double %4, double %5)
%48 = sitofp i32 %47 to double
%49 = fcmp olt double %48, %0
br i1 %49, label %50, label %92
50: ; preds = %6
%51 = fmul double %5, %5
%52 = fmul double %4, 2.000000e+00
%53 = fdiv double %52, %51
%54 = fmul double %3, 2.000000e+00
%55 = fneg double %3
%56 = fmul double %55, %2
%57 = tail call double @exp(double %56)
%58 = fsub double 1.000000e+00, %57
%59 = fmul double %51, %58
%60 = fdiv double %54, %59
%61 = fdiv double %48, %1
%62 = tail call double @log(double %61)
%63 = fmul double %51, 5.000000e-01
%64 = fadd double %63, %4
%65 = tail call double @llvm.fmuladd.f64(double %64, double %2, double %62)
%66 = tail call double @sqrt(double %2)
%67 = fmul double %66, %5
%68 = fadd double %53, -1.000000e+00
%69 = fneg double %68
%70 = fmul double %60, 4.000000e+00
%71 = tail call double @llvm.fmuladd.f64(double %68, double %68, double %70)
%72 = tail call double @sqrt(double %71)
%73 = fsub double %69, %72
%74 = fmul double %73, 5.000000e-01
%75 = fneg double %48
%76 = fdiv double %75, %74
%77 = fsub double %4, %3
%78 = fmul double %77, %2
%79 = tail call double @exp(double %78)
%80 = fneg double %65
%81 = fdiv double %80, %67
%82 = tail call i32 (double, ...) bitcast (i32 (...)* @cnd to i32 (double, ...)*)(double %81)
%83 = sitofp i32 %82 to double
%84 = fneg double %79
%85 = tail call double @llvm.fmuladd.f64(double %84, double %83, double 1.000000e+00)
%86 = fmul double %76, %85
%87 = tail call i32 (double, double, double, double, double, double, ...) bitcast (i32 (...)* @gbs_put to i32 (double, double, double, double, double, double, ...)*)(double %0, double %1, double %2, double %3, double %4, double %5)
%88 = sitofp i32 %87 to double
%89 = fdiv double %0, %48
%90 = tail call double @pow(double %89, double %74)
%91 = tail call double @llvm.fmuladd.f64(double %86, double %90, double %88)
br label %94
92: ; preds = %6
%93 = fsub double %1, %0
br label %94
94: ; preds = %92, %50
%95 = phi double [ %91, %50 ], [ %93, %92 ]
%96 = fcmp ord double %95, 0.000000e+00
%97 = zext i1 %96 to i32
%98 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %97)
ret double %95
}