#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*/ assert(int /*<<< orphan*/);
bool parsing_ulong_out_of_range(unsigned long value, size_t size) {
  switch (size) {
  case 1:
    return value > 0xFFull;
  case 2:
    return value > 0xFFFFull;
  case 4:
    return value > 0xFFFFFFFFull;
  case 8:
    return false;
  default:
    assert(0);
  }
}


x86 assembly (clang, -O0):
<parsing_ulong_out_of_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
sub    $0x7,%rax
ja     119f <parsing_ulong_out_of_range+0x8f>
mov    -0x20(%rbp),%rax
lea    0xebf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpq   $0xff,-0x10(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11a6 <parsing_ulong_out_of_range+0x96>
cmpq   $0xffff,-0x10(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11a6 <parsing_ulong_out_of_range+0x96>
mov    $0xffffffff,%eax
cmp    %rax,-0x10(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11a6 <parsing_ulong_out_of_range+0x96>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <parsing_ulong_out_of_range+0x96>
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parsing_ulong_out_of_range>:
push   %rax
add    $0xffffffffffffffff,%rsi
cmp    $0x7,%rsi
ja     1146 <parsing_ulong_out_of_range+0x36>
xor    %eax,%eax
lea    0xedc(%rip),%rcx
movslq (%rcx,%rsi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
xor    %eax,%eax
cmp    $0x100,%rdi
jmp    1141 <parsing_ulong_out_of_range+0x31>
xor    %eax,%eax
cmp    $0x10000,%rdi
setae  %al
pop    %rcx
ret
xor    %edi,%edi
call   1030 <assert@plt>
pop    %rcx
ret
xor    %eax,%eax
shr    $0x20,%rdi
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @parsing_ulong_out_of_range(i64 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
switch i64 %6, label %20 [
i64 1, label %7
i64 2, label %11
i64 4, label %15
i64 8, label %19
]
7: ; preds = %2
%8 = load i64, i64* %4
%9 = icmp ugt i64 %8, 255
%10 = zext i1 %9 to i32
store i32 %10, i32* %3
br label %22
11: ; preds = %2
%12 = load i64, i64* %4
%13 = icmp ugt i64 %12, 65535
%14 = zext i1 %13 to i32
store i32 %14, i32* %3
br label %22
15: ; preds = %2
%16 = load i64, i64* %4
%17 = icmp ugt i64 %16, 4294967295
%18 = zext i1 %17 to i32
store i32 %18, i32* %3
br label %22
19: ; preds = %2
store i32 0, i32* %3
br label %22
20: ; preds = %2
%21 = call i32 @assert(i32 0)
br label %22
22: ; preds = %7, %11, %15, %19, %20
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @parsing_ulong_out_of_range(i64 %0, i64 %1) {
switch i64 %1, label %12 [
i64 1, label %3
i64 2, label %6
i64 4, label %9
i64 8, label %14
]
3: ; preds = %2
%4 = icmp ugt i64 %0, 255
%5 = zext i1 %4 to i32
br label %14
6: ; preds = %2
%7 = icmp ugt i64 %0, 65535
%8 = zext i1 %7 to i32
br label %14
9: ; preds = %2
%10 = icmp ugt i64 %0, 4294967295
%11 = zext i1 %10 to i32
br label %14
12: ; preds = %2
%13 = tail call i32 @assert(i32 0)
br label %14
14: ; preds = %2, %3, %6, %9, %12
%15 = phi i32 [ undef, %12 ], [ %11, %9 ], [ %8, %6 ], [ %5, %3 ], [ 0, %2 ]
ret i32 %15
}