Optimal control of the Kirchhoff equation