#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 */
scalar_t__ d(int);
int /*<<< orphan*/ duergar(scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ goblin(scalar_t__);
int /*<<< orphan*/ grimlock(scalar_t__);
int /*<<< orphan*/ halfling(scalar_t__);
int /*<<< orphan*/ human(scalar_t__);
int /*<<< orphan*/ kobold(scalar_t__);
int /*<<< orphan*/ niceprint(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ shielddwarf(scalar_t__);
void caravan() {
  niceprint(
      "The characters encounter a group of duergar slavers hearding unarmed "
      "slaves.  The slaves wear iron collars "
      "manacles similar to the ones worn by the characters in Velkynvele.");
  (void)putchar('\n');
  duergar(d(4) + 1, 0);
  printf("Slaves:\n\n");
  switch (6) {
  case 1:
    human(d(4) + d(4));
    break;
  case 2:
    shielddwarf(d(4) + d(4) + d(4));
    break;
  case 3:
    halfling(d(4) + d(4));
    break;
  case 4:
    goblin(d(6) + d(6) + d(6));
    break;
  case 5:
    grimlock(d(6) + d(6));
    break;
  case 6:
    kobold(d(6) + d(6) + d(6));
    break;
  }
}


x86 assembly (clang, -O0):
<caravan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
call   1080 <niceprint@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x4,%edi
call   1040 <d@plt>
mov    %rax,%rdi
add    $0x1,%rdi
xor    %esi,%esi
call   1060 <duergar@plt>
lea    0xf11(%rip),%rdi
call   1050 <printf@plt>
mov    $0x6,%edi
call   1040 <d@plt>
mov    %rax,-0x10(%rbp)
mov    $0x6,%edi
call   1040 <d@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    $0x6,%edi
call   1040 <d@plt>
mov    -0x8(%rbp),%rdi
add    %rax,%rdi
call   1070 <kobold@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caravan>:
push   %rbx
lea    0xe98(%rip),%rdi
call   1080 <niceprint@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x4,%edi
call   1050 <d@plt>
lea    0x1(%rax),%rdi
xor    %esi,%esi
call   1060 <duergar@plt>
lea    0xf1b(%rip),%rdi
call   1040 <puts@plt>
mov    $0x6,%edi
call   1050 <d@plt>
mov    %rax,%rbx
mov    $0x6,%edi
call   1050 <d@plt>
add    %rax,%rbx
mov    $0x6,%edi
call   1050 <d@plt>
add    %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1070 <kobold@plt>

LLVM IR (-O0):
@.str = [174 x i8] c"The characters encounter a group of duergar slavers hearding unarmed slaves. The slaves wear iron collars manacles similar to the ones worn by the characters in Velkynvele.\00"
@.str.1 = [10 x i8] c"Slaves:\0A\0A\00"
define void @caravan() {
%1 = call i32 @niceprint(i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @putchar(i8 signext 10)
%3 = call i64 @d(i32 4)
%4 = add nsw i64 %3, 1
%5 = call i32 @duergar(i64 %4, i32 0)
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%7 = call i64 @d(i32 6)
%8 = call i64 @d(i32 6)
%9 = add nsw i64 %7, %8
%10 = call i64 @d(i32 6)
%11 = add nsw i64 %9, %10
%12 = call i32 @kobold(i64 %11)
ret void
}

LLVM IR (-O2):
@.str = [174 x i8] c"The characters encounter a group of duergar slavers hearding unarmed slaves. The slaves wear iron collars manacles similar to the ones worn by the characters in Velkynvele.\00"
@str = [9 x i8] c"Slaves:\0A\00"
define void @caravan() {
%1 = tail call i32 @niceprint(i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @putchar(i8 signext 10)
%3 = tail call i64 @d(i32 4)
%4 = add nsw i64 %3, 1
%5 = tail call i32 @duergar(i64 %4, i32 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%7 = tail call i64 @d(i32 6)
%8 = tail call i64 @d(i32 6)
%9 = add nsw i64 %8, %7
%10 = tail call i64 @d(i32 6)
%11 = add nsw i64 %9, %10
%12 = tail call i32 @kobold(i64 %11)
ret void
}