#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*/ feof(int /*<<< orphan*/);
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
void main() {
  int i = 0;
  while (!feof(stdin) && i < 0x4000) {
    fputc(fgetc(stdin), stdout);
    i++;
  }
  while (i < 0x4000) {
    fputc(0xFF, stdout);
    i++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1050 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
jne    116a <main+0x3a>
cmpl   $0x4000,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    117a <main+0x4a>
jmp    11a6 <main+0x76>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,%edi
mov    0x2e47(%rip),%rax
mov    (%rax),%esi
call   1040 <fputc@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <main+0xf>
jmp    11ab <main+0x7b>
cmpl   $0x4000,-0x4(%rbp)
jge    11d9 <main+0xa9>
mov    0x2e19(%rip),%rax
mov    (%rax),%esi
mov    $0xff,%edi
call   1040 <fputc@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11ab <main+0x7b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x2eac(%rip),%r14
mov    (%r14),%edi
call   1050 <feof@plt>
xor    %ebx,%ebx
test   %eax,%eax
jne    1194 <main+0x64>
mov    $0xffffffff,%ebx
mov    0x2e82(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    (%r15),%esi
mov    %eax,%edi
call   1040 <fputc@plt>
mov    (%r14),%edi
call   1050 <feof@plt>
test   %eax,%eax
jne    1189 <main+0x59>
cmp    $0x3fff,%ebx
jb     1160 <main+0x30>
cmp    $0x3ffe,%ebx
ja     11c1 <main+0x91>
add    $0x1,%ebx
add    $0xffffc000,%ebx
mov    0x2e37(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14),%esi
mov    $0xff,%edi
call   1040 <fputc@plt>
inc    %ebx
jne    11b0 <main+0x80>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@stdout = global i32 0
define void @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %11, %0
%3 = load i32, i32* @stdin
%4 = call i32 @feof(i32 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 16384
br label %9
9: ; preds = %6, %2
%10 = phi i1 [ false, %2 ], [ %8, %6 ]
br i1 %10, label %11, label %18
11: ; preds = %9
%12 = load i32, i32* @stdin
%13 = call i32 @fgetc(i32 %12)
%14 = load i32, i32* @stdout
%15 = call i32 @fputc(i32 %13, i32 %14)
%16 = load i32, i32* %1
%17 = add nsw i32 %16, 1
store i32 %17, i32* %1
br label %2
18: ; preds = %9
br label %19
19: ; preds = %22, %18
%20 = load i32, i32* %1
%21 = icmp slt i32 %20, 16384
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i32, i32* @stdout
%24 = call i32 @fputc(i32 255, i32 %23)
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
br label %19
27: ; preds = %19
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@stdout = global i32 0
define void @main() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @feof(i32 %1)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %6
4: ; preds = %8
%5 = icmp ult i32 %9, 16383
br i1 %5, label %6, label %26
6: ; preds = %0, %4
%7 = phi i32 [ 0, %0 ], [ %14, %4 ]
br label %20
8: ; preds = %0, %8
%9 = phi i32 [ %14, %8 ], [ 0, %0 ]
%10 = load i32, i32* @stdin
%11 = tail call i32 @fgetc(i32 %10)
%12 = load i32, i32* @stdout
%13 = tail call i32 @fputc(i32 %11, i32 %12)
%14 = add nuw nsw i32 %9, 1
%15 = load i32, i32* @stdin
%16 = tail call i32 @feof(i32 %15)
%17 = icmp eq i32 %16, 0
%18 = icmp ult i32 %9, 16383
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %8, label %4
20: ; preds = %6, %20
%21 = phi i32 [ %24, %20 ], [ %7, %6 ]
%22 = load i32, i32* @stdout
%23 = tail call i32 @fputc(i32 255, i32 %22)
%24 = add nuw nsw i32 %21, 1
%25 = icmp eq i32 %24, 16384
br i1 %25, label %26, label %20
26: ; preds = %20, %4
ret void
}