#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 *);
scalar_t__ sigismember(int /*<<< orphan*/ const *, int);
void print_sigset(const sigset_t *sigset) {
  int i = 1;
  for (; i < NSIG; i++) {
    if (sigismember(sigset, i)) {
      printf("1");
    } else {
      printf("0");
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_sigset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%eax
jge    118b <print_sigset+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <sigismember@plt>
cmp    $0x0,%rax
je     116c <print_sigset+0x4c>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    1178 <print_sigset+0x58>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
jmp    117d <print_sigset+0x5d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <print_sigset+0x13>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_sigset>:
push   %rbp
push   %r14
push   %rbx
mov    0x2eb5(%rip),%r14
cmpl   $0x2,(%r14)
jl     1163 <print_sigset+0x43>
mov    %rdi,%rbx
mov    $0x1,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <sigismember@plt>
cmp    $0x1,%rax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    (%r14),%ebp
jl     1140 <print_sigset+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@NSIG = global i32 0
define void @print_sigset(i32* %0) {
%2 = load i32, i32* @NSIG
%3 = icmp sgt i32 %2, 1
br i1 %3, label %4, label %13
4: ; preds = %1, %4
%5 = phi i32 [ %10, %4 ], [ 1, %1 ]
%6 = tail call i64 @sigismember(i32* %0, i32 %5)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i32 48, i32 49
%9 = tail call i32 @putchar(i32 %8)
%10 = add nuw nsw i32 %5, 1
%11 = load i32, i32* @NSIG
%12 = icmp slt i32 %10, %11
br i1 %12, label %4, label %13
13: ; preds = %4, %1
%14 = tail call i32 @putchar(i32 10)
ret void
}