#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 /*<<< orphan*/ exit(int);
scalar_t__ fclose(int /*<<< orphan*/);
scalar_t__ ferror(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ n_spaces(int);
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main() {
  int c;
  int spacecount;
zeilenanfang:
  spacecount = 0;
looking_for_space:
  c = getchar();
  if (c == EOF) {
    n_spaces(spacecount);
    goto eof;
  }
  if (c == ' ') {
    spacecount++;
    goto looking_for_space;
  }
  if (c == '\t') {
    do {
      spacecount++;
    } while (!((spacecount % 8) == 0));
    goto looking_for_space;
  }
  if (c == '#') {
    spacecount = 0;
  }
  n_spaces(spacecount);
rest:
  putchar(c);
  if (c == 10)
    goto zeilenanfang;
  c = getchar();
  if (c == EOF) {
    goto eof;
  }
  goto rest;
eof:;
  if (ferror(stdin) || ferror(stdout) || fclose(stdout)) {
    exit(1);
  }
  exit(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   1070 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e56(%rip),%rcx
cmp    (%rcx),%eax
jne    119f <main+0x3f>
mov    -0xc(%rbp),%edi
call   1050 <n_spaces@plt>
jmp    1245 <main+0xe5>
cmpl   $0x20,-0x8(%rbp)
jne    11b7 <main+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <main+0x16>
cmpl   $0x9,-0x8(%rbp)
jne    11ef <main+0x8f>
jmp    11c6 <main+0x66>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
xor    $0xff,%al
test   $0x1,%al
jne    11c6 <main+0x66>
jmp    1176 <main+0x16>
cmpl   $0x23,-0x8(%rbp)
jne    1200 <main+0xa0>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <n_spaces@plt>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
cmpl   $0xa,-0x8(%rbp)
jne    121f <main+0xbf>
jmp    116f <main+0xf>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2dad(%rip),%rcx
cmp    (%rcx),%eax
jne    1240 <main+0xe0>
jmp    1245 <main+0xe5>
jmp    1208 <main+0xa8>
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
call   1040 <ferror@plt>
cmp    $0x0,%rax
jne    128d <main+0x12d>
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
call   1040 <ferror@plt>
cmp    $0x0,%rax
jne    128d <main+0x12d>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
call   1060 <fclose@plt>
cmp    $0x0,%rax
je     1297 <main+0x137>
mov    $0x1,%edi
call   1080 <exit@plt>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <getchar@plt>
mov    0x2e6c(%rip),%r14
cmp    (%r14),%eax
jne    11c3 <main+0x63>
mov    %ebx,%edi
call   1050 <n_spaces@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1040 <ferror@plt>
test   %rax,%rax
jne    11b9 <main+0x59>
mov    0x2e36(%rip),%rbx
mov    (%rbx),%edi
call   1040 <ferror@plt>
test   %rax,%rax
jne    11b9 <main+0x59>
mov    (%rbx),%edi
call   1060 <fclose@plt>
test   %rax,%rax
jne    11b9 <main+0x59>
xor    %edi,%edi
call   1080 <exit@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    %eax,%ebp
xor    %ebx,%ebx
jmp    11d6 <main+0x76>
nopl   0x0(%rax)
xor    %ebx,%ebx
cmp    %eax,%ebp
je     1179 <main+0x19>
cmp    $0x23,%ebp
je     11f0 <main+0x90>
cmp    $0x20,%ebp
je     1230 <main+0xd0>
cmp    $0x9,%ebp
jne    11f2 <main+0x92>
mov    %ebx,%eax
or     $0xfffffff8,%eax
sub    %eax,%ebx
jmp    1233 <main+0xd3>
xchg   %ax,%ax
xor    %ebx,%ebx
mov    %ebx,%edi
call   1050 <n_spaces@plt>
nopl   0x0(%rax)
mov    %ebp,%ebx
mov    %ebp,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %eax,%ebp
mov    (%r14),%eax
cmp    $0xa,%ebx
je     11d0 <main+0x70>
cmp    %eax,%ebp
jne    1200 <main+0xa0>
jmp    1180 <main+0x20>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebx
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %eax,%ebp
cmp    (%r14),%eax
jne    11d6 <main+0x76>
jmp    1179 <main+0x19>

LLVM IR (-O0):
@EOF = global i32 0
@stdin = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %44, %0
store i32 0, i32* %3
br label %5
5: ; preds = %31, %16, %4
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = load i32, i32* %3
%12 = call i32 @n_spaces(i32 %11)
br label %52
13: ; preds = %5
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 32
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %5
19: ; preds = %13
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 9
br i1 %21, label %22, label %32
22: ; preds = %19
br label %23
23: ; preds = %26, %22
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %26
26: ; preds = %23
%27 = load i32, i32* %3
%28 = srem i32 %27, 8
%29 = icmp eq i32 %28, 0
%30 = xor i1 %29, true
br i1 %30, label %23, label %31
31: ; preds = %26
br label %5
32: ; preds = %19
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 35
br i1 %34, label %35, label %36
35: ; preds = %32
store i32 0, i32* %3
br label %36
36: ; preds = %35, %32
%37 = load i32, i32* %3
%38 = call i32 @n_spaces(i32 %37)
br label %39
39: ; preds = %51, %36
%40 = load i32, i32* %2
%41 = call i32 @putchar(i32 %40)
%42 = load i32, i32* %2
%43 = icmp eq i32 %42, 10
br i1 %43, label %44, label %45
44: ; preds = %39
br label %4
45: ; preds = %39
%46 = call i32 (...) @getchar()
store i32 %46, i32* %2
%47 = load i32, i32* %2
%48 = load i32, i32* @EOF
%49 = icmp eq i32 %47, %48
br i1 %49, label %50, label %51
50: ; preds = %45
br label %52
51: ; preds = %45
br label %39
52: ; preds = %50, %10
%53 = load i32, i32* @stdin
%54 = call i64 @ferror(i32 %53)
%55 = icmp ne i64 %54, 0
br i1 %55, label %64, label %56
56: ; preds = %52
%57 = load i32, i32* @stdout
%58 = call i64 @ferror(i32 %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %64, label %60
60: ; preds = %56
%61 = load i32, i32* @stdout
%62 = call i64 @fclose(i32 %61)
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %60, %56, %52
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %60
%67 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@EOF = global i32 0
@stdin = global i32 0
@stdout = 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 %5, label %8
4: ; preds = %28
br i1 %34, label %5, label %21
5: ; preds = %4, %16, %0
%6 = phi i32 [ 0, %0 ], [ 0, %4 ], [ %17, %16 ]
%7 = tail call i32 @n_spaces(i32 %6)
br label %36
8: ; preds = %0, %21
%9 = phi i32 [ %22, %21 ], [ %1, %0 ]
%10 = phi i32 [ %23, %21 ], [ 0, %0 ]
switch i32 %9, label %25 [
i32 32, label %14
i32 9, label %11
i32 35, label %24
]
11: ; preds = %8
%12 = or i32 %10, -8
%13 = sub i32 %10, %12
br label %16
14: ; preds = %8
%15 = add nsw i32 %10, 1
br label %16
16: ; preds = %11, %14
%17 = phi i32 [ %15, %14 ], [ %13, %11 ]
%18 = tail call i32 (...) @getchar()
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %5, label %21
21: ; preds = %16, %4
%22 = phi i32 [ %18, %16 ], [ %32, %4 ]
%23 = phi i32 [ %17, %16 ], [ 0, %4 ]
br label %8
24: ; preds = %8
br label %25
25: ; preds = %8, %24
%26 = phi i32 [ 0, %24 ], [ %10, %8 ]
%27 = tail call i32 @n_spaces(i32 %26)
br label %28
28: ; preds = %35, %25
%29 = phi i32 [ %9, %25 ], [ %32, %35 ]
%30 = tail call i32 @putchar(i32 %29)
%31 = icmp eq i32 %29, 10
%32 = tail call i32 (...) @getchar()
%33 = load i32, i32* @EOF
%34 = icmp eq i32 %32, %33
br i1 %31, label %4, label %35
35: ; preds = %28
br i1 %34, label %36, label %28
36: ; preds = %35, %5
%37 = load i32, i32* @stdin
%38 = tail call i64 @ferror(i32 %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %48
40: ; preds = %36
%41 = load i32, i32* @stdout
%42 = tail call i64 @ferror(i32 %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %40
%45 = load i32, i32* @stdout
%46 = tail call i64 @fclose(i32 %45)
%47 = icmp eq i64 %46, 0
br i1 %47, label %50, label %48
48: ; preds = %44, %40, %36
%49 = tail call i32 @exit(i32 1)
unreachable
50: ; preds = %44
%51 = tail call i32 @exit(i32 0)
unreachable
}