#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, double);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double i = 0, cont = 0, X, media = 0;
  while (i < 6) {
    scanf(" %lf", &X);
    if (X > 0) {
      cont++;
      media += X;
    }
    i++;
  }
  printf("%0.0lf valores positivos\n%0.1lf\n", cont, media / cont);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb1(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11b4 <main+0x94>
lea    0xeaf(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    119d <main+0x7d>
movsd  0xe84(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe63(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1147 <main+0x27>
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
divsd  -0x18(%rbp),%xmm1
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xee2(%rip),%rbx
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm2
xorpd  %xmm0,%xmm0
xorpd  %xmm3,%xmm3
cmpltsd %xmm2,%xmm3
movsd  0xea7(%rip),%xmm1
andpd  %xmm1,%xmm3
movapd %xmm3,0x10(%rsp)
maxsd  0xe9d(%rip),%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm2
movapd 0x10(%rsp),%xmm4
movapd %xmm4,%xmm0
movsd  0xe69(%rip),%xmm1
addsd  %xmm1,%xmm0
xorpd  %xmm3,%xmm3
cmpltsd %xmm2,%xmm3
movapd %xmm3,%xmm1
andnpd %xmm4,%xmm1
andpd  %xmm0,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,0x10(%rsp)
maxsd  0xe46(%rip),%xmm2
addsd  (%rsp),%xmm2
movsd  %xmm2,(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm2
movapd 0x10(%rsp),%xmm4
movapd %xmm4,%xmm0
movsd  0xe11(%rip),%xmm1
addsd  %xmm1,%xmm0
xorpd  %xmm3,%xmm3
cmpltsd %xmm2,%xmm3
movapd %xmm3,%xmm1
andnpd %xmm4,%xmm1
andpd  %xmm0,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,0x10(%rsp)
maxsd  0xdee(%rip),%xmm2
addsd  (%rsp),%xmm2
movsd  %xmm2,(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm2
movapd 0x10(%rsp),%xmm4
movapd %xmm4,%xmm0
movsd  0xdb9(%rip),%xmm1
addsd  %xmm1,%xmm0
xorpd  %xmm3,%xmm3
cmpltsd %xmm2,%xmm3
movapd %xmm3,%xmm1
andnpd %xmm4,%xmm1
andpd  %xmm0,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,0x10(%rsp)
maxsd  0xd96(%rip),%xmm2
addsd  (%rsp),%xmm2
movsd  %xmm2,(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm2
movapd 0x10(%rsp),%xmm4
movapd %xmm4,%xmm0
movsd  0xd61(%rip),%xmm1
addsd  %xmm1,%xmm0
xorpd  %xmm3,%xmm3
cmpltsd %xmm2,%xmm3
movapd %xmm3,%xmm1
andnpd %xmm4,%xmm1
andpd  %xmm0,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,0x10(%rsp)
maxsd  0xd3e(%rip),%xmm2
addsd  (%rsp),%xmm2
movsd  %xmm2,(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm1
movapd 0x10(%rsp),%xmm4
movapd %xmm4,%xmm0
movsd  0xd09(%rip),%xmm2
addsd  %xmm2,%xmm0
xorpd  %xmm3,%xmm3
cmpltsd %xmm1,%xmm3
movapd %xmm3,%xmm2
andnpd %xmm4,%xmm2
andpd  %xmm0,%xmm3
orpd   %xmm2,%xmm3
movapd %xmm3,%xmm0
maxsd  0xce8(%rip),%xmm1
addsd  (%rsp),%xmm1
divsd  %xmm3,%xmm1
lea    0xce5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" %lf\00"
@.str.1 = [33 x i8] c"%0.0lf valores positivos\0A%0.1lf\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 ogt double %4, 0.000000e+00
%6 = select i1 %5, double 1.000000e+00, double 0.000000e+00
%7 = fcmp ogt double %4, -0.000000e+00
%8 = select i1 %7, double %4, double -0.000000e+00
%9 = fadd double %8, 0.000000e+00
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double* %1)
%11 = load double, double* %1
%12 = fcmp ogt double %11, 0.000000e+00
%13 = fadd double %6, 1.000000e+00
%14 = select i1 %12, double %13, double %6
%15 = fcmp ogt double %11, -0.000000e+00
%16 = select i1 %15, double %11, double -0.000000e+00
%17 = fadd double %9, %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double* %1)
%19 = load double, double* %1
%20 = fcmp ogt double %19, 0.000000e+00
%21 = fadd double %14, 1.000000e+00
%22 = select i1 %20, double %21, double %14
%23 = fcmp ogt double %19, -0.000000e+00
%24 = select i1 %23, double %19, double -0.000000e+00
%25 = fadd double %17, %24
%26 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double* %1)
%27 = load double, double* %1
%28 = fcmp ogt double %27, 0.000000e+00
%29 = fadd double %22, 1.000000e+00
%30 = select i1 %28, double %29, double %22
%31 = fcmp ogt double %27, -0.000000e+00
%32 = select i1 %31, double %27, double -0.000000e+00
%33 = fadd double %25, %32
%34 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double* %1)
%35 = load double, double* %1
%36 = fcmp ogt double %35, 0.000000e+00
%37 = fadd double %30, 1.000000e+00
%38 = select i1 %36, double %37, double %30
%39 = fcmp ogt double %35, -0.000000e+00
%40 = select i1 %39, double %35, double -0.000000e+00
%41 = fadd double %33, %40
%42 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double* %1)
%43 = load double, double* %1
%44 = fcmp ogt double %43, 0.000000e+00
%45 = fadd double %38, 1.000000e+00
%46 = select i1 %44, double %45, double %38
%47 = fcmp ogt double %43, -0.000000e+00
%48 = select i1 %47, double %43, double -0.000000e+00
%49 = fadd double %41, %48
%50 = fdiv double %49, %46
%51 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), double %46, double %50)
ret i32 0
}