#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 hash_table {
  int dummy;
};
struct chirp_audit {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/);
int /*<<< orphan*/ hash_table_delete(struct hash_table *);
int /*<<< orphan*/ hash_table_firstkey(struct hash_table *);
scalar_t__ hash_table_nextkey(struct hash_table *, char **, void *);
int /*<<< orphan*/ hash_table_remove(struct hash_table *, char *);
void chirp_audit_delete(struct hash_table *table) {
  char *key;
  struct chirp_audit *entry;
  hash_table_firstkey(table);
  while (hash_table_nextkey(table, &key, (void *)&entry)) {
    free(hash_table_remove(table, key));
  }
  hash_table_delete(table);
}


x86 assembly (clang, -O0):
<chirp_audit_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <hash_table_firstkey@plt>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    -0x10(%rbp),%rsi
call   1040 <hash_table_nextkey@plt>
cmp    $0x0,%rax
je     1199 <chirp_audit_delete+0x49>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <hash_table_remove@plt>
mov    %eax,%edi
call   1030 <free@plt>
jmp    1165 <chirp_audit_delete+0x15>
mov    -0x8(%rbp),%rdi
call   1060 <hash_table_delete@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_audit_delete>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1070 <hash_table_firstkey@plt>
mov    %rsp,%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <hash_table_nextkey@plt>
test   %rax,%rax
je     11a6 <chirp_audit_delete+0x56>
mov    %rsp,%r14
lea    0x8(%rsp),%r15
xchg   %ax,%ax
mov    (%rsp),%rsi
mov    %rbx,%rdi
call   1050 <hash_table_remove@plt>
mov    %eax,%edi
call   1030 <free@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <hash_table_nextkey@plt>
test   %rax,%rax
jne    1180 <chirp_audit_delete+0x30>
mov    %rbx,%rdi
call   1060 <hash_table_delete@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.hash_table = type { i32 }
%struct.chirp_audit = type { i32 }
define void @chirp_audit_delete(%struct.hash_table* %0) {
%2 = alloca %struct.hash_table*
%3 = alloca i8*
%4 = alloca %struct.chirp_audit*
store %struct.hash_table* %0, %struct.hash_table** %2
%5 = load %struct.hash_table*, %struct.hash_table** %2
%6 = call i32 @hash_table_firstkey(%struct.hash_table* %5)
br label %7
7: ; preds = %12, %1
%8 = load %struct.hash_table*, %struct.hash_table** %2
%9 = bitcast %struct.chirp_audit** %4 to i8*
%10 = call i64 @hash_table_nextkey(%struct.hash_table* %8, i8** %3, i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load %struct.hash_table*, %struct.hash_table** %2
%14 = load i8*, i8** %3
%15 = call i32 @hash_table_remove(%struct.hash_table* %13, i8* %14)
%16 = call i32 @free(i32 %15)
br label %7
17: ; preds = %7
%18 = load %struct.hash_table*, %struct.hash_table** %2
%19 = call i32 @hash_table_delete(%struct.hash_table* %18)
ret void
}

LLVM IR (-O2):
%struct.hash_table = type { i32 }
%struct.chirp_audit = type { i32 }
define void @chirp_audit_delete(%struct.hash_table* %0) {
%2 = alloca i8*
%3 = alloca %struct.chirp_audit*
%4 = bitcast i8** %2 to i8*
%5 = bitcast %struct.chirp_audit** %3 to i8*
%6 = tail call i32 @hash_table_firstkey(%struct.hash_table* %0)
%7 = call i64 @hash_table_nextkey(%struct.hash_table* %0, i8** %2, i8* %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %1, %9
%10 = load i8*, i8** %2
%11 = call i32 @hash_table_remove(%struct.hash_table* %0, i8* %10)
%12 = call i32 @free(i32 %11)
%13 = call i64 @hash_table_nextkey(%struct.hash_table* %0, i8** %2, i8* %5)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %9
15: ; preds = %9, %1
%16 = call i32 @hash_table_delete(%struct.hash_table* %0)
ret void
}