#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*/ duergar(int, int /*<<< orphan*/);
int /*<<< orphan*/ malesteeder(int);
int /*<<< orphan*/ niceprint(char *);
int /*<<< orphan*/ patrol(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
void handlers() {
  niceprint("A group of duergar teamsters herd a clutch of male steeders.");
  (void)putchar('\n');
  duergar(d(4) + 1, 0);
  malesteeder(d(6) + d(6));
  if (d(2) == 1) {
    (void)putchar('\n');
    niceprint("The a few steeders start attacking nearby characters or "
              "bystanders.  The duergar keep the rest of the "
              "clutch in check, but they clamor for the characters' arrest if "
              "even one of the arachnids is killed. A "
              "nearby patrol hears the teamsters' clamor and arrives a few "
              "rounds later");
    printf("\n%d steeder(s) attacks\n\n", d(4));
    printf("The patrol arrives in %d rounds\n\n", d(6));
    (void)putchar('\n');
    patrol(1);
  }
}


x86 assembly (clang, -O0):
<handlers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe81(%rip),%rdi
call   1090 <niceprint@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x4,%edi
call   1050 <d@plt>
mov    %eax,%edi
add    $0x1,%edi
xor    %esi,%esi
call   1070 <duergar@plt>
mov    $0x6,%edi
call   1050 <d@plt>
mov    %eax,-0x4(%rbp)
mov    $0x6,%edi
call   1050 <d@plt>
mov    -0x4(%rbp),%edi
add    %eax,%edi
call   1080 <malesteeder@plt>
mov    $0x2,%edi
call   1050 <d@plt>
cmp    $0x1,%eax
jne    1232 <handlers+0xc2>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe54(%rip),%rdi
call   1090 <niceprint@plt>
mov    $0x4,%edi
call   1050 <d@plt>
mov    %eax,%esi
lea    0xf51(%rip),%rdi
call   1060 <printf@plt>
mov    $0x6,%edi
call   1050 <d@plt>
mov    %eax,%esi
lea    0xf52(%rip),%rdi
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1040 <patrol@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handlers>:
push   %rbx
lea    0xe88(%rip),%rdi
call   1090 <niceprint@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x4,%edi
call   1050 <d@plt>
lea    0x1(%rax),%edi
xor    %esi,%esi
call   1070 <duergar@plt>
mov    $0x6,%edi
call   1050 <d@plt>
mov    %eax,%ebx
mov    $0x6,%edi
call   1050 <d@plt>
add    %eax,%ebx
mov    %ebx,%edi
call   1080 <malesteeder@plt>
mov    $0x2,%edi
call   1050 <d@plt>
cmp    $0x1,%eax
jne    1224 <handlers+0xb4>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe63(%rip),%rdi
call   1090 <niceprint@plt>
mov    $0x4,%edi
call   1050 <d@plt>
lea    0xf62(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    $0x6,%edi
call   1050 <d@plt>
lea    0xf63(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
pop    %rbx
jmp    1040 <patrol@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [61 x i8] c"A group of duergar teamsters herd a clutch of male steeders.\00"
@.str.1 = [277 x i8] c"The a few steeders start attacking nearby characters or bystanders. The duergar keep the rest of the clutch in check, but they clamor for the characters' arrest if even one of the arachnids is killed. A nearby patrol hears the teamsters' clamor and arrives a few rounds later\00"
@.str.2 = [25 x i8] c"\0A%d steeder(s) attacks\0A\0A\00"
@.str.3 = [34 x i8] c"The patrol arrives in %d rounds\0A\0A\00"
define void @handlers() {
%1 = call i32 @niceprint(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @putchar(i8 signext 10)
%3 = call i32 @d(i32 4)
%4 = add nsw i32 %3, 1
%5 = call i32 @duergar(i32 %4, i32 0)
%6 = call i32 @d(i32 6)
%7 = call i32 @d(i32 6)
%8 = add nsw i32 %6, %7
%9 = call i32 @malesteeder(i32 %8)
%10 = call i32 @d(i32 2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %21
12: ; preds = %0
%13 = call i32 @putchar(i8 signext 10)
%14 = call i32 @niceprint(i8* getelementptr inbounds ([277 x i8], [277 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @d(i32 4)
%16 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 @d(i32 6)
%18 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = call i32 @putchar(i8 signext 10)
%20 = call i32 @patrol(i32 1)
br label %21
21: ; preds = %12, %0
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c"A group of duergar teamsters herd a clutch of male steeders.\00"
@.str.1 = [277 x i8] c"The a few steeders start attacking nearby characters or bystanders. The duergar keep the rest of the clutch in check, but they clamor for the characters' arrest if even one of the arachnids is killed. A nearby patrol hears the teamsters' clamor and arrives a few rounds later\00"
@.str.2 = [25 x i8] c"\0A%d steeder(s) attacks\0A\0A\00"
@.str.3 = [34 x i8] c"The patrol arrives in %d rounds\0A\0A\00"
define void @handlers() {
%1 = tail call i32 @niceprint(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @putchar(i8 signext 10)
%3 = tail call i32 @d(i32 4)
%4 = add nsw i32 %3, 1
%5 = tail call i32 @duergar(i32 %4, i32 0)
%6 = tail call i32 @d(i32 6)
%7 = tail call i32 @d(i32 6)
%8 = add nsw i32 %7, %6
%9 = tail call i32 @malesteeder(i32 %8)
%10 = tail call i32 @d(i32 2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %21
12: ; preds = %0
%13 = tail call i32 @putchar(i8 signext 10)
%14 = tail call i32 @niceprint(i8* getelementptr inbounds ([277 x i8], [277 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @d(i32 4)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = tail call i32 @d(i32 6)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = tail call i32 @putchar(i8 signext 10)
%20 = tail call i32 @patrol(i32 1)
br label %21
21: ; preds = %12, %0
ret void
}