#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 */
scalar_t__ malloc(int);
double **copy_double_arr(double **arr, int row, int col) {
  double **copy;
  int i, j;
  copy = (double **)malloc(sizeof(double *) * row);
  for (i = 0; i < row; i++) {
    copy[i] = (double *)malloc(sizeof(double) * col);
    for (j = 0; j < col; j++)
      copy[i][j] = arr[i][j];
  }
  return (copy);
}


x86 assembly (clang, -O0):
<copy_double_arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c4 <copy_double_arr+0xb4>
movslq -0x10(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b1 <copy_double_arr+0xa1>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    116d <copy_double_arr+0x5d>
jmp    11b6 <copy_double_arr+0xa6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <copy_double_arr+0x2c>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_double_arr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edx,%ebx
mov    %esi,%r12d
mov    %rdi,0x28(%rsp)
lea    0x0(,%r12,8),%edi
call   1030 <malloc@plt>
mov    %rax,%r15
test   %r12d,%r12d
jle    1321 <copy_double_arr+0x211>
lea    0x0(,%rbx,8),%eax
mov    %eax,0x4(%rsp)
mov    %r12d,%eax
mov    %rax,0x30(%rsp)
mov    %ebx,%ebp
mov    %ebp,%eax
and    $0xfffffffc,%eax
mov    %rax,0x20(%rsp)
add    $0xfffffffffffffffc,%rax
mov    %rax,0x18(%rsp)
shr    $0x2,%rax
add    $0x1,%rax
mov    %eax,%r12d
and    $0x3,%r12d
and    $0xfffffffffffffffc,%rax
mov    %rax,0x8(%rsp)
mov    %ebp,%r14d
and    $0x3,%r14d
mov    %r12,0x10(%rsp)
shl    $0x5,%r12
xor    %r13d,%r13d
jmp    11af <copy_double_arr+0x9f>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r13
cmp    0x30(%rsp),%r13
je     1321 <copy_double_arr+0x211>
mov    0x4(%rsp),%edi
call   1030 <malloc@plt>
mov    %rax,(%r15,%r13,8)
test   %ebx,%ebx
jle    11a0 <copy_double_arr+0x90>
mov    0x28(%rsp),%rcx
mov    (%rcx,%r13,8),%rcx
cmp    $0x4,%ebx
jb     11e4 <copy_double_arr+0xd4>
lea    (%rcx,%rbp,8),%rdx
cmp    %rdx,%rax
jae    125c <copy_double_arr+0x14c>
lea    (%rax,%rbp,8),%rdx
cmp    %rdx,%rcx
jae    125c <copy_double_arr+0x14c>
xor    %edx,%edx
mov    %rdx,%rsi
not    %rsi
add    %rbp,%rsi
test   %r14,%r14
je     1214 <copy_double_arr+0x104>
mov    %r14,%rdi
nopw   0x0(%rax,%rax,1)
movsd  (%rcx,%rdx,8),%xmm0
movsd  %xmm0,(%rax,%rdx,8)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rdi
jne    1200 <copy_double_arr+0xf0>
cmp    $0x3,%rsi
jb     11a0 <copy_double_arr+0x90>
nopw   0x0(%rax,%rax,1)
movsd  (%rcx,%rdx,8),%xmm0
movsd  %xmm0,(%rax,%rdx,8)
movsd  0x8(%rcx,%rdx,8),%xmm0
movsd  %xmm0,0x8(%rax,%rdx,8)
movsd  0x10(%rcx,%rdx,8),%xmm0
movsd  %xmm0,0x10(%rax,%rdx,8)
movsd  0x18(%rcx,%rdx,8),%xmm0
movsd  %xmm0,0x18(%rax,%rdx,8)
add    $0x4,%rdx
cmp    %rdx,%rbp
jne    1220 <copy_double_arr+0x110>
jmp    11a0 <copy_double_arr+0x90>
cmpq   $0xc,0x18(%rsp)
jae    1268 <copy_double_arr+0x158>
xor    %edx,%edx
jmp    12c8 <copy_double_arr+0x1b8>
mov    0x8(%rsp),%rsi
xor    %edx,%edx
nop
movups (%rcx,%rdx,8),%xmm0
movups 0x10(%rcx,%rdx,8),%xmm1
movups %xmm0,(%rax,%rdx,8)
movups %xmm1,0x10(%rax,%rdx,8)
movups 0x20(%rcx,%rdx,8),%xmm0
movups 0x30(%rcx,%rdx,8),%xmm1
movups %xmm0,0x20(%rax,%rdx,8)
movups %xmm1,0x30(%rax,%rdx,8)
movups 0x40(%rcx,%rdx,8),%xmm0
movups 0x50(%rcx,%rdx,8),%xmm1
movups %xmm0,0x40(%rax,%rdx,8)
movups %xmm1,0x50(%rax,%rdx,8)
movups 0x60(%rcx,%rdx,8),%xmm0
movups 0x70(%rcx,%rdx,8),%xmm1
movups %xmm0,0x60(%rax,%rdx,8)
movups %xmm1,0x70(%rax,%rdx,8)
add    $0x10,%rdx
add    $0xfffffffffffffffc,%rsi
jne    1270 <copy_double_arr+0x160>
cmpq   $0x0,0x10(%rsp)
je     130b <copy_double_arr+0x1fb>
lea    (%rax,%rdx,8),%rsi
add    $0x10,%rsi
lea    (%rcx,%rdx,8),%rdx
add    $0x10,%rdx
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups -0x10(%rdx,%rdi,1),%xmm0
movups (%rdx,%rdi,1),%xmm1
movups %xmm0,-0x10(%rsi,%rdi,1)
movups %xmm1,(%rsi,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%r12
jne    12f0 <copy_double_arr+0x1e0>
mov    0x20(%rsp),%rsi
mov    %rsi,%rdx
cmp    %rbp,%rsi
je     11a0 <copy_double_arr+0x90>
jmp    11e6 <copy_double_arr+0xd6>
mov    %r15,%rax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double** @copy_double_arr(double** %0, i32 %1, i32 %2) {
%4 = alloca double**
%5 = alloca i32
%6 = alloca i32
%7 = alloca double**
%8 = alloca i32
%9 = alloca i32
store double** %0, double*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = mul i64 8, %11
%13 = trunc i64 %12 to i32
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to double**
store double** %15, double*** %7
store i32 0, i32* %8
br label %16
16: ; preds = %57, %3
%17 = load i32, i32* %8
%18 = load i32, i32* %5
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %60
20: ; preds = %16
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = mul i64 8, %22
%24 = trunc i64 %23 to i32
%25 = call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to double*
%27 = load double**, double*** %7
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double*, double** %27, i64 %29
store double* %26, double** %30
store i32 0, i32* %9
br label %31
31: ; preds = %53, %20
%32 = load i32, i32* %9
%33 = load i32, i32* %6
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %56
35: ; preds = %31
%36 = load double**, double*** %4
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double*, double** %36, i64 %38
%40 = load double*, double** %39
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
%44 = load double, double* %43
%45 = load double**, double*** %7
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double*, double** %45, i64 %47
%49 = load double*, double** %48
%50 = load i32, i32* %9
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
store double %44, double* %52
br label %53
53: ; preds = %35
%54 = load i32, i32* %9
%55 = add nsw i32 %54, 1
store i32 %55, i32* %9
br label %31
56: ; preds = %31
br label %57
57: ; preds = %56
%58 = load i32, i32* %8
%59 = add nsw i32 %58, 1
store i32 %59, i32* %8
br label %16
60: ; preds = %16
%61 = load double**, double*** %7
ret double** %61
}

LLVM IR (-O2):
define double** @copy_double_arr(double** nocapture %0, i32 %1, i32 %2) {
%4 = shl i32 %1, 3
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to double**
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %149
8: ; preds = %3
%9 = shl i32 %2, 3
%10 = icmp sgt i32 %2, 0
%11 = zext i32 %1 to i64
%12 = zext i32 %2 to i64
%13 = and i64 %12, 4294967292
%14 = add nsw i64 %13, -4
%15 = lshr exact i64 %14, 2
%16 = add nuw nsw i64 %15, 1
%17 = icmp ult i32 %2, 4
%18 = and i64 %12, 4294967292
%19 = and i64 %16, 3
%20 = icmp ult i64 %14, 12
%21 = and i64 %16, 9223372036854775804
%22 = icmp eq i64 %19, 0
%23 = icmp eq i64 %18, %12
%24 = and i64 %12, 3
%25 = icmp eq i64 %24, 0
br label %26
26: ; preds = %8, %146
%27 = phi i64 [ 0, %8 ], [ %147, %146 ]
%28 = tail call i64 @malloc(i32 %9)
%29 = inttoptr i64 %28 to double*
%30 = inttoptr i64 %28 to i8*
%31 = getelementptr inbounds double*, double** %6, i64 %27
store double* %29, double** %31
br i1 %10, label %32, label %146
32: ; preds = %26
%33 = getelementptr inbounds double*, double** %0, i64 %27
%34 = load double*, double** %33
br i1 %17, label %111, label %35
35: ; preds = %32
%36 = getelementptr double, double* %29, i64 %12
%37 = getelementptr double, double* %34, i64 %12
%38 = bitcast double* %37 to i8*
%39 = icmp ult i8* %30, %38
%40 = icmp ult double* %34, %36
%41 = and i1 %39, %40
br i1 %41, label %111, label %42
42: ; preds = %35
br i1 %20, label %92, label %43
43: ; preds = %42, %43
%44 = phi i64 [ %89, %43 ], [ 0, %42 ]
%45 = phi i64 [ %90, %43 ], [ 0, %42 ]
%46 = getelementptr inbounds double, double* %34, i64 %44
%47 = bitcast double* %46 to <2 x double>*
%48 = load <2 x double>, <2 x double>* %47
%49 = getelementptr inbounds double, double* %46, i64 2
%50 = bitcast double* %49 to <2 x double>*
%51 = load <2 x double>, <2 x double>* %50
%52 = getelementptr inbounds double, double* %29, i64 %44
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> %48, <2 x double>* %53
%54 = getelementptr inbounds double, double* %52, i64 2
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> %51, <2 x double>* %55
%56 = or i64 %44, 4
%57 = getelementptr inbounds double, double* %34, i64 %56
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = getelementptr inbounds double, double* %57, i64 2
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = getelementptr inbounds double, double* %29, i64 %56
%64 = bitcast double* %63 to <2 x double>*
store <2 x double> %59, <2 x double>* %64
%65 = getelementptr inbounds double, double* %63, i64 2
%66 = bitcast double* %65 to <2 x double>*
store <2 x double> %62, <2 x double>* %66
%67 = or i64 %44, 8
%68 = getelementptr inbounds double, double* %34, i64 %67
%69 = bitcast double* %68 to <2 x double>*
%70 = load <2 x double>, <2 x double>* %69
%71 = getelementptr inbounds double, double* %68, i64 2
%72 = bitcast double* %71 to <2 x double>*
%73 = load <2 x double>, <2 x double>* %72
%74 = getelementptr inbounds double, double* %29, i64 %67
%75 = bitcast double* %74 to <2 x double>*
store <2 x double> %70, <2 x double>* %75
%76 = getelementptr inbounds double, double* %74, i64 2
%77 = bitcast double* %76 to <2 x double>*
store <2 x double> %73, <2 x double>* %77
%78 = or i64 %44, 12
%79 = getelementptr inbounds double, double* %34, i64 %78
%80 = bitcast double* %79 to <2 x double>*
%81 = load <2 x double>, <2 x double>* %80
%82 = getelementptr inbounds double, double* %79, i64 2
%83 = bitcast double* %82 to <2 x double>*
%84 = load <2 x double>, <2 x double>* %83
%85 = getelementptr inbounds double, double* %29, i64 %78
%86 = bitcast double* %85 to <2 x double>*
store <2 x double> %81, <2 x double>* %86
%87 = getelementptr inbounds double, double* %85, i64 2
%88 = bitcast double* %87 to <2 x double>*
store <2 x double> %84, <2 x double>* %88
%89 = add nuw i64 %44, 16
%90 = add nuw i64 %45, 4
%91 = icmp eq i64 %90, %21
br i1 %91, label %92, label %43
92: ; preds = %43, %42
%93 = phi i64 [ 0, %42 ], [ %89, %43 ]
br i1 %22, label %110, label %94
94: ; preds = %92, %94
%95 = phi i64 [ %107, %94 ], [ %93, %92 ]
%96 = phi i64 [ %108, %94 ], [ 0, %92 ]
%97 = getelementptr inbounds double, double* %34, i64 %95
%98 = bitcast double* %97 to <2 x double>*
%99 = load <2 x double>, <2 x double>* %98
%100 = getelementptr inbounds double, double* %97, i64 2
%101 = bitcast double* %100 to <2 x double>*
%102 = load <2 x double>, <2 x double>* %101
%103 = getelementptr inbounds double, double* %29, i64 %95
%104 = bitcast double* %103 to <2 x double>*
store <2 x double> %99, <2 x double>* %104
%105 = getelementptr inbounds double, double* %103, i64 2
%106 = bitcast double* %105 to <2 x double>*
store <2 x double> %102, <2 x double>* %106
%107 = add nuw i64 %95, 4
%108 = add i64 %96, 1
%109 = icmp eq i64 %108, %19
br i1 %109, label %110, label %94
110: ; preds = %94, %92
br i1 %23, label %146, label %111
111: ; preds = %35, %32, %110
%112 = phi i64 [ 0, %35 ], [ 0, %32 ], [ %18, %110 ]
%113 = xor i64 %112, -1
%114 = add nsw i64 %113, %12
br i1 %25, label %124, label %115
115: ; preds = %111, %115
%116 = phi i64 [ %121, %115 ], [ %112, %111 ]
%117 = phi i64 [ %122, %115 ], [ 0, %111 ]
%118 = getelementptr inbounds double, double* %34, i64 %116
%119 = load double, double* %118
%120 = getelementptr inbounds double, double* %29, i64 %116
store double %119, double* %120
%121 = add nuw nsw i64 %116, 1
%122 = add i64 %117, 1
%123 = icmp eq i64 %122, %24
br i1 %123, label %124, label %115
124: ; preds = %115, %111
%125 = phi i64 [ %112, %111 ], [ %121, %115 ]
%126 = icmp ult i64 %114, 3
br i1 %126, label %146, label %127
127: ; preds = %124, %127
%128 = phi i64 [ %144, %127 ], [ %125, %124 ]
%129 = getelementptr inbounds double, double* %34, i64 %128
%130 = load double, double* %129
%131 = getelementptr inbounds double, double* %29, i64 %128
store double %130, double* %131
%132 = add nuw nsw i64 %128, 1
%133 = getelementptr inbounds double, double* %34, i64 %132
%134 = load double, double* %133
%135 = getelementptr inbounds double, double* %29, i64 %132
store double %134, double* %135
%136 = add nuw nsw i64 %128, 2
%137 = getelementptr inbounds double, double* %34, i64 %136
%138 = load double, double* %137
%139 = getelementptr inbounds double, double* %29, i64 %136
store double %138, double* %139
%140 = add nuw nsw i64 %128, 3
%141 = getelementptr inbounds double, double* %34, i64 %140
%142 = load double, double* %141
%143 = getelementptr inbounds double, double* %29, i64 %140
store double %142, double* %143
%144 = add nuw nsw i64 %128, 4
%145 = icmp eq i64 %144, %12
br i1 %145, label %146, label %127
146: ; preds = %124, %127, %110, %26
%147 = add nuw nsw i64 %27, 1
%148 = icmp eq i64 %147, %11
br i1 %148, label %149, label %26
149: ; preds = %146, %3
ret double** %6
}