#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 EOF;
char getchar();
int /*<<< orphan*/ printf(char *, char);
int main(int argc, char **argv) {
  char c;
  short int x = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      if (x) {
        continue;
      } else {
        x = 1;
      }
    } else {
      x = 0;
    }
    printf("%c", c);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movw   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e98(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     119e <main+0x7e>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    1183 <main+0x63>
cmpw   $0x0,-0x14(%rbp)
je     1178 <main+0x58>
jmp    113c <main+0x1c>
movw   $0x1,-0x14(%rbp)
jmp    1189 <main+0x69>
movw   $0x0,-0x14(%rbp)
lea    0xe70(%rip),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <printf@plt>
jmp    113c <main+0x1c>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%r15
cmp    (%r15),%al
jne    1147 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xeb2(%rip),%r14
xor    %ebx,%ebx
jmp    117b <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ebp,%ebp
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %ebp,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%al
je     113a <main+0x1a>
cmp    $0x20,%al
jne    1160 <main+0x40>
mov    $0x1,%bp
test   %bx,%bx
mov    $0x1,%bx
jne    116f <main+0x4f>
jmp    1162 <main+0x42>

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

LLVM IR (-O2):
@EOF = global i8 0
@.str = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call signext i8 (...) @getchar()
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %20, label %6
6: ; preds = %2, %15
%7 = phi i8 [ %17, %15 ], [ %3, %2 ]
%8 = phi i16 [ %16, %15 ], [ 0, %2 ]
%9 = icmp eq i8 %7, 32
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = icmp eq i16 %8, 0
br i1 %11, label %12, label %15
12: ; preds = %6, %10
%13 = phi i16 [ 1, %10 ], [ 0, %6 ]
%14 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %7)
br label %15
15: ; preds = %12, %10
%16 = phi i16 [ 1, %10 ], [ %13, %12 ]
%17 = tail call signext i8 (...) @getchar()
%18 = load i8, i8* @EOF
%19 = icmp eq i8 %17, %18
br i1 %19, label %20, label %6
20: ; preds = %15, %2
ret i32 0
}