#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 *, int, int, int, float);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  float aver;
  int m, score, maxs, mins, sum;
  scanf("%d", &score);
  maxs = mins = score;
  sum = 0;
  m = 0;
  while (score >= 0) {
    sum = sum + score;
    m++;
    if (score > maxs)
      maxs = score;
    if (score < mins) {
      mins = score;
    }
    scanf("%d", &score);
  }
  aver = (sum + .0) / m;
  printf("%d,%d,%d,%.2f\n", m, maxs, mins, aver);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11a4 <main+0x84>
mov    -0x18(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    117d <main+0x5d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118f <main+0x6f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xe6a(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114f <main+0x2f>
cvtsi2sdl -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
movss  -0x4(%rbp),%xmm0
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%r13d
test   %r13d,%r13d
js     118b <main+0x6b>
xor    %ebx,%ebx
lea    0xeb1(%rip),%r15
lea    0x4(%rsp),%r12
mov    %r13d,%ebp
xor    %r14d,%r14d
mov    %r13d,%eax
nopl   (%rax)
add    %eax,%ebx
add    $0x1,%r14d
cmp    %r13d,%eax
cmovg  %eax,%r13d
cmp    %ebp,%eax
cmovl  %eax,%ebp
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jns    1160 <main+0x40>
cvtsi2sd %ebx,%xmm0
jmp    1195 <main+0x75>
xorpd  %xmm0,%xmm0
xor    %r14d,%r14d
mov    %r13d,%ebp
cvtsi2sd %r14d,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xe5a(%rip),%rdi
mov    %r14d,%esi
mov    %r13d,%edx
mov    %ebp,%ecx
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [15 x i8] c"%d,%d,%d,%.2f\0A\00"
define void @main() {
%1 = alloca float
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
store i32 %8, i32* %5
store i32 %8, i32* %4
store i32 0, i32* %6
store i32 0, i32* %2
br label %9
9: ; preds = %29, %0
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %31
12: ; preds = %9
%13 = load i32, i32* %6
%14 = load i32, i32* %3
%15 = add nsw i32 %13, %14
store i32 %15, i32* %6
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %12
%22 = load i32, i32* %3
store i32 %22, i32* %4
br label %23
23: ; preds = %21, %12
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = load i32, i32* %3
store i32 %28, i32* %5
br label %29
29: ; preds = %27, %23
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %9
31: ; preds = %9
%32 = load i32, i32* %6
%33 = sitofp i32 %32 to double
%34 = fadd double %33, 0.000000e+00
%35 = load i32, i32* %2
%36 = sitofp i32 %35 to double
%37 = fdiv double %34, %36
%38 = fptrunc double %37 to float
store float %38, float* %1
%39 = load i32, i32* %2
%40 = load i32, i32* %4
%41 = load i32, i32* %5
%42 = load float, float* %1
%43 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %39, i32 %40, i32 %41, float %42)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [15 x i8] c"%d,%d,%d,%.2f\0A\00"
define void @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 = load i32, i32* %1
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %23
6: ; preds = %0, %6
%7 = phi i32 [ %12, %6 ], [ 0, %0 ]
%8 = phi i32 [ %17, %6 ], [ %4, %0 ]
%9 = phi i32 [ %15, %6 ], [ %4, %0 ]
%10 = phi i32 [ %13, %6 ], [ 0, %0 ]
%11 = phi i32 [ %19, %6 ], [ %4, %0 ]
%12 = add nsw i32 %7, %11
%13 = add nuw nsw i32 %10, 1
%14 = icmp sgt i32 %11, %9
%15 = select i1 %14, i32 %11, i32 %9
%16 = icmp slt i32 %11, %8
%17 = select i1 %16, i32 %11, i32 %8
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %1
%20 = icmp sgt i32 %19, -1
br i1 %20, label %6, label %21
21: ; preds = %6
%22 = sitofp i32 %12 to double
br label %23
23: ; preds = %21, %0
%24 = phi i32 [ 0, %0 ], [ %13, %21 ]
%25 = phi i32 [ %4, %0 ], [ %15, %21 ]
%26 = phi i32 [ %4, %0 ], [ %17, %21 ]
%27 = phi double [ 0.000000e+00, %0 ], [ %22, %21 ]
%28 = sitofp i32 %24 to double
%29 = fdiv double %27, %28
%30 = fptrunc double %29 to float
%31 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %25, i32 %26, float %30)
ret void
}