#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(void) {
  char ch;
  printf("Enter the character to be tested: ");
  scanf("%c", &ch);
  if (ch >= 'a' && ch <= 'z')
    printf("lowercase char\n");
  if (ch >= 'A' && ch <= 'Z')
    printf("uppercase char \n ");
  if (ch >= '0' && ch <= '9')
    printf("digit char\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1171 <main+0x51>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1171 <main+0x51>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1197 <main+0x77>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1197 <main+0x77>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     11bd <main+0x9d>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     11bd <main+0x9d>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x7(%rsp),%al
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     116a <main+0x3a>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
mov    0x7(%rsp),%al
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     1182 <main+0x52>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
mov    0x7(%rsp),%al
add    $0xd0,%al
cmp    $0x9,%al
ja     1194 <main+0x64>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Enter the character to be tested: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [16 x i8] c"lowercase char\0A\00"
@.str.3 = [18 x i8] c"uppercase char \0A \00"
@.str.4 = [12 x i8] c"digit char\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 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, 97
br i1 %7, label %8, label %14
8: ; preds = %0
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp sle i32 %10, 122
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %8, %0
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sge i32 %16, 65
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sle i32 %20, 90
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %18, %14
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp sge i32 %26, 48
br i1 %27, label %28, label %34
28: ; preds = %24
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = icmp sle i32 %30, 57
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %32, %28, %24
ret i32 0
}

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