#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 *);
void validar(float *var) {
  while (1) {
    scanf("%f", var);
    if (*var >= 0 && *var <= 10)
      return;
    printf("\nNota invalida, tente novamente: ");
  }
}


x86 assembly (clang, -O0):
<validar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xecd(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     116b <validar+0x4b>
mov    -0x8(%rbp),%rax
movss  0xea4(%rip),%xmm0
ucomiss (%rax),%xmm0
jb     116b <validar+0x4b>
add    $0x10,%rsp
pop    %rbp
ret
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
jmp    112c <validar+0xc>

x86 assembly (clang, -O2):
<validar>:
push   %rbx
mov    %rdi,%rbx
lea    0xedd(%rip),%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movss  (%rbx),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     114c <validar+0x2c>
movss  0xeb9(%rip),%xmm1
ucomiss %xmm0,%xmm1
jae    1176 <validar+0x56>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movss  (%rbx),%xmm0
ucomiss 0xe92(%rip),%xmm0
jae    113f <validar+0x1f>
jmp    114c <validar+0x2c>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [34 x i8] c"\0ANota invalida, tente novamente: \00"
define void @validar(float* %0) {
%2 = alloca float*
store float* %0, float** %2
br label %3
3: ; preds = %1, %14
%4 = load float*, float** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %4)
%6 = load float*, float** %2
%7 = load float, float* %6
%8 = fcmp oge float %7, 0.000000e+00
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load float*, float** %2
%11 = load float, float* %10
%12 = fcmp ole float %11, 1.000000e+01
br i1 %12, label %13, label %14
13: ; preds = %9
ret void
14: ; preds = %9, %3
%15 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %3
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [34 x i8] c"\0ANota invalida, tente novamente: \00"
define void @validar(float* %0) {
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %0)
%3 = load float, float* %0
%4 = fcmp ult float %3, 0.000000e+00
%5 = fcmp ugt float %3, 1.000000e+01
%6 = or i1 %4, %5
br i1 %6, label %8, label %7
7: ; preds = %8, %1
ret void
8: ; preds = %1, %8
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %0)
%11 = load float, float* %0
%12 = fcmp ult float %11, 0.000000e+00
%13 = fcmp ugt float %11, 1.000000e+01
%14 = or i1 %12, %13
br i1 %14, label %8, label %7
}