#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void m_move(char **t, int *p, char ch, int n, int k) {
  switch (ch) {
  case 'w':
  case 'W':
    if ((*p) > 0) {
      t[(*p)][(*(p + 1))] = '.';
      if (t[(*p) - 1][(*(p + 1))] == 'S' || t[(*p) - 1][(*(p + 1))] == 'O') {
        printf("\nYou lost....");
        exit(0);
      }
      (*p)--;
      t[(*p)][(*(p + 1))] = 'M';
    } else
      printf("\nMove out of border,retry another choise....\n");
    break;
  case 's':
  case 'S':
    if ((*p) < n - 1) {
      t[(*p)][(*(p + 1))] = '.';
      if (t[(*p) + 1][(*(p + 1))] == 'S' || t[(*p) + 1][(*(p + 1))] == 'O') {
        printf("\nYou lost....");
        exit(0);
      }
      (*p)++;
      t[(*p)][(*(p + 1))] = 'M';
    } else
      printf("\nMove out of border,retry another choise....\n");
    break;
  case 'a':
  case 'A':
    if ((*(p + 1)) > 0) {
      t[(*p)][(*(p + 1))] = '.';
      if (t[(*p)][(*(p + 1)) - 1] == 'S' || t[(*p)][(*(p + 1) - 1)] == 'O') {
        printf("\nYou lost....");
        exit(0);
      }
      (*(p + 1))--;
      t[(*p)][(*(p + 1))] = 'M';
    } else
      printf("\nMove out of border,retry another choise....\n");
    break;
  case 'd':
  case 'D':
    if ((*(p + 1)) < k - 1) {
      t[*p][*(p + 1)] = '.';
      if (t[(*p)][(*(p + 1) + 1)] == 'S' || t[(*p)][(*(p + 1) + 1)] == 'O') {
        printf("\nYou lost....");
        exit(0);
      }
      (*(p + 1))++;
      t[*p][*(p + 1)] = 'M';
    } else
      printf("\nMove out of border,retry another choise....\n");
    break;
  case 'e':
  case 'E':
    printf("\nYou prefered exit the game....");
    exit(0);
  case 'h':
  case 'H':
    printf("\nHelp:\nThere is a well in (%d,%d) and gold is in (%d,%d).\n",
           *(p + 7) + 1, *(p + 6) + 1, *(p + 5) + 1, *(p + 4) + 1);
  }
}


x86 assembly (clang, -O0):
<m_move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movsbl -0x11(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x36,%eax
ja     14fb <m_move+0x3db>
mov    -0x28(%rbp),%rax
lea    0xea3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jle    1220 <m_move+0x100>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x53,%eax
je     11e0 <m_move+0xc0>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4f,%eax
jne    11f5 <m_move+0xd5>
lea    0xef5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movb   $0x4d,(%rax,%rcx,1)
jmp    122e <m_move+0x10e>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14fb <m_move+0x3db>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12f4 <m_move+0x1d4>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x53,%eax
je     12b4 <m_move+0x194>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4f,%eax
jne    12c9 <m_move+0x1a9>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movb   $0x4d,(%rax,%rcx,1)
jmp    1302 <m_move+0x1e2>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14fb <m_move+0x3db>
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x4(%rax)
jle    13c4 <m_move+0x2a4>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x53,%eax
je     1382 <m_move+0x262>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4f,%eax
jne    1397 <m_move+0x277>
lea    0xd53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movb   $0x4d,(%rax,%rcx,1)
jmp    13d2 <m_move+0x2b2>
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14fb <m_move+0x3db>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    149b <m_move+0x37b>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x53,%eax
je     1459 <m_move+0x339>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4f,%eax
jne    146e <m_move+0x34e>
lea    0xc7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rcx
movb   $0x4d,(%rax,%rcx,1)
jmp    14a9 <m_move+0x389>
lea    0xc48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14fb <m_move+0x3db>
lea    0xc63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%edx
add    $0x1,%edx
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r8d
add    $0x1,%r8d
lea    0xc44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_move>:
push   %rax
add    $0xffffffbf,%edx
cmp    $0x36,%edx
ja     1266 <m_move+0x136>
lea    0xebc(%rip),%rax
movslq (%rax,%rdx,4),%rdx
add    %rax,%rdx
jmp    *%rdx
mov    0x4(%rsi),%eax
test   %eax,%eax
jle    1268 <m_move+0x138>
movslq (%rsi),%rcx
mov    (%rdi,%rcx,8),%rcx
movb   $0x2e,(%rcx,%rax,1)
movslq (%rsi),%rax
mov    (%rdi,%rax,8),%rax
movslq 0x4(%rsi),%rcx
mov    -0x1(%rax,%rcx,1),%dl
cmp    $0x53,%dl
je     1275 <m_move+0x145>
cmp    $0x4f,%dl
je     1275 <m_move+0x145>
add    $0xffffffffffffffff,%rcx
jmp    11cb <m_move+0x9b>
movslq 0x4(%rsi),%rax
add    $0xffffffff,%r8d
cmp    %r8d,%eax
jge    1268 <m_move+0x138>
movslq (%rsi),%rcx
mov    (%rdi,%rcx,8),%rcx
movb   $0x2e,(%rcx,%rax,1)
movslq (%rsi),%rax
mov    (%rdi,%rax,8),%rax
movslq 0x4(%rsi),%rcx
mov    0x1(%rax,%rcx,1),%dl
cmp    $0x53,%dl
je     1275 <m_move+0x145>
cmp    $0x4f,%dl
je     1275 <m_move+0x145>
add    $0x1,%rcx
mov    %ecx,0x4(%rsi)
movb   $0x4d,(%rax,%rcx,1)
pop    %rax
ret
mov    0x1c(%rsi),%eax
add    $0x1,%eax
mov    0x18(%rsi),%edx
add    $0x1,%edx
mov    0x10(%rsi),%r8d
mov    0x14(%rsi),%ecx
add    $0x1,%ecx
add    $0x1,%r8d
lea    0xf15(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
pop    %r9
jmp    1040 <printf@plt>
movslq (%rsi),%rax
add    $0xffffffff,%ecx
cmp    %ecx,%eax
jge    1268 <m_move+0x138>
mov    (%rdi,%rax,8),%rax
movslq 0x4(%rsi),%rcx
movb   $0x2e,(%rax,%rcx,1)
movslq (%rsi),%rcx
mov    0x8(%rdi,%rcx,8),%rdi
movslq 0x4(%rsi),%rdx
mov    (%rdi,%rdx,1),%al
cmp    $0x53,%al
je     1275 <m_move+0x145>
cmp    $0x4f,%al
je     1275 <m_move+0x145>
add    $0x1,%rcx
jmp    1260 <m_move+0x130>
mov    (%rsi),%eax
test   %eax,%eax
jle    1268 <m_move+0x138>
mov    (%rdi,%rax,8),%rax
movslq 0x4(%rsi),%rcx
movb   $0x2e,(%rax,%rcx,1)
movslq (%rsi),%rcx
mov    -0x8(%rdi,%rcx,8),%rdi
movslq 0x4(%rsi),%rdx
mov    (%rdi,%rdx,1),%al
cmp    $0x53,%al
je     1275 <m_move+0x145>
cmp    $0x4f,%al
je     1275 <m_move+0x145>
add    $0xffffffffffffffff,%rcx
mov    %ecx,(%rsi)
movb   $0x4d,(%rdi,%rdx,1)
pop    %rax
ret
lea    0xed6(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
lea    0xe59(%rip),%rdi
jmp    127c <m_move+0x14c>

LLVM IR (-O0):
@.str = [14 x i8] c"\0AYou lost....\00"
@.str.1 = [46 x i8] c"\0AMove out of border,retry another choise....\0A\00"
@.str.2 = [32 x i8] c"\0AYou prefered exit the game....\00"
@.str.3 = [59 x i8] c"\0AHelp:\0AThere is a well in (%d,%d) and gold is in (%d,%d).\0A\00"
define void @m_move(i8** %0, i32* %1, i8 signext %2, i32 %3, i32 %4) {
%6 = alloca i8**
%7 = alloca i32*
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
store i8** %0, i8*** %6
store i32* %1, i32** %7
store i8 %2, i8* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i8, i8* %8
%12 = sext i8 %11 to i32
switch i32 %12, label %314 [
i32 119, label %13
i32 87, label %13
i32 115, label %81
i32 83, label %81
i32 97, label %151
i32 65, label %151
i32 100, label %221
i32 68, label %221
i32 101, label %293
i32 69, label %293
i32 104, label %296
i32 72, label %296
]
13: ; preds = %5, %5
%14 = load i32*, i32** %7
%15 = load i32, i32* %14
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %78
17: ; preds = %13
%18 = load i8**, i8*** %6
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %18, i64 %21
%23 = load i8*, i8** %22
%24 = load i32*, i32** %7
%25 = getelementptr inbounds i32, i32* %24, i64 1
%26 = load i32, i32* %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %23, i64 %27
store i8 46, i8* %28
%29 = load i8**, i8*** %6
%30 = load i32*, i32** %7
%31 = load i32, i32* %30
%32 = sub nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %29, i64 %33
%35 = load i8*, i8** %34
%36 = load i32*, i32** %7
%37 = getelementptr inbounds i32, i32* %36, i64 1
%38 = load i32, i32* %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %35, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 83
br i1 %43, label %60, label %44
44: ; preds = %17
%45 = load i8**, i8*** %6
%46 = load i32*, i32** %7
%47 = load i32, i32* %46
%48 = sub nsw i32 %47, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %45, i64 %49
%51 = load i8*, i8** %50
%52 = load i32*, i32** %7
%53 = getelementptr inbounds i32, i32* %52, i64 1
%54 = load i32, i32* %53
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %51, i64 %55
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 79
br i1 %59, label %60, label %63
60: ; preds = %44, %17
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%62 = call i32 @exit(i32 0)
unreachable
63: ; preds = %44
%64 = load i32*, i32** %7
%65 = load i32, i32* %64
%66 = add nsw i32 %65, -1
store i32 %66, i32* %64
%67 = load i8**, i8*** %6
%68 = load i32*, i32** %7
%69 = load i32, i32* %68
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %67, i64 %70
%72 = load i8*, i8** %71
%73 = load i32*, i32** %7
%74 = getelementptr inbounds i32, i32* %73, i64 1
%75 = load i32, i32* %74
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %72, i64 %76
store i8 77, i8* %77
br label %80
78: ; preds = %13
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %80
80: ; preds = %78, %63
br label %314
81: ; preds = %5, %5
%82 = load i32*, i32** %7
%83 = load i32, i32* %82
%84 = load i32, i32* %9
%85 = sub nsw i32 %84, 1
%86 = icmp slt i32 %83, %85
br i1 %86, label %87, label %148
87: ; preds = %81
%88 = load i8**, i8*** %6
%89 = load i32*, i32** %7
%90 = load i32, i32* %89
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8*, i8** %88, i64 %91
%93 = load i8*, i8** %92
%94 = load i32*, i32** %7
%95 = getelementptr inbounds i32, i32* %94, i64 1
%96 = load i32, i32* %95
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %93, i64 %97
store i8 46, i8* %98
%99 = load i8**, i8*** %6
%100 = load i32*, i32** %7
%101 = load i32, i32* %100
%102 = add nsw i32 %101, 1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8*, i8** %99, i64 %103
%105 = load i8*, i8** %104
%106 = load i32*, i32** %7
%107 = getelementptr inbounds i32, i32* %106, i64 1
%108 = load i32, i32* %107
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8, i8* %105, i64 %109
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp eq i32 %112, 83
br i1 %113, label %130, label %114
114: ; preds = %87
%115 = load i8**, i8*** %6
%116 = load i32*, i32** %7
%117 = load i32, i32* %116
%118 = add nsw i32 %117, 1
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i8*, i8** %115, i64 %119
%121 = load i8*, i8** %120
%122 = load i32*, i32** %7
%123 = getelementptr inbounds i32, i32* %122, i64 1
%124 = load i32, i32* %123
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i8, i8* %121, i64 %125
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = icmp eq i32 %128, 79
br i1 %129, label %130, label %133
130: ; preds = %114, %87
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%132 = call i32 @exit(i32 0)
unreachable
133: ; preds = %114
%134 = load i32*, i32** %7
%135 = load i32, i32* %134
%136 = add nsw i32 %135, 1
store i32 %136, i32* %134
%137 = load i8**, i8*** %6
%138 = load i32*, i32** %7
%139 = load i32, i32* %138
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8*, i8** %137, i64 %140
%142 = load i8*, i8** %141
%143 = load i32*, i32** %7
%144 = getelementptr inbounds i32, i32* %143, i64 1
%145 = load i32, i32* %144
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i8, i8* %142, i64 %146
store i8 77, i8* %147
br label %150
148: ; preds = %81
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %150
150: ; preds = %148, %133
br label %314
151: ; preds = %5, %5
%152 = load i32*, i32** %7
%153 = getelementptr inbounds i32, i32* %152, i64 1
%154 = load i32, i32* %153
%155 = icmp sgt i32 %154, 0
br i1 %155, label %156, label %218
156: ; preds = %151
%157 = load i8**, i8*** %6
%158 = load i32*, i32** %7
%159 = load i32, i32* %158
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i8*, i8** %157, i64 %160
%162 = load i8*, i8** %161
%163 = load i32*, i32** %7
%164 = getelementptr inbounds i32, i32* %163, i64 1
%165 = load i32, i32* %164
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds i8, i8* %162, i64 %166
store i8 46, i8* %167
%168 = load i8**, i8*** %6
%169 = load i32*, i32** %7
%170 = load i32, i32* %169
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i8*, i8** %168, i64 %171
%173 = load i8*, i8** %172
%174 = load i32*, i32** %7
%175 = getelementptr inbounds i32, i32* %174, i64 1
%176 = load i32, i32* %175
%177 = sub nsw i32 %176, 1
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds i8, i8* %173, i64 %178
%180 = load i8, i8* %179
%181 = sext i8 %180 to i32
%182 = icmp eq i32 %181, 83
br i1 %182, label %199, label %183
183: ; preds = %156
%184 = load i8**, i8*** %6
%185 = load i32*, i32** %7
%186 = load i32, i32* %185
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds i8*, i8** %184, i64 %187
%189 = load i8*, i8** %188
%190 = load i32*, i32** %7
%191 = getelementptr inbounds i32, i32* %190, i64 1
%192 = load i32, i32* %191
%193 = sub nsw i32 %192, 1
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds i8, i8* %189, i64 %194
%196 = load i8, i8* %195
%197 = sext i8 %196 to i32
%198 = icmp eq i32 %197, 79
br i1 %198, label %199, label %202
199: ; preds = %183, %156
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%201 = call i32 @exit(i32 0)
unreachable
202: ; preds = %183
%203 = load i32*, i32** %7
%204 = getelementptr inbounds i32, i32* %203, i64 1
%205 = load i32, i32* %204
%206 = add nsw i32 %205, -1
store i32 %206, i32* %204
%207 = load i8**, i8*** %6
%208 = load i32*, i32** %7
%209 = load i32, i32* %208
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds i8*, i8** %207, i64 %210
%212 = load i8*, i8** %211
%213 = load i32*, i32** %7
%214 = getelementptr inbounds i32, i32* %213, i64 1
%215 = load i32, i32* %214
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds i8, i8* %212, i64 %216
store i8 77, i8* %217
br label %220
218: ; preds = %151
%219 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %220
220: ; preds = %218, %202
br label %314
221: ; preds = %5, %5
%222 = load i32*, i32** %7
%223 = getelementptr inbounds i32, i32* %222, i64 1
%224 = load i32, i32* %223
%225 = load i32, i32* %10
%226 = sub nsw i32 %225, 1
%227 = icmp slt i32 %224, %226
br i1 %227, label %228, label %290
228: ; preds = %221
%229 = load i8**, i8*** %6
%230 = load i32*, i32** %7
%231 = load i32, i32* %230
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds i8*, i8** %229, i64 %232
%234 = load i8*, i8** %233
%235 = load i32*, i32** %7
%236 = getelementptr inbounds i32, i32* %235, i64 1
%237 = load i32, i32* %236
%238 = sext i32 %237 to i64
%239 = getelementptr inbounds i8, i8* %234, i64 %238
store i8 46, i8* %239
%240 = load i8**, i8*** %6
%241 = load i32*, i32** %7
%242 = load i32, i32* %241
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds i8*, i8** %240, i64 %243
%245 = load i8*, i8** %244
%246 = load i32*, i32** %7
%247 = getelementptr inbounds i32, i32* %246, i64 1
%248 = load i32, i32* %247
%249 = add nsw i32 %248, 1
%250 = sext i32 %249 to i64
%251 = getelementptr inbounds i8, i8* %245, i64 %250
%252 = load i8, i8* %251
%253 = sext i8 %252 to i32
%254 = icmp eq i32 %253, 83
br i1 %254, label %271, label %255
255: ; preds = %228
%256 = load i8**, i8*** %6
%257 = load i32*, i32** %7
%258 = load i32, i32* %257
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds i8*, i8** %256, i64 %259
%261 = load i8*, i8** %260
%262 = load i32*, i32** %7
%263 = getelementptr inbounds i32, i32* %262, i64 1
%264 = load i32, i32* %263
%265 = add nsw i32 %264, 1
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds i8, i8* %261, i64 %266
%268 = load i8, i8* %267
%269 = sext i8 %268 to i32
%270 = icmp eq i32 %269, 79
br i1 %270, label %271, label %274
271: ; preds = %255, %228
%272 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%273 = call i32 @exit(i32 0)
unreachable
274: ; preds = %255
%275 = load i32*, i32** %7
%276 = getelementptr inbounds i32, i32* %275, i64 1
%277 = load i32, i32* %276
%278 = add nsw i32 %277, 1
store i32 %278, i32* %276
%279 = load i8**, i8*** %6
%280 = load i32*, i32** %7
%281 = load i32, i32* %280
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds i8*, i8** %279, i64 %282
%284 = load i8*, i8** %283
%285 = load i32*, i32** %7
%286 = getelementptr inbounds i32, i32* %285, i64 1
%287 = load i32, i32* %286
%288 = sext i32 %287 to i64
%289 = getelementptr inbounds i8, i8* %284, i64 %288
store i8 77, i8* %289
br label %292
290: ; preds = %221
%291 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %292
292: ; preds = %290, %274
br label %314
293: ; preds = %5, %5
%294 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%295 = call i32 @exit(i32 0)
unreachable
296: ; preds = %5, %5
%297 = load i32*, i32** %7
%298 = getelementptr inbounds i32, i32* %297, i64 7
%299 = load i32, i32* %298
%300 = add nsw i32 %299, 1
%301 = load i32*, i32** %7
%302 = getelementptr inbounds i32, i32* %301, i64 6
%303 = load i32, i32* %302
%304 = add nsw i32 %303, 1
%305 = load i32*, i32** %7
%306 = getelementptr inbounds i32, i32* %305, i64 5
%307 = load i32, i32* %306
%308 = add nsw i32 %307, 1
%309 = load i32*, i32** %7
%310 = getelementptr inbounds i32, i32* %309, i64 4
%311 = load i32, i32* %310
%312 = add nsw i32 %311, 1
%313 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i32 %300, i32 %304, i32 %308, i32 %312)
br label %314
314: ; preds = %296, %5, %292, %220, %150, %80
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0AYou lost....\00"
@.str.2 = [32 x i8] c"\0AYou prefered exit the game....\00"
@.str.3 = [59 x i8] c"\0AHelp:\0AThere is a well in (%d,%d) and gold is in (%d,%d).\0A\00"
@str.6 = [45 x i8] c"\0AMove out of border,retry another choise....\00"
define void @m_move(i8** nocapture %0, i32* nocapture %1, i8 signext %2, i32 %3, i32 %4) {
%6 = sext i8 %2 to i32
switch i32 %6, label %130 [
i32 119, label %7
i32 87, label %7
i32 115, label %33
i32 83, label %33
i32 97, label %60
i32 65, label %60
i32 100, label %86
i32 68, label %86
i32 101, label %113
i32 69, label %113
i32 104, label %116
i32 72, label %116
]
7: ; preds = %5, %5
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %31
10: ; preds = %7
%11 = zext i32 %8 to i64
%12 = getelementptr inbounds i8*, i8** %0, i64 %11
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i32, i32* %1, i64 1
%15 = load i32, i32* %14
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
store i8 46, i8* %17
%18 = load i32, i32* %1
%19 = add nsw i32 %18, -1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %0, i64 %20
%22 = load i8*, i8** %21
%23 = load i32, i32* %14
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
switch i8 %26, label %30 [
i8 83, label %27
i8 79, label %27
]
27: ; preds = %10, %10
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%29 = tail call i32 @exit(i32 0)
unreachable
30: ; preds = %10
store i32 %19, i32* %1
store i8 77, i8* %25
br label %130
31: ; preds = %7
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.6, i64 0, i64 0))
br label %130
33: ; preds = %5, %5
%34 = load i32, i32* %1
%35 = add nsw i32 %3, -1
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %58
37: ; preds = %33
%38 = sext i32 %34 to i64
%39 = getelementptr inbounds i8*, i8** %0, i64 %38
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i32, i32* %1, i64 1
%42 = load i32, i32* %41
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %40, i64 %43
store i8 46, i8* %44
%45 = load i32, i32* %1
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %0, i64 %47
%49 = load i8*, i8** %48
%50 = load i32, i32* %41
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = load i8, i8* %52
switch i8 %53, label %57 [
i8 83, label %54
i8 79, label %54
]
54: ; preds = %37, %37
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%56 = tail call i32 @exit(i32 0)
unreachable
57: ; preds = %37
store i32 %46, i32* %1
store i8 77, i8* %52
br label %130
58: ; preds = %33
%59 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.6, i64 0, i64 0))
br label %130
60: ; preds = %5, %5
%61 = getelementptr inbounds i32, i32* %1, i64 1
%62 = load i32, i32* %61
%63 = icmp sgt i32 %62, 0
br i1 %63, label %64, label %84
64: ; preds = %60
%65 = load i32, i32* %1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %0, i64 %66
%68 = load i8*, i8** %67
%69 = zext i32 %62 to i64
%70 = getelementptr inbounds i8, i8* %68, i64 %69
store i8 46, i8* %70
%71 = load i32, i32* %1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %0, i64 %72
%74 = load i8*, i8** %73
%75 = load i32, i32* %61
%76 = add nsw i32 %75, -1
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %74, i64 %77
%79 = load i8, i8* %78
switch i8 %79, label %83 [
i8 83, label %80
i8 79, label %80
]
80: ; preds = %64, %64
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%82 = tail call i32 @exit(i32 0)
unreachable
83: ; preds = %64
store i32 %76, i32* %61
store i8 77, i8* %78
br label %130
84: ; preds = %60
%85 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.6, i64 0, i64 0))
br label %130
86: ; preds = %5, %5
%87 = getelementptr inbounds i32, i32* %1, i64 1
%88 = load i32, i32* %87
%89 = add nsw i32 %4, -1
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %111
91: ; preds = %86
%92 = load i32, i32* %1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8*, i8** %0, i64 %93
%95 = load i8*, i8** %94
%96 = sext i32 %88 to i64
%97 = getelementptr inbounds i8, i8* %95, i64 %96
store i8 46, i8* %97
%98 = load i32, i32* %1
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8*, i8** %0, i64 %99
%101 = load i8*, i8** %100
%102 = load i32, i32* %87
%103 = add nsw i32 %102, 1
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %101, i64 %104
%106 = load i8, i8* %105
switch i8 %106, label %110 [
i8 83, label %107
i8 79, label %107
]
107: ; preds = %91, %91
%108 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%109 = tail call i32 @exit(i32 0)
unreachable
110: ; preds = %91
store i32 %103, i32* %87
store i8 77, i8* %105
br label %130
111: ; preds = %86
%112 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.6, i64 0, i64 0))
br label %130
113: ; preds = %5, %5
%114 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%115 = tail call i32 @exit(i32 0)
unreachable
116: ; preds = %5, %5
%117 = getelementptr inbounds i32, i32* %1, i64 7
%118 = load i32, i32* %117
%119 = add nsw i32 %118, 1
%120 = getelementptr inbounds i32, i32* %1, i64 6
%121 = load i32, i32* %120
%122 = add nsw i32 %121, 1
%123 = getelementptr inbounds i32, i32* %1, i64 5
%124 = load i32, i32* %123
%125 = add nsw i32 %124, 1
%126 = getelementptr inbounds i32, i32* %1, i64 4
%127 = load i32, i32* %126
%128 = add nsw i32 %127, 1
%129 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i32 %119, i32 %122, i32 %125, i32 %128)
br label %130
130: ; preds = %110, %111, %83, %84, %57, %58, %30, %31, %116, %5
ret void
}