#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 /*<<< orphan*/ assert(int);
double cnd(double);
double exp(double);
double log(double);
double pow(double, double);
double sqrt(double);
double phi(double S, double T, double gamma_val, double H, double I, double r,
           double b, double v) {
  double vst, vv, lambda, d, kappa;
  assert(((S) == (S)) && (S) >= 0.000001 && (S) <= 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(((v) == (v)) && (v) >= 0.0000001 && v <= 100.99999);
  vst = v * sqrt(T);
  vv = v * v;
  lambda = (-r + gamma_val * b + 0.5 * gamma_val * (gamma_val - 1.0) * vv) * T;
  d = -(log(S / H) + (b + (gamma_val - 0.5) * vv) * T) / vst;
  kappa = 2.0 * b / vv + (2.0 * gamma_val - 1.0);
  return exp(lambda) * pow(S, gamma_val) *
         (cnd(d) - pow(I / S, kappa) * cnd(d - 2.0 * log(I / S) / vst));
}


x86 assembly (clang, -O0):
<phi>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%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  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x8(%rbp),%xmm0
mov    %al,-0x69(%rbp)
jne    11dd <phi+0x7d>
jp     11dd <phi+0x7d>
movsd  -0x8(%rbp),%xmm0
xor    %eax,%eax
movsd  0xe43(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x69(%rbp)
jb     11dd <phi+0x7d>
movsd  0xe36(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
setae  %al
mov    %al,-0x69(%rbp)
mov    -0x69(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x6a(%rbp)
jne    1234 <phi+0xd4>
jp     1234 <phi+0xd4>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
movsd  0xdfc(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x6a(%rbp)
jb     1234 <phi+0xd4>
movsd  0xdef(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
setae  %al
mov    %al,-0x6a(%rbp)
mov    -0x6a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x30(%rbp),%xmm0
mov    %al,-0x6b(%rbp)
jne    1286 <phi+0x126>
jp     1286 <phi+0x126>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x6b(%rbp)
jb     1286 <phi+0x126>
movsd  0xda5(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
setae  %al
mov    %al,-0x6b(%rbp)
mov    -0x6b(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x40(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x40(%rbp),%xmm0
mov    %al,-0x6c(%rbp)
jne    12dd <phi+0x17d>
jp     12dd <phi+0x17d>
movsd  -0x40(%rbp),%xmm0
xor    %eax,%eax
movsd  0xd6b(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x6c(%rbp)
jb     12dd <phi+0x17d>
movsd  0xd5e(%rip),%xmm0
ucomisd -0x40(%rbp),%xmm0
setae  %al
mov    %al,-0x6c(%rbp)
mov    -0x6c(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1080 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xcee(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xce4(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm0
movsd  0xc99(%rip),%xmm3
subsd  %xmm3,%xmm0
movsd  -0x50(%rbp),%xmm3
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xc42(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xc2f(%rip),%xmm2
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1070 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1060 <cnd@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
call   1070 <pow@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x90(%rbp),%xmm0
ff
movsd  0xb8b(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  -0x48(%rbp),%xmm1
subsd  %xmm1,%xmm0
call   1060 <cnd@plt>
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x80(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x78(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phi>:
sub    $0x58,%rsp
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xe8d(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xe87(%rip),%xmm8
movsd  %xmm0,0x18(%rsp)
ucomisd %xmm0,%xmm8
movsd  %xmm7,0x8(%rsp)
movsd  %xmm6,0x38(%rsp)
movsd  %xmm5,0x30(%rsp)
movsd  %xmm4,0x40(%rsp)
movsd  %xmm3,0x50(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x20(%rsp)
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  0x20(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xe38(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xe33(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1030 <assert@plt>
xorpd  %xmm0,%xmm0
movsd  0x30(%rsp),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
movsd  0xe11(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xdf3(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xdee(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  0x20(%rsp),%xmm0
ucomisd 0xdef(%rip),%xmm0
jb     126f <phi+0x10f>
movsd  0x20(%rsp),%xmm0
sqrtsd %xmm0,%xmm0
jmp    127a <phi+0x11a>
movsd  0x20(%rsp),%xmm0
call   1080 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x48(%rsp)
mulsd  %xmm1,%xmm1
movapd %xmm1,%xmm4
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
mulsd  0x38(%rsp),%xmm0
subsd  0x30(%rsp),%xmm0
movsd  0xd82(%rip),%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm2,%xmm3
addsd  0xd7a(%rip),%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm4,%xmm3
addsd  %xmm0,%xmm3
mulsd  0x20(%rsp),%xmm3
movsd  %xmm3,0x30(%rsp)
movsd  0x18(%rsp),%xmm0
divsd  0x50(%rsp),%xmm0
call   1050 <log@plt>
movsd  0xd51(%rip),%xmm1
movsd  0x10(%rsp),%xmm2
addsd  %xmm2,%xmm1
movsd  0x8(%rsp),%xmm3
mulsd  %xmm3,%xmm1
movsd  0x38(%rsp),%xmm4
addsd  %xmm4,%xmm1
mulsd  0x20(%rsp),%xmm1
addsd  %xmm1,%xmm0
xorpd  0xd39(%rip),%xmm0
divsd  0x48(%rsp),%xmm0
movapd %xmm0,0x20(%rsp)
movapd %xmm4,%xmm0
addsd  %xmm4,%xmm0
divsd  %xmm3,%xmm0
movapd %xmm2,%xmm1
addsd  %xmm2,%xmm1
addsd  0xcf1(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x38(%rsp)
movsd  0x30(%rsp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1070 <pow@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movaps 0x20(%rsp),%xmm0
call   1060 <cnd@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x40(%rsp),%xmm0
divsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0x38(%rsp),%xmm1
call   1070 <pow@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x40(%rsp),%xmm0
call   1050 <log@plt>
addsd  %xmm0,%xmm0
divsd  0x48(%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1060 <cnd@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x58,%rsp
ret

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

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