def visit_Index(self, expr):
    arr = self.visit_expr(expr.value)
    if isinstance(expr.index.type, ScalarT):
      index_exprs = [expr.index]
    else:
      assert isinstance(expr.index.type, TupleT), \
        "Unexpected index %s : %s" % (expr.index, expr.index.type)
      if isinstance(expr.index, Tuple):
        index_exprs = expr.index.elts 
      else:
        index_exprs = [TupleProj(expr.index, i, type = t) 
                       for i, t in enumerate(expr.index.type.elt_types) ]
    assert all(isinstance(idx_expr.type, ScalarT) for idx_expr in index_exprs), \
      "Expected all indices to be scalars but got %s" % (index_exprs,)
    indices = [self.visit_expr(idx_expr) for idx_expr in index_exprs]
    if isinstance(expr.value.type, PtrT):
      assert len (indices) == 1, \
        "Can't index into pointer using %d indices (%s)" % (len(indices), index_exprs)
      raw_ptr = "%s.raw_ptr" % arr
      offset = indices[0]
    else:
      assert isinstance(expr.value.type, ArrayT)
      offset = self.fresh_var("int64_t", "offset", "%s.offset" % arr)
      for i, idx in enumerate(indices):
        stride = "%s.strides[%d]" % (arr, i)
        self.append((offset, idx, stride) % "%s += %s * %s;")
      raw_ptr = "%s.data.raw_ptr" % arr 

    return "%s[%s]" % (raw_ptr, offset)
dataset/ETHPy150Open iskandr/parakeet/parakeet/c_backend/fn_compiler.py/FnCompiler.visit_Index/swapped operands of `%`