#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 */
typedef int uint32_t;

/* Variables and functions */
int check_page_access(uint32_t page, uint32_t count) {
  if (page >= ((4 * 1024 * 1024) / 256)) {
    do {
      do {
      } while (0);
    } while (0);
    return (-3);
  } else if (count > ((4 * 1024 * 1024) / 256)) {
    do {
      do {
      } while (0);
    } while (0);
    return (-3);
  } else if ((page + count) > ((4 * 1024 * 1024) / 256)) {
    do {
      do {
      } while (0);
    } while (0);
    return (-3);
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<check_page_access>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x4000,-0x8(%rbp)
jl     1137 <check_page_access+0x37>
jmp    111c <check_page_access+0x1c>
jmp    1121 <check_page_access+0x21>
jmp    1126 <check_page_access+0x26>
jmp    112b <check_page_access+0x2b>
movl   $0xfffffffd,-0x4(%rbp)
jmp    119c <check_page_access+0x9c>
cmpl   $0x4000,-0xc(%rbp)
jle    1164 <check_page_access+0x64>
jmp    1149 <check_page_access+0x49>
jmp    114e <check_page_access+0x4e>
jmp    1153 <check_page_access+0x53>
jmp    1158 <check_page_access+0x58>
movl   $0xfffffffd,-0x4(%rbp)
jmp    119c <check_page_access+0x9c>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x4000,%eax
jle    1195 <check_page_access+0x95>
jmp    117a <check_page_access+0x7a>
jmp    117f <check_page_access+0x7f>
jmp    1184 <check_page_access+0x84>
jmp    1189 <check_page_access+0x89>
movl   $0xfffffffd,-0x4(%rbp)
jmp    119c <check_page_access+0x9c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_page_access>:
cmp    $0x4000,%edi
setl   %al
cmp    $0x4001,%esi
setl   %cl
and    %al,%cl
add    %edi,%esi
cmp    $0x4001,%esi
setl   %al
and    %cl,%al
movzbl %al,%eax
lea    (%rax,%rax,2),%eax
add    $0xfffffffd,%eax
ret

LLVM IR (-O0):
define i32 @check_page_access(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp sge i32 %6, 16384
br i1 %7, label %8, label %13
8: ; preds = %2
br label %9
9: ; preds = %8
br label %10
10: ; preds = %9
br label %11
11: ; preds = %10
br label %12
12: ; preds = %11
store i32 -3, i32* %3
br label %32
13: ; preds = %2
%14 = load i32, i32* %5
%15 = icmp sgt i32 %14, 16384
br i1 %15, label %16, label %21
16: ; preds = %13
br label %17
17: ; preds = %16
br label %18
18: ; preds = %17
br label %19
19: ; preds = %18
br label %20
20: ; preds = %19
store i32 -3, i32* %3
br label %32
21: ; preds = %13
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = add nsw i32 %22, %23
%25 = icmp sgt i32 %24, 16384
br i1 %25, label %26, label %31
26: ; preds = %21
br label %27
27: ; preds = %26
br label %28
28: ; preds = %27
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29
store i32 -3, i32* %3
br label %32
31: ; preds = %21
store i32 0, i32* %3
br label %32
32: ; preds = %31, %30, %20, %12
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @check_page_access(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 16383
%4 = icmp sgt i32 %1, 16384
%5 = or i1 %3, %4
%6 = add nsw i32 %1, %0
%7 = icmp sgt i32 %6, 16384
%8 = select i1 %5, i1 true, i1 %7
%9 = select i1 %8, i32 -3, i32 0
ret i32 %9
}