Some instructions (especially mov+pop instructions) were setting the wrong operands. For example, the pop instruction had the register set as a source operand while it is a destination operand (the value is loaded into the register).
I have found these issues using the machine verifier and using manual code inspection.
clang-format: please reformat the code