#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*/ SIGTERM;
int /*<<< orphan*/ SIGUSR1;
int /*<<< orphan*/ SIGUSR2;
int /*<<< orphan*/ SIGWINCH;
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ sigismember(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void CheckSigs() {
  sigset_t sigset;
  sigprocmask(SIG_BLOCK, 0, &sigset);
  if (sigismember(&sigset, SIGUSR1)) {
    fprintf(stderr, "usr1 blocked\n");
  }
  if (sigismember(&sigset, SIGUSR2)) {
    fprintf(stderr, "usr2 blocked\n");
  }
  if (sigismember(&sigset, SIGTERM)) {
    fprintf(stderr, "term blocked\n");
  }
  if (sigismember(&sigset, SIGWINCH)) {
    fprintf(stderr, "winch blocked\n");
  }
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<CheckSigs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
lea    -0x4(%rbp),%rdx
call   1030 <sigprocmask@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1050 <sigismember@plt>
cmp    $0x0,%rax
je     117d <CheckSigs+0x4d>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1050 <sigismember@plt>
cmp    $0x0,%rax
je     11ae <CheckSigs+0x7e>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
lea    0xe65(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1050 <sigismember@plt>
cmp    $0x0,%rax
je     11df <CheckSigs+0xaf>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
lea    0xe42(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2df2(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1050 <sigismember@plt>
cmp    $0x0,%rax
je     1210 <CheckSigs+0xe0>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
lea    0xe1f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
lea    0xdec(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckSigs>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xc(%rsp),%rbx
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <sigprocmask@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigismember@plt>
test   %rax,%rax
je     1178 <CheckSigs+0x48>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e41(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1050 <sigismember@plt>
test   %rax,%rax
je     11a5 <CheckSigs+0x75>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1050 <sigismember@plt>
test   %rax,%rax
je     11d2 <CheckSigs+0xa2>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
lea    0xe4f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1050 <sigismember@plt>
test   %rax,%rax
je     11ff <CheckSigs+0xcf>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
lea    0xe30(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
lea    0xdfd(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIG_BLOCK = global i32 0
@SIGUSR1 = global i32 0
@stderr = global i32 0
@.str = [14 x i8] c"usr1 blocked\0A\00"
@SIGUSR2 = global i32 0
@.str.1 = [14 x i8] c"usr2 blocked\0A\00"
@SIGTERM = global i32 0
@.str.2 = [14 x i8] c"term blocked\0A\00"
@SIGWINCH = global i32 0
@.str.3 = [15 x i8] c"winch blocked\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @CheckSigs() {
%1 = alloca i32
%2 = load i32, i32* @SIG_BLOCK
%3 = call i32 @sigprocmask(i32 %2, i32 0, i32* %1)
%4 = load i32, i32* @SIGUSR1
%5 = call i64 @sigismember(i32* %1, i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %7, %0
%11 = load i32, i32* @SIGUSR2
%12 = call i64 @sigismember(i32* %1, i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* @SIGTERM
%19 = call i64 @sigismember(i32* %1, i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %21, %17
%25 = load i32, i32* @SIGWINCH
%26 = call i64 @sigismember(i32* %1, i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %28, %24
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SIG_BLOCK = global i32 0
@SIGUSR1 = global i32 0
@stderr = global i32 0
@.str = [14 x i8] c"usr1 blocked\0A\00"
@SIGUSR2 = global i32 0
@.str.1 = [14 x i8] c"usr2 blocked\0A\00"
@SIGTERM = global i32 0
@.str.2 = [14 x i8] c"term blocked\0A\00"
@SIGWINCH = global i32 0
@.str.3 = [15 x i8] c"winch blocked\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @CheckSigs() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @SIG_BLOCK
%4 = call i32 @sigprocmask(i32 %3, i32 0, i32* %1)
%5 = load i32, i32* @SIGUSR1
%6 = call i64 @sigismember(i32* %1, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %0
%12 = load i32, i32* @SIGUSR2
%13 = call i64 @sigismember(i32* %1, i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %15, %11
%19 = load i32, i32* @SIGTERM
%20 = call i64 @sigismember(i32* %1, i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %22, %18
%26 = load i32, i32* @SIGWINCH
%27 = call i64 @sigismember(i32* %1, i32 %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %25
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %29, %25
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}