#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 */
typedef int /*<<< orphan*/ y;
typedef int /*<<< orphan*/ mass;
typedef int /*<<< orphan*/ height;
typedef int /*<<< orphan*/ CO2_level;

/* Variables and functions */
int /*<<< orphan*/ LeastSquaresLinearFit(double *, double *, int, double *,
                                         double *);
double covd(double *, double *, int);
int /*<<< orphan*/ printf(char *, double, ...);
double vard(double *, int);
int main() {
  double height[] = {1.47, 1.50, 1.52, 1.55, 1.57, 1.60, 1.63, 1.65,
                     1.68, 1.70, 1.73, 1.75, 1.78, 1.80, 1.83};
  double mass[] = {52.21, 53.12, 54.48, 55.84, 57.20, 58.57, 59.93, 61.29,
                   63.11, 64.47, 66.28, 68.10, 69.92, 72.19, 74.46};
  double slope, intercept;
  double x[] = {-4.0, -3.0, -2.0, -1.5, -0.5, 1.0, 2.0, 3.5, 4.0};
  double y[] = {-3.0, -1.0, -2.0, -0.5, 1.0, 0.0, 1.5, 1.0, 2.5};
  double year[] = {1980, 1982, 1984, 1986, 1988, 1990, 1992, 1994,
                   1996, 1998, 2000, 2002, 2004, 2006, 2008};
  double CO2_level[] = {338.7, 341.2, 344.4, 347.2, 351.5, 354.2, 356.3, 358.6,
                        362.4, 366.5, 369.4, 373.2, 377.5, 381.9, 385.6};
  LeastSquaresLinearFit(height, mass, (sizeof(mass) / sizeof(mass[0])), &slope,
                        &intercept);
  printf("Slope: %f, Intercept: %f\n", slope, intercept);
  slope = covd(height, mass, (sizeof(mass) / sizeof(mass[0]))) /
          vard(height, (sizeof(height) / sizeof(height[0])));
  printf("Slope via Cov(X,Y)/Var(X): %f\n", slope);
  LeastSquaresLinearFit(x, y, (sizeof(y) / sizeof(y[0])), &slope, &intercept);
  printf("Slope: %f, Intercept: %f\n", slope, intercept);
  LeastSquaresLinearFit(year, CO2_level,
                        (sizeof(CO2_level) / sizeof(CO2_level[0])), &slope,
                        &intercept);
  printf("Slope: %f, Intercept: %f\n", slope, intercept);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x78,%edx
call   1060 <memcpy@plt>
lea    -0x100(%rbp),%rdi
lea    0xefb(%rip),%rsi
mov    $0x78,%edx
call   1060 <memcpy@plt>
lea    -0x160(%rbp),%rdi
lea    0xf63(%rip),%rsi
mov    $0x48,%edx
call   1060 <memcpy@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xf9b(%rip),%rsi
mov    $0x48,%edx
call   1060 <memcpy@plt>
lea    -0x230(%rbp),%rdi
lea    0xfd3(%rip),%rsi
mov    $0x78,%edx
call   1060 <memcpy@plt>
lea    -0x2b0(%rbp),%rdi
lea    0x103b(%rip),%rsi
mov    $0x78,%edx
call   1060 <memcpy@plt>
lea    -0x80(%rbp),%rdi
lea    -0x100(%rbp),%rsi
mov    $0xf,%edx
lea    -0x108(%rbp),%rcx
lea    -0x110(%rbp),%r8
call   1070 <LeastSquaresLinearFit@plt>
movsd  -0x108(%rbp),%xmm0
ff
movsd  -0x110(%rbp),%xmm1
ff
lea    0x106f(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
lea    -0x80(%rbp),%rdi
lea    -0x100(%rbp),%rsi
mov    $0xf,%edx
call   1030 <covd@plt>
movsd  %xmm0,-0x2b8(%rbp)
ff
lea    -0x80(%rbp),%rdi
mov    $0xf,%esi
call   1040 <vard@plt>
movaps %xmm0,%xmm1
movsd  -0x2b8(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
movsd  -0x108(%rbp),%xmm0
ff
lea    0x1031(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x160(%rbp),%rdi
lea    -0x1b0(%rbp),%rsi
mov    $0x9,%edx
lea    -0x108(%rbp),%rcx
lea    -0x110(%rbp),%r8
call   1070 <LeastSquaresLinearFit@plt>
movsd  -0x108(%rbp),%xmm0
ff
movsd  -0x110(%rbp),%xmm1
ff
lea    0xfd3(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
lea    -0x230(%rbp),%rdi
lea    -0x2b0(%rbp),%rsi
mov    $0xf,%edx
lea    -0x108(%rbp),%rcx
lea    -0x110(%rbp),%r8
call   1070 <LeastSquaresLinearFit@plt>
movsd  -0x108(%rbp),%xmm0
ff
movsd  -0x110(%rbp),%xmm1
ff
lea    0xf8f(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x2c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2c0,%rsp
mov    0xf19(%rip),%rax
mov    %rax,0x2b0(%rsp)
movaps 0xefa(%rip),%xmm0
movaps %xmm0,0x2a0(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,0x290(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x280(%rsp)
movaps 0xe9d(%rip),%xmm0
movaps %xmm0,0x270(%rsp)
movaps 0xe7e(%rip),%xmm0
movaps %xmm0,0x260(%rsp)
movaps 0xe5f(%rip),%xmm0
movaps %xmm0,0x250(%rsp)
movaps 0xe40(%rip),%xmm0
movaps %xmm0,0x240(%rsp)
mov    0xf21(%rip),%rax
mov    %rax,0x230(%rsp)
movaps 0xf02(%rip),%xmm0
movaps %xmm0,0x220(%rsp)
movaps 0xee3(%rip),%xmm0
movaps %xmm0,0x210(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x200(%rsp)
movaps 0xea5(%rip),%xmm0
movaps %xmm0,0x1f0(%rsp)
movaps 0xe86(%rip),%xmm0
movaps %xmm0,0x1e0(%rsp)
movaps 0xe67(%rip),%xmm0
movaps %xmm0,0x1d0(%rsp)
movaps 0xe48(%rip),%xmm0
movaps %xmm0,0x1c0(%rsp)
mov    0xef9(%rip),%rax
mov    %rax,0xb0(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xebb(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe7d(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
mov    0xf01(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xead(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe91(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xf45(%rip),%rax
mov    %rax,0x1b0(%rsp)
movaps 0xf26(%rip),%xmm0
movaps %xmm0,0x1a0(%rsp)
movaps 0xf07(%rip),%xmm0
movaps %xmm0,0x190(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x180(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x170(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,0x160(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movaps 0xe6c(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
mov    0xf4d(%rip),%rax
mov    %rax,0x130(%rsp)
movaps 0xf2e(%rip),%xmm0
movaps %xmm0,0x120(%rsp)
movaps 0xf0f(%rip),%xmm0
movaps %xmm0,0x110(%rsp)
movaps 0xef0(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0xe93(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xe74(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
lea    0x240(%rsp),%rbx
lea    0x1c0(%rsp),%r13
lea    0x8(%rsp),%r15
lea    0x10(%rsp),%r14
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0xf,%edx
mov    %r15,%rcx
mov    %r14,%r8
call   1060 <LeastSquaresLinearFit@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
lea    0xea1(%rip),%r12
mov    %r12,%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0xf,%edx
call   1030 <covd@plt>
movsd  %xmm0,0x18(%rsp)
mov    %rbx,%rdi
mov    $0xf,%esi
call   1040 <vard@plt>
movsd  0x18(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
lea    0xe73(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0x70(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    $0x9,%edx
mov    %r15,%rcx
mov    %r14,%r8
call   1060 <LeastSquaresLinearFit@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %r12,%rdi
mov    $0x2,%al
call   1050 <printf@plt>
lea    0x140(%rsp),%rdi
lea    0xc0(%rsp),%rsi
mov    $0xf,%edx
mov    %r15,%rcx
mov    %r14,%r8
call   1060 <LeastSquaresLinearFit@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %r12,%rdi
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x2c0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.height = [15 x double] [double 1.470000e+00, double 1.500000e+00, double 1.520000e+00, double 1.550000e+00, double 1.570000e+00, double 1.600000e+00, double 1.630000e+00, double 1.650000e+00, double 1.680000e+00, double 1.700000e+00, double 1.730000e+00, double 1.750000e+00, double 1.780000e+00, double 1.800000e+00, double 1.830000e+00]
@__const.main.mass = [15 x double] [double 5.221000e+01, double 5.312000e+01, double 5.448000e+01, double 5.584000e+01, double 5.720000e+01, double 5.857000e+01, double 0x404DF70A3D70A3D7, double 0x404EA51EB851EB85, double 6.311000e+01, double 6.447000e+01, double 6.628000e+01, double 6.810000e+01, double 6.992000e+01, double 0x40520C28F5C28F5C, double 0x40529D70A3D70A3D]
@__const.main.x = [9 x double] [double -4.000000e+00, double -3.000000e+00, double -2.000000e+00, double -1.500000e+00, double -5.000000e-01, double 1.000000e+00, double 2.000000e+00, double 3.500000e+00, double 4.000000e+00]
@__const.main.y = [9 x double] [double -3.000000e+00, double -1.000000e+00, double -2.000000e+00, double -5.000000e-01, double 1.000000e+00, double 0.000000e+00, double 1.500000e+00, double 1.000000e+00, double 2.500000e+00]
@__const.main.year = [15 x double] [double 1.980000e+03, double 1.982000e+03, double 1.984000e+03, double 1.986000e+03, double 1.988000e+03, double 1.990000e+03, double 1.992000e+03, double 1.994000e+03, double 1.996000e+03, double 1.998000e+03, double 2.000000e+03, double 2.002000e+03, double 2.004000e+03, double 2.006000e+03, double 2.008000e+03]
@__const.main.CO2_level = [15 x double] [double 3.387000e+02, double 3.412000e+02, double 3.444000e+02, double 3.472000e+02, double 3.515000e+02, double 3.542000e+02, double 3.563000e+02, double 3.586000e+02, double 3.624000e+02, double 3.665000e+02, double 3.694000e+02, double 3.732000e+02, double 3.775000e+02, double 3.819000e+02, double 3.856000e+02]
@.str = [26 x i8] c"Slope: %f, Intercept: %f\0A\00"
@.str.1 = [31 x i8] c"Slope via Cov(X,Y)/Var(X): %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x double]
%3 = alloca [15 x double]
%4 = alloca double
%5 = alloca double
%6 = alloca [9 x double]
%7 = alloca [9 x double]
%8 = alloca [15 x double]
%9 = alloca [15 x double]
store i32 0, i32* %1
%10 = bitcast [15 x double]* %2 to i8*
%11 = bitcast [15 x double]* %3 to i8*
%12 = bitcast [9 x double]* %6 to i8*
%13 = bitcast [9 x double]* %7 to i8*
%14 = bitcast [15 x double]* %8 to i8*
%15 = bitcast [15 x double]* %9 to i8*
%16 = getelementptr inbounds [15 x double], [15 x double]* %2, i64 0, i64 0
%17 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 0
%18 = call i32 @LeastSquaresLinearFit(double* %16, double* %17, i32 15, double* %4, double* %5)
%19 = load double, double* %4
%20 = load double, double* %5
%21 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %19, double %20)
%22 = getelementptr inbounds [15 x double], [15 x double]* %2, i64 0, i64 0
%23 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 0
%24 = call double @covd(double* %22, double* %23, i32 15)
%25 = getelementptr inbounds [15 x double], [15 x double]* %2, i64 0, i64 0
%26 = call double @vard(double* %25, i32 15)
%27 = fdiv double %24, %26
store double %27, double* %4
%28 = load double, double* %4
%29 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double %28)
%30 = getelementptr inbounds [9 x double], [9 x double]* %6, i64 0, i64 0
%31 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 0
%32 = call i32 @LeastSquaresLinearFit(double* %30, double* %31, i32 9, double* %4, double* %5)
%33 = load double, double* %4
%34 = load double, double* %5
%35 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %33, double %34)
%36 = getelementptr inbounds [15 x double], [15 x double]* %8, i64 0, i64 0
%37 = getelementptr inbounds [15 x double], [15 x double]* %9, i64 0, i64 0
%38 = call i32 @LeastSquaresLinearFit(double* %36, double* %37, i32 15, double* %4, double* %5)
%39 = load double, double* %4
%40 = load double, double* %5
%41 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %39, double %40)
ret i32 0
}

LLVM IR (-O2):
@__const.main.height = [15 x double] [double 1.470000e+00, double 1.500000e+00, double 1.520000e+00, double 1.550000e+00, double 1.570000e+00, double 1.600000e+00, double 1.630000e+00, double 1.650000e+00, double 1.680000e+00, double 1.700000e+00, double 1.730000e+00, double 1.750000e+00, double 1.780000e+00, double 1.800000e+00, double 1.830000e+00]
@__const.main.mass = [15 x double] [double 5.221000e+01, double 5.312000e+01, double 5.448000e+01, double 5.584000e+01, double 5.720000e+01, double 5.857000e+01, double 0x404DF70A3D70A3D7, double 0x404EA51EB851EB85, double 6.311000e+01, double 6.447000e+01, double 6.628000e+01, double 6.810000e+01, double 6.992000e+01, double 0x40520C28F5C28F5C, double 0x40529D70A3D70A3D]
@__const.main.x = [9 x double] [double -4.000000e+00, double -3.000000e+00, double -2.000000e+00, double -1.500000e+00, double -5.000000e-01, double 1.000000e+00, double 2.000000e+00, double 3.500000e+00, double 4.000000e+00]
@__const.main.y = [9 x double] [double -3.000000e+00, double -1.000000e+00, double -2.000000e+00, double -5.000000e-01, double 1.000000e+00, double 0.000000e+00, double 1.500000e+00, double 1.000000e+00, double 2.500000e+00]
@__const.main.year = [15 x double] [double 1.980000e+03, double 1.982000e+03, double 1.984000e+03, double 1.986000e+03, double 1.988000e+03, double 1.990000e+03, double 1.992000e+03, double 1.994000e+03, double 1.996000e+03, double 1.998000e+03, double 2.000000e+03, double 2.002000e+03, double 2.004000e+03, double 2.006000e+03, double 2.008000e+03]
@__const.main.CO2_level = [15 x double] [double 3.387000e+02, double 3.412000e+02, double 3.444000e+02, double 3.472000e+02, double 3.515000e+02, double 3.542000e+02, double 3.563000e+02, double 3.586000e+02, double 3.624000e+02, double 3.665000e+02, double 3.694000e+02, double 3.732000e+02, double 3.775000e+02, double 3.819000e+02, double 3.856000e+02]
@.str = [26 x i8] c"Slope: %f, Intercept: %f\0A\00"
@.str.1 = [31 x i8] c"Slope via Cov(X,Y)/Var(X): %f\0A\00"
define i32 @main() {
%1 = alloca [15 x double]
%2 = alloca [15 x double]
%3 = alloca double
%4 = alloca double
%5 = alloca [9 x double]
%6 = alloca [9 x double]
%7 = alloca [15 x double]
%8 = alloca [15 x double]
%9 = bitcast [15 x double]* %1 to i8*
%10 = bitcast [15 x double]* %2 to i8*
%11 = bitcast double* %3 to i8*
%12 = bitcast double* %4 to i8*
%13 = bitcast [9 x double]* %5 to i8*
%14 = bitcast [9 x double]* %6 to i8*
%15 = bitcast [15 x double]* %7 to i8*
%16 = bitcast [15 x double]* %8 to i8*
%17 = getelementptr inbounds [15 x double], [15 x double]* %1, i64 0, i64 0
%18 = getelementptr inbounds [15 x double], [15 x double]* %2, i64 0, i64 0
%19 = call i32 @LeastSquaresLinearFit(double* %17, double* %18, i32 15, double* %3, double* %4)
%20 = load double, double* %3
%21 = load double, double* %4
%22 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %20, double %21)
%23 = call double @covd(double* %17, double* %18, i32 15)
%24 = call double @vard(double* %17, i32 15)
%25 = fdiv double %23, %24
store double %25, double* %3
%26 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double %25)
%27 = getelementptr inbounds [9 x double], [9 x double]* %5, i64 0, i64 0
%28 = getelementptr inbounds [9 x double], [9 x double]* %6, i64 0, i64 0
%29 = call i32 @LeastSquaresLinearFit(double* %27, double* %28, i32 9, double* %3, double* %4)
%30 = load double, double* %3
%31 = load double, double* %4
%32 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %30, double %31)
%33 = getelementptr inbounds [15 x double], [15 x double]* %7, i64 0, i64 0
%34 = getelementptr inbounds [15 x double], [15 x double]* %8, i64 0, i64 0
%35 = call i32 @LeastSquaresLinearFit(double* %33, double* %34, i32 15, double* %3, double* %4)
%36 = load double, double* %3
%37 = load double, double* %4
%38 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %36, double %37)
ret i32 0
}