Guitarist David Gilmour recorded a wordless demo, and bassist Roger Waters wrote lyrics, inspired by an experience of being injected with tranquilizers for stomach cramps before a 1977 performance in Philadelphia on the In the Flesh Tour. "That was the longest two hours of my life," Waters said, "trying to do a show when you can hardly lift your arm." The song's working title was "The Doctor".