#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() {
  float nota1, nota2;
  printf("Digite a 1a nota: ");
  scanf("%f", &nota1);
  printf("Digite a 2a nota: ");
  scanf("%f", &nota2);
  if (nota1 <= 0.0 || nota1 >= 10.0) {
    printf("Nota %.2f inválida. Programa encerrado!", nota1);
  } else if (nota2 <= 0.0 || nota2 >= 10.0) {
    printf("Nota %.2f inválida. Programa encerrado!", nota2);
  } else {
    printf("Média = %.2f", (nota1 + nota2) / 2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jae    119c <main+0x7c>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe6e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11b8 <main+0x98>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe89(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1232 <main+0x112>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jae    11e9 <main+0xc9>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe21(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1205 <main+0xe5>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    122d <main+0x10d>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  0xdf1(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe38(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1232 <main+0x112>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee1(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
lea    0xebc(%rip),%rdi
jae    11af <main+0x8f>
ucomiss 0xe82(%rip),%xmm0
jae    11af <main+0x8f>
movss  0x8(%rsp),%xmm1
xorps  %xmm2,%xmm2
ucomiss %xmm1,%xmm2
jae    11ac <main+0x8c>
ucomiss 0xe6b(%rip),%xmm1
jae    11ac <main+0x8c>
addss  %xmm1,%xmm0
mulss  0xe61(%rip),%xmm0
lea    0xeb0(%rip),%rdi
jmp    11af <main+0x8f>
movaps %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Digite a 1a nota: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [19 x i8] c"Digite a 2a nota: \00"
@.str.3 = [41 x i8] c"Nota %.2f inv\C3\A1lida. Programa encerrado!\00"
@.str.4 = [14 x i8] c"M\C3\A9dia = %.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = fcmp ole double %9, 0.000000e+00
br i1 %10, label %15, label %11
11: ; preds = %0
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = fcmp oge double %13, 1.000000e+01
br i1 %14, label %15, label %19
15: ; preds = %11, %0
%16 = load float, float* %2
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), double %17)
br label %39
19: ; preds = %11
%20 = load float, float* %3
%21 = fpext float %20 to double
%22 = fcmp ole double %21, 0.000000e+00
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = load float, float* %3
%25 = fpext float %24 to double
%26 = fcmp oge double %25, 1.000000e+01
br i1 %26, label %27, label %31
27: ; preds = %23, %19
%28 = load float, float* %3
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), double %29)
br label %38
31: ; preds = %23
%32 = load float, float* %2
%33 = load float, float* %3
%34 = fadd float %32, %33
%35 = fdiv float %34, 2.000000e+00
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %36)
br label %38
38: ; preds = %31, %27
br label %39
39: ; preds = %38, %15
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Digite a 1a nota: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [19 x i8] c"Digite a 2a nota: \00"
@.str.3 = [41 x i8] c"Nota %.2f inv\C3\A1lida. Programa encerrado!\00"
@.str.4 = [14 x i8] c"M\C3\A9dia = %.2f\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = load float, float* %1
%10 = fcmp ugt float %9, 0.000000e+00
%11 = fcmp ult float %9, 1.000000e+01
%12 = and i1 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %0
%14 = load float, float* %2
%15 = fcmp ugt float %14, 0.000000e+00
%16 = fcmp ult float %14, 1.000000e+01
%17 = and i1 %15, %16
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = fadd float %9, %14
%20 = fmul float %19, 5.000000e-01
br label %21
21: ; preds = %13, %0, %18
%22 = phi float [ %20, %18 ], [ %9, %0 ], [ %14, %13 ]
%23 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), %18 ], [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), %13 ]
%24 = fpext float %22 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %23, double %24)
ret i32 0
}