#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 seccomp_notif_sizes {
  int /*<<< orphan*/ seccomp_notif;
  int /*<<< orphan*/ seccomp_notif_resp;
};
struct seccomp_notif_resp {
  int dummy;
};
typedef struct seccomp_notif_resp seccomp_notif;
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ EINVAL;
scalar_t__ ENOENT;
scalar_t__ EPERM;
int /*<<< orphan*/ MNT_DETACH;
int /*<<< orphan*/ MS_BIND;
int /*<<< orphan*/ PF_LOCAL;
int /*<<< orphan*/ SECCOMP_FILTER_FLAG_NEW_LISTENER;
int /*<<< orphan*/ SECCOMP_GET_NOTIF_SIZES;
int /*<<< orphan*/ SECCOMP_IOCTL_NOTIF_RECV;
int /*<<< orphan*/ SECCOMP_IOCTL_NOTIF_SEND;
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ SOCK_SEQPACKET;
scalar_t__ WEXITSTATUS(int);
int /*<<< orphan*/ WIFEXITED(int);
int /*<<< orphan*/ __NR_mount;
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(struct seccomp_notif_resp *);
scalar_t__ handle_req(struct seccomp_notif_resp *, struct seccomp_notif_resp *,
                      int);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct seccomp_notif_resp *);
int /*<<< orphan*/ kill(scalar_t__, int /*<<< orphan*/);
struct seccomp_notif_resp *malloc(int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct seccomp_notif_resp *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
scalar_t__ mkdir(char *, int);
int mount(char *, char *, int /*<<< orphan*/ *, int /*<<< orphan*/,
          int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int recv_fd(int);
scalar_t__ remove(char *);
scalar_t__ seccomp(int /*<<< orphan*/, int /*<<< orphan*/,
                   struct seccomp_notif_sizes *);
scalar_t__ send_fd(int, int);
scalar_t__ setuid(int);
scalar_t__ socketpair(int /*<<< orphan*/, int /*<<< orphan*/,
                      int /*<<< orphan*/, int *);
int /*<<< orphan*/ stderr;
scalar_t__ umount2(char *, int /*<<< orphan*/);
int user_trap_syscall(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ waitpid(scalar_t__, int *, int /*<<< orphan*/);
int main(void) {
  int sk_pair[2], ret = 1, status, listener;
  pid_t worker = 0, tracer = 0;
  if (socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair) < 0) {
    perror("socketpair");
    return 1;
  }
  worker = fork();
  if (worker < 0) {
    perror("fork");
    goto close_pair;
  }
  if (worker == 0) {
    listener = user_trap_syscall(__NR_mount, SECCOMP_FILTER_FLAG_NEW_LISTENER);
    if (listener < 0) {
      perror("seccomp");
      exit(1);
    }
    if (setuid(1000) < 0) {
      perror("setuid");
      exit(1);
    }
    if (send_fd(sk_pair[1], listener) < 0)
      exit(1);
    close(listener);
    if (mkdir("/tmp/foo", 0755) < 0) {
      perror("mkdir");
      exit(1);
    }
    if (mount("/dev/sda", "/tmp/foo", NULL, 0, NULL) != -1) {
      fprintf(stderr, "huh? mounted /dev/sda?\n");
      exit(1);
    }
    if (errno != EPERM) {
      perror("bad error from mount");
      exit(1);
    }
    if (mount("/tmp/foo", "/tmp/foo", NULL, MS_BIND, NULL) < 0) {
      perror("mount");
      exit(1);
    }
    exit(0);
  }
  listener = recv_fd(sk_pair[0]);
  if (listener < 0)
    goto out_kill;
  tracer = fork();
  if (tracer < 0) {
    perror("fork");
    goto out_kill;
  }
  if (tracer == 0) {
    struct seccomp_notif *req;
    struct seccomp_notif_resp *resp;
    struct seccomp_notif_sizes sizes;
    if (seccomp(SECCOMP_GET_NOTIF_SIZES, 0, &sizes) < 0) {
      perror("seccomp(GET_NOTIF_SIZES)");
      goto out_close;
    }
    req = malloc(sizes.seccomp_notif);
    if (!req)
      goto out_close;
    resp = malloc(sizes.seccomp_notif_resp);
    if (!resp)
      goto out_req;
    memset(resp, 0, sizes.seccomp_notif_resp);
    while (1) {
      memset(req, 0, sizes.seccomp_notif);
      if (ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, req)) {
        perror("ioctl recv");
        goto out_resp;
      }
      if (handle_req(req, resp, listener) < 0)
        goto out_resp;
      if (ioctl(listener, SECCOMP_IOCTL_NOTIF_SEND, resp) < 0 &&
          errno != ENOENT) {
        perror("ioctl send");
        goto out_resp;
      }
    }
  out_resp:
    free(resp);
  out_req:
    free(req);
  out_close:
    close(listener);
    exit(1);
  }
  close(listener);
  if (waitpid(worker, &status, 0) != worker) {
    perror("waitpid");
    goto out_kill;
  }
  if (umount2("/tmp/foo", MNT_DETACH) < 0 && errno != EINVAL) {
    perror("umount2");
    goto out_kill;
  }
  if (remove("/tmp/foo") < 0 && errno != ENOENT) {
    perror("remove");
    exit(1);
  }
  if (!WIFEXITED(status) || WEXITSTATUS(status)) {
    fprintf(stderr, "worker exited nonzero\n");
    goto out_kill;
  }
  ret = 0;
out_kill:
  if (tracer > 0)
    kill(tracer, SIGKILL);
  if (worker > 0)
    kill(worker, SIGKILL);
close_pair:
  close(sk_pair[0]);
  close(sk_pair[1]);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
mov    0x2cca(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rcx
xor    %edx,%edx
call   10f0 <socketpair@plt>
cmp    $0x0,%rax
jge    12e5 <main+0x65>
lea    0xd2c(%rip),%rdi
call   1160 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    177a <main+0x4fa>
mov    $0x0,%al
call   11a0 <fork@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    130c <main+0x8c>
lea    0xd09(%rip),%rdi
call   1160 <perror@plt>
jmp    1764 <main+0x4e4>
cmpq   $0x0,-0x20(%rbp)
jne    148e <main+0x20e>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
mov    0x2c81(%rip),%rax
mov    (%rax),%esi
call   10e0 <user_trap_syscall@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1351 <main+0xd1>
lea    0xcce(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    $0x3e8,%edi
call   1190 <setuid@plt>
cmp    $0x0,%rax
jge    137b <main+0xfb>
lea    0xcac(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1080 <send_fd@plt>
cmp    $0x0,%rax
jge    139a <main+0x11a>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    -0x18(%rbp),%edi
call   10b0 <close@plt>
lea    0xc76(%rip),%rdi
mov    $0x1ed,%esi
call   1050 <mkdir@plt>
cmp    $0x0,%rax
jge    13d3 <main+0x153>
lea    0xc64(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
lea    0xc54(%rip),%rdi
lea    0xc3e(%rip),%rsi
xor    %eax,%eax
mov    %eax,%r8d
xor    %ecx,%ecx
mov    %r8,%rdx
call   1070 <mount@plt>
cmp    $0xffffffff,%eax
je     1418 <main+0x198>
mov    0x2bc0(%rip),%rax
mov    (%rax),%edi
lea    0xc2e(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    0x2b91(%rip),%rax
mov    (%rax),%rax
mov    0x2b3f(%rip),%rcx
cmp    (%rcx),%rax
je     1448 <main+0x1c8>
lea    0xc16(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    0x2b89(%rip),%rax
mov    (%rax),%ecx
lea    0xbc7(%rip),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
mov    %r8,%rdx
call   1070 <mount@plt>
cmp    $0x0,%eax
jge    1487 <main+0x207>
lea    0xbe6(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    -0xc(%rbp),%edi
call   1110 <recv_fd@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    14a8 <main+0x228>
jmp    1725 <main+0x4a5>
mov    $0x0,%al
call   11a0 <fork@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jge    14cf <main+0x24f>
lea    0xb46(%rip),%rdi
call   1160 <perror@plt>
jmp    1725 <main+0x4a5>
cmpq   $0x0,-0x28(%rbp)
jne    161f <main+0x39f>
mov    0x2ad7(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
lea    -0x40(%rbp),%rdx
call   1130 <seccomp@plt>
cmp    $0x0,%rax
jge    1509 <main+0x289>
lea    0xb65(%rip),%rdi
call   1160 <perror@plt>
jmp    160d <main+0x38d>
mov    -0x40(%rbp),%edi
call   1120 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1525 <main+0x2a5>
jmp    160d <main+0x38d>
mov    -0x3c(%rbp),%edi
call   1120 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1541 <main+0x2c1>
jmp    1604 <main+0x384>
mov    -0x38(%rbp),%rdi
mov    -0x3c(%rbp),%edx
xor    %esi,%esi
call   1090 <memset@plt>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%edx
xor    %esi,%esi
call   1090 <memset@plt>
mov    -0x18(%rbp),%edi
mov    0x2a61(%rip),%rax
mov    (%rax),%esi
mov    -0x30(%rbp),%rdx
call   10a0 <ioctl@plt>
cmp    $0x0,%rax
je     158d <main+0x30d>
lea    0xafa(%rip),%rdi
call   1160 <perror@plt>
jmp    15fb <main+0x37b>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   10c0 <handle_req@plt>
cmp    $0x0,%rax
jge    15ac <main+0x32c>
jmp    15fb <main+0x37b>
mov    -0x18(%rbp),%edi
mov    0x2a2a(%rip),%rax
mov    (%rax),%esi
mov    -0x38(%rbp),%rdx
call   10a0 <ioctl@plt>
cmp    $0x0,%rax
jge    15f6 <main+0x376>
mov    0x29de(%rip),%rax
mov    (%rax),%rax
mov    0x2994(%rip),%rcx
cmp    (%rcx),%rax
je     15f6 <main+0x376>
lea    0xa9c(%rip),%rdi
call   1160 <perror@plt>
jmp    15fb <main+0x37b>
jmp    154f <main+0x2cf>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%edi
call   10b0 <close@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    -0x18(%rbp),%edi
call   10b0 <close@plt>
mov    -0x20(%rbp),%rdi
lea    -0x14(%rbp),%rsi
xor    %edx,%edx
call   1150 <waitpid@plt>
cmp    -0x20(%rbp),%rax
je     1651 <main+0x3d1>
lea    0xa4c(%rip),%rdi
call   1160 <perror@plt>
jmp    1725 <main+0x4a5>
mov    0x2948(%rip),%rax
mov    (%rax),%esi
lea    0x9be(%rip),%rdi
call   1060 <umount2@plt>
cmp    $0x0,%rax
jge    169b <main+0x41b>
mov    0x2939(%rip),%rax
mov    (%rax),%rax
mov    0x2917(%rip),%rcx
cmp    (%rcx),%rax
je     169b <main+0x41b>
lea    0xa0a(%rip),%rdi
call   1160 <perror@plt>
jmp    1725 <main+0x4a5>
lea    0x97d(%rip),%rdi
call   1040 <remove@plt>
cmp    $0x0,%rax
jge    16e1 <main+0x461>
mov    0x28f8(%rip),%rax
mov    (%rax),%rax
mov    0x28ae(%rip),%rcx
cmp    (%rcx),%rax
je     16e1 <main+0x461>
lea    0x9d1(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    -0x14(%rbp),%edi
call   1170 <WIFEXITED@plt>
cmp    $0x0,%eax
je     1704 <main+0x484>
mov    -0x14(%rbp),%edi
call   1140 <WEXITSTATUS@plt>
cmp    $0x0,%rax
je     171e <main+0x49e>
mov    0x28b5(%rip),%rax
mov    (%rax),%edi
lea    0x996(%rip),%rsi
call   10d0 <fprintf@plt>
jmp    1725 <main+0x4a5>
movl   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x28(%rbp)
jle    1742 <main+0x4c2>
mov    -0x28(%rbp),%rdi
mov    0x2855(%rip),%rax
mov    (%rax),%esi
call   1100 <kill@plt>
cmpq   $0x0,-0x20(%rbp)
jle    175f <main+0x4df>
mov    -0x20(%rbp),%rdi
mov    0x2838(%rip),%rax
mov    (%rax),%esi
call   1100 <kill@plt>
jmp    1764 <main+0x4e4>
mov    -0xc(%rbp),%edi
call   10b0 <close@plt>
mov    -0x8(%rbp),%edi
call   10b0 <close@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
mov    0x2ce2(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rcx
xor    %edx,%edx
call   10f0 <socketpair@plt>
test   %rax,%rax
js     13f9 <main+0x179>
xor    %eax,%eax
call   11a0 <fork@plt>
test   %rax,%rax
js     140c <main+0x18c>
je     144f <main+0x1cf>
mov    %rax,%rbx
mov    0x8(%rsp),%edi
call   1110 <recv_fd@plt>
mov    $0x1,%ebp
test   %eax,%eax
js     13c5 <main+0x145>
mov    %eax,%r15d
xor    %eax,%eax
call   11a0 <fork@plt>
test   %rax,%rax
js     141f <main+0x19f>
je     1476 <main+0x1f6>
mov    %rax,%r14
mov    %r15d,%edi
call   10b0 <close@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   1150 <waitpid@plt>
cmp    %rbx,%rax
jne    142d <main+0x1ad>
mov    0x2c7b(%rip),%rax
mov    (%rax),%esi
lea    0xcf1(%rip),%rdi
call   1060 <umount2@plt>
test   %rax,%rax
jns    1352 <main+0xd2>
mov    0x2c71(%rip),%rax
mov    (%rax),%rax
mov    0x2c4f(%rip),%rcx
cmp    (%rcx),%rax
jne    143e <main+0x1be>
lea    0xcc6(%rip),%rdi
call   1040 <remove@plt>
test   %rax,%rax
jns    137d <main+0xfd>
mov    0x2c46(%rip),%rax
mov    (%rax),%rax
mov    0x2bfc(%rip),%rcx
cmp    (%rcx),%rax
jne    14e7 <main+0x267>
mov    (%rsp),%edi
call   1170 <WIFEXITED@plt>
test   %eax,%eax
je     1396 <main+0x116>
mov    (%rsp),%edi
call   1140 <WEXITSTATUS@plt>
test   %rax,%rax
je     13b2 <main+0x132>
mov    0x2c23(%rip),%rax
mov    (%rax),%edi
lea    0xd04(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%ebp
jmp    13b4 <main+0x134>
xor    %ebp,%ebp
mov    0x2bd5(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1100 <kill@plt>
mov    0x2bc4(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1100 <kill@plt>
mov    0x8(%rsp),%edi
call   10b0 <close@plt>
mov    0xc(%rsp),%edi
call   10b0 <close@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc00(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%ebp
jmp    13e8 <main+0x168>
lea    0xbf8(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%ebp
jmp    13d6 <main+0x156>
lea    0xbe5(%rip),%rdi
call   1160 <perror@plt>
jmp    13c5 <main+0x145>
lea    0xc5f(%rip),%rdi
call   1160 <perror@plt>
jmp    13ab <main+0x12b>
lea    0xc56(%rip),%rdi
call   1160 <perror@plt>
jmp    13ab <main+0x12b>
mov    0x2b9a(%rip),%rax
mov    (%rax),%edi
mov    0x2b49(%rip),%rax
mov    (%rax),%esi
call   10e0 <user_trap_syscall@plt>
test   %eax,%eax
jns    14b0 <main+0x230>
lea    0xb9f(%rip),%rdi
jmp    15a1 <main+0x321>
mov    0x2b3b(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rdx
xor    %esi,%esi
call   1130 <seccomp@plt>
test   %rax,%rax
jns    15b7 <main+0x337>
lea    0xbcb(%rip),%rdi
call   1160 <perror@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    %eax,%ebx
mov    $0x3e8,%edi
call   1190 <setuid@plt>
test   %rax,%rax
jns    14cd <main+0x24d>
lea    0xb50(%rip),%rdi
jmp    15a1 <main+0x321>
mov    0xc(%rsp),%edi
mov    %ebx,%esi
call   1080 <send_fd@plt>
test   %rax,%rax
jns    14f3 <main+0x273>
mov    $0x1,%edi
call   1180 <exit@plt>
lea    0xbb5(%rip),%rdi
jmp    15a1 <main+0x321>
mov    %ebx,%edi
call   10b0 <close@plt>
lea    0xb1e(%rip),%rdi
mov    $0x1ed,%esi
call   1050 <mkdir@plt>
test   %rax,%rax
jns    151c <main+0x29c>
lea    0xb11(%rip),%rdi
jmp    15a1 <main+0x321>
lea    0xb0b(%rip),%rdi
lea    0xaf5(%rip),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1070 <mount@plt>
cmp    $0xffffffff,%eax
jne    157b <main+0x2fb>
mov    0x2a6e(%rip),%rax
mov    (%rax),%rax
mov    0x2a1c(%rip),%rcx
cmp    (%rcx),%rax
jne    159a <main+0x31a>
mov    0x2a80(%rip),%rax
mov    (%rax),%ecx
lea    0xabe(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
xor    %r8d,%r8d
call   1070 <mount@plt>
test   %eax,%eax
jns    15b0 <main+0x330>
lea    0xae5(%rip),%rdi
jmp    15a1 <main+0x321>
mov    0x2a3e(%rip),%rax
mov    (%rax),%edi
lea    0xaac(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
lea    0xaae(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    (%rsp),%edi
call   1120 <malloc@plt>
test   %rax,%rax
je     149e <main+0x21e>
mov    %rax,%rbx
mov    0x4(%rsp),%ebp
mov    %ebp,%edi
call   1120 <malloc@plt>
test   %rax,%rax
je     16a7 <main+0x427>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1090 <memset@plt>
mov    (%rsp),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1090 <memset@plt>
mov    0x29c6(%rip),%r13
mov    0x0(%r13),%esi
mov    %r15d,%edi
mov    %rbx,%rdx
call   10a0 <ioctl@plt>
lea    0xa65(%rip),%rcx
mov    %rcx,0x10(%rsp)
test   %rax,%rax
jne    1695 <main+0x415>
mov    0x29b7(%rip),%rbp
mov    0x2940(%rip),%r12
jmp    1653 <main+0x3d3>
mov    (%rsp),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1090 <memset@plt>
mov    0x0(%r13),%esi
mov    %r15d,%edi
mov    %rbx,%rdx
call   10a0 <ioctl@plt>
test   %rax,%rax
jne    1695 <main+0x415>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   10c0 <handle_req@plt>
test   %rax,%rax
js     169f <main+0x41f>
mov    0x0(%rbp),%esi
mov    %r15d,%edi
mov    %r14,%rdx
call   10a0 <ioctl@plt>
test   %rax,%rax
jns    1632 <main+0x3b2>
mov    0x2930(%rip),%rax
mov    (%rax),%rax
cmp    (%r12),%rax
je     1632 <main+0x3b2>
lea    0x9f8(%rip),%rax
mov    %rax,0x10(%rsp)
mov    0x10(%rsp),%rdi
call   1160 <perror@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    149e <main+0x21e>

LLVM IR (-O0):
%struct.seccomp_notif = type opaque
%struct.seccomp_notif_resp = type { i32 }
%struct.seccomp_notif_sizes = type { i32, i32 }
@PF_LOCAL = global i32 0
@SOCK_SEQPACKET = global i32 0
@.str = [11 x i8] c"socketpair\00"
@.str.1 = [5 x i8] c"fork\00"
@__NR_mount = global i32 0
@SECCOMP_FILTER_FLAG_NEW_LISTENER = global i32 0
@.str.2 = [8 x i8] c"seccomp\00"
@.str.3 = [7 x i8] c"setuid\00"
@.str.4 = [9 x i8] c"/tmp/foo\00"
@.str.5 = [6 x i8] c"mkdir\00"
@.str.6 = [9 x i8] c"/dev/sda\00"
@stderr = global i32 0
@.str.7 = [24 x i8] c"huh? mounted /dev/sda?\0A\00"
@errno = global i64 0
@EPERM = global i64 0
@.str.8 = [21 x i8] c"bad error from mount\00"
@MS_BIND = global i32 0
@.str.9 = [6 x i8] c"mount\00"
@SECCOMP_GET_NOTIF_SIZES = global i32 0
@.str.10 = [25 x i8] c"seccomp(GET_NOTIF_SIZES)\00"
@SECCOMP_IOCTL_NOTIF_RECV = global i32 0
@.str.11 = [11 x i8] c"ioctl recv\00"
@SECCOMP_IOCTL_NOTIF_SEND = global i32 0
@ENOENT = global i64 0
@.str.12 = [11 x i8] c"ioctl send\00"
@.str.13 = [8 x i8] c"waitpid\00"
@MNT_DETACH = global i32 0
@EINVAL = global i64 0
@.str.14 = [8 x i8] c"umount2\00"
@.str.15 = [7 x i8] c"remove\00"
@.str.16 = [23 x i8] c"worker exited nonzero\0A\00"
@SIGKILL = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca %struct.seccomp_notif*
%9 = alloca %struct.seccomp_notif_resp*
%10 = alloca %struct.seccomp_notif_sizes
store i32 0, i32* %1
store i32 1, i32* %3
store i64 0, i64* %6
store i64 0, i64* %7
%11 = load i32, i32* @PF_LOCAL
%12 = load i32, i32* @SOCK_SEQPACKET
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%14 = call i64 @socketpair(i32 %11, i32 %12, i32 0, i32* %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %233
18: ; preds = %0
%19 = call i64 (...) @fork()
store i64 %19, i64* %6
%20 = load i64, i64* %6
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %225
24: ; preds = %18
%25 = load i64, i64* %6
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %81
27: ; preds = %24
%28 = load i32, i32* @__NR_mount
%29 = load i32, i32* @SECCOMP_FILTER_FLAG_NEW_LISTENER
%30 = call i32 @user_trap_syscall(i32 %28, i32 %29)
store i32 %30, i32* %5
%31 = load i32, i32* %5
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %27
%34 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %27
%37 = call i64 @setuid(i32 1000)
%38 = icmp slt i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %36
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%44 = load i32, i32* %43
%45 = load i32, i32* %5
%46 = call i64 @send_fd(i32 %44, i32 %45)
%47 = icmp slt i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %42
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %42
%51 = load i32, i32* %5
%52 = call i32 @close(i32 %51)
%53 = call i64 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 493)
%54 = icmp slt i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %50
%59 = call i32 @mount(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32* null, i32 0, i32* null)
%60 = icmp ne i32 %59, -1
br i1 %60, label %61, label %65
61: ; preds = %58
%62 = load i32, i32* @stderr
%63 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%64 = call i32 @exit(i32 1)
unreachable
65: ; preds = %58
%66 = load i64, i64* @errno
%67 = load i64, i64* @EPERM
%68 = icmp ne i64 %66, %67
br i1 %68, label %69, label %72
69: ; preds = %65
%70 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %65
%73 = load i32, i32* @MS_BIND
%74 = call i32 @mount(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32* null, i32 %73, i32* null)
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %72
%77 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %72
%80 = call i32 @exit(i32 0)
unreachable
81: ; preds = %24
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%83 = load i32, i32* %82
%84 = call i32 @recv_fd(i32 %83)
store i32 %84, i32* %5
%85 = load i32, i32* %5
%86 = icmp slt i32 %85, 0
br i1 %86, label %87, label %88
87: ; preds = %81
br label %210
88: ; preds = %81
%89 = call i64 (...) @fork()
store i64 %89, i64* %7
%90 = load i64, i64* %7
%91 = icmp slt i64 %90, 0
br i1 %91, label %92, label %94
92: ; preds = %88
%93 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %210
94: ; preds = %88
%95 = load i64, i64* %7
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %169
97: ; preds = %94
%98 = load i32, i32* @SECCOMP_GET_NOTIF_SIZES
%99 = call i64 @seccomp(i32 %98, i32 0, %struct.seccomp_notif_sizes* %10)
%100 = icmp slt i64 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %97
%102 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
br label %165
103: ; preds = %97
%104 = getelementptr inbounds %struct.seccomp_notif_sizes, %struct.seccomp_notif_sizes* %10, i32 0, i32 0
%105 = load i32, i32* %104
%106 = call %struct.seccomp_notif_resp* @malloc(i32 %105)
%107 = bitcast %struct.seccomp_notif_resp* %106 to %struct.seccomp_notif*
store %struct.seccomp_notif* %107, %struct.seccomp_notif** %8
%108 = load %struct.seccomp_notif*, %struct.seccomp_notif** %8
%109 = icmp ne %struct.seccomp_notif* %108, null
br i1 %109, label %111, label %110
110: ; preds = %103
br label %165
111: ; preds = %103
%112 = getelementptr inbounds %struct.seccomp_notif_sizes, %struct.seccomp_notif_sizes* %10, i32 0, i32 1
%113 = load i32, i32* %112
%114 = call %struct.seccomp_notif_resp* @malloc(i32 %113)
store %struct.seccomp_notif_resp* %114, %struct.seccomp_notif_resp** %9
%115 = load %struct.seccomp_notif_resp*, %struct.seccomp_notif_resp** %9
%116 = icmp ne %struct.seccomp_notif_resp* %115, null
br i1 %116, label %118, label %117
117: ; preds = %111
br label %161
118: ; preds = %111
%119 = load %struct.seccomp_notif_resp*, %struct.seccomp_notif_resp** %9
%120 = getelementptr inbounds %struct.seccomp_notif_sizes, %struct.seccomp_notif_sizes* %10, i32 0, i32 1
%121 = load i32, i32* %120
%122 = call i32 @memset(%struct.seccomp_notif_resp* %119, i32 0, i32 %121)
br label %123
123: ; preds = %118, %157
%124 = load %struct.seccomp_notif*, %struct.seccomp_notif** %8
%125 = bitcast %struct.seccomp_notif* %124 to %struct.seccomp_notif_resp*
%126 = getelementptr inbounds %struct.seccomp_notif_sizes, %struct.seccomp_notif_sizes* %10, i32 0, i32 0
%127 = load i32, i32* %126
%128 = call i32 @memset(%struct.seccomp_notif_resp* %125, i32 0, i32 %127)
%129 = load i32, i32* %5
%130 = load i32, i32* @SECCOMP_IOCTL_NOTIF_RECV
%131 = load %struct.seccomp_notif*, %struct.seccomp_notif** %8
%132 = bitcast %struct.seccomp_notif* %131 to %struct.seccomp_notif_resp*
%133 = call i64 @ioctl(i32 %129, i32 %130, %struct.seccomp_notif_resp* %132)
%134 = icmp ne i64 %133, 0
br i1 %134, label %135, label %137
135: ; preds = %123
%136 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
br label %158
137: ; preds = %123
%138 = load %struct.seccomp_notif*, %struct.seccomp_notif** %8
%139 = bitcast %struct.seccomp_notif* %138 to %struct.seccomp_notif_resp*
%140 = load %struct.seccomp_notif_resp*, %struct.seccomp_notif_resp** %9
%141 = load i32, i32* %5
%142 = call i64 @handle_req(%struct.seccomp_notif_resp* %139, %struct.seccomp_notif_resp* %140, i32 %141)
%143 = icmp slt i64 %142, 0
br i1 %143, label %144, label %145
144: ; preds = %137
br label %158
145: ; preds = %137
%146 = load i32, i32* %5
%147 = load i32, i32* @SECCOMP_IOCTL_NOTIF_SEND
%148 = load %struct.seccomp_notif_resp*, %struct.seccomp_notif_resp** %9
%149 = call i64 @ioctl(i32 %146, i32 %147, %struct.seccomp_notif_resp* %148)
%150 = icmp slt i64 %149, 0
br i1 %150, label %151, label %157
151: ; preds = %145
%152 = load i64, i64* @errno
%153 = load i64, i64* @ENOENT
%154 = icmp ne i64 %152, %153
br i1 %154, label %155, label %157
155: ; preds = %151
%156 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
br label %158
157: ; preds = %151, %145
br label %123
158: ; preds = %155, %144, %135
%159 = load %struct.seccomp_notif_resp*, %struct.seccomp_notif_resp** %9
%160 = call i32 @free(%struct.seccomp_notif_resp* %159)
br label %161
161: ; preds = %158, %117
%162 = load %struct.seccomp_notif*, %struct.seccomp_notif** %8
%163 = bitcast %struct.seccomp_notif* %162 to %struct.seccomp_notif_resp*
%164 = call i32 @free(%struct.seccomp_notif_resp* %163)
br label %165
165: ; preds = %161, %110, %101
%166 = load i32, i32* %5
%167 = call i32 @close(i32 %166)
%168 = call i32 @exit(i32 1)
unreachable
169: ; preds = %94
%170 = load i32, i32* %5
%171 = call i32 @close(i32 %170)
%172 = load i64, i64* %6
%173 = call i64 @waitpid(i64 %172, i32* %4, i32 0)
%174 = load i64, i64* %6
%175 = icmp ne i64 %173, %174
br i1 %175, label %176, label %178
176: ; preds = %169
%177 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
br label %210
178: ; preds = %169
%179 = load i32, i32* @MNT_DETACH
%180 = call i64 @umount2(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %179)
%181 = icmp slt i64 %180, 0
br i1 %181, label %182, label %188
182: ; preds = %178
%183 = load i64, i64* @errno
%184 = load i64, i64* @EINVAL
%185 = icmp ne i64 %183, %184
br i1 %185, label %186, label %188
186: ; preds = %182
%187 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
br label %210
188: ; preds = %182, %178
%189 = call i64 @remove(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%190 = icmp slt i64 %189, 0
br i1 %190, label %191, label %198
191: ; preds = %188
%192 = load i64, i64* @errno
%193 = load i64, i64* @ENOENT
%194 = icmp ne i64 %192, %193
br i1 %194, label %195, label %198
195: ; preds = %191
%196 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%197 = call i32 @exit(i32 1)
unreachable
198: ; preds = %191, %188
%199 = load i32, i32* %4
%200 = call i32 @WIFEXITED(i32 %199)
%201 = icmp ne i32 %200, 0
br i1 %201, label %202, label %206
202: ; preds = %198
%203 = load i32, i32* %4
%204 = call i64 @WEXITSTATUS(i32 %203)
%205 = icmp ne i64 %204, 0
br i1 %205, label %206, label %209
206: ; preds = %202, %198
%207 = load i32, i32* @stderr
%208 = call i32 @fprintf(i32 %207, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0))
br label %210
209: ; preds = %202
store i32 0, i32* %3
br label %210
210: ; preds = %209, %206, %186, %176, %92, %87
%211 = load i64, i64* %7
%212 = icmp sgt i64 %211, 0
br i1 %212, label %213, label %217
213: ; preds = %210
%214 = load i64, i64* %7
%215 = load i32, i32* @SIGKILL
%216 = call i32 @kill(i64 %214, i32 %215)
br label %217
217: ; preds = %213, %210
%218 = load i64, i64* %6
%219 = icmp sgt i64 %218, 0
br i1 %219, label %220, label %224
220: ; preds = %217
%221 = load i64, i64* %6
%222 = load i32, i32* @SIGKILL
%223 = call i32 @kill(i64 %221, i32 %222)
br label %224
224: ; preds = %220, %217
br label %225
225: ; preds = %224, %22
%226 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%227 = load i32, i32* %226
%228 = call i32 @close(i32 %227)
%229 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%230 = load i32, i32* %229
%231 = call i32 @close(i32 %230)
%232 = load i32, i32* %3
store i32 %232, i32* %1
br label %233
233: ; preds = %225, %16
%234 = load i32, i32* %1
ret i32 %234
}

LLVM IR (-O2):
%struct.seccomp_notif_sizes = type { i32, i32 }
%struct.seccomp_notif_resp = type { i32 }
@PF_LOCAL = global i32 0
@SOCK_SEQPACKET = global i32 0
@.str = [11 x i8] c"socketpair\00"
@.str.1 = [5 x i8] c"fork\00"
@__NR_mount = global i32 0
@SECCOMP_FILTER_FLAG_NEW_LISTENER = global i32 0
@.str.2 = [8 x i8] c"seccomp\00"
@.str.3 = [7 x i8] c"setuid\00"
@.str.4 = [9 x i8] c"/tmp/foo\00"
@.str.5 = [6 x i8] c"mkdir\00"
@.str.6 = [9 x i8] c"/dev/sda\00"
@stderr = global i32 0
@.str.7 = [24 x i8] c"huh? mounted /dev/sda?\0A\00"
@errno = global i64 0
@EPERM = global i64 0
@.str.8 = [21 x i8] c"bad error from mount\00"
@MS_BIND = global i32 0
@.str.9 = [6 x i8] c"mount\00"
@SECCOMP_GET_NOTIF_SIZES = global i32 0
@.str.10 = [25 x i8] c"seccomp(GET_NOTIF_SIZES)\00"
@SECCOMP_IOCTL_NOTIF_RECV = global i32 0
@.str.11 = [11 x i8] c"ioctl recv\00"
@SECCOMP_IOCTL_NOTIF_SEND = global i32 0
@ENOENT = global i64 0
@.str.12 = [11 x i8] c"ioctl send\00"
@.str.13 = [8 x i8] c"waitpid\00"
@MNT_DETACH = global i32 0
@EINVAL = global i64 0
@.str.14 = [8 x i8] c"umount2\00"
@.str.15 = [7 x i8] c"remove\00"
@.str.16 = [23 x i8] c"worker exited nonzero\0A\00"
@SIGKILL = global i32 0
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca i32
%3 = alloca %struct.seccomp_notif_sizes
%4 = bitcast [2 x i32]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = load i32, i32* @PF_LOCAL
%7 = load i32, i32* @SOCK_SEQPACKET
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%9 = call i64 @socketpair(i32 %6, i32 %7, i32 0, i32* %8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %185
13: ; preds = %0
%14 = call i64 (...) @fork()
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %178
18: ; preds = %13
%19 = icmp eq i64 %14, 0
br i1 %19, label %20, label %71
20: ; preds = %18
%21 = load i32, i32* @__NR_mount
%22 = load i32, i32* @SECCOMP_FILTER_FLAG_NEW_LISTENER
%23 = call i32 @user_trap_syscall(i32 %21, i32 %22)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %20
%29 = call i64 @setuid(i32 1000)
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %28
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%36 = load i32, i32* %35
%37 = call i64 @send_fd(i32 %36, i32 %23)
%38 = icmp slt i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %34
%42 = call i32 @close(i32 %23)
%43 = call i64 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 493)
%44 = icmp slt i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %41
%49 = call i32 @mount(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32* null, i32 0, i32* null)
%50 = icmp eq i32 %49, -1
br i1 %50, label %55, label %51
51: ; preds = %48
%52 = load i32, i32* @stderr
%53 = call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %48
%56 = load i64, i64* @errno
%57 = load i64, i64* @EPERM
%58 = icmp eq i64 %56, %57
br i1 %58, label %62, label %59
59: ; preds = %55
%60 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %55
%63 = load i32, i32* @MS_BIND
%64 = call i32 @mount(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32* null, i32 %63, i32* null)
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %62
%70 = call i32 @exit(i32 0)
unreachable
71: ; preds = %18
%72 = load i32, i32* %8
%73 = call i32 @recv_fd(i32 %72)
%74 = icmp slt i32 %73, 0
br i1 %74, label %174, label %75
75: ; preds = %71
%76 = call i64 (...) @fork()
%77 = icmp slt i64 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %75
%79 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %174
80: ; preds = %75
%81 = icmp eq i64 %76, 0
br i1 %81, label %82, label %133
82: ; preds = %80
%83 = bitcast %struct.seccomp_notif_sizes* %3 to i8*
%84 = load i32, i32* @SECCOMP_GET_NOTIF_SIZES
%85 = call i64 @seccomp(i32 %84, i32 0, %struct.seccomp_notif_sizes* %3)
%86 = icmp slt i64 %85, 0
br i1 %86, label %87, label %89
87: ; preds = %82
%88 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
br label %130
89: ; preds = %82
%90 = getelementptr inbounds %struct.seccomp_notif_sizes, %struct.seccomp_notif_sizes* %3, i64 0, i32 0
%91 = load i32, i32* %90
%92 = call %struct.seccomp_notif_resp* @malloc(i32 %91)
%93 = icmp eq %struct.seccomp_notif_resp* %92, null
br i1 %93, label %130, label %94
94: ; preds = %89
%95 = getelementptr inbounds %struct.seccomp_notif_sizes, %struct.seccomp_notif_sizes* %3, i64 0, i32 1
%96 = load i32, i32* %95
%97 = call %struct.seccomp_notif_resp* @malloc(i32 %96)
%98 = icmp eq %struct.seccomp_notif_resp* %97, null
br i1 %98, label %128, label %99
99: ; preds = %94
%100 = call i32 @memset(%struct.seccomp_notif_resp* %97, i32 0, i32 %96)
%101 = load i32, i32* %90
%102 = call i32 @memset(%struct.seccomp_notif_resp* %92, i32 0, i32 %101)
%103 = load i32, i32* @SECCOMP_IOCTL_NOTIF_RECV
%104 = call i64 @ioctl(i32 %73, i32 %103, %struct.seccomp_notif_resp* %92)
%105 = icmp eq i64 %104, 0
br i1 %105, label %106, label %123
106: ; preds = %99, %117
%107 = call i64 @handle_req(%struct.seccomp_notif_resp* %92, %struct.seccomp_notif_resp* %97, i32 %73)
%108 = icmp slt i64 %107, 0
br i1 %108, label %126, label %109
109: ; preds = %106
%110 = load i32, i32* @SECCOMP_IOCTL_NOTIF_SEND
%111 = call i64 @ioctl(i32 %73, i32 %110, %struct.seccomp_notif_resp* %97)
%112 = icmp slt i64 %111, 0
br i1 %112, label %113, label %117
113: ; preds = %109
%114 = load i64, i64* @errno
%115 = load i64, i64* @ENOENT
%116 = icmp eq i64 %114, %115
br i1 %116, label %117, label %123
117: ; preds = %113, %109
%118 = load i32, i32* %90
%119 = call i32 @memset(%struct.seccomp_notif_resp* %92, i32 0, i32 %118)
%120 = load i32, i32* @SECCOMP_IOCTL_NOTIF_RECV
%121 = call i64 @ioctl(i32 %73, i32 %120, %struct.seccomp_notif_resp* %92)
%122 = icmp eq i64 %121, 0
br i1 %122, label %106, label %123
123: ; preds = %113, %117, %99
%124 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), %99 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), %117 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), %113 ]
%125 = call i32 @perror(i8* %124)
br label %126
126: ; preds = %106, %123
%127 = call i32 @free(%struct.seccomp_notif_resp* %97)
br label %128
128: ; preds = %94, %126
%129 = call i32 @free(%struct.seccomp_notif_resp* %92)
br label %130
130: ; preds = %89, %128, %87
%131 = call i32 @close(i32 %73)
%132 = call i32 @exit(i32 1)
unreachable
133: ; preds = %80
%134 = call i32 @close(i32 %73)
%135 = call i64 @waitpid(i64 %14, i32* %2, i32 0)
%136 = icmp eq i64 %135, %14
br i1 %136, label %139, label %137
137: ; preds = %133
%138 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
br label %170
139: ; preds = %133
%140 = load i32, i32* @MNT_DETACH
%141 = call i64 @umount2(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %140)
%142 = icmp slt i64 %141, 0
br i1 %142, label %143, label %149
143: ; preds = %139
%144 = load i64, i64* @errno
%145 = load i64, i64* @EINVAL
%146 = icmp eq i64 %144, %145
br i1 %146, label %149, label %147
147: ; preds = %143
%148 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
br label %170
149: ; preds = %143, %139
%150 = call i64 @remove(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%151 = icmp slt i64 %150, 0
br i1 %151, label %152, label %159
152: ; preds = %149
%153 = load i64, i64* @errno
%154 = load i64, i64* @ENOENT
%155 = icmp eq i64 %153, %154
br i1 %155, label %159, label %156
156: ; preds = %152
%157 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%158 = call i32 @exit(i32 1)
unreachable
159: ; preds = %152, %149
%160 = load i32, i32* %2
%161 = call i32 @WIFEXITED(i32 %160)
%162 = icmp eq i32 %161, 0
br i1 %162, label %167, label %163
163: ; preds = %159
%164 = load i32, i32* %2
%165 = call i64 @WEXITSTATUS(i32 %164)
%166 = icmp eq i64 %165, 0
br i1 %166, label %170, label %167
167: ; preds = %163, %159
%168 = load i32, i32* @stderr
%169 = call i32 @fprintf(i32 %168, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0))
br label %170
170: ; preds = %137, %147, %167, %163
%171 = phi i32 [ 0, %163 ], [ 1, %167 ], [ 1, %147 ], [ 1, %137 ]
%172 = load i32, i32* @SIGKILL
%173 = call i32 @kill(i64 %76, i32 %172)
br label %174
174: ; preds = %78, %71, %170
%175 = phi i32 [ %171, %170 ], [ 1, %71 ], [ 1, %78 ]
%176 = load i32, i32* @SIGKILL
%177 = call i32 @kill(i64 %14, i32 %176)
br label %178
178: ; preds = %174, %16
%179 = phi i32 [ 1, %16 ], [ %175, %174 ]
%180 = load i32, i32* %8
%181 = call i32 @close(i32 %180)
%182 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%183 = load i32, i32* %182
%184 = call i32 @close(i32 %183)
br label %185
185: ; preds = %178, %11
%186 = phi i32 [ 1, %11 ], [ %179, %178 ]
ret i32 %186
}