#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 d(int);
int /*<<< orphan*/ niceprint(char *);
int /*<<< orphan*/ printf(char *, int);
void falls(void) {
  niceprint(
      "Characters with a passive Wisdom (Perception) score of 12 or better can "
      "hear the roar of a waterfall ahead.\n\n");
  printf("Fall Height: %d feet\n", 10 * d(6));
  printf("Fall Pool Depth: %d feet\n\n", 5 * d(6));
  if (d(2) == 1) {
    niceprint("A successful DC 14 group Strength (Athletics) check is "
              "neccessary to steer "
              "or swim away from the falls. Otherwise, the characters go over, "
              "falling into "
              "a pool or river. A character swept over the fall must succeed "
              "on a DC 11 "
              "Dexterity saving through or take 1d6 per 10' fallen. A "
              "successful save "
              "indicates that the creature avoids a hard landing in the water "
              "below.\n\n");
  } else {
    niceprint("A duergar-built lock designed to traverse it, in which case "
              "there is no risk "
              "of going over the falls. It takes a successful DC 11 "
              "Intelligence (Investigation) "
              "check to figure out how to operate the lock. Once a lock is "
              "opened, it takes 1 hour "
              "for the water level to lower so the party can proceed.\n\n");
  }
}


x86 assembly (clang, -O0):
<falls>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1050 <niceprint@plt>
mov    $0x6,%edi
call   1030 <d@plt>
imul   $0xa,%eax,%esi
lea    0xf1a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x6,%edi
call   1030 <d@plt>
imul   $0x5,%eax,%esi
lea    0xf17(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1030 <d@plt>
cmp    $0x1,%eax
jne    1196 <falls+0x66>
lea    0xf13(%rip),%rdi
call   1050 <niceprint@plt>
jmp    11a2 <falls+0x72>
lea    0x1072(%rip),%rdi
call   1050 <niceprint@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<falls>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <niceprint@plt>
mov    $0x6,%edi
call   1030 <d@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%esi
lea    0xf1b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x6,%edi
call   1030 <d@plt>
lea    (%rax,%rax,4),%esi
lea    0xf18(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1030 <d@plt>
cmp    $0x1,%eax
lea    0xf1a(%rip),%rax
lea    0x1083(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1050 <niceprint@plt>

LLVM IR (-O0):
@.str = [110 x i8] c"Characters with a passive Wisdom (Perception) score of 12 or better can hear the roar of a waterfall ahead.\0A\0A\00"
@.str.1 = [22 x i8] c"Fall Height: %d feet\0A\00"
@.str.2 = [27 x i8] c"Fall Pool Depth: %d feet\0A\0A\00"
@.str.3 = [368 x i8] c"A successful DC 14 group Strength (Athletics) check is neccessary to steer or swim away from the falls. Otherwise, the characters go over, falling into a pool or river. A character swept over the fall must succeed on a DC 11 Dexterity saving through or take 1d6 per 10' fallen. A successful save indicates that the creature avoids a hard landing in the water below.\0A\0A\00"
@.str.4 = [300 x i8] c"A duergar-built lock designed to traverse it, in which case there is no risk of going over the falls. It takes a successful DC 11 Intelligence (Investigation) check to figure out how to operate the lock. Once a lock is opened, it takes 1 hour for the water level to lower so the party can proceed.\0A\0A\00"
define void @falls() {
%1 = call i32 @niceprint(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @d(i32 6)
%3 = mul nsw i32 10, %2
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = call i32 @d(i32 6)
%6 = mul nsw i32 5, %5
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = call i32 @d(i32 2)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @niceprint(i8* getelementptr inbounds ([368 x i8], [368 x i8]* @.str.3, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @niceprint(i8* getelementptr inbounds ([300 x i8], [300 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
ret void
}

LLVM IR (-O2):
@.str = [110 x i8] c"Characters with a passive Wisdom (Perception) score of 12 or better can hear the roar of a waterfall ahead.\0A\0A\00"
@.str.1 = [22 x i8] c"Fall Height: %d feet\0A\00"
@.str.2 = [27 x i8] c"Fall Pool Depth: %d feet\0A\0A\00"
@.str.3 = [368 x i8] c"A successful DC 14 group Strength (Athletics) check is neccessary to steer or swim away from the falls. Otherwise, the characters go over, falling into a pool or river. A character swept over the fall must succeed on a DC 11 Dexterity saving through or take 1d6 per 10' fallen. A successful save indicates that the creature avoids a hard landing in the water below.\0A\0A\00"
@.str.4 = [300 x i8] c"A duergar-built lock designed to traverse it, in which case there is no risk of going over the falls. It takes a successful DC 11 Intelligence (Investigation) check to figure out how to operate the lock. Once a lock is opened, it takes 1 hour for the water level to lower so the party can proceed.\0A\0A\00"
define void @falls() {
%1 = tail call i32 @niceprint(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @d(i32 6)
%3 = mul nsw i32 %2, 10
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @d(i32 6)
%6 = mul nsw i32 %5, 5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = tail call i32 @d(i32 2)
%9 = icmp eq i32 %8, 1
%10 = select i1 %9, i8* getelementptr inbounds ([368 x i8], [368 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([300 x i8], [300 x i8]* @.str.4, i64 0, i64 0)
%11 = tail call i32 @niceprint(i8* %10)
ret void
}