#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 TYPE_3__ {
  int sival_int;
};
typedef TYPE_1__ sigval_t;
typedef void *pid_t;

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int EXIT_FAILURE;
int EXIT_SUCCESS;
void *atoi(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ perror(char *);
scalar_t__ sigqueue(void *, int, TYPE_1__);
int main_test(int argc, char **argv) {
  pid_t pid;
  int signum;
  if (argc != 3) {
    errno = EINVAL;
    perror("argument");
    return EXIT_FAILURE;
  }
  signum = atoi(argv[1]);
  pid = atoi(argv[2]);
  sigval_t sigval;
  sigval.sival_int = 125;
  if (sigqueue(pid, signum, sigval)) {
    perror("sigqueue");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1178 <main_test+0x48>
mov    0x2e80(%rip),%rax
mov    (%rax),%ecx
mov    0x2e87(%rip),%rax
mov    %ecx,(%rax)
lea    0xe9e(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d1 <main_test+0xa1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %rax,-0x18(%rbp)
movl   $0x7d,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1030 <sigqueue@plt>
cmp    $0x0,%rax
je     11c5 <main_test+0x95>
lea    0xe49(%rip),%rdi
call   1040 <perror@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_test>:
push   %r14
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    1177 <main_test+0x47>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %rax,%rdi
mov    %r14d,%esi
mov    $0x7d,%edx
call   1030 <sigqueue@plt>
mov    0x2e60(%rip),%rbx
test   %rax,%rax
jne    1199 <main_test+0x69>
mov    (%rbx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e52(%rip),%rax
mov    (%rax),%eax
mov    0x2e59(%rip),%rcx
mov    %eax,(%rcx)
mov    0x2e48(%rip),%rbx
lea    0xe69(%rip),%rdi
jmp    11a0 <main_test+0x70>
lea    0xe69(%rip),%rdi
call   1040 <perror@plt>
jmp    116d <main_test+0x3d>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
@.str = [9 x i8] c"argument\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"sigqueue\00"
@EXIT_SUCCESS = global i32 0
define i32 @main_test(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.TYPE_3__
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @EINVAL
store i32 %12, i32* @errno
%13 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
store i32 %14, i32* %3
br label %36
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i8* @atoi(i8* %18)
%20 = ptrtoint i8* %19 to i32
store i32 %20, i32* %7
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i8* @atoi(i8* %23)
store i8* %24, i8** %6
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 125, i32* %25
%26 = load i8*, i8** %6
%27 = load i32, i32* %7
%28 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%29 = load i32, i32* %28
%30 = call i64 @sigqueue(i8* %26, i32 %27, i32 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %15
%33 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %15
%35 = load i32, i32* @EXIT_SUCCESS
store i32 %35, i32* %3
br label %36
36: ; preds = %34, %11
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@EINVAL = global i32 0
@errno = global i32 0
@.str = [9 x i8] c"argument\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"sigqueue\00"
@EXIT_SUCCESS = global i32 0
define i32 @main_test(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = load i32, i32* @EINVAL
store i32 %5, i32* @errno
br label %17
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i8* @atoi(i8* %8)
%10 = ptrtoint i8* %9 to i64
%11 = trunc i64 %10 to i32
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i8* @atoi(i8* %13)
%15 = tail call i64 @sigqueue(i8* %14, i32 %11, i32 125)
%16 = icmp eq i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %6, %4
%18 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %6 ]
%19 = phi i32* [ @EXIT_FAILURE, %4 ], [ @EXIT_SUCCESS, %6 ]
%20 = tail call i32 @perror(i8* %18)
br label %21
21: ; preds = %17, %6
%22 = phi i32* [ @EXIT_SUCCESS, %6 ], [ %19, %17 ]
%23 = load i32, i32* %22
ret i32 %23
}