#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 a, b, c, d, e, m;
  scanf("%f %f %f %f", &a, &b, &c, &d);
  m = (a * 2 + b * 3 + c * 4 + d) / 10;
  printf("Media: %.1f\n", m);
  if (m >= 7.0) {
    printf("Aluno aprovado.\n");
  } else if (m >= 5.0) {
    printf("Aluno em exame.\n");
    scanf("%f", &e);
    printf("Nota do exame: %.1f\n", e);
    if (e + m / 2.0 > 5.0) {
      printf("Aluno aprovado.\n");
    } else {
      printf("Aluno reprovado.\n");
    }
    printf("Media final: %.1f\n", (e + m) / 2.0);
  } else {
    printf("Aluno reprovado.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeee(%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),%xmm1
movss  0xec6(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
addss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
movss  0xea8(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x14(%rbp),%xmm0
movss  0xe8f(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe46(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11d7 <main+0xb7>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12be <main+0x19e>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe20(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12ab <main+0x18b>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe26(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xdcd(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  0xdb5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1270 <main+0x150>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127e <main+0x15e>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd7c(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xde7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12b9 <main+0x199>
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12be <main+0x19e>
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,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
lea    0xe8e(%rip),%rdi
movsd  %xmm0,0x20(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xe4c(%rip),%xmm0
jae    11d4 <main+0xa4>
ucomiss 0xe47(%rip),%xmm0
jae    11e5 <main+0xb5>
lea    0xea7(%rip),%rdi
jmp    11db <main+0xab>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
jmp    127d <main+0x14d>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe39(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0xde4(%rip),%xmm1
addsd  %xmm0,%xmm1
ucomisd 0xde0(%rip),%xmm1
lea    0xe43(%rip),%rax
lea    0xe2b(%rip),%rdi
cmova  %rax,%rdi
call   1030 <puts@plt>
movss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xda9(%rip),%xmm0
lea    0xde0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%f %f %f %f\00"
@.str.1 = [13 x i8] c"Media: %.1f\0A\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [21 x i8] c"Nota do exame: %.1f\0A\00"
@.str.7 = [19 x i8] c"Media final: %.1f\0A\00"
@str.8 = [16 x i8] c"Aluno em exame.\00"
@str.9 = [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 ([12 x i8], [12 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 ([13 x i8], [13 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 %48
26: ; preds = %0
%27 = fcmp ult float %20, 5.000000e+00
br i1 %27, label %46, label %28
28: ; preds = %26
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0))
%30 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %5)
%31 = load float, float* %5
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %32)
%34 = load float, float* %5
%35 = fpext float %34 to double
%36 = fmul double %21, 5.000000e-01
%37 = fadd double %36, %35
%38 = fcmp ogt double %37, 5.000000e+00
%39 = select i1 %38, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.11, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0)
%40 = call i32 @puts(i8* dereferenceable(1) %39)
%41 = load float, float* %5
%42 = fadd float %20, %41
%43 = fpext float %42 to double
%44 = fmul double %43, 5.000000e-01
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), double %44)
br label %48
46: ; preds = %26
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
br label %48
48: ; preds = %28, %46, %24
ret i32 0
}