#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 */
char EOF;
char getchar();
int /*<<< orphan*/ putchar(char);
int main() {
  char c = EOF;
  char input[100];
  int i;
  for (i = 0; i < 100 - 1; ++i) {
    if ((c = getchar()) != '\n') {
      if (c != EOF) {
        input[i] = c;
        putchar(c);
      } else {
        break;
      }
    }
  }
  input[i] = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaf(%rip),%rax
mov    (%rax),%al
mov    %al,-0x5(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x63,-0x74(%rbp)
jge    11b1 <main+0x91>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     119e <main+0x7e>
movsbl -0x5(%rbp),%eax
mov    0x2e78(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1194 <main+0x74>
mov    -0x5(%rbp),%cl
movslq -0x74(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    1199 <main+0x79>
jmp    11b1 <main+0x91>
jmp    119e <main+0x7e>
jmp    11a3 <main+0x83>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1145 <main+0x25>
movslq -0x74(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x63,%ebx
mov    0x2eb8(%rip),%r14
jmp    1145 <main+0x25>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0xffffffff,%ebx
je     115f <main+0x3f>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     1140 <main+0x20>
cmp    (%r14),%al
je     115f <main+0x3f>
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [100 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = load i8, i8* @EOF
store i8 %5, i8* %2
store i32 0, i32* %4
br label %6
6: ; preds = %29, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 99
br i1 %8, label %9, label %32
9: ; preds = %6
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %28
13: ; preds = %9
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = load i8, i8* @EOF
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %15, %17
br i1 %18, label %19, label %26
19: ; preds = %13
%20 = load i8, i8* %2
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %22
store i8 %20, i8* %23
%24 = load i8, i8* %2
%25 = call i32 @putchar(i8 signext %24)
br label %27
26: ; preds = %13
br label %32
27: ; preds = %19
br label %28
28: ; preds = %27, %9
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %6
32: ; preds = %26, %6
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %34
store i8 0, i8* %35
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
br label %1
1: ; preds = %0, %10
%2 = phi i32 [ 0, %0 ], [ %11, %10 ]
%3 = tail call signext i8 (...) @getchar()
%4 = icmp eq i8 %3, 10
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = load i8, i8* @EOF
%7 = icmp eq i8 %3, %6
br i1 %7, label %13, label %8
8: ; preds = %5
%9 = tail call i32 @putchar(i8 signext %3)
br label %10
10: ; preds = %1, %8
%11 = add nuw nsw i32 %2, 1
%12 = icmp eq i32 %11, 99
br i1 %12, label %13, label %1
13: ; preds = %5, %10
ret i32 0
}