// File: /workspace/github_cpp_makefile_star2_O1/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 -0x68(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x1330
movq %rsp, %r15
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 0x16ec
xorl %r14d, %r14d
movq (%rax,%r14,8), %rsi
movq %rbx, %rdx
callq 0x13d0
movl %eax, (%r12,%r14,4)
incq %r14
movq -0x68(%rbp), %rax
movq -0x60(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
ja 0x16c5
movq %r15, -0x70(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x68(%rbp), %rax
je 0x173b
xorl %r15d, %r15d
movq 0x38d4(%rip), %rbx      # 0x4fd8
leaq 0x19c9(%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 -0x60(%rbp), %rax
subq -0x68(%rbp), %rax
sarq $0x3, %rax
cmpq %r15, %rax
ja 0x170b
movq 0x3896(%rip), %rdi      # 0x4fd8
leaq 0x18df(%rip), %rsi      # 0x3028
movl $0x3, %edx
callq 0x10e0
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x48(%rbp), %rsi
testq %rsi, %rsi
je 0x1782
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x178f
leaq -0x50(%rbp), %rdi
leaq -0x2c(%rbp), %rdx
callq 0x1a90
movq -0x60(%rbp), %rax
subq -0x68(%rbp), %rax
movq %rax, %r14
shrq $0x3, %r14
movq %rsp, %rcx
sarq %rax
addq $0xf, %rax
andq $-0x10, %rax
movq %rcx, %r13
subq %rax, %r13
movq %r13, %rsp
negq %rax
movl $0x0, (%rcx,%rax)
movq -0x60(%rbp), %rcx
subq -0x68(%rbp), %rcx
movslq (%r12), %rax
sarq $0x3, %rcx
decq %rcx
cmpq %rax, %rcx
jbe 0x186b
leaq 0x4(%r13), %rdx
leal -0x1(%r14), %r15d
xorl %ecx, %ecx
movl $0x1, %ebx
xorl %esi, %esi
incq %rcx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl (%r12,%rcx,4), %r9d
addl %esi, %r9d
cmpl %r8d, %r9d
jle 0x180b
cmpl %r15d, %r9d
jge 0x1819
movl %r9d, %r8d
movl %ecx, %edi
leaq 0x1(%rcx), %r9
cmpq %rax, %rcx
movq %r9, %rcx
jl 0x17f5
jmp 0x181b
movl %ecx, %edi
movl %edi, (%rdx)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x1833
movl %edi, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x183c
leaq -0x50(%rbp), %rdi
callq 0x1bd0
leaq 0x4(,%rbx,4), %rdx
addq %r13, %rdx
incq %rbx
movl -0x4(%rdx), %esi
movslq %esi, %rcx
movslq (%r12,%rcx,4), %rax
movq -0x60(%rbp), %rdi
subq -0x68(%rbp), %rdi
addq %rcx, %rax
sarq $0x3, %rdi
decq %rdi
cmpq %rax, %rdi
ja 0x17ec
decl %r14d
movl %r14d, -0x2c(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x1889
movl %r14d, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x1896
leaq -0x50(%rbp), %rdi
leaq -0x2c(%rbp), %rdx
callq 0x1a90
movq -0x48(%rbp), %rsi
subq -0x50(%rbp), %rsi
sarq $0x2, %rsi
movq 0x372f(%rip), %rdi      # 0x4fd8
callq 0x1060
leaq 0x1774(%rip), %rsi      # 0x3029
movl $0x2, %edx
movq %rax, %rdi
callq 0x10e0
movq -0x50(%rbp), %rax
cmpq %rax, -0x48(%rbp)
je 0x1910
xorl %r15d, %r15d
movq 0x3702(%rip), %rbx      # 0x4fd8
leaq 0x17f7(%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 -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
ja 0x18dd
movq 0x36c1(%rip), %rdi      # 0x4fd8
leaq 0x170c(%rip), %rsi      # 0x302a
movl $0x1, %edx
callq 0x10e0
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
movq -0x70(%rbp), %rbx
je 0x1941
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq %rbx, %rsp
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x1959
movq -0x58(%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 0x1976
jmp 0x1976
jmp 0x1990
jmp 0x1976
jmp 0x1976
jmp 0x1990
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x1993
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
jmp 0x1993
movq %rax, %rbx
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x19a8
movq -0x58(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq %rbx, %rdi
callq 0x1140