Implement meet-in-the-middle function.

Needs a bit of refactoring, I needed to have a proof that it can work. In
particular, lengths and indices are hardcoded, and I sense the loop workload
can be condensed in a more concise fashion.