#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;
int /*<<< orphan*/ d(int);
int /*<<< orphan*/ drowspore(int /*<<< orphan*/);
int /*<<< orphan*/ duergarspore(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ hookhorrorspore(int /*<<< orphan*/);
int /*<<< orphan*/ niceprint(char *);
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ quaggothspore(int /*<<< orphan*/);
void sporeservants(unsigned d10) {
  niceprint("One or more creatures killed and reanimated by Zuggtmoy's spores "
            "observe the characters as they pass by. The spore savants don't "
            "communicate and don't attack except in self-defense.\n\n");
  switch (d10) {
  case 1:
  case 2:
  case 3:
    drowspore(d(4));
    break;
  case 4:
  case 5:
  case 6:
    duergarspore(d(6));
    break;
  case 7:
  case 8:
    hookhorrorspore(d(4));
    break;
  case 9:
  case 10:
    quaggothspore(d(8));
    break;
  default:
    printf("Impossible spore servant encounter of %d\n", d10);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<sporeservants>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xe96(%rip),%rdi
call   1080 <niceprint@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     1218 <sporeservants+0x98>
mov    -0x10(%rbp),%rax
lea    0xe49(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x4,%edi
call   1030 <d@plt>
mov    %eax,%edi
call   1060 <drowspore@plt>
jmp    1235 <sporeservants+0xb5>
mov    $0x6,%edi
call   1030 <d@plt>
mov    %eax,%edi
call   1090 <duergarspore@plt>
jmp    1235 <sporeservants+0xb5>
mov    $0x4,%edi
call   1030 <d@plt>
mov    %eax,%edi
call   1040 <hookhorrorspore@plt>
jmp    1235 <sporeservants+0xb5>
mov    $0x8,%edi
call   1030 <d@plt>
mov    %eax,%edi
call   1070 <quaggothspore@plt>
jmp    1235 <sporeservants+0xb5>
mov    -0x4(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1050 <printf@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sporeservants>:
push   %rbx
mov    %edi,%ebx
lea    0xe9e(%rip),%rdi
call   1080 <niceprint@plt>
lea    -0x1(%rbx),%eax
cmp    $0x9,%eax
ja     11ef <sporeservants+0x6f>
lea    0xe62(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x4,%edi
call   1030 <d@plt>
mov    %eax,%edi
pop    %rbx
jmp    1060 <drowspore@plt>
mov    $0x6,%edi
call   1030 <d@plt>
mov    %eax,%edi
pop    %rbx
jmp    1090 <duergarspore@plt>
mov    $0x4,%edi
call   1030 <d@plt>
mov    %eax,%edi
pop    %rbx
jmp    1040 <hookhorrorspore@plt>
mov    $0x8,%edi
call   1030 <d@plt>
mov    %eax,%edi
pop    %rbx
jmp    1070 <quaggothspore@plt>
lea    0xeea(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [184 x i8] c"One or more creatures killed and reanimated by Zuggtmoy's spores observe the characters as they pass by. The spore savants don't communicate and don't attack except in self-defense.\0A\0A\00"
@.str.1 = [42 x i8] c"Impossible spore servant encounter of %d\0A\00"
@EXIT_FAILURE = global i32 0
define void @sporeservants(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @niceprint(i8* getelementptr inbounds ([184 x i8], [184 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
switch i32 %4, label %17 [
i32 1, label %5
i32 2, label %5
i32 3, label %5
i32 4, label %8
i32 5, label %8
i32 6, label %8
i32 7, label %11
i32 8, label %11
i32 9, label %14
i32 10, label %14
]
5: ; preds = %1, %1, %1
%6 = call i32 @d(i32 4)
%7 = call i32 @drowspore(i32 %6)
br label %22
8: ; preds = %1, %1, %1
%9 = call i32 @d(i32 6)
%10 = call i32 @duergarspore(i32 %9)
br label %22
11: ; preds = %1, %1
%12 = call i32 @d(i32 4)
%13 = call i32 @hookhorrorspore(i32 %12)
br label %22
14: ; preds = %1, %1
%15 = call i32 @d(i32 8)
%16 = call i32 @quaggothspore(i32 %15)
br label %22
17: ; preds = %1
%18 = load i32, i32* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %14, %11, %8, %5
ret void
}

LLVM IR (-O2):
@.str = [184 x i8] c"One or more creatures killed and reanimated by Zuggtmoy's spores observe the characters as they pass by. The spore savants don't communicate and don't attack except in self-defense.\0A\0A\00"
@.str.1 = [42 x i8] c"Impossible spore servant encounter of %d\0A\00"
@EXIT_FAILURE = global i32 0
define void @sporeservants(i32 %0) {
%2 = tail call i32 @niceprint(i8* getelementptr inbounds ([184 x i8], [184 x i8]* @.str, i64 0, i64 0))
switch i32 %0, label %15 [
i32 1, label %3
i32 2, label %3
i32 3, label %3
i32 4, label %6
i32 5, label %6
i32 6, label %6
i32 7, label %9
i32 8, label %9
i32 9, label %12
i32 10, label %12
]
3: ; preds = %1, %1, %1
%4 = tail call i32 @d(i32 4)
%5 = tail call i32 @drowspore(i32 %4)
br label %19
6: ; preds = %1, %1, %1
%7 = tail call i32 @d(i32 6)
%8 = tail call i32 @duergarspore(i32 %7)
br label %19
9: ; preds = %1, %1
%10 = tail call i32 @d(i32 4)
%11 = tail call i32 @hookhorrorspore(i32 %10)
br label %19
12: ; preds = %1, %1
%13 = tail call i32 @d(i32 8)
%14 = tail call i32 @quaggothspore(i32 %13)
br label %19
15: ; preds = %1
%16 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %12, %9, %6, %3
ret void
}