#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 */

/* Variables and functions */
int ksft_exit_pass();
int /*<<< orphan*/ ksft_print_header();
int /*<<< orphan*/ ksft_set_plan(int);
int /*<<< orphan*/ test_pidfd_poll_exec(int);
int /*<<< orphan*/ test_pidfd_poll_leader_exit(int);
int /*<<< orphan*/ test_pidfd_send_signal_exited_fail();
int /*<<< orphan*/ test_pidfd_send_signal_recycled_pid_fail();
int /*<<< orphan*/ test_pidfd_send_signal_simple_success();
int /*<<< orphan*/ test_pidfd_send_signal_syscall_support();
int main(int argc, char **argv) {
  ksft_print_header();
  ksft_set_plan(4);
  test_pidfd_poll_exec(0);
  test_pidfd_poll_exec(1);
  test_pidfd_poll_leader_exit(0);
  test_pidfd_poll_leader_exit(1);
  test_pidfd_send_signal_syscall_support();
  test_pidfd_send_signal_simple_success();
  test_pidfd_send_signal_exited_fail();
  test_pidfd_send_signal_recycled_pid_fail();
  return ksft_exit_pass();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10b0 <ksft_print_header@plt>
mov    $0x4,%edi
call   1040 <ksft_set_plan@plt>
xor    %edi,%edi
call   1060 <test_pidfd_poll_exec@plt>
mov    $0x1,%edi
call   1060 <test_pidfd_poll_exec@plt>
xor    %edi,%edi
call   1030 <test_pidfd_poll_leader_exit@plt>
mov    $0x1,%edi
call   1030 <test_pidfd_poll_leader_exit@plt>
mov    $0x0,%al
call   1090 <test_pidfd_send_signal_syscall_support@plt>
mov    $0x0,%al
call   10a0 <test_pidfd_send_signal_simple_success@plt>
mov    $0x0,%al
call   1080 <test_pidfd_send_signal_exited_fail@plt>
mov    $0x0,%al
call   1070 <test_pidfd_send_signal_recycled_pid_fail@plt>
mov    $0x0,%al
call   1050 <ksft_exit_pass@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   10b0 <ksft_print_header@plt>
mov    $0x4,%edi
call   1040 <ksft_set_plan@plt>
xor    %edi,%edi
call   1060 <test_pidfd_poll_exec@plt>
mov    $0x1,%edi
call   1060 <test_pidfd_poll_exec@plt>
xor    %edi,%edi
call   1030 <test_pidfd_poll_leader_exit@plt>
mov    $0x1,%edi
call   1030 <test_pidfd_poll_leader_exit@plt>
xor    %eax,%eax
call   1090 <test_pidfd_send_signal_syscall_support@plt>
xor    %eax,%eax
call   10a0 <test_pidfd_send_signal_simple_success@plt>
xor    %eax,%eax
call   1080 <test_pidfd_send_signal_exited_fail@plt>
xor    %eax,%eax
call   1070 <test_pidfd_send_signal_recycled_pid_fail@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <ksft_exit_pass@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @ksft_print_header()
%7 = call i32 @ksft_set_plan(i32 4)
%8 = call i32 @test_pidfd_poll_exec(i32 0)
%9 = call i32 @test_pidfd_poll_exec(i32 1)
%10 = call i32 @test_pidfd_poll_leader_exit(i32 0)
%11 = call i32 @test_pidfd_poll_leader_exit(i32 1)
%12 = call i32 (...) @test_pidfd_send_signal_syscall_support()
%13 = call i32 (...) @test_pidfd_send_signal_simple_success()
%14 = call i32 (...) @test_pidfd_send_signal_exited_fail()
%15 = call i32 (...) @test_pidfd_send_signal_recycled_pid_fail()
%16 = call i32 (...) @ksft_exit_pass()
ret i32 %16
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @ksft_print_header()
%4 = tail call i32 @ksft_set_plan(i32 4)
%5 = tail call i32 @test_pidfd_poll_exec(i32 0)
%6 = tail call i32 @test_pidfd_poll_exec(i32 1)
%7 = tail call i32 @test_pidfd_poll_leader_exit(i32 0)
%8 = tail call i32 @test_pidfd_poll_leader_exit(i32 1)
%9 = tail call i32 (...) @test_pidfd_send_signal_syscall_support()
%10 = tail call i32 (...) @test_pidfd_send_signal_simple_success()
%11 = tail call i32 (...) @test_pidfd_send_signal_exited_fail()
%12 = tail call i32 (...) @test_pidfd_send_signal_recycled_pid_fail()
%13 = tail call i32 (...) @ksft_exit_pass()
ret i32 %13
}