#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*/ LC_ALL;
int /*<<< orphan*/ printf(char *, float, ...);
int /*<<< orphan*/ scanf(char *, float *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main() {
  setlocale(LC_ALL, "");
  float nota[4], soma = 0, media = 0;
  int i = 0;
  for (i = 0; i < 4; i++) {
    printf("Insira a nota[%d]: ", i);
    scanf("%f", &nota[i]);
    soma += nota[i];
  }
  media = soma / 4;
  printf("A média das notas [%.2f, %.2f, %.2f, %.2f] é: %f\n", nota[0], nota[1],
         nota[2], nota[3], media);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeff(%rip),%rsi
call   1040 <setlocale@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x2c(%rbp)
jge    11cc <main+0x9c>
cvtsi2ssl -0x2c(%rbp),%xmm0
lea    0xe7c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movslq -0x2c(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe73(%rip),%rdi
call   1050 <scanf@plt>
movslq -0x2c(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1172 <main+0x42>
movss  -0x24(%rbp),%xmm0
movss  0xe27(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x18(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x14(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0x28(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
lea    0xe09(%rip),%rdi
mov    $0x5,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xf13(%rip),%rsi
call   1040 <setlocale@plt>
lea    0xebd(%rip),%r14
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
xorps  %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0xe69(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0xe3c(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x18(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0xe0f(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x1c(%rsp),%xmm3
movss  0xc(%rsp),%xmm0
addss  %xmm3,%xmm0
mulss  0xde4(%rip),%xmm0
movaps %xmm0,%xmm4
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x18(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
cvtss2sd %xmm3,%xmm3
cvtss2sd %xmm4,%xmm4
lea    0xdd3(%rip),%rdi
mov    $0x5,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [20 x i8] c"Insira a nota[%d]: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [52 x i8] c"A m\C3\A9dia das notas [%.2f, %.2f, %.2f, %.2f] \C3\A9: %f\0A\00"
define i32 @main() {
%1 = alloca [4 x float]
%2 = load i32, i32* @LC_ALL
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [4 x float]* %1 to i8*
%5 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float 0.000000e+00)
%6 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %6)
%8 = load float, float* %6
%9 = fadd float %8, 0.000000e+00
%10 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float 1.000000e+00)
%11 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 1
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %11)
%13 = load float, float* %11
%14 = fadd float %9, %13
%15 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float 2.000000e+00)
%16 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 2
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %16)
%18 = load float, float* %16
%19 = fadd float %14, %18
%20 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float 3.000000e+00)
%21 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 3
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %21)
%23 = load float, float* %21
%24 = fadd float %19, %23
%25 = fmul float %24, 2.500000e-01
%26 = load float, float* %6
%27 = load float, float* %11
%28 = fpext float %27 to double
%29 = load float, float* %16
%30 = fpext float %29 to double
%31 = fpext float %23 to double
%32 = fpext float %25 to double
%33 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), float %26, double %28, double %30, double %31, double %32)
ret i32 0
}