#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 *, double, ...);
int /*<<< orphan*/ scanf(char *, double *, ...);
int main() {
  double N1, N2, N3, N4, media, exame, media2;
  scanf(" %lf %lf %lf %lf", &N1, &N2, &N3, &N4);
  media = ((N1 * 2) + (N2 * 3) + (N3 * 4) + (N4 * 1)) / 10;
  if (media >= 7.0)
    printf("Media: %0.1lf\nAluno aprovado.\n", media);
  else if (media < 5.0)
    printf("Media: %0.1lf\nAluno reprovado.\n", media);
  else {
    scanf(" %lf", &exame);
    media2 = (media + exame) / 2;
    if (media2 >= 5.0)
      printf("Media: %0.1lf\nAluno em exame.\nNota do exame: %0.1f\nAluno "
             "aprovado.\nMedia final: %0.1f\n",
             media, exame, media2);
    else
      printf("Media: %0.1lf\nAluno em exame.\nNota do exame: %0.1f\nAluno "
             "reprovado.\nMedia final: %0.1f\n",
             media, exame, media2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xebe(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe9c(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe7b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe5d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11c5 <main+0xa5>
movsd  -0x30(%rbp),%xmm0
lea    0xe88(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    127d <main+0x15d>
movsd  0xe53(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    11f0 <main+0xd0>
movsd  -0x30(%rbp),%xmm0
lea    0xe7c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1278 <main+0x158>
lea    0xe45(%rip),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  0xe14(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xdf6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1256 <main+0x136>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
lea    0xe36(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
jmp    1273 <main+0x153>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
lea    0xe6b(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
jmp    1278 <main+0x158>
jmp    127d <main+0x15d>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
lea    0xf05(%rip),%rdi
lea    0x30(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x18(%rsp),%r8
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x30(%rsp),%xmm2
movsd  0x28(%rsp),%xmm1
mulsd  0xea6(%rip),%xmm1
addsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
movsd  0x20(%rsp),%xmm0
mulsd  0xe98(%rip),%xmm0
addsd  %xmm2,%xmm0
addsd  0x18(%rsp),%xmm0
divsd  0xe8e(%rip),%xmm0
ucomisd 0xe8e(%rip),%xmm0
jae    11a3 <main+0x83>
movsd  0xe8c(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11b3 <main+0x93>
lea    0xebf(%rip),%rdi
jmp    11aa <main+0x8a>
lea    0xe97(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1209 <main+0xe9>
lea    0xe82(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
movsd  %xmm0,0x8(%rsp)
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
mulsd  0xe40(%rip),%xmm2
ucomisd 0xe30(%rip),%xmm2
jae    11fb <main+0xdb>
lea    0xede(%rip),%rdi
jmp    1202 <main+0xe2>
lea    0xe7e(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [17 x i8] c" %lf %lf %lf %lf\00"
@.str.1 = [31 x i8] c"Media: %0.1lf\0AAluno aprovado.\0A\00"
@.str.2 = [32 x i8] c"Media: %0.1lf\0AAluno reprovado.\0A\00"
@.str.3 = [5 x i8] c" %lf\00"
@.str.4 = [87 x i8] c"Media: %0.1lf\0AAluno em exame.\0ANota do exame: %0.1f\0AAluno aprovado.\0AMedia final: %0.1f\0A\00"
@.str.5 = [88 x i8] c"Media: %0.1lf\0AAluno em exame.\0ANota do exame: %0.1f\0AAluno reprovado.\0AMedia final: %0.1f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 0, i32* %1
%9 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double* %2, double* %3, double* %4, double* %5)
%10 = load double, double* %2
%11 = load double, double* %3
%12 = fmul double %11, 3.000000e+00
%13 = call double @llvm.fmuladd.f64(double %10, double 2.000000e+00, double %12)
%14 = load double, double* %4
%15 = call double @llvm.fmuladd.f64(double %14, double 4.000000e+00, double %13)
%16 = load double, double* %5
%17 = call double @llvm.fmuladd.f64(double %16, double 1.000000e+00, double %15)
%18 = fdiv double %17, 1.000000e+01
store double %18, double* %6
%19 = load double, double* %6
%20 = fcmp oge double %19, 7.000000e+00
br i1 %20, label %21, label %24
21: ; preds = %0
%22 = load double, double* %6
%23 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double %22)
br label %50
24: ; preds = %0
%25 = load double, double* %6
%26 = fcmp olt double %25, 5.000000e+00
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load double, double* %6
%29 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %28)
br label %49
30: ; preds = %24
%31 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double* %7)
%32 = load double, double* %6
%33 = load double, double* %7
%34 = fadd double %32, %33
%35 = fdiv double %34, 2.000000e+00
store double %35, double* %8
%36 = load double, double* %8
%37 = fcmp oge double %36, 5.000000e+00
br i1 %37, label %38, label %43
38: ; preds = %30
%39 = load double, double* %6
%40 = load double, double* %7
%41 = load double, double* %8
%42 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.4, i64 0, i64 0), double %39, double %40, double %41)
br label %48
43: ; preds = %30
%44 = load double, double* %6
%45 = load double, double* %7
%46 = load double, double* %8
%47 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.5, i64 0, i64 0), double %44, double %45, double %46)
br label %48
48: ; preds = %43, %38
br label %49
49: ; preds = %48, %27
br label %50
50: ; preds = %49, %21
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c" %lf %lf %lf %lf\00"
@.str.1 = [31 x i8] c"Media: %0.1lf\0AAluno aprovado.\0A\00"
@.str.2 = [32 x i8] c"Media: %0.1lf\0AAluno reprovado.\0A\00"
@.str.3 = [5 x i8] c" %lf\00"
@.str.4 = [87 x i8] c"Media: %0.1lf\0AAluno em exame.\0ANota do exame: %0.1f\0AAluno aprovado.\0AMedia final: %0.1f\0A\00"
@.str.5 = [88 x i8] c"Media: %0.1lf\0AAluno em exame.\0ANota do exame: %0.1f\0AAluno reprovado.\0AMedia final: %0.1f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = bitcast double* %1 to i8*
%7 = bitcast double* %2 to i8*
%8 = bitcast double* %3 to i8*
%9 = bitcast double* %4 to i8*
%10 = bitcast double* %5 to i8*
%11 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double* %1, double* %2, double* %3, double* %4)
%12 = load double, double* %1
%13 = load double, double* %2
%14 = fmul double %13, 3.000000e+00
%15 = call double @llvm.fmuladd.f64(double %12, double 2.000000e+00, double %14)
%16 = load double, double* %3
%17 = call double @llvm.fmuladd.f64(double %16, double 4.000000e+00, double %15)
%18 = load double, double* %4
%19 = fadd double %18, %17
%20 = fdiv double %19, 1.000000e+01
%21 = fcmp ult double %20, 7.000000e+00
br i1 %21, label %24, label %22
22: ; preds = %0
%23 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double %20)
br label %38
24: ; preds = %0
%25 = fcmp olt double %20, 5.000000e+00
br i1 %25, label %26, label %28
26: ; preds = %24
%27 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %20)
br label %38
28: ; preds = %24
%29 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double* %5)
%30 = load double, double* %5
%31 = fadd double %20, %30
%32 = fmul double %31, 5.000000e-01
%33 = fcmp ult double %32, 5.000000e+00
br i1 %33, label %36, label %34
34: ; preds = %28
%35 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.4, i64 0, i64 0), double %20, double %30, double %32)
br label %38
36: ; preds = %28
%37 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.5, i64 0, i64 0), double %20, double %30, double %32)
br label %38
38: ; preds = %26, %36, %34, %22
ret i32 0
}