#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *greeting();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main() {
  fprintf(stdout, "stdout: %s\n", greeting());
  fflush(stdout);
  fprintf(stderr, "stderr: %s\n", greeting());
  fflush(stderr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <greeting@plt>
mov    -0xc(%rbp),%edi
mov    %rax,%rdx
lea    0xea1(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <greeting@plt>
mov    -0x8(%rbp),%edi
mov    %rax,%rdx
lea    0xe7a(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2e9d(%rip),%r14
mov    (%r14),%ebx
xor    %eax,%eax
call   1030 <greeting@plt>
lea    0xeb4(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    (%r14),%edi
call   1050 <fflush@plt>
mov    0x2e7b(%rip),%r14
mov    (%r14),%ebx
xor    %eax,%eax
call   1030 <greeting@plt>
lea    0xe96(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    (%r14),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [12 x i8] c"stdout: %s\0A\00"
@stderr = global i32 0
@.str.1 = [12 x i8] c"stderr: %s\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stdout
%3 = call i8* (...) @greeting()
%4 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
%7 = load i32, i32* @stderr
%8 = call i8* (...) @greeting()
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @stderr
%11 = call i32 @fflush(i32 %10)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [12 x i8] c"stdout: %s\0A\00"
@stderr = global i32 0
@.str.1 = [12 x i8] c"stderr: %s\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i8* (...) @greeting()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
%6 = load i32, i32* @stderr
%7 = tail call i8* (...) @greeting()
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @stderr
%10 = tail call i32 @fflush(i32 %9)
ret i32 0
}