#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(void **);
void free_array(void ***array, int *n, int *len) {
  int loop;
  for (loop = 0; loop < *n; loop++) {
    free((*array)[loop]);
  }
  free(*array);
  *array = NULL;
  *n = *len = 0;
}


x86 assembly (clang, -O0):
<free_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    115c <free_array+0x4c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <free_array+0x1b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
cmpl   $0x0,(%rsi)
jle    1149 <free_array+0x39>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r12),%rax
mov    (%rax,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
movslq (%r15),%rax
cmp    %rax,%rbx
jl     1130 <free_array+0x20>
mov    (%r12),%rdi
call   1030 <free@plt>
movq   $0x0,(%r12)
movl   $0x0,(%r14)
movl   $0x0,(%r15)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @free_array(i8*** %0, i32* %1, i32* %2) {
%4 = alloca i8***
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i8*** %0, i8**** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %7
br label %8
8: ; preds = %22, %3
%9 = load i32, i32* %7
%10 = load i32*, i32** %5
%11 = load i32, i32* %10
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %25
13: ; preds = %8
%14 = load i8***, i8**** %4
%15 = load i8**, i8*** %14
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = bitcast i8* %19 to i8**
%21 = call i32 @free(i8** %20)
br label %22
22: ; preds = %13
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %8
25: ; preds = %8
%26 = load i8***, i8**** %4
%27 = load i8**, i8*** %26
%28 = call i32 @free(i8** %27)
%29 = load i8***, i8**** %4
store i8** null, i8*** %29
%30 = load i32*, i32** %6
store i32 0, i32* %30
%31 = load i32*, i32** %5
store i32 0, i32* %31
ret void
}

LLVM IR (-O2):
define void @free_array(i8*** nocapture %0, i32* nocapture %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %3, %6
%7 = phi i64 [ %13, %6 ], [ 0, %3 ]
%8 = load i8**, i8*** %0
%9 = getelementptr inbounds i8*, i8** %8, i64 %7
%10 = bitcast i8** %9 to i8***
%11 = load i8**, i8*** %10
%12 = tail call i32 @free(i8** %11)
%13 = add nuw nsw i64 %7, 1
%14 = load i32, i32* %1
%15 = sext i32 %14 to i64
%16 = icmp slt i64 %13, %15
br i1 %16, label %6, label %17
17: ; preds = %6, %3
%18 = load i8**, i8*** %0
%19 = tail call i32 @free(i8** %18)
store i8** null, i8*** %0
store i32 0, i32* %2
store i32 0, i32* %1
ret void
}