This patch fixes both issues. I'm pretty sure the problem is when we perform non-trivial replacement (e.g. lognot -> lognot-mod64), the result isn't necessarily cut to the right width: it's actually widened to the VOP's width. So, we "only" need to track when we perform such replacements, and insert actually cutting operations (logand/mask-signed-field) after the final result.

Hopefully, we can have a second opinion and I'll commit the conclusion around the end of the week.