#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 *);
void free_cmd(char **argv) {
  int i;
  for (i = 0; i < 4; i++) {
    if (argv[i]) {
      free(argv[i]);
      argv[i] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<free_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1174 <free_cmd+0x64>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1161 <free_cmd+0x51>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    1166 <free_cmd+0x56>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <free_cmd+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_cmd>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1128 <free_cmd+0x18>
call   1030 <free@plt>
movq   $0x0,(%rbx)
mov    0x8(%rbx),%rdi
test   %rdi,%rdi
je     113e <free_cmd+0x2e>
call   1030 <free@plt>
movq   $0x0,0x8(%rbx)
mov    0x10(%rbx),%rdi
test   %rdi,%rdi
je     1154 <free_cmd+0x44>
call   1030 <free@plt>
movq   $0x0,0x10(%rbx)
mov    0x18(%rbx),%rdi
test   %rdi,%rdi
je     116a <free_cmd+0x5a>
call   1030 <free@plt>
movq   $0x0,0x18(%rbx)
pop    %rbx
ret

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

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