#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
size_t fread(char *, int, int, int /*<<< orphan*/);
size_t fwrite(char *, int, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  char buf[8192];
  size_t n;
  for (;;) {
    n = fread(buf, 1, 8192, stdin);
    if (n <= 0)
      break;
    n = fwrite(buf, 1, n, stdout);
    if (n < 0) {
      fprintf(stderr, "### Fatal error: NEMOPASS: Could not write\n");
      exit(1);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x2010(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
mov    $0x2000,%edx
call   1030 <fread@plt>
mov    %rax,-0x2018(%rbp)
cmpq   $0x0,-0x2018(%rbp)
ja     1192 <main+0x52>
jmp    11ec <main+0xac>
lea    -0x2010(%rbp),%rdi
mov    -0x2018(%rbp),%rdx
mov    0x2e29(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1060 <fwrite@plt>
mov    %rax,-0x2018(%rbp)
cmpq   $0x0,-0x2018(%rbp)
jae    11e7 <main+0xa7>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
lea    0xe28(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    1159 <main+0x19>
xor    %eax,%eax
add    $0x2020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x2000,%rsp
mov    0x2eb5(%rip),%r14
mov    (%r14),%ecx
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x2000,%edx
call   1030 <fread@plt>
test   %rax,%rax
je     118d <main+0x6d>
mov    0x2e84(%rip),%r15
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    (%r15),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
call   1040 <fwrite@plt>
mov    (%r14),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2000,%edx
call   1030 <fread@plt>
test   %rax,%rax
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x2000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@stdout = global i32 0
@stderr = global i32 0
@.str = [44 x i8] c"### Fatal error: NEMOPASS: Could not write\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8192 x i8]
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %26, %2
%9 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i64 @fread(i8* %9, i32 1, i32 8192, i32 %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = icmp ule i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %8
br label %27
15: ; preds = %8
%16 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%17 = load i64, i64* %7
%18 = load i32, i32* @stdout
%19 = call i64 @fwrite(i8* %16, i32 1, i64 %17, i32 %18)
store i64 %19, i64* %7
%20 = load i64, i64* %7
%21 = icmp ult i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %15
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %15
br label %8
27: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@stdout = global i32 0
@stderr = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8192 x i8]
%4 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i64 @fread(i8* %4, i32 1, i32 8192, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %2, %8
%9 = phi i64 [ %13, %8 ], [ %6, %2 ]
%10 = load i32, i32* @stdout
%11 = call i64 @fwrite(i8* %4, i32 1, i64 %9, i32 %10)
%12 = load i32, i32* @stdin
%13 = call i64 @fread(i8* %4, i32 1, i32 8192, i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %8
15: ; preds = %8, %2
ret i32 0
}