#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 *, double *);
main() {
  double a, b;
  scanf("%lf", &a);
  while (a < 0 || a > 10) {
    if (a < 0 || a > 0) {
      printf("nota invalida\n");
      scanf("%lf", &a);
    }
  }
  scanf("%lf", &b);
  while (b < 0 || b > 10) {
    if (b < 0 || b > 0) {
      printf("nota invalida\n");
      scanf("%lf", &b);
    }
  }
  printf("media = %.2lf\n", (a + b) / 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x19(%rbp)
ja     1169 <main+0x49>
movsd  -0x10(%rbp),%xmm0
movsd  0xea1(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1179 <main+0x59>
jmp    11bc <main+0x9c>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     1199 <main+0x79>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11b7 <main+0x97>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe62(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
jmp    113f <main+0x1f>
lea    0xe4d(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
mov    %al,-0x1a(%rbp)
ja     11f6 <main+0xd6>
movsd  -0x18(%rbp),%xmm0
movsd  0xe14(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    1206 <main+0xe6>
jmp    1249 <main+0x129>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     1226 <main+0x106>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1244 <main+0x124>
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd5(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
jmp    11cc <main+0xac>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xdad(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdbd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1161 <main+0x31>
ucomisd 0xea1(%rip),%xmm0
jbe    11b2 <main+0x82>
lea    0xebb(%rip),%r14
lea    0xea1(%rip),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
ucomisd %xmm1,%xmm0
je     11a2 <main+0x72>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm0
ucomisd %xmm0,%xmm1
ja     1180 <main+0x50>
ucomisd 0xe50(%rip),%xmm0
ja     1180 <main+0x50>
lea    0xe57(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     11dd <main+0xad>
ucomisd 0xe25(%rip),%xmm0
jbe    1223 <main+0xf3>
lea    0xe3f(%rip),%r14
lea    0xe25(%rip),%r15
lea    0x8(%rsp),%rbx
ucomisd %xmm1,%xmm0
je     1213 <main+0xe3>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xorpd  %xmm1,%xmm1
movsd  0x8(%rsp),%xmm0
ucomisd %xmm0,%xmm1
ja     11f0 <main+0xc0>
ucomisd 0xddf(%rip),%xmm0
ja     11f0 <main+0xc0>
addsd  (%rsp),%xmm0
mulsd  0xdd8(%rip),%xmm0
lea    0xddd(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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