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

/* Variables and functions */
int /*<<< orphan*/ free(struct data_item *);
void hash_free(struct data_item **hash) {
  int i;
  for (i = 0; i < 32; i++) {
    if (hash[i]) {
      free(hash[i]);
      hash[i] = NULL;
    }
  }
}


x86 assembly (clang, -O0):
<hash_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1174 <hash_free+0x64>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1161 <hash_free+0x51>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    1166 <hash_free+0x56>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <hash_free+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_free>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
jmp    112a <hash_free+0x1a>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x20,%rbx
je     1142 <hash_free+0x32>
mov    (%r14,%rbx,8),%rdi
test   %rdi,%rdi
je     1120 <hash_free+0x10>
call   1030 <free@plt>
movq   $0x0,(%r14,%rbx,8)
jmp    1120 <hash_free+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.data_item = type { i32 }
define void @hash_free(%struct.data_item** nocapture %0) {
br label %2
2: ; preds = %1, %9
%3 = phi i64 [ 0, %1 ], [ %10, %9 ]
%4 = getelementptr inbounds %struct.data_item*, %struct.data_item** %0, i64 %3
%5 = load %struct.data_item*, %struct.data_item** %4
%6 = icmp eq %struct.data_item* %5, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @free(%struct.data_item* %5)
store %struct.data_item* null, %struct.data_item** %4
br label %9
9: ; preds = %2, %7
%10 = add nuw nsw i64 %3, 1
%11 = icmp eq i64 %10, 32
br i1 %11, label %12, label %2
12: ; preds = %9
ret void
}