A simple implementation of the ideas from Stochastic Superoptimization which uses a variant of Markov Chain Monte Carlo (MCMC) to synthesize programs based on a set of test cases.
Stochastic Superoptimization: http://cs.stanford.edu/people/eschkufz/research/asplos291-schkufza.pdf