Stellar structure and mass loss on the upper asymptotic giant branch