#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int, float);
scalar_t__ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  float avg;
  int num = 0, now, possum = 0, neg = 0;
  while (scanf("%d", &now) != EOF) {
    if (now < 0)
      neg++;
    if (now > 0) {
      possum += now;
      num++;
    }
  }
  avg = (float)possum / (float)num;
  printf("%d\n%.2f", neg, avg);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xeae(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e86(%rip),%rcx
cmp    (%rcx),%rax
je     119f <main+0x7f>
cmpl   $0x0,-0x1c(%rbp)
jge    117e <main+0x5e>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    119a <main+0x7a>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114b <main+0x2b>
cvtsi2ssl -0x20(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x24(%rbp),%esi
movss  -0x14(%rbp),%xmm0
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2ea5(%rip),%r12
cmp    (%r12),%rax
jne    1155 <main+0x35>
movss  0xeaf(%rip),%xmm0
xor    %ebx,%ebx
jmp    11ad <main+0x8d>
lea    0xea8(%rip),%r14
lea    0x4(%rsp),%r15
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %ecx,%ebx
xor    %ecx,%ecx
test   %eax,%eax
setg   %cl
mov    $0x0,%edx
cmovle %edx,%eax
add    %ecx,%r13d
add    %eax,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
cmp    (%r12),%rax
jne    1170 <main+0x50>
cvtsi2ss %ebp,%xmm0
cvtsi2ss %r13d,%xmm1
divss  %xmm1,%xmm0
lea    0xe53(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
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"
@EOF = global i64 0
@.str.1 = [8 x i8] c"%d\0A%.2f\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %9
store i32 0, i32* %10
br label %11
11: ; preds = %30, %2
%12 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%13 = load i64, i64* @EOF
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %10
%20 = add nsw i32 %19, 1
store i32 %20, i32* %10
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %8
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load i32, i32* %8
%26 = load i32, i32* %9
%27 = add nsw i32 %26, %25
store i32 %27, i32* %9
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %30
30: ; preds = %24, %21
br label %11
31: ; preds = %11
%32 = load i32, i32* %9
%33 = sitofp i32 %32 to float
%34 = load i32, i32* %7
%35 = sitofp i32 %34 to float
%36 = fdiv float %33, %35
store float %36, float* %6
%37 = load i32, i32* %10
%38 = load float, float* %6
%39 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %37, float %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [8 x i8] c"%d\0A%.2f\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %27, label %8
8: ; preds = %2, %8
%9 = phi i32 [ %14, %8 ], [ 0, %2 ]
%10 = phi i32 [ %19, %8 ], [ 0, %2 ]
%11 = phi i32 [ %17, %8 ], [ 0, %2 ]
%12 = load i32, i32* %3
%13 = lshr i32 %12, 31
%14 = add nuw nsw i32 %13, %9
%15 = icmp sgt i32 %12, 0
%16 = zext i1 %15 to i32
%17 = add nuw nsw i32 %11, %16
%18 = select i1 %15, i32 %12, i32 0
%19 = add nuw nsw i32 %18, %10
%20 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%21 = load i64, i64* @EOF
%22 = icmp eq i64 %20, %21
br i1 %22, label %23, label %8
23: ; preds = %8
%24 = sitofp i32 %19 to float
%25 = sitofp i32 %17 to float
%26 = fdiv float %24, %25
br label %27
27: ; preds = %23, %2
%28 = phi i32 [ 0, %2 ], [ %14, %23 ]
%29 = phi float [ 0x7FF8000000000000, %2 ], [ %26, %23 ]
%30 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %28, float %29)
ret i32 0
}