#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() {
  float n1, n2, n3, n4, ave, m, sum;
  scanf("%f%f%f%f", &n1, &n2, &n3, &n4);
  ave = ((n1 * 2) + (n2 * 3) + (n3 * 4) + (n4 * 1)) / 10;
  printf("Media: %0.1f\n", ave);
  if (ave >= 7.0) {
    printf("Aluno aprovado.\n");
  } else if (ave < 5.0) {
    printf("Aluno reprovado.\n");
  } else if (ave >= 5.0 && ave <= 6.9) {
    printf("Aluno em exame.\n");
    scanf("%f", &m);
    printf("Nota do exame: %0.1f\n", m);
    sum = (ave + m) / 2;
    {
      if (sum >= 5.0) {
        printf("Aluno aprovado.\n");
      } else if (sum <= 4.9) {
        printf("Aluno reprovado.\n");
      }
    }
    printf("Media final: %0.1f\n", sum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xece(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xeb0(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xe93(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe93(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe42(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11db <main+0xbb>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130e <main+0x1ee>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe1c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1209 <main+0xe9>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1309 <main+0x1e9>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdee(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1304 <main+0x1e4>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xddb(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1304 <main+0x1e4>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xde2(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  0xda4(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd66(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12bf <main+0x19f>
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ed <main+0x1cd>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd48(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     12e8 <main+0x1c8>
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ed <main+0x1cd>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd94(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1309 <main+0x1e9>
jmp    130e <main+0x1ee>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xeed(%rip),%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x1c(%rsp),%xmm0
movss  0x18(%rsp),%xmm1
mulss  0xe96(%rip),%xmm1
addss  %xmm0,%xmm0
movss  0x14(%rsp),%xmm2
mulss  0xe88(%rip),%xmm2
addss  %xmm1,%xmm0
addss  %xmm0,%xmm2
addss  0x10(%rsp),%xmm2
divss  0xe76(%rip),%xmm2
movss  %xmm2,(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
lea    0xe8c(%rip),%rdi
movsd  %xmm0,0x20(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
movss  (%rsp),%xmm1
ucomiss 0xe4e(%rip),%xmm1
jae    11d6 <main+0xa6>
movss  0xe48(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11e9 <main+0xb9>
lea    0xea5(%rip),%rdi
jmp    11dd <main+0xad>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret
ucomiss 0xe20(%rip),%xmm1
jb     11e2 <main+0xb2>
movsd  0xe1e(%rip),%xmm0
ucomisd 0x20(%rsp),%xmm0
jb     11e2 <main+0xb2>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
lea    0xe19(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  (%rsp),%xmm1
addss  0xc(%rsp),%xmm1
mulss  0xdc8(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
ucomiss 0xdb6(%rip),%xmm1
jae    1278 <main+0x148>
movsd  0xdbc(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     128e <main+0x15e>
movsd  %xmm0,(%rsp)
lea    0xe03(%rip),%rdi
jmp    1284 <main+0x154>
movsd  %xmm0,(%rsp)
lea    0xe06(%rip),%rdi
call   1030 <puts@plt>
movsd  (%rsp),%xmm0
lea    0xdc0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11e2 <main+0xb2>

LLVM IR (-O0):
@.str = [9 x i8] c"%f%f%f%f\00"
@.str.1 = [14 x i8] c"Media: %0.1f\0A\00"
@.str.2 = [17 x i8] c"Aluno aprovado.\0A\00"
@.str.3 = [18 x i8] c"Aluno reprovado.\0A\00"
@.str.4 = [17 x i8] c"Aluno em exame.\0A\00"
@.str.5 = [3 x i8] c"%f\00"
@.str.6 = [22 x i8] c"Nota do exame: %0.1f\0A\00"
@.str.7 = [20 x i8] c"Media final: %0.1f\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 float
%8 = alloca float
store i32 0, i32* %1
%9 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float* %2, float* %3, float* %4, float* %5)
%10 = load float, float* %2
%11 = load float, float* %3
%12 = fmul float %11, 3.000000e+00
%13 = call float @llvm.fmuladd.f32(float %10, float 2.000000e+00, float %12)
%14 = load float, float* %4
%15 = call float @llvm.fmuladd.f32(float %14, float 4.000000e+00, float %13)
%16 = load float, float* %5
%17 = call float @llvm.fmuladd.f32(float %16, float 1.000000e+00, float %15)
%18 = fdiv float %17, 1.000000e+01
store float %18, float* %6
%19 = load float, float* %6
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %20)
%22 = load float, float* %6
%23 = fpext float %22 to double
%24 = fcmp oge double %23, 7.000000e+00
br i1 %24, label %25, label %27
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %69
27: ; preds = %0
%28 = load float, float* %6
%29 = fpext float %28 to double
%30 = fcmp olt double %29, 5.000000e+00
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %68
33: ; preds = %27
%34 = load float, float* %6
%35 = fpext float %34 to double
%36 = fcmp oge double %35, 5.000000e+00
br i1 %36, label %37, label %67
37: ; preds = %33
%38 = load float, float* %6
%39 = fpext float %38 to double
%40 = fcmp ole double %39, 6.900000e+00
br i1 %40, label %41, label %67
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%43 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %7)
%44 = load float, float* %7
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), double %45)
%47 = load float, float* %6
%48 = load float, float* %7
%49 = fadd float %47, %48
%50 = fdiv float %49, 2.000000e+00
store float %50, float* %8
%51 = load float, float* %8
%52 = fpext float %51 to double
%53 = fcmp oge double %52, 5.000000e+00
br i1 %53, label %54, label %56
54: ; preds = %41
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %63
56: ; preds = %41
%57 = load float, float* %8
%58 = fpext float %57 to double
%59 = fcmp ole double %58, 4.900000e+00
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %62
62: ; preds = %60, %56
br label %63
63: ; preds = %62, %54
%64 = load float, float* %8
%65 = fpext float %64 to double
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), double %65)
br label %67
67: ; preds = %63, %37, %33
br label %68
68: ; preds = %67, %31
br label %69
69: ; preds = %68, %25
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%f%f%f%f\00"
@.str.1 = [14 x i8] c"Media: %0.1f\0A\00"
@.str.5 = [3 x i8] c"%f\00"
@.str.6 = [22 x i8] c"Nota do exame: %0.1f\0A\00"
@.str.7 = [20 x i8] c"Media final: %0.1f\0A\00"
@str = [16 x i8] c"Aluno em exame.\00"
@str.10 = [17 x i8] c"Aluno reprovado.\00"
@str.11 = [16 x i8] c"Aluno aprovado.\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %1 to i8*
%7 = bitcast float* %2 to i8*
%8 = bitcast float* %3 to i8*
%9 = bitcast float* %4 to i8*
%10 = bitcast float* %5 to i8*
%11 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float* %1, float* %2, float* %3, float* %4)
%12 = load float, float* %1
%13 = load float, float* %2
%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* %3
%17 = call float @llvm.fmuladd.f32(float %16, float 4.000000e+00, float %15)
%18 = load float, float* %4
%19 = fadd float %18, %17
%20 = fdiv float %19, 1.000000e+01
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = fcmp ult float %20, 7.000000e+00
br i1 %23, label %26, label %24
24: ; preds = %0
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.11, i64 0, i64 0))
br label %52
26: ; preds = %0
%27 = fcmp olt float %20, 5.000000e+00
br i1 %27, label %28, label %30
28: ; preds = %26
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0))
br label %52
30: ; preds = %26
%31 = fcmp ult float %20, 5.000000e+00
%32 = fcmp ugt double %21, 6.900000e+00
%33 = or i1 %31, %32
br i1 %33, label %52, label %34
34: ; preds = %30
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%36 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %5)
%37 = load float, float* %5
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), double %38)
%40 = load float, float* %5
%41 = fadd float %20, %40
%42 = fmul float %41, 5.000000e-01
%43 = fpext float %42 to double
%44 = fcmp ult float %42, 5.000000e+00
br i1 %44, label %45, label %47
45: ; preds = %34
%46 = fcmp ugt double %43, 4.900000e+00
br i1 %46, label %50, label %47
47: ; preds = %45, %34
%48 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.11, i64 0, i64 0), %34 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0), %45 ]
%49 = call i32 @puts(i8* dereferenceable(1) %48)
br label %50
50: ; preds = %47, %45
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), double %43)
br label %52
52: ; preds = %28, %50, %30, %24
ret i32 0
}