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

/* Variables and functions */
int /*<<< orphan*/ clearStackHNodes(struct StackHNodes *);
int /*<<< orphan*/ free(struct StackHNodes *);
void freeStackHNodes(struct StackHNodes **stack) {
  if (!stack || !*stack)
    return;
  clearStackHNodes(*stack);
  free(*stack);
  *stack = NULL;
}


x86 assembly (clang, -O0):
<freeStackHNodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1145 <freeStackHNodes+0x25>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    114a <freeStackHNodes+0x2a>
jmp    116d <freeStackHNodes+0x4d>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <clearStackHNodes@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):
<freeStackHNodes>:
push   %rbx
test   %rdi,%rdi
je     1145 <freeStackHNodes+0x25>
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1145 <freeStackHNodes+0x25>
call   1040 <clearStackHNodes@plt>
mov    (%rbx),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

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