#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 rand();
int /*<<< orphan*/ strcpy(char *, char *);
void mob_adjective_magician(char *out_string) {
  switch (rand() % 10) {
  case 0:
    strcpy(out_string, "ancient ");
    break;
  case 1:
    strcpy(out_string, "powerful ");
    break;
  case 2:
    strcpy(out_string, "strange looking ");
    break;
  case 3:
    strcpy(out_string, "dark ");
    break;
  default:
    strcpy(out_string, "");
    break;
  }
}


x86 assembly (clang, -O0):
<mob_adjective_magician>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rdx
add    %ecx,%edx
add    %edx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11ca <mob_adjective_magician+0xaa>
mov    -0x10(%rbp),%rax
lea    0xe93(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11da <mob_adjective_magician+0xba>
mov    -0x8(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11da <mob_adjective_magician+0xba>
mov    -0x8(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11da <mob_adjective_magician+0xba>
mov    -0x8(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11da <mob_adjective_magician+0xba>
mov    -0x8(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mob_adjective_magician>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cmp    $0x3,%eax
ja     115f <mob_adjective_magician+0x3f>
cltq
lea    0xed6(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
jmp    1166 <mob_adjective_magician+0x46>
lea    0xebd(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"ancient \00"
@.str.1 = [10 x i8] c"powerful \00"
@.str.2 = [17 x i8] c"strange looking \00"
@.str.3 = [6 x i8] c"dark \00"
@.str.4 = [1 x i8] zeroinitializer
define void @mob_adjective_magician(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 10
switch i32 %4, label %17 [
i32 0, label %5
i32 1, label %8
i32 2, label %11
i32 3, label %14
]
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %20
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %20
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %20
14: ; preds = %1
%15 = load i8*, i8** %2
%16 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %20
17: ; preds = %1
%18 = load i8*, i8** %2
%19 = call i32 @strcpy(i8* %18, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %17, %14, %11, %8, %5
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"ancient \00"
@.str.1 = [10 x i8] c"powerful \00"
@.str.2 = [17 x i8] c"strange looking \00"
@.str.3 = [6 x i8] c"dark \00"
@.str.4 = [1 x i8] zeroinitializer
@reltable.mob_adjective_magician = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.mob_adjective_magician to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.mob_adjective_magician to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.mob_adjective_magician to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.mob_adjective_magician to i64)) to i32)]
define void @mob_adjective_magician(i8* %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 10
%4 = icmp ult i32 %3, 4
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.mob_adjective_magician to i8*), i64 %7)
br label %9
9: ; preds = %1, %5
%10 = phi i8* [ %8, %5 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), %1 ]
%11 = tail call i32 @strcpy(i8* %0, i8* %10)
ret void
}