#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 uint8_t;

/* Variables and functions */
char *inet_mtoa(uint8_t *mac) {
  static char str[18];
  char hex[16] = "0123456789ABCDEF";
  int i, p;
  p = 0;
  for (i = 0; i < 6; i++) {
    str[p++] = hex[mac[i] >> 4];
    str[p++] = hex[mac[i] & 0xf];
    if (i < 5)
      str[p++] = ':';
    else
      str[p++] = '\0';
  }
  return str;
}


x86 assembly (clang, -O0):
<inet_mtoa>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0xef1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeee(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x6,-0x24(%rbp)
jge    11e2 <inet_mtoa+0xe2>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sar    $0x4,%eax
cltq
mov    -0x20(%rbp,%rax,1),%dl
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x28(%rbp)
movslq %eax,%rcx
lea    0x2ed1(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0xf,%eax
cltq
mov    -0x20(%rbp,%rax,1),%dl
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x28(%rbp)
movslq %eax,%rcx
lea    0x2ea5(%rip),%rax
mov    %dl,(%rax,%rcx,1)
cmpl   $0x5,-0x24(%rbp)
jge    11b6 <inet_mtoa+0xb6>
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x28(%rbp)
movslq %eax,%rcx
lea    0x2e83(%rip),%rax
movb   $0x3a,(%rax,%rcx,1)
jmp    11cf <inet_mtoa+0xcf>
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x28(%rbp)
movslq %eax,%rcx
lea    0x2e65(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    11d4 <inet_mtoa+0xd4>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112c <inet_mtoa+0x2c>
lea    0x2e47(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_mtoa>:
mov    (%rdi),%eax
sar    $0x4,%eax
cltq
lea    0xef2(%rip),%r8
mov    (%rax,%r8,1),%al
mov    %al,0x2f18(%rip)
lea    0x2f11(%rip),%rax
mov    (%rdi),%edx
and    $0xf,%edx
mov    (%rdx,%r8,1),%dl
mov    %dl,0x2f03(%rip)
movb   $0x3a,0x2efd(%rip)
mov    0x4(%rdi),%edx
mov    %edx,%esi
sar    $0x4,%esi
movslq %esi,%rsi
mov    (%rsi,%r8,1),%cl
mov    %cl,0x2ee9(%rip)
and    $0xf,%edx
mov    (%rdx,%r8,1),%cl
mov    %cl,0x2edd(%rip)
movb   $0x3a,0x2ed7(%rip)
mov    0x8(%rdi),%ecx
mov    %ecx,%edx
sar    $0x4,%edx
movslq %edx,%rdx
mov    (%rdx,%r8,1),%dl
mov    %dl,0x2ec3(%rip)
and    $0xf,%ecx
mov    (%rcx,%r8,1),%cl
mov    %cl,0x2eb7(%rip)
movb   $0x3a,0x2eb1(%rip)
mov    0xc(%rdi),%ecx
mov    %ecx,%edx
sar    $0x4,%edx
movslq %edx,%rdx
mov    (%rdx,%r8,1),%dl
mov    %dl,0x2e9d(%rip)
and    $0xf,%ecx
mov    (%rcx,%r8,1),%cl
mov    %cl,0x2e91(%rip)
movb   $0x3a,0x2e8b(%rip)
mov    0x10(%rdi),%ecx
mov    %ecx,%edx
sar    $0x4,%edx
movslq %edx,%rdx
mov    (%rdx,%r8,1),%dl
mov    %dl,0x2e77(%rip)
and    $0xf,%ecx
mov    (%rcx,%r8,1),%cl
mov    %cl,0x2e6b(%rip)
movb   $0x3a,0x2e65(%rip)
mov    0x14(%rdi),%ecx
mov    %ecx,%edx
sar    $0x4,%edx
movslq %edx,%rdx
mov    (%rdx,%r8,1),%dl
mov    %dl,0x2e51(%rip)
and    $0xf,%ecx
mov    (%rcx,%r8,1),%cl
mov    %cl,0x2e45(%rip)
movb   $0x0,0x2e3f(%rip)
ret

LLVM IR (-O0):
@inet_mtoa.str = internal global [18 x i8] zeroinitializer
@__const.inet_mtoa.hex = [16 x i8] c"0123456789ABCDEF"
define i8* @inet_mtoa(i32* %0) {
%2 = alloca i32*
%3 = alloca [16 x i8]
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
%6 = bitcast [16 x i8]* %3 to i8*
store i32 0, i32* %5
store i32 0, i32* %4
br label %7
7: ; preds = %50, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 6
br i1 %9, label %10, label %53
10: ; preds = %7
%11 = load i32*, i32** %2
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = ashr i32 %15, 4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
%22 = sext i32 %20 to i64
%23 = getelementptr inbounds [18 x i8], [18 x i8]* @inet_mtoa.str, i64 0, i64 %22
store i8 %19, i8* %23
%24 = load i32*, i32** %2
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = and i32 %28, 15
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds [18 x i8], [18 x i8]* @inet_mtoa.str, i64 0, i64 %35
store i8 %32, i8* %36
%37 = load i32, i32* %4
%38 = icmp slt i32 %37, 5
br i1 %38, label %39, label %44
39: ; preds = %10
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
%42 = sext i32 %40 to i64
%43 = getelementptr inbounds [18 x i8], [18 x i8]* @inet_mtoa.str, i64 0, i64 %42
store i8 58, i8* %43
br label %49
44: ; preds = %10
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
%47 = sext i32 %45 to i64
%48 = getelementptr inbounds [18 x i8], [18 x i8]* @inet_mtoa.str, i64 0, i64 %47
store i8 0, i8* %48
br label %49
49: ; preds = %44, %39
br label %50
50: ; preds = %49
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
store i32 %52, i32* %4
br label %7
53: ; preds = %7
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @inet_mtoa.str, i64 0, i64 0)
}

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