The agnostics contend that pain has evolved blindly as a means of causing us to avoid injury. There are two things that might be said about the theory: the first is that a few moments’ thought will produce half a dozen better ways of achieving the same objective (one of them is intelligence — but the more intelligent the organism, the more pain it is capable of feeling). The second is that by and large it does not work — human beings jump their motorcycles over the fountain at Caesar’s Palace; dogs chase cars.
What pain does do is act as a motivator in all sorts of less than obvious ways. It is responsible for compassion and the hot foot; it makes people who do not believe God would permit it think about God. It has been remarked thousands of times that Christ died under torture. Many of us have read so often that he was a “humble carpenter” that we feel a little surge on nausea on seeing the words yet again. But no one ever seems to notice that the instruments of torture were wood, nails, and a hammer; that the man who hammered in the nails was as much a carpenter as a soldier, as much a carpenter as a torturer. Very few seem even to have noticed that although Christ was a “humble carpenter,” the only object we are specifically told he made was not a table, or a chair, but a whip.
Castle of Days; Helioscope by Gene Wolfe pp 218-219