#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;
int /*<<< orphan*/ SetUpStdFileDescriptor(char *, int /*<<< orphan*/);
__attribute__((constructor)) void SetUpStdFileDescriptors() {
  SetUpStdFileDescriptor("GSTDIN", STDIN_FILENO);
  SetUpStdFileDescriptor("GSTDOUT", STDOUT_FILENO);
  SetUpStdFileDescriptor("GSTDERR", STDERR_FILENO);
}


x86 assembly (clang, -O0):
<SetUpStdFileDescriptors>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <SetUpStdFileDescriptor@plt>
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xece(%rip),%rdi
call   1030 <SetUpStdFileDescriptor@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1030 <SetUpStdFileDescriptor@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetUpStdFileDescriptors>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <SetUpStdFileDescriptor@plt>
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
lea    0xed1(%rip),%rdi
call   1030 <SetUpStdFileDescriptor@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%esi
lea    0xec4(%rip),%rdi
pop    %rax
jmp    1030 <SetUpStdFileDescriptor@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"GSTDIN\00"
@STDIN_FILENO = global i32 0
@.str.1 = [8 x i8] c"GSTDOUT\00"
@STDOUT_FILENO = global i32 0
@.str.2 = [8 x i8] c"GSTDERR\00"
@STDERR_FILENO = global i32 0
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @SetUpStdFileDescriptors, i8* null }]
define void @SetUpStdFileDescriptors() {
%1 = load i32, i32* @STDIN_FILENO
%2 = call i32 @SetUpStdFileDescriptor(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @STDOUT_FILENO
%4 = call i32 @SetUpStdFileDescriptor(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @STDERR_FILENO
%6 = call i32 @SetUpStdFileDescriptor(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"GSTDIN\00"
@STDIN_FILENO = global i32 0
@.str.1 = [8 x i8] c"GSTDOUT\00"
@STDOUT_FILENO = global i32 0
@.str.2 = [8 x i8] c"GSTDERR\00"
@STDERR_FILENO = global i32 0
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @SetUpStdFileDescriptors, i8* null }]
define void @SetUpStdFileDescriptors() {
%1 = load i32, i32* @STDIN_FILENO
%2 = tail call i32 @SetUpStdFileDescriptor(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @STDOUT_FILENO
%4 = tail call i32 @SetUpStdFileDescriptor(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @STDERR_FILENO
%6 = tail call i32 @SetUpStdFileDescriptor(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret void
}