#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_list_entry {
  int dummy;
};
struct udev_device {
  int dummy;
};
struct udev {
  int dummy;
};
struct stat {
  scalar_t__ st_rdev;
};
typedef int /*<<< orphan*/ partitionname;

/* Variables and functions */
int /*<<< orphan*/ name_index(struct udev *, int /*<<< orphan*/, char *,
                              int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, int);
scalar_t__ stat(char const *, struct stat *);
struct udev_list_entry *
udev_device_get_devlinks_list_entry(struct udev_device *);
char *udev_device_get_devnode(struct udev_device *);
scalar_t__ udev_device_get_devnum(struct udev_device *);
int /*<<< orphan*/ udev_device_get_devpath(struct udev_device *);
int udev_device_get_num_fake_partitions(struct udev_device *);
struct udev *udev_device_get_udev(struct udev_device *);
char *udev_list_entry_get_name(struct udev_list_entry *);
struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *);
int /*<<< orphan*/ udev_log_null(struct udev *, char *, char const *, ...);
int /*<<< orphan*/ update_link(struct udev_device *, char *);
int /*<<< orphan*/ util_delete_path(struct udev *, char const *);
int util_unlink_secure(struct udev *, char const *);
int udev_node_remove(struct udev_device *dev) {
  struct udev *udev = udev_device_get_udev(dev);
  struct udev_list_entry *list_entry;
  const char *devnode;
  char partitionname[1024];
  struct stat stats;
  int err = 0;
  int num;
  name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev),
             0);
  for (list_entry = udev_device_get_devlinks_list_entry(dev);
       list_entry != NULL; list_entry = udev_list_entry_get_next(list_entry)) {
    name_index(udev, udev_device_get_devpath(dev),
               udev_list_entry_get_name(list_entry), 0);
    update_link(dev, udev_list_entry_get_name(list_entry));
  }
  devnode = udev_device_get_devnode(dev);
  if (devnode == NULL)
    return 0;
  if (stat(devnode, &stats) != 0) {
    udev_log_null(udev, "device node '%s' not found\n", devnode);
    return 0;
  }
  if (stats.st_rdev != udev_device_get_devnum(dev)) {
    udev_log_null(
        udev, "device node '%s' points to a different device, skip removal\n",
        devnode);
    return -1;
  }
  udev_log_null(udev, "removing device node '%s'\n", devnode);
  err = util_unlink_secure(udev, devnode);
  if (err)
    return err;
  num = udev_device_get_num_fake_partitions(dev);
  if (num > 0) {
    int i;
    udev_log_null(udev, "removing all_partitions '%s[1-%i]'\n", devnode, num);
    if (num > 255)
      return -1;
    for (i = 1; i <= num; i++) {
      snprintf(partitionname, sizeof(partitionname), "%s%d", devnode, i);
      partitionname[sizeof(partitionname) - 1] = '\0';
      util_unlink_secure(udev, partitionname);
    }
  }
  util_delete_path(udev, devnode);
  return err;
}


x86 assembly (clang, -O0):
<udev_node_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <udev_device_get_udev@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x43c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x450(%rbp)
mov    -0x10(%rbp),%rdi
call   1100 <udev_device_get_devpath@plt>
mov    %eax,-0x448(%rbp)
mov    -0x10(%rbp),%rdi
call   10f0 <udev_device_get_devnode@plt>
mov    -0x450(%rbp),%rdi
mov    -0x448(%rbp),%esi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1110 <name_index@plt>
mov    -0x10(%rbp),%rdi
call   1080 <udev_device_get_devlinks_list_entry@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     12d7 <udev_node_remove+0xe7>
mov    -0x18(%rbp),%rax
mov    %rax,-0x468(%rbp)
mov    -0x10(%rbp),%rdi
call   1100 <udev_device_get_devpath@plt>
mov    %eax,-0x45c(%rbp)
mov    -0x20(%rbp),%rdi
call   10e0 <udev_list_entry_get_name@plt>
mov    -0x468(%rbp),%rdi
mov    -0x45c(%rbp),%esi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1110 <name_index@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x458(%rbp)
mov    -0x20(%rbp),%rdi
call   10e0 <udev_list_entry_get_name@plt>
mov    -0x458(%rbp),%rdi
mov    %rax,%rsi
call   1060 <update_link@plt>
mov    -0x20(%rbp),%rdi
call   10b0 <udev_list_entry_get_next@plt>
mov    %rax,-0x20(%rbp)
jmp    125d <udev_node_remove+0x6d>
mov    -0x10(%rbp),%rdi
call   10f0 <udev_device_get_devnode@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12fb <udev_node_remove+0x10b>
movl   $0x0,-0x4(%rbp)
jmp    149d <udev_node_remove+0x2ad>
mov    -0x28(%rbp),%rdi
lea    -0x438(%rbp),%rsi
call   10a0 <stat@plt>
cmp    $0x0,%rax
je     1337 <udev_node_remove+0x147>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xcdc(%rip),%rsi
mov    $0x0,%al
call   1040 <udev_log_null@plt>
movl   $0x0,-0x4(%rbp)
jmp    149d <udev_node_remove+0x2ad>
mov    -0x438(%rbp),%rax
mov    %rax,-0x470(%rbp)
mov    -0x10(%rbp),%rdi
call   10c0 <udev_device_get_devnum@plt>
mov    %rax,%rcx
mov    -0x470(%rbp),%rax
cmp    %rcx,%rax
je     1383 <udev_node_remove+0x193>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xcac(%rip),%rsi
mov    $0x0,%al
call   1040 <udev_log_null@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149d <udev_node_remove+0x2ad>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xcc7(%rip),%rsi
mov    $0x0,%al
call   1040 <udev_log_null@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1090 <util_unlink_secure@plt>
mov    %eax,-0x43c(%rbp)
cmpl   $0x0,-0x43c(%rbp)
je     13c7 <udev_node_remove+0x1d7>
mov    -0x43c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    149d <udev_node_remove+0x2ad>
mov    -0x10(%rbp),%rdi
call   10d0 <udev_device_get_num_fake_partitions@plt>
mov    %eax,-0x440(%rbp)
cmpl   $0x0,-0x440(%rbp)
jle    1487 <udev_node_remove+0x297>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x440(%rbp),%ecx
lea    0xc7c(%rip),%rsi
mov    $0x0,%al
call   1040 <udev_log_null@plt>
cmpl   $0xff,-0x440(%rbp)
jle    141b <udev_node_remove+0x22b>
movl   $0xffffffff,-0x4(%rbp)
jmp    149d <udev_node_remove+0x2ad>
movl   $0x1,-0x444(%rbp)
mov    -0x444(%rbp),%eax
cmp    -0x440(%rbp),%eax
jg     1482 <udev_node_remove+0x292>
lea    -0x430(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    -0x444(%rbp),%r8d
mov    $0x400,%esi
lea    0xc43(%rip),%rdx
call   1050 <snprintf@plt>
movb   $0x0,-0x31(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x430(%rbp),%rsi
call   1090 <util_unlink_secure@plt>
mov    -0x444(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x444(%rbp)
jmp    1425 <udev_node_remove+0x235>
jmp    1487 <udev_node_remove+0x297>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <util_delete_path@plt>
mov    -0x43c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udev_node_remove>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rdi,%r13
call   1030 <udev_device_get_udev@plt>
mov    %rax,%r14
mov    %r13,%rdi
call   1100 <udev_device_get_devpath@plt>
mov    %eax,%ebp
mov    %r13,%rdi
call   10f0 <udev_device_get_devnode@plt>
xor    %r12d,%r12d
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1110 <name_index@plt>
mov    %r13,%rdi
call   1080 <udev_device_get_devlinks_list_entry@plt>
test   %rax,%rax
je     1284 <udev_node_remove+0x94>
mov    %rax,%rbp
mov    %r13,%rdi
call   1100 <udev_device_get_devpath@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   10e0 <udev_list_entry_get_name@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1110 <name_index@plt>
mov    %rbp,%rdi
call   10e0 <udev_list_entry_get_name@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1060 <update_link@plt>
mov    %rbp,%rdi
call   10b0 <udev_list_entry_get_next@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1240 <udev_node_remove+0x50>
mov    %r13,%rdi
call   10f0 <udev_device_get_devnode@plt>
test   %rax,%rax
je     13b4 <udev_node_remove+0x1c4>
mov    %rax,%r15
lea    0x8(%rsp),%rsi
mov    %rax,%rdi
call   10a0 <stat@plt>
test   %rax,%rax
je     12c6 <udev_node_remove+0xd6>
lea    0xd4f(%rip),%rsi
xor    %r12d,%r12d
mov    %r14,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <udev_log_null@plt>
jmp    13b4 <udev_node_remove+0x1c4>
mov    0x8(%rsp),%rbx
mov    %r13,%rdi
call   10c0 <udev_device_get_devnum@plt>
cmp    %rax,%rbx
jne    139a <udev_node_remove+0x1aa>
lea    0xd76(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <udev_log_null@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <util_unlink_secure@plt>
mov    %eax,%r12d
test   %eax,%eax
jne    13b4 <udev_node_remove+0x1c4>
mov    %r13,%rdi
call   10d0 <udev_device_get_num_fake_partitions@plt>
test   %eax,%eax
jle    138a <udev_node_remove+0x19a>
mov    %eax,%r13d
lea    0xd58(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <udev_log_null@plt>
mov    $0xffffffff,%r12d
cmp    $0xff,%r13d
ja     13b4 <udev_node_remove+0x1c4>
neg    %r13d
mov    $0x1,%ebp
lea    0xd4f(%rip),%r12
lea    0x10(%rsp),%rbx
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %ebp,%r8d
call   1050 <snprintf@plt>
movb   $0x0,0x40f(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <util_unlink_secure@plt>
lea    0x1(%r13,%rbp,1),%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1350 <udev_node_remove+0x160>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <util_delete_path@plt>
xor    %r12d,%r12d
jmp    13b4 <udev_node_remove+0x1c4>
lea    0xc7b(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <udev_log_null@plt>
mov    $0xffffffff,%r12d
mov    %r12d,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.udev_device = type { i32 }
%struct.udev = type { i32 }
%struct.udev_list_entry = type { i32 }
%struct.stat = type { i64 }
@.str = [28 x i8] c"device node '%s' not found\0A\00"
@.str.1 = [61 x i8] c"device node '%s' points to a different device, skip removal\0A\00"
@.str.2 = [27 x i8] c"removing device node '%s'\0A\00"
@.str.3 = [36 x i8] c"removing all_partitions '%s[1-%i]'\0A\00"
@.str.4 = [5 x i8] c"%s%d\00"
define i32 @udev_node_remove(%struct.udev_device* %0) {
%2 = alloca i32
%3 = alloca %struct.udev_device*
%4 = alloca %struct.udev*
%5 = alloca %struct.udev_list_entry*
%6 = alloca i8*
%7 = alloca [1024 x i8]
%8 = alloca %struct.stat
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store %struct.udev_device* %0, %struct.udev_device** %3
%12 = load %struct.udev_device*, %struct.udev_device** %3
%13 = call %struct.udev* @udev_device_get_udev(%struct.udev_device* %12)
store %struct.udev* %13, %struct.udev** %4
store i32 0, i32* %9
%14 = load %struct.udev*, %struct.udev** %4
%15 = load %struct.udev_device*, %struct.udev_device** %3
%16 = call i32 @udev_device_get_devpath(%struct.udev_device* %15)
%17 = load %struct.udev_device*, %struct.udev_device** %3
%18 = call i8* @udev_device_get_devnode(%struct.udev_device* %17)
%19 = call i32 @name_index(%struct.udev* %14, i32 %16, i8* %18, i32 0)
%20 = load %struct.udev_device*, %struct.udev_device** %3
%21 = call %struct.udev_list_entry* @udev_device_get_devlinks_list_entry(%struct.udev_device* %20)
store %struct.udev_list_entry* %21, %struct.udev_list_entry** %5
br label %22
22: ; preds = %36, %1
%23 = load %struct.udev_list_entry*, %struct.udev_list_entry** %5
%24 = icmp ne %struct.udev_list_entry* %23, null
br i1 %24, label %25, label %39
25: ; preds = %22
%26 = load %struct.udev*, %struct.udev** %4
%27 = load %struct.udev_device*, %struct.udev_device** %3
%28 = call i32 @udev_device_get_devpath(%struct.udev_device* %27)
%29 = load %struct.udev_list_entry*, %struct.udev_list_entry** %5
%30 = call i8* @udev_list_entry_get_name(%struct.udev_list_entry* %29)
%31 = call i32 @name_index(%struct.udev* %26, i32 %28, i8* %30, i32 0)
%32 = load %struct.udev_device*, %struct.udev_device** %3
%33 = load %struct.udev_list_entry*, %struct.udev_list_entry** %5
%34 = call i8* @udev_list_entry_get_name(%struct.udev_list_entry* %33)
%35 = call i32 @update_link(%struct.udev_device* %32, i8* %34)
br label %36
36: ; preds = %25
%37 = load %struct.udev_list_entry*, %struct.udev_list_entry** %5
%38 = call %struct.udev_list_entry* @udev_list_entry_get_next(%struct.udev_list_entry* %37)
store %struct.udev_list_entry* %38, %struct.udev_list_entry** %5
br label %22
39: ; preds = %22
%40 = load %struct.udev_device*, %struct.udev_device** %3
%41 = call i8* @udev_device_get_devnode(%struct.udev_device* %40)
store i8* %41, i8** %6
%42 = load i8*, i8** %6
%43 = icmp eq i8* %42, null
br i1 %43, label %44, label %45
44: ; preds = %39
store i32 0, i32* %2
br label %110
45: ; preds = %39
%46 = load i8*, i8** %6
%47 = call i64 @stat(i8* %46, %struct.stat* %8)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %53
49: ; preds = %45
%50 = load %struct.udev*, %struct.udev** %4
%51 = load i8*, i8** %6
%52 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %50, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %51)
store i32 0, i32* %2
br label %110
53: ; preds = %45
%54 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%55 = load i64, i64* %54
%56 = load %struct.udev_device*, %struct.udev_device** %3
%57 = call i64 @udev_device_get_devnum(%struct.udev_device* %56)
%58 = icmp ne i64 %55, %57
br i1 %58, label %59, label %63
59: ; preds = %53
%60 = load %struct.udev*, %struct.udev** %4
%61 = load i8*, i8** %6
%62 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %60, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i8* %61)
store i32 -1, i32* %2
br label %110
63: ; preds = %53
%64 = load %struct.udev*, %struct.udev** %4
%65 = load i8*, i8** %6
%66 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %64, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %65)
%67 = load %struct.udev*, %struct.udev** %4
%68 = load i8*, i8** %6
%69 = call i32 @util_unlink_secure(%struct.udev* %67, i8* %68)
store i32 %69, i32* %9
%70 = load i32, i32* %9
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %63
%73 = load i32, i32* %9
store i32 %73, i32* %2
br label %110
74: ; preds = %63
%75 = load %struct.udev_device*, %struct.udev_device** %3
%76 = call i32 @udev_device_get_num_fake_partitions(%struct.udev_device* %75)
store i32 %76, i32* %10
%77 = load i32, i32* %10
%78 = icmp sgt i32 %77, 0
br i1 %78, label %79, label %105
79: ; preds = %74
%80 = load %struct.udev*, %struct.udev** %4
%81 = load i8*, i8** %6
%82 = load i32, i32* %10
%83 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %80, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %81, i32 %82)
%84 = load i32, i32* %10
%85 = icmp sgt i32 %84, 255
br i1 %85, label %86, label %87
86: ; preds = %79
store i32 -1, i32* %2
br label %110
87: ; preds = %79
store i32 1, i32* %11
br label %88
88: ; preds = %101, %87
%89 = load i32, i32* %11
%90 = load i32, i32* %10
%91 = icmp sle i32 %89, %90
br i1 %91, label %92, label %104
92: ; preds = %88
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%94 = load i8*, i8** %6
%95 = load i32, i32* %11
%96 = call i32 @snprintf(i8* %93, i32 1024, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %94, i32 %95)
%97 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 1023
store i8 0, i8* %97
%98 = load %struct.udev*, %struct.udev** %4
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%100 = call i32 @util_unlink_secure(%struct.udev* %98, i8* %99)
br label %101
101: ; preds = %92
%102 = load i32, i32* %11
%103 = add nsw i32 %102, 1
store i32 %103, i32* %11
br label %88
104: ; preds = %88
br label %105
105: ; preds = %104, %74
%106 = load %struct.udev*, %struct.udev** %4
%107 = load i8*, i8** %6
%108 = call i32 @util_delete_path(%struct.udev* %106, i8* %107)
%109 = load i32, i32* %9
store i32 %109, i32* %2
br label %110
110: ; preds = %105, %86, %72, %59, %49, %44
%111 = load i32, i32* %2
ret i32 %111
}

LLVM IR (-O2):
%struct.udev_device = type { i32 }
%struct.stat = type { i64 }
%struct.udev = type { i32 }
%struct.udev_list_entry = type { i32 }
@.str = [28 x i8] c"device node '%s' not found\0A\00"
@.str.1 = [61 x i8] c"device node '%s' points to a different device, skip removal\0A\00"
@.str.2 = [27 x i8] c"removing device node '%s'\0A\00"
@.str.3 = [36 x i8] c"removing all_partitions '%s[1-%i]'\0A\00"
@.str.4 = [5 x i8] c"%s%d\00"
define i32 @udev_node_remove(%struct.udev_device* %0) {
%2 = alloca [1024 x i8]
%3 = alloca %struct.stat
%4 = tail call %struct.udev* @udev_device_get_udev(%struct.udev_device* %0)
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = bitcast %struct.stat* %3 to i8*
%7 = tail call i32 @udev_device_get_devpath(%struct.udev_device* %0)
%8 = tail call i8* @udev_device_get_devnode(%struct.udev_device* %0)
%9 = tail call i32 @name_index(%struct.udev* %4, i32 %7, i8* %8, i32 0)
%10 = tail call %struct.udev_list_entry* @udev_device_get_devlinks_list_entry(%struct.udev_device* %0)
%11 = icmp eq %struct.udev_list_entry* %10, null
br i1 %11, label %21, label %12
12: ; preds = %1, %12
%13 = phi %struct.udev_list_entry* [ %19, %12 ], [ %10, %1 ]
%14 = tail call i32 @udev_device_get_devpath(%struct.udev_device* %0)
%15 = tail call i8* @udev_list_entry_get_name(%struct.udev_list_entry* %13)
%16 = tail call i32 @name_index(%struct.udev* %4, i32 %14, i8* %15, i32 0)
%17 = tail call i8* @udev_list_entry_get_name(%struct.udev_list_entry* %13)
%18 = tail call i32 @update_link(%struct.udev_device* %0, i8* %17)
%19 = tail call %struct.udev_list_entry* @udev_list_entry_get_next(%struct.udev_list_entry* %13)
%20 = icmp eq %struct.udev_list_entry* %19, null
br i1 %20, label %21, label %12
21: ; preds = %12, %1
%22 = tail call i8* @udev_device_get_devnode(%struct.udev_device* %0)
%23 = icmp eq i8* %22, null
br i1 %23, label %56, label %24
24: ; preds = %21
%25 = call i64 @stat(i8* %22, %struct.stat* %3)
%26 = icmp eq i64 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %24
%28 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %22)
br label %56
29: ; preds = %24
%30 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%31 = load i64, i64* %30
%32 = call i64 @udev_device_get_devnum(%struct.udev_device* %0)
%33 = icmp eq i64 %31, %32
br i1 %33, label %36, label %34
34: ; preds = %29
%35 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %4, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %56
36: ; preds = %29
%37 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %4, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%38 = call i32 @util_unlink_secure(%struct.udev* %4, i8* %22)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %56
40: ; preds = %36
%41 = call i32 @udev_device_get_num_fake_partitions(%struct.udev_device* %0)
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %54
43: ; preds = %40
%44 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %4, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %22, i32 %41)
%45 = icmp ugt i32 %41, 255
br i1 %45, label %56, label %46
46: ; preds = %43
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 1023
br label %48
48: ; preds = %46, %48
%49 = phi i32 [ 1, %46 ], [ %52, %48 ]
%50 = call i32 @snprintf(i8* %5, i32 1024, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %22, i32 %49)
store i8 0, i8* %47
%51 = call i32 @util_unlink_secure(%struct.udev* %4, i8* %5)
%52 = add nuw i32 %49, 1
%53 = icmp eq i32 %49, %41
br i1 %53, label %54, label %48
54: ; preds = %48, %40
%55 = call i32 @util_delete_path(%struct.udev* %4, i8* %22)
br label %56
56: ; preds = %43, %36, %21, %54, %34, %27
%57 = phi i32 [ 0, %27 ], [ -1, %34 ], [ 0, %54 ], [ 0, %21 ], [ %38, %36 ], [ -1, %43 ]
ret i32 %57
}