This should be all the logic. Before reviewing the style/code appeareance, I'd like to ensure that this is the right direction, thanks.
Left to be done:
- There are two tests failing, the one which include inline asm (currently investigating).
- The old LTO code wasn't removed yet. I found that it makes the patch less readable, and that can be removed separately.
You are not using Msg.