#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__ fisCreateMatrix(int, int, int);
double **fisCopyMatrix(double **source, int row_n, int col_n) {
  double **target;
  int i, j;
  target = (double **)fisCreateMatrix(row_n, col_n, sizeof(double));
  for (i = 0; i < row_n; i++)
    for (j = 0; j < col_n; j++)
      target[i][j] = source[i][j];
  return (target);
}


x86 assembly (clang, -O0):
<fisCopyMatrix>:
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
mov    $0x8,%edx
call   1030 <fisCreateMatrix@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a7 <fisCopyMatrix+0x97>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1194 <fisCopyMatrix+0x84>
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    1150 <fisCopyMatrix+0x40>
jmp    1199 <fisCopyMatrix+0x89>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <fisCopyMatrix+0x2d>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fisCopyMatrix>:
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
mov    $0x8,%edx
call   1030 <fisCreateMatrix@plt>
test   %ebp,%ebp
jle    12ec <fisCopyMatrix+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 <fisCopyMatrix+0x7d>
xchg   %ax,%ax
add    $0x1,%r8
cmp    %r15,%r8
je     12ec <fisCopyMatrix+0x1dc>
test   %r13d,%r13d
jle    1180 <fisCopyMatrix+0x70>
mov    (%r14,%r8,8),%rcx
mov    (%rax,%r8,8),%rbp
cmp    $0x4,%r13d
jb     11bd <fisCopyMatrix+0xad>
lea    (%rcx,%rdx,8),%rsi
cmp    %rsi,%rbp
jae    122d <fisCopyMatrix+0x11d>
lea    0x0(,%rdx,8),%rsi
add    %rbp,%rsi
cmp    %rsi,%rcx
jae    122d <fisCopyMatrix+0x11d>
xor    %ebx,%ebx
mov    %rbx,%rdi
not    %rdi
add    %rdx,%rdi
test   %r12,%r12
je     11e5 <fisCopyMatrix+0xd5>
mov    %r12,%rsi
movsd  (%rcx,%rbx,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rbx,8)
add    $0x1,%rbx
add    $0xffffffffffffffff,%rsi
jne    11d0 <fisCopyMatrix+0xc0>
cmp    $0x3,%rdi
jb     1180 <fisCopyMatrix+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 <fisCopyMatrix+0xe0>
jmp    1180 <fisCopyMatrix+0x70>
cmpq   $0xc,0x10(%rsp)
jae    1239 <fisCopyMatrix+0x129>
xor    %ebx,%ebx
jmp    1299 <fisCopyMatrix+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 <fisCopyMatrix+0x130>
cmpq   $0x0,0x8(%rsp)
je     12db <fisCopyMatrix+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 <fisCopyMatrix+0x1b0>
mov    %r11,%rbx
cmp    %rdx,%r11
je     1180 <fisCopyMatrix+0x70>
jmp    11bf <fisCopyMatrix+0xaf>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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