#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*/ LimpaBuffer();
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *);
int leInt(int min, int max) {
  int teste, i;
  teste = scanf("%d", &i);
  while (teste != 1 || i < min || i > max) {
    LimpaBuffer();
    printf("Digite um valor valido!\n.> ");
    teste = scanf("%d", &i);
  }
  return i;
}


x86 assembly (clang, -O0):
<leInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xebb(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jne    117d <leInt+0x4d>
mov    -0x10(%rbp),%ecx
mov    $0x1,%al
cmp    -0x4(%rbp),%ecx
mov    %al,-0x11(%rbp)
jl     117d <leInt+0x4d>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    118d <leInt+0x5d>
jmp    11b8 <leInt+0x88>
mov    $0x0,%al
call   1030 <LimpaBuffer@plt>
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
lea    0xe59(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0xc(%rbp)
jmp    1151 <leInt+0x21>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leInt>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %edi,%r15d
lea    0xeb7(%rip),%r12
lea    0xc(%rsp),%rbp
lea    0xeae(%rip),%rbx
jmp    116f <leInt+0x3f>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <LimpaBuffer@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1160 <leInt+0x30>
mov    0xc(%rsp),%eax
cmp    %r15d,%eax
jl     1160 <leInt+0x30>
cmp    %r14d,%eax
jg     1160 <leInt+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [28 x i8] c"Digite um valor valido!\0A.> \00"
define i32 @leInt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 %7, i32* %5
br label %8
8: ; preds = %21, %2
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 1
br i1 %10, label %19, label %11
11: ; preds = %8
%12 = load i32, i32* %6
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp sgt i32 %16, %17
br label %19
19: ; preds = %15, %11, %8
%20 = phi i1 [ true, %11 ], [ true, %8 ], [ %18, %15 ]
br i1 %20, label %21, label %25
21: ; preds = %19
%22 = call i32 (...) @LimpaBuffer()
%23 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 %24, i32* %5
br label %8
25: ; preds = %19
%26 = load i32, i32* %6
ret i32 %26
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [28 x i8] c"Digite um valor valido!\0A.> \00"
define i32 @leInt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
br label %5
5: ; preds = %13, %2
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, %0
%11 = icmp sgt i32 %9, %1
%12 = or i1 %10, %11
br i1 %12, label %13, label %16
13: ; preds = %5, %8
%14 = call i32 (...) @LimpaBuffer()
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %5
16: ; preds = %8
ret i32 %9
}