#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__ calloc(int, int);
double ****Matrix4Double(int M, int N, int P, int Q) {
  double ****out;
  int i, j, k;
  out = (double ****)calloc(M, sizeof(double ***));
  out[0] = (double ***)calloc(M * N, sizeof(double **));
  out[0][0] = (double **)calloc(M * N * P, sizeof(double *));
  out[0][0][0] = (double *)calloc(M * N * P * Q, sizeof(double));
  for (i = 1; i < M; i++) {
    out[i] = out[i - 1] + N;
    out[i][0] = out[i - 1][0] + N * P;
    out[i][0][0] = out[i - 1][0][0] + N * P * Q;
  }
  for (i = 0; i < M; i++)
    for (j = 1; j < N; j++) {
      out[i][j] = out[i][j - 1] + P;
      out[i][j][0] = out[i][j - 1][0] + P * Q;
    }
  for (i = 0; i < M; i++)
    for (j = 0; j < N; j++)
      for (k = 1; k < P; k++)
        out[i][j][k] = out[i][j][k - 1] + Q;
  return out;
}


x86 assembly (clang, -O0):
<Matrix4Double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
imul   -0x8(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x4(%rbp),%edi
imul   -0x8(%rbp),%edi
imul   -0xc(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rcx,(%rax)
mov    -0x4(%rbp),%edi
imul   -0x8(%rbp),%edi
imul   -0xc(%rbp),%edi
imul   -0x10(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1254 <Matrix4Double+0x144>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    (%rax),%rax
mov    %rcx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a2 <Matrix4Double+0x92>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1316 <Matrix4Double+0x206>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1303 <Matrix4Double+0x1f3>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%rcx
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
movslq -0x20(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    126e <Matrix4Double+0x15e>
jmp    1308 <Matrix4Double+0x1f8>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    125b <Matrix4Double+0x14b>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    13cb <Matrix4Double+0x2bb>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13b8 <Matrix4Double+0x2a8>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13a5 <Matrix4Double+0x295>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1343 <Matrix4Double+0x233>
jmp    13aa <Matrix4Double+0x29a>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1330 <Matrix4Double+0x220>
jmp    13bd <Matrix4Double+0x2ad>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    131d <Matrix4Double+0x20d>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Matrix4Double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %esi,%r14d
mov    %edi,%ebp
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%r12
mov    %r14d,%r13d
imul   %ebp,%r13d
mov    %r13d,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,(%r12)
imul   %r15d,%r13d
mov    %r13d,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    (%r12),%rcx
mov    %rax,(%rcx)
mov    %ebx,0x4(%rsp)
imul   %ebx,%r13d
mov    %r13d,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    (%r12),%rcx
mov    (%rcx),%rcx
mov    %rax,(%rcx)
mov    %ebp,%r9d
cmp    $0x2,%ebp
jl     11e8 <Matrix4Double+0xd8>
movslq %r14d,%rax
mov    %r15d,%ecx
imul   %r14d,%ecx
movslq %ecx,%rcx
mov    %ecx,%edx
imul   0x4(%rsp),%edx
movslq %edx,%rdx
mov    $0x1,%esi
shl    $0x3,%rcx
shl    $0x3,%rdx
nopl   (%rax)
mov    -0x8(%r12,%rsi,8),%rdi
lea    (%rdi,%rax,8),%rbx
mov    %rbx,(%r12,%rsi,8)
mov    (%rdi),%rbx
add    %rcx,%rbx
mov    %rbx,(%rdi,%rax,8)
mov    -0x8(%r12,%rsi,8),%rdi
mov    (%r12,%rsi,8),%rbx
mov    (%rdi),%rdi
mov    (%rdi),%rdi
add    %rdx,%rdi
mov    (%rbx),%rbx
mov    %rdi,(%rbx)
add    $0x1,%rsi
cmp    %rsi,%r9
jne    11b0 <Matrix4Double+0xa0>
test   %ebp,%ebp
jle    13a0 <Matrix4Double+0x290>
movslq %r15d,%rdx
mov    0x4(%rsp),%eax
imul   %r15d,%eax
movslq %eax,%r11
mov    %r14d,%r10d
lea    -0x1(%r10),%r8
mov    %r8,%r13
and    $0xfffffffffffffffe,%r13
neg    %r13
xor    %eax,%eax
shl    $0x3,%rdx
jmp    122d <Matrix4Double+0x11d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
cmp    %r9,%rax
je     12dd <Matrix4Double+0x1cd>
cmp    $0x2,%r14d
jl     1220 <Matrix4Double+0x110>
mov    $0x1,%ebx
je     12a3 <Matrix4Double+0x193>
mov    $0x1,%ebx
nop
mov    (%r12,%rax,8),%rcx
mov    -0x8(%rcx,%rbx,8),%rsi
add    %rdx,%rsi
mov    %rsi,(%rcx,%rbx,8)
mov    (%r12,%rax,8),%rcx
lea    0x0(,%r11,8),%rsi
mov    -0x8(%rcx,%rbx,8),%rdi
mov    (%rcx,%rbx,8),%rcx
mov    (%rdi),%rdi
add    %rsi,%rdi
mov    %rdi,(%rcx)
mov    (%r12,%rax,8),%rcx
mov    (%rcx,%rbx,8),%rdi
add    %rdx,%rdi
mov    %rdi,0x8(%rcx,%rbx,8)
mov    (%r12,%rax,8),%rcx
mov    (%rcx,%rbx,8),%rdi
mov    0x8(%rcx,%rbx,8),%rcx
add    (%rdi),%rsi
mov    %rsi,(%rcx)
lea    (%rbx,%r13,1),%rcx
add    $0x2,%rcx
add    $0x2,%rbx
cmp    $0x1,%rcx
jne    1240 <Matrix4Double+0x130>
test   $0x1,%r8b
je     1220 <Matrix4Double+0x110>
mov    (%r12,%rax,8),%rcx
mov    -0x8(%rcx,%rbx,8),%rsi
add    %rdx,%rsi
mov    %rsi,(%rcx,%rbx,8)
mov    (%r12,%rax,8),%rcx
lea    0x0(,%r11,8),%rsi
mov    -0x8(%rcx,%rbx,8),%rdi
mov    (%rcx,%rbx,8),%rcx
add    (%rdi),%rsi
mov    %rsi,(%rcx)
jmp    1220 <Matrix4Double+0x110>
test   %ebp,%ebp
jle    13a0 <Matrix4Double+0x290>
movslq 0x4(%rsp),%r11
mov    %r15d,%r8d
add    $0xffffffffffffffff,%r8
mov    %r8,%rax
and    $0xfffffffffffffffe,%rax
neg    %rax
xor    %edi,%edi
jmp    130d <Matrix4Double+0x1fd>
nop
add    $0x1,%rdi
cmp    %r9,%rdi
je     13a0 <Matrix4Double+0x290>
test   %r14d,%r14d
jle    1300 <Matrix4Double+0x1f0>
xor    %ebx,%ebx
jmp    1329 <Matrix4Double+0x219>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %r10,%rbx
je     1300 <Matrix4Double+0x1f0>
cmp    $0x2,%r15d
jl     1320 <Matrix4Double+0x210>
mov    $0x1,%esi
je     137f <Matrix4Double+0x26f>
mov    $0x1,%esi
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rdi,8),%rcx
mov    (%rcx,%rbx,8),%rcx
lea    0x0(,%r11,8),%rbp
mov    -0x8(%rcx,%rsi,8),%rdx
add    %rbp,%rdx
mov    %rdx,(%rcx,%rsi,8)
mov    (%r12,%rdi,8),%rcx
mov    (%rcx,%rbx,8),%rcx
add    (%rcx,%rsi,8),%rbp
mov    %rbp,0x8(%rcx,%rsi,8)
lea    (%rax,%rsi,1),%rcx
add    $0x2,%rcx
add    $0x2,%rsi
cmp    $0x1,%rcx
jne    1340 <Matrix4Double+0x230>
test   $0x1,%r8b
je     1320 <Matrix4Double+0x210>
mov    (%r12,%rdi,8),%rcx
mov    (%rcx,%rbx,8),%rcx
lea    0x0(,%r11,8),%rdx
add    -0x8(%rcx,%rsi,8),%rdx
mov    %rdx,(%rcx,%rsi,8)
jmp    1320 <Matrix4Double+0x210>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double**** @Matrix4Double(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double****
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%13 = load i32, i32* %5
%14 = call i64 @calloc(i32 %13, i32 8)
%15 = inttoptr i64 %14 to double****
store double**** %15, double***** %9
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = mul nsw i32 %16, %17
%19 = call i64 @calloc(i32 %18, i32 8)
%20 = inttoptr i64 %19 to double***
%21 = load double****, double***** %9
%22 = getelementptr inbounds double***, double**** %21, i64 0
store double*** %20, double**** %22
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = mul nsw i32 %23, %24
%26 = load i32, i32* %7
%27 = mul nsw i32 %25, %26
%28 = call i64 @calloc(i32 %27, i32 8)
%29 = inttoptr i64 %28 to double**
%30 = load double****, double***** %9
%31 = getelementptr inbounds double***, double**** %30, i64 0
%32 = load double***, double**** %31
%33 = getelementptr inbounds double**, double*** %32, i64 0
store double** %29, double*** %33
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = mul nsw i32 %34, %35
%37 = load i32, i32* %7
%38 = mul nsw i32 %36, %37
%39 = load i32, i32* %8
%40 = mul nsw i32 %38, %39
%41 = call i64 @calloc(i32 %40, i32 8)
%42 = inttoptr i64 %41 to double*
%43 = load double****, double***** %9
%44 = getelementptr inbounds double***, double**** %43, i64 0
%45 = load double***, double**** %44
%46 = getelementptr inbounds double**, double*** %45, i64 0
%47 = load double**, double*** %46
%48 = getelementptr inbounds double*, double** %47, i64 0
store double* %42, double** %48
store i32 1, i32* %10
br label %49
49: ; preds = %111, %4
%50 = load i32, i32* %10
%51 = load i32, i32* %5
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %114
53: ; preds = %49
%54 = load double****, double***** %9
%55 = load i32, i32* %10
%56 = sub nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double***, double**** %54, i64 %57
%59 = load double***, double**** %58
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double**, double*** %59, i64 %61
%63 = load double****, double***** %9
%64 = load i32, i32* %10
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double***, double**** %63, i64 %65
store double*** %62, double**** %66
%67 = load double****, double***** %9
%68 = load i32, i32* %10
%69 = sub nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double***, double**** %67, i64 %70
%72 = load double***, double**** %71
%73 = getelementptr inbounds double**, double*** %72, i64 0
%74 = load double**, double*** %73
%75 = load i32, i32* %6
%76 = load i32, i32* %7
%77 = mul nsw i32 %75, %76
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double*, double** %74, i64 %78
%80 = load double****, double***** %9
%81 = load i32, i32* %10
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double***, double**** %80, i64 %82
%84 = load double***, double**** %83
%85 = getelementptr inbounds double**, double*** %84, i64 0
store double** %79, double*** %85
%86 = load double****, double***** %9
%87 = load i32, i32* %10
%88 = sub nsw i32 %87, 1
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double***, double**** %86, i64 %89
%91 = load double***, double**** %90
%92 = getelementptr inbounds double**, double*** %91, i64 0
%93 = load double**, double*** %92
%94 = getelementptr inbounds double*, double** %93, i64 0
%95 = load double*, double** %94
%96 = load i32, i32* %6
%97 = load i32, i32* %7
%98 = mul nsw i32 %96, %97
%99 = load i32, i32* %8
%100 = mul nsw i32 %98, %99
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %95, i64 %101
%103 = load double****, double***** %9
%104 = load i32, i32* %10
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double***, double**** %103, i64 %105
%107 = load double***, double**** %106
%108 = getelementptr inbounds double**, double*** %107, i64 0
%109 = load double**, double*** %108
%110 = getelementptr inbounds double*, double** %109, i64 0
store double* %102, double** %110
br label %111
111: ; preds = %53
%112 = load i32, i32* %10
%113 = add nsw i32 %112, 1
store i32 %113, i32* %10
br label %49
114: ; preds = %49
store i32 0, i32* %10
br label %115
115: ; preds = %177, %114
%116 = load i32, i32* %10
%117 = load i32, i32* %5
%118 = icmp slt i32 %116, %117
br i1 %118, label %119, label %180
119: ; preds = %115
store i32 1, i32* %11
br label %120
120: ; preds = %173, %119
%121 = load i32, i32* %11
%122 = load i32, i32* %6
%123 = icmp slt i32 %121, %122
br i1 %123, label %124, label %176
124: ; preds = %120
%125 = load double****, double***** %9
%126 = load i32, i32* %10
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds double***, double**** %125, i64 %127
%129 = load double***, double**** %128
%130 = load i32, i32* %11
%131 = sub nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds double**, double*** %129, i64 %132
%134 = load double**, double*** %133
%135 = load i32, i32* %7
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double*, double** %134, i64 %136
%138 = load double****, double***** %9
%139 = load i32, i32* %10
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double***, double**** %138, i64 %140
%142 = load double***, double**** %141
%143 = load i32, i32* %11
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds double**, double*** %142, i64 %144
store double** %137, double*** %145
%146 = load double****, double***** %9
%147 = load i32, i32* %10
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double***, double**** %146, i64 %148
%150 = load double***, double**** %149
%151 = load i32, i32* %11
%152 = sub nsw i32 %151, 1
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds double**, double*** %150, i64 %153
%155 = load double**, double*** %154
%156 = getelementptr inbounds double*, double** %155, i64 0
%157 = load double*, double** %156
%158 = load i32, i32* %7
%159 = load i32, i32* %8
%160 = mul nsw i32 %158, %159
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds double, double* %157, i64 %161
%163 = load double****, double***** %9
%164 = load i32, i32* %10
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds double***, double**** %163, i64 %165
%167 = load double***, double**** %166
%168 = load i32, i32* %11
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double**, double*** %167, i64 %169
%171 = load double**, double*** %170
%172 = getelementptr inbounds double*, double** %171, i64 0
store double* %162, double** %172
br label %173
173: ; preds = %124
%174 = load i32, i32* %11
%175 = add nsw i32 %174, 1
store i32 %175, i32* %11
br label %120
176: ; preds = %120
br label %177
177: ; preds = %176
%178 = load i32, i32* %10
%179 = add nsw i32 %178, 1
store i32 %179, i32* %10
br label %115
180: ; preds = %115
store i32 0, i32* %10
br label %181
181: ; preds = %233, %180
%182 = load i32, i32* %10
%183 = load i32, i32* %5
%184 = icmp slt i32 %182, %183
br i1 %184, label %185, label %236
185: ; preds = %181
store i32 0, i32* %11
br label %186
186: ; preds = %229, %185
%187 = load i32, i32* %11
%188 = load i32, i32* %6
%189 = icmp slt i32 %187, %188
br i1 %189, label %190, label %232
190: ; preds = %186
store i32 1, i32* %12
br label %191
191: ; preds = %225, %190
%192 = load i32, i32* %12
%193 = load i32, i32* %7
%194 = icmp slt i32 %192, %193
br i1 %194, label %195, label %228
195: ; preds = %191
%196 = load double****, double***** %9
%197 = load i32, i32* %10
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds double***, double**** %196, i64 %198
%200 = load double***, double**** %199
%201 = load i32, i32* %11
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double**, double*** %200, i64 %202
%204 = load double**, double*** %203
%205 = load i32, i32* %12
%206 = sub nsw i32 %205, 1
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds double*, double** %204, i64 %207
%209 = load double*, double** %208
%210 = load i32, i32* %8
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds double, double* %209, i64 %211
%213 = load double****, double***** %9
%214 = load i32, i32* %10
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds double***, double**** %213, i64 %215
%217 = load double***, double**** %216
%218 = load i32, i32* %11
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds double**, double*** %217, i64 %219
%221 = load double**, double*** %220
%222 = load i32, i32* %12
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds double*, double** %221, i64 %223
store double* %212, double** %224
br label %225
225: ; preds = %195
%226 = load i32, i32* %12
%227 = add nsw i32 %226, 1
store i32 %227, i32* %12
br label %191
228: ; preds = %191
br label %229
229: ; preds = %228
%230 = load i32, i32* %11
%231 = add nsw i32 %230, 1
store i32 %231, i32* %11
br label %186
232: ; preds = %186
br label %233
233: ; preds = %232
%234 = load i32, i32* %10
%235 = add nsw i32 %234, 1
store i32 %235, i32* %10
br label %181
236: ; preds = %181
%237 = load double****, double***** %9
ret double**** %237
}

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