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

/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int EEXIST;
int ENOENT;
int S_IFBLK;
int S_IFCHR;
int S_IFMT;
int /*<<< orphan*/ chmod(char const *, int);
int /*<<< orphan*/ chown(char const *, scalar_t__, int);
int errno;
scalar_t__ lstat(char const *, struct stat *);
int major(scalar_t__);
scalar_t__ minor(scalar_t__);
int mknod(char const *, int, 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 *, int);
int /*<<< orphan*/ udev_selinux_resetfscreatecon(struct udev *);
int /*<<< orphan*/ udev_selinux_setfscreatecon(struct udev *, char const *,
                                               int);
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 & 0777) != (mode & 0777) || stats.st_uid != uid ||
          stats.st_gid != gid) {
        mode |= stats.st_mode & 01000;
        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 && err != -EEXIST)
      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    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%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    0xd5f(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    12c4 <udev_node_mknod+0x74>
mov    0x2d21(%rip),%rax
mov    (%rax),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    12d3 <udev_node_mknod+0x83>
mov    0x2cfd(%rip),%rax
mov    (%rax),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    12eb <udev_node_mknod+0x9b>
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    15a3 <udev_node_mknod+0x353>
mov    -0x58(%rbp),%eax
mov    0x2cd4(%rip),%rcx
and    (%rcx),%eax
mov    -0x14(%rbp),%ecx
mov    0x2cc8(%rip),%rdx
and    (%rdx),%ecx
cmp    %ecx,%eax
jne    1438 <udev_node_mknod+0x1e8>
mov    -0x50(%rbp),%rax
cmp    -0x38(%rbp),%rax
jne    1438 <udev_node_mknod+0x1e8>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xcc7(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x58(%rbp),%eax
and    $0x1ff,%eax
mov    -0x14(%rbp),%ecx
and    $0x1ff,%ecx
cmp    %ecx,%eax
jne    1379 <udev_node_mknod+0x129>
mov    -0x48(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    1379 <udev_node_mknod+0x129>
mov    -0x40(%rbp),%eax
cmp    -0x24(%rbp),%eax
je     13c9 <udev_node_mknod+0x179>
mov    -0x58(%rbp),%eax
and    $0x200,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
lea    0xc97(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1120 <chmod@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10f0 <chown@plt>
jmp    13ea <udev_node_mknod+0x19a>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
lea    0xc7e(%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    0xc93(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    141b <udev_node_mknod+0x1cb>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1160 <udev_selinux_lsetfilecon@plt>
mov    0x2b86(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
call   1030 <utimensat@plt>
jmp    159e <udev_node_mknod+0x34e>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xc4c(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
lea    -0x470(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x40a,%esi
lea    0xc55(%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    -0x14(%rbp),%edx
call   1100 <udev_selinux_setfscreatecon@plt>
lea    -0x470(%rbp),%rdi
mov    -0x14(%rbp),%esi
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     1516 <udev_node_mknod+0x2c6>
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    %eax,-0x474(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <minor@plt>
mov    -0x488(%rbp),%rdi
mov    -0x480(%rbp),%rdx
mov    -0x474(%rbp),%ecx
mov    %rax,%r8
mov    -0x14(%rbp),%r9d
lea    0xbba(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
jmp    1742 <udev_node_mknod+0x4f2>
lea    -0x470(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1150 <rename@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
je     1561 <udev_node_mknod+0x311>
mov    -0x30(%rbp),%rdi
lea    -0x470(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xb9c(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
lea    -0x470(%rbp),%rdi
call   1050 <unlink@plt>
jmp    1742 <udev_node_mknod+0x4f2>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
lea    0xb87(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1120 <chmod@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10f0 <chown@plt>
jmp    173d <udev_node_mknod+0x4ed>
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    %eax,-0x48c(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <minor@plt>
mov    -0x4a0(%rbp),%rdi
mov    -0x498(%rbp),%rdx
mov    -0x48c(%rbp),%ecx
mov    %rax,%r8
mov    -0x14(%rbp),%r9d
lea    0xb37(%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     162f <udev_node_mknod+0x3df>
mov    -0x5c(%rbp),%eax
xor    %ecx,%ecx
mov    0x2990(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
je     162f <udev_node_mknod+0x3df>
jmp    1689 <udev_node_mknod+0x439>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1100 <udev_selinux_setfscreatecon@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x38(%rbp),%rdx
call   10d0 <mknod@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
je     166a <udev_node_mknod+0x41a>
xor    %eax,%eax
mov    0x295b(%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    0x2931(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
je     15fa <udev_node_mknod+0x3aa>
cmpl   $0x0,-0x5c(%rbp)
je     1700 <udev_node_mknod+0x4b0>
mov    -0x5c(%rbp),%eax
xor    %ecx,%ecx
mov    0x2931(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
je     1700 <udev_node_mknod+0x4b0>
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    %eax,-0x4a4(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <minor@plt>
mov    -0x4b8(%rbp),%rdi
mov    -0x4b0(%rbp),%rdx
mov    -0x4a4(%rbp),%ecx
mov    %rax,%r8
mov    -0x14(%rbp),%r9d
lea    0xa47(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
lea    0x9e8(%rip),%rsi
mov    $0x0,%al
call   1060 <udev_log_null@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1120 <chmod@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   10f0 <chown@plt>
jmp    1742 <udev_node_mknod+0x4f2>
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    $0x448,%rsp
mov    %r8d,%ebp
mov    %rcx,0x8(%rsp)
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r15
call   1040 <udev_device_get_udev@plt>
mov    %rax,%r12
mov    %r15,%rdi
call   1110 <udev_device_get_devnum@plt>
mov    %rax,%r13
mov    %r15,%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    0x2d18(%rip),%rax
or     (%rax),%r14d
test   %rbx,%rbx
jne    12c3 <udev_node_mknod+0x73>
mov    %r15,%rdi
call   1170 <udev_device_get_devnode@plt>
mov    %rax,%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <lstat@plt>
test   %rax,%rax
mov    %r14d,(%rsp)
mov    %ebp,0x4(%rsp)
je     13e2 <udev_node_mknod+0x192>
mov    %r13,%rdi
call   1080 <major@plt>
mov    %eax,%r15d
mov    %r14d,%ebp
mov    %r13,%r14
mov    %r13,%rdi
call   1070 <minor@plt>
lea    0xe29(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    %rax,%r8
mov    %ebp,%r9d
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    0x2c92(%rip),%r13
mov    (%rsp),%ebp
jmp    136e <udev_node_mknod+0x11e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1100 <udev_selinux_setfscreatecon@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   10d0 <mknod@plt>
xor    %r15d,%r15d
mov    0x2c6c(%rip),%rcx
sub    (%rcx),%r15d
test   %eax,%eax
cmove  %eax,%r15d
mov    %r12,%rdi
call   10e0 <udev_selinux_resetfscreatecon@plt>
mov    0x0(%r13),%eax
add    %r15d,%eax
jne    138b <udev_node_mknod+0x13b>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1130 <util_create_path_selinux@plt>
test   %eax,%eax
je     1330 <udev_node_mknod+0xe0>
mov    %eax,%r15d
mov    0x0(%r13),%eax
add    %r15d,%eax
je     1330 <udev_node_mknod+0xe0>
jmp    1394 <udev_node_mknod+0x144>
test   %r15d,%r15d
je     150f <udev_node_mknod+0x2bf>
mov    0x2c35(%rip),%rax
mov    (%rax),%eax
add    %r15d,%eax
je     1512 <udev_node_mknod+0x2c2>
mov    %r14,%rdi
call   1080 <major@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1070 <minor@plt>
lea    0xd81(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %rax,%r8
mov    (%rsp),%r14d
mov    %r14d,%r9d
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    0x4(%rsp),%r13d
jmp    151b <udev_node_mknod+0x2cb>
mov    %r14d,%ecx
mov    %r13,%r14
mov    0x10(%rsp),%ebp
mov    0x2bed(%rip),%rax
mov    %ebp,%r13d
xor    %ecx,%r13d
test   %r13d,(%rax)
jne    146e <udev_node_mknod+0x21e>
cmp    %r14,0x18(%rsp)
jne    146e <udev_node_mknod+0x21e>
lea    0xbfa(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <udev_log_null@plt>
test   $0x1ff,%r13d
mov    0x4(%rsp),%r13d
jne    155b <udev_node_mknod+0x30b>
mov    0x8(%rsp),%rax
cmp    %rax,0x20(%rsp)
jne    155b <udev_node_mknod+0x30b>
cmp    %r13d,0x28(%rsp)
jne    155b <udev_node_mknod+0x30b>
lea    0xc14(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
mov    (%rsp),%r14d
mov    %r14d,%ecx
mov    0x8(%rsp),%r8
mov    %r13d,%r9d
xor    %eax,%eax
call   1060 <udev_log_null@plt>
jmp    15a3 <udev_node_mknod+0x353>
lea    0xc1e(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <udev_log_null@plt>
lea    0xc31(%rip),%rcx
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    $0x40a,%esi
mov    %rbx,%rdx
xor    %r8d,%r8d
call   1140 <util_strscpyl@plt>
mov    %r15,%rdi
call   1050 <unlink@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    (%rsp),%ebp
mov    %ebp,%edx
call   1100 <udev_selinux_setfscreatecon@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   10d0 <mknod@plt>
mov    %eax,%r15d
mov    %r12,%rdi
call   10e0 <udev_selinux_resetfscreatecon@plt>
test   %r15d,%r15d
je     15f9 <udev_node_mknod+0x3a9>
mov    %r14,%rdi
call   1080 <major@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1070 <minor@plt>
lea    0xbd1(%rip),%rsi
lea    0x30(%rsp),%rdx
mov    %r12,%rdi
mov    %ebx,%ecx
mov    %rax,%r8
mov    %ebp,%r9d
xor    %eax,%eax
call   1060 <udev_log_null@plt>
jmp    15e4 <udev_node_mknod+0x394>
xor    %r15d,%r15d
mov    0x4(%rsp),%r13d
mov    (%rsp),%r14d
lea    0xbe0(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
mov    %r14d,%ecx
mov    0x8(%rsp),%rbp
mov    %rbp,%r8
mov    %r13d,%r9d
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1120 <chmod@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r13d,%edx
call   10f0 <chown@plt>
jmp    15e4 <udev_node_mknod+0x394>
and    $0x200,%ebp
mov    (%rsp),%r14d
or     %ebp,%r14d
lea    0xac9(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
mov    %r14d,%ecx
mov    0x8(%rsp),%rbp
mov    %rbp,%r8
mov    %r13d,%r9d
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1120 <chmod@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r13d,%edx
call   10f0 <chown@plt>
mov    %r15,%rdi
call   10c0 <udev_device_get_action@plt>
lea    0xadd(%rip),%rsi
mov    %eax,%edi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    15cc <udev_node_mknod+0x37c>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1160 <udev_selinux_lsetfilecon@plt>
mov    0x29d5(%rip),%rax
mov    (%rax),%edi
xor    %r15d,%r15d
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <utimensat@plt>
mov    %r15d,%eax
add    $0x448,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x30(%rsp),%rdi
mov    %rbx,%rsi
call   1150 <rename@plt>
test   %eax,%eax
je     1633 <udev_node_mknod+0x3e3>
mov    %eax,%r15d
lea    0xad1(%rip),%rsi
lea    0x30(%rsp),%r14
mov    %r12,%rdi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    %r14,%rdi
call   1050 <unlink@plt>
jmp    15e4 <udev_node_mknod+0x394>
lea    0xac8(%rip),%rsi
xor    %r15d,%r15d
mov    %r12,%rdi
mov    %rbx,%rdx
mov    (%rsp),%ebp
mov    %ebp,%ecx
mov    0x8(%rsp),%r12
mov    %r12,%r8
mov    0x4(%rsp),%r14d
mov    %r14d,%r9d
xor    %eax,%eax
call   1060 <udev_log_null@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1120 <chmod@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
jmp    1551 <udev_node_mknod+0x301>

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

LLVM IR (-O2):
%struct.udev_device = type { i32 }
%struct.stat = type { i32, i64, i64, i32 }
%struct.udev = type { i32 }
@.str = [6 x i8] c"block\00"
@S_IFBLK = global i32 0
@S_IFCHR = global i32 0
@S_IFMT = global i32 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
@EEXIST = 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, i32 %2, i64 %3, i32 %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 i32, i32* @S_IFBLK
%15 = load i32, i32* @S_IFCHR
%16 = select i1 %13, i32 %14, i32 %15
%17 = or i32 %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 %91
25: ; preds = %21
%26 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 0
%27 = load i32, i32* %26
%28 = load i32, i32* @S_IFMT
%29 = xor i32 %27, %17
%30 = and i32 %29, %28
%31 = icmp eq i32 %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 %66
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 = and i32 %29, 511
%39 = icmp eq i32 %38, 0
%40 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 2
%41 = load i64, i64* %40
%42 = icmp eq i64 %41, %3
%43 = select i1 %39, i1 %42, i1 false
%44 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 3
%45 = load i32, i32* %44
%46 = icmp eq i32 %45, %4
%47 = select i1 %43, i1 %46, i1 false
br i1 %47, label %54, label %48
48: ; preds = %36
%49 = and i32 %27, 512
%50 = or i32 %49, %17
%51 = 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, i32 %50, i64 %3, i32 %4)
%52 = tail call i32 @chmod(i8* %22, i32 %50)
%53 = tail call i32 @chown(i8* %22, i64 %3, i32 %4)
br label %56
54: ; preds = %36
%55 = 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, i32 %17, i64 %3, i32 %4)
br label %56
56: ; preds = %54, %48
%57 = phi i32 [ %50, %48 ], [ %17, %54 ]
%58 = tail call i32 @udev_device_get_action(%struct.udev_device* %0)
%59 = tail call i64 @strcmp(i32 %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %56
%62 = tail call i32 @udev_selinux_lsetfilecon(%struct.udev* %8, i8* %22, i32 %57)
br label %63
63: ; preds = %61, %56
%64 = load i32, i32* @AT_FDCWD
%65 = tail call i32 @utimensat(i32 %64, i8* %22, i32* null, i32 0)
br label %129
66: ; preds = %25
%67 = getelementptr inbounds [1034 x i8], [1034 x i8]* %7, i64 0, i64 0
%68 = 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)
%69 = call i32 @util_strscpyl(i8* %67, i32 1034, i8* %22, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32* null)
%70 = call i32 @unlink(i8* %67)
%71 = call i32 @udev_selinux_setfscreatecon(%struct.udev* %8, i8* %67, i32 %17)
%72 = call i32 @mknod(i8* %67, i32 %17, i64 %9)
%73 = call i32 @udev_selinux_resetfscreatecon(%struct.udev* %8)
%74 = icmp eq i32 %72, 0
br i1 %74, label %79, label %75
75: ; preds = %66
%76 = call i32 @major(i64 %9)
%77 = call i64 @minor(i64 %9)
%78 = 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* %67, i32 %76, i64 %77, i32 %17)
br label %89
79: ; preds = %66
%80 = call i32 @rename(i8* %67, i8* %22)
%81 = icmp eq i32 %80, 0
br i1 %81, label %85, label %82
82: ; preds = %79
%83 = 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* %67, i8* %22)
%84 = call i32 @unlink(i8* %67)
br label %89
85: ; preds = %79
%86 = 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, i32 %17, i64 %3, i32 %4)
%87 = call i32 @chmod(i8* %22, i32 %17)
%88 = call i32 @chown(i8* %22, i64 %3, i32 %4)
br label %89
89: ; preds = %82, %75, %85
%90 = phi i32 [ %72, %75 ], [ %80, %82 ], [ 0, %85 ]
br label %129
91: ; preds = %21
%92 = tail call i32 @major(i64 %9)
%93 = tail call i64 @minor(i64 %9)
%94 = 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, i32 %92, i64 %93, i32 %17)
br label %95
95: ; preds = %102, %91
%96 = tail call i32 @util_create_path_selinux(%struct.udev* %8, i8* %22)
%97 = icmp eq i32 %96, 0
br i1 %97, label %102, label %98
98: ; preds = %95
%99 = load i32, i32* @ENOENT
%100 = sub nsw i32 0, %99
%101 = icmp eq i32 %96, %100
br i1 %101, label %102, label %115
102: ; preds = %98, %95
%103 = tail call i32 @udev_selinux_setfscreatecon(%struct.udev* %8, i8* %22, i32 %17)
%104 = tail call i32 @mknod(i8* %22, i32 %17, i64 %9)
%105 = icmp eq i32 %104, 0
%106 = load i32, i32* @errno
%107 = sub nsw i32 0, %106
%108 = select i1 %105, i32 0, i32 %107
%109 = tail call i32 @udev_selinux_resetfscreatecon(%struct.udev* %8)
%110 = load i32, i32* @ENOENT
%111 = sub nsw i32 0, %110
%112 = icmp eq i32 %108, %111
br i1 %112, label %95, label %113
113: ; preds = %102
%114 = icmp eq i32 %108, 0
br i1 %114, label %124, label %115
115: ; preds = %98, %113
%116 = phi i32 [ %108, %113 ], [ %96, %98 ]
%117 = load i32, i32* @EEXIST
%118 = sub nsw i32 0, %117
%119 = icmp eq i32 %116, %118
br i1 %119, label %124, label %120
120: ; preds = %115
%121 = tail call i32 @major(i64 %9)
%122 = tail call i64 @minor(i64 %9)
%123 = 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, i32 %121, i64 %122, i32 %17)
br label %124
124: ; preds = %120, %115, %113
%125 = phi i32 [ %116, %120 ], [ %116, %115 ], [ 0, %113 ]
%126 = 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, i32 %17, i64 %3, i32 %4)
%127 = tail call i32 @chmod(i8* %22, i32 %17)
%128 = tail call i32 @chown(i8* %22, i64 %3, i32 %4)
br label %129
129: ; preds = %63, %124, %89
%130 = phi i32 [ 0, %63 ], [ %90, %89 ], [ %125, %124 ]
ret i32 %130
}