#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(void) {
  char c;
  int stat = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\n' || c == '\t') {
      stat = 0;
      printf("%c", c);
    } else if (stat == 0) {
      stat = 1;
      printf("%c", c >= 'a' && c <= 'z' ? c - 32 : c);
    } else {
      printf("%c", c);
    }
  }
  printf("\n");
  return 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   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e9e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     120d <main+0xed>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     117c <main+0x5c>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     117c <main+0x5c>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    119a <main+0x7a>
movl   $0x0,-0xc(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1208 <main+0xe8>
cmpl   $0x0,-0xc(%rbp)
jne    11f1 <main+0xd1>
movl   $0x1,-0xc(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     11d4 <main+0xb4>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     11d4 <main+0xb4>
movsbl -0x5(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x10(%rbp)
jmp    11db <main+0xbb>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1203 <main+0xe3>
movsbl -0x5(%rbp),%esi
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1208 <main+0xe8>
jmp    1136 <main+0x16>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%rbx
cmp    (%rbx),%al
jne    1147 <main+0x27>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ecx,%ecx
jmp    1182 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%ebp
test   %ecx,%ecx
je     1196 <main+0x76>
nopl   0x0(%rax)
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebp,%ecx
cmp    (%rbx),%al
je     1136 <main+0x16>
movsbl %al,%edi
cmp    $0x20,%al
ja     1160 <main+0x40>
xor    %ebp,%ebp
movzbl %al,%edx
bt     %rdx,%r14
jb     1170 <main+0x50>
jmp    1160 <main+0x40>
add    $0x9f,%al
lea    -0x20(%rdi),%ecx
cmp    $0x1a,%al
cmovae %edi,%ecx
mov    %ecx,%edi
jmp    1170 <main+0x50>

LLVM IR (-O0):
@EOF = global i8 0
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %52, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* @EOF
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %53
10: ; preds = %4
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 32
br i1 %13, label %22, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 10
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 9
br i1 %21, label %22, label %26
22: ; preds = %18, %14, %10
store i32 0, i32* %3
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %52
26: ; preds = %18
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %47
29: ; preds = %26
store i32 1, i32* %3
%30 = load i8, i8* %2
%31 = sext i8 %30 to i32
%32 = icmp sge i32 %31, 97
br i1 %32, label %33, label %41
33: ; preds = %29
%34 = load i8, i8* %2
%35 = sext i8 %34 to i32
%36 = icmp sle i32 %35, 122
br i1 %36, label %37, label %41
37: ; preds = %33
%38 = load i8, i8* %2
%39 = sext i8 %38 to i32
%40 = sub nsw i32 %39, 32
br label %44
41: ; preds = %33, %29
%42 = load i8, i8* %2
%43 = sext i8 %42 to i32
br label %44
44: ; preds = %41, %37
%45 = phi i32 [ %40, %37 ], [ %43, %41 ]
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %45)
br label %51
47: ; preds = %26
%48 = load i8, i8* %2
%49 = sext i8 %48 to i32
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %47, %44
br label %52
52: ; preds = %51, %22
br label %4
53: ; preds = %4
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %22, label %4
4: ; preds = %0, %15
%5 = phi i8 [ %19, %15 ], [ %1, %0 ]
%6 = phi i32 [ %17, %15 ], [ 0, %0 ]
%7 = sext i8 %5 to i32
switch i8 %5, label %8 [
i8 32, label %15
i8 10, label %15
i8 9, label %15
]
8: ; preds = %4
%9 = icmp eq i32 %6, 0
br i1 %9, label %10, label %15
10: ; preds = %8
%11 = add i8 %5, -97
%12 = icmp ult i8 %11, 26
%13 = add nsw i32 %7, -32
%14 = select i1 %12, i32 %13, i32 %7
br label %15
15: ; preds = %8, %4, %4, %4, %10
%16 = phi i32 [ %14, %10 ], [ %7, %4 ], [ %7, %4 ], [ %7, %4 ], [ %7, %8 ]
%17 = phi i32 [ 1, %10 ], [ 0, %4 ], [ 0, %4 ], [ 0, %4 ], [ 1, %8 ]
%18 = tail call i32 @putchar(i32 %16)
%19 = tail call signext i8 (...) @getchar()
%20 = load i8, i8* @EOF
%21 = icmp eq i8 %19, %20
br i1 %21, label %22, label %4
22: ; preds = %15, %0
%23 = tail call i32 @putchar(i32 10)
ret i32 0
}