#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 **allocateDoubleMatrix(int, int);
double *allocateDoubleVector(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
double *multipleLinearRegression(double **, double *, int, int);
int /*<<< orphan*/ stdout;
void testMultipleRegression() {
  int i, n = 3, m = 6;
  double **X, *y, *x;
  X = allocateDoubleMatrix(m, n);
  y = allocateDoubleVector(m);
  X[0][0] = 1, X[1][0] = 1, X[2][0] = 1, X[3][0] = 1, X[4][0] = 1, X[5][0] = 1;
  X[0][1] = 0, X[1][1] = 2, X[2][1] = 2.5, X[3][1] = 1, X[4][1] = 4,
  X[5][1] = 7;
  X[0][2] = 0, X[1][2] = 1, X[2][2] = 2, X[3][2] = 3, X[4][2] = 6, X[5][2] = 2;
  y[0] = 5, y[1] = 10, y[2] = 9, y[3] = 0, y[4] = 3, y[5] = 27;
  x = multipleLinearRegression(X, y, n, m);
  fprintf(stdout, "\nMultiple Regression\n");
  for (i = 0; i < n; i++)
    fprintf(stdout, "%f ", x[i]);
  fprintf(stdout, "\n");
}


x86 assembly (clang, -O0):
<testMultipleRegression>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x3,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <allocateDoubleMatrix@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <allocateDoubleVector@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0xea4(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
movsd  0xe7c(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
movsd  0xe68(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rax
movsd  0xe54(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0xe21(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
movsd  0xe34(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
movsd  0xe07(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
movsd  0xe02(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rax
movsd  0xde5(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0xdb9(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
movsd  0xd94(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
movsd  0xd5f(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
movsd  0xd72(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rax
movsd  0xd55(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x20(%rbp),%rax
movsd  0xd3c(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0xd24(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movsd  0xd0b(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x20(%rbp),%rax
movsd  0xce6(%rip),%xmm0
movsd  %xmm0,0x20(%rax)
mov    -0x20(%rbp),%rax
movsd  0xccd(%rip),%xmm0
movsd  %xmm0,0x28(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1050 <multipleLinearRegression@plt>
mov    %rax,-0x28(%rbp)
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
lea    0xcf9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13ab <testMultipleRegression+0x26b>
mov    0x2c60(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xcd8(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    136d <testMultipleRegression+0x22d>
mov    0x2c2e(%rip),%rax
mov    (%rax),%edi
lea    0xcb1(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testMultipleRegression>:
push   %r15
push   %r14
push   %rbx
mov    $0x6,%edi
mov    $0x3,%esi
call   1030 <allocateDoubleMatrix@plt>
mov    %rax,%rbx
mov    $0x6,%edi
call   1040 <allocateDoubleVector@plt>
mov    (%rbx),%r8
movabs $0x3ff0000000000000,%rdx
mov    %rdx,(%r8)
mov    0x8(%rbx),%r9
mov    %rdx,(%r9)
mov    0x10(%rbx),%rdi
mov    %rdx,(%rdi)
mov    0x18(%rbx),%r10
mov    %rdx,(%r10)
mov    0x20(%rbx),%r14
mov    %rdx,(%r14)
mov    0x28(%rbx),%rcx
mov    %rdx,(%rcx)
movq   $0x0,0x8(%r8)
movabs $0x4000000000000000,%r11
mov    %r11,0x8(%r9)
movabs $0x4004000000000000,%rsi
mov    %rsi,0x8(%rdi)
mov    %rdx,0x8(%r10)
movabs $0x4010000000000000,%rsi
mov    %rsi,0x8(%r14)
movabs $0x401c000000000000,%rsi
mov    %rsi,0x8(%rcx)
movq   $0x0,0x10(%r8)
mov    %rdx,0x10(%r9)
mov    %r11,0x10(%rdi)
movabs $0x4008000000000000,%rdx
mov    %rdx,0x10(%r10)
movabs $0x4018000000000000,%rdx
mov    %rdx,0x10(%r14)
mov    %r11,0x10(%rcx)
movaps 0xdf1(%rip),%xmm0
movups %xmm0,(%rax)
movsd  0xe06(%rip),%xmm0
movups %xmm0,0x10(%rax)
movaps 0xdeb(%rip),%xmm0
movups %xmm0,0x20(%rax)
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x3,%edx
mov    $0x6,%ecx
call   1050 <multipleLinearRegression@plt>
mov    %rax,%rbx
mov    0x2d98(%rip),%r15
mov    (%r15),%edi
lea    0xdd6(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%edi
movsd  (%rbx),%xmm0
lea    0xdd7(%rip),%r14
mov    %r14,%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    (%r15),%edi
movsd  0x8(%rbx),%xmm0
mov    %r14,%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    (%r15),%edi
movsd  0x10(%rbx),%xmm0
mov    %r14,%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    (%r15),%edi
lea    0xd9d(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [22 x i8] c"\0AMultiple Regression\0A\00"
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @testMultipleRegression() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double**
%5 = alloca double*
%6 = alloca double*
store i32 3, i32* %2
store i32 6, i32* %3
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = call double** @allocateDoubleMatrix(i32 %7, i32 %8)
store double** %9, double*** %4
%10 = load i32, i32* %3
%11 = call double* @allocateDoubleVector(i32 %10)
store double* %11, double** %5
%12 = load double**, double*** %4
%13 = getelementptr inbounds double*, double** %12, i64 0
%14 = load double*, double** %13
%15 = getelementptr inbounds double, double* %14, i64 0
store double 1.000000e+00, double* %15
%16 = load double**, double*** %4
%17 = getelementptr inbounds double*, double** %16, i64 1
%18 = load double*, double** %17
%19 = getelementptr inbounds double, double* %18, i64 0
store double 1.000000e+00, double* %19
%20 = load double**, double*** %4
%21 = getelementptr inbounds double*, double** %20, i64 2
%22 = load double*, double** %21
%23 = getelementptr inbounds double, double* %22, i64 0
store double 1.000000e+00, double* %23
%24 = load double**, double*** %4
%25 = getelementptr inbounds double*, double** %24, i64 3
%26 = load double*, double** %25
%27 = getelementptr inbounds double, double* %26, i64 0
store double 1.000000e+00, double* %27
%28 = load double**, double*** %4
%29 = getelementptr inbounds double*, double** %28, i64 4
%30 = load double*, double** %29
%31 = getelementptr inbounds double, double* %30, i64 0
store double 1.000000e+00, double* %31
%32 = load double**, double*** %4
%33 = getelementptr inbounds double*, double** %32, i64 5
%34 = load double*, double** %33
%35 = getelementptr inbounds double, double* %34, i64 0
store double 1.000000e+00, double* %35
%36 = load double**, double*** %4
%37 = getelementptr inbounds double*, double** %36, i64 0
%38 = load double*, double** %37
%39 = getelementptr inbounds double, double* %38, i64 1
store double 0.000000e+00, double* %39
%40 = load double**, double*** %4
%41 = getelementptr inbounds double*, double** %40, i64 1
%42 = load double*, double** %41
%43 = getelementptr inbounds double, double* %42, i64 1
store double 2.000000e+00, double* %43
%44 = load double**, double*** %4
%45 = getelementptr inbounds double*, double** %44, i64 2
%46 = load double*, double** %45
%47 = getelementptr inbounds double, double* %46, i64 1
store double 2.500000e+00, double* %47
%48 = load double**, double*** %4
%49 = getelementptr inbounds double*, double** %48, i64 3
%50 = load double*, double** %49
%51 = getelementptr inbounds double, double* %50, i64 1
store double 1.000000e+00, double* %51
%52 = load double**, double*** %4
%53 = getelementptr inbounds double*, double** %52, i64 4
%54 = load double*, double** %53
%55 = getelementptr inbounds double, double* %54, i64 1
store double 4.000000e+00, double* %55
%56 = load double**, double*** %4
%57 = getelementptr inbounds double*, double** %56, i64 5
%58 = load double*, double** %57
%59 = getelementptr inbounds double, double* %58, i64 1
store double 7.000000e+00, double* %59
%60 = load double**, double*** %4
%61 = getelementptr inbounds double*, double** %60, i64 0
%62 = load double*, double** %61
%63 = getelementptr inbounds double, double* %62, i64 2
store double 0.000000e+00, double* %63
%64 = load double**, double*** %4
%65 = getelementptr inbounds double*, double** %64, i64 1
%66 = load double*, double** %65
%67 = getelementptr inbounds double, double* %66, i64 2
store double 1.000000e+00, double* %67
%68 = load double**, double*** %4
%69 = getelementptr inbounds double*, double** %68, i64 2
%70 = load double*, double** %69
%71 = getelementptr inbounds double, double* %70, i64 2
store double 2.000000e+00, double* %71
%72 = load double**, double*** %4
%73 = getelementptr inbounds double*, double** %72, i64 3
%74 = load double*, double** %73
%75 = getelementptr inbounds double, double* %74, i64 2
store double 3.000000e+00, double* %75
%76 = load double**, double*** %4
%77 = getelementptr inbounds double*, double** %76, i64 4
%78 = load double*, double** %77
%79 = getelementptr inbounds double, double* %78, i64 2
store double 6.000000e+00, double* %79
%80 = load double**, double*** %4
%81 = getelementptr inbounds double*, double** %80, i64 5
%82 = load double*, double** %81
%83 = getelementptr inbounds double, double* %82, i64 2
store double 2.000000e+00, double* %83
%84 = load double*, double** %5
%85 = getelementptr inbounds double, double* %84, i64 0
store double 5.000000e+00, double* %85
%86 = load double*, double** %5
%87 = getelementptr inbounds double, double* %86, i64 1
store double 1.000000e+01, double* %87
%88 = load double*, double** %5
%89 = getelementptr inbounds double, double* %88, i64 2
store double 9.000000e+00, double* %89
%90 = load double*, double** %5
%91 = getelementptr inbounds double, double* %90, i64 3
store double 0.000000e+00, double* %91
%92 = load double*, double** %5
%93 = getelementptr inbounds double, double* %92, i64 4
store double 3.000000e+00, double* %93
%94 = load double*, double** %5
%95 = getelementptr inbounds double, double* %94, i64 5
store double 2.700000e+01, double* %95
%96 = load double**, double*** %4
%97 = load double*, double** %5
%98 = load i32, i32* %2
%99 = load i32, i32* %3
%100 = call double* @multipleLinearRegression(double** %96, double* %97, i32 %98, i32 %99)
store double* %100, double** %6
%101 = load i32, i32* @stdout
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %103
103: ; preds = %115, %0
%104 = load i32, i32* %1
%105 = load i32, i32* %2
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %118
107: ; preds = %103
%108 = load i32, i32* @stdout
%109 = load double*, double** %6
%110 = load i32, i32* %1
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %109, i64 %111
%113 = load double, double* %112
%114 = call i32 (i32, i8*, ...) @fprintf(i32 %108, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %113)
br label %115
115: ; preds = %107
%116 = load i32, i32* %1
%117 = add nsw i32 %116, 1
store i32 %117, i32* %1
br label %103
118: ; preds = %103
%119 = load i32, i32* @stdout
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [22 x i8] c"\0AMultiple Regression\0A\00"
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @testMultipleRegression() {
%1 = tail call double** @allocateDoubleMatrix(i32 6, i32 3)
%2 = tail call double* @allocateDoubleVector(i32 6)
%3 = load double*, double** %1
store double 1.000000e+00, double* %3
%4 = getelementptr inbounds double*, double** %1, i64 1
%5 = load double*, double** %4
store double 1.000000e+00, double* %5
%6 = getelementptr inbounds double*, double** %1, i64 2
%7 = load double*, double** %6
store double 1.000000e+00, double* %7
%8 = getelementptr inbounds double*, double** %1, i64 3
%9 = load double*, double** %8
store double 1.000000e+00, double* %9
%10 = getelementptr inbounds double*, double** %1, i64 4
%11 = load double*, double** %10
store double 1.000000e+00, double* %11
%12 = getelementptr inbounds double*, double** %1, i64 5
%13 = load double*, double** %12
store double 1.000000e+00, double* %13
%14 = getelementptr inbounds double, double* %3, i64 1
store double 0.000000e+00, double* %14
%15 = getelementptr inbounds double, double* %5, i64 1
store double 2.000000e+00, double* %15
%16 = getelementptr inbounds double, double* %7, i64 1
store double 2.500000e+00, double* %16
%17 = getelementptr inbounds double, double* %9, i64 1
store double 1.000000e+00, double* %17
%18 = getelementptr inbounds double, double* %11, i64 1
store double 4.000000e+00, double* %18
%19 = getelementptr inbounds double, double* %13, i64 1
store double 7.000000e+00, double* %19
%20 = getelementptr inbounds double, double* %3, i64 2
store double 0.000000e+00, double* %20
%21 = getelementptr inbounds double, double* %5, i64 2
store double 1.000000e+00, double* %21
%22 = getelementptr inbounds double, double* %7, i64 2
store double 2.000000e+00, double* %22
%23 = getelementptr inbounds double, double* %9, i64 2
store double 3.000000e+00, double* %23
%24 = getelementptr inbounds double, double* %11, i64 2
store double 6.000000e+00, double* %24
%25 = getelementptr inbounds double, double* %13, i64 2
store double 2.000000e+00, double* %25
%26 = bitcast double* %2 to <2 x double>*
store <2 x double> <double 5.000000e+00, double 1.000000e+01>, <2 x double>* %26
%27 = getelementptr inbounds double, double* %2, i64 2
%28 = bitcast double* %27 to <2 x double>*
store <2 x double> <double 9.000000e+00, double 0.000000e+00>, <2 x double>* %28
%29 = getelementptr inbounds double, double* %2, i64 4
%30 = bitcast double* %29 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 2.700000e+01>, <2 x double>* %30
%31 = tail call double* @multipleLinearRegression(double** %1, double* %2, i32 3, i32 6)
%32 = load i32, i32* @stdout
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%34 = load i32, i32* @stdout
%35 = load double, double* %31
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %35)
%37 = load i32, i32* @stdout
%38 = getelementptr inbounds double, double* %31, i64 1
%39 = load double, double* %38
%40 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %39)
%41 = load i32, i32* @stdout
%42 = getelementptr inbounds double, double* %31, i64 2
%43 = load double, double* %42
%44 = tail call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %43)
%45 = load i32, i32* @stdout
%46 = tail call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}