#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 */
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int magicconsume(int *, int *, int, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ movement(int *, int *, int *, int *, int *, int *, int *,
                            int *, int *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ treasure(int *, int *, int *, int *, int *, int *, int *,
                            int *, int *, int *, int *, int *,
                            int /*<<< orphan*/, int, int);
void stealingspirit(int *hpmax, int *hpnow, int *aces, int *inv, int *slave,
                    int *future, int *map, int *loot, int *vision, int *end,
                    int *pos, int *floor, int *start, int *antimag,
                    int *checkcurse, char *st, int *control) {
  char s[20];
  memset(s, 0, sizeof(s));
  sprintf(s, "StealingSpirit");
  int v = magicconsume(aces, inv, 6, s);
  if (v < 0)
    return;
  printf("Before your escape, you steal the %s's property!\n", st);
  treasure(hpmax, hpnow, aces, inv, slave, future, map, loot, vision, end, pos,
           antimag, 0, 1, 1);
  *control = 0;
  movement(future, map, loot, vision, pos, floor, start, antimag, checkcurse,
           0);
}


x86 assembly (clang, -O0):
<stealingspirit>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa0,%rsp
mov    0x60(%rbp),%rax
mov    0x58(%rbp),%rax
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
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,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
mov    %rcx,-0x40(%rbp)
mov    %r8,-0x48(%rbp)
mov    %r9,-0x50(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1060 <memset@plt>
lea    -0x70(%rbp),%rdi
lea    0xe2f(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
lea    -0x70(%rbp),%rcx
mov    $0x6,%edx
call   1050 <magicconsume@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0x0,-0x74(%rbp)
jge    11fe <stealingspirit+0x9e>
jmp    12c6 <stealingspirit+0x166>
mov    0x58(%rbp),%rsi
lea    0xe06(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x50(%rbp),%r9
mov    0x10(%rbp),%r15
mov    0x18(%rbp),%r14
mov    0x20(%rbp),%rbx
mov    0x28(%rbp),%r11
mov    0x30(%rbp),%r10
mov    0x48(%rbp),%rax
xor    %r12d,%r12d
mov    %r15,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
movl   $0x0,0x30(%rsp)
movl   $0x1,0x38(%rsp)
movl   $0x1,0x40(%rsp)
call   1030 <treasure@plt>
mov    0x60(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x50(%rbp),%rdi
mov    0x10(%rbp),%rsi
mov    0x18(%rbp),%rdx
mov    0x20(%rbp),%rcx
mov    0x30(%rbp),%r8
mov    0x38(%rbp),%r9
mov    0x40(%rbp),%r11
mov    0x48(%rbp),%r10
mov    0x50(%rbp),%rax
xor    %ebx,%ebx
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
movl   $0x0,0x18(%rsp)
call   1080 <movement@plt>
add    $0xa0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<stealingspirit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%r15
mov    %r8,0x8(%rsp)
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %rsi,%r13
mov    %rdi,%rbp
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1060 <memset@plt>
movabs $0x676e696c61657453,%rax
69 6e 67
mov    %rax,0x10(%rsp)
movabs $0x74697269705367,%rax
mov    %rax,0x17(%rsp)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x6,%edx
mov    %r14,%rcx
call   1050 <magicconsume@plt>
test   %eax,%eax
js     1273 <stealingspirit+0x123>
mov    0xa8(%rsp),%rsi
mov    0x80(%rsp),%r14
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
sub    $0x8,%rsp
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    0x10(%rsp),%r8
mov    %r15,%r9
push   $0x1
push   $0x1
push   $0x0
push   0xb8(%rsp)
push   %r14
push   0xa8(%rsp)
mov    0xa8(%rsp),%r12
push   %r12
mov    0xa8(%rsp),%rbx
push   %rbx
mov    0xa8(%rsp),%rbp
push   %rbp
call   1030 <treasure@plt>
add    $0x50,%rsp
mov    0xb0(%rsp),%rax
movl   $0x0,(%rax)
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r14,%r8
mov    0x88(%rsp),%r9
push   $0x0
push   0xa8(%rsp)
push   0xa8(%rsp)
push   0xa8(%rsp)
call   1070 <movement@plt>
add    $0x20,%rsp
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"StealingSpirit\00"
@.str.1 = [50 x i8] c"Before your escape, you steal the %s's property!\0A\00"
define void @stealingspirit(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, i8* %15, i32* %16) {
%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*
%32 = alloca i32*
%33 = alloca i8*
%34 = alloca i32*
%35 = alloca [20 x i8]
%36 = alloca i32
store i32* %0, i32** %18
store i32* %1, i32** %19
store i32* %2, i32** %20
store i32* %3, i32** %21
store i32* %4, i32** %22
store i32* %5, i32** %23
store i32* %6, i32** %24
store i32* %7, i32** %25
store i32* %8, i32** %26
store i32* %9, i32** %27
store i32* %10, i32** %28
store i32* %11, i32** %29
store i32* %12, i32** %30
store i32* %13, i32** %31
store i32* %14, i32** %32
store i8* %15, i8** %33
store i32* %16, i32** %34
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %35, i64 0, i64 0
%38 = call i32 @memset(i8* %37, i32 0, i32 20)
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %35, i64 0, i64 0
%40 = call i32 @sprintf(i8* %39, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%41 = load i32*, i32** %20
%42 = load i32*, i32** %21
%43 = getelementptr inbounds [20 x i8], [20 x i8]* %35, i64 0, i64 0
%44 = call i32 @magicconsume(i32* %41, i32* %42, i32 6, i8* %43)
store i32 %44, i32* %36
%45 = load i32, i32* %36
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %17
br label %75
48: ; preds = %17
%49 = load i8*, i8** %33
%50 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8* %49)
%51 = load i32*, i32** %18
%52 = load i32*, i32** %19
%53 = load i32*, i32** %20
%54 = load i32*, i32** %21
%55 = load i32*, i32** %22
%56 = load i32*, i32** %23
%57 = load i32*, i32** %24
%58 = load i32*, i32** %25
%59 = load i32*, i32** %26
%60 = load i32*, i32** %27
%61 = load i32*, i32** %28
%62 = load i32*, i32** %31
%63 = call i32 @treasure(i32* %51, i32* %52, i32* %53, i32* %54, i32* %55, i32* %56, i32* %57, i32* %58, i32* %59, i32* %60, i32* %61, i32* %62, i32 0, i32 1, i32 1)
%64 = load i32*, i32** %34
store i32 0, i32* %64
%65 = load i32*, i32** %23
%66 = load i32*, i32** %24
%67 = load i32*, i32** %25
%68 = load i32*, i32** %26
%69 = load i32*, i32** %28
%70 = load i32*, i32** %29
%71 = load i32*, i32** %30
%72 = load i32*, i32** %31
%73 = load i32*, i32** %32
%74 = call i32 @movement(i32* %65, i32* %66, i32* %67, i32* %68, i32* %69, i32* %70, i32* %71, i32* %72, i32* %73, i32 0)
br label %75
75: ; preds = %48, %47
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"StealingSpirit\00"
@.str.1 = [50 x i8] c"Before your escape, you steal the %s's property!\0A\00"
define void @stealingspirit(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, i8* %15, i32* nocapture writeonly %16) {
%18 = alloca [20 x i8]
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 0
%20 = call i32 @memset(i8* %19, i32 0, i32 20)
%21 = call i32 @magicconsume(i32* %2, i32* %3, i32 6, i8* %19)
%22 = icmp slt i32 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %17
%24 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%25 = 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* %13, i32 0, i32 1, i32 1)
store i32 0, i32* %16
%26 = call i32 @movement(i32* %5, i32* %6, i32* %7, i32* %8, i32* %10, i32* %11, i32* %12, i32* %13, i32* %14, i32 0)
br label %27
27: ; preds = %17, %23
ret void
}