#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 *, double);
int /*<<< orphan*/ scanf(char *, double *);
double sqrt(double);
int main() {
  double dat[10];
  double avg = 0;
  double dev = 0;
  for (int i = 0; i < 10; i++) {
    scanf("%lf", &dat[i]);
    avg += dat[i];
  }
  avg /= 10;
  printf("average = %lf\n", avg);
  for (int i = 0; i < 10; i++) {
    dev += (dat[i] - avg) * (dat[i] - avg) / (9.);
  }
  dev = sqrt(dev);
  printf("dev = %lf\n", dev);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0xa,-0x74(%rbp)
jge    11a0 <main+0x70>
movslq -0x74(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe97(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x74(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1159 <main+0x29>
movsd  -0x68(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x78(%rbp)
cmpl   $0xa,-0x78(%rbp)
jge    121e <main+0xee>
movslq -0x78(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
subsd  -0x68(%rbp),%xmm0
movslq -0x78(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm1
subsd  -0x68(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe06(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    11ce <main+0x9e>
movsd  -0x70(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
lea    0xdea(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0xee4(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
xorpd  %xmm0,%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movapd (%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
movapd %xmm0,(%rsp)
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movapd (%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
movapd %xmm0,(%rsp)
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movapd (%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
movapd %xmm0,(%rsp)
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movapd (%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
movapd %xmm0,(%rsp)
lea    0x38(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movapd (%rsp),%xmm0
addsd  0x38(%rsp),%xmm0
movapd %xmm0,(%rsp)
lea    0x40(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movapd (%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
movapd %xmm0,(%rsp)
lea    0x48(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movapd (%rsp),%xmm0
addsd  0x48(%rsp),%xmm0
movapd %xmm0,(%rsp)
lea    0x50(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movapd (%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
movapd %xmm0,(%rsp)
lea    0x58(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movapd (%rsp),%xmm0
addsd  0x58(%rsp),%xmm0
divsd  0xd9c(%rip),%xmm0
movapd %xmm0,(%rsp)
lea    0xdb4(%rip),%rdi
call   1030 <printf@plt>
movapd (%rsp),%xmm7
unpcklpd %xmm7,%xmm7
movapd 0x10(%rsp),%xmm4
movapd 0x20(%rsp),%xmm3
movapd 0x30(%rsp),%xmm0
movapd 0x40(%rsp),%xmm1
subpd  %xmm7,%xmm4
mulpd  %xmm4,%xmm4
movapd 0xd6a(%rip),%xmm2
divpd  %xmm2,%xmm4
movapd %xmm4,%xmm5
xorpd  %xmm6,%xmm6
addsd  %xmm6,%xmm5
unpckhpd %xmm4,%xmm4
addsd  %xmm5,%xmm4
subpd  %xmm7,%xmm3
mulpd  %xmm3,%xmm3
divpd  %xmm2,%xmm3
addsd  %xmm3,%xmm4
unpckhpd %xmm3,%xmm3
addsd  %xmm4,%xmm3
subpd  %xmm7,%xmm0
mulpd  %xmm0,%xmm0
divpd  %xmm2,%xmm0
addsd  %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
subpd  %xmm7,%xmm1
mulpd  %xmm1,%xmm1
divpd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd 0x50(%rsp),%xmm0
subpd  %xmm7,%xmm0
mulpd  %xmm0,%xmm0
divpd  %xmm2,%xmm0
addsd  %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm6,%xmm0
jb     1330 <main+0x200>
sqrtsd %xmm0,%xmm0
jmp    1335 <main+0x205>
call   1050 <sqrt@plt>
lea    0xcf7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [15 x i8] c"average = %lf\0A\00"
@.str.2 = [11 x i8] c"dev = %lf\0A\00"
define i32 @main() {
%1 = alloca [10 x double]
%2 = bitcast [10 x double]* %1 to i8*
%3 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%5 = load double, double* %3
%6 = fadd double %5, 0.000000e+00
%7 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %7)
%9 = load double, double* %7
%10 = fadd double %6, %9
%11 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 2
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %11)
%13 = load double, double* %11
%14 = fadd double %10, %13
%15 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 3
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %15)
%17 = load double, double* %15
%18 = fadd double %14, %17
%19 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 4
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %19)
%21 = load double, double* %19
%22 = fadd double %18, %21
%23 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 5
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %23)
%25 = load double, double* %23
%26 = fadd double %22, %25
%27 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 6
%28 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %27)
%29 = load double, double* %27
%30 = fadd double %26, %29
%31 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 7
%32 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %31)
%33 = load double, double* %31
%34 = fadd double %30, %33
%35 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 8
%36 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %35)
%37 = load double, double* %35
%38 = fadd double %34, %37
%39 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 9
%40 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %39)
%41 = load double, double* %39
%42 = fadd double %38, %41
%43 = fdiv double %42, 1.000000e+01
%44 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %43)
%45 = bitcast [10 x double]* %1 to <2 x double>*
%46 = load <2 x double>, <2 x double>* %45
%47 = insertelement <2 x double> poison, double %43, i64 0
%48 = shufflevector <2 x double> %47, <2 x double> poison, <2 x i32> zeroinitializer
%49 = fsub <2 x double> %46, %48
%50 = fmul <2 x double> %49, %49
%51 = fdiv <2 x double> %50, <double 9.000000e+00, double 9.000000e+00>
%52 = extractelement <2 x double> %51, i64 0
%53 = fadd double %52, 0.000000e+00
%54 = extractelement <2 x double> %51, i64 1
%55 = fadd double %53, %54
%56 = bitcast double* %11 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = fsub <2 x double> %57, %48
%59 = fmul <2 x double> %58, %58
%60 = fdiv <2 x double> %59, <double 9.000000e+00, double 9.000000e+00>
%61 = extractelement <2 x double> %60, i64 0
%62 = fadd double %55, %61
%63 = extractelement <2 x double> %60, i64 1
%64 = fadd double %62, %63
%65 = bitcast double* %19 to <2 x double>*
%66 = load <2 x double>, <2 x double>* %65
%67 = fsub <2 x double> %66, %48
%68 = fmul <2 x double> %67, %67
%69 = fdiv <2 x double> %68, <double 9.000000e+00, double 9.000000e+00>
%70 = extractelement <2 x double> %69, i64 0
%71 = fadd double %64, %70
%72 = extractelement <2 x double> %69, i64 1
%73 = fadd double %71, %72
%74 = bitcast double* %27 to <2 x double>*
%75 = load <2 x double>, <2 x double>* %74
%76 = fsub <2 x double> %75, %48
%77 = fmul <2 x double> %76, %76
%78 = fdiv <2 x double> %77, <double 9.000000e+00, double 9.000000e+00>
%79 = extractelement <2 x double> %78, i64 0
%80 = fadd double %73, %79
%81 = extractelement <2 x double> %78, i64 1
%82 = fadd double %80, %81
%83 = bitcast double* %35 to <2 x double>*
%84 = load <2 x double>, <2 x double>* %83
%85 = fsub <2 x double> %84, %48
%86 = fmul <2 x double> %85, %85
%87 = fdiv <2 x double> %86, <double 9.000000e+00, double 9.000000e+00>
%88 = extractelement <2 x double> %87, i64 0
%89 = fadd double %82, %88
%90 = extractelement <2 x double> %87, i64 1
%91 = fadd double %89, %90
%92 = call double @sqrt(double %91)
%93 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %92)
ret i32 0
}