#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 ((c = getchar()) == EOF)
      break;
    putchar(c);
    if (getchar() == EOF)
      break;
    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    %eax,-0x8(%rbp)
cltq
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%rax
jne    116c <main+0x4c>
jmp    11b1 <main+0x91>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2e66(%rip),%rcx
cmp    (%rcx),%rax
jne    1190 <main+0x70>
jmp    11b1 <main+0x91>
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>
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
je     116a <main+0x4a>
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 = trunc i64 %9 to i32
store i32 %10, i32* %2
%11 = sext i32 %10 to i64
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %8
br label %28
15: ; preds = %8
%16 = load i32, i32* %2
%17 = call i32 @putchar(i32 %16)
%18 = call i64 (...) @getchar()
%19 = load i64, i64* @EOF
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %15
br label %28
22: ; preds = %15
%23 = call i64 (...) @getchar()
%24 = load i64, i64* @EOF
%25 = icmp eq i64 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %22
br label %28
27: ; preds = %22
br label %3
28: ; preds = %26, %21, %14, %7
ret i32 0
}

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