#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 */
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int, int, int,
                           int);
char *sprint_MACaddr(char *buf, uint8_t mac[8]) {
  sprintf(buf, "%x:%x:%x:%x:%x:%x:%x:%x", mac[0], mac[1], mac[2], mac[3],
          mac[4], mac[5], mac[6], mac[7]);
  return buf;
}


x86 assembly (clang, -O0):
<sprint_MACaddr>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x38,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%ebx
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%r11d
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%r10d
mov    -0x18(%rbp),%rax
mov    0x1c(%rax),%eax
lea    0xe99(%rip),%rsi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprint_MACaddr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rsi),%edx
mov    0x4(%rsi),%ecx
mov    0x8(%rsi),%r8d
mov    0xc(%rsi),%r9d
mov    0x10(%rsi),%r10d
mov    0x14(%rsi),%r11d
mov    0x18(%rsi),%r14d
mov    0x1c(%rsi),%eax
lea    0xec6(%rip),%rsi
push   %rax
push   %r14
push   %r11
push   %r10
call   1030 <sprintf@plt>
add    $0x20,%rsp
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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