#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 ch;
  printf("Enter any character:\n");
  scanf("%c", &ch);
  if (ch >= 65 && ch <= 90 || ch >= 48 && ch <= 57)
    printf("%c\n", ch);
  else if (ch >= 97 && ch <= 122) {
    ch = ch - 32;
    printf("%c\n", ch);
  }
  return 0;
}


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    0xed2(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1167 <main+0x47>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jle    1181 <main+0x61>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1198 <main+0x78>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1198 <main+0x78>
movsbl -0x5(%rbp),%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d3 <main+0xb3>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     11ce <main+0xae>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     11ce <main+0xae>
movsbl -0x5(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d3 <main+0xb3>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x7(%rsp),%al
lea    -0x41(%rax),%ecx
cmp    $0x1a,%cl
jb     1170 <main+0x40>
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     1170 <main+0x40>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1181 <main+0x51>
add    $0xe0,%al
mov    %al,0x7(%rsp)
movzbl %al,%esi
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter any character:\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp sge i32 %6, 65
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp sle i32 %10, 90
br i1 %11, label %20, label %12
12: ; preds = %8, %0
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp sge i32 %14, 48
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 57
br i1 %19, label %20, label %24
20: ; preds = %16, %8
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %41
24: ; preds = %16, %12
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp sge i32 %26, 97
br i1 %27, label %28, label %40
28: ; preds = %24
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = icmp sle i32 %30, 122
br i1 %31, label %32, label %40
32: ; preds = %28
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 32
%36 = trunc i32 %35 to i8
store i8 %36, i8* %2
%37 = load i8, i8* %2
%38 = sext i8 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %32, %28, %24
br label %41
41: ; preds = %40, %20
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [4 x i8] c"%c\0A\00"
@str = [21 x i8] c"Enter any character:\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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 = add i8 %4, -65
%6 = icmp ult i8 %5, 26
%7 = add i8 %4, -48
%8 = icmp ult i8 %7, 10
%9 = or i1 %6, %8
br i1 %9, label %15, label %10
10: ; preds = %0
%11 = add i8 %4, -97
%12 = icmp ult i8 %11, 26
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = add nsw i8 %4, -32
store i8 %14, i8* %1
br label %15
15: ; preds = %0, %13
%16 = phi i8 [ %14, %13 ], [ %4, %0 ]
%17 = zext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %15, %10
ret i32 0
}