#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*/ SIGALRM;
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SIGHUP;
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIGQUIT;
int /*<<< orphan*/ SIGUSR1;
int /*<<< orphan*/ SIGUSR2;
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sigismember(int /*<<< orphan*/ *, int /*<<< orphan*/);
scalar_t__ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                       int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void pr_mask(const char *str) {
  sigset_t sigset;
  int errno_save;
  errno_save = errno;
  if (sigprocmask(0, NULL, &sigset) < 0) {
    fprintf(stderr, "sigprocmask error\n");
    return;
  }
  printf("%s ", str);
  if (sigismember(&sigset, SIGINT)) {
    printf("SIGINT");
  } else if (sigismember(&sigset, SIGQUIT)) {
    printf("SIGQUIT");
  } else if (sigismember(&sigset, SIGALRM)) {
    printf("SIGALRM");
  } else if (sigismember(&sigset, SIGUSR1)) {
    printf("SIGUSR1");
  } else if (sigismember(&sigset, SIGUSR2)) {
    printf("SIGUSR2");
  } else if (sigismember(&sigset, SIGABRT)) {
    printf("SIGABRT");
  } else if (sigismember(&sigset, SIGHUP)) {
    printf("SIGHUP");
  } else if (sigismember(&sigset, SIGCHLD)) {
    printf("SIGCHLD");
  }
  printf("\n");
  errno = errno_save;
}


x86 assembly (clang, -O0):
<pr_mask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
lea    -0xc(%rbp),%rdx
call   1030 <sigprocmask@plt>
cmp    $0x0,%rax
jge    118b <pr_mask+0x4b>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
call   1050 <fprintf@plt>
jmp    134d <pr_mask+0x20d>
mov    -0x8(%rbp),%rsi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     11cc <pr_mask+0x8c>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1333 <pr_mask+0x1f3>
mov    0x2df5(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     11fb <pr_mask+0xbb>
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    132e <pr_mask+0x1ee>
mov    0x2dd6(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     122a <pr_mask+0xea>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1329 <pr_mask+0x1e9>
mov    0x2daf(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     1259 <pr_mask+0x119>
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1324 <pr_mask+0x1e4>
mov    0x2d48(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     1288 <pr_mask+0x148>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    131f <pr_mask+0x1df>
mov    0x2d09(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     12b7 <pr_mask+0x177>
lea    0xd93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    131a <pr_mask+0x1da>
mov    0x2d32(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     12e6 <pr_mask+0x1a6>
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1315 <pr_mask+0x1d5>
mov    0x2cd3(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     1310 <pr_mask+0x1d0>
lea    0xd44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1315 <pr_mask+0x1d5>
jmp    131a <pr_mask+0x1da>
jmp    131f <pr_mask+0x1df>
jmp    1324 <pr_mask+0x1e4>
jmp    1329 <pr_mask+0x1e9>
jmp    132e <pr_mask+0x1ee>
jmp    1333 <pr_mask+0x1f3>
lea    0xcd7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%ecx
mov    0x2c55(%rip),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_mask>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    0x2e3e(%rip),%r14
mov    (%r14),%ebp
lea    0xc(%rsp),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1030 <sigprocmask@plt>
test   %rax,%rax
js     11ad <pr_mask+0x5d>
lea    0xe94(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1070 <sigismember@plt>
test   %rax,%rax
je     11c7 <pr_mask+0x77>
lea    0xe6f(%rip),%rdi
jmp    12b5 <pr_mask+0x165>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
lea    0xe43(%rip),%rsi
call   1060 <fprintf@plt>
jmp    12c9 <pr_mask+0x179>
mov    0x2dfa(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1070 <sigismember@plt>
test   %rax,%rax
je     11eb <pr_mask+0x9b>
lea    0xe38(%rip),%rdi
jmp    12b5 <pr_mask+0x165>
mov    0x2de6(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1070 <sigismember@plt>
test   %rax,%rax
je     120f <pr_mask+0xbf>
lea    0xe1c(%rip),%rdi
jmp    12b5 <pr_mask+0x165>
mov    0x2dca(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1070 <sigismember@plt>
test   %rax,%rax
je     1233 <pr_mask+0xe3>
lea    0xe00(%rip),%rdi
jmp    12b5 <pr_mask+0x165>
mov    0x2d6e(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1070 <sigismember@plt>
test   %rax,%rax
je     1254 <pr_mask+0x104>
lea    0xde4(%rip),%rdi
jmp    12b5 <pr_mask+0x165>
mov    0x2d3d(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1070 <sigismember@plt>
test   %rax,%rax
je     1275 <pr_mask+0x125>
lea    0xdcb(%rip),%rdi
jmp    12b5 <pr_mask+0x165>
mov    0x2d74(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1070 <sigismember@plt>
test   %rax,%rax
je     1296 <pr_mask+0x146>
lea    0xdb2(%rip),%rdi
jmp    12b5 <pr_mask+0x165>
mov    0x2d23(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1070 <sigismember@plt>
test   %rax,%rax
je     12bc <pr_mask+0x16c>
lea    0xd98(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %ebp,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"sigprocmask error\0A\00"
@.str.1 = [4 x i8] c"%s \00"
@SIGINT = global i32 0
@.str.2 = [7 x i8] c"SIGINT\00"
@SIGQUIT = global i32 0
@.str.3 = [8 x i8] c"SIGQUIT\00"
@SIGALRM = global i32 0
@.str.4 = [8 x i8] c"SIGALRM\00"
@SIGUSR1 = global i32 0
@.str.5 = [8 x i8] c"SIGUSR1\00"
@SIGUSR2 = global i32 0
@.str.6 = [8 x i8] c"SIGUSR2\00"
@SIGABRT = global i32 0
@.str.7 = [8 x i8] c"SIGABRT\00"
@SIGHUP = global i32 0
@.str.8 = [7 x i8] c"SIGHUP\00"
@SIGCHLD = global i32 0
@.str.9 = [8 x i8] c"SIGCHLD\00"
@.str.10 = [2 x i8] c"\0A\00"
define void @pr_mask(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i32, i32* @errno
store i32 %5, i32* %4
%6 = call i64 @sigprocmask(i32 0, i32* null, i32* %3)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %71
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @SIGINT
%15 = call i64 @sigismember(i32* %3, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %68
19: ; preds = %11
%20 = load i32, i32* @SIGQUIT
%21 = call i64 @sigismember(i32* %3, i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %67
25: ; preds = %19
%26 = load i32, i32* @SIGALRM
%27 = call i64 @sigismember(i32* %3, i32 %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %66
31: ; preds = %25
%32 = load i32, i32* @SIGUSR1
%33 = call i64 @sigismember(i32* %3, i32 %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %65
37: ; preds = %31
%38 = load i32, i32* @SIGUSR2
%39 = call i64 @sigismember(i32* %3, i32 %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %64
43: ; preds = %37
%44 = load i32, i32* @SIGABRT
%45 = call i64 @sigismember(i32* %3, i32 %44)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %63
49: ; preds = %43
%50 = load i32, i32* @SIGHUP
%51 = call i64 @sigismember(i32* %3, i32 %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %62
55: ; preds = %49
%56 = load i32, i32* @SIGCHLD
%57 = call i64 @sigismember(i32* %3, i32 %56)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %55
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %61
61: ; preds = %59, %55
br label %62
62: ; preds = %61, %53
br label %63
63: ; preds = %62, %47
br label %64
64: ; preds = %63, %41
br label %65
65: ; preds = %64, %35
br label %66
66: ; preds = %65, %29
br label %67
67: ; preds = %66, %23
br label %68
68: ; preds = %67, %17
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%70 = load i32, i32* %4
store i32 %70, i32* @errno
br label %71
71: ; preds = %68, %8
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"sigprocmask error\0A\00"
@.str.1 = [4 x i8] c"%s \00"
@SIGINT = global i32 0
@.str.2 = [7 x i8] c"SIGINT\00"
@SIGQUIT = global i32 0
@.str.3 = [8 x i8] c"SIGQUIT\00"
@SIGALRM = global i32 0
@.str.4 = [8 x i8] c"SIGALRM\00"
@SIGUSR1 = global i32 0
@.str.5 = [8 x i8] c"SIGUSR1\00"
@SIGUSR2 = global i32 0
@.str.6 = [8 x i8] c"SIGUSR2\00"
@SIGABRT = global i32 0
@.str.7 = [8 x i8] c"SIGABRT\00"
@SIGHUP = global i32 0
@.str.8 = [7 x i8] c"SIGHUP\00"
@SIGCHLD = global i32 0
@.str.9 = [8 x i8] c"SIGCHLD\00"
define void @pr_mask(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @errno
%5 = call i64 @sigprocmask(i32 0, i32* null, i32* %2)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %48
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%12 = load i32, i32* @SIGINT
%13 = call i64 @sigismember(i32* %2, i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %43
15: ; preds = %10
%16 = load i32, i32* @SIGQUIT
%17 = call i64 @sigismember(i32* %2, i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %43
19: ; preds = %15
%20 = load i32, i32* @SIGALRM
%21 = call i64 @sigismember(i32* %2, i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %43
23: ; preds = %19
%24 = load i32, i32* @SIGUSR1
%25 = call i64 @sigismember(i32* %2, i32 %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %43
27: ; preds = %23
%28 = load i32, i32* @SIGUSR2
%29 = call i64 @sigismember(i32* %2, i32 %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %43
31: ; preds = %27
%32 = load i32, i32* @SIGABRT
%33 = call i64 @sigismember(i32* %2, i32 %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %43
35: ; preds = %31
%36 = load i32, i32* @SIGHUP
%37 = call i64 @sigismember(i32* %2, i32 %36)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %35
%40 = load i32, i32* @SIGCHLD
%41 = call i64 @sigismember(i32* %2, i32 %40)
%42 = icmp eq i64 %41, 0
br i1 %42, label %46, label %43
43: ; preds = %39, %35, %31, %27, %23, %19, %15, %10
%44 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %10 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %15 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %19 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %23 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %27 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %31 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), %35 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), %39 ]
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %44)
br label %46
46: ; preds = %43, %39
%47 = call i32 @putchar(i32 10)
store i32 %4, i32* @errno
br label %48
48: ; preds = %46, %7
ret void
}