double CashOrNothing(int fCall, double S, double X, double K, double T,
                     double r, double b, double v) {
  double d;
  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);
  d = (log(S / X) + (b - ((v) * (v)) / 2.0) * T) / (v * sqrt(T));
  if (fCall)
    return K * exp(-r * T) * cnd(d);
  else
    return K * exp(-r * T) * cnd(-d);
}


x86 assembly (clang, -O0):
<CashOrNothing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
movsd  %xmm5,-0x40(%rbp)
movsd  %xmm6,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x18(%rbp),%xmm0
mov    %al,-0x51(%rbp)
jne    11cb <CashOrNothing+0x7b>
jp     11cb <CashOrNothing+0x7b>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
movsd  0xe55(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x51(%rbp)
jb     11cb <CashOrNothing+0x7b>
movsd  0xe48(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
setae  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x20(%rbp),%xmm0
mov    %al,-0x52(%rbp)
jne    1224 <CashOrNothing+0xd4>
jp     1224 <CashOrNothing+0xd4>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
movsd  0xdfc(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x52(%rbp)
jb     1224 <CashOrNothing+0xd4>
movsd  0xdef(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
setae  %al
mov    %al,-0x52(%rbp)
mov    -0x52(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x30(%rbp),%xmm0
mov    %al,-0x53(%rbp)
jne    127d <CashOrNothing+0x12d>
jp     127d <CashOrNothing+0x12d>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
movsd  0xdb3(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x53(%rbp)
jb     127d <CashOrNothing+0x12d>
movsd  0xda6(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
setae  %al
mov    %al,-0x53(%rbp)
mov    -0x53(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
movsd  -0x38(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x38(%rbp),%xmm0
mov    %al,-0x54(%rbp)
jne    12d1 <CashOrNothing+0x181>
jp     12d1 <CashOrNothing+0x181>
movsd  -0x38(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x54(%rbp)
jb     12d1 <CashOrNothing+0x181>
movsd  0xd5a(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
setae  %al
mov    %al,-0x54(%rbp)
mov    -0x54(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
movsd  -0x40(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x40(%rbp),%xmm0
mov    %al,-0x55(%rbp)
jne    132a <CashOrNothing+0x1da>
jp     132a <CashOrNothing+0x1da>
movsd  -0x40(%rbp),%xmm0
xor    %eax,%eax
movsd  0xd1e(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x55(%rbp)
jb     132a <CashOrNothing+0x1da>
movsd  0xd01(%rip),%xmm0
ucomisd -0x40(%rbp),%xmm0
setae  %al
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
movsd  -0x48(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x48(%rbp),%xmm0
mov    %al,-0x56(%rbp)
jne    1383 <CashOrNothing+0x233>
jp     1383 <CashOrNothing+0x233>
movsd  -0x48(%rbp),%xmm0
xor    %eax,%eax
movsd  0xccd(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x56(%rbp)
jb     1383 <CashOrNothing+0x233>
movsd  0xcc0(%rip),%xmm0
ucomisd -0x48(%rbp),%xmm0
setae  %al
mov    %al,-0x56(%rbp)
mov    -0x56(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  -0x48(%rbp),%xmm2
movsd  0xc85(%rip),%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1471 <CashOrNothing+0x321>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    $0x1,%al
call   1060 <cnd@plt>
movsd  -0x70(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    14ed <CashOrNothing+0x39d>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    $0x1,%al
call   1060 <cnd@plt>
movsd  -0x80(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CashOrNothing>:
push   %rbx
sub    $0x50,%rsp
movsd  %xmm0,0x30(%rsp)
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xe96(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xe91(%rip),%xmm7
ucomisd %xmm0,%xmm7
movsd  %xmm6,0x8(%rsp)
movsd  %xmm5,0x28(%rsp)
movaps %xmm4,0x40(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x38(%rsp)
movsd  %xmm1,0x10(%rsp)
mov    %edi,%ebx
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1030 <assert@plt>
movsd  0x10(%rsp),%xmm0
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xe3c(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xe37(%rip),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1030 <assert@plt>
movsd  0x20(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xe17(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xe12(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1030 <assert@plt>
xorpd  %xmm0,%xmm0
movapd 0x40(%rsp),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
movsd  0xdee(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %cl
and    %al,%cl
movzbl %cl,%edi
xor    %eax,%eax
call   1030 <assert@plt>
movsd  0x28(%rsp),%xmm0
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xdce(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xdb9(%rip),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1030 <assert@plt>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xda1(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xd9c(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
xor    %eax,%eax
call   1030 <assert@plt>
movsd  0x30(%rsp),%xmm0
divsd  0x10(%rsp),%xmm0
call   1050 <log@plt>
movsd  0x20(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm2
mulsd  0xd68(%rip),%xmm2
addsd  0x28(%rsp),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
ucomisd 0xd5a(%rip),%xmm1
jb     12f9 <CashOrNothing+0x1a9>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    1314 <CashOrNothing+0x1c4>
movapd %xmm1,%xmm0
movapd %xmm2,0x10(%rsp)
call   1070 <sqrt@plt>
movapd 0x10(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm0
divsd  %xmm0,%xmm2
movapd %xmm2,0x10(%rsp)
movapd 0x40(%rsp),%xmm0
xorpd  0xd1e(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
mulsd  0x38(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
test   %ebx,%ebx
je     1352 <CashOrNothing+0x202>
movaps 0x10(%rsp),%xmm0
jmp    135e <CashOrNothing+0x20e>
movaps 0x10(%rsp),%xmm0
xorps  0xcf2(%rip),%xmm0
mov    $0x1,%al
call   1060 <cnd@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define double @CashOrNothing(i32 %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = fcmp ord double %1, 0.000000e+00
%10 = fcmp oge double %1, 0x3EB0C6F7A0B5ED8D
%11 = and i1 %9, %10
%12 = fcmp ole double %1, 1.000000e+12
%13 = and i1 %12, %11
%14 = zext i1 %13 to i32
%15 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %14)
%16 = fcmp ord double %2, 0.000000e+00
%17 = fcmp oge double %2, 0x3EB0C6F7A0B5ED8D
%18 = and i1 %16, %17
%19 = fcmp ole double %2, 1.000000e+12
%20 = and i1 %19, %18
%21 = zext i1 %20 to i32
%22 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %21)
%23 = fcmp ord double %4, 0.000000e+00
%24 = fcmp oge double %4, 0x3F2596179C29D2CE
%25 = and i1 %23, %24
%26 = fcmp ole double %4, 2.000000e+01
%27 = and i1 %26, %25
%28 = zext i1 %27 to i32
%29 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %28)
%30 = fcmp oge double %5, 0.000000e+00
%31 = fcmp ole double %5, 1.000000e+03
%32 = and i1 %30, %31
%33 = zext i1 %32 to i32
%34 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %33)
%35 = fcmp ord double %6, 0.000000e+00
%36 = fcmp oge double %6, -1.000000e+03
%37 = and i1 %35, %36
%38 = fcmp ole double %6, 1.000000e+03
%39 = and i1 %38, %37
%40 = zext i1 %39 to i32
%41 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %40)
%42 = fcmp ord double %7, 0.000000e+00
%43 = fcmp oge double %7, 0x3E7AD7F29ABCAF48
%44 = and i1 %42, %43
%45 = fcmp ole double %7, 0x40593FFFD60E94EE
%46 = and i1 %45, %44
%47 = zext i1 %46 to i32
%48 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %47)
%49 = fdiv double %1, %2
%50 = tail call double @log(double %49)
%51 = fmul double %7, %7
%52 = fmul double %51, 5.000000e-01
%53 = fsub double %6, %52
%54 = tail call double @llvm.fmuladd.f64(double %53, double %4, double %50)
%55 = tail call double @sqrt(double %4)
%56 = fmul double %55, %7
%57 = fdiv double %54, %56
%58 = icmp eq i32 %0, 0
%59 = fneg double %5
%60 = fmul double %59, %4
%61 = tail call double @exp(double %60)
%62 = fmul double %61, %3
%63 = fneg double %57
%64 = select i1 %58, double %63, double %57
%65 = tail call i32 (double, ...) bitcast (i32 (...)* @cnd to i32 (double, ...)*)(double %64)
%66 = sitofp i32 %65 to double
%67 = fmul double %62, %66
ret double %67
}