#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 main() {
  int apols[5], apolsTotal = 0;
  for (int i = 0; i < 5; i++) {
    printf("Digite a sua nota da apol %d\n", i + 1);
    scanf("%d", &apols[i]);
    apolsTotal += apols[i];
  }
  printf("Total: %d\n", apolsTotal);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    1190 <main+0x70>
mov    -0x28(%rbp),%esi
add    $0x1,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
movslq -0x28(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeaf(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    113d <main+0x1d>
mov    -0x24(%rbp),%esi
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xed0(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xeda(%rip),%r15
mov    %rsp,%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%ebx
mov    %r14,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
add    0x4(%rsp),%ebx
mov    %r14,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
add    0x8(%rsp),%ebx
mov    %r14,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
add    0xc(%rsp),%ebx
mov    %r14,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
add    0x10(%rsp),%ebx
lea    0xe50(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Digite a sua nota da apol %d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"Total: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %22, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %25
8: ; preds = %5
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 1
%11 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = load i32, i32* %3
%21 = add nsw i32 %20, %19
store i32 %21, i32* %3
br label %22
22: ; preds = %8
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %5
25: ; preds = %5
%26 = load i32, i32* %3
%27 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [30 x i8] c"Digite a sua nota da apol %d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"Total: %d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 2)
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = load i32, i32* %8
%11 = add nsw i32 %10, %6
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 3)
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = load i32, i32* %13
%16 = add nsw i32 %15, %11
%17 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 4)
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = load i32, i32* %18
%21 = add nsw i32 %20, %16
%22 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 5)
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %23)
%25 = load i32, i32* %23
%26 = add nsw i32 %25, %21
%27 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %26)
ret i32 0
}