pether(out, addr) char *out, *addr;
{
  sprintf(out, "%02x:%02x:%02x:%02x:%02x:%02x", ((unsigned char)(addr[0])),
          ((unsigned char)(addr[1])), ((unsigned char)(addr[2])),
          ((unsigned char)(addr[3])), ((unsigned char)(addr[4])),
          ((unsigned char)(addr[5])));
}


x86 assembly (clang, -O0):
<pether>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movzbl (%rax),%edx
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%ecx
mov    -0x18(%rbp),%rax
movzbl 0x2(%rax),%r8d
mov    -0x18(%rbp),%rax
movzbl 0x3(%rax),%r9d
mov    -0x18(%rbp),%rax
movzbl 0x4(%rax),%r10d
mov    -0x18(%rbp),%rax
movzbl 0x5(%rax),%eax
lea    0xea3(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pether>:
push   %rax
movzbl (%rsi),%edx
movzbl 0x1(%rsi),%ecx
movzbl 0x2(%rsi),%r8d
movzbl 0x3(%rsi),%r9d
movzbl 0x4(%rsi),%r10d
movzbl 0x5(%rsi),%r11d
lea    0xecd(%rip),%rsi
xor    %eax,%eax
push   %r11
push   %r10
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"%02x:%02x:%02x:%02x:%02x:%02x\00"
define i32 @pether(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %5
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 3
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 4
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i64 5
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %14, i32 %18, i32 %22, i32 %26, i32 %30)
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@.str = [30 x i8] c"%02x:%02x:%02x:%02x:%02x:%02x\00"
define i32 @pether(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = zext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %1, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = getelementptr inbounds i8, i8* %1, i64 2
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = getelementptr inbounds i8, i8* %1, i64 3
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = getelementptr inbounds i8, i8* %1, i64 4
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = getelementptr inbounds i8, i8* %1, i64 5
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %7, i32 %10, i32 %13, i32 %16, i32 %19)
ret i32 undef
}