#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 *, ...);
int main() {
  char nome[30];
  int f = 0;
  printf("Digite o nome do aluno: ");
  scanf("%s", nome);
  printf("\nDigite o numero de faltas do aluno: ");
  scanf("%d", &f);
  if (f > 15) {
    printf("\nAluno reprovado por falta.");
  } else {
    float n1, n2, n3;
    printf("\nDigite a primeira nota do aluno: ");
    scanf("%f", &n1);
    printf("\nDigite a segunda nota do aluno: ");
    scanf("%f", &n2);
    printf("\nDigite a terceira nota do aluno: ");
    scanf("%f", &n3);
    float mf = (n1 + n2 + n3) / 3;
    if (mf >= 7) {
      printf("\nAluno aprovado!");
    } else {
      printf("\nAluno reprovado por media.");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x34(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0xf,-0x34(%rbp)
jle    118d <main+0x6d>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
jmp    123f <main+0x11f>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x3c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x38(%rbp),%xmm0
addss  -0x3c(%rbp),%xmm0
addss  -0x40(%rbp),%xmm0
movss  0xe06(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x44(%rbp),%xmm0
movss  0xdec(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     122e <main+0x10e>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    123f <main+0x11f>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movl   $0x0,(%rsp)
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x10,(%rsp)
jl     117a <main+0x5a>
lea    0xed8(%rip),%rdi
jmp    1205 <main+0xe5>
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
lea    0xeff(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xef3(%rip),%rdi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
addss  0x4(%rsp),%xmm0
divss  0xe14(%rip),%xmm0
ucomiss 0xe11(%rip),%xmm0
lea    0xeeb(%rip),%rax
lea    0xed3(%rip),%rdi
cmovb  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Digite o nome do aluno: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [38 x i8] c"\0ADigite o numero de faltas do aluno: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [28 x i8] c"\0AAluno reprovado por falta.\00"
@.str.5 = [35 x i8] c"\0ADigite a primeira nota do aluno: \00"
@.str.6 = [3 x i8] c"%f\00"
@.str.7 = [34 x i8] c"\0ADigite a segunda nota do aluno: \00"
@.str.8 = [35 x i8] c"\0ADigite a terceira nota do aluno: \00"
@.str.9 = [17 x i8] c"\0AAluno aprovado!\00"
@.str.10 = [28 x i8] c"\0AAluno reprovado por media.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store i32 0, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 15
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %37
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %4)
%20 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %5)
%22 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %6)
%24 = load float, float* %4
%25 = load float, float* %5
%26 = fadd float %24, %25
%27 = load float, float* %6
%28 = fadd float %26, %27
%29 = fdiv float %28, 3.000000e+00
store float %29, float* %7
%30 = load float, float* %7
%31 = fcmp oge float %30, 7.000000e+00
br i1 %31, label %32, label %34
32: ; preds = %17
%33 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
br label %36
34: ; preds = %17
%35 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
br label %37
37: ; preds = %36, %15
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [25 x i8] c"Digite o nome do aluno: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [38 x i8] c"\0ADigite o numero de faltas do aluno: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [28 x i8] c"\0AAluno reprovado por falta.\00"
@.str.5 = [35 x i8] c"\0ADigite a primeira nota do aluno: \00"
@.str.6 = [3 x i8] c"%f\00"
@.str.7 = [34 x i8] c"\0ADigite a segunda nota do aluno: \00"
@.str.8 = [35 x i8] c"\0ADigite a terceira nota do aluno: \00"
@.str.9 = [17 x i8] c"\0AAluno aprovado!\00"
@.str.10 = [28 x i8] c"\0AAluno reprovado por media.\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%7 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 15
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %35
16: ; preds = %0
%17 = bitcast float* %3 to i8*
%18 = bitcast float* %4 to i8*
%19 = bitcast float* %5 to i8*
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %3)
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %4)
%24 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %5)
%26 = load float, float* %3
%27 = load float, float* %4
%28 = fadd float %26, %27
%29 = load float, float* %5
%30 = fadd float %28, %29
%31 = fdiv float %30, 3.000000e+00
%32 = fcmp ult float %31, 7.000000e+00
%33 = select i1 %32, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0)
%34 = call i32 @printf(i8* dereferenceable(1) %33)
br label %35
35: ; preds = %16, %14
ret i32 0
}