#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char usrChar;
  char invChar;
  printf("Enter a character: ");
  scanf("%c", &usrChar);
  if (usrChar < 97)
    invChar = (int)usrChar + 32;
  else
    invChar = (int)usrChar - 32;
  printf("%c -> %c\n", usrChar, invChar);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jge    1169 <main+0x49>
movsbl -0x5(%rbp),%eax
add    $0x20,%eax
mov    %al,-0x6(%rbp)
jmp    1173 <main+0x53>
movsbl -0x5(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%esi
movsbl -0x6(%rbp),%edx
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
movsbl 0x7(%rsp),%esi
cmp    $0x61,%esi
setl   %al
shl    $0x6,%al
add    %sil,%al
add    $0xe0,%al
movsbl %al,%edx
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter a character: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [10 x i8] c"%c -> %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp slt i32 %7, 97
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = add nsw i32 %11, 32
%13 = trunc i32 %12 to i8
store i8 %13, i8* %3
br label %19
14: ; preds = %0
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = sub nsw i32 %16, 32
%18 = trunc i32 %17 to i8
store i8 %18, i8* %3
br label %19
19: ; preds = %14, %9
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %23)
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter a character: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [10 x i8] c"%c -> %c\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = icmp slt i8 %4, 97
%6 = select i1 %5, i8 32, i8 -32
%7 = add i8 %6, %4
%8 = sext i8 %4 to i32
%9 = sext i8 %7 to i32
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}