#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_eb_access(uint32_t erase_block, uint32_t count) {
  if (erase_block >= ((4 * 1024 * 1024) / (64 * 1024))) {
    do {
      do {
      } while (0);
    } while (0);
    return (-3);
  } else if (count > ((4 * 1024 * 1024) / (64 * 1024))) {
    do {
      do {
      } while (0);
    } while (0);
    return (-3);
  } else if ((erase_block + count) > ((4 * 1024 * 1024) / (64 * 1024))) {
    do {
      do {
      } while (0);
    } while (0);
    return (-3);
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<check_eb_access>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x40,-0x8(%rbp)
jl     1134 <check_eb_access+0x34>
jmp    1119 <check_eb_access+0x19>
jmp    111e <check_eb_access+0x1e>
jmp    1123 <check_eb_access+0x23>
jmp    1128 <check_eb_access+0x28>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1194 <check_eb_access+0x94>
cmpl   $0x40,-0xc(%rbp)
jle    115e <check_eb_access+0x5e>
jmp    1143 <check_eb_access+0x43>
jmp    1148 <check_eb_access+0x48>
jmp    114d <check_eb_access+0x4d>
jmp    1152 <check_eb_access+0x52>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1194 <check_eb_access+0x94>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x40,%eax
jle    118d <check_eb_access+0x8d>
jmp    1172 <check_eb_access+0x72>
jmp    1177 <check_eb_access+0x77>
jmp    117c <check_eb_access+0x7c>
jmp    1181 <check_eb_access+0x81>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1194 <check_eb_access+0x94>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @check_eb_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, 64
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, 64
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, 64
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_eb_access(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 63
%4 = icmp sgt i32 %1, 64
%5 = or i1 %3, %4
%6 = add nsw i32 %1, %0
%7 = icmp sgt i32 %6, 64
%8 = select i1 %5, i1 true, i1 %7
%9 = select i1 %8, i32 -3, i32 0
ret i32 %9
}