#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*/ EXIT_FAILURE;
unsigned int d(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned int);
char *randbard1lvl(void) {
  unsigned roll;
  roll = d(19);
  switch (roll) {
  case 1:
    return ("Animal Friendship");
  case 2:
    return ("Bane");
  case 3:
    return ("Charm Person");
  case 4:
    return ("Comprehend Languages");
  case 5:
    return ("Cure Wounds");
  case 6:
    return ("Detect Magic");
  case 7:
    return ("Disguise Self");
  case 8:
    return ("Dissonant Whispers");
  case 9:
    return ("Faerie Fire");
  case 10:
    return ("Healing Word");
  case 11:
    return ("Heroism");
  case 12:
    return ("Identify");
  case 13:
    return ("Illusory Script");
  case 14:
    return ("Longstrider");
  case 15:
    return ("Silent Image");
  case 16:
    return ("Sleep");
  case 17:
    return ("Speak with Animals");
  case 18:
    return ("Tasha's Hideous Laughter");
  case 19:
    return ("Thunderwave");
  case 0:
    return ("Unseen Servant");
  default:
    printf("Impossible random level 1 bard spell %d\n", roll);
    exit(EXIT_FAILURE);
  }
  return "";
}


x86 assembly (clang, -O0):
<randbard1lvl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x13,%edi
call   1030 <d@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x13,%rax
ja     12aa <randbard1lvl+0x17a>
mov    -0x18(%rbp),%rax
lea    0xe9f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xedf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xed6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xed3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xed8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xed4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xecf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xed2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xecb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xec3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xeb8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xeb5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xeab(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xeae(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xeb7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
lea    0xeb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c7 <randbard1lvl+0x197>
mov    -0xc(%rbp),%esi
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randbard1lvl>:
push   %rax
mov    $0x13,%edi
call   1030 <d@plt>
cmp    $0x14,%eax
jae    1152 <randbard1lvl+0x22>
cltq
lea    0xff3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
pop    %rcx
ret
lea    0xfba(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Animal Friendship\00"
@.str.1 = [5 x i8] c"Bane\00"
@.str.2 = [13 x i8] c"Charm Person\00"
@.str.3 = [21 x i8] c"Comprehend Languages\00"
@.str.4 = [12 x i8] c"Cure Wounds\00"
@.str.5 = [13 x i8] c"Detect Magic\00"
@.str.6 = [14 x i8] c"Disguise Self\00"
@.str.7 = [19 x i8] c"Dissonant Whispers\00"
@.str.8 = [12 x i8] c"Faerie Fire\00"
@.str.9 = [13 x i8] c"Healing Word\00"
@.str.10 = [8 x i8] c"Heroism\00"
@.str.11 = [9 x i8] c"Identify\00"
@.str.12 = [16 x i8] c"Illusory Script\00"
@.str.13 = [12 x i8] c"Longstrider\00"
@.str.14 = [13 x i8] c"Silent Image\00"
@.str.15 = [6 x i8] c"Sleep\00"
@.str.16 = [19 x i8] c"Speak with Animals\00"
@.str.17 = [25 x i8] c"Tasha's Hideous Laughter\00"
@.str.18 = [12 x i8] c"Thunderwave\00"
@.str.19 = [15 x i8] c"Unseen Servant\00"
@.str.20 = [41 x i8] c"Impossible random level 1 bard spell %d\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @randbard1lvl() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i32 @d(i32 19)
store i32 %3, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %25 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
i32 4, label %8
i32 5, label %9
i32 6, label %10
i32 7, label %11
i32 8, label %12
i32 9, label %13
i32 10, label %14
i32 11, label %15
i32 12, label %16
i32 13, label %17
i32 14, label %18
i32 15, label %19
i32 16, label %20
i32 17, label %21
i32 18, label %22
i32 19, label %23
i32 0, label %24
]
5: ; preds = %0
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %1
br label %30
6: ; preds = %0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %30
7: ; preds = %0
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %30
8: ; preds = %0
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %30
9: ; preds = %0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8** %1
br label %30
10: ; preds = %0
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %1
br label %30
11: ; preds = %0
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8** %1
br label %30
12: ; preds = %0
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8** %1
br label %30
13: ; preds = %0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8** %1
br label %30
14: ; preds = %0
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i8** %1
br label %30
15: ; preds = %0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8** %1
br label %30
16: ; preds = %0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8** %1
br label %30
17: ; preds = %0
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8** %1
br label %30
18: ; preds = %0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i8** %1
br label %30
19: ; preds = %0
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8** %1
br label %30
20: ; preds = %0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8** %1
br label %30
21: ; preds = %0
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i64 0, i64 0), i8** %1
br label %30
22: ; preds = %0
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0), i8** %1
br label %30
23: ; preds = %0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0), i8** %1
br label %30
24: ; preds = %0
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0), i8** %1
br label %30
25: ; preds = %0
%26 = load i32, i32* %2
%27 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.20, i64 0, i64 0), i32 %26)
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @exit(i32 %28)
unreachable
30: ; preds = %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%31 = load i8*, i8** %1
ret i8* %31
}

LLVM IR (-O2):
@.str = [18 x i8] c"Animal Friendship\00"
@.str.1 = [5 x i8] c"Bane\00"
@.str.2 = [13 x i8] c"Charm Person\00"
@.str.3 = [21 x i8] c"Comprehend Languages\00"
@.str.4 = [12 x i8] c"Cure Wounds\00"
@.str.5 = [13 x i8] c"Detect Magic\00"
@.str.6 = [14 x i8] c"Disguise Self\00"
@.str.7 = [19 x i8] c"Dissonant Whispers\00"
@.str.8 = [12 x i8] c"Faerie Fire\00"
@.str.9 = [13 x i8] c"Healing Word\00"
@.str.10 = [8 x i8] c"Heroism\00"
@.str.11 = [9 x i8] c"Identify\00"
@.str.12 = [16 x i8] c"Illusory Script\00"
@.str.13 = [12 x i8] c"Longstrider\00"
@.str.14 = [13 x i8] c"Silent Image\00"
@.str.15 = [6 x i8] c"Sleep\00"
@.str.16 = [19 x i8] c"Speak with Animals\00"
@.str.17 = [25 x i8] c"Tasha's Hideous Laughter\00"
@.str.18 = [12 x i8] c"Thunderwave\00"
@.str.19 = [15 x i8] c"Unseen Servant\00"
@.str.20 = [41 x i8] c"Impossible random level 1 bard spell %d\0A\00"
@EXIT_FAILURE = global i32 0
@reltable.randbard1lvl = [20 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.19 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.2 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.3 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.4 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.5 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.6 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.7 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.8 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.9 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.11 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.12 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.13 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.14 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.15 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.16 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @.str.17 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.18 to i64), i64 ptrtoint ([20 x i32]* @reltable.randbard1lvl to i64)) to i32)]
define i8* @randbard1lvl() {
%1 = tail call i32 @d(i32 19)
%2 = icmp ult i32 %1, 20
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.20, i64 0, i64 0), i32 %1)
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
7: ; preds = %0
%8 = sext i32 %1 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([20 x i32]* @reltable.randbard1lvl to i8*), i64 %9)
ret i8* %10
}