#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 *);
scalar_t__ m_next(int, int *, char ***);
int /*<<< orphan*/ m_setlen(int, int);
void v_kclr(int var) {
  int i = 0;
  char **d;
  while (m_next(var, &i, &d))
    if (*d) {
      free(*d);
      *d = NULL;
    }
  m_setlen(var, 1);
}


x86 assembly (clang, -O0):
<v_kclr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1050 <m_next@plt>
cmp    $0x0,%rax
je     1186 <v_kclr+0x56>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1181 <v_kclr+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
jmp    1142 <v_kclr+0x12>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1040 <m_setlen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v_kclr>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <m_next@plt>
test   %rax,%rax
je     11a2 <v_kclr+0x72>
lea    0x4(%rsp),%r14
lea    0x8(%rsp),%r15
jmp    1182 <v_kclr+0x52>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <m_next@plt>
test   %rax,%rax
je     11a2 <v_kclr+0x72>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     1170 <v_kclr+0x40>
call   1030 <free@plt>
mov    0x8(%rsp),%rax
movq   $0x0,(%rax)
jmp    1170 <v_kclr+0x40>
mov    %ebx,%edi
mov    $0x1,%esi
call   1040 <m_setlen@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @v_kclr(i32 %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast i8*** %3 to i8*
%6 = call i64 @m_next(i32 %0, i32* %2, i8*** %3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %1, %15
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %15, label %12
12: ; preds = %8
%13 = call i32 @free(i8* %10)
%14 = load i8**, i8*** %3
store i8* null, i8** %14
br label %15
15: ; preds = %12, %8
%16 = call i64 @m_next(i32 %0, i32* %2, i8*** %3)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %8
18: ; preds = %15, %1
%19 = call i32 @m_setlen(i32 %0, i32 1)
ret void
}