Hundreds of thousands of mourners have gathered in Iran for the funeral ceremonies of Supreme Leader Ayatollah Ali Khamenei.