#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);
int /*<<< orphan*/ scanf(char *, double *);
int /*<<< orphan*/ system(char *);
main() {
  int I, aux;
  double A, B;
  aux = 0;
  B = 0;
  for (I = 0; I < 6; I++) {
    scanf("%lf", &A);
    if (A > 0) {
      aux++;
      B = B + A;
    }
  }
  B = B / aux;
  printf("%d valores positivos\n", aux);
  printf("%.1lf\n", B);
  system("pause");
  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
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    11ac <main+0x7c>
lea    0xe9a(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1199 <main+0x69>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    119e <main+0x6e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1155 <main+0x25>
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe3e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe39(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
lea    0xed1(%rip),%rbx
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movapd %xmm0,0x20(%rsp)
movapd %xmm0,%xmm1
maxsd  0xe99(%rip),%xmm1
xorpd  %xmm0,%xmm0
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movaps %xmm0,0x40(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm1
movapd 0x30(%rsp),%xmm3
movapd %xmm3,%xmm0
unpcklpd %xmm1,%xmm0
movapd %xmm0,0x50(%rsp)
movapd 0x20(%rsp),%xmm0
movapd 0x40(%rsp),%xmm2
unpcklpd %xmm2,%xmm0
movapd %xmm0,0x20(%rsp)
movsd  0xe1c(%rip),%xmm0
maxsd  %xmm0,%xmm2
addsd  0x10(%rsp),%xmm2
maxsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
maxsd  %xmm0,%xmm1
addsd  %xmm3,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
xor    %ebp,%ebp
ucomisd 0xde9(%rip),%xmm0
seta   %bpl
maxsd  0xdd5(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm1
xor    %eax,%eax
ucomisd 0xdb6(%rip),%xmm1
seta   %al
xorpd  %xmm0,%xmm0
cmpltpd 0x20(%rsp),%xmm0
xorpd  %xmm2,%xmm2
cmpltpd 0x50(%rsp),%xmm2
packssdw %xmm2,%xmm0
movmskps %xmm0,%ecx
mov    %ecx,%edx
shr    %dl
and    $0x5,%dl
sub    %dl,%cl
mov    %ecx,%edx
and    $0x33,%dl
shr    $0x2,%cl
and    $0x33,%cl
add    %dl,%cl
mov    %ecx,%edx
shr    $0x4,%dl
add    %cl,%dl
and    $0xf,%dl
movzbl %dl,%ecx
add    %ebp,%ecx
add    %eax,%ecx
maxsd  0xd5f(%rip),%xmm1
addsd  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
lea    0xd55(%rip),%rdi
call   1040 <printf@plt>
lea    0xd5f(%rip),%rdi
movsd  0x20(%rsp),%xmm0
call   1040 <printf@plt>
lea    0xd54(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [22 x i8] c"%d valores positivos\0A\00"
@.str.2 = [7 x i8] c"%.1lf\0A\00"
@.str.3 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 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 %4, double -0.000000e+00
%7 = fadd double %6, 0.000000e+00
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%9 = load double, double* %1
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%11 = load double, double* %1
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%13 = load double, double* %1
%14 = insertelement <4 x double> poison, double %4, i64 0
%15 = insertelement <4 x double> %14, double %9, i64 1
%16 = insertelement <4 x double> %15, double %11, i64 2
%17 = insertelement <4 x double> %16, double %13, i64 3
%18 = fcmp ogt <4 x double> %17, zeroinitializer
%19 = fcmp ogt double %9, -0.000000e+00
%20 = select i1 %19, double %9, double -0.000000e+00
%21 = fadd double %7, %20
%22 = fcmp ogt double %11, -0.000000e+00
%23 = select i1 %22, double %11, double -0.000000e+00
%24 = fadd double %21, %23
%25 = fcmp ogt double %13, -0.000000e+00
%26 = select i1 %25, double %13, double -0.000000e+00
%27 = fadd double %24, %26
%28 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%29 = load double, double* %1
%30 = fcmp ogt double %29, 0.000000e+00
%31 = zext i1 %30 to i32
%32 = fcmp ogt double %29, -0.000000e+00
%33 = select i1 %32, double %29, double -0.000000e+00
%34 = fadd double %27, %33
%35 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%36 = load double, double* %1
%37 = fcmp ogt double %36, 0.000000e+00
%38 = zext i1 %37 to i32
%39 = bitcast <4 x i1> %18 to i4
%40 = call i4 @llvm.ctpop.i4(i4 %39)
%41 = zext i4 %40 to i32
%42 = add nuw nsw i32 %41, %31
%43 = add nuw nsw i32 %42, %38
%44 = fcmp ogt double %36, -0.000000e+00
%45 = select i1 %44, double %36, double -0.000000e+00
%46 = fadd double %34, %45
%47 = sitofp i32 %43 to double
%48 = fdiv double %46, %47
%49 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %47)
%50 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %48)
%51 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}