#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 /*<<< orphan*/ buf;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ drop_line(char *);
int getchar();
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char buf[2000];
  size_t len;
  int c;
  do {
    len = 0;
    c = getchar();
    while (c != EOF) {
      buf[len++] = (char)c;
      if (c == '\n' || len >= sizeof(buf) - 1) {
        break;
      }
      c = getchar();
    }
    if (len > 0) {
      buf[len] = '\0';
      if (!drop_line(buf)) {
        printf("%s", buf);
      }
    }
  } while (c != EOF);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x7e8(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x7ec(%rbp)
mov    -0x7ec(%rbp),%eax
mov    0x2e81(%rip),%rcx
cmp    (%rcx),%eax
je     11c8 <main+0x98>
mov    -0x7ec(%rbp),%eax
mov    %al,%cl
mov    -0x7e8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x7e8(%rbp)
mov    %cl,-0x7e0(%rbp,%rax,1)
cmpl   $0xa,-0x7ec(%rbp)
je     11b1 <main+0x81>
cmpq   $0x7cf,-0x7e8(%rbp)
jb     11b6 <main+0x86>
jmp    11c8 <main+0x98>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x7ec(%rbp)
jmp    115a <main+0x2a>
cmpq   $0x0,-0x7e8(%rbp)
jbe    1212 <main+0xe2>
mov    -0x7e8(%rbp),%rax
movb   $0x0,-0x7e0(%rbp,%rax,1)
lea    -0x7e0(%rbp),%rdi
call   1030 <drop_line@plt>
cmp    $0x0,%eax
jne    120d <main+0xdd>
lea    -0x7e0(%rbp),%rsi
lea    0xdf8(%rip),%rdi
call   1040 <printf@plt>
jmp    1212 <main+0xe2>
jmp    1217 <main+0xe7>
mov    -0x7ec(%rbp),%eax
mov    0x2dc4(%rip),%rcx
cmp    (%rcx),%eax
jne    1142 <main+0x12>
xor    %eax,%eax
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x7d0,%rsp
mov    0x2ea2(%rip),%r12
mov    %rsp,%r15
lea    0xeb0(%rip),%r14
jmp    1166 <main+0x36>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    (%r12),%ebp
je     11c6 <main+0x96>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
cmp    (%r12),%eax
je     1160 <main+0x30>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
mov    %rax,%rbx
mov    %bpl,(%rsp,%rax,1)
cmp    $0xa,%ebp
je     11a8 <main+0x78>
cmp    $0x7cd,%rbx
ja     11a8 <main+0x78>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
lea    0x1(%rbx),%rax
cmp    (%r12),%ebp
jne    1180 <main+0x50>
movb   $0x0,0x1(%rsp,%rbx,1)
mov    %r15,%rdi
call   1030 <drop_line@plt>
test   %eax,%eax
jne    1160 <main+0x30>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x7d0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2000 x i8]
%3 = alloca i64
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %39, %0
store i64 0, i64* %3
%6 = call i32 (...) @getchar()
store i32 %6, i32* %4
br label %7
7: ; preds = %23, %5
%8 = load i32, i32* %4
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %25
11: ; preds = %7
%12 = load i32, i32* %4
%13 = trunc i32 %12 to i8
%14 = load i64, i64* %3
%15 = add i64 %14, 1
store i64 %15, i64* %3
%16 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 %14
store i8 %13, i8* %16
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 10
br i1 %18, label %22, label %19
19: ; preds = %11
%20 = load i64, i64* %3
%21 = icmp uge i64 %20, 1999
br i1 %21, label %22, label %23
22: ; preds = %19, %11
br label %25
23: ; preds = %19
%24 = call i32 (...) @getchar()
store i32 %24, i32* %4
br label %7
25: ; preds = %22, %7
%26 = load i64, i64* %3
%27 = icmp ugt i64 %26, 0
br i1 %27, label %28, label %38
28: ; preds = %25
%29 = load i64, i64* %3
%30 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 %29
store i8 0, i8* %30
%31 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 0
%32 = call i32 @drop_line(i8* %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %28
%35 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 0
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %35)
br label %37
37: ; preds = %34, %28
br label %38
38: ; preds = %37, %25
br label %39
39: ; preds = %38
%40 = load i32, i32* %4
%41 = load i32, i32* @EOF
%42 = icmp ne i32 %40, %41
br i1 %42, label %5, label %43
43: ; preds = %39
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [2000 x i8]
%2 = getelementptr inbounds [2000 x i8], [2000 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %27, %0
%4 = call i32 (...) @getchar()
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %27, label %7
7: ; preds = %3, %16
%8 = phi i32 [ %17, %16 ], [ %4, %3 ]
%9 = phi i64 [ %11, %16 ], [ 0, %3 ]
%10 = trunc i32 %8 to i8
%11 = add nuw nsw i64 %9, 1
%12 = getelementptr inbounds [2000 x i8], [2000 x i8]* %1, i64 0, i64 %9
store i8 %10, i8* %12
%13 = icmp eq i32 %8, 10
%14 = icmp ugt i64 %9, 1997
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %20, label %16
16: ; preds = %7
%17 = call i32 (...) @getchar()
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %7
20: ; preds = %7, %16
%21 = phi i32 [ %8, %7 ], [ %17, %16 ]
%22 = getelementptr inbounds [2000 x i8], [2000 x i8]* %1, i64 0, i64 %11
store i8 0, i8* %22
%23 = call i32 @drop_line(i8* %2)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %27
27: ; preds = %3, %25, %20
%28 = phi i32 [ %21, %25 ], [ %21, %20 ], [ %4, %3 ]
%29 = load i32, i32* @EOF
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %3
31: ; preds = %27
ret i32 0
}