#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 *, int *);
double sqrt(double);
int main(void) {
  int i;
  int input[10];
  int sum = 0;
  double average = 0;
  double sd = 0;
  for (i = 0; i < 10; ++i) {
    printf("Enter input[%d]=", i);
    scanf("%d", &input[i]);
    sum += input[i];
  }
  { average = (double)sum / 10; }
  {
    for (i = 0; i < 10; ++i)
      sd += ((double)input[i] - average) * ((double)input[i] - average);
    sd *= 0.1;
    sd = sqrt(sd);
  }
  printf("Result is: average=%lf sd=%lf\n", average, sd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11b1 <main+0x81>
cvtsi2sdl -0x8(%rbp),%xmm0
lea    0xe9d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe91(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115d <main+0x2d>
cvtsi2sdl -0x34(%rbp),%xmm0
movsd  0xe42(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1216 <main+0xe6>
movslq -0x8(%rbp),%rax
cvtsi2sdl -0x30(%rbp,%rax,4),%xmm0
subsd  -0x40(%rbp),%xmm0
movslq -0x8(%rbp),%rax
cvtsi2sdl -0x30(%rbp,%rax,4),%xmm2
subsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ce <main+0x9e>
movsd  0xdea(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
lea    0xddc(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
lea    0xf19(%rip),%r14
xorps  %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf16(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%ebp
movsd  0xe97(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
movaps %xmm0,0x30(%rsp)
movsd  0xe75(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm0
unpcklps 0x30(%rsp),%xmm0
movaps %xmm0,0x30(%rsp)
movsd  0xe4e(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movaps %xmm0,0x40(%rsp)
movsd  0xe2c(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm0
unpcklps 0x40(%rsp),%xmm0
unpcklpd 0x30(%rsp),%xmm0
movaps %xmm0,0x30(%rsp)
movsd  0xdff(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x14(%rsp),%xmm0
movaps %xmm0,0x40(%rsp)
movsd  0xddd(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x18(%rsp),%xmm0
unpcklps 0x40(%rsp),%xmm0
movaps %xmm0,0x40(%rsp)
movsd  0xdb6(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x1c(%rsp),%xmm0
movaps %xmm0,0x50(%rsp)
movsd  0xd94(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movd   0x20(%rsp),%xmm0
punpckldq 0x50(%rsp),%xmm0
punpcklqdq 0x40(%rsp),%xmm0
paddd  0x30(%rsp),%xmm0
movdqa %xmm0,0x30(%rsp)
movsd  0xd5f(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x24(%rsp),%eax
movdqa 0x30(%rsp),%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%ecx
add    %ebp,%ecx
add    %eax,%ecx
cvtsi2sd %ecx,%xmm4
divsd  0xd20(%rip),%xmm4
xorps  %xmm0,%xmm0
cvtsi2sdl (%rsp),%xmm0
subsd  %xmm4,%xmm0
mulsd  %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x4(%rsp),%xmm1
xorpd  %xmm3,%xmm3
addsd  %xmm3,%xmm0
subsd  %xmm4,%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rsp),%xmm0
subsd  %xmm4,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
subsd  %xmm4,%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdl 0x10(%rsp),%xmm0
subsd  %xmm4,%xmm0
mulsd  %xmm0,%xmm0
cvtsi2sdl 0x14(%rsp),%xmm2
addsd  %xmm1,%xmm0
subsd  %xmm4,%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sdl 0x18(%rsp),%xmm0
subsd  %xmm4,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x1c(%rsp),%xmm1
subsd  %xmm4,%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cvtsi2sdl 0x20(%rsp),%xmm2
subsd  %xmm4,%xmm2
mulsd  %xmm2,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm1,%xmm2
subsd  %xmm4,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xc50(%rip),%xmm0
ucomisd %xmm3,%xmm0
jb     140f <main+0x2df>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    1424 <main+0x2f4>
movsd  %xmm4,0x30(%rsp)
call   1050 <sqrt@plt>
movsd  0x30(%rsp),%xmm4
movapd %xmm0,%xmm1
lea    0xc41(%rip),%rdi
movapd %xmm4,%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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