Emperor Xuanzong of Tang, personal name Li Longji, son of Emperor Ruizong, reigned over the Tang dynasty forty-four years. Scarred young by palace coups, in 710 he joined Princess Taiping to destroy the faction of Empress Wei and restored his father, taking the throne in 712 and breaking the princess's power the next year to rule alone. At the outset he appointed the chancellors Yao Chong and Song Jing, cleaned up officialdom, pruned surplus offices and built water works: the Tang entered the fullness of the Kaiyuan era — population grew, granaries filled, and Chang'an became one of the most splendid cities on earth, while Li Bai, Du Fu and their generation of poets grew up under him. In late years he trusted Li Linfu and Yang Guozhong, let government slide, and doted on Yang Guifei; he let An Lushan hold the three commands of Fanyang, Pinglu and Hedong at once — power outside outweighing the center. In 755 An Lushan rose in revolt, and the An Lushan Rebellion swept Luoyang and Chang'an in turn; Xuanzong fled in panic toward Chengdu, and at Mawei station the escort troops forced the death of Yang Guifei while the heir fled north to Lingwu and took the throne as Suzong. Xuanzong died in gloom at Chang'an in 762 — under him the Tang turned from summit to decline.