#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(int argc, char *argv[]) {
  float nota1, nota2, media;
  printf("Digite a nota1: ");
  scanf("%f", &nota1);
  printf("Digite a nota2: ");
  scanf("%f", &nota2);
  media = (nota1 + nota2) / 2;
  printf("A média é: %.2f\n", media);
  if (media < 6) {
    printf("\nAluno Reprovado\n");
  } else {
    printf("\nAluno Aprovado\n");
  }
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  0xe70(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe80(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xe44(%rip),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    11d9 <main+0xa9>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e7 <main+0xb7>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe75(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebf(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
mulss  0xe6a(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe86(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0xe4e(%rip),%xmm0
ucomiss 0x4(%rsp),%xmm0
lea    0xe94(%rip),%rax
lea    0xe7d(%rip),%rdi
cmova  %rax,%rdi
call   1030 <puts@plt>
lea    0xe67(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Digite a nota1: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [17 x i8] c"Digite a nota2: \00"
@.str.3 = [19 x i8] c"A m\C3\A9dia \C3\A9: %.2f\0A\00"
@.str.4 = [18 x i8] c"\0AAluno Reprovado\0A\00"
@.str.5 = [17 x i8] c"\0AAluno Aprovado\0A\00"
@.str.6 = [6 x i8] c"pause\00"
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 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* %6)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 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* %7)
%13 = load float, float* %6
%14 = load float, float* %7
%15 = fadd float %13, %14
%16 = fdiv float %15, 2.000000e+00
store float %16, float* %8
%17 = load float, float* %8
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %18)
%20 = load float, float* %8
%21 = fcmp olt float %20, 6.000000e+00
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %26
24: ; preds = %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
%27 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Digite a nota1: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [17 x i8] c"Digite a nota2: \00"
@.str.3 = [19 x i8] c"A m\C3\A9dia \C3\A9: %.2f\0A\00"
@.str.6 = [6 x i8] c"pause\00"
@str = [16 x i8] c"\0AAluno Aprovado\00"
@str.7 = [17 x i8] c"\0AAluno Reprovado\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %3 to i8*
%6 = bitcast float* %4 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%11 = load float, float* %3
%12 = load float, float* %4
%13 = fadd float %11, %12
%14 = fmul float %13, 5.000000e-01
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %15)
%17 = fcmp olt float %14, 6.000000e+00
%18 = select i1 %17, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0)
%19 = call i32 @puts(i8* dereferenceable(1) %18)
%20 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}