#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 */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
scalar_t__ check(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(void) {
  exit(check("stdin", stdin, STDIN_FILENO) ||
       check("stdout", stdout, STDOUT_FILENO) ||
       check("stderr", stderr, STDERR_FILENO));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
mov    0x2e79(%rip),%rax
mov    (%rax),%edx
lea    0xeb8(%rip),%rdi
call   1030 <check@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    11b7 <main+0x97>
mov    0x2e5a(%rip),%rax
mov    (%rax),%esi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
lea    0xe8e(%rip),%rdi
call   1030 <check@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    11b7 <main+0x97>
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
mov    0x2e29(%rip),%rax
mov    (%rax),%edx
lea    0xe65(%rip),%rdi
call   1030 <check@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
mov    0x2e87(%rip),%rax
mov    (%rax),%edx
lea    0xec6(%rip),%rdi
call   1030 <check@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    1192 <main+0x72>
mov    0x2e70(%rip),%rax
mov    (%rax),%esi
mov    0x2e97(%rip),%rax
mov    (%rax),%edx
lea    0xea4(%rip),%rdi
call   1030 <check@plt>
test   %rax,%rax
jne    1192 <main+0x72>
mov    0x2e5d(%rip),%rax
mov    (%rax),%esi
mov    0x2e4c(%rip),%rax
mov    (%rax),%edx
lea    0xe88(%rip),%rdi
call   1030 <check@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"stdin\00"
@stdin = global i32 0
@STDIN_FILENO = global i32 0
@.str.1 = [7 x i8] c"stdout\00"
@stdout = global i32 0
@STDOUT_FILENO = global i32 0
@.str.2 = [7 x i8] c"stderr\00"
@stderr = global i32 0
@STDERR_FILENO = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stdin
%3 = load i32, i32* @STDIN_FILENO
%4 = call i64 @check(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %0
%7 = load i32, i32* @stdout
%8 = load i32, i32* @STDOUT_FILENO
%9 = call i64 @check(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %6
%12 = load i32, i32* @stderr
%13 = load i32, i32* @STDERR_FILENO
%14 = call i64 @check(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %13)
%15 = icmp ne i64 %14, 0
br label %16
16: ; preds = %11, %6, %0
%17 = phi i1 [ true, %6 ], [ true, %0 ], [ %15, %11 ]
%18 = zext i1 %17 to i32
%19 = call i32 @exit(i32 %18)
unreachable
}

LLVM IR (-O2):
@.str = [6 x i8] c"stdin\00"
@stdin = global i32 0
@STDIN_FILENO = global i32 0
@.str.1 = [7 x i8] c"stdout\00"
@stdout = global i32 0
@STDOUT_FILENO = global i32 0
@.str.2 = [7 x i8] c"stderr\00"
@stderr = global i32 0
@STDERR_FILENO = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdin
%2 = load i32, i32* @STDIN_FILENO
%3 = tail call i64 @check(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %16
5: ; preds = %0
%6 = load i32, i32* @stdout
%7 = load i32, i32* @STDOUT_FILENO
%8 = tail call i64 @check(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %5
%11 = load i32, i32* @stderr
%12 = load i32, i32* @STDERR_FILENO
%13 = tail call i64 @check(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %12)
%14 = icmp ne i64 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %10, %5, %0
%17 = phi i32 [ 1, %5 ], [ 1, %0 ], [ %15, %10 ]
%18 = tail call i32 @exit(i32 %17)
unreachable
}