#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*/ validar(float *);
int main() {
  float lab, avaliacao, exame;
  printf("Entre com a nota do trabalho de laboratorio: ");
  validar(&lab);
  printf("Entre com a nota da avaliação bimestral: ");
  validar(&avaliacao);
  printf("Entre com a nota do exame final: ");
  validar(&exame);
  float media = (lab * 2 + avaliacao * 3 + exame * 5) / (2 + 3 + 5);
  printf((media < 3)   ? "\nAluno reprovado.\n"
         : (media < 5) ? "\nAluno em recuperação\n"
                       : "\nAluno aprovado\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed6(%rip),%rdi
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1030 <validar@plt>
lea    0xeef(%rip),%rdi
call   1040 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1030 <validar@plt>
lea    0xf06(%rip),%rdi
call   1040 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1030 <validar@plt>
movss  -0x8(%rbp),%xmm1
movss  0xe85(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
addss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
movss  0xe73(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xe5f(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe4a(%rip),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    11d0 <main+0xb0>
lea    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11f6 <main+0xd6>
movss  -0x14(%rbp),%xmm1
movss  0xe2b(%rip),%xmm0
lea    0xed0(%rip),%rax
lea    0xeb0(%rip),%rcx
ucomiss %xmm1,%xmm0
cmova  %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee1(%rip),%rdi
call   1040 <printf@plt>
lea    0x14(%rsp),%rdi
call   1030 <validar@plt>
lea    0xef9(%rip),%rdi
call   1040 <printf@plt>
lea    0x10(%rsp),%rdi
call   1030 <validar@plt>
lea    0xf0f(%rip),%rdi
call   1040 <printf@plt>
lea    0xc(%rsp),%rdi
call   1030 <validar@plt>
movss  0x14(%rsp),%xmm0
movss  0xe8c(%rip),%xmm1
movss  0x10(%rsp),%xmm2
mulss  %xmm1,%xmm2
addss  %xmm0,%xmm0
addss  %xmm2,%xmm0
movss  0xe76(%rip),%xmm2
movss  0xc(%rsp),%xmm3
mulss  %xmm2,%xmm3
addss  %xmm0,%xmm3
divss  0xe64(%rip),%xmm3
ucomiss %xmm3,%xmm2
lea    0xeed(%rip),%rax
lea    0xeff(%rip),%rcx
cmova  %rax,%rcx
ucomiss %xmm3,%xmm1
lea    0xec5(%rip),%rdi
cmovbe %rcx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Entre com a nota do trabalho de laboratorio: \00"
@.str.1 = [44 x i8] c"Entre com a nota da avalia\C3\A7\C3\A3o bimestral: \00"
@.str.2 = [34 x i8] c"Entre com a nota do exame final: \00"
@.str.3 = [19 x i8] c"\0AAluno reprovado.\0A\00"
@.str.4 = [25 x i8] c"\0AAluno em recupera\C3\A7\C3\A3o\0A\00"
@.str.5 = [17 x i8] c"\0AAluno aprovado\0A\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 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @validar(float* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @validar(float* %3)
%10 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @validar(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* %5
%20 = fcmp olt float %19, 3.000000e+00
br i1 %20, label %21, label %22
21: ; preds = %0
br label %27
22: ; preds = %0
%23 = load float, float* %5
%24 = fcmp olt float %23, 5.000000e+00
%25 = zext i1 %24 to i64
%26 = select i1 %24, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0)
br label %27
27: ; preds = %22, %21
%28 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), %21 ], [ %26, %22 ]
%29 = call i32 @printf(i8* %28)
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [46 x i8] c"Entre com a nota do trabalho de laboratorio: \00"
@.str.1 = [44 x i8] c"Entre com a nota da avalia\C3\A7\C3\A3o bimestral: \00"
@.str.2 = [34 x i8] c"Entre com a nota do exame final: \00"
@.str.3 = [19 x i8] c"\0AAluno reprovado.\0A\00"
@.str.4 = [25 x i8] c"\0AAluno em recupera\C3\A7\C3\A3o\0A\00"
@.str.5 = [17 x i8] c"\0AAluno aprovado\0A\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 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @validar(float* %1)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @validar(float* %2)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @validar(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 %19, 3.000000e+00
%21 = fcmp olt float %19, 5.000000e+00
%22 = select i1 %21, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0)
%23 = select i1 %20, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %22
%24 = call i32 @printf(i8* dereferenceable(1) %23)
ret i32 0
}