#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 main() {
  int c;
  int nb = 0;
  int nt = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      nb++;
      continue;
    }
    if (c == '\t') {
      nb += 4;
      continue;
    }
    if (nb == 0) {
      putchar(c);
    } else {
      nt = nb / 4;
      nb = nb % 4;
      while (nt != 0) {
        putchar('\t');
        nt--;
      }
      while (nb != 0) {
        putchar(' ');
        nb--;
      }
      putchar(c);
    }
  }
  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    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     120f <main+0xef>
cmpl   $0x20,-0x8(%rbp)
jne    116e <main+0x4e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
cmpl   $0x9,-0x8(%rbp)
jne    1186 <main+0x66>
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
cmpl   $0x0,-0xc(%rbp)
jne    119d <main+0x7d>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    120a <main+0xea>
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11db <main+0xbb>
mov    $0x9,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11b9 <main+0x99>
jmp    11e0 <main+0xc0>
cmpl   $0x0,-0xc(%rbp)
je     1202 <main+0xe2>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11e0 <main+0xc0>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%r14
cmp    (%r14),%eax
jne    1147 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r15d
xor    %ebx,%ebx
jmp    1162 <main+0x42>
xchg   %ax,%ax
add    $0x4,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%r15d
cmp    (%r14),%eax
je     113a <main+0x1a>
cmp    $0x9,%r15d
je     1150 <main+0x30>
cmp    $0x20,%r15d
jne    1180 <main+0x60>
add    $0x1,%ebx
jmp    1153 <main+0x33>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %ebx,%ebx
je     11cf <main+0xaf>
lea    0x3(%rbx),%eax
test   %ebx,%ebx
mov    %ebx,%ebp
cmovs  %eax,%ebp
mov    %ebp,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%ebx
cmp    $0x7,%eax
jb     11af <main+0x8f>
sar    $0x2,%ebp
nopl   (%rax)
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x80>
test   %ebx,%ebx
je     11cf <main+0xaf>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11c0 <main+0xa0>
mov    %r15d,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
jmp    1153 <main+0x33>

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 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %50, %18, %12, %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 %51
9: ; preds = %5
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 32
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %5
15: ; preds = %9
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 9
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 4
store i32 %20, i32* %3
br label %5
21: ; preds = %15
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %2
%26 = call i32 @putchar(i32 %25)
br label %50
27: ; preds = %21
%28 = load i32, i32* %3
%29 = sdiv i32 %28, 4
store i32 %29, i32* %4
%30 = load i32, i32* %3
%31 = srem i32 %30, 4
store i32 %31, i32* %3
br label %32
32: ; preds = %35, %27
%33 = load i32, i32* %4
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = call i32 @putchar(i32 9)
%37 = load i32, i32* %4
%38 = add nsw i32 %37, -1
store i32 %38, i32* %4
br label %32
39: ; preds = %32
br label %40
40: ; preds = %43, %39
%41 = load i32, i32* %3
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = call i32 @putchar(i32 32)
%45 = load i32, i32* %3
%46 = add nsw i32 %45, -1
store i32 %46, i32* %3
br label %40
47: ; preds = %40
%48 = load i32, i32* %2
%49 = call i32 @putchar(i32 %48)
br label %50
50: ; preds = %47, %24
br label %5
51: ; 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 %39, label %4
4: ; preds = %0, %9
%5 = phi i32 [ %11, %9 ], [ %1, %0 ]
%6 = phi i32 [ %10, %9 ], [ 0, %0 ]
switch i32 %5, label %16 [
i32 32, label %7
i32 9, label %14
]
7: ; preds = %4
%8 = add nsw i32 %6, 1
br label %9
9: ; preds = %18, %37, %7, %14
%10 = phi i32 [ %8, %7 ], [ %15, %14 ], [ 0, %37 ], [ 0, %18 ]
%11 = tail call i32 (...) @getchar()
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %39, label %4
14: ; preds = %4
%15 = add nsw i32 %6, 4
br label %9
16: ; preds = %4
%17 = icmp eq i32 %6, 0
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = tail call i32 @putchar(i32 %5)
br label %9
20: ; preds = %16
%21 = srem i32 %6, 4
%22 = sdiv i32 %6, 4
%23 = add i32 %6, 3
%24 = icmp ult i32 %23, 7
br i1 %24, label %25, label %27
25: ; preds = %27, %20
%26 = icmp eq i32 %21, 0
br i1 %26, label %37, label %32
27: ; preds = %20, %27
%28 = phi i32 [ %30, %27 ], [ %22, %20 ]
%29 = tail call i32 @putchar(i32 9)
%30 = add nsw i32 %28, -1
%31 = icmp eq i32 %30, 0
br i1 %31, label %25, label %27
32: ; preds = %25, %32
%33 = phi i32 [ %35, %32 ], [ %21, %25 ]
%34 = tail call i32 @putchar(i32 32)
%35 = add nsw i32 %33, -1
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %32
37: ; preds = %32, %25
%38 = tail call i32 @putchar(i32 %5)
br label %9
39: ; preds = %9, %0
ret i32 0
}