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


x86 assembly (clang, -O0):
<free_dmatrix4d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
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,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1202 <free_dmatrix4d+0xf2>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     11d8 <free_dmatrix4d+0xc8>
mov    0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     11a6 <free_dmatrix4d+0x96>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq 0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    1160 <free_dmatrix4d+0x50>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    114e <free_dmatrix4d+0x3e>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    113c <free_dmatrix4d+0x2c>
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_dmatrix4d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%rbx
cmp    %esi,%edx
jge    113f <free_dmatrix4d+0x2f>
movslq %esi,%rdx
lea    (%rbx,%rdx,8),%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    %r9d,%r13d
mov    0x70(%rsp),%eax
movslq 0x78(%rsp),%r14
movslq %r9d,%r15
movslq %ecx,%rdi
mov    %rdi,0x18(%rsp)
mov    %eax,0x10(%rsp)
cltq
movslq %r8d,%rdi
mov    %rdi,0x20(%rsp)
movslq %edx,%r12
movslq %esi,%rdx
add    $0x1,%rax
mov    %rax,0x30(%rsp)
shl    $0x3,%r14
mov    %r9d,0x14(%rsp)
mov    %r8d,0xc(%rsp)
mov    %ecx,0x8(%rsp)
mov    %rdx,0x28(%rsp)
jmp    11c5 <free_dmatrix4d+0xb5>
nopl   0x0(%rax)
mov    0x18(%rsp),%rax
lea    0x0(,%rax,8),%rdi
add    (%rbx,%r12,8),%rdi
call   1030 <free@plt>
lea    -0x1(%r12),%rax
mov    0x28(%rsp),%rdx
cmp    %rdx,%r12
mov    %rax,%r12
mov    0xc(%rsp),%r8d
mov    0x8(%rsp),%ecx
jle    1128 <free_dmatrix4d+0x18>
cmp    %ecx,%r8d
jl     1190 <free_dmatrix4d+0x80>
mov    0x20(%rsp),%rbp
jmp    1208 <free_dmatrix4d+0xf8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%r12,8),%rax
lea    0x0(,%r15,8),%rdi
add    (%rax,%rbp,8),%rdi
call   1030 <free@plt>
lea    -0x1(%rbp),%rax
cmp    0x18(%rsp),%rbp
mov    %rax,%rbp
mov    0x14(%rsp),%r13d
jle    1190 <free_dmatrix4d+0x80>
cmp    %r13d,0x10(%rsp)
jl     11e0 <free_dmatrix4d+0xd0>
mov    0x30(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx,%r12,8),%rax
mov    (%rax,%rbp,8),%rax
mov    -0x8(%rax,%r13,8),%rdi
add    %r14,%rdi
call   1030 <free@plt>
add    $0xffffffffffffffff,%r13
cmp    %r15,%r13
jg     1220 <free_dmatrix4d+0x110>
jmp    11e0 <free_dmatrix4d+0xd0>

LLVM IR (-O0):
define void @free_dmatrix4d(double**** %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca double****
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store double**** %0, double***** %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
%22 = load i32, i32* %12
store i32 %22, i32* %21
br label %23
23: ; preds = %90, %9
%24 = load i32, i32* %21
%25 = load i32, i32* %11
%26 = icmp sge i32 %24, %25
br i1 %26, label %27, label %93
27: ; preds = %23
%28 = load i32, i32* %14
store i32 %28, i32* %20
br label %29
29: ; preds = %76, %27
%30 = load i32, i32* %20
%31 = load i32, i32* %13
%32 = icmp sge i32 %30, %31
br i1 %32, label %33, label %79
33: ; preds = %29
%34 = load i32, i32* %16
store i32 %34, i32* %19
br label %35
35: ; preds = %58, %33
%36 = load i32, i32* %19
%37 = load i32, i32* %15
%38 = icmp sge i32 %36, %37
br i1 %38, label %39, label %61
39: ; preds = %35
%40 = load double****, double***** %10
%41 = load i32, i32* %21
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double***, double**** %40, i64 %42
%44 = load double***, double**** %43
%45 = load i32, i32* %20
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double**, double*** %44, i64 %46
%48 = load double**, double*** %47
%49 = load i32, i32* %19
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double*, double** %48, i64 %50
%52 = load double*, double** %51
%53 = load i32, i32* %17
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = bitcast double* %55 to i8*
%57 = call i32 @free(i8* %56)
br label %58
58: ; preds = %39
%59 = load i32, i32* %19
%60 = add nsw i32 %59, -1
store i32 %60, i32* %19
br label %35
61: ; preds = %35
%62 = load double****, double***** %10
%63 = load i32, i32* %21
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double***, double**** %62, i64 %64
%66 = load double***, double**** %65
%67 = load i32, i32* %20
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double**, double*** %66, i64 %68
%70 = load double**, double*** %69
%71 = load i32, i32* %15
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double*, double** %70, i64 %72
%74 = bitcast double** %73 to i8*
%75 = call i32 @free(i8* %74)
br label %76
76: ; preds = %61
%77 = load i32, i32* %20
%78 = add nsw i32 %77, -1
store i32 %78, i32* %20
br label %29
79: ; preds = %29
%80 = load double****, double***** %10
%81 = load i32, i32* %21
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double***, double**** %80, i64 %82
%84 = load double***, double**** %83
%85 = load i32, i32* %13
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double**, double*** %84, i64 %86
%88 = bitcast double*** %87 to i8*
%89 = call i32 @free(i8* %88)
br label %90
90: ; preds = %79
%91 = load i32, i32* %21
%92 = add nsw i32 %91, -1
store i32 %92, i32* %21
br label %23
93: ; preds = %23
%94 = load double****, double***** %10
%95 = load i32, i32* %11
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double***, double**** %94, i64 %96
%98 = bitcast double**** %97 to i8*
%99 = call i32 @free(i8* %98)
ret void
}

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