#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(void) {
  int c, nb, pos;
  nb = 0;
  pos = 1;
  while ((c = getchar()) != EOF) {
    if (c == '\t') {
      nb = 5 - (pos - 1) % 5;
      while (nb > 0) {
        putchar(' ');
        pos++;
        nb--;
      }
    } else if (c == '\n') {
      putchar(c);
      pos = 1;
    } else {
      putchar(c);
      pos++;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     11e1 <main+0xc1>
cmpl   $0x9,-0x8(%rbp)
jne    11a8 <main+0x88>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    $0x5,%eax
sub    %edx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11a3 <main+0x83>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1178 <main+0x58>
jmp    11dc <main+0xbc>
cmpl   $0xa,-0x8(%rbp)
jne    11c6 <main+0xa6>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x1,-0x10(%rbp)
jmp    11d7 <main+0xb7>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11dc <main+0xbc>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%eax
jne    113e <main+0x1e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x1,%ebx
jmp    1166 <main+0x46>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     1137 <main+0x17>
cmp    $0xa,%eax
je     11c0 <main+0xa0>
cmp    $0x9,%eax
jne    1150 <main+0x30>
lea    -0x1(%rbx),%eax
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ebp
sub    %eax,%ebp
add    $0x6,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     11a0 <main+0x80>
jmp    115a <main+0x3a>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebx
jmp    115a <main+0x3a>

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