#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*/ gbgc_free(int /*<<< orphan*/ *, ...);
void free_strtab(char **tab) {
  int i;
  if (tab == NULL)
    return;
  i = -1;
  while (tab[++i] != NULL)
    gbgc_free(NULL, tab[i]);
  gbgc_free(NULL, tab);
}


x86 assembly (clang, -O0):
<free_strtab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <free_strtab+0x1c>
jmp    1179 <free_strtab+0x69>
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     116a <free_strtab+0x5a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
xor    %eax,%eax
mov    %eax,%edi
mov    $0x0,%al
call   1030 <gbgc_free@plt>
jmp    1133 <free_strtab+0x23>
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
mov    $0x0,%al
call   1030 <gbgc_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_strtab>:
test   %rdi,%rdi
je     1158 <free_strtab+0x48>
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rsi
test   %rsi,%rsi
je     1145 <free_strtab+0x35>
lea    0x8(%r14),%rbx
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
xor    %eax,%eax
call   1030 <gbgc_free@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1130 <free_strtab+0x20>
xor    %edi,%edi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <gbgc_free@plt>
ret

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

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