#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*/ dec_to_hex(char, char *, int);
void bytes_to_mac(char *device_mac_str, char mac_bytes[]) {
  int i, from_limit;
  for (i = 0; i < 6; i++) {
    char tmp[3];
    from_limit = (i * 2) + i;
    dec_to_hex(mac_bytes[i], device_mac_str, from_limit);
  }
}


x86 assembly (clang, -O0):
<bytes_to_mac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    1165 <bytes_to_mac+0x55>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%edx
movsbl %al,%edi
call   1030 <dec_to_hex@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <bytes_to_mac+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytes_to_mac>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movsbl (%rsi),%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <dec_to_hex@plt>
movsbl 0x1(%rbx),%edi
mov    %r14,%rsi
mov    $0x3,%edx
call   1030 <dec_to_hex@plt>
movsbl 0x2(%rbx),%edi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <dec_to_hex@plt>
movsbl 0x3(%rbx),%edi
mov    %r14,%rsi
mov    $0x9,%edx
call   1030 <dec_to_hex@plt>
movsbl 0x4(%rbx),%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   1030 <dec_to_hex@plt>
movsbl 0x5(%rbx),%edi
mov    %r14,%rsi
mov    $0xf,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <dec_to_hex@plt>

LLVM IR (-O0):
define void @bytes_to_mac(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [3 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %8
8: ; preds = %24, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 6
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i32, i32* %5
%13 = mul nsw i32 %12, 2
%14 = load i32, i32* %5
%15 = add nsw i32 %13, %14
store i32 %15, i32* %6
%16 = load i8*, i8** %4
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = load i8*, i8** %3
%22 = load i32, i32* %6
%23 = call i32 @dec_to_hex(i8 signext %20, i8* %21, i32 %22)
br label %24
24: ; preds = %11
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %8
27: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @bytes_to_mac(i8* %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = tail call i32 @dec_to_hex(i8 signext %3, i8* %0, i32 0)
%5 = getelementptr inbounds i8, i8* %1, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @dec_to_hex(i8 signext %6, i8* %0, i32 3)
%8 = getelementptr inbounds i8, i8* %1, i64 2
%9 = load i8, i8* %8
%10 = tail call i32 @dec_to_hex(i8 signext %9, i8* %0, i32 6)
%11 = getelementptr inbounds i8, i8* %1, i64 3
%12 = load i8, i8* %11
%13 = tail call i32 @dec_to_hex(i8 signext %12, i8* %0, i32 9)
%14 = getelementptr inbounds i8, i8* %1, i64 4
%15 = load i8, i8* %14
%16 = tail call i32 @dec_to_hex(i8 signext %15, i8* %0, i32 12)
%17 = getelementptr inbounds i8, i8* %1, i64 5
%18 = load i8, i8* %17
%19 = tail call i32 @dec_to_hex(i8 signext %18, i8* %0, i32 15)
ret void
}