#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);
double log(double);
double sqrt(double);
BlackScholes(double StockPrice, double OptionStrike, double TimePeriod,
             double risk, double vol, double A1, double A2, double A3,
             double A4, double A5, double PI, double const1, double const2,
             double const3, double *W1) {
  double T0 = sqrt(TimePeriod);
  double T1 = (log(StockPrice / OptionStrike) +
               (risk + const2 * vol * vol) * TimePeriod) /
              (vol * T0);
  double T2 = T1 - vol * T0;
  double T3 = const1 / (const1 + const3 * T1);
  double T4 = const1 / (const1 + const3 * T2);
  double T5 = T3 * (A1 + T3 * (A2 + T3 * (A3 + T3 * (A4 + T3 * A5))));
  double T6 = T4 * (A2 + T4 * (A2 + T4 * (A3 + T4 * (A4 + T4 * A5))));
  double T7 = PI * exp(const1 - const2 * T1 * T1) * T5;
  double T8 = PI * exp(const1 - const2 * T2 * T2) * T6;
  double T9 = const1 / exp(risk * TimePeriod);
  *W1 = OptionStrike * T0 * (const1 - T8) - StockPrice * (const1 - T7);
}


x86 assembly (clang, -O0):
<BlackScholes>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movsd  0x38(%rbp),%xmm8
movsd  0x30(%rbp),%xmm8
movsd  0x28(%rbp),%xmm8
movsd  0x20(%rbp),%xmm8
movsd  0x18(%rbp),%xmm8
movsd  0x10(%rbp),%xmm8
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  %xmm6,-0x40(%rbp)
movsd  %xmm7,-0x48(%rbp)
mov    %rdi,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm3
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0x28(%rbp),%xmm0
movsd  0x28(%rbp),%xmm2
movsd  0x38(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0x28(%rbp),%xmm0
movsd  0x28(%rbp),%xmm2
movsd  0x38(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm4
movsd  -0x70(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm6
movsd  -0x70(%rbp),%xmm5
movsd  0x10(%rbp),%xmm8
movsd  -0x70(%rbp),%xmm7
movsd  0x18(%rbp),%xmm9
mulsd  %xmm9,%xmm7
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm5
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm4
movsd  -0x78(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm6
movsd  -0x78(%rbp),%xmm5
movsd  0x10(%rbp),%xmm8
movsd  -0x78(%rbp),%xmm7
movsd  0x18(%rbp),%xmm9
mulsd  %xmm9,%xmm7
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm5
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0x20(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  0x28(%rbp),%xmm1
movsd  0x30(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0x20(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  0x28(%rbp),%xmm1
movsd  0x30(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0x28(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  0x28(%rbp),%xmm2
subsd  -0x98(%rbp),%xmm2
ff
movsd  -0x10(%rbp),%xmm1
movsd  0x28(%rbp),%xmm3
subsd  -0x90(%rbp),%xmm3
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BlackScholes>:
push   %rbx
sub    $0x60,%rsp
mov    %rdi,%rbx
movsd  %xmm7,0x48(%rsp)
movsd  %xmm6,0x50(%rsp)
movsd  %xmm5,0x58(%rsp)
movsd  %xmm4,0x8(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x28(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
movsd  %xmm2,(%rsp)
jb     117a <BlackScholes+0x4a>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    1183 <BlackScholes+0x53>
movapd %xmm2,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
divsd  0x20(%rsp),%xmm0
call   1040 <log@plt>
movsd  0x8(%rsp),%xmm3
movapd %xmm3,%xmm1
movsd  0x90(%rsp),%xmm2
mulsd  %xmm2,%xmm1
movapd %xmm2,%xmm5
mulsd  %xmm3,%xmm1
addsd  0x18(%rsp),%xmm1
mulsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm3
divsd  %xmm3,%xmm1
movsd  0x98(%rsp),%xmm4
movapd %xmm4,%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm1,%xmm2
mulsd  %xmm5,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm1,%xmm5
subsd  %xmm3,%xmm5
movsd  %xmm5,0x30(%rsp)
movsd  0x88(%rsp),%xmm3
addsd  %xmm3,%xmm0
movapd %xmm3,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm5,%xmm4
addsd  %xmm3,%xmm4
movapd %xmm3,%xmm0
divsd  %xmm4,%xmm0
movsd  %xmm0,0x38(%rsp)
movapd %xmm3,%xmm0
subsd  %xmm2,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x90(%rsp),%xmm1
movsd  0x30(%rsp),%xmm0
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x88(%rsp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  (%rsp),%xmm1
movapd %xmm0,%xmm7
mulsd  0x18(%rsp),%xmm1
ucomisd 0xd7f(%rip),%xmm1
ja     1363 <BlackScholes+0x233>
movsd  0xd79(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1363 <BlackScholes+0x233>
movsd  0x80(%rsp),%xmm5
mulsd  %xmm5,%xmm7
movsd  0x38(%rsp),%xmm6
movapd %xmm6,%xmm0
movsd  0x78(%rsp),%xmm4
mulsd  %xmm4,%xmm0
movsd  0x70(%rsp),%xmm3
addsd  %xmm3,%xmm0
mulsd  %xmm6,%xmm0
movsd  0x48(%rsp),%xmm2
addsd  %xmm2,%xmm0
mulsd  %xmm6,%xmm0
movsd  0x50(%rsp),%xmm1
addsd  %xmm1,%xmm0
mulsd  %xmm6,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm6,%xmm0
mulsd  %xmm7,%xmm0
movsd  0x40(%rsp),%xmm6
mulsd  %xmm5,%xmm6
movsd  0x8(%rsp),%xmm5
mulsd  %xmm5,%xmm4
addsd  %xmm3,%xmm4
mulsd  %xmm5,%xmm4
addsd  %xmm2,%xmm4
mulsd  %xmm5,%xmm4
addsd  %xmm1,%xmm4
mulsd  %xmm5,%xmm4
addsd  0x58(%rsp),%xmm4
mulsd  %xmm5,%xmm4
mulsd  %xmm6,%xmm4
movsd  0x10(%rsp),%xmm3
mulsd  0x20(%rsp),%xmm3
movsd  0x88(%rsp),%xmm2
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm3,%xmm1
subsd  %xmm4,%xmm2
mulsd  0x28(%rsp),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rbx)
add    $0x60,%rsp
pop    %rbx
ret
movapd %xmm1,%xmm0
movsd  %xmm7,(%rsp)
call   1030 <exp@plt>
movsd  (%rsp),%xmm7
jmp    1299 <BlackScholes+0x169>

LLVM IR (-O0):
define i32 @BlackScholes(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, double %13, double* %14) {
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double*
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca double
%39 = alloca double
%40 = alloca double
%41 = alloca double
store double %0, double* %17
store double %1, double* %18
store double %2, double* %19
store double %3, double* %20
store double %4, double* %21
store double %5, double* %22
store double %6, double* %23
store double %7, double* %24
store double %8, double* %25
store double %9, double* %26
store double %10, double* %27
store double %11, double* %28
store double %12, double* %29
store double %13, double* %30
store double* %14, double** %31
%42 = load double, double* %19
%43 = call double @sqrt(double %42)
store double %43, double* %32
%44 = load double, double* %17
%45 = load double, double* %18
%46 = fdiv double %44, %45
%47 = call double @log(double %46)
%48 = load double, double* %20
%49 = load double, double* %29
%50 = load double, double* %21
%51 = fmul double %49, %50
%52 = load double, double* %21
%53 = call double @llvm.fmuladd.f64(double %51, double %52, double %48)
%54 = load double, double* %19
%55 = call double @llvm.fmuladd.f64(double %53, double %54, double %47)
%56 = load double, double* %21
%57 = load double, double* %32
%58 = fmul double %56, %57
%59 = fdiv double %55, %58
store double %59, double* %33
%60 = load double, double* %33
%61 = load double, double* %21
%62 = load double, double* %32
%63 = fneg double %61
%64 = call double @llvm.fmuladd.f64(double %63, double %62, double %60)
store double %64, double* %34
%65 = load double, double* %28
%66 = load double, double* %28
%67 = load double, double* %30
%68 = load double, double* %33
%69 = call double @llvm.fmuladd.f64(double %67, double %68, double %66)
%70 = fdiv double %65, %69
store double %70, double* %35
%71 = load double, double* %28
%72 = load double, double* %28
%73 = load double, double* %30
%74 = load double, double* %34
%75 = call double @llvm.fmuladd.f64(double %73, double %74, double %72)
%76 = fdiv double %71, %75
store double %76, double* %36
%77 = load double, double* %35
%78 = load double, double* %22
%79 = load double, double* %35
%80 = load double, double* %23
%81 = load double, double* %35
%82 = load double, double* %24
%83 = load double, double* %35
%84 = load double, double* %25
%85 = load double, double* %35
%86 = load double, double* %26
%87 = call double @llvm.fmuladd.f64(double %85, double %86, double %84)
%88 = call double @llvm.fmuladd.f64(double %83, double %87, double %82)
%89 = call double @llvm.fmuladd.f64(double %81, double %88, double %80)
%90 = call double @llvm.fmuladd.f64(double %79, double %89, double %78)
%91 = fmul double %77, %90
store double %91, double* %37
%92 = load double, double* %36
%93 = load double, double* %23
%94 = load double, double* %36
%95 = load double, double* %23
%96 = load double, double* %36
%97 = load double, double* %24
%98 = load double, double* %36
%99 = load double, double* %25
%100 = load double, double* %36
%101 = load double, double* %26
%102 = call double @llvm.fmuladd.f64(double %100, double %101, double %99)
%103 = call double @llvm.fmuladd.f64(double %98, double %102, double %97)
%104 = call double @llvm.fmuladd.f64(double %96, double %103, double %95)
%105 = call double @llvm.fmuladd.f64(double %94, double %104, double %93)
%106 = fmul double %92, %105
store double %106, double* %38
%107 = load double, double* %27
%108 = load double, double* %28
%109 = load double, double* %29
%110 = load double, double* %33
%111 = fmul double %109, %110
%112 = load double, double* %33
%113 = fneg double %111
%114 = call double @llvm.fmuladd.f64(double %113, double %112, double %108)
%115 = call double @exp(double %114)
%116 = fmul double %107, %115
%117 = load double, double* %37
%118 = fmul double %116, %117
store double %118, double* %39
%119 = load double, double* %27
%120 = load double, double* %28
%121 = load double, double* %29
%122 = load double, double* %34
%123 = fmul double %121, %122
%124 = load double, double* %34
%125 = fneg double %123
%126 = call double @llvm.fmuladd.f64(double %125, double %124, double %120)
%127 = call double @exp(double %126)
%128 = fmul double %119, %127
%129 = load double, double* %38
%130 = fmul double %128, %129
store double %130, double* %40
%131 = load double, double* %28
%132 = load double, double* %20
%133 = load double, double* %19
%134 = fmul double %132, %133
%135 = call double @exp(double %134)
%136 = fdiv double %131, %135
store double %136, double* %41
%137 = load double, double* %18
%138 = load double, double* %32
%139 = fmul double %137, %138
%140 = load double, double* %28
%141 = load double, double* %40
%142 = fsub double %140, %141
%143 = load double, double* %17
%144 = load double, double* %28
%145 = load double, double* %39
%146 = fsub double %144, %145
%147 = fmul double %143, %146
%148 = fneg double %147
%149 = call double @llvm.fmuladd.f64(double %139, double %142, double %148)
%150 = load double*, double** %31
store double %149, double* %150
%151 = load i32, i32* %16
ret i32 %151
}

LLVM IR (-O2):
define i32 @BlackScholes(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, double %13, double* nocapture writeonly %14) {
%16 = tail call double @sqrt(double %2)
%17 = fdiv double %0, %1
%18 = tail call double @log(double %17)
%19 = fmul double %4, %12
%20 = tail call double @llvm.fmuladd.f64(double %19, double %4, double %3)
%21 = tail call double @llvm.fmuladd.f64(double %20, double %2, double %18)
%22 = fmul double %16, %4
%23 = fdiv double %21, %22
%24 = fneg double %4
%25 = tail call double @llvm.fmuladd.f64(double %24, double %16, double %23)
%26 = tail call double @llvm.fmuladd.f64(double %13, double %23, double %11)
%27 = fdiv double %11, %26
%28 = tail call double @llvm.fmuladd.f64(double %13, double %25, double %11)
%29 = fdiv double %11, %28
%30 = fneg double %23
%31 = fmul double %30, %12
%32 = tail call double @llvm.fmuladd.f64(double %31, double %23, double %11)
%33 = tail call double @exp(double %32)
%34 = fneg double %25
%35 = fmul double %34, %12
%36 = tail call double @llvm.fmuladd.f64(double %35, double %25, double %11)
%37 = tail call double @exp(double %36)
%38 = fmul double %2, %3
%39 = fcmp olt double %38, -7.450000e+02
%40 = fcmp ogt double %38, 7.090000e+02
%41 = or i1 %40, %39
br i1 %41, label %42, label %44
42: ; preds = %15
%43 = tail call double @exp(double %38)
br label %44
44: ; preds = %15, %42
%45 = fmul double %37, %10
%46 = tail call double @llvm.fmuladd.f64(double %29, double %9, double %8)
%47 = tail call double @llvm.fmuladd.f64(double %29, double %46, double %7)
%48 = tail call double @llvm.fmuladd.f64(double %29, double %47, double %6)
%49 = tail call double @llvm.fmuladd.f64(double %29, double %48, double %6)
%50 = fmul double %29, %49
%51 = fmul double %45, %50
%52 = fmul double %33, %10
%53 = tail call double @llvm.fmuladd.f64(double %27, double %9, double %8)
%54 = tail call double @llvm.fmuladd.f64(double %27, double %53, double %7)
%55 = tail call double @llvm.fmuladd.f64(double %27, double %54, double %6)
%56 = tail call double @llvm.fmuladd.f64(double %27, double %55, double %5)
%57 = fmul double %27, %56
%58 = fmul double %52, %57
%59 = fmul double %16, %1
%60 = fsub double %11, %51
%61 = fsub double %11, %58
%62 = fneg double %61
%63 = fmul double %62, %0
%64 = tail call double @llvm.fmuladd.f64(double %59, double %60, double %63)
store double %64, double* %14
ret i32 undef
}