#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*/ printf(char *, char *);
int readline(char *, int);
main() {
  int len, c;
  int max;
  char line[1000];
  while ((len = readline(line, 1000)) > 0) {
    len--;
    while (len >= 0 && (line[len] == ' ' || line[len] == '\t' ||
                        line[len] == '\r' || line[len] == '\n')) {
      --len;
    }
    if (len > 0) {
      ++len;
      line[len] = '\n';
      ++len;
      line[len] = '\0';
      printf("%s", line);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   1040 <readline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1252 <main+0x132>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x401(%rbp)
jl     11e5 <main+0xc5>
movslq -0x8(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%ecx
ff
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x402(%rbp)
je     11d9 <main+0xb9>
movslq -0x8(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%ecx
ff
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x402(%rbp)
je     11d9 <main+0xb9>
movslq -0x8(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%ecx
ff
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0x402(%rbp)
je     11d9 <main+0xb9>
movslq -0x8(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
sete   %al
mov    %al,-0x402(%rbp)
mov    -0x402(%rbp),%al
mov    %al,-0x401(%rbp)
mov    -0x401(%rbp),%al
test   $0x1,%al
jne    11f8 <main+0xd8>
jmp    1206 <main+0xe6>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1158 <main+0x38>
cmpl   $0x0,-0x8(%rbp)
jle    124d <main+0x12d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movb   $0xa,-0x400(%rbp,%rax,1)
0a
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movb   $0x0,-0x400(%rbp,%rax,1)
lea    -0x400(%rbp),%rsi
lea    0xdb8(%rip),%rdi
call   1030 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x3f0,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1040 <readline@plt>
test   %eax,%eax
jle    11d1 <main+0xb1>
lea    0xeb8(%rip),%r14
mov    %rsp,%r15
movabs $0x100002600,%rbx
jmp    1171 <main+0x51>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x3e8,%esi
call   1040 <readline@plt>
test   %eax,%eax
jle    11d1 <main+0xb1>
mov    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    -0x1(%rax),%rcx
mov    %ecx,%edx
movzbl (%rsp,%rdx,1),%edx
cmp    $0x20,%rdx
ja     11b0 <main+0x90>
bt     %rdx,%rbx
jae    11b0 <main+0x90>
lea    0x1(%rcx),%rdx
mov    %rcx,%rax
cmp    $0x1,%rdx
ja     1180 <main+0x60>
jmp    1160 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
nop
test   $0xfffffffe,%eax
je     1160 <main+0x40>
mov    %eax,%ecx
movb   $0xa,(%rsp,%rcx,1)
add    $0x1,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
jmp    1160 <main+0x40>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
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 i32
%5 = alloca [1000 x i8]
store i32 0, i32* %1
br label %6
6: ; preds = %67, %0
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%8 = call i32 @readline(i8* %7, i32 1000)
store i32 %8, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %68
10: ; preds = %6
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
br label %13
13: ; preds = %48, %10
%14 = load i32, i32* %2
%15 = icmp sge i32 %14, 0
br i1 %15, label %16, label %46
16: ; preds = %13
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 32
br i1 %22, label %44, label %23
23: ; preds = %16
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 9
br i1 %29, label %44, label %30
30: ; preds = %23
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 13
br i1 %36, label %44, label %37
37: ; preds = %30
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 10
br label %44
44: ; preds = %37, %30, %23, %16
%45 = phi i1 [ true, %30 ], [ true, %23 ], [ true, %16 ], [ %43, %37 ]
br label %46
46: ; preds = %44, %13
%47 = phi i1 [ false, %13 ], [ %45, %44 ]
br i1 %47, label %48, label %51
48: ; preds = %46
%49 = load i32, i32* %2
%50 = add nsw i32 %49, -1
store i32 %50, i32* %2
br label %13
51: ; preds = %46
%52 = load i32, i32* %2
%53 = icmp sgt i32 %52, 0
br i1 %53, label %54, label %67
54: ; preds = %51
%55 = load i32, i32* %2
%56 = add nsw i32 %55, 1
store i32 %56, i32* %2
%57 = load i32, i32* %2
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %58
store i8 10, i8* %59
%60 = load i32, i32* %2
%61 = add nsw i32 %60, 1
store i32 %61, i32* %2
%62 = load i32, i32* %2
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %63
store i8 0, i8* %64
%65 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%66 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %65)
br label %67
67: ; preds = %54, %51
br label %6
68: ; preds = %6
ret i32 0
}

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