#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*/ derrosavant(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ kuotoa(int);
int /*<<< orphan*/ mindflayer(int);
int /*<<< orphan*/ niceprint(char *);
int /*<<< orphan*/ orog(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ troglodyte(int);
void society(unsigned d10) {
  niceprint(
      "The party stumbles upon a member of the Society of Brilliance, a sect "
      "of highly intelligent monsters that have banded togehter to solve all "
      "of "
      "the Underdark's problems. The society is investigating areas suffused "
      "with "
      "faerzress to ascertain whether it has something to do with what the "
      "society "
      "fears is some kind of \"demonic incursion.\"\n\n");
  switch (d10) {
  case 1:
  case 2:
    printf("Y the derro savant\n\n");
    derrosavant(1);
    break;
  case 3:
  case 4:
    printf("Blurg the orog\n\n");
    orog(1);
    break;
  case 5:
  case 6:
    printf("Grazilaxx the mind flayer\n\n");
    mindflayer(1);
    niceprint("He prefers to use telepathy to communicate\n\n");
    break;
  case 7:
  case 8:
    printf("Skriss the troglodyte\n\n");
    troglodyte(1);
    break;
  case 9:
  case 10:
    printf("Sloopidoop the kuo-toa archpriest\n\n");
    kuotoa(1);
    break;
  default:
    printf("Impossible society encounter of %d\n", d10);
    exit(EXIT_FAILURE);
  }
  niceprint(
      "Alignment: Netural\nIntelligence: 18 (+4)\nFluent in multiple langages "
      "including: Dwarvish, Elvish, and Undercommon\n\n");
  niceprint("He is erudite and talkative, prefering deplomacy and debate over "
            "violence.\n\n");
  niceprint("Can cast teleport once per day if the intended destination is "
            "within 30' of "
            "another society member but faerzress disrupts this ability\n\n");
  niceprint("He is aware that paths to the surface world exist but has not "
            "explored any of "
            "them since his concern is with the Underdark. If the characters "
            "seem intent on "
            "reaching the surface, he might suggest they look for a guide in "
            "one of the "
            "Underdark's larger settlements, such as Blingdensone or "
            "Gracklstugh. And, he "
            "can proide detailed verbal directions; however, cannot guarantee "
            "that the "
            "route is safe. Otherwise, he will provide whatever assistance he "
            "can.\n\n");
}


x86 assembly (clang, -O0):
<society>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xe96(%rip),%rdi
call   1070 <niceprint@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     125d <society+0xdd>
mov    -0x10(%rbp),%rax
lea    0xe49(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <derrosavant@plt>
jmp    127c <society+0xfc>
lea    0xfac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <orog@plt>
jmp    127c <society+0xfc>
lea    0xfa0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <mindflayer@plt>
lea    0xfa4(%rip),%rdi
call   1070 <niceprint@plt>
jmp    127c <society+0xfc>
lea    0xfc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <troglodyte@plt>
jmp    127c <society+0xfc>
lea    0xfbb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <kuotoa@plt>
jmp    127c <society+0xfc>
mov    -0x4(%rbp),%esi
lea    0xfbf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
lea    0xfc7(%rip),%rdi
call   1070 <niceprint@plt>
lea    0x102f(%rip),%rdi
call   1070 <niceprint@plt>
lea    0x1070(%rip),%rdi
call   1070 <niceprint@plt>
lea    0x10ed(%rip),%rdi
call   1070 <niceprint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<society>:
push   %rbx
mov    %edi,%ebx
lea    0xe8e(%rip),%rdi
call   1080 <niceprint@plt>
lea    -0x1(%rbx),%eax
cmp    $0x9,%eax
ja     126e <society+0xde>
lea    0xe4e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1380(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1030 <derrosavant@plt>
jmp    123d <society+0xad>
lea    0x1358(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1070 <orog@plt>
jmp    123d <society+0xad>
lea    0x1325(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1060 <mindflayer@plt>
lea    0xf73(%rip),%rdi
call   1080 <niceprint@plt>
jmp    123d <society+0xad>
lea    0x12ea(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10a0 <troglodyte@plt>
jmp    123d <society+0xad>
lea    0x12af(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10b0 <kuotoa@plt>
lea    0xf88(%rip),%rdi
call   1080 <niceprint@plt>
lea    0xff0(%rip),%rdi
call   1080 <niceprint@plt>
lea    0x1031(%rip),%rdi
call   1080 <niceprint@plt>
lea    0x10ae(%rip),%rdi
pop    %rbx
jmp    1080 <niceprint@plt>
lea    0xf33(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [339 x i8] c"The party stumbles upon a member of the Society of Brilliance, a sect of highly intelligent monsters that have banded togehter to solve all of the Underdark's problems. The society is investigating areas suffused with faerzress to ascertain whether it has something to do with what the society fears is some kind of \22demonic incursion.\22\0A\0A\00"
@.str.1 = [21 x i8] c"Y the derro savant\0A\0A\00"
@.str.2 = [17 x i8] c"Blurg the orog\0A\0A\00"
@.str.3 = [28 x i8] c"Grazilaxx the mind flayer\0A\0A\00"
@.str.4 = [45 x i8] c"He prefers to use telepathy to communicate\0A\0A\00"
@.str.5 = [24 x i8] c"Skriss the troglodyte\0A\0A\00"
@.str.6 = [36 x i8] c"Sloopidoop the kuo-toa archpriest\0A\0A\00"
@.str.7 = [36 x i8] c"Impossible society encounter of %d\0A\00"
@EXIT_FAILURE = global i32 0
@.str.8 = [116 x i8] c"Alignment: Netural\0AIntelligence: 18 (+4)\0AFluent in multiple langages including: Dwarvish, Elvish, and Undercommon\0A\0A\00"
@.str.9 = [77 x i8] c"He is erudite and talkative, prefering deplomacy and debate over violence.\0A\0A\00"
@.str.10 = [137 x i8] c"Can cast teleport once per day if the intended destination is within 30' of another society member but faerzress disrupts this ability\0A\0A\00"
@.str.11 = [455 x i8] c"He is aware that paths to the surface world exist but has not explored any of them since his concern is with the Underdark. If the characters seem intent on reaching the surface, he might suggest they look for a guide in one of the Underdark's larger settlements, such as Blingdensone or Gracklstugh. And, he can proide detailed verbal directions; however, cannot guarantee that the route is safe. Otherwise, he will provide whatever assistance he can.\0A\0A\00"
define void @society(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @niceprint(i8* getelementptr inbounds ([339 x i8], [339 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
switch i32 %4, label %21 [
i32 1, label %5
i32 2, label %5
i32 3, label %8
i32 4, label %8
i32 5, label %11
i32 6, label %11
i32 7, label %15
i32 8, label %15
i32 9, label %18
i32 10, label %18
]
5: ; preds = %1, %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @derrosavant(i32 1)
br label %26
8: ; preds = %1, %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @orog(i32 1)
br label %26
11: ; preds = %1, %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @mindflayer(i32 1)
%14 = call i32 @niceprint(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
br label %26
15: ; preds = %1, %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @troglodyte(i32 1)
br label %26
18: ; preds = %1, %1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 @kuotoa(i32 1)
br label %26
21: ; preds = %1
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i32 %22)
%24 = load i32, i32* @EXIT_FAILURE
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %18, %15, %11, %8, %5
%27 = call i32 @niceprint(i8* getelementptr inbounds ([116 x i8], [116 x i8]* @.str.8, i64 0, i64 0))
%28 = call i32 @niceprint(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.9, i64 0, i64 0))
%29 = call i32 @niceprint(i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.10, i64 0, i64 0))
%30 = call i32 @niceprint(i8* getelementptr inbounds ([455 x i8], [455 x i8]* @.str.11, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [339 x i8] c"The party stumbles upon a member of the Society of Brilliance, a sect of highly intelligent monsters that have banded togehter to solve all of the Underdark's problems. The society is investigating areas suffused with faerzress to ascertain whether it has something to do with what the society fears is some kind of \22demonic incursion.\22\0A\0A\00"
@.str.4 = [45 x i8] c"He prefers to use telepathy to communicate\0A\0A\00"
@.str.7 = [36 x i8] c"Impossible society encounter of %d\0A\00"
@EXIT_FAILURE = global i32 0
@.str.8 = [116 x i8] c"Alignment: Netural\0AIntelligence: 18 (+4)\0AFluent in multiple langages including: Dwarvish, Elvish, and Undercommon\0A\0A\00"
@.str.9 = [77 x i8] c"He is erudite and talkative, prefering deplomacy and debate over violence.\0A\0A\00"
@.str.10 = [137 x i8] c"Can cast teleport once per day if the intended destination is within 30' of another society member but faerzress disrupts this ability\0A\0A\00"
@.str.11 = [455 x i8] c"He is aware that paths to the surface world exist but has not explored any of them since his concern is with the Underdark. If the characters seem intent on reaching the surface, he might suggest they look for a guide in one of the Underdark's larger settlements, such as Blingdensone or Gracklstugh. And, he can proide detailed verbal directions; however, cannot guarantee that the route is safe. Otherwise, he will provide whatever assistance he can.\0A\0A\00"
@str = [35 x i8] c"Sloopidoop the kuo-toa archpriest\0A\00"
@str.12 = [23 x i8] c"Skriss the troglodyte\0A\00"
@str.13 = [27 x i8] c"Grazilaxx the mind flayer\0A\00"
@str.14 = [16 x i8] c"Blurg the orog\0A\00"
@str.15 = [20 x i8] c"Y the derro savant\0A\00"
define void @society(i32 %0) {
%2 = tail call i32 @niceprint(i8* getelementptr inbounds ([339 x i8], [339 x i8]* @.str, i64 0, i64 0))
switch i32 %0, label %19 [
i32 1, label %3
i32 2, label %3
i32 3, label %6
i32 4, label %6
i32 5, label %9
i32 6, label %9
i32 7, label %13
i32 8, label %13
i32 9, label %16
i32 10, label %16
]
3: ; preds = %1, %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.15, i64 0, i64 0))
%5 = tail call i32 @derrosavant(i32 1)
br label %23
6: ; preds = %1, %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.14, i64 0, i64 0))
%8 = tail call i32 @orog(i32 1)
br label %23
9: ; preds = %1, %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.13, i64 0, i64 0))
%11 = tail call i32 @mindflayer(i32 1)
%12 = tail call i32 @niceprint(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
br label %23
13: ; preds = %1, %1
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.12, i64 0, i64 0))
%15 = tail call i32 @troglodyte(i32 1)
br label %23
16: ; preds = %1, %1
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%18 = tail call i32 @kuotoa(i32 1)
br label %23
19: ; preds = %1
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i32 %0)
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @exit(i32 %21)
unreachable
23: ; preds = %16, %13, %9, %6, %3
%24 = tail call i32 @niceprint(i8* getelementptr inbounds ([116 x i8], [116 x i8]* @.str.8, i64 0, i64 0))
%25 = tail call i32 @niceprint(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.9, i64 0, i64 0))
%26 = tail call i32 @niceprint(i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.10, i64 0, i64 0))
%27 = tail call i32 @niceprint(i8* getelementptr inbounds ([455 x i8], [455 x i8]* @.str.11, i64 0, i64 0))
ret void
}