#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*/ emptyBuffer();
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, long *);
long getNumber(const char *nom, long min, long max) {
  int ok = 0;
  long n = 0;
  int checkMax = 1;
  if (max <= min) {
    checkMax = 0;
  }
  do {
    if (checkMax) {
      printf("Input %ld < %s < %ld : ", min - 1, nom, max + 1);
    } else {
      printf("Input %s > %ld : ", nom, min - 1);
    }
    ok = scanf("%ld", &n);
    emptyBuffer();
  } while (!ok || n < min || (checkMax && n > max));
  return n;
}


x86 assembly (clang, -O0):
<getNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     116f <getNumber+0x3f>
movl   $0x0,-0x2c(%rbp)
jmp    1174 <getNumber+0x44>
cmpl   $0x0,-0x2c(%rbp)
je     11a5 <getNumber+0x75>
mov    -0x10(%rbp),%rsi
sub    $0x1,%rsi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
add    $0x1,%rcx
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bf <getNumber+0x8f>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
sub    $0x1,%rdx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe64(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <emptyBuffer@plt>
mov    $0x1,%al
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x2d(%rbp)
je     121e <getNumber+0xee>
mov    -0x28(%rbp),%rcx
mov    $0x1,%al
cmp    -0x10(%rbp),%rcx
mov    %al,-0x2d(%rbp)
jl     121e <getNumber+0xee>
xor    %eax,%eax
cmpl   $0x0,-0x2c(%rbp)
mov    %al,-0x2e(%rbp)
je     1218 <getNumber+0xe8>
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
setg   %al
mov    %al,-0x2e(%rbp)
mov    -0x2e(%rbp),%al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
test   $0x1,%al
jne    1174 <getNumber+0x44>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNumber>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
movq   $0x0,0x8(%rsp)
lea    -0x1(%rsi),%r12
lea    0x1(%rdx),%rax
mov    %rax,0x10(%rsp)
lea    0x8(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %rbx,%r14
jle    1190 <getNumber+0x60>
lea    0xe84(%rip),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    0x10(%rsp),%rcx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11a4 <getNumber+0x74>
lea    0xe81(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <emptyBuffer@plt>
test   %ebp,%ebp
je     1170 <getNumber+0x40>
mov    0x8(%rsp),%rax
cmp    %rbx,%rax
jl     1170 <getNumber+0x40>
cmp    %rbx,%r14
jle    11d4 <getNumber+0xa4>
cmp    %r14,%rax
jg     1170 <getNumber+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Input %ld < %s < %ld : \00"
@.str.1 = [18 x i8] c"Input %s > %ld : \00"
@.str.2 = [4 x i8] c"%ld\00"
define i64 @getNumber(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = alloca i64
%9 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
store i32 0, i32* %7
store i64 0, i64* %8
store i32 1, i32* %9
%10 = load i64, i64* %6
%11 = load i64, i64* %5
%12 = icmp sle i64 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 0, i32* %9
br label %14
14: ; preds = %13, %3
br label %15
15: ; preds = %49, %14
%16 = load i32, i32* %9
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = load i64, i64* %5
%20 = sub nsw i64 %19, 1
%21 = load i8*, i8** %4
%22 = load i64, i64* %6
%23 = add nsw i64 %22, 1
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 %20, i8* %21, i64 %23)
br label %30
25: ; preds = %15
%26 = load i8*, i8** %4
%27 = load i64, i64* %5
%28 = sub nsw i64 %27, 1
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %26, i64 %28)
br label %30
30: ; preds = %25, %18
%31 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %8)
store i32 %31, i32* %7
%32 = call i32 (...) @emptyBuffer()
br label %33
33: ; preds = %30
%34 = load i32, i32* %7
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %49
36: ; preds = %33
%37 = load i64, i64* %8
%38 = load i64, i64* %5
%39 = icmp slt i64 %37, %38
br i1 %39, label %49, label %40
40: ; preds = %36
%41 = load i32, i32* %9
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = load i64, i64* %8
%45 = load i64, i64* %6
%46 = icmp sgt i64 %44, %45
br label %47
47: ; preds = %43, %40
%48 = phi i1 [ false, %40 ], [ %46, %43 ]
br label %49
49: ; preds = %47, %36, %33
%50 = phi i1 [ true, %36 ], [ true, %33 ], [ %48, %47 ]
br i1 %50, label %15, label %51
51: ; preds = %49
%52 = load i64, i64* %8
ret i64 %52
}

LLVM IR (-O2):
@.str = [24 x i8] c"Input %ld < %s < %ld : \00"
@.str.1 = [18 x i8] c"Input %s > %ld : \00"
@.str.2 = [4 x i8] c"%ld\00"
define i64 @getNumber(i8* %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%6 = icmp sgt i64 %2, %1
%7 = add nsw i64 %1, -1
%8 = add nsw i64 %2, 1
br label %9
9: ; preds = %24, %3
br i1 %6, label %10, label %12
10: ; preds = %9
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 %7, i8* %0, i64 %8)
br label %14
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0, i64 %7)
br label %14
14: ; preds = %12, %10
%15 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %4)
%16 = call i32 (...) @emptyBuffer()
%17 = icmp eq i32 %15, 0
br i1 %17, label %24, label %18
18: ; preds = %14
%19 = load i64, i64* %4
%20 = icmp slt i64 %19, %1
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = icmp sgt i64 %19, %2
%23 = select i1 %6, i1 %22, i1 false
br i1 %23, label %24, label %25
24: ; preds = %21, %18, %14
br label %9
25: ; preds = %21
ret i64 %19
}