1. A method, comprising: receiving a model for a technical computing environment, the model including a plurality of blocks and a plurality of lines, and the receiving the model being performed by a device; identifying first candidate boundaries for the model, each of the first candidate boundaries defining a group of one or more of the plurality of blocks of the model, and the identifying the first candidate boundaries being performed by the device; generating an intermediate representation of the model, the generating the intermediate representation being performed by the device; performing an optimization of the intermediate representation to generate an optimized intermediate representation with respect to the intermediate representation, the performing the optimization of the intermediate representation being performed by the device; identifying second candidate boundaries for the model based on the optimized intermediate representation, each of the second candidate boundaries defining a group of one or more of the plurality of blocks of the model, the first candidate boundaries and the second candidate boundaries defining a set of candidate boundaries for the model, and the identifying the second candidate boundaries being performed by the device; reducing the set of candidate boundaries, to a reduced set of boundaries, based on at least one of code efficiency metrics or metrics associated with a hardware platform, the reducing the set of candidate boundaries being performed by the device; generating code for the model based on the reduced set of boundaries, the generating the code being performed by the device; and outputting or storing the code, the outputting or storing the code being performed by the device.