#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__ EACCES;
int R_OK;
int W_OK;
int X_OK;
int access(char *, int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (access(argv[0], R_OK | W_OK | X_OK) == 0 &&
      access("/dev/null", R_OK | W_OK) == 0 &&
      access("/dev/null", X_OK) == -1 && errno == EACCES)
    printf("pass\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2e6c(%rip),%rax
mov    (%rax),%esi
mov    0x2e8b(%rip),%rax
or     (%rax),%esi
mov    0x2e7a(%rip),%rax
or     (%rax),%esi
call   1040 <access@plt>
cmp    $0x0,%eax
jne    11e1 <main+0xb1>
mov    0x2e43(%rip),%rax
mov    (%rax),%esi
mov    0x2e62(%rip),%rax
or     (%rax),%esi
lea    0xe71(%rip),%rdi
call   1040 <access@plt>
cmp    $0x0,%eax
jne    11e1 <main+0xb1>
mov    0x2e3c(%rip),%rax
mov    (%rax),%esi
lea    0xe53(%rip),%rdi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
jne    11e1 <main+0xb1>
mov    0x2e06(%rip),%rax
mov    (%rax),%rax
mov    0x2e0c(%rip),%rcx
cmp    (%rcx),%rax
jne    11e1 <main+0xb1>
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x2e84(%rip),%r15
mov    0x2ea5(%rip),%rbx
mov    (%rbx),%eax
or     (%r15),%eax
mov    (%rsi),%rdi
mov    0x2e8e(%rip),%r14
or     (%r14),%eax
mov    %eax,%esi
call   1040 <access@plt>
test   %eax,%eax
jne    11ab <main+0x7b>
mov    (%rbx),%esi
or     (%r15),%esi
lea    0xe94(%rip),%rdi
call   1040 <access@plt>
test   %eax,%eax
jne    11ab <main+0x7b>
mov    (%r14),%esi
lea    0xe81(%rip),%rdi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
jne    11ab <main+0x7b>
mov    0x2e38(%rip),%rax
mov    (%rax),%rax
mov    0x2e3e(%rip),%rcx
cmp    (%rcx),%rax
jne    11ab <main+0x7b>
lea    0xe64(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@R_OK = global i32 0
@W_OK = global i32 0
@X_OK = global i32 0
@.str = [10 x i8] c"/dev/null\00"
@errno = global i64 0
@EACCES = global i64 0
@.str.1 = [6 x i8] c"pass\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = load i32, i32* @R_OK
%10 = load i32, i32* @W_OK
%11 = or i32 %9, %10
%12 = load i32, i32* @X_OK
%13 = or i32 %11, %12
%14 = call i32 @access(i8* %8, i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %32
16: ; preds = %2
%17 = load i32, i32* @R_OK
%18 = load i32, i32* @W_OK
%19 = or i32 %17, %18
%20 = call i32 @access(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %16
%23 = load i32, i32* @X_OK
%24 = call i32 @access(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %32
26: ; preds = %22
%27 = load i64, i64* @errno
%28 = load i64, i64* @EACCES
%29 = icmp eq i64 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %26, %22, %16, %2
%33 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@R_OK = global i32 0
@W_OK = global i32 0
@X_OK = global i32 0
@.str = [10 x i8] c"/dev/null\00"
@errno = global i64 0
@EACCES = global i64 0
@str = [5 x i8] c"pass\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = load i32, i32* @R_OK
%5 = load i32, i32* @W_OK
%6 = or i32 %5, %4
%7 = load i32, i32* @X_OK
%8 = or i32 %6, %7
%9 = tail call i32 @access(i8* %3, i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %2
%12 = load i32, i32* @R_OK
%13 = load i32, i32* @W_OK
%14 = or i32 %13, %12
%15 = tail call i32 @access(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %11
%18 = load i32, i32* @X_OK
%19 = tail call i32 @access(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %27
21: ; preds = %17
%22 = load i64, i64* @errno
%23 = load i64, i64* @EACCES
%24 = icmp eq i64 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %27
27: ; preds = %25, %21, %17, %11, %2
%28 = tail call i32 @exit(i32 0)
unreachable
}