#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 /*<<< orphan*/ putchar_repeat(char, int);
int main(void) {
  char c, i;
  int nSpace, nTab;
  nSpace = 0;
  nTab = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      nSpace++;
      if (nSpace == 4) {
        nTab++;
        nSpace = 0;
      }
    } else {
      putchar_repeat('\t', nTab);
      putchar_repeat(' ', nSpace);
      putchar(c);
      nSpace = 0;
      nTab = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e87(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11d7 <main+0xa7>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    11a1 <main+0x71>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jne    119c <main+0x6c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    11d2 <main+0xa2>
mov    -0x10(%rbp),%esi
mov    $0x9,%edi
call   1050 <putchar_repeat@plt>
mov    -0xc(%rbp),%esi
mov    $0x20,%edi
call   1050 <putchar_repeat@plt>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e9f(%rip),%r12
cmp    (%r12),%al
jne    115a <main+0x2a>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
xor    %r14d,%r14d
xor    %ebp,%ebp
jmp    11a5 <main+0x75>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x9,%edi
mov    %r14d,%esi
call   1050 <putchar_repeat@plt>
mov    $0x20,%edi
mov    %ebp,%esi
call   1050 <putchar_repeat@plt>
movsbl %bl,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r12),%al
je     114f <main+0x1f>
cmp    $0x20,%bl
jne    1170 <main+0x40>
add    $0x1,%ebp
xor    %eax,%eax
cmp    $0x4,%ebp
sete   %al
cmove  %r15d,%ebp
add    %eax,%r14d
jmp    1196 <main+0x66>

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %32, %0
%7 = call signext i8 (...) @getchar()
store i8 %7, i8* %2
%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 %33
12: ; preds = %6
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 32
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 4
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
store i32 0, i32* %4
br label %24
24: ; preds = %21, %16
br label %32
25: ; preds = %12
%26 = load i32, i32* %5
%27 = call i32 @putchar_repeat(i8 signext 9, i32 %26)
%28 = load i32, i32* %4
%29 = call i32 @putchar_repeat(i8 signext 32, i32 %28)
%30 = load i8, i8* %2
%31 = call i32 @putchar(i8 signext %30)
store i32 0, i32* %4
store i32 0, i32* %5
br label %32
32: ; preds = %25, %24
br label %6
33: ; preds = %6
ret i32 0
}

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