double BAWAmericanCallApprox(double S, double X, double T, double r, double b,
                             double v) {
  double 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);
  if (b >= r)
    result = gbs_call(S, X, T, r, b, v);
  else {
    const double p2v = ((v) * (v));
    const double Sk = Kc(X, T, r, b, 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 Q2 =
        (-(n - 1.0) + sqrt(((n - 1.0) * (n - 1.0)) + 4.0 * K)) / 2.0;
    const double a2 = (Sk / Q2) * (1.0 - exp((b - r) * T) * cnd(d1));
    if (S < Sk)
      result = gbs_call(S, X, T, r, b, v) + a2 * pow((S / Sk), Q2);
    else
      result = S - X;
  }
  assert(((result) == (result)));
  return result;
}


x86 assembly (clang, -O0):
<BAWAmericanCallApprox>:
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 <BAWAmericanCallApprox+0x73>
jp     11f3 <BAWAmericanCallApprox+0x73>
movsd  -0x8(%rbp),%xmm0
xor    %eax,%eax
movsd  0xe2d(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x71(%rbp)
jb     11f3 <BAWAmericanCallApprox+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   1040 <assert@plt>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x72(%rbp)
jne    124c <BAWAmericanCallApprox+0xcc>
jp     124c <BAWAmericanCallApprox+0xcc>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
movsd  0xdd4(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x72(%rbp)
jb     124c <BAWAmericanCallApprox+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   1040 <assert@plt>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x18(%rbp),%xmm0
mov    %al,-0x73(%rbp)
jne    12a5 <BAWAmericanCallApprox+0x125>
jp     12a5 <BAWAmericanCallApprox+0x125>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
movsd  0xd8b(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x73(%rbp)
jb     12a5 <BAWAmericanCallApprox+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   1040 <assert@plt>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x20(%rbp),%xmm0
mov    %al,-0x74(%rbp)
jne    12f9 <BAWAmericanCallApprox+0x179>
jp     12f9 <BAWAmericanCallApprox+0x179>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x74(%rbp)
jb     12f9 <BAWAmericanCallApprox+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   1040 <assert@plt>
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x28(%rbp),%xmm0
mov    %al,-0x75(%rbp)
jne    1352 <BAWAmericanCallApprox+0x1d2>
jp     1352 <BAWAmericanCallApprox+0x1d2>
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
movsd  0xcf6(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x75(%rbp)
jb     1352 <BAWAmericanCallApprox+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   1040 <assert@plt>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x30(%rbp),%xmm0
mov    %al,-0x76(%rbp)
jne    13ab <BAWAmericanCallApprox+0x22b>
jp     13ab <BAWAmericanCallApprox+0x22b>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
movsd  0xca5(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x76(%rbp)
jb     13ab <BAWAmericanCallApprox+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   1040 <assert@plt>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     13fd <BAWAmericanCallApprox+0x27d>
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   1030 <gbs_call@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    16db <BAWAmericanCallApprox+0x55b>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
mov    $0x5,%al
call   1060 <Kc@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xc0b(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xbf4(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1050 <exp@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movaps %xmm0,%xmm3
movsd  -0xa8(%rbp),%xmm0
ff
movsd  0xb91(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1070 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  0xb64(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   10a0 <sqrt@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xafb(%rip),%xmm1
subsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  0xacb(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  0xaba(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xabe(%rip),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   10a0 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  0xa8d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
divsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
mov    $0x1,%al
call   1080 <cnd@plt>
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x80(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xa11(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    16c7 <BAWAmericanCallApprox+0x547>
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   1030 <gbs_call@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
call   1090 <pow@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    16d6 <BAWAmericanCallApprox+0x556>
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    16db <BAWAmericanCallApprox+0x55b>
movsd  -0x38(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
movsd  -0x38(%rbp),%xmm0
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BAWAmericanCallApprox>:
sub    $0x68,%rsp
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xe6d(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xe68(%rip),%xmm6
movsd  %xmm0,0x28(%rsp)
ucomisd %xmm0,%xmm6
movsd  %xmm5,0x18(%rsp)
movsd  %xmm4,0x8(%rsp)
movaps %xmm3,0x50(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x20(%rsp)
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1040 <assert@plt>
movsd  0x20(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xe15(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xe10(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1040 <assert@plt>
movsd  0x10(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xdf0(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xdeb(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1040 <assert@plt>
xorpd  %xmm0,%xmm0
movapd 0x50(%rsp),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
movsd  0xdc7(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %cl
and    %al,%cl
movzbl %cl,%edi
xor    %eax,%eax
call   1040 <assert@plt>
movsd  0x8(%rsp),%xmm0
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xda7(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xd92(%rip),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1040 <assert@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xd7a(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xd75(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1040 <assert@plt>
movapd 0x50(%rsp),%xmm3
movsd  0x8(%rsp),%xmm5
ucomisd %xmm3,%xmm5
jae    13d3 <BAWAmericanCallApprox+0x253>
movsd  0x18(%rsp),%xmm4
movapd %xmm4,%xmm0
mulsd  %xmm4,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movapd %xmm3,%xmm2
movapd %xmm5,%xmm3
mov    $0x5,%al
call   1060 <Kc@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x48(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  (%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
movapd 0x50(%rsp),%xmm1
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,0x30(%rsp)
movapd 0xd18(%rip),%xmm0
xorpd  %xmm1,%xmm0
mulsd  0x10(%rsp),%xmm0
call   1050 <exp@plt>
movsd  0xcd1(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  (%rsp),%xmm1
movapd 0x30(%rsp),%xmm0
divsd  %xmm1,%xmm0
movapd %xmm0,0x30(%rsp)
movsd  0x48(%rsp),%xmm0
divsd  0x20(%rsp),%xmm0
call   1070 <log@plt>
movsd  (%rsp),%xmm1
mulsd  0xca2(%rip),%xmm1
addsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
ucomisd 0xc99(%rip),%xmm2
movapd %xmm2,%xmm0
jb     1402 <BAWAmericanCallApprox+0x282>
sqrtsd %xmm0,%xmm0
jmp    1407 <BAWAmericanCallApprox+0x287>
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movapd %xmm5,%xmm4
movsd  0x18(%rsp),%xmm5
mov    $0x6,%al
call   1030 <gbs_call@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
jmp    1546 <BAWAmericanCallApprox+0x3c6>
call   10a0 <sqrt@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x40(%rsp),%xmm2
addsd  0xc35(%rip),%xmm2
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movapd 0x30(%rsp),%xmm1
mulsd  0xc21(%rip),%xmm1
movsd  %xmm2,0x40(%rsp)
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1459 <BAWAmericanCallApprox+0x2d9>
sqrtsd %xmm0,%xmm0
jmp    145e <BAWAmericanCallApprox+0x2de>
call   10a0 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
movapd 0x50(%rsp),%xmm2
movsd  %xmm0,0x30(%rsp)
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
mulsd  0x10(%rsp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x60(%rsp)
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1080 <cnd@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x48(%rsp),%xmm2
ucomisd %xmm0,%xmm2
movsd  0x20(%rsp),%xmm1
jbe    1542 <BAWAmericanCallApprox+0x3c2>
movsd  0x30(%rsp),%xmm4
subsd  0x40(%rsp),%xmm4
mulsd  0xb83(%rip),%xmm4
movsd  %xmm4,0x30(%rsp)
cvtsi2sd %eax,%xmm3
divsd  %xmm4,%xmm2
movsd  0x60(%rsp),%xmm4
mulsd  %xmm3,%xmm4
movsd  0xb5b(%rip),%xmm3
subsd  %xmm4,%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,(%rsp)
movsd  0x10(%rsp),%xmm2
movapd 0x50(%rsp),%xmm3
movsd  0x8(%rsp),%xmm4
movsd  0x18(%rsp),%xmm5
mov    $0x6,%al
call   1030 <gbs_call@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x28(%rsp),%xmm0
divsd  0x48(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
call   1090 <pow@plt>
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
jmp    1546 <BAWAmericanCallApprox+0x3c6>
subsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rsp)
xor    %edi,%edi
ucomisd %xmm0,%xmm0
setnp  %dil
xor    %eax,%eax
call   1040 <assert@plt>
movsd  0x28(%rsp),%xmm0
add    $0x68,%rsp
ret

LLVM IR (-O0):
define double @BAWAmericanCallApprox(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* %11
%100 = load double, double* %10
%101 = fcmp oge double %99, %100
br i1 %101, label %102, label %111
102: ; preds = %95
%103 = load double, double* %7
%104 = load double, double* %8
%105 = load double, double* %9
%106 = load double, double* %10
%107 = load double, double* %11
%108 = load double, double* %12
%109 = call i32 (double, double, double, double, double, double, ...) bitcast (i32 (...)* @gbs_call to i32 (double, double, double, double, double, double, ...)*)(double %103, double %104, double %105, double %106, double %107, double %108)
%110 = sitofp i32 %109 to double
store double %110, double* %13
br label %204
111: ; preds = %95
%112 = load double, double* %12
%113 = load double, double* %12
%114 = fmul double %112, %113
store double %114, double* %14
%115 = load double, double* %8
%116 = load double, double* %9
%117 = load double, double* %10
%118 = load double, double* %11
%119 = load double, double* %12
%120 = call i32 (double, double, double, double, double, ...) bitcast (i32 (...)* @Kc to i32 (double, double, double, double, double, ...)*)(double %115, double %116, double %117, double %118, double %119)
%121 = sitofp i32 %120 to double
store double %121, double* %15
%122 = load double, double* %11
%123 = fmul double 2.000000e+00, %122
%124 = load double, double* %14
%125 = fdiv double %123, %124
store double %125, double* %16
%126 = load double, double* %10
%127 = fmul double 2.000000e+00, %126
%128 = load double, double* %14
%129 = load double, double* %10
%130 = fneg double %129
%131 = load double, double* %9
%132 = fmul double %130, %131
%133 = call double @exp(double %132)
%134 = fsub double 1.000000e+00, %133
%135 = fmul double %128, %134
%136 = fdiv double %127, %135
store double %136, double* %17
%137 = load double, double* %15
%138 = load double, double* %8
%139 = fdiv double %137, %138
%140 = call double @log(double %139)
%141 = load double, double* %11
%142 = load double, double* %14
%143 = fdiv double %142, 2.000000e+00
%144 = fadd double %141, %143
%145 = load double, double* %9
%146 = call double @llvm.fmuladd.f64(double %144, double %145, double %140)
%147 = load double, double* %12
%148 = load double, double* %9
%149 = call double @sqrt(double %148)
%150 = fmul double %147, %149
%151 = fdiv double %146, %150
store double %151, double* %18
%152 = load double, double* %16
%153 = fsub double %152, 1.000000e+00
%154 = fneg double %153
%155 = load double, double* %16
%156 = fsub double %155, 1.000000e+00
%157 = load double, double* %16
%158 = fsub double %157, 1.000000e+00
%159 = load double, double* %17
%160 = fmul double 4.000000e+00, %159
%161 = call double @llvm.fmuladd.f64(double %156, double %158, double %160)
%162 = call double @sqrt(double %161)
%163 = fadd double %154, %162
%164 = fdiv double %163, 2.000000e+00
store double %164, double* %19
%165 = load double, double* %15
%166 = load double, double* %19
%167 = fdiv double %165, %166
%168 = load double, double* %11
%169 = load double, double* %10
%170 = fsub double %168, %169
%171 = load double, double* %9
%172 = fmul double %170, %171
%173 = call double @exp(double %172)
%174 = load double, double* %18
%175 = call i32 (double, ...) bitcast (i32 (...)* @cnd to i32 (double, ...)*)(double %174)
%176 = sitofp i32 %175 to double
%177 = fneg double %173
%178 = call double @llvm.fmuladd.f64(double %177, double %176, double 1.000000e+00)
%179 = fmul double %167, %178
store double %179, double* %20
%180 = load double, double* %7
%181 = load double, double* %15
%182 = fcmp olt double %180, %181
br i1 %182, label %183, label %199
183: ; preds = %111
%184 = load double, double* %7
%185 = load double, double* %8
%186 = load double, double* %9
%187 = load double, double* %10
%188 = load double, double* %11
%189 = load double, double* %12
%190 = call i32 (double, double, double, double, double, double, ...) bitcast (i32 (...)* @gbs_call to i32 (double, double, double, double, double, double, ...)*)(double %184, double %185, double %186, double %187, double %188, double %189)
%191 = sitofp i32 %190 to double
%192 = load double, double* %20
%193 = load double, double* %7
%194 = load double, double* %15
%195 = fdiv double %193, %194
%196 = load double, double* %19
%197 = call double @pow(double %195, double %196)
%198 = call double @llvm.fmuladd.f64(double %192, double %197, double %191)
store double %198, double* %13
br label %203
199: ; preds = %111
%200 = load double, double* %7
%201 = load double, double* %8
%202 = fsub double %200, %201
store double %202, double* %13
br label %203
203: ; preds = %199, %183
br label %204
204: ; preds = %203, %102
%205 = load double, double* %13
%206 = load double, double* %13
%207 = fcmp oeq double %205, %206
%208 = zext i1 %207 to i32
%209 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %208)
%210 = load double, double* %13
ret double %210
}

LLVM IR (-O2):
define double @BAWAmericanCallApprox(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 = fcmp ult double %4, %3
br i1 %47, label %51, label %48
48: ; preds = %6
%49 = tail call i32 (double, double, double, double, double, double, ...) bitcast (i32 (...)* @gbs_call to i32 (double, double, double, double, double, double, ...)*)(double %0, double %1, double %2, double %3, double %4, double %5)
%50 = sitofp i32 %49 to double
br label %96
51: ; preds = %6
%52 = fmul double %5, %5
%53 = tail call i32 (double, double, double, double, double, ...) bitcast (i32 (...)* @Kc to i32 (double, double, double, double, double, ...)*)(double %1, double %2, double %3, double %4, double %5)
%54 = sitofp i32 %53 to double
%55 = fmul double %4, 2.000000e+00
%56 = fdiv double %55, %52
%57 = fmul double %3, 2.000000e+00
%58 = fneg double %3
%59 = fmul double %58, %2
%60 = tail call double @exp(double %59)
%61 = fsub double 1.000000e+00, %60
%62 = fmul double %52, %61
%63 = fdiv double %57, %62
%64 = fdiv double %54, %1
%65 = tail call double @log(double %64)
%66 = fmul double %52, 5.000000e-01
%67 = fadd double %66, %4
%68 = tail call double @llvm.fmuladd.f64(double %67, double %2, double %65)
%69 = tail call double @sqrt(double %2)
%70 = fmul double %69, %5
%71 = fdiv double %68, %70
%72 = fadd double %56, -1.000000e+00
%73 = fmul double %63, 4.000000e+00
%74 = tail call double @llvm.fmuladd.f64(double %72, double %72, double %73)
%75 = tail call double @sqrt(double %74)
%76 = fsub double %75, %72
%77 = fmul double %76, 5.000000e-01
%78 = fsub double %4, %3
%79 = fmul double %78, %2
%80 = tail call double @exp(double %79)
%81 = tail call i32 (double, ...) bitcast (i32 (...)* @cnd to i32 (double, ...)*)(double %71)
%82 = fcmp ogt double %54, %0
br i1 %82, label %83, label %94
83: ; preds = %51
%84 = fdiv double %54, %77
%85 = fneg double %80
%86 = sitofp i32 %81 to double
%87 = tail call double @llvm.fmuladd.f64(double %85, double %86, double 1.000000e+00)
%88 = fmul double %84, %87
%89 = tail call i32 (double, double, double, double, double, double, ...) bitcast (i32 (...)* @gbs_call to i32 (double, double, double, double, double, double, ...)*)(double %0, double %1, double %2, double %3, double %4, double %5)
%90 = sitofp i32 %89 to double
%91 = fdiv double %0, %54
%92 = tail call double @pow(double %91, double %77)
%93 = tail call double @llvm.fmuladd.f64(double %88, double %92, double %90)
br label %96
94: ; preds = %51
%95 = fsub double %0, %1
br label %96
96: ; preds = %83, %94, %48
%97 = phi double [ %50, %48 ], [ %93, %83 ], [ %95, %94 ]
%98 = fcmp ord double %97, 0.000000e+00
%99 = zext i1 %98 to i32
%100 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %99)
ret double %97
}