#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*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
int check_boundaries(int indx, int MXINDX, char name[], int maxv) {
  if (maxv) {
    if (indx > MXINDX) {
      fprintf(stderr,
              "Warning: the upper boundary has been reached. Increase %s= %d\n",
              name, indx);
      return (1);
    }
  } else {
    if (indx < MXINDX) {
      fprintf(stderr,
              "Warning: the lower boundary has been reached. Decrease %s= %d\n",
              name, indx);
      return (1);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<check_boundaries>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1168 <check_boundaries+0x58>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1163 <check_boundaries+0x53>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%ecx
lea    0xeae(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a8 <check_boundaries+0x98>
jmp    11a1 <check_boundaries+0x91>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119c <check_boundaries+0x8c>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%ecx
lea    0xeb4(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a8 <check_boundaries+0x98>
jmp    11a1 <check_boundaries+0x91>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_boundaries>:
mov    %edi,%r8d
xor    %eax,%eax
test   %ecx,%ecx
je     1127 <check_boundaries+0x17>
cmp    %esi,%r8d
jle    114e <check_boundaries+0x3e>
lea    0xedb(%rip),%rsi
jmp    1133 <check_boundaries+0x23>
cmp    %esi,%r8d
jge    114e <check_boundaries+0x3e>
lea    0xf0c(%rip),%rsi
push   %rax
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
mov    %r8d,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [63 x i8] c"Warning: the upper boundary has been reached. Increase %s= %d\0A\00"
@.str.1 = [63 x i8] c"Warning: the lower boundary has been reached. Decrease %s= %d\0A\00"
define i32 @check_boundaries(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %4
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %8
%19 = load i32, i32* %6
%20 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %19)
store i32 1, i32* %5
br label %33
21: ; preds = %12
br label %32
22: ; preds = %4
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %8
%29 = load i32, i32* %6
%30 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i8* %28, i32 %29)
store i32 1, i32* %5
br label %33
31: ; preds = %22
br label %32
32: ; preds = %31, %21
store i32 0, i32* %5
br label %33
33: ; preds = %32, %26, %16
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [63 x i8] c"Warning: the upper boundary has been reached. Increase %s= %d\0A\00"
@.str.1 = [63 x i8] c"Warning: the lower boundary has been reached. Decrease %s= %d\0A\00"
define i32 @check_boundaries(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = icmp sgt i32 %0, %1
br i1 %7, label %10, label %14
8: ; preds = %4
%9 = icmp slt i32 %0, %1
br i1 %9, label %10, label %14
10: ; preds = %8, %6
%11 = phi i8* [ getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), %6 ], [ getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), %8 ]
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* %11, i8* %2, i32 %0)
br label %14
14: ; preds = %10, %6, %8
%15 = phi i32 [ 0, %8 ], [ 0, %6 ], [ 1, %10 ]
ret i32 %15
}