#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 getchar();
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ replace(int, int);
int main() {
  int c, count;
  int TabSize = 5;
  count = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\n')
      count = 0;
    if (c == ' ') {
      ++count;
      while ((c = getchar()) == ' ')
        ++count;
      replace(count, TabSize);
      putchar(c);
      count = 0;
    } else {
      putchar(c);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%eax
je     11d7 <main+0xa7>
cmpl   $0xa,-0x8(%rbp)
jne    1177 <main+0x47>
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0x8(%rbp)
jne    11ca <main+0x9a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x20,%eax
jne    11ab <main+0x7b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118a <main+0x5a>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1050 <replace@plt>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    11d2 <main+0xa2>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2ea6(%rip),%r14
cmp    (%r14),%eax
jne    114e <main+0x1e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %eax,%ebx
jmp    1175 <main+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     1147 <main+0x17>
cmp    $0x20,%ebx
jne    1160 <main+0x30>
xor    %ebp,%ebp
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebp
cmp    $0x20,%eax
je     1180 <main+0x50>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0x5,%esi
call   1050 <replace@plt>
jmp    1160 <main+0x30>

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

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