#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*/ newLine(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
void exercicio2() {
  printf("Exercicio 2:");
  newLine(1);
  float n1, n2, n3, res;
  printf("Nota 1: ");
  scanf("%f", &n1);
  printf("Nota 2: ");
  scanf("%f", &n2);
  printf("Nota 3: ");
  scanf("%f", &n3);
  res = (n1 * 1 + n2 * 2 + n3 * 3) / 6;
  if (res >= 7) {
    printf("Nota Final: %f -> Aprovado", res);
  } else if (res > 5 && res < 7) {
    printf("Nota Final: %f -> Recuperacao", res);
  } else {
    printf("Nota Final: %f -> Reprovado", res);
  }
  newLine(2);
}


x86 assembly (clang, -O0):
<exercicio2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <newLine@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x4(%rbp),%xmm1
movss  0xe55(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
movss  0xe3b(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xe27(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe0d(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1218 <exercicio2+0xe8>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe33(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1278 <exercicio2+0x148>
movss  -0x10(%rbp),%xmm0
movss  0xdeb(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    125c <exercicio2+0x12c>
movss  0xdca(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    125c <exercicio2+0x12c>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1273 <exercicio2+0x143>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1278 <exercicio2+0x148>
mov    $0x2,%edi
call   1030 <newLine@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exercicio2>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <newLine@plt>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
addss  %xmm0,%xmm0
addss  0xc(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
mulss  0xe3d(%rip),%xmm1
addss  %xmm0,%xmm1
divss  0xe35(%rip),%xmm1
ucomiss 0xe32(%rip),%xmm1
jae    11fe <exercicio2+0xce>
ucomiss 0xe2d(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
jbe    120e <exercicio2+0xde>
movss  0xe18(%rip),%xmm2
ucomiss %xmm1,%xmm2
jbe    120e <exercicio2+0xde>
lea    0xe5a(%rip),%rdi
jmp    1215 <exercicio2+0xe5>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe2f(%rip),%rdi
jmp    1215 <exercicio2+0xe5>
lea    0xe5f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x2,%edi
call   1030 <newLine@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Exercicio 2:\00"
@.str.1 = [9 x i8] c"Nota 1: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [9 x i8] c"Nota 2: \00"
@.str.4 = [9 x i8] c"Nota 3: \00"
@.str.5 = [27 x i8] c"Nota Final: %f -> Aprovado\00"
@.str.6 = [30 x i8] c"Nota Final: %f -> Recuperacao\00"
@.str.7 = [28 x i8] c"Nota Final: %f -> Reprovado\00"
define void @exercicio2() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @newLine(i32 1)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%13 = load float, float* %1
%14 = load float, float* %2
%15 = fmul float %14, 2.000000e+00
%16 = call float @llvm.fmuladd.f32(float %13, float 1.000000e+00, float %15)
%17 = load float, float* %3
%18 = call float @llvm.fmuladd.f32(float %17, float 3.000000e+00, float %16)
%19 = fdiv float %18, 6.000000e+00
store float %19, float* %4
%20 = load float, float* %4
%21 = fcmp oge float %20, 7.000000e+00
br i1 %21, label %22, label %26
22: ; preds = %0
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), double %24)
br label %41
26: ; preds = %0
%27 = load float, float* %4
%28 = fcmp ogt float %27, 5.000000e+00
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load float, float* %4
%31 = fcmp olt float %30, 7.000000e+00
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load float, float* %4
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), double %34)
br label %40
36: ; preds = %29, %26
%37 = load float, float* %4
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), double %38)
br label %40
40: ; preds = %36, %32
br label %41
41: ; preds = %40, %22
%42 = call i32 @newLine(i32 2)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Exercicio 2:\00"
@.str.1 = [9 x i8] c"Nota 1: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [9 x i8] c"Nota 2: \00"
@.str.4 = [9 x i8] c"Nota 3: \00"
@.str.5 = [27 x i8] c"Nota Final: %f -> Aprovado\00"
@.str.6 = [30 x i8] c"Nota Final: %f -> Recuperacao\00"
@.str.7 = [28 x i8] c"Nota Final: %f -> Reprovado\00"
define void @exercicio2() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @newLine(i32 1)
%6 = bitcast float* %1 to i8*
%7 = bitcast float* %2 to i8*
%8 = bitcast float* %3 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%15 = load float, float* %1
%16 = load float, float* %2
%17 = fmul float %16, 2.000000e+00
%18 = fadd float %15, %17
%19 = load float, float* %3
%20 = call float @llvm.fmuladd.f32(float %19, float 3.000000e+00, float %18)
%21 = fdiv float %20, 6.000000e+00
%22 = fcmp ult float %21, 7.000000e+00
br i1 %22, label %26, label %23
23: ; preds = %0
%24 = fpext float %21 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), double %24)
br label %35
26: ; preds = %0
%27 = fcmp ogt float %21, 5.000000e+00
%28 = fcmp olt float %21, 7.000000e+00
%29 = and i1 %27, %28
%30 = fpext float %21 to double
br i1 %29, label %31, label %33
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), double %30)
br label %35
33: ; preds = %26
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), double %30)
br label %35
35: ; preds = %31, %33, %23
%36 = call i32 @newLine(i32 2)
ret void
}