#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef union sigval {
  int dummy;
} sigval;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIGRTMIN;
int /*<<< orphan*/ SIGUSR1;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sigqueue(int /*<<< orphan*/, int /*<<< orphan*/,
                            union sigval);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "usage : %s pid\n", argv[0]);
    exit(EXIT_SUCCESS);
  }
  pid_t pid = atoi(argv[1]);
  union sigval sv;
  sigqueue(pid, SIGINT, sv);
  sigqueue(pid, SIGINT, sv);
  sigqueue(pid, SIGINT, sv);
  sigqueue(pid, SIGRTMIN, sv);
  sigqueue(pid, SIGRTMIN, sv);
  sigqueue(pid, SIGRTMIN, sv);
  sleep(1);
  kill(pid, SIGUSR1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11aa <main+0x4a>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2e1c(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
call   1050 <sigqueue@plt>
mov    -0x14(%rbp),%edi
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
call   1050 <sigqueue@plt>
mov    -0x14(%rbp),%edi
mov    0x2df4(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
call   1050 <sigqueue@plt>
mov    -0x14(%rbp),%edi
mov    0x2dc8(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
call   1050 <sigqueue@plt>
mov    -0x14(%rbp),%edi
mov    0x2db4(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
call   1050 <sigqueue@plt>
mov    -0x14(%rbp),%edi
mov    0x2da0(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
call   1050 <sigqueue@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    -0x14(%rbp),%edi
mov    0x2da2(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11e2 <main+0x82>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    0x2e65(%rip),%r14
mov    (%r14),%esi
mov    %eax,%edi
call   1050 <sigqueue@plt>
mov    (%r14),%esi
mov    %ebx,%edi
call   1050 <sigqueue@plt>
mov    (%r14),%esi
mov    %ebx,%edi
call   1050 <sigqueue@plt>
mov    0x2e28(%rip),%r14
mov    (%r14),%esi
mov    %ebx,%edi
call   1050 <sigqueue@plt>
mov    (%r14),%esi
mov    %ebx,%edi
call   1050 <sigqueue@plt>
mov    (%r14),%esi
mov    %ebx,%edi
call   1050 <sigqueue@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1040 <kill@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe0b(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%union.sigval = type { i32 }
@stderr = global i32 0
@.str = [16 x i8] c"usage : %s pid\0A\00"
@EXIT_SUCCESS = global i32 0
@SIGINT = global i32 0
@SIGRTMIN = global i32 0
@SIGUSR1 = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %union.sigval
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %18
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_SUCCESS
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = load i32, i32* @SIGINT
%25 = getelementptr inbounds %union.sigval, %union.sigval* %7, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i32 @sigqueue(i32 %23, i32 %24, i32 %26)
%28 = load i32, i32* %6
%29 = load i32, i32* @SIGINT
%30 = getelementptr inbounds %union.sigval, %union.sigval* %7, i32 0, i32 0
%31 = load i32, i32* %30
%32 = call i32 @sigqueue(i32 %28, i32 %29, i32 %31)
%33 = load i32, i32* %6
%34 = load i32, i32* @SIGINT
%35 = getelementptr inbounds %union.sigval, %union.sigval* %7, i32 0, i32 0
%36 = load i32, i32* %35
%37 = call i32 @sigqueue(i32 %33, i32 %34, i32 %36)
%38 = load i32, i32* %6
%39 = load i32, i32* @SIGRTMIN
%40 = getelementptr inbounds %union.sigval, %union.sigval* %7, i32 0, i32 0
%41 = load i32, i32* %40
%42 = call i32 @sigqueue(i32 %38, i32 %39, i32 %41)
%43 = load i32, i32* %6
%44 = load i32, i32* @SIGRTMIN
%45 = getelementptr inbounds %union.sigval, %union.sigval* %7, i32 0, i32 0
%46 = load i32, i32* %45
%47 = call i32 @sigqueue(i32 %43, i32 %44, i32 %46)
%48 = load i32, i32* %6
%49 = load i32, i32* @SIGRTMIN
%50 = getelementptr inbounds %union.sigval, %union.sigval* %7, i32 0, i32 0
%51 = load i32, i32* %50
%52 = call i32 @sigqueue(i32 %48, i32 %49, i32 %51)
%53 = call i32 @sleep(i32 1)
%54 = load i32, i32* %6
%55 = load i32, i32* @SIGUSR1
%56 = call i32 @kill(i32 %54, i32 %55)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"usage : %s pid\0A\00"
@EXIT_SUCCESS = global i32 0
@SIGINT = global i32 0
@SIGRTMIN = global i32 0
@SIGUSR1 = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @EXIT_SUCCESS
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = load i32, i32* @SIGINT
%15 = tail call i32 @sigqueue(i32 %13, i32 %14, i32 undef)
%16 = load i32, i32* @SIGINT
%17 = tail call i32 @sigqueue(i32 %13, i32 %16, i32 undef)
%18 = load i32, i32* @SIGINT
%19 = tail call i32 @sigqueue(i32 %13, i32 %18, i32 undef)
%20 = load i32, i32* @SIGRTMIN
%21 = tail call i32 @sigqueue(i32 %13, i32 %20, i32 undef)
%22 = load i32, i32* @SIGRTMIN
%23 = tail call i32 @sigqueue(i32 %13, i32 %22, i32 undef)
%24 = load i32, i32* @SIGRTMIN
%25 = tail call i32 @sigqueue(i32 %13, i32 %24, i32 undef)
%26 = tail call i32 @sleep(i32 1)
%27 = load i32, i32* @SIGUSR1
%28 = tail call i32 @kill(i32 %13, i32 %27)
ret i32 0
}