#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 _NSIG;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sig2str(int, char *);
scalar_t__ sigismember(int /*<<< orphan*/ *, int);
void pr_mask(sigset_t *mask) {
  int i;
  char text[10];
  for (i = 1; i < _NSIG; ++i) {
    if (sigismember(mask, i)) {
      sig2str(i, text);
      printf("%s ", text);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<pr_mask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%eax
jge    119c <pr_mask+0x6c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <sigismember@plt>
cmp    $0x0,%rax
je     1189 <pr_mask+0x59>
mov    -0xc(%rbp),%edi
lea    -0x16(%rbp),%rsi
call   1040 <sig2str@plt>
lea    -0x16(%rbp),%rsi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118e <pr_mask+0x5e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <pr_mask+0x13>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_mask>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2e9d(%rip),%r12
cmpl   $0x2,(%r12)
jl     11a1 <pr_mask+0x61>
mov    %rdi,%rbx
mov    $0x1,%ebp
lea    0x6(%rsp),%r14
lea    0xe92(%rip),%r15
jmp    1179 <pr_mask+0x39>
add    $0x1,%ebp
cmp    (%r12),%ebp
jge    11a1 <pr_mask+0x61>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <sigismember@plt>
test   %rax,%rax
je     1170 <pr_mask+0x30>
mov    %ebp,%edi
mov    %r14,%rsi
call   1050 <sig2str@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <pr_mask+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@_NSIG = global i32 0
@.str = [4 x i8] c"%s \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @pr_mask(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca [10 x i8]
store i32* %0, i32** %2
store i32 1, i32* %3
br label %5
5: ; preds = %21, %1
%6 = load i32, i32* %3
%7 = load i32, i32* @_NSIG
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %24
9: ; preds = %5
%10 = load i32*, i32** %2
%11 = load i32, i32* %3
%12 = call i64 @sigismember(i32* %10, i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %9
%15 = load i32, i32* %3
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%17 = call i32 @sig2str(i32 %15, i8* %16)
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %14, %9
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %5
24: ; preds = %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@_NSIG = global i32 0
@.str = [4 x i8] c"%s \00"
define void @pr_mask(i32* %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @_NSIG
%5 = icmp sgt i32 %4, 1
br i1 %5, label %6, label %17
6: ; preds = %1, %13
%7 = phi i32 [ %14, %13 ], [ 1, %1 ]
%8 = call i64 @sigismember(i32* %0, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = call i32 @sig2str(i32 %7, i8* %3)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %13
13: ; preds = %6, %10
%14 = add nuw nsw i32 %7, 1
%15 = load i32, i32* @_NSIG
%16 = icmp slt i32 %14, %15
br i1 %16, label %6, label %17
17: ; preds = %13, %1
%18 = call i32 @putchar(i32 10)
ret void
}