#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*/ graphic_init();
scalar_t__ strEql(char *, char *);
int /*<<< orphan*/ vga_clearScreen();
int /*<<< orphan*/ vga_pushChar(int);
int /*<<< orphan*/ vga_pushString(char *);
void terminal_checkCmd(char *cmd) {
  if (strEql(cmd, "info")) {
    vga_pushString("FrostOS is currently in alpha development.\nUSE AT YOUR "
                   "OWN RISK!\n\nFor a list of commands, type 'help'.\n\n");
  } else if (strEql(cmd, "help")) {
    vga_pushString("-- Commands --\n info     -Shows the welcome message "
                   "displayed on login.\n help     -Shows a list of "
                   "commands.\n cls     -Clears the screen.\n\n");
  } else if (strEql(cmd, "cls")) {
    vga_clearScreen();
  } else if (strEql(cmd, "graphic_init")) {
    graphic_init();
  } else if (strEql(cmd, "divide")) {
    vga_pushChar(5 / 0);
  } else {
    vga_pushString("Illegal Command! - ");
    vga_pushString(cmd);
    vga_pushString("\n\n");
  }
}


x86 assembly (clang, -O0):
<terminal_checkCmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1060 <strEql@plt>
cmp    $0x0,%rax
je     1187 <terminal_checkCmd+0x37>
lea    0xe88(%rip),%rdi
call   1070 <vga_pushString@plt>
jmp    1257 <terminal_checkCmd+0x107>
mov    -0x8(%rbp),%rdi
lea    0xedc(%rip),%rsi
call   1060 <strEql@plt>
cmp    $0x0,%rax
je     11b2 <terminal_checkCmd+0x62>
lea    0xecb(%rip),%rdi
call   1070 <vga_pushString@plt>
jmp    1252 <terminal_checkCmd+0x102>
mov    -0x8(%rbp),%rdi
lea    0xf42(%rip),%rsi
call   1060 <strEql@plt>
cmp    $0x0,%rax
je     11d8 <terminal_checkCmd+0x88>
mov    $0x0,%al
call   1050 <vga_clearScreen@plt>
jmp    124d <terminal_checkCmd+0xfd>
mov    -0x8(%rbp),%rdi
lea    0xf20(%rip),%rsi
call   1060 <strEql@plt>
cmp    $0x0,%rax
je     11fe <terminal_checkCmd+0xae>
mov    $0x0,%al
call   1030 <graphic_init@plt>
jmp    1248 <terminal_checkCmd+0xf8>
mov    -0x8(%rbp),%rdi
lea    0xf07(%rip),%rsi
call   1060 <strEql@plt>
cmp    $0x0,%rax
je     1222 <terminal_checkCmd+0xd2>
call   1040 <vga_pushChar@plt>
jmp    1243 <terminal_checkCmd+0xf3>
lea    0xeee(%rip),%rdi
call   1070 <vga_pushString@plt>
mov    -0x8(%rbp),%rdi
call   1070 <vga_pushString@plt>
lea    0xe2d(%rip),%rdi
call   1070 <vga_pushString@plt>
jmp    1248 <terminal_checkCmd+0xf8>
jmp    124d <terminal_checkCmd+0xfd>
jmp    1252 <terminal_checkCmd+0x102>
jmp    1257 <terminal_checkCmd+0x107>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<terminal_checkCmd>:
push   %rbx
mov    %rdi,%rbx
lea    0xea5(%rip),%rsi
call   1060 <strEql@plt>
test   %rax,%rax
je     1172 <terminal_checkCmd+0x22>
lea    0xe99(%rip),%rdi
pop    %rbx
jmp    1070 <vga_pushString@plt>
lea    0xef5(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strEql@plt>
test   %rax,%rax
je     1193 <terminal_checkCmd+0x43>
lea    0xee6(%rip),%rdi
pop    %rbx
jmp    1070 <vga_pushString@plt>
lea    0xf65(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strEql@plt>
test   %rax,%rax
je     11af <terminal_checkCmd+0x5f>
xor    %eax,%eax
pop    %rbx
jmp    1050 <vga_clearScreen@plt>
lea    0xf4d(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strEql@plt>
test   %rax,%rax
je     11cb <terminal_checkCmd+0x7b>
xor    %eax,%eax
pop    %rbx
jmp    1030 <graphic_init@plt>
lea    0xf3e(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strEql@plt>
test   %rax,%rax
je     11e5 <terminal_checkCmd+0x95>
pop    %rbx
jmp    1040 <vga_pushChar@plt>
lea    0xf2b(%rip),%rdi
call   1070 <vga_pushString@plt>
mov    %rbx,%rdi
call   1070 <vga_pushString@plt>
lea    0xe6b(%rip),%rdi
pop    %rbx
jmp    1070 <vga_pushString@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"info\00"
@.str.1 = [105 x i8] c"FrostOS is currently in alpha development.\0AUSE AT YOUR OWN RISK!\0A\0AFor a list of commands, type 'help'.\0A\0A\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [140 x i8] c"-- Commands --\0A info -Shows the welcome message displayed on login.\0A help -Shows a list of commands.\0A cls -Clears the screen.\0A\0A\00"
@.str.4 = [4 x i8] c"cls\00"
@.str.5 = [13 x i8] c"graphic_init\00"
@.str.6 = [7 x i8] c"divide\00"
@.str.7 = [20 x i8] c"Illegal Command! - \00"
@.str.8 = [3 x i8] c"\0A\0A\00"
define void @terminal_checkCmd(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strEql(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @vga_pushString(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.1, i64 0, i64 0))
br label %41
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i64 @strEql(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @vga_pushString(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.3, i64 0, i64 0))
br label %40
14: ; preds = %8
%15 = load i8*, i8** %2
%16 = call i64 @strEql(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 (...) @vga_clearScreen()
br label %39
20: ; preds = %14
%21 = load i8*, i8** %2
%22 = call i64 @strEql(i8* %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (...) @graphic_init()
br label %38
26: ; preds = %20
%27 = load i8*, i8** %2
%28 = call i64 @strEql(i8* %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @vga_pushChar(i32 poison)
br label %37
32: ; preds = %26
%33 = call i32 @vga_pushString(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%34 = load i8*, i8** %2
%35 = call i32 @vga_pushString(i8* %34)
%36 = call i32 @vga_pushString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %37
37: ; preds = %32, %30
br label %38
38: ; preds = %37, %24
br label %39
39: ; preds = %38, %18
br label %40
40: ; preds = %39, %12
br label %41
41: ; preds = %40, %6
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"info\00"
@.str.1 = [105 x i8] c"FrostOS is currently in alpha development.\0AUSE AT YOUR OWN RISK!\0A\0AFor a list of commands, type 'help'.\0A\0A\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [140 x i8] c"-- Commands --\0A info -Shows the welcome message displayed on login.\0A help -Shows a list of commands.\0A cls -Clears the screen.\0A\0A\00"
@.str.4 = [4 x i8] c"cls\00"
@.str.5 = [13 x i8] c"graphic_init\00"
@.str.6 = [7 x i8] c"divide\00"
@.str.7 = [20 x i8] c"Illegal Command! - \00"
@.str.8 = [3 x i8] c"\0A\0A\00"
define void @terminal_checkCmd(i8* %0) {
%2 = tail call i64 @strEql(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @vga_pushString(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.1, i64 0, i64 0))
br label %30
6: ; preds = %1
%7 = tail call i64 @strEql(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @vga_pushString(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.3, i64 0, i64 0))
br label %30
11: ; preds = %6
%12 = tail call i64 @strEql(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 (...) @vga_clearScreen()
br label %30
16: ; preds = %11
%17 = tail call i64 @strEql(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 (...) @graphic_init()
br label %30
21: ; preds = %16
%22 = tail call i64 @strEql(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = tail call i32 @vga_pushChar(i32 poison)
br label %30
26: ; preds = %21
%27 = tail call i32 @vga_pushString(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%28 = tail call i32 @vga_pushString(i8* %0)
%29 = tail call i32 @vga_pushString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %30
30: ; preds = %9, %19, %26, %24, %14, %4
ret void
}