#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*/ godvision(int *, int *, int *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stonestatue(int *, int *, int *, int, int, int);
int /*<<< orphan*/ treasure(int *, int *, int *, int *, int *, int *, int *,
                            int *, int *, int *, int *, int *, int,
                            int /*<<< orphan*/, int);
void genie(int *hpmax, int *hpnow, int *aces, int *inv, int *slave, int *future,
           int *map, int *loot, int *vision, int *end, int *pos, int *antimag,
           int r, int combat) {
  if (r == 12) {
    printf("You rub the lantern! From the smoke, a djinn of Life "
           "appears!\nYour maximum HP are increased by 2!\n");
    *hpmax = *hpmax + 2;
    return;
  }
  if (r == 25) {
    printf("You rub the lantern! From the smoke, a djinn of Luck appears!\nYou "
           "find some treasure!\n");
    treasure(hpmax, hpnow, aces, inv, slave, future, map, loot, vision, end,
             pos, antimag, 1, 0, combat);
    treasure(hpmax, hpnow, aces, inv, slave, future, map, loot, vision, end,
             pos, antimag, 1, 0, combat);
    treasure(hpmax, hpnow, aces, inv, slave, future, map, loot, vision, end,
             pos, antimag, 1, 0, combat);
    return;
  }
  if (r == 38) {
    printf("You rub the lantern! From the smoke, a djinn of Destiny "
           "appears!\nNow you know this floor perfectly!\n");
    godvision(aces, inv, vision, NULL, 1);
    return;
  }
  printf("You rub the lantern! From the smoke, a djinn of Death appears!\nYou "
         "can choose to kill 3 enemies!\n");
  stonestatue(aces, inv, map, 3, combat, 1);
}


x86 assembly (clang, -O0):
<genie>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9,-0x58(%rbp)
cmpl   $0xc,0x40(%rbp)
jne    11b1 <genie+0x71>
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
jmp    1372 <genie+0x232>
cmpl   $0x19,0x40(%rbp)
jne    1310 <genie+0x1d0>
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0x58(%rbp),%r9
mov    0x10(%rbp),%r12
mov    0x18(%rbp),%r15
mov    0x20(%rbp),%r14
mov    0x28(%rbp),%rbx
mov    0x30(%rbp),%r11
mov    0x38(%rbp),%r10
mov    0x48(%rbp),%eax
xor    %r13d,%r13d
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
movl   $0x1,0x30(%rsp)
movl   $0x0,0x38(%rsp)
mov    %eax,0x40(%rsp)
call   1030 <treasure@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0x58(%rbp),%r9
mov    0x10(%rbp),%r12
mov    0x18(%rbp),%r15
mov    0x20(%rbp),%r14
mov    0x28(%rbp),%rbx
mov    0x30(%rbp),%r11
mov    0x38(%rbp),%r10
mov    0x48(%rbp),%eax
xor    %r13d,%r13d
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
movl   $0x1,0x30(%rsp)
movl   $0x0,0x38(%rsp)
mov    %eax,0x40(%rsp)
call   1030 <treasure@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0x58(%rbp),%r9
mov    0x10(%rbp),%r12
mov    0x18(%rbp),%r15
mov    0x20(%rbp),%r14
mov    0x28(%rbp),%rbx
mov    0x30(%rbp),%r11
mov    0x38(%rbp),%r10
mov    0x48(%rbp),%eax
xor    %r13d,%r13d
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
movl   $0x1,0x30(%rsp)
movl   $0x0,0x38(%rsp)
mov    %eax,0x40(%rsp)
call   1030 <treasure@plt>
jmp    1372 <genie+0x232>
cmpl   $0x26,0x40(%rbp)
jne    1346 <genie+0x206>
lea    0xd99(%rip),%rdi
call   1040 <printf@plt>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    0x20(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    $0x1,%r8d
call   1050 <godvision@plt>
jmp    1372 <genie+0x232>
lea    0xdd2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    0x10(%rbp),%rdx
mov    0x48(%rbp),%r8d
mov    $0x3,%ecx
mov    $0x1,%r9d
call   1060 <stonestatue@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<genie>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rcx,0x8(%rsp)
mov    %rdx,%r12
mov    0xd0(%rsp),%eax
mov    0xb0(%rsp),%rdx
cmp    $0x26,%eax
je     11a3 <genie+0x63>
mov    %rdi,%rbx
mov    0xd8(%rsp),%r14d
mov    0xa0(%rsp),%rcx
cmp    $0x19,%eax
je     11d8 <genie+0x98>
cmp    $0xc,%eax
jne    1326 <genie+0x1e6>
lea    0xf89(%rip),%rdi
call   1040 <puts@plt>
addl   $0x2,(%rbx)
add    $0x68,%rsp
jmp    131b <genie+0x1db>
lea    0xeb7(%rip),%rdi
mov    %rdx,%rbx
call   1040 <puts@plt>
mov    %r12,%rdi
mov    0x8(%rsp),%rsi
mov    %rbx,%rdx
xor    %ecx,%ecx
mov    $0x1,%r8d
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <godvision@plt>
mov    0xc8(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    0xc0(%rsp),%rax
mov    %rax,0x28(%rsp)
mov    0xb8(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0xa8(%rsp),%rax
mov    %rax,0x30(%rsp)
lea    0xeb2(%rip),%rdi
mov    %rcx,0x58(%rsp)
mov    %rdx,0x38(%rsp)
mov    %r14,0x48(%rsp)
mov    %rbx,0x50(%rsp)
mov    %r9,%r13
mov    %r9,0x40(%rsp)
mov    %r8,%r15
mov    %r8,0x60(%rsp)
mov    %rsi,%rbp
mov    %rsi,0x20(%rsp)
call   1040 <puts@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
mov    0x10(%rsp),%rbx
mov    %rbx,%rcx
mov    %r15,%r8
mov    %r13,%r9
push   %r14
push   $0x0
push   $0x1
push   0x30(%rsp)
mov    %r12,%rbp
mov    0x50(%rsp),%r13
push   %r13
push   0x48(%rsp)
push   0x70(%rsp)
mov    0x70(%rsp),%r14
push   %r14
mov    0xa0(%rsp),%r15
push   %r15
call   1030 <treasure@plt>
add    $0x48,%rsp
mov    0x58(%rsp),%r12
mov    %r12,%rdi
mov    0x28(%rsp),%rsi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    0x68(%rsp),%rbx
mov    %rbx,%r8
mov    0x48(%rsp),%r9
push   0x50(%rsp)
push   $0x0
push   $0x1
push   0x30(%rsp)
push   %r13
push   0x48(%rsp)
mov    0x70(%rsp),%r13
push   %r13
push   %r14
push   %r15
call   1030 <treasure@plt>
add    $0x48,%rsp
mov    %r12,%rdi
mov    0x28(%rsp),%rsi
mov    %rbp,%rdx
mov    0x10(%rsp),%rcx
mov    %rbx,%r8
mov    0x48(%rsp),%r9
push   0x50(%rsp)
push   $0x0
push   $0x1
push   0x30(%rsp)
push   0x50(%rsp)
push   0x48(%rsp)
push   %r13
push   0x70(%rsp)
push   %r15
call   1030 <treasure@plt>
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcd3(%rip),%rdi
mov    %rcx,%rbx
call   1040 <puts@plt>
mov    %r12,%rdi
mov    0x8(%rsp),%rsi
mov    %rbx,%rdx
mov    $0x3,%ecx
mov    %r14d,%r8d
mov    $0x1,%r9d
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <stonestatue@plt>

LLVM IR (-O0):
@.str = [99 x i8] c"You rub the lantern! From the smoke, a djinn of Life appears!\0AYour maximum HP are increased by 2!\0A\00"
@.str.1 = [87 x i8] c"You rub the lantern! From the smoke, a djinn of Luck appears!\0AYou find some treasure!\0A\00"
@.str.2 = [101 x i8] c"You rub the lantern! From the smoke, a djinn of Destiny appears!\0ANow you know this floor perfectly!\0A\00"
@.str.3 = [98 x i8] c"You rub the lantern! From the smoke, a djinn of Death appears!\0AYou can choose to kill 3 enemies!\0A\00"
define void @genie(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32 %12, i32 %13) {
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i32*
%24 = alloca i32*
%25 = alloca i32*
%26 = alloca i32*
%27 = alloca i32
%28 = alloca i32
store i32* %0, i32** %15
store i32* %1, i32** %16
store i32* %2, i32** %17
store i32* %3, i32** %18
store i32* %4, i32** %19
store i32* %5, i32** %20
store i32* %6, i32** %21
store i32* %7, i32** %22
store i32* %8, i32** %23
store i32* %9, i32** %24
store i32* %10, i32** %25
store i32* %11, i32** %26
store i32 %12, i32* %27
store i32 %13, i32* %28
%29 = load i32, i32* %27
%30 = icmp eq i32 %29, 12
br i1 %30, label %31, label %37
31: ; preds = %14
%32 = call i32 @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
%33 = load i32*, i32** %15
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 2
%36 = load i32*, i32** %15
store i32 %35, i32* %36
br label %100
37: ; preds = %14
%38 = load i32, i32* %27
%39 = icmp eq i32 %38, 25
br i1 %39, label %40, label %84
40: ; preds = %37
%41 = call i32 @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.1, i64 0, i64 0))
%42 = load i32*, i32** %15
%43 = load i32*, i32** %16
%44 = load i32*, i32** %17
%45 = load i32*, i32** %18
%46 = load i32*, i32** %19
%47 = load i32*, i32** %20
%48 = load i32*, i32** %21
%49 = load i32*, i32** %22
%50 = load i32*, i32** %23
%51 = load i32*, i32** %24
%52 = load i32*, i32** %25
%53 = load i32*, i32** %26
%54 = load i32, i32* %28
%55 = call i32 @treasure(i32* %42, i32* %43, i32* %44, i32* %45, i32* %46, i32* %47, i32* %48, i32* %49, i32* %50, i32* %51, i32* %52, i32* %53, i32 1, i32 0, i32 %54)
%56 = load i32*, i32** %15
%57 = load i32*, i32** %16
%58 = load i32*, i32** %17
%59 = load i32*, i32** %18
%60 = load i32*, i32** %19
%61 = load i32*, i32** %20
%62 = load i32*, i32** %21
%63 = load i32*, i32** %22
%64 = load i32*, i32** %23
%65 = load i32*, i32** %24
%66 = load i32*, i32** %25
%67 = load i32*, i32** %26
%68 = load i32, i32* %28
%69 = call i32 @treasure(i32* %56, i32* %57, i32* %58, i32* %59, i32* %60, i32* %61, i32* %62, i32* %63, i32* %64, i32* %65, i32* %66, i32* %67, i32 1, i32 0, i32 %68)
%70 = load i32*, i32** %15
%71 = load i32*, i32** %16
%72 = load i32*, i32** %17
%73 = load i32*, i32** %18
%74 = load i32*, i32** %19
%75 = load i32*, i32** %20
%76 = load i32*, i32** %21
%77 = load i32*, i32** %22
%78 = load i32*, i32** %23
%79 = load i32*, i32** %24
%80 = load i32*, i32** %25
%81 = load i32*, i32** %26
%82 = load i32, i32* %28
%83 = call i32 @treasure(i32* %70, i32* %71, i32* %72, i32* %73, i32* %74, i32* %75, i32* %76, i32* %77, i32* %78, i32* %79, i32* %80, i32* %81, i32 1, i32 0, i32 %82)
br label %100
84: ; preds = %37
%85 = load i32, i32* %27
%86 = icmp eq i32 %85, 38
br i1 %86, label %87, label %93
87: ; preds = %84
%88 = call i32 @printf(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.2, i64 0, i64 0))
%89 = load i32*, i32** %17
%90 = load i32*, i32** %18
%91 = load i32*, i32** %23
%92 = call i32 @godvision(i32* %89, i32* %90, i32* %91, i32* null, i32 1)
br label %100
93: ; preds = %84
%94 = call i32 @printf(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.3, i64 0, i64 0))
%95 = load i32*, i32** %17
%96 = load i32*, i32** %18
%97 = load i32*, i32** %21
%98 = load i32, i32* %28
%99 = call i32 @stonestatue(i32* %95, i32* %96, i32* %97, i32 3, i32 %98, i32 1)
br label %100
100: ; preds = %93, %87, %40, %31
ret void
}

LLVM IR (-O2):
@str = [97 x i8] c"You rub the lantern! From the smoke, a djinn of Death appears!\0AYou can choose to kill 3 enemies!\00"
@str.4 = [100 x i8] c"You rub the lantern! From the smoke, a djinn of Destiny appears!\0ANow you know this floor perfectly!\00"
@str.5 = [86 x i8] c"You rub the lantern! From the smoke, a djinn of Luck appears!\0AYou find some treasure!\00"
@str.6 = [98 x i8] c"You rub the lantern! From the smoke, a djinn of Life appears!\0AYour maximum HP are increased by 2!\00"
define void @genie(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32 %12, i32 %13) {
switch i32 %12, label %27 [
i32 12, label %15
i32 25, label %19
i32 38, label %24
]
15: ; preds = %14
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @str.6, i64 0, i64 0))
%17 = load i32, i32* %0
%18 = add nsw i32 %17, 2
store i32 %18, i32* %0
br label %30
19: ; preds = %14
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @str.5, i64 0, i64 0))
%21 = tail call i32 @treasure(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32 1, i32 0, i32 %13)
%22 = tail call i32 @treasure(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32 1, i32 0, i32 %13)
%23 = tail call i32 @treasure(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32 1, i32 0, i32 %13)
br label %30
24: ; preds = %14
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @str.4, i64 0, i64 0))
%26 = tail call i32 @godvision(i32* %2, i32* %3, i32* %8, i32* null, i32 1)
br label %30
27: ; preds = %14
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([97 x i8], [97 x i8]* @str, i64 0, i64 0))
%29 = tail call i32 @stonestatue(i32* %2, i32* %3, i32* %6, i32 3, i32 %13, i32 1)
br label %30
30: ; preds = %27, %24, %19, %15
ret void
}