Correct option is B
To make the sentence contextually correct, we need to interchange ‘disease’ and ‘patient’. After rearrangement, the meaningful sentence would be, “The doctor carefully examined the patient to diagnose the underlying disease.”