#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(void *, void const *, size_t);
void copyMemory(void **source, int sourceIndex, void **dest, int destIndex,
                int num) {

  ;
  ;
  for (int i = 0; i < num; i++) {
    ;
  }
  memcpy((void *)(dest + destIndex), (const void *)(source + sourceIndex),
         (size_t)(num * sizeof(void *)));
  ;
  for (int i = 0; i < num; i++) {
    ;
  };
}


x86 assembly (clang, -O0):
<copyMemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1150 <copyMemory+0x40>
jmp    1142 <copyMemory+0x32>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1131 <copyMemory+0x21>
mov    -0x18(%rbp),%rdi
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
movslq -0x20(%rbp),%rdx
shl    $0x3,%rdx
call   1030 <memcpy@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11a1 <copyMemory+0x91>
jmp    1193 <copyMemory+0x83>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1182 <copyMemory+0x72>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyMemory>:
movslq %ecx,%rax
lea    (%rdx,%rax,8),%rax
movslq %esi,%rcx
lea    (%rdi,%rcx,8),%rsi
movslq %r8d,%rdx
shl    $0x3,%rdx
mov    %rax,%rdi
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @copyMemory(i8** %0, i32 %1, i8** %2, i32 %3, i32 %4) {
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8** %0, i8*** %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 0, i32* %11
br label %13
13: ; preds = %18, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %10
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %13
br label %18
18: ; preds = %17
%19 = load i32, i32* %11
%20 = add nsw i32 %19, 1
store i32 %20, i32* %11
br label %13
21: ; preds = %13
%22 = load i8**, i8*** %8
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = bitcast i8** %25 to i8*
%27 = load i8**, i8*** %6
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = bitcast i8** %30 to i8*
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = mul i64 %33, 8
%35 = call i32 @memcpy(i8* %26, i8* %31, i64 %34)
store i32 0, i32* %12
br label %36
36: ; preds = %41, %21
%37 = load i32, i32* %12
%38 = load i32, i32* %10
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %44
40: ; preds = %36
br label %41
41: ; preds = %40
%42 = load i32, i32* %12
%43 = add nsw i32 %42, 1
store i32 %43, i32* %12
br label %36
44: ; preds = %36
ret void
}

LLVM IR (-O2):
define void @copyMemory(i8** %0, i32 %1, i8** %2, i32 %3, i32 %4) {
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds i8*, i8** %2, i64 %6
%8 = bitcast i8** %7 to i8*
%9 = sext i32 %1 to i64
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = bitcast i8** %10 to i8*
%12 = sext i32 %4 to i64
%13 = shl nsw i64 %12, 3
%14 = tail call i32 @memcpy(i8* %8, i8* %11, i64 %13)
ret void
}