#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 */
struct __sk_buff {
  int dummy;
};

/* Variables and functions */
unsigned char load_byte(struct __sk_buff *, long);
void fill_haddr(struct __sk_buff *skb, long offset, unsigned char *mac) {
  mac[0] = load_byte(skb, offset);
  mac[1] = load_byte(skb, offset + 1);
  mac[2] = load_byte(skb, offset + 2);
  mac[3] = load_byte(skb, offset + 3);
  mac[4] = load_byte(skb, offset + 4);
  mac[5] = load_byte(skb, offset + 5);
}


x86 assembly (clang, -O0):
<fill_haddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <load_byte@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
call   1030 <load_byte@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x2,%rsi
call   1030 <load_byte@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x3,%rsi
call   1030 <load_byte@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
call   1030 <load_byte@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x5,%rsi
call   1030 <load_byte@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x5(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_haddr>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
call   1030 <load_byte@plt>
mov    %al,(%r14)
lea    0x1(%rbx),%rsi
mov    %r15,%rdi
call   1030 <load_byte@plt>
mov    %al,0x1(%r14)
lea    0x2(%rbx),%rsi
mov    %r15,%rdi
call   1030 <load_byte@plt>
mov    %al,0x2(%r14)
lea    0x3(%rbx),%rsi
mov    %r15,%rdi
call   1030 <load_byte@plt>
mov    %al,0x3(%r14)
lea    0x4(%rbx),%rsi
mov    %r15,%rdi
call   1030 <load_byte@plt>
mov    %al,0x4(%r14)
add    $0x5,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <load_byte@plt>
mov    %al,0x5(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.__sk_buff = type { i32 }
define void @fill_haddr(%struct.__sk_buff* %0, i64 %1, i8* %2) {
%4 = alloca %struct.__sk_buff*
%5 = alloca i64
%6 = alloca i8*
store %struct.__sk_buff* %0, %struct.__sk_buff** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load %struct.__sk_buff*, %struct.__sk_buff** %4
%8 = load i64, i64* %5
%9 = call zeroext i8 @load_byte(%struct.__sk_buff* %7, i64 %8)
%10 = load i8*, i8** %6
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %9, i8* %11
%12 = load %struct.__sk_buff*, %struct.__sk_buff** %4
%13 = load i64, i64* %5
%14 = add nsw i64 %13, 1
%15 = call zeroext i8 @load_byte(%struct.__sk_buff* %12, i64 %14)
%16 = load i8*, i8** %6
%17 = getelementptr inbounds i8, i8* %16, i64 1
store i8 %15, i8* %17
%18 = load %struct.__sk_buff*, %struct.__sk_buff** %4
%19 = load i64, i64* %5
%20 = add nsw i64 %19, 2
%21 = call zeroext i8 @load_byte(%struct.__sk_buff* %18, i64 %20)
%22 = load i8*, i8** %6
%23 = getelementptr inbounds i8, i8* %22, i64 2
store i8 %21, i8* %23
%24 = load %struct.__sk_buff*, %struct.__sk_buff** %4
%25 = load i64, i64* %5
%26 = add nsw i64 %25, 3
%27 = call zeroext i8 @load_byte(%struct.__sk_buff* %24, i64 %26)
%28 = load i8*, i8** %6
%29 = getelementptr inbounds i8, i8* %28, i64 3
store i8 %27, i8* %29
%30 = load %struct.__sk_buff*, %struct.__sk_buff** %4
%31 = load i64, i64* %5
%32 = add nsw i64 %31, 4
%33 = call zeroext i8 @load_byte(%struct.__sk_buff* %30, i64 %32)
%34 = load i8*, i8** %6
%35 = getelementptr inbounds i8, i8* %34, i64 4
store i8 %33, i8* %35
%36 = load %struct.__sk_buff*, %struct.__sk_buff** %4
%37 = load i64, i64* %5
%38 = add nsw i64 %37, 5
%39 = call zeroext i8 @load_byte(%struct.__sk_buff* %36, i64 %38)
%40 = load i8*, i8** %6
%41 = getelementptr inbounds i8, i8* %40, i64 5
store i8 %39, i8* %41
ret void
}

LLVM IR (-O2):
%struct.__sk_buff = type { i32 }
define void @fill_haddr(%struct.__sk_buff* %0, i64 %1, i8* nocapture writeonly %2) {
%4 = tail call zeroext i8 @load_byte(%struct.__sk_buff* %0, i64 %1)
store i8 %4, i8* %2
%5 = add nsw i64 %1, 1
%6 = tail call zeroext i8 @load_byte(%struct.__sk_buff* %0, i64 %5)
%7 = getelementptr inbounds i8, i8* %2, i64 1
store i8 %6, i8* %7
%8 = add nsw i64 %1, 2
%9 = tail call zeroext i8 @load_byte(%struct.__sk_buff* %0, i64 %8)
%10 = getelementptr inbounds i8, i8* %2, i64 2
store i8 %9, i8* %10
%11 = add nsw i64 %1, 3
%12 = tail call zeroext i8 @load_byte(%struct.__sk_buff* %0, i64 %11)
%13 = getelementptr inbounds i8, i8* %2, i64 3
store i8 %12, i8* %13
%14 = add nsw i64 %1, 4
%15 = tail call zeroext i8 @load_byte(%struct.__sk_buff* %0, i64 %14)
%16 = getelementptr inbounds i8, i8* %2, i64 4
store i8 %15, i8* %16
%17 = add nsw i64 %1, 5
%18 = tail call zeroext i8 @load_byte(%struct.__sk_buff* %0, i64 %17)
%19 = getelementptr inbounds i8, i8* %2, i64 5
store i8 %18, i8* %19
ret void
}