#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*/ braf_displayErrorInInterpreter(char *, int const, int const);
int /*<<< orphan*/ sprintf(char *, char *, int const);
unsigned int braf_tapeAccessCheck(const int currIndex, const int col,
                                  const int rw) {
  if (currIndex < 1 || currIndex > 30000) {
    char msg[105];
    sprintf(msg,
            "Attempting to access non-existent Cell #%d. Accessible cells "
            "range from Cell #1 to Cell #30000.",
            currIndex);
    braf_displayErrorInInterpreter(msg, col, rw);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<braf_tapeAccessCheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     114b <braf_tapeAccessCheck+0x2b>
cmpl   $0x7530,-0x8(%rbp)
jle    1179 <braf_tapeAccessCheck+0x59>
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xea7(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x80(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <braf_displayErrorInInterpreter@plt>
movl   $0x1,-0x4(%rbp)
jmp    1180 <braf_tapeAccessCheck+0x60>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<braf_tapeAccessCheck>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %edx,%ebx
mov    %edi,%edx
lea    -0x7531(%rdx),%ecx
xor    %eax,%eax
cmp    $0xffff8acf,%ecx
ja     1161 <braf_tapeAccessCheck+0x41>
mov    %esi,%ebp
lea    0xebb(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <braf_displayErrorInInterpreter@plt>
mov    $0x1,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [96 x i8] c"Attempting to access non-existent Cell #%d. Accessible cells range from Cell to Cell.\00"
define i32 @braf_tapeAccessCheck(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [105 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 1
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = load i32, i32* %5
%13 = icmp sgt i32 %12, 30000
br i1 %13, label %14, label %22
14: ; preds = %11, %3
%15 = getelementptr inbounds [105 x i8], [105 x i8]* %8, i64 0, i64 0
%16 = load i32, i32* %5
%17 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [105 x i8], [105 x i8]* %8, i64 0, i64 0
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = call i32 @braf_displayErrorInInterpreter(i8* %18, i32 %19, i32 %20)
store i32 1, i32* %4
br label %23
22: ; preds = %11
store i32 0, i32* %4
br label %23
23: ; preds = %22, %14
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
@.str = [96 x i8] c"Attempting to access non-existent Cell #%d. Accessible cells range from Cell to Cell.\00"
define i32 @braf_tapeAccessCheck(i32 %0, i32 %1, i32 %2) {
%4 = alloca [105 x i8]
%5 = add i32 %0, -30001
%6 = icmp ult i32 %5, -30000
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = getelementptr inbounds [105 x i8], [105 x i8]* %4, i64 0, i64 0
%9 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i32 %0)
%10 = call i32 @braf_displayErrorInInterpreter(i8* %8, i32 %1, i32 %2)
br label %11
11: ; preds = %3, %7
%12 = phi i32 [ 1, %7 ], [ 0, %3 ]
ret i32 %12
}