#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*/ copy_arr(double *, double *, int);
int /*<<< orphan*/ copy_ptr(double *, double *, int);
int main(void) {
  double source[2][5] = {{1.1, 2.2, 3.3, 4.4, 5.5}, {6.6, 7.7, 8.8, 9.9, 1.1}};
  double target1[2][5], target2[2][5];
  copy_arr(source[0], target1[0], 5);
  copy_arr(source[1], target1[1], 5);
  copy_ptr(*source, *target2, 5);
  copy_ptr(*(source + 1), *(target2 + 1), 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
mov    $0x5,%edx
call   1050 <copy_arr@plt>
lea    -0x60(%rbp),%rdi
add    $0x28,%rdi
lea    -0xb0(%rbp),%rsi
add    $0x28,%rsi
mov    $0x5,%edx
call   1050 <copy_arr@plt>
lea    -0x60(%rbp),%rdi
lea    -0x100(%rbp),%rsi
mov    $0x5,%edx
call   1030 <copy_ptr@plt>
lea    -0x60(%rbp),%rdi
add    $0x28,%rdi
lea    -0x100(%rbp),%rsi
add    $0x28,%rsi
mov    $0x5,%edx
call   1030 <copy_ptr@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xf8,%rsp
movaps 0xf0f(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xef3(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xebb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9f(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r14
lea    0xa0(%rsp),%rsi
mov    %r14,%rdi
mov    $0x5,%edx
call   1040 <copy_arr@plt>
lea    0x28(%rsp),%rbx
lea    0xc8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1040 <copy_arr@plt>
lea    0x50(%rsp),%rsi
mov    %r14,%rdi
mov    $0x5,%edx
call   1030 <copy_ptr@plt>
lea    0x78(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <copy_ptr@plt>
xor    %eax,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.source = [2 x [5 x double]] [[5 x double] [double 1.100000e+00, double 2.200000e+00, double 3.300000e+00, double 4.400000e+00, double 5.500000e+00], [5 x double] [double 6.600000e+00, double 7.700000e+00, double 8.800000e+00, double 9.900000e+00, double 1.100000e+00]]
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [5 x double]]
%3 = alloca [2 x [5 x double]]
%4 = alloca [2 x [5 x double]]
store i32 0, i32* %1
%5 = bitcast [2 x [5 x double]]* %2 to i8*
%6 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %2, i64 0, i64 0
%7 = getelementptr inbounds [5 x double], [5 x double]* %6, i64 0, i64 0
%8 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %3, i64 0, i64 0
%9 = getelementptr inbounds [5 x double], [5 x double]* %8, i64 0, i64 0
%10 = call i32 @copy_arr(double* %7, double* %9, i32 5)
%11 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %2, i64 0, i64 1
%12 = getelementptr inbounds [5 x double], [5 x double]* %11, i64 0, i64 0
%13 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %3, i64 0, i64 1
%14 = getelementptr inbounds [5 x double], [5 x double]* %13, i64 0, i64 0
%15 = call i32 @copy_arr(double* %12, double* %14, i32 5)
%16 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %2, i64 0, i64 0
%17 = getelementptr inbounds [5 x double], [5 x double]* %16, i64 0, i64 0
%18 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %4, i64 0, i64 0
%19 = getelementptr inbounds [5 x double], [5 x double]* %18, i64 0, i64 0
%20 = call i32 @copy_ptr(double* %17, double* %19, i32 5)
%21 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %2, i64 0, i64 0
%22 = getelementptr inbounds [5 x double], [5 x double]* %21, i64 1
%23 = getelementptr inbounds [5 x double], [5 x double]* %22, i64 0, i64 0
%24 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %4, i64 0, i64 0
%25 = getelementptr inbounds [5 x double], [5 x double]* %24, i64 1
%26 = getelementptr inbounds [5 x double], [5 x double]* %25, i64 0, i64 0
%27 = call i32 @copy_ptr(double* %23, double* %26, i32 5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.source = [2 x [5 x double]] [[5 x double] [double 1.100000e+00, double 2.200000e+00, double 3.300000e+00, double 4.400000e+00, double 5.500000e+00], [5 x double] [double 6.600000e+00, double 7.700000e+00, double 8.800000e+00, double 9.900000e+00, double 1.100000e+00]]
define i32 @main() {
%1 = alloca [2 x [5 x double]]
%2 = alloca [2 x [5 x double]]
%3 = alloca [2 x [5 x double]]
%4 = bitcast [2 x [5 x double]]* %1 to i8*
%5 = bitcast [2 x [5 x double]]* %2 to i8*
%6 = bitcast [2 x [5 x double]]* %3 to i8*
%7 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %1, i64 0, i64 0, i64 0
%8 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %2, i64 0, i64 0, i64 0
%9 = call i32 @copy_arr(double* %7, double* %8, i32 5)
%10 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %1, i64 0, i64 1, i64 0
%11 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %2, i64 0, i64 1, i64 0
%12 = call i32 @copy_arr(double* %10, double* %11, i32 5)
%13 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %3, i64 0, i64 0, i64 0
%14 = call i32 @copy_ptr(double* %7, double* %13, i32 5)
%15 = getelementptr inbounds [2 x [5 x double]], [2 x [5 x double]]* %3, i64 0, i64 1, i64 0
%16 = call i32 @copy_ptr(double* %10, double* %15, i32 5)
ret i32 0
}