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


x86 assembly (clang, -O0):
<d3tensor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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,-0x50(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%rax
sub    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    119c <d3tensor+0x7c>
lea    0xe69(%rip),%rdi
call   1030 <nrerror@plt>
mov    -0x68(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x68(%rbp),%rax
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x50(%rbp),%rdi
imul   -0x58(%rbp),%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x68(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x68(%rbp),%rax
mov    -0x8(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1204 <d3tensor+0xe4>
lea    0xe24(%rip),%rdi
call   1030 <nrerror@plt>
mov    -0x68(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
add    $0x8,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rdi
mov    -0x68(%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    -0x50(%rbp),%rdi
imul   -0x58(%rbp),%rdi
imul   -0x60(%rbp),%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x68(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x68(%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    -0x68(%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    -0x68(%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    -0x68(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x60(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x68(%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    -0x68(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x58(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x68(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x68(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x58(%rbp),%rax
imul   -0x60(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x68(%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    -0x68(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x60(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x68(%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    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     14cb <d3tensor+0x3ab>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
jg     14b5 <d3tensor+0x395>
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x30(%rbp),%rax
jg     149f <d3tensor+0x37f>
mov    -0x68(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1460 <d3tensor+0x340>
jmp    14a4 <d3tensor+0x384>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    144a <d3tensor+0x32a>
jmp    14ba <d3tensor+0x39a>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1434 <d3tensor+0x314>
mov    -0x68(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d3tensor>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r12
mov    %rdi,%r14
mov    %rsi,0x28(%rsp)
sub    %rdi,%r12
mov    %rcx,(%rsp)
mov    %rcx,%rbp
mov    %rdx,0x18(%rsp)
sub    %rdx,%rbp
add    $0x1,%rbp
mov    %r9,0x40(%rsp)
mov    %r9,%rbx
mov    %r8,0x20(%rsp)
sub    %r8,%rbx
lea    0x10(,%r12,8),%rdi
add    $0x1,%r12
call   1050 <malloc@plt>
mov    %rax,%r13
test   %rax,%rax
jne    1194 <d3tensor+0x64>
lea    0xe71(%rip),%rdi
call   1030 <nrerror@plt>
mov    %rbx,0x30(%rsp)
lea    0x1(%rbx),%r15
lea    0x0(,%r14,8),%rax
sub    %rax,%r13
mov    %r13,%rbx
add    $0x8,%r13
mov    %rbp,0x10(%rsp)
imul   %rbp,%r12
lea    0x8(,%r12,8),%rdi
shl    $0x3,%r12
call   1050 <malloc@plt>
mov    %rax,0x8(%rbx,%r14,8)
test   %rax,%rax
jne    11e4 <d3tensor+0xb4>
lea    0xe49(%rip),%rdi
call   1030 <nrerror@plt>
mov    0x0(%r13,%r14,8),%rax
mov    0x18(%rsp),%rbp
lea    0x0(,%rbp,8),%rcx
sub    %rcx,%rax
add    $0x8,%rax
mov    %rax,0x0(%r13,%r14,8)
imul   %r15,%r12
add    $0x8,%r12
mov    %r12,%rdi
call   1050 <malloc@plt>
mov    0x0(%r13,%r14,8),%rcx
mov    %rax,(%rcx,%rbp,8)
mov    0x0(%r13,%r14,8),%rax
mov    (%rax,%rbp,8),%rcx
test   %rcx,%rcx
jne    1239 <d3tensor+0x109>
lea    0xe1b(%rip),%rdi
call   1030 <nrerror@plt>
mov    0x0(%r13,%r14,8),%rax
mov    (%rax,%rbp,8),%rcx
add    $0x8,%rcx
mov    %rcx,(%rax,%rbp,8)
mov    0x0(%r13,%r14,8),%rax
mov    0x20(%rsp),%rcx
lea    0x0(,%rcx,8),%rcx
mov    %rcx,0x38(%rsp)
sub    %rcx,(%rax,%rbp,8)
lea    0x1(%rbp),%r10
mov    (%rsp),%rax
mov    %rbp,%r9
not    %r9
sub    %rbp,%rax
mov    %rax,0x50(%rsp)
jle    133b <d3tensor+0x20b>
mov    (%rsp),%rcx
mov    %ecx,%eax
sub    %ebp,%eax
add    %r9,%rcx
mov    %r10,%rdx
and    $0x3,%rax
je     12bb <d3tensor+0x18b>
lea    0x0(,%r15,8),%rsi
mov    %r10,%rdx
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13,%r14,8),%rdi
mov    -0x8(%rdi,%rdx,8),%rbp
add    %rsi,%rbp
mov    %rbp,(%rdi,%rdx,8)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rax
jne    12a0 <d3tensor+0x170>
cmp    $0x3,%rcx
jb     133b <d3tensor+0x20b>
mov    (%rsp),%rax
sub    %rdx,%rax
add    $0x1,%rax
shl    $0x3,%rdx
xor    %ecx,%ecx
lea    0x0(,%r15,8),%rsi
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13,%r14,8),%rdi
add    %rdx,%rdi
mov    -0x8(%rdi,%rcx,8),%rbp
add    %rsi,%rbp
mov    %rbp,(%rdi,%rcx,8)
mov    0x0(%r13,%r14,8),%rdi
add    %rdx,%rdi
mov    (%rdi,%rcx,8),%rbp
add    %rsi,%rbp
mov    %rbp,0x8(%rdi,%rcx,8)
mov    0x0(%r13,%r14,8),%rdi
add    %rdx,%rdi
mov    0x8(%rdi,%rcx,8),%rbp
add    %rsi,%rbp
mov    %rbp,0x10(%rdi,%rcx,8)
mov    0x0(%r13,%r14,8),%rdi
add    %rdx,%rdi
mov    0x10(%rdi,%rcx,8),%rbp
add    %rsi,%rbp
mov    %rbp,0x18(%rdi,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%rax
jne    12e0 <d3tensor+0x1b0>
mov    0x40(%rsp),%r12
mov    %r14,%rax
mov    %r14,0x8(%rsp)
cmp    %r14,0x28(%rsp)
mov    0x10(%rsp),%rcx
jle    1485 <d3tensor+0x355>
mov    %r15,%r14
imul   %rcx,%r14
mov    (%rsp),%rax
mov    %eax,%r11d
sub    0x18(%rsp),%r11d
add    %rax,%r9
and    $0x3,%r11d
lea    0x1(%rax),%r8
shl    $0x3,%r14
mov    0x8(%rsp),%rbp
jmp    13a0 <d3tensor+0x270>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    0x28(%rsp),%rbp
mov    0x10(%rsp),%rcx
je     1485 <d3tensor+0x355>
mov    0x0(%r13,%rbp,8),%rax
lea    (%rax,%rcx,8),%rcx
mov    %rcx,0x8(%r13,%rbp,8)
add    $0x1,%rbp
mov    0x18(%rsp),%rdx
mov    (%rax,%rdx,8),%rax
add    %r14,%rax
mov    %rax,(%rcx,%rdx,8)
cmp    %rdx,(%rsp)
jle    1390 <d3tensor+0x260>
mov    %r10,%rax
test   %r11,%r11
je     1400 <d3tensor+0x2d0>
mov    %r11,%rcx
mov    %r10,%rax
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%r13,%rbp,8),%rdi
lea    0x0(,%r15,8),%rsi
add    -0x8(%rdi,%rax,8),%rsi
mov    %rsi,(%rdi,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rcx
jne    13e0 <d3tensor+0x2b0>
cmp    $0x3,%r9
jb     1390 <d3tensor+0x260>
mov    %r8,%rcx
sub    %rax,%rcx
shl    $0x3,%rax
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%rbp,8),%rsi
add    %rax,%rsi
lea    0x0(,%r15,8),%rdx
mov    -0x8(%rsi,%rdi,8),%rbx
add    %rdx,%rbx
mov    %rbx,(%rsi,%rdi,8)
mov    0x0(%r13,%rbp,8),%rsi
add    %rax,%rsi
mov    (%rsi,%rdi,8),%rbx
add    %rdx,%rbx
mov    %rbx,0x8(%rsi,%rdi,8)
mov    0x0(%r13,%rbp,8),%rsi
add    %rax,%rsi
mov    0x8(%rsi,%rdi,8),%rbx
add    %rdx,%rbx
mov    %rbx,0x10(%rsi,%rdi,8)
mov    0x0(%r13,%rbp,8),%rsi
add    %rax,%rsi
add    0x10(%rsi,%rdi,8),%rdx
mov    %rdx,0x18(%rsi,%rdi,8)
add    $0x4,%rdi
cmp    %rdi,%rcx
jne    1420 <d3tensor+0x2f0>
jmp    1390 <d3tensor+0x260>
mov    0x8(%rsp),%rax
cmp    %rax,0x28(%rsp)
mov    0x20(%rsp),%rcx
jge    14a8 <d3tensor+0x378>
mov    %r13,%rax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rbx
mov    0x30(%rsp),%rax
lea    0x8(,%rax,8),%r15
mov    0x10(%rsp),%rax
and    $0x3,%eax
mov    %rax,0x10(%rsp)
mov    (%rsp),%rax
add    $0x1,%rax
mov    %rax,0x48(%rsp)
jmp    14f5 <d3tensor+0x3c5>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x8(%rsp),%rdx
lea    0x1(%rdx),%rax
cmp    0x28(%rsp),%rdx
mov    %rax,0x8(%rsp)
je     1496 <d3tensor+0x366>
mov    0x18(%rsp),%rax
cmp    %rax,(%rsp)
jl     14e0 <d3tensor+0x3b0>
mov    0x18(%rsp),%rax
mov    %rax,%r14
cmpq   $0x0,0x10(%rsp)
mov    0x8(%rsp),%r12
je     1550 <d3tensor+0x420>
mov    0x10(%rsp),%rbp
mov    %rax,%r14
jmp    152a <d3tensor+0x3fa>
nop
add    $0x1,%r14
add    $0xffffffffffffffff,%rbp
je     1550 <d3tensor+0x420>
cmp    %rcx,%rbx
jl     1520 <d3tensor+0x3f0>
mov    0x0(%r13,%r12,8),%rax
mov    (%rax,%r14,8),%rdi
add    0x38(%rsp),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1040 <memset@plt>
mov    0x20(%rsp),%rcx
jmp    1520 <d3tensor+0x3f0>
xchg   %ax,%ax
cmpq   $0x3,0x50(%rsp)
jb     14e0 <d3tensor+0x3b0>
mov    0x48(%rsp),%rbp
sub    %r14,%rbp
shl    $0x3,%r14
xor    %r12d,%r12d
mov    %rbp,0x30(%rsp)
jmp    157d <d3tensor+0x44d>
xchg   %ax,%ax
add    $0x4,%r12
cmp    %r12,%rbp
je     14e0 <d3tensor+0x3b0>
cmp    %rcx,%rbx
jl     15f2 <d3tensor+0x4c2>
mov    0x8(%rsp),%rbp
mov    0x0(%r13,%rbp,8),%rax
add    %r14,%rax
mov    (%rax,%r12,8),%rdi
mov    %r13,%rbx
mov    %r15,%r13
mov    0x38(%rsp),%r15
add    %r15,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1040 <memset@plt>
mov    (%rbx,%rbp,8),%rax
add    %r14,%rax
mov    0x8(%rax,%r12,8),%rdi
add    %r15,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1040 <memset@plt>
mov    (%rbx,%rbp,8),%rax
mov    0x30(%rsp),%rbp
add    %r14,%rax
mov    0x10(%rax,%r12,8),%rdi
add    %r15,%rdi
mov    %r13,%r15
mov    %rbx,%r13
mov    0x40(%rsp),%rbx
xor    %esi,%esi
mov    %r15,%rdx
call   1040 <memset@plt>
mov    0x20(%rsp),%rcx
cmp    %rcx,%rbx
jl     1570 <d3tensor+0x440>
mov    0x8(%rsp),%rax
mov    0x0(%r13,%rax,8),%rax
add    %r14,%rax
mov    0x18(%rax,%r12,8),%rdi
add    0x38(%rsp),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1040 <memset@plt>
mov    0x20(%rsp),%rcx
jmp    1570 <d3tensor+0x440>

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

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 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 %127
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 %139
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 = %163, %165, %139
%126 = icmp eq i64 %141, %1
br i1 %126, label %127, label %139
127: ; preds = %125, %87
%128 = icmp slt i64 %1, %0
br i1 %128, label %246, label %129
129: ; preds = %127
%130 = icmp slt i64 %3, %2
%131 = icmp slt i64 %5, %4
%132 = add i64 %5, 1
%133 = sub i64 %132, %4
%134 = shl nuw i64 %133, 3
%135 = sub i64 %3, %2
%136 = and i64 %10, 3
%137 = icmp eq i64 %136, 0
%138 = icmp ult i64 %135, 3
br label %193
139: ; preds = %89, %125
%140 = phi i64 [ %0, %89 ], [ %141, %125 ]
%141 = add nsw i64 %140, 1
%142 = getelementptr inbounds double**, double*** %23, i64 %140
%143 = load double**, double*** %142
%144 = getelementptr inbounds double*, double** %143, i64 %10
%145 = getelementptr inbounds double**, double*** %23, i64 %141
store double** %144, double*** %145
%146 = getelementptr inbounds double*, double** %143, i64 %2
%147 = load double*, double** %146
%148 = getelementptr inbounds double, double* %147, i64 %90
%149 = getelementptr inbounds double*, double** %144, i64 %2
store double* %148, double** %149
br i1 %65, label %150, label %125
150: ; preds = %139
br i1 %95, label %163, label %151
151: ; preds = %150, %151
%152 = phi i64 [ %160, %151 ], [ %64, %150 ]
%153 = phi i64 [ %161, %151 ], [ 0, %150 ]
%154 = load double**, double*** %145
%155 = add nsw i64 %152, -1
%156 = getelementptr inbounds double*, double** %154, i64 %155
%157 = load double*, double** %156
%158 = getelementptr inbounds double, double* %157, i64 %12
%159 = getelementptr inbounds double*, double** %154, i64 %152
store double* %158, double** %159
%160 = add i64 %152, 1
%161 = add i64 %153, 1
%162 = icmp eq i64 %161, %94
br i1 %162, label %163, label %151
163: ; preds = %151, %150
%164 = phi i64 [ %64, %150 ], [ %160, %151 ]
br i1 %96, label %125, label %165
165: ; preds = %163, %165
%166 = phi i64 [ %191, %165 ], [ %164, %163 ]
%167 = load double**, double*** %145
%168 = add nsw i64 %166, -1
%169 = getelementptr inbounds double*, double** %167, i64 %168
%170 = load double*, double** %169
%171 = getelementptr inbounds double, double* %170, i64 %12
%172 = getelementptr inbounds double*, double** %167, i64 %166
store double* %171, double** %172
%173 = add i64 %166, 1
%174 = load double**, double*** %145
%175 = getelementptr inbounds double*, double** %174, i64 %166
%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 %166, 2
%180 = load double**, double*** %145
%181 = getelementptr inbounds double*, double** %180, i64 %173
%182 = load double*, double** %181
%183 = getelementptr inbounds double, double* %182, i64 %12
%184 = getelementptr inbounds double*, double** %180, i64 %179
store double* %183, double** %184
%185 = add i64 %166, 3
%186 = load double**, double*** %145
%187 = getelementptr inbounds double*, double** %186, i64 %179
%188 = load double*, double** %187
%189 = getelementptr inbounds double, double* %188, i64 %12
%190 = getelementptr inbounds double*, double** %186, i64 %185
store double* %189, double** %190
%191 = add i64 %166, 4
%192 = icmp eq i64 %185, %3
br i1 %192, label %125, label %165
193: ; preds = %129, %243
%194 = phi i64 [ %0, %129 ], [ %244, %243 ]
br i1 %130, label %243, label %195
195: ; preds = %193
%196 = getelementptr inbounds double**, double*** %23, i64 %194
br i1 %137, label %210, label %197
197: ; preds = %195, %206
%198 = phi i64 [ %207, %206 ], [ %2, %195 ]
%199 = phi i64 [ %208, %206 ], [ 0, %195 ]
br i1 %131, label %206, label %200
200: ; preds = %197
%201 = load double**, double*** %196
%202 = getelementptr inbounds double*, double** %201, i64 %198
%203 = load double*, double** %202
%204 = getelementptr double, double* %203, i64 %4
%205 = bitcast double* %204 to i8*
br label %206
206: ; preds = %200, %197
%207 = add i64 %198, 1
%208 = add i64 %199, 1
%209 = icmp eq i64 %208, %136
br i1 %209, label %210, label %197
210: ; preds = %206, %195
%211 = phi i64 [ %2, %195 ], [ %207, %206 ]
br i1 %138, label %243, label %212
212: ; preds = %210, %240
%213 = phi i64 [ %241, %240 ], [ %211, %210 ]
br i1 %131, label %232, label %214
214: ; preds = %212
%215 = load double**, double*** %196
%216 = getelementptr inbounds double*, double** %215, i64 %213
%217 = load double*, double** %216
%218 = getelementptr double, double* %217, i64 %4
%219 = bitcast double* %218 to i8*
%220 = add i64 %213, 1
%221 = load double**, double*** %196
%222 = getelementptr inbounds double*, double** %221, i64 %220
%223 = load double*, double** %222
%224 = getelementptr double, double* %223, i64 %4
%225 = bitcast double* %224 to i8*
%226 = add i64 %213, 2
%227 = load double**, double*** %196
%228 = getelementptr inbounds double*, double** %227, i64 %226
%229 = load double*, double** %228
%230 = getelementptr double, double* %229, i64 %4
%231 = bitcast double* %230 to i8*
br label %232
232: ; preds = %212, %214
%233 = add i64 %213, 3
br i1 %131, label %240, label %234
234: ; preds = %232
%235 = load double**, double*** %196
%236 = getelementptr inbounds double*, double** %235, i64 %233
%237 = load double*, double** %236
%238 = getelementptr double, double* %237, i64 %4
%239 = bitcast double* %238 to i8*
br label %240
240: ; preds = %234, %232
%241 = add i64 %213, 4
%242 = icmp eq i64 %233, %3
br i1 %242, label %243, label %212
243: ; preds = %210, %240, %193
%244 = add i64 %194, 1
%245 = icmp eq i64 %194, %1
br i1 %245, label %246, label %193
246: ; preds = %243, %127
ret double*** %23
}