1. A control system including an execution environment of control software that analyzes a control program and executes processing for outputting control information on a machine as a control object, the control system including at least one processor and a memory that stores instructions, when executed by the at least one processor, performs a method comprising: receiving the control program and a use history of the control program; calculating a use frequency of a function used by the control program based on the control program, or on the control program and the use history of the control program; optimizing a source code of the control software to generate an optimized source code based on the calculated use frequency of the function used by the control program; generating optimized control software based on the optimized source code; and transferring the optimized control software to the execution environment of the control software.