// File: /workspace/github_cpp_makefile_star2_O3/ujjwal-ism[P]Jumping_game/gameUtil.cpp
// Function: GameUtil::shortestPathDistance(Game*, Player*)
int GameUtil::shortestPathDistance(Game* game, Player* player){
  
  std::vector<Square*> board = game->getBoard();
  int board_array[board.size()];
  //std::vector<int> board_array(board.size());
  for (int i = 0; i < board.size(); ++i)
  {
    board_array[i] = compute(board[i],player);
  }
  for (int i = 0; i < board.size(); ++i)
  {
    std::cout<<board_array[i]<<" ";
  }
  std::cout<<"\n\n\n";

  std::vector<int> path;
  path.push_back(0);
  int path_index[board.size()];
  path_index[0] = 0;
  int size = board.size();
  int i=1;

  while(1){
    if((path_index[i-1]+board_array[path_index[i-1]]) >= board.size()-1)
      break;

    path_index[i] = max_distance(path_index[i-1],board_array,size);
    path.push_back(path_index[i]);
    i++;
  }

  path.push_back(size-1);
  std::cout<<path.size()<<"\n\n";

  for (int i = 0; i < path.size(); ++i)
  {
    std::cout<<path[i]<<" ";  
  }
    std::cout<<"\n";

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %rbx
movq %rsi, %rdi
callq 0x1326
leaq -0x60(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x1330
movq %rsp, %r13
movq 0x8(%r14), %rax
subq (%r14), %rax
movq %rsp, %r12
sarq %rax
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x1733
xorl %r14d, %r14d
movq (%rax,%r14,8), %rsi
movq %rbx, %rdx
callq 0x13d0
movl %eax, (%r12,%r14,4)
incq %r14
movq -0x60(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r14, %rdx
ja 0x16c3
cmpq %rax, %rcx
je 0x1733
xorl %r15d, %r15d
movq 0x38dc(%rip), %rbx      # 0x4fd8
leaq 0x19d1(%rip), %r14      # 0x30d4
movl (%r12,%r15,4), %esi
movq %rbx, %rdi
callq 0x1120
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x10e0
incq %r15
movq -0x58(%rbp), %rax
subq -0x60(%rbp), %rax
sarq $0x3, %rax
cmpq %r15, %rax
ja 0x1703
movq 0x389e(%rip), %rdi      # 0x4fd8
leaq 0x18e7(%rip), %rsi      # 0x3028
movl $0x3, %edx
callq 0x10e0
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq -0x44(%rbp), %rdx
movl $0x0, (%rdx)
xorl %esi, %esi
callq 0x1a92
movq %r13, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
movq %rdx, %rdi
sarq $0x3, %rdi
movq %rsp, %rsi
sarq %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsi, %r14
subq %rdx, %r14
movq %r14, %rsp
negq %rdx
movl $0x0, (%rsi,%rdx)
movslq (%r12), %rsi
movq %rdi, %rdx
decq %rdx
cmpq %rsi, %rdx
jbe 0x185e
leaq 0x4(%r14), %rdx
leal -0x1(%rdi), %r13d
xorl %edi, %edi
movl $0x1, %r15d
leaq -0x40(%rbp), %rbx
xorl %r8d, %r8d
incq %rdi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl (%r12,%rdi,4), %r11d
addl %r8d, %r11d
cmpl %r10d, %r11d
jle 0x17f2
cmpl %r13d, %r11d
jge 0x1800
movl %r11d, %r10d
movl %edi, %r9d
leaq 0x1(%rdi), %r11
cmpq %rsi, %rdi
movq %r11, %rdi
jl 0x17db
jmp 0x1803
movl %edi, %r9d
movl %r9d, (%rdx)
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x181d
movl %r9d, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x38(%rbp)
jmp 0x182d
movq %rbx, %rdi
callq 0x1bd2
movq -0x60(%rbp), %rax
movq -0x58(%rbp), %rcx
leaq (%r14,%r15,4), %rdx
addq $0x4, %rdx
incq %r15
movl -0x4(%rdx), %r8d
movslq %r8d, %rdi
movslq (%r12,%rdi,4), %rsi
addq %rdi, %rsi
movq %rcx, %r9
subq %rax, %r9
sarq $0x3, %r9
decq %r9
cmpq %rsi, %r9
ja 0x17d2
jmp 0x1862
leal -0x1(%rdi), %r13d
movl %r13d, -0x44(%rbp)
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x187d
movl %r13d, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x38(%rbp)
jmp 0x188e
leaq -0x40(%rbp), %rdi
leaq -0x44(%rbp), %rdx
callq 0x1a92
movq -0x38(%rbp), %rsi
movq -0x68(%rbp), %r12
subq -0x40(%rbp), %rsi
sarq $0x2, %rsi
movq 0x3737(%rip), %rdi      # 0x4fd8
callq 0x1060
leaq 0x177c(%rip), %rsi      # 0x3029
movl $0x2, %edx
movq %rax, %rdi
callq 0x10e0
movq -0x40(%rbp), %rax
cmpq %rax, -0x38(%rbp)
je 0x1908
xorl %r15d, %r15d
movq 0x370a(%rip), %rbx      # 0x4fd8
leaq 0x17ff(%rip), %r14      # 0x30d4
movl (%rax,%r15,4), %esi
movq %rbx, %rdi
callq 0x1120
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x10e0
incq %r15
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
ja 0x18d5
movq 0x36c9(%rip), %rdi      # 0x4fd8
leaq 0x1714(%rip), %rsi      # 0x302a
movl $0x1, %edx
callq 0x10e0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x1935
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq %r12, %rsp
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x194d
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x196f
jmp 0x196f
jmp 0x196a
jmp 0x196f
jmp 0x196f
jmp 0x196a
movq %rax, %rbx
jmp 0x1987
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x1987
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x199c
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq %rbx, %rdi
callq 0x1140