#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 EthernetPacketPutInternal(unsigned long, unsigned char *, long);
long EthernetPacketPut(unsigned long ulBase, unsigned char *pucBuf,
                       long lBufLen) {
  DEBUG_ASSERT(ulBase == 0x40048000);
  DEBUG_ASSERT(pucBuf != 0);
  DEBUG_ASSERT(lBufLen > 0);
  while ((*((volatile unsigned long *)(ulBase + 0x00000038))) & 0x00000001) {
  }
  return (EthernetPacketPutInternal(ulBase, pucBuf, lBufLen));
}


x86 assembly (clang, -O0):
<EthernetPacketPut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x40048000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
cmpq   $0x0,-0x18(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    0x38(%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1188 <EthernetPacketPut+0x68>
jmp    116d <EthernetPacketPut+0x4d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <EthernetPacketPutInternal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EthernetPacketPut>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x40048000,%rbx
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
test   %r14,%r14
setg   %dil
call   1030 <DEBUG_ASSERT@plt>
nopl   0x0(%rax)
mov    0x38(%rbx),%rax
test   $0x1,%al
jne    1160 <EthernetPacketPut+0x40>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <EthernetPacketPutInternal@plt>

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

LLVM IR (-O2):
define i64 @EthernetPacketPut(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, 56
%14 = inttoptr i64 %13 to i64*
br label %15
15: ; preds = %15, %3
%16 = load volatile i64, i64* %14
%17 = and i64 %16, 1
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %15
19: ; preds = %15
%20 = tail call i64 @EthernetPacketPutInternal(i64 %0, i8* %1, i64 %2)
ret i64 %20
}