#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*/ fprintf(int /*<<< orphan*/, char *, double, double);
double mean(double const *, int);
int /*<<< orphan*/ stderr;
double sx(double const *, int, double);
double sxy(double const *, double const *, int, double, double);
int checkO1(const double *x, const double *y, int n) {
  double meanX, meanY;
  double linearA, linearB;
  meanX = mean(x, n);
  meanY = mean(y, n);
  linearB = sxy(x, y, n, meanX, meanY) / sx(x, n, meanX);
  linearA = meanY - linearB * meanX;
  fprintf(stderr, "a=%f b=%f\n", linearA, linearB);
  return 0;
}


x86 assembly (clang, -O0):
<checkO1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <mean@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <mean@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1050 <sxy@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
call   1030 <sx@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xdfd(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkO1>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%esi
call   1060 <mean@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <mean@plt>
movaps %xmm0,%xmm1
movsd  %xmm0,0x18(%rsp)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
movsd  0x8(%rsp),%xmm0
call   1050 <sxy@plt>
movsd  %xmm0,0x10(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
movsd  0x8(%rsp),%xmm0
call   1030 <sx@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm1,%xmm2
movsd  0x18(%rsp),%xmm0
subsd  %xmm2,%xmm0
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"a=%f b=%f\0A\00"
define i32 @checkO1(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%11 = load double*, double** %4
%12 = load i32, i32* %6
%13 = call double @mean(double* %11, i32 %12)
store double %13, double* %7
%14 = load double*, double** %5
%15 = load i32, i32* %6
%16 = call double @mean(double* %14, i32 %15)
store double %16, double* %8
%17 = load double*, double** %4
%18 = load double*, double** %5
%19 = load i32, i32* %6
%20 = load double, double* %7
%21 = load double, double* %8
%22 = call double @sxy(double* %17, double* %18, i32 %19, double %20, double %21)
%23 = load double*, double** %4
%24 = load i32, i32* %6
%25 = load double, double* %7
%26 = call double @sx(double* %23, i32 %24, double %25)
%27 = fdiv double %22, %26
store double %27, double* %10
%28 = load double, double* %8
%29 = load double, double* %10
%30 = load double, double* %7
%31 = fneg double %29
%32 = call double @llvm.fmuladd.f64(double %31, double %30, double %28)
store double %32, double* %9
%33 = load i32, i32* @stderr
%34 = load double, double* %9
%35 = load double, double* %10
%36 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %34, double %35)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"a=%f b=%f\0A\00"
define i32 @checkO1(double* %0, double* %1, i32 %2) {
%4 = tail call double @mean(double* %0, i32 %2)
%5 = tail call double @mean(double* %1, i32 %2)
%6 = tail call double @sxy(double* %0, double* %1, i32 %2, double %4, double %5)
%7 = tail call double @sx(double* %0, i32 %2, double %4)
%8 = fdiv double %6, %7
%9 = fneg double %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double %4, double %5)
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %10, double %8)
ret i32 0
}