#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
double sigma(int *, int);
int sigma_mul(int *, int *, int);
int sigma_sqr(int *, int);
int main() {
  int n, i;
  printf("Enter the no. of Entries: ");
  scanf("%d", &n);
  int x[n], y[n];
  for (i = 0; i < n; i++) {
    printf("Enter the X(%d) Y(%d): ", i + 1, i + 1);
    scanf("%d %d", &x[i], &y[i]);
  }
  printf("Eqn. of The Line is: \n");
  double m = (n * sigma_mul(x, y, n) - sigma(x, n) * sigma(y, n)) /
             ((n * sigma_sqr(x, n)) - sigma(x, n) * sigma(x, n));
  double c = (sigma(y, n) - m * (sigma(x, n))) / n;
  printf("y = %.2fx + %.2f \n", m, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x49(%rbp)
call   1050 <printf@plt>
mov    -0x49(%rbp),%al
lea    0xeb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1234 <main+0xe4>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x48(%rbp),%rsi
mov    -0x40(%rbp),%rdx
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d4 <main+0x84>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdi
mov    -0x8(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x8(%rbp),%edx
call   1060 <sigma_mul@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%ecx
mov    -0x94(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x8(%rbp),%esi
call   1040 <sigma@plt>
mov    -0x40(%rbp),%rdi
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x8(%rbp),%esi
call   1040 <sigma@plt>
movsd  -0x90(%rbp),%xmm1
ff
mov    -0x48(%rbp),%rdi
movaps %xmm0,%xmm2
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x8(%rbp),%esi
call   1030 <sigma_sqr@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x8(%rbp),%esi
call   1040 <sigma@plt>
mov    -0x48(%rbp),%rdi
movsd  %xmm0,-0x78(%rbp)
mov    -0x8(%rbp),%esi
call   1040 <sigma@plt>
movsd  -0x78(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
mov    -0x40(%rbp),%rdi
movaps %xmm0,%xmm3
movsd  -0x68(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%esi
call   1040 <sigma@plt>
mov    -0x48(%rbp),%rdi
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%esi
call   1040 <sigma@plt>
movsd  -0x60(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xc9b(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    %rsp,-0x60(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%rcx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    -0x2c(%rbp),%eax
mov    %rsp,%rdx
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
test   %eax,%eax
jle    1225 <main+0xc5>
lea    0xe43(%rip),%r12
lea    0xe54(%rip),%r13
mov    -0x50(%rbp),%rbx
mov    -0x40(%rbp),%r14
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <scanf@plt>
movslq -0x2c(%rbp),%rax
add    $0x4,%r14
add    $0x4,%rbx
cmp    %rax,%r15
jl     11f0 <main+0x90>
lea    0xe20(%rip),%rdi
call   1040 <puts@plt>
mov    -0x2c(%rbp),%ebx
mov    -0x50(%rbp),%r14
mov    %r14,%rdi
mov    -0x40(%rbp),%r15
mov    %r15,%rsi
mov    %ebx,%edx
call   1070 <sigma_mul@plt>
imul   %ebx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x2c(%rbp),%esi
mov    %r14,%rdi
call   1050 <sigma@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x2c(%rbp),%esi
mov    %r15,%rdi
call   1050 <sigma@plt>
mulsd  -0x48(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,-0x38(%rbp)
mov    -0x2c(%rbp),%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <sigma_sqr@plt>
imul   %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x2c(%rbp),%esi
mov    %r14,%rdi
call   1050 <sigma@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x2c(%rbp),%esi
mov    %r14,%rdi
call   1050 <sigma@plt>
mulsd  -0x58(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
subsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x2c(%rbp),%esi
mov    %r15,%rdi
call   1050 <sigma@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x2c(%rbp),%esi
mov    %r14,%rdi
call   1050 <sigma@plt>
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x40(%rbp),%xmm1
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm0
divsd  %xmm0,%xmm1
lea    0xd23(%rip),%rdi
movapd %xmm2,%xmm0
mov    $0x2,%al
call   1060 <printf@plt>
mov    -0x60(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Enter the no. of Entries: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"Enter the X(%d) Y(%d): \00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [23 x i8] c"Eqn. of The Line is: \0A\00"
@.str.5 = [19 x i8] c"y = %.2fx + %.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca double
%8 = alloca double
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %4
%14 = alloca i32, i64 %12
store i64 %12, i64* %5
%15 = load i32, i32* %2
%16 = zext i32 %15 to i64
%17 = alloca i32, i64 %16
store i64 %16, i64* %6
store i32 0, i32* %3
br label %18
18: ; preds = %35, %0
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %24, i32 %26)
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %14, i64 %29
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %17, i64 %32
%34 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %30, i32* %33)
br label %35
35: ; preds = %22
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %18
38: ; preds = %18
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%40 = load i32, i32* %2
%41 = load i32, i32* %2
%42 = call i32 @sigma_mul(i32* %14, i32* %17, i32 %41)
%43 = mul nsw i32 %40, %42
%44 = sitofp i32 %43 to double
%45 = load i32, i32* %2
%46 = call double @sigma(i32* %14, i32 %45)
%47 = load i32, i32* %2
%48 = call double @sigma(i32* %17, i32 %47)
%49 = fneg double %46
%50 = call double @llvm.fmuladd.f64(double %49, double %48, double %44)
%51 = load i32, i32* %2
%52 = load i32, i32* %2
%53 = call i32 @sigma_sqr(i32* %14, i32 %52)
%54 = mul nsw i32 %51, %53
%55 = sitofp i32 %54 to double
%56 = load i32, i32* %2
%57 = call double @sigma(i32* %14, i32 %56)
%58 = load i32, i32* %2
%59 = call double @sigma(i32* %14, i32 %58)
%60 = fneg double %57
%61 = call double @llvm.fmuladd.f64(double %60, double %59, double %55)
%62 = fdiv double %50, %61
store double %62, double* %7
%63 = load i32, i32* %2
%64 = call double @sigma(i32* %17, i32 %63)
%65 = load double, double* %7
%66 = load i32, i32* %2
%67 = call double @sigma(i32* %14, i32 %66)
%68 = fneg double %65
%69 = call double @llvm.fmuladd.f64(double %68, double %67, double %64)
%70 = load i32, i32* %2
%71 = sitofp i32 %70 to double
%72 = fdiv double %69, %71
store double %72, double* %8
%73 = load double, double* %7
%74 = load double, double* %8
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %73, double %74)
store i32 0, i32* %1
%76 = load i8*, i8** %4
%77 = load i32, i32* %1
ret i32 %77
}

LLVM IR (-O2):
@.str = [27 x i8] c"Enter the no. of Entries: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"Enter the X(%d) Y(%d): \00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.5 = [19 x i8] c"y = %.2fx + %.2f \0A\00"
@str = [22 x i8] c"Eqn. of The Line is: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = alloca i32, i64 %10
%12 = icmp sgt i32 %9, 0
br i1 %12, label %13, label %24
13: ; preds = %0, %13
%14 = phi i64 [ %15, %13 ], [ 0, %0 ]
%15 = add nuw nsw i64 %14, 1
%16 = trunc i64 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %16)
%18 = getelementptr inbounds i32, i32* %8, i64 %14
%19 = getelementptr inbounds i32, i32* %11, i64 %14
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %18, i32* %19)
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %15, %22
br i1 %23, label %13, label %24
24: ; preds = %13, %0
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%26 = load i32, i32* %1
%27 = call i32 @sigma_mul(i32* %8, i32* %11, i32 %26)
%28 = mul nsw i32 %27, %26
%29 = sitofp i32 %28 to double
%30 = load i32, i32* %1
%31 = call double @sigma(i32* %8, i32 %30)
%32 = load i32, i32* %1
%33 = call double @sigma(i32* %11, i32 %32)
%34 = fneg double %31
%35 = call double @llvm.fmuladd.f64(double %34, double %33, double %29)
%36 = load i32, i32* %1
%37 = call i32 @sigma_sqr(i32* %8, i32 %36)
%38 = mul nsw i32 %37, %36
%39 = sitofp i32 %38 to double
%40 = load i32, i32* %1
%41 = call double @sigma(i32* %8, i32 %40)
%42 = load i32, i32* %1
%43 = call double @sigma(i32* %8, i32 %42)
%44 = fneg double %41
%45 = call double @llvm.fmuladd.f64(double %44, double %43, double %39)
%46 = fdiv double %35, %45
%47 = load i32, i32* %1
%48 = call double @sigma(i32* %11, i32 %47)
%49 = load i32, i32* %1
%50 = call double @sigma(i32* %8, i32 %49)
%51 = fneg double %46
%52 = call double @llvm.fmuladd.f64(double %51, double %50, double %48)
%53 = load i32, i32* %1
%54 = sitofp i32 %53 to double
%55 = fdiv double %52, %54
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %46, double %55)
ret i32 0
}