Here is a factory wiring diagram for the Honda XR650R. It is specifically from a 2000 model, but they were mostly the same. Please not that this is only a U-Type XR650R which was the street legal model available in Australia and select other parts of the globe.

Honda XR650R-U- Wiring Diagram