#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__ EPERM;
int /*<<< orphan*/ SIGABRT;
int /*<<< orphan*/ SIGTERM;
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int kill(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(void) {
  if (kill(1, SIGTERM) != -1 || errno != EPERM) {
    printf("fail\n");
    exit(1);
  }
  errno = 0;
  if (kill(1, SIGABRT) != -1 || errno != EPERM) {
    printf("fail\n");
    exit(1);
  }
  errno = 0;
  printf("pass\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
call   1040 <kill@plt>
cmp    $0xffffffff,%eax
jne    1175 <main+0x45>
mov    0x2e76(%rip),%rax
mov    (%rax),%rax
mov    0x2e54(%rip),%rcx
cmp    (%rcx),%rax
je     118b <main+0x5b>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    0x2e46(%rip),%rax
movq   $0x0,(%rax)
mov    0x2e30(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
call   1040 <kill@plt>
cmp    $0xffffffff,%eax
jne    11cf <main+0x9f>
mov    0x2e1c(%rip),%rax
mov    (%rax),%rax
mov    0x2dfa(%rip),%rcx
cmp    (%rcx),%rax
je     11e5 <main+0xb5>
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    0x2dec(%rip),%rax
movq   $0x0,(%rax)
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
call   1040 <kill@plt>
cmp    $0xffffffff,%eax
jne    11a3 <main+0x73>
mov    0x2e85(%rip),%rbx
mov    (%rbx),%rax
mov    0x2e63(%rip),%r14
cmp    (%r14),%rax
jne    11a3 <main+0x73>
movq   $0x0,(%rbx)
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
call   1040 <kill@plt>
cmp    $0xffffffff,%eax
jne    11a3 <main+0x73>
mov    (%rbx),%rax
cmp    (%r14),%rax
jne    11a3 <main+0x73>
movq   $0x0,(%rbx)
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>
lea    0xe5b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SIGTERM = global i32 0
@errno = global i64 0
@EPERM = global i64 0
@.str = [6 x i8] c"fail\0A\00"
@SIGABRT = global i32 0
@.str.1 = [6 x i8] c"pass\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @SIGTERM
%3 = call i32 @kill(i32 1, i32 %2)
%4 = icmp ne i32 %3, -1
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = load i64, i64* @errno
%7 = load i64, i64* @EPERM
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5, %0
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %5
store i64 0, i64* @errno
%13 = load i32, i32* @SIGABRT
%14 = call i32 @kill(i32 1, i32 %13)
%15 = icmp ne i32 %14, -1
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i64, i64* @errno
%18 = load i64, i64* @EPERM
%19 = icmp ne i64 %17, %18
br i1 %19, label %20, label %23
20: ; preds = %16, %12
%21 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %16
store i64 0, i64* @errno
%24 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@SIGTERM = global i32 0
@errno = global i64 0
@EPERM = global i64 0
@SIGABRT = global i32 0
@str = [5 x i8] c"pass\00"
@str.3 = [5 x i8] c"fail\00"
define i32 @main() {
%1 = load i32, i32* @SIGTERM
%2 = tail call i32 @kill(i32 1, i32 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = load i64, i64* @errno
%6 = load i64, i64* @EPERM
%7 = icmp eq i64 %5, %6
br i1 %7, label %11, label %8
8: ; preds = %4, %0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.3, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %4
store i64 0, i64* @errno
%12 = load i32, i32* @SIGABRT
%13 = tail call i32 @kill(i32 1, i32 %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i64, i64* @errno
%17 = load i64, i64* @EPERM
%18 = icmp eq i64 %16, %17
br i1 %18, label %22, label %19
19: ; preds = %15, %11
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.3, i64 0, i64 0))
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %15
store i64 0, i64* @errno
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%24 = tail call i32 @exit(i32 0)
unreachable
}