Rising to power in 1989, Khamenei ruled three times longer than the late Khomeini and shaped Iran dramatically.