#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;
  int st_mode;
};
typedef int /*<<< orphan*/ filename;

/* Variables and functions */
int /*<<< orphan*/ link_update(struct udev_device *, int /*<<< orphan*/,
                               int /*<<< orphan*/);
int major(scalar_t__);
int minor(scalar_t__);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, int, int);
scalar_t__ stat(char const *, struct stat *);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
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_subsystem(struct udev_device *);
int /*<<< orphan*/ udev_device_get_syspath(struct udev_device *);
struct udev *udev_device_get_udev(struct udev_device *);
struct udev_device *udev_device_new_from_syspath(struct udev *,
                                                 int /*<<< orphan*/);
int /*<<< orphan*/ udev_device_unref(struct udev_device *);
char *udev_get_dev_path(struct udev *);
int /*<<< orphan*/ 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*/ unlink(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;
  struct stat stats;
  struct udev_device *dev_check;
  char filename[1024];
  int err = 0;
  for (list_entry = udev_device_get_devlinks_list_entry(dev);
       list_entry != NULL; list_entry = udev_list_entry_get_next(list_entry))
    link_update(dev, udev_list_entry_get_name(list_entry), 0);
  devnode = udev_device_get_devnode(dev);
  if (devnode == NULL)
    goto out;
  if (stat(devnode, &stats) == 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);
      err = -1;
      goto out;
    }
    if (stats.st_mode & 01000) {
      udev_log_null(udev, "device node '%s' has sticky bit set, skip removal\n",
                    devnode);
      goto out;
    }
  } else {
    udev_log_null(udev, "device node '%s' not found\n", devnode);
  }
  dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev));
  if (dev_check != NULL) {
    udev_log_null(udev, "keeping device node of existing device'%s'\n",
                  devnode);
    udev_device_unref(dev_check);
    goto out;
  }
  udev_log_null(udev, "removing device node '%s'\n", devnode);
  err = util_unlink_secure(udev, devnode);
  if (err == 0)
    util_delete_path(udev, devnode);
  snprintf(
      filename, sizeof(filename), "%s/%s/%u:%u", udev_get_dev_path(udev),
      strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char",
      major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)));
  unlink(filename);
out:
  return err;
}


x86 assembly (clang, -O0):
<udev_node_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <udev_device_get_udev@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x444(%rbp)
mov    -0x8(%rbp),%rdi
call   10d0 <udev_device_get_devlinks_list_entry@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     12c4 <udev_node_remove+0x74>
mov    -0x8(%rbp),%rax
mov    %rax,-0x450(%rbp)
mov    -0x18(%rbp),%rdi
call   1160 <udev_list_entry_get_name@plt>
mov    -0x450(%rbp),%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1040 <link_update@plt>
mov    -0x18(%rbp),%rdi
call   1120 <udev_list_entry_get_next@plt>
mov    %rax,-0x18(%rbp)
jmp    1283 <udev_node_remove+0x33>
mov    -0x8(%rbp),%rdi
call   1170 <udev_device_get_devnode@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12e1 <udev_node_remove+0x91>
jmp    14d2 <udev_node_remove+0x282>
mov    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1100 <stat@plt>
cmp    $0x0,%rax
jne    1371 <udev_node_remove+0x121>
mov    -0x30(%rbp),%rax
mov    %rax,-0x458(%rbp)
mov    -0x8(%rbp),%rdi
call   1150 <udev_device_get_devnum@plt>
mov    %rax,%rcx
mov    -0x458(%rbp),%rax
cmp    %rcx,%rax
je     1342 <udev_node_remove+0xf2>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xcd2(%rip),%rsi
call   1070 <udev_log_null@plt>
movl   $0xffffffff,-0x444(%rbp)
ff ff ff
jmp    14d2 <udev_node_remove+0x282>
mov    -0x28(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
je     136c <udev_node_remove+0x11c>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xcdb(%rip),%rsi
call   1070 <udev_log_null@plt>
jmp    14d2 <udev_node_remove+0x282>
jmp    1385 <udev_node_remove+0x135>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xcf0(%rip),%rsi
call   1070 <udev_log_null@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x460(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <udev_device_get_syspath@plt>
mov    -0x460(%rbp),%rdi
mov    %eax,%esi
call   1130 <udev_device_new_from_syspath@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     13d8 <udev_node_remove+0x188>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xcc7(%rip),%rsi
call   1070 <udev_log_null@plt>
mov    -0x38(%rbp),%rdi
call   1140 <udev_device_unref@plt>
jmp    14d2 <udev_node_remove+0x282>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xcd1(%rip),%rsi
call   1070 <udev_log_null@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10e0 <util_unlink_secure@plt>
mov    %eax,-0x444(%rbp)
cmpl   $0x0,-0x444(%rbp)
jne    1419 <udev_node_remove+0x1c9>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <util_delete_path@plt>
lea    -0x440(%rbp),%rax
mov    %rax,-0x480(%rbp)
mov    -0x10(%rbp),%rdi
call   1110 <udev_get_dev_path@plt>
mov    %rax,-0x478(%rbp)
mov    -0x8(%rbp),%rdi
call   10b0 <udev_device_get_subsystem@plt>
mov    %eax,%edi
lea    0xc96(%rip),%rsi
call   10f0 <strcmp@plt>
mov    %rax,%rdx
lea    0xc8d(%rip),%rax
lea    0xc80(%rip),%rcx
cmp    $0x0,%rdx
cmove  %rcx,%rax
mov    %rax,-0x470(%rbp)
mov    -0x8(%rbp),%rdi
call   1150 <udev_device_get_devnum@plt>
mov    %rax,%rdi
call   10a0 <major@plt>
mov    %eax,-0x464(%rbp)
mov    -0x8(%rbp),%rdi
call   1150 <udev_device_get_devnum@plt>
mov    %rax,%rdi
call   1080 <minor@plt>
mov    -0x480(%rbp),%rdi
mov    -0x478(%rbp),%rcx
mov    -0x470(%rbp),%r8
mov    -0x464(%rbp),%r9d
mov    $0x400,%esi
lea    0xc15(%rip),%rdx
mov    %eax,(%rsp)
call   1090 <snprintf@plt>
lea    -0x440(%rbp),%rdi
call   1060 <unlink@plt>
mov    -0x444(%rbp),%eax
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udev_node_remove>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x420,%rsp
mov    %rdi,%rbx
call   1050 <udev_device_get_udev@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   10d0 <udev_device_get_devlinks_list_entry@plt>
test   %rax,%rax
je     12a4 <udev_node_remove+0x54>
mov    %rax,%rbp
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1160 <udev_list_entry_get_name@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1040 <link_update@plt>
mov    %rbp,%rdi
call   1120 <udev_list_entry_get_next@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1280 <udev_node_remove+0x30>
mov    %rbx,%rdi
call   1170 <udev_device_get_devnode@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     1417 <udev_node_remove+0x1c7>
mov    %rax,%rbp
lea    0x10(%rsp),%rsi
mov    %rax,%rdi
call   1100 <stat@plt>
test   %rax,%rax
je     1318 <udev_node_remove+0xc8>
lea    0xd9c(%rip),%rsi
mov    %r15,%rdi
mov    %rbp,%rdx
call   1070 <udev_log_null@plt>
mov    %rbx,%rdi
call   1030 <udev_device_get_syspath@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1130 <udev_device_new_from_syspath@plt>
test   %rax,%rax
je     134c <udev_node_remove+0xfc>
mov    %rax,%r12
lea    0xd8c(%rip),%rsi
mov    %r15,%rdi
mov    %rbp,%rdx
call   1070 <udev_log_null@plt>
mov    %r12,%rdi
call   1140 <udev_device_unref@plt>
jmp    1417 <udev_node_remove+0x1c7>
mov    0x10(%rsp),%r12
mov    %rbx,%rdi
call   1150 <udev_device_get_devnum@plt>
cmp    %rax,%r12
jne    13ff <udev_node_remove+0x1af>
testb  $0x2,0x19(%rsp)
je     12df <udev_node_remove+0x8f>
lea    0xd01(%rip),%rsi
mov    %r15,%rdi
mov    %rbp,%rdx
call   1070 <udev_log_null@plt>
jmp    1417 <udev_node_remove+0x1c7>
lea    0xd65(%rip),%rsi
mov    %r15,%rdi
mov    %rbp,%rdx
call   1070 <udev_log_null@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   10e0 <util_unlink_secure@plt>
mov    %eax,%r14d
test   %eax,%eax
jne    137b <udev_node_remove+0x12b>
mov    %r15,%rdi
mov    %rbp,%rsi
call   10c0 <util_delete_path@plt>
mov    %r15,%rdi
call   1110 <udev_get_dev_path@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   10b0 <udev_device_get_subsystem@plt>
lea    0xd4a(%rip),%r12
mov    %eax,%edi
mov    %r12,%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
lea    0xd3c(%rip),%rbp
cmove  %r12,%rbp
mov    %rbx,%rdi
call   1150 <udev_device_get_devnum@plt>
mov    %rax,%rdi
call   10a0 <major@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1150 <udev_device_get_devnum@plt>
mov    %rax,%rdi
call   1080 <minor@plt>
mov    %eax,(%rsp)
lea    0xcf9(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rcx
mov    %rbp,%r8
mov    %r12d,%r9d
call   1090 <snprintf@plt>
mov    %rbx,%rdi
call   1060 <unlink@plt>
jmp    1417 <udev_node_remove+0x1c7>
lea    0xbfa(%rip),%rsi
mov    %r15,%rdi
mov    %rbp,%rdx
call   1070 <udev_log_null@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x420,%rsp
pop    %rbx
pop    %r12
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, i32 }
@.str = [61 x i8] c"device node '%s' points to a different device, skip removal\0A\00"
@.str.1 = [51 x i8] c"device node '%s' has sticky bit set, skip removal\0A\00"
@.str.2 = [28 x i8] c"device node '%s' not found\0A\00"
@.str.3 = [44 x i8] c"keeping device node of existing device'%s'\0A\00"
@.str.4 = [27 x i8] c"removing device node '%s'\0A\00"
@.str.5 = [12 x i8] c"%s/%s/%u:%u\00"
@.str.6 = [6 x i8] c"block\00"
@.str.7 = [5 x i8] c"char\00"
define i32 @udev_node_remove(%struct.udev_device* %0) {
%2 = alloca %struct.udev_device*
%3 = alloca %struct.udev*
%4 = alloca %struct.udev_list_entry*
%5 = alloca i8*
%6 = alloca %struct.stat
%7 = alloca %struct.udev_device*
%8 = alloca [1024 x i8]
%9 = alloca i32
store %struct.udev_device* %0, %struct.udev_device** %2
%10 = load %struct.udev_device*, %struct.udev_device** %2
%11 = call %struct.udev* @udev_device_get_udev(%struct.udev_device* %10)
store %struct.udev* %11, %struct.udev** %3
store i32 0, i32* %9
%12 = load %struct.udev_device*, %struct.udev_device** %2
%13 = call %struct.udev_list_entry* @udev_device_get_devlinks_list_entry(%struct.udev_device* %12)
store %struct.udev_list_entry* %13, %struct.udev_list_entry** %4
br label %14
14: ; preds = %22, %1
%15 = load %struct.udev_list_entry*, %struct.udev_list_entry** %4
%16 = icmp ne %struct.udev_list_entry* %15, null
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load %struct.udev_device*, %struct.udev_device** %2
%19 = load %struct.udev_list_entry*, %struct.udev_list_entry** %4
%20 = call i32 @udev_list_entry_get_name(%struct.udev_list_entry* %19)
%21 = call i32 @link_update(%struct.udev_device* %18, i32 %20, i32 0)
br label %22
22: ; preds = %17
%23 = load %struct.udev_list_entry*, %struct.udev_list_entry** %4
%24 = call %struct.udev_list_entry* @udev_list_entry_get_next(%struct.udev_list_entry* %23)
store %struct.udev_list_entry* %24, %struct.udev_list_entry** %4
br label %14
25: ; preds = %14
%26 = load %struct.udev_device*, %struct.udev_device** %2
%27 = call i8* @udev_device_get_devnode(%struct.udev_device* %26)
store i8* %27, i8** %5
%28 = load i8*, i8** %5
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %31
30: ; preds = %25
br label %104
31: ; preds = %25
%32 = load i8*, i8** %5
%33 = call i64 @stat(i8* %32, %struct.stat* %6)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %55
35: ; preds = %31
%36 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%37 = load i64, i64* %36
%38 = load %struct.udev_device*, %struct.udev_device** %2
%39 = call i64 @udev_device_get_devnum(%struct.udev_device* %38)
%40 = icmp ne i64 %37, %39
br i1 %40, label %41, label %45
41: ; preds = %35
%42 = load %struct.udev*, %struct.udev** %3
%43 = load i8*, i8** %5
%44 = call i32 @udev_log_null(%struct.udev* %42, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %43)
store i32 -1, i32* %9
br label %104
45: ; preds = %35
%46 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 1
%47 = load i32, i32* %46
%48 = and i32 %47, 512
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %45
%51 = load %struct.udev*, %struct.udev** %3
%52 = load i8*, i8** %5
%53 = call i32 @udev_log_null(%struct.udev* %51, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %52)
br label %104
54: ; preds = %45
br label %59
55: ; preds = %31
%56 = load %struct.udev*, %struct.udev** %3
%57 = load i8*, i8** %5
%58 = call i32 @udev_log_null(%struct.udev* %56, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %57)
br label %59
59: ; preds = %55, %54
%60 = load %struct.udev*, %struct.udev** %3
%61 = load %struct.udev_device*, %struct.udev_device** %2
%62 = call i32 @udev_device_get_syspath(%struct.udev_device* %61)
%63 = call %struct.udev_device* @udev_device_new_from_syspath(%struct.udev* %60, i32 %62)
store %struct.udev_device* %63, %struct.udev_device** %7
%64 = load %struct.udev_device*, %struct.udev_device** %7
%65 = icmp ne %struct.udev_device* %64, null
br i1 %65, label %66, label %72
66: ; preds = %59
%67 = load %struct.udev*, %struct.udev** %3
%68 = load i8*, i8** %5
%69 = call i32 @udev_log_null(%struct.udev* %67, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i8* %68)
%70 = load %struct.udev_device*, %struct.udev_device** %7
%71 = call i32 @udev_device_unref(%struct.udev_device* %70)
br label %104
72: ; preds = %59
%73 = load %struct.udev*, %struct.udev** %3
%74 = load i8*, i8** %5
%75 = call i32 @udev_log_null(%struct.udev* %73, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %74)
%76 = load %struct.udev*, %struct.udev** %3
%77 = load i8*, i8** %5
%78 = call i32 @util_unlink_secure(%struct.udev* %76, i8* %77)
store i32 %78, i32* %9
%79 = load i32, i32* %9
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %85
81: ; preds = %72
%82 = load %struct.udev*, %struct.udev** %3
%83 = load i8*, i8** %5
%84 = call i32 @util_delete_path(%struct.udev* %82, i8* %83)
br label %85
85: ; preds = %81, %72
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%87 = load %struct.udev*, %struct.udev** %3
%88 = call i8* @udev_get_dev_path(%struct.udev* %87)
%89 = load %struct.udev_device*, %struct.udev_device** %2
%90 = call i32 @udev_device_get_subsystem(%struct.udev_device* %89)
%91 = call i64 @strcmp(i32 %90, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
%93 = zext i1 %92 to i64
%94 = select i1 %92, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0)
%95 = load %struct.udev_device*, %struct.udev_device** %2
%96 = call i64 @udev_device_get_devnum(%struct.udev_device* %95)
%97 = call i32 @major(i64 %96)
%98 = load %struct.udev_device*, %struct.udev_device** %2
%99 = call i64 @udev_device_get_devnum(%struct.udev_device* %98)
%100 = call i32 @minor(i64 %99)
%101 = call i32 @snprintf(i8* %86, i32 1024, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %88, i8* %94, i32 %97, i32 %100)
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%103 = call i32 @unlink(i8* %102)
br label %104
104: ; preds = %85, %66, %50, %41, %30
%105 = load i32, i32* %9
ret i32 %105
}

LLVM IR (-O2):
%struct.udev_device = type { i32 }
%struct.stat = type { i64, i32 }
%struct.udev = type { i32 }
%struct.udev_list_entry = type { i32 }
@.str = [61 x i8] c"device node '%s' points to a different device, skip removal\0A\00"
@.str.1 = [51 x i8] c"device node '%s' has sticky bit set, skip removal\0A\00"
@.str.2 = [28 x i8] c"device node '%s' not found\0A\00"
@.str.3 = [44 x i8] c"keeping device node of existing device'%s'\0A\00"
@.str.4 = [27 x i8] c"removing device node '%s'\0A\00"
@.str.5 = [12 x i8] c"%s/%s/%u:%u\00"
@.str.6 = [6 x i8] c"block\00"
@.str.7 = [5 x i8] c"char\00"
define i32 @udev_node_remove(%struct.udev_device* %0) {
%2 = alloca %struct.stat
%3 = alloca [1024 x i8]
%4 = tail call %struct.udev* @udev_device_get_udev(%struct.udev_device* %0)
%5 = bitcast %struct.stat* %2 to i8*
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = tail call %struct.udev_list_entry* @udev_device_get_devlinks_list_entry(%struct.udev_device* %0)
%8 = icmp eq %struct.udev_list_entry* %7, null
br i1 %8, label %15, label %9
9: ; preds = %1, %9
%10 = phi %struct.udev_list_entry* [ %13, %9 ], [ %7, %1 ]
%11 = tail call i32 @udev_list_entry_get_name(%struct.udev_list_entry* %10)
%12 = tail call i32 @link_update(%struct.udev_device* %0, i32 %11, i32 0)
%13 = tail call %struct.udev_list_entry* @udev_list_entry_get_next(%struct.udev_list_entry* %10)
%14 = icmp eq %struct.udev_list_entry* %13, null
br i1 %14, label %15, label %9
15: ; preds = %9, %1
%16 = tail call i8* @udev_device_get_devnode(%struct.udev_device* %0)
%17 = icmp eq i8* %16, null
br i1 %17, label %62, label %18
18: ; preds = %15
%19 = call i64 @stat(i8* %16, %struct.stat* %2)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %35
21: ; preds = %18
%22 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%23 = load i64, i64* %22
%24 = call i64 @udev_device_get_devnum(%struct.udev_device* %0)
%25 = icmp eq i64 %23, %24
br i1 %25, label %28, label %26
26: ; preds = %21
%27 = call i32 @udev_log_null(%struct.udev* %4, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %62
28: ; preds = %21
%29 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 1
%30 = load i32, i32* %29
%31 = and i32 %30, 512
%32 = icmp eq i32 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %28
%34 = call i32 @udev_log_null(%struct.udev* %4, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %62
35: ; preds = %18
%36 = call i32 @udev_log_null(%struct.udev* %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %37
37: ; preds = %28, %35
%38 = call i32 @udev_device_get_syspath(%struct.udev_device* %0)
%39 = call %struct.udev_device* @udev_device_new_from_syspath(%struct.udev* %4, i32 %38)
%40 = icmp eq %struct.udev_device* %39, null
br i1 %40, label %44, label %41
41: ; preds = %37
%42 = call i32 @udev_log_null(%struct.udev* %4, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%43 = call i32 @udev_device_unref(%struct.udev_device* %39)
br label %62
44: ; preds = %37
%45 = call i32 @udev_log_null(%struct.udev* %4, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %16)
%46 = call i32 @util_unlink_secure(%struct.udev* %4, i8* %16)
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 @util_delete_path(%struct.udev* %4, i8* %16)
br label %50
50: ; preds = %48, %44
%51 = call i8* @udev_get_dev_path(%struct.udev* %4)
%52 = call i32 @udev_device_get_subsystem(%struct.udev_device* %0)
%53 = call i64 @strcmp(i32 %52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
%55 = select i1 %54, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0)
%56 = call i64 @udev_device_get_devnum(%struct.udev_device* %0)
%57 = call i32 @major(i64 %56)
%58 = call i64 @udev_device_get_devnum(%struct.udev_device* %0)
%59 = call i32 @minor(i64 %58)
%60 = call i32 @snprintf(i8* %6, i32 1024, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %51, i8* %55, i32 %57, i32 %59)
%61 = call i32 @unlink(i8* %6)
br label %62
62: ; preds = %15, %50, %41, %33, %26
%63 = phi i32 [ 0, %15 ], [ -1, %26 ], [ 0, %33 ], [ 0, %41 ], [ %46, %50 ]
ret i32 %63
}