#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__ errno;
int /*<<< orphan*/ printf(char *);
int sigignore(int /*<<< orphan*/);
int main(void) {
  if (sigignore(SIGKILL) == -1) {
    if (errno == EINVAL) {
      printf("Test PASSED: errno set to EINVAL\n");
      return 0;
    } else {
      printf("errno was not set to EINVAL\n");
      return 1;
    }
  }
  printf("sigignore did not return -1\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1030 <sigignore@plt>
cmp    $0xffffffff,%eax
jne    1190 <main+0x70>
mov    0x2e93(%rip),%rax
mov    (%rax),%rax
mov    0x2e81(%rip),%rcx
cmp    (%rcx),%rax
jne    1178 <main+0x58>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <main+0x83>
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a3 <main+0x83>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1030 <sigignore@plt>
cmp    $0xffffffff,%eax
je     1142 <main+0x22>
mov    $0x1,%ebx
lea    0xec0(%rip),%rdi
jmp    116d <main+0x4d>
mov    0x2e97(%rip),%rax
mov    (%rax),%rax
mov    0x2e85(%rip),%rcx
xor    %ebx,%ebx
cmp    (%rcx),%rax
setne  %bl
lea    0xed6(%rip),%rax
lea    0xeb3(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@SIGKILL = global i32 0
@errno = global i64 0
@EINVAL = global i64 0
@.str = [34 x i8] c"Test PASSED: errno set to EINVAL\0A\00"
@.str.1 = [29 x i8] c"errno was not set to EINVAL\0A\00"
@.str.2 = [29 x i8] c"sigignore did not return -1\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @SIGKILL
%3 = call i32 @sigignore(i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %13
5: ; preds = %0
%6 = load i64, i64* @errno
%7 = load i64, i64* @EINVAL
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %15
11: ; preds = %5
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %15
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %15
15: ; preds = %13, %11, %9
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@SIGKILL = global i32 0
@errno = global i64 0
@EINVAL = global i64 0
@str = [28 x i8] c"sigignore did not return -1\00"
@str.3 = [28 x i8] c"errno was not set to EINVAL\00"
@str.4 = [33 x i8] c"Test PASSED: errno set to EINVAL\00"
define i32 @main() {
%1 = load i32, i32* @SIGKILL
%2 = tail call i32 @sigignore(i32 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %11
4: ; preds = %0
%5 = load i64, i64* @errno
%6 = load i64, i64* @EINVAL
%7 = icmp eq i64 %5, %6
%8 = select i1 %7, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.3, i64 0, i64 0)
%9 = xor i1 %7, true
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %0, %4
%12 = phi i8* [ %8, %4 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0), %0 ]
%13 = phi i32 [ %10, %4 ], [ 1, %0 ]
%14 = tail call i32 @puts(i8* dereferenceable(1) %12)
ret i32 %13
}