#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 */
unsigned int strtol(char *, char **, int /*<<< orphan*/);
bool getnumber(char *s, unsigned int min, unsigned int max, unsigned int *no) {
  char *myend;
  *no = strtol(s, &myend, 0);
  if (s && *myend == '\0' && min <= *no && *no <= max)
    return true;
  return false;
}


x86 assembly (clang, -O0):
<getnumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtol@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     1182 <getnumber+0x72>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1182 <getnumber+0x72>
mov    -0x14(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
ja     1182 <getnumber+0x72>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
cmp    -0x18(%rbp),%eax
ja     1182 <getnumber+0x72>
movl   $0x1,-0x4(%rbp)
jmp    1189 <getnumber+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getnumber>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbp
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <strtol@plt>
mov    %eax,(%rbx)
test   %rbp,%rbp
je     114c <getnumber+0x3c>
mov    (%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    114c <getnumber+0x3c>
cmp    %r15d,%eax
jb     114c <getnumber+0x3c>
mov    $0x1,%ecx
cmp    %r14d,%eax
jbe    114e <getnumber+0x3e>
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getnumber(i8* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%11 = load i8*, i8** %6
%12 = call i32 @strtol(i8* %11, i8** %10, i32 0)
%13 = load i32*, i32** %9
store i32 %12, i32* %13
%14 = load i8*, i8** %6
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %32
16: ; preds = %4
%17 = load i8*, i8** %10
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %32
21: ; preds = %16
%22 = load i32, i32* %7
%23 = load i32*, i32** %9
%24 = load i32, i32* %23
%25 = icmp ule i32 %22, %24
br i1 %25, label %26, label %32
26: ; preds = %21
%27 = load i32*, i32** %9
%28 = load i32, i32* %27
%29 = load i32, i32* %8
%30 = icmp ule i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 1, i32* %5
br label %33
32: ; preds = %26, %21, %16, %4
store i32 0, i32* %5
br label %33
33: ; preds = %32, %31
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
define i32 @getnumber(i8* %0, i32 %1, i32 %2, i32* nocapture writeonly %3) {
%5 = alloca i8*
%6 = bitcast i8** %5 to i8*
%7 = call i32 @strtol(i8* %0, i8** %5, i32 0)
store i32 %7, i32* %3
%8 = icmp eq i8* %0, null
br i1 %8, label %17, label %9
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
%13 = icmp ult i32 %7, %1
%14 = select i1 %12, i1 true, i1 %13
%15 = icmp ugt i32 %7, %2
%16 = select i1 %14, i1 true, i1 %15
br i1 %16, label %17, label %18
17: ; preds = %9, %4
br label %18
18: ; preds = %9, %17
%19 = phi i32 [ 0, %17 ], [ 1, %9 ]
ret i32 %19
}