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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1e,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11cd <main+0xbd>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xa,%eax
je     11b5 <main+0xa5>
mov    -0x8(%rbp),%eax
mov    0x2e58(%rip),%rcx
cmp    (%rcx),%eax
je     11ab <main+0x9b>
mov    -0x28(%rbp),%rax
mov    -0x8(%rbp),%edx
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    11b0 <main+0xa0>
jmp    11cd <main+0xbd>
jmp    11ba <main+0xaa>
jmp    11cd <main+0xbd>
jmp    11bf <main+0xaf>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1162 <main+0x52>
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
push   %rax
mov    $0x1c,%ebx
mov    0x2ec8(%rip),%r14
xor    %eax,%eax
call   1030 <getchar@plt>
sub    $0x1,%ebx
setb   %cl
cmp    $0xa,%eax
je     113b <main+0x2b>
cmp    (%r14),%eax
je     113b <main+0x2b>
test   %cl,%cl
je     1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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