#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 ethhdr {
  int h_proto;
  int /*<<< orphan*/ h_source;
  int /*<<< orphan*/ h_dest;
};

/* Variables and functions */
int /*<<< orphan*/ ETH_ALEN;
int /*<<< orphan*/ memcpy(int /*<<< orphan*/, void const *, int /*<<< orphan*/);
void init_ethhdr(struct ethhdr *pEthHdr, const void *dst_addr,
                 const void *src_addr, int ll_protocol) {
  memcpy(pEthHdr->h_dest, dst_addr, ETH_ALEN);
  memcpy(pEthHdr->h_source, src_addr, ETH_ALEN);
  pEthHdr->h_proto = ll_protocol;
}


x86 assembly (clang, -O0):
<init_ethhdr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x10(%rbp),%rsi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x18(%rbp),%rsi
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
call   1030 <memcpy@plt>
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_ethhdr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rdi,%rbp
mov    0x8(%rdi),%edi
mov    0x2ebe(%rip),%r15
mov    (%r15),%edx
call   1030 <memcpy@plt>
mov    0x4(%rbp),%edi
mov    (%r15),%edx
mov    %rbx,%rsi
call   1030 <memcpy@plt>
mov    %r14d,0x0(%rbp)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ethhdr = type { i32, i32, i32 }
@ETH_ALEN = global i32 0
define void @init_ethhdr(%struct.ethhdr* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca %struct.ethhdr*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store %struct.ethhdr* %0, %struct.ethhdr** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load %struct.ethhdr*, %struct.ethhdr** %5
%10 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %9, i32 0, i32 2
%11 = load i32, i32* %10
%12 = load i8*, i8** %6
%13 = load i32, i32* @ETH_ALEN
%14 = call i32 @memcpy(i32 %11, i8* %12, i32 %13)
%15 = load %struct.ethhdr*, %struct.ethhdr** %5
%16 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = load i8*, i8** %7
%19 = load i32, i32* @ETH_ALEN
%20 = call i32 @memcpy(i32 %17, i8* %18, i32 %19)
%21 = load i32, i32* %8
%22 = load %struct.ethhdr*, %struct.ethhdr** %5
%23 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %22, i32 0, i32 0
store i32 %21, i32* %23
ret void
}

LLVM IR (-O2):
%struct.ethhdr = type { i32, i32, i32 }
@ETH_ALEN = global i32 0
define void @init_ethhdr(%struct.ethhdr* nocapture %0, i8* %1, i8* %2, i32 %3) {
%5 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %0, i64 0, i32 2
%6 = load i32, i32* %5
%7 = load i32, i32* @ETH_ALEN
%8 = tail call i32 @memcpy(i32 %6, i8* %1, i32 %7)
%9 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %0, i64 0, i32 1
%10 = load i32, i32* %9
%11 = load i32, i32* @ETH_ALEN
%12 = tail call i32 @memcpy(i32 %10, i8* %2, i32 %11)
%13 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %0, i64 0, i32 0
store i32 %3, i32* %13
ret void
}