#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 *, double *);
int main() {
  double I, total = 0, cont = 0;
  scanf(" %lf", &I);
  while (I >= 0) {
    total += I;
    cont++;
    scanf(" %lf", &I);
  }
  printf("%0.2f\n", total / cont);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1197 <main+0x77>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe88(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xe7f(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114f <main+0x2f>
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xee2(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jae    114f <main+0x2f>
movsd  0xeb3(%rip),%xmm0
jmp    11b2 <main+0x92>
lea    0xeba(%rip),%r14
mov    %rsp,%rbx
xorpd  %xmm2,%xmm2
xorpd  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
addsd  0xe86(%rip),%xmm2
movsd  %xmm2,0x8(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
xorpd  %xmm2,%xmm2
movsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm2,%xmm1
movsd  0x8(%rsp),%xmm2
jae    1170 <main+0x50>
divsd  %xmm2,%xmm0
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" %lf\00"
@.str.1 = [7 x i8] c"%0.2f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load double, double* %1
%5 = fcmp ult double %4, 0.000000e+00
br i1 %5, label %17, label %6
6: ; preds = %0, %6
%7 = phi double [ %13, %6 ], [ %4, %0 ]
%8 = phi double [ %11, %6 ], [ 0.000000e+00, %0 ]
%9 = phi double [ %10, %6 ], [ 0.000000e+00, %0 ]
%10 = fadd double %9, %7
%11 = fadd double %8, 1.000000e+00
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double* %1)
%13 = load double, double* %1
%14 = fcmp ult double %13, 0.000000e+00
br i1 %14, label %15, label %6
15: ; preds = %6
%16 = fdiv double %10, %11
br label %17
17: ; preds = %15, %0
%18 = phi double [ %16, %15 ], [ 0x7FF8000000000000, %0 ]
%19 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %18)
ret i32 0
}