#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() {
  int i, sum = 0;
  float n, ave, sum2 = 0;
  for (i = 1; i <= 6; i++) {
    scanf("%f", &n);
    if (n > 0) {
      sum++;
      sum2 += n;
      ave = sum2 / sum;
    }
  }
  printf("%d valores positivos\n", sum);
  printf("%0.1f\n", ave);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     11ae <main+0x8e>
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    119b <main+0x7b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movss  -0x10(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    11a0 <main+0x80>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <main+0x25>
cvtsi2ssl -0xc(%rbp),%xmm0
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed3(%rip),%r15
lea    0x8(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
xor    %ebp,%ebp
ucomiss %xmm1,%xmm0
seta   %bl
movss  %xmm0,0x14(%rsp)
addss  %xmm1,%xmm0
movss  %xmm0,0x10(%rsp)
ja     1167 <main+0x47>
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm0
ucomiss 0xe7b(%rip),%xmm0
jbe    11bf <main+0x9f>
xorps  %xmm1,%xmm1
xor    %ebp,%ebp
movss  0x14(%rsp),%xmm2
ucomiss %xmm1,%xmm2
seta   %bpl
add    $0x1,%ebp
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm1,0xc(%rsp)
divss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
jmp    11c2 <main+0xa2>
mov    %bl,%bpl
lea    0xe3b(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1205 <main+0xe5>
add    $0x1,%ebp
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm1,0xc(%rsp)
divss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
lea    0xdf8(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm0
ucomiss 0xddd(%rip),%xmm0
jbe    1249 <main+0x129>
add    $0x1,%ebp
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm1,0xc(%rsp)
divss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
lea    0xdb4(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    128c <main+0x16c>
add    $0x1,%ebp
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm1,0xc(%rsp)
divss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
lea    0xd71(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm0
ucomiss 0xd56(%rip),%xmm0
jbe    12cc <main+0x1ac>
add    $0x1,%ebp
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
divss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
jmp    12d3 <main+0x1b3>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
lea    0xd2d(%rip),%rdi
call   1030 <printf@plt>
lea    0xd37(%rip),%rdi
movss  0x10(%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [22 x i8] c"%d valores positivos\0A\00"
@.str.2 = [7 x i8] c"%0.1f\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 ogt float %4, 0.000000e+00
%6 = fadd float %4, 0.000000e+00
%7 = zext i1 %5 to i32
%8 = select i1 %5, float %6, float undef
%9 = select i1 %5, float %6, float 0.000000e+00
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%11 = load float, float* %1
%12 = fcmp ogt float %11, 0.000000e+00
br i1 %12, label %13, label %18
13: ; preds = %0
%14 = select i1 %5, i32 2, i32 1
%15 = fadd float %9, %11
%16 = sitofp i32 %14 to float
%17 = fdiv float %15, %16
br label %18
18: ; preds = %13, %0
%19 = phi i32 [ %14, %13 ], [ %7, %0 ]
%20 = phi float [ %17, %13 ], [ %8, %0 ]
%21 = phi float [ %15, %13 ], [ %9, %0 ]
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%23 = load float, float* %1
%24 = fcmp ogt float %23, 0.000000e+00
br i1 %24, label %25, label %30
25: ; preds = %18
%26 = add nuw nsw i32 %19, 1
%27 = fadd float %21, %23
%28 = sitofp i32 %26 to float
%29 = fdiv float %27, %28
br label %30
30: ; preds = %25, %18
%31 = phi i32 [ %26, %25 ], [ %19, %18 ]
%32 = phi float [ %29, %25 ], [ %20, %18 ]
%33 = phi float [ %27, %25 ], [ %21, %18 ]
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%35 = load float, float* %1
%36 = fcmp ogt float %35, 0.000000e+00
br i1 %36, label %37, label %42
37: ; preds = %30
%38 = add nuw nsw i32 %31, 1
%39 = fadd float %33, %35
%40 = sitofp i32 %38 to float
%41 = fdiv float %39, %40
br label %42
42: ; preds = %37, %30
%43 = phi i32 [ %38, %37 ], [ %31, %30 ]
%44 = phi float [ %41, %37 ], [ %32, %30 ]
%45 = phi float [ %39, %37 ], [ %33, %30 ]
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%47 = load float, float* %1
%48 = fcmp ogt float %47, 0.000000e+00
br i1 %48, label %49, label %54
49: ; preds = %42
%50 = add nuw nsw i32 %43, 1
%51 = fadd float %45, %47
%52 = sitofp i32 %50 to float
%53 = fdiv float %51, %52
br label %54
54: ; preds = %49, %42
%55 = phi i32 [ %50, %49 ], [ %43, %42 ]
%56 = phi float [ %53, %49 ], [ %44, %42 ]
%57 = phi float [ %51, %49 ], [ %45, %42 ]
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%59 = load float, float* %1
%60 = fcmp ogt float %59, 0.000000e+00
br i1 %60, label %63, label %61
61: ; preds = %54
%62 = sitofp i32 %55 to float
br label %68
63: ; preds = %54
%64 = add nuw nsw i32 %55, 1
%65 = fadd float %57, %59
%66 = sitofp i32 %64 to float
%67 = fdiv float %65, %66
br label %68
68: ; preds = %61, %63
%69 = phi float [ %62, %61 ], [ %66, %63 ]
%70 = phi float [ %56, %61 ], [ %67, %63 ]
%71 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), float %69)
%72 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float %70)
ret i32 0
}