#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 EOF;
int /*<<< orphan*/ deleteTrailingCharFromLines(char *, char);
int getchar();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int i, c, k;
  char userinput[1000];
  for (i = 0; (i < 1000) && ((c = getchar()) != EOF); i++) {
    userinput[i] = c;
  }
  for (int i = 0; (i < 1000) && (userinput[i] != '\0'); i++) {
    deleteTrailingCharFromLines(userinput, ' ');
    deleteTrailingCharFromLines(userinput, '\t');
  }
  printf("%s", userinput);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x3e8,-0x8(%rbp)
mov    %al,-0x405(%rbp)
jge    117a <main+0x4a>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e79(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x405(%rbp)
mov    -0x405(%rbp),%al
test   $0x1,%al
jne    118d <main+0x5d>
jmp    11ab <main+0x7b>
mov    -0xc(%rbp),%eax
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x400(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <main+0x19>
movl   $0x0,-0x404(%rbp)
xor    %eax,%eax
cmpl   $0x3e8,-0x404(%rbp)
mov    %al,-0x406(%rbp)
jge    11e8 <main+0xb8>
movslq -0x404(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
setne  %al
mov    %al,-0x406(%rbp)
mov    -0x406(%rbp),%al
test   $0x1,%al
jne    11fb <main+0xcb>
jmp    1231 <main+0x101>
lea    -0x400(%rbp),%rdi
mov    $0x20,%esi
call   1050 <deleteTrailingCharFromLines@plt>
lea    -0x400(%rbp),%rdi
mov    $0x9,%esi
call   1050 <deleteTrailingCharFromLines@plt>
mov    -0x404(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
jmp    11b5 <main+0x85>
lea    -0x400(%rbp),%rsi
lea    0xdc1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    0x2ea7(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     116c <main+0x3c>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x3e8,%rbx
jne    1150 <main+0x20>
xor    %ebx,%ebx
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,(%rsp,%rbx,1)
je     11ad <main+0x7d>
mov    %r14,%rdi
mov    $0x20,%esi
call   1050 <deleteTrailingCharFromLines@plt>
mov    %r14,%rdi
mov    $0x9,%esi
call   1050 <deleteTrailingCharFromLines@plt>
add    $0x1,%rbx
cmp    $0x3e8,%rbx
jne    1180 <main+0x50>
lea    0xe4c(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
@.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]
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %7
7: ; preds = %22, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 1000
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = call i32 (...) @getchar()
store i32 %11, i32* %3
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br label %14
14: ; preds = %10, %7
%15 = phi i1 [ false, %7 ], [ %13, %10 ]
br i1 %15, label %16, label %25
16: ; preds = %14
%17 = load i32, i32* %3
%18 = trunc i32 %17 to i8
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %20
store i8 %18, i8* %21
br label %22
22: ; preds = %16
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %7
25: ; preds = %14
store i32 0, i32* %6
br label %26
26: ; preds = %43, %25
%27 = load i32, i32* %6
%28 = icmp slt i32 %27, 1000
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 0
br label %36
36: ; preds = %29, %26
%37 = phi i1 [ false, %26 ], [ %35, %29 ]
br i1 %37, label %38, label %46
38: ; preds = %36
%39 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%40 = call i32 @deleteTrailingCharFromLines(i8* %39, i8 signext 32)
%41 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%42 = call i32 @deleteTrailingCharFromLines(i8* %41, i8 signext 9)
br label %43
43: ; preds = %38
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %26
46: ; preds = %36
%47 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %47)
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
@EOF = global i32 0
@.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
br label %3
3: ; preds = %0, %8
%4 = phi i64 [ 0, %0 ], [ %11, %8 ]
%5 = tail call i32 (...) @getchar()
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = trunc i32 %5 to i8
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %4
store i8 %9, i8* %10
%11 = add nuw nsw i64 %4, 1
%12 = icmp eq i64 %11, 1000
br i1 %12, label %13, label %3
13: ; preds = %8, %3
br label %14
14: ; preds = %13, %21
%15 = phi i64 [ %24, %21 ], [ 0, %13 ]
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %21, %14
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
21: ; preds = %14
%22 = call i32 @deleteTrailingCharFromLines(i8* %2, i8 signext 32)
%23 = call i32 @deleteTrailingCharFromLines(i8* %2, i8 signext 9)
%24 = add nuw nsw i64 %15, 1
%25 = icmp eq i64 %24, 1000
br i1 %25, label %19, label %14
}