#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*/ __thinthin_syscall(int, int, char *, int);
int fprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(void) {
  __thinthin_syscall(1, 1, "hi0\n", 4);
  __thinthin_syscall(1, 1, "hi1\n", 4);
  for (;;) {
    int count = fprintf(stderr, "hey there: %p %p\n", stdout, stderr);
    break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%esi
lea    0xecc(%rip),%rdx
mov    $0x4,%ecx
mov    %esi,%edi
call   1030 <__thinthin_syscall@plt>
mov    $0x1,%esi
lea    0xeb9(%rip),%rdx
mov    $0x4,%ecx
mov    %esi,%edi
call   1030 <__thinthin_syscall@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
mov    0x2e70(%rip),%rax
mov    (%rax),%edx
mov    0x2e6f(%rip),%rax
mov    (%rax),%ecx
lea    0xe90(%rip),%rsi
call   1040 <fprintf@plt>
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdx
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x4,%ecx
call   1030 <__thinthin_syscall@plt>
lea    0xec2(%rip),%rdx
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x4,%ecx
call   1030 <__thinthin_syscall@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%ecx
mov    0x2e71(%rip),%rax
mov    (%rax),%edx
lea    0xe9a(%rip),%rsi
mov    %ecx,%edi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"hi0\0A\00"
@.str.1 = [5 x i8] c"hi1\0A\00"
@stderr = global i32 0
@.str.2 = [18 x i8] c"hey there: %p %p\0A\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = call i32 @__thinthin_syscall(i32 1, i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = call i32 @__thinthin_syscall(i32 1, i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
br label %4
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = load i32, i32* @stdout
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %7)
store i32 %8, i32* %1
br label %9
9: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"hi0\0A\00"
@.str.1 = [5 x i8] c"hi1\0A\00"
@stderr = global i32 0
@.str.2 = [18 x i8] c"hey there: %p %p\0A\00"
@stdout = global i32 0
define i32 @main() {
%1 = tail call i32 @__thinthin_syscall(i32 1, i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%2 = tail call i32 @__thinthin_syscall(i32 1, i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%3 = load i32, i32* @stderr
%4 = load i32, i32* @stdout
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 %3)
ret i32 0
}