#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 binderfs_device {
  int /*<<< orphan*/ protocol_version;
  int /*<<< orphan*/ name;
  int /*<<< orphan*/ minor;
  int /*<<< orphan*/ major;
  int /*<<< orphan*/ member_0;
};
struct binder_version {
  int /*<<< orphan*/ protocol_version;
  int /*<<< orphan*/ name;
  int /*<<< orphan*/ minor;
  int /*<<< orphan*/ major;
  int /*<<< orphan*/ member_0;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ BINDER_CTL_ADD;
int /*<<< orphan*/ BINDER_VERSION;
int EEXIST;
int ENODEV;
int EPERM;
int /*<<< orphan*/ MNT_DETACH;
int O_CLOEXEC;
int O_RDONLY;
int /*<<< orphan*/ change_to_mountns();
int /*<<< orphan*/ close(int);
int errno;
int ioctl(int, int /*<<< orphan*/, struct binderfs_device *);
int /*<<< orphan*/ ksft_exit_fail_msg(char *, ...);
int /*<<< orphan*/ ksft_exit_skip(char *);
int /*<<< orphan*/ ksft_inc_pass_cnt();
int /*<<< orphan*/ ksft_inc_xfail_cnt();
int /*<<< orphan*/ ksft_print_msg(char *, int /*<<< orphan*/, ...);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int mkdir(char *, int);
int mount(int /*<<< orphan*/ *, char *, char *, int /*<<< orphan*/,
          int /*<<< orphan*/);
int open(char *, int);
int /*<<< orphan*/ rmdir_protect_errno(char *);
int /*<<< orphan*/ strerror(int);
int /*<<< orphan*/ strlen(char *);
int umount2(char *, int /*<<< orphan*/);
int unlink(char *);
void __do_binderfs_test(void) {
  int fd, ret, saved_errno;
  size_t len;
  ssize_t wret;
  bool keep = false;
  struct binderfs_device device = {0};
  struct binder_version version = {0};
  change_to_mountns();
  ret = mkdir("/dev/binderfs", 0755);
  if (ret < 0) {
    if (errno != EEXIST)
      ksft_exit_fail_msg("%s - Failed to create binderfs mountpoint\n",
                         strerror(errno));
    keep = true;
  }
  ret = mount(NULL, "/dev/binderfs", "binder", 0, 0);
  if (ret < 0) {
    if (errno != ENODEV)
      ksft_exit_fail_msg("%s - Failed to mount binderfs\n", strerror(errno));
    keep ?: rmdir_protect_errno("/dev/binderfs");
    ksft_exit_skip("The Android binderfs filesystem is not available\n");
  }
  ksft_inc_pass_cnt();
  memcpy(device.name, "my-binder", strlen("my-binder"));
  fd = open("/dev/binderfs/binder-control", O_RDONLY | O_CLOEXEC);
  if (fd < 0)
    ksft_exit_fail_msg("%s - Failed to open binder-control device\n",
                       strerror(errno));
  ret = ioctl(fd, BINDER_CTL_ADD, &device);
  saved_errno = errno;
  close(fd);
  errno = saved_errno;
  if (ret < 0) {
    keep ?: rmdir_protect_errno("/dev/binderfs");
    ksft_exit_fail_msg("%s - Failed to allocate new binder device\n",
                       strerror(errno));
  }
  ksft_print_msg(
      "Allocated new binder device with major %d, minor %d, and name %s\n",
      device.major, device.minor, device.name);
  ksft_inc_pass_cnt();
  fd = open("/dev/binderfs/my-binder", O_CLOEXEC | O_RDONLY);
  if (fd < 0) {
    keep ?: rmdir_protect_errno("/dev/binderfs");
    ksft_exit_fail_msg("%s - Failed to open my-binder device\n",
                       strerror(errno));
  }
  ret = ioctl(fd, BINDER_VERSION, &version);
  saved_errno = errno;
  close(fd);
  errno = saved_errno;
  if (ret < 0) {
    keep ?: rmdir_protect_errno("/dev/binderfs");
    ksft_exit_fail_msg("%s - Failed to open perform BINDER_VERSION request\n",
                       strerror(errno));
  }
  ksft_print_msg("Detected binder version: %d\n", version.protocol_version);
  ksft_inc_pass_cnt();
  ret = unlink("/dev/binderfs/my-binder");
  if (ret < 0) {
    keep ?: rmdir_protect_errno("/dev/binderfs");
    ksft_exit_fail_msg("%s - Failed to delete binder device\n",
                       strerror(errno));
  }
  ksft_inc_pass_cnt();
  ret = unlink("/dev/binderfs/binder-control");
  if (!ret) {
    keep ?: rmdir_protect_errno("/dev/binderfs");
    ksft_exit_fail_msg("Managed to delete binder-control device\n");
  } else if (errno != EPERM) {
    keep ?: rmdir_protect_errno("/dev/binderfs");
    ksft_exit_fail_msg("%s - Failed to delete binder-control device but exited "
                       "with unexpected error code\n",
                       strerror(errno));
  }
  ksft_inc_xfail_cnt();
on_error:
  ret = umount2("/dev/binderfs", MNT_DETACH);
  keep ?: rmdir_protect_errno("/dev/binderfs");
  if (ret < 0)
    ksft_exit_fail_msg("%s - Failed to unmount binderfs\n", strerror(errno));
  ksft_inc_pass_cnt();
}


x86 assembly (clang, -O0):
<__do_binderfs_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x20(%rbp)
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
mov    $0x0,%al
call   1110 <change_to_mountns@plt>
lea    0xda3(%rip),%rdi
mov    $0x1ed,%esi
call   1040 <mkdir@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    12b1 <__do_binderfs_test+0x91>
mov    0x2d4d(%rip),%rax
mov    (%rax),%eax
mov    0x2d4c(%rip),%rcx
cmp    (%rcx),%eax
je     12aa <__do_binderfs_test+0x8a>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    %eax,%esi
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
movl   $0x1,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xd44(%rip),%rsi
lea    0xe8d(%rip),%rdx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1090 <mount@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    133a <__do_binderfs_test+0x11a>
mov    0x2ce6(%rip),%rax
mov    (%rax),%eax
mov    0x2ccd(%rip),%rcx
cmp    (%rcx),%eax
je     1311 <__do_binderfs_test+0xf1>
mov    0x2cce(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    %eax,%esi
lea    0xd2f(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x20(%rbp),%eax
cmp    $0x0,%eax
je     1322 <__do_binderfs_test+0x102>
jmp    132e <__do_binderfs_test+0x10e>
lea    0xcd7(%rip),%rdi
call   10f0 <rmdir_protect_errno@plt>
lea    0xd23(%rip),%rdi
call   10a0 <ksft_exit_skip@plt>
mov    $0x0,%al
call   1050 <ksft_inc_pass_cnt@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x54(%rbp)
lea    0xdff(%rip),%rdi
call   1080 <strlen@plt>
mov    -0x54(%rbp),%edi
mov    %eax,%edx
lea    0xdee(%rip),%rsi
call   10e0 <memcpy@plt>
mov    0x2c7d(%rip),%rax
mov    (%rax),%esi
mov    0x2c2c(%rip),%rax
or     (%rax),%esi
lea    0xd0d(%rip),%rdi
call   1120 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    13ad <__do_binderfs_test+0x18d>
mov    0x2c32(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    %eax,%esi
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x4(%rbp),%edi
mov    0x2c29(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdx
call   10c0 <ioctl@plt>
mov    %eax,-0x8(%rbp)
mov    0x2bfc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   10d0 <close@plt>
mov    -0xc(%rbp),%ecx
mov    0x2be5(%rip),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x8(%rbp)
jge    142a <__do_binderfs_test+0x20a>
mov    -0x20(%rbp),%eax
cmp    $0x0,%eax
je     1400 <__do_binderfs_test+0x1e0>
jmp    140c <__do_binderfs_test+0x1ec>
lea    0xbf9(%rip),%rdi
call   10f0 <rmdir_protect_errno@plt>
mov    0x2bb5(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    %eax,%esi
lea    0xcaf(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    -0x34(%rbp),%ecx
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1100 <ksft_print_msg@plt>
mov    $0x0,%al
call   1050 <ksft_inc_pass_cnt@plt>
mov    0x2b51(%rip),%rax
mov    (%rax),%esi
mov    0x2b90(%rip),%rax
or     (%rax),%esi
lea    0xcde(%rip),%rdi
call   1120 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    14ae <__do_binderfs_test+0x28e>
mov    -0x20(%rbp),%eax
cmp    $0x0,%eax
je     1484 <__do_binderfs_test+0x264>
jmp    1490 <__do_binderfs_test+0x270>
lea    0xb75(%rip),%rdi
call   10f0 <rmdir_protect_errno@plt>
mov    0x2b31(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    %eax,%esi
lea    0xcb0(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x4(%rbp),%edi
mov    0x2af8(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   10c0 <ioctl@plt>
mov    %eax,-0x8(%rbp)
mov    0x2afb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   10d0 <close@plt>
mov    -0xc(%rbp),%ecx
mov    0x2ae4(%rip),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x8(%rbp)
jge    152b <__do_binderfs_test+0x30b>
mov    -0x20(%rbp),%eax
cmp    $0x0,%eax
je     1501 <__do_binderfs_test+0x2e1>
jmp    150d <__do_binderfs_test+0x2ed>
lea    0xaf8(%rip),%rdi
call   10f0 <rmdir_protect_errno@plt>
mov    0x2ab4(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    %eax,%esi
lea    0xc59(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x50(%rbp),%esi
lea    0xc7c(%rip),%rdi
mov    $0x0,%al
call   1100 <ksft_print_msg@plt>
mov    $0x0,%al
call   1050 <ksft_inc_pass_cnt@plt>
lea    0xbf5(%rip),%rdi
call   1030 <unlink@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1597 <__do_binderfs_test+0x377>
mov    -0x20(%rbp),%eax
cmp    $0x0,%eax
je     156d <__do_binderfs_test+0x34d>
jmp    1579 <__do_binderfs_test+0x359>
lea    0xa8c(%rip),%rdi
call   10f0 <rmdir_protect_errno@plt>
mov    0x2a48(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    %eax,%esi
lea    0xc3e(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    $0x0,%al
call   1050 <ksft_inc_pass_cnt@plt>
lea    0xae5(%rip),%rdi
call   1030 <unlink@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    15e7 <__do_binderfs_test+0x3c7>
mov    -0x20(%rbp),%eax
cmp    $0x0,%eax
je     15c8 <__do_binderfs_test+0x3a8>
jmp    15d4 <__do_binderfs_test+0x3b4>
lea    0xa31(%rip),%rdi
call   10f0 <rmdir_protect_errno@plt>
lea    0xc18(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
jmp    163f <__do_binderfs_test+0x41f>
mov    0x29da(%rip),%rax
mov    (%rax),%eax
mov    0x29a1(%rip),%rcx
cmp    (%rcx),%eax
je     163a <__do_binderfs_test+0x41a>
mov    -0x20(%rbp),%eax
cmp    $0x0,%eax
je     1610 <__do_binderfs_test+0x3f0>
jmp    161c <__do_binderfs_test+0x3fc>
lea    0x9e9(%rip),%rdi
call   10f0 <rmdir_protect_errno@plt>
mov    0x29a5(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    %eax,%esi
lea    0xbe9(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
jmp    163f <__do_binderfs_test+0x41f>
mov    $0x0,%al
call   1130 <ksft_inc_xfail_cnt@plt>
mov    0x2973(%rip),%rax
mov    (%rax),%esi
lea    0x9aa(%rip),%rdi
call   1060 <umount2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
cmp    $0x0,%eax
je     166f <__do_binderfs_test+0x44f>
jmp    167b <__do_binderfs_test+0x45b>
lea    0x98a(%rip),%rdi
call   10f0 <rmdir_protect_errno@plt>
cmpl   $0x0,-0x8(%rbp)
jge    16a3 <__do_binderfs_test+0x483>
mov    0x293c(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    %eax,%esi
lea    0xbd3(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    $0x0,%al
call   1050 <ksft_inc_pass_cnt@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__do_binderfs_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x30(%rsp)
xor    %eax,%eax
call   1100 <change_to_mountns@plt>
lea    0xdb8(%rip),%rdi
mov    $0x1ed,%esi
call   1040 <mkdir@plt>
mov    %eax,%r14d
test   %eax,%eax
jns    1282 <__do_binderfs_test+0x72>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
mov    0x2d67(%rip),%rax
cmp    (%rax),%edi
je     1282 <__do_binderfs_test+0x72>
call   1130 <strerror@plt>
lea    0xd95(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
lea    0xd77(%rip),%rsi
lea    0xec0(%rip),%rdx
xor    %edi,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1090 <mount@plt>
test   %eax,%eax
jns    12e6 <__do_binderfs_test+0xd6>
mov    0x2d21(%rip),%rax
mov    (%rax),%edi
mov    0x2d08(%rip),%rax
cmp    (%rax),%edi
je     12c9 <__do_binderfs_test+0xb9>
call   1130 <strerror@plt>
lea    0xd79(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
test   %r14d,%r14d
js     12da <__do_binderfs_test+0xca>
lea    0xd2b(%rip),%rdi
call   10e0 <rmdir_protect_errno@plt>
lea    0xd77(%rip),%rdi
call   10a0 <ksft_exit_skip@plt>
xor    %eax,%eax
call   1050 <ksft_inc_pass_cnt@plt>
lea    0xe59(%rip),%rbx
mov    %rbx,%rdi
call   1080 <strlen@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   10d0 <memcpy@plt>
mov    0x2cd9(%rip),%r12
mov    0x2c8a(%rip),%rax
mov    (%rax),%esi
or     (%r12),%esi
lea    0xd67(%rip),%rdi
call   1110 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    134c <__do_binderfs_test+0x13c>
mov    0x2c93(%rip),%rax
mov    (%rax),%edi
call   1130 <strerror@plt>
lea    0xd64(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x2c8d(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %ebp,%edi
call   10b0 <ioctl@plt>
mov    %eax,%ebx
mov    0x2c60(%rip),%r13
mov    0x0(%r13),%r15d
mov    %ebp,%edi
call   10c0 <close@plt>
mov    %r13,%rbp
mov    %r15d,0x0(%r13)
test   %ebx,%ebx
jns    13ab <__do_binderfs_test+0x19b>
test   %r14d,%r14d
js     1393 <__do_binderfs_test+0x183>
lea    0xc76(%rip),%rdi
call   10e0 <rmdir_protect_errno@plt>
mov    0x0(%rbp),%r15d
mov    %r15d,%edi
call   1130 <strerror@plt>
lea    0xd30(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0xc(%rsp),%esi
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%edx
lea    0xd3f(%rip),%rdi
xor    %eax,%eax
call   10f0 <ksft_print_msg@plt>
xor    %eax,%eax
call   1050 <ksft_inc_pass_cnt@plt>
mov    (%r12),%esi
mov    0x2bc9(%rip),%rax
or     (%rax),%esi
lea    0xd5f(%rip),%rdi
call   1110 <open@plt>
mov    %eax,%r15d
test   %eax,%eax
mov    %rbp,%r12
jns    1419 <__do_binderfs_test+0x209>
test   %r14d,%r14d
js     1400 <__do_binderfs_test+0x1f0>
lea    0xc05(%rip),%rdi
call   10e0 <rmdir_protect_errno@plt>
mov    (%r12),%edi
call   1130 <strerror@plt>
lea    0xd47(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x2b90(%rip),%rax
mov    (%rax),%esi
lea    0x20(%rsp),%rdx
mov    %r15d,%edi
call   10b0 <ioctl@plt>
mov    %eax,%ebp
mov    (%r12),%ebx
mov    %r15d,%edi
call   10c0 <close@plt>
mov    %ebx,(%r12)
test   %ebp,%ebp
jns    1471 <__do_binderfs_test+0x261>
test   %r14d,%r14d
js     145a <__do_binderfs_test+0x24a>
lea    0xbaf(%rip),%rdi
call   10e0 <rmdir_protect_errno@plt>
mov    (%r12),%ebx
mov    %ebx,%edi
call   1130 <strerror@plt>
lea    0xd15(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x20(%rsp),%esi
lea    0xd35(%rip),%rdi
xor    %eax,%eax
call   10f0 <ksft_print_msg@plt>
xor    %eax,%eax
call   1050 <ksft_inc_pass_cnt@plt>
lea    0xcae(%rip),%rdi
call   1030 <unlink@plt>
test   %eax,%eax
jns    14c4 <__do_binderfs_test+0x2b4>
test   %r14d,%r14d
js     14ab <__do_binderfs_test+0x29b>
lea    0xb5a(%rip),%rdi
call   10e0 <rmdir_protect_errno@plt>
mov    (%r12),%edi
call   1130 <strerror@plt>
lea    0xd13(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
xor    %eax,%eax
call   1050 <ksft_inc_pass_cnt@plt>
lea    0xbb8(%rip),%rdi
call   1030 <unlink@plt>
test   %eax,%eax
je     1516 <__do_binderfs_test+0x306>
mov    (%r12),%edi
mov    0x2ab2(%rip),%rax
cmp    (%rax),%edi
je     1535 <__do_binderfs_test+0x325>
test   %r14d,%r14d
js     14ff <__do_binderfs_test+0x2ef>
lea    0xb0a(%rip),%rdi
call   10e0 <rmdir_protect_errno@plt>
mov    (%r12),%edi
call   1130 <strerror@plt>
lea    0xd11(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
jmp    1535 <__do_binderfs_test+0x325>
test   %r14d,%r14d
js     1527 <__do_binderfs_test+0x317>
lea    0xade(%rip),%rdi
call   10e0 <rmdir_protect_errno@plt>
lea    0xcc5(%rip),%rdi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
xor    %eax,%eax
call   1120 <ksft_inc_xfail_cnt@plt>
mov    0x2a7d(%rip),%rax
mov    (%rax),%esi
lea    0xab4(%rip),%rdi
call   1060 <umount2@plt>
mov    %eax,%ebx
test   %r14d,%r14d
js     1564 <__do_binderfs_test+0x354>
lea    0xaa1(%rip),%rdi
call   10e0 <rmdir_protect_errno@plt>
test   %ebx,%ebx
jns    1581 <__do_binderfs_test+0x371>
mov    (%r12),%edi
call   1130 <strerror@plt>
lea    0xcf7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
xor    %eax,%eax
call   1050 <ksft_inc_pass_cnt@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.binderfs_device = type { i32, i32, i32, i32, i32 }
%struct.binder_version = type { i32, i32, i32, i32, i32 }
@.str = [14 x i8] c"/dev/binderfs\00"
@errno = global i32 0
@EEXIST = global i32 0
@.str.1 = [43 x i8] c"%s - Failed to create binderfs mountpoint\0A\00"
@.str.2 = [7 x i8] c"binder\00"
@ENODEV = global i32 0
@.str.3 = [31 x i8] c"%s - Failed to mount binderfs\0A\00"
@.str.4 = [50 x i8] c"The Android binderfs filesystem is not available\0A\00"
@.str.5 = [10 x i8] c"my-binder\00"
@.str.6 = [29 x i8] c"/dev/binderfs/binder-control\00"
@O_RDONLY = global i32 0
@O_CLOEXEC = global i32 0
@.str.7 = [43 x i8] c"%s - Failed to open binder-control device\0A\00"
@BINDER_CTL_ADD = global i32 0
@.str.8 = [43 x i8] c"%s - Failed to allocate new binder device\0A\00"
@.str.9 = [66 x i8] c"Allocated new binder device with major %d, minor %d, and name %s\0A\00"
@.str.10 = [24 x i8] c"/dev/binderfs/my-binder\00"
@.str.11 = [38 x i8] c"%s - Failed to open my-binder device\0A\00"
@BINDER_VERSION = global i32 0
@.str.12 = [52 x i8] c"%s - Failed to open perform BINDER_VERSION request\0A\00"
@.str.13 = [29 x i8] c"Detected binder version: %d\0A\00"
@.str.14 = [37 x i8] c"%s - Failed to delete binder device\0A\00"
@.str.15 = [41 x i8] c"Managed to delete binder-control device\0A\00"
@EPERM = global i32 0
@.str.16 = [83 x i8] c"%s - Failed to delete binder-control device but exited with unexpected error code\0A\00"
@MNT_DETACH = global i32 0
@.str.17 = [33 x i8] c"%s - Failed to unmount binderfs\0A\00"
define void @__do_binderfs_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.binderfs_device
%8 = alloca %struct.binder_version
store i32 0, i32* %6
%9 = bitcast %struct.binderfs_device* %7 to i8*
%10 = bitcast %struct.binder_version* %8 to i8*
%11 = call i32 (...) @change_to_mountns()
%12 = call i32 @mkdir(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 493)
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %0
%16 = load i32, i32* @errno
%17 = load i32, i32* @EEXIST
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i32, i32* @errno
%21 = call i32 @strerror(i32 %20)
%22 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %19, %15
store i32 1, i32* %6
br label %24
24: ; preds = %23, %0
%25 = call i32 @mount(i32* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 0)
store i32 %25, i32* %2
%26 = load i32, i32* %2
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %45
28: ; preds = %24
%29 = load i32, i32* @errno
%30 = load i32, i32* @ENODEV
%31 = icmp ne i32 %29, %30
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i32, i32* @errno
%34 = call i32 @strerror(i32 %33)
%35 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %32, %28
%37 = load i32, i32* %6
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %36
br label %42
40: ; preds = %36
%41 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %42
42: ; preds = %40, %39
%43 = phi i32 [ %37, %39 ], [ %41, %40 ]
%44 = call i32 @ksft_exit_skip(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
br label %45
45: ; preds = %42, %24
%46 = call i32 (...) @ksft_inc_pass_cnt()
%47 = getelementptr inbounds %struct.binderfs_device, %struct.binderfs_device* %7, i32 0, i32 1
%48 = load i32, i32* %47
%49 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%50 = call i32 @memcpy(i32 %48, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %49)
%51 = load i32, i32* @O_RDONLY
%52 = load i32, i32* @O_CLOEXEC
%53 = or i32 %51, %52
%54 = call i32 @open(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %53)
store i32 %54, i32* %1
%55 = load i32, i32* %1
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %61
57: ; preds = %45
%58 = load i32, i32* @errno
%59 = call i32 @strerror(i32 %58)
%60 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %57, %45
%62 = load i32, i32* %1
%63 = load i32, i32* @BINDER_CTL_ADD
%64 = call i32 @ioctl(i32 %62, i32 %63, %struct.binderfs_device* %7)
store i32 %64, i32* %2
%65 = load i32, i32* @errno
store i32 %65, i32* %3
%66 = load i32, i32* %1
%67 = call i32 @close(i32 %66)
%68 = load i32, i32* %3
store i32 %68, i32* @errno
%69 = load i32, i32* %2
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %82
71: ; preds = %61
%72 = load i32, i32* %6
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %71
br label %77
75: ; preds = %71
%76 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %77
77: ; preds = %75, %74
%78 = phi i32 [ %72, %74 ], [ %76, %75 ]
%79 = load i32, i32* @errno
%80 = call i32 @strerror(i32 %79)
%81 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i32 %80)
br label %82
82: ; preds = %77, %61
%83 = getelementptr inbounds %struct.binderfs_device, %struct.binderfs_device* %7, i32 0, i32 3
%84 = load i32, i32* %83
%85 = getelementptr inbounds %struct.binderfs_device, %struct.binderfs_device* %7, i32 0, i32 2
%86 = load i32, i32* %85
%87 = getelementptr inbounds %struct.binderfs_device, %struct.binderfs_device* %7, i32 0, i32 1
%88 = load i32, i32* %87
%89 = call i32 (i8*, i32, ...) @ksft_print_msg(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.9, i64 0, i64 0), i32 %84, i32 %86, i32 %88)
%90 = call i32 (...) @ksft_inc_pass_cnt()
%91 = load i32, i32* @O_CLOEXEC
%92 = load i32, i32* @O_RDONLY
%93 = or i32 %91, %92
%94 = call i32 @open(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i32 %93)
store i32 %94, i32* %1
%95 = load i32, i32* %1
%96 = icmp slt i32 %95, 0
br i1 %96, label %97, label %108
97: ; preds = %82
%98 = load i32, i32* %6
%99 = icmp ne i32 %98, 0
br i1 %99, label %100, label %101
100: ; preds = %97
br label %103
101: ; preds = %97
%102 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %103
103: ; preds = %101, %100
%104 = phi i32 [ %98, %100 ], [ %102, %101 ]
%105 = load i32, i32* @errno
%106 = call i32 @strerror(i32 %105)
%107 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %106)
br label %108
108: ; preds = %103, %82
%109 = load i32, i32* %1
%110 = load i32, i32* @BINDER_VERSION
%111 = bitcast %struct.binder_version* %8 to %struct.binderfs_device*
%112 = call i32 @ioctl(i32 %109, i32 %110, %struct.binderfs_device* %111)
store i32 %112, i32* %2
%113 = load i32, i32* @errno
store i32 %113, i32* %3
%114 = load i32, i32* %1
%115 = call i32 @close(i32 %114)
%116 = load i32, i32* %3
store i32 %116, i32* @errno
%117 = load i32, i32* %2
%118 = icmp slt i32 %117, 0
br i1 %118, label %119, label %130
119: ; preds = %108
%120 = load i32, i32* %6
%121 = icmp ne i32 %120, 0
br i1 %121, label %122, label %123
122: ; preds = %119
br label %125
123: ; preds = %119
%124 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %125
125: ; preds = %123, %122
%126 = phi i32 [ %120, %122 ], [ %124, %123 ]
%127 = load i32, i32* @errno
%128 = call i32 @strerror(i32 %127)
%129 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.12, i64 0, i64 0), i32 %128)
br label %130
130: ; preds = %125, %108
%131 = getelementptr inbounds %struct.binder_version, %struct.binder_version* %8, i32 0, i32 0
%132 = load i32, i32* %131
%133 = call i32 (i8*, i32, ...) @ksft_print_msg(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i32 %132)
%134 = call i32 (...) @ksft_inc_pass_cnt()
%135 = call i32 @unlink(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
store i32 %135, i32* %2
%136 = load i32, i32* %2
%137 = icmp slt i32 %136, 0
br i1 %137, label %138, label %149
138: ; preds = %130
%139 = load i32, i32* %6
%140 = icmp ne i32 %139, 0
br i1 %140, label %141, label %142
141: ; preds = %138
br label %144
142: ; preds = %138
%143 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %144
144: ; preds = %142, %141
%145 = phi i32 [ %139, %141 ], [ %143, %142 ]
%146 = load i32, i32* @errno
%147 = call i32 @strerror(i32 %146)
%148 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.14, i64 0, i64 0), i32 %147)
br label %149
149: ; preds = %144, %130
%150 = call i32 (...) @ksft_inc_pass_cnt()
%151 = call i32 @unlink(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
store i32 %151, i32* %2
%152 = load i32, i32* %2
%153 = icmp ne i32 %152, 0
br i1 %153, label %163, label %154
154: ; preds = %149
%155 = load i32, i32* %6
%156 = icmp ne i32 %155, 0
br i1 %156, label %157, label %158
157: ; preds = %154
br label %160
158: ; preds = %154
%159 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %160
160: ; preds = %158, %157
%161 = phi i32 [ %155, %157 ], [ %159, %158 ]
%162 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0))
br label %179
163: ; preds = %149
%164 = load i32, i32* @errno
%165 = load i32, i32* @EPERM
%166 = icmp ne i32 %164, %165
br i1 %166, label %167, label %178
167: ; preds = %163
%168 = load i32, i32* %6
%169 = icmp ne i32 %168, 0
br i1 %169, label %170, label %171
170: ; preds = %167
br label %173
171: ; preds = %167
%172 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %173
173: ; preds = %171, %170
%174 = phi i32 [ %168, %170 ], [ %172, %171 ]
%175 = load i32, i32* @errno
%176 = call i32 @strerror(i32 %175)
%177 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.16, i64 0, i64 0), i32 %176)
br label %178
178: ; preds = %173, %163
br label %179
179: ; preds = %178, %160
%180 = call i32 (...) @ksft_inc_xfail_cnt()
br label %181
181: ; preds = %179
%182 = load i32, i32* @MNT_DETACH
%183 = call i32 @umount2(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %182)
store i32 %183, i32* %2
%184 = load i32, i32* %6
%185 = icmp ne i32 %184, 0
br i1 %185, label %186, label %187
186: ; preds = %181
br label %189
187: ; preds = %181
%188 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %189
189: ; preds = %187, %186
%190 = phi i32 [ %184, %186 ], [ %188, %187 ]
%191 = load i32, i32* %2
%192 = icmp slt i32 %191, 0
br i1 %192, label %193, label %197
193: ; preds = %189
%194 = load i32, i32* @errno
%195 = call i32 @strerror(i32 %194)
%196 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0), i32 %195)
br label %197
197: ; preds = %193, %189
%198 = call i32 (...) @ksft_inc_pass_cnt()
ret void
}

LLVM IR (-O2):
%struct.binderfs_device = type { i32, i32, i32, i32, i32 }
%struct.binder_version = type { i32, i32, i32, i32, i32 }
@.str = [14 x i8] c"/dev/binderfs\00"
@errno = global i32 0
@EEXIST = global i32 0
@.str.1 = [43 x i8] c"%s - Failed to create binderfs mountpoint\0A\00"
@.str.2 = [7 x i8] c"binder\00"
@ENODEV = global i32 0
@.str.3 = [31 x i8] c"%s - Failed to mount binderfs\0A\00"
@.str.4 = [50 x i8] c"The Android binderfs filesystem is not available\0A\00"
@.str.5 = [10 x i8] c"my-binder\00"
@.str.6 = [29 x i8] c"/dev/binderfs/binder-control\00"
@O_RDONLY = global i32 0
@O_CLOEXEC = global i32 0
@.str.7 = [43 x i8] c"%s - Failed to open binder-control device\0A\00"
@BINDER_CTL_ADD = global i32 0
@.str.8 = [43 x i8] c"%s - Failed to allocate new binder device\0A\00"
@.str.9 = [66 x i8] c"Allocated new binder device with major %d, minor %d, and name %s\0A\00"
@.str.10 = [24 x i8] c"/dev/binderfs/my-binder\00"
@.str.11 = [38 x i8] c"%s - Failed to open my-binder device\0A\00"
@BINDER_VERSION = global i32 0
@.str.12 = [52 x i8] c"%s - Failed to open perform BINDER_VERSION request\0A\00"
@.str.13 = [29 x i8] c"Detected binder version: %d\0A\00"
@.str.14 = [37 x i8] c"%s - Failed to delete binder device\0A\00"
@.str.15 = [41 x i8] c"Managed to delete binder-control device\0A\00"
@EPERM = global i32 0
@.str.16 = [83 x i8] c"%s - Failed to delete binder-control device but exited with unexpected error code\0A\00"
@MNT_DETACH = global i32 0
@.str.17 = [33 x i8] c"%s - Failed to unmount binderfs\0A\00"
define void @__do_binderfs_test() {
%1 = alloca %struct.binderfs_device
%2 = alloca %struct.binder_version
%3 = bitcast %struct.binderfs_device* %1 to i8*
%4 = bitcast %struct.binder_version* %2 to i8*
%5 = tail call i32 (...) @change_to_mountns()
%6 = tail call i32 @mkdir(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 493)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %0
%9 = load i32, i32* @errno
%10 = load i32, i32* @EEXIST
%11 = icmp eq i32 %9, %10
br i1 %11, label %15, label %12
12: ; preds = %8
%13 = tail call i32 @strerror(i32 %9)
%14 = tail call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %8, %12, %0
%16 = tail call i32 @mount(i32* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 0)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %30
18: ; preds = %15
%19 = load i32, i32* @errno
%20 = load i32, i32* @ENODEV
%21 = icmp eq i32 %19, %20
br i1 %21, label %25, label %22
22: ; preds = %18
%23 = tail call i32 @strerror(i32 %19)
%24 = tail call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %18
br i1 %7, label %28, label %26
26: ; preds = %25
%27 = tail call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %28
28: ; preds = %25, %26
%29 = tail call i32 @ksft_exit_skip(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %28, %15
%31 = tail call i32 (...) @ksft_inc_pass_cnt()
%32 = getelementptr inbounds %struct.binderfs_device, %struct.binderfs_device* %1, i64 0, i32 1
%33 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%34 = tail call i32 @memcpy(i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %33)
%35 = load i32, i32* @O_RDONLY
%36 = load i32, i32* @O_CLOEXEC
%37 = or i32 %36, %35
%38 = tail call i32 @open(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %37)
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %30
%41 = load i32, i32* @errno
%42 = tail call i32 @strerror(i32 %41)
%43 = tail call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %40, %30
%45 = load i32, i32* @BINDER_CTL_ADD
%46 = call i32 @ioctl(i32 %38, i32 %45, %struct.binderfs_device* %1)
%47 = load i32, i32* @errno
%48 = call i32 @close(i32 %38)
store i32 %47, i32* @errno
%49 = icmp slt i32 %46, 0
br i1 %49, label %50, label %58
50: ; preds = %44
br i1 %7, label %54, label %51
51: ; preds = %50
%52 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%53 = load i32, i32* @errno
br label %54
54: ; preds = %50, %51
%55 = phi i32 [ %47, %50 ], [ %53, %51 ]
%56 = call i32 @strerror(i32 %55)
%57 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i32 %56)
br label %58
58: ; preds = %54, %44
%59 = getelementptr inbounds %struct.binderfs_device, %struct.binderfs_device* %1, i64 0, i32 3
%60 = load i32, i32* %59
%61 = getelementptr inbounds %struct.binderfs_device, %struct.binderfs_device* %1, i64 0, i32 2
%62 = load i32, i32* %61
%63 = load i32, i32* %32
%64 = call i32 (i8*, i32, ...) @ksft_print_msg(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.9, i64 0, i64 0), i32 %60, i32 %62, i32 %63)
%65 = call i32 (...) @ksft_inc_pass_cnt()
%66 = load i32, i32* @O_CLOEXEC
%67 = load i32, i32* @O_RDONLY
%68 = or i32 %67, %66
%69 = call i32 @open(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i32 %68)
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %78
71: ; preds = %58
br i1 %7, label %74, label %72
72: ; preds = %71
%73 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %74
74: ; preds = %71, %72
%75 = load i32, i32* @errno
%76 = call i32 @strerror(i32 %75)
%77 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %76)
br label %78
78: ; preds = %74, %58
%79 = load i32, i32* @BINDER_VERSION
%80 = bitcast %struct.binder_version* %2 to %struct.binderfs_device*
%81 = call i32 @ioctl(i32 %69, i32 %79, %struct.binderfs_device* %80)
%82 = load i32, i32* @errno
%83 = call i32 @close(i32 %69)
store i32 %82, i32* @errno
%84 = icmp slt i32 %81, 0
br i1 %84, label %85, label %93
85: ; preds = %78
br i1 %7, label %89, label %86
86: ; preds = %85
%87 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%88 = load i32, i32* @errno
br label %89
89: ; preds = %85, %86
%90 = phi i32 [ %82, %85 ], [ %88, %86 ]
%91 = call i32 @strerror(i32 %90)
%92 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.12, i64 0, i64 0), i32 %91)
br label %93
93: ; preds = %89, %78
%94 = getelementptr inbounds %struct.binder_version, %struct.binder_version* %2, i64 0, i32 0
%95 = load i32, i32* %94
%96 = call i32 (i8*, i32, ...) @ksft_print_msg(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i32 %95)
%97 = call i32 (...) @ksft_inc_pass_cnt()
%98 = call i32 @unlink(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%99 = icmp slt i32 %98, 0
br i1 %99, label %100, label %107
100: ; preds = %93
br i1 %7, label %103, label %101
101: ; preds = %100
%102 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %103
103: ; preds = %100, %101
%104 = load i32, i32* @errno
%105 = call i32 @strerror(i32 %104)
%106 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.14, i64 0, i64 0), i32 %105)
br label %107
107: ; preds = %103, %93
%108 = call i32 (...) @ksft_inc_pass_cnt()
%109 = call i32 @unlink(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%110 = icmp eq i32 %109, 0
br i1 %110, label %111, label %116
111: ; preds = %107
br i1 %7, label %114, label %112
112: ; preds = %111
%113 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %114
114: ; preds = %111, %112
%115 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0))
br label %128
116: ; preds = %107
%117 = load i32, i32* @errno
%118 = load i32, i32* @EPERM
%119 = icmp eq i32 %117, %118
br i1 %119, label %128, label %120
120: ; preds = %116
br i1 %7, label %124, label %121
121: ; preds = %120
%122 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%123 = load i32, i32* @errno
br label %124
124: ; preds = %120, %121
%125 = phi i32 [ %117, %120 ], [ %123, %121 ]
%126 = call i32 @strerror(i32 %125)
%127 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.16, i64 0, i64 0), i32 %126)
br label %128
128: ; preds = %116, %124, %114
%129 = call i32 (...) @ksft_inc_xfail_cnt()
%130 = load i32, i32* @MNT_DETACH
%131 = call i32 @umount2(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %130)
br i1 %7, label %134, label %132
132: ; preds = %128
%133 = call i32 @rmdir_protect_errno(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %134
134: ; preds = %128, %132
%135 = icmp slt i32 %131, 0
br i1 %135, label %136, label %140
136: ; preds = %134
%137 = load i32, i32* @errno
%138 = call i32 @strerror(i32 %137)
%139 = call i32 (i8*, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0), i32 %138)
br label %140
140: ; preds = %136, %134
%141 = call i32 (...) @ksft_inc_pass_cnt()
ret void
}