#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*/ printf(char *, ...);
scalar_t__ sigismember(int /*<<< orphan*/ *, int);
void PrintMask(const char *prefix, sigset_t *mask) {
  int sig;
  int first;
  first = 1;
  printf("%s[", prefix);
  for (sig = 1; sig < 64; sig++) {
    if (sigismember(mask, sig)) {
      if (!first)
        printf(" ");
      first = 0;
      printf("%d", sig);
    }
  }
  printf("]\n");
}


x86 assembly (clang, -O0):
<PrintMask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x40,-0x14(%rbp)
jge    11b3 <PrintMask+0x93>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <sigismember@plt>
cmp    $0x0,%rax
je     11a0 <PrintMask+0x80>
cmpl   $0x0,-0x18(%rbp)
jne    1188 <PrintMask+0x68>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a5 <PrintMask+0x85>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1150 <PrintMask+0x30>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintMask>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%rsi
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebx
lea    0xe9d(%rip),%r14
mov    $0x1,%ebp
jmp    1186 <PrintMask+0x46>
xchg   %ax,%ax
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
cmp    $0x40,%ebp
je     11a5 <PrintMask+0x65>
mov    %r15,%rdi
mov    %ebp,%esi
call   1060 <sigismember@plt>
test   %rax,%rax
je     117e <PrintMask+0x3e>
test   %ebx,%ebx
jne    1170 <PrintMask+0x30>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1170 <PrintMask+0x30>
lea    0xe5b(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

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

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