#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 */
double **get_double_matrix(int, int);
double **copy_double_matrix(double **a, int m, int n) {
  double **b = get_double_matrix(m, n);
  int i, j;
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      b[i][j] = a[i][j];
  return b;
}


x86 assembly (clang, -O0):
<copy_double_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <get_double_matrix@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a2 <copy_double_matrix+0x92>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    118f <copy_double_matrix+0x7f>
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    114b <copy_double_matrix+0x3b>
jmp    1194 <copy_double_matrix+0x84>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1138 <copy_double_matrix+0x28>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_double_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r13d
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%edi
mov    %edx,%esi
call   1030 <get_double_matrix@plt>
test   %ebp,%ebp
jle    12ec <copy_double_matrix+0x1dc>
mov    %ebp,%r15d
mov    %r13d,%edx
mov    %edx,%r11d
and    $0xfffffffc,%r11d
lea    -0x4(%r11),%rcx
mov    %rcx,0x10(%rsp)
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %ecx,%r9d
and    $0x3,%r9d
and    $0xfffffffffffffffc,%rcx
mov    %rcx,(%rsp)
mov    %edx,%r12d
and    $0x3,%r12d
mov    %r9,0x8(%rsp)
shl    $0x5,%r9
xor    %r8d,%r8d
jmp    118d <copy_double_matrix+0x7d>
nopl   0x0(%rax)
add    $0x1,%r8
cmp    %r15,%r8
je     12ec <copy_double_matrix+0x1dc>
test   %r13d,%r13d
jle    1180 <copy_double_matrix+0x70>
mov    (%r14,%r8,8),%rcx
mov    (%rax,%r8,8),%rbp
cmp    $0x4,%r13d
jb     11bd <copy_double_matrix+0xad>
lea    (%rcx,%rdx,8),%rsi
cmp    %rsi,%rbp
jae    122d <copy_double_matrix+0x11d>
lea    0x0(,%rdx,8),%rsi
add    %rbp,%rsi
cmp    %rsi,%rcx
jae    122d <copy_double_matrix+0x11d>
xor    %ebx,%ebx
mov    %rbx,%rdi
not    %rdi
add    %rdx,%rdi
test   %r12,%r12
je     11e5 <copy_double_matrix+0xd5>
mov    %r12,%rsi
movsd  (%rcx,%rbx,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rbx,8)
add    $0x1,%rbx
add    $0xffffffffffffffff,%rsi
jne    11d0 <copy_double_matrix+0xc0>
cmp    $0x3,%rdi
jb     1180 <copy_double_matrix+0x70>
nopl   0x0(%rax,%rax,1)
movsd  (%rcx,%rbx,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rbx,8)
movsd  0x8(%rcx,%rbx,8),%xmm0
movsd  %xmm0,0x8(%rbp,%rbx,8)
movsd  0x10(%rcx,%rbx,8),%xmm0
movsd  %xmm0,0x10(%rbp,%rbx,8)
movsd  0x18(%rcx,%rbx,8),%xmm0
movsd  %xmm0,0x18(%rbp,%rbx,8)
add    $0x4,%rbx
cmp    %rbx,%rdx
jne    11f0 <copy_double_matrix+0xe0>
jmp    1180 <copy_double_matrix+0x70>
cmpq   $0xc,0x10(%rsp)
jae    1239 <copy_double_matrix+0x129>
xor    %ebx,%ebx
jmp    1299 <copy_double_matrix+0x189>
mov    (%rsp),%r10
xor    %ebx,%ebx
nop
movups (%rcx,%rbx,8),%xmm0
movups 0x10(%rcx,%rbx,8),%xmm1
movups %xmm0,0x0(%rbp,%rbx,8)
movups %xmm1,0x10(%rbp,%rbx,8)
movups 0x20(%rcx,%rbx,8),%xmm0
movups 0x30(%rcx,%rbx,8),%xmm1
movups %xmm0,0x20(%rbp,%rbx,8)
movups %xmm1,0x30(%rbp,%rbx,8)
movups 0x40(%rcx,%rbx,8),%xmm0
movups 0x50(%rcx,%rbx,8),%xmm1
movups %xmm0,0x40(%rbp,%rbx,8)
movups %xmm1,0x50(%rbp,%rbx,8)
movups 0x60(%rcx,%rbx,8),%xmm0
movups 0x70(%rcx,%rbx,8),%xmm1
movups %xmm0,0x60(%rbp,%rbx,8)
movups %xmm1,0x70(%rbp,%rbx,8)
add    $0x10,%rbx
add    $0xfffffffffffffffc,%r10
jne    1240 <copy_double_matrix+0x130>
cmpq   $0x0,0x8(%rsp)
je     12db <copy_double_matrix+0x1cb>
lea    0x10(,%rbx,8),%rdi
add    %rbp,%rdi
lea    (%rcx,%rbx,8),%rsi
add    $0x10,%rsi
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movups -0x10(%rsi,%rbx,1),%xmm0
movups (%rsi,%rbx,1),%xmm1
movups %xmm0,-0x10(%rdi,%rbx,1)
movups %xmm1,(%rdi,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%r9
jne    12c0 <copy_double_matrix+0x1b0>
mov    %r11,%rbx
cmp    %rdx,%r11
je     1180 <copy_double_matrix+0x70>
jmp    11bf <copy_double_matrix+0xaf>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double** @copy_double_matrix(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 = load i32, i32* %6
%12 = call double** @get_double_matrix(i32 %10, i32 %11)
store double** %12, double*** %7
store i32 0, i32* %8
br label %13
13: ; preds = %44, %3
%14 = load i32, i32* %8
%15 = load i32, i32* %5
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %47
17: ; preds = %13
store i32 0, i32* %9
br label %18
18: ; preds = %40, %17
%19 = load i32, i32* %9
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %43
22: ; preds = %18
%23 = load double**, double*** %4
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double*, double** %23, i64 %25
%27 = load double*, double** %26
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = load double**, double*** %7
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double*, double** %32, i64 %34
%36 = load double*, double** %35
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
store double %31, double* %39
br label %40
40: ; preds = %22
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
br label %18
43: ; preds = %18
br label %44
44: ; preds = %43
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %13
47: ; preds = %13
%48 = load double**, double*** %7
ret double** %48
}

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