#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*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int sigemptyset(int /*<<< orphan*/ *);
scalar_t__ sigismember(int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(void) {
  sigset_t signalset;
  if (sigemptyset(&signalset) == -1) {
    perror("sigemptyset failed -- test aborted");
    return 2;
  }
  if (sigismember(&signalset, SIGABRT) != 0) {
    printf("sigismember dit not return 0\n");
    return 1;
  }
  printf("Test PASSED\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <sigemptyset@plt>
cmp    $0xffffffff,%eax
jne    1179 <main+0x39>
lea    0xe98(%rip),%rdi
call   1050 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    11c0 <main+0x80>
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1060 <sigismember@plt>
cmp    $0x0,%rax
je     11ad <main+0x6d>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <main+0x80>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1040 <sigemptyset@plt>
cmp    $0xffffffff,%eax
je     118b <main+0x4b>
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdi
call   1060 <sigismember@plt>
test   %rax,%rax
je     117b <main+0x3b>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe6e(%rip),%rdi
call   1050 <perror@plt>
mov    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"sigemptyset failed -- test aborted\00"
@SIGABRT = global i32 0
@.str.1 = [30 x i8] c"sigismember dit not return 0\0A\00"
@.str.2 = [13 x i8] c"Test PASSED\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @sigemptyset(i32* %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %1
br label %15
7: ; preds = %0
%8 = load i32, i32* @SIGABRT
%9 = call i64 @sigismember(i32* %2, i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %15
13: ; preds = %7
%14 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %15
15: ; preds = %13, %11, %5
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str = [35 x i8] c"sigemptyset failed -- test aborted\00"
@SIGABRT = global i32 0
@str = [12 x i8] c"Test PASSED\00"
@str.3 = [29 x i8] c"sigismember dit not return 0\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigemptyset(i32* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %15
7: ; preds = %0
%8 = load i32, i32* @SIGABRT
%9 = call i64 @sigismember(i32* %1, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
br label %15
13: ; preds = %7
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %11, %5
%16 = phi i32 [ 2, %5 ], [ 1, %11 ], [ 0, %13 ]
ret i32 %16
}