#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 __disp_arr_free(void *p) {
  struct {
    const int nmemb;
    void *a;
  } *arr_p = p;
  int i;
  for (i = 0; i < arr_p->nmemb; i++) {
    char **a = (char **)(&arr_p->a + i);
    free(*a);
  }
}


x86 assembly (clang, -O0):
<__disp_arr_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    116b <__disp_arr_free+0x5b>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
movslq -0x14(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <__disp_arr_free+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__disp_arr_free>:
push   %r14
push   %rbx
push   %rax
cmpl   $0x0,(%rdi)
jle    1136 <__disp_arr_free+0x26>
mov    %rdi,%r14
xor    %ebx,%ebx
xchg   %ax,%ax
mov    0x8(%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
movslq (%r14),%rax
cmp    %rax,%rbx
jl     1120 <__disp_arr_free+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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