#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 /*<<< orphan*/ scanf(char *, ...);
int main() {
  float media = 0, nota = 0;
  int alunos, acima_de_5 = 0, i;
  printf("Digite a quantidade de alunos: ");
  scanf("%d", &alunos);
  for (i = 1; i <= alunos; i++) {
    printf("Digite a nota do %d° aluno: ", i);
    scanf("%f", &nota);
    if (nota > 5) {
      acima_de_5++;
    }
    media += nota;
  }
  printf("A média das notas é: %.1f\n", media / alunos);
  if (acima_de_5 > 0) {
    printf("%d aluno(s) tiraram nota acima de 5.0\n", acima_de_5);
  } else {
    printf("Não há nenhum aluno com nota acima de 5.0\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11d8 <main+0xb8>
mov    -0x18(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  0xe57(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11bb <main+0x9b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116d <main+0x4d>
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe57(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    1218 <main+0xf8>
mov    -0x14(%rbp),%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1226 <main+0x106>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
lea    0xeb9(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
xorps  %xmm1,%xmm1
test   %eax,%eax
jle    11d8 <main+0xa8>
lea    0xeae(%rip),%r14
lea    0xec5(%rip),%r15
lea    0x8(%rsp),%r12
xor    %ebp,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
movss  %xmm1,0xc(%rsp)
add    $0x1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
xor    %eax,%eax
ucomiss 0xe39(%rip),%xmm0
seta   %al
add    %eax,%ebx
addss  %xmm0,%xmm1
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
jl     1190 <main+0x60>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe57(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
test   %ebx,%ebx
je     120e <main+0xde>
lea    0xe62(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    121a <main+0xea>
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Digite a quantidade de alunos: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"Digite a nota do %d\C2\B0 aluno: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [29 x i8] c"A m\C3\A9dia das notas \C3\A9: %.1f\0A\00"
@.str.5 = [39 x i8] c"%d aluno(s) tiraram nota acima de 5.0\0A\00"
@.str.6 = [45 x i8] c"N\C3\A3o h\C3\A1 nenhum aluno com nota acima de 5.0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
store i32 0, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 1, i32* %6
br label %9
9: ; preds = %26, %0
%10 = load i32, i32* %6
%11 = load i32, i32* %4
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %29
13: ; preds = %9
%14 = load i32, i32* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%17 = load float, float* %3
%18 = fcmp ogt float %17, 5.000000e+00
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %22
22: ; preds = %19, %13
%23 = load float, float* %3
%24 = load float, float* %2
%25 = fadd float %24, %23
store float %25, float* %2
br label %26
26: ; preds = %22
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %9
29: ; preds = %9
%30 = load float, float* %2
%31 = load i32, i32* %4
%32 = sitofp i32 %31 to float
%33 = fdiv float %30, %32
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), double %34)
%36 = load i32, i32* %5
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %29
%39 = load i32, i32* %5
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %39)
br label %43
41: ; preds = %29
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
br label %43
43: ; preds = %41, %38
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@.str = [32 x i8] c"Digite a quantidade de alunos: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"Digite a nota do %d\C2\B0 aluno: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [29 x i8] c"A m\C3\A9dia das notas \C3\A9: %.1f\0A\00"
@.str.5 = [39 x i8] c"%d aluno(s) tiraram nota acima de 5.0\0A\00"
@str = [44 x i8] c"N\C3\A3o h\C3\A1 nenhum aluno com nota acima de 5.0\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1
br i1 %8, label %23, label %9
9: ; preds = %0, %9
%10 = phi i32 [ %20, %9 ], [ 1, %0 ]
%11 = phi i32 [ %18, %9 ], [ 0, %0 ]
%12 = phi float [ %19, %9 ], [ 0.000000e+00, %0 ]
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%15 = load float, float* %1
%16 = fcmp ogt float %15, 5.000000e+00
%17 = zext i1 %16 to i32
%18 = add nuw nsw i32 %11, %17
%19 = fadd float %12, %15
%20 = add nuw nsw i32 %10, 1
%21 = load i32, i32* %2
%22 = icmp slt i32 %10, %21
br i1 %22, label %9, label %23
23: ; preds = %9, %0
%24 = phi float [ 0.000000e+00, %0 ], [ %19, %9 ]
%25 = phi i32 [ 0, %0 ], [ %18, %9 ]
%26 = phi i32 [ %7, %0 ], [ %21, %9 ]
%27 = sitofp i32 %26 to float
%28 = fdiv float %24, %27
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), double %29)
%31 = icmp eq i32 %25, 0
br i1 %31, label %34, label %32
32: ; preds = %23
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %25)
br label %36
34: ; preds = %23
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
ret i32 0
}