#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;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int, int, int, int,
                            int);
int /*<<< orphan*/ strtoull(char *, char **, int);
uint64_t sonicPointGetHexMac(uint8_t *mac) {
  uint64_t hexMac = 0;
  char macStr[16];
  snprintf(macStr, 8 * 2 + 1, "%02x%02x%02x%02x%02x%02x", (mac)[0], (mac)[1],
           (mac)[2], (mac)[3], (mac)[4], (mac)[5], (mac)[6]);
  hexMac = strtoull(macStr, (char **)NULL, 16);
  return hexMac;
}


x86 assembly (clang, -O0):
<sonicPointGetHexMac>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x48,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%ebx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r11d
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%r10d
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%eax
mov    $0x11,%esi
lea    0xe88(%rip),%rdx
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <snprintf@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtoull@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<sonicPointGetHexMac>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    (%rdi),%ecx
mov    0x4(%rdi),%r8d
mov    0x8(%rdi),%r9d
mov    0xc(%rdi),%r10d
mov    0x10(%rdi),%r11d
mov    0x14(%rdi),%eax
mov    0x18(%rdi),%ebx
lea    0xeba(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x11,%esi
push   %rbx
push   %rax
push   %r11
push   %r10
call   1030 <snprintf@plt>
add    $0x20,%rsp
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtoull@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [25 x i8] c"%02x%02x%02x%02x%02x%02x\00"
define i32 @sonicPointGetHexMac(i32* nocapture %0) {
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* %0
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %0, i64 3
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %0, i64 4
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %0, i64 5
%14 = load i32, i32* %13
%15 = getelementptr inbounds i32, i32* %0, i64 6
%16 = load i32, i32* %15
%17 = call i32 @snprintf(i8* %3, i32 17, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6, i32 %8, i32 %10, i32 %12, i32 %14, i32 %16)
%18 = call i32 @strtoull(i8* nocapture %3, i8** null, i32 16)
ret i32 %18
}