#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 */
struct arg_hdr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct arg_hdr *);
void arg_freetable(void **argtable, size_t n) {
  struct arg_hdr **table = (struct arg_hdr **)argtable;
  size_t tabindex = 0;
  for (tabindex = 0; tabindex < n; tabindex++) {
    if (table[tabindex] == NULL)
      continue;
    free(table[tabindex]);
    table[tabindex] = NULL;
  };
}


x86 assembly (clang, -O0):
<arg_freetable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1190 <arg_freetable+0x80>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    115e <arg_freetable+0x4e>
jmp    117f <arg_freetable+0x6f>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1138 <arg_freetable+0x28>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_freetable>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     1151 <arg_freetable+0x41>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
jmp    1139 <arg_freetable+0x29>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%r14
je     1151 <arg_freetable+0x41>
mov    (%r15,%rbx,8),%rdi
test   %rdi,%rdi
je     1130 <arg_freetable+0x20>
call   1030 <free@plt>
movq   $0x0,(%r15,%rbx,8)
jmp    1130 <arg_freetable+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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