#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 */
typedef int u_int8_t;

/* Variables and functions */
char *GetEtherAddr(u_int8_t *addr) {
  static char Hex[] = "0123456789abcdef";
  static char etherstr[6 * 3];
  int i;
  char *cp;
  i = 0;
  cp = etherstr;
  for (;;) {
    *cp++ = Hex[*addr >> 4 & 0xf];
    *cp++ = Hex[*addr++ & 0xf];
    if (++i == 6)
      break;
    *cp++ = ':';
  }
  *cp = '\0';
  return (etherstr);
}


x86 assembly (clang, -O0):
<GetEtherAddr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0x2f4a(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
sar    $0x4,%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0x2f00(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0x2ece(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x6,%eax
jne    118d <GetEtherAddr+0x8d>
jmp    11a4 <GetEtherAddr+0xa4>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x3a,(%rax)
jmp    111a <GetEtherAddr+0x1a>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2eae(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetEtherAddr>:
mov    (%rdi),%eax
shr    $0x4,%eax
and    $0xf,%eax
lea    0xef1(%rip),%r8
mov    (%rax,%r8,1),%al
mov    %al,0x2f17(%rip)
lea    0x2f10(%rip),%rax
mov    (%rdi),%edx
and    $0xf,%edx
mov    (%rdx,%r8,1),%dl
mov    %dl,0x2f02(%rip)
movb   $0x3a,0x2efc(%rip)
mov    0x4(%rdi),%edx
mov    %edx,%esi
shr    $0x4,%esi
and    $0xf,%esi
mov    (%rsi,%r8,1),%cl
mov    %cl,0x2ee8(%rip)
and    $0xf,%edx
mov    (%rdx,%r8,1),%cl
mov    %cl,0x2edc(%rip)
movb   $0x3a,0x2ed6(%rip)
mov    0x8(%rdi),%ecx
mov    %ecx,%edx
shr    $0x4,%edx
and    $0xf,%edx
mov    (%rdx,%r8,1),%dl
mov    %dl,0x2ec2(%rip)
and    $0xf,%ecx
mov    (%rcx,%r8,1),%cl
mov    %cl,0x2eb6(%rip)
movb   $0x3a,0x2eb0(%rip)
mov    0xc(%rdi),%ecx
mov    %ecx,%edx
shr    $0x4,%edx
and    $0xf,%edx
mov    (%rdx,%r8,1),%dl
mov    %dl,0x2e9c(%rip)
and    $0xf,%ecx
mov    (%rcx,%r8,1),%cl
mov    %cl,0x2e90(%rip)
movb   $0x3a,0x2e8a(%rip)
mov    0x10(%rdi),%ecx
mov    %ecx,%edx
shr    $0x4,%edx
and    $0xf,%edx
mov    (%rdx,%r8,1),%dl
mov    %dl,0x2e76(%rip)
and    $0xf,%ecx
mov    (%rcx,%r8,1),%cl
mov    %cl,0x2e6a(%rip)
movb   $0x3a,0x2e64(%rip)
mov    0x14(%rdi),%ecx
mov    %ecx,%edx
shr    $0x4,%edx
and    $0xf,%edx
mov    (%rdx,%r8,1),%dl
mov    %dl,0x2e50(%rip)
and    $0xf,%ecx
mov    (%rcx,%r8,1),%cl
mov    %cl,0x2e44(%rip)
movb   $0x0,0x2e3e(%rip)
ret

LLVM IR (-O0):
@GetEtherAddr.Hex = internal global [17 x i8] c"0123456789abcdef\00"
@GetEtherAddr.etherstr = internal global [18 x i8] zeroinitializer
define i8* @GetEtherAddr(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8*
store i32* %0, i32** %2
store i32 0, i32* %3
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 0), i8** %4
br label %5
5: ; preds = %28, %1
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = ashr i32 %7, 4
%9 = and i32 %8, 15
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %4
store i8 %12, i8* %13
%15 = load i32*, i32** %2
%16 = getelementptr inbounds i32, i32* %15, i32 1
store i32* %16, i32** %2
%17 = load i32, i32* %15
%18 = and i32 %17, 15
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
store i8 %21, i8* %22
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
%26 = icmp eq i32 %25, 6
br i1 %26, label %27, label %28
27: ; preds = %5
br label %31
28: ; preds = %5
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %4
store i8 58, i8* %29
br label %5
31: ; preds = %27
%32 = load i8*, i8** %4
store i8 0, i8* %32
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 0)
}

LLVM IR (-O2):
@GetEtherAddr.Hex = internal unnamed_addr constant [17 x i8] c"0123456789abcdef\00"
@GetEtherAddr.etherstr = internal global [18 x i8] zeroinitializer
define i8* @GetEtherAddr(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = lshr i32 %2, 4
%4 = and i32 %3, 15
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %5
%7 = load i8, i8* %6
store i8 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 0)
%8 = load i32, i32* %0
%9 = and i32 %8, 15
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 1)
%13 = getelementptr inbounds i32, i32* %0, i64 1
store i8 58, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 2)
%14 = load i32, i32* %13
%15 = lshr i32 %14, 4
%16 = and i32 %15, 15
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %17
%19 = load i8, i8* %18
store i8 %19, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 3)
%20 = and i32 %14, 15
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %21
%23 = load i8, i8* %22
store i8 %23, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 4)
%24 = getelementptr inbounds i32, i32* %0, i64 2
store i8 58, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 5)
%25 = load i32, i32* %24
%26 = lshr i32 %25, 4
%27 = and i32 %26, 15
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %28
%30 = load i8, i8* %29
store i8 %30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 6)
%31 = and i32 %25, 15
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %32
%34 = load i8, i8* %33
store i8 %34, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 7)
%35 = getelementptr inbounds i32, i32* %0, i64 3
store i8 58, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 8)
%36 = load i32, i32* %35
%37 = lshr i32 %36, 4
%38 = and i32 %37, 15
%39 = zext i32 %38 to i64
%40 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %39
%41 = load i8, i8* %40
store i8 %41, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 9)
%42 = and i32 %36, 15
%43 = zext i32 %42 to i64
%44 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %43
%45 = load i8, i8* %44
store i8 %45, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 10)
%46 = getelementptr inbounds i32, i32* %0, i64 4
store i8 58, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 11)
%47 = load i32, i32* %46
%48 = lshr i32 %47, 4
%49 = and i32 %48, 15
%50 = zext i32 %49 to i64
%51 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %50
%52 = load i8, i8* %51
store i8 %52, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 12)
%53 = and i32 %47, 15
%54 = zext i32 %53 to i64
%55 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %54
%56 = load i8, i8* %55
store i8 %56, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 13)
%57 = getelementptr inbounds i32, i32* %0, i64 5
store i8 58, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 14)
%58 = load i32, i32* %57
%59 = lshr i32 %58, 4
%60 = and i32 %59, 15
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %61
%63 = load i8, i8* %62
store i8 %63, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 15)
%64 = and i32 %58, 15
%65 = zext i32 %64 to i64
%66 = getelementptr inbounds [17 x i8], [17 x i8]* @GetEtherAddr.Hex, i64 0, i64 %65
%67 = load i8, i8* %66
store i8 %67, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 16)
store i8 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 17)
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @GetEtherAddr.etherstr, i64 0, i64 0)
}