D'backs beat Cards in 16-inning marathon