def get_index_in_permuted(x, L):
  """Mapping to undo the effects of permute4
  
  Useful to find the location of an index in original list
  in Merkle tree.
  """
  ld4 = L // 4
  return x // ld4 + 4 * (x % ld4)