#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*/ memcpy(unsigned char *, unsigned char *, int);
void prepare_wol(unsigned char *wol_magic, unsigned char *mac) {
  int i;
  for (i = 0; i < 16; i++)
    memcpy(&wol_magic[30 + i * 6], mac, 6);
}


x86 assembly (clang, -O0):
<prepare_wol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    115d <prepare_wol+0x4d>
mov    -0x8(%rbp),%rdi
imul   $0x6,-0x14(%rbp),%eax
add    $0x1e,%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <prepare_wol+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prepare_wol>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1e,%rdi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x24(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x2a(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x30(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x36(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x3c(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x42(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x48(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x4e(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x54(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x5a(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x60(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x66(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x6c(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
lea    0x72(%rbx),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
add    $0x78,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @prepare_wol(i8* %0, i8* %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 30
%4 = tail call i32 @memcpy(i8* %3, i8* %1, i32 6)
%5 = getelementptr inbounds i8, i8* %0, i64 36
%6 = tail call i32 @memcpy(i8* %5, i8* %1, i32 6)
%7 = getelementptr inbounds i8, i8* %0, i64 42
%8 = tail call i32 @memcpy(i8* %7, i8* %1, i32 6)
%9 = getelementptr inbounds i8, i8* %0, i64 48
%10 = tail call i32 @memcpy(i8* %9, i8* %1, i32 6)
%11 = getelementptr inbounds i8, i8* %0, i64 54
%12 = tail call i32 @memcpy(i8* %11, i8* %1, i32 6)
%13 = getelementptr inbounds i8, i8* %0, i64 60
%14 = tail call i32 @memcpy(i8* %13, i8* %1, i32 6)
%15 = getelementptr inbounds i8, i8* %0, i64 66
%16 = tail call i32 @memcpy(i8* %15, i8* %1, i32 6)
%17 = getelementptr inbounds i8, i8* %0, i64 72
%18 = tail call i32 @memcpy(i8* %17, i8* %1, i32 6)
%19 = getelementptr inbounds i8, i8* %0, i64 78
%20 = tail call i32 @memcpy(i8* %19, i8* %1, i32 6)
%21 = getelementptr inbounds i8, i8* %0, i64 84
%22 = tail call i32 @memcpy(i8* %21, i8* %1, i32 6)
%23 = getelementptr inbounds i8, i8* %0, i64 90
%24 = tail call i32 @memcpy(i8* %23, i8* %1, i32 6)
%25 = getelementptr inbounds i8, i8* %0, i64 96
%26 = tail call i32 @memcpy(i8* %25, i8* %1, i32 6)
%27 = getelementptr inbounds i8, i8* %0, i64 102
%28 = tail call i32 @memcpy(i8* %27, i8* %1, i32 6)
%29 = getelementptr inbounds i8, i8* %0, i64 108
%30 = tail call i32 @memcpy(i8* %29, i8* %1, i32 6)
%31 = getelementptr inbounds i8, i8* %0, i64 114
%32 = tail call i32 @memcpy(i8* %31, i8* %1, i32 6)
%33 = getelementptr inbounds i8, i8* %0, i64 120
%34 = tail call i32 @memcpy(i8* %33, i8* %1, i32 6)
ret void
}