#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 *, float *);
int main() {
  char aluno;
  float media, nota1, nota2, trab, list1, list2, list3, list4, list5, somalist;
  printf("\nDiga a primeira nota:");
  scanf("%f", &nota1);
  printf("\nDiga a segunda nota:");
  scanf("%f", &nota2);
  printf("\nDigite a nota do seu trabalho:");
  scanf("%f", &trab);
  printf("\nDigite a nota da lista 1");
  scanf("%f", &list1);
  printf("\nDigite a nota da lista 2");
  scanf("%f", &list2);
  printf("\nDigite a nota da lista 3");
  scanf("%f", &list3);
  printf("\nDigite a nota da lista 4");
  scanf("%f", &list4);
  printf("\nDigite a nota da lista 5");
  scanf("%f", &list5);
  somalist = list1 + list2 + list3 + list4 + list5 / 5;
  media = 0.3 * nota1 + 0.4 * nota2 + 0.2 * somalist + 0.1 * trab;
  printf("\nSua média é %2.f", media);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe61(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe43(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe25(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm1
movss  0xde0(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xdb1(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd9d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movss  -0x30(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xd7c(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd5b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe30(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xefc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf05(%rip),%rbx
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xef4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeef(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xef4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xef3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xef2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xef1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xef0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
divss  0xdd9(%rip),%xmm1
addss  %xmm0,%xmm1
movss  0x1c(%rsp),%xmm0
movss  0x18(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  0xdc5(%rip),%xmm2
cvtss2sd %xmm0,%xmm0
mulsd  0xdc1(%rip),%xmm0
addsd  %xmm2,%xmm0
cvtss2sd %xmm1,%xmm1
mulsd  0xdb9(%rip),%xmm1
addsd  %xmm0,%xmm1
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xdab(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe72(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0ADiga a primeira nota:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [22 x i8] c"\0ADiga a segunda nota:\00"
@.str.3 = [32 x i8] c"\0ADigite a nota do seu trabalho:\00"
@.str.4 = [26 x i8] c"\0ADigite a nota da lista 1\00"
@.str.5 = [26 x i8] c"\0ADigite a nota da lista 2\00"
@.str.6 = [26 x i8] c"\0ADigite a nota da lista 3\00"
@.str.7 = [26 x i8] c"\0ADigite a nota da lista 4\00"
@.str.8 = [26 x i8] c"\0ADigite a nota da lista 5\00"
@.str.9 = [20 x i8] c"\0ASua m\C3\A9dia \C3\A9 %2.f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store i32 0, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %5)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %7)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %8)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %9)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %10)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %11)
%29 = load float, float* %7
%30 = load float, float* %8
%31 = fadd float %29, %30
%32 = load float, float* %9
%33 = fadd float %31, %32
%34 = load float, float* %10
%35 = fadd float %33, %34
%36 = load float, float* %11
%37 = fdiv float %36, 5.000000e+00
%38 = fadd float %35, %37
store float %38, float* %12
%39 = load float, float* %4
%40 = fpext float %39 to double
%41 = load float, float* %5
%42 = fpext float %41 to double
%43 = fmul double 4.000000e-01, %42
%44 = call double @llvm.fmuladd.f64(double 3.000000e-01, double %40, double %43)
%45 = load float, float* %12
%46 = fpext float %45 to double
%47 = call double @llvm.fmuladd.f64(double 2.000000e-01, double %46, double %44)
%48 = load float, float* %6
%49 = fpext float %48 to double
%50 = call double @llvm.fmuladd.f64(double 1.000000e-01, double %49, double %47)
%51 = fptrunc double %50 to float
store float %51, float* %3
%52 = load float, float* %3
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), double %53)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0ADiga a primeira nota:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [22 x i8] c"\0ADiga a segunda nota:\00"
@.str.3 = [32 x i8] c"\0ADigite a nota do seu trabalho:\00"
@.str.4 = [26 x i8] c"\0ADigite a nota da lista 1\00"
@.str.5 = [26 x i8] c"\0ADigite a nota da lista 2\00"
@.str.6 = [26 x i8] c"\0ADigite a nota da lista 3\00"
@.str.7 = [26 x i8] c"\0ADigite a nota da lista 4\00"
@.str.8 = [26 x i8] c"\0ADigite a nota da lista 5\00"
@.str.9 = [20 x i8] c"\0ASua m\C3\A9dia \C3\A9 %2.f\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = bitcast float* %1 to i8*
%10 = bitcast float* %2 to i8*
%11 = bitcast float* %3 to i8*
%12 = bitcast float* %4 to i8*
%13 = bitcast float* %5 to i8*
%14 = bitcast float* %6 to i8*
%15 = bitcast float* %7 to i8*
%16 = bitcast float* %8 to i8*
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %5)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %7)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %8)
%33 = load float, float* %4
%34 = load float, float* %5
%35 = fadd float %33, %34
%36 = load float, float* %6
%37 = fadd float %35, %36
%38 = load float, float* %7
%39 = fadd float %37, %38
%40 = load float, float* %8
%41 = fdiv float %40, 5.000000e+00
%42 = fadd float %39, %41
%43 = load float, float* %1
%44 = fpext float %43 to double
%45 = load float, float* %2
%46 = fpext float %45 to double
%47 = fmul double %46, 4.000000e-01
%48 = call double @llvm.fmuladd.f64(double %44, double 3.000000e-01, double %47)
%49 = fpext float %42 to double
%50 = call double @llvm.fmuladd.f64(double %49, double 2.000000e-01, double %48)
%51 = load float, float* %3
%52 = fpext float %51 to double
%53 = call double @llvm.fmuladd.f64(double %52, double 1.000000e-01, double %50)
%54 = fptrunc double %53 to float
%55 = fpext float %54 to double
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), double %55)
ret i32 0
}