#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(void) {
  int i;
  float sum, average;
  sum = 0;
  for (i = 1; i <= 100; i++) {
    float input;
    scanf("%f", &input);
    sum += input;
  }
  average = sum / 100.0;
  printf("%f \n", average);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     1175 <main+0x55>
lea    0xeb9(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x14(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <main+0x1e>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
mov    $0x64,%ebp
lea    0xecd(%rip),%r14
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
movss  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
add    $0xffffffff,%ebp
jne    1140 <main+0x20>
divss  0xe96(%rip),%xmm0
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [5 x i8] c"%f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %3
store i32 1, i32* %2
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 100
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %5)
%11 = load float, float* %5
%12 = load float, float* %3
%13 = fadd float %12, %11
store float %13, float* %3
br label %14
14: ; preds = %9
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %6
17: ; preds = %6
%18 = load float, float* %3
%19 = fpext float %18 to double
%20 = fdiv double %19, 1.000000e+02
%21 = fptrunc double %20 to float
store float %21, float* %4
%22 = load float, float* %4
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), float %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [5 x i8] c"%f \0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 1, %0 ], [ %9, %3 ]
%5 = phi float [ 0.000000e+00, %0 ], [ %8, %3 ]
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%7 = load float, float* %1
%8 = fadd float %5, %7
%9 = add nuw nsw i32 %4, 1
%10 = icmp eq i32 %9, 101
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = fdiv float %8, 1.000000e+02
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), float %12)
ret i32 0
}