#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 */

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char, unsigned char,
                           unsigned char, unsigned char, unsigned char,
                           unsigned char);
int sigar_ether_ntoa(char *buff, unsigned char *ptr) {
  sprintf(buff, "%02X:%02X:%02X:%02X:%02X:%02X", (ptr[0] & 0xff),
          (ptr[1] & 0xff), (ptr[2] & 0xff), (ptr[3] & 0xff), (ptr[4] & 0xff),
          (ptr[5] & 0xff));
  return 0;
}


x86 assembly (clang, -O0):
<sigar_ether_ntoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%eax
and    $0xff,%eax
mov    %al,%r8b
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%eax
and    $0xff,%eax
mov    %al,%r9b
mov    -0x10(%rbp),%rax
movzbl 0x4(%rax),%eax
and    $0xff,%eax
mov    %al,%r10b
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%eax
and    $0xff,%eax
lea    0xe7b(%rip),%rsi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl %r10b,%r10d
mov    %r10d,(%rsp)
movzbl %al,%eax
mov    %eax,0x8(%rsp)
call   1030 <sprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

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