#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 EOF;
int EXIT_SUCCESS;
int getchar();
int /*<<< orphan*/ printf(char *, double);
int scanf(char *, int *);
int main() {
  int temp, cnt = 0;
  double avg = 0.0;
  while (scanf("%d", &temp) == 1) {
    avg += ((double)temp - avg) / ++cnt;
  }
  printf("%.6lf", avg);
  while ((temp = getchar()) != '\n' && temp != EOF)
    ;
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xeab(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1191 <main+0x61>
cvtsi2sdl -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    114e <main+0x1e>
movsd  -0x18(%rbp),%xmm0
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x19(%rbp)
je     11ce <main+0x9e>
mov    -0x8(%rbp),%eax
mov    0x2e22(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11de <main+0xae>
jmp    11e3 <main+0xb3>
jmp    11a2 <main+0x72>
mov    0x2dee(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
xorpd  %xmm0,%xmm0
cmp    $0x1,%eax
jne    11ab <main+0x7b>
xorpd  %xmm0,%xmm0
mov    $0x1,%ebp
lea    0xe9e(%rip),%r14
lea    0x4(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
xorps  %xmm2,%xmm2
cvtsi2sdl 0x4(%rsp),%xmm2
subsd  %xmm0,%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
divsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
add    $0x1,%ebp
cmp    $0x1,%eax
je     1170 <main+0x40>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e2a(%rip),%rbx
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,0x4(%rsp)
cmp    $0xa,%eax
je     11d4 <main+0xa4>
cmp    (%rbx),%eax
jne    11c0 <main+0x90>
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%.6lf\00"
@EOF = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
store i32 0, i32* %3
store double 0.000000e+00, double* %4
br label %5
5: ; preds = %8, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = load double, double* %4
%12 = fsub double %10, %11
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
%15 = sitofp i32 %14 to double
%16 = fdiv double %12, %15
%17 = load double, double* %4
%18 = fadd double %17, %16
store double %18, double* %4
br label %5
19: ; preds = %5
%20 = load double, double* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %20)
br label %22
22: ; preds = %31, %19
%23 = call i32 (...) @getchar()
store i32 %23, i32* %2
%24 = icmp ne i32 %23, 10
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = load i32, i32* %2
%27 = load i32, i32* @EOF
%28 = icmp ne i32 %26, %27
br label %29
29: ; preds = %25, %22
%30 = phi i1 [ false, %22 ], [ %28, %25 ]
br i1 %30, label %31, label %32
31: ; preds = %29
br label %22
32: ; preds = %29
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%.6lf\00"
@EOF = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %17
5: ; preds = %0, %5
%6 = phi double [ %14, %5 ], [ 0.000000e+00, %0 ]
%7 = phi i32 [ %11, %5 ], [ 0, %0 ]
%8 = load i32, i32* %1
%9 = sitofp i32 %8 to double
%10 = fsub double %9, %6
%11 = add nuw nsw i32 %7, 1
%12 = sitofp i32 %11 to double
%13 = fdiv double %10, %12
%14 = fadd double %6, %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%16 = icmp eq i32 %15, 1
br i1 %16, label %5, label %17
17: ; preds = %5, %0
%18 = phi double [ 0.000000e+00, %0 ], [ %14, %5 ]
%19 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %18)
br label %20
20: ; preds = %20, %17
%21 = call i32 (...) @getchar()
store i32 %21, i32* %1
%22 = icmp ne i32 %21, 10
%23 = load i32, i32* @EOF
%24 = icmp ne i32 %21, %23
%25 = select i1 %22, i1 %24, i1 false
br i1 %25, label %20, label %26
26: ; preds = %20
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
}