#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 *);
void main() {
  float n1, n2, n3, me, ma;
  printf("Digite a primeira nota: ");
  scanf("%f", &n1);
  printf("Digite a segunda nota: ");
  scanf(" %f", &n2);
  printf("Digite a terceira nota: ");
  scanf(" %f", &n3);
  me = (n1 + n2 + n3) / 3.0;
  ma = (n1 + 2 * n2 + 3 * n3 + me) / 7.0;
  printf("\nMedia de aproveitamento: %.2f.\n", ma);
  if (ma >= 9)
    printf("Conceito A.\n");
  else if (ma >= 7.5)
    printf("Conceito B.\n");
  else if (ma >= 6)
    printf("Conceito C.\n");
  else if (ma >= 4)
    printf("Conceito D.\n");
  else
    printf("Conceito E.\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf1d(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
addss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
movss  0xe3b(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe2e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe77(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
movss  0xded(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     122f <main+0x10f>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12cc <main+0x1ac>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xde0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     125d <main+0x13d>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c7 <main+0x1a7>
movss  -0x14(%rbp),%xmm0
movss  0xd9e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1286 <main+0x166>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c2 <main+0x1a2>
movss  -0x14(%rbp),%xmm0
movss  0xd79(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     12af <main+0x18f>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12bd <main+0x19d>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c2 <main+0x1a2>
jmp    12c7 <main+0x1a7>
jmp    12cc <main+0x1ac>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf00(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee0(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movaps %xmm0,%xmm2
addss  %xmm1,%xmm2
movss  0x4(%rsp),%xmm4
addss  %xmm4,%xmm2
movss  0xe4a(%rip),%xmm3
divss  %xmm3,%xmm2
addss  %xmm1,%xmm1
addss  %xmm0,%xmm1
mulss  %xmm3,%xmm4
addss  %xmm1,%xmm4
addss  %xmm2,%xmm4
divss  0xe2e(%rip),%xmm4
movss  %xmm4,(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
lea    0xe7d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  (%rsp),%xmm0
ucomiss 0xe0c(%rip),%xmm0
jae    122b <main+0xfb>
ucomiss 0xe07(%rip),%xmm0
jae    1234 <main+0x104>
ucomiss 0xe02(%rip),%xmm0
jae    123d <main+0x10d>
ucomiss 0xdfd(%rip),%xmm0
lea    0xe69(%rip),%rax
lea    0xe6e(%rip),%rdi
cmovb  %rax,%rdi
jmp    1244 <main+0x114>
lea    0xe85(%rip),%rdi
jmp    1244 <main+0x114>
lea    0xe70(%rip),%rdi
jmp    1244 <main+0x114>
lea    0xe5b(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Digite a primeira nota: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [24 x i8] c"Digite a segunda nota: \00"
@.str.3 = [4 x i8] c" %f\00"
@.str.4 = [25 x i8] c"Digite a terceira nota: \00"
@.str.5 = [33 x i8] c"\0AMedia de aproveitamento: %.2f.\0A\00"
@.str.6 = [13 x i8] c"Conceito A.\0A\00"
@.str.7 = [13 x i8] c"Conceito B.\0A\00"
@.str.8 = [13 x i8] c"Conceito C.\0A\00"
@.str.9 = [13 x i8] c"Conceito D.\0A\00"
@.str.10 = [13 x i8] c"Conceito E.\0A\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 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* %1)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), float* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), float* %3)
%12 = load float, float* %1
%13 = load float, float* %2
%14 = fadd float %12, %13
%15 = load float, float* %3
%16 = fadd float %14, %15
%17 = fpext float %16 to double
%18 = fdiv double %17, 3.000000e+00
%19 = fptrunc double %18 to float
store float %19, float* %4
%20 = load float, float* %1
%21 = load float, float* %2
%22 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %21, float %20)
%23 = load float, float* %3
%24 = call float @llvm.fmuladd.f32(float 3.000000e+00, float %23, float %22)
%25 = load float, float* %4
%26 = fadd float %24, %25
%27 = fpext float %26 to double
%28 = fdiv double %27, 7.000000e+00
%29 = fptrunc double %28 to float
store float %29, float* %5
%30 = load float, float* %5
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), double %31)
%33 = load float, float* %5
%34 = fcmp oge float %33, 9.000000e+00
br i1 %34, label %35, label %37
35: ; preds = %0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %58
37: ; preds = %0
%38 = load float, float* %5
%39 = fpext float %38 to double
%40 = fcmp oge double %39, 7.500000e+00
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
br label %57
43: ; preds = %37
%44 = load float, float* %5
%45 = fcmp oge float %44, 6.000000e+00
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %56
48: ; preds = %43
%49 = load float, float* %5
%50 = fcmp oge float %49, 4.000000e+00
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
br label %55
53: ; preds = %48
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
br label %55
55: ; preds = %53, %51
br label %56
56: ; preds = %55, %46
br label %57
57: ; preds = %56, %41
br label %58
58: ; preds = %57, %35
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Digite a primeira nota: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [24 x i8] c"Digite a segunda nota: \00"
@.str.3 = [4 x i8] c" %f\00"
@.str.4 = [25 x i8] c"Digite a terceira nota: \00"
@.str.5 = [33 x i8] c"\0AMedia de aproveitamento: %.2f.\0A\00"
@str = [12 x i8] c"Conceito E.\00"
@str.11 = [12 x i8] c"Conceito D.\00"
@str.12 = [12 x i8] c"Conceito C.\00"
@str.13 = [12 x i8] c"Conceito B.\00"
@str.14 = [12 x i8] c"Conceito A.\00"
define void @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 ([25 x i8], [25 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 ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), float* %3)
%13 = load float, float* %1
%14 = load float, float* %2
%15 = fadd float %13, %14
%16 = load float, float* %3
%17 = fadd float %15, %16
%18 = fdiv float %17, 3.000000e+00
%19 = call float @llvm.fmuladd.f32(float %14, float 2.000000e+00, float %13)
%20 = call float @llvm.fmuladd.f32(float %16, float 3.000000e+00, float %19)
%21 = fadd float %20, %18
%22 = fdiv float %21, 7.000000e+00
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), double %23)
%25 = fcmp ult float %22, 9.000000e+00
br i1 %25, label %26, label %33
26: ; preds = %0
%27 = fcmp ult float %22, 7.500000e+00
br i1 %27, label %28, label %33
28: ; preds = %26
%29 = fcmp ult float %22, 6.000000e+00
br i1 %29, label %30, label %33
30: ; preds = %28
%31 = fcmp ult float %22, 4.000000e+00
%32 = select i1 %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.11, i64 0, i64 0)
br label %33
33: ; preds = %30, %28, %26, %0
%34 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.14, i64 0, i64 0), %0 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.13, i64 0, i64 0), %26 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.12, i64 0, i64 0), %28 ], [ %32, %30 ]
%35 = call i32 @puts(i8* dereferenceable(1) %34)
ret void
}