#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(size_t);
int /*<<< orphan*/ nrerror(char *);
double ***d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh) {
  long i, j, nrow = nrh - nrl + 1, ncol = nch - ncl + 1, ndep = ndh - ndl + 1;
  double ***t;
  t = (double ***)malloc((size_t)((nrow + 1) * sizeof(double **)));
  if (!t)
    nrerror("allocation failure 1 in d3tensor()");
  t += 1;
  t -= nrl;
  t[nrl] = (double **)malloc((size_t)((nrow * ncol + 1) * sizeof(double *)));
  if (!t[nrl])
    nrerror("allocation failure 2 in d3tensor()");
  t[nrl] += 1;
  t[nrl] -= ncl;
  t[nrl][ncl] =
      (double *)malloc((size_t)((nrow * ncol * ndep + 1) * sizeof(double)));
  if (!t[nrl][ncl])
    nrerror("allocation failure 3 in d3tensor()");
  t[nrl][ncl] += 1;
  t[nrl][ncl] -= ndl;
  for (j = ncl + 1; j <= nch; j++)
    t[nrl][j] = t[nrl][j - 1] + ndep;
  for (i = nrl + 1; i <= nrh; i++) {
    t[i] = t[i - 1] + ncol;
    t[i][ncl] = t[i - 1][ncl] + ncol * ndep;
    for (j = ncl + 1; j <= nch; j++)
      t[i][j] = t[i][j - 1] + ndep;
  }
  return t;
}


x86 assembly (clang, -O0):
<d3tensor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rax
sub    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x48(%rbp),%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    119c <d3tensor+0x7c>
lea    0xe69(%rip),%rdi
call   1030 <nrerror@plt>
mov    -0x60(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x60(%rbp),%rax
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x48(%rbp),%rdi
imul   -0x50(%rbp),%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1204 <d3tensor+0xe4>
lea    0xe24(%rip),%rdi
call   1030 <nrerror@plt>
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
add    $0x8,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rdi
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
xor    %esi,%esi
sub    %rdi,%rsi
shl    $0x3,%rsi
add    %rsi,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x48(%rbp),%rdi
imul   -0x50(%rbp),%rdi
imul   -0x58(%rbp),%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1291 <d3tensor+0x171>
lea    0xdba(%rip),%rdi
call   1030 <nrerror@plt>
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
add    $0x8,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%rdi
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
xor    %esi,%esi
sub    %rdi,%rsi
shl    $0x3,%rsi
add    %rsi,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
jg     1337 <d3tensor+0x217>
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x58(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x40(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    12e1 <d3tensor+0x1c1>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     142c <d3tensor+0x30c>
mov    -0x60(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x50(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x60(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x60(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x50(%rbp),%rax
imul   -0x58(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x60(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
jg     1416 <d3tensor+0x2f6>
mov    -0x60(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x58(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x60(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x40(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    13c0 <d3tensor+0x2a0>
jmp    141b <d3tensor+0x2fb>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1343 <d3tensor+0x223>
mov    -0x60(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d3tensor>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%r13
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mov    %rsi,0x10(%rsp)
sub    %rdi,%r12
mov    %rcx,(%rsp)
sub    %rdx,%r14
add    $0x1,%r14
mov    %r8,0x20(%rsp)
sub    %r8,%r13
lea    0x10(,%r12,8),%rdi
add    $0x1,%r12
call   1040 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    117d <d3tensor+0x5d>
lea    0xe88(%rip),%rdi
call   1030 <nrerror@plt>
add    $0x1,%r13
lea    0x0(,%rbx,8),%rax
sub    %rax,%rbp
mov    %rbp,0x18(%rsp)
add    $0x8,%rbp
mov    %r14,0x8(%rsp)
imul   %r14,%r12
lea    0x8(,%r12,8),%rdi
shl    $0x3,%r12
call   1040 <malloc@plt>
mov    0x18(%rsp),%rcx
mov    %rax,0x8(%rcx,%rbx,8)
test   %rax,%rax
jne    11cf <d3tensor+0xaf>
lea    0xe5e(%rip),%rdi
call   1030 <nrerror@plt>
mov    0x0(%rbp,%rbx,8),%rax
lea    0x0(,%r15,8),%rcx
sub    %rcx,%rax
add    $0x8,%rax
mov    %rax,0x0(%rbp,%rbx,8)
imul   %r13,%r12
add    $0x8,%r12
mov    %r12,%rdi
call   1040 <malloc@plt>
mov    0x0(%rbp,%rbx,8),%rcx
mov    %rax,(%rcx,%r15,8)
mov    0x0(%rbp,%rbx,8),%rax
mov    (%rax,%r15,8),%rcx
test   %rcx,%rcx
jne    121f <d3tensor+0xff>
lea    0xe35(%rip),%rdi
call   1030 <nrerror@plt>
mov    0x0(%rbp,%rbx,8),%rax
mov    (%rax,%r15,8),%rcx
add    $0x8,%rcx
mov    %rcx,(%rax,%r15,8)
mov    0x0(%rbp,%rbx,8),%rax
mov    0x20(%rsp),%rcx
shl    $0x3,%rcx
sub    %rcx,(%rax,%r15,8)
lea    0x1(%r15),%r10
mov    %r15,%r9
not    %r9
cmp    %r15,(%rsp)
jle    130b <d3tensor+0x1eb>
mov    (%rsp),%rcx
mov    %ecx,%eax
sub    %r15d,%eax
lea    (%r9,%rcx,1),%r8
mov    %r10,%rdx
and    $0x3,%rax
je     128b <d3tensor+0x16b>
lea    0x0(,%r13,8),%rsi
mov    %r10,%rdx
xchg   %ax,%ax
mov    0x0(%rbp,%rbx,8),%rdi
mov    -0x8(%rdi,%rdx,8),%rcx
add    %rsi,%rcx
mov    %rcx,(%rdi,%rdx,8)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rax
jne    1270 <d3tensor+0x150>
cmp    $0x3,%r8
jb     130b <d3tensor+0x1eb>
mov    (%rsp),%r8
sub    %rdx,%r8
add    $0x1,%r8
shl    $0x3,%rdx
xor    %ecx,%ecx
lea    0x0(,%r13,8),%rsi
nopw   0x0(%rax,%rax,1)
mov    0x0(%rbp,%rbx,8),%rdi
add    %rdx,%rdi
mov    -0x8(%rdi,%rcx,8),%rax
add    %rsi,%rax
mov    %rax,(%rdi,%rcx,8)
mov    0x0(%rbp,%rbx,8),%rax
add    %rdx,%rax
mov    (%rax,%rcx,8),%rdi
add    %rsi,%rdi
mov    %rdi,0x8(%rax,%rcx,8)
mov    0x0(%rbp,%rbx,8),%rax
add    %rdx,%rax
mov    0x8(%rax,%rcx,8),%rdi
add    %rsi,%rdi
mov    %rdi,0x10(%rax,%rcx,8)
mov    0x0(%rbp,%rbx,8),%rax
add    %rdx,%rax
mov    0x10(%rax,%rcx,8),%rdi
add    %rsi,%rdi
mov    %rdi,0x18(%rax,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%r8
jne    12b0 <d3tensor+0x190>
cmp    %rbx,0x10(%rsp)
mov    0x8(%rsp),%rcx
jle    1435 <d3tensor+0x315>
mov    %r13,%r14
imul   %rcx,%r14
mov    (%rsp),%rax
mov    %eax,%r11d
sub    %r15d,%r11d
add    %rax,%r9
and    $0x3,%r11d
lea    0x1(%rax),%r8
shl    $0x3,%r14
jmp    1350 <d3tensor+0x230>
nopl   (%rax)
cmp    0x10(%rsp),%rbx
mov    0x8(%rsp),%rcx
je     1435 <d3tensor+0x315>
mov    0x0(%rbp,%rbx,8),%rax
lea    (%rax,%rcx,8),%rcx
mov    %rcx,0x8(%rbp,%rbx,8)
add    $0x1,%rbx
mov    (%rax,%r15,8),%rax
add    %r14,%rax
mov    %rax,(%rcx,%r15,8)
cmp    %r15,(%rsp)
jle    1340 <d3tensor+0x220>
mov    %r10,%rax
test   %r11,%r11
je     13b0 <d3tensor+0x290>
mov    %r11,%rcx
mov    %r10,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%rbx,8),%rdi
lea    0x0(,%r13,8),%rsi
add    -0x8(%rdi,%rax,8),%rsi
mov    %rsi,(%rdi,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rcx
jne    1390 <d3tensor+0x270>
cmp    $0x3,%r9
jb     1340 <d3tensor+0x220>
mov    %r8,%r12
sub    %rax,%r12
shl    $0x3,%rax
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%rbp,%rbx,8),%rsi
add    %rax,%rsi
lea    0x0(,%r13,8),%rdx
mov    -0x8(%rsi,%rdi,8),%rcx
add    %rdx,%rcx
mov    %rcx,(%rsi,%rdi,8)
mov    0x0(%rbp,%rbx,8),%rcx
add    %rax,%rcx
mov    (%rcx,%rdi,8),%rsi
add    %rdx,%rsi
mov    %rsi,0x8(%rcx,%rdi,8)
mov    0x0(%rbp,%rbx,8),%rcx
add    %rax,%rcx
mov    0x8(%rcx,%rdi,8),%rsi
add    %rdx,%rsi
mov    %rsi,0x10(%rcx,%rdi,8)
mov    0x0(%rbp,%rbx,8),%rcx
add    %rax,%rcx
add    0x10(%rcx,%rdi,8),%rdx
mov    %rdx,0x18(%rcx,%rdi,8)
add    $0x4,%rdi
cmp    %rdi,%r12
jne    13d0 <d3tensor+0x2b0>
jmp    1340 <d3tensor+0x220>
mov    %rbp,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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