#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 a1, p1, a2, p2;
  float mb1, mb2, mf;
  printf("Informe A1: ");
  scanf("%f", &a1);
  printf("Informe P1: ");
  scanf("%f", &p1);
  printf("Informe A2: ");
  scanf("%f", &a2);
  printf("Informe P2: ");
  scanf("%f", &p2);
  mb1 = 0.7 * p1 + 0.3 * a1;
  mb2 = 0.7 * p2 + 0.3 * a2;
  mf = 0.4 * mb1 + 0.6 * mb2;
  if (mf >= 6)
    printf("Aprovado\n");
  else if (mf < 2)
    printf("Reprovado\n");
  else
    printf("Exame\n");
  printf("Media Final: %.1f", mf);
}


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    0xef8(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe66(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe52(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe2f(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe1b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xde8(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xdd4(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  0xdae(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     126e <main+0x14e>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a6 <main+0x186>
movss  0xd8e(%rip),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    1293 <main+0x173>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a1 <main+0x181>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a6 <main+0x186>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdc5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xeec(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeeb(%rip),%rbx
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeda(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x1c(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe3c(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe38(%rip),%xmm3
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x14(%rsp),%xmm4
cvtss2sd %xmm4,%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm3,%xmm1
addsd  %xmm4,%xmm1
cvtsd2ss %xmm1,%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mulsd  0xe00(%rip),%xmm1
mulsd  0xe00(%rip),%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0xdef(%rip),%xmm0
ucomiss %xmm1,%xmm0
lea    0xe3c(%rip),%rax
lea    0xe2f(%rip),%rcx
cmova  %rax,%rcx
ucomiss 0xdd7(%rip),%xmm1
lea    0xe2d(%rip),%rdi
cmovb  %rcx,%rdi
call   1030 <puts@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf1(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Informe A1: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [13 x i8] c"Informe P1: \00"
@.str.3 = [13 x i8] c"Informe A2: \00"
@.str.4 = [13 x i8] c"Informe P2: \00"
@.str.5 = [10 x i8] c"Aprovado\0A\00"
@.str.6 = [11 x i8] c"Reprovado\0A\00"
@.str.7 = [7 x i8] c"Exame\0A\00"
@.str.8 = [18 x i8] c"Media Final: %.1f\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%16 = load float, float* %2
%17 = fpext float %16 to double
%18 = load float, float* %1
%19 = fpext float %18 to double
%20 = fmul double 3.000000e-01, %19
%21 = call double @llvm.fmuladd.f64(double 0x3FE6666666666666, double %17, double %20)
%22 = fptrunc double %21 to float
store float %22, float* %5
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = load float, float* %3
%26 = fpext float %25 to double
%27 = fmul double 3.000000e-01, %26
%28 = call double @llvm.fmuladd.f64(double 0x3FE6666666666666, double %24, double %27)
%29 = fptrunc double %28 to float
store float %29, float* %6
%30 = load float, float* %5
%31 = fpext float %30 to double
%32 = load float, float* %6
%33 = fpext float %32 to double
%34 = fmul double 6.000000e-01, %33
%35 = call double @llvm.fmuladd.f64(double 4.000000e-01, double %31, double %34)
%36 = fptrunc double %35 to float
store float %36, float* %7
%37 = load float, float* %7
%38 = fcmp oge float %37, 6.000000e+00
br i1 %38, label %39, label %41
39: ; preds = %0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %49
41: ; preds = %0
%42 = load float, float* %7
%43 = fcmp olt float %42, 2.000000e+00
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %48
46: ; preds = %41
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %48
48: ; preds = %46, %44
br label %49
49: ; preds = %48, %39
%50 = load float, float* %7
%51 = fpext float %50 to double
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), double %51)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Informe A1: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [13 x i8] c"Informe P1: \00"
@.str.3 = [13 x i8] c"Informe A2: \00"
@.str.4 = [13 x i8] c"Informe P2: \00"
@.str.8 = [18 x i8] c"Media Final: %.1f\00"
@str = [6 x i8] c"Exame\00"
@str.9 = [10 x i8] c"Reprovado\00"
@str.10 = [9 x i8] c"Aprovado\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %1 to i8*
%6 = bitcast float* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = load float, float* %1
%20 = fpext float %19 to double
%21 = fmul double %20, 3.000000e-01
%22 = call double @llvm.fmuladd.f64(double %18, double 0x3FE6666666666666, double %21)
%23 = fptrunc double %22 to float
%24 = load float, float* %4
%25 = fpext float %24 to double
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = fmul double %27, 3.000000e-01
%29 = call double @llvm.fmuladd.f64(double %25, double 0x3FE6666666666666, double %28)
%30 = fptrunc double %29 to float
%31 = fpext float %23 to double
%32 = fpext float %30 to double
%33 = fmul double %32, 6.000000e-01
%34 = call double @llvm.fmuladd.f64(double %31, double 4.000000e-01, double %33)
%35 = fptrunc double %34 to float
%36 = fcmp ult float %35, 6.000000e+00
%37 = fcmp olt float %35, 2.000000e+00
%38 = select i1 %37, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0)
%39 = select i1 %36, i8* %38, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.10, i64 0, i64 0)
%40 = call i32 @puts(i8* dereferenceable(1) %39)
%41 = fpext float %35 to double
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), double %41)
ret void
}