#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 QueueHLevels {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ clearQueueHLevels(struct QueueHLevels *);
int /*<<< orphan*/ free(struct QueueHLevels *);
void freeQueueHLevels(struct QueueHLevels **queue) {
  if (!queue)
    return;
  if (*queue) {
    clearQueueHLevels(*queue);
    free(*queue);
  }
  *queue = NULL;
}


x86 assembly (clang, -O0):
<freeQueueHLevels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <freeQueueHLevels+0x1c>
jmp    116d <freeQueueHLevels+0x4d>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1162 <freeQueueHLevels+0x42>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <clearQueueHLevels@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeQueueHLevels>:
test   %rdi,%rdi
je     1146 <freeQueueHLevels+0x26>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     113e <freeQueueHLevels+0x1e>
call   1040 <clearQueueHLevels@plt>
mov    (%rbx),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.QueueHLevels = type { i32 }
define void @freeQueueHLevels(%struct.QueueHLevels** %0) {
%2 = alloca %struct.QueueHLevels**
store %struct.QueueHLevels** %0, %struct.QueueHLevels*** %2
%3 = load %struct.QueueHLevels**, %struct.QueueHLevels*** %2
%4 = icmp ne %struct.QueueHLevels** %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %19
6: ; preds = %1
%7 = load %struct.QueueHLevels**, %struct.QueueHLevels*** %2
%8 = load %struct.QueueHLevels*, %struct.QueueHLevels** %7
%9 = icmp ne %struct.QueueHLevels* %8, null
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load %struct.QueueHLevels**, %struct.QueueHLevels*** %2
%12 = load %struct.QueueHLevels*, %struct.QueueHLevels** %11
%13 = call i32 @clearQueueHLevels(%struct.QueueHLevels* %12)
%14 = load %struct.QueueHLevels**, %struct.QueueHLevels*** %2
%15 = load %struct.QueueHLevels*, %struct.QueueHLevels** %14
%16 = call i32 @free(%struct.QueueHLevels* %15)
br label %17
17: ; preds = %10, %6
%18 = load %struct.QueueHLevels**, %struct.QueueHLevels*** %2
store %struct.QueueHLevels* null, %struct.QueueHLevels** %18
br label %19
19: ; preds = %17, %5
ret void
}

LLVM IR (-O2):
%struct.QueueHLevels = type { i32 }
define void @freeQueueHLevels(%struct.QueueHLevels** %0) {
%2 = icmp eq %struct.QueueHLevels** %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = load %struct.QueueHLevels*, %struct.QueueHLevels** %0
%5 = icmp eq %struct.QueueHLevels* %4, null
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 @clearQueueHLevels(%struct.QueueHLevels* %4)
%8 = load %struct.QueueHLevels*, %struct.QueueHLevels** %0
%9 = tail call i32 @free(%struct.QueueHLevels* %8)
br label %10
10: ; preds = %6, %3
store %struct.QueueHLevels* null, %struct.QueueHLevels** %0
br label %11
11: ; preds = %1, %10
ret void
}