#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 scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
bool xNumber_checkUint32(void *pvNumber, uint16_t u16NumberSize) {
  register uint16_t u16Index = 0;
  if (u16NumberSize <= 4) {
    return true;
  }
  for (u16Index = u16NumberSize - 5;
       u16NumberSize > u16Index && u16Index >= 0 &&
       ((uint8_t *)pvNumber)[u16Index] == 0;
       u16Index--)
    ;
  return u16Index == 0xFFFF && ((uint8_t *)pvNumber)[0] == 0;
}


x86 assembly (clang, -O0):
<xNumber_checkUint32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x14(%rbp)
jg     1128 <xNumber_checkUint32+0x28>
movl   $0x1,-0x4(%rbp)
jmp    11b2 <xNumber_checkUint32+0xb2>
mov    -0x14(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
cmp    -0x18(%rbp),%ecx
mov    %al,-0x19(%rbp)
jle    1164 <xNumber_checkUint32+0x64>
xor    %eax,%eax
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0x19(%rbp)
jl     1164 <xNumber_checkUint32+0x64>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1174 <xNumber_checkUint32+0x74>
jmp    1187 <xNumber_checkUint32+0x87>
jmp    1179 <xNumber_checkUint32+0x79>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1131 <xNumber_checkUint32+0x31>
xor    %eax,%eax
cmpl   $0xffff,-0x18(%rbp)
mov    %al,-0x1a(%rbp)
jne    11a7 <xNumber_checkUint32+0xa7>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
sete   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xNumber_checkUint32>:
mov    $0x1,%eax
cmp    $0x5,%esi
jl     1138 <xNumber_checkUint32+0x38>
add    $0xfffffffb,%esi
nopl   (%rax)
mov    %esi,%eax
cmpq   $0x0,(%rdi,%rax,8)
jne    1125 <xNumber_checkUint32+0x25>
lea    -0x1(%rsi),%eax
test   %esi,%esi
mov    %eax,%esi
jg     1110 <xNumber_checkUint32+0x10>
xor    %eax,%eax
ret
xor    %eax,%eax
cmp    $0xffff,%esi
jne    1138 <xNumber_checkUint32+0x38>
xor    %eax,%eax
cmpq   $0x0,(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @xNumber_checkUint32(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 0, i32* %6
%7 = load i32, i32* %5
%8 = icmp sle i32 %7, 4
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 1, i32* %3
br label %46
10: ; preds = %2
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 5
store i32 %12, i32* %6
br label %13
13: ; preds = %31, %10
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i32, i32* %6
%19 = icmp sge i32 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = load i8*, i8** %4
%22 = bitcast i8* %21 to i64*
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i64, i64* %22, i64 %24
%26 = load i64, i64* %25
%27 = icmp eq i64 %26, 0
br label %28
28: ; preds = %20, %17, %13
%29 = phi i1 [ false, %17 ], [ false, %13 ], [ %27, %20 ]
br i1 %29, label %30, label %34
30: ; preds = %28
br label %31
31: ; preds = %30
%32 = load i32, i32* %6
%33 = add nsw i32 %32, -1
store i32 %33, i32* %6
br label %13
34: ; preds = %28
%35 = load i32, i32* %6
%36 = icmp eq i32 %35, 65535
br i1 %36, label %37, label %43
37: ; preds = %34
%38 = load i8*, i8** %4
%39 = bitcast i8* %38 to i64*
%40 = getelementptr inbounds i64, i64* %39, i64 0
%41 = load i64, i64* %40
%42 = icmp eq i64 %41, 0
br label %43
43: ; preds = %37, %34
%44 = phi i1 [ false, %34 ], [ %42, %37 ]
%45 = zext i1 %44 to i32
store i32 %45, i32* %3
br label %46
46: ; preds = %43, %9
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
define i32 @xNumber_checkUint32(i8* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 5
br i1 %3, label %22, label %4
4: ; preds = %2
%5 = bitcast i8* %0 to i64*
%6 = add nsw i32 %1, -5
br label %7
7: ; preds = %4, %13
%8 = phi i32 [ %14, %13 ], [ %6, %4 ]
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i64, i64* %5, i64 %9
%11 = load i64, i64* %10
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = add nsw i32 %8, -1
%15 = icmp sgt i32 %8, 0
br i1 %15, label %7, label %22
16: ; preds = %7
%17 = icmp eq i32 %8, 65535
br i1 %17, label %18, label %22
18: ; preds = %16
%19 = load i64, i64* %5
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %13, %16, %18, %2
%23 = phi i32 [ 1, %2 ], [ 0, %16 ], [ %21, %18 ], [ 0, %13 ]
ret i32 %23
}