#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() {
  float media, x, y;
  int op;
  do {
    scanf(" %f", &x);
    while ((x < 0) || (x > 10)) {
      printf("nota invalida\n");
      scanf(" %f", &x);
    }
    scanf(" %f", &y);
    while ((y < 0) || (y > 10)) {
      printf("nota invalida\n");
      scanf(" %f", &y);
    }
    printf("media = %0.2f\n", (x + y) / 2);
    op = 4;
    while ((op != 1) && (op != 2)) {
      printf("novo calculo (1-sim 2-nao)\n");
      scanf(" %d", &op);
    }
  } while (op == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    $0x1,%al
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
mov    %al,-0x15(%rbp)
ja     1169 <main+0x49>
movss  -0xc(%rbp),%xmm0
movss  0xea0(%rip),%xmm1
ucomiss %xmm1,%xmm0
seta   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1179 <main+0x59>
jmp    119e <main+0x7e>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    1141 <main+0x21>
lea    0xe63(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    $0x1,%al
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
mov    %al,-0x16(%rbp)
ja     11d8 <main+0xb8>
movss  -0x10(%rbp),%xmm0
movss  0xe31(%rip),%xmm1
ucomiss %xmm1,%xmm0
seta   %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
test   $0x1,%al
jne    11e8 <main+0xc8>
jmp    120d <main+0xed>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0b(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    11b0 <main+0x90>
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  0xde5(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xded(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x4,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x14(%rbp)
mov    %al,-0x17(%rbp)
je     1255 <main+0x135>
cmpl   $0x2,-0x14(%rbp)
setne  %al
mov    %al,-0x17(%rbp)
mov    -0x17(%rbp),%al
test   $0x1,%al
jne    1265 <main+0x145>
jmp    128a <main+0x16a>
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdcc(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    123c <main+0x11c>
jmp    128f <main+0x16f>
cmpl   $0x1,-0x14(%rbp)
je     112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xec7(%rip),%rbx
lea    0xef2(%rip),%r15
lea    0x14(%rsp),%r12
lea    0xecb(%rip),%rbp
lea    0xec0(%rip),%r13
lea    0x10(%rsp),%r14
jmp    1178 <main+0x48>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     1170 <main+0x40>
ucomiss 0xe64(%rip),%xmm0
ja     1170 <main+0x40>
jmp    11a8 <main+0x78>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x14(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     11a0 <main+0x70>
ucomiss 0xe36(%rip),%xmm0
ja     11a0 <main+0x70>
addss  0xc(%rsp),%xmm0
mulss  0xe2a(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movl   $0x4,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
lea    -0x3(%rax),%ecx
cmp    $0xfffffffe,%ecx
jb     1200 <main+0xd0>
cmp    $0x1,%eax
je     1178 <main+0x48>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %f\00"
@.str.1 = [15 x i8] c"nota invalida\0A\00"
@.str.2 = [15 x i8] c"media = %0.2f\0A\00"
@.str.3 = [28 x i8] c"novo calculo (1-sim 2-nao)\0A\00"
@.str.4 = [4 x i8] c" %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %51, %0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %3)
br label %8
8: ; preds = %16, %6
%9 = load float, float* %3
%10 = fcmp olt float %9, 0.000000e+00
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load float, float* %3
%13 = fcmp ogt float %12, 1.000000e+01
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ true, %8 ], [ %13, %11 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %3)
br label %8
19: ; preds = %14
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %4)
br label %21
21: ; preds = %29, %19
%22 = load float, float* %4
%23 = fcmp olt float %22, 0.000000e+00
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load float, float* %4
%26 = fcmp ogt float %25, 1.000000e+01
br label %27
27: ; preds = %24, %21
%28 = phi i1 [ true, %21 ], [ %26, %24 ]
br i1 %28, label %29, label %32
29: ; preds = %27
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %4)
br label %21
32: ; preds = %27
%33 = load float, float* %3
%34 = load float, float* %4
%35 = fadd float %33, %34
%36 = fdiv float %35, 2.000000e+00
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %37)
store i32 4, i32* %5
br label %39
39: ; preds = %47, %32
%40 = load i32, i32* %5
%41 = icmp ne i32 %40, 1
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32, i32* %5
%44 = icmp ne i32 %43, 2
br label %45
45: ; preds = %42, %39
%46 = phi i1 [ false, %39 ], [ %44, %42 ]
br i1 %46, label %47, label %50
47: ; preds = %45
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32* %5)
br label %39
50: ; preds = %45
br label %51
51: ; preds = %50
%52 = load i32, i32* %5
%53 = icmp eq i32 %52, 1
br i1 %53, label %6, label %54
54: ; preds = %51
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c" %f\00"
@.str.2 = [15 x i8] c"media = %0.2f\0A\00"
@.str.4 = [4 x i8] c" %d\00"
@str = [27 x i8] c"novo calculo (1-sim 2-nao)\00"
@str.6 = [14 x i8] c"nota invalida\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %46, %0
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %1)
%9 = load float, float* %1
%10 = fcmp olt float %9, 0.000000e+00
%11 = fcmp ogt float %9, 1.000000e+01
%12 = or i1 %10, %11
br i1 %12, label %13, label %20
13: ; preds = %7, %13
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %1)
%16 = load float, float* %1
%17 = fcmp olt float %16, 0.000000e+00
%18 = fcmp ogt float %16, 1.000000e+01
%19 = or i1 %17, %18
br i1 %19, label %13, label %20
20: ; preds = %13, %7
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %2)
%22 = load float, float* %2
%23 = fcmp olt float %22, 0.000000e+00
%24 = fcmp ogt float %22, 1.000000e+01
%25 = or i1 %23, %24
br i1 %25, label %26, label %33
26: ; preds = %20, %26
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %2)
%29 = load float, float* %2
%30 = fcmp olt float %29, 0.000000e+00
%31 = fcmp ogt float %29, 1.000000e+01
%32 = or i1 %30, %31
br i1 %32, label %26, label %33
33: ; preds = %26, %20
%34 = phi float [ %22, %20 ], [ %29, %26 ]
%35 = load float, float* %1
%36 = fadd float %34, %35
%37 = fmul float %36, 5.000000e-01
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %38)
store i32 4, i32* %3
br label %40
40: ; preds = %33, %40
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%43 = load i32, i32* %3
%44 = add i32 %43, -3
%45 = icmp ult i32 %44, -2
br i1 %45, label %40, label %46
46: ; preds = %40
%47 = icmp eq i32 %43, 1
br i1 %47, label %7, label %48
48: ; preds = %46
ret i32 0
}