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

/* Variables and functions */
int /*<<< orphan*/ dealloclibvirtentry(struct libvirtentry *);
int /*<<< orphan*/ free(struct libvirtentry **);
void dealloclibvirtentryarray(struct libvirtentry **entries,
                              struct libvirtentry *keep, int keepentries) {
  struct libvirtentry **start = entries;
  if (!keepentries) {
    while (*entries != NULL) {
      if (*entries != keep)
        dealloclibvirtentry(*entries);
      entries++;
    }
  }
  free(start);
}


x86 assembly (clang, -O0):
<dealloclibvirtentryarray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    118b <dealloclibvirtentryarray+0x6b>
jmp    114a <dealloclibvirtentryarray+0x2a>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1186 <dealloclibvirtentryarray+0x66>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
je     1175 <dealloclibvirtentryarray+0x55>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <dealloclibvirtentry@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    114a <dealloclibvirtentryarray+0x2a>
jmp    118b <dealloclibvirtentryarray+0x6b>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dealloclibvirtentryarray>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %edx,%edx
je     1139 <dealloclibvirtentryarray+0x19>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
mov    (%r14),%rdi
test   %rdi,%rdi
je     112c <dealloclibvirtentryarray+0xc>
mov    %rsi,%r15
lea    0x8(%r14),%rbx
jmp    115c <dealloclibvirtentryarray+0x3c>
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     112c <dealloclibvirtentryarray+0xc>
cmp    %r15,%rdi
je     1150 <dealloclibvirtentryarray+0x30>
call   1040 <dealloclibvirtentry@plt>
jmp    1150 <dealloclibvirtentryarray+0x30>

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

LLVM IR (-O2):
%struct.libvirtentry = type { i32 }
define void @dealloclibvirtentryarray(%struct.libvirtentry** nocapture %0, %struct.libvirtentry* readnone %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = load %struct.libvirtentry*, %struct.libvirtentry** %0
%7 = icmp eq %struct.libvirtentry* %6, null
br i1 %7, label %18, label %8
8: ; preds = %5, %14
%9 = phi %struct.libvirtentry* [ %16, %14 ], [ %6, %5 ]
%10 = phi %struct.libvirtentry** [ %15, %14 ], [ %0, %5 ]
%11 = icmp eq %struct.libvirtentry* %9, %1
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = tail call i32 @dealloclibvirtentry(%struct.libvirtentry* %9)
br label %14
14: ; preds = %12, %8
%15 = getelementptr inbounds %struct.libvirtentry*, %struct.libvirtentry** %10, i64 1
%16 = load %struct.libvirtentry*, %struct.libvirtentry** %15
%17 = icmp eq %struct.libvirtentry* %16, null
br i1 %17, label %18, label %8
18: ; preds = %14, %5, %3
%19 = tail call i32 @free(%struct.libvirtentry** %0)
ret void
}