#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 main(void) {
  char c;
  int count;
  count = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\n')
      count = 0;
    else if (c != '\t')
      ++count;
    if (c == '\t') {
      for (; count < 4; ++count)
        putchar(' ');
    } else {
      putchar(c);
    }
    count %= 4;
  }
  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    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e9e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11de <main+0xbe>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    116e <main+0x4e>
movl   $0x0,-0xc(%rbp)
jmp    1189 <main+0x69>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
je     1184 <main+0x64>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1189 <main+0x69>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    11c2 <main+0xa2>
jmp    119b <main+0x7b>
cmpl   $0x4,-0xc(%rbp)
jge    11bd <main+0x9d>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119b <main+0x7b>
jmp    11cb <main+0xab>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%al
jne    1141 <main+0x21>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %ebx,%ebx
jmp    1174 <main+0x54>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
movsbl %al,%edi
call   1030 <putchar@plt>
lea    0x3(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffffc,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%al
je     1137 <main+0x17>
cmp    $0xa,%al
je     11a0 <main+0x80>
cmp    $0x9,%al
jne    1150 <main+0x30>
add    $0xfffffffc,%ebx
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
inc    %ebx
jne    1180 <main+0x60>
mov    $0x4,%ebx
jmp    115b <main+0x3b>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebx,%ebx
jmp    1153 <main+0x33>

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