#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 notas[12], soma = 0;
  int notasval = 0;
  for (int i = 0; i < 12; i++) {
    scanf("%f", &notas[i]);
    if (notas[i] >= 0.0 && notas[i] <= 10.0) {
      notasval++;
      soma += notas[i];
    }
  }
  printf("A quantidae de notas invalidas é: %i\nA média das notas validas é: "
         "%.2f\n",
         12 - notasval, soma / notasval);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
cmpl   $0xc,-0x4c(%rbp)
jge    11d5 <main+0xb5>
movslq -0x4c(%rbp),%rax
lea    -0x40(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea3(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x4c(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11c2 <main+0xa2>
movslq -0x4c(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe65(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11c2 <main+0xa2>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
addss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
jmp    11c7 <main+0xa7>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1145 <main+0x25>
mov    $0xc,%esi
sub    -0x48(%rbp),%esi
movss  -0x44(%rbp),%xmm0
cvtsi2ssl -0x48(%rbp),%xmm1
divss  %xmm1,%xmm0
lea    0xe19(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
xor    %ebx,%ebx
lea    0xedb(%rip),%r14
xor    %ebp,%ebp
xorps  %xmm0,%xmm0
jmp    115b <main+0x3b>
nopl   0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm0
addss  %xmm1,%xmm0
xor    $0x1,%al
movzbl %al,%eax
add    %eax,%ebp
add    $0x4,%rbx
cmp    $0x30,%rbx
je     11a0 <main+0x80>
movss  %xmm0,0xc(%rsp)
lea    (%rsp,%rbx,1),%rsi
add    $0x10,%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
movss  0x10(%rsp,%rbx,1),%xmm0
ucomiss 0xe8a(%rip),%xmm0
setb   %cl
movss  0xe77(%rip),%xmm1
ucomiss %xmm0,%xmm1
setb   %al
or     %cl,%al
movss  0xe6b(%rip),%xmm1
jne    1140 <main+0x20>
movaps %xmm0,%xmm1
jmp    1140 <main+0x20>
mov    $0xc,%esi
sub    %ebp,%esi
xorps  %xmm1,%xmm1
cvtsi2ss %ebp,%xmm1
divss  %xmm1,%xmm0
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [75 x i8] c"A quantidae de notas invalidas \C3\A9: %i\0AA m\C3\A9dia das notas validas \C3\A9: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x float]
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %37, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 12
br i1 %8, label %9, label %40
9: ; preds = %6
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [12 x float], [12 x float]* %2, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %12)
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [12 x float], [12 x float]* %2, i64 0, i64 %15
%17 = load float, float* %16
%18 = fpext float %17 to double
%19 = fcmp oge double %18, 0.000000e+00
br i1 %19, label %20, label %36
20: ; preds = %9
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [12 x float], [12 x float]* %2, i64 0, i64 %22
%24 = load float, float* %23
%25 = fpext float %24 to double
%26 = fcmp ole double %25, 1.000000e+01
br i1 %26, label %27, label %36
27: ; preds = %20
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [12 x float], [12 x float]* %2, i64 0, i64 %31
%33 = load float, float* %32
%34 = load float, float* %3
%35 = fadd float %34, %33
store float %35, float* %3
br label %36
36: ; preds = %27, %20, %9
br label %37
37: ; preds = %36
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %6
40: ; preds = %6
%41 = load i32, i32* %4
%42 = sub nsw i32 12, %41
%43 = load float, float* %3
%44 = load i32, i32* %4
%45 = sitofp i32 %44 to float
%46 = fdiv float %43, %45
%47 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i32 %42, float %46)
%48 = load i32, i32* %1
ret i32 %48
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [75 x i8] c"A quantidae de notas invalidas \C3\A9: %i\0AA m\C3\A9dia das notas validas \C3\A9: %.2f\0A\00"
define i32 @main() {
%1 = alloca [12 x float]
%2 = bitcast [12 x float]* %1 to i8*
br label %8
3: ; preds = %8
%4 = sub nsw i32 12, %23
%5 = sitofp i32 %23 to float
%6 = fdiv float %19, %5
%7 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i32 %4, float %6)
ret i32 0
8: ; preds = %0, %8
%9 = phi i64 [ 0, %0 ], [ %24, %8 ]
%10 = phi i32 [ 0, %0 ], [ %23, %8 ]
%11 = phi float [ 0.000000e+00, %0 ], [ %19, %8 ]
%12 = getelementptr inbounds [12 x float], [12 x float]* %1, i64 0, i64 %9
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %12)
%14 = load float, float* %12
%15 = fcmp ult float %14, 0.000000e+00
%16 = fcmp ugt float %14, 1.000000e+01
%17 = or i1 %15, %16
%18 = select i1 %17, float -0.000000e+00, float %14
%19 = fadd float %11, %18
%20 = or i1 %15, %16
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
%23 = add nuw nsw i32 %10, %22
%24 = add nuw nsw i64 %9, 1
%25 = icmp eq i64 %24, 12
br i1 %25, label %3, label %8
}