#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 */
int /*<<< orphan*/ syslog(char *, ...);
void dump_ethhdr(const char *msg, unsigned char *buf, int buflen) {
  syslog("TAPDEV: %s %d bytes\n", msg, buflen);
  syslog("        %02x:%02x:%02x:%02x:%02x:%02x %02x:%02x:%02x:%02x:%02x:%02x "
         "%02x%02x\n",
         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8],
         buf[9], buf[10], buf[11], buf[12], buf[13]);
}


x86 assembly (clang, -O0):
<dump_ethhdr>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %edx,-0x3c(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x3c(%rbp),%edx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <syslog@plt>
mov    -0x38(%rbp),%rax
movzbl (%rax),%esi
mov    -0x38(%rbp),%rax
movzbl 0x1(%rax),%edx
mov    -0x38(%rbp),%rax
movzbl 0x2(%rax),%ecx
mov    -0x38(%rbp),%rax
movzbl 0x3(%rax),%r8d
mov    -0x38(%rbp),%rax
movzbl 0x4(%rax),%r9d
mov    -0x38(%rbp),%rax
movzbl 0x5(%rax),%eax
mov    -0x38(%rbp),%rdi
movzbl 0x6(%rdi),%r13d
mov    -0x38(%rbp),%rdi
movzbl 0x7(%rdi),%r12d
mov    -0x38(%rbp),%rdi
movzbl 0x8(%rdi),%r15d
mov    -0x38(%rbp),%rdi
movzbl 0x9(%rdi),%r14d
mov    -0x38(%rbp),%rdi
movzbl 0xa(%rdi),%ebx
mov    -0x38(%rbp),%rdi
movzbl 0xb(%rdi),%r11d
mov    -0x38(%rbp),%rdi
movzbl 0xc(%rdi),%r10d
mov    -0x38(%rbp),%rdi
movzbl 0xd(%rdi),%edi
mov    %edi,-0x40(%rbp)
lea    0xe53(%rip),%rdi
mov    %eax,(%rsp)
mov    -0x40(%rbp),%eax
mov    %r13d,0x8(%rsp)
mov    %r12d,0x10(%rsp)
mov    %r15d,0x18(%rsp)
mov    %r14d,0x20(%rsp)
mov    %ebx,0x28(%rsp)
mov    %r11d,0x30(%rsp)
mov    %r10d,0x38(%rsp)
mov    %eax,0x40(%rsp)
mov    $0x0,%al
call   1030 <syslog@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_ethhdr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <syslog@plt>
movzbl (%rbx),%esi
movzbl 0x1(%rbx),%edx
movzbl 0x2(%rbx),%ecx
movzbl 0x3(%rbx),%r8d
movzbl 0x4(%rbx),%r9d
movzbl 0x5(%rbx),%eax
mov    %rax,(%rsp)
movzbl 0x6(%rbx),%r11d
movzbl 0x7(%rbx),%r14d
movzbl 0x8(%rbx),%r15d
movzbl 0x9(%rbx),%r12d
movzbl 0xa(%rbx),%r13d
movzbl 0xb(%rbx),%ebp
movzbl 0xc(%rbx),%r10d
movzbl 0xd(%rbx),%ebx
sub    $0x8,%rsp
lea    0xe98(%rip),%rdi
xor    %eax,%eax
push   %rbx
push   %r10
push   %rbp
push   %r13
push   %r12
push   %r15
push   %r14
push   %r11
push   0x48(%rsp)
call   1030 <syslog@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"TAPDEV: %s %d bytes\0A\00"
@.str.1 = [78 x i8] c" %02x:%02x:%02x:%02x:%02x:%02x %02x:%02x:%02x:%02x:%02x:%02x %02x%02x\0A\00"
define void @dump_ethhdr(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %6
%9 = call i32 (i8*, ...) @syslog(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8)
%10 = load i8*, i8** %5
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i64 3
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i64 4
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = load i8*, i8** %5
%31 = getelementptr inbounds i8, i8* %30, i64 5
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i64 6
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = load i8*, i8** %5
%39 = getelementptr inbounds i8, i8* %38, i64 7
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = load i8*, i8** %5
%43 = getelementptr inbounds i8, i8* %42, i64 8
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
%46 = load i8*, i8** %5
%47 = getelementptr inbounds i8, i8* %46, i64 9
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = load i8*, i8** %5
%51 = getelementptr inbounds i8, i8* %50, i64 10
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = load i8*, i8** %5
%55 = getelementptr inbounds i8, i8* %54, i64 11
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = load i8*, i8** %5
%59 = getelementptr inbounds i8, i8* %58, i64 12
%60 = load i8, i8* %59
%61 = zext i8 %60 to i32
%62 = load i8*, i8** %5
%63 = getelementptr inbounds i8, i8* %62, i64 13
%64 = load i8, i8* %63
%65 = zext i8 %64 to i32
%66 = call i32 (i8*, ...) @syslog(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %17, i32 %21, i32 %25, i32 %29, i32 %33, i32 %37, i32 %41, i32 %45, i32 %49, i32 %53, i32 %57, i32 %61, i32 %65)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"TAPDEV: %s %d bytes\0A\00"
@.str.1 = [78 x i8] c" %02x:%02x:%02x:%02x:%02x:%02x %02x:%02x:%02x:%02x:%02x:%02x %02x%02x\0A\00"
define void @dump_ethhdr(i8* %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @syslog(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %2)
%5 = load i8, i8* %1
%6 = zext i8 %5 to i32
%7 = getelementptr inbounds i8, i8* %1, i64 1
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = getelementptr inbounds i8, i8* %1, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = getelementptr inbounds i8, i8* %1, i64 3
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = getelementptr inbounds i8, i8* %1, i64 4
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = getelementptr inbounds i8, i8* %1, i64 5
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = getelementptr inbounds i8, i8* %1, i64 6
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = getelementptr inbounds i8, i8* %1, i64 7
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = getelementptr inbounds i8, i8* %1, i64 8
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = getelementptr inbounds i8, i8* %1, i64 9
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = getelementptr inbounds i8, i8* %1, i64 10
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = getelementptr inbounds i8, i8* %1, i64 11
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = getelementptr inbounds i8, i8* %1, i64 12
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = getelementptr inbounds i8, i8* %1, i64 13
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
%46 = tail call i32 (i8*, ...) @syslog(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %9, i32 %12, i32 %15, i32 %18, i32 %21, i32 %24, i32 %27, i32 %30, i32 %33, i32 %36, i32 %39, i32 %42, i32 %45)
ret void
}