Generated by Cython 0.29.13

Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.

Raw output: CACompute.cpp

+001: # distutils: language=c++
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 002: """
 003: cdef extern from "Compute.cpp":
 004:     cdef struct compute_return:
 005:         int lower_x, lower_y, upper_x, upper_y
 006:         unordered_map[pair[int, int], int] dict_grid
 007:         unordered_set[pair[int, int]] cells_changed
 008: 
 009:     cdef compute_return compute(vector[pair[int, int]] neighbourhood, bool first,
 010:                                 unordered_set[pair[int, int]] cells_changed, int lower_x, int upper_x, int lower_y,
 011:                                 int upper_y, unordered_map[pair[int, int], int] copy_grid,
 012:                                 unordered_map[pair[int, int], int] dict_grid)
 013: 
 014: 
 015: cpdef pycompute(vector[pair[int, int]] neighbourhood, bool first,
 016:               unordered_set[pair[int, int]] cells_changed, int lower_x, int upper_x, int lower_y,
 017:               int upper_y, unordered_map[pair[int, int], int] copy_grid,
 018:               unordered_map[pair[int, int], int] dict_grid):
 019: 
 020:     cdef compute_return ans = compute(neighbourhood, first, cells_changed, lower_x, upper_x, lower_y, upper_y,
 021:                                       copy_grid, dict_grid)
 022: 
 023:     return ans.lower_x, ans.lower_y, ans.upper_x, ans.upper_y, ans.cells_changed, ans.dict_grid
 024: 
 025: 
 026: """
 027: 
 028: from libcpp.vector cimport vector
 029: from libcpp.pair cimport pair
 030: from libcpp.unordered_map cimport unordered_map
 031: from libcpp.unordered_set cimport unordered_set
+032: from transFunc import transition_func, depend_on_neighbours, alternating_period, max_affect_dist
  __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_transition_func);
  __Pyx_GIVEREF(__pyx_n_s_transition_func);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_transition_func);
  __Pyx_INCREF(__pyx_n_s_depend_on_neighbours);
  __Pyx_GIVEREF(__pyx_n_s_depend_on_neighbours);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_depend_on_neighbours);
  __Pyx_INCREF(__pyx_n_s_alternating_period);
  __Pyx_GIVEREF(__pyx_n_s_alternating_period);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_alternating_period);
  __Pyx_INCREF(__pyx_n_s_max_affect_dist);
  __Pyx_GIVEREF(__pyx_n_s_max_affect_dist);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_max_affect_dist);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_transFunc, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_transition_func); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_transition_func, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_depend_on_neighbours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_depend_on_neighbours, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_alternating_period); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_alternating_period, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_max_affect_dist); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_max_affect_dist, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 033: 
 034: cdef extern from "compute.cpp":
 035:     pass
 036: 
+037: cdef int change = max_affect_dist
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_max_affect_dist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_9CACompute_change = __pyx_t_3;
+038: cdef int alternating_period2 = alternating_period
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_alternating_period); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_9CACompute_alternating_period2 = __pyx_t_3;
+039: cpdef compute(vector[pair[int, int]] neighbourhood,
static PyObject *__pyx_pw_9CACompute_1compute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_9CACompute_compute(std::vector<std::pair<int,int> >  __pyx_v_neighbourhood, std::unordered_set<std::pair<int,int> >  __pyx_v_cells_changed, int __pyx_v_lower_x, int __pyx_v_upper_x, int __pyx_v_lower_y, int __pyx_v_upper_y, std::unordered_map<std::pair<int,int> ,int>  __pyx_v_copy_grid, std::unordered_map<std::pair<int,int> ,int>  __pyx_v_dict_grid, int __pyx_v_generations, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<int>  __pyx_v_neighbours;
  std::unordered_set<std::pair<int,int> >  __pyx_v_cells_to_check;
  int __pyx_v_ans;
  std::pair<int,int>  __pyx_v_coordinates;
  std::pair<int,int>  __pyx_v_coordinates2;
  std::pair<int,int>  __pyx_v_neighbour;
  std::pair<int,int>  __pyx_v_coor;
  std::pair<int,int>  __pyx_v_k;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compute", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("CACompute.compute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9CACompute_1compute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_9CACompute_1compute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  std::vector<std::pair<int,int> >  __pyx_v_neighbourhood;
  std::unordered_set<std::pair<int,int> >  __pyx_v_cells_changed;
  int __pyx_v_lower_x;
  int __pyx_v_upper_x;
  int __pyx_v_lower_y;
  int __pyx_v_upper_y;
  std::unordered_map<std::pair<int,int> ,int>  __pyx_v_copy_grid;
  std::unordered_map<std::pair<int,int> ,int>  __pyx_v_dict_grid;
  int __pyx_v_generations;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_neighbourhood,&__pyx_n_s_cells_changed,&__pyx_n_s_lower_x,&__pyx_n_s_upper_x,&__pyx_n_s_lower_y,&__pyx_n_s_upper_y,&__pyx_n_s_copy_grid,&__pyx_n_s_dict_grid,&__pyx_n_s_generations,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_neighbourhood)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cells_changed)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute", 1, 9, 9, 1); __PYX_ERR(0, 39, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lower_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute", 1, 9, 9, 2); __PYX_ERR(0, 39, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_upper_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute", 1, 9, 9, 3); __PYX_ERR(0, 39, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lower_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute", 1, 9, 9, 4); __PYX_ERR(0, 39, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_upper_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute", 1, 9, 9, 5); __PYX_ERR(0, 39, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_copy_grid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute", 1, 9, 9, 6); __PYX_ERR(0, 39, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dict_grid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute", 1, 9, 9, 7); __PYX_ERR(0, 39, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute", 1, 9, 9, 8); __PYX_ERR(0, 39, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compute") < 0)) __PYX_ERR(0, 39, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_neighbourhood = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error)
    __pyx_v_cells_changed = __pyx_convert_unordered_set_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error)
    __pyx_v_lower_x = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_lower_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
    __pyx_v_upper_x = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_upper_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
    __pyx_v_lower_y = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_lower_y == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
    __pyx_v_upper_y = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_upper_y == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
    __pyx_v_copy_grid = __pyx_convert_unordered_map_from_py_std_3a__3a_pair_3c_int_2c_int_3e_____and_int(values[6]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 42, __pyx_L3_error)
    __pyx_v_dict_grid = __pyx_convert_unordered_map_from_py_std_3a__3a_pair_3c_int_2c_int_3e_____and_int(values[7]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 42, __pyx_L3_error)
    __pyx_v_generations = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_generations == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("compute", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 39, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("CACompute.compute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9CACompute_compute(__pyx_self, __pyx_v_neighbourhood, __pyx_v_cells_changed, __pyx_v_lower_x, __pyx_v_upper_x, __pyx_v_lower_y, __pyx_v_upper_y, __pyx_v_copy_grid, __pyx_v_dict_grid, __pyx_v_generations);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9CACompute_compute(CYTHON_UNUSED PyObject *__pyx_self, std::vector<std::pair<int,int> >  __pyx_v_neighbourhood, std::unordered_set<std::pair<int,int> >  __pyx_v_cells_changed, int __pyx_v_lower_x, int __pyx_v_upper_x, int __pyx_v_lower_y, int __pyx_v_upper_y, std::unordered_map<std::pair<int,int> ,int>  __pyx_v_copy_grid, std::unordered_map<std::pair<int,int> ,int>  __pyx_v_dict_grid, int __pyx_v_generations) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compute", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_9CACompute_compute(__pyx_v_neighbourhood, __pyx_v_cells_changed, __pyx_v_lower_x, __pyx_v_upper_x, __pyx_v_lower_y, __pyx_v_upper_y, __pyx_v_copy_grid, __pyx_v_dict_grid, __pyx_v_generations, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("CACompute.compute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 040:               unordered_set[pair[int, int]] cells_changed,
 041:               int lower_x, int upper_x, int lower_y, int upper_y,
 042:               unordered_map[pair[int, int], int] copy_grid, unordered_map[pair[int, int], int] dict_grid,
 043:               int generations):
 044: 
 045:     cdef vector[int] neighbours
+046:     neighbours.reserve(neighbourhood.size() + 1)
  __pyx_v_neighbours.reserve((__pyx_v_neighbourhood.size() + 1));
 047: 
 048:     cdef unordered_set[pair[int, int]] cells_to_check
 049: 
 050:     cdef int i, j
 051:     cdef int ans
 052:     cdef pair[int, int] coordinates, coordinates2
 053:     cdef pair[int, int] neighbour
 054: 
+055:     for coor in cells_changed:
  __pyx_t_1 = __pyx_v_cells_changed.begin();
  for (;;) {
    if (!(__pyx_t_1 != __pyx_v_cells_changed.end())) break;
    __pyx_t_2 = *__pyx_t_1;
    ++__pyx_t_1;
    __pyx_v_coor = __pyx_t_2;
/* … */
  }
+056:         for neighbour in neighbourhood:
    __pyx_t_3 = __pyx_v_neighbourhood.begin();
    for (;;) {
      if (!(__pyx_t_3 != __pyx_v_neighbourhood.end())) break;
      __pyx_t_2 = *__pyx_t_3;
      ++__pyx_t_3;
      __pyx_v_neighbour = __pyx_t_2;
/* … */
    }
+057:             coordinates.first = coor.first + neighbour.first
      __pyx_v_coordinates.first = (__pyx_v_coor.first + __pyx_v_neighbour.first);
+058:             coordinates.second = coor.second + neighbour.second
      __pyx_v_coordinates.second = (__pyx_v_coor.second + __pyx_v_neighbour.second);
+059:             cells_to_check.insert(coordinates)
      (void)(__pyx_v_cells_to_check.insert(__pyx_v_coordinates));
 060: 
+061:         cells_to_check.insert(coor)
    (void)(__pyx_v_cells_to_check.insert(__pyx_v_coor));
 062: 
+063:     if alternating_period2 > 1:
  __pyx_t_4 = ((__pyx_v_9CACompute_alternating_period2 > 1) != 0);
  if (__pyx_t_4) {
/* … */
    goto __pyx_L7;
  }
+064:         if generations % (alternating_period2 - 1) == 0:
    __pyx_t_5 = (__pyx_v_9CACompute_alternating_period2 - 1);
    if (unlikely(__pyx_t_5 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(0, 64, __pyx_L1_error)
    }
    __pyx_t_4 = ((__Pyx_mod_long(__pyx_v_generations, __pyx_t_5) == 0) != 0);
    if (__pyx_t_4) {
/* … */
    }
+065:             cells_changed.clear()
      __pyx_v_cells_changed.clear();
 066:     else:
+067:         cells_changed.clear()
  /*else*/ {
    __pyx_v_cells_changed.clear();
  }
  __pyx_L7:;
 068: 
+069:     for coordinates in cells_to_check:
  __pyx_t_1 = __pyx_v_cells_to_check.begin();
  for (;;) {
    if (!(__pyx_t_1 != __pyx_v_cells_to_check.end())) break;
    __pyx_t_2 = *__pyx_t_1;
    ++__pyx_t_1;
    __pyx_v_coordinates = __pyx_t_2;
/* … */
  }
+070:         neighbours.clear()
    __pyx_v_neighbours.clear();
+071:         ans = -1
    __pyx_v_ans = -1;
 072: 
+073:         if copy_grid.find(coordinates) == copy_grid.end(): ans = depend_on_neighbours(0, generations)
    __pyx_t_4 = ((__pyx_v_copy_grid.find(__pyx_v_coordinates) == __pyx_v_copy_grid.end()) != 0);
    if (__pyx_t_4) {
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_depend_on_neighbours); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 73, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_generations); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_int_0, __pyx_t_8};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_int_0, __pyx_t_8};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_ans = __pyx_t_10;
      goto __pyx_L11;
    }
+074:         else: ans = depend_on_neighbours(copy_grid[coordinates], generations)
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_depend_on_neighbours); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_11 = __Pyx_PyInt_From_int((__pyx_v_copy_grid[__pyx_v_coordinates])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_generations); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_8};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_8};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 74, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_10, __pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_10, __pyx_t_8);
        __pyx_t_11 = 0;
        __pyx_t_8 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_ans = __pyx_t_10;
    }
    __pyx_L11:;
 075: 
+076:         if ans == -1:
    __pyx_t_4 = ((__pyx_v_ans == -1L) != 0);
    if (__pyx_t_4) {
/* … */
    }
+077:             for k in neighbourhood:
      __pyx_t_3 = __pyx_v_neighbourhood.begin();
      for (;;) {
        if (!(__pyx_t_3 != __pyx_v_neighbourhood.end())) break;
        __pyx_t_2 = *__pyx_t_3;
        ++__pyx_t_3;
        __pyx_v_k = __pyx_t_2;
/* … */
      }
+078:                 coordinates2 = pair[int, int] (coordinates.first + k.first,
        try {
          __pyx_t_2 = std::pair<int,int> ((__pyx_v_coordinates.first + __pyx_v_k.first), (__pyx_v_coordinates.second + __pyx_v_k.second));
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 78, __pyx_L1_error)
        }
        __pyx_v_coordinates2 = __pyx_t_2;
 079:                                                coordinates.second + k.second)
+080:                 if copy_grid.find(coordinates2) != copy_grid.end():
        __pyx_t_4 = ((__pyx_v_copy_grid.find(__pyx_v_coordinates2) != __pyx_v_copy_grid.end()) != 0);
        if (__pyx_t_4) {
/* … */
          goto __pyx_L15;
        }
+081:                     neighbours.push_back(copy_grid[coordinates2])
          try {
            __pyx_v_neighbours.push_back((__pyx_v_copy_grid[__pyx_v_coordinates2]));
          } catch(...) {
            __Pyx_CppExn2PyErr();
            __PYX_ERR(0, 81, __pyx_L1_error)
          }
 082:                 else:
+083:                     neighbours.push_back(0)
        /*else*/ {
          try {
            __pyx_v_neighbours.push_back(0);
          } catch(...) {
            __Pyx_CppExn2PyErr();
            __PYX_ERR(0, 83, __pyx_L1_error)
          }
        }
        __pyx_L15:;
 084: 
+085:         if copy_grid.find(coordinates) != copy_grid.end():
    __pyx_t_4 = ((__pyx_v_copy_grid.find(__pyx_v_coordinates) != __pyx_v_copy_grid.end()) != 0);
    if (__pyx_t_4) {
/* … */
      goto __pyx_L16;
    }
+086:             neighbours.push_back(copy_grid[coordinates])
      try {
        __pyx_v_neighbours.push_back((__pyx_v_copy_grid[__pyx_v_coordinates]));
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 86, __pyx_L1_error)
      }
+087:             if ans == -1: ans = transition_func(neighbours, generations)
      __pyx_t_4 = ((__pyx_v_ans == -1L) != 0);
      if (__pyx_t_4) {
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_transition_func); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_12 = __pyx_convert_vector_to_py_int(__pyx_v_neighbours); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_generations); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_11 = NULL;
        __pyx_t_10 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_10 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_12, __pyx_t_8};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_12, __pyx_t_8};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11); __pyx_t_11 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_t_8);
          __pyx_t_12 = 0;
          __pyx_t_8 = 0;
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_ans = __pyx_t_10;
      }
+088:             if ans == 0:
      __pyx_t_4 = ((__pyx_v_ans == 0) != 0);
      if (__pyx_t_4) {
/* … */
        goto __pyx_L18;
      }
+089:                 dict_grid.erase(coordinates)
        (void)(__pyx_v_dict_grid.erase(__pyx_v_coordinates));
+090:                 cells_changed.insert(coordinates)
        (void)(__pyx_v_cells_changed.insert(__pyx_v_coordinates));
+091:             elif ans != copy_grid[coordinates]:
      __pyx_t_4 = ((__pyx_v_ans != (__pyx_v_copy_grid[__pyx_v_coordinates])) != 0);
      if (__pyx_t_4) {
/* … */
      }
      __pyx_L18:;
+092:                 dict_grid[coordinates] = ans
        (__pyx_v_dict_grid[__pyx_v_coordinates]) = __pyx_v_ans;
+093:                 cells_changed.insert(coordinates)
        (void)(__pyx_v_cells_changed.insert(__pyx_v_coordinates));
 094:         else:
+095:             neighbours.push_back(0)
    /*else*/ {
      try {
        __pyx_v_neighbours.push_back(0);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 95, __pyx_L1_error)
      }
+096:             if ans == -1: ans = transition_func(neighbours, generations)
      __pyx_t_4 = ((__pyx_v_ans == -1L) != 0);
      if (__pyx_t_4) {
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_transition_func); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = __pyx_convert_vector_to_py_int(__pyx_v_neighbours); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_generations); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 96, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_12 = NULL;
        __pyx_t_10 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_10 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_9, __pyx_t_8};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_9, __pyx_t_8};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        {
          __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 96, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          if (__pyx_t_12) {
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __pyx_t_12 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8);
          __pyx_t_9 = 0;
          __pyx_t_8 = 0;
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_ans = __pyx_t_10;
      }
+097:             if ans != 0:
      __pyx_t_4 = ((__pyx_v_ans != 0) != 0);
      if (__pyx_t_4) {
/* … */
      }
    }
    __pyx_L16:;
+098:                 dict_grid.insert(pair[pair[int, int], int] (coordinates, ans))
        try {
          __pyx_t_13 = std::pair<std::pair<int,int> ,int> (__pyx_v_coordinates, __pyx_v_ans);
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 98, __pyx_L1_error)
        }
        (void)(__pyx_v_dict_grid.insert(__pyx_t_13));
+099:                 cells_changed.insert(coordinates)
        (void)(__pyx_v_cells_changed.insert(__pyx_v_coordinates));
+100:                 if coordinates.second < lower_x:
        __pyx_t_4 = ((__pyx_v_coordinates.second < __pyx_v_lower_x) != 0);
        if (__pyx_t_4) {
/* … */
          goto __pyx_L21;
        }
+101:                     lower_x -= change
          __pyx_v_lower_x = (__pyx_v_lower_x - __pyx_v_9CACompute_change);
+102:                 elif coordinates.second > upper_x:
        __pyx_t_4 = ((__pyx_v_coordinates.second > __pyx_v_upper_x) != 0);
        if (__pyx_t_4) {
/* … */
        }
        __pyx_L21:;
+103:                     upper_x += change
          __pyx_v_upper_x = (__pyx_v_upper_x + __pyx_v_9CACompute_change);
 104: 
+105:                 if coordinates.first < lower_y:
        __pyx_t_4 = ((__pyx_v_coordinates.first < __pyx_v_lower_y) != 0);
        if (__pyx_t_4) {
/* … */
          goto __pyx_L22;
        }
+106:                     lower_y -= change
          __pyx_v_lower_y = (__pyx_v_lower_y - __pyx_v_9CACompute_change);
+107:                 elif coordinates.first > upper_y:
        __pyx_t_4 = ((__pyx_v_coordinates.first > __pyx_v_upper_y) != 0);
        if (__pyx_t_4) {
/* … */
        }
        __pyx_L22:;
+108:                     upper_y += change
          __pyx_v_upper_y = (__pyx_v_upper_y + __pyx_v_9CACompute_change);
 109: 
 110: 
+111:     return lower_x, upper_x, lower_y, upper_y, cells_changed, dict_grid
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_lower_x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_upper_x); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_lower_y); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_upper_y); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __pyx_convert_unordered_set_to_py_std_3a__3a_pair_3c_int_2c_int_3e___(__pyx_v_cells_changed); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_12 = __pyx_convert_unordered_map_to_py_std_3a__3a_pair_3c_int_2c_int_3e_______int(__pyx_v_dict_grid); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_14 = PyTuple_New(6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_t_12);
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_11 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_12 = 0;
  __pyx_r = __pyx_t_14;
  __pyx_t_14 = 0;
  goto __pyx_L0;