#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 getchar();
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int main() {
  char ch = '#';
  while ('#' != (ch = getchar())) {
    if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) {
      ch = ch > 'Z' ? (ch -= ' ') : (ch += ' ');
      putchar(ch);
      puts("");
    } else
      puts("invaild !");
    getchar();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x23,-0x5(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
je     11fb <main+0xcb>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1177 <main+0x47>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jle    1191 <main+0x61>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     11e3 <main+0xb3>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     11e3 <main+0xb3>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jle    11b3 <main+0x83>
movsbl -0x5(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    %eax,-0xc(%rbp)
jmp    11c3 <main+0x93>
movsbl -0x5(%rbp),%eax
add    $0x20,%eax
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
lea    0xe30(%rip),%rdi
call   1040 <puts@plt>
jmp    11ef <main+0xbf>
lea    0xe16(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
jmp    1143 <main+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x23,%al
jne    1140 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret
lea    0xeb9(%rip),%rbx
jmp    116a <main+0x3a>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x23,%al
je     113c <main+0xc>
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x19,%cl
ja     1150 <main+0x20>
cmp    $0x5b,%al
setb   %cl
shl    $0x6,%cl
add    %al,%cl
add    $0xe0,%cl
movsbl %cl,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1158 <main+0x28>

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

LLVM IR (-O2):
@.str.1 = [10 x i8] c"invaild !\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = icmp eq i8 %1, 35
br i1 %2, label %20, label %3
3: ; preds = %0, %16
%4 = phi i8 [ %18, %16 ], [ %1, %0 ]
%5 = and i8 %4, -33
%6 = add i8 %5, -65
%7 = icmp ult i8 %6, 26
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = icmp ugt i8 %4, 90
%10 = select i1 %9, i8 -32, i8 32
%11 = add i8 %10, %4
%12 = tail call i32 @putchar(i8 signext %11)
%13 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
br label %16
14: ; preds = %3
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %8
%17 = tail call signext i8 (...) @getchar()
%18 = tail call signext i8 (...) @getchar()
%19 = icmp eq i8 %18, 35
br i1 %19, label %20, label %3
20: ; preds = %16, %0
ret i32 0
}