Dozens of people have been killed and thousands detained as the Iranian state has attempted to quell mass protests in the country.