#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char c;
  int x = 0;
  int y;
  int t;
  int s;
  int space = 0;
  while ((c = getchar()) != '~') {
    if (c == ' ') {
      space = 1;
      ++x;
    } else if (c == '\t') {
      space = 1;
      x += 5;
    } else {
      if (space == 1) {
        t = x / 5;
        s = x % 5;
        if (t > 0)
          for (y = 0; y < t; y++)
            printf("*****");
        if (s > 0)
          for (y = 0; y < s; y++)
            printf("-");
        x = 0;
        space = 0;
      }
      if (space == 0) {
        printf("%c", c);
        space = 0;
        x = 0;
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0x7e,%eax
je     1280 <main+0x160>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    1175 <main+0x55>
movl   $0x1,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    127b <main+0x15b>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    1197 <main+0x77>
movl   $0x1,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0xc(%rbp)
jmp    1276 <main+0x156>
cmpl   $0x1,-0x1c(%rbp)
jne    1247 <main+0x127>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11fb <main+0xdb>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f6 <main+0xd6>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ce <main+0xae>
jmp    11fb <main+0xdb>
cmpl   $0x0,-0x18(%rbp)
jle    1239 <main+0x119>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1234 <main+0x114>
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120c <main+0xec>
jmp    1239 <main+0x119>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1271 <main+0x151>
movsbl -0x5(%rbp),%esi
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    1276 <main+0x156>
jmp    127b <main+0x15b>
jmp    113d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xec1(%rip),%r14
jmp    1159 <main+0x29>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %r12b,%edi
call   1030 <putchar@plt>
xor    %r15d,%r15d
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x9,%al
je     1180 <main+0x50>
mov    %eax,%r12d
cmp    $0x20,%al
jne    1190 <main+0x60>
add    $0x1,%r15d
mov    $0x1,%bpl
jmp    115e <main+0x2e>
nopl   0x0(%rax)
add    $0x5,%r15d
mov    $0x1,%bpl
jmp    115e <main+0x2e>
nopl   0x0(%rax)
cmp    $0x7e,%r12b
je     1204 <main+0xd4>
test   $0x1,%bpl
je     1150 <main+0x20>
movslq %r15d,%rax
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x21,%rbx
add    %eax,%ebx
lea    (%rbx,%rbx,4),%eax
mov    %r15d,%ebp
sub    %eax,%ebp
cmp    $0x5,%r15d
jl     11df <main+0xaf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    11d0 <main+0xa0>
test   %ebp,%ebp
jle    1150 <main+0x20>
nopw   0x0(%rax,%rax,1)
mov    $0x2d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11f0 <main+0xc0>
jmp    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"*****\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %7
br label %8
8: ; preds = %71, %0
%9 = call signext i8 (...) @getchar()
store i8 %9, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 126
br i1 %11, label %12, label %72
12: ; preds = %8
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 32
br i1 %15, label %16, label %19
16: ; preds = %12
store i32 1, i32* %7
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %71
19: ; preds = %12
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 9
br i1 %22, label %23, label %26
23: ; preds = %19
store i32 1, i32* %7
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 5
store i32 %25, i32* %3
br label %70
26: ; preds = %19
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %62
29: ; preds = %26
%30 = load i32, i32* %3
%31 = sdiv i32 %30, 5
store i32 %31, i32* %5
%32 = load i32, i32* %3
%33 = srem i32 %32, 5
store i32 %33, i32* %6
%34 = load i32, i32* %5
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %47
36: ; preds = %29
store i32 0, i32* %4
br label %37
37: ; preds = %43, %36
%38 = load i32, i32* %4
%39 = load i32, i32* %5
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %46
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %43
43: ; preds = %41
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %37
46: ; preds = %37
br label %47
47: ; preds = %46, %29
%48 = load i32, i32* %6
%49 = icmp sgt i32 %48, 0
br i1 %49, label %50, label %61
50: ; preds = %47
store i32 0, i32* %4
br label %51
51: ; preds = %57, %50
%52 = load i32, i32* %4
%53 = load i32, i32* %6
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %60
55: ; preds = %51
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %57
57: ; preds = %55
%58 = load i32, i32* %4
%59 = add nsw i32 %58, 1
store i32 %59, i32* %4
br label %51
60: ; preds = %51
br label %61
61: ; preds = %60, %47
store i32 0, i32* %3
store i32 0, i32* %7
br label %62
62: ; preds = %61, %26
%63 = load i32, i32* %7
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %69
65: ; preds = %62
%66 = load i8, i8* %2
%67 = sext i8 %66 to i32
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %67)
store i32 0, i32* %7
store i32 0, i32* %3
br label %69
69: ; preds = %65, %62
br label %70
70: ; preds = %69, %23
br label %71
71: ; preds = %70, %16
br label %8
72: ; preds = %8
%73 = load i32, i32* %1
ret i32 %73
}

LLVM IR (-O2):
@.str = [6 x i8] c"*****\00"
define i32 @main() {
br label %1
1: ; preds = %10, %0
%2 = phi i32 [ 0, %0 ], [ %11, %10 ]
%3 = phi i1 [ false, %0 ], [ %12, %10 ]
%4 = tail call signext i8 (...) @getchar()
%5 = sext i8 %4 to i32
switch i8 %4, label %13 [
i8 126, label %32
i8 32, label %6
i8 9, label %8
]
6: ; preds = %1
%7 = add nsw i32 %2, 1
br label %10
8: ; preds = %1
%9 = add nsw i32 %2, 5
br label %10
10: ; preds = %8, %30, %6
%11 = phi i32 [ %7, %6 ], [ %9, %8 ], [ 0, %30 ]
%12 = phi i1 [ true, %6 ], [ true, %8 ], [ false, %30 ]
br label %1
13: ; preds = %1
br i1 %3, label %14, label %30
14: ; preds = %13
%15 = sdiv i32 %2, 5
%16 = srem i32 %2, 5
%17 = icmp sgt i32 %2, 4
br i1 %17, label %18, label %23
18: ; preds = %14, %18
%19 = phi i32 [ %21, %18 ], [ 0, %14 ]
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%21 = add nuw nsw i32 %19, 1
%22 = icmp eq i32 %21, %15
br i1 %22, label %23, label %18
23: ; preds = %18, %14
%24 = icmp sgt i32 %16, 0
br i1 %24, label %25, label %30
25: ; preds = %23, %25
%26 = phi i32 [ %28, %25 ], [ 0, %23 ]
%27 = tail call i32 @putchar(i32 45)
%28 = add nuw nsw i32 %26, 1
%29 = icmp eq i32 %28, %16
br i1 %29, label %30, label %25
30: ; preds = %25, %13, %23
%31 = tail call i32 @putchar(i32 %5)
br label %10
32: ; preds = %1
ret i32 0
}