#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(int argc, const char *argv[]) {
  float n1, n2, n3, med;
  printf("primeira nota?");
  scanf("%f", &n1);
  printf("segunda nota?");
  scanf("%f", &n2);
  printf("terceira nota?");
  scanf("%f", &n3);
  med = (n1 + n2 + n3) / 3;
  if (med >= 7) {
    printf("aprovado\n");
  }
  if (med < 7) {
    printf("reprovado\n");
  }
  if (med == 10) {
    printf("aprovado com distincao\n");
  }
}


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    0xecf(%rip),%rdi
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  0xe63(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  0xe49(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11cc <main+0xac>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
movss  0xe2c(%rip),%xmm0
ucomiss -0x20(%rbp),%xmm0
jbe    11ea <main+0xca>
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
movss  0xe11(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1212 <main+0xf2>
jp     1212 <main+0xf2>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    0xed3(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm1
addss  0x8(%rsp),%xmm1
addss  0x4(%rsp),%xmm1
divss  0xe5f(%rip),%xmm1
ucomiss 0xe5c(%rip),%xmm1
movss  %xmm1,(%rsp)
jb     11c0 <main+0x90>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
movss  (%rsp),%xmm1
movss  0xe3c(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11de <main+0xae>
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
movss  (%rsp),%xmm1
ucomiss 0xe23(%rip),%xmm1
jne    11f5 <main+0xc5>
jp     11f5 <main+0xc5>
lea    0xe4b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"primeira nota?\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [14 x i8] c"segunda nota?\00"
@.str.3 = [15 x i8] c"terceira nota?\00"
@.str.4 = [10 x i8] c"aprovado\0A\00"
@.str.5 = [11 x i8] c"reprovado\0A\00"
@.str.6 = [24 x i8] c"aprovado com distincao\0A\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
%9 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%12 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %7)
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %8)
%16 = load float, float* %6
%17 = load float, float* %7
%18 = fadd float %16, %17
%19 = load float, float* %8
%20 = fadd float %18, %19
%21 = fdiv float %20, 3.000000e+00
store float %21, float* %9
%22 = load float, float* %9
%23 = fcmp oge float %22, 7.000000e+00
br i1 %23, label %24, label %26
24: ; preds = %2
%25 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %24, %2
%27 = load float, float* %9
%28 = fcmp olt float %27, 7.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
%32 = load float, float* %9
%33 = fcmp oeq float %32, 1.000000e+01
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [15 x i8] c"primeira nota?\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [14 x i8] c"segunda nota?\00"
@.str.3 = [15 x i8] c"terceira nota?\00"
@str = [23 x i8] c"aprovado com distincao\00"
@str.7 = [10 x i8] c"reprovado\00"
@str.8 = [9 x i8] c"aprovado\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %3 to i8*
%7 = bitcast float* %4 to i8*
%8 = bitcast float* %5 to i8*
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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* %3)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 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* %4)
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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* %5)
%15 = load float, float* %3
%16 = load float, float* %4
%17 = fadd float %15, %16
%18 = load float, float* %5
%19 = fadd float %17, %18
%20 = fdiv float %19, 3.000000e+00
%21 = fcmp ult float %20, 7.000000e+00
br i1 %21, label %24, label %22
22: ; preds = %2
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.8, i64 0, i64 0))
br label %24
24: ; preds = %22, %2
%25 = fcmp olt float %20, 7.000000e+00
br i1 %25, label %26, label %28
26: ; preds = %24
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.7, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
%29 = fcmp oeq float %20, 1.000000e+01
br i1 %29, label %30, label %32
30: ; preds = %28
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
ret i32 0
}