double ***d3tensor(nrl, nrh, ncl, nch, ndl, ndh)
long nch, ncl, ndh, ndl, nrh, nrl;
{
  long i, j, nrow = nrh - nrl + 1, ncol = nch - ncl + 1, ndep = ndh - ndl + 1;
  double ***t;
  t = (double ***)malloc((unsigned int)((nrow + 1) * sizeof(double **)));
  if (!t)
    nrerror("allocation failure 1 in d3tensor()");
  t += 1;
  t -= nrl;
  t[nrl] =
      (double **)malloc((unsigned int)((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(
      (unsigned int)((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),%rax
add    $0x1,%rax
shl    $0x3,%rax
mov    %eax,%eax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    11a2 <d3tensor+0x82>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
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),%rax
imul   -0x50(%rbp),%rax
add    $0x1,%rax
shl    $0x3,%rax
mov    %eax,%eax
mov    %eax,%edi
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    1210 <d3tensor+0xf0>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
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),%rax
imul   -0x50(%rbp),%rax
imul   -0x58(%rbp),%rax
add    $0x1,%rax
shl    $0x3,%rax
mov    %eax,%eax
mov    %eax,%edi
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    12a3 <d3tensor+0x183>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
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     1349 <d3tensor+0x229>
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    12f3 <d3tensor+0x1d3>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     143e <d3tensor+0x31e>
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     1428 <d3tensor+0x308>
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    13d2 <d3tensor+0x2b2>
jmp    142d <d3tensor+0x30d>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1355 <d3tensor+0x235>
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    $0x58,%rsp
mov    %r9,%r12
mov    %rdx,%r15
mov    %rdi,%r13
mov    %rsi,0x48(%rsp)
mov    %rsi,%rax
sub    %rdi,%rax
lea    0x1(%rax),%rbx
mov    %rcx,0x10(%rsp)
mov    %rcx,%rbp
sub    %rdx,%rbp
add    $0x1,%rbp
mov    %r9,%rcx
mov    %r8,0x50(%rsp)
sub    %r8,%rcx
mov    %rcx,0x8(%rsp)
lea    0x10(,%rax,8),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1187 <d3tensor+0x67>
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1030 <nrerror@plt>
addq   $0x1,0x8(%rsp)
lea    0x0(,%r13,8),%rax
sub    %rax,%r14
lea    0x8(%r14),%rax
mov    %rax,0x18(%rsp)
mov    %rbp,0x40(%rsp)
imul   %rbp,%rbx
shl    $0x3,%rbx
lea    0x8(%rbx),%edi
call   1040 <malloc@plt>
mov    %rax,%rbp
mov    %rax,0x8(%r14,%r13,8)
test   %rax,%rax
jne    11d1 <d3tensor+0xb1>
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1030 <nrerror@plt>
lea    0x0(,%r15,8),%rcx
mov    %rbp,0x28(%rsp)
mov    %rcx,0x38(%rsp)
sub    %rcx,%rbp
lea    0x8(%rbp),%r14
mov    0x18(%rsp),%rax
mov    %r14,(%rax,%r13,8)
mov    0x8(%rsp),%rax
imul   %eax,%ebx
add    $0x8,%ebx
and    $0xfffffff8,%ebx
mov    %rbx,%rdi
call   1040 <malloc@plt>
mov    %rax,0x8(%rbp,%r15,8)
test   %rax,%rax
jne    1225 <d3tensor+0x105>
lea    0xe2c(%rip),%rdi
xor    %eax,%eax
call   1030 <nrerror@plt>
mov    (%r14,%r15,8),%rax
mov    0x50(%rsp),%r9
lea    0x0(,%r9,8),%r8
mov    %rax,%rcx
sub    %r8,%rcx
add    $0x8,%rcx
mov    %rcx,(%r14,%r15,8)
lea    0x1(%r15),%rdx
mov    %rdx,0x20(%rsp)
mov    %r15,%rdx
not    %rdx
mov    %rdx,0x30(%rsp)
cmp    %r15,0x10(%rsp)
jle    1379 <d3tensor+0x259>
mov    0x10(%rsp),%rdx
mov    %edx,%edi
sub    %r15d,%edi
mov    0x30(%rsp),%rsi
add    %rdx,%rsi
and    $0x7,%rdi
je     12c4 <d3tensor+0x1a4>
lea    0x0(,%r12,8),%rbx
sub    %r8,%rbx
add    $0x8,%rbx
mov    %r12,%rbp
sub    %r9,%rbp
sub    %r9,%rbp
lea    (%rax,%rbp,8),%rax
add    $0x10,%rax
xor    %edx,%edx
mov    0x28(%rsp),%rbp
xchg   %ax,%ax
mov    %rax,0x10(%rbp,%rdx,8)
add    $0x1,%rdx
add    %rbx,%rcx
add    %rbx,%rax
cmp    %rdx,%rdi
jne    12a0 <d3tensor+0x180>
add    0x20(%rsp),%rdx
cmp    $0x7,%rsi
jae    12d3 <d3tensor+0x1b3>
jmp    1379 <d3tensor+0x259>
mov    0x20(%rsp),%rdx
cmp    $0x7,%rsi
jb     1379 <d3tensor+0x259>
mov    0x8(%rsp),%rax
lea    (%rcx,%rax,8),%rax
mov    %r12,%rcx
shl    $0x6,%rcx
mov    %r9,%rsi
shl    $0x6,%rsi
sub    %rsi,%rcx
add    $0x40,%rcx
mov    0x10(%rsp),%rsi
sub    %rdx,%rsi
shl    $0x3,%rdx
sub    0x38(%rsp),%rdx
mov    0x28(%rsp),%rdi
add    %rdi,%rdx
add    $0x40,%rdx
lea    0x0(,%r12,8),%rdi
sub    %r8,%rdi
add    $0x8,%rdi
mov    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,-0x30(%rdx,%rbx,8)
lea    (%rax,%rdi,1),%rbp
mov    %rbp,-0x28(%rdx,%rbx,8)
add    %rdi,%rbp
mov    %rbp,-0x20(%rdx,%rbx,8)
add    %rdi,%rbp
mov    %rbp,-0x18(%rdx,%rbx,8)
add    %rdi,%rbp
mov    %rbp,-0x10(%rdx,%rbx,8)
add    %rdi,%rbp
mov    %rbp,-0x8(%rdx,%rbx,8)
add    %rdi,%rbp
mov    %rbp,(%rdx,%rbx,8)
add    %rdi,%rbp
mov    %rbp,0x8(%rdx,%rbx,8)
add    %rcx,%rax
add    $0x8,%rbx
cmp    %rbx,%rsi
jne    1330 <d3tensor+0x210>
cmp    %r13,0x48(%rsp)
mov    0x18(%rsp),%rax
jle    14df <d3tensor+0x3bf>
mov    0x8(%rsp),%r11
imul   0x40(%rsp),%r11
mov    0x10(%rsp),%rax
mov    %eax,%edi
sub    %r15d,%edi
add    %rax,0x30(%rsp)
and    $0x7,%edi
lea    0x0(,%r12,8),%rsi
sub    %r8,%rsi
add    $0x8,%rsi
lea    0x0(,%rax,8),%rcx
mov    %rcx,%r8
sub    0x38(%rsp),%r8
mov    0x28(%rsp),%rbp
lea    (%r8,%rbp,1),%rdx
add    $0x18,%rdx
add    $0x8,%r8
shl    $0x6,%r12
shl    $0x6,%r9
sub    %r9,%r12
add    $0x40,%r12
lea    0x1(%rax),%r10
mov    0x18(%rsp),%rax
mov    %r15,%rbx
shl    $0x4,%rbx
sub    %rbx,%rcx
add    %rcx,%rbp
add    $0x28,%rbp
shl    $0x3,%r11
jmp    1421 <d3tensor+0x301>
cs nopw 0x0(%rax,%rax,1)
nop
add    %r8,%rdx
add    %r8,%rbp
cmp    0x48(%rsp),%r13
je     14df <d3tensor+0x3bf>
mov    (%r14,%r15,8),%rbx
mov    0x40(%rsp),%rcx
lea    (%r14,%rcx,8),%r14
mov    %r14,0x8(%rax,%r13,8)
add    $0x1,%r13
add    %r11,%rbx
mov    %rbx,(%r14,%r15,8)
cmp    %r15,0x10(%rsp)
jle    1410 <d3tensor+0x2f0>
test   %rdi,%rdi
je     146f <d3tensor+0x34f>
xor    %ecx,%ecx
nopl   0x0(%rax)
add    %rsi,%rbx
mov    %rbx,(%rdx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rdi
jne    1450 <d3tensor+0x330>
add    0x20(%rsp),%rcx
cmpq   $0x7,0x30(%rsp)
jb     1410 <d3tensor+0x2f0>
jmp    147c <d3tensor+0x35c>
mov    0x20(%rsp),%rcx
cmpq   $0x7,0x30(%rsp)
jb     1410 <d3tensor+0x2f0>
mov    0x8(%rsp),%rax
lea    (%rbx,%rax,8),%rbx
mov    0x18(%rsp),%rax
nopw   0x0(%rax,%rax,1)
mov    %rbx,-0x18(%rbp,%rcx,8)
lea    (%rbx,%rsi,1),%r9
mov    %r9,-0x10(%rbp,%rcx,8)
add    %rsi,%r9
mov    %r9,-0x8(%rbp,%rcx,8)
add    %rsi,%r9
mov    %r9,0x0(%rbp,%rcx,8)
add    %rsi,%r9
mov    %r9,0x8(%rbp,%rcx,8)
add    %rsi,%r9
mov    %r9,0x10(%rbp,%rcx,8)
add    %rsi,%r9
mov    %r9,0x18(%rbp,%rcx,8)
add    %rsi,%r9
mov    %r9,0x20(%rbp,%rcx,8)
add    $0x8,%rcx
add    %r12,%rbx
cmp    %rcx,%r10
jne    1490 <d3tensor+0x370>
jmp    1410 <d3tensor+0x2f0>
add    $0x58,%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 = trunc i64 %33 to i32
%35 = zext i32 %34 to i64
%36 = call i8* @malloc(i64 %35)
%37 = bitcast i8* %36 to double***
store double*** %37, double**** %18
%38 = load double***, double**** %18
%39 = icmp ne double*** %38, null
br i1 %39, label %42, label %40
40: ; preds = %6
%41 = call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %42
42: ; preds = %40, %6
%43 = load double***, double**** %18
%44 = getelementptr inbounds double**, double*** %43, i64 1
store double*** %44, double**** %18
%45 = load i64, i64* %7
%46 = load double***, double**** %18
%47 = sub i64 0, %45
%48 = getelementptr inbounds double**, double*** %46, i64 %47
store double*** %48, double**** %18
%49 = load i64, i64* %15
%50 = load i64, i64* %16
%51 = mul nsw i64 %49, %50
%52 = add nsw i64 %51, 1
%53 = mul i64 %52, 8
%54 = trunc i64 %53 to i32
%55 = zext i32 %54 to i64
%56 = call i8* @malloc(i64 %55)
%57 = bitcast i8* %56 to double**
%58 = load double***, double**** %18
%59 = load i64, i64* %7
%60 = getelementptr inbounds double**, double*** %58, i64 %59
store double** %57, double*** %60
%61 = load double***, double**** %18
%62 = load i64, i64* %7
%63 = getelementptr inbounds double**, double*** %61, i64 %62
%64 = load double**, double*** %63
%65 = icmp ne double** %64, null
br i1 %65, label %68, label %66
66: ; preds = %42
%67 = call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %68
68: ; preds = %66, %42
%69 = load double***, double**** %18
%70 = load i64, i64* %7
%71 = getelementptr inbounds double**, double*** %69, i64 %70
%72 = load double**, double*** %71
%73 = getelementptr inbounds double*, double** %72, i64 1
store double** %73, double*** %71
%74 = load i64, i64* %9
%75 = load double***, double**** %18
%76 = load i64, i64* %7
%77 = getelementptr inbounds double**, double*** %75, i64 %76
%78 = load double**, double*** %77
%79 = sub i64 0, %74
%80 = getelementptr inbounds double*, double** %78, i64 %79
store double** %80, double*** %77
%81 = load i64, i64* %15
%82 = load i64, i64* %16
%83 = mul nsw i64 %81, %82
%84 = load i64, i64* %17
%85 = mul nsw i64 %83, %84
%86 = add nsw i64 %85, 1
%87 = mul i64 %86, 8
%88 = trunc i64 %87 to i32
%89 = zext i32 %88 to i64
%90 = call i8* @malloc(i64 %89)
%91 = bitcast i8* %90 to double*
%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
store double* %91, double** %97
%98 = load double***, double**** %18
%99 = load i64, i64* %7
%100 = getelementptr inbounds double**, double*** %98, i64 %99
%101 = load double**, double*** %100
%102 = load i64, i64* %9
%103 = getelementptr inbounds double*, double** %101, i64 %102
%104 = load double*, double** %103
%105 = icmp ne double* %104, null
br i1 %105, label %108, label %106
106: ; preds = %68
%107 = call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %108
108: ; preds = %106, %68
%109 = load double***, double**** %18
%110 = load i64, i64* %7
%111 = getelementptr inbounds double**, double*** %109, i64 %110
%112 = load double**, double*** %111
%113 = load i64, i64* %9
%114 = getelementptr inbounds double*, double** %112, i64 %113
%115 = load double*, double** %114
%116 = getelementptr inbounds double, double* %115, i64 1
store double* %116, double** %114
%117 = load i64, i64* %11
%118 = load double***, double**** %18
%119 = load i64, i64* %7
%120 = getelementptr inbounds double**, double*** %118, i64 %119
%121 = load double**, double*** %120
%122 = load i64, i64* %9
%123 = getelementptr inbounds double*, double** %121, i64 %122
%124 = load double*, double** %123
%125 = sub i64 0, %117
%126 = getelementptr inbounds double, double* %124, i64 %125
store double* %126, double** %123
%127 = load i64, i64* %9
%128 = add nsw i64 %127, 1
store i64 %128, i64* %14
br label %129
129: ; preds = %150, %108
%130 = load i64, i64* %14
%131 = load i64, i64* %10
%132 = icmp sle i64 %130, %131
br i1 %132, label %133, label %153
133: ; preds = %129
%134 = load double***, double**** %18
%135 = load i64, i64* %7
%136 = getelementptr inbounds double**, double*** %134, i64 %135
%137 = load double**, double*** %136
%138 = load i64, i64* %14
%139 = sub nsw i64 %138, 1
%140 = getelementptr inbounds double*, double** %137, i64 %139
%141 = load double*, double** %140
%142 = load i64, i64* %17
%143 = getelementptr inbounds double, double* %141, i64 %142
%144 = load double***, double**** %18
%145 = load i64, i64* %7
%146 = getelementptr inbounds double**, double*** %144, i64 %145
%147 = load double**, double*** %146
%148 = load i64, i64* %14
%149 = getelementptr inbounds double*, double** %147, i64 %148
store double* %143, double** %149
br label %150
150: ; preds = %133
%151 = load i64, i64* %14
%152 = add nsw i64 %151, 1
store i64 %152, i64* %14
br label %129
153: ; preds = %129
%154 = load i64, i64* %7
%155 = add nsw i64 %154, 1
store i64 %155, i64* %13
br label %156
156: ; preds = %216, %153
%157 = load i64, i64* %13
%158 = load i64, i64* %8
%159 = icmp sle i64 %157, %158
br i1 %159, label %160, label %219
160: ; preds = %156
%161 = load double***, double**** %18
%162 = load i64, i64* %13
%163 = sub nsw i64 %162, 1
%164 = getelementptr inbounds double**, double*** %161, i64 %163
%165 = load double**, double*** %164
%166 = load i64, i64* %16
%167 = getelementptr inbounds double*, double** %165, i64 %166
%168 = load double***, double**** %18
%169 = load i64, i64* %13
%170 = getelementptr inbounds double**, double*** %168, i64 %169
store double** %167, double*** %170
%171 = load double***, double**** %18
%172 = load i64, i64* %13
%173 = sub nsw i64 %172, 1
%174 = getelementptr inbounds double**, double*** %171, i64 %173
%175 = load double**, double*** %174
%176 = load i64, i64* %9
%177 = getelementptr inbounds double*, double** %175, i64 %176
%178 = load double*, double** %177
%179 = load i64, i64* %16
%180 = load i64, i64* %17
%181 = mul nsw i64 %179, %180
%182 = getelementptr inbounds double, double* %178, i64 %181
%183 = load double***, double**** %18
%184 = load i64, i64* %13
%185 = getelementptr inbounds double**, double*** %183, i64 %184
%186 = load double**, double*** %185
%187 = load i64, i64* %9
%188 = getelementptr inbounds double*, double** %186, i64 %187
store double* %182, double** %188
%189 = load i64, i64* %9
%190 = add nsw i64 %189, 1
store i64 %190, i64* %14
br label %191
191: ; preds = %212, %160
%192 = load i64, i64* %14
%193 = load i64, i64* %10
%194 = icmp sle i64 %192, %193
br i1 %194, label %195, label %215
195: ; preds = %191
%196 = load double***, double**** %18
%197 = load i64, i64* %13
%198 = getelementptr inbounds double**, double*** %196, i64 %197
%199 = load double**, double*** %198
%200 = load i64, i64* %14
%201 = sub nsw i64 %200, 1
%202 = getelementptr inbounds double*, double** %199, i64 %201
%203 = load double*, double** %202
%204 = load i64, i64* %17
%205 = getelementptr inbounds double, double* %203, i64 %204
%206 = load double***, double**** %18
%207 = load i64, i64* %13
%208 = getelementptr inbounds double**, double*** %206, i64 %207
%209 = load double**, double*** %208
%210 = load i64, i64* %14
%211 = getelementptr inbounds double*, double** %209, i64 %210
store double* %205, double** %211
br label %212
212: ; preds = %195
%213 = load i64, i64* %14
%214 = add nsw i64 %213, 1
store i64 %214, i64* %14
br label %191
215: ; preds = %191
br label %216
216: ; preds = %215
%217 = load i64, i64* %13
%218 = add nsw i64 %217, 1
store i64 %218, i64* %13
br label %156
219: ; preds = %156
%220 = load double***, double**** %18
ret double*** %220
}

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