#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 */
typedef scalar_t__ uid_t;
struct udev_device {
  int dummy;
};
struct udev {
  int dummy;
};
struct stat {
  scalar_t__ st_mode;
  scalar_t__ st_rdev;
  scalar_t__ st_uid;
  scalar_t__ st_gid;
};
typedef scalar_t__ mode_t;
typedef scalar_t__ gid_t;
typedef int /*<<< orphan*/ file_tmp;
typedef scalar_t__ dev_t;

/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int ENOENT;
scalar_t__ S_IFBLK;
scalar_t__ S_IFCHR;
scalar_t__ S_IFMT;
int /*<<< orphan*/ chmod(char const *, scalar_t__);
int /*<<< orphan*/ chown(char const *, scalar_t__, scalar_t__);
int errno;
scalar_t__ lstat(char const *, struct stat *);
scalar_t__ major(scalar_t__);
scalar_t__ minor(scalar_t__);
int mknod(char const *, scalar_t__, scalar_t__);
int rename(char *, char const *);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int /*<<< orphan*/ udev_device_get_action(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 *);
struct udev *udev_device_get_udev(struct udev_device *);
int /*<<< orphan*/ udev_log_null(struct udev *, char *, char const *, ...);
int /*<<< orphan*/ udev_selinux_lsetfilecon(struct udev *, char const *,
                                            scalar_t__);
int /*<<< orphan*/ udev_selinux_resetfscreatecon(struct udev *);
int /*<<< orphan*/ udev_selinux_setfscreatecon(struct udev *, char const *,
                                               scalar_t__);
int /*<<< orphan*/ unlink(char *);
int util_create_path_selinux(struct udev *, char const *);
int /*<<< orphan*/ util_strscpyl(char *, int, char const *, char *,
                                 int /*<<< orphan*/ *);
int /*<<< orphan*/ utimensat(int /*<<< orphan*/, char const *,
                             int /*<<< orphan*/ *, int /*<<< orphan*/);
int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode,
                    uid_t uid, gid_t gid) {
  struct udev *udev = udev_device_get_udev(dev);
  dev_t devnum = udev_device_get_devnum(dev);
  struct stat stats;
  int err = 0;
  if (strcmp(udev_device_get_subsystem(dev), "block") == 0)
    mode |= S_IFBLK;
  else
    mode |= S_IFCHR;
  if (file == NULL)
    file = udev_device_get_devnode(dev);
  if (lstat(file, &stats) == 0) {
    if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) &&
        (stats.st_rdev == devnum)) {
      udev_log_null(udev, "preserve file '%s', because it has correct dev_t\n",
                    file);
      if (stats.st_mode != mode || stats.st_uid != uid || stats.st_gid != gid) {
        udev_log_null(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file,
                      mode, uid, gid);
        chmod(file, mode);
        chown(file, uid, gid);
      } else {
        udev_log_null(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n",
                      file, mode, uid, gid);
      }
      if (strcmp(udev_device_get_action(dev), "add") == 0)
        udev_selinux_lsetfilecon(udev, file, mode);
      utimensat(AT_FDCWD, file, NULL, 0);
    } else {
      char file_tmp[1024 + sizeof(".udev-tmp")];
      udev_log_null(udev, "atomically replace existing file '%s'\n", file);
      util_strscpyl(file_tmp, sizeof(file_tmp), file, ".udev-tmp", NULL);
      unlink(file_tmp);
      udev_selinux_setfscreatecon(udev, file_tmp, mode);
      err = mknod(file_tmp, mode, devnum);
      udev_selinux_resetfscreatecon(udev);
      if (err != 0) {
        udev_log_null(udev, "mknod '%s' %u:%u %#o failed: %m\n", file_tmp,
                      major(devnum), minor(devnum), mode);
        goto exit;
      }
      err = rename(file_tmp, file);
      if (err != 0) {
        udev_log_null(udev, "rename '%s' '%s' failed: %m\n", file_tmp, file);
        unlink(file_tmp);
        goto exit;
      }
      udev_log_null(udev, "set permissions '%s' %#o uid=%u gid=%u\n", file,
                    mode, uid, gid);
      chmod(file, mode);
      chown(file, uid, gid);
    }
  } else {
    udev_log_null(udev, "mknod '%s' %u:%u %#o\n", file, major(devnum),
                  minor(devnum), mode);
    do {
      err = util_create_path_selinux(udev, file);
      if (err != 0 && err != -ENOENT)
        break;
      udev_selinux_setfscreatecon(udev, file, mode);
      err = mknod(file, mode, devnum);
      if (err != 0)
        err = -errno;
      udev_selinux_resetfscreatecon(udev);
    } while (err == -ENOENT);
    if (err != 0)
      udev_log_null(udev, "mknod '%s' %u:%u %#o' failed: %m\n", file,
                    major(devnum), minor(devnum), mode);
    udev_log_null(udev, "set permissions '%s' %#o uid=%u gid=%u\n", file, mode,
                  uid, gid);
    chmod(file, mode);
    chown(file, uid, gid);
  }
exit:
  return err;
}


x86 assembly (clang, -O0):
<udev_node_mknod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <udev_device_get_udev@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1110 <udev_device_get_devnum@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <udev_device_get_subsystem@plt>
mov    %eax,%edi
lea    0xd5e(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    12c8 <udev_node_mknod+0x78>
mov    0x2d20(%rip),%rax
mov    (%rax),%rax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    12da <udev_node_mknod+0x8a>
mov    0x2d01(%rip),%rax
mov    (%rax),%rax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    12f2 <udev_node_mknod+0xa2>
mov    -0x8(%rbp),%rdi
call   1170 <udev_device_get_devnode@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   10a0 <lstat@plt>
cmp    $0x0,%rax
jne    15a4 <udev_node_mknod+0x354>
mov    -0x58(%rbp),%rax
mov    0x2ccc(%rip),%rcx
and    (%rcx),%rax
mov    -0x18(%rbp),%rcx
mov    0x2cbe(%rip),%rdx
and    (%rdx),%rcx
cmp    %rcx,%rax
jne    1432 <udev_node_mknod+0x1e2>
mov    -0x50(%rbp),%rax
cmp    -0x38(%rbp),%rax
jne    1432 <udev_node_mknod+0x1e2>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xcbb(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x58(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    137c <udev_node_mknod+0x12c>
mov    -0x48(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    137c <udev_node_mknod+0x12c>
mov    -0x40(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     13c1 <udev_node_mknod+0x171>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    0xca1(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1120 <chmod@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   10f0 <chown@plt>
jmp    13e3 <udev_node_mknod+0x193>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    0xc85(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x8(%rbp),%rdi
call   10c0 <udev_device_get_action@plt>
mov    %eax,%edi
lea    0xc9a(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1415 <udev_node_mknod+0x1c5>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1160 <udev_selinux_lsetfilecon@plt>
mov    0x2b94(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
call   1030 <utimensat@plt>
jmp    159f <udev_node_mknod+0x34f>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xc52(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
lea    -0x470(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x40a,%esi
lea    0xc5b(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1140 <util_strscpyl@plt>
lea    -0x470(%rbp),%rdi
call   1050 <unlink@plt>
mov    -0x30(%rbp),%rdi
lea    -0x470(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1100 <udev_selinux_setfscreatecon@plt>
lea    -0x470(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   10d0 <mknod@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x30(%rbp),%rdi
call   10e0 <udev_selinux_resetfscreatecon@plt>
cmpl   $0x0,-0x5c(%rbp)
je     1514 <udev_node_mknod+0x2c4>
mov    -0x30(%rbp),%rax
mov    %rax,-0x488(%rbp)
lea    -0x470(%rbp),%rax
mov    %rax,-0x480(%rbp)
mov    -0x38(%rbp),%rdi
call   1080 <major@plt>
mov    %rax,-0x478(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <minor@plt>
mov    -0x488(%rbp),%rdi
mov    -0x480(%rbp),%rdx
mov    -0x478(%rbp),%rcx
mov    %rax,%r8
mov    -0x18(%rbp),%r9
lea    0xbbc(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
jmp    1736 <udev_node_mknod+0x4e6>
lea    -0x470(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1150 <rename@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
je     155f <udev_node_mknod+0x30f>
mov    -0x30(%rbp),%rdi
lea    -0x470(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xb9e(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
lea    -0x470(%rbp),%rdi
call   1050 <unlink@plt>
jmp    1736 <udev_node_mknod+0x4e6>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    0xb88(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1120 <chmod@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   10f0 <chown@plt>
jmp    1731 <udev_node_mknod+0x4e1>
mov    -0x30(%rbp),%rax
mov    %rax,-0x4a0(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x498(%rbp)
mov    -0x38(%rbp),%rdi
call   1080 <major@plt>
mov    %rax,-0x490(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <minor@plt>
mov    -0x4a0(%rbp),%rdi
mov    -0x498(%rbp),%rdx
mov    -0x490(%rbp),%rcx
mov    %rax,%r8
mov    -0x18(%rbp),%r9
lea    0xb34(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1130 <util_create_path_selinux@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
je     1632 <udev_node_mknod+0x3e2>
mov    -0x5c(%rbp),%eax
xor    %ecx,%ecx
mov    0x2995(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
je     1632 <udev_node_mknod+0x3e2>
jmp    168e <udev_node_mknod+0x43e>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1100 <udev_selinux_setfscreatecon@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   10d0 <mknod@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
je     166f <udev_node_mknod+0x41f>
xor    %eax,%eax
mov    0x295e(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x30(%rbp),%rdi
call   10e0 <udev_selinux_resetfscreatecon@plt>
mov    -0x5c(%rbp),%eax
xor    %ecx,%ecx
mov    0x2934(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
je     15fd <udev_node_mknod+0x3ad>
cmpl   $0x0,-0x5c(%rbp)
je     16f1 <udev_node_mknod+0x4a1>
mov    -0x30(%rbp),%rax
mov    %rax,-0x4b8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x4b0(%rbp)
mov    -0x38(%rbp),%rdi
call   1080 <major@plt>
mov    %rax,-0x4a8(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <minor@plt>
mov    -0x4b8(%rbp),%rdi
mov    -0x4b0(%rbp),%rdx
mov    -0x4a8(%rbp),%rcx
mov    %rax,%r8
mov    -0x18(%rbp),%r9
lea    0xa56(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    0x9f6(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1120 <chmod@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   10f0 <chown@plt>
jmp    1736 <udev_node_mknod+0x4e6>
mov    -0x5c(%rbp),%eax
add    $0x4c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udev_node_mknod>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x458,%rsp
mov    %r8,%r14
mov    %rcx,0x18(%rsp)
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,%r12
call   1040 <udev_device_get_udev@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1110 <udev_device_get_devnum@plt>
mov    %rax,%r13
mov    %r12,%rdi
call   1090 <udev_device_get_subsystem@plt>
lea    0xd6c(%rip),%rsi
mov    %eax,%edi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    12a9 <udev_node_mknod+0x59>
mov    0x2d31(%rip),%rax
jmp    12b0 <udev_node_mknod+0x60>
mov    0x2d20(%rip),%rax
or     (%rax),%rbp
test   %rbx,%rbx
jne    12c3 <udev_node_mknod+0x73>
mov    %r12,%rdi
call   1170 <udev_device_get_devnode@plt>
mov    %rax,%rbx
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <lstat@plt>
test   %rax,%rax
mov    %rbp,0x8(%rsp)
mov    %r14,0x10(%rsp)
je     13d0 <udev_node_mknod+0x180>
mov    %r13,%rdi
call   1080 <major@plt>
mov    %rax,%r12
mov    %r13,%r14
mov    %r13,%rdi
call   1070 <minor@plt>
lea    0xe2a(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %rax,%r8
mov    %rbp,%r9
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    0x2c9b(%rip),%r13
mov    0x8(%rsp),%rbp
jmp    1370 <udev_node_mknod+0x120>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1100 <udev_selinux_setfscreatecon@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   10d0 <mknod@plt>
xor    %r12d,%r12d
mov    0x2c72(%rip),%rcx
sub    (%rcx),%r12d
test   %eax,%eax
cmove  %eax,%r12d
mov    %r15,%rdi
call   10e0 <udev_selinux_resetfscreatecon@plt>
mov    0x0(%r13),%eax
add    %r12d,%eax
jne    138d <udev_node_mknod+0x13d>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1130 <util_create_path_selinux@plt>
test   %eax,%eax
je     1330 <udev_node_mknod+0xe0>
mov    %eax,%r12d
mov    0x0(%r13),%eax
add    %r12d,%eax
je     1330 <udev_node_mknod+0xe0>
jmp    1396 <udev_node_mknod+0x146>
test   %r12d,%r12d
je     1506 <udev_node_mknod+0x2b6>
mov    %r14,%rdi
call   1080 <major@plt>
mov    %rax,%rbp
mov    %r14,%rdi
call   1070 <minor@plt>
lea    0xd90(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %rax,%r8
mov    0x8(%rsp),%r14
mov    %r14,%r9
xor    %eax,%eax
call   1060 <udev_log_null@plt>
jmp    150e <udev_node_mknod+0x2be>
mov    %rbp,%rdx
mov    %r13,%r14
mov    0x20(%rsp),%rbp
mov    0x2bfe(%rip),%rax
mov    %rbp,%rcx
xor    %rdx,%rcx
test   %rcx,(%rax)
jne    145c <udev_node_mknod+0x20c>
cmp    %r14,0x28(%rsp)
jne    145c <udev_node_mknod+0x20c>
lea    0xc0b(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    0x8(%rsp),%r14
cmp    %r14,%rbp
jne    1553 <udev_node_mknod+0x303>
mov    0x18(%rsp),%rax
cmp    %rax,0x30(%rsp)
jne    1553 <udev_node_mknod+0x303>
mov    0x10(%rsp),%rax
cmp    %rax,0x38(%rsp)
jne    1553 <udev_node_mknod+0x303>
lea    0xc24(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    0x18(%rsp),%r8
mov    0x10(%rsp),%r9
xor    %eax,%eax
call   1060 <udev_log_null@plt>
jmp    1593 <udev_node_mknod+0x343>
lea    0xc30(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <udev_log_null@plt>
lea    0xc43(%rip),%rcx
lea    0x40(%rsp),%r12
mov    %r12,%rdi
mov    $0x40a,%esi
mov    %rbx,%rdx
xor    %r8d,%r8d
call   1140 <util_strscpyl@plt>
mov    %r12,%rdi
call   1050 <unlink@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    0x8(%rsp),%r13
mov    %r13,%rdx
call   1100 <udev_selinux_setfscreatecon@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rbp
mov    %r14,%rdx
call   10d0 <mknod@plt>
mov    %eax,%r12d
mov    %r15,%rdi
call   10e0 <udev_selinux_resetfscreatecon@plt>
test   %r12d,%r12d
je     15e9 <udev_node_mknod+0x399>
mov    %rbp,%rdi
call   1080 <major@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1070 <minor@plt>
lea    0xbdb(%rip),%rsi
lea    0x40(%rsp),%rdx
mov    %r15,%rdi
mov    %rbx,%rcx
mov    %rax,%r8
mov    %r13,%r9
xor    %eax,%eax
call   1060 <udev_log_null@plt>
jmp    15d4 <udev_node_mknod+0x384>
xor    %r12d,%r12d
mov    0x8(%rsp),%r14
lea    0xbed(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    0x18(%rsp),%r15
mov    %r15,%r8
mov    0x10(%rsp),%rbp
mov    %rbp,%r9
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1120 <chmod@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   10f0 <chown@plt>
jmp    15d4 <udev_node_mknod+0x384>
lea    0xade(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    0x18(%rsp),%rbp
mov    %rbp,%r8
mov    0x10(%rsp),%r13
mov    %r13,%r9
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1120 <chmod@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
call   10f0 <chown@plt>
mov    %r12,%rdi
call   10c0 <udev_device_get_action@plt>
lea    0xaed(%rip),%rsi
mov    %eax,%edi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    15bc <udev_node_mknod+0x36c>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1160 <udev_selinux_lsetfilecon@plt>
mov    0x29ed(%rip),%rax
mov    (%rax),%edi
xor    %r12d,%r12d
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <utimensat@plt>
mov    %r12d,%eax
add    $0x458,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x40(%rsp),%rdi
mov    %rbx,%rsi
call   1150 <rename@plt>
test   %eax,%eax
je     1623 <udev_node_mknod+0x3d3>
mov    %eax,%r12d
lea    0xae1(%rip),%rsi
lea    0x40(%rsp),%rbp
mov    %r15,%rdi
mov    %rbp,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    %rbp,%rdi
call   1050 <unlink@plt>
jmp    15d4 <udev_node_mknod+0x384>
lea    0xad8(%rip),%rsi
xor    %r12d,%r12d
mov    %r15,%rdi
mov    %rbx,%rdx
mov    0x8(%rsp),%rbp
mov    %rbp,%rcx
mov    0x18(%rsp),%r14
mov    %r14,%r8
mov    0x10(%rsp),%r15
mov    %r15,%r9
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1120 <chmod@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
jmp    1549 <udev_node_mknod+0x2f9>

LLVM IR (-O0):
%struct.udev_device = type { i32 }
%struct.udev = type { i32 }
%struct.stat = type { i64, i64, i64, i64 }
@.str = [6 x i8] c"block\00"
@S_IFBLK = global i64 0
@S_IFCHR = global i64 0
@S_IFMT = global i64 0
@.str.1 = [50 x i8] c"preserve file '%s', because it has correct dev_t\0A\00"
@.str.2 = [41 x i8] c"set permissions %s, %#o, uid=%u, gid=%u\0A\00"
@.str.3 = [46 x i8] c"preserve permissions %s, %#o, uid=%u, gid=%u\0A\00"
@.str.4 = [4 x i8] c"add\00"
@AT_FDCWD = global i32 0
@.str.5 = [39 x i8] c"atomically replace existing file '%s'\0A\00"
@.str.6 = [10 x i8] c".udev-tmp\00"
@.str.7 = [33 x i8] c"mknod '%s' %u:%u %#o failed: %m\0A\00"
@.str.8 = [29 x i8] c"rename '%s' '%s' failed: %m\0A\00"
@.str.9 = [40 x i8] c"set permissions '%s' %#o uid=%u gid=%u\0A\00"
@.str.10 = [22 x i8] c"mknod '%s' %u:%u %#o\0A\00"
@ENOENT = global i32 0
@errno = global i32 0
@.str.11 = [34 x i8] c"mknod '%s' %u:%u %#o' failed: %m\0A\00"
define i32 @udev_node_mknod(%struct.udev_device* %0, i8* %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca %struct.udev_device*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca %struct.udev*
%12 = alloca i64
%13 = alloca %struct.stat
%14 = alloca i32
%15 = alloca [1034 x i8]
store %struct.udev_device* %0, %struct.udev_device** %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%16 = load %struct.udev_device*, %struct.udev_device** %6
%17 = call %struct.udev* @udev_device_get_udev(%struct.udev_device* %16)
store %struct.udev* %17, %struct.udev** %11
%18 = load %struct.udev_device*, %struct.udev_device** %6
%19 = call i64 @udev_device_get_devnum(%struct.udev_device* %18)
store i64 %19, i64* %12
store i32 0, i32* %14
%20 = load %struct.udev_device*, %struct.udev_device** %6
%21 = call i32 @udev_device_get_subsystem(%struct.udev_device* %20)
%22 = call i64 @strcmp(i32 %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %5
%25 = load i64, i64* @S_IFBLK
%26 = load i64, i64* %8
%27 = or i64 %26, %25
store i64 %27, i64* %8
br label %32
28: ; preds = %5
%29 = load i64, i64* @S_IFCHR
%30 = load i64, i64* %8
%31 = or i64 %30, %29
store i64 %31, i64* %8
br label %32
32: ; preds = %28, %24
%33 = load i8*, i8** %7
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load %struct.udev_device*, %struct.udev_device** %6
%37 = call i8* @udev_device_get_devnode(%struct.udev_device* %36)
store i8* %37, i8** %7
br label %38
38: ; preds = %35, %32
%39 = load i8*, i8** %7
%40 = call i64 @lstat(i8* %39, %struct.stat* %13)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %167
42: ; preds = %38
%43 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 0
%44 = load i64, i64* %43
%45 = load i64, i64* @S_IFMT
%46 = and i64 %44, %45
%47 = load i64, i64* %8
%48 = load i64, i64* @S_IFMT
%49 = and i64 %47, %48
%50 = icmp eq i64 %46, %49
br i1 %50, label %51, label %109
51: ; preds = %42
%52 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 1
%53 = load i64, i64* %52
%54 = load i64, i64* %12
%55 = icmp eq i64 %53, %54
br i1 %55, label %56, label %109
56: ; preds = %51
%57 = load %struct.udev*, %struct.udev** %11
%58 = load i8*, i8** %7
%59 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %57, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8* %58)
%60 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 0
%61 = load i64, i64* %60
%62 = load i64, i64* %8
%63 = icmp ne i64 %61, %62
br i1 %63, label %74, label %64
64: ; preds = %56
%65 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 2
%66 = load i64, i64* %65
%67 = load i64, i64* %9
%68 = icmp ne i64 %66, %67
br i1 %68, label %74, label %69
69: ; preds = %64
%70 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 3
%71 = load i64, i64* %70
%72 = load i64, i64* %10
%73 = icmp ne i64 %71, %72
br i1 %73, label %74, label %88
74: ; preds = %69, %64, %56
%75 = load %struct.udev*, %struct.udev** %11
%76 = load i8*, i8** %7
%77 = load i64, i64* %8
%78 = load i64, i64* %9
%79 = load i64, i64* %10
%80 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %75, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %76, i64 %77, i64 %78, i64 %79)
%81 = load i8*, i8** %7
%82 = load i64, i64* %8
%83 = call i32 @chmod(i8* %81, i64 %82)
%84 = load i8*, i8** %7
%85 = load i64, i64* %9
%86 = load i64, i64* %10
%87 = call i32 @chown(i8* %84, i64 %85, i64 %86)
br label %95
88: ; preds = %69
%89 = load %struct.udev*, %struct.udev** %11
%90 = load i8*, i8** %7
%91 = load i64, i64* %8
%92 = load i64, i64* %9
%93 = load i64, i64* %10
%94 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %89, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %90, i64 %91, i64 %92, i64 %93)
br label %95
95: ; preds = %88, %74
%96 = load %struct.udev_device*, %struct.udev_device** %6
%97 = call i32 @udev_device_get_action(%struct.udev_device* %96)
%98 = call i64 @strcmp(i32 %97, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%99 = icmp eq i64 %98, 0
br i1 %99, label %100, label %105
100: ; preds = %95
%101 = load %struct.udev*, %struct.udev** %11
%102 = load i8*, i8** %7
%103 = load i64, i64* %8
%104 = call i32 @udev_selinux_lsetfilecon(%struct.udev* %101, i8* %102, i64 %103)
br label %105
105: ; preds = %100, %95
%106 = load i32, i32* @AT_FDCWD
%107 = load i8*, i8** %7
%108 = call i32 @utimensat(i32 %106, i8* %107, i32* null, i32 0)
br label %166
109: ; preds = %51, %42
%110 = load %struct.udev*, %struct.udev** %11
%111 = load i8*, i8** %7
%112 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %110, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %111)
%113 = getelementptr inbounds [1034 x i8], [1034 x i8]* %15, i64 0, i64 0
%114 = load i8*, i8** %7
%115 = call i32 @util_strscpyl(i8* %113, i32 1034, i8* %114, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32* null)
%116 = getelementptr inbounds [1034 x i8], [1034 x i8]* %15, i64 0, i64 0
%117 = call i32 @unlink(i8* %116)
%118 = load %struct.udev*, %struct.udev** %11
%119 = getelementptr inbounds [1034 x i8], [1034 x i8]* %15, i64 0, i64 0
%120 = load i64, i64* %8
%121 = call i32 @udev_selinux_setfscreatecon(%struct.udev* %118, i8* %119, i64 %120)
%122 = getelementptr inbounds [1034 x i8], [1034 x i8]* %15, i64 0, i64 0
%123 = load i64, i64* %8
%124 = load i64, i64* %12
%125 = call i32 @mknod(i8* %122, i64 %123, i64 %124)
store i32 %125, i32* %14
%126 = load %struct.udev*, %struct.udev** %11
%127 = call i32 @udev_selinux_resetfscreatecon(%struct.udev* %126)
%128 = load i32, i32* %14
%129 = icmp ne i32 %128, 0
br i1 %129, label %130, label %139
130: ; preds = %109
%131 = load %struct.udev*, %struct.udev** %11
%132 = getelementptr inbounds [1034 x i8], [1034 x i8]* %15, i64 0, i64 0
%133 = load i64, i64* %12
%134 = call i64 @major(i64 %133)
%135 = load i64, i64* %12
%136 = call i64 @minor(i64 %135)
%137 = load i64, i64* %8
%138 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %131, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %132, i64 %134, i64 %136, i64 %137)
br label %237
139: ; preds = %109
%140 = getelementptr inbounds [1034 x i8], [1034 x i8]* %15, i64 0, i64 0
%141 = load i8*, i8** %7
%142 = call i32 @rename(i8* %140, i8* %141)
store i32 %142, i32* %14
%143 = load i32, i32* %14
%144 = icmp ne i32 %143, 0
br i1 %144, label %145, label %152
145: ; preds = %139
%146 = load %struct.udev*, %struct.udev** %11
%147 = getelementptr inbounds [1034 x i8], [1034 x i8]* %15, i64 0, i64 0
%148 = load i8*, i8** %7
%149 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %146, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i8* %147, i8* %148)
%150 = getelementptr inbounds [1034 x i8], [1034 x i8]* %15, i64 0, i64 0
%151 = call i32 @unlink(i8* %150)
br label %237
152: ; preds = %139
%153 = load %struct.udev*, %struct.udev** %11
%154 = load i8*, i8** %7
%155 = load i64, i64* %8
%156 = load i64, i64* %9
%157 = load i64, i64* %10
%158 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %153, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i8* %154, i64 %155, i64 %156, i64 %157)
%159 = load i8*, i8** %7
%160 = load i64, i64* %8
%161 = call i32 @chmod(i8* %159, i64 %160)
%162 = load i8*, i8** %7
%163 = load i64, i64* %9
%164 = load i64, i64* %10
%165 = call i32 @chown(i8* %162, i64 %163, i64 %164)
br label %166
166: ; preds = %152, %105
br label %236
167: ; preds = %38
%168 = load %struct.udev*, %struct.udev** %11
%169 = load i8*, i8** %7
%170 = load i64, i64* %12
%171 = call i64 @major(i64 %170)
%172 = load i64, i64* %12
%173 = call i64 @minor(i64 %172)
%174 = load i64, i64* %8
%175 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %168, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* %169, i64 %171, i64 %173, i64 %174)
br label %176
176: ; preds = %205, %167
%177 = load %struct.udev*, %struct.udev** %11
%178 = load i8*, i8** %7
%179 = call i32 @util_create_path_selinux(%struct.udev* %177, i8* %178)
store i32 %179, i32* %14
%180 = load i32, i32* %14
%181 = icmp ne i32 %180, 0
br i1 %181, label %182, label %188
182: ; preds = %176
%183 = load i32, i32* %14
%184 = load i32, i32* @ENOENT
%185 = sub nsw i32 0, %184
%186 = icmp ne i32 %183, %185
br i1 %186, label %187, label %188
187: ; preds = %182
br label %210
188: ; preds = %182, %176
%189 = load %struct.udev*, %struct.udev** %11
%190 = load i8*, i8** %7
%191 = load i64, i64* %8
%192 = call i32 @udev_selinux_setfscreatecon(%struct.udev* %189, i8* %190, i64 %191)
%193 = load i8*, i8** %7
%194 = load i64, i64* %8
%195 = load i64, i64* %12
%196 = call i32 @mknod(i8* %193, i64 %194, i64 %195)
store i32 %196, i32* %14
%197 = load i32, i32* %14
%198 = icmp ne i32 %197, 0
br i1 %198, label %199, label %202
199: ; preds = %188
%200 = load i32, i32* @errno
%201 = sub nsw i32 0, %200
store i32 %201, i32* %14
br label %202
202: ; preds = %199, %188
%203 = load %struct.udev*, %struct.udev** %11
%204 = call i32 @udev_selinux_resetfscreatecon(%struct.udev* %203)
br label %205
205: ; preds = %202
%206 = load i32, i32* %14
%207 = load i32, i32* @ENOENT
%208 = sub nsw i32 0, %207
%209 = icmp eq i32 %206, %208
br i1 %209, label %176, label %210
210: ; preds = %205, %187
%211 = load i32, i32* %14
%212 = icmp ne i32 %211, 0
br i1 %212, label %213, label %222
213: ; preds = %210
%214 = load %struct.udev*, %struct.udev** %11
%215 = load i8*, i8** %7
%216 = load i64, i64* %12
%217 = call i64 @major(i64 %216)
%218 = load i64, i64* %12
%219 = call i64 @minor(i64 %218)
%220 = load i64, i64* %8
%221 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %214, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i8* %215, i64 %217, i64 %219, i64 %220)
br label %222
222: ; preds = %213, %210
%223 = load %struct.udev*, %struct.udev** %11
%224 = load i8*, i8** %7
%225 = load i64, i64* %8
%226 = load i64, i64* %9
%227 = load i64, i64* %10
%228 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %223, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i8* %224, i64 %225, i64 %226, i64 %227)
%229 = load i8*, i8** %7
%230 = load i64, i64* %8
%231 = call i32 @chmod(i8* %229, i64 %230)
%232 = load i8*, i8** %7
%233 = load i64, i64* %9
%234 = load i64, i64* %10
%235 = call i32 @chown(i8* %232, i64 %233, i64 %234)
br label %236
236: ; preds = %222, %166
br label %237
237: ; preds = %236, %145, %130
%238 = load i32, i32* %14
ret i32 %238
}

LLVM IR (-O2):
%struct.udev_device = type { i32 }
%struct.stat = type { i64, i64, i64, i64 }
%struct.udev = type { i32 }
@.str = [6 x i8] c"block\00"
@S_IFBLK = global i64 0
@S_IFCHR = global i64 0
@S_IFMT = global i64 0
@.str.1 = [50 x i8] c"preserve file '%s', because it has correct dev_t\0A\00"
@.str.2 = [41 x i8] c"set permissions %s, %#o, uid=%u, gid=%u\0A\00"
@.str.3 = [46 x i8] c"preserve permissions %s, %#o, uid=%u, gid=%u\0A\00"
@.str.4 = [4 x i8] c"add\00"
@AT_FDCWD = global i32 0
@.str.5 = [39 x i8] c"atomically replace existing file '%s'\0A\00"
@.str.6 = [10 x i8] c".udev-tmp\00"
@.str.7 = [33 x i8] c"mknod '%s' %u:%u %#o failed: %m\0A\00"
@.str.8 = [29 x i8] c"rename '%s' '%s' failed: %m\0A\00"
@.str.9 = [40 x i8] c"set permissions '%s' %#o uid=%u gid=%u\0A\00"
@.str.10 = [22 x i8] c"mknod '%s' %u:%u %#o\0A\00"
@ENOENT = global i32 0
@errno = global i32 0
@.str.11 = [34 x i8] c"mknod '%s' %u:%u %#o' failed: %m\0A\00"
define i32 @udev_node_mknod(%struct.udev_device* %0, i8* %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca %struct.stat
%7 = alloca [1034 x i8]
%8 = tail call %struct.udev* @udev_device_get_udev(%struct.udev_device* %0)
%9 = tail call i64 @udev_device_get_devnum(%struct.udev_device* %0)
%10 = bitcast %struct.stat* %6 to i8*
%11 = tail call i32 @udev_device_get_subsystem(%struct.udev_device* %0)
%12 = tail call i64 @strcmp(i32 %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
%14 = load i64, i64* @S_IFBLK
%15 = load i64, i64* @S_IFCHR
%16 = select i1 %13, i64 %14, i64 %15
%17 = or i64 %16, %2
%18 = icmp eq i8* %1, null
br i1 %18, label %19, label %21
19: ; preds = %5
%20 = tail call i8* @udev_device_get_devnode(%struct.udev_device* %0)
br label %21
21: ; preds = %19, %5
%22 = phi i8* [ %20, %19 ], [ %1, %5 ]
%23 = call i64 @lstat(i8* %22, %struct.stat* %6)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %87
25: ; preds = %21
%26 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 0
%27 = load i64, i64* %26
%28 = load i64, i64* @S_IFMT
%29 = xor i64 %27, %17
%30 = and i64 %29, %28
%31 = icmp eq i64 %30, 0
%32 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 1
%33 = load i64, i64* %32
%34 = icmp eq i64 %33, %9
%35 = select i1 %31, i1 %34, i1 false
br i1 %35, label %36, label %62
36: ; preds = %25
%37 = tail call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %8, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%38 = icmp eq i64 %27, %17
%39 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 2
%40 = load i64, i64* %39
%41 = icmp eq i64 %40, %3
%42 = select i1 %38, i1 %41, i1 false
%43 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 3
%44 = load i64, i64* %43
%45 = icmp eq i64 %44, %4
%46 = select i1 %42, i1 %45, i1 false
br i1 %46, label %51, label %47
47: ; preds = %36
%48 = tail call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %8, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %22, i64 %17, i64 %3, i64 %4)
%49 = tail call i32 @chmod(i8* %22, i64 %17)
%50 = tail call i32 @chown(i8* %22, i64 %3, i64 %4)
br label %53
51: ; preds = %36
%52 = tail call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %8, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %22, i64 %17, i64 %3, i64 %4)
br label %53
53: ; preds = %51, %47
%54 = tail call i32 @udev_device_get_action(%struct.udev_device* %0)
%55 = tail call i64 @strcmp(i32 %54, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = tail call i32 @udev_selinux_lsetfilecon(%struct.udev* %8, i8* %22, i64 %17)
br label %59
59: ; preds = %57, %53
%60 = load i32, i32* @AT_FDCWD
%61 = tail call i32 @utimensat(i32 %60, i8* %22, i32* null, i32 0)
br label %121
62: ; preds = %25
%63 = getelementptr inbounds [1034 x i8], [1034 x i8]* %7, i64 0, i64 0
%64 = tail call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %8, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %22)
%65 = call i32 @util_strscpyl(i8* %63, i32 1034, i8* %22, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32* null)
%66 = call i32 @unlink(i8* %63)
%67 = call i32 @udev_selinux_setfscreatecon(%struct.udev* %8, i8* %63, i64 %17)
%68 = call i32 @mknod(i8* %63, i64 %17, i64 %9)
%69 = call i32 @udev_selinux_resetfscreatecon(%struct.udev* %8)
%70 = icmp eq i32 %68, 0
br i1 %70, label %75, label %71
71: ; preds = %62
%72 = call i64 @major(i64 %9)
%73 = call i64 @minor(i64 %9)
%74 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %63, i64 %72, i64 %73, i64 %17)
br label %85
75: ; preds = %62
%76 = call i32 @rename(i8* %63, i8* %22)
%77 = icmp eq i32 %76, 0
br i1 %77, label %81, label %78
78: ; preds = %75
%79 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i8* %63, i8* %22)
%80 = call i32 @unlink(i8* %63)
br label %85
81: ; preds = %75
%82 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %8, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i8* %22, i64 %17, i64 %3, i64 %4)
%83 = call i32 @chmod(i8* %22, i64 %17)
%84 = call i32 @chown(i8* %22, i64 %3, i64 %4)
br label %85
85: ; preds = %78, %71, %81
%86 = phi i32 [ %68, %71 ], [ %76, %78 ], [ 0, %81 ]
br label %121
87: ; preds = %21
%88 = tail call i64 @major(i64 %9)
%89 = tail call i64 @minor(i64 %9)
%90 = tail call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* %22, i64 %88, i64 %89, i64 %17)
br label %91
91: ; preds = %98, %87
%92 = tail call i32 @util_create_path_selinux(%struct.udev* %8, i8* %22)
%93 = icmp eq i32 %92, 0
br i1 %93, label %98, label %94
94: ; preds = %91
%95 = load i32, i32* @ENOENT
%96 = sub nsw i32 0, %95
%97 = icmp eq i32 %92, %96
br i1 %97, label %98, label %111
98: ; preds = %94, %91
%99 = tail call i32 @udev_selinux_setfscreatecon(%struct.udev* %8, i8* %22, i64 %17)
%100 = tail call i32 @mknod(i8* %22, i64 %17, i64 %9)
%101 = icmp eq i32 %100, 0
%102 = load i32, i32* @errno
%103 = sub nsw i32 0, %102
%104 = select i1 %101, i32 0, i32 %103
%105 = tail call i32 @udev_selinux_resetfscreatecon(%struct.udev* %8)
%106 = load i32, i32* @ENOENT
%107 = sub nsw i32 0, %106
%108 = icmp eq i32 %104, %107
br i1 %108, label %91, label %109
109: ; preds = %98
%110 = icmp eq i32 %104, 0
br i1 %110, label %116, label %111
111: ; preds = %94, %109
%112 = phi i32 [ %104, %109 ], [ %92, %94 ]
%113 = tail call i64 @major(i64 %9)
%114 = tail call i64 @minor(i64 %9)
%115 = tail call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i8* %22, i64 %113, i64 %114, i64 %17)
br label %116
116: ; preds = %111, %109
%117 = phi i32 [ %112, %111 ], [ 0, %109 ]
%118 = tail call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %8, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i8* %22, i64 %17, i64 %3, i64 %4)
%119 = tail call i32 @chmod(i8* %22, i64 %17)
%120 = tail call i32 @chown(i8* %22, i64 %3, i64 %4)
br label %121
121: ; preds = %59, %116, %85
%122 = phi i32 [ 0, %59 ], [ %86, %85 ], [ %117, %116 ]
ret i32 %122
}