#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 */

/* Variables and functions */
scalar_t__ EINVAL;
int /*<<< orphan*/ SIGKILL;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ SIG_IGN;
scalar_t__ errno;
int /*<<< orphan*/ printf(char *);
scalar_t__ sigset(int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  if (sigset(SIGKILL, SIG_IGN) == SIG_ERR) {
    if (errno != EINVAL) {
      printf("Test FAILED: sigset() returned SIG_ERR but didn't set errno to "
             "EINVAL\n");
      return 1;
    }
  } else {
    printf("Test FAILED: sigset() didn't return SIG_ERROR even though SIGKILL "
           "was passed to it\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
call   1040 <sigset@plt>
mov    0x2e8b(%rip),%rcx
cmp    (%rcx),%rax
jne    118d <main+0x6d>
mov    0x2e73(%rip),%rax
mov    (%rax),%rax
mov    0x2e61(%rip),%rcx
cmp    (%rcx),%rax
je     1188 <main+0x68>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ac <main+0x8c>
jmp    11a5 <main+0x85>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ac <main+0x8c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
call   1040 <sigset@plt>
mov    0x2e99(%rip),%rcx
cmp    (%rcx),%rax
jne    1165 <main+0x45>
mov    0x2e85(%rip),%rax
mov    (%rax),%rcx
mov    0x2e73(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
je     1176 <main+0x56>
lea    0xef0(%rip),%rdi
jmp    116c <main+0x4c>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGKILL = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@errno = global i64 0
@EINVAL = global i64 0
@.str = [71 x i8] c"Test FAILED: sigset() returned SIG_ERR but didn't set errno to EINVAL\0A\00"
@.str.1 = [84 x i8] c"Test FAILED: sigset() didn't return SIG_ERROR even though SIGKILL was passed to it\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @SIGKILL
%3 = load i32, i32* @SIG_IGN
%4 = call i64 @sigset(i32 %2, i32 %3)
%5 = load i64, i64* @SIG_ERR
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %14
7: ; preds = %0
%8 = load i64, i64* @errno
%9 = load i64, i64* @EINVAL
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %17
13: ; preds = %7
br label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %17
16: ; preds = %13
store i32 0, i32* %1
br label %17
17: ; preds = %16, %14, %11
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@SIGKILL = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@errno = global i64 0
@EINVAL = global i64 0
@str = [83 x i8] c"Test FAILED: sigset() didn't return SIG_ERROR even though SIGKILL was passed to it\00"
@str.2 = [70 x i8] c"Test FAILED: sigset() returned SIG_ERR but didn't set errno to EINVAL\00"
define i32 @main() {
%1 = load i32, i32* @SIGKILL
%2 = load i32, i32* @SIG_IGN
%3 = tail call i64 @sigset(i32 %1, i32 %2)
%4 = load i64, i64* @SIG_ERR
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = load i64, i64* @errno
%8 = load i64, i64* @EINVAL
%9 = icmp eq i64 %7, %8
br i1 %9, label %13, label %10
10: ; preds = %0, %6
%11 = phi i8* [ getelementptr inbounds ([70 x i8], [70 x i8]* @str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([83 x i8], [83 x i8]* @str, i64 0, i64 0), %0 ]
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
br label %13
13: ; preds = %10, %6
%14 = phi i32 [ 0, %6 ], [ 1, %10 ]
ret i32 %14
}