#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 *, size_t);
void array_set2(size_t size0, size_t size1, size_t v_size, void *array,
                void *data) {
  for (size_t x = 0; x < size0; x++) {
    for (size_t y = 0; y < size1; y++) {
      memcpy(&((void ***)array)[x][y], data, v_size);
    }
  }
}


x86 assembly (clang, -O0):
<array_set2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    11a3 <array_set2+0x93>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    118d <array_set2+0x7d>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x38(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    114a <array_set2+0x3a>
jmp    1192 <array_set2+0x82>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1134 <array_set2+0x24>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_set2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,0x10(%rsp)
test   %rdi,%rdi
je     117e <array_set2+0x6e>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbx
xor    %ebp,%ebp
jmp    114b <array_set2+0x3b>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    0x10(%rsp),%rbp
je     117e <array_set2+0x6e>
cmpq   $0x0,0x8(%rsp)
je     1140 <array_set2+0x30>
xor    %r13d,%r13d
mov    0x8(%rsp),%r12
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbp,8),%rdi
add    %r13,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <memcpy@plt>
add    $0x8,%r13
add    $0xffffffffffffffff,%r12
jne    1160 <array_set2+0x50>
jmp    1140 <array_set2+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @array_set2(i64 %0, i64 %1, i64 %2, i8* nocapture %3, i8* %4) {
%6 = icmp eq i64 %0, 0
br i1 %6, label %14, label %7
7: ; preds = %5
%8 = icmp eq i64 %1, 0
%9 = bitcast i8* %3 to i8***
br label %10
10: ; preds = %7, %15
%11 = phi i64 [ 0, %7 ], [ %16, %15 ]
br i1 %8, label %15, label %12
12: ; preds = %10
%13 = getelementptr inbounds i8**, i8*** %9, i64 %11
br label %18
14: ; preds = %15, %5
ret void
15: ; preds = %18, %10
%16 = add nuw i64 %11, 1
%17 = icmp eq i64 %16, %0
br i1 %17, label %14, label %10
18: ; preds = %12, %18
%19 = phi i64 [ 0, %12 ], [ %23, %18 ]
%20 = load i8**, i8*** %13
%21 = getelementptr inbounds i8*, i8** %20, i64 %19
%22 = tail call i32 @memcpy(i8** %21, i8* %4, i64 %2)
%23 = add nuw i64 %19, 1
%24 = icmp eq i64 %23, %1
br i1 %24, label %15, label %18
}