#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 */
float expf(float);
float func(float);
float logf(float);
float sqrtf(float);
void blackscholes(const int width, const int height, float *input,
                  float *output1, float *output2) {
  int y;
#pragma omp simd
  for (y = 0; y < (width * height * 4); ++y) {
    float d1, d2;
    float sig;
    float minus;
    float s = 10.0f * input[y] + 100.0f * (1.0f - input[y]);
    float k = 10.0f * input[y] + 100.0f * (1.0f - input[y]);
    float t = 1.0f * input[y] + 10.0f * (1.0f - input[y]);
    float r = 0.01f * input[y] + 0.05f * (1.0f - input[y]);
    float sig2 = 0.01f * input[y] + 0.10f * (1.0f - input[y]);
    sig = sig2 * sqrtf(t);
    d1 = (logf(s / k) + (r + sig2 * sig2 / 2.0f) * t) / sig;
    d2 = d1 - sig;
    minus = k * expf(-r * t);
    output1[y] = s * func(d1) - minus * func(d2);
    output2[y] = minus * func(-d2) - s * func(-d1);
  }
}


x86 assembly (clang, -O0):
<blackscholes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jge    145e <blackscholes+0x31e>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  0xe79(%rip),%xmm2
subss  (%rax,%rcx,4),%xmm2
movss  0xe78(%rip),%xmm1
mulss  %xmm2,%xmm1
movss  0xe68(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  0xe36(%rip),%xmm2
subss  (%rax,%rcx,4),%xmm2
movss  0xe35(%rip),%xmm1
mulss  %xmm2,%xmm1
movss  0xe25(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  0xdf3(%rip),%xmm2
subss  (%rax,%rcx,4),%xmm2
movss  0xdee(%rip),%xmm1
mulss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  0xdbc(%rip),%xmm2
subss  (%rax,%rcx,4),%xmm2
movss  0xdb3(%rip),%xmm1
mulss  %xmm2,%xmm1
movss  0xd9b(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  0xd79(%rip),%xmm2
subss  (%rax,%rcx,4),%xmm2
movss  0xd68(%rip),%xmm1
mulss  %xmm2,%xmm1
movss  0xd58(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0x40(%rbp),%xmm0
call   1060 <sqrtf@plt>
movaps %xmm0,%xmm1
movss  -0x68(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x38(%rbp),%xmm0
divss  -0x3c(%rbp),%xmm0
call   1030 <logf@plt>
movaps %xmm0,%xmm1
movss  -0x44(%rbp),%xmm0
movss  -0x48(%rbp),%xmm2
mulss  -0x48(%rbp),%xmm2
movss  0xcf9(%rip),%xmm3
divss  %xmm3,%xmm2
addss  %xmm2,%xmm0
movss  -0x40(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
divss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
subss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x64(%rbp)
movss  -0x44(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x40(%rbp),%xmm0
call   1040 <expf@plt>
movaps %xmm0,%xmm1
movss  -0x64(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0x28(%rbp),%xmm0
call   1050 <func@plt>
movss  %xmm0,-0x5c(%rbp)
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
movss  -0x2c(%rbp),%xmm0
call   1050 <func@plt>
movss  -0x60(%rbp),%xmm1
movss  -0x5c(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x58(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x2c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1050 <func@plt>
movss  %xmm0,-0x50(%rbp)
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0x28(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1050 <func@plt>
movss  -0x54(%rbp),%xmm1
movss  -0x50(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x4c(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1161 <blackscholes+0x21>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blackscholes>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x50,%rsp
imul   %esi,%edi
shl    $0x2,%edi
test   %edi,%edi
jle    134e <blackscholes+0x20e>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %edi,%r13d
xor    %ebx,%ebx
movss  0xe97(%rip),%xmm1
jmp    12ec <blackscholes+0x1ac>
cs nopw 0x0(%rax,%rax,1)
movss  %xmm2,0x8(%rsp)
movaps %xmm3,0x30(%rsp)
movss  %xmm4,0x40(%rsp)
movss  %xmm5,0x10(%rsp)
movss  %xmm6,0x2c(%rsp)
call   1060 <sqrtf@plt>
movss  0x2c(%rsp),%xmm6
movss  0x10(%rsp),%xmm5
movss  0x40(%rsp),%xmm4
movaps 0x30(%rsp),%xmm3
movss  0x8(%rsp),%xmm2
movss  0xe41(%rip),%xmm1
mulss  %xmm1,%xmm2
addss  %xmm5,%xmm2
movss  %xmm2,0x8(%rsp)
addss  %xmm6,%xmm3
movaps %xmm3,0x30(%rsp)
addss  %xmm6,%xmm4
movss  %xmm4,0x40(%rsp)
mulss  %xmm4,%xmm0
movss  %xmm0,0x10(%rsp)
movaps %xmm2,%xmm0
divss  %xmm2,%xmm0
call   1030 <logf@plt>
movss  0x40(%rsp),%xmm3
mulss  %xmm3,%xmm3
mulss  0xe08(%rip),%xmm3
movaps 0x30(%rsp),%xmm2
addss  %xmm2,%xmm3
movss  0xc(%rsp),%xmm1
mulss  %xmm1,%xmm3
addss  %xmm3,%xmm0
movss  0x10(%rsp),%xmm3
divss  %xmm3,%xmm0
movaps %xmm0,0x40(%rsp)
subss  %xmm3,%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xdda(%rip),%xmm0
xorps  %xmm0,%xmm2
mulss  %xmm1,%xmm2
movaps %xmm2,%xmm0
call   1040 <expf@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x30(%rsp)
movaps 0x40(%rsp),%xmm0
call   1050 <func@plt>
movss  %xmm0,0xc(%rsp)
movaps 0x10(%rsp),%xmm0
call   1050 <func@plt>
mulss  0x30(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,(%r15,%rbx,4)
movaps 0x10(%rsp),%xmm0
xorps  0xd7d(%rip),%xmm0
call   1050 <func@plt>
movss  %xmm0,0x10(%rsp)
movaps 0x40(%rsp),%xmm0
xorps  0xd66(%rip),%xmm0
call   1050 <func@plt>
movss  0xd41(%rip),%xmm1
mulss  0x8(%rsp),%xmm0
movss  0x10(%rsp),%xmm2
mulss  0x30(%rsp),%xmm2
subss  %xmm0,%xmm2
movss  %xmm2,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r13
je     134e <blackscholes+0x20e>
movss  (%r12,%rbx,4),%xmm2
movss  0xd06(%rip),%xmm4
subss  %xmm2,%xmm4
movaps %xmm4,%xmm5
mulss  0xcfb(%rip),%xmm5
movaps %xmm4,%xmm0
mulss  %xmm1,%xmm0
addss  %xmm2,%xmm0
movaps %xmm4,%xmm3
mulss  0xced(%rip),%xmm3
movaps %xmm2,%xmm6
mulss  0xce6(%rip),%xmm6
mulss  0xce2(%rip),%xmm4
ucomiss 0xce3(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
jb     1180 <blackscholes+0x40>
sqrtss %xmm0,%xmm0
jmp    11c7 <blackscholes+0x87>
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @blackscholes(i32 %0, i32 %1, float* nocapture %2, float* nocapture writeonly %3, float* nocapture writeonly %4) {
%6 = shl i32 %0, 2
%7 = mul i32 %6, %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %54
9: ; preds = %5
%10 = zext i32 %7 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %52, %11 ]
%13 = getelementptr inbounds float, float* %2, i64 %12
%14 = load float, float* %13
%15 = fsub float 1.000000e+00, %14
%16 = fmul float %15, 1.000000e+02
%17 = tail call float @llvm.fmuladd.f32(float %14, float 1.000000e+01, float %16)
%18 = fmul float %15, 1.000000e+01
%19 = fadd float %14, %18
%20 = fmul float %15, 0x3FA99999A0000000
%21 = tail call float @llvm.fmuladd.f32(float %14, float 0x3F847AE140000000, float %20)
%22 = fmul float %15, 0x3FB99999A0000000
%23 = tail call float @llvm.fmuladd.f32(float %14, float 0x3F847AE140000000, float %22)
%24 = tail call float @sqrtf(float %19)
%25 = fmul float %24, %23
%26 = fdiv float %17, %17
%27 = tail call float @logf(float %26)
%28 = fmul float %23, %23
%29 = fmul float %28, 5.000000e-01
%30 = fadd float %21, %29
%31 = tail call float @llvm.fmuladd.f32(float %30, float %19, float %27)
%32 = fdiv float %31, %25
%33 = fsub float %32, %25
%34 = fneg float %21
%35 = fmul float %19, %34
%36 = tail call float @expf(float %35)
%37 = fmul float %17, %36
%38 = tail call float @func(float %32)
%39 = tail call float @func(float %33)
%40 = fneg float %37
%41 = fmul float %39, %40
%42 = tail call float @llvm.fmuladd.f32(float %17, float %38, float %41)
%43 = getelementptr inbounds float, float* %3, i64 %12
store float %42, float* %43
%44 = fneg float %33
%45 = tail call float @func(float %44)
%46 = fneg float %32
%47 = tail call float @func(float %46)
%48 = fneg float %17
%49 = fmul float %47, %48
%50 = tail call float @llvm.fmuladd.f32(float %37, float %45, float %49)
%51 = getelementptr inbounds float, float* %4, i64 %12
store float %50, float* %51
%52 = add nuw nsw i64 %12, 1
%53 = icmp eq i64 %52, %10
br i1 %53, label %54, label %11
54: ; preds = %11, %5
ret void
}