#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*/ do_cmd_rune();
int /*<<< orphan*/ do_cmd_rune_add();
int /*<<< orphan*/ do_cmd_rune_cast();
int /*<<< orphan*/ do_cmd_rune_del();
int /*<<< orphan*/ do_cmd_runestone();
int /*<<< orphan*/ get_com(char *, char *);
void do_cmd_runecrafter() {
  int ext = 0;
  char ch;
  while (1) {
    if (!get_com("Rune Spell:[C]reate, [D]elete, C[a]st, D[i]rectly Cast "
                 "or Use [R]unestone",
                 &ch)) {
      ext = 0;
      break;
    }
    if ((ch == 'C') || (ch == 'c')) {
      ext = 1;
      break;
    }
    if ((ch == 'D') || (ch == 'd')) {
      ext = 2;
      break;
    }
    if ((ch == 'A') || (ch == 'a')) {
      ext = 3;
      break;
    }
    if ((ch == 'I') || (ch == 'i')) {
      ext = 4;
      break;
    }
    if ((ch == 'R') || (ch == 'r')) {
      ext = 5;
      break;
    }
  }
  switch (ext) {
  case 1: {
    do_cmd_rune_add();
    break;
  }
  case 2: {
    do_cmd_rune_del();
    break;
  }
  case 3: {
    do_cmd_rune_cast();
    break;
  }
  case 4: {
    do_cmd_rune();
    break;
  }
  case 5: {
    do_cmd_runestone();
    break;
  }
  }
}


x86 assembly (clang, -O0):
<do_cmd_runecrafter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9e(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <get_com@plt>
cmp    $0x0,%eax
jne    1194 <do_cmd_runecrafter+0x34>
movl   $0x0,-0x4(%rbp)
jmp    1257 <do_cmd_runecrafter+0xf7>
movsbl -0x5(%rbp),%eax
cmp    $0x43,%eax
je     11ae <do_cmd_runecrafter+0x4e>
movsbl -0x5(%rbp),%eax
cmp    $0x63,%eax
jne    11ba <do_cmd_runecrafter+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    1257 <do_cmd_runecrafter+0xf7>
movsbl -0x5(%rbp),%eax
cmp    $0x44,%eax
je     11d4 <do_cmd_runecrafter+0x74>
movsbl -0x5(%rbp),%eax
cmp    $0x64,%eax
jne    11e0 <do_cmd_runecrafter+0x80>
movl   $0x2,-0x4(%rbp)
jmp    1257 <do_cmd_runecrafter+0xf7>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
je     11fa <do_cmd_runecrafter+0x9a>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jne    1206 <do_cmd_runecrafter+0xa6>
movl   $0x3,-0x4(%rbp)
jmp    1257 <do_cmd_runecrafter+0xf7>
movsbl -0x5(%rbp),%eax
cmp    $0x49,%eax
je     1220 <do_cmd_runecrafter+0xc0>
movsbl -0x5(%rbp),%eax
cmp    $0x69,%eax
jne    122c <do_cmd_runecrafter+0xcc>
movl   $0x4,-0x4(%rbp)
jmp    1257 <do_cmd_runecrafter+0xf7>
movsbl -0x5(%rbp),%eax
cmp    $0x52,%eax
je     1246 <do_cmd_runecrafter+0xe6>
movsbl -0x5(%rbp),%eax
cmp    $0x72,%eax
jne    1252 <do_cmd_runecrafter+0xf2>
movl   $0x5,-0x4(%rbp)
jmp    1257 <do_cmd_runecrafter+0xf7>
jmp    116f <do_cmd_runecrafter+0xf>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     12b7 <do_cmd_runecrafter+0x157>
mov    -0x10(%rbp),%rax
lea    0xd89(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <do_cmd_rune_add@plt>
jmp    12b7 <do_cmd_runecrafter+0x157>
mov    $0x0,%al
call   1080 <do_cmd_rune_del@plt>
jmp    12b7 <do_cmd_runecrafter+0x157>
mov    $0x0,%al
call   1040 <do_cmd_rune_cast@plt>
jmp    12b7 <do_cmd_runecrafter+0x157>
mov    $0x0,%al
call   1070 <do_cmd_rune@plt>
jmp    12b7 <do_cmd_runecrafter+0x157>
mov    $0x0,%al
call   1060 <do_cmd_runestone@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_cmd_runecrafter>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed8(%rip),%r14
lea    0xf(%rsp),%r15
lea    0xe84(%rip),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <get_com@plt>
test   %eax,%eax
je     11d3 <do_cmd_runecrafter+0x73>
movzbl 0xf(%rsp),%eax
and    $0xdf,%al
add    $0xbf,%al
cmp    $0x11,%al
ja     1180 <do_cmd_runecrafter+0x20>
movzbl %al,%eax
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1040 <do_cmd_rune_cast@plt>
jmp    11d3 <do_cmd_runecrafter+0x73>
xor    %eax,%eax
call   1030 <do_cmd_rune_add@plt>
jmp    11d3 <do_cmd_runecrafter+0x73>
xor    %eax,%eax
call   1080 <do_cmd_rune_del@plt>
jmp    11d3 <do_cmd_runecrafter+0x73>
xor    %eax,%eax
call   1070 <do_cmd_rune@plt>
jmp    11d3 <do_cmd_runecrafter+0x73>
xor    %eax,%eax
call   1060 <do_cmd_runestone@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [74 x i8] c"Rune Spell:[C]reate, [D]elete, C[a]st, D[i]rectly Cast or Use [R]unestone\00"
define void @do_cmd_runecrafter() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %0, %52
%4 = call i32 @get_com(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = icmp ne i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %3
store i32 0, i32* %1
br label %53
7: ; preds = %3
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 67
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 99
br i1 %14, label %15, label %16
15: ; preds = %11, %7
store i32 1, i32* %1
br label %53
16: ; preds = %11
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 68
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 100
br i1 %23, label %24, label %25
24: ; preds = %20, %16
store i32 2, i32* %1
br label %53
25: ; preds = %20
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 65
br i1 %28, label %33, label %29
29: ; preds = %25
%30 = load i8, i8* %2
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 97
br i1 %32, label %33, label %34
33: ; preds = %29, %25
store i32 3, i32* %1
br label %53
34: ; preds = %29
%35 = load i8, i8* %2
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 73
br i1 %37, label %42, label %38
38: ; preds = %34
%39 = load i8, i8* %2
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 105
br i1 %41, label %42, label %43
42: ; preds = %38, %34
store i32 4, i32* %1
br label %53
43: ; preds = %38
%44 = load i8, i8* %2
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 82
br i1 %46, label %51, label %47
47: ; preds = %43
%48 = load i8, i8* %2
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 114
br i1 %50, label %51, label %52
51: ; preds = %47, %43
store i32 5, i32* %1
br label %53
52: ; preds = %47
br label %3
53: ; preds = %51, %42, %33, %24, %15, %6
%54 = load i32, i32* %1
switch i32 %54, label %65 [
i32 1, label %55
i32 2, label %57
i32 3, label %59
i32 4, label %61
i32 5, label %63
]
55: ; preds = %53
%56 = call i32 (...) @do_cmd_rune_add()
br label %65
57: ; preds = %53
%58 = call i32 (...) @do_cmd_rune_del()
br label %65
59: ; preds = %53
%60 = call i32 (...) @do_cmd_rune_cast()
br label %65
61: ; preds = %53
%62 = call i32 (...) @do_cmd_rune()
br label %65
63: ; preds = %53
%64 = call i32 (...) @do_cmd_runestone()
br label %65
65: ; preds = %53, %63, %61, %59, %57, %55
ret void
}

LLVM IR (-O2):
@.str = [74 x i8] c"Rune Spell:[C]reate, [D]elete, C[a]st, D[i]rectly Cast or Use [R]unestone\00"
define void @do_cmd_runecrafter() {
%1 = alloca i8
br label %2
2: ; preds = %5, %0
%3 = call i32 @get_com(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %2
%6 = load i8, i8* %1
%7 = and i8 %6, -33
switch i8 %7, label %2 [
i8 67, label %8
i8 68, label %10
i8 65, label %12
i8 73, label %14
i8 82, label %16
]
8: ; preds = %5
%9 = call i32 (...) @do_cmd_rune_add()
br label %18
10: ; preds = %5
%11 = call i32 (...) @do_cmd_rune_del()
br label %18
12: ; preds = %5
%13 = call i32 (...) @do_cmd_rune_cast()
br label %18
14: ; preds = %5
%15 = call i32 (...) @do_cmd_rune()
br label %18
16: ; preds = %5
%17 = call i32 (...) @do_cmd_runestone()
br label %18
18: ; preds = %2, %16, %14, %12, %10, %8
ret void
}