#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, ...);
int /*<<< orphan*/ scanf(char *, float *);
int /*<<< orphan*/ system(char *);
int main() {
  int i, j, aprovados = 0, reprovados = 0;
  float mat[40][4], media, acumulador;
  for (i = 0; i < 40; i++) {
    acumulador = 0;
    for (j = 0; j < 4; j++) {
      printf("Digite a nota do aluno %d, na prova %d: ", (i + 1), (j + 1));
      scanf("%f", &mat[i][j]);
      acumulador = (acumulador + mat[i][j]);
    }
    media = ((float)(acumulador / 4));
    printf("\nMédia do aluno %d: %.2f", (i + 1), media);
    if (media >= 6.0) {
      printf("\nAluno %d APROVADO!!!\n\n", (i + 1));
      aprovados++;
    } else {
      printf("\nAluno %d REPROVADO!!!\n\n", (i + 1));
      reprovados++;
    }
  }
  printf("\nO total de alunos aprovados foi: %d, e de reprovados foi: %d.\n\n",
         aprovados, reprovados);
  system("pause");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x28,-0x8(%rbp)
jge    12a5 <main+0x175>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2a8(%rbp)
ff
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11f9 <main+0xc9>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x2a0(%rbp),%rsi
shl    $0x4,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7a(%rip),%rdi
call   1050 <scanf@plt>
movss  -0x2a8(%rbp),%xmm0
ff
movslq -0x8(%rbp),%rcx
lea    -0x2a0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x2a8(%rbp)
ff
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1173 <main+0x43>
movss  -0x2a8(%rbp),%xmm0
movss  0xdff(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x2a4(%rbp)
ff
mov    -0x8(%rbp),%esi
add    $0x1,%esi
movss  -0x2a4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xe0a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x2a4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xdb7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1275 <main+0x145>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1292 <main+0x162>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1297 <main+0x167>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1157 <main+0x27>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe04(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x2b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x298,%rsp
mov    $0x1,%ebx
lea    0xebf(%rip),%r14
lea    0xee1(%rip),%r15
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebp,%ebp
jmp    1188 <main+0x58>
xchg   %ax,%ax
lea    0xf03(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r13d
add    $0x10,%r12
add    $0x1,%ebx
cmp    $0x280,%r12
je     12a1 <main+0x171>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%r12,1),%rsi
add    $0x10,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
movss  0x10(%rsp,%r12,1),%xmm0
addss  0xe50(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%r12,1),%rsi
add    $0x14,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x14(%rsp,%r12,1),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%r12,1),%rsi
add    $0x18,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x18(%rsp,%r12,1),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%r12,1),%rsi
add    $0x1c,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x1c(%rsp,%r12,1),%xmm0
mulss  0xda4(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xdcb(%rip),%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xd81(%rip),%xmm0
jb     1160 <main+0x30>
lea    0xdc2(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
jmp    1174 <main+0x44>
lea    0xddb(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe09(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x298,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Digite a nota do aluno %d, na prova %d: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [26 x i8] c"\0AM\C3\A9dia do aluno %d: %.2f\00"
@.str.3 = [24 x i8] c"\0AAluno %d APROVADO!!!\0A\0A\00"
@.str.4 = [25 x i8] c"\0AAluno %d REPROVADO!!!\0A\0A\00"
@.str.5 = [65 x i8] c"\0AO total de alunos aprovados foi: %d, e de reprovados foi: %d.\0A\0A\00"
@.str.6 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [40 x [4 x float]]
%7 = alloca float
%8 = alloca float
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %2
br label %9
9: ; preds = %65, %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 40
br i1 %11, label %12, label %68
12: ; preds = %9
store float 0.000000e+00, float* %8
store i32 0, i32* %3
br label %13
13: ; preds = %38, %12
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 4
br i1 %15, label %16, label %41
16: ; preds = %13
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %20)
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [40 x [4 x float]], [40 x [4 x float]]* %6, i64 0, i64 %23
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [4 x float], [4 x float]* %24, i64 0, i64 %26
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %27)
%29 = load float, float* %8
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [40 x [4 x float]], [40 x [4 x float]]* %6, i64 0, i64 %31
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [4 x float], [4 x float]* %32, i64 0, i64 %34
%36 = load float, float* %35
%37 = fadd float %29, %36
store float %37, float* %8
br label %38
38: ; preds = %16
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %13
41: ; preds = %13
%42 = load float, float* %8
%43 = fdiv float %42, 4.000000e+00
store float %43, float* %7
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
%46 = load float, float* %7
%47 = fpext float %46 to double
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %45, double %47)
%49 = load float, float* %7
%50 = fpext float %49 to double
%51 = fcmp oge double %50, 6.000000e+00
br i1 %51, label %52, label %58
52: ; preds = %41
%53 = load i32, i32* %2
%54 = add nsw i32 %53, 1
%55 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
br label %64
58: ; preds = %41
%59 = load i32, i32* %2
%60 = add nsw i32 %59, 1
%61 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %5
%63 = add nsw i32 %62, 1
store i32 %63, i32* %5
br label %64
64: ; preds = %58, %52
br label %65
65: ; preds = %64
%66 = load i32, i32* %2
%67 = add nsw i32 %66, 1
store i32 %67, i32* %2
br label %9
68: ; preds = %9
%69 = load i32, i32* %4
%70 = load i32, i32* %5
%71 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.5, i64 0, i64 0), i32 %69, i32 %70)
%72 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"Digite a nota do aluno %d, na prova %d: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [26 x i8] c"\0AM\C3\A9dia do aluno %d: %.2f\00"
@.str.3 = [24 x i8] c"\0AAluno %d APROVADO!!!\0A\0A\00"
@.str.4 = [25 x i8] c"\0AAluno %d REPROVADO!!!\0A\0A\00"
@.str.5 = [65 x i8] c"\0AO total de alunos aprovados foi: %d, e de reprovados foi: %d.\0A\0A\00"
@.str.6 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca [40 x [4 x float]]
%2 = bitcast [40 x [4 x float]]* %1 to i8*
br label %3
3: ; preds = %0, %39
%4 = phi i64 [ 0, %0 ], [ %7, %39 ]
%5 = phi i32 [ 0, %0 ], [ %41, %39 ]
%6 = phi i32 [ 0, %0 ], [ %40, %39 ]
%7 = add nuw nsw i64 %4, 1
%8 = trunc i64 %7 to i32
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %8, i32 1)
%10 = getelementptr inbounds [40 x [4 x float]], [40 x [4 x float]]* %1, i64 0, i64 %4, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %10)
%12 = load float, float* %10
%13 = fadd float %12, 0.000000e+00
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %8, i32 2)
%15 = getelementptr inbounds [40 x [4 x float]], [40 x [4 x float]]* %1, i64 0, i64 %4, i64 1
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %15)
%17 = load float, float* %15
%18 = fadd float %13, %17
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %8, i32 3)
%20 = getelementptr inbounds [40 x [4 x float]], [40 x [4 x float]]* %1, i64 0, i64 %4, i64 2
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %20)
%22 = load float, float* %20
%23 = fadd float %18, %22
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %8, i32 4)
%25 = getelementptr inbounds [40 x [4 x float]], [40 x [4 x float]]* %1, i64 0, i64 %4, i64 3
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %25)
%27 = load float, float* %25
%28 = fadd float %23, %27
%29 = fmul float %28, 2.500000e-01
%30 = fpext float %29 to double
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %8, double %30)
%32 = fcmp ult float %29, 6.000000e+00
br i1 %32, label %36, label %33
33: ; preds = %3
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%35 = add nsw i32 %6, 1
br label %39
36: ; preds = %3
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%38 = add nsw i32 %5, 1
br label %39
39: ; preds = %33, %36
%40 = phi i32 [ %35, %33 ], [ %6, %36 ]
%41 = phi i32 [ %5, %33 ], [ %38, %36 ]
%42 = icmp eq i64 %7, 40
br i1 %42, label %43, label %3
43: ; preds = %39
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.5, i64 0, i64 0), i32 %40, i32 %41)
%45 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}