#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 EOF;
int /*<<< orphan*/ exit(int);
scalar_t__ ferror(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
main() {
  int c;
  while (!((c = getchar()) == EOF)) {
    if (c == 10) {
      putchar(13);
      putchar(10);
    } else {
      putchar(c);
    }
  }
  if (ferror(stdin) || ferror(stdout)) {
    exit(1);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
xor    $0xff,%al
test   $0x1,%al
jne    1174 <main+0x34>
jmp    11a4 <main+0x64>
cmpl   $0xa,-0x8(%rbp)
jne    1197 <main+0x57>
mov    $0xd,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    119f <main+0x5f>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    114f <main+0xf>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
call   1040 <ferror@plt>
cmp    $0x0,%rax
jne    11d4 <main+0x94>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1040 <ferror@plt>
cmp    $0x0,%rax
je     11de <main+0x9e>
mov    $0x1,%edi
call   1060 <exit@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e91(%rip),%rbx
jmp    116e <main+0x2e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     1188 <main+0x48>
cmp    $0xa,%eax
jne    1160 <main+0x20>
mov    $0xd,%edi
call   1030 <putchar@plt>
mov    $0xa,%eax
jmp    1160 <main+0x20>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
call   1040 <ferror@plt>
test   %rax,%rax
jne    11b5 <main+0x75>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1040 <ferror@plt>
test   %rax,%rax
jne    11b5 <main+0x75>
xor    %edi,%edi
call   1060 <exit@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@EOF = global i32 0
@stdin = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %17, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
%7 = xor i1 %6, true
br i1 %7, label %8, label %18
8: ; preds = %3
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 10
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 @putchar(i32 13)
%13 = call i32 @putchar(i32 10)
br label %17
14: ; preds = %8
%15 = load i32, i32* %2
%16 = call i32 @putchar(i32 %15)
br label %17
17: ; preds = %14, %11
br label %3
18: ; preds = %3
%19 = load i32, i32* @stdin
%20 = call i64 @ferror(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i32, i32* @stdout
%24 = call i64 @ferror(i32 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22, %18
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %22
%29 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@EOF = global i32 0
@stdin = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %15, label %4
4: ; preds = %0, %9
%5 = phi i32 [ %12, %9 ], [ %1, %0 ]
%6 = icmp eq i32 %5, 10
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @putchar(i32 13)
br label %9
9: ; preds = %4, %7
%10 = phi i32 [ 10, %7 ], [ %5, %4 ]
%11 = tail call i32 @putchar(i32 %10)
%12 = tail call i32 (...) @getchar()
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %4
15: ; preds = %9, %0
%16 = load i32, i32* @stdin
%17 = tail call i64 @ferror(i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i32, i32* @stdout
%21 = tail call i64 @ferror(i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %19, %15
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %19
%26 = tail call i32 @exit(i32 0)
unreachable
}