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


x86 assembly (clang, -O0):
<free_mem6Dshort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     119d <free_mem6Dshort+0x6d>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118f <free_mem6Dshort+0x5f>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1050 <free_mem5Dshort@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <free_mem6Dshort+0x2b>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
jmp    11ae <free_mem6Dshort+0x7e>
lea    0xe5c(%rip),%rdi
mov    $0x64,%esi
call   1040 <error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_mem6Dshort>:
test   %rdi,%rdi
je     1192 <free_mem6Dshort+0x62>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
test   %esi,%esi
jle    117c <free_mem6Dshort+0x4c>
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%r13,%rbp,8),%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1050 <free_mem5Dshort@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1160 <free_mem6Dshort+0x30>
mov    %r13,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
lea    0xe67(%rip),%rdi
mov    $0x64,%esi
jmp    1040 <error@plt>

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

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