// File: 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
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1310
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x1320
movq -0xa0(%rbp), %rdi
callq 0x1410
movq %rax, %rcx
movq %rcx, %rax
movq %rsp, %rdx
movq %rdx, -0x38(%rbp)
leaq 0xf(,%rcx,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x98(%rbp)
movq %rcx, %rsp
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movslq -0x44(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x1410
movq %rax, %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
jae 0x2099
movslq -0x44(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x2680
movq -0xa8(%rbp), %rdi
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x1b90
movl %eax, -0xb4(%rbp)
jmp 0x2069
movq -0x98(%rbp), %rax
movl -0xb4(%rbp), %edx
movslq -0x44(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x201e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x237b
movl $0x0, -0x58(%rbp)
movslq -0x58(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x1410
movq %rax, %rcx
movq -0xc0(%rbp), %rax
cmpq %rcx, %rax
jae 0x2108
movq -0x98(%rbp), %rax
movslq -0x58(%rbp), %rcx
movl (%rax,%rcx,4), %esi
movq 0x5f00(%rip), %rdi      # 0x7fd8
callq 0x1130
movq %rax, -0xc8(%rbp)
jmp 0x20e6
movq -0xc8(%rbp), %rdi
leaq 0x2fe8(%rip), %rsi      # 0x50dc
callq 0x10b0
jmp 0x20fb
jmp 0x20fd
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x20a0
movq 0x5ec9(%rip), %rdi      # 0x7fd8
leaq 0x2f1a(%rip), %rsi      # 0x5030
callq 0x10b0
jmp 0x211d
leaq -0x70(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x2700
movq -0xd0(%rbp), %rdi
movl $0x0, -0x74(%rbp)
leaq -0x74(%rbp), %rsi
callq 0x2720
jmp 0x2146
leaq -0x30(%rbp), %rdi
callq 0x1410
movq %rax, %rcx
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rax
subq %rdx, %rax
movq %rax, -0xd8(%rbp)
movq %rax, %rsp
movq %rcx, -0x80(%rbp)
movl $0x0, (%rax)
leaq -0x30(%rbp), %rdi
callq 0x1410
movl %eax, -0x84(%rbp)
movl $0x1, -0x88(%rbp)
jmp 0x2193
movq -0x98(%rbp), %rcx
movq -0xd8(%rbp), %rdx
movl -0x88(%rbp), %eax
subl $0x1, %eax
cltq
movl (%rdx,%rax,4), %eax
movl -0x88(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movslq (%rdx,%rsi,4), %rdx
addl (%rcx,%rdx,4), %eax
cltq
movq %rax, -0xe0(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x1410
movq %rax, %rcx
movq -0xe0(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jb 0x2206
jmp 0x2271
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x27c0
jmp 0x237b
movq -0xd8(%rbp), %rax
movq -0x98(%rbp), %rdx
movq -0xa8(%rbp), %rdi
movl -0x88(%rbp), %ecx
decl %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %esi
movl -0x84(%rbp), %ecx
callq 0x1f00
movl %eax, %edx
movq -0xd8(%rbp), %rax
movslq -0x88(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movslq -0x88(%rbp), %rcx
leaq (%rax,%rcx,4), %rsi
leaq -0x70(%rbp), %rdi
callq 0x2750
jmp 0x225d
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x2191
movl -0x84(%rbp), %eax
decl %eax
movl %eax, -0x8c(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x8c(%rbp), %rsi
callq 0x2720
jmp 0x2291
leaq -0x70(%rbp), %rdi
callq 0x2660
movq %rax, %rsi
movq 0x5d34(%rip), %rdi      # 0x7fd8
callq 0x1030
movq %rax, -0xe8(%rbp)
jmp 0x22b2
movq -0xe8(%rbp), %rdi
leaq 0x2d71(%rip), %rsi      # 0x5031
callq 0x10b0
jmp 0x22c7
movl $0x0, -0x90(%rbp)
movslq -0x90(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2660
movq %rax, %rcx
movq -0xf0(%rbp), %rax
cmpq %rcx, %rax
jae 0x2346
movslq -0x90(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x2640
movl (%rax), %esi
movq 0x5cc8(%rip), %rdi      # 0x7fd8
callq 0x1130
movq %rax, -0xf8(%rbp)
jmp 0x231e
movq -0xf8(%rbp), %rdi
leaq 0x2db0(%rip), %rsi      # 0x50dc
callq 0x10b0
jmp 0x2333
jmp 0x2335
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x22d1
movq 0x5c8b(%rip), %rdi      # 0x7fd8
leaq 0x2cde(%rip), %rsi      # 0x5032
callq 0x10b0
jmp 0x235b
leaq -0x70(%rbp), %rdi
callq 0x27c0
movq -0x38(%rbp), %rax
movq %rax, %rsp
leaq -0x30(%rbp), %rdi
callq 0x26a0
xorl %eax, %eax
movq %rbp, %rsp
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x26a0
movq -0x50(%rbp), %rdi
callq 0x1150
nopl (%rax)