#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*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(void) {
  return (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    0x2eba(%rip),%rax
mov    (%rax),%esi
mov    0x2e89(%rip),%rax
mov    (%rax),%edx
lea    0xec8(%rip),%rdi
call   1030 <check@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    11a7 <main+0x97>
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
lea    0xe9e(%rip),%rdi
call   1030 <check@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    11a7 <main+0x97>
mov    0x2e4a(%rip),%rax
mov    (%rax),%esi
mov    0x2e39(%rip),%rax
mov    (%rax),%edx
lea    0xe75(%rip),%rdi
call   1030 <check@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    0x2e97(%rip),%rax
mov    (%rax),%edx
lea    0xed6(%rip),%rdi
call   1030 <check@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    1182 <main+0x72>
mov    0x2e80(%rip),%rax
mov    (%rax),%esi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
lea    0xeb4(%rip),%rdi
call   1030 <check@plt>
test   %rax,%rax
jne    1182 <main+0x72>
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
mov    0x2e5c(%rip),%rax
mov    (%rax),%edx
lea    0xe98(%rip),%rdi
call   1030 <check@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

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
ret i32 %18
}

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 ]
ret i32 %17
}