#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*/ error(char *, int);
int /*<<< orphan*/ free(int *****);
int /*<<< orphan*/ free_mem4Dint(int ****, int, int);
void free_mem5Dint(int *****array5D, int refs, int blocktype, int height) {
  int j;
  if (array5D) {
    for (j = 0; j < refs; j++)
      free_mem4Dint(array5D[j], blocktype, height);
    free(array5D);
  } else {
    error("free_mem5Dint: trying to free unused memory", 100);
  }
}


x86 assembly (clang, -O0):
<free_mem5Dint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1196 <free_mem5Dint+0x66>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1188 <free_mem5Dint+0x58>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <free_mem4Dint@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1157 <free_mem5Dint+0x27>
mov    -0x8(%rbp),%rdi
call   1040 <free@plt>
jmp    11a7 <free_mem5Dint+0x77>
lea    0xe63(%rip),%rdi
mov    $0x64,%esi
call   1050 <error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_mem5Dint>:
test   %rdi,%rdi
je     1178 <free_mem5Dint+0x48>
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r12
test   %esi,%esi
jle    1168 <free_mem5Dint+0x38>
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebp
xor    %ebx,%ebx
xchg   %ax,%ax
mov    (%r12,%rbx,8),%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1030 <free_mem4Dint@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <free_mem5Dint+0x20>
mov    %r12,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <free@plt>
lea    0xe81(%rip),%rdi
mov    $0x64,%esi
jmp    1050 <error@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"free_mem5Dint: trying to free unused memory\00"
define void @free_mem5Dint(i32***** %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*****
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32***** %0, i32****** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32*****, i32****** %5
%11 = icmp ne i32***** %10, null
br i1 %11, label %12, label %32
12: ; preds = %4
store i32 0, i32* %9
br label %13
13: ; preds = %26, %12
%14 = load i32, i32* %9
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %29
17: ; preds = %13
%18 = load i32*****, i32****** %5
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32****, i32***** %18, i64 %20
%22 = load i32****, i32***** %21
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = call i32 @free_mem4Dint(i32**** %22, i32 %23, i32 %24)
br label %26
26: ; preds = %17
%27 = load i32, i32* %9
%28 = add nsw i32 %27, 1
store i32 %28, i32* %9
br label %13
29: ; preds = %13
%30 = load i32*****, i32****** %5
%31 = call i32 @free(i32***** %30)
br label %34
32: ; preds = %4
%33 = call i32 @error(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 100)
br label %34
34: ; preds = %32, %29
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"free_mem5Dint: trying to free unused memory\00"
define void @free_mem5Dint(i32***** %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32***** %0, null
br i1 %5, label %19, label %6
6: ; preds = %4
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %17
8: ; preds = %6
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %15, %10 ]
%12 = getelementptr inbounds i32****, i32***** %0, i64 %11
%13 = load i32****, i32***** %12
%14 = tail call i32 @free_mem4Dint(i32**** %13, i32 %2, i32 %3)
%15 = add nuw nsw i64 %11, 1
%16 = icmp eq i64 %15, %9
br i1 %16, label %17, label %10
17: ; preds = %10, %6
%18 = tail call i32 @free(i32***** %0)
br label %21
19: ; preds = %4
%20 = tail call i32 @error(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 100)
br label %21
21: ; preds = %19, %17
ret void
}