#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 */
scalar_t__ malloc(int);
char *unload_mac_addr(char *data, int *i) {
  int j;
  char *mac;
  mac = (char *)malloc(6);
  for (j = 5; j >= 0; j--) {
    mac[j] = data[*i++];
  }
  return mac;
}


x86 assembly (clang, -O0):
<unload_mac_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x6,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x5,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1171 <unload_mac_addr+0x61>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x4,%rdx
mov    %rdx,-0x10(%rbp)
movslq (%rcx),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <unload_mac_addr+0x25>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unload_mac_addr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x6,%edi
call   1030 <malloc@plt>
movslq (%rbx),%rcx
mov    (%r14,%rcx,1),%cl
mov    %cl,0x5(%rax)
movslq 0x4(%rbx),%rcx
mov    (%r14,%rcx,1),%cl
mov    %cl,0x4(%rax)
movslq 0x8(%rbx),%rcx
mov    (%r14,%rcx,1),%cl
mov    %cl,0x3(%rax)
movslq 0xc(%rbx),%rcx
mov    (%r14,%rcx,1),%cl
mov    %cl,0x2(%rax)
movslq 0x10(%rbx),%rcx
mov    (%r14,%rcx,1),%cl
mov    %cl,0x1(%rax)
movslq 0x14(%rbx),%rcx
mov    (%r14,%rcx,1),%cl
mov    %cl,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @unload_mac_addr(i8* nocapture %0, i32* nocapture %1) {
%3 = tail call i64 @malloc(i32 6)
%4 = inttoptr i64 %3 to i8*
%5 = getelementptr inbounds i32, i32* %1, i64 1
%6 = load i32, i32* %1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %4, i64 5
store i8 %9, i8* %10
%11 = getelementptr inbounds i32, i32* %1, i64 2
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %4, i64 4
store i8 %15, i8* %16
%17 = getelementptr inbounds i32, i32* %1, i64 3
%18 = load i32, i32* %11
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %0, i64 %19
%21 = load i8, i8* %20
%22 = getelementptr inbounds i8, i8* %4, i64 3
store i8 %21, i8* %22
%23 = getelementptr inbounds i32, i32* %1, i64 4
%24 = load i32, i32* %17
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %0, i64 %25
%27 = load i8, i8* %26
%28 = getelementptr inbounds i8, i8* %4, i64 2
store i8 %27, i8* %28
%29 = getelementptr inbounds i32, i32* %1, i64 5
%30 = load i32, i32* %23
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %0, i64 %31
%33 = load i8, i8* %32
%34 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %33, i8* %34
%35 = load i32, i32* %29
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %0, i64 %36
%38 = load i8, i8* %37
store i8 %38, i8* %4
ret i8* %4
}