#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 getchar();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(int);
main() {
  int c;
  while ((c = getchar()) != EOF) {
    putchar(c);
    printf("%f", c != EOF);
    printf("%d", EOF);
  }
}


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    0x2e98(%rip),%rcx
cmp    (%rcx),%eax
je     119a <main+0x6a>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%esi
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
jmp    113f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea3(%rip),%rbx
cmp    (%rbx),%eax
je     118e <main+0x5e>
mov    %eax,%ebp
lea    0xeae(%rip),%r14
lea    0xeaa(%rip),%r15
nopl   0x0(%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
xor    %esi,%esi
cmp    (%rbx),%ebp
setne  %sil
mov    %r14,%rdi
call   1040 <printf@plt>
mov    (%rbx),%esi
mov    %r15,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
cmp    (%rbx),%eax
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [3 x i8] c"%f\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %17
7: ; preds = %3
%8 = load i32, i32* %2
%9 = call i32 @putchar(i32 %8)
%10 = load i32, i32* %2
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @EOF
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %3
17: ; preds = %3
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [3 x i8] c"%f\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %16, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %13, %4 ], [ %1, %0 ]
%6 = tail call i32 @putchar(i32 %5)
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %5, %7
%9 = zext i1 %8 to i32
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @EOF
%12 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = tail call i32 (...) @getchar()
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %4
16: ; preds = %4, %0
ret i32 0
}