#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, pos = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\t') {
      while (pos <= 5 - 1) {
        putchar(' ');
        pos++;
      }
      pos = 0;
    } else {
      putchar(c);
      if (c == '\n')
        pos = 0;
      else
        pos = (pos + 1) % 5;
    }
  }
  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     11c5 <main+0xa5>
cmpl   $0x9,-0x8(%rbp)
jne    118c <main+0x6c>
jmp    115e <main+0x3e>
cmpl   $0x4,-0xc(%rbp)
jg     1180 <main+0x60>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115e <main+0x3e>
movl   $0x0,-0xc(%rbp)
jmp    11c0 <main+0xa0>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
cmpl   $0xa,-0x8(%rbp)
jne    11aa <main+0x8a>
movl   $0x0,-0xc(%rbp)
jmp    11bb <main+0x9b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
jmp    11c0 <main+0xa0>
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    %ebp,%ebp
jmp    1161 <main+0x41>
nopl   (%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    %r15d,%ebp
cmp    (%r14),%eax
je     113a <main+0x1a>
cmp    $0x9,%ebx
jne    1190 <main+0x70>
add    $0xfffffffb,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
inc    %ebp
jne    1170 <main+0x50>
xor    %r15d,%r15d
jmp    1150 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %r15d,%r15d
cmp    $0xa,%ebx
je     1150 <main+0x30>
add    $0x1,%ebp
movslq %ebp,%r15
imul   $0x66666667,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r15d
jmp    1150 <main+0x30>

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 = %31, %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 %32
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 9
br i1 %10, label %11, label %20
11: ; preds = %8
br label %12
12: ; preds = %15, %11
%13 = load i32, i32* %3
%14 = icmp sle i32 %13, 4
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = call i32 @putchar(i32 32)
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %12
19: ; preds = %12
store i32 0, i32* %3
br label %31
20: ; preds = %8
%21 = load i32, i32* %2
%22 = call i32 @putchar(i32 %21)
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 10
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 0, i32* %3
br label %30
26: ; preds = %20
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
%29 = srem i32 %28, 5
store i32 %29, i32* %3
br label %30
30: ; preds = %26, %25
br label %31
31: ; preds = %30, %19
br label %4
32: ; preds = %4
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 %24, label %4
4: ; preds = %0, %19
%5 = phi i32 [ %21, %19 ], [ %1, %0 ]
%6 = phi i32 [ %20, %19 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 9
br i1 %7, label %8, label %13
8: ; preds = %4, %8
%9 = phi i32 [ %11, %8 ], [ %6, %4 ]
%10 = tail call i32 @putchar(i32 32)
%11 = add nsw i32 %9, 1
%12 = icmp eq i32 %11, 5
br i1 %12, label %19, label %8
13: ; preds = %4
%14 = tail call i32 @putchar(i32 %5)
%15 = icmp eq i32 %5, 10
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = add nsw i32 %6, 1
%18 = srem i32 %17, 5
br label %19
19: ; preds = %8, %13, %16
%20 = phi i32 [ %18, %16 ], [ 0, %13 ], [ 0, %8 ]
%21 = tail call i32 (...) @getchar()
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %4
24: ; preds = %19, %0
ret i32 0
}