1. A non-transitory, tangible computer readable storage medium, encoded with processor readable instructions to perform a method for reducing duplicated code during compiling of source code, the method comprising: receiving a plurality of fingerprints each associated with one of a plurality of segments of an intermediate representation of the source code; grouping the plurality of segments of the intermediate representation into clusters based on a similarity of the fingerprints such that each cluster comprises segments of the intermediate representation that are substantially the same; for each cluster, recording a new merged function to a memory, the merged function including code that is the same among all segments of the intermediate representation for a given cluster; inserting control flow and new arguments into the new merged function to handle differences between the segments of the intermediate representation in the given cluster; and replacing the segments of the intermediate representation for the given cluster with wrappers that call the new merged function using the new arguments.