#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 ETH_ALEN;
int /*<<< orphan*/ printf(char *, unsigned char const, char *);
void ebt_print_mac(const unsigned char *mac) {
  int j;
  for (j = 0; j < ETH_ALEN; j++)
    printf("%02x%s", mac[j], (j == ETH_ALEN - 1) ? "" : ":");
}


x86 assembly (clang, -O0):
<ebt_print_mac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ebb(%rip),%rcx
cmp    (%rcx),%eax
jge    1180 <ebt_print_mac+0x70>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0xc(%rbp),%esi
mov    0x2e9e(%rip),%rcx
mov    (%rcx),%edi
sub    $0x1,%edi
lea    0xeb1(%rip),%rdx
lea    0xeab(%rip),%rcx
cmp    %edi,%esi
cmove  %rcx,%rdx
lea    0xe96(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <ebt_print_mac+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ebt_print_mac>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2ec6(%rip),%r15
mov    (%r15),%eax
test   %eax,%eax
jle    1179 <ebt_print_mac+0x69>
mov    %rdi,%r12
xor    %ebx,%ebx
lea    0xed3(%rip),%r13
lea    0xecb(%rip),%rbp
lea    0xebd(%rip),%r14
jmp    1169 <ebt_print_mac+0x59>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%r12,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
movslq (%r15),%rax
cmp    %rax,%rbx
jge    1179 <ebt_print_mac+0x69>
add    $0xffffffff,%eax
mov    %r13,%rdx
cmp    %rax,%rbx
je     1150 <ebt_print_mac+0x40>
mov    %rbp,%rdx
jmp    1150 <ebt_print_mac+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@ETH_ALEN = global i32 0
@.str = [7 x i8] c"%02x%s\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c":\00"
define void @ebt_print_mac(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %21, %1
%5 = load i32, i32* %3
%6 = load i32, i32* @ETH_ALEN
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %24
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = load i32, i32* %3
%15 = load i32, i32* @ETH_ALEN
%16 = sub nsw i32 %15, 1
%17 = icmp eq i32 %14, %16
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%20 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext %13, i8* %19)
br label %21
21: ; preds = %8
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %4
24: ; preds = %4
ret void
}

LLVM IR (-O2):
@ETH_ALEN = global i32 0
@.str = [7 x i8] c"%02x%s\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c":\00"
define void @ebt_print_mac(i8* nocapture %0) {
%2 = load i32, i32* @ETH_ALEN
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %18
4: ; preds = %1, %4
%5 = phi i64 [ %14, %4 ], [ 0, %1 ]
%6 = phi i32 [ %15, %4 ], [ %2, %1 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %5
%8 = load i8, i8* %7
%9 = add nsw i32 %6, -1
%10 = zext i32 %9 to i64
%11 = icmp eq i64 %5, %10
%12 = select i1 %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext %8, i8* %12)
%14 = add nuw nsw i64 %5, 1
%15 = load i32, i32* @ETH_ALEN
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %4, label %18
18: ; preds = %4, %1
ret void
}