#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 fnMean(double *, int);
int /*<<< orphan*/ fnPrintArray(double *, int);
int /*<<< orphan*/ fnReadArray(double *, int);
double fnSD(double);
double fnVar(double *, int, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int iNum;
  double daArr[10], dMean, dVar, dSD;
  printf("\nEnter no of elements\n");
  scanf("%d", &iNum);
  fnReadArray(daArr, iNum);
  printf("\nInput Array is:\n");
  fnPrintArray(daArr, iNum);
  dMean = fnMean(daArr, iNum);
  printf("\nMean of the Array is: %lf\n", dMean);
  dVar = fnVar(daArr, iNum, dMean);
  printf("\nVariance of the Array is: %lf\n", dVar);
  dSD = fnSD(dVar);
  printf("\nStandard Deviation of the Array is: %lf\n", dSD);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe80(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <fnReadArray@plt>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1070 <fnPrintArray@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1090 <fnMean@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
lea    0xe49(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%esi
movsd  -0x68(%rbp),%xmm0
call   1080 <fnVar@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
lea    0xe3c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x70(%rbp),%xmm0
call   1050 <fnSD@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
lea    0xe3a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe68(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <fnReadArray@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1080 <fnPrintArray@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   10a0 <fnMean@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xe1f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
call   1090 <fnVar@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xe15(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1060 <fnSD@plt>
lea    0xe1c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0AEnter no of elements\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"\0AInput Array is:\0A\00"
@.str.3 = [28 x i8] c"\0AMean of the Array is: %lf\0A\00"
@.str.4 = [32 x i8] c"\0AVariance of the Array is: %lf\0A\00"
@.str.5 = [42 x i8] c"\0AStandard Deviation of the Array is: %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x double]
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 0
%10 = load i32, i32* %2
%11 = call i32 @fnReadArray(double* %9, i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%13 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 0
%14 = load i32, i32* %2
%15 = call i32 @fnPrintArray(double* %13, i32 %14)
%16 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 0
%17 = load i32, i32* %2
%18 = call double @fnMean(double* %16, i32 %17)
store double %18, double* %4
%19 = load double, double* %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %19)
%21 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 0
%22 = load i32, i32* %2
%23 = load double, double* %4
%24 = call double @fnVar(double* %21, i32 %22, double %23)
store double %24, double* %5
%25 = load double, double* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), double %25)
%27 = load double, double* %5
%28 = call double @fnSD(double %27)
store double %28, double* %6
%29 = load double, double* %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), double %29)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [28 x i8] c"\0AMean of the Array is: %lf\0A\00"
@.str.4 = [32 x i8] c"\0AVariance of the Array is: %lf\0A\00"
@.str.5 = [42 x i8] c"\0AStandard Deviation of the Array is: %lf\0A\00"
@str = [22 x i8] c"\0AEnter no of elements\00"
@str.6 = [17 x i8] c"\0AInput Array is:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x double]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [10 x double]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 0
%8 = load i32, i32* %1
%9 = call i32 @fnReadArray(double* %7, i32 %8)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = call i32 @fnPrintArray(double* %7, i32 %11)
%13 = load i32, i32* %1
%14 = call double @fnMean(double* %7, i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %14)
%16 = load i32, i32* %1
%17 = call double @fnVar(double* %7, i32 %16, double %14)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), double %17)
%19 = call double @fnSD(double %17)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), double %19)
ret i32 0
}