#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*/ atoi(char *);
scalar_t__ isdigit(int);
int /*<<< orphan*/ listInstances(char *);
int /*<<< orphan*/ output(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ showClass(int /*<<< orphan*/);
int /*<<< orphan*/ showClassHierarchy(int, int /*<<< orphan*/);
scalar_t__ strchr(char *, char);
char *strtok(int /*<<< orphan*/ *, char *);
void handleClassesCommand() {
  char *parameter = strtok(NULL, "");
  if (parameter == NULL || strchr(parameter, '*') != 0) {
    output("Classes:");
    showClassHierarchy(1, 0);
    listInstances(parameter);
  } else if (isdigit((int)parameter[0]))
    showClass(atoi(parameter));
  else {
    printf("You have to give a class index to display. You can't use names "
           "(yet).");
  }
}


x86 assembly (clang, -O0):
<handleClassesCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
lea    0xeab(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11cf <handleClassesCommand+0x3f>
mov    -0x8(%rbp),%rdi
mov    $0x2a,%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     11f5 <handleClassesCommand+0x65>
lea    0xe2a(%rip),%rdi
call   1040 <output@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   10a0 <showClassHierarchy@plt>
mov    -0x8(%rbp),%rdi
call   1080 <listInstances@plt>
jmp    1231 <handleClassesCommand+0xa1>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1220 <handleClassesCommand+0x90>
mov    -0x8(%rbp),%rdi
call   10b0 <atoi@plt>
mov    %eax,%edi
call   1070 <showClass@plt>
jmp    122c <handleClassesCommand+0x9c>
lea    0xde2(%rip),%rdi
call   1060 <printf@plt>
jmp    1231 <handleClassesCommand+0xa1>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleClassesCommand>:
push   %rbx
lea    0xeb6(%rip),%rsi
xor    %edi,%edi
call   1090 <strtok@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11b9 <handleClassesCommand+0x29>
mov    %rbx,%rdi
mov    $0x2a,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     11da <handleClassesCommand+0x4a>
lea    0xe40(%rip),%rdi
call   1040 <output@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   10a0 <showClassHierarchy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1080 <listInstances@plt>
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     11f7 <handleClassesCommand+0x67>
mov    %rbx,%rdi
call   10b0 <atoi@plt>
mov    %eax,%edi
pop    %rbx
jmp    1070 <showClass@plt>
lea    0xe0b(%rip),%rdi
pop    %rbx
jmp    1060 <printf@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [9 x i8] c"Classes:\00"
@.str.2 = [70 x i8] c"You have to give a class index to display. You can't use names (yet).\00"
define void @handleClassesCommand() {
%1 = alloca i8*
%2 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = call i64 @strchr(i8* %6, i8 signext 42)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %5, %0
%10 = call i32 @output(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @showClassHierarchy(i32 1, i32 0)
%12 = load i8*, i8** %1
%13 = call i32 @listInstances(i8* %12)
br label %28
14: ; preds = %5
%15 = load i8*, i8** %1
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i64 @isdigit(i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %14
%22 = load i8*, i8** %1
%23 = call i32 @atoi(i8* %22)
%24 = call i32 @showClass(i32 %23)
br label %27
25: ; preds = %14
%26 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %21
br label %28
28: ; preds = %27, %9
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [9 x i8] c"Classes:\00"
@.str.2 = [70 x i8] c"You have to give a class index to display. You can't use names (yet).\00"
define void @handleClassesCommand() {
%1 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i64 @strchr(i8* %1, i8 signext 42)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3, %0
%7 = tail call i32 @output(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @showClassHierarchy(i32 1, i32 0)
%9 = tail call i32 @listInstances(i8* %1)
br label %20
10: ; preds = %3
%11 = load i8, i8* %1
%12 = sext i8 %11 to i32
%13 = tail call i64 @isdigit(i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = tail call i32 @atoi(i8* %1)
%17 = tail call i32 @showClass(i32 %16)
br label %20
18: ; preds = %10
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %15, %18, %6
ret void
}