#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_dmatrix3d(double ***m, int nsl, int nsh, int nrl, int nrh, int ncl,
                    int nch) {
  int i, j;
  for (j = nsh; j >= nsl; j--) {
    for (i = nrh; i >= nrl; i--) {
      free((char *)(m[j][i] + ncl));
    }
    free((char *)(m[j] + nrl));
  }
  free((char *)(m + nsl));
}


x86 assembly (clang, -O0):
<free_dmatrix3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11b0 <free_dmatrix3d+0xa0>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1186 <free_dmatrix3d+0x76>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    1148 <free_dmatrix3d+0x38>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1136 <free_dmatrix3d+0x26>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_dmatrix3d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r13
cmp    %esi,%edx
jge    1146 <free_dmatrix3d+0x36>
movslq %esi,%r15
lea    0x0(,%r15,8),%rdi
add    %r13,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
movslq %r9d,%rbp
movslq %ecx,%rbx
movslq %r8d,%rax
movslq %edx,%r14
movslq %esi,%r15
add    $0x1,%rax
mov    %rax,0x8(%rsp)
lea    0x0(,%rbx,8),%rax
mov    %rax,0x10(%rsp)
shl    $0x3,%rbp
mov    %ecx,0x4(%rsp)
mov    %r8d,(%rsp)
jmp    11a3 <free_dmatrix3d+0x93>
nopl   0x0(%rax)
mov    0x0(%r13,%r14,8),%rdi
add    0x10(%rsp),%rdi
call   1030 <free@plt>
lea    -0x1(%r14),%rax
cmp    %r15,%r14
mov    %rax,%r14
mov    (%rsp),%r8d
mov    0x4(%rsp),%ecx
jle    1128 <free_dmatrix3d+0x18>
cmp    %ecx,%r8d
jl     1180 <free_dmatrix3d+0x70>
mov    0x8(%rsp),%r12
nopl   (%rax)
mov    0x0(%r13,%r14,8),%rax
mov    -0x8(%rax,%r12,8),%rdi
add    %rbp,%rdi
call   1030 <free@plt>
add    $0xffffffffffffffff,%r12
cmp    %rbx,%r12
jg     11b0 <free_dmatrix3d+0xa0>
jmp    1180 <free_dmatrix3d+0x70>

LLVM IR (-O0):
define void @free_dmatrix3d(double*** %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca double***
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store double*** %0, double**** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%17 = load i32, i32* %10
store i32 %17, i32* %16
br label %18
18: ; preds = %57, %7
%19 = load i32, i32* %16
%20 = load i32, i32* %9
%21 = icmp sge i32 %19, %20
br i1 %21, label %22, label %60
22: ; preds = %18
%23 = load i32, i32* %12
store i32 %23, i32* %15
br label %24
24: ; preds = %43, %22
%25 = load i32, i32* %15
%26 = load i32, i32* %11
%27 = icmp sge i32 %25, %26
br i1 %27, label %28, label %46
28: ; preds = %24
%29 = load double***, double**** %8
%30 = load i32, i32* %16
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double**, double*** %29, i64 %31
%33 = load double**, double*** %32
%34 = load i32, i32* %15
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double*, double** %33, i64 %35
%37 = load double*, double** %36
%38 = load i32, i32* %13
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = bitcast double* %40 to i8*
%42 = call i32 @free(i8* %41)
br label %43
43: ; preds = %28
%44 = load i32, i32* %15
%45 = add nsw i32 %44, -1
store i32 %45, i32* %15
br label %24
46: ; preds = %24
%47 = load double***, double**** %8
%48 = load i32, i32* %16
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double**, double*** %47, i64 %49
%51 = load double**, double*** %50
%52 = load i32, i32* %11
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double*, double** %51, i64 %53
%55 = bitcast double** %54 to i8*
%56 = call i32 @free(i8* %55)
br label %57
57: ; preds = %46
%58 = load i32, i32* %16
%59 = add nsw i32 %58, -1
store i32 %59, i32* %16
br label %18
60: ; preds = %18
%61 = load double***, double**** %8
%62 = load i32, i32* %9
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double**, double*** %61, i64 %63
%65 = bitcast double*** %64 to i8*
%66 = call i32 @free(i8* %65)
ret void
}

LLVM IR (-O2):
define void @free_dmatrix3d(double*** nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = icmp slt i32 %2, %1
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = sext i32 %1 to i64
br label %40
11: ; preds = %7
%12 = icmp slt i32 %4, %3
%13 = sext i32 %5 to i64
%14 = sext i32 %3 to i64
%15 = sext i32 %4 to i64
%16 = sext i32 %2 to i64
%17 = sext i32 %1 to i64
br label %18
18: ; preds = %11, %32
%19 = phi i64 [ %16, %11 ], [ %38, %32 ]
br i1 %12, label %32, label %20
20: ; preds = %18
%21 = getelementptr inbounds double**, double*** %0, i64 %19
br label %22
22: ; preds = %20, %22
%23 = phi i64 [ %15, %20 ], [ %30, %22 ]
%24 = load double**, double*** %21
%25 = getelementptr inbounds double*, double** %24, i64 %23
%26 = load double*, double** %25
%27 = getelementptr inbounds double, double* %26, i64 %13
%28 = bitcast double* %27 to i8*
%29 = tail call i32 @free(i8* %28)
%30 = add nsw i64 %23, -1
%31 = icmp sgt i64 %23, %14
br i1 %31, label %22, label %32
32: ; preds = %22, %18
%33 = getelementptr inbounds double**, double*** %0, i64 %19
%34 = load double**, double*** %33
%35 = getelementptr inbounds double*, double** %34, i64 %14
%36 = bitcast double** %35 to i8*
%37 = tail call i32 @free(i8* %36)
%38 = add nsw i64 %19, -1
%39 = icmp sgt i64 %19, %17
br i1 %39, label %18, label %40
40: ; preds = %32, %9
%41 = phi i64 [ %10, %9 ], [ %17, %32 ]
%42 = getelementptr inbounds double**, double*** %0, i64 %41
%43 = bitcast double*** %42 to i8*
%44 = tail call i32 @free(i8* %43)
ret void
}