#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();
main() {
  int lim, i;
  lim = 100;
  i = 0;
  char s[lim];
  char c;
  while ((c = getchar()) != EOF) {
    if (i >= lim - 1) {
      break;
    }
    if (c == '\n') {
      break;
    }
    s[i] = c;
    ++i;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%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,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%eax
mov    0x2e81(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11b6 <main+0xa6>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jl     1188 <main+0x78>
jmp    11b6 <main+0xa6>
movsbl -0x21(%rbp),%eax
cmp    $0xa,%eax
jne    119a <main+0x8a>
jmp    11b6 <main+0xa6>
mov    -0x30(%rbp),%rax
mov    -0x21(%rbp),%dl
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1153 <main+0x43>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <getchar@plt>
mov    0x2ec7(%rip),%rbx
cmp    (%rbx),%al
je     1147 <main+0x37>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
cmp    $0x62,%ebp
ja     1147 <main+0x37>
cmp    $0xa,%al
je     1147 <main+0x37>
add    $0x1,%ebp
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    (%rbx),%al
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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