Pakistan are in control of the first Test against England after Shan Masood's century and a devastating display from their bowling attack.