#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, float);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float num, avg, a;
  int total;
  avg = total = 0;
  for (a = 1; a <= 6; a++) {
    scanf("%f", &num);
    if (num > 0) {
      avg += num;
      total++;
    }
  }
  printf("%i valores positivos\n%.1f\n", total, avg / total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xeba(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xeb1(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     11b2 <main+0x92>
lea    0xea4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1196 <main+0x76>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119b <main+0x7b>
movss  0xe5d(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    114b <main+0x2b>
mov    -0x14(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
lea    0xed9(%rip),%rbx
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,%xmm1
maxss  0xeab(%rip),%xmm1
xorps  %xmm0,%xmm0
addss  %xmm0,%xmm1
movaps %xmm1,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movaps %xmm0,0x40(%rsp)
maxss  0xe81(%rip),%xmm0
addss  0x10(%rsp),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm2
movaps 0x20(%rsp),%xmm1
unpcklps 0x40(%rsp),%xmm1
movaps 0x30(%rsp),%xmm3
movaps %xmm3,%xmm0
unpcklps %xmm2,%xmm0
movlhps %xmm0,%xmm1
xorps  %xmm0,%xmm0
cmpltps %xmm1,%xmm0
movaps %xmm0,0x20(%rsp)
movss  0xe23(%rip),%xmm0
movaps %xmm3,%xmm1
maxss  %xmm0,%xmm1
addss  0x10(%rsp),%xmm1
maxss  %xmm0,%xmm2
addss  %xmm1,%xmm2
movaps %xmm2,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
xor    %ebp,%ebp
ucomiss 0xdf3(%rip),%xmm0
seta   %bpl
maxss  0xde3(%rip),%xmm0
addss  0x10(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
xor    %eax,%eax
ucomiss 0xdc1(%rip),%xmm0
seta   %al
maxss  0xdb2(%rip),%xmm0
addss  0x10(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movmskps %xmm1,%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,%esi
add    %ebp,%esi
add    %eax,%esi
xorps  %xmm1,%xmm1
cvtsi2ss %esi,%xmm1
divss  %xmm1,%xmm0
lea    0xd76(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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