#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);
scalar_t__ sigismember(int /*<<< orphan*/ *, int);
void print_sigset(sigset_t *set) {
  int i;
  for (i = 1; i < NSIG; ++i) {
    if (sigismember(set, i))
      printf("signal id = %d, in\n", i);
    else
      printf("signal id = %d, out\n", i);
  }
}


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    1191 <print_sigset+0x71>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <sigismember@plt>
cmp    $0x0,%rax
je     116f <print_sigset+0x4f>
mov    -0xc(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    117e <print_sigset+0x5e>
mov    -0xc(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    1183 <print_sigset+0x63>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <print_sigset+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_sigset>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2eb1(%rip),%r14
cmpl   $0x2,(%r14)
jl     1173 <print_sigset+0x53>
mov    %rdi,%rbx
mov    $0x1,%ebp
lea    0xed0(%rip),%r15
lea    0xeb5(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <sigismember@plt>
test   %rax,%rax
mov    %r12,%rdi
cmove  %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    (%r14),%ebp
jl     1150 <print_sigset+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@NSIG = global i32 0
@.str = [20 x i8] c"signal id = %d, in\0A\00"
@.str.1 = [21 x i8] c"signal id = %d, out\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 = %20, %1
%5 = load i32, i32* %3
%6 = load i32, i32* @NSIG
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %23
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 %16
13: ; preds = %8
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %19
16: ; preds = %8
%17 = load i32, i32* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %16, %13
br label %20
20: ; preds = %19
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %4
23: ; preds = %4
ret void
}

LLVM IR (-O2):
@NSIG = global i32 0
@.str = [20 x i8] c"signal id = %d, in\0A\00"
@.str.1 = [21 x i8] c"signal id = %d, out\0A\00"
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, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
%9 = tail call i32 @printf(i8* %8, i32 %5)
%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
ret void
}