Refactor assembly patcher.

Extract insertion of custom code call.