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

/* Variables and functions */
void EMACAddrGet(uint32_t ui32Base, uint32_t ui32Index, uint8_t *pui8MACAddr) {
  uint32_t ui32Val;
  ;
  ;
  ui32Val = (*((volatile uint32_t *)(ui32Base +
                                     (0x00000044 + ((0x0000004C - 0x00000044) *
                                                    (ui32Index))))));
  pui8MACAddr[0] = ui32Val & 0xFF;
  pui8MACAddr[1] = (ui32Val >> 8) & 0xFF;
  pui8MACAddr[2] = (ui32Val >> 16) & 0xFF;
  pui8MACAddr[3] = (ui32Val >> 24) & 0xFF;
  ui32Val = (*((volatile uint32_t *)(ui32Base +
                                     (0x00000040 + ((0x0000004C - 0x00000044) *
                                                    (ui32Index))))));
  pui8MACAddr[4] = ui32Val & 0xFF;
  pui8MACAddr[5] = (ui32Val >> 8) & 0xFF;
}


x86 assembly (clang, -O0):
<EMACAddrGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
add    $0x44,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
add    $0x40,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACAddrGet>:
lea    (%rdi,%rsi,8),%eax
add    $0x44,%eax
cltq
mov    (%rax),%eax
movzbl %al,%ecx
mov    %ecx,(%rdx)
movzbl %ah,%ecx
mov    %ecx,0x4(%rdx)
mov    %eax,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x8(%rdx)
shr    $0x18,%eax
mov    %eax,0xc(%rdx)
lea    (%rdi,%rsi,8),%eax
add    $0x40,%eax
cltq
mov    (%rax),%eax
movzbl %al,%ecx
mov    %ecx,0x10(%rdx)
movzbl %ah,%eax
mov    %eax,0x14(%rdx)
ret

LLVM IR (-O0):
define void @EMACAddrGet(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = mul nsw i32 8, %9
%11 = add nsw i32 68, %10
%12 = add nsw i32 %8, %11
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = and i32 %16, 255
%18 = load i32*, i32** %6
%19 = getelementptr inbounds i32, i32* %18, i64 0
store i32 %17, i32* %19
%20 = load i32, i32* %7
%21 = ashr i32 %20, 8
%22 = and i32 %21, 255
%23 = load i32*, i32** %6
%24 = getelementptr inbounds i32, i32* %23, i64 1
store i32 %22, i32* %24
%25 = load i32, i32* %7
%26 = ashr i32 %25, 16
%27 = and i32 %26, 255
%28 = load i32*, i32** %6
%29 = getelementptr inbounds i32, i32* %28, i64 2
store i32 %27, i32* %29
%30 = load i32, i32* %7
%31 = ashr i32 %30, 24
%32 = and i32 %31, 255
%33 = load i32*, i32** %6
%34 = getelementptr inbounds i32, i32* %33, i64 3
store i32 %32, i32* %34
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = mul nsw i32 8, %36
%38 = add nsw i32 64, %37
%39 = add nsw i32 %35, %38
%40 = sext i32 %39 to i64
%41 = inttoptr i64 %40 to i32*
%42 = load volatile i32, i32* %41
store i32 %42, i32* %7
%43 = load i32, i32* %7
%44 = and i32 %43, 255
%45 = load i32*, i32** %6
%46 = getelementptr inbounds i32, i32* %45, i64 4
store i32 %44, i32* %46
%47 = load i32, i32* %7
%48 = ashr i32 %47, 8
%49 = and i32 %48, 255
%50 = load i32*, i32** %6
%51 = getelementptr inbounds i32, i32* %50, i64 5
store i32 %49, i32* %51
ret void
}

LLVM IR (-O2):
define void @EMACAddrGet(i32 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = shl nsw i32 %1, 3
%5 = add i32 %4, %0
%6 = add i32 %5, 68
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, 255
store i32 %10, i32* %2
%11 = lshr i32 %9, 8
%12 = and i32 %11, 255
%13 = getelementptr inbounds i32, i32* %2, i64 1
store i32 %12, i32* %13
%14 = lshr i32 %9, 16
%15 = and i32 %14, 255
%16 = getelementptr inbounds i32, i32* %2, i64 2
store i32 %15, i32* %16
%17 = lshr i32 %9, 24
%18 = getelementptr inbounds i32, i32* %2, i64 3
store i32 %17, i32* %18
%19 = add i32 %5, 64
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load volatile i32, i32* %21
%23 = and i32 %22, 255
%24 = getelementptr inbounds i32, i32* %2, i64 4
store i32 %23, i32* %24
%25 = lshr i32 %22, 8
%26 = and i32 %25, 255
%27 = getelementptr inbounds i32, i32* %2, i64 5
store i32 %26, i32* %27
ret void
}