#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 *);
int main(void) {
  int media = 0;
  while (media != -1) {
    printf("Digite a media do final aluno: \n");
    scanf("%d", &media);
    if (media < -1 || media > 10) {
      printf("Voce digitou numero invalido ");
      continue;
    }
    printf(media >= 7 ? "APROVADO!\n" : "REPROVADO!\n");
  }
  printf("Fim do programa! \n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
je     11a3 <main+0x83>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jl     1170 <main+0x50>
cmpl   $0xa,-0x8(%rbp)
jle    1181 <main+0x61>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
mov    -0x8(%rbp),%ecx
lea    0xec2(%rip),%rdi
lea    0xeb0(%rip),%rax
cmp    $0x7,%ecx
cmovge %rax,%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xf00(%rip),%r14
lea    0xeaf(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xec4(%rip),%r13
lea    0xec8(%rip),%rbx
lea    0xe98(%rip),%rbp
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x7,%eax
mov    %rbx,%rdi
cmovge %r13,%rdi
add    $0xfffffff5,%eax
cmp    $0xfffffff4,%eax
cmovb  %rbp,%rdi
call   1040 <printf@plt>
cmpl   $0xffffffff,0x4(%rsp)
jne    1170 <main+0x40>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Digite a media do final aluno: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"Voce digitou numero invalido \00"
@.str.3 = [11 x i8] c"APROVADO!\0A\00"
@.str.4 = [12 x i8] c"REPROVADO!\0A\00"
@.str.5 = [19 x i8] c"Fim do programa! \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %16, %14, %0
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, -1
br i1 %5, label %6, label %22
6: ; preds = %3
%7 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 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), i32* %2)
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, -1
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 10
br i1 %13, label %14, label %16
14: ; preds = %11, %6
%15 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %3
16: ; preds = %11
%17 = load i32, i32* %2
%18 = icmp sge i32 %17, 7
%19 = zext i1 %18 to i64
%20 = select i1 %18, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0)
%21 = call i32 @printf(i8* %20)
br label %3
22: ; preds = %3
%23 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"Voce digitou numero invalido \00"
@.str.3 = [11 x i8] c"APROVADO!\0A\00"
@.str.4 = [12 x i8] c"REPROVADO!\0A\00"
@str = [18 x i8] c"Fim do programa! \00"
@str.6 = [32 x i8] c"Digite a media do final aluno: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.6, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add i32 %6, -11
%8 = icmp ult i32 %7, -12
%9 = icmp sgt i32 %6, 6
%10 = select i1 %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0)
%11 = select i1 %8, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %10
%12 = call i32 @printf(i8* dereferenceable(1) %11)
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %3
15: ; preds = %3
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 0
}