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

/* Variables and functions */
int /*<<< orphan*/ LOG_DEBUG;
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
void debug_ether2(struct ethhdr *eth2) {
  syslog(LOG_DEBUG, "STARTING ETHER2 LOG");
  syslog(LOG_DEBUG, "DstHWAddr: %02X:%02X:%02X:%02X:%02X:%02X", eth2->h_dest[0],
         eth2->h_dest[1], eth2->h_dest[2], eth2->h_dest[3], eth2->h_dest[4],
         eth2->h_dest[5]);
  syslog(LOG_DEBUG, "SrcHWAddr: %02X:%02X:%02X:%02X:%02X:%02X",
         eth2->h_source[0], eth2->h_source[1], eth2->h_source[2],
         eth2->h_source[3], eth2->h_source[4], eth2->h_source[5]);
  syslog(LOG_DEBUG, "Protocol: %d", eth2->h_proto);
  syslog(LOG_DEBUG, "ETHER2 LOG ENDED");
}


x86 assembly (clang, -O0):
<debug_ether2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1030 <syslog@plt>
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    0x8(%rax),%r8d
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    0xc(%rax),%r9d
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    0x10(%rax),%r10d
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    0x14(%rax),%eax
lea    0xe8d(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <syslog@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x8(%rax),%r8d
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0xc(%rax),%r9d
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x10(%rax),%r10d
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x14(%rax),%eax
lea    0xe53(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <syslog@plt>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1030 <syslog@plt>
mov    0x2dc3(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
mov    $0x0,%al
call   1030 <syslog@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_ether2>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    0x2ec1(%rip),%r14
mov    (%r14),%edi
lea    0xed7(%rip),%rsi
xor    %eax,%eax
call   1030 <syslog@plt>
mov    (%r14),%edi
mov    0x10(%r15),%rax
mov    (%rax),%edx
mov    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
mov    0xc(%rax),%r9d
mov    0x10(%rax),%r10d
mov    0x14(%rax),%ebx
lea    0xec2(%rip),%rsi
xor    %eax,%eax
push   %rbx
push   %r10
call   1030 <syslog@plt>
add    $0x10,%rsp
mov    (%r14),%edi
mov    0x8(%r15),%rax
mov    (%rax),%edx
mov    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
mov    0xc(%rax),%r9d
mov    0x10(%rax),%r10d
mov    0x14(%rax),%ebx
lea    0xebb(%rip),%rsi
xor    %eax,%eax
push   %rbx
push   %r10
call   1030 <syslog@plt>
add    $0x10,%rsp
mov    (%r14),%edi
mov    (%r15),%edx
lea    0xec9(%rip),%rsi
xor    %eax,%eax
call   1030 <syslog@plt>
mov    (%r14),%edi
lea    0xec5(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <syslog@plt>

LLVM IR (-O0):
%struct.ethhdr = type { i32, i32*, i32* }
@LOG_DEBUG = global i32 0
@.str = [20 x i8] c"STARTING ETHER2 LOG\00"
@.str.1 = [41 x i8] c"DstHWAddr: %02X:%02X:%02X:%02X:%02X:%02X\00"
@.str.2 = [41 x i8] c"SrcHWAddr: %02X:%02X:%02X:%02X:%02X:%02X\00"
@.str.3 = [13 x i8] c"Protocol: %d\00"
@.str.4 = [17 x i8] c"ETHER2 LOG ENDED\00"
define void @debug_ether2(%struct.ethhdr* %0) {
%2 = alloca %struct.ethhdr*
store %struct.ethhdr* %0, %struct.ethhdr** %2
%3 = load i32, i32* @LOG_DEBUG
%4 = call i32 (i32, i8*, ...) @syslog(i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @LOG_DEBUG
%6 = load %struct.ethhdr*, %struct.ethhdr** %2
%7 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %6, i32 0, i32 2
%8 = load i32*, i32** %7
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = load %struct.ethhdr*, %struct.ethhdr** %2
%12 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %11, i32 0, i32 2
%13 = load i32*, i32** %12
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = load i32, i32* %14
%16 = load %struct.ethhdr*, %struct.ethhdr** %2
%17 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %16, i32 0, i32 2
%18 = load i32*, i32** %17
%19 = getelementptr inbounds i32, i32* %18, i64 2
%20 = load i32, i32* %19
%21 = load %struct.ethhdr*, %struct.ethhdr** %2
%22 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %21, i32 0, i32 2
%23 = load i32*, i32** %22
%24 = getelementptr inbounds i32, i32* %23, i64 3
%25 = load i32, i32* %24
%26 = load %struct.ethhdr*, %struct.ethhdr** %2
%27 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %26, i32 0, i32 2
%28 = load i32*, i32** %27
%29 = getelementptr inbounds i32, i32* %28, i64 4
%30 = load i32, i32* %29
%31 = load %struct.ethhdr*, %struct.ethhdr** %2
%32 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %31, i32 0, i32 2
%33 = load i32*, i32** %32
%34 = getelementptr inbounds i32, i32* %33, i64 5
%35 = load i32, i32* %34
%36 = call i32 (i32, i8*, ...) @syslog(i32 %5, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %15, i32 %20, i32 %25, i32 %30, i32 %35)
%37 = load i32, i32* @LOG_DEBUG
%38 = load %struct.ethhdr*, %struct.ethhdr** %2
%39 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %38, i32 0, i32 1
%40 = load i32*, i32** %39
%41 = getelementptr inbounds i32, i32* %40, i64 0
%42 = load i32, i32* %41
%43 = load %struct.ethhdr*, %struct.ethhdr** %2
%44 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %43, i32 0, i32 1
%45 = load i32*, i32** %44
%46 = getelementptr inbounds i32, i32* %45, i64 1
%47 = load i32, i32* %46
%48 = load %struct.ethhdr*, %struct.ethhdr** %2
%49 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %48, i32 0, i32 1
%50 = load i32*, i32** %49
%51 = getelementptr inbounds i32, i32* %50, i64 2
%52 = load i32, i32* %51
%53 = load %struct.ethhdr*, %struct.ethhdr** %2
%54 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %53, i32 0, i32 1
%55 = load i32*, i32** %54
%56 = getelementptr inbounds i32, i32* %55, i64 3
%57 = load i32, i32* %56
%58 = load %struct.ethhdr*, %struct.ethhdr** %2
%59 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %58, i32 0, i32 1
%60 = load i32*, i32** %59
%61 = getelementptr inbounds i32, i32* %60, i64 4
%62 = load i32, i32* %61
%63 = load %struct.ethhdr*, %struct.ethhdr** %2
%64 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %63, i32 0, i32 1
%65 = load i32*, i32** %64
%66 = getelementptr inbounds i32, i32* %65, i64 5
%67 = load i32, i32* %66
%68 = call i32 (i32, i8*, ...) @syslog(i32 %37, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %42, i32 %47, i32 %52, i32 %57, i32 %62, i32 %67)
%69 = load i32, i32* @LOG_DEBUG
%70 = load %struct.ethhdr*, %struct.ethhdr** %2
%71 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %70, i32 0, i32 0
%72 = load i32, i32* %71
%73 = call i32 (i32, i8*, ...) @syslog(i32 %69, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %72)
%74 = load i32, i32* @LOG_DEBUG
%75 = call i32 (i32, i8*, ...) @syslog(i32 %74, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.ethhdr = type { i32, i32*, i32* }
@LOG_DEBUG = global i32 0
@.str = [20 x i8] c"STARTING ETHER2 LOG\00"
@.str.1 = [41 x i8] c"DstHWAddr: %02X:%02X:%02X:%02X:%02X:%02X\00"
@.str.2 = [41 x i8] c"SrcHWAddr: %02X:%02X:%02X:%02X:%02X:%02X\00"
@.str.3 = [13 x i8] c"Protocol: %d\00"
@.str.4 = [17 x i8] c"ETHER2 LOG ENDED\00"
define void @debug_ether2(%struct.ethhdr* nocapture %0) {
%2 = load i32, i32* @LOG_DEBUG
%3 = tail call i32 (i32, i8*, ...) @syslog(i32 %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @LOG_DEBUG
%5 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %0, i64 0, i32 2
%6 = load i32*, i32** %5
%7 = load i32, i32* %6
%8 = getelementptr inbounds i32, i32* %6, i64 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds i32, i32* %6, i64 2
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %6, i64 3
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %6, i64 4
%15 = load i32, i32* %14
%16 = getelementptr inbounds i32, i32* %6, i64 5
%17 = load i32, i32* %16
%18 = tail call i32 (i32, i8*, ...) @syslog(i32 %4, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %9, i32 %11, i32 %13, i32 %15, i32 %17)
%19 = load i32, i32* @LOG_DEBUG
%20 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %0, i64 0, i32 1
%21 = load i32*, i32** %20
%22 = load i32, i32* %21
%23 = getelementptr inbounds i32, i32* %21, i64 1
%24 = load i32, i32* %23
%25 = getelementptr inbounds i32, i32* %21, i64 2
%26 = load i32, i32* %25
%27 = getelementptr inbounds i32, i32* %21, i64 3
%28 = load i32, i32* %27
%29 = getelementptr inbounds i32, i32* %21, i64 4
%30 = load i32, i32* %29
%31 = getelementptr inbounds i32, i32* %21, i64 5
%32 = load i32, i32* %31
%33 = tail call i32 (i32, i8*, ...) @syslog(i32 %19, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %24, i32 %26, i32 %28, i32 %30, i32 %32)
%34 = load i32, i32* @LOG_DEBUG
%35 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %0, i64 0, i32 0
%36 = load i32, i32* %35
%37 = tail call i32 (i32, i8*, ...) @syslog(i32 %34, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = load i32, i32* @LOG_DEBUG
%39 = tail call i32 (i32, i8*, ...) @syslog(i32 %38, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
ret void
}