#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() {
  float n, tot = 0;
  float media, i = 0;
  scanf("%f", &n);
  while (n >= 0) {
    i++;
    tot = tot + n;
    scanf("%f", &n);
  }
  if (tot >= 0) {
    media = (tot / i);
    printf("%.2f\n", media);
  }
  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)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1196 <main+0x76>
movss  0xe98(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xe7c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114f <main+0x2f>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11c7 <main+0xa7>
movss  -0xc(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    0xe45(%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    0xeda(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm2
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm2
xorps  %xmm0,%xmm0
jb     11a6 <main+0x86>
lea    0xeb8(%rip),%r14
lea    0xc(%rsp),%rbx
xorps  %xmm1,%xmm1
xorps  %xmm0,%xmm0
nopl   0x0(%rax,%rax,1)
addss  %xmm2,%xmm0
movss  %xmm0,0x10(%rsp)
addss  0xe8e(%rip),%xmm1
movss  %xmm1,0x14(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
ucomiss 0xe68(%rip),%xmm2
jae    1160 <main+0x40>
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jb     11b6 <main+0x96>
divss  %xmm1,%xmm0
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

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