original_string: private function extractSnakes(array $v_save, $x, $y)
      {
          $snakes = array();
          for ($d = count($v_save) - 1; $x >= 0 && $y >= 0; $d--) {
              array_unshift($snakes, array($x, $y));
  
              $v = $v_save[$d];
              $k = $x - $y;
  
              if ($k === -$d || $k !== $d && $v[$k - 1] < $v[$k + 1]) {
                  $k_prev = $k + 1;
              } else {
                  $k_prev = $k - 1;
              }
  
              $x = $v[$k_prev];
              $y = $x - $k_prev;
          }
  
          return $snakes;
      }
code: private function extractSnakes(array $v_save, $x, $y)
      {
          $snakes = array();
          for ($d = count($v_save) - 1; $x >= 0 && $y >= 0; $d--) {
              array_unshift($snakes, array($x, $y));
  
              $v = $v_save[$d];
              $k = $x - $y;
  
              if ($k === -$d || $k !== $d && $v[$k - 1] < $v[$k + 1]) {
                  $k_prev = $k + 1;
              } else {
                  $k_prev = $k - 1;
              }
  
              $x = $v[$k_prev];
              $y = $x - $k_prev;
          }
  
          return $snakes;
      }
code_tokens: private function extractSnakes ( array $ v_save , $ x , $ y ) { $ snakes = array ( ) ; for ( $ d = count ( $ v_save ) - 1 ; $ x >= 0 && $ y >= 0 ; $ d -- ) { array_unshift ( $ snakes , array ( $ x , $ y ) ) ; $ v = $ v_save [ $ d ] ; $ k = $ x - $ y ; if ( $ k === - $ d || $ k !== $ d && $ v [ $ k - 1 ] < $ v [ $ k + 1 ] ) { $ k_prev = $ k + 1 ; } else { $ k_prev = $ k - 1 ; } $ x = $ v [ $ k_prev ] ; $ y = $ x - $ k_prev ; } return $ snakes ; }
docstring: Backtrack through the intermediate results to extract the "snakes" that
  are visited on the chosen "D-path".
  
  @param string[] $v_save Intermediate results
  @param int      $x      End position
  @param int      $y      End position
  
  @return int[][]
docstring_tokens: Backtrack through the intermediate results to extract the snakes that are visited on the chosen D - path .