#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 */
typedef scalar_t__ uint32_t;
struct iscsi_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct iscsi_node **);
int /*<<< orphan*/ iscsi_node_free(struct iscsi_node *);
void iscsi_nodes_free(struct iscsi_node **nodes, uint32_t node_count) {
  uint32_t i = 0;
  if ((nodes == NULL) || (node_count == 0))
    return;
  for (i = 0; i < node_count; ++i)
    iscsi_node_free(nodes[i]);
  free(nodes);
}


x86 assembly (clang, -O0):
<iscsi_nodes_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114e <iscsi_nodes_free+0x2e>
cmpq   $0x0,-0x10(%rbp)
jne    1153 <iscsi_nodes_free+0x33>
jmp    1194 <iscsi_nodes_free+0x74>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    118b <iscsi_nodes_free+0x6b>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <iscsi_node_free@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    115b <iscsi_nodes_free+0x3b>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscsi_nodes_free>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     115f <iscsi_nodes_free+0x3f>
mov    %rsi,%r14
test   %rsi,%rsi
je     115f <iscsi_nodes_free+0x3f>
mov    %rdi,%r15
jle    1152 <iscsi_nodes_free+0x32>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r15,%rbx,8),%rdi
call   1040 <iscsi_node_free@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <iscsi_nodes_free+0x20>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
%struct.iscsi_node = type { i32 }
define void @iscsi_nodes_free(%struct.iscsi_node** %0, i64 %1) {
%3 = icmp eq %struct.iscsi_node** %0, null
%4 = icmp eq i64 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %17, label %6
6: ; preds = %2
%7 = icmp sgt i64 %1, 0
br i1 %7, label %8, label %15
8: ; preds = %6, %8
%9 = phi i64 [ %13, %8 ], [ 0, %6 ]
%10 = getelementptr inbounds %struct.iscsi_node*, %struct.iscsi_node** %0, i64 %9
%11 = load %struct.iscsi_node*, %struct.iscsi_node** %10
%12 = tail call i32 @iscsi_node_free(%struct.iscsi_node* %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %1
br i1 %14, label %15, label %8
15: ; preds = %8, %6
%16 = tail call i32 @free(%struct.iscsi_node** %0)
br label %17
17: ; preds = %2, %15
ret void
}