#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*/ x;

/* Variables and functions */
int /*<<< orphan*/ leastSquareFit(int, double *, double *, double *, double *);
int /*<<< orphan*/ printf(char *, double, double);
int main(int argc, char **argv) {
  double alpha, beta;
  double x[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  double y[] = {5, 10, 8, 9, 8, 12, 6, 8, 9, 13};
  int n = sizeof(x) / sizeof(double);
  ;
  leastSquareFit(n, x, y, &alpha, &beta);
  printf("alpha=%.2f, beta=%.2f\n", alpha, beta);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeac(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
lea    -0xc0(%rbp),%rdi
lea    0xee4(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
movl   $0xa,-0xc4(%rbp)
mov    -0xc4(%rbp),%edi
lea    -0x70(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x20(%rbp),%r8
call   1050 <leastSquareFit@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xb8,%rsp
movaps 0xf12(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xef3(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe99(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xf1d(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf01(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xead(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x60(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rsp,%r8
mov    $0xa,%edi
call   1040 <leastSquareFit@plt>
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb8,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [10 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00, double 9.000000e+00, double 1.000000e+01]
@__const.main.y = [10 x double] [double 5.000000e+00, double 1.000000e+01, double 8.000000e+00, double 9.000000e+00, double 8.000000e+00, double 1.200000e+01, double 6.000000e+00, double 8.000000e+00, double 9.000000e+00, double 1.300000e+01]
@.str = [23 x i8] c"alpha=%.2f, beta=%.2f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca [10 x double]
%9 = alloca [10 x double]
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [10 x double]* %8 to i8*
%12 = bitcast [10 x double]* %9 to i8*
store i32 10, i32* %10
%13 = load i32, i32* %10
%14 = getelementptr inbounds [10 x double], [10 x double]* %8, i64 0, i64 0
%15 = getelementptr inbounds [10 x double], [10 x double]* %9, i64 0, i64 0
%16 = call i32 @leastSquareFit(i32 %13, double* %14, double* %15, double* %6, double* %7)
%17 = load double, double* %6
%18 = load double, double* %7
%19 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %17, double %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [10 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00, double 9.000000e+00, double 1.000000e+01]
@__const.main.y = [10 x double] [double 5.000000e+00, double 1.000000e+01, double 8.000000e+00, double 9.000000e+00, double 8.000000e+00, double 1.200000e+01, double 6.000000e+00, double 8.000000e+00, double 9.000000e+00, double 1.300000e+01]
@.str = [23 x i8] c"alpha=%.2f, beta=%.2f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca [10 x double]
%6 = alloca [10 x double]
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = bitcast [10 x double]* %5 to i8*
%10 = bitcast [10 x double]* %6 to i8*
%11 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 0
%12 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 0
%13 = call i32 @leastSquareFit(i32 10, double* %11, double* %12, double* %3, double* %4)
%14 = load double, double* %3
%15 = load double, double* %4
%16 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %14, double %15)
ret i32 0
}