#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 /*<<< orphan*/ system(char *);
int main() {
  float nota1, nota2, media;
  printf("Digite a nota da prova 1: ");
  scanf("%f", &nota1);
  printf("Digite a nota da prova 2: ");
  scanf("%f", &nota2);
  media = (nota1 + nota2) / 2;
  printf("\nMédia calculada é igual a %f", media);
  printf("\nMédia calculada é igual a %6.2f", media);
  if (media >= 7) {
    printf("\nParabéns. Você foi aprovado!");
  } else {
    printf("\nTente outra vez. Você foi reprovado!");
  }
  printf("\nFim do programa. Tecle algo para continuar...");
  printf("\n\n\n");
  system("pause");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf07(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  0xe77(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea1(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x10(%rbp),%xmm0
movss  0xe2f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11ed <main+0xbd>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fb <main+0xcb>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf01(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movss  0x14(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
mulss  0xe6a(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0xe91(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xea3(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xe2f(%rip),%xmm0
lea    0xec5(%rip),%rax
lea    0xe9e(%rip),%rdi
cmovb  %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xee8(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Digite a nota da prova 1: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [27 x i8] c"Digite a nota da prova 2: \00"
@.str.3 = [32 x i8] c"\0AM\C3\A9dia calculada \C3\A9 igual a %f\00"
@.str.4 = [35 x i8] c"\0AM\C3\A9dia calculada \C3\A9 igual a %6.2f\00"
@.str.5 = [32 x i8] c"\0AParab\C3\A9ns. Voc\C3\AA foi aprovado!\00"
@.str.6 = [39 x i8] c"\0ATente outra vez. Voc\C3\AA foi reprovado!\00"
@.str.7 = [47 x i8] c"\0AFim do programa. Tecle algo para continuar...\00"
@.str.8 = [4 x i8] c"\0A\0A\0A\00"
@.str.9 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%9 = load float, float* %2
%10 = load float, float* %3
%11 = fadd float %9, %10
%12 = fdiv float %11, 2.000000e+00
store float %12, float* %4
%13 = load float, float* %4
%14 = fpext float %13 to double
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), double %14)
%16 = load float, float* %4
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), double %17)
%19 = load float, float* %4
%20 = fcmp oge float %19, 7.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %25
23: ; preds = %0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%28 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Digite a nota da prova 1: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [27 x i8] c"Digite a nota da prova 2: \00"
@.str.3 = [32 x i8] c"\0AM\C3\A9dia calculada \C3\A9 igual a %f\00"
@.str.4 = [35 x i8] c"\0AM\C3\A9dia calculada \C3\A9 igual a %6.2f\00"
@.str.5 = [32 x i8] c"\0AParab\C3\A9ns. Voc\C3\AA foi aprovado!\00"
@.str.6 = [39 x i8] c"\0ATente outra vez. Voc\C3\AA foi reprovado!\00"
@.str.7 = [47 x i8] c"\0AFim do programa. Tecle algo para continuar...\00"
@.str.9 = [6 x i8] c"pause\00"
@str = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = load float, float* %1
%10 = load float, float* %2
%11 = fadd float %9, %10
%12 = fmul float %11, 5.000000e-01
%13 = fpext float %12 to double
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), double %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), double %13)
%16 = fcmp ult float %12, 7.000000e+00
%17 = select i1 %16, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%21 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}