#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 */
scalar_t__ isdigit(char);
scalar_t__ islower(char);
scalar_t__ isupper(char);
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 (islower(ch))
    printf("lowercase char\n");
  if (isupper(ch))
    printf("uppercase char \n ");
  if (isdigit(ch))
    printf("digit char\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1070 <scanf@plt>
movsbl -0x5(%rbp),%edi
call   1040 <islower@plt>
cmp    $0x0,%rax
je     119a <main+0x4a>
lea    0xe91(%rip),%rdi
call   1050 <printf@plt>
movsbl -0x5(%rbp),%edi
call   1060 <isupper@plt>
cmp    $0x0,%rax
je     11b9 <main+0x69>
lea    0xe82(%rip),%rdi
call   1050 <printf@plt>
movsbl -0x5(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11d8 <main+0x88>
lea    0xe75(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1060 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1080 <scanf@plt>
movsbl 0x7(%rsp),%edi
call   1040 <islower@plt>
test   %rax,%rax
je     1199 <main+0x39>
lea    0xeaf(%rip),%rdi
call   1050 <puts@plt>
movsbl 0x7(%rsp),%edi
call   1070 <isupper@plt>
test   %rax,%rax
je     11b4 <main+0x54>
lea    0xe77(%rip),%rdi
call   1060 <printf@plt>
movsbl 0x7(%rsp),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     11cf <main+0x6f>
lea    0xe6e(%rip),%rdi
call   1050 <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 = call i64 @islower(i8 signext %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
%11 = load i8, i8* %2
%12 = call i64 @isupper(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %10
%17 = load i8, i8* %2
%18 = call i64 @isdigit(i8 signext %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
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 = call i64 @islower(i8 signext %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = load i8, i8* %1
%11 = call i64 @isupper(i8 signext %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
%16 = load i8, i8* %1
%17 = call i64 @isdigit(i8 signext %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
ret i32 0
}