#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ file_print(char *, int /*<<< orphan*/);
char *numerate_number(int);
int /*<<< orphan*/ stderr;
void bound_values(int displacement, int number_of_bytes, int low, int high) {
  if ((high < displacement) || (displacement < low)) {
    file_print("A displacement of ", stderr);
    file_print(numerate_number(displacement), stderr);
    file_print(" does not fit in ", stderr);
    file_print(numerate_number(number_of_bytes), stderr);
    file_print(" bytes\n", stderr);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<bound_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     115c <bound_values+0x2c>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11db <bound_values+0xab>
mov    0x2e7d(%rip),%rax
mov    (%rax),%esi
lea    0xe94(%rip),%rdi
call   1050 <file_print@plt>
mov    -0x4(%rbp),%edi
call   1040 <numerate_number@plt>
mov    %rax,%rdi
mov    0x2e5d(%rip),%rax
mov    (%rax),%esi
call   1050 <file_print@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%esi
lea    0xe79(%rip),%rdi
call   1050 <file_print@plt>
mov    -0x8(%rbp),%edi
call   1040 <numerate_number@plt>
mov    %rax,%rdi
mov    0x2e2f(%rip),%rax
mov    (%rax),%esi
call   1050 <file_print@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
lea    0xe5d(%rip),%rdi
call   1050 <file_print@plt>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bound_values>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
cmp    %edx,%edi
jl     1145 <bound_values+0x15>
cmp    %ebp,%ecx
jl     1145 <bound_values+0x15>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e94(%rip),%r14
mov    (%r14),%esi
lea    0xeaa(%rip),%rdi
call   1050 <file_print@plt>
mov    %ebp,%edi
call   1040 <numerate_number@plt>
mov    (%r14),%esi
mov    %rax,%rdi
call   1050 <file_print@plt>
mov    (%r14),%esi
lea    0xe9c(%rip),%rdi
call   1050 <file_print@plt>
mov    %ebx,%edi
call   1040 <numerate_number@plt>
mov    (%r14),%esi
mov    %rax,%rdi
call   1050 <file_print@plt>
mov    (%r14),%esi
lea    0xe8d(%rip),%rdi
call   1050 <file_print@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"A displacement of \00"
@stderr = global i32 0
@.str.1 = [18 x i8] c" does not fit in \00"
@.str.2 = [8 x i8] c" bytes\0A\00"
@EXIT_FAILURE = global i32 0
define void @bound_values(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %16, label %12
12: ; preds = %4
%13 = load i32, i32* %5
%14 = load i32, i32* %7
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %33
16: ; preds = %12, %4
%17 = load i32, i32* @stderr
%18 = call i32 @file_print(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %5
%20 = call i8* @numerate_number(i32 %19)
%21 = load i32, i32* @stderr
%22 = call i32 @file_print(i8* %20, i32 %21)
%23 = load i32, i32* @stderr
%24 = call i32 @file_print(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %6
%26 = call i8* @numerate_number(i32 %25)
%27 = load i32, i32* @stderr
%28 = call i32 @file_print(i8* %26, i32 %27)
%29 = load i32, i32* @stderr
%30 = call i32 @file_print(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load i32, i32* @EXIT_FAILURE
%32 = call i32 @exit(i32 %31)
unreachable
33: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"A displacement of \00"
@stderr = global i32 0
@.str.1 = [18 x i8] c" does not fit in \00"
@.str.2 = [8 x i8] c" bytes\0A\00"
@EXIT_FAILURE = global i32 0
define void @bound_values(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %3, %0
%6 = icmp slt i32 %0, %2
%7 = or i1 %6, %5
br i1 %7, label %8, label %23
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = tail call i32 @file_print(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i8* @numerate_number(i32 %0)
%12 = load i32, i32* @stderr
%13 = tail call i32 @file_print(i8* %11, i32 %12)
%14 = load i32, i32* @stderr
%15 = tail call i32 @file_print(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = tail call i8* @numerate_number(i32 %1)
%17 = load i32, i32* @stderr
%18 = tail call i32 @file_print(i8* %16, i32 %17)
%19 = load i32, i32* @stderr
%20 = tail call i32 @file_print(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @exit(i32 %21)
unreachable
23: ; preds = %4
ret void
}