#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);
void EthernetMACAddrSet(unsigned long ulBase, unsigned char *pucMACAddr) {
  unsigned long ulTemp;
  unsigned char *pucTemp = (unsigned char *)&ulTemp;
  DEBUG_ASSERT(ulBase == 0x40048000);
  DEBUG_ASSERT(pucMACAddr != 0);
  pucTemp[0] = pucMACAddr[0];
  pucTemp[1] = pucMACAddr[1];
  pucTemp[2] = pucMACAddr[2];
  pucTemp[3] = pucMACAddr[3];
  (*((volatile unsigned long *)(ulBase + 0x00000014))) = ulTemp;
  ulTemp = 0;
  pucTemp[0] = pucMACAddr[4];
  pucTemp[1] = pucMACAddr[5];
  (*((volatile unsigned long *)(ulBase + 0x00000018))) = ulTemp;
}


x86 assembly (clang, -O0):
<EthernetMACAddrSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%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>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x10(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x14(%rax)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EthernetMACAddrSet>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x40048000,%r14
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <DEBUG_ASSERT@plt>
mov    (%rbx),%eax
mov    %rax,0x14(%r14)
movzwl 0x4(%rbx),%eax
mov    %rax,0x18(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @EthernetMACAddrSet(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%7 = bitcast i64* %5 to i8*
store i8* %7, i8** %6
%8 = load i64, i64* %3
%9 = icmp eq i64 %8, 1074036736
%10 = zext i1 %9 to i32
%11 = call i32 @DEBUG_ASSERT(i32 %10)
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
%14 = zext i1 %13 to i32
%15 = call i32 @DEBUG_ASSERT(i32 %14)
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = load i8*, i8** %6
%20 = getelementptr inbounds i8, i8* %19, i64 0
store i8 %18, i8* %20
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i64 1
store i8 %23, i8* %25
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 2
%28 = load i8, i8* %27
%29 = load i8*, i8** %6
%30 = getelementptr inbounds i8, i8* %29, i64 2
store i8 %28, i8* %30
%31 = load i8*, i8** %4
%32 = getelementptr inbounds i8, i8* %31, i64 3
%33 = load i8, i8* %32
%34 = load i8*, i8** %6
%35 = getelementptr inbounds i8, i8* %34, i64 3
store i8 %33, i8* %35
%36 = load i64, i64* %5
%37 = load i64, i64* %3
%38 = add i64 %37, 20
%39 = inttoptr i64 %38 to i64*
store volatile i64 %36, i64* %39
store i64 0, i64* %5
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i64 4
%42 = load i8, i8* %41
%43 = load i8*, i8** %6
%44 = getelementptr inbounds i8, i8* %43, i64 0
store i8 %42, i8* %44
%45 = load i8*, i8** %4
%46 = getelementptr inbounds i8, i8* %45, i64 5
%47 = load i8, i8* %46
%48 = load i8*, i8** %6
%49 = getelementptr inbounds i8, i8* %48, i64 1
store i8 %47, i8* %49
%50 = load i64, i64* %5
%51 = load i64, i64* %3
%52 = add i64 %51, 24
%53 = inttoptr i64 %52 to i64*
store volatile i64 %50, i64* %53
ret void
}

LLVM IR (-O2):
define void @EthernetMACAddrSet(i64 %0, i8* %1) {
%3 = icmp eq i64 %0, 1074036736
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = icmp ne i8* %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @DEBUG_ASSERT(i32 %7)
%9 = load i8, i8* %1
%10 = getelementptr inbounds i8, i8* %1, i64 1
%11 = load i8, i8* %10
%12 = getelementptr inbounds i8, i8* %1, i64 2
%13 = load i8, i8* %12
%14 = getelementptr inbounds i8, i8* %1, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i64
%17 = shl nuw nsw i64 %16, 24
%18 = zext i8 %13 to i64
%19 = shl nuw nsw i64 %18, 16
%20 = zext i8 %11 to i64
%21 = shl nuw nsw i64 %20, 8
%22 = zext i8 %9 to i64
%23 = or i64 %21, %22
%24 = or i64 %23, %19
%25 = or i64 %24, %17
%26 = add i64 %0, 20
%27 = inttoptr i64 %26 to i64*
store volatile i64 %25, i64* %27
%28 = getelementptr inbounds i8, i8* %1, i64 4
%29 = load i8, i8* %28
%30 = getelementptr inbounds i8, i8* %1, i64 5
%31 = load i8, i8* %30
%32 = zext i8 %31 to i64
%33 = shl nuw nsw i64 %32, 8
%34 = zext i8 %29 to i64
%35 = or i64 %33, %34
%36 = add i64 %0, 24
%37 = inttoptr i64 %36 to i64*
store volatile i64 %35, i64* %37
ret void
}