#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct clone_args {
  int flags;
  scalar_t__ exit_signal;
  int /*<<< orphan*/ pidfd;
  int /*<<< orphan*/ parent_tid;
};
struct TYPE_3__ {
  scalar_t__ si_signo;
  scalar_t__ si_code;
  scalar_t__ si_pid;
};
typedef TYPE_1__ siginfo_t;
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ __u64;

/* Variables and functions */
scalar_t__ CLD_CONTINUED;
scalar_t__ CLD_KILLED;
scalar_t__ CLD_STOPPED;
int CLONE_PARENT_SETTID;
int /*<<< orphan*/ EXIT_SUCCESS;
scalar_t__ SIGCHLD;
int /*<<< orphan*/ SIGCONT;
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ SIGSTOP;
int /*<<< orphan*/ WCONTINUED;
int /*<<< orphan*/ WEXITED;
int /*<<< orphan*/ WSTOPPED;
int /*<<< orphan*/ WUNTRACED;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ ksft_exit_fail_msg(char *, char const *, scalar_t__, ...);
int /*<<< orphan*/ ksft_test_result_pass(char *, char const *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
scalar_t__ sys_clone3(struct clone_args *);
int sys_pidfd_send_signal(int, int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/);
int sys_waitid(int, int, TYPE_1__ *, int /*<<< orphan*/, int /*<<< orphan*/ *);
int test_pidfd_wait_states(void) {
  const char *test_name = "pidfd wait states";
  int pidfd = -1, status = 0;
  pid_t parent_tid = -1;
  struct clone_args args = {
      .parent_tid = ((__u64)((uintptr_t)(&parent_tid))),
      .pidfd = ((__u64)((uintptr_t)(&pidfd))),
      .flags = 0x00001000 | CLONE_PARENT_SETTID,
      .exit_signal = SIGCHLD,
  };
  int ret;
  pid_t pid;
  siginfo_t info = {
      .si_signo = 0,
  };
  pid = sys_clone3(&args);
  if (pid < 0)
    ksft_exit_fail_msg("%s test: failed to create new process %s\n", test_name,
                       strerror(errno));
  if (pid == 0) {
    kill(getpid(), SIGSTOP);
    kill(getpid(), SIGSTOP);
    exit(EXIT_SUCCESS);
  }
  ret = sys_waitid(3, pidfd, &info, WSTOPPED, NULL);
  if (ret < 0)
    ksft_exit_fail_msg("%s test: failed to wait on WSTOPPED process with pid "
                       "%d and pidfd %d: %s\n",
                       test_name, parent_tid, pidfd, strerror(errno));
  if (info.si_signo != SIGCHLD)
    ksft_exit_fail_msg("%s test: unexpected si_signo value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_signo, parent_tid, pidfd,
                       strerror(errno));
  if (info.si_code != CLD_STOPPED)
    ksft_exit_fail_msg("%s test: unexpected si_code value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_code, parent_tid, pidfd,
                       strerror(errno));
  if (info.si_pid != parent_tid)
    ksft_exit_fail_msg("%s test: unexpected si_pid value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_pid, parent_tid, pidfd,
                       strerror(errno));
  ret = sys_pidfd_send_signal(pidfd, SIGCONT, NULL, 0);
  if (ret < 0)
    ksft_exit_fail_msg("%s test: failed to send signal to process with pid %d "
                       "and pidfd %d: %s\n",
                       test_name, parent_tid, pidfd, strerror(errno));
  ret = sys_waitid(3, pidfd, &info, WCONTINUED, NULL);
  if (ret < 0)
    ksft_exit_fail_msg("%s test: failed to wait WCONTINUED on process with pid "
                       "%d and pidfd %d: %s\n",
                       test_name, parent_tid, pidfd, strerror(errno));
  if (info.si_signo != SIGCHLD)
    ksft_exit_fail_msg("%s test: unexpected si_signo value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_signo, parent_tid, pidfd,
                       strerror(errno));
  if (info.si_code != CLD_CONTINUED)
    ksft_exit_fail_msg("%s test: unexpected si_code value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_code, parent_tid, pidfd,
                       strerror(errno));
  if (info.si_pid != parent_tid)
    ksft_exit_fail_msg("%s test: unexpected si_pid value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_pid, parent_tid, pidfd,
                       strerror(errno));
  ret = sys_waitid(3, pidfd, &info, WUNTRACED, NULL);
  if (ret < 0)
    ksft_exit_fail_msg("%s test: failed to wait on WUNTRACED process with pid "
                       "%d and pidfd %d: %s\n",
                       test_name, parent_tid, pidfd, strerror(errno));
  if (info.si_signo != SIGCHLD)
    ksft_exit_fail_msg("%s test: unexpected si_signo value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_signo, parent_tid, pidfd,
                       strerror(errno));
  if (info.si_code != CLD_STOPPED)
    ksft_exit_fail_msg("%s test: unexpected si_code value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_code, parent_tid, pidfd,
                       strerror(errno));
  if (info.si_pid != parent_tid)
    ksft_exit_fail_msg("%s test: unexpected si_pid value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_pid, parent_tid, pidfd,
                       strerror(errno));
  ret = sys_pidfd_send_signal(pidfd, SIGKILL, NULL, 0);
  if (ret < 0)
    ksft_exit_fail_msg("%s test: failed to send SIGKILL to process with pid %d "
                       "and pidfd %d: %s\n",
                       test_name, parent_tid, pidfd, strerror(errno));
  ret = sys_waitid(3, pidfd, &info, WEXITED, NULL);
  if (ret < 0)
    ksft_exit_fail_msg("%s test: failed to wait on WEXITED process with pid %d "
                       "and pidfd %d: %s\n",
                       test_name, parent_tid, pidfd, strerror(errno));
  if (info.si_signo != SIGCHLD)
    ksft_exit_fail_msg("%s test: unexpected si_signo value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_signo, parent_tid, pidfd,
                       strerror(errno));
  if (info.si_code != CLD_KILLED)
    ksft_exit_fail_msg("%s test: unexpected si_code value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_code, parent_tid, pidfd,
                       strerror(errno));
  if (info.si_pid != parent_tid)
    ksft_exit_fail_msg("%s test: unexpected si_pid value %d received after "
                       "waiting on process with pid %d and pidfd %d: %s\n",
                       test_name, info.si_pid, parent_tid, pidfd,
                       strerror(errno));
  close(pidfd);
  ksft_test_result_pass("%s test: Passed\n", test_name);
  return 0;
}


x86 assembly (clang, -O0):
<test_pidfd_wait_states>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
lea    0xe3e(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movq   $0xffffffffffffffff,-0x18(%rbp)
ff
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
or     $0x1000,%eax
mov    %eax,-0x30(%rbp)
mov    0x2dd4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
lea    -0xc(%rbp),%rax
mov    %eax,-0x20(%rbp)
lea    -0x18(%rbp),%rax
mov    %eax,-0x1c(%rbp)
lea    -0x58(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
lea    -0x30(%rbp),%rdi
call   1050 <sys_clone3@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jge    125c <test_pidfd_wait_states+0xac>
mov    -0x8(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x60(%rbp),%rsi
movslq %eax,%rdx
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
cmpq   $0x0,-0x40(%rbp)
jne    12a3 <test_pidfd_wait_states+0xf3>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%edi
mov    0x2d19(%rip),%rax
mov    (%rax),%esi
call   10a0 <kill@plt>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%edi
mov    0x2d02(%rip),%rax
mov    (%rax),%esi
call   10a0 <kill@plt>
mov    0x2cfc(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0xc(%rbp),%esi
mov    0x2d3b(%rip),%rax
mov    (%rax),%ecx
mov    $0x3,%edi
lea    -0x58(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <sys_waitid@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    130f <test_pidfd_wait_states+0x15f>
mov    -0x8(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    0x2cbc(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x78(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    -0x64(%rbp),%ecx
mov    %eax,%r8d
lea    0xd34(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x58(%rbp),%rax
mov    0x2cae(%rip),%rcx
cmp    (%rcx),%rax
je     1382 <test_pidfd_wait_states+0x1d2>
mov    -0x8(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    0x2c57(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x98(%rbp),%rsi
mov    -0x90(%rbp),%rdx
mov    -0x88(%rbp),%rcx
mov    -0x7c(%rbp),%r8d
mov    %eax,%r9d
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x50(%rbp),%rax
mov    0x2c23(%rip),%rcx
cmp    (%rcx),%rax
je     13fb <test_pidfd_wait_states+0x24b>
mov    -0x8(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    0x2be1(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0xb8(%rbp),%rsi
mov    -0xb0(%rbp),%rdx
mov    -0xa8(%rbp),%rcx
mov    -0x9c(%rbp),%r8d
mov    %eax,%r9d
lea    0xcf8(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x48(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     146e <test_pidfd_wait_states+0x2be>
mov    -0x8(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0xbc(%rbp)
mov    0x2b6e(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0xd8(%rbp),%rsi
mov    -0xd0(%rbp),%rdx
mov    -0xc8(%rbp),%rcx
mov    -0xbc(%rbp),%r8d
mov    %eax,%r9d
lea    0xcea(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0xc(%rbp),%edi
mov    0x2b60(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
call   10b0 <sys_pidfd_send_signal@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    14e4 <test_pidfd_wait_states+0x334>
mov    -0x8(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0xdc(%rbp)
mov    0x2af0(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0xf0(%rbp),%rsi
mov    -0xe8(%rbp),%rdx
mov    -0xdc(%rbp),%ecx
mov    %eax,%r8d
lea    0xcd8(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0xc(%rbp),%esi
mov    0x2a92(%rip),%rax
mov    (%rax),%ecx
mov    $0x3,%edi
lea    -0x58(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <sys_waitid@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1562 <test_pidfd_wait_states+0x3b2>
mov    -0x8(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0xf4(%rbp)
mov    0x2a72(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x108(%rbp),%rsi
mov    -0x100(%rbp),%rdx
mov    -0xf4(%rbp),%ecx
mov    %eax,%r8d
lea    0xca2(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x58(%rbp),%rax
mov    0x2a5b(%rip),%rcx
cmp    (%rcx),%rax
je     15db <test_pidfd_wait_states+0x42b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10c(%rbp)
mov    0x2a01(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x128(%rbp),%rsi
mov    -0x120(%rbp),%rdx
mov    -0x118(%rbp),%rcx
mov    -0x10c(%rbp),%r8d
mov    %eax,%r9d
lea    0xab2(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x50(%rbp),%rax
mov    0x298a(%rip),%rcx
cmp    (%rcx),%rax
je     1654 <test_pidfd_wait_states+0x4a4>
mov    -0x8(%rbp),%rax
mov    %rax,-0x148(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x12c(%rbp)
mov    0x2988(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x148(%rbp),%rsi
mov    -0x140(%rbp),%rdx
mov    -0x138(%rbp),%rcx
mov    -0x12c(%rbp),%r8d
mov    %eax,%r9d
lea    0xa9f(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x48(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     16c7 <test_pidfd_wait_states+0x517>
mov    -0x8(%rbp),%rax
mov    %rax,-0x168(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x160(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x158(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14c(%rbp)
mov    0x2915(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x168(%rbp),%rsi
mov    -0x160(%rbp),%rdx
mov    -0x158(%rbp),%rcx
mov    -0x14c(%rbp),%r8d
mov    %eax,%r9d
lea    0xa91(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0xc(%rbp),%esi
mov    0x28e7(%rip),%rax
mov    (%rax),%ecx
mov    $0x3,%edi
lea    -0x58(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <sys_waitid@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1745 <test_pidfd_wait_states+0x595>
mov    -0x8(%rbp),%rax
mov    %rax,-0x180(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x178(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x16c(%rbp)
mov    0x288f(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x180(%rbp),%rsi
mov    -0x178(%rbp),%rdx
mov    -0x16c(%rbp),%ecx
mov    %eax,%r8d
lea    0xb0b(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x58(%rbp),%rax
mov    0x2878(%rip),%rcx
cmp    (%rcx),%rax
je     17be <test_pidfd_wait_states+0x60e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x1a0(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x198(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x190(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x184(%rbp)
mov    0x281e(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x1a0(%rbp),%rsi
mov    -0x198(%rbp),%rdx
mov    -0x190(%rbp),%rcx
mov    -0x184(%rbp),%r8d
mov    %eax,%r9d
lea    0x8cf(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x50(%rbp),%rax
mov    0x27e7(%rip),%rcx
cmp    (%rcx),%rax
je     1837 <test_pidfd_wait_states+0x687>
mov    -0x8(%rbp),%rax
mov    %rax,-0x1c0(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x1b8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x1b0(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1a4(%rbp)
mov    0x27a5(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x1c0(%rbp),%rsi
mov    -0x1b8(%rbp),%rdx
mov    -0x1b0(%rbp),%rcx
mov    -0x1a4(%rbp),%r8d
mov    %eax,%r9d
lea    0x8bc(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x48(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     18aa <test_pidfd_wait_states+0x6fa>
mov    -0x8(%rbp),%rax
mov    %rax,-0x1e0(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x1d8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x1d0(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c4(%rbp)
mov    0x2732(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x1e0(%rbp),%rsi
mov    -0x1d8(%rbp),%rdx
mov    -0x1d0(%rbp),%rcx
mov    -0x1c4(%rbp),%r8d
mov    %eax,%r9d
lea    0x8ae(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0xc(%rbp),%edi
mov    0x26ec(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
call   10b0 <sys_pidfd_send_signal@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1920 <test_pidfd_wait_states+0x770>
mov    -0x8(%rbp),%rax
mov    %rax,-0x1f8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x1f0(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1e4(%rbp)
mov    0x26b4(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x1f8(%rbp),%rsi
mov    -0x1f0(%rbp),%rdx
mov    -0x1e4(%rbp),%ecx
mov    %eax,%r8d
lea    0x97b(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0xc(%rbp),%esi
mov    0x26a6(%rip),%rax
mov    (%rax),%ecx
mov    $0x3,%edi
lea    -0x58(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <sys_waitid@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    199e <test_pidfd_wait_states+0x7ee>
mov    -0x8(%rbp),%rax
mov    %rax,-0x210(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x208(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1fc(%rbp)
mov    0x2636(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x210(%rbp),%rsi
mov    -0x208(%rbp),%rdx
mov    -0x1fc(%rbp),%ecx
mov    %eax,%r8d
lea    0x946(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x58(%rbp),%rax
mov    0x261f(%rip),%rcx
cmp    (%rcx),%rax
je     1a17 <test_pidfd_wait_states+0x867>
mov    -0x8(%rbp),%rax
mov    %rax,-0x230(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x228(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x220(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x214(%rbp)
mov    0x25c5(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x230(%rbp),%rsi
mov    -0x228(%rbp),%rdx
mov    -0x220(%rbp),%rcx
mov    -0x214(%rbp),%r8d
mov    %eax,%r9d
lea    0x676(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x50(%rbp),%rax
mov    0x25d6(%rip),%rcx
cmp    (%rcx),%rax
je     1a90 <test_pidfd_wait_states+0x8e0>
mov    -0x8(%rbp),%rax
mov    %rax,-0x250(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x248(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x240(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x234(%rbp)
mov    0x254c(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x250(%rbp),%rsi
mov    -0x248(%rbp),%rdx
mov    -0x240(%rbp),%rcx
mov    -0x234(%rbp),%r8d
mov    %eax,%r9d
lea    0x663(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0x48(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     1b03 <test_pidfd_wait_states+0x953>
mov    -0x8(%rbp),%rax
mov    %rax,-0x270(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x268(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x260(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x254(%rbp)
mov    0x24d9(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x270(%rbp),%rsi
mov    -0x268(%rbp),%rdx
mov    -0x260(%rbp),%rcx
mov    -0x254(%rbp),%r8d
mov    %eax,%r9d
lea    0x655(%rip),%rdi
mov    $0x0,%al
call   1070 <ksft_exit_fail_msg@plt>
mov    -0xc(%rbp),%edi
call   1090 <close@plt>
mov    -0x8(%rbp),%rsi
lea    0x810(%rip),%rdi
call   1040 <ksft_test_result_pass@plt>
xor    %eax,%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_pidfd_wait_states>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
movl   $0xffffffff,0x4(%rsp)
ff
mov    0x2dbd(%rip),%rax
mov    $0x1000,%ecx
or     (%rax),%ecx
movq   $0xffffffffffffffff,0x8(%rsp)
ff ff
mov    %ecx,0x28(%rsp)
mov    0x2df2(%rip),%r15
mov    (%r15),%rax
mov    %rax,0x30(%rsp)
lea    0x4(%rsp),%rax
mov    %eax,0x38(%rsp)
lea    0x8(%rsp),%rax
mov    %eax,0x3c(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x28(%rsp),%rdi
call   1050 <sys_clone3@plt>
test   %rax,%rax
js     1247 <test_pidfd_wait_states+0xa7>
jne    126d <test_pidfd_wait_states+0xcd>
xor    %eax,%eax
call   1060 <getpid@plt>
mov    0x2d70(%rip),%rbx
mov    (%rbx),%esi
mov    %eax,%edi
call   1090 <kill@plt>
xor    %eax,%eax
call   1060 <getpid@plt>
mov    (%rbx),%esi
mov    %eax,%edi
call   1090 <kill@plt>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
movslq %eax,%rdx
lea    0xdb3(%rip),%rdi
lea    0xd9a(%rip),%rsi
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x4(%rsp),%esi
mov    0x2d70(%rip),%rax
mov    (%rax),%ecx
lea    0x10(%rsp),%rdx
mov    $0x3,%edi
xor    %r8d,%r8d
call   1030 <sys_waitid@plt>
test   %eax,%eax
jns    12c4 <test_pidfd_wait_states+0x124>
mov    0x8(%rsp),%rbx
mov    0x4(%rsp),%ebp
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd8e(%rip),%rdi
lea    0xd4b(%rip),%rsi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x10(%rsp),%rbx
cmp    (%r15),%rbx
je     1307 <test_pidfd_wait_states+0x167>
mov    0x8(%rsp),%rbp
mov    0x4(%rsp),%r14d
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd99(%rip),%rdi
lea    0xd0c(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r14d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x18(%rsp),%rbx
mov    0x2c9d(%rip),%r12
cmp    (%r12),%rbx
je     1352 <test_pidfd_wait_states+0x1b2>
mov    0x8(%rsp),%rbp
mov    0x4(%rsp),%r14d
mov    0x2c7e(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xdb4(%rip),%rdi
lea    0xcc1(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r14d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x20(%rsp),%rbx
mov    0x8(%rsp),%r14
cmp    %r14,%rbx
je     1394 <test_pidfd_wait_states+0x1f4>
mov    0x4(%rsp),%ebp
mov    0x2c3c(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xdd7(%rip),%rdi
lea    0xc7f(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x4(%rsp),%edi
mov    0x2c39(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   10a0 <sys_pidfd_send_signal@plt>
test   %eax,%eax
jns    13e2 <test_pidfd_wait_states+0x242>
mov    0x8(%rsp),%rbx
mov    0x4(%rsp),%ebp
mov    0x2bea(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xde9(%rip),%rdi
lea    0xc2d(%rip),%rsi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x4(%rsp),%esi
mov    0x2b93(%rip),%rax
mov    (%rax),%ecx
lea    0x10(%rsp),%rdx
mov    $0x3,%edi
xor    %r8d,%r8d
call   1030 <sys_waitid@plt>
test   %eax,%eax
jns    1439 <test_pidfd_wait_states+0x299>
mov    0x8(%rsp),%rbx
mov    0x4(%rsp),%ebp
mov    0x2b93(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xdda(%rip),%rdi
lea    0xbd6(%rip),%rsi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x10(%rsp),%rbx
cmp    (%r15),%rbx
je     147c <test_pidfd_wait_states+0x2dc>
mov    0x8(%rsp),%rbp
mov    0x4(%rsp),%r14d
mov    0x2b54(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xc24(%rip),%rdi
lea    0xb97(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r14d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x18(%rsp),%rbx
mov    0x2ae8(%rip),%rax
cmp    (%rax),%rbx
je     14c6 <test_pidfd_wait_states+0x326>
mov    0x8(%rsp),%rbp
mov    0x4(%rsp),%r14d
mov    0x2b0a(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xc40(%rip),%rdi
lea    0xb4d(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r14d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x20(%rsp),%rbx
mov    0x8(%rsp),%r14
cmp    %r14,%rbx
je     1508 <test_pidfd_wait_states+0x368>
mov    0x4(%rsp),%ebp
mov    0x2ac8(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xc63(%rip),%rdi
lea    0xb0b(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x4(%rsp),%esi
mov    0x2aa5(%rip),%rax
mov    (%rax),%ecx
lea    0x10(%rsp),%rdx
mov    $0x3,%edi
xor    %r8d,%r8d
call   1030 <sys_waitid@plt>
test   %eax,%eax
jns    155f <test_pidfd_wait_states+0x3bf>
mov    0x8(%rsp),%rbx
mov    0x4(%rsp),%ebp
mov    0x2a6d(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd00(%rip),%rdi
lea    0xab0(%rip),%rsi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x10(%rsp),%rbx
cmp    (%r15),%rbx
je     15a2 <test_pidfd_wait_states+0x402>
mov    0x8(%rsp),%rbp
mov    0x4(%rsp),%r14d
mov    0x2a2e(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xafe(%rip),%rdi
lea    0xa71(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r14d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x18(%rsp),%rbx
cmp    (%r12),%rbx
je     15e6 <test_pidfd_wait_states+0x446>
mov    0x8(%rsp),%rbp
mov    0x4(%rsp),%r14d
mov    0x29ea(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xb20(%rip),%rdi
lea    0xa2d(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r14d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x20(%rsp),%rbx
mov    0x8(%rsp),%r14
cmp    %r14,%rbx
je     1628 <test_pidfd_wait_states+0x488>
mov    0x4(%rsp),%ebp
mov    0x29a8(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xb43(%rip),%rdi
lea    0x9eb(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x4(%rsp),%edi
mov    0x296d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   10a0 <sys_pidfd_send_signal@plt>
test   %eax,%eax
jns    1676 <test_pidfd_wait_states+0x4d6>
mov    0x8(%rsp),%rbx
mov    0x4(%rsp),%ebp
mov    0x2956(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xc34(%rip),%rdi
lea    0x999(%rip),%rsi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x4(%rsp),%esi
mov    0x294f(%rip),%rax
mov    (%rax),%ecx
lea    0x10(%rsp),%rdx
mov    $0x3,%edi
xor    %r8d,%r8d
call   1030 <sys_waitid@plt>
test   %eax,%eax
jns    16cd <test_pidfd_wait_states+0x52d>
mov    0x8(%rsp),%rbx
mov    0x4(%rsp),%ebp
mov    0x28ff(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xc26(%rip),%rdi
lea    0x942(%rip),%rsi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x10(%rsp),%rbx
cmp    (%r15),%rbx
je     1710 <test_pidfd_wait_states+0x570>
mov    0x8(%rsp),%rbp
mov    0x4(%rsp),%r14d
mov    0x28c0(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0x990(%rip),%rdi
lea    0x903(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r14d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x18(%rsp),%rbx
mov    0x28dc(%rip),%rax
cmp    (%rax),%rbx
je     175a <test_pidfd_wait_states+0x5ba>
mov    0x8(%rsp),%rbp
mov    0x4(%rsp),%r14d
mov    0x2876(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0x9ac(%rip),%rdi
lea    0x8b9(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r14d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x20(%rsp),%rbx
mov    0x8(%rsp),%r14
cmp    %r14,%rbx
je     179c <test_pidfd_wait_states+0x5fc>
mov    0x4(%rsp),%ebp
mov    0x2834(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0x9cf(%rip),%rdi
lea    0x877(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1070 <ksft_exit_fail_msg@plt>
mov    0x4(%rsp),%edi
call   1080 <close@plt>
lea    0xb7a(%rip),%rdi
lea    0x84d(%rip),%rsi
call   1040 <ksft_test_result_pass@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.clone_args = type { i32, i64, i32, i32 }
%struct.TYPE_3__ = type { i64, i64, i64 }
@.str = [18 x i8] c"pidfd wait states\00"
@CLONE_PARENT_SETTID = global i32 0
@SIGCHLD = global i64 0
@.str.1 = [42 x i8] c"%s test: failed to create new process %s\0A\00"
@errno = global i32 0
@SIGSTOP = global i32 0
@EXIT_SUCCESS = global i32 0
@WSTOPPED = global i32 0
@.str.2 = [74 x i8] c"%s test: failed to wait on WSTOPPED process with pid %d and pidfd %d: %s\0A\00"
@.str.3 = [102 x i8] c"%s test: unexpected si_signo value %d received after waiting on process with pid %d and pidfd %d: %s\0A\00"
@CLD_STOPPED = global i64 0
@.str.4 = [101 x i8] c"%s test: unexpected si_code value %d received after waiting on process with pid %d and pidfd %d: %s\0A\00"
@.str.5 = [100 x i8] c"%s test: unexpected si_pid value %d received after waiting on process with pid %d and pidfd %d: %s\0A\00"
@SIGCONT = global i32 0
@.str.6 = [72 x i8] c"%s test: failed to send signal to process with pid %d and pidfd %d: %s\0A\00"
@WCONTINUED = global i32 0
@.str.7 = [76 x i8] c"%s test: failed to wait WCONTINUED on process with pid %d and pidfd %d: %s\0A\00"
@CLD_CONTINUED = global i64 0
@WUNTRACED = global i32 0
@.str.8 = [75 x i8] c"%s test: failed to wait on WUNTRACED process with pid %d and pidfd %d: %s\0A\00"
@SIGKILL = global i32 0
@.str.9 = [73 x i8] c"%s test: failed to send SIGKILL to process with pid %d and pidfd %d: %s\0A\00"
@WEXITED = global i32 0
@.str.10 = [73 x i8] c"%s test: failed to wait on WEXITED process with pid %d and pidfd %d: %s\0A\00"
@CLD_KILLED = global i64 0
@.str.11 = [17 x i8] c"%s test: Passed\0A\00"
define i32 @test_pidfd_wait_states() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca %struct.clone_args
%6 = alloca i32
%7 = alloca i64
%8 = alloca %struct.TYPE_3__
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %1
store i32 -1, i32* %2
store i32 0, i32* %3
store i64 -1, i64* %4
%9 = getelementptr inbounds %struct.clone_args, %struct.clone_args* %5, i32 0, i32 0
%10 = load i32, i32* @CLONE_PARENT_SETTID
%11 = or i32 4096, %10
store i32 %11, i32* %9
%12 = getelementptr inbounds %struct.clone_args, %struct.clone_args* %5, i32 0, i32 1
%13 = load i64, i64* @SIGCHLD
store i64 %13, i64* %12
%14 = getelementptr inbounds %struct.clone_args, %struct.clone_args* %5, i32 0, i32 2
%15 = ptrtoint i32* %2 to i64
%16 = trunc i64 %15 to i32
store i32 %16, i32* %14
%17 = getelementptr inbounds %struct.clone_args, %struct.clone_args* %5, i32 0, i32 3
%18 = ptrtoint i64* %4 to i64
%19 = trunc i64 %18 to i32
store i32 %19, i32* %17
%20 = bitcast %struct.TYPE_3__* %8 to i8*
%21 = call i64 @sys_clone3(%struct.clone_args* %5)
store i64 %21, i64* %7
%22 = load i64, i64* %7
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %0
%25 = load i8*, i8** %1
%26 = load i32, i32* @errno
%27 = call i32 @strerror(i32 %26)
%28 = sext i32 %27 to i64
%29 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %25, i64 %28)
br label %30
30: ; preds = %24, %0
%31 = load i64, i64* %7
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %42
33: ; preds = %30
%34 = call i32 (...) @getpid()
%35 = load i32, i32* @SIGSTOP
%36 = call i32 @kill(i32 %34, i32 %35)
%37 = call i32 (...) @getpid()
%38 = load i32, i32* @SIGSTOP
%39 = call i32 @kill(i32 %37, i32 %38)
%40 = load i32, i32* @EXIT_SUCCESS
%41 = call i32 @exit(i32 %40)
unreachable
42: ; preds = %30
%43 = load i32, i32* %2
%44 = load i32, i32* @WSTOPPED
%45 = call i32 @sys_waitid(i32 3, i32 %43, %struct.TYPE_3__* %8, i32 %44, i32* null)
store i32 %45, i32* %6
%46 = load i32, i32* %6
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %55
48: ; preds = %42
%49 = load i8*, i8** %1
%50 = load i64, i64* %4
%51 = load i32, i32* %2
%52 = load i32, i32* @errno
%53 = call i32 @strerror(i32 %52)
%54 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0), i8* %49, i64 %50, i32 %51, i32 %53)
br label %55
55: ; preds = %48, %42
%56 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%57 = load i64, i64* %56
%58 = load i64, i64* @SIGCHLD
%59 = icmp ne i64 %57, %58
br i1 %59, label %60, label %69
60: ; preds = %55
%61 = load i8*, i8** %1
%62 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%63 = load i64, i64* %62
%64 = load i64, i64* %4
%65 = load i32, i32* %2
%66 = load i32, i32* @errno
%67 = call i32 @strerror(i32 %66)
%68 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.3, i64 0, i64 0), i8* %61, i64 %63, i64 %64, i32 %65, i32 %67)
br label %69
69: ; preds = %60, %55
%70 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%71 = load i64, i64* %70
%72 = load i64, i64* @CLD_STOPPED
%73 = icmp ne i64 %71, %72
br i1 %73, label %74, label %83
74: ; preds = %69
%75 = load i8*, i8** %1
%76 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%77 = load i64, i64* %76
%78 = load i64, i64* %4
%79 = load i32, i32* %2
%80 = load i32, i32* @errno
%81 = call i32 @strerror(i32 %80)
%82 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), i8* %75, i64 %77, i64 %78, i32 %79, i32 %81)
br label %83
83: ; preds = %74, %69
%84 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 2
%85 = load i64, i64* %84
%86 = load i64, i64* %4
%87 = icmp ne i64 %85, %86
br i1 %87, label %88, label %97
88: ; preds = %83
%89 = load i8*, i8** %1
%90 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 2
%91 = load i64, i64* %90
%92 = load i64, i64* %4
%93 = load i32, i32* %2
%94 = load i32, i32* @errno
%95 = call i32 @strerror(i32 %94)
%96 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0), i8* %89, i64 %91, i64 %92, i32 %93, i32 %95)
br label %97
97: ; preds = %88, %83
%98 = load i32, i32* %2
%99 = load i32, i32* @SIGCONT
%100 = call i32 @sys_pidfd_send_signal(i32 %98, i32 %99, i32* null, i32 0)
store i32 %100, i32* %6
%101 = load i32, i32* %6
%102 = icmp slt i32 %101, 0
br i1 %102, label %103, label %110
103: ; preds = %97
%104 = load i8*, i8** %1
%105 = load i64, i64* %4
%106 = load i32, i32* %2
%107 = load i32, i32* @errno
%108 = call i32 @strerror(i32 %107)
%109 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.6, i64 0, i64 0), i8* %104, i64 %105, i32 %106, i32 %108)
br label %110
110: ; preds = %103, %97
%111 = load i32, i32* %2
%112 = load i32, i32* @WCONTINUED
%113 = call i32 @sys_waitid(i32 3, i32 %111, %struct.TYPE_3__* %8, i32 %112, i32* null)
store i32 %113, i32* %6
%114 = load i32, i32* %6
%115 = icmp slt i32 %114, 0
br i1 %115, label %116, label %123
116: ; preds = %110
%117 = load i8*, i8** %1
%118 = load i64, i64* %4
%119 = load i32, i32* %2
%120 = load i32, i32* @errno
%121 = call i32 @strerror(i32 %120)
%122 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.7, i64 0, i64 0), i8* %117, i64 %118, i32 %119, i32 %121)
br label %123
123: ; preds = %116, %110
%124 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%125 = load i64, i64* %124
%126 = load i64, i64* @SIGCHLD
%127 = icmp ne i64 %125, %126
br i1 %127, label %128, label %137
128: ; preds = %123
%129 = load i8*, i8** %1
%130 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%131 = load i64, i64* %130
%132 = load i64, i64* %4
%133 = load i32, i32* %2
%134 = load i32, i32* @errno
%135 = call i32 @strerror(i32 %134)
%136 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.3, i64 0, i64 0), i8* %129, i64 %131, i64 %132, i32 %133, i32 %135)
br label %137
137: ; preds = %128, %123
%138 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%139 = load i64, i64* %138
%140 = load i64, i64* @CLD_CONTINUED
%141 = icmp ne i64 %139, %140
br i1 %141, label %142, label %151
142: ; preds = %137
%143 = load i8*, i8** %1
%144 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%145 = load i64, i64* %144
%146 = load i64, i64* %4
%147 = load i32, i32* %2
%148 = load i32, i32* @errno
%149 = call i32 @strerror(i32 %148)
%150 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), i8* %143, i64 %145, i64 %146, i32 %147, i32 %149)
br label %151
151: ; preds = %142, %137
%152 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 2
%153 = load i64, i64* %152
%154 = load i64, i64* %4
%155 = icmp ne i64 %153, %154
br i1 %155, label %156, label %165
156: ; preds = %151
%157 = load i8*, i8** %1
%158 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 2
%159 = load i64, i64* %158
%160 = load i64, i64* %4
%161 = load i32, i32* %2
%162 = load i32, i32* @errno
%163 = call i32 @strerror(i32 %162)
%164 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0), i8* %157, i64 %159, i64 %160, i32 %161, i32 %163)
br label %165
165: ; preds = %156, %151
%166 = load i32, i32* %2
%167 = load i32, i32* @WUNTRACED
%168 = call i32 @sys_waitid(i32 3, i32 %166, %struct.TYPE_3__* %8, i32 %167, i32* null)
store i32 %168, i32* %6
%169 = load i32, i32* %6
%170 = icmp slt i32 %169, 0
br i1 %170, label %171, label %178
171: ; preds = %165
%172 = load i8*, i8** %1
%173 = load i64, i64* %4
%174 = load i32, i32* %2
%175 = load i32, i32* @errno
%176 = call i32 @strerror(i32 %175)
%177 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.8, i64 0, i64 0), i8* %172, i64 %173, i32 %174, i32 %176)
br label %178
178: ; preds = %171, %165
%179 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%180 = load i64, i64* %179
%181 = load i64, i64* @SIGCHLD
%182 = icmp ne i64 %180, %181
br i1 %182, label %183, label %192
183: ; preds = %178
%184 = load i8*, i8** %1
%185 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%186 = load i64, i64* %185
%187 = load i64, i64* %4
%188 = load i32, i32* %2
%189 = load i32, i32* @errno
%190 = call i32 @strerror(i32 %189)
%191 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.3, i64 0, i64 0), i8* %184, i64 %186, i64 %187, i32 %188, i32 %190)
br label %192
192: ; preds = %183, %178
%193 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%194 = load i64, i64* %193
%195 = load i64, i64* @CLD_STOPPED
%196 = icmp ne i64 %194, %195
br i1 %196, label %197, label %206
197: ; preds = %192
%198 = load i8*, i8** %1
%199 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%200 = load i64, i64* %199
%201 = load i64, i64* %4
%202 = load i32, i32* %2
%203 = load i32, i32* @errno
%204 = call i32 @strerror(i32 %203)
%205 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), i8* %198, i64 %200, i64 %201, i32 %202, i32 %204)
br label %206
206: ; preds = %197, %192
%207 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 2
%208 = load i64, i64* %207
%209 = load i64, i64* %4
%210 = icmp ne i64 %208, %209
br i1 %210, label %211, label %220
211: ; preds = %206
%212 = load i8*, i8** %1
%213 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 2
%214 = load i64, i64* %213
%215 = load i64, i64* %4
%216 = load i32, i32* %2
%217 = load i32, i32* @errno
%218 = call i32 @strerror(i32 %217)
%219 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0), i8* %212, i64 %214, i64 %215, i32 %216, i32 %218)
br label %220
220: ; preds = %211, %206
%221 = load i32, i32* %2
%222 = load i32, i32* @SIGKILL
%223 = call i32 @sys_pidfd_send_signal(i32 %221, i32 %222, i32* null, i32 0)
store i32 %223, i32* %6
%224 = load i32, i32* %6
%225 = icmp slt i32 %224, 0
br i1 %225, label %226, label %233
226: ; preds = %220
%227 = load i8*, i8** %1
%228 = load i64, i64* %4
%229 = load i32, i32* %2
%230 = load i32, i32* @errno
%231 = call i32 @strerror(i32 %230)
%232 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.9, i64 0, i64 0), i8* %227, i64 %228, i32 %229, i32 %231)
br label %233
233: ; preds = %226, %220
%234 = load i32, i32* %2
%235 = load i32, i32* @WEXITED
%236 = call i32 @sys_waitid(i32 3, i32 %234, %struct.TYPE_3__* %8, i32 %235, i32* null)
store i32 %236, i32* %6
%237 = load i32, i32* %6
%238 = icmp slt i32 %237, 0
br i1 %238, label %239, label %246
239: ; preds = %233
%240 = load i8*, i8** %1
%241 = load i64, i64* %4
%242 = load i32, i32* %2
%243 = load i32, i32* @errno
%244 = call i32 @strerror(i32 %243)
%245 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.10, i64 0, i64 0), i8* %240, i64 %241, i32 %242, i32 %244)
br label %246
246: ; preds = %239, %233
%247 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%248 = load i64, i64* %247
%249 = load i64, i64* @SIGCHLD
%250 = icmp ne i64 %248, %249
br i1 %250, label %251, label %260
251: ; preds = %246
%252 = load i8*, i8** %1
%253 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%254 = load i64, i64* %253
%255 = load i64, i64* %4
%256 = load i32, i32* %2
%257 = load i32, i32* @errno
%258 = call i32 @strerror(i32 %257)
%259 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.3, i64 0, i64 0), i8* %252, i64 %254, i64 %255, i32 %256, i32 %258)
br label %260
260: ; preds = %251, %246
%261 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%262 = load i64, i64* %261
%263 = load i64, i64* @CLD_KILLED
%264 = icmp ne i64 %262, %263
br i1 %264, label %265, label %274
265: ; preds = %260
%266 = load i8*, i8** %1
%267 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%268 = load i64, i64* %267
%269 = load i64, i64* %4
%270 = load i32, i32* %2
%271 = load i32, i32* @errno
%272 = call i32 @strerror(i32 %271)
%273 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), i8* %266, i64 %268, i64 %269, i32 %270, i32 %272)
br label %274
274: ; preds = %265, %260
%275 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 2
%276 = load i64, i64* %275
%277 = load i64, i64* %4
%278 = icmp ne i64 %276, %277
br i1 %278, label %279, label %288
279: ; preds = %274
%280 = load i8*, i8** %1
%281 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 2
%282 = load i64, i64* %281
%283 = load i64, i64* %4
%284 = load i32, i32* %2
%285 = load i32, i32* @errno
%286 = call i32 @strerror(i32 %285)
%287 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0), i8* %280, i64 %282, i64 %283, i32 %284, i32 %286)
br label %288
288: ; preds = %279, %274
%289 = load i32, i32* %2
%290 = call i32 @close(i32 %289)
%291 = load i8*, i8** %1
%292 = call i32 @ksft_test_result_pass(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i8* %291)
ret i32 0
}

LLVM IR (-O2):
%struct.clone_args = type { i32, i64, i32, i32 }
%struct.TYPE_3__ = type { i64, i64, i64 }
@.str = [18 x i8] c"pidfd wait states\00"
@CLONE_PARENT_SETTID = global i32 0
@SIGCHLD = global i64 0
@.str.1 = [42 x i8] c"%s test: failed to create new process %s\0A\00"
@errno = global i32 0
@SIGSTOP = global i32 0
@EXIT_SUCCESS = global i32 0
@WSTOPPED = global i32 0
@.str.2 = [74 x i8] c"%s test: failed to wait on WSTOPPED process with pid %d and pidfd %d: %s\0A\00"
@.str.3 = [102 x i8] c"%s test: unexpected si_signo value %d received after waiting on process with pid %d and pidfd %d: %s\0A\00"
@CLD_STOPPED = global i64 0
@.str.4 = [101 x i8] c"%s test: unexpected si_code value %d received after waiting on process with pid %d and pidfd %d: %s\0A\00"
@.str.5 = [100 x i8] c"%s test: unexpected si_pid value %d received after waiting on process with pid %d and pidfd %d: %s\0A\00"
@SIGCONT = global i32 0
@.str.6 = [72 x i8] c"%s test: failed to send signal to process with pid %d and pidfd %d: %s\0A\00"
@WCONTINUED = global i32 0
@.str.7 = [76 x i8] c"%s test: failed to wait WCONTINUED on process with pid %d and pidfd %d: %s\0A\00"
@CLD_CONTINUED = global i64 0
@WUNTRACED = global i32 0
@.str.8 = [75 x i8] c"%s test: failed to wait on WUNTRACED process with pid %d and pidfd %d: %s\0A\00"
@SIGKILL = global i32 0
@.str.9 = [73 x i8] c"%s test: failed to send SIGKILL to process with pid %d and pidfd %d: %s\0A\00"
@WEXITED = global i32 0
@.str.10 = [73 x i8] c"%s test: failed to wait on WEXITED process with pid %d and pidfd %d: %s\0A\00"
@CLD_KILLED = global i64 0
@.str.11 = [17 x i8] c"%s test: Passed\0A\00"
define i32 @test_pidfd_wait_states() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca %struct.clone_args
%4 = alloca %struct.TYPE_3__
%5 = bitcast i32* %1 to i8*
store i32 -1, i32* %1
%6 = bitcast i64* %2 to i8*
store i64 -1, i64* %2
%7 = bitcast %struct.clone_args* %3 to i8*
%8 = getelementptr inbounds %struct.clone_args, %struct.clone_args* %3, i64 0, i32 0
%9 = load i32, i32* @CLONE_PARENT_SETTID
%10 = or i32 %9, 4096
store i32 %10, i32* %8
%11 = getelementptr inbounds %struct.clone_args, %struct.clone_args* %3, i64 0, i32 1
%12 = load i64, i64* @SIGCHLD
store i64 %12, i64* %11
%13 = getelementptr inbounds %struct.clone_args, %struct.clone_args* %3, i64 0, i32 2
%14 = ptrtoint i32* %1 to i64
%15 = trunc i64 %14 to i32
store i32 %15, i32* %13
%16 = getelementptr inbounds %struct.clone_args, %struct.clone_args* %3, i64 0, i32 3
%17 = ptrtoint i64* %2 to i64
%18 = trunc i64 %17 to i32
store i32 %18, i32* %16
%19 = bitcast %struct.TYPE_3__* %4 to i8*
%20 = call i64 @sys_clone3(%struct.clone_args* %3)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %0
%23 = load i32, i32* @errno
%24 = call i32 @strerror(i32 %23)
%25 = sext i32 %24 to i64
%26 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %25)
br label %38
27: ; preds = %0
%28 = icmp eq i64 %20, 0
br i1 %28, label %29, label %38
29: ; preds = %27
%30 = call i32 (...) @getpid()
%31 = load i32, i32* @SIGSTOP
%32 = call i32 @kill(i32 %30, i32 %31)
%33 = call i32 (...) @getpid()
%34 = load i32, i32* @SIGSTOP
%35 = call i32 @kill(i32 %33, i32 %34)
%36 = load i32, i32* @EXIT_SUCCESS
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %22, %27
%39 = load i32, i32* %1
%40 = load i32, i32* @WSTOPPED
%41 = call i32 @sys_waitid(i32 3, i32 %39, %struct.TYPE_3__* %4, i32 %40, i32* null)
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %49
43: ; preds = %38
%44 = load i64, i64* %2
%45 = load i32, i32* %1
%46 = load i32, i32* @errno
%47 = call i32 @strerror(i32 %46)
%48 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %44, i32 %45, i32 %47)
br label %49
49: ; preds = %43, %38
%50 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i64 0, i32 0
%51 = load i64, i64* %50
%52 = load i64, i64* @SIGCHLD
%53 = icmp eq i64 %51, %52
br i1 %53, label %60, label %54
54: ; preds = %49
%55 = load i64, i64* %2
%56 = load i32, i32* %1
%57 = load i32, i32* @errno
%58 = call i32 @strerror(i32 %57)
%59 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %51, i64 %55, i32 %56, i32 %58)
br label %60
60: ; preds = %54, %49
%61 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i64 0, i32 1
%62 = load i64, i64* %61
%63 = load i64, i64* @CLD_STOPPED
%64 = icmp eq i64 %62, %63
br i1 %64, label %71, label %65
65: ; preds = %60
%66 = load i64, i64* %2
%67 = load i32, i32* %1
%68 = load i32, i32* @errno
%69 = call i32 @strerror(i32 %68)
%70 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %62, i64 %66, i32 %67, i32 %69)
br label %71
71: ; preds = %65, %60
%72 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i64 0, i32 2
%73 = load i64, i64* %72
%74 = load i64, i64* %2
%75 = icmp eq i64 %73, %74
br i1 %75, label %81, label %76
76: ; preds = %71
%77 = load i32, i32* %1
%78 = load i32, i32* @errno
%79 = call i32 @strerror(i32 %78)
%80 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %73, i64 %74, i32 %77, i32 %79)
br label %81
81: ; preds = %76, %71
%82 = load i32, i32* %1
%83 = load i32, i32* @SIGCONT
%84 = call i32 @sys_pidfd_send_signal(i32 %82, i32 %83, i32* null, i32 0)
%85 = icmp slt i32 %84, 0
br i1 %85, label %86, label %92
86: ; preds = %81
%87 = load i64, i64* %2
%88 = load i32, i32* %1
%89 = load i32, i32* @errno
%90 = call i32 @strerror(i32 %89)
%91 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %87, i32 %88, i32 %90)
br label %92
92: ; preds = %86, %81
%93 = load i32, i32* %1
%94 = load i32, i32* @WCONTINUED
%95 = call i32 @sys_waitid(i32 3, i32 %93, %struct.TYPE_3__* %4, i32 %94, i32* null)
%96 = icmp slt i32 %95, 0
br i1 %96, label %97, label %103
97: ; preds = %92
%98 = load i64, i64* %2
%99 = load i32, i32* %1
%100 = load i32, i32* @errno
%101 = call i32 @strerror(i32 %100)
%102 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %98, i32 %99, i32 %101)
br label %103
103: ; preds = %97, %92
%104 = load i64, i64* %50
%105 = load i64, i64* @SIGCHLD
%106 = icmp eq i64 %104, %105
br i1 %106, label %113, label %107
107: ; preds = %103
%108 = load i64, i64* %2
%109 = load i32, i32* %1
%110 = load i32, i32* @errno
%111 = call i32 @strerror(i32 %110)
%112 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %104, i64 %108, i32 %109, i32 %111)
br label %113
113: ; preds = %107, %103
%114 = load i64, i64* %61
%115 = load i64, i64* @CLD_CONTINUED
%116 = icmp eq i64 %114, %115
br i1 %116, label %123, label %117
117: ; preds = %113
%118 = load i64, i64* %2
%119 = load i32, i32* %1
%120 = load i32, i32* @errno
%121 = call i32 @strerror(i32 %120)
%122 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %114, i64 %118, i32 %119, i32 %121)
br label %123
123: ; preds = %117, %113
%124 = load i64, i64* %72
%125 = load i64, i64* %2
%126 = icmp eq i64 %124, %125
br i1 %126, label %132, label %127
127: ; preds = %123
%128 = load i32, i32* %1
%129 = load i32, i32* @errno
%130 = call i32 @strerror(i32 %129)
%131 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %124, i64 %125, i32 %128, i32 %130)
br label %132
132: ; preds = %127, %123
%133 = load i32, i32* %1
%134 = load i32, i32* @WUNTRACED
%135 = call i32 @sys_waitid(i32 3, i32 %133, %struct.TYPE_3__* %4, i32 %134, i32* null)
%136 = icmp slt i32 %135, 0
br i1 %136, label %137, label %143
137: ; preds = %132
%138 = load i64, i64* %2
%139 = load i32, i32* %1
%140 = load i32, i32* @errno
%141 = call i32 @strerror(i32 %140)
%142 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %138, i32 %139, i32 %141)
br label %143
143: ; preds = %137, %132
%144 = load i64, i64* %50
%145 = load i64, i64* @SIGCHLD
%146 = icmp eq i64 %144, %145
br i1 %146, label %153, label %147
147: ; preds = %143
%148 = load i64, i64* %2
%149 = load i32, i32* %1
%150 = load i32, i32* @errno
%151 = call i32 @strerror(i32 %150)
%152 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %144, i64 %148, i32 %149, i32 %151)
br label %153
153: ; preds = %147, %143
%154 = load i64, i64* %61
%155 = load i64, i64* @CLD_STOPPED
%156 = icmp eq i64 %154, %155
br i1 %156, label %163, label %157
157: ; preds = %153
%158 = load i64, i64* %2
%159 = load i32, i32* %1
%160 = load i32, i32* @errno
%161 = call i32 @strerror(i32 %160)
%162 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %154, i64 %158, i32 %159, i32 %161)
br label %163
163: ; preds = %157, %153
%164 = load i64, i64* %72
%165 = load i64, i64* %2
%166 = icmp eq i64 %164, %165
br i1 %166, label %172, label %167
167: ; preds = %163
%168 = load i32, i32* %1
%169 = load i32, i32* @errno
%170 = call i32 @strerror(i32 %169)
%171 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %164, i64 %165, i32 %168, i32 %170)
br label %172
172: ; preds = %167, %163
%173 = load i32, i32* %1
%174 = load i32, i32* @SIGKILL
%175 = call i32 @sys_pidfd_send_signal(i32 %173, i32 %174, i32* null, i32 0)
%176 = icmp slt i32 %175, 0
br i1 %176, label %177, label %183
177: ; preds = %172
%178 = load i64, i64* %2
%179 = load i32, i32* %1
%180 = load i32, i32* @errno
%181 = call i32 @strerror(i32 %180)
%182 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %178, i32 %179, i32 %181)
br label %183
183: ; preds = %177, %172
%184 = load i32, i32* %1
%185 = load i32, i32* @WEXITED
%186 = call i32 @sys_waitid(i32 3, i32 %184, %struct.TYPE_3__* %4, i32 %185, i32* null)
%187 = icmp slt i32 %186, 0
br i1 %187, label %188, label %194
188: ; preds = %183
%189 = load i64, i64* %2
%190 = load i32, i32* %1
%191 = load i32, i32* @errno
%192 = call i32 @strerror(i32 %191)
%193 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %189, i32 %190, i32 %192)
br label %194
194: ; preds = %188, %183
%195 = load i64, i64* %50
%196 = load i64, i64* @SIGCHLD
%197 = icmp eq i64 %195, %196
br i1 %197, label %204, label %198
198: ; preds = %194
%199 = load i64, i64* %2
%200 = load i32, i32* %1
%201 = load i32, i32* @errno
%202 = call i32 @strerror(i32 %201)
%203 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %195, i64 %199, i32 %200, i32 %202)
br label %204
204: ; preds = %198, %194
%205 = load i64, i64* %61
%206 = load i64, i64* @CLD_KILLED
%207 = icmp eq i64 %205, %206
br i1 %207, label %214, label %208
208: ; preds = %204
%209 = load i64, i64* %2
%210 = load i32, i32* %1
%211 = load i32, i32* @errno
%212 = call i32 @strerror(i32 %211)
%213 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %205, i64 %209, i32 %210, i32 %212)
br label %214
214: ; preds = %208, %204
%215 = load i64, i64* %72
%216 = load i64, i64* %2
%217 = icmp eq i64 %215, %216
br i1 %217, label %223, label %218
218: ; preds = %214
%219 = load i32, i32* %1
%220 = load i32, i32* @errno
%221 = call i32 @strerror(i32 %220)
%222 = call i32 (i8*, i8*, i64, ...) @ksft_exit_fail_msg(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %215, i64 %216, i32 %219, i32 %221)
br label %223
223: ; preds = %218, %214
%224 = load i32, i32* %1
%225 = call i32 @close(i32 %224)
%226 = call i32 @ksft_test_result_pass(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 0
}