#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, float *);
float sqrt(float);
void five() {
  int count = 0;
  float number, sum = 0, sum_square = 0, mean, variance, deviation;
  printf("enter numbers (float) and a single character to exit:\n\n");
  while (scanf("%f", &number)) {
    sum += number;
    sum_square += number * number;
    count++;
  }
  mean = sum / count;
  variance = sum_square / count - mean * mean;
  deviation = sqrt(variance);
  printf("\nevaluated mean\t\t\t= %9.2f\nevaluated variance\t\t= "
         "%9.2f\nevaluated standard deviation\t= %9.2f\n",
         mean, variance, deviation);
  getchar();
  getchar();
  printf("\nreturning to menu. press Enter...");
  getchar();
}


x86 assembly (clang, -O0):
<five>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x0,%rax
je     11c0 <five+0x80>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116d <five+0x2d>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm1
cvtsi2ssl -0x4(%rbp),%xmm0
divss  %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
call   1060 <sqrt@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x1c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe05(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<five>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xf23(%rip),%rdi
call   1030 <puts@plt>
lea    0xe95(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
xorps  %xmm3,%xmm3
xorps  %xmm2,%xmm2
xorps  %xmm1,%xmm1
xorps  %xmm0,%xmm0
test   %rax,%rax
je     11e7 <five+0x97>
xorps  %xmm1,%xmm1
xor    %ebp,%ebp
lea    0xe6e(%rip),%r14
lea    0xc(%rsp),%rbx
xorps  %xmm2,%xmm2
nopw   0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm0
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
mulss  %xmm0,%xmm0
addss  %xmm0,%xmm2
movss  %xmm2,0x4(%rsp)
add    $0x1,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm2
movss  0x8(%rsp),%xmm1
test   %rax,%rax
jne    11a0 <five+0x50>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
xorps  %xmm3,%xmm3
divss  %xmm0,%xmm1
divss  %xmm0,%xmm2
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
subss  %xmm0,%xmm2
ucomiss %xmm3,%xmm2
jb     1208 <five+0xb8>
xorps  %xmm0,%xmm0
sqrtss %xmm2,%xmm0
jmp    1228 <five+0xd8>
movaps %xmm2,%xmm0
movss  %xmm1,0x8(%rsp)
movss  %xmm2,0x4(%rsp)
call   1070 <sqrt@plt>
movss  0x4(%rsp),%xmm2
movss  0x8(%rsp),%xmm1
xorps  %xmm3,%xmm3
cvtss2sd %xmm1,%xmm3
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
lea    0xdbf(%rip),%rdi
movaps %xmm3,%xmm0
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    0xdfc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [56 x i8] c"enter numbers (float) and a single character to exit:\0A\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [92 x i8] c"\0Aevaluated mean\09\09\09= %9.2f\0Aevaluated variance\09\09= %9.2f\0Aevaluated standard deviation\09= %9.2f\0A\00"
@.str.3 = [35 x i8] c"\0Areturning to menu. press Enter...\00"
define void @five() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %12, %0
%10 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load float, float* %2
%14 = load float, float* %3
%15 = fadd float %14, %13
store float %15, float* %3
%16 = load float, float* %2
%17 = load float, float* %2
%18 = load float, float* %4
%19 = call float @llvm.fmuladd.f32(float %16, float %17, float %18)
store float %19, float* %4
%20 = load i32, i32* %1
%21 = add nsw i32 %20, 1
store i32 %21, i32* %1
br label %9
22: ; preds = %9
%23 = load float, float* %3
%24 = load i32, i32* %1
%25 = sitofp i32 %24 to float
%26 = fdiv float %23, %25
store float %26, float* %5
%27 = load float, float* %4
%28 = load i32, i32* %1
%29 = sitofp i32 %28 to float
%30 = fdiv float %27, %29
%31 = load float, float* %5
%32 = load float, float* %5
%33 = fneg float %31
%34 = call float @llvm.fmuladd.f32(float %33, float %32, float %30)
store float %34, float* %6
%35 = load float, float* %6
%36 = call float @sqrt(float %35)
store float %36, float* %7
%37 = load float, float* %5
%38 = fpext float %37 to double
%39 = load float, float* %6
%40 = fpext float %39 to double
%41 = load float, float* %7
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.2, i64 0, i64 0), double %38, double %40, double %42)
%44 = call i32 (...) @getchar()
%45 = call i32 (...) @getchar()
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%47 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [92 x i8] c"\0Aevaluated mean\09\09\09= %9.2f\0Aevaluated variance\09\09= %9.2f\0Aevaluated standard deviation\09= %9.2f\0A\00"
@.str.3 = [35 x i8] c"\0Areturning to menu. press Enter...\00"
@str = [55 x i8] c"enter numbers (float) and a single character to exit:\0A\00"
define void @five() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%4 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %13, %6 ], [ 0, %0 ]
%8 = phi float [ %11, %6 ], [ 0.000000e+00, %0 ]
%9 = phi float [ %12, %6 ], [ 0.000000e+00, %0 ]
%10 = load float, float* %1
%11 = fadd float %8, %10
%12 = call float @llvm.fmuladd.f32(float %10, float %10, float %9)
%13 = add nuw nsw i32 %7, 1
%14 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6
%17 = sitofp i32 %13 to float
br label %18
18: ; preds = %16, %0
%19 = phi float [ 0.000000e+00, %0 ], [ %12, %16 ]
%20 = phi float [ 0.000000e+00, %0 ], [ %11, %16 ]
%21 = phi float [ 0.000000e+00, %0 ], [ %17, %16 ]
%22 = fdiv float %20, %21
%23 = fdiv float %19, %21
%24 = fneg float %22
%25 = call float @llvm.fmuladd.f32(float %24, float %22, float %23)
%26 = call float @sqrt(float %25)
%27 = fpext float %22 to double
%28 = fpext float %25 to double
%29 = fpext float %26 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([92 x i8], [92 x i8]* @.str.2, i64 0, i64 0), double %27, double %28, double %29)
%31 = call i32 (...) @getchar()
%32 = call i32 (...) @getchar()
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%34 = call i32 (...) @getchar()
ret void
}