#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_add_mem();
int /*<<< orphan*/ do_cmd_rune_carve();
int /*<<< orphan*/ get_com(char *, char *);
void do_cmd_rune_add() {
  int ext = 0;
  char ch;
  while (1) {
    if (!get_com("Add to [M]emory(need runes to cast) or "
                 "Carve a [R]unestone(less mana to cast)",
                 &ch)) {
      ext = 0;
      break;
    }
    if ((ch == 'M') || (ch == 'm')) {
      ext = 1;
      break;
    }
    if ((ch == 'R') || (ch == 'r')) {
      ext = 2;
      break;
    }
  }
  switch (ext) {
  case 1: {
    do_cmd_rune_add_mem();
    break;
  }
  case 2: {
    do_cmd_rune_carve();
    break;
  }
  }
}


x86 assembly (clang, -O0):
<do_cmd_rune_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1030 <get_com@plt>
cmp    $0x0,%eax
jne    1164 <do_cmd_rune_add+0x34>
movl   $0x0,-0x4(%rbp)
jmp    11b5 <do_cmd_rune_add+0x85>
movsbl -0x5(%rbp),%eax
cmp    $0x4d,%eax
je     117e <do_cmd_rune_add+0x4e>
movsbl -0x5(%rbp),%eax
cmp    $0x6d,%eax
jne    118a <do_cmd_rune_add+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    11b5 <do_cmd_rune_add+0x85>
movsbl -0x5(%rbp),%eax
cmp    $0x52,%eax
je     11a4 <do_cmd_rune_add+0x74>
movsbl -0x5(%rbp),%eax
cmp    $0x72,%eax
jne    11b0 <do_cmd_rune_add+0x80>
movl   $0x2,-0x4(%rbp)
jmp    11b5 <do_cmd_rune_add+0x85>
jmp    113f <do_cmd_rune_add+0xf>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     11da <do_cmd_rune_add+0xaa>
jmp    11c9 <do_cmd_rune_add+0x99>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11e6 <do_cmd_rune_add+0xb6>
jmp    11ed <do_cmd_rune_add+0xbd>
mov    $0x0,%al
call   1040 <do_cmd_rune_add_mem@plt>
jmp    11ed <do_cmd_rune_add+0xbd>
mov    $0x0,%al
call   1050 <do_cmd_rune_carve@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_cmd_rune_add>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%r14
lea    0x7(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <get_com@plt>
test   %eax,%eax
je     116e <do_cmd_rune_add+0x3e>
movzbl 0x7(%rsp),%eax
and    $0xdf,%al
cmp    $0x52,%al
je     1167 <do_cmd_rune_add+0x37>
cmp    $0x4d,%al
jne    1140 <do_cmd_rune_add+0x10>
xor    %eax,%eax
call   1040 <do_cmd_rune_add_mem@plt>
jmp    116e <do_cmd_rune_add+0x3e>
xor    %eax,%eax
call   1050 <do_cmd_rune_carve@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [78 x i8] c"Add to [M]emory(need runes to cast) or Carve a [R]unestone(less mana to cast)\00"
define void @do_cmd_rune_add() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %0, %25
%4 = call i32 @get_com(i8* getelementptr inbounds ([78 x i8], [78 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 %26
7: ; preds = %3
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 77
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, 109
br i1 %14, label %15, label %16
15: ; preds = %11, %7
store i32 1, i32* %1
br label %26
16: ; preds = %11
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 82
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, 114
br i1 %23, label %24, label %25
24: ; preds = %20, %16
store i32 2, i32* %1
br label %26
25: ; preds = %20
br label %3
26: ; preds = %24, %15, %6
%27 = load i32, i32* %1
switch i32 %27, label %32 [
i32 1, label %28
i32 2, label %30
]
28: ; preds = %26
%29 = call i32 (...) @do_cmd_rune_add_mem()
br label %32
30: ; preds = %26
%31 = call i32 (...) @do_cmd_rune_carve()
br label %32
32: ; preds = %26, %30, %28
ret void
}

LLVM IR (-O2):
@.str = [78 x i8] c"Add to [M]emory(need runes to cast) or Carve a [R]unestone(less mana to cast)\00"
define void @do_cmd_rune_add() {
%1 = alloca i8
br label %2
2: ; preds = %5, %0
%3 = call i32 @get_com(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = load i8, i8* %1
%7 = and i8 %6, -33
switch i8 %7, label %2 [
i8 77, label %8
i8 82, label %10
]
8: ; preds = %5
%9 = call i32 (...) @do_cmd_rune_add_mem()
br label %12
10: ; preds = %5
%11 = call i32 (...) @do_cmd_rune_carve()
br label %12
12: ; preds = %2, %10, %8
ret void
}