#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 rstdin_d();
int with_islimit_read_d(int n, int m) {
  int r;
  bool flag = false;
  do {
    if (flag)
      printf("Digito fuera de rango\n");
    printf("Introduza una opcion [%d, %d]: ", n, m);
    r = rstdin_d();
    flag = true;
  } while (r < n || r > m);
  return r;
}


x86 assembly (clang, -O0):
<with_islimit_read_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     114d <with_islimit_read_d+0x2d>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <rstdin_d@plt>
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%al
cmp    -0x4(%rbp),%ecx
mov    %al,-0x11(%rbp)
jl     118f <with_islimit_read_d+0x6f>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1135 <with_islimit_read_d+0x15>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<with_islimit_read_d>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xebe(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <rstdin_d@plt>
cmp    %ebp,%eax
jl     115c <with_islimit_read_d+0x2c>
cmp    %ebx,%eax
jle    1195 <with_islimit_read_d+0x65>
lea    0xebd(%rip),%r14
lea    0xe96(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <rstdin_d@plt>
cmp    %ebp,%eax
jl     1170 <with_islimit_read_d+0x40>
cmp    %ebx,%eax
jg     1170 <with_islimit_read_d+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Digito fuera de rango\0A\00"
@.str.1 = [32 x i8] c"Introduza una opcion [%d, %d]: \00"
define i32 @with_islimit_read_d(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
store i32 0, i32* %6
br label %7
7: ; preds = %25, %2
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %14)
%16 = call i32 (...) @rstdin_d()
store i32 %16, i32* %5
store i32 1, i32* %6
br label %17
17: ; preds = %12
%18 = load i32, i32* %5
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i32, i32* %5
%23 = load i32, i32* %4
%24 = icmp sgt i32 %22, %23
br label %25
25: ; preds = %21, %17
%26 = phi i1 [ true, %17 ], [ %24, %21 ]
br i1 %26, label %7, label %27
27: ; preds = %25
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"Introduza una opcion [%d, %d]: \00"
@str = [22 x i8] c"Digito fuera de rango\00"
define i32 @with_islimit_read_d(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %1)
%4 = tail call i32 (...) @rstdin_d()
%5 = icmp slt i32 %4, %0
%6 = icmp sgt i32 %4, %1
%7 = or i1 %5, %6
br i1 %7, label %8, label %15
8: ; preds = %2, %8
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %1)
%11 = tail call i32 (...) @rstdin_d()
%12 = icmp slt i32 %11, %0
%13 = icmp sgt i32 %11, %1
%14 = or i1 %12, %13
br i1 %14, label %8, label %15
15: ; preds = %8, %2
%16 = phi i32 [ %4, %2 ], [ %11, %8 ]
ret i32 %16
}