#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);
unsigned long EthernetConfigGet(unsigned long ulBase) {
  unsigned long ulConfig;
  DEBUG_ASSERT(ulBase == 0x40048000);
  ulConfig = (*((volatile unsigned long *)(ulBase + 0x0000003C))) << 16;
  ulConfig |=
      ((*((volatile unsigned long *)(ulBase + 0x00000008))) & ~(0x00000001))
      << 8;
  ulConfig |=
      (*((volatile unsigned long *)(ulBase + 0x0000000C))) & ~(0x00000001);
  return (ulConfig);
}


x86 assembly (clang, -O0):
<EthernetConfigGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x40048000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    0x3c(%rax),%rax
shl    $0x10,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
and    $0xfffffffffffffffe,%rax
shl    $0x8,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rax
and    $0xfffffffffffffffe,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EthernetConfigGet>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x40048000,%rbx
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    0x3c(%rbx),%rcx
shl    $0x10,%rcx
mov    0x8(%rbx),%rdx
and    $0xfffffffffffffffe,%rdx
shl    $0x8,%rdx
mov    0xc(%rbx),%rax
and    $0xfffffffffffffffe,%rax
or     %rcx,%rax
or     %rdx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @EthernetConfigGet(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 1074036736
%6 = zext i1 %5 to i32
%7 = call i32 @DEBUG_ASSERT(i32 %6)
%8 = load i64, i64* %2
%9 = add i64 %8, 60
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
%12 = shl i64 %11, 16
store i64 %12, i64* %3
%13 = load i64, i64* %2
%14 = add i64 %13, 8
%15 = inttoptr i64 %14 to i64*
%16 = load volatile i64, i64* %15
%17 = and i64 %16, -2
%18 = shl i64 %17, 8
%19 = load i64, i64* %3
%20 = or i64 %19, %18
store i64 %20, i64* %3
%21 = load i64, i64* %2
%22 = add i64 %21, 12
%23 = inttoptr i64 %22 to i64*
%24 = load volatile i64, i64* %23
%25 = and i64 %24, -2
%26 = load i64, i64* %3
%27 = or i64 %26, %25
store i64 %27, i64* %3
%28 = load i64, i64* %3
ret i64 %28
}

LLVM IR (-O2):
define i64 @EthernetConfigGet(i64 %0) {
%2 = icmp eq i64 %0, 1074036736
%3 = zext i1 %2 to i32
%4 = tail call i32 @DEBUG_ASSERT(i32 %3)
%5 = add i64 %0, 60
%6 = inttoptr i64 %5 to i64*
%7 = load volatile i64, i64* %6
%8 = shl i64 %7, 16
%9 = add i64 %0, 8
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
%12 = shl i64 %11, 8
%13 = and i64 %12, -512
%14 = or i64 %13, %8
%15 = add i64 %0, 12
%16 = inttoptr i64 %15 to i64*
%17 = load volatile i64, i64* %16
%18 = and i64 %17, -2
%19 = or i64 %14, %18
ret i64 %19
}