#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, column = 0;
  while ((c = getchar()) != EOF) {
    switch (c) {
    case '\n':
      putchar(c);
      column = 0;
      break;
    case '\t':
      do
        putchar(' ');
      while (++column % 4 == 0);
      break;
    default:
      putchar(c);
      ++column;
    }
    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>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x9,%eax
je     1188 <main+0x68>
jmp    1163 <main+0x43>
mov    -0x10(%rbp),%eax
sub    $0xa,%eax
jne    11b6 <main+0x96>
jmp    1174 <main+0x54>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    11c7 <main+0xa7>
jmp    118d <main+0x6d>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     118d <main+0x6d>
jmp    11c7 <main+0xa7>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb9(%rip),%rcx
cmp    (%rcx),%eax
je     1143 <main+0x23>
cmp    $0x9,%eax
mov    $0x20,%edi
cmovne %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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 %8, label %4
4: ; preds = %0
%5 = icmp eq i32 %1, 9
%6 = select i1 %5, i32 32, i32 %1
%7 = tail call i32 @putchar(i32 %6)
br label %8
8: ; preds = %4, %0
ret i32 0
}