#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 /*<<< orphan*/ copy(char *, char *);
int getaline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ trim(char *, int);
int main() {
  int len;
  int max;
  char line[1000];
  char buffer[1000];
  max = 0;
  while ((len = getaline(line, 1000)) > 0) {
    copy(buffer, line);
    if (len > max)
      max = len;
    trim(buffer, len);
    if (buffer[0] != '\n')
      printf("%s", buffer);
  }
  if (max > 1000)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   1030 <getaline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11d2 <main+0x92>
lea    -0x7f0(%rbp),%rdi
lea    -0x400(%rbp),%rsi
call   1060 <copy@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    119b <main+0x5b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    -0x7f0(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <trim@plt>
movsbl -0x7f0(%rbp),%eax
cmp    $0xa,%eax
je     11cd <main+0x8d>
lea    -0x7f0(%rbp),%rsi
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
jmp    1159 <main+0x19>
cmpl   $0x3e8,-0xc(%rbp)
jle    11eb <main+0xab>
movl   $0x1,-0x4(%rbp)
jmp    11f2 <main+0xb2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x7e0,%rsp
lea    0x3f0(%rsp),%rdi
mov    $0x3e8,%esi
call   1030 <getaline@plt>
test   %eax,%eax
jle    11cd <main+0x8d>
mov    %eax,%ebp
xor    %ebx,%ebx
mov    %rsp,%r12
lea    0x3f0(%rsp),%r14
lea    0xe85(%rip),%r15
jmp    1193 <main+0x53>
nopl   (%rax)
mov    %r14,%rdi
mov    $0x3e8,%esi
call   1030 <getaline@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    11c0 <main+0x80>
mov    %r12,%rdi
mov    %r14,%rsi
call   1060 <copy@plt>
cmp    %ebx,%ebp
cmovg  %ebp,%ebx
mov    %r12,%rdi
mov    %ebp,%esi
call   1050 <trim@plt>
cmpb   $0xa,(%rsp)
je     1180 <main+0x40>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
jmp    1180 <main+0x40>
xor    %eax,%eax
cmp    $0x3e9,%ebx
setae  %al
jmp    11cf <main+0x8f>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000 x i8]
%5 = alloca [1000 x i8]
store i32 0, i32* %1
store i32 0, i32* %3
br label %6
6: ; preds = %30, %0
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%8 = call i32 @getaline(i8* %7, i32 1000)
store i32 %8, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %31
10: ; preds = %6
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%13 = call i32 @copy(i8* %11, i8* %12)
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %10
%18 = load i32, i32* %2
store i32 %18, i32* %3
br label %19
19: ; preds = %17, %10
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%21 = load i32, i32* %2
%22 = call i32 @trim(i8* %20, i32 %21)
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 10
br i1 %26, label %27, label %30
27: ; preds = %19
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %27, %19
br label %6
31: ; preds = %6
%32 = load i32, i32* %3
%33 = icmp sgt i32 %32, 1000
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 1, i32* %1
br label %36
35: ; preds = %31
store i32 0, i32* %1
br label %36
36: ; preds = %35, %34
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = call i32 @getaline(i8* %3, i32 1000)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %24
7: ; preds = %0, %18
%8 = phi i32 [ %19, %18 ], [ %5, %0 ]
%9 = phi i32 [ %12, %18 ], [ 0, %0 ]
%10 = call i32 @copy(i8* %4, i8* %3)
%11 = icmp sgt i32 %8, %9
%12 = select i1 %11, i32 %8, i32 %9
%13 = call i32 @trim(i8* %4, i32 %8)
%14 = load i8, i8* %4
%15 = icmp eq i8 %14, 10
br i1 %15, label %18, label %16
16: ; preds = %7
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %18
18: ; preds = %16, %7
%19 = call i32 @getaline(i8* %3, i32 1000)
%20 = icmp sgt i32 %19, 0
br i1 %20, label %7, label %21
21: ; preds = %18
%22 = icmp ugt i32 %12, 1000
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %21, %0
%25 = phi i32 [ 0, %0 ], [ %23, %21 ]
ret i32 %25
}