Optimal discrimination between real and complex quantum theories