#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, count = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\t') {
      short i;
      for (i = 0; i != 4 - count; ++i)
        putchar(' ');
      count = 0;
    } else {
      putchar(c);
      count = (count + 1) % 4;
      if (c == '\n')
        count = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     11ce <main+0xae>
cmpl   $0x9,-0x8(%rbp)
jne    119a <main+0x7a>
movw   $0x0,-0xe(%rbp)
movswl -0xe(%rbp),%eax
mov    $0x4,%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
je     118e <main+0x6e>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xe(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xe(%rbp)
jmp    115f <main+0x3f>
movl   $0x0,-0xc(%rbp)
jmp    11c9 <main+0xa9>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    11c4 <main+0xa4>
movl   $0x0,-0xc(%rbp)
jmp    11c9 <main+0xa9>
jmp    1136 <main+0x16>
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,%ebx
xor    %r15d,%r15d
jmp    1161 <main+0x41>
xchg   %ax,%ax
mov    %eax,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     113a <main+0x1a>
cmp    $0x9,%ebx
jne    11a0 <main+0x80>
mov    $0x4,%ebp
sub    %r15d,%ebp
mov    $0x1,%bx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
movswl %bx,%eax
add    $0x1,%ebx
cmp    %eax,%ebp
jne    1180 <main+0x60>
xor    %r15d,%r15d
jmp    1153 <main+0x33>
nopl   0x0(%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
cmp    $0xa,%ebx
je     1150 <main+0x30>
add    $0x1,%r15d
lea    0x3(%r15),%eax
test   %r15d,%r15d
cmovns %r15d,%eax
and    $0xfffffffc,%eax
sub    %eax,%r15d
mov    %r15d,%eax
jmp    1150 <main+0x30>

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