#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_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 *);
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 'block'\n");
  udev_enumerate = udev_enumerate_new(udev);
  if (udev_enumerate == NULL)
    return -1;
  udev_enumerate_add_match_subsystem(udev_enumerate, "block");
  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    11bb <test_enumerate+0x2b>
lea    0xe5e(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11c3 <test_enumerate+0x33>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f9 <test_enumerate+0x69>
movl   $0xffffffff,-0x4(%rbp)
jmp    1410 <test_enumerate+0x280>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <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   10b0 <udev_enumerate_unref@plt>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1253 <test_enumerate+0xc3>
movl   $0xffffffff,-0x4(%rbp)
jmp    1410 <test_enumerate+0x280>
mov    -0x20(%rbp),%rdi
lea    0xdcb(%rip),%rsi
call   10a0 <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   10b0 <udev_enumerate_unref@plt>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12b0 <test_enumerate+0x120>
movl   $0xffffffff,-0x4(%rbp)
jmp    1410 <test_enumerate+0x280>
mov    -0x20(%rbp),%rdi
lea    0xd6e(%rip),%rsi
call   1080 <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   10b0 <udev_enumerate_unref@plt>
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    130d <test_enumerate+0x17d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1410 <test_enumerate+0x280>
mov    -0x20(%rbp),%rdi
lea    0xd48(%rip),%rsi
call   10a0 <udev_enumerate_add_match_subsystem@plt>
mov    -0x20(%rbp),%rdi
lea    0xd3c(%rip),%rsi
call   10a0 <udev_enumerate_add_match_subsystem@plt>
mov    -0x20(%rbp),%rdi
lea    0xd30(%rip),%rsi
call   10a0 <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   10b0 <udev_enumerate_unref@plt>
lea    0xd0c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    138a <test_enumerate+0x1fa>
movl   $0xffffffff,-0x4(%rbp)
jmp    1410 <test_enumerate+0x280>
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   10b0 <udev_enumerate_unref@plt>
lea    0xcd6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <udev_enumerate_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    13d7 <test_enumerate+0x247>
movl   $0xffffffff,-0x4(%rbp)
jmp    1410 <test_enumerate+0x280>
mov    -0x20(%rbp),%rdi
lea    0xcc9(%rip),%rsi
lea    0xcc9(%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   10b0 <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   %rbx
push   %rax
mov    %rsi,%rbp
mov    %rdi,%r15
test   %rsi,%rsi
lea    0xe59(%rip),%rsi
cmovne %rbp,%rsi
lea    0xe3e(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15,%rdi
call   10a0 <udev_enumerate_new@plt>
mov    $0xffffffff,%r14d
test   %rax,%rax
je     137a <test_enumerate+0x1da>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   10b0 <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   10c0 <udev_enumerate_unref@plt>
lea    0xe2c(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10a0 <udev_enumerate_new@plt>
test   %rax,%rax
je     137a <test_enumerate+0x1da>
mov    %rax,%rbx
lea    0xde9(%rip),%rsi
mov    %rax,%rdi
call   10b0 <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   10c0 <udev_enumerate_unref@plt>
lea    0xdf7(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10a0 <udev_enumerate_new@plt>
test   %rax,%rax
je     137a <test_enumerate+0x1da>
mov    %rax,%rbx
lea    0xda2(%rip),%rsi
mov    %rax,%rdi
call   1090 <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   10c0 <udev_enumerate_unref@plt>
lea    0xdc6(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10a0 <udev_enumerate_new@plt>
test   %rax,%rax
je     137a <test_enumerate+0x1da>
mov    %rax,%rbp
lea    0xd61(%rip),%rsi
mov    %rax,%rdi
call   10b0 <udev_enumerate_add_match_subsystem@plt>
lea    0xd56(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <udev_enumerate_add_match_subsystem@plt>
lea    0xd4b(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <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   10c0 <udev_enumerate_unref@plt>
lea    0xd7a(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10a0 <udev_enumerate_new@plt>
test   %rax,%rax
je     137a <test_enumerate+0x1da>
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   10c0 <udev_enumerate_unref@plt>
lea    0xd5c(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10a0 <udev_enumerate_new@plt>
test   %rax,%rax
je     137a <test_enumerate+0x1da>
mov    %rax,%rbx
lea    0xcd7(%rip),%rsi
lea    0xcd7(%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   10c0 <udev_enumerate_unref@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
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 = [19 x i8] c"enumerate 'block'\0A\00"
@.str.3 = [6 x i8] c"block\00"
@.str.4 = [23 x i8] c"enumerate 'not block'\0A\00"
@.str.5 = [26 x i8] c"enumerate 'pci, mem, vc'\0A\00"
@.str.6 = [4 x i8] c"pci\00"
@.str.7 = [4 x i8] c"mem\00"
@.str.8 = [3 x i8] c"vc\00"
@.str.9 = [23 x i8] c"enumerate 'subsystem'\0A\00"
@.str.10 = [41 x i8] c"enumerate 'property IF_FS_*=filesystem'\0A\00"
@.str.11 = [7 x i8] c"ID_FS*\00"
@.str.12 = [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 %107
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 ([19 x i8], [19 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 %107
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 ([6 x i8], [6 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 @test_enumerate_print_list(%struct.udev_enumerate* %41)
%43 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%44 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %43)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%46 = load %struct.udev*, %struct.udev** %4
%47 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %46)
store %struct.udev_enumerate* %47, %struct.udev_enumerate** %6
%48 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%49 = icmp eq %struct.udev_enumerate* %48, null
br i1 %49, label %50, label %51
50: ; preds = %36
store i32 -1, i32* %3
br label %107
51: ; preds = %36
%52 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%53 = call i32 @udev_enumerate_add_nomatch_subsystem(%struct.udev_enumerate* %52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%54 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%55 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %54)
%56 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%57 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %56)
%58 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%59 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %58)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%61 = load %struct.udev*, %struct.udev** %4
%62 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %61)
store %struct.udev_enumerate* %62, %struct.udev_enumerate** %6
%63 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%64 = icmp eq %struct.udev_enumerate* %63, null
br i1 %64, label %65, label %66
65: ; preds = %51
store i32 -1, i32* %3
br label %107
66: ; preds = %51
%67 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%68 = call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %67, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%69 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%70 = call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %69, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%71 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%72 = call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %71, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%73 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%74 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %73)
%75 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%76 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %75)
%77 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%78 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %77)
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%80 = load %struct.udev*, %struct.udev** %4
%81 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %80)
store %struct.udev_enumerate* %81, %struct.udev_enumerate** %6
%82 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%83 = icmp eq %struct.udev_enumerate* %82, null
br i1 %83, label %84, label %85
84: ; preds = %66
store i32 -1, i32* %3
br label %107
85: ; preds = %66
%86 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%87 = call i32 @udev_enumerate_scan_subsystems(%struct.udev_enumerate* %86)
%88 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%89 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %88)
%90 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%91 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %90)
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0))
%93 = load %struct.udev*, %struct.udev** %4
%94 = call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %93)
store %struct.udev_enumerate* %94, %struct.udev_enumerate** %6
%95 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%96 = icmp eq %struct.udev_enumerate* %95, null
br i1 %96, label %97, label %98
97: ; preds = %85
store i32 -1, i32* %3
br label %107
98: ; preds = %85
%99 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%100 = call i32 @udev_enumerate_add_match_property(%struct.udev_enumerate* %99, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%101 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%102 = call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %101)
%103 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%104 = call i32 @test_enumerate_print_list(%struct.udev_enumerate* %103)
%105 = load %struct.udev_enumerate*, %struct.udev_enumerate** %6
%106 = call i32 @udev_enumerate_unref(%struct.udev_enumerate* %105)
store i32 0, i32* %3
br label %107
107: ; preds = %98, %97, %84, %65, %50, %35, %19
%108 = load i32, i32* %3
ret i32 %108
}

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 = [6 x i8] c"block\00"
@.str.6 = [4 x i8] c"pci\00"
@.str.7 = [4 x i8] c"mem\00"
@.str.8 = [3 x i8] c"vc\00"
@.str.11 = [7 x i8] c"ID_FS*\00"
@.str.12 = [11 x i8] c"filesystem\00"
@str = [18 x i8] c"enumerate 'block'\00"
@str.13 = [22 x i8] c"enumerate 'not block'\00"
@str.14 = [25 x i8] c"enumerate 'pci, mem, vc'\00"
@str.15 = [22 x i8] c"enumerate 'subsystem'\00"
@str.16 = [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 %54, 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 ([18 x i8], [18 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 %54, label %16
16: ; preds = %8
%17 = tail call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %14)
%19 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %14)
%20 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %14)
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.13, i64 0, i64 0))
%22 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%23 = icmp eq %struct.udev_enumerate* %22, null
br i1 %23, label %54, label %24
24: ; preds = %16
%25 = tail call i32 @udev_enumerate_add_nomatch_subsystem(%struct.udev_enumerate* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%26 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %22)
%27 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %22)
%28 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %22)
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.14, i64 0, i64 0))
%30 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%31 = icmp eq %struct.udev_enumerate* %30, null
br i1 %31, label %54, label %32
32: ; preds = %24
%33 = tail call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%34 = tail call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%35 = tail call i32 @udev_enumerate_add_match_subsystem(%struct.udev_enumerate* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%36 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %30)
%37 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %30)
%38 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %30)
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.15, i64 0, i64 0))
%40 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%41 = icmp eq %struct.udev_enumerate* %40, null
br i1 %41, label %54, label %42
42: ; preds = %32
%43 = tail call i32 @udev_enumerate_scan_subsystems(%struct.udev_enumerate* %40)
%44 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %40)
%45 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %40)
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.16, i64 0, i64 0))
%47 = tail call %struct.udev_enumerate* @udev_enumerate_new(%struct.udev* %0)
%48 = icmp eq %struct.udev_enumerate* %47, null
br i1 %48, label %54, label %49
49: ; preds = %42
%50 = tail call i32 @udev_enumerate_add_match_property(%struct.udev_enumerate* %47, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%51 = tail call i32 @udev_enumerate_scan_devices(%struct.udev_enumerate* %47)
%52 = tail call i32 @test_enumerate_print_list(%struct.udev_enumerate* %47)
%53 = tail call i32 @udev_enumerate_unref(%struct.udev_enumerate* %47)
br label %54
54: ; preds = %42, %32, %24, %16, %8, %2, %49
%55 = phi i32 [ 0, %49 ], [ -1, %2 ], [ -1, %8 ], [ -1, %16 ], [ -1, %24 ], [ -1, %32 ], [ -1, %42 ]
ret i32 %55
}