#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 */
typedef size_t u_int;
typedef int /*<<< orphan*/ ****queue;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ ******);
void freeq(struct queue **namelist, u_int nitems) {
  u_int i;
  if (namelist == NULL)
    return;
  for (i = 0; i < nitems; i++)
    if (namelist[i])
      free(namelist[i]);
  free(namelist);
}


x86 assembly (clang, -O0):
<freeq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1130 <freeq+0x20>
jmp    1189 <freeq+0x79>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1180 <freeq+0x70>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     116a <freeq+0x5a>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    116f <freeq+0x5f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1138 <freeq+0x28>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeq>:
test   %rdi,%rdi
je     1156 <freeq+0x46>
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
test   %rsi,%rsi
je     1149 <freeq+0x39>
xor    %ebx,%ebx
jmp    1139 <freeq+0x29>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%r14
je     1149 <freeq+0x39>
mov    (%r15,%rbx,8),%rdi
test   %rdi,%rdi
je     1130 <freeq+0x20>
call   1030 <free@plt>
jmp    1130 <freeq+0x20>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
ret

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

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