#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*/ m_clear(int);
int /*<<< orphan*/ m_free(int);
scalar_t__ m_next(int, int *, char ***);
void m_free_strings(int list, int CLEAR_ONLY) {
  int index;
  char **strp;
  for (index = -1; m_next(list, &index, &strp);) {
    if (*strp)
      free(*strp);
    *strp = NULL;
  }
  if (CLEAR_ONLY)
    m_clear(list);
  else
    m_free(list);
}


x86 assembly (clang, -O0):
<m_free_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xc(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <m_next@plt>
cmp    $0x0,%rax
je     1199 <m_free_strings+0x59>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1189 <m_free_strings+0x49>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
jmp    1155 <m_free_strings+0x15>
cmpl   $0x0,-0x8(%rbp)
je     11b0 <m_free_strings+0x70>
mov    -0x4(%rbp),%edi
call   1050 <m_clear@plt>
jmp    11b8 <m_free_strings+0x78>
mov    -0x4(%rbp),%edi
call   1040 <m_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_free_strings>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r14d
mov    %edi,%ebx
movl   $0xffffffff,0xc(%rsp)
ff
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1060 <m_next@plt>
test   %rax,%rax
je     11b2 <m_free_strings+0x72>
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%rbp
jmp    1199 <m_free_strings+0x59>
nopw   0x0(%rax,%rax,1)
movq   $0x0,(%rax)
mov    %ebx,%edi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1060 <m_next@plt>
test   %rax,%rax
je     11b2 <m_free_strings+0x72>
mov    0x10(%rsp),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     1180 <m_free_strings+0x40>
call   1030 <free@plt>
mov    0x10(%rsp),%rax
jmp    1180 <m_free_strings+0x40>
mov    %ebx,%edi
test   %r14d,%r14d
je     11c0 <m_free_strings+0x80>
call   1050 <m_clear@plt>
jmp    11c5 <m_free_strings+0x85>
call   1040 <m_free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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