#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 */
struct libvirtentry **newentries();
struct libvirtentry **excludeinnew(struct libvirtentry **array,
                                   struct libvirtentry *b) {
  struct libvirtentry **new = newentries();
  struct libvirtentry **start = new;
  struct libvirtentry **ptr = array;
  while (*ptr != NULL) {
    if (b != *ptr) {
      *(new ++) = *ptr;
      *new = NULL;
    }
    ptr++;
  }
  return start;
}


x86 assembly (clang, -O0):
<excludeinnew>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <newentries@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
je     118f <excludeinnew+0x7f>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%rax
je     117e <excludeinnew+0x6e>
mov    -0x28(%rbp),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    113b <excludeinnew+0x2b>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<excludeinnew>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <newentries@plt>
mov    (%rbx),%rcx
test   %rcx,%rcx
je     1162 <excludeinnew+0x52>
add    $0x8,%rbx
mov    %rax,%rdx
jmp    114c <excludeinnew+0x3c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx),%rcx
add    $0x8,%rbx
test   %rcx,%rcx
je     1162 <excludeinnew+0x52>
cmp    %r14,%rcx
je     1140 <excludeinnew+0x30>
mov    %rcx,(%rdx)
movq   $0x0,0x8(%rdx)
add    $0x8,%rdx
jmp    1140 <excludeinnew+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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