#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 */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ putchar(int);
main() {
  int c;
  for (;;) {
    if (getchar() == EOF)
      break;
    if (getchar() == EOF)
      break;
    if ((c = getchar()) == EOF)
      break;
    putchar(c);
    if (getchar() == EOF)
      break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2eab(%rip),%rcx
cmp    (%rcx),%rax
jne    114b <main+0x2b>
jmp    11b1 <main+0x91>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2e8f(%rip),%rcx
cmp    (%rcx),%rax
jne    1167 <main+0x47>
jmp    11b1 <main+0x91>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cltq
mov    0x2e6e(%rip),%rcx
cmp    (%rcx),%rax
jne    1188 <main+0x68>
jmp    11b1 <main+0x91>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2e4a(%rip),%rcx
cmp    (%rcx),%rax
jne    11ac <main+0x8c>
jmp    11b1 <main+0x91>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%rax
je     116a <main+0x4a>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%rax
je     116a <main+0x4a>
xor    %eax,%eax
call   1040 <getchar@plt>
movslq %eax,%rcx
cmp    (%rbx),%rcx
je     116a <main+0x4a>
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%rax
jne    1130 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@EOF = global i64 0
define i32 @main() {
br label %1
1: ; preds = %15, %0
%2 = tail call i64 (...) @getchar()
%3 = load i64, i64* @EOF
%4 = icmp eq i64 %2, %3
br i1 %4, label %21, label %5
5: ; preds = %1
%6 = tail call i64 (...) @getchar()
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %21, label %9
9: ; preds = %5
%10 = tail call i64 (...) @getchar()
%11 = shl i64 %10, 32
%12 = ashr exact i64 %11, 32
%13 = load i64, i64* @EOF
%14 = icmp eq i64 %12, %13
br i1 %14, label %21, label %15
15: ; preds = %9
%16 = trunc i64 %10 to i32
%17 = tail call i32 @putchar(i32 %16)
%18 = tail call i64 (...) @getchar()
%19 = load i64, i64* @EOF
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %1
21: ; preds = %15, %9, %5, %1
ret i32 0
}