#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 */
int /*<<< orphan*/ free(char *);
void free_d3tensor(double ***t, long nrl, long ncl, long ndl) {
  free((char *)(t[nrl][ncl] + ndl - 1));
  free((char *)(t[nrl] + ncl - 1));
  free((char *)(t + nrl - 1));
}


x86 assembly (clang, -O0):
<free_d3tensor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_d3tensor>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    (%rdi,%rsi,8),%rax
mov    (%rax,%rdx,8),%rax
lea    (%rax,%rcx,8),%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
mov    (%rbx,%r15,8),%rax
lea    (%rax,%r14,8),%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
lea    (%rbx,%r15,8),%rdi
add    $0xfffffffffffffff8,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_d3tensor(double*** %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca double***
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store double*** %0, double**** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load double***, double**** %5
%10 = load i64, i64* %6
%11 = getelementptr inbounds double**, double*** %9, i64 %10
%12 = load double**, double*** %11
%13 = load i64, i64* %7
%14 = getelementptr inbounds double*, double** %12, i64 %13
%15 = load double*, double** %14
%16 = load i64, i64* %8
%17 = getelementptr inbounds double, double* %15, i64 %16
%18 = getelementptr inbounds double, double* %17, i64 -1
%19 = bitcast double* %18 to i8*
%20 = call i32 @free(i8* %19)
%21 = load double***, double**** %5
%22 = load i64, i64* %6
%23 = getelementptr inbounds double**, double*** %21, i64 %22
%24 = load double**, double*** %23
%25 = load i64, i64* %7
%26 = getelementptr inbounds double*, double** %24, i64 %25
%27 = getelementptr inbounds double*, double** %26, i64 -1
%28 = bitcast double** %27 to i8*
%29 = call i32 @free(i8* %28)
%30 = load double***, double**** %5
%31 = load i64, i64* %6
%32 = getelementptr inbounds double**, double*** %30, i64 %31
%33 = getelementptr inbounds double**, double*** %32, i64 -1
%34 = bitcast double*** %33 to i8*
%35 = call i32 @free(i8* %34)
ret void
}

LLVM IR (-O2):
define void @free_d3tensor(double*** nocapture %0, i64 %1, i64 %2, i64 %3) {
%5 = getelementptr inbounds double**, double*** %0, i64 %1
%6 = load double**, double*** %5
%7 = getelementptr inbounds double*, double** %6, i64 %2
%8 = load double*, double** %7
%9 = getelementptr inbounds double, double* %8, i64 %3
%10 = getelementptr inbounds double, double* %9, i64 -1
%11 = bitcast double* %10 to i8*
%12 = tail call i32 @free(i8* %11)
%13 = load double**, double*** %5
%14 = getelementptr inbounds double*, double** %13, i64 %2
%15 = getelementptr inbounds double*, double** %14, i64 -1
%16 = bitcast double** %15 to i8*
%17 = tail call i32 @free(i8* %16)
%18 = getelementptr inbounds double**, double*** %5, i64 -1
%19 = bitcast double*** %18 to i8*
%20 = tail call i32 @free(i8* %19)
ret void
}