#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 covariance(double *, double *, int);
int /*<<< orphan*/ heaviside(double *, double *, int);
double kge_c(double *, double *, int);
double mean(double *, int);
double mse_c(double *, double *, int);
double nse_c(double *, double *, int);
int /*<<< orphan*/ printf(char *, int, ...);
double standard_dev_mean(double *, double, int);
double sum(double *, int);
double variance_mean(double *, double, int);
int main(void) {
  double data[8] = {2, 4, 4, 4, 5, 5, 7, 9};
  double x = sum(data, 8);
  printf("%f\n", x);
  double m = mean(data, 8);
  printf("%f\n", m);
  double v = variance_mean(data, m, 8);
  printf("%f\n", v);
  double sd = standard_dev_mean(data, m, 8);
  printf("%f\n", sd);
  double obs[5] = {13, 17, 18, 20, 24};
  double sim[5] = {12, 15, 20, 22, 24};
  double mean_square_error = mse_c(obs, sim, 5);
  printf("%f\n", mean_square_error);
  double pobs[5] = {1, 2, 3, 4, 5};
  double psim[5] = {1, 2, 3, 4, 5};
  double ns = nse_c(pobs, psim, 5);
  printf("%f\n", ns);
  double kge = kge_c(obs, sim, 5);
  printf("KGE: %f\n", kge);
  kge = kge_c(pobs, psim, 5);
  printf("Perfect KGE: %f\n", kge);
  double cv = covariance(obs, sim, 5);
  printf("Covariance: %f\n", cv);
  cv = covariance(pobs, psim, 5);
  printf("Covariance: %f\n", cv);
  double h_data[5] = {-3, -2, -1, 1, 2};
  double out_data[6] = {0, 0, 0, 0, 0, 0};
  heaviside(h_data, out_data, 6);
  int i;
  for (i = 0; i < 5; i++) {
    printf("Heaviside %d: %f\n", i, out_data[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x40,%edx
call   1080 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
call   1090 <sum@plt>
movsd  %xmm0,-0x58(%rbp)
cvttsd2si -0x58(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
call   10d0 <mean@plt>
movsd  %xmm0,-0x60(%rbp)
cvttsd2si -0x60(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
movsd  -0x60(%rbp),%xmm0
mov    $0x8,%esi
call   1070 <variance_mean@plt>
movsd  %xmm0,-0x68(%rbp)
cvttsd2si -0x68(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
movsd  -0x60(%rbp),%xmm0
mov    $0x8,%esi
call   1060 <standard_dev_mean@plt>
movsd  %xmm0,-0x70(%rbp)
cvttsd2si -0x70(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xdd4(%rip),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xdbc(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xda4(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xd7c(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xd5c(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xd5c(%rip),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  0xd44(%rip),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  0xd2c(%rip),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0xd14(%rip),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  0xcfc(%rip),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
lea    -0xa0(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
mov    $0x5,%edx
call   1030 <mse_c@plt>
movsd  %xmm0,-0xd8(%rbp)
ff
cvttsd2si -0xd8(%rbp),%esi
ff
lea    0xd52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x100(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xc6b(%rip),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  0xc53(%rip),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  0xc7b(%rip),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  0xc63(%rip),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  0xc4b(%rip),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xc08(%rip),%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
movsd  0xbf0(%rip),%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
movsd  0xc18(%rip),%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movsd  0xc00(%rip),%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
movsd  0xbe8(%rip),%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
lea    -0x100(%rbp),%rdi
lea    -0x130(%rbp),%rsi
mov    $0x5,%edx
call   10b0 <nse_c@plt>
movsd  %xmm0,-0x138(%rbp)
ff
cvttsd2si -0x138(%rbp),%esi
ff
lea    0xc56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
mov    $0x5,%edx
call   10e0 <kge_c@plt>
movsd  %xmm0,-0x140(%rbp)
ff
cvttsd2si -0x140(%rbp),%esi
ff
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x100(%rbp),%rdi
lea    -0x130(%rbp),%rsi
mov    $0x5,%edx
call   10e0 <kge_c@plt>
movsd  %xmm0,-0x140(%rbp)
ff
cvttsd2si -0x140(%rbp),%esi
ff
lea    0xbdd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
mov    $0x5,%edx
call   10a0 <covariance@plt>
movsd  %xmm0,-0x148(%rbp)
ff
cvttsd2si -0x148(%rbp),%esi
ff
lea    0xbb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x100(%rbp),%rdi
lea    -0x130(%rbp),%rsi
mov    $0x5,%edx
call   10a0 <covariance@plt>
movsd  %xmm0,-0x148(%rbp)
ff
cvttsd2si -0x148(%rbp),%esi
ff
lea    0xb82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x170(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xaaf(%rip),%xmm0
movsd  %xmm0,-0x170(%rbp)
ff
movsd  0xa97(%rip),%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
movsd  0xa7f(%rip),%xmm0
movsd  %xmm0,-0x160(%rbp)
ff
movsd  0xa67(%rip),%xmm0
movsd  %xmm0,-0x158(%rbp)
ff
movsd  0xa4f(%rip),%xmm0
movsd  %xmm0,-0x150(%rbp)
ff
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1050 <memset@plt>
lea    -0x170(%rbp),%rdi
lea    -0x1a0(%rbp),%rsi
mov    $0x6,%edx
call   10c0 <heaviside@plt>
movl   $0x0,-0x1a4(%rbp)
cmpl   $0x5,-0x1a4(%rbp)
jge    1633 <main+0x473>
mov    -0x1a4(%rbp),%esi
movslq -0x1a4(%rbp),%rax
movsd  -0x1a0(%rbp,%rax,8),%xmm0
ff ff
lea    0xac9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    15ee <main+0x42e>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x178,%rsp
movaps 0xef8(%rip),%xmm0
movaps %xmm0,0x160(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movapd 0xe9a(%rip),%xmm0
movapd %xmm0,0x130(%rsp)
lea    0x130(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1070 <sum@plt>
cvttsd2si %xmm0,%esi
lea    0xebe(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   10b0 <mean@plt>
movsd  %xmm0,0x8(%rsp)
cvttsd2si %xmm0,%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x8,%esi
call   1060 <variance_mean@plt>
cvttsd2si %xmm0,%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x8,%esi
call   1050 <standard_dev_mean@plt>
cvttsd2si %xmm0,%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movaps 0xd7d(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xd7e(%rip),%xmm0
movaps %xmm0,0x110(%rsp)
movabs $0x4038000000000000,%rax
mov    %rax,0x120(%rsp)
movaps 0xd6d(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movapd 0xd6d(%rip),%xmm0
movapd %xmm0,0xe0(%rsp)
mov    %rax,0xf0(%rsp)
lea    0x100(%rsp),%r14
lea    0xd0(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x5,%edx
call   1030 <mse_c@plt>
cvttsd2si %xmm0,%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movapd 0xd36(%rip),%xmm0
movapd %xmm0,0xa0(%rsp)
movaps 0xd36(%rip),%xmm1
movaps %xmm1,0xb0(%rsp)
movabs $0x4014000000000000,%rax
mov    %rax,0xc0(%rsp)
movapd %xmm0,0x70(%rsp)
movaps %xmm1,0x80(%rsp)
mov    %rax,0x90(%rsp)
lea    0xa0(%rsp),%r12
lea    0x70(%rsp),%r13
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0x5,%edx
call   1090 <nse_c@plt>
cvttsd2si %xmm0,%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x5,%edx
call   10c0 <kge_c@plt>
cvttsd2si %xmm0,%esi
lea    0xd38(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0x5,%edx
call   10c0 <kge_c@plt>
cvttsd2si %xmm0,%esi
lea    0xd0e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x5,%edx
call   1080 <covariance@plt>
cvttsd2si %xmm0,%esi
lea    0xcfd(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0x5,%edx
call   1080 <covariance@plt>
cvttsd2si %xmm0,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movaps 0xc5d(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xc61(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movabs $0x4000000000000000,%rax
mov    %rax,0x60(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0x40(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    $0x6,%edx
call   10a0 <heaviside@plt>
movsd  0x10(%rsp),%xmm0
lea    0xc8b(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x178,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.data = [8 x double] [double 2.000000e+00, double 4.000000e+00, double 4.000000e+00, double 4.000000e+00, double 5.000000e+00, double 5.000000e+00, double 7.000000e+00, double 9.000000e+00]
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [9 x i8] c"KGE: %f\0A\00"
@.str.2 = [17 x i8] c"Perfect KGE: %f\0A\00"
@.str.3 = [16 x i8] c"Covariance: %f\0A\00"
@.str.4 = [18 x i8] c"Heaviside %d: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x double]
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca [5 x double]
%8 = alloca [5 x double]
%9 = alloca double
%10 = alloca [5 x double]
%11 = alloca [5 x double]
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca [5 x double]
%16 = alloca [6 x double]
%17 = alloca i32
store i32 0, i32* %1
%18 = bitcast [8 x double]* %2 to i8*
%19 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%20 = call double @sum(double* %19, i32 8)
store double %20, double* %3
%21 = load double, double* %3
%22 = fptosi double %21 to i32
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%25 = call double @mean(double* %24, i32 8)
store double %25, double* %4
%26 = load double, double* %4
%27 = fptosi double %26 to i32
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%30 = load double, double* %4
%31 = call double @variance_mean(double* %29, double %30, i32 8)
store double %31, double* %5
%32 = load double, double* %5
%33 = fptosi double %32 to i32
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%36 = load double, double* %4
%37 = call double @standard_dev_mean(double* %35, double %36, i32 8)
store double %37, double* %6
%38 = load double, double* %6
%39 = fptosi double %38 to i32
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %39)
%41 = bitcast [5 x double]* %7 to i8*
%42 = bitcast i8* %41 to [5 x double]*
%43 = getelementptr inbounds [5 x double], [5 x double]* %42, i32 0, i32 0
store double 1.300000e+01, double* %43
%44 = getelementptr inbounds [5 x double], [5 x double]* %42, i32 0, i32 1
store double 1.700000e+01, double* %44
%45 = getelementptr inbounds [5 x double], [5 x double]* %42, i32 0, i32 2
store double 1.800000e+01, double* %45
%46 = getelementptr inbounds [5 x double], [5 x double]* %42, i32 0, i32 3
store double 2.000000e+01, double* %46
%47 = getelementptr inbounds [5 x double], [5 x double]* %42, i32 0, i32 4
store double 2.400000e+01, double* %47
%48 = bitcast [5 x double]* %8 to i8*
%49 = bitcast i8* %48 to [5 x double]*
%50 = getelementptr inbounds [5 x double], [5 x double]* %49, i32 0, i32 0
store double 1.200000e+01, double* %50
%51 = getelementptr inbounds [5 x double], [5 x double]* %49, i32 0, i32 1
store double 1.500000e+01, double* %51
%52 = getelementptr inbounds [5 x double], [5 x double]* %49, i32 0, i32 2
store double 2.000000e+01, double* %52
%53 = getelementptr inbounds [5 x double], [5 x double]* %49, i32 0, i32 3
store double 2.200000e+01, double* %53
%54 = getelementptr inbounds [5 x double], [5 x double]* %49, i32 0, i32 4
store double 2.400000e+01, double* %54
%55 = getelementptr inbounds [5 x double], [5 x double]* %7, i64 0, i64 0
%56 = getelementptr inbounds [5 x double], [5 x double]* %8, i64 0, i64 0
%57 = call double @mse_c(double* %55, double* %56, i32 5)
store double %57, double* %9
%58 = load double, double* %9
%59 = fptosi double %58 to i32
%60 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %59)
%61 = bitcast [5 x double]* %10 to i8*
%62 = bitcast i8* %61 to [5 x double]*
%63 = getelementptr inbounds [5 x double], [5 x double]* %62, i32 0, i32 0
store double 1.000000e+00, double* %63
%64 = getelementptr inbounds [5 x double], [5 x double]* %62, i32 0, i32 1
store double 2.000000e+00, double* %64
%65 = getelementptr inbounds [5 x double], [5 x double]* %62, i32 0, i32 2
store double 3.000000e+00, double* %65
%66 = getelementptr inbounds [5 x double], [5 x double]* %62, i32 0, i32 3
store double 4.000000e+00, double* %66
%67 = getelementptr inbounds [5 x double], [5 x double]* %62, i32 0, i32 4
store double 5.000000e+00, double* %67
%68 = bitcast [5 x double]* %11 to i8*
%69 = bitcast i8* %68 to [5 x double]*
%70 = getelementptr inbounds [5 x double], [5 x double]* %69, i32 0, i32 0
store double 1.000000e+00, double* %70
%71 = getelementptr inbounds [5 x double], [5 x double]* %69, i32 0, i32 1
store double 2.000000e+00, double* %71
%72 = getelementptr inbounds [5 x double], [5 x double]* %69, i32 0, i32 2
store double 3.000000e+00, double* %72
%73 = getelementptr inbounds [5 x double], [5 x double]* %69, i32 0, i32 3
store double 4.000000e+00, double* %73
%74 = getelementptr inbounds [5 x double], [5 x double]* %69, i32 0, i32 4
store double 5.000000e+00, double* %74
%75 = getelementptr inbounds [5 x double], [5 x double]* %10, i64 0, i64 0
%76 = getelementptr inbounds [5 x double], [5 x double]* %11, i64 0, i64 0
%77 = call double @nse_c(double* %75, double* %76, i32 5)
store double %77, double* %12
%78 = load double, double* %12
%79 = fptosi double %78 to i32
%80 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %79)
%81 = getelementptr inbounds [5 x double], [5 x double]* %7, i64 0, i64 0
%82 = getelementptr inbounds [5 x double], [5 x double]* %8, i64 0, i64 0
%83 = call double @kge_c(double* %81, double* %82, i32 5)
store double %83, double* %13
%84 = load double, double* %13
%85 = fptosi double %84 to i32
%86 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %85)
%87 = getelementptr inbounds [5 x double], [5 x double]* %10, i64 0, i64 0
%88 = getelementptr inbounds [5 x double], [5 x double]* %11, i64 0, i64 0
%89 = call double @kge_c(double* %87, double* %88, i32 5)
store double %89, double* %13
%90 = load double, double* %13
%91 = fptosi double %90 to i32
%92 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %91)
%93 = getelementptr inbounds [5 x double], [5 x double]* %7, i64 0, i64 0
%94 = getelementptr inbounds [5 x double], [5 x double]* %8, i64 0, i64 0
%95 = call double @covariance(double* %93, double* %94, i32 5)
store double %95, double* %14
%96 = load double, double* %14
%97 = fptosi double %96 to i32
%98 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %97)
%99 = getelementptr inbounds [5 x double], [5 x double]* %10, i64 0, i64 0
%100 = getelementptr inbounds [5 x double], [5 x double]* %11, i64 0, i64 0
%101 = call double @covariance(double* %99, double* %100, i32 5)
store double %101, double* %14
%102 = load double, double* %14
%103 = fptosi double %102 to i32
%104 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %103)
%105 = bitcast [5 x double]* %15 to i8*
%106 = bitcast i8* %105 to [5 x double]*
%107 = getelementptr inbounds [5 x double], [5 x double]* %106, i32 0, i32 0
store double -3.000000e+00, double* %107
%108 = getelementptr inbounds [5 x double], [5 x double]* %106, i32 0, i32 1
store double -2.000000e+00, double* %108
%109 = getelementptr inbounds [5 x double], [5 x double]* %106, i32 0, i32 2
store double -1.000000e+00, double* %109
%110 = getelementptr inbounds [5 x double], [5 x double]* %106, i32 0, i32 3
store double 1.000000e+00, double* %110
%111 = getelementptr inbounds [5 x double], [5 x double]* %106, i32 0, i32 4
store double 2.000000e+00, double* %111
%112 = bitcast [6 x double]* %16 to i8*
%113 = getelementptr inbounds [5 x double], [5 x double]* %15, i64 0, i64 0
%114 = getelementptr inbounds [6 x double], [6 x double]* %16, i64 0, i64 0
%115 = call i32 @heaviside(double* %113, double* %114, i32 6)
store i32 0, i32* %17
br label %116
116: ; preds = %126, %0
%117 = load i32, i32* %17
%118 = icmp slt i32 %117, 5
br i1 %118, label %119, label %129
119: ; preds = %116
%120 = load i32, i32* %17
%121 = load i32, i32* %17
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [6 x double], [6 x double]* %16, i64 0, i64 %122
%124 = load double, double* %123
%125 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %120, double %124)
br label %126
126: ; preds = %119
%127 = load i32, i32* %17
%128 = add nsw i32 %127, 1
store i32 %128, i32* %17
br label %116
129: ; preds = %116
ret i32 0
}

LLVM IR (-O2):
@__const.main.data = [8 x double] [double 2.000000e+00, double 4.000000e+00, double 4.000000e+00, double 4.000000e+00, double 5.000000e+00, double 5.000000e+00, double 7.000000e+00, double 9.000000e+00]
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [9 x i8] c"KGE: %f\0A\00"
@.str.2 = [17 x i8] c"Perfect KGE: %f\0A\00"
@.str.3 = [16 x i8] c"Covariance: %f\0A\00"
@.str.4 = [18 x i8] c"Heaviside %d: %f\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = alloca [5 x double]
%3 = alloca [5 x double]
%4 = alloca [5 x double]
%5 = alloca [5 x double]
%6 = alloca [5 x double]
%7 = alloca [6 x double]
%8 = bitcast [8 x double]* %1 to i8*
%9 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%10 = call double @sum(double* %9, i32 8)
%11 = fptosi double %10 to i32
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call double @mean(double* %9, i32 8)
%14 = fptosi double %13 to i32
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call double @variance_mean(double* %9, double %13, i32 8)
%17 = fptosi double %16 to i32
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = call double @standard_dev_mean(double* %9, double %13, i32 8)
%20 = fptosi double %19 to i32
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = bitcast [5 x double]* %2 to i8*
%23 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%24 = bitcast [5 x double]* %2 to <2 x double>*
store <2 x double> <double 1.300000e+01, double 1.700000e+01>, <2 x double>* %24
%25 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 2
%26 = bitcast double* %25 to <2 x double>*
store <2 x double> <double 1.800000e+01, double 2.000000e+01>, <2 x double>* %26
%27 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 4
store double 2.400000e+01, double* %27
%28 = bitcast [5 x double]* %3 to i8*
%29 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 0
%30 = bitcast [5 x double]* %3 to <2 x double>*
store <2 x double> <double 1.200000e+01, double 1.500000e+01>, <2 x double>* %30
%31 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 2
%32 = bitcast double* %31 to <2 x double>*
store <2 x double> <double 2.000000e+01, double 2.200000e+01>, <2 x double>* %32
%33 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 4
store double 2.400000e+01, double* %33
%34 = call double @mse_c(double* %23, double* %29, i32 5)
%35 = fptosi double %34 to i32
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %35)
%37 = bitcast [5 x double]* %4 to i8*
%38 = getelementptr inbounds [5 x double], [5 x double]* %4, i64 0, i64 0
%39 = bitcast [5 x double]* %4 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 2.000000e+00>, <2 x double>* %39
%40 = getelementptr inbounds [5 x double], [5 x double]* %4, i64 0, i64 2
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 4.000000e+00>, <2 x double>* %41
%42 = getelementptr inbounds [5 x double], [5 x double]* %4, i64 0, i64 4
store double 5.000000e+00, double* %42
%43 = bitcast [5 x double]* %5 to i8*
%44 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 0
%45 = bitcast [5 x double]* %5 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 2.000000e+00>, <2 x double>* %45
%46 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 2
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 4.000000e+00>, <2 x double>* %47
%48 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 4
store double 5.000000e+00, double* %48
%49 = call double @nse_c(double* %38, double* %44, i32 5)
%50 = fptosi double %49 to i32
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %50)
%52 = call double @kge_c(double* %23, double* %29, i32 5)
%53 = fptosi double %52 to i32
%54 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %53)
%55 = call double @kge_c(double* %38, double* %44, i32 5)
%56 = fptosi double %55 to i32
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %56)
%58 = call double @covariance(double* %23, double* %29, i32 5)
%59 = fptosi double %58 to i32
%60 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %59)
%61 = call double @covariance(double* %38, double* %44, i32 5)
%62 = fptosi double %61 to i32
%63 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %62)
%64 = bitcast [5 x double]* %6 to i8*
%65 = getelementptr inbounds [5 x double], [5 x double]* %6, i64 0, i64 0
%66 = bitcast [5 x double]* %6 to <2 x double>*
store <2 x double> <double -3.000000e+00, double -2.000000e+00>, <2 x double>* %66
%67 = getelementptr inbounds [5 x double], [5 x double]* %6, i64 0, i64 2
%68 = bitcast double* %67 to <2 x double>*
store <2 x double> <double -1.000000e+00, double 1.000000e+00>, <2 x double>* %68
%69 = getelementptr inbounds [5 x double], [5 x double]* %6, i64 0, i64 4
store double 2.000000e+00, double* %69
%70 = bitcast [6 x double]* %7 to i8*
%71 = getelementptr inbounds [6 x double], [6 x double]* %7, i64 0, i64 0
%72 = call i32 @heaviside(double* %65, double* %71, i32 6)
%73 = load double, double* %71
%74 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 0, double %73)
%75 = getelementptr inbounds [6 x double], [6 x double]* %7, i64 0, i64 1
%76 = load double, double* %75
%77 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 1, double %76)
%78 = getelementptr inbounds [6 x double], [6 x double]* %7, i64 0, i64 2
%79 = load double, double* %78
%80 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 2, double %79)
%81 = getelementptr inbounds [6 x double], [6 x double]* %7, i64 0, i64 3
%82 = load double, double* %81
%83 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 3, double %82)
%84 = getelementptr inbounds [6 x double], [6 x double]* %7, i64 0, i64 4
%85 = load double, double* %84
%86 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 4, double %85)
ret i32 0
}