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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1040 <getline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    120e <main+0xee>
jmp    1154 <main+0x34>
xor    %eax,%eax
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x3f1(%rbp)
jle    11af <main+0x8f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
cltq
movsbl -0x3f0(%rbp,%rax,1),%ecx
ff
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x3f2(%rbp)
je     11a3 <main+0x83>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
cltq
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x9,%eax
sete   %al
mov    %al,-0x3f2(%rbp)
mov    -0x3f2(%rbp),%al
mov    %al,-0x3f1(%rbp)
mov    -0x3f1(%rbp),%al
test   $0x1,%al
jne    11c2 <main+0xa2>
jmp    11d0 <main+0xb0>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x34>
cmpl   $0x1,-0x8(%rbp)
jle    1209 <main+0xe9>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0xa,-0x3f0(%rbp,%rax,1)
0a
movslq -0x8(%rbp),%rax
movb   $0x0,-0x3f0(%rbp,%rax,1)
lea    -0x3f0(%rbp),%rsi
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x400,%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 <getline@plt>
test   %eax,%eax
jle    11ab <main+0x8b>
mov    $0xfffffffe,%ebx
lea    0xeb7(%rip),%r14
mov    %rsp,%r15
jmp    1161 <main+0x41>
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0x3e8,%esi
call   1040 <getline@plt>
test   %eax,%eax
jle    11ab <main+0x8b>
cmp    $0x2,%eax
jb     1150 <main+0x30>
mov    %eax,%eax
jmp    117d <main+0x5d>
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rax),%rcx
cmp    $0x2,%rax
mov    %rcx,%rax
jle    1150 <main+0x30>
lea    (%rax,%rbx,1),%ecx
movzbl (%rsp,%rcx,1),%ecx
cmp    $0x20,%cl
je     1170 <main+0x50>
cmp    $0x9,%cl
je     1170 <main+0x50>
lea    (%rbx,%rax,1),%ecx
add    $0x1,%ecx
movb   $0xa,(%rsp,%rcx,1)
mov    %eax,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
jmp    1150 <main+0x30>
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 [1000 x i8]
store i32 0, i32* %1
br label %4
4: ; preds = %48, %0
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = call i32 @getline(i8* %5, i32 1000)
store i32 %6, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %49
8: ; preds = %4
br label %9
9: ; preds = %32, %8
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %30
12: ; preds = %9
%13 = load i32, i32* %2
%14 = sub nsw i32 %13, 2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 32
br i1 %19, label %28, label %20
20: ; preds = %12
%21 = load i32, i32* %2
%22 = sub nsw i32 %21, 2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 9
br label %28
28: ; preds = %20, %12
%29 = phi i1 [ true, %12 ], [ %27, %20 ]
br label %30
30: ; preds = %28, %9
%31 = phi i1 [ false, %9 ], [ %29, %28 ]
br i1 %31, label %32, label %35
32: ; preds = %30
%33 = load i32, i32* %2
%34 = add nsw i32 %33, -1
store i32 %34, i32* %2
br label %9
35: ; preds = %30
%36 = load i32, i32* %2
%37 = icmp sgt i32 %36, 1
br i1 %37, label %38, label %48
38: ; preds = %35
%39 = load i32, i32* %2
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %41
store i8 10, i8* %42
%43 = load i32, i32* %2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %44
store i8 0, i8* %45
%46 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%47 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %46)
br label %48
48: ; preds = %38, %35
br label %4
49: ; preds = %4
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 @getline(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 = icmp ugt i32 %6, 1
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = zext i32 %6 to i64
br label %10
10: ; preds = %8, %16
%11 = phi i64 [ %9, %8 ], [ %17, %16 ]
%12 = add nuw i64 %11, 4294967294
%13 = and i64 %12, 4294967295
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
switch i8 %15, label %19 [
i8 32, label %16
i8 9, label %16
]
16: ; preds = %10, %10
%17 = add nsw i64 %11, -1
%18 = icmp sgt i64 %11, 2
br i1 %18, label %10, label %26
19: ; preds = %10
%20 = add nuw i64 %11, 4294967295
%21 = and i64 %20, 4294967295
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %21
store i8 10, i8* %22
%23 = and i64 %11, 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 = %16, %5, %19
%27 = call i32 @getline(i8* %2, i32 1000)
%28 = icmp sgt i32 %27, 0
br i1 %28, label %5, label %29
29: ; preds = %26, %0
ret i32 0
}