#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*/ DEBUG_ASSERT(int);
long EthernetPacketGetInternal(unsigned long, unsigned char *, long);
long EthernetPacketGetNonBlocking(unsigned long ulBase, unsigned char *pucBuf,
                                  long lBufLen) {
  DEBUG_ASSERT(ulBase == 0x40048000);
  DEBUG_ASSERT(pucBuf != 0);
  DEBUG_ASSERT(lBufLen > 0);
  if (((*((volatile unsigned long *)(ulBase + 0x00000034))) & 0x0000003F) ==
      0) {
    return (0);
  }
  return (EthernetPacketGetInternal(ulBase, pucBuf, lBufLen));
}


x86 assembly (clang, -O0):
<EthernetPacketGetNonBlocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x40048000,-0x10(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <DEBUG_ASSERT@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <DEBUG_ASSERT@plt>
cmpq   $0x0,-0x20(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rax
mov    0x34(%rax),%rax
and    $0x3f,%rax
cmp    $0x0,%rax
jne    1190 <EthernetPacketGetNonBlocking+0x70>
movq   $0x0,-0x8(%rbp)
jmp    11a5 <EthernetPacketGetNonBlocking+0x85>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <EthernetPacketGetInternal@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EthernetPacketGetNonBlocking>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x40048000,%rbx
sete   %dil
call   1040 <DEBUG_ASSERT@plt>
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1040 <DEBUG_ASSERT@plt>
xor    %edi,%edi
test   %r14,%r14
setg   %dil
call   1040 <DEBUG_ASSERT@plt>
testq  $0x3f,0x34(%rbx)
je     1179 <EthernetPacketGetNonBlocking+0x59>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <EthernetPacketGetInternal@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @EthernetPacketGetNonBlocking(i64 %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i64
store i64 %0, i64* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%8 = load i64, i64* %5
%9 = icmp eq i64 %8, 1074036736
%10 = zext i1 %9 to i32
%11 = call i32 @DEBUG_ASSERT(i32 %10)
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
%14 = zext i1 %13 to i32
%15 = call i32 @DEBUG_ASSERT(i32 %14)
%16 = load i64, i64* %7
%17 = icmp sgt i64 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @DEBUG_ASSERT(i32 %18)
%20 = load i64, i64* %5
%21 = add i64 %20, 52
%22 = inttoptr i64 %21 to i64*
%23 = load volatile i64, i64* %22
%24 = and i64 %23, 63
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %3
store i64 0, i64* %4
br label %32
27: ; preds = %3
%28 = load i64, i64* %5
%29 = load i8*, i8** %6
%30 = load i64, i64* %7
%31 = call i64 @EthernetPacketGetInternal(i64 %28, i8* %29, i64 %30)
store i64 %31, i64* %4
br label %32
32: ; preds = %27, %26
%33 = load i64, i64* %4
ret i64 %33
}

LLVM IR (-O2):
define i64 @EthernetPacketGetNonBlocking(i64 %0, i8* %1, i64 %2) {
%4 = icmp eq i64 %0, 1074036736
%5 = zext i1 %4 to i32
%6 = tail call i32 @DEBUG_ASSERT(i32 %5)
%7 = icmp ne i8* %1, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @DEBUG_ASSERT(i32 %8)
%10 = icmp sgt i64 %2, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @DEBUG_ASSERT(i32 %11)
%13 = add i64 %0, 52
%14 = inttoptr i64 %13 to i64*
%15 = load volatile i64, i64* %14
%16 = and i64 %15, 63
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %3
%19 = tail call i64 @EthernetPacketGetInternal(i64 %0, i8* %1, i64 %2)
br label %20
20: ; preds = %3, %18
%21 = phi i64 [ %19, %18 ], [ 0, %3 ]
ret i64 %21
}