#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 /*<<< orphan*/ uint8_t;

/* Variables and functions */
void generatePacket(uint8_t *mac, uint8_t *packet) {
  int i, j, k;
  k = 6;
  for (i = 0; i <= 15; i++) {
    for (j = 0; j <= 5; j++, k++) {
      packet[k] = mac[j];
    }
  }
}


x86 assembly (clang, -O0):
<generatePacket>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x6,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xf,-0x14(%rbp)
jg     1175 <generatePacket+0x75>
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jg     1162 <generatePacket+0x62>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <generatePacket+0x2b>
jmp    1167 <generatePacket+0x67>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111a <generatePacket+0x1a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<generatePacket>:
mov    $0x2c,%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rdi),%ecx
mov    %ecx,-0x14(%rsi,%rax,1)
mov    0x4(%rdi),%ecx
mov    %ecx,-0x10(%rsi,%rax,1)
mov    0x8(%rdi),%ecx
mov    %ecx,-0xc(%rsi,%rax,1)
mov    0xc(%rdi),%ecx
mov    %ecx,-0x8(%rsi,%rax,1)
mov    0x10(%rdi),%ecx
mov    %ecx,-0x4(%rsi,%rax,1)
mov    0x14(%rdi),%ecx
mov    %ecx,(%rsi,%rax,1)
add    $0x18,%rax
cmp    $0x1ac,%eax
jne    1110 <generatePacket+0x10>
ret

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

LLVM IR (-O2):
define void @generatePacket(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = getelementptr inbounds i32, i32* %0, i64 2
%5 = getelementptr inbounds i32, i32* %0, i64 3
%6 = getelementptr inbounds i32, i32* %0, i64 4
%7 = getelementptr inbounds i32, i32* %0, i64 5
br label %8
8: ; preds = %2, %8
%9 = phi i64 [ 6, %2 ], [ %28, %8 ]
%10 = phi i32 [ 0, %2 ], [ %29, %8 ]
%11 = load i32, i32* %0
%12 = getelementptr inbounds i32, i32* %1, i64 %9
store i32 %11, i32* %12
%13 = or i64 %9, 1
%14 = load i32, i32* %3
%15 = getelementptr inbounds i32, i32* %1, i64 %13
store i32 %14, i32* %15
%16 = add nuw i64 %9, 2
%17 = load i32, i32* %4
%18 = getelementptr inbounds i32, i32* %1, i64 %16
store i32 %17, i32* %18
%19 = add nuw i64 %9, 3
%20 = load i32, i32* %5
%21 = getelementptr inbounds i32, i32* %1, i64 %19
store i32 %20, i32* %21
%22 = add nuw i64 %9, 4
%23 = load i32, i32* %6
%24 = getelementptr inbounds i32, i32* %1, i64 %22
store i32 %23, i32* %24
%25 = add nuw i64 %9, 5
%26 = load i32, i32* %7
%27 = getelementptr inbounds i32, i32* %1, i64 %25
store i32 %26, i32* %27
%28 = add nuw nsw i64 %9, 6
%29 = add nuw nsw i32 %10, 1
%30 = icmp eq i32 %29, 16
br i1 %30, label %31, label %8
31: ; preds = %8
ret void
}