#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 get_line(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char buffer[9001];
  int c, i, len;
  while (len = get_line(buffer, 9001)) {
    for (i = len - 2; (i > 0) && (buffer[i] == ' ') || (buffer[i] == '\t'); --i)
      ;
    if (i >= 1) {
      buffer[i + 1] = '\n';
      buffer[i + 2] = '\0';
      printf("%s", buffer);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2340,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x2330(%rbp),%rdi
mov    $0x2329,%esi
call   1030 <get_line@plt>
mov    %eax,-0x233c(%rbp)
cmp    $0x0,%eax
je     1220 <main+0x100>
mov    -0x233c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x2338(%rbp)
cmpl   $0x0,-0x2338(%rbp)
jle    118e <main+0x6e>
movslq -0x2338(%rbp),%rax
movsbl -0x2330(%rbp,%rax,1),%ecx
ff
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x233d(%rbp)
je     11a9 <main+0x89>
movslq -0x2338(%rbp),%rax
movsbl -0x2330(%rbp,%rax,1),%eax
ff
cmp    $0x9,%eax
sete   %al
mov    %al,-0x233d(%rbp)
mov    -0x233d(%rbp),%al
test   $0x1,%al
jne    11bc <main+0x9c>
jmp    11d5 <main+0xb5>
jmp    11c1 <main+0xa1>
mov    -0x2338(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2338(%rbp)
jmp    1161 <main+0x41>
cmpl   $0x1,-0x2338(%rbp)
jl     121b <main+0xfb>
mov    -0x2338(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0xa,-0x2330(%rbp,%rax,1)
0a
mov    -0x2338(%rbp),%eax
add    $0x2,%eax
cltq
movb   $0x0,-0x2330(%rbp,%rax,1)
lea    -0x2330(%rbp),%rsi
lea    0xdea(%rip),%rdi
call   1040 <printf@plt>
jmp    1132 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0x2340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2338,%rsp
mov    %rsp,%rdi
mov    $0x2329,%esi
call   1030 <get_line@plt>
test   %eax,%eax
je     11e2 <main+0xc2>
movabs $0xffffffff00000000,%rbp
ff ff ff
movabs $0x200000000,%r12
movabs $0x100000000,%r13
lea    0xe95(%rip),%r14
mov    %rsp,%r15
jmp    1181 <main+0x61>
mov    %r15,%rdi
mov    $0x2329,%esi
call   1030 <get_line@plt>
test   %eax,%eax
je     11e2 <main+0xc2>
add    $0xfffffffe,%eax
movslq %eax,%rdx
mov    %rdx,%rcx
shl    $0x20,%rcx
lea    (%rcx,%r12,1),%rax
add    %r13,%rcx
jmp    11b0 <main+0x90>
nopw   0x0(%rax,%rax,1)
cmpb   $0x9,(%rsp,%rdx,1)
jne    1170 <main+0x50>
add    $0xffffffffffffffff,%rdx
add    %rbp,%rax
add    %rbp,%rcx
test   %rdx,%rdx
jle    11a0 <main+0x80>
mov    %edx,%esi
movzbl (%rsp,%rsi,1),%ebx
cmp    $0x9,%bl
je     11a6 <main+0x86>
cmp    $0x20,%bl
je     11a6 <main+0x86>
sar    $0x20,%rcx
movb   $0xa,(%rsp,%rcx,1)
sar    $0x20,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x2338,%rsp
pop    %rbx
pop    %r12
pop    %r13
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 [9001 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %50, %0
%7 = getelementptr inbounds [9001 x i8], [9001 x i8]* %2, i64 0, i64 0
%8 = call i32 @get_line(i8* %7, i32 9001)
store i32 %8, i32* %5
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %51
10: ; preds = %6
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 2
store i32 %12, i32* %4
br label %13
13: ; preds = %33, %10
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [9001 x i8], [9001 x i8]* %2, 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 %30, label %23
23: ; preds = %16, %13
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [9001 x i8], [9001 x i8]* %2, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 9
br label %30
30: ; preds = %23, %16
%31 = phi i1 [ true, %16 ], [ %29, %23 ]
br i1 %31, label %32, label %36
32: ; preds = %30
br label %33
33: ; preds = %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, -1
store i32 %35, i32* %4
br label %13
36: ; preds = %30
%37 = load i32, i32* %4
%38 = icmp sge i32 %37, 1
br i1 %38, label %39, label %50
39: ; preds = %36
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [9001 x i8], [9001 x i8]* %2, i64 0, i64 %42
store i8 10, i8* %43
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [9001 x i8], [9001 x i8]* %2, i64 0, i64 %46
store i8 0, i8* %47
%48 = getelementptr inbounds [9001 x i8], [9001 x i8]* %2, i64 0, i64 0
%49 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %39, %36
br label %6
51: ; preds = %6
%52 = load i32, i32* %1
ret i32 %52
}

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