#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 *, ...);
int main(int argc, char **argv) {
  int iBlankFlag = 0;
  char cChar = 0;
  printf("Please input some character:");
  cChar = getchar();
  while (cChar != EOF) {
    if (cChar == ' ') {
      if (0 == iBlankFlag) {
        iBlankFlag = 1;
        printf("%c", cChar);
      }
    } else {
      iBlankFlag = 0;
      printf("%c", cChar);
    }
    cChar = getchar();
  }
  return 0;
}


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)
movl   $0x0,-0x14(%rbp)
movb   $0x0,-0x15(%rbp)
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
mov    0x2e84(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11cd <main+0xad>
movsbl -0x15(%rbp),%eax
cmp    $0x20,%eax
jne    11a5 <main+0x85>
xor    %eax,%eax
cmp    -0x14(%rbp),%eax
jne    11a0 <main+0x80>
movl   $0x1,-0x14(%rbp)
movsbl -0x15(%rbp),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11be <main+0x9e>
movl   $0x0,-0x14(%rbp)
movsbl -0x15(%rbp),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x15(%rbp)
jmp    1159 <main+0x39>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e99(%rip),%rbx
cmp    (%rbx),%al
jne    115c <main+0x2c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %ecx,%ecx
jmp    1177 <main+0x47>
movsbl %al,%edi
xor    %ebp,%ebp
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %ebp,%ecx
cmp    (%rbx),%al
je     1153 <main+0x23>
cmp    $0x20,%al
jne    1160 <main+0x30>
mov    $0x1,%ebp
test   %ecx,%ecx
jne    116a <main+0x3a>
mov    $0x20,%edi
jmp    1165 <main+0x35>

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

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