#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 mp_array_free(char ***array, int *num) {
  int i;
  for (i = 0; i < *num; i++) {
    if ((*array)[i])
      free((*array)[i]);
  }
  (*array) = NULL;
  (*num) = 0;
}


x86 assembly (clang, -O0):
<mp_array_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1173 <mp_array_free+0x63>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1160 <mp_array_free+0x50>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    1165 <mp_array_free+0x55>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <mp_array_free+0x17>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_array_free>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rsi),%eax
test   %eax,%eax
jle    1152 <mp_array_free+0x42>
xor    %ebx,%ebx
jmp    113c <mp_array_free+0x2c>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    1152 <mp_array_free+0x42>
mov    (%r15),%rcx
mov    (%rcx,%rbx,8),%rdi
test   %rdi,%rdi
je     1130 <mp_array_free+0x20>
call   1030 <free@plt>
mov    (%r14),%eax
jmp    1130 <mp_array_free+0x20>
movq   $0x0,(%r15)
movl   $0x0,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

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

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