Hadronic contribution to the muon anomalous magnetic moment to next-to-next-to-leading order