#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 *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int i, j, total = 0, notas[40][4];
  float media;
  for (i = 0; i < 40; i++) {
    for (j = 0; j < 4; j++) {
      printf("Digite a %d nota do aluno %d: ", (j + 1), (i + 1));
      scanf("%d", &notas[i][j]);
    }
  }
  for (i = 0; i < 40; i++, total = 0) {
    for (j = 0; j < 4; j++) {
      total = total + notas[i][j];
    }
    media = ((float)total / 4);
    printf("Média do aluno %d é: %.2f!\n", (i + 1), media);
    if (media >= 6) {
      printf("Aluno %d APROVADO!!!\n\n", (i + 1));
    } else {
      printf("Aluno %d REPROVADO!!!\n\n", (i + 1));
    }
  }
  system("pause");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2a0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x28,-0x8(%rbp)
jge    11cf <main+0x9f>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11bc <main+0x8c>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x290(%rbp),%rsi
shl    $0x4,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7e(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <main+0x31>
jmp    11c1 <main+0x91>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <main+0x20>
movl   $0x0,-0x8(%rbp)
cmpl   $0x28,-0x8(%rbp)
jge    12b7 <main+0x187>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    121e <main+0xee>
mov    -0x10(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    -0x290(%rbp),%rcx
shl    $0x4,%rdx
add    %rdx,%rcx
movslq -0xc(%rbp),%rdx
add    (%rcx,%rdx,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e7 <main+0xb7>
cvtsi2ssl -0x10(%rbp),%xmm0
movss  0xdd9(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x294(%rbp)
ff
mov    -0x8(%rbp),%esi
add    $0x1,%esi
movss  -0x294(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xdda(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x294(%rbp),%xmm0
ff
movss  0xd99(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1289 <main+0x159>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    129d <main+0x16d>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a2 <main+0x172>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    11d6 <main+0xa6>
lea    0xdb9(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x2a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x290,%rsp
lea    0x10(%rsp),%rbx
mov    $0xffffffffffffffd8,%r12
lea    0xeb6(%rip),%r14
lea    0xece(%rip),%r15
nopl   0x0(%rax)
lea    0x29(%r12),%ebp
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rbx),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rbx),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rbx),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
add    $0x10,%rbx
inc    %r12
jne    1160 <main+0x30>
mov    $0x1,%ebx
lea    0xe39(%rip),%r14
lea    0xe67(%rip),%r15
lea    0xe49(%rip),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movdqa 0x10(%rsp,%rbp,1),%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
cvtdq2ps %xmm0,%xmm0
mulss  0xdcd(%rip),%xmm0
movaps %xmm0,(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movaps (%rsp),%xmm0
ucomiss 0xdb2(%rip),%xmm0
mov    %r12,%rdi
cmovb  %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rbp
add    $0x1,%ebx
cmp    $0x280,%rbp
jne    1210 <main+0xe0>
lea    0xdfe(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x290,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [31 x i8] c"Digite a %d nota do aluno %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"M\C3\A9dia do aluno %d \C3\A9: %.2f!\0A\00"
@.str.3 = [23 x i8] c"Aluno %d APROVADO!!!\0A\0A\00"
@.str.4 = [24 x i8] c"Aluno %d REPROVADO!!!\0A\0A\00"
@.str.5 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca [40 x [4 x i32]]
%2 = bitcast [40 x [4 x i32]]* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %5, %3 ]
%5 = add nuw nsw i64 %4, 1
%6 = trunc i64 %5 to i32
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 1, i32 %6)
%8 = getelementptr inbounds [40 x [4 x i32]], [40 x [4 x i32]]* %1, i64 0, i64 %4, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 2, i32 %6)
%11 = getelementptr inbounds [40 x [4 x i32]], [40 x [4 x i32]]* %1, i64 0, i64 %4, i64 1
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 3, i32 %6)
%14 = getelementptr inbounds [40 x [4 x i32]], [40 x [4 x i32]]* %1, i64 0, i64 %4, i64 2
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 4, i32 %6)
%17 = getelementptr inbounds [40 x [4 x i32]], [40 x [4 x i32]]* %1, i64 0, i64 %4, i64 3
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
%19 = icmp eq i64 %5, 40
br i1 %19, label %20, label %3
20: ; preds = %3, %20
%21 = phi i64 [ %28, %20 ], [ 0, %3 ]
%22 = getelementptr inbounds [40 x [4 x i32]], [40 x [4 x i32]]* %1, i64 0, i64 %21, i64 0
%23 = bitcast i32* %22 to <4 x i32>*
%24 = load <4 x i32>, <4 x i32>* %23
%25 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %24)
%26 = sitofp i32 %25 to float
%27 = fmul float %26, 2.500000e-01
%28 = add nuw nsw i64 %21, 1
%29 = fpext float %27 to double
%30 = trunc i64 %28 to i32
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %30, double %29)
%32 = fcmp ult float %27, 6.000000e+00
%33 = select i1 %32, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0)
%34 = call i32 (i8*, i32, ...) @printf(i8* %33, i32 %30)
%35 = icmp eq i64 %28, 40
br i1 %35, label %36, label %20
36: ; preds = %20
%37 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}