#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 */
unsigned int readl(unsigned long);
void stmmac_get_mac_addr(unsigned long ioaddr, unsigned char *addr,
                         unsigned int high, unsigned int low) {
  unsigned int hi_addr, lo_addr;
  hi_addr = readl(ioaddr + high);
  lo_addr = readl(ioaddr + low);
  addr[0] = lo_addr & 0xff;
  addr[1] = (lo_addr >> 8) & 0xff;
  addr[2] = (lo_addr >> 16) & 0xff;
  addr[3] = (lo_addr >> 24) & 0xff;
  addr[4] = hi_addr & 0xff;
  addr[5] = (hi_addr >> 8) & 0xff;
  return;
}


x86 assembly (clang, -O0):
<stmmac_get_mac_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
add    %rax,%rdi
call   1030 <readl@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%eax
add    %rax,%rdi
call   1030 <readl@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x20(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x20(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x1c(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x1c(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x5(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stmmac_get_mac_addr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %edx,%edi
add    %rbp,%rdi
call   1030 <readl@plt>
mov    %eax,%r15d
mov    %r14d,%edi
add    %rbp,%rdi
call   1030 <readl@plt>
mov    %al,(%rbx)
mov    %ah,0x1(%rbx)
mov    %eax,%ecx
shr    $0x10,%ecx
mov    %cl,0x2(%rbx)
shr    $0x18,%eax
mov    %al,0x3(%rbx)
mov    %r15d,%eax
mov    %al,0x4(%rbx)
mov    %ah,0x5(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @stmmac_get_mac_addr(i64 %0, i8* nocapture writeonly %1, i32 %2, i32 %3) {
%5 = zext i32 %2 to i64
%6 = add i64 %5, %0
%7 = tail call i32 @readl(i64 %6)
%8 = zext i32 %3 to i64
%9 = add i64 %8, %0
%10 = tail call i32 @readl(i64 %9)
%11 = trunc i32 %10 to i8
store i8 %11, i8* %1
%12 = lshr i32 %10, 8
%13 = trunc i32 %12 to i8
%14 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %13, i8* %14
%15 = lshr i32 %10, 16
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %16, i8* %17
%18 = lshr i32 %10, 24
%19 = trunc i32 %18 to i8
%20 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %19, i8* %20
%21 = trunc i32 %7 to i8
%22 = getelementptr inbounds i8, i8* %1, i64 4
store i8 %21, i8* %22
%23 = lshr i32 %7, 8
%24 = trunc i32 %23 to i8
%25 = getelementptr inbounds i8, i8* %1, i64 5
store i8 %24, i8* %25
ret void
}