#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 abs(int);
int canReachTargetInMovesRecursive(char **grid, int startRow, int startColumn,
                                   int movesAllowed, int gridWidth,
                                   int gridHeight) {
  if (grid[startRow][startColumn] == '*') {
    return (movesAllowed == 0);
  }
  int numOptions = 0;
  for (int i = -1; i <= 1; i++) {
    for (int j = -1; j <= 1; j++) {
      if (abs(i) ^ abs(j)) {
        int childRow = startRow + i;
        int childColumn = startColumn + j;
        if (childRow >= 0 && childColumn >= 0 && childRow < gridHeight &&
            childColumn < gridWidth &&
            grid[startRow + i][startColumn + j] != 'X') {
          numOptions++;
        }
      }
    }
  }
  if (numOptions > 1) {
    movesAllowed--;
  }
  if (movesAllowed < 0 || numOptions <= 0) {
    return 0;
  }
  grid[startRow][startColumn] = 'X';
  int canReachFromChild = 0;
  for (int i = -1; i <= 1; i++) {
    for (int j = -1; j <= 1; j++) {
      if (abs(i) ^ abs(j)) {
        int childRow = startRow + i;
        int childColumn = startColumn + j;
        if (childRow >= 0 && childColumn >= 0 && childRow < gridHeight &&
            childColumn < gridWidth && grid[childRow][childColumn] != 'X' &&
            canReachTargetInMovesRecursive(grid, startRow + i, startColumn + j,
                                           movesAllowed, gridWidth,
                                           gridHeight)) {
          canReachFromChild = 1;
          break;
        }
      }
    }
    if (canReachFromChild) {
      break;
    }
  }
  return canReachFromChild;
}


x86 assembly (clang, -O0):
<canReachTargetInMovesRecursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
jne    116e <canReachTargetInMovesRecursive+0x4e>
cmpl   $0x0,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    13b6 <canReachTargetInMovesRecursive+0x296>
movl   $0x0,-0x28(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
cmpl   $0x1,-0x2c(%rbp)
jg     1253 <canReachTargetInMovesRecursive+0x133>
movl   $0xffffffff,-0x30(%rbp)
cmpl   $0x1,-0x30(%rbp)
jg     1240 <canReachTargetInMovesRecursive+0x120>
mov    -0x2c(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x50(%rbp)
mov    -0x30(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
xor    %ecx,%eax
cmp    $0x0,%eax
je     122d <canReachTargetInMovesRecursive+0x10d>
mov    -0x14(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     1228 <canReachTargetInMovesRecursive+0x108>
cmpl   $0x0,-0x38(%rbp)
jl     1228 <canReachTargetInMovesRecursive+0x108>
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1228 <canReachTargetInMovesRecursive+0x108>
mov    -0x38(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1228 <canReachTargetInMovesRecursive+0x108>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x58,%eax
je     1228 <canReachTargetInMovesRecursive+0x108>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    122d <canReachTargetInMovesRecursive+0x10d>
jmp    1232 <canReachTargetInMovesRecursive+0x112>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    118d <canReachTargetInMovesRecursive+0x6d>
jmp    1245 <canReachTargetInMovesRecursive+0x125>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    117c <canReachTargetInMovesRecursive+0x5c>
cmpl   $0x1,-0x28(%rbp)
jle    1266 <canReachTargetInMovesRecursive+0x146>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     127a <canReachTargetInMovesRecursive+0x15a>
cmpl   $0x0,-0x28(%rbp)
jg     1286 <canReachTargetInMovesRecursive+0x166>
movl   $0x0,-0x4(%rbp)
jmp    13b6 <canReachTargetInMovesRecursive+0x296>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movb   $0x58,(%rax,%rcx,1)
movl   $0x0,-0x3c(%rbp)
movl   $0xffffffff,-0x40(%rbp)
cmpl   $0x1,-0x40(%rbp)
jg     13b0 <canReachTargetInMovesRecursive+0x290>
movl   $0xffffffff,-0x44(%rbp)
cmpl   $0x1,-0x44(%rbp)
jg     138e <canReachTargetInMovesRecursive+0x26e>
mov    -0x40(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x54(%rbp)
mov    -0x44(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
xor    %ecx,%eax
cmp    $0x0,%eax
je     137b <canReachTargetInMovesRecursive+0x25b>
mov    -0x14(%rbp),%eax
add    -0x40(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x48(%rbp)
jl     1376 <canReachTargetInMovesRecursive+0x256>
cmpl   $0x0,-0x4c(%rbp)
jl     1376 <canReachTargetInMovesRecursive+0x256>
mov    -0x48(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1376 <canReachTargetInMovesRecursive+0x256>
mov    -0x4c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1376 <canReachTargetInMovesRecursive+0x256>
mov    -0x10(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x4c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x58,%eax
je     1376 <canReachTargetInMovesRecursive+0x256>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    -0x40(%rbp),%esi
mov    -0x18(%rbp),%edx
add    -0x44(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
call   1040 <canReachTargetInMovesRecursive@plt>
cmp    $0x0,%eax
je     1376 <canReachTargetInMovesRecursive+0x256>
movl   $0x1,-0x3c(%rbp)
jmp    138e <canReachTargetInMovesRecursive+0x26e>
jmp    137b <canReachTargetInMovesRecursive+0x25b>
jmp    1380 <canReachTargetInMovesRecursive+0x260>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12b9 <canReachTargetInMovesRecursive+0x199>
cmpl   $0x0,-0x3c(%rbp)
je     139d <canReachTargetInMovesRecursive+0x27d>
jmp    13b0 <canReachTargetInMovesRecursive+0x290>
jmp    13a2 <canReachTargetInMovesRecursive+0x282>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12a8 <canReachTargetInMovesRecursive+0x188>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<canReachTargetInMovesRecursive>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9d,%r12d
movslq %esi,%rax
mov    (%rdi,%rax,8),%r11
movslq %edx,%r9
cmpb   $0x2a,(%r11,%r9,1)
jne    113e <canReachTargetInMovesRecursive+0x2e>
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
jmp    13b2 <canReachTargetInMovesRecursive+0x2a2>
mov    %edx,%ebx
xor    %edx,%edx
mov    %ebx,%eax
mov    %rax,0x28(%rsp)
cmp    %r12d,%esi
mov    %rsi,0x8(%rsp)
jg     117a <canReachTargetInMovesRecursive+0x6a>
test   %esi,%esi
jle    117a <canReachTargetInMovesRecursive+0x6a>
test   %ebx,%ebx
js     117a <canReachTargetInMovesRecursive+0x6a>
cmp    %r8d,%ebx
jge    117a <canReachTargetInMovesRecursive+0x6a>
lea    -0x1(%rsi),%edx
mov    (%rdi,%rdx,8),%rsi
xor    %edx,%edx
mov    0x28(%rsp),%rax
cmpb   $0x58,(%rsi,%rax,1)
mov    0x8(%rsp),%rsi
setne  %dl
mov    %rdi,0x10(%rsp)
mov    %esi,%r10d
cmp    %r12d,%esi
jge    11b1 <canReachTargetInMovesRecursive+0xa1>
test   %esi,%esi
js     11b1 <canReachTargetInMovesRecursive+0xa1>
test   %ebx,%ebx
jle    11b1 <canReachTargetInMovesRecursive+0xa1>
cmp    %r8d,%ebx
jg     11b1 <canReachTargetInMovesRecursive+0xa1>
lea    -0x1(%rbx),%edi
mov    0x10(%rsp),%rax
mov    (%rax,%r10,8),%rax
xor    %esi,%esi
cmpb   $0x58,(%rax,%rdi,1)
setne  %sil
add    %esi,%edx
mov    0x8(%rsp),%rsi
lea    0x1(%rbx),%eax
mov    %rax,0x20(%rsp)
cmp    %r12d,%esi
jge    11f0 <canReachTargetInMovesRecursive+0xe0>
test   %esi,%esi
js     11f0 <canReachTargetInMovesRecursive+0xe0>
cmp    $0xffffffff,%ebx
jl     11f0 <canReachTargetInMovesRecursive+0xe0>
mov    0x20(%rsp),%rax
cmp    %r8d,%eax
jge    11f0 <canReachTargetInMovesRecursive+0xe0>
mov    0x10(%rsp),%rdi
mov    (%rdi,%r10,8),%r10
mov    %eax,%eax
xor    %esi,%esi
cmpb   $0x58,(%r10,%rax,1)
setne  %sil
add    %esi,%edx
mov    0x8(%rsp),%rsi
jmp    11f5 <canReachTargetInMovesRecursive+0xe5>
mov    0x10(%rsp),%rdi
mov    %rsi,%rax
add    $0x1,%esi
cmp    %r12d,%esi
jge    13c1 <canReachTargetInMovesRecursive+0x2b1>
cmp    $0xffffffff,%eax
jl     122a <canReachTargetInMovesRecursive+0x11a>
test   %ebx,%ebx
js     122a <canReachTargetInMovesRecursive+0x11a>
cmp    %r8d,%ebx
jge    122a <canReachTargetInMovesRecursive+0x11a>
mov    %esi,%eax
mov    (%rdi,%rax,8),%r10
xor    %esi,%esi
mov    0x28(%rsp),%rax
cmpb   $0x58,(%r10,%rax,1)
setne  %sil
add    %esi,%edx
mov    0x8(%rsp),%rsi
xor    %ebp,%ebp
cmp    $0x2,%edx
setae  %bpl
xor    %eax,%eax
sub    %ebp,%ecx
js     13b2 <canReachTargetInMovesRecursive+0x2a2>
test   %edx,%edx
je     13b2 <canReachTargetInMovesRecursive+0x2a2>
movb   $0x58,(%r11,%r9,1)
lea    -0x1(%rbx),%eax
mov    %rax,0x30(%rsp)
mov    $0xffffffff,%r13d
mov    %ecx,0x1c(%rsp)
mov    %r8d,0x18(%rsp)
mov    0x20(%rsp),%rbp
jmp    127e <canReachTargetInMovesRecursive+0x16e>
nopl   (%rax)
add    $0x1,%r13d
cmp    $0x2,%r13d
je     13b0 <canReachTargetInMovesRecursive+0x2a0>
mov    %r13d,%r15d
neg    %r15d
cmovs  %r13d,%r15d
lea    (%rsi,%r13,1),%r14d
cmp    $0x1,%r15d
je     12f0 <canReachTargetInMovesRecursive+0x1e0>
cmp    %r12d,%r14d
jge    12f0 <canReachTargetInMovesRecursive+0x1e0>
test   %r14d,%r14d
js     12f0 <canReachTargetInMovesRecursive+0x1e0>
test   %ebx,%ebx
jle    12f0 <canReachTargetInMovesRecursive+0x1e0>
cmp    %r8d,%ebx
jg     12f0 <canReachTargetInMovesRecursive+0x1e0>
mov    (%rdi,%r14,8),%rax
mov    0x30(%rsp),%rdx
cmpb   $0x58,(%rax,%rdx,1)
je     12f0 <canReachTargetInMovesRecursive+0x1e0>
mov    %r14d,%esi
mov    0x30(%rsp),%rdx
mov    %r12d,%r9d
call   1030 <canReachTargetInMovesRecursive@plt>
mov    0x8(%rsp),%rsi
mov    0x20(%rsp),%rbp
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%r8d
mov    0x1c(%rsp),%ecx
test   %eax,%eax
jne    13a9 <canReachTargetInMovesRecursive+0x299>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %r13d,%r13d
je     1340 <canReachTargetInMovesRecursive+0x230>
cmp    %r12d,%r14d
jge    1340 <canReachTargetInMovesRecursive+0x230>
mov    %r14d,%eax
or     %ebx,%eax
js     1340 <canReachTargetInMovesRecursive+0x230>
cmp    %r8d,%ebx
jge    1340 <canReachTargetInMovesRecursive+0x230>
mov    (%rdi,%r14,8),%rax
mov    0x28(%rsp),%rdx
cmpb   $0x58,(%rax,%rdx,1)
je     1340 <canReachTargetInMovesRecursive+0x230>
mov    %r14d,%esi
mov    %ebx,%edx
mov    %r12d,%r9d
call   1030 <canReachTargetInMovesRecursive@plt>
mov    0x8(%rsp),%rsi
mov    0x20(%rsp),%rbp
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%r8d
mov    0x1c(%rsp),%ecx
test   %eax,%eax
jne    13a9 <canReachTargetInMovesRecursive+0x299>
xchg   %ax,%ax
cmp    $0x1,%r15d
je     1270 <canReachTargetInMovesRecursive+0x160>
cmp    %r12d,%r14d
jge    1270 <canReachTargetInMovesRecursive+0x160>
test   %r14d,%r14d
js     1270 <canReachTargetInMovesRecursive+0x160>
cmp    $0xffffffff,%ebx
jl     1270 <canReachTargetInMovesRecursive+0x160>
cmp    %r8d,%ebp
jge    1270 <canReachTargetInMovesRecursive+0x160>
mov    (%rdi,%r14,8),%rax
cmpb   $0x58,(%rax,%rbp,1)
je     1270 <canReachTargetInMovesRecursive+0x160>
mov    %r14d,%esi
mov    %ebp,%edx
mov    %r12d,%r9d
call   1030 <canReachTargetInMovesRecursive@plt>
mov    0x8(%rsp),%rsi
mov    0x20(%rsp),%rbp
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%r8d
mov    0x1c(%rsp),%ecx
test   %eax,%eax
je     1270 <canReachTargetInMovesRecursive+0x160>
mov    $0x1,%eax
jmp    13b2 <canReachTargetInMovesRecursive+0x2a2>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rax,%rsi
jmp    122f <canReachTargetInMovesRecursive+0x11f>

LLVM IR (-O0):
define i32 @canReachTargetInMovesRecursive(i8** %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%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
store i8** %0, i8*** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%24 = load i8**, i8*** %8
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = load i32, i32* %10
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 42
br i1 %34, label %35, label %39
35: ; preds = %6
%36 = load i32, i32* %11
%37 = icmp eq i32 %36, 0
%38 = zext i1 %37 to i32
store i32 %38, i32* %7
br label %199
39: ; preds = %6
store i32 0, i32* %14
store i32 -1, i32* %15
br label %40
40: ; preds = %99, %39
%41 = load i32, i32* %15
%42 = icmp sle i32 %41, 1
br i1 %42, label %43, label %102
43: ; preds = %40
store i32 -1, i32* %16
br label %44
44: ; preds = %95, %43
%45 = load i32, i32* %16
%46 = icmp sle i32 %45, 1
br i1 %46, label %47, label %98
47: ; preds = %44
%48 = load i32, i32* %15
%49 = call i32 @abs(i32 %48)
%50 = load i32, i32* %16
%51 = call i32 @abs(i32 %50)
%52 = xor i32 %49, %51
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %94
54: ; preds = %47
%55 = load i32, i32* %9
%56 = load i32, i32* %15
%57 = add nsw i32 %55, %56
store i32 %57, i32* %17
%58 = load i32, i32* %10
%59 = load i32, i32* %16
%60 = add nsw i32 %58, %59
store i32 %60, i32* %18
%61 = load i32, i32* %17
%62 = icmp sge i32 %61, 0
br i1 %62, label %63, label %93
63: ; preds = %54
%64 = load i32, i32* %18
%65 = icmp sge i32 %64, 0
br i1 %65, label %66, label %93
66: ; preds = %63
%67 = load i32, i32* %17
%68 = load i32, i32* %13
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %93
70: ; preds = %66
%71 = load i32, i32* %18
%72 = load i32, i32* %12
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %93
74: ; preds = %70
%75 = load i8**, i8*** %8
%76 = load i32, i32* %9
%77 = load i32, i32* %15
%78 = add nsw i32 %76, %77
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %75, i64 %79
%81 = load i8*, i8** %80
%82 = load i32, i32* %10
%83 = load i32, i32* %16
%84 = add nsw i32 %82, %83
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %81, i64 %85
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp ne i32 %88, 88
br i1 %89, label %90, label %93
90: ; preds = %74
%91 = load i32, i32* %14
%92 = add nsw i32 %91, 1
store i32 %92, i32* %14
br label %93
93: ; preds = %90, %74, %70, %66, %63, %54
br label %94
94: ; preds = %93, %47
br label %95
95: ; preds = %94
%96 = load i32, i32* %16
%97 = add nsw i32 %96, 1
store i32 %97, i32* %16
br label %44
98: ; preds = %44
br label %99
99: ; preds = %98
%100 = load i32, i32* %15
%101 = add nsw i32 %100, 1
store i32 %101, i32* %15
br label %40
102: ; preds = %40
%103 = load i32, i32* %14
%104 = icmp sgt i32 %103, 1
br i1 %104, label %105, label %108
105: ; preds = %102
%106 = load i32, i32* %11
%107 = add nsw i32 %106, -1
store i32 %107, i32* %11
br label %108
108: ; preds = %105, %102
%109 = load i32, i32* %11
%110 = icmp slt i32 %109, 0
br i1 %110, label %114, label %111
111: ; preds = %108
%112 = load i32, i32* %14
%113 = icmp sle i32 %112, 0
br i1 %113, label %114, label %115
114: ; preds = %111, %108
store i32 0, i32* %7
br label %199
115: ; preds = %111
%116 = load i8**, i8*** %8
%117 = load i32, i32* %9
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8*, i8** %116, i64 %118
%120 = load i8*, i8** %119
%121 = load i32, i32* %10
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8, i8* %120, i64 %122
store i8 88, i8* %123
store i32 0, i32* %19
store i32 -1, i32* %20
br label %124
124: ; preds = %194, %115
%125 = load i32, i32* %20
%126 = icmp sle i32 %125, 1
br i1 %126, label %127, label %197
127: ; preds = %124
store i32 -1, i32* %21
br label %128
128: ; preds = %186, %127
%129 = load i32, i32* %21
%130 = icmp sle i32 %129, 1
br i1 %130, label %131, label %189
131: ; preds = %128
%132 = load i32, i32* %20
%133 = call i32 @abs(i32 %132)
%134 = load i32, i32* %21
%135 = call i32 @abs(i32 %134)
%136 = xor i32 %133, %135
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %185
138: ; preds = %131
%139 = load i32, i32* %9
%140 = load i32, i32* %20
%141 = add nsw i32 %139, %140
store i32 %141, i32* %22
%142 = load i32, i32* %10
%143 = load i32, i32* %21
%144 = add nsw i32 %142, %143
store i32 %144, i32* %23
%145 = load i32, i32* %22
%146 = icmp sge i32 %145, 0
br i1 %146, label %147, label %184
147: ; preds = %138
%148 = load i32, i32* %23
%149 = icmp sge i32 %148, 0
br i1 %149, label %150, label %184
150: ; preds = %147
%151 = load i32, i32* %22
%152 = load i32, i32* %13
%153 = icmp slt i32 %151, %152
br i1 %153, label %154, label %184
154: ; preds = %150
%155 = load i32, i32* %23
%156 = load i32, i32* %12
%157 = icmp slt i32 %155, %156
br i1 %157, label %158, label %184
158: ; preds = %154
%159 = load i8**, i8*** %8
%160 = load i32, i32* %22
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds i8*, i8** %159, i64 %161
%163 = load i8*, i8** %162
%164 = load i32, i32* %23
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i8, i8* %163, i64 %165
%167 = load i8, i8* %166
%168 = sext i8 %167 to i32
%169 = icmp ne i32 %168, 88
br i1 %169, label %170, label %184
170: ; preds = %158
%171 = load i8**, i8*** %8
%172 = load i32, i32* %9
%173 = load i32, i32* %20
%174 = add nsw i32 %172, %173
%175 = load i32, i32* %10
%176 = load i32, i32* %21
%177 = add nsw i32 %175, %176
%178 = load i32, i32* %11
%179 = load i32, i32* %12
%180 = load i32, i32* %13
%181 = call i32 @canReachTargetInMovesRecursive(i8** %171, i32 %174, i32 %177, i32 %178, i32 %179, i32 %180)
%182 = icmp ne i32 %181, 0
br i1 %182, label %183, label %184
183: ; preds = %170
store i32 1, i32* %19
br label %189
184: ; preds = %170, %158, %154, %150, %147, %138
br label %185
185: ; preds = %184, %131
br label %186
186: ; preds = %185
%187 = load i32, i32* %21
%188 = add nsw i32 %187, 1
store i32 %188, i32* %21
br label %128
189: ; preds = %183, %128
%190 = load i32, i32* %19
%191 = icmp ne i32 %190, 0
br i1 %191, label %192, label %193
192: ; preds = %189
br label %197
193: ; preds = %189
br label %194
194: ; preds = %193
%195 = load i32, i32* %20
%196 = add nsw i32 %195, 1
store i32 %196, i32* %20
br label %124
197: ; preds = %192, %124
%198 = load i32, i32* %19
store i32 %198, i32* %7
br label %199
199: ; preds = %197, %114, %35
%200 = load i32, i32* %7
ret i32 %200
}

LLVM IR (-O2):
define i32 @canReachTargetInMovesRecursive(i8** nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = sext i32 %2 to i64
%11 = getelementptr inbounds i8, i8* %9, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 42
br i1 %13, label %14, label %17
14: ; preds = %6
%15 = icmp eq i32 %3, 0
%16 = zext i1 %15 to i32
br label %162
17: ; preds = %6
%18 = icmp sgt i32 %1, 0
%19 = icmp sle i32 %1, %5
%20 = icmp sgt i32 %2, -1
%21 = and i1 %18, %20
%22 = and i1 %19, %21
%23 = icmp slt i32 %2, %4
%24 = and i1 %22, %23
br i1 %24, label %25, label %35
25: ; preds = %17
%26 = add nsw i32 %1, -1
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %0, i64 %27
%29 = load i8*, i8** %28
%30 = zext i32 %2 to i64
%31 = getelementptr inbounds i8, i8* %29, i64 %30
%32 = load i8, i8* %31
%33 = icmp ne i8 %32, 88
%34 = zext i1 %33 to i32
br label %35
35: ; preds = %25, %17
%36 = phi i32 [ 0, %17 ], [ %34, %25 ]
%37 = icmp sgt i32 %1, -1
%38 = icmp slt i32 %1, %5
%39 = zext i32 %1 to i64
%40 = getelementptr inbounds i8*, i8** %0, i64 %39
%41 = icmp sgt i32 %2, 0
%42 = and i1 %37, %41
%43 = and i1 %38, %42
%44 = icmp sle i32 %2, %4
%45 = and i1 %43, %44
br i1 %45, label %46, label %55
46: ; preds = %35
%47 = add nsw i32 %2, -1
%48 = load i8*, i8** %40
%49 = zext i32 %47 to i64
%50 = getelementptr inbounds i8, i8* %48, i64 %49
%51 = load i8, i8* %50
%52 = icmp ne i8 %51, 88
%53 = zext i1 %52 to i32
%54 = add nuw nsw i32 %36, %53
br label %55
55: ; preds = %46, %35
%56 = phi i32 [ %36, %35 ], [ %54, %46 ]
%57 = add nsw i32 %2, 1
%58 = icmp sgt i32 %2, -2
%59 = and i1 %37, %58
%60 = and i1 %38, %59
%61 = icmp slt i32 %57, %4
%62 = select i1 %60, i1 %61, i1 false
br i1 %62, label %63, label %71
63: ; preds = %55
%64 = load i8*, i8** %40
%65 = zext i32 %57 to i64
%66 = getelementptr inbounds i8, i8* %64, i64 %65
%67 = load i8, i8* %66
%68 = icmp ne i8 %67, 88
%69 = zext i1 %68 to i32
%70 = add nuw nsw i32 %56, %69
br label %71
71: ; preds = %63, %55
%72 = phi i32 [ %56, %55 ], [ %70, %63 ]
%73 = add nsw i32 %1, 1
%74 = icmp sgt i32 %1, -2
%75 = icmp slt i32 %73, %5
%76 = icmp sgt i32 %2, -1
%77 = and i1 %74, %76
%78 = and i1 %75, %77
%79 = icmp slt i32 %2, %4
%80 = and i1 %78, %79
br i1 %80, label %81, label %91
81: ; preds = %71
%82 = zext i32 %73 to i64
%83 = getelementptr inbounds i8*, i8** %0, i64 %82
%84 = load i8*, i8** %83
%85 = zext i32 %2 to i64
%86 = getelementptr inbounds i8, i8* %84, i64 %85
%87 = load i8, i8* %86
%88 = icmp ne i8 %87, 88
%89 = zext i1 %88 to i32
%90 = add nuw nsw i32 %72, %89
br label %91
91: ; preds = %71, %81
%92 = phi i32 [ %72, %71 ], [ %90, %81 ]
%93 = icmp ugt i32 %92, 1
%94 = sext i1 %93 to i32
%95 = add nsw i32 %94, %3
%96 = icmp slt i32 %95, 0
%97 = icmp eq i32 %92, 0
%98 = select i1 %96, i1 true, i1 %97
br i1 %98, label %162, label %99
99: ; preds = %91
store i8 88, i8* %11
%100 = add nsw i32 %2, -1
%101 = icmp sgt i32 %2, 0
%102 = icmp sle i32 %2, %4
%103 = zext i32 %100 to i64
%104 = icmp slt i32 %2, %4
%105 = zext i32 %2 to i64
%106 = add nsw i32 %2, 1
%107 = icmp sgt i32 %2, -2
%108 = icmp slt i32 %106, %4
%109 = zext i32 %106 to i64
br label %110
110: ; preds = %99, %159
%111 = phi i32 [ -1, %99 ], [ %160, %159 ]
%112 = tail call i32 @llvm.abs.i32(i32 %111, i1 true)
%113 = add nsw i32 %111, %1
%114 = icmp sgt i32 %113, -1
%115 = icmp slt i32 %113, %5
%116 = zext i32 %113 to i64
%117 = getelementptr inbounds i8*, i8** %0, i64 %116
%118 = icmp eq i32 %112, 1
br i1 %118, label %131, label %119
119: ; preds = %110
%120 = and i1 %114, %101
%121 = and i1 %115, %120
%122 = and i1 %121, %102
br i1 %122, label %123, label %131
123: ; preds = %119
%124 = load i8*, i8** %117
%125 = getelementptr inbounds i8, i8* %124, i64 %103
%126 = load i8, i8* %125
%127 = icmp eq i8 %126, 88
br i1 %127, label %131, label %128
128: ; preds = %123
%129 = tail call i32 @canReachTargetInMovesRecursive(i8** %0, i32 %113, i32 %100, i32 %95, i32 %4, i32 %5)
%130 = icmp eq i32 %129, 0
br i1 %130, label %131, label %162
131: ; preds = %128, %123, %119, %110
%132 = icmp eq i32 %111, 0
br i1 %132, label %146, label %133
133: ; preds = %131
%134 = or i32 %113, %2
%135 = icmp sgt i32 %134, -1
%136 = and i1 %115, %135
%137 = and i1 %136, %104
br i1 %137, label %138, label %146
138: ; preds = %133
%139 = load i8*, i8** %117
%140 = getelementptr inbounds i8, i8* %139, i64 %105
%141 = load i8, i8* %140
%142 = icmp eq i8 %141, 88
br i1 %142, label %146, label %143
143: ; preds = %138
%144 = tail call i32 @canReachTargetInMovesRecursive(i8** %0, i32 %113, i32 %2, i32 %95, i32 %4, i32 %5)
%145 = icmp eq i32 %144, 0
br i1 %145, label %146, label %162
146: ; preds = %143, %138, %133, %131
br i1 %118, label %159, label %147
147: ; preds = %146
%148 = and i1 %114, %107
%149 = and i1 %115, %148
%150 = select i1 %149, i1 %108, i1 false
br i1 %150, label %151, label %159
151: ; preds = %147
%152 = load i8*, i8** %117
%153 = getelementptr inbounds i8, i8* %152, i64 %109
%154 = load i8, i8* %153
%155 = icmp eq i8 %154, 88
br i1 %155, label %159, label %156
156: ; preds = %151
%157 = tail call i32 @canReachTargetInMovesRecursive(i8** %0, i32 %113, i32 %106, i32 %95, i32 %4, i32 %5)
%158 = icmp eq i32 %157, 0
br i1 %158, label %159, label %162
159: ; preds = %156, %151, %147, %146
%160 = add nsw i32 %111, 1
%161 = icmp eq i32 %160, 2
br i1 %161, label %162, label %110
162: ; preds = %159, %128, %143, %156, %91, %14
%163 = phi i32 [ %16, %14 ], [ 0, %91 ], [ 0, %159 ], [ 1, %128 ], [ 1, %143 ], [ 1, %156 ]
ret i32 %163
}