#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 */
typedef scalar_t__ strs;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_all_strs(char **strs) {
  for (size_t i = 0; i < ((strs) ? ((size_t *)(strs)-2)[1] : 0); ++i) {
    free(strs[i]);
  }
}


x86 assembly (clang, -O0):
<free_all_strs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1148 <free_all_strs+0x38>
mov    -0x8(%rbp),%rax
mov    -0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1153 <free_all_strs+0x43>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1153 <free_all_strs+0x43>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jae    1186 <free_all_strs+0x76>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <free_all_strs+0x14>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_all_strs>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
test   %r14,%r14
je     1130 <free_all_strs+0x20>
xchg   %ax,%ax
mov    -0x8(%r14),%rax
cmp    %rax,%rbx
jb     1137 <free_all_strs+0x27>
jmp    114b <free_all_strs+0x3b>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
cmp    %rax,%rbx
jae    114b <free_all_strs+0x3b>
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
test   %r14,%r14
jne    1120 <free_all_strs+0x10>
jmp    1130 <free_all_strs+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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