#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 udev_enumerate {
  int dummy;
};
struct udev {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ test_enumerate_print_list(struct udev_enumerate *);
int /*<<< orphan*/
udev_enumerate_add_match_is_initialized(struct udev_enumerate *);
int /*<<< orphan*/ udev_enumerate_add_match_property(struct udev_enumerate *,
                                                     char *, char *);
int /*<<< orphan*/ udev_enumerate_add_match_subsystem(struct udev_enumerate *,
                                                      char const *);
int /*<<< orphan*/ udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *,
                                                        char *);
int /*<<< orphan*/ udev_enumerate_add_syspath(struct udev_enumerate *, char *);
struct udev_enumerate *udev_enumerate_new(struct udev *);
int /*<<< orphan*/ udev_enumerate_scan_devices(struct udev_enumerate *);
int /*<<< orphan*/ udev_enumerate_scan_subsystems(struct udev_enumerate *);
int /*<<< orphan*/ udev_enumerate_unref(struct udev_enumerate *);
int test_enumerate(struct udev *udev, const char *subsystem) {
  struct udev_enumerate *udev_enumerate;
  printf("enumerate '%s'\n", subsystem == NULL ? "<all>" : subsystem);
  udev_enumerate = udev_enumerate_new(udev);
  if (udev_enumerate == NULL)
    return -1;
  udev_enumerate_add_match_subsystem(udev_enumerate, subsystem);
  udev_enumerate_scan_devices(udev_enumerate);
  test_enumerate_print_list(udev_enumerate);
  udev_enumerate_unref(udev_enumerate);
  printf("enumerate 'net' + duplicated scan + null + zero\n");
  udev_enumerate = udev_enumerate_new(udev);
  if (udev_enumerate == NULL)
    return -1;
  udev_enumerate_add_match_subsystem(udev_enumerate, "net");
  udev_enumerate_scan_devices(udev_enumerate);
  udev_enumerate_scan_devices(udev_enumerate);
  udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero");
  udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null");
  udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero");
  udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null");
  udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero");
  udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null");
  udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null");
  udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero");
  udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero");
  udev_enumerate_scan_devices(udev_enumerate);
  test_enumerate_print_list(udev_enumerate);
  udev_enumerate_unref(udev_enumerate);
  printf("enumerate 'block'\n");
  udev_enumerate = udev_enumerate_new(udev);
  if (udev_enumerate == NULL)
    return -1;
  udev_enumerate_add_match_subsystem(udev_enumerate, "block");
  udev_enumerate_add_match_is_initialized(udev_enumerate);
  udev_enumerate_scan_devices(udev_enumerate);
  test_enumerate_print_list(udev_enumerate);
  udev_enumerate_unref(udev_enumerate);
  printf("enumerate 'not block'\n");
  udev_enumerate = udev_enumerate_new(udev);
  if (udev_enumerate == NULL)
    return -1;
  udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block");
  udev_enumerate_scan_devices(udev_enumerate);
  test_enumerate_print_list(udev_enumerate);
  udev_enumerate_unref(udev_enumerate);
  printf("enumerate 'pci, mem, vc'\n");
  udev_enumerate = udev_enumerate_new(udev);
  if (udev_enumerate == NULL)
    return -1;
  udev_enumerate_add_match_subsystem(udev_enumerate, "pci");
  udev_enumerate_add_match_subsystem(udev_enumerate, "mem");
  udev_enumerate_add_match_subsystem(udev_enumerate, "vc");
  udev_enumerate_scan_devices(udev_enumerate);
  test_enumerate_print_list(udev_enumerate);
  udev_enumerate_unref(udev_enumerate);
  printf("enumerate 'subsystem'\n");
  udev_enumerate = udev_enumerate_new(udev);
  if (udev_enumerate == NULL)
    return -1;
  udev_enumerate_scan_subsystems(udev_enumerate);
  test_enumerate_print_list(udev_enumerate);
  udev_enumerate_unref(udev_enumerate);
  printf("enumerate 'property IF_FS_*=filesystem'\n");
  udev_enumerate = udev_enumerate_new(udev);
  if (udev_enumerate == NULL)
    return -1;
  udev_enumerate_add_match_property(udev_enumerate, "ID_FS*", "filesystem");
  udev_enumerate_scan_devices(udev_enumerate);
  test_enumerate_print_list(udev_enumerate);
  udev_enumerate_unref(udev_enumerate);
  return 0;
}


x86 assembly (clang, -O0):
<test_enumerate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11db <test_enumerate+0x2b>
lea    0xe3e(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11e3 <test_enumerate+0x33>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1219 <test_enumerate+0x69>
movl   $0xffffffff,-0x4(%rbp)
jmp    1538 <test_enumerate+0x388>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10b0 <udev_enumerate_add_match_subsystem@plt>
mov    -0x20(%rbp),%rdi
call   1060 <udev_enumerate_scan_devices@plt>
mov    -0x20(%rbp),%rdi
call   1050 <test_enumerate_print_list@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <udev_enumerate_unref@plt>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1273 <test_enumerate+0xc3>
movl   $0xffffffff,-0x4(%rbp)
jmp    1538 <test_enumerate+0x388>
mov    -0x20(%rbp),%rdi
lea    0xdc9(%rip),%rsi
call   10b0 <udev_enumerate_add_match_subsystem@plt>
mov    -0x20(%rbp),%rdi
call   1060 <udev_enumerate_scan_devices@plt>
mov    -0x20(%rbp),%rdi
call   1060 <udev_enumerate_scan_devices@plt>
mov    -0x20(%rbp),%rdi
lea    0xdab(%rip),%rsi
call   1080 <udev_enumerate_add_syspath@plt>
mov    -0x20(%rbp),%rdi
lea    0xdaf(%rip),%rsi
call   1080 <udev_enumerate_add_syspath@plt>
mov    -0x20(%rbp),%rdi
lea    0xd8b(%rip),%rsi
call   1080 <udev_enumerate_add_syspath@plt>
mov    -0x20(%rbp),%rdi
lea    0xd8f(%rip),%rsi
call   1080 <udev_enumerate_add_syspath@plt>
mov    -0x20(%rbp),%rdi
lea    0xd6b(%rip),%rsi
call   1080 <udev_enumerate_add_syspath@plt>
mov    -0x20(%rbp),%rdi
lea    0xd6f(%rip),%rsi
call   1080 <udev_enumerate_add_syspath@plt>
mov    -0x20(%rbp),%rdi
lea    0xd5f(%rip),%rsi
call   1080 <udev_enumerate_add_syspath@plt>
mov    -0x20(%rbp),%rdi
lea    0xd3b(%rip),%rsi
call   1080 <udev_enumerate_add_syspath@plt>
mov    -0x20(%rbp),%rdi
lea    0xd2b(%rip),%rsi
call   1080 <udev_enumerate_add_syspath@plt>
mov    -0x20(%rbp),%rdi
call   1060 <udev_enumerate_scan_devices@plt>
mov    -0x20(%rbp),%rdi
call   1050 <test_enumerate_print_list@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <udev_enumerate_unref@plt>
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1372 <test_enumerate+0x1c2>
movl   $0xffffffff,-0x4(%rbp)
jmp    1538 <test_enumerate+0x388>
mov    -0x20(%rbp),%rdi
lea    0xd09(%rip),%rsi
call   10b0 <udev_enumerate_add_match_subsystem@plt>
mov    -0x20(%rbp),%rdi
call   10c0 <udev_enumerate_add_match_is_initialized@plt>
mov    -0x20(%rbp),%rdi
call   1060 <udev_enumerate_scan_devices@plt>
mov    -0x20(%rbp),%rdi
call   1050 <test_enumerate_print_list@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <udev_enumerate_unref@plt>
lea    0xcdf(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    13d8 <test_enumerate+0x228>
movl   $0xffffffff,-0x4(%rbp)
jmp    1538 <test_enumerate+0x388>
mov    -0x20(%rbp),%rdi
lea    0xca3(%rip),%rsi
call   1090 <udev_enumerate_add_nomatch_subsystem@plt>
mov    -0x20(%rbp),%rdi
call   1060 <udev_enumerate_scan_devices@plt>
mov    -0x20(%rbp),%rdi
call   1050 <test_enumerate_print_list@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <udev_enumerate_unref@plt>
lea    0xc99(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1435 <test_enumerate+0x285>
movl   $0xffffffff,-0x4(%rbp)
jmp    1538 <test_enumerate+0x388>
mov    -0x20(%rbp),%rdi
lea    0xc7d(%rip),%rsi
call   10b0 <udev_enumerate_add_match_subsystem@plt>
mov    -0x20(%rbp),%rdi
lea    0xc71(%rip),%rsi
call   10b0 <udev_enumerate_add_match_subsystem@plt>
mov    -0x20(%rbp),%rdi
lea    0xc65(%rip),%rsi
call   10b0 <udev_enumerate_add_match_subsystem@plt>
mov    -0x20(%rbp),%rdi
call   1060 <udev_enumerate_scan_devices@plt>
mov    -0x20(%rbp),%rdi
call   1050 <test_enumerate_print_list@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <udev_enumerate_unref@plt>
lea    0xc41(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    14b2 <test_enumerate+0x302>
movl   $0xffffffff,-0x4(%rbp)
jmp    1538 <test_enumerate+0x388>
mov    -0x20(%rbp),%rdi
call   1040 <udev_enumerate_scan_subsystems@plt>
mov    -0x20(%rbp),%rdi
call   1050 <test_enumerate_print_list@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <udev_enumerate_unref@plt>
lea    0xc0b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    14ff <test_enumerate+0x34f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1538 <test_enumerate+0x388>
mov    -0x20(%rbp),%rdi
lea    0xbfe(%rip),%rsi
lea    0xbfe(%rip),%rdx
call   1030 <udev_enumerate_add_match_property@plt>
mov    -0x20(%rbp),%rdi
call   1060 <udev_enumerate_scan_devices@plt>
mov    -0x20(%rbp),%rdi
call   1050 <test_enumerate_print_list@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <udev_enumerate_unref@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_enumerate>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r15
test   %rsi,%rsi
lea    0xe38(%rip),%rsi
cmovne %rbx,%rsi
lea    0xe1d(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15,%rdi
call   10b0 <udev_enumerate_new@plt>
mov    $0xffffffff,%r14d
test   %rax,%rax
je     146b <test_enumerate+0x2ab>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   10c0 <udev_enumerate_add_match_subsystem@plt>
mov    %rbp,%rdi
call   1070 <udev_enumerate_scan_devices@plt>
mov    %rbp,%rdi
call   1060 <test_enumerate_print_list@plt>
mov    %rbp,%rdi
call   10e0 <udev_enumerate_unref@plt>
lea    0xe37(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10b0 <udev_enumerate_new@plt>
test   %rax,%rax
je     146b <test_enumerate+0x2ab>
mov    %rax,%rbp
lea    0xdc8(%rip),%rsi
mov    %rax,%rdi
call   10c0 <udev_enumerate_add_match_subsystem@plt>
mov    %rbp,%rdi
call   1070 <udev_enumerate_scan_devices@plt>
mov    %rbp,%rdi
call   1070 <udev_enumerate_scan_devices@plt>
lea    0xdad(%rip),%r12
mov    %rbp,%rdi
mov    %r12,%rsi
call   1090 <udev_enumerate_add_syspath@plt>
lea    0xdaf(%rip),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <udev_enumerate_add_syspath@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1090 <udev_enumerate_add_syspath@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <udev_enumerate_add_syspath@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1090 <udev_enumerate_add_syspath@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <udev_enumerate_add_syspath@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <udev_enumerate_add_syspath@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1090 <udev_enumerate_add_syspath@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1090 <udev_enumerate_add_syspath@plt>
mov    %rbp,%rdi
call   1070 <udev_enumerate_scan_devices@plt>
mov    %rbp,%rdi
call   1060 <test_enumerate_print_list@plt>
mov    %rbp,%rdi
call   10e0 <udev_enumerate_unref@plt>
lea    0xd9f(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10b0 <udev_enumerate_new@plt>
test   %rax,%rax
je     146b <test_enumerate+0x2ab>
mov    %rax,%rbx
lea    0xd2c(%rip),%rsi
mov    %rax,%rdi
call   10c0 <udev_enumerate_add_match_subsystem@plt>
mov    %rbx,%rdi
call   10d0 <udev_enumerate_add_match_is_initialized@plt>
mov    %rbx,%rdi
call   1070 <udev_enumerate_scan_devices@plt>
mov    %rbx,%rdi
call   1060 <test_enumerate_print_list@plt>
mov    %rbx,%rdi
call   10e0 <udev_enumerate_unref@plt>
lea    0xd62(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10b0 <udev_enumerate_new@plt>
test   %rax,%rax
je     146b <test_enumerate+0x2ab>
mov    %rax,%rbx
lea    0xcdd(%rip),%rsi
mov    %rax,%rdi
call   10a0 <udev_enumerate_add_nomatch_subsystem@plt>
mov    %rbx,%rdi
call   1070 <udev_enumerate_scan_devices@plt>
mov    %rbx,%rdi
call   1060 <test_enumerate_print_list@plt>
mov    %rbx,%rdi
call   10e0 <udev_enumerate_unref@plt>
lea    0xd31(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10b0 <udev_enumerate_new@plt>
test   %rax,%rax
je     146b <test_enumerate+0x2ab>
mov    %rax,%rbx
lea    0xc9c(%rip),%rsi
mov    %rax,%rdi
call   10c0 <udev_enumerate_add_match_subsystem@plt>
lea    0xc91(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <udev_enumerate_add_match_subsystem@plt>
lea    0xc86(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <udev_enumerate_add_match_subsystem@plt>
mov    %rbx,%rdi
call   1070 <udev_enumerate_scan_devices@plt>
mov    %rbx,%rdi
call   1060 <test_enumerate_print_list@plt>
mov    %rbx,%rdi
call   10e0 <udev_enumerate_unref@plt>
lea    0xce5(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10b0 <udev_enumerate_new@plt>
test   %rax,%rax
je     146b <test_enumerate+0x2ab>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <udev_enumerate_scan_subsystems@plt>
mov    %rbx,%rdi
call   1060 <test_enumerate_print_list@plt>
mov    %rbx,%rdi
call   10e0 <udev_enumerate_unref@plt>
lea    0xcc7(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10b0 <udev_enumerate_new@plt>
test   %rax,%rax
je     146b <test_enumerate+0x2ab>
mov    %rax,%rbx
lea    0xc12(%rip),%rsi
lea    0xc12(%rip),%rdx
mov    %rax,%rdi
call   1030 <udev_enumerate_add_match_property@plt>
mov    %rbx,%rdi
call   1070 <udev_enumerate_scan_devices@plt>
mov    %rbx,%rdi
call   1060 <test_enumerate_print_list@plt>
mov    %rbx,%rdi
call   10e0 <udev_enumerate_unref@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.udev = type { i32 }
%struct.udev_enumerate = type { i32 }
@.str = [16 x i8] c"enumerate '%s'\0A\00"
@.str.1 = [6 x i8] c"<all>\00"
@.str.2 = [49 x i8] c"enumerate 'net' + duplicated scan + null + zero\0A\00"
@.str.3 = [4 x i8] c"net\00"
@.str.4 = [20 x i8] c"/sys/class/mem/zero\00"
@.str.5 = [20 x i8] c"/sys/class/mem/null\00"
@.str.6 = [19 x i8] c"enumerate 'block'\0A\00"
@.str.7 = [6 x i8] c"block\00"
@.str.8 = [23 x i8] c"enumerate 'not block'\0A\00"
@.str.9 = [26 x i8] c"enumerate 'pci, mem, vc'\0A\00"
@.str.10 = [4 x i8] c"pci\00"
@.str.11 = [4 x i8] c"mem\00"
@.str.12 = [3 x i8] c"vc\00"
@.str.13 = [23 x i8] c"enumerate 'subsystem'\0A\00"
@.str.14 = [41 x i8] c"enumerate 'property IF_FS_*=filesystem'\0A\00"
@.str.15 = [7 x i8] c"ID_FS*\00"
@.str.16 = [11 x i8] c"filesystem\00"
define i32 @test_enumerate(%struct.udev* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.udev*
%5 = alloca i8*
%6 = alloca %struct.udev_enumerate*
store %struct.udev* %0, %struct.udev** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
br label %12
10: ; preds = %2
%11 = load i8*, i8** %5
br label %12
12: ; preds = %10, %9
%13 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %9 ], [ %11, %10 ]
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load %struct.udev*, %struct.udev** %4
%16 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %15)
store %struct.udev_enumerate* %16, %struct.udev_enumerate** %6
%17 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%18 = icmp eq %struct.udev_enumerate* %17, null
br i1 %18, label %19, label %20
19: ; preds = %12
store i32 -1, i32* %3
br label %146
20: ; preds = %12
%21 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%22 = load i8*, i8** %5
%23 = call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %21, i8* %22)
%24 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%25 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %24)
%26 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%27 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %26)
%28 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%29 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%31 = load %struct.udev*, %struct.udev** %4
%32 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %31)
store %struct.udev_enumerate* %32, %struct.udev_enumerate** %6
%33 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%34 = icmp eq %struct.udev_enumerate* %33, null
br i1 %34, label %35, label %36
35: ; preds = %20
store i32 -1, i32* %3
br label %146
36: ; preds = %20
%37 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%38 = call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%39 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%40 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %39)
%41 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%42 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %41)
%43 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%44 = call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %43, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%45 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%46 = call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %45, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%47 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%48 = call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %47, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%49 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%50 = call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %49, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%51 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%52 = call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %51, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%53 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%54 = call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %53, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%55 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%56 = call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %55, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%57 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%58 = call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %57, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%59 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%60 = call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %59, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%61 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%62 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %61)
%63 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%64 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %63)
%65 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%66 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%68 = load %struct.udev*, %struct.udev** %4
%69 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %68)
store %struct.udev_enumerate* %69, %struct.udev_enumerate** %6
%70 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%71 = icmp eq %struct.udev_enumerate* %70, null
br i1 %71, label %72, label %73
72: ; preds = %36
store i32 -1, i32* %3
br label %146
73: ; preds = %36
%74 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%75 = call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %74, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%76 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%77 = call i32 @udev_enumerate_add_match_is_initialized(%struct.udev_enumerate* %76)
%78 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%79 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %78)
%80 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%81 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %80)
%82 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%83 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %82)
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%85 = load %struct.udev*, %struct.udev** %4
%86 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %85)
store %struct.udev_enumerate* %86, %struct.udev_enumerate** %6
%87 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%88 = icmp eq %struct.udev_enumerate* %87, null
br i1 %88, label %89, label %90
89: ; preds = %73
store i32 -1, i32* %3
br label %146
90: ; preds = %73
%91 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%92 = call i32 @udev_enumerate_add_nomatch_subsystem(%struct.udev_enumerate* %91, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%93 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%94 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %93)
%95 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%96 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %95)
%97 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%98 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %97)
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%100 = load %struct.udev*, %struct.udev** %4
%101 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %100)
store %struct.udev_enumerate* %101, %struct.udev_enumerate** %6
%102 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%103 = icmp eq %struct.udev_enumerate* %102, null
br i1 %103, label %104, label %105
104: ; preds = %90
store i32 -1, i32* %3
br label %146
105: ; preds = %90
%106 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%107 = call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %106, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%108 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%109 = call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %108, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%110 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%111 = call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %110, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%112 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%113 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %112)
%114 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%115 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %114)
%116 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%117 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %116)
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
%119 = load %struct.udev*, %struct.udev** %4
%120 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %119)
store %struct.udev_enumerate* %120, %struct.udev_enumerate** %6
%121 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%122 = icmp eq %struct.udev_enumerate* %121, null
br i1 %122, label %123, label %124
123: ; preds = %105
store i32 -1, i32* %3
br label %146
124: ; preds = %105
%125 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%126 = call i32 @udev_enumerate_scan_subsystems(%struct.udev_enumerate* %125)
%127 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%128 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %127)
%129 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%130 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %129)
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.14, i64 0, i64 0))
%132 = load %struct.udev*, %struct.udev** %4
%133 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %132)
store %struct.udev_enumerate* %133, %struct.udev_enumerate** %6
%134 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%135 = icmp eq %struct.udev_enumerate* %134, null
br i1 %135, label %136, label %137
136: ; preds = %124
store i32 -1, i32* %3
br label %146
137: ; preds = %124
%138 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%139 = call i32 @udev_enumerate_add_match_property(%struct.udev_enumerate* %138, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
%140 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%141 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %140)
%142 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%143 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %142)
%144 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%145 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %144)
store i32 0, i32* %3
br label %146
146: ; preds = %137, %136, %123, %104, %89, %72, %35, %19
%147 = load i32, i32* %3
ret i32 %147
}

LLVM IR (-O2):
%struct.udev = type { i32 }
%struct.udev_enumerate = type { i32 }
@.str = [16 x i8] c"enumerate '%s'\0A\00"
@.str.1 = [6 x i8] c"<all>\00"
@.str.3 = [4 x i8] c"net\00"
@.str.4 = [20 x i8] c"/sys/class/mem/zero\00"
@.str.5 = [20 x i8] c"/sys/class/mem/null\00"
@.str.7 = [6 x i8] c"block\00"
@.str.10 = [4 x i8] c"pci\00"
@.str.11 = [4 x i8] c"mem\00"
@.str.12 = [3 x i8] c"vc\00"
@.str.15 = [7 x i8] c"ID_FS*\00"
@.str.16 = [11 x i8] c"filesystem\00"
@str = [48 x i8] c"enumerate 'net' + duplicated scan + null + zero\00"
@str.17 = [18 x i8] c"enumerate 'block'\00"
@str.18 = [22 x i8] c"enumerate 'not block'\00"
@str.19 = [25 x i8] c"enumerate 'pci, mem, vc'\00"
@str.20 = [22 x i8] c"enumerate 'subsystem'\00"
@str.21 = [40 x i8] c"enumerate 'property IF_FS_*=filesystem'\00"
define i32 @test_enumerate(%struct.udev* %0, i8* %1) {
%3 = icmp eq i8* %1, null
%4 = select i1 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%7 = icmp eq %struct.udev_enumerate* %6, null
br i1 %7, label %74, label %8
8: ; preds = %2
%9 = tail call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %6, i8* %1)
%10 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %6)
%11 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %6)
%12 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %6)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%14 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%15 = icmp eq %struct.udev_enumerate* %14, null
br i1 %15, label %74, label %16
16: ; preds = %8
%17 = tail call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %14)
%19 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %14)
%20 = tail call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%21 = tail call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%22 = tail call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%23 = tail call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%24 = tail call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%25 = tail call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%26 = tail call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%27 = tail call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%28 = tail call i32 @udev_enumerate_add_syspath(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%29 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %14)
%30 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %14)
%31 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %14)
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.17, i64 0, i64 0))
%33 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%34 = icmp eq %struct.udev_enumerate* %33, null
br i1 %34, label %74, label %35
35: ; preds = %16
%36 = tail call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%37 = tail call i32 @udev_enumerate_add_match_is_initialized(%struct.udev_enumerate* %33)
%38 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %33)
%39 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %33)
%40 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %33)
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.18, i64 0, i64 0))
%42 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%43 = icmp eq %struct.udev_enumerate* %42, null
br i1 %43, label %74, label %44
44: ; preds = %35
%45 = tail call i32 @udev_enumerate_add_nomatch_subsystem(%struct.udev_enumerate* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%46 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %42)
%47 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %42)
%48 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %42)
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.19, i64 0, i64 0))
%50 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%51 = icmp eq %struct.udev_enumerate* %50, null
br i1 %51, label %74, label %52
52: ; preds = %44
%53 = tail call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%54 = tail call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%55 = tail call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%56 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %50)
%57 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %50)
%58 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %50)
%59 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.20, i64 0, i64 0))
%60 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%61 = icmp eq %struct.udev_enumerate* %60, null
br i1 %61, label %74, label %62
62: ; preds = %52
%63 = tail call i32 @udev_enumerate_scan_subsystems(%struct.udev_enumerate* %60)
%64 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %60)
%65 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %60)
%66 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.21, i64 0, i64 0))
%67 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%68 = icmp eq %struct.udev_enumerate* %67, null
br i1 %68, label %74, label %69
69: ; preds = %62
%70 = tail call i32 @udev_enumerate_add_match_property(%struct.udev_enumerate* %67, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
%71 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %67)
%72 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %67)
%73 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %67)
br label %74
74: ; preds = %62, %52, %44, %35, %16, %8, %2, %69
%75 = phi i32 [ 0, %69 ], [ -1, %2 ], [ -1, %8 ], [ -1, %16 ], [ -1, %35 ], [ -1, %44 ], [ -1, %52 ], [ -1, %62 ]
ret i32 %75
}