#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 exp(double);
int log(double);
double pow(double, double);
double rq_pricing_cumul_norm_dist(double);
double sqrt(double);
double phi(double S, double T, double gamma, double H, double I, double r,
           double b, double v) {
  double lambda;
  double kappa;
  double d;
  lambda = (-r + gamma * b + 0.5 * gamma * (gamma - 1) * (v * v)) * T;
  d = -(log(S / H) + (b + (gamma - 0.5) * (v * v)) * T) / (v * sqrt(T));
  kappa = 2 * b / (v * v) + (2 * gamma - 1);
  return exp(lambda) * pow(S, gamma) *
         (rq_pricing_cumul_norm_dist(d) -
          pow(I / S, kappa) *
              rq_pricing_cumul_norm_dist(d - 2 * log(I / S) / (v * sqrt(T))));
}


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  -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  0xe57(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xe4d(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
call   1050 <log@plt>
cvtsi2sd %eax,%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm0
movsd  0xdfc(%rip),%xmm3
subsd  %xmm3,%xmm0
movsd  -0x40(%rbp),%xmm3
mulsd  -0x40(%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
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xd73(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xd47(%rip),%xmm2
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1050 <log@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x80(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  -0x70(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x60(%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    $0x68,%rsp
movsd  %xmm6,0x8(%rsp)
movsd  %xmm4,0x30(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movapd %xmm2,%xmm8
mulsd  %xmm6,%xmm8
subsd  %xmm5,%xmm8
movsd  0xe7d(%rip),%xmm5
mulsd  %xmm2,%xmm5
movsd  0xe79(%rip),%xmm4
addsd  %xmm2,%xmm4
mulsd  %xmm5,%xmm4
movsd  %xmm7,0x38(%rsp)
mulsd  %xmm7,%xmm7
movsd  %xmm7,0x20(%rsp)
mulsd  %xmm7,%xmm4
addsd  %xmm8,%xmm4
mulsd  %xmm1,%xmm4
movsd  %xmm4,0x58(%rsp)
movsd  %xmm0,0x28(%rsp)
divsd  %xmm3,%xmm0
call   1050 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xe38(%rip),%xmm1
addsd  0x18(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
addsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
xorpd  0xe20(%rip),%xmm1
movapd %xmm1,0x40(%rsp)
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm2
movsd  %xmm0,0x60(%rsp)
jae    1228 <phi+0xd8>
movsd  0x10(%rsp),%xmm0
call   1070 <sqrt@plt>
mulsd  0x38(%rsp),%xmm0
movapd 0x40(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
addsd  %xmm1,%xmm1
addsd  0xda8(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x58(%rsp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1060 <pow@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movaps 0x40(%rsp),%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x30(%rsp),%xmm0
divsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x20(%rsp),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x30(%rsp),%xmm0
call   1050 <log@plt>
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x10(%rsp),%xmm0
ucomisd 0xd2b(%rip),%xmm0
movsd  0x60(%rsp),%xmm0
jae    130c <phi+0x1bc>
movsd  0x10(%rsp),%xmm0
movsd  %xmm1,0x10(%rsp)
call   1070 <sqrt@plt>
movsd  0x10(%rsp),%xmm1
mulsd  0x38(%rsp),%xmm0
divsd  %xmm0,%xmm1
movapd 0x40(%rsp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  0x28(%rsp),%xmm2
mulsd  %xmm0,%xmm2
movsd  0x8(%rsp),%xmm1
subsd  %xmm2,%xmm1
movsd  0x18(%rsp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x68,%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
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
%20 = load double, double* %14
%21 = fneg double %20
%22 = load double, double* %11
%23 = load double, double* %15
%24 = call double @llvm.fmuladd.f64(double %22, double %23, double %21)
%25 = load double, double* %11
%26 = fmul double 5.000000e-01, %25
%27 = load double, double* %11
%28 = fsub double %27, 1.000000e+00
%29 = fmul double %26, %28
%30 = load double, double* %16
%31 = load double, double* %16
%32 = fmul double %30, %31
%33 = call double @llvm.fmuladd.f64(double %29, double %32, double %24)
%34 = load double, double* %10
%35 = fmul double %33, %34
store double %35, double* %17
%36 = load double, double* %9
%37 = load double, double* %12
%38 = fdiv double %36, %37
%39 = call i32 @log(double %38)
%40 = sitofp i32 %39 to double
%41 = load double, double* %15
%42 = load double, double* %11
%43 = fsub double %42, 5.000000e-01
%44 = load double, double* %16
%45 = load double, double* %16
%46 = fmul double %44, %45
%47 = call double @llvm.fmuladd.f64(double %43, double %46, double %41)
%48 = load double, double* %10
%49 = call double @llvm.fmuladd.f64(double %47, double %48, double %40)
%50 = fneg double %49
%51 = load double, double* %16
%52 = load double, double* %10
%53 = call double @sqrt(double %52)
%54 = fmul double %51, %53
%55 = fdiv double %50, %54
store double %55, double* %19
%56 = load double, double* %15
%57 = fmul double 2.000000e+00, %56
%58 = load double, double* %16
%59 = load double, double* %16
%60 = fmul double %58, %59
%61 = fdiv double %57, %60
%62 = load double, double* %11
%63 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %62, double -1.000000e+00)
%64 = fadd double %61, %63
store double %64, double* %18
%65 = load double, double* %17
%66 = call double @exp(double %65)
%67 = load double, double* %9
%68 = load double, double* %11
%69 = call double @pow(double %67, double %68)
%70 = fmul double %66, %69
%71 = load double, double* %19
%72 = call double @rq_pricing_cumul_norm_dist(double %71)
%73 = load double, double* %13
%74 = load double, double* %9
%75 = fdiv double %73, %74
%76 = load double, double* %18
%77 = call double @pow(double %75, double %76)
%78 = load double, double* %19
%79 = load double, double* %13
%80 = load double, double* %9
%81 = fdiv double %79, %80
%82 = call i32 @log(double %81)
%83 = mul nsw i32 2, %82
%84 = sitofp i32 %83 to double
%85 = load double, double* %16
%86 = load double, double* %10
%87 = call double @sqrt(double %86)
%88 = fmul double %85, %87
%89 = fdiv double %84, %88
%90 = fsub double %78, %89
%91 = call double @rq_pricing_cumul_norm_dist(double %90)
%92 = fneg double %77
%93 = call double @llvm.fmuladd.f64(double %92, double %91, double %72)
%94 = fmul double %70, %93
ret double %94
}

LLVM IR (-O2):
define double @phi(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = fneg double %5
%10 = tail call double @llvm.fmuladd.f64(double %2, double %6, double %9)
%11 = fmul double %2, 5.000000e-01
%12 = fadd double %2, -1.000000e+00
%13 = fmul double %11, %12
%14 = fmul double %7, %7
%15 = tail call double @llvm.fmuladd.f64(double %13, double %14, double %10)
%16 = fmul double %15, %1
%17 = fdiv double %0, %3
%18 = tail call i32 @log(double %17)
%19 = sitofp i32 %18 to double
%20 = fadd double %2, -5.000000e-01
%21 = tail call double @llvm.fmuladd.f64(double %20, double %14, double %6)
%22 = tail call double @llvm.fmuladd.f64(double %21, double %1, double %19)
%23 = fneg double %22
%24 = tail call double @sqrt(double %1)
%25 = fmul double %24, %7
%26 = fdiv double %23, %25
%27 = fmul double %6, 2.000000e+00
%28 = fdiv double %27, %14
%29 = tail call double @llvm.fmuladd.f64(double %2, double 2.000000e+00, double -1.000000e+00)
%30 = fadd double %29, %28
%31 = tail call double @exp(double %16)
%32 = tail call double @pow(double %0, double %2)
%33 = fmul double %31, %32
%34 = tail call double @rq_pricing_cumul_norm_dist(double %26)
%35 = fdiv double %4, %0
%36 = tail call double @pow(double %35, double %30)
%37 = tail call i32 @log(double %35)
%38 = shl nsw i32 %37, 1
%39 = sitofp i32 %38 to double
%40 = tail call double @sqrt(double %1)
%41 = fmul double %40, %7
%42 = fdiv double %39, %41
%43 = fsub double %26, %42
%44 = tail call double @rq_pricing_cumul_norm_dist(double %43)
%45 = fneg double %36
%46 = tail call double @llvm.fmuladd.f64(double %45, double %44, double %34)
%47 = fmul double %33, %46
ret double %47
}