#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 /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char, char, char, char, char,
                            char);
char *hw2str(char *hw) {
  static char buf[18];
  snprintf(buf, sizeof(buf), "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", hw[0],
           hw[1], hw[2], hw[3], hw[4], hw[5]);
  return buf;
}


x86 assembly (clang, -O0):
<hw2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%r8b
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%r9b
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%r11b
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%r10b
mov    -0x8(%rbp),%rax
lea    0x2ef3(%rip),%rdi
mov    $0x12,%esi
lea    0xea7(%rip),%rdx
movsbl %cl,%ecx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r11b,%r11d
mov    %r11d,(%rsp)
movsbl %r10b,%r10d
mov    %r10d,0x8(%rsp)
movsbl 0x5(%rax),%eax
mov    %eax,0x10(%rsp)
call   1030 <snprintf@plt>
lea    0x2eb7(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hw2str>:
push   %r14
push   %rbx
push   %rax
movsbl (%rdi),%ecx
movsbl 0x1(%rdi),%r8d
movsbl 0x2(%rdi),%r9d
movsbl 0x3(%rdi),%r10d
movsbl 0x4(%rdi),%ebx
movsbl 0x5(%rdi),%eax
sub    $0x8,%rsp
lea    0x2f07(%rip),%r14
lea    0xec0(%rip),%rdx
mov    %r14,%rdi
mov    $0x12,%esi
push   %rax
push   %rbx
push   %r10
call   1030 <snprintf@plt>
add    $0x20,%rsp
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@hw2str.buf = internal global [18 x i8] zeroinitializer
@.str = [42 x i8] c"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\00"
define i8* @hw2str(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 2
%11 = load i8, i8* %10
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 3
%14 = load i8, i8* %13
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 4
%17 = load i8, i8* %16
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 5
%20 = load i8, i8* %19
%21 = call i32 @snprintf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @hw2str.buf, i64 0, i64 0), i32 18, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8 signext %5, i8 signext %8, i8 signext %11, i8 signext %14, i8 signext %17, i8 signext %20)
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @hw2str.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@hw2str.buf = internal global [18 x i8] zeroinitializer
@.str = [42 x i8] c"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\00"
define i8* @hw2str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %0, i64 3
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %0, i64 5
%12 = load i8, i8* %11
%13 = tail call i32 @snprintf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @hw2str.buf, i64 0, i64 0), i32 18, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8 signext %2, i8 signext %4, i8 signext %6, i8 signext %8, i8 signext %10, i8 signext %12)
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @hw2str.buf, i64 0, i64 0)
}