#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 **);
int /*<<< orphan*/ string_destroy(char **);
void string_list_destroy(char ***list) {
  if (*list) {
    size_t i = 0;
    while ((*list)[i])
      string_destroy(&(*list)[i++]);
    free(*list);
    *list = 0;
  }
}


x86 assembly (clang, -O0):
<string_list_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1196 <string_list_destroy+0x76>
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     117f <string_list_destroy+0x5f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
shl    $0x3,%rax
add    %rax,%rdi
call   1040 <string_destroy@plt>
jmp    1142 <string_list_destroy+0x22>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_list_destroy>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1186 <string_list_destroy+0x66>
cmpq   $0x0,(%rdi)
je     1174 <string_list_destroy+0x54>
mov    $0x8,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbx),%r12
call   1040 <string_destroy@plt>
mov    (%r14),%rax
lea    (%rax,%rbx,8),%rdi
add    $0x8,%rdi
cmpq   $0x0,(%rax,%r15,1)
lea    0x8(%r15),%r15
mov    %r12,%rbx
jne    1150 <string_list_destroy+0x30>
jmp    1177 <string_list_destroy+0x57>
mov    %rdi,%rax
mov    %rax,%rdi
call   1030 <free@plt>
movq   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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