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

/* Variables and functions */
int /*<<< orphan*/ memcpy(int **, int **, int);
int /*<<< orphan*/ test_assert(int);
int main(void) {
  int a = 0;
  int *array[10];
  int *array2[10];
  int **p = array;
  int **q = array2;
  array[3] = &a;
  memcpy(q, p, sizeof(array));
  *array2[3] = 13;
  test_assert(13 == a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    -0xb0(%rbp),%rax
mov    %rax,-0xc0(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0xc0(%rbp),%rdi
mov    -0xb8(%rbp),%rsi
mov    $0x50,%edx
call   1030 <memcpy@plt>
mov    -0x98(%rbp),%rax
movl   $0xd,(%rax)
mov    $0xd,%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <test_assert@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xb8,%rsp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rax
mov    %rax,0x78(%rsp)
lea    0x10(%rsp),%rdi
lea    0x60(%rsp),%rsi
mov    $0x50,%edx
call   1030 <memcpy@plt>
mov    0x28(%rsp),%rax
movl   $0xd,(%rax)
xor    %edi,%edi
cmpl   $0xd,0xc(%rsp)
sete   %dil
call   1040 <test_assert@plt>
xor    %eax,%eax
add    $0xb8,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32*]
%4 = alloca [10 x i32*]
%5 = alloca i32**
%6 = alloca i32**
store i32 0, i32* %1
store i32 0, i32* %2
%7 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 0
store i32** %7, i32*** %5
%8 = getelementptr inbounds [10 x i32*], [10 x i32*]* %4, i64 0, i64 0
store i32** %8, i32*** %6
%9 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 3
store i32* %2, i32** %9
%10 = load i32**, i32*** %6
%11 = load i32**, i32*** %5
%12 = call i32 @memcpy(i32** %10, i32** %11, i32 80)
%13 = getelementptr inbounds [10 x i32*], [10 x i32*]* %4, i64 0, i64 3
%14 = load i32*, i32** %13
store i32 13, i32* %14
%15 = load i32, i32* %2
%16 = icmp eq i32 13, %15
%17 = zext i1 %16 to i32
%18 = call i32 @test_assert(i32 %17)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32*]
%3 = alloca [10 x i32*]
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast [10 x i32*]* %2 to i8*
%6 = bitcast [10 x i32*]* %3 to i8*
%7 = getelementptr inbounds [10 x i32*], [10 x i32*]* %2, i64 0, i64 0
%8 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 0
%9 = getelementptr inbounds [10 x i32*], [10 x i32*]* %2, i64 0, i64 3
store i32* %1, i32** %9
%10 = call i32 @memcpy(i32** %8, i32** %7, i32 80)
%11 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 3
%12 = load i32*, i32** %11
store i32 13, i32* %12
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 13
%15 = zext i1 %14 to i32
%16 = call i32 @test_assert(i32 %15)
ret i32 0
}