#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 */
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void get_And_Verify_Int(int *test, int lower_bound, int upper_bound) {
  scanf("%d", test);
  while (*test > upper_bound || *test < lower_bound) {
    while (getchar() != '\n')
      ;
    printf("Your choice is not valid, please try again.\n");
    scanf("%d", test);
  }
}


x86 assembly (clang, -O0):
<get_And_Verify_Int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    $0x1,%al
cmp    -0x10(%rbp),%ecx
mov    %al,-0x11(%rbp)
jg     1175 <get_And_Verify_Int+0x45>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1185 <get_And_Verify_Int+0x55>
jmp    11c3 <get_And_Verify_Int+0x93>
jmp    118a <get_And_Verify_Int+0x5a>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11a2 <get_And_Verify_Int+0x72>
jmp    118a <get_And_Verify_Int+0x5a>
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe47(%rip),%rdi
call   1050 <scanf@plt>
jmp    1152 <get_And_Verify_Int+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_And_Verify_Int>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
lea    0xeb9(%rip),%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x0(%rbp),%eax
cmp    %ebx,%eax
jg     115b <get_And_Verify_Int+0x2b>
cmp    %r14d,%eax
jge    119a <get_And_Verify_Int+0x6a>
lea    0xea1(%rip),%r15
lea    0xe97(%rip),%r12
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1170 <get_And_Verify_Int+0x40>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x0(%rbp),%eax
cmp    %ebx,%eax
jg     1170 <get_And_Verify_Int+0x40>
cmp    %r14d,%eax
jl     1170 <get_And_Verify_Int+0x40>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [45 x i8] c"Your choice is not valid, please try again.\0A\00"
define void @get_And_Verify_Int(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
br label %9
9: ; preds = %27, %3
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = load i32, i32* %6
%13 = icmp sgt i32 %11, %12
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br label %19
19: ; preds = %14, %9
%20 = phi i1 [ true, %9 ], [ %18, %14 ]
br i1 %20, label %21, label %31
21: ; preds = %19
br label %22
22: ; preds = %26, %21
%23 = call signext i8 (...) @getchar()
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 10
br i1 %25, label %26, label %27
26: ; preds = %22
br label %22
27: ; preds = %22
%28 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%29 = load i32*, i32** %4
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %29)
br label %9
31: ; preds = %19
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [44 x i8] c"Your choice is not valid, please try again.\00"
define void @get_And_Verify_Int(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %0)
%5 = load i32, i32* %0
%6 = icmp sgt i32 %5, %2
%7 = icmp slt i32 %5, %1
%8 = or i1 %6, %7
br i1 %8, label %9, label %20
9: ; preds = %3, %12
%10 = tail call signext i8 (...) @getchar()
%11 = icmp eq i8 %10, 10
br i1 %11, label %13, label %12
12: ; preds = %9, %13
br label %9
13: ; preds = %9
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %0)
%16 = load i32, i32* %0
%17 = icmp sgt i32 %16, %2
%18 = icmp slt i32 %16, %1
%19 = or i1 %17, %18
br i1 %19, label %12, label %20
20: ; preds = %13, %3
ret void
}