#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, float, ...);
int /*<<< orphan*/ scanf(char *, float *, ...);
int main(int argc, char **argv) {
  float media;
  float a, b, c, d;
  scanf("%f %f %f %f", &a, &b, &c, &d);
  media = (a * 2 + b * 3 + c * 4 + d) / 10;
  if (media > 7) {
    printf("Media: %.1f\nAluno aprovado.\n", media);
  } else if (media > 4.9) {
    float exame;
    scanf("%f", &exame);
    printf("Media: %.1f\nAluno em exame.\nNota do exame: %.1f\n", media, exame);
    media = (media + exame) / 2;
    if (media > 5) {
      printf("Aluno aprovado.\nMedia final: %.1f\n", media);
    } else {
      printf("Aluno reprovado.\nMedia final: %.1f\n", media);
    }
  } else {
    printf("Media: %.1f\nAluno reprovado.\n", media);
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xee3(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm1
movss  0xeab(%rip),%xmm0
mulss  -0x1c(%rbp),%xmm0
addss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
movss  0xe8d(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x24(%rbp),%xmm0
movss  0xe74(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xe5a(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11c7 <main+0xa7>
movss  -0x14(%rbp),%xmm0
lea    0xe71(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1289 <main+0x169>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe40(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1271 <main+0x151>
lea    0xe40(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe40(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
movss  0xdf2(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xdd8(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1259 <main+0x139>
movss  -0x14(%rbp),%xmm0
lea    0xe2d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    126c <main+0x14c>
movss  -0x14(%rbp),%xmm0
lea    0xe38(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1284 <main+0x164>
movss  -0x14(%rbp),%xmm0
lea    0xe44(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1289 <main+0x169>
mov    0x2d50(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xef5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x14(%rsp),%xmm2
movss  0x10(%rsp),%xmm1
mulss  0xea6(%rip),%xmm1
addss  %xmm2,%xmm2
addss  %xmm1,%xmm2
movss  0xc(%rsp),%xmm0
mulss  0xe94(%rip),%xmm0
addss  %xmm2,%xmm0
addss  0x8(%rsp),%xmm0
divss  0xe86(%rip),%xmm0
ucomiss 0xe83(%rip),%xmm0
jbe    1194 <main+0x74>
lea    0xe9a(%rip),%rdi
jmp    1212 <main+0xf2>
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd 0xe75(%rip),%xmm1
jbe    120b <main+0xeb>
lea    0xe7d(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
movss  %xmm0,(%rsp)
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xe78(%rip),%rdi
movss  (%rsp),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
mulss  0xe20(%rip),%xmm0
ucomiss 0xe1d(%rip),%xmm0
lea    0xe7c(%rip),%rax
lea    0xe98(%rip),%rdi
cmova  %rax,%rdi
jmp    1212 <main+0xf2>
lea    0xeaf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
ret

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

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