Government mandates and subsidies drove the automaker to bet big on electric vehicles, leaving it now with a $19.5 billion loss.