#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*/ getint(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ treasure(int *, int *, int *, int *, int *, int *, int *,
                            int *, int *, int *, int *, int *, int, int, int);
void redqueen(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 rec, int stat, int combat) {
  int i;
  printf("You meet a white priestess, a gentle pixie!\n'Greetings! I want to "
         "help you, but you don't have to be greedy. Do you want a gift or you "
         "want to be healed?'\n");
  if (*antimag == 1) {
    printf("'Wait! I perceive an antimagic field, so I can't heal you... here "
           "a gift, I hope it will be useful...'\n");
    treasure(hpmax, hpnow, aces, inv, slave, future, map, loot, vision, end,
             pos, antimag, rec, stat, combat);
    return;
  } else {
    printf("[0]: Gift\n[1]: Heal\n");
  }
  do {
    getint(&i);
    if (i == 0) {
      printf(
          "'As you wish, here your gift!'\nThe white priestess disappears!\n");
      treasure(hpmax, hpnow, aces, inv, slave, future, map, loot, vision, end,
               pos, antimag, rec, stat, combat);
      return;
    }
    if (i == 1) {
      printf(
          "'As you wish, I will heal you!'\nThe white priestess disappears!\n");
      *hpnow = *hpmax;
      *(loot + *pos) = -1;
      *(vision + *pos) = 2;
      return;
    }
    printf("'I'm sorry, but I can't understand you... Do you want a gift or "
           "you want to be healed?'\n[0]: Gift\n[1]: Heal\n'");
    i = -1;
  } while (i == -1);
}


x86 assembly (clang, -O0):
<redqueen>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    0x50(%rbp),%eax
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)
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
mov    0x38(%rbp),%rax
cmpl   $0x1,(%rax)
jne    1220 <redqueen+0xf0>
lea    0xeff(%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),%rax
mov    %rax,-0x68(%rbp)
mov    0x18(%rbp),%r13
mov    0x20(%rbp),%r12
mov    0x28(%rbp),%r15
mov    0x30(%rbp),%r14
mov    0x38(%rbp),%rbx
mov    0x40(%rbp),%r11d
mov    0x48(%rbp),%r10d
mov    0x50(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,(%rsp)
mov    -0x60(%rbp),%eax
mov    %r13,0x8(%rsp)
mov    %r12,0x10(%rsp)
mov    %r15,0x18(%rsp)
mov    %r14,0x20(%rsp)
mov    %rbx,0x28(%rsp)
mov    %r11d,0x30(%rsp)
mov    %r10d,0x38(%rsp)
mov    %eax,0x40(%rsp)
call   1030 <treasure@plt>
jmp    1336 <redqueen+0x206>
lea    0xedd(%rip),%rdi
call   1040 <printf@plt>
jmp    1231 <redqueen+0x101>
lea    -0x5c(%rbp),%rdi
call   1050 <getint@plt>
cmpl   $0x0,-0x5c(%rbp)
jne    12ce <redqueen+0x19e>
lea    0xece(%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),%rax
mov    %rax,-0x78(%rbp)
mov    0x18(%rbp),%r13
mov    0x20(%rbp),%r12
mov    0x28(%rbp),%r15
mov    0x30(%rbp),%r14
mov    0x38(%rbp),%rbx
mov    0x40(%rbp),%r11d
mov    0x48(%rbp),%r10d
mov    0x50(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,(%rsp)
mov    -0x6c(%rbp),%eax
mov    %r13,0x8(%rsp)
mov    %r12,0x10(%rsp)
mov    %r15,0x18(%rsp)
mov    %r14,0x20(%rsp)
mov    %rbx,0x28(%rsp)
mov    %r11d,0x30(%rsp)
mov    %r10d,0x38(%rsp)
mov    %eax,0x40(%rsp)
call   1030 <treasure@plt>
jmp    1336 <redqueen+0x206>
cmpl   $0x1,-0x5c(%rbp)
jne    1319 <redqueen+0x1e9>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rax
mov    0x30(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    0x20(%rbp),%rax
mov    0x30(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0x2,(%rax,%rcx,4)
jmp    1336 <redqueen+0x206>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x5c(%rbp)
cmpl   $0xffffffff,-0x5c(%rbp)
je     1231 <redqueen+0x101>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<redqueen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,0x30(%rsp)
mov    %r8,0x28(%rsp)
mov    %rcx,0x40(%rsp)
mov    %rdx,0x38(%rsp)
mov    %rsi,%r12
mov    %rdi,%r13
mov    0xf0(%rsp),%eax
mov    %rax,0x48(%rsp)
mov    0xe8(%rsp),%eax
mov    %rax,0x50(%rsp)
mov    0xe0(%rsp),%eax
mov    %rax,0x58(%rsp)
mov    0xd8(%rsp),%r15
mov    0xd0(%rsp),%r14
mov    0xc8(%rsp),%rax
mov    %rax,0x68(%rsp)
mov    0xc0(%rsp),%rbp
mov    0xb8(%rsp),%rbx
mov    0xb0(%rsp),%rax
mov    %rax,0x70(%rsp)
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,0x60(%rsp)
cmpl   $0x1,(%r15)
jne    1216 <redqueen+0xd6>
lea    0xfb8(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    0x38(%rsp),%rdx
mov    0x40(%rsp),%rcx
mov    0x28(%rsp),%r8
mov    0x30(%rsp),%r9
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <treasure@plt>
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %rbp,0x20(%rsp)
lea    0xedd(%rip),%rdi
call   1040 <puts@plt>
lea    0xc(%rsp),%r14
lea    0xdc3(%rip),%r15
mov    %r12,%rbx
mov    0x40(%rsp),%r12
mov    %r13,%rbp
mov    0x38(%rsp),%r13
nopl   (%rax)
mov    %r14,%rdi
call   1060 <getint@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     1277 <redqueen+0x137>
test   %eax,%eax
je     12ad <redqueen+0x16d>
mov    %r15,%rdi
call   1050 <printf@plt>
movl   $0xffffffff,0xc(%rsp)
ff
jmp    1250 <redqueen+0x110>
lea    0xe9f(%rip),%rdi
call   1040 <puts@plt>
mov    0x0(%rbp),%eax
mov    %eax,(%rbx)
mov    0x10(%rsp),%rdx
movslq (%rdx),%rax
mov    0x18(%rsp),%rcx
movl   $0xffffffff,(%rcx,%rax,4)
movslq (%rdx),%rax
mov    0x20(%rsp),%rcx
movl   $0x2,(%rcx,%rax,4)
jmp    1309 <redqueen+0x1c9>
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
sub    $0x8,%rsp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    0x30(%rsp),%r8
mov    0x38(%rsp),%r9
push   0x50(%rsp)
push   0x60(%rsp)
push   0x70(%rsp)
push   0x80(%rsp)
push   0x38(%rsp)
push   0x98(%rsp)
push   0x58(%rsp)
push   0x58(%rsp)
push   0xb8(%rsp)
call   1030 <treasure@plt>
add    $0x50,%rsp
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [156 x i8] c"You meet a white priestess, a gentle pixie!\0A'Greetings! I want to help you, but you don't have to be greedy. Do you want a gift or you want to be healed?'\0A\00"
@.str.1 = [104 x i8] c"'Wait! I perceive an antimagic field, so I can't heal you... here a gift, I hope it will be useful...'\0A\00"
@.str.2 = [21 x i8] c"[0]: Gift\0A[1]: Heal\0A\00"
@.str.3 = [64 x i8] c"'As you wish, here your gift!'\0AThe white priestess disappears!\0A\00"
@.str.4 = [65 x i8] c"'As you wish, I will heal you!'\0AThe white priestess disappears!\0A\00"
@.str.5 = [110 x i8] c"'I'm sorry, but I can't understand you... Do you want a gift or you want to be healed?'\0A[0]: Gift\0A[1]: Heal\0A'\00"
define void @redqueen(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, i32 %14) {
%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
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
store i32* %0, i32** %16
store i32* %1, i32** %17
store i32* %2, i32** %18
store i32* %3, i32** %19
store i32* %4, i32** %20
store i32* %5, i32** %21
store i32* %6, i32** %22
store i32* %7, i32** %23
store i32* %8, i32** %24
store i32* %9, i32** %25
store i32* %10, i32** %26
store i32* %11, i32** %27
store i32 %12, i32* %28
store i32 %13, i32* %29
store i32 %14, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0))
%33 = load i32*, i32** %27
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %54
36: ; preds = %15
%37 = call i32 @printf(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str.1, i64 0, i64 0))
%38 = load i32*, i32** %16
%39 = load i32*, i32** %17
%40 = load i32*, i32** %18
%41 = load i32*, i32** %19
%42 = load i32*, i32** %20
%43 = load i32*, i32** %21
%44 = load i32*, i32** %22
%45 = load i32*, i32** %23
%46 = load i32*, i32** %24
%47 = load i32*, i32** %25
%48 = load i32*, i32** %26
%49 = load i32*, i32** %27
%50 = load i32, i32* %28
%51 = load i32, i32* %29
%52 = load i32, i32* %30
%53 = call i32 @treasure(i32* %38, i32* %39, i32* %40, i32* %41, i32* %42, i32* %43, i32* %44, i32* %45, i32* %46, i32* %47, i32* %48, i32* %49, i32 %50, i32 %51, i32 %52)
br label %102
54: ; preds = %15
%55 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %56
56: ; preds = %54
br label %57
57: ; preds = %99, %56
%58 = call i32 @getint(i32* %31)
%59 = load i32, i32* %31
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %79
61: ; preds = %57
%62 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.3, i64 0, i64 0))
%63 = load i32*, i32** %16
%64 = load i32*, i32** %17
%65 = load i32*, i32** %18
%66 = load i32*, i32** %19
%67 = load i32*, i32** %20
%68 = load i32*, i32** %21
%69 = load i32*, i32** %22
%70 = load i32*, i32** %23
%71 = load i32*, i32** %24
%72 = load i32*, i32** %25
%73 = load i32*, i32** %26
%74 = load i32*, i32** %27
%75 = load i32, i32* %28
%76 = load i32, i32* %29
%77 = load i32, i32* %30
%78 = call i32 @treasure(i32* %63, i32* %64, i32* %65, i32* %66, i32* %67, i32* %68, i32* %69, i32* %70, i32* %71, i32* %72, i32* %73, i32* %74, i32 %75, i32 %76, i32 %77)
br label %102
79: ; preds = %57
%80 = load i32, i32* %31
%81 = icmp eq i32 %80, 1
br i1 %81, label %82, label %97
82: ; preds = %79
%83 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.4, i64 0, i64 0))
%84 = load i32*, i32** %16
%85 = load i32, i32* %84
%86 = load i32*, i32** %17
store i32 %85, i32* %86
%87 = load i32*, i32** %23
%88 = load i32*, i32** %26
%89 = load i32, i32* %88
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i32, i32* %87, i64 %90
store i32 -1, i32* %91
%92 = load i32*, i32** %24
%93 = load i32*, i32** %26
%94 = load i32, i32* %93
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i32, i32* %92, i64 %95
store i32 2, i32* %96
br label %102
97: ; preds = %79
%98 = call i32 @printf(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %31
br label %99
99: ; preds = %97
%100 = load i32, i32* %31
%101 = icmp eq i32 %100, -1
br i1 %101, label %57, label %102
102: ; preds = %36, %61, %82, %99
ret void
}

LLVM IR (-O2):
@.str.5 = [110 x i8] c"'I'm sorry, but I can't understand you... Do you want a gift or you want to be healed?'\0A[0]: Gift\0A[1]: Heal\0A'\00"
@str = [155 x i8] c"You meet a white priestess, a gentle pixie!\0A'Greetings! I want to help you, but you don't have to be greedy. Do you want a gift or you want to be healed?'\00"
@str.6 = [20 x i8] c"[0]: Gift\0A[1]: Heal\00"
@str.7 = [64 x i8] c"'As you wish, I will heal you!'\0AThe white priestess disappears!\00"
@str.8 = [63 x i8] c"'As you wish, here your gift!'\0AThe white priestess disappears!\00"
@str.9 = [103 x i8] c"'Wait! I perceive an antimagic field, so I can't heal you... here a gift, I hope it will be useful...'\00"
define void @redqueen(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, i32 %14) {
%16 = alloca i32
%17 = bitcast i32* %16 to i8*
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([155 x i8], [155 x i8]* @str, i64 0, i64 0))
%19 = load i32, i32* %11
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @str.9, i64 0, i64 0))
%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 %12, i32 %13, i32 %14)
br label %43
24: ; preds = %15
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.6, i64 0, i64 0))
br label %26
26: ; preds = %41, %24
%27 = call i32 @getint(i32* %16)
%28 = load i32, i32* %16
switch i32 %28, label %41 [
i32 0, label %29
i32 1, label %32
]
29: ; preds = %26
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.8, i64 0, i64 0))
%31 = 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 %12, i32 %13, i32 %14)
br label %43
32: ; preds = %26
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.7, i64 0, i64 0))
%34 = load i32, i32* %0
store i32 %34, i32* %1
%35 = load i32, i32* %10
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %7, i64 %36
store i32 -1, i32* %37
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %8, i64 %39
store i32 2, i32* %40
br label %43
41: ; preds = %26
%42 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([110 x i8], [110 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %16
br label %26
43: ; preds = %32, %29, %21
ret void
}