#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 a character: ");
  scanf("%c", &ch);
  switch (ch) {
  case '+':
    printf("You typed a plus sign.\n");
    break;
  case '-':
    printf("You typed a minus sign.\n");
    break;
  case '0':
  case '1':
  case '2':
  case '3':
  case '4':
  case '5':
  case '6':
  case '7':
  case '8':
  case '9':
    printf("You typed a digit.\n");
    break;
  case 'A':
  case 'B':
  case 'C':
  case 'D':
  case 'E':
  case 'F':
  case 'G':
  case 'H':
  case 'I':
  case 'J':
  case 'K':
  case 'L':
  case 'M':
  case 'N':
  case 'O':
  case 'P':
  case 'Q':
  case 'R':
  case 'S':
  case 'T':
  case 'U':
  case 'V':
  case 'W':
  case 'X':
  case 'Y':
  case 'Z':
    printf("You typed an uppercase letter.\n");
    printf("The letter was %c.\n", ch);
    break;
  default:
    printf("You typed something else.\n");
    break;
  }
  if (ch == '+')
    printf("You typed a plus sign.\n");
  else if (ch == '-')
    printf("You typed a minus sign.\n");
  else if (ch >= '0' && ch <= '9')
    printf("You typed a digit.\n");
  else if (ch >= 'A' && ch <= 'Z') {
    printf("You typed an uppercase letter.\n");
    printf("The letter was %c.\n", ch);
  } else
    printf("You typed something else.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf8a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf90(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffffd5,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x2f,%eax
ja     11d5 <main+0xb5>
mov    -0x10(%rbp),%rax
lea    0xe92(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xc3>
lea    0xf5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xc3>
lea    0xf64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xc3>
lea    0xf65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x5(%rbp),%esi
lea    0xf73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xc3>
lea    0xf74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
jne    1203 <main+0xe3>
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ac <main+0x18c>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
jne    1223 <main+0x103>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a7 <main+0x187>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1250 <main+0x130>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1250 <main+0x130>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a2 <main+0x182>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     128f <main+0x16f>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     128f <main+0x16f>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x5(%rbp),%esi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    129d <main+0x17d>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a2 <main+0x182>
jmp    12a7 <main+0x187>
jmp    12ac <main+0x18c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%eax
lea    -0x41(%rax),%ecx
cmp    $0x1a,%ecx
jae    117e <main+0x4e>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
movsbl 0x7(%rsp),%esi
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1192 <main+0x62>
lea    -0x30(%rax),%ecx
cmp    $0xa,%ecx
jae    11f8 <main+0xc8>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
mov    0x7(%rsp),%al
cmp    $0x2d,%al
je     11a7 <main+0x77>
cmp    $0x2b,%al
jne    11b0 <main+0x80>
lea    0xed0(%rip),%rdi
jmp    11ef <main+0xbf>
lea    0xeaf(%rip),%rdi
jmp    11ef <main+0xbf>
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     11c1 <main+0x91>
lea    0xe8b(%rip),%rdi
jmp    11ef <main+0xbf>
add    $0xbf,%al
cmp    $0x19,%al
ja     11e8 <main+0xb8>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
movsbl 0x7(%rsp),%esi
lea    0xe38(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f4 <main+0xc4>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
cmp    $0x2d,%eax
je     120b <main+0xdb>
cmp    $0x2b,%eax
jne    1217 <main+0xe7>
lea    0xe6c(%rip),%rdi
jmp    118d <main+0x5d>
lea    0xe4b(%rip),%rdi
jmp    118d <main+0x5d>
lea    0xe6e(%rip),%rdi
jmp    118d <main+0x5d>

LLVM IR (-O0):
@.str = [20 x i8] c"Enter a character: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [24 x i8] c"You typed a plus sign.\0A\00"
@.str.3 = [25 x i8] c"You typed a minus sign.\0A\00"
@.str.4 = [20 x i8] c"You typed a digit.\0A\00"
@.str.5 = [32 x i8] c"You typed an uppercase letter.\0A\00"
@.str.6 = [20 x i8] c"The letter was %c.\0A\00"
@.str.7 = [27 x i8] c"You typed something else.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 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
switch i32 %6, label %18 [
i32 43, label %7
i32 45, label %9
i32 48, label %11
i32 49, label %11
i32 50, label %11
i32 51, label %11
i32 52, label %11
i32 53, label %11
i32 54, label %11
i32 55, label %11
i32 56, label %11
i32 57, label %11
i32 65, label %13
i32 66, label %13
i32 67, label %13
i32 68, label %13
i32 69, label %13
i32 70, label %13
i32 71, label %13
i32 72, label %13
i32 73, label %13
i32 74, label %13
i32 75, label %13
i32 76, label %13
i32 77, label %13
i32 78, label %13
i32 79, label %13
i32 80, label %13
i32 81, label %13
i32 82, label %13
i32 83, label %13
i32 84, label %13
i32 85, label %13
i32 86, label %13
i32 87, label %13
i32 88, label %13
i32 89, label %13
i32 90, label %13
]
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %20
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %20
11: ; preds = %0, %0, %0, %0, %0, %0, %0, %0, %0, %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %20
13: ; preds = %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %16)
br label %20
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
br label %20
20: ; preds = %18, %13, %11, %9, %7
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 43
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %60
26: ; preds = %20
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 45
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %59
32: ; preds = %26
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
%35 = icmp sge i32 %34, 48
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = load i8, i8* %2
%38 = sext i8 %37 to i32
%39 = icmp sle i32 %38, 57
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %58
42: ; preds = %36, %32
%43 = load i8, i8* %2
%44 = sext i8 %43 to i32
%45 = icmp sge i32 %44, 65
br i1 %45, label %46, label %55
46: ; preds = %42
%47 = load i8, i8* %2
%48 = sext i8 %47 to i32
%49 = icmp sle i32 %48, 90
br i1 %49, label %50, label %55
50: ; preds = %46
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%52 = load i8, i8* %2
%53 = sext i8 %52 to i32
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %53)
br label %57
55: ; preds = %46, %42
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
br label %57
57: ; preds = %55, %50
br label %58
58: ; preds = %57, %40
br label %59
59: ; preds = %58, %30
br label %60
60: ; preds = %59, %24
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter a character: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.6 = [20 x i8] c"The letter was %c.\0A\00"
@str.9 = [31 x i8] c"You typed an uppercase letter.\00"
@str.13 = [19 x i8] c"You typed a digit.\00"
@str.14 = [24 x i8] c"You typed a minus sign.\00"
@str.15 = [23 x i8] c"You typed a plus sign.\00"
@str.16 = [26 x i8] c"You typed something else.\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 = sext i8 %4 to i32
switch i32 %5, label %17 [
i32 43, label %6
i32 45, label %8
i32 48, label %10
i32 49, label %10
i32 50, label %10
i32 51, label %10
i32 52, label %10
i32 53, label %10
i32 54, label %10
i32 55, label %10
i32 56, label %10
i32 57, label %10
i32 65, label %12
i32 66, label %12
i32 67, label %12
i32 68, label %12
i32 69, label %12
i32 70, label %12
i32 71, label %12
i32 72, label %12
i32 73, label %12
i32 74, label %12
i32 75, label %12
i32 76, label %12
i32 77, label %12
i32 78, label %12
i32 79, label %12
i32 80, label %12
i32 81, label %12
i32 82, label %12
i32 83, label %12
i32 84, label %12
i32 85, label %12
i32 86, label %12
i32 87, label %12
i32 88, label %12
i32 89, label %12
i32 90, label %12
]
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
br label %19
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0))
br label %19
10: ; preds = %0, %0, %0, %0, %0, %0, %0, %0, %0, %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
br label %19
12: ; preds = %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0, %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.9, i64 0, i64 0))
%14 = load i8, i8* %1
%15 = sext i8 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %15)
br label %19
17: ; preds = %0
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.16, i64 0, i64 0))
br label %19
19: ; preds = %17, %12, %10, %8, %6
%20 = load i8, i8* %1
switch i8 %20, label %25 [
i8 43, label %21
i8 45, label %23
]
21: ; preds = %19
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
br label %40
23: ; preds = %19
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0))
br label %40
25: ; preds = %19
%26 = add i8 %20, -48
%27 = icmp ult i8 %26, 10
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
br label %40
30: ; preds = %25
%31 = add i8 %20, -65
%32 = icmp ult i8 %31, 26
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.9, i64 0, i64 0))
%35 = load i8, i8* %1
%36 = sext i8 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %36)
br label %40
38: ; preds = %30
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.16, i64 0, i64 0))
br label %40
40: ; preds = %23, %33, %38, %28, %21
ret i32 0
}