#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 */
void *fdopen(int, char *);
void *stderr;
void *stdin;
void *stdout;
void dalibc_linux_initialize() {
  stdin = fdopen(0, "r");
  stdout = fdopen(1, "r");
  stderr = fdopen(2, "r");
  if (!stdin || !stdout || !stderr)
    ;
}


x86 assembly (clang, -O0):
<dalibc_linux_initialize>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
call   1030 <fdopen@plt>
mov    %rax,%rcx
mov    0x2ebc(%rip),%rax
mov    %rcx,(%rax)
mov    $0x1,%edi
lea    0xec5(%rip),%rsi
call   1030 <fdopen@plt>
mov    %rax,%rcx
mov    0x2e86(%rip),%rax
mov    %rcx,(%rax)
mov    $0x2,%edi
lea    0xea7(%rip),%rsi
call   1030 <fdopen@plt>
mov    %rax,%rcx
mov    0x2e70(%rip),%rax
mov    %rcx,(%rax)
mov    0x2e76(%rip),%rax
cmpq   $0x0,(%rax)
je     119e <dalibc_linux_initialize+0x8e>
mov    0x2e4d(%rip),%rax
cmpq   $0x0,(%rax)
je     119e <dalibc_linux_initialize+0x8e>
mov    0x2e44(%rip),%rax
cmpq   $0x0,(%rax)
jne    11a3 <dalibc_linux_initialize+0x93>
jmp    11a3 <dalibc_linux_initialize+0x93>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dalibc_linux_initialize>:
push   %rbx
lea    0xee8(%rip),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <fdopen@plt>
mov    0x2ebf(%rip),%rcx
mov    %rax,(%rcx)
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <fdopen@plt>
mov    0x2e90(%rip),%rcx
mov    %rax,(%rcx)
mov    $0x2,%edi
mov    %rbx,%rsi
call   1030 <fdopen@plt>
mov    0x2e81(%rip),%rcx
mov    %rax,(%rcx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stdin = global i8* null
@stdout = global i8* null
@stderr = global i8* null
define void @dalibc_linux_initialize() {
%1 = call i8* @fdopen(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %1, i8** @stdin
%2 = call i8* @fdopen(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** @stdout
%3 = call i8* @fdopen(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** @stderr
%4 = load i8*, i8** @stdin
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %12
6: ; preds = %0
%7 = load i8*, i8** @stdout
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i8*, i8** @stderr
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %9, %6, %0
br label %13
13: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stdin = global i8* null
@stdout = global i8* null
@stderr = global i8* null
define void @dalibc_linux_initialize() {
%1 = tail call i8* @fdopen(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %1, i8** @stdin
%2 = tail call i8* @fdopen(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** @stdout
%3 = tail call i8* @fdopen(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** @stderr
ret void
}