#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 */
unsigned int d(int);
int /*<<< orphan*/ minotaurskeletons(unsigned int);
int /*<<< orphan*/ niceprint(char *);
int /*<<< orphan*/ skeletons(unsigned int);
void boneyard(void) {
  unsigned d20;
  niceprint(
      "An eerie cavern littered with countless bones of various creatures. "
      "It is unclear if this is the natural graveyard for some Underdark "
      "species "
      "or the former lair of a fearsome predator. The characters can "
      "potentially "
      "gather useful material for crafting among the bones.\n\n");
  d20 = d(20);
  if (d20 < 15)
    return;
  if (d20 < 19)
    skeletons(d(4) + d(4) + d(4));
  else
    minotaurskeletons(d(3));
}


x86 assembly (clang, -O0):
<boneyard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1050 <niceprint@plt>
mov    $0x14,%edi
call   1030 <d@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xf,-0x4(%rbp)
jae    1170 <boneyard+0x30>
jmp    11c5 <boneyard+0x85>
cmpl   $0x13,-0x4(%rbp)
jae    11b4 <boneyard+0x74>
mov    $0x4,%edi
call   1030 <d@plt>
mov    %eax,-0xc(%rbp)
mov    $0x4,%edi
call   1030 <d@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x4,%edi
call   1030 <d@plt>
mov    -0x8(%rbp),%edi
add    %eax,%edi
call   1060 <skeletons@plt>
jmp    11c5 <boneyard+0x85>
mov    $0x3,%edi
call   1030 <d@plt>
mov    %eax,%edi
call   1040 <minotaurskeletons@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boneyard>:
push   %rbx
lea    0xeb8(%rip),%rdi
call   1050 <niceprint@plt>
mov    $0x14,%edi
call   1030 <d@plt>
cmp    $0xf,%eax
jae    115e <boneyard+0x1e>
pop    %rbx
ret
cmp    $0x12,%eax
ja     118f <boneyard+0x4f>
mov    $0x4,%edi
call   1030 <d@plt>
mov    %eax,%ebx
mov    $0x4,%edi
call   1030 <d@plt>
add    %eax,%ebx
mov    $0x4,%edi
call   1030 <d@plt>
add    %eax,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1060 <skeletons@plt>
mov    $0x3,%edi
call   1030 <d@plt>
mov    %eax,%edi
pop    %rbx
jmp    1040 <minotaurskeletons@plt>

LLVM IR (-O0):
@.str = [271 x i8] c"An eerie cavern littered with countless bones of various creatures. It is unclear if this is the natural graveyard for some Underdark species or the former lair of a fearsome predator. The characters can potentially gather useful material for crafting among the bones.\0A\0A\00"
define void @boneyard() {
%1 = alloca i32
%2 = call i32 @niceprint(i8* getelementptr inbounds ([271 x i8], [271 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @d(i32 20)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp ult i32 %4, 15
br i1 %5, label %6, label %7
6: ; preds = %0
br label %20
7: ; preds = %0
%8 = load i32, i32* %1
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = call i32 @d(i32 4)
%12 = call i32 @d(i32 4)
%13 = add i32 %11, %12
%14 = call i32 @d(i32 4)
%15 = add i32 %13, %14
%16 = call i32 @skeletons(i32 %15)
br label %20
17: ; preds = %7
%18 = call i32 @d(i32 3)
%19 = call i32 @minotaurskeletons(i32 %18)
br label %20
20: ; preds = %6, %17, %10
ret void
}

LLVM IR (-O2):
@.str = [271 x i8] c"An eerie cavern littered with countless bones of various creatures. It is unclear if this is the natural graveyard for some Underdark species or the former lair of a fearsome predator. The characters can potentially gather useful material for crafting among the bones.\0A\0A\00"
define void @boneyard() {
%1 = tail call i32 @niceprint(i8* getelementptr inbounds ([271 x i8], [271 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @d(i32 20)
%3 = icmp ult i32 %2, 15
br i1 %3, label %16, label %4
4: ; preds = %0
%5 = icmp ult i32 %2, 19
br i1 %5, label %6, label %13
6: ; preds = %4
%7 = tail call i32 @d(i32 4)
%8 = tail call i32 @d(i32 4)
%9 = add i32 %8, %7
%10 = tail call i32 @d(i32 4)
%11 = add i32 %9, %10
%12 = tail call i32 @skeletons(i32 %11)
br label %16
13: ; preds = %4
%14 = tail call i32 @d(i32 3)
%15 = tail call i32 @minotaurskeletons(i32 %14)
br label %16
16: ; preds = %6, %13, %0
ret void
}