#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() {
  float nota1, nota2, nota3, media;
  printf("Nota do Trabalho de laboratorio: ");
  scanf("%f", &nota1);
  printf("Nota da Avalição semestral: ");
  scanf("%f", &nota2);
  printf("Nota do Exame Final: ");
  scanf("%f", &nota3);
  media = (nota1 * 2 + nota2 * 3 + nota3 * 5) / (2 + 3 + 5);
  if (nota1 < 0.0 || nota1 > 10.0) {
    printf("Nota %.2f inválida. Programa encerrado!", nota1);
  } else if (nota2 < 0.0 || nota2 > 10.0) {
    printf("Nota %.2f inválida. Programa encerrado!", nota2);
  } else if (nota3 < 0.0 || nota3 > 10.0) {
    printf("Nota %.2f inválida. Programa encerrado!", nota2);
  } else {
    if (media <= 2.9) {
      printf("Aluno reprovado! Media: %.2f", media);
    } else if (media >= 3.0 && media <= 4.9) {
      printf("Aluno de recuperação! Media %.2f", media);
    } else {
      printf("Aluno Aprovado! Media %.2f", media);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0e(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm1
movss  0xe72(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
addss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
movss  0xe54(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xe40(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     11fa <main+0xda>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe20(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1216 <main+0xf6>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe80(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1364 <main+0x244>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     1247 <main+0x127>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdd3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1263 <main+0x143>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe33(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    135f <main+0x23f>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     1294 <main+0x174>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd86(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12b0 <main+0x190>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    135a <main+0x23a>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd57(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     12e7 <main+0x1c7>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1355 <main+0x235>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd28(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1339 <main+0x219>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd15(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1339 <main+0x219>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xda3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1350 <main+0x230>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdaa(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1355 <main+0x235>
jmp    135a <main+0x23a>
jmp    135f <main+0x23f>
jmp    1364 <main+0x244>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xef4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf08(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xef7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xefb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     1223 <main+0x103>
ucomiss 0xe72(%rip),%xmm0
ja     1223 <main+0x103>
movss  0x8(%rsp),%xmm1
xorps  %xmm2,%xmm2
ucomiss %xmm1,%xmm2
ja     1229 <main+0x109>
ucomiss 0xe57(%rip),%xmm1
ja     1229 <main+0x109>
movss  0x4(%rsp),%xmm2
xorps  %xmm3,%xmm3
ucomiss %xmm2,%xmm3
ja     1229 <main+0x109>
ucomiss 0xe40(%rip),%xmm2
ja     1229 <main+0x109>
mulss  0xe2e(%rip),%xmm1
addss  %xmm0,%xmm0
mulss  0xe26(%rip),%xmm2
addss  %xmm1,%xmm0
addss  %xmm0,%xmm2
divss  0xe1a(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
movsd  0xe13(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1246 <main+0x126>
ucomiss 0xdf6(%rip),%xmm2
jb     124f <main+0x12f>
movsd  0xe04(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     124f <main+0x12f>
lea    0xe9f(%rip),%rdi
jmp    1237 <main+0x117>
cvtss2sd %xmm0,%xmm0
jmp    1230 <main+0x110>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe43(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe56(%rip),%rdi
jmp    1237 <main+0x117>
lea    0xe8d(%rip),%rdi
jmp    1237 <main+0x117>

LLVM IR (-O0):
@.str = [34 x i8] c"Nota do Trabalho de laboratorio: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [31 x i8] c"Nota da Avali\C3\A7\C3\A3o semestral: \00"
@.str.3 = [22 x i8] c"Nota do Exame Final: \00"
@.str.4 = [41 x i8] c"Nota %.2f inv\C3\A1lida. Programa encerrado!\00"
@.str.5 = [29 x i8] c"Aluno reprovado! Media: %.2f\00"
@.str.6 = [35 x i8] c"Aluno de recupera\C3\A7\C3\A3o! Media %.2f\00"
@.str.7 = [27 x i8] c"Aluno Aprovado! Media %.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%12 = load float, float* %2
%13 = load float, float* %3
%14 = fmul float %13, 3.000000e+00
%15 = call float @llvm.fmuladd.f32(float %12, float 2.000000e+00, float %14)
%16 = load float, float* %4
%17 = call float @llvm.fmuladd.f32(float %16, float 5.000000e+00, float %15)
%18 = fdiv float %17, 1.000000e+01
store float %18, float* %5
%19 = load float, float* %2
%20 = fpext float %19 to double
%21 = fcmp olt double %20, 0.000000e+00
br i1 %21, label %26, label %22
22: ; preds = %0
%23 = load float, float* %2
%24 = fpext float %23 to double
%25 = fcmp ogt double %24, 1.000000e+01
br i1 %25, label %26, label %30
26: ; preds = %22, %0
%27 = load float, float* %2
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), double %28)
br label %82
30: ; preds = %22
%31 = load float, float* %3
%32 = fpext float %31 to double
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load float, float* %3
%36 = fpext float %35 to double
%37 = fcmp ogt double %36, 1.000000e+01
br i1 %37, label %38, label %42
38: ; preds = %34, %30
%39 = load float, float* %3
%40 = fpext float %39 to double
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), double %40)
br label %81
42: ; preds = %34
%43 = load float, float* %4
%44 = fpext float %43 to double
%45 = fcmp olt double %44, 0.000000e+00
br i1 %45, label %50, label %46
46: ; preds = %42
%47 = load float, float* %4
%48 = fpext float %47 to double
%49 = fcmp ogt double %48, 1.000000e+01
br i1 %49, label %50, label %54
50: ; preds = %46, %42
%51 = load float, float* %3
%52 = fpext float %51 to double
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), double %52)
br label %80
54: ; preds = %46
%55 = load float, float* %5
%56 = fpext float %55 to double
%57 = fcmp ole double %56, 2.900000e+00
br i1 %57, label %58, label %62
58: ; preds = %54
%59 = load float, float* %5
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), double %60)
br label %79
62: ; preds = %54
%63 = load float, float* %5
%64 = fpext float %63 to double
%65 = fcmp oge double %64, 3.000000e+00
br i1 %65, label %66, label %74
66: ; preds = %62
%67 = load float, float* %5
%68 = fpext float %67 to double
%69 = fcmp ole double %68, 4.900000e+00
br i1 %69, label %70, label %74
70: ; preds = %66
%71 = load float, float* %5
%72 = fpext float %71 to double
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), double %72)
br label %78
74: ; preds = %66, %62
%75 = load float, float* %5
%76 = fpext float %75 to double
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), double %76)
br label %78
78: ; preds = %74, %70
br label %79
79: ; preds = %78, %58
br label %80
80: ; preds = %79, %50
br label %81
81: ; preds = %80, %38
br label %82
82: ; preds = %81, %26
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"Nota do Trabalho de laboratorio: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [31 x i8] c"Nota da Avali\C3\A7\C3\A3o semestral: \00"
@.str.3 = [22 x i8] c"Nota do Exame Final: \00"
@.str.4 = [41 x i8] c"Nota %.2f inv\C3\A1lida. Programa encerrado!\00"
@.str.5 = [29 x i8] c"Aluno reprovado! Media: %.2f\00"
@.str.6 = [35 x i8] c"Aluno de recupera\C3\A7\C3\A3o! Media %.2f\00"
@.str.7 = [27 x i8] c"Aluno Aprovado! Media %.2f\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%13 = load float, float* %1
%14 = load float, float* %2
%15 = fmul float %14, 3.000000e+00
%16 = call float @llvm.fmuladd.f32(float %13, float 2.000000e+00, float %15)
%17 = load float, float* %3
%18 = call float @llvm.fmuladd.f32(float %17, float 5.000000e+00, float %16)
%19 = fdiv float %18, 1.000000e+01
%20 = fcmp olt float %13, 0.000000e+00
%21 = fcmp ogt float %13, 1.000000e+01
%22 = or i1 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %0
%24 = fpext float %13 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), double %24)
br label %53
26: ; preds = %0
%27 = fcmp olt float %14, 0.000000e+00
%28 = fcmp ogt float %14, 1.000000e+01
%29 = or i1 %27, %28
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = fpext float %14 to double
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), double %31)
br label %53
33: ; preds = %26
%34 = fcmp olt float %17, 0.000000e+00
%35 = fcmp ogt float %17, 1.000000e+01
%36 = or i1 %34, %35
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = fpext float %14 to double
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), double %38)
br label %53
40: ; preds = %33
%41 = fpext float %19 to double
%42 = fcmp ugt double %41, 2.900000e+00
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), double %41)
br label %53
45: ; preds = %40
%46 = fcmp ult float %19, 3.000000e+00
%47 = fcmp ugt double %41, 4.900000e+00
%48 = or i1 %46, %47
br i1 %48, label %51, label %49
49: ; preds = %45
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), double %41)
br label %53
51: ; preds = %45
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), double %41)
br label %53
53: ; preds = %30, %43, %51, %49, %37, %23
ret i32 0
}