#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*/ putchar(char);
int main(int argc, char *argv[]) {
  char c;
  int space, i;
  space = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      ++space;
      if (space == 4) {
        putchar('\t');
        space = 0;
      }
    } else {
      if (space > 0) {
        for (i = 0; i < space; i++) {
          putchar(' ');
        }
      }
      putchar(c);
      space = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e97(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11e1 <main+0xc1>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    1192 <main+0x72>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jne    118d <main+0x6d>
mov    $0x9,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x18(%rbp)
jmp    11dc <main+0xbc>
cmpl   $0x0,-0x18(%rbp)
jle    11cc <main+0xac>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11c7 <main+0xa7>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a3 <main+0x83>
jmp    11cc <main+0xac>
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0x18(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%al
jne    113e <main+0x1e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %eax,%ebx
xor    %ebp,%ebp
jmp    1168 <main+0x48>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %bl,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%al
je     1137 <main+0x17>
cmp    $0x20,%bl
jne    1180 <main+0x60>
add    $0x1,%ebp
cmp    $0x4,%ebp
jne    115a <main+0x3a>
mov    $0x9,%bl
jmp    1150 <main+0x30>
nopl   0x0(%rax)
test   %ebp,%ebp
jle    1150 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x70>
jmp    1150 <main+0x30>

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %9
9: ; preds = %44, %2
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %6
%11 = sext i8 %10 to i32
%12 = load i8, i8* @EOF
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %11, %13
br i1 %14, label %15, label %45
15: ; preds = %9
%16 = load i8, i8* %6
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 32
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, 4
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = call i32 @putchar(i8 signext 9)
store i32 0, i32* %7
br label %26
26: ; preds = %24, %19
br label %44
27: ; preds = %15
%28 = load i32, i32* %7
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %41
30: ; preds = %27
store i32 0, i32* %8
br label %31
31: ; preds = %37, %30
%32 = load i32, i32* %8
%33 = load i32, i32* %7
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = call i32 @putchar(i8 signext 32)
br label %37
37: ; preds = %35
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %31
40: ; preds = %31
br label %41
41: ; preds = %40, %27
%42 = load i8, i8* %6
%43 = call i32 @putchar(i8 signext %42)
store i32 0, i32* %7
br label %44
44: ; preds = %41, %26
br label %9
45: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call signext i8 (...) @getchar()
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %28, label %6
6: ; preds = %2, %23
%7 = phi i8 [ %25, %23 ], [ %3, %2 ]
%8 = phi i32 [ %24, %23 ], [ 0, %2 ]
%9 = icmp eq i8 %7, 32
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = add nsw i32 %8, 1
%12 = icmp eq i32 %11, 4
br i1 %12, label %20, label %23
13: ; preds = %6
%14 = icmp sgt i32 %8, 0
br i1 %14, label %15, label %20
15: ; preds = %13, %15
%16 = phi i32 [ %18, %15 ], [ 0, %13 ]
%17 = tail call i32 @putchar(i8 signext 32)
%18 = add nuw nsw i32 %16, 1
%19 = icmp eq i32 %18, %8
br i1 %19, label %20, label %15
20: ; preds = %15, %13, %10
%21 = phi i8 [ 9, %10 ], [ %7, %13 ], [ %7, %15 ]
%22 = tail call i32 @putchar(i8 signext %21)
br label %23
23: ; preds = %20, %10
%24 = phi i32 [ %11, %10 ], [ 0, %20 ]
%25 = tail call signext i8 (...) @getchar()
%26 = load i8, i8* @EOF
%27 = icmp eq i8 %25, %26
br i1 %27, label %28, label %6
28: ; preds = %23, %2
ret i32 0
}