#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 BAWAmericanCallApprox(double, double, double, double, double, double);
double BAWAmericanPutApprox(double, double, double, double, double, double);
int /*<<< orphan*/ assert(int);
double BAWAmericanApprox(int fCall, 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 (fCall)
    result = BAWAmericanCallApprox(S, X, T, r, b, v);
  else
    result = BAWAmericanPutApprox(S, X, T, r, b, v);
  assert(((result) == (result)));
  return result;
}


x86 assembly (clang, -O0):
<BAWAmericanApprox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%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  -0x10(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x41(%rbp)
jne    11a3 <BAWAmericanApprox+0x73>
jp     11a3 <BAWAmericanApprox+0x73>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
movsd  0xe7d(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x41(%rbp)
jb     11a3 <BAWAmericanApprox+0x73>
movsd  0xe70(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
setae  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x18(%rbp),%xmm0
mov    %al,-0x42(%rbp)
jne    11fa <BAWAmericanApprox+0xca>
jp     11fa <BAWAmericanApprox+0xca>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
movsd  0xe26(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x42(%rbp)
jb     11fa <BAWAmericanApprox+0xca>
movsd  0xe19(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
setae  %al
mov    %al,-0x42(%rbp)
mov    -0x42(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x20(%rbp),%xmm0
mov    %al,-0x43(%rbp)
jne    1251 <BAWAmericanApprox+0x121>
jp     1251 <BAWAmericanApprox+0x121>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
movsd  0xddf(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x43(%rbp)
jb     1251 <BAWAmericanApprox+0x121>
movsd  0xdd2(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
setae  %al
mov    %al,-0x43(%rbp)
mov    -0x43(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x28(%rbp),%xmm0
mov    %al,-0x44(%rbp)
jne    12a3 <BAWAmericanApprox+0x173>
jp     12a3 <BAWAmericanApprox+0x173>
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x44(%rbp)
jb     12a3 <BAWAmericanApprox+0x173>
movsd  0xd88(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
setae  %al
mov    %al,-0x44(%rbp)
mov    -0x44(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x30(%rbp),%xmm0
mov    %al,-0x45(%rbp)
jne    12fa <BAWAmericanApprox+0x1ca>
jp     12fa <BAWAmericanApprox+0x1ca>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
movsd  0xd4e(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x45(%rbp)
jb     12fa <BAWAmericanApprox+0x1ca>
movsd  0xd31(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
setae  %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x38(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x38(%rbp),%xmm0
mov    %al,-0x46(%rbp)
jne    1351 <BAWAmericanApprox+0x221>
jp     1351 <BAWAmericanApprox+0x221>
movsd  -0x38(%rbp),%xmm0
xor    %eax,%eax
movsd  0xcff(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x46(%rbp)
jb     1351 <BAWAmericanApprox+0x221>
movsd  0xcf2(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
setae  %al
mov    %al,-0x46(%rbp)
mov    -0x46(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x4(%rbp)
je     1395 <BAWAmericanApprox+0x265>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
call   1050 <BAWAmericanCallApprox@plt>
movsd  %xmm0,-0x40(%rbp)
jmp    13bd <BAWAmericanApprox+0x28d>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
call   1030 <BAWAmericanPutApprox@plt>
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
call   1040 <assert@plt>
movsd  -0x40(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BAWAmericanApprox>:
push   %rbx
sub    $0x30,%rsp
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xebc(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xeb7(%rip),%xmm6
movsd  %xmm0,0x28(%rsp)
ucomisd %xmm0,%xmm6
movsd  %xmm5,(%rsp)
movsd  %xmm4,0x20(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
mov    %edi,%ebx
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xe64(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xe5f(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  0x10(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xe41(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xe3c(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
xorpd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
movsd  0xe1a(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1040 <assert@plt>
movsd  0x20(%rsp),%xmm0
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xdfc(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xde7(%rip),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  (%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xdd2(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xdcd(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
test   %ebx,%ebx
je     12aa <BAWAmericanApprox+0x17a>
movsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  (%rsp),%xmm5
call   1050 <BAWAmericanCallApprox@plt>
jmp    12d2 <BAWAmericanApprox+0x1a2>
movsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  (%rsp),%xmm5
call   1030 <BAWAmericanPutApprox@plt>
movsd  %xmm0,(%rsp)
xor    %edi,%edi
ucomisd %xmm0,%xmm0
setnp  %dil
call   1040 <assert@plt>
movsd  (%rsp),%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @BAWAmericanApprox(i32 %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store i32 %0, i32* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store double %6, double* %14
%16 = load double, double* %9
%17 = load double, double* %9
%18 = fcmp oeq double %16, %17
br i1 %18, label %19, label %25
19: ; preds = %7
%20 = load double, double* %9
%21 = fcmp oge double %20, 0x3EB0C6F7A0B5ED8D
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load double, double* %9
%24 = fcmp ole double %23, 1.000000e+12
br label %25
25: ; preds = %22, %19, %7
%26 = phi i1 [ false, %19 ], [ false, %7 ], [ %24, %22 ]
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = load double, double* %10
%30 = load double, double* %10
%31 = fcmp oeq double %29, %30
br i1 %31, label %32, label %38
32: ; preds = %25
%33 = load double, double* %10
%34 = fcmp oge double %33, 0x3EB0C6F7A0B5ED8D
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load double, double* %10
%37 = fcmp ole double %36, 1.000000e+12
br label %38
38: ; preds = %35, %32, %25
%39 = phi i1 [ false, %32 ], [ false, %25 ], [ %37, %35 ]
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = load double, double* %11
%43 = load double, double* %11
%44 = fcmp oeq double %42, %43
br i1 %44, label %45, label %51
45: ; preds = %38
%46 = load double, double* %11
%47 = fcmp oge double %46, 0x3F2596179C29D2CE
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load double, double* %11
%50 = fcmp ole double %49, 2.000000e+01
br label %51
51: ; preds = %48, %45, %38
%52 = phi i1 [ false, %45 ], [ false, %38 ], [ %50, %48 ]
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = load double, double* %12
%56 = load double, double* %12
%57 = fcmp oeq double %55, %56
br i1 %57, label %58, label %64
58: ; preds = %51
%59 = load double, double* %12
%60 = fcmp oge double %59, 0.000000e+00
br i1 %60, label %61, label %64
61: ; preds = %58
%62 = load double, double* %12
%63 = fcmp ole double %62, 1.000000e+03
br label %64
64: ; preds = %61, %58, %51
%65 = phi i1 [ false, %58 ], [ false, %51 ], [ %63, %61 ]
%66 = zext i1 %65 to i32
%67 = call i32 @assert(i32 %66)
%68 = load double, double* %13
%69 = load double, double* %13
%70 = fcmp oeq double %68, %69
br i1 %70, label %71, label %77
71: ; preds = %64
%72 = load double, double* %13
%73 = fcmp oge double %72, -1.000000e+03
br i1 %73, label %74, label %77
74: ; preds = %71
%75 = load double, double* %13
%76 = fcmp ole double %75, 1.000000e+03
br label %77
77: ; preds = %74, %71, %64
%78 = phi i1 [ false, %71 ], [ false, %64 ], [ %76, %74 ]
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
%81 = load double, double* %14
%82 = load double, double* %14
%83 = fcmp oeq double %81, %82
br i1 %83, label %84, label %90
84: ; preds = %77
%85 = load double, double* %14
%86 = fcmp oge double %85, 0x3E7AD7F29ABCAF48
br i1 %86, label %87, label %90
87: ; preds = %84
%88 = load double, double* %14
%89 = fcmp ole double %88, 0x40593FFFD60E94EE
br label %90
90: ; preds = %87, %84, %77
%91 = phi i1 [ false, %84 ], [ false, %77 ], [ %89, %87 ]
%92 = zext i1 %91 to i32
%93 = call i32 @assert(i32 %92)
%94 = load i32, i32* %8
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %104
96: ; preds = %90
%97 = load double, double* %9
%98 = load double, double* %10
%99 = load double, double* %11
%100 = load double, double* %12
%101 = load double, double* %13
%102 = load double, double* %14
%103 = call double @BAWAmericanCallApprox(double %97, double %98, double %99, double %100, double %101, double %102)
store double %103, double* %15
br label %112
104: ; preds = %90
%105 = load double, double* %9
%106 = load double, double* %10
%107 = load double, double* %11
%108 = load double, double* %12
%109 = load double, double* %13
%110 = load double, double* %14
%111 = call double @BAWAmericanPutApprox(double %105, double %106, double %107, double %108, double %109, double %110)
store double %111, double* %15
br label %112
112: ; preds = %104, %96
%113 = load double, double* %15
%114 = load double, double* %15
%115 = fcmp oeq double %113, %114
%116 = zext i1 %115 to i32
%117 = call i32 @assert(i32 %116)
%118 = load double, double* %15
ret double %118
}

LLVM IR (-O2):
define double @BAWAmericanApprox(i32 %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = fcmp ord double %1, 0.000000e+00
%9 = fcmp oge double %1, 0x3EB0C6F7A0B5ED8D
%10 = and i1 %8, %9
%11 = fcmp ole double %1, 1.000000e+12
%12 = and i1 %11, %10
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = fcmp ord double %2, 0.000000e+00
%16 = fcmp oge double %2, 0x3EB0C6F7A0B5ED8D
%17 = and i1 %15, %16
%18 = fcmp ole double %2, 1.000000e+12
%19 = and i1 %18, %17
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = fcmp ord double %3, 0.000000e+00
%23 = fcmp oge double %3, 0x3F2596179C29D2CE
%24 = and i1 %22, %23
%25 = fcmp ole double %3, 2.000000e+01
%26 = and i1 %25, %24
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = fcmp oge double %4, 0.000000e+00
%30 = fcmp ole double %4, 1.000000e+03
%31 = and i1 %29, %30
%32 = zext i1 %31 to i32
%33 = tail call i32 @assert(i32 %32)
%34 = fcmp ord double %5, 0.000000e+00
%35 = fcmp oge double %5, -1.000000e+03
%36 = and i1 %34, %35
%37 = fcmp ole double %5, 1.000000e+03
%38 = and i1 %37, %36
%39 = zext i1 %38 to i32
%40 = tail call i32 @assert(i32 %39)
%41 = fcmp ord double %6, 0.000000e+00
%42 = fcmp oge double %6, 0x3E7AD7F29ABCAF48
%43 = and i1 %41, %42
%44 = fcmp ole double %6, 0x40593FFFD60E94EE
%45 = and i1 %44, %43
%46 = zext i1 %45 to i32
%47 = tail call i32 @assert(i32 %46)
%48 = icmp eq i32 %0, 0
br i1 %48, label %51, label %49
49: ; preds = %7
%50 = tail call double @BAWAmericanCallApprox(double %1, double %2, double %3, double %4, double %5, double %6)
br label %53
51: ; preds = %7
%52 = tail call double @BAWAmericanPutApprox(double %1, double %2, double %3, double %4, double %5, double %6)
br label %53
53: ; preds = %51, %49
%54 = phi double [ %50, %49 ], [ %52, %51 ]
%55 = fcmp ord double %54, 0.000000e+00
%56 = zext i1 %55 to i32
%57 = tail call i32 @assert(i32 %56)
ret double %54
}