#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 */
typedef int uint32_t;

/* Variables and functions */
char EOF;
int EXIT_SUCCESS;
char getchar();
int /*<<< orphan*/ puts(char *);
int main(void) {
  uint32_t i = 0;
  uint32_t lim = 100;
  char c = 0;
  char s[lim];
  while (i < (lim - 1)) {
    c = getchar();
    if (c != '\n') {
      if (c != EOF) {
        s[i++] = c;
      }
    }
  }
  s[i] = '\0';
  puts(s);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x64,-0xc(%rbp)
movb   $0x0,-0xd(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11c7 <main+0xa7>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0xa,%eax
je     11c2 <main+0xa2>
movsbl -0xd(%rbp),%eax
mov    0x2e4e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11bd <main+0x9d>
mov    -0x28(%rbp),%rax
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x8(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11c2 <main+0xa2>
jmp    1167 <main+0x47>
mov    -0x28(%rbp),%rdi
movslq -0x8(%rbp),%rax
movb   $0x0,(%rdi,%rax,1)
call   1030 <puts@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    0x2eba(%rip),%r14
xor    %ebx,%ebx
jmp    1145 <main+0x25>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x63,%ebx
jge    1160 <main+0x40>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     1140 <main+0x20>
cmp    (%r14),%al
je     1140 <main+0x20>
movslq %ebx,%rcx
add    $0x1,%ebx
mov    %al,(%rsp,%rcx,1)
jmp    1140 <main+0x20>
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
call   1030 <puts@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i8 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [100 x i8]
br label %2
2: ; preds = %0, %13
%3 = phi i32 [ 0, %0 ], [ %14, %13 ]
%4 = tail call signext i8 (...) @getchar()
%5 = icmp eq i8 %4, 10
%6 = load i8, i8* @EOF
%7 = icmp eq i8 %4, %6
%8 = select i1 %5, i1 true, i1 %7
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = add nsw i32 %3, 1
%11 = sext i32 %3 to i64
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %11
store i8 %4, i8* %12
br label %13
13: ; preds = %9, %2
%14 = phi i32 [ %10, %9 ], [ %3, %2 ]
%15 = icmp slt i32 %14, 99
br i1 %15, label %2, label %16
16: ; preds = %13
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%18 = zext i32 %14 to i64
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %18
store i8 0, i8* %19
%20 = call i32 @puts(i8* %17)
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}