#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);
float sqrt(float);
scalar_t__ square(float);
int /*<<< orphan*/ system(char *);
int main() {
  float fValues[10] = {2.33,  32.9823, 2.723, 3.152, 6.273,
                       7.681, 6.73,    9.423, 4.093, 1.94};
  float fAverage, fStandardDeviation, fTotal = 0, fSDTotal = 0;
  int i, j;
  for (i = 0; i < 10; i++) {
    fTotal += fValues[i];
  }
  fAverage = fTotal / 10;
  printf("The average for these numbers is: %3.4f\n", fAverage);
  for (i = 0; i < 10; i++) {
    fSDTotal += square((fValues[i] - fAverage));
  }
  fStandardDeviation = sqrt((fSDTotal / 10));
  printf("The standard deviation for these is: %3.4f\n", fStandardDeviation);
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    11b7 <main+0x67>
movslq -0x44(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
addss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    118b <main+0x3b>
movss  -0x3c(%rbp),%xmm0
movss  0xe3c(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
lea    0xe5f(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    1220 <main+0xd0>
movslq -0x44(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
subss  -0x34(%rbp),%xmm0
call   1030 <square@plt>
cvtsi2ss %rax,%xmm0
addss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11e5 <main+0x95>
movss  -0x40(%rbp),%xmm0
movss  0xdd3(%rip),%xmm1
divss  %xmm1,%xmm0
call   1070 <sqrt@plt>
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm0
lea    0xe1a(%rip),%rdi
call   1050 <printf@plt>
lea    0xe3a(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
movss  0xeb0(%rip),%xmm0
call   1050 <printf@plt>
movss  0xea7(%rip),%xmm0
call   1030 <square@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xe90(%rip),%xmm0
call   1030 <square@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xe73(%rip),%xmm0
call   1030 <square@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xe56(%rip),%xmm0
call   1030 <square@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xe39(%rip),%xmm0
call   1030 <square@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xe1c(%rip),%xmm0
call   1030 <square@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xdff(%rip),%xmm0
call   1030 <square@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xde2(%rip),%xmm0
call   1030 <square@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xdc5(%rip),%xmm0
call   1030 <square@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xda8(%rip),%xmm0
call   1030 <square@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
divss  0xd91(%rip),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     12a9 <main+0x169>
sqrtss %xmm0,%xmm0
jmp    12ae <main+0x16e>
call   1060 <sqrt@plt>
lea    0xda4(%rip),%rdi
call   1050 <printf@plt>
lea    0xdc4(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.fValues = [10 x float] [float 0x4002A3D700000000, float 0x40407DBC00000000, float 0x4005C8B440000000, float 0x4009374BC0000000, float 0x4019178D40000000, float 0x401EB95820000000, float 0x401AEB8520000000, float 0x4022D89380000000, float 0x40105F3B60000000, float 0x3FFF0A3D80000000]
@.str = [41 x i8] c"The average for these numbers is: %3.4f\0A\00"
@.str.1 = [44 x i8] c"The standard deviation for these is: %3.4f\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x float]
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [10 x float]* %2 to i8*
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
store i32 0, i32* %7
br label %10
10: ; preds = %20, %0
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %15
%17 = load float, float* %16
%18 = load float, float* %5
%19 = fadd float %18, %17
store float %19, float* %5
br label %20
20: ; preds = %13
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %10
23: ; preds = %10
%24 = load float, float* %5
%25 = fdiv float %24, 1.000000e+01
store float %25, float* %3
%26 = load float, float* %3
%27 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float %26)
store i32 0, i32* %7
br label %28
28: ; preds = %42, %23
%29 = load i32, i32* %7
%30 = icmp slt i32 %29, 10
br i1 %30, label %31, label %45
31: ; preds = %28
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %33
%35 = load float, float* %34
%36 = load float, float* %3
%37 = fsub float %35, %36
%38 = call i64 @square(float %37)
%39 = sitofp i64 %38 to float
%40 = load float, float* %6
%41 = fadd float %40, %39
store float %41, float* %6
br label %42
42: ; preds = %31
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %28
45: ; preds = %28
%46 = load float, float* %6
%47 = fdiv float %46, 1.000000e+01
%48 = call float @sqrt(float %47)
store float %48, float* %4
%49 = load float, float* %4
%50 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), float %49)
%51 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"The average for these numbers is: %3.4f\0A\00"
@.str.1 = [44 x i8] c"The standard deviation for these is: %3.4f\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 0x401EEE50C0000000)
%2 = tail call i64 @square(float 0xC0159C6540000000)
%3 = sitofp i64 %2 to float
%4 = tail call i64 @square(float 0x40393FE3C0000000)
%5 = sitofp i64 %4 to float
%6 = fadd float %3, %5
%7 = tail call i64 @square(float 0xC01409F6A0000000)
%8 = sitofp i64 %7 to float
%9 = fadd float %6, %8
%10 = tail call i64 @square(float 0xC01252AAE0000000)
%11 = sitofp i64 %10 to float
%12 = fadd float %9, %11
%13 = tail call i64 @square(float 0xBFF75B0E00000000)
%14 = sitofp i64 %13 to float
%15 = fadd float %12, %14
%16 = tail call i64 @square(float 0xBFAA7C5000000000)
%17 = sitofp i64 %16 to float
%18 = fadd float %15, %17
%19 = tail call i64 @square(float 0xBFF00B2E80000000)
%20 = sitofp i64 %19 to float
%21 = fadd float %18, %20
%22 = tail call i64 @square(float 0x3FFB0B5900000000)
%23 = sitofp i64 %22 to float
%24 = fadd float %21, %23
%25 = tail call i64 @square(float 0xC00D1E2AC0000000)
%26 = sitofp i64 %25 to float
%27 = fadd float %24, %26
%28 = tail call i64 @square(float 0xC0172BC160000000)
%29 = sitofp i64 %28 to float
%30 = fadd float %27, %29
%31 = fdiv float %30, 1.000000e+01
%32 = tail call float @sqrt(float %31)
%33 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), float %32)
%34 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}