#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 *, float);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  int i;
  float ave, dis, sum = 0.0, data[10];
  for (i = 0; i < 10; i++) {
    scanf("%f", &data[i]);
    sum += data[i];
  }
  ave = sum / 10.0;
  printf("Average = %.2f\n", ave);
  for (i = 0; i < 10; i++) {
    dis += (data[i] - ave) * (data[i] - ave);
  }
  dis = dis / 10;
  printf("Distributed = %.2f\n", dis);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1185 <main+0x65>
movslq -0x8(%rbp),%rax
lea    -0x40(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeae(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x8(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <main+0x1e>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe6a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1203 <main+0xe3>
movslq -0x8(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
subss  -0xc(%rbp),%xmm0
movslq -0x8(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm2
subss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <main+0x9b>
movss  -0x10(%rbp),%xmm0
movss  0xdf8(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    0xdfa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xedc(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
addss  0x10(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x18(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x1c(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x20(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x24(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x28(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x2c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x2c(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x30(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x34(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x34(%rsp),%xmm0
divss  0xd9f(%rip),%xmm0
lea    0xda3(%rip),%rdi
call   1030 <printf@plt>
lea    0xda7(%rip),%rdi
movss  0xd88(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [16 x i8] c"Average = %.2f\0A\00"
@.str.2 = [20 x i8] c"Distributed = %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca [10 x float]
store i32 0, i32* %1
store float 0.000000e+00, float* %5
store i32 0, i32* %2
br label %7
7: ; preds = %21, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [10 x float], [10 x float]* %6, i64 0, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %13)
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x float], [10 x float]* %6, i64 0, i64 %16
%18 = load float, float* %17
%19 = load float, float* %5
%20 = fadd float %19, %18
store float %20, float* %5
br label %21
21: ; preds = %10
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %7
24: ; preds = %7
%25 = load float, float* %5
%26 = fpext float %25 to double
%27 = fdiv double %26, 1.000000e+01
%28 = fptrunc double %27 to float
store float %28, float* %3
%29 = load float, float* %3
%30 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), float %29)
store i32 0, i32* %2
br label %31
31: ; preds = %49, %24
%32 = load i32, i32* %2
%33 = icmp slt i32 %32, 10
br i1 %33, label %34, label %52
34: ; preds = %31
%35 = load i32, i32* %2
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x float], [10 x float]* %6, i64 0, i64 %36
%38 = load float, float* %37
%39 = load float, float* %3
%40 = fsub float %38, %39
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [10 x float], [10 x float]* %6, i64 0, i64 %42
%44 = load float, float* %43
%45 = load float, float* %3
%46 = fsub float %44, %45
%47 = load float, float* %4
%48 = call float @llvm.fmuladd.f32(float %40, float %46, float %47)
store float %48, float* %4
br label %49
49: ; preds = %34
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
store i32 %51, i32* %2
br label %31
52: ; preds = %31
%53 = load float, float* %4
%54 = fdiv float %53, 1.000000e+01
store float %54, float* %4
%55 = load float, float* %4
%56 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), float %55)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [16 x i8] c"Average = %.2f\0A\00"
@.str.2 = [20 x i8] c"Distributed = %.2f\0A\00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = bitcast [10 x float]* %1 to i8*
%3 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%5 = load float, float* %3
%6 = fadd float %5, 0.000000e+00
%7 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %7)
%9 = load float, float* %7
%10 = fadd float %6, %9
%11 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 2
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %11)
%13 = load float, float* %11
%14 = fadd float %10, %13
%15 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 3
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %15)
%17 = load float, float* %15
%18 = fadd float %14, %17
%19 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 4
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %19)
%21 = load float, float* %19
%22 = fadd float %18, %21
%23 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 5
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %23)
%25 = load float, float* %23
%26 = fadd float %22, %25
%27 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 6
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %27)
%29 = load float, float* %27
%30 = fadd float %26, %29
%31 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 7
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %31)
%33 = load float, float* %31
%34 = fadd float %30, %33
%35 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 8
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %35)
%37 = load float, float* %35
%38 = fadd float %34, %37
%39 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 9
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %39)
%41 = load float, float* %39
%42 = fadd float %38, %41
%43 = fdiv float %42, 1.000000e+01
%44 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), float %43)
%45 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), float 0x7FF8000000000000)
ret i32 0
}