#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *eembed_stderr();
int /*<<< orphan*/ *eembed_stdout();
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
FILE *eembed_stream(FILE *stream) {
  if (!stream || stream == stderr) {
    return eembed_stderr();
  }
  if (stream == stdout) {
    return eembed_stdout();
  }
  return stream;
}


x86 assembly (clang, -O0):
<eembed_stream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114b <eembed_stream+0x2b>
mov    -0x10(%rbp),%rax
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%rax
jne    115b <eembed_stream+0x3b>
mov    $0x0,%al
call   1040 <eembed_stderr@plt>
mov    %rax,-0x8(%rbp)
jmp    1187 <eembed_stream+0x67>
mov    -0x10(%rbp),%rax
mov    0x2e72(%rip),%rcx
cmp    (%rcx),%rax
jne    117f <eembed_stream+0x5f>
mov    $0x0,%al
call   1030 <eembed_stdout@plt>
mov    %rax,-0x8(%rbp)
jmp    1187 <eembed_stream+0x67>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eembed_stream>:
test   %rdi,%rdi
je     1141 <eembed_stream+0x21>
mov    0x2eb4(%rip),%rax
cmp    %rdi,(%rax)
je     1141 <eembed_stream+0x21>
mov    0x2ea0(%rip),%rax
cmp    %rdi,(%rax)
je     1148 <eembed_stream+0x28>
mov    %rdi,%rax
ret
xor    %eax,%eax
jmp    1040 <eembed_stderr@plt>
xor    %eax,%eax
jmp    1030 <eembed_stdout@plt>

LLVM IR (-O0):
@stderr = global i32* null
@stdout = global i32* null
define i32* @eembed_stream(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32*, i32** %3
%8 = load i32*, i32** @stderr
%9 = icmp eq i32* %7, %8
br i1 %9, label %10, label %12
10: ; preds = %6, %1
%11 = call i32* (...) @eembed_stderr()
store i32* %11, i32** %2
br label %20
12: ; preds = %6
%13 = load i32*, i32** %3
%14 = load i32*, i32** @stdout
%15 = icmp eq i32* %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32* (...) @eembed_stdout()
store i32* %17, i32** %2
br label %20
18: ; preds = %12
%19 = load i32*, i32** %3
store i32* %19, i32** %2
br label %20
20: ; preds = %18, %16, %10
%21 = load i32*, i32** %2
ret i32* %21
}

LLVM IR (-O2):
@stderr = global i32* null
@stdout = global i32* null
define i32* @eembed_stream(i32* readnone %0) {
%2 = icmp eq i32* %0, null
%3 = load i32*, i32** @stderr
%4 = icmp eq i32* %3, %0
%5 = select i1 %2, i1 true, i1 %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32* (...) @eembed_stderr()
br label %13
8: ; preds = %1
%9 = load i32*, i32** @stdout
%10 = icmp eq i32* %9, %0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32* (...) @eembed_stdout()
br label %13
13: ; preds = %8, %11, %6
%14 = phi i32* [ %7, %6 ], [ %12, %11 ], [ %0, %8 ]
ret i32* %14
}