#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*/ printf(char *, ...);
int main(void) {
  int c = 0;
  int o = 1;
  while (1) {
    c = getchar();
    if (c == EOF)
      return (0);
    if (c == '\0')
      printf(" ");
    else if (o)
      printf("%c", c);
    if (c == 'K')
      o = 0;
    if (c == 'Z')
      o = 0;
    if (c == 'D')
      o = 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e97(%rip),%rcx
cmp    (%rcx),%eax
jne    1161 <main+0x41>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
cmpl   $0x0,-0x8(%rbp)
jne    117e <main+0x5e>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119e <main+0x7e>
cmpl   $0x0,-0xc(%rbp)
je     1199 <main+0x79>
mov    -0x8(%rbp),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119e <main+0x7e>
cmpl   $0x4b,-0x8(%rbp)
jne    11af <main+0x8f>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5a,-0x8(%rbp)
jne    11c0 <main+0xa0>
movl   $0x0,-0xc(%rbp)
cmpl   $0x44,-0x8(%rbp)
jne    11d1 <main+0xb1>
movl   $0x0,-0xc(%rbp)
jmp    113d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb0(%rip),%r14
cmp    (%r14),%eax
jne    114a <main+0x2a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
mov    $0x1,%ebp
jmp    118d <main+0x6d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    $0x4b,%ebx
cmove  %r15d,%ebp
cmp    $0x5a,%ebx
cmove  %r15d,%ebp
cmp    $0x44,%ebx
cmove  %r15d,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     113d <main+0x1d>
test   %ebx,%ebx
je     1160 <main+0x40>
mov    %ebx,%edi
test   %ebp,%ebp
jne    1165 <main+0x45>
jmp    116a <main+0x4a>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [2 x i8] c" \00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %0, %34
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %4
ret i32 0
10: ; preds = %4
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %22
15: ; preds = %10
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %15
br label %22
22: ; preds = %21, %13
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 75
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 0, i32* %3
br label %26
26: ; preds = %25, %22
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 90
br i1 %28, label %29, label %30
29: ; preds = %26
store i32 0, i32* %3
br label %30
30: ; preds = %29, %26
%31 = load i32, i32* %2
%32 = icmp eq i32 %31, 68
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 0, i32* %3
br label %34
34: ; preds = %33, %30
br label %4
}

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 %4, label %5
4: ; preds = %14, %0
ret i32 0
5: ; preds = %0, %14
%6 = phi i32 [ %21, %14 ], [ %1, %0 ]
%7 = phi i32 [ %20, %14 ], [ 1, %0 ]
%8 = icmp eq i32 %6, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = icmp eq i32 %7, 0
br i1 %10, label %14, label %11
11: ; preds = %9, %5
%12 = phi i32 [ 32, %5 ], [ %6, %9 ]
%13 = tail call i32 @putchar(i32 %12)
br label %14
14: ; preds = %11, %9
%15 = icmp eq i32 %6, 75
%16 = icmp eq i32 %6, 90
%17 = or i1 %16, %15
%18 = icmp eq i32 %6, 68
%19 = or i1 %18, %17
%20 = select i1 %19, i32 0, i32 %7
%21 = tail call i32 (...) @getchar()
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %21, %22
br i1 %23, label %4, label %5
}