#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(void) {
  float ma, n1, n2, n3, me;
  char conceito;
  printf("Digite a nota da primeira prova: ");
  scanf("%f", &n1);
  printf("\nDigite a nota da segunda prova: ");
  scanf("%f", &n2);
  printf("\nDigite a nota da terceira prova: ");
  scanf("%f", &n3);
  printf("\nDigite a nota da média de exercícios: ");
  scanf("%f", &me);
  ma = (n1 + n2 * 2 + n3 * 3 + me) / 7;
  if (ma >= 9.0f)
    conceito = 'A';
  else if (ma >= 7.5f && ma < 9.0f)
    conceito = 'B';
  else if (ma >= 6.0f && ma < 7.5f)
    conceito = 'C';
  else if (ma >= 4.0f && ma < 6.0f)
    conceito = 'D';
  else
    conceito = 'E';
  printf("\nConceito: %c\n", conceito);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
addss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
movss  0xe42(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x18(%rbp),%xmm0
movss  0xe29(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe0f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1203 <main+0xe3>
movb   $0x41,-0x19(%rbp)
jmp    12a9 <main+0x189>
movss  -0x8(%rbp),%xmm0
movss  0xdfc(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1234 <main+0x114>
movss  0xddf(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1234 <main+0x114>
movb   $0x42,-0x19(%rbp)
jmp    12a4 <main+0x184>
movss  -0x8(%rbp),%xmm0
movss  0xdcf(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1265 <main+0x145>
movss  0xdba(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1265 <main+0x145>
movb   $0x43,-0x19(%rbp)
jmp    129f <main+0x17f>
movss  -0x8(%rbp),%xmm0
movss  0xda2(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1296 <main+0x176>
movss  0xd8d(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1296 <main+0x176>
movb   $0x44,-0x19(%rbp)
jmp    129a <main+0x17a>
movb   $0x45,-0x19(%rbp)
jmp    129f <main+0x17f>
jmp    12a4 <main+0x184>
jmp    12a9 <main+0x189>
movsbl -0x19(%rbp),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeec(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf00(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeef(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xef6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xefe(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm1
addss  %xmm1,%xmm1
addss  0xc(%rsp),%xmm1
movss  0x4(%rsp),%xmm0
mulss  0xe4c(%rip),%xmm0
addss  %xmm1,%xmm0
addss  (%rsp),%xmm0
divss  0xe3f(%rip),%xmm0
mov    $0x41,%esi
ucomiss 0xe37(%rip),%xmm0
jae    1229 <main+0x109>
ucomiss 0xe32(%rip),%xmm0
jb     11ee <main+0xce>
mov    $0x42,%esi
movss  0xe1f(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     1229 <main+0x109>
ucomiss 0xe1b(%rip),%xmm0
jb     1209 <main+0xe9>
mov    $0x43,%esi
movss  0xe08(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     1229 <main+0x109>
ucomiss 0xe04(%rip),%xmm0
setae  %al
movss  0xdf5(%rip),%xmm1
ucomiss %xmm0,%xmm1
seta   %cl
and    %al,%cl
movzbl %cl,%esi
xor    $0x45,%esi
lea    0xe7c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Digite a nota da primeira prova: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [34 x i8] c"\0ADigite a nota da segunda prova: \00"
@.str.3 = [35 x i8] c"\0ADigite a nota da terceira prova: \00"
@.str.4 = [42 x i8] c"\0ADigite a nota da m\C3\A9dia de exerc\C3\ADcios: \00"
@.str.5 = [15 x i8] c"\0AConceito: %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i8
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, 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 ([34 x i8], [34 x i8]* @.str.2, 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %5)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%16 = load float, float* %3
%17 = load float, float* %4
%18 = call float @llvm.fmuladd.f32(float %17, float 2.000000e+00, float %16)
%19 = load float, float* %5
%20 = call float @llvm.fmuladd.f32(float %19, float 3.000000e+00, float %18)
%21 = load float, float* %6
%22 = fadd float %20, %21
%23 = fdiv float %22, 7.000000e+00
store float %23, float* %2
%24 = load float, float* %2
%25 = fcmp oge float %24, 9.000000e+00
br i1 %25, label %26, label %27
26: ; preds = %0
store i8 65, i8* %7
br label %52
27: ; preds = %0
%28 = load float, float* %2
%29 = fcmp oge float %28, 7.500000e+00
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load float, float* %2
%32 = fcmp olt float %31, 9.000000e+00
br i1 %32, label %33, label %34
33: ; preds = %30
store i8 66, i8* %7
br label %51
34: ; preds = %30, %27
%35 = load float, float* %2
%36 = fcmp oge float %35, 6.000000e+00
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = load float, float* %2
%39 = fcmp olt float %38, 7.500000e+00
br i1 %39, label %40, label %41
40: ; preds = %37
store i8 67, i8* %7
br label %50
41: ; preds = %37, %34
%42 = load float, float* %2
%43 = fcmp oge float %42, 4.000000e+00
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = load float, float* %2
%46 = fcmp olt float %45, 6.000000e+00
br i1 %46, label %47, label %48
47: ; preds = %44
store i8 68, i8* %7
br label %49
48: ; preds = %44, %41
store i8 69, i8* %7
br label %49
49: ; preds = %48, %47
br label %50
50: ; preds = %49, %40
br label %51
51: ; preds = %50, %33
br label %52
52: ; preds = %51, %26
%53 = load i8, i8* %7
%54 = sext i8 %53 to i32
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %54)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"Digite a nota da primeira prova: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [34 x i8] c"\0ADigite a nota da segunda prova: \00"
@.str.3 = [35 x i8] c"\0ADigite a nota da terceira prova: \00"
@.str.4 = [42 x i8] c"\0ADigite a nota da m\C3\A9dia de exerc\C3\ADcios: \00"
@.str.5 = [15 x i8] c"\0AConceito: %c\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %1 to i8*
%6 = bitcast float* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%17 = load float, float* %1
%18 = load float, float* %2
%19 = call float @llvm.fmuladd.f32(float %18, float 2.000000e+00, float %17)
%20 = load float, float* %3
%21 = call float @llvm.fmuladd.f32(float %20, float 3.000000e+00, float %19)
%22 = load float, float* %4
%23 = fadd float %21, %22
%24 = fdiv float %23, 7.000000e+00
%25 = fcmp ult float %24, 9.000000e+00
br i1 %25, label %26, label %39
26: ; preds = %0
%27 = fcmp oge float %24, 7.500000e+00
%28 = fcmp olt float %24, 9.000000e+00
%29 = and i1 %27, %28
br i1 %29, label %39, label %30
30: ; preds = %26
%31 = fcmp oge float %24, 6.000000e+00
%32 = fcmp olt float %24, 7.500000e+00
%33 = and i1 %31, %32
br i1 %33, label %39, label %34
34: ; preds = %30
%35 = fcmp oge float %24, 4.000000e+00
%36 = fcmp olt float %24, 6.000000e+00
%37 = and i1 %35, %36
%38 = select i1 %37, i32 68, i32 69
br label %39
39: ; preds = %34, %30, %26, %0
%40 = phi i32 [ 65, %0 ], [ 66, %26 ], [ 67, %30 ], [ %38, %34 ]
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %40)
ret i32 0
}