#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*/ assert(double **);
void _PSICopyMatrix_double(double **dest, double **src, unsigned int ncols,
                           unsigned int nrows) {
  unsigned int i = 0;
  unsigned int j = 0;
  assert(dest);
  assert(src);
  for (i = 0; i < ncols; i++) {
    for (j = 0; j < nrows; j++) {
      dest[i][j] = src[i][j];
    }
  }
}


x86 assembly (clang, -O0):
<_PSICopyMatrix_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    11b3 <_PSICopyMatrix_double+0xa3>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    11a0 <_PSICopyMatrix_double+0x90>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1160 <_PSICopyMatrix_double+0x50>
jmp    11a5 <_PSICopyMatrix_double+0x95>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114d <_PSICopyMatrix_double+0x3d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_PSICopyMatrix_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r15
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1030 <assert@plt>
test   %ebp,%ebp
je     12fc <_PSICopyMatrix_double+0x1ec>
mov    %rbx,%r8
mov    %ebp,%r12d
mov    %r14d,%ecx
mov    %ecx,%r11d
and    $0xfffffffc,%r11d
lea    -0x4(%r11),%rax
mov    %rax,0x10(%rsp)
shr    $0x2,%rax
add    $0x1,%rax
mov    %eax,%r9d
and    $0x3,%r9d
and    $0xfffffffffffffffc,%rax
mov    %rax,(%rsp)
mov    %ecx,%r13d
and    $0x3,%r13d
mov    %r9,0x8(%rsp)
shl    $0x5,%r9
xor    %edi,%edi
jmp    119d <_PSICopyMatrix_double+0x8d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rdi
cmp    %r12,%rdi
je     12fc <_PSICopyMatrix_double+0x1ec>
test   %r14d,%r14d
je     1190 <_PSICopyMatrix_double+0x80>
mov    (%r8,%rdi,8),%rdx
mov    (%r15,%rdi,8),%rax
cmp    $0x4,%r14d
jb     11c6 <_PSICopyMatrix_double+0xb6>
lea    (%rdx,%rcx,8),%rsi
cmp    %rsi,%rax
jae    123c <_PSICopyMatrix_double+0x12c>
lea    (%rax,%rcx,8),%rsi
cmp    %rsi,%rdx
jae    123c <_PSICopyMatrix_double+0x12c>
xor    %esi,%esi
mov    %rsi,%rbx
not    %rbx
add    %rcx,%rbx
test   %r13,%r13
je     11f4 <_PSICopyMatrix_double+0xe4>
mov    %r13,%rbp
nopl   0x0(%rax)
movsd  (%rdx,%rsi,8),%xmm0
movsd  %xmm0,(%rax,%rsi,8)
add    $0x1,%rsi
add    $0xffffffffffffffff,%rbp
jne    11e0 <_PSICopyMatrix_double+0xd0>
cmp    $0x3,%rbx
jb     1190 <_PSICopyMatrix_double+0x80>
nopw   0x0(%rax,%rax,1)
movsd  (%rdx,%rsi,8),%xmm0
movsd  %xmm0,(%rax,%rsi,8)
movsd  0x8(%rdx,%rsi,8),%xmm0
movsd  %xmm0,0x8(%rax,%rsi,8)
movsd  0x10(%rdx,%rsi,8),%xmm0
movsd  %xmm0,0x10(%rax,%rsi,8)
movsd  0x18(%rdx,%rsi,8),%xmm0
movsd  %xmm0,0x18(%rax,%rsi,8)
add    $0x4,%rsi
cmp    %rsi,%rcx
jne    1200 <_PSICopyMatrix_double+0xf0>
jmp    1190 <_PSICopyMatrix_double+0x80>
cmpq   $0xc,0x10(%rsp)
jae    1248 <_PSICopyMatrix_double+0x138>
xor    %esi,%esi
jmp    12a8 <_PSICopyMatrix_double+0x198>
mov    (%rsp),%r10
xor    %esi,%esi
xchg   %ax,%ax
movups (%rdx,%rsi,8),%xmm0
movups 0x10(%rdx,%rsi,8),%xmm1
movups %xmm0,(%rax,%rsi,8)
movups %xmm1,0x10(%rax,%rsi,8)
movups 0x20(%rdx,%rsi,8),%xmm0
movups 0x30(%rdx,%rsi,8),%xmm1
movups %xmm0,0x20(%rax,%rsi,8)
movups %xmm1,0x30(%rax,%rsi,8)
movups 0x40(%rdx,%rsi,8),%xmm0
movups 0x50(%rdx,%rsi,8),%xmm1
movups %xmm0,0x40(%rax,%rsi,8)
movups %xmm1,0x50(%rax,%rsi,8)
movups 0x60(%rdx,%rsi,8),%xmm0
movups 0x70(%rdx,%rsi,8),%xmm1
movups %xmm0,0x60(%rax,%rsi,8)
movups %xmm1,0x70(%rax,%rsi,8)
add    $0x10,%rsi
add    $0xfffffffffffffffc,%r10
jne    1250 <_PSICopyMatrix_double+0x140>
cmpq   $0x0,0x8(%rsp)
je     12eb <_PSICopyMatrix_double+0x1db>
lea    (%rax,%rsi,8),%rbx
add    $0x10,%rbx
lea    (%rdx,%rsi,8),%rsi
add    $0x10,%rsi
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups -0x10(%rsi,%rbp,1),%xmm0
movups (%rsi,%rbp,1),%xmm1
movups %xmm0,-0x10(%rbx,%rbp,1)
movups %xmm1,(%rbx,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%r9
jne    12d0 <_PSICopyMatrix_double+0x1c0>
mov    %r11,%rsi
cmp    %rcx,%r11
je     1190 <_PSICopyMatrix_double+0x80>
jmp    11c8 <_PSICopyMatrix_double+0xb8>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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