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

/* Variables and functions */
int /*<<< orphan*/ clearQueueHNodes(struct QueueHNodes *);
int /*<<< orphan*/ free(struct QueueHNodes *);
void freeQueueHNodes(struct QueueHNodes **queue) {
  if (!queue)
    return;
  if (*queue) {
    clearQueueHNodes(*queue);
    free(*queue);
  }
  *queue = NULL;
}


x86 assembly (clang, -O0):
<freeQueueHNodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <freeQueueHNodes+0x1c>
jmp    116d <freeQueueHNodes+0x4d>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1162 <freeQueueHNodes+0x42>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <clearQueueHNodes@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):
<freeQueueHNodes>:
test   %rdi,%rdi
je     1146 <freeQueueHNodes+0x26>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     113e <freeQueueHNodes+0x1e>
call   1040 <clearQueueHNodes@plt>
mov    (%rbx),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

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