#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 */
int /*<<< orphan*/ getch();
int /*<<< orphan*/ liregression(double *, double *, int, double *, double *);
int /*<<< orphan*/ printf(char *, double, double, ...);
main() {
  double x[11] = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
  double y[11] = {2.76, 2.84, 2.97, 3.11, 3.23, 3.26,
                  3.49, 3.53, 3.66, 3.78, 3.95};
  double dt[6], a[2];
  liregression(x, y, 11, a, dt);
  printf("\na=%5.4lf b=%5.4lf ", a[1], a[0]);
  printf("\nq=%5.4lf s=%5.4lf p=%5.4lf", dt[0], dt[1], dt[2]);
  printf("\numax=%5.4lf umin=%5.4lf u=%5.4lf", dt[3], dt[4], dt[5]);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x60(%rbp),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x58,%edx
call   1040 <memcpy@plt>
lea    -0xc0(%rbp),%rdi
lea    0xef2(%rip),%rsi
mov    $0x58,%edx
call   1040 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
lea    -0x100(%rbp),%rcx
lea    -0xf0(%rbp),%r8
mov    $0xb,%edx
call   1050 <liregression@plt>
movsd  -0xf8(%rbp),%xmm0
ff
movsd  -0x100(%rbp),%xmm1
ff
lea    0xf06(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0xf0(%rbp),%xmm0
ff
movsd  -0xe8(%rbp),%xmm1
ff
movsd  -0xe0(%rbp),%xmm2
ff
lea    0xef4(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  -0xd8(%rbp),%xmm0
ff
movsd  -0xd0(%rbp),%xmm1
ff
movsd  -0xc8(%rbp),%xmm2
ff
lea    0xeea(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xf8,%rsp
mov    0xf12(%rip),%rax
mov    %rax,0xf0(%rsp)
movaps 0xef3(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xe96(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xe77(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
mov    0xf18(%rip),%rax
mov    %rax,0x90(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xea2(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe86(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0xa0(%rsp),%rdi
lea    0x40(%rsp),%rsi
mov    %rsp,%rcx
lea    0x10(%rsp),%r8
mov    $0xb,%edx
call   1040 <liregression@plt>
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
lea    0xea8(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
lea    0xe9c(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0x38(%rsp),%xmm2
lea    0xe98(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
add    $0xf8,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [11 x double] [double 0.000000e+00, double 1.000000e-01, double 2.000000e-01, double 3.000000e-01, double 4.000000e-01, double 5.000000e-01, double 6.000000e-01, double 0x3FE6666666666666, double 8.000000e-01, double 9.000000e-01, double 1.000000e+00]
@__const.main.y = [11 x double] [double 2.760000e+00, double 2.840000e+00, double 2.970000e+00, double 3.110000e+00, double 3.230000e+00, double 3.260000e+00, double 3.490000e+00, double 3.530000e+00, double 3.660000e+00, double 3.780000e+00, double 3.950000e+00]
@.str = [20 x i8] c"\0Aa=%5.4lf b=%5.4lf \00"
@.str.1 = [28 x i8] c"\0Aq=%5.4lf s=%5.4lf p=%5.4lf\00"
@.str.2 = [34 x i8] c"\0Aumax=%5.4lf umin=%5.4lf u=%5.4lf\00"
define i32 @main() {
%1 = alloca [11 x double]
%2 = alloca [11 x double]
%3 = alloca [6 x double]
%4 = alloca [2 x double]
%5 = bitcast [11 x double]* %1 to i8*
%6 = bitcast [11 x double]* %2 to i8*
%7 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 0
%8 = getelementptr inbounds [11 x double], [11 x double]* %2, i64 0, i64 0
%9 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%10 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%11 = call i32 @liregression(double* %7, double* %8, i32 11, double* %9, double* %10)
%12 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 1
%13 = load double, double* %12
%14 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%15 = load double, double* %14
%16 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %13, double %15)
%17 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%18 = load double, double* %17
%19 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 1
%20 = load double, double* %19
%21 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 2
%22 = load double, double* %21
%23 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), double %18, double %20, double %22)
%24 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 3
%25 = load double, double* %24
%26 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 4
%27 = load double, double* %26
%28 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 5
%29 = load double, double* %28
%30 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double %25, double %27, double %29)
%31 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [11 x double] [double 0.000000e+00, double 1.000000e-01, double 2.000000e-01, double 3.000000e-01, double 4.000000e-01, double 5.000000e-01, double 6.000000e-01, double 0x3FE6666666666666, double 8.000000e-01, double 9.000000e-01, double 1.000000e+00]
@__const.main.y = [11 x double] [double 2.760000e+00, double 2.840000e+00, double 2.970000e+00, double 3.110000e+00, double 3.230000e+00, double 3.260000e+00, double 3.490000e+00, double 3.530000e+00, double 3.660000e+00, double 3.780000e+00, double 3.950000e+00]
@.str = [20 x i8] c"\0Aa=%5.4lf b=%5.4lf \00"
@.str.1 = [28 x i8] c"\0Aq=%5.4lf s=%5.4lf p=%5.4lf\00"
@.str.2 = [34 x i8] c"\0Aumax=%5.4lf umin=%5.4lf u=%5.4lf\00"
define i32 @main() {
%1 = alloca [11 x double]
%2 = alloca [11 x double]
%3 = alloca [6 x double]
%4 = alloca [2 x double]
%5 = bitcast [11 x double]* %1 to i8*
%6 = bitcast [11 x double]* %2 to i8*
%7 = bitcast [6 x double]* %3 to i8*
%8 = bitcast [2 x double]* %4 to i8*
%9 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 0
%10 = getelementptr inbounds [11 x double], [11 x double]* %2, i64 0, i64 0
%11 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%12 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%13 = call i32 @liregression(double* %9, double* %10, i32 11, double* %11, double* %12)
%14 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 1
%15 = load double, double* %14
%16 = load double, double* %11
%17 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %15, double %16)
%18 = load double, double* %12
%19 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 1
%20 = load double, double* %19
%21 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 2
%22 = load double, double* %21
%23 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), double %18, double %20, double %22)
%24 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 3
%25 = load double, double* %24
%26 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 4
%27 = load double, double* %26
%28 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 5
%29 = load double, double* %28
%30 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double %25, double %27, double %29)
%31 = call i32 (...) @getch()
ret i32 0
}