#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 int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIGABRT;
int /*<<< orphan*/ SIGHUP;
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ sigismember(int /*<<< orphan*/ *, int /*<<< orphan*/);
scalar_t__ sigpending(int /*<<< orphan*/ *);
void check_pending() {
  sigset_t set;
  if (sigpending(&set) != 0)
    perror("sigpending() error");
  else {
    if (sigismember(&set, SIGHUP))
      printf("\t| SIG:1 | SIGHUP is pending\n");
    if (sigismember(&set, SIGINT))
      printf("\t| SIG:2 | SIGINT is pending\n");
    if (sigismember(&set, SIGABRT))
      printf("\t| SIG:6 | SIGABRT is pending\n");
  }
}


x86 assembly (clang, -O0):
<check_pending>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <sigpending@plt>
cmp    $0x0,%rax
je     116c <check_pending+0x2c>
lea    0xe9e(%rip),%rdi
call   1040 <perror@plt>
jmp    11e9 <check_pending+0xa9>
mov    0x2e7d(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     1194 <check_pending+0x54>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     11bc <check_pending+0x7c>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     11e4 <check_pending+0xa4>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <check_pending+0xa9>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_pending>:
push   %rax
lea    0x4(%rsp),%rdi
call   1050 <sigpending@plt>
test   %rax,%rax
jne    11be <check_pending+0x7e>
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdi
call   1060 <sigismember@plt>
test   %rax,%rax
je     1174 <check_pending+0x34>
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdi
call   1060 <sigismember@plt>
test   %rax,%rax
je     1198 <check_pending+0x58>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdi
call   1060 <sigismember@plt>
test   %rax,%rax
je     11bc <check_pending+0x7c>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
pop    %rax
ret
lea    0xe3b(%rip),%rdi
call   1040 <perror@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"sigpending() error\00"
@SIGHUP = global i32 0
@.str.1 = [30 x i8] c"\09| SIG:1 | SIGHUP is pending\0A\00"
@SIGINT = global i32 0
@.str.2 = [30 x i8] c"\09| SIG:2 | SIGINT is pending\0A\00"
@SIGABRT = global i32 0
@.str.3 = [31 x i8] c"\09| SIG:6 | SIGABRT is pending\0A\00"
define void @check_pending() {
%1 = alloca i32
%2 = call i64 @sigpending(i32* %1)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %25
6: ; preds = %0
%7 = load i32, i32* @SIGHUP
%8 = call i64 @sigismember(i32* %1, i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
%13 = load i32, i32* @SIGINT
%14 = call i64 @sigismember(i32* %1, i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* @SIGABRT
%20 = call i64 @sigismember(i32* %1, i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %18
br label %25
25: ; preds = %24, %4
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"sigpending() error\00"
@SIGHUP = global i32 0
@SIGINT = global i32 0
@SIGABRT = global i32 0
@str = [30 x i8] c"\09| SIG:6 | SIGABRT is pending\00"
@str.4 = [29 x i8] c"\09| SIG:2 | SIGINT is pending\00"
@str.5 = [29 x i8] c"\09| SIG:1 | SIGHUP is pending\00"
define void @check_pending() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @sigpending(i32* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %25
7: ; preds = %0
%8 = load i32, i32* @SIGHUP
%9 = call i64 @sigismember(i32* %1, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.5, i64 0, i64 0))
br label %13
13: ; preds = %11, %7
%14 = load i32, i32* @SIGINT
%15 = call i64 @sigismember(i32* %1, i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.4, i64 0, i64 0))
br label %19
19: ; preds = %17, %13
%20 = load i32, i32* @SIGABRT
%21 = call i64 @sigismember(i32* %1, i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %19, %23, %5
ret void
}