#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 getchar();
int /*<<< orphan*/ putchar(int);
int main() {
  while (1) {
    int c = getchar();
    if (c == -1 || c == 0)
      break;
    if (c >= 'A' && c <= 'Z') {
      c += 32;
    } else if (!(c < 'a' || c > 'z')) {
      c -= 32;
    }
    putchar(c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
je     114d <main+0x2d>
cmpl   $0x0,-0x8(%rbp)
jne    1152 <main+0x32>
jmp    11a3 <main+0x83>
cmpl   $0x41,-0x8(%rbp)
jl     1174 <main+0x54>
cmpl   $0x5a,-0x8(%rbp)
jg     1174 <main+0x54>
mov    -0x8(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    1196 <main+0x76>
cmpl   $0x61,-0x8(%rbp)
jl     1191 <main+0x71>
cmpl   $0x7a,-0x8(%rbp)
jg     1191 <main+0x71>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    1196 <main+0x76>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
lea    0x1(%rax),%ecx
cmp    $0x2,%ecx
jae    1166 <main+0x46>
xor    %eax,%eax
pop    %rcx
ret
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x7b(%rax),%ecx
lea    -0x20(%rax),%edx
cmp    $0xffffffe6,%ecx
cmovb  %eax,%edx
mov    %edx,%eax
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ecx
add    $0x1,%ecx
cmp    $0x1,%ecx
jbe    1130 <main+0x10>
lea    -0x41(%rax),%ecx
cmp    $0x19,%ecx
ja     1140 <main+0x20>
add    $0x20,%eax
jmp    114e <main+0x2e>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %30
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, -1
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7, %3
br label %33
11: ; preds = %7
%12 = load i32, i32* %2
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp sle i32 %15, 90
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 32
store i32 %19, i32* %2
br label %30
20: ; preds = %14, %11
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 97
br i1 %22, label %29, label %23
23: ; preds = %20
%24 = load i32, i32* %2
%25 = icmp sgt i32 %24, 122
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* %2
%28 = sub nsw i32 %27, 32
store i32 %28, i32* %2
br label %29
29: ; preds = %26, %23, %20
br label %30
30: ; preds = %29, %17
%31 = load i32, i32* %2
%32 = call i32 @putchar(i32 %31)
br label %3
33: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = add i32 %1, 1
%3 = icmp ult i32 %2, 2
br i1 %3, label %21, label %4
4: ; preds = %0, %15
%5 = phi i32 [ %18, %15 ], [ %1, %0 ]
%6 = add i32 %5, -65
%7 = icmp ult i32 %6, 26
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = add nuw nsw i32 %5, 32
br label %15
10: ; preds = %4
%11 = add i32 %5, -123
%12 = icmp ult i32 %11, -26
%13 = add nsw i32 %5, -32
%14 = select i1 %12, i32 %5, i32 %13
br label %15
15: ; preds = %8, %10
%16 = phi i32 [ %9, %8 ], [ %14, %10 ]
%17 = tail call i32 @putchar(i32 %16)
%18 = tail call i32 (...) @getchar()
%19 = add i32 %18, 1
%20 = icmp ult i32 %19, 2
br i1 %20, label %21, label %4
21: ; preds = %15, %0
ret i32 0
}