#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 gbdbg_free_text_lookup(char *arr[], const size_t arr_size) {
  if (arr)
    for (size_t i = 0; i < arr_size && arr[i]; i++) {
      if (NULL != arr[i])
        free(arr[i]);
      arr[i] = NULL;
    }
}


x86 assembly (clang, -O0):
<gbdbg_free_text_lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11b4 <gbdbg_free_text_lookup+0xa4>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x19(%rbp)
jae    1159 <gbdbg_free_text_lookup+0x49>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1169 <gbdbg_free_text_lookup+0x59>
jmp    11af <gbdbg_free_text_lookup+0x9f>
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
xor    %eax,%eax
cmp    (%rcx,%rdx,8),%rax
je     118e <gbdbg_free_text_lookup+0x7e>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1133 <gbdbg_free_text_lookup+0x23>
jmp    11b4 <gbdbg_free_text_lookup+0xa4>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gbdbg_free_text_lookup>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     114f <gbdbg_free_text_lookup+0x3f>
mov    %rsi,%r14
test   %rsi,%rsi
je     114f <gbdbg_free_text_lookup+0x3f>
mov    %rdi,%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rdi
test   %rdi,%rdi
je     114f <gbdbg_free_text_lookup+0x3f>
call   1030 <free@plt>
movq   $0x0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <gbdbg_free_text_lookup+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @gbdbg_free_text_lookup(i8** %0, i64 %1) {
%3 = alloca i8**
%4 = alloca i64
%5 = alloca i64
store i8** %0, i8*** %3
store i64 %1, i64* %4
%6 = load i8**, i8*** %3
%7 = icmp ne i8** %6, null
br i1 %7, label %8, label %41
8: ; preds = %2
store i64 0, i64* %5
br label %9
9: ; preds = %37, %8
%10 = load i64, i64* %5
%11 = load i64, i64* %4
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load i8**, i8*** %3
%15 = load i64, i64* %5
%16 = getelementptr inbounds i8*, i8** %14, i64 %15
%17 = load i8*, i8** %16
%18 = icmp ne i8* %17, null
br label %19
19: ; preds = %13, %9
%20 = phi i1 [ false, %9 ], [ %18, %13 ]
br i1 %20, label %21, label %40
21: ; preds = %19
%22 = load i8**, i8*** %3
%23 = load i64, i64* %5
%24 = getelementptr inbounds i8*, i8** %22, i64 %23
%25 = load i8*, i8** %24
%26 = icmp ne i8* null, %25
br i1 %26, label %27, label %33
27: ; preds = %21
%28 = load i8**, i8*** %3
%29 = load i64, i64* %5
%30 = getelementptr inbounds i8*, i8** %28, i64 %29
%31 = load i8*, i8** %30
%32 = call i32 @free(i8* %31)
br label %33
33: ; preds = %27, %21
%34 = load i8**, i8*** %3
%35 = load i64, i64* %5
%36 = getelementptr inbounds i8*, i8** %34, i64 %35
store i8* null, i8** %36
br label %37
37: ; preds = %33
%38 = load i64, i64* %5
%39 = add i64 %38, 1
store i64 %39, i64* %5
br label %9
40: ; preds = %19
br label %41
41: ; preds = %40, %2
ret void
}

LLVM IR (-O2):
define void @gbdbg_free_text_lookup(i8** %0, i64 %1) {
%3 = icmp ne i8** %0, null
%4 = icmp ne i64 %1, 0
%5 = and i1 %3, %4
br i1 %5, label %6, label %15
6: ; preds = %2, %11
%7 = phi i64 [ %13, %11 ], [ 0, %2 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = tail call i32 @free(i8* %9)
store i8* null, i8** %8
%13 = add nuw i64 %7, 1
%14 = icmp eq i64 %13, %1
br i1 %14, label %15, label %6
15: ; preds = %11, %6, %2
ret void
}