#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;
  int lim = 20;
  int estado = 1;
  int i = 0;
  char s[1000];
  while (estado == 1) {
    if (i < lim - 1) {
      if ((c = getchar()) != '\n') {
        if (c == EOF)
          estado = 0;
      } else
        estado = 0;
    } else
      estado = 0;
    if (estado == 1) {
      s[i] = c;
      ++i;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11be <main+0xae>
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    118f <main+0x7f>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xa,%eax
je     1183 <main+0x73>
mov    -0x8(%rbp),%eax
mov    0x2e79(%rip),%rcx
cmp    (%rcx),%eax
jne    117e <main+0x6e>
movl   $0x0,-0x10(%rbp)
jmp    118a <main+0x7a>
movl   $0x0,-0x10(%rbp)
jmp    1196 <main+0x86>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11b9 <main+0xa9>
mov    -0x8(%rbp),%eax
mov    %al,%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x400(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <main+0x27>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
mov    0x2ec8(%rip),%r14
add    $0x1,%ebx
cmp    $0x12,%ebx
ja     1139 <main+0x29>
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1139 <main+0x29>
cmp    (%r14),%eax
jne    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 i32
%6 = alloca [1000 x i8]
store i32 0, i32* %1
store i32 20, i32* %3
store i32 1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %38, %0
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %39
10: ; preds = %7
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %26
15: ; preds = %10
%16 = call i32 (...) @getchar()
store i32 %16, i32* %2
%17 = icmp ne i32 %16, 10
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i32, i32* %2
%20 = load i32, i32* @EOF
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %4
br label %23
23: ; preds = %22, %18
br label %25
24: ; preds = %15
store i32 0, i32* %4
br label %25
25: ; preds = %24, %23
br label %27
26: ; preds = %10
store i32 0, i32* %4
br label %27
27: ; preds = %26, %25
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load i32, i32* %2
%32 = trunc i32 %31 to i8
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 %34
store i8 %32, i8* %35
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %38
38: ; preds = %30, %27
br label %7
39: ; preds = %7
ret i32 0
}

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