#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();
scalar_t__ isdigit(int);
int /*<<< orphan*/ putchar(int);
int main() {
  int c, i, sum;
  sum = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\n')
      putchar(c);
    else if (c == '!')
      putchar('\n');
    else if (isdigit(c))
      sum += (c - '0');
    else {
      for (i = 0; i < sum; i++) {
        if (c == 'b')
          putchar(' ');
        else
          putchar(c);
      }
      sum = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e91(%rip),%rcx
cmp    (%rcx),%eax
je     120f <main+0xdf>
cmpl   $0xa,-0x8(%rbp)
jne    1176 <main+0x46>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    120a <main+0xda>
cmpl   $0x21,-0x8(%rbp)
jne    118f <main+0x5f>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1205 <main+0xd5>
mov    -0x8(%rbp),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     11b2 <main+0x82>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1200 <main+0xd0>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f9 <main+0xc9>
cmpl   $0x62,-0x8(%rbp)
jne    11de <main+0xae>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    11e6 <main+0xb6>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11eb <main+0xbb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b9 <main+0x89>
movl   $0x0,-0x10(%rbp)
jmp    1205 <main+0xd5>
jmp    120a <main+0xda>
jmp    1146 <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   1050 <getchar@plt>
mov    0x2ea3(%rip),%r14
cmp    (%r14),%eax
jne    1157 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
mov    $0x20,%r15d
xor    %ebp,%ebp
jmp    1188 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     114a <main+0x1a>
cmp    $0x21,%ebx
je     1170 <main+0x40>
cmp    $0xa,%ebx
je     1170 <main+0x40>
mov    %ebx,%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     11a5 <main+0x75>
add    %ebx,%ebp
add    $0xffffffd0,%ebp
jmp    117a <main+0x4a>
test   %ebp,%ebp
jle    11bc <main+0x8c>
cmp    $0x62,%ebx
cmove  %r15d,%ebx
mov    %ebx,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x80>
xor    %ebp,%ebp
jmp    117a <main+0x4a>

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