#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(char);
main() {
  int i, line_not_empty;
  char buffer[1024];
  char c;
  i = line_not_empty = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t') {
      if (i < 1024 - 1) {
        buffer[i] = c;
        ++i;
      }
    } else if (c == '\n') {
      if (line_not_empty) {
        putchar(c);
        line_not_empty = 0;
      }
    } else {
      buffer[i] = '\0';
      i = 0;
      printf("%s", buffer);
      putchar(c);
      line_not_empty = 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x411(%rbp)
movsbl %al,%eax
mov    0x2e81(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1233 <main+0x103>
movsbl -0x411(%rbp),%eax
cmp    $0x20,%eax
je     1192 <main+0x62>
movsbl -0x411(%rbp),%eax
cmp    $0x9,%eax
jne    11be <main+0x8e>
cmpl   $0x3ff,-0x8(%rbp)
jge    11b9 <main+0x89>
mov    -0x411(%rbp),%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x410(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    122e <main+0xfe>
movsbl -0x411(%rbp),%eax
cmp    $0xa,%eax
jne    11f0 <main+0xc0>
cmpl   $0x0,-0xc(%rbp)
je     11eb <main+0xbb>
movsbl -0x411(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    1229 <main+0xf9>
movslq -0x8(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
movl   $0x0,-0x8(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xdef(%rip),%rdi
call   1040 <printf@plt>
movsbl -0x411(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x1,-0xc(%rbp)
jmp    122e <main+0xfe>
jmp    1150 <main+0x20>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e99(%rip),%r12
cmp    (%r12),%al
jne    1169 <main+0x39>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
lea    0xe8e(%rip),%r14
mov    %rsp,%r15
xor    %ebp,%ebp
xor    %r13d,%r13d
jmp    11b1 <main+0x81>
nopl   0x0(%rax)
movslq %ebp,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
movsbl %bl,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
mov    $0x1,%r13d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cmp    (%r12),%al
je     1155 <main+0x25>
cmp    $0x20,%bl
je     11c0 <main+0x90>
cmp    $0xa,%bl
je     11e0 <main+0xb0>
cmp    $0x9,%bl
jne    1180 <main+0x50>
cmp    $0x3fe,%ebp
jg     11a2 <main+0x72>
movslq %ebp,%rax
mov    %bl,(%rsp,%rax,1)
add    $0x1,%ebp
jmp    11a2 <main+0x72>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %r13d,%r13d
jne    11ea <main+0xba>
xor    %r13d,%r13d
jmp    11a2 <main+0x72>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r13d,%r13d
jmp    11a2 <main+0x72>

LLVM IR (-O0):
@EOF = global i8 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %2
br label %6
6: ; preds = %51, %0
%7 = call signext i8 (...) @getchar()
store i8 %7, i8* %5
%8 = sext i8 %7 to i32
%9 = load i8, i8* @EOF
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %8, %10
br i1 %11, label %12, label %52
12: ; preds = %6
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 32
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 9
br i1 %19, label %20, label %31
20: ; preds = %16, %12
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 1023
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = load i8, i8* %5
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %26
store i8 %24, i8* %27
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %30
30: ; preds = %23, %20
br label %51
31: ; preds = %16
%32 = load i8, i8* %5
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 10
br i1 %34, label %35, label %42
35: ; preds = %31
%36 = load i32, i32* %3
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i8, i8* %5
%40 = call i32 @putchar(i8 signext %39)
store i32 0, i32* %3
br label %41
41: ; preds = %38, %35
br label %50
42: ; preds = %31
%43 = load i32, i32* %2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %44
store i8 0, i8* %45
store i32 0, i32* %2
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%47 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %46)
%48 = load i8, i8* %5
%49 = call i32 @putchar(i8 signext %48)
store i32 1, i32* %3
br label %50
50: ; preds = %42, %41
br label %51
51: ; preds = %50, %30
br label %6
52: ; preds = %6
ret i32 0
}

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