Question for knowledgeable users.
In games using the Unity engine, I often come across sections of code that look incomprehensible to me, even meaningless.
For example, here is the code from the game RimWorld:
![Image](https://i.imgur.com/9gLJonX.png)
Please explain the meaning of the instructions surrounded by a colored frame. There are more than a thousand such code sections in the game. Why is this double round-trip conversion necessary?
Or here are other examples on the same piece of code:
![Image](https://i.imgur.com/j6sGsfJ.png)
6 sequential instructions are highlighted in green, although in this case only two instructions are sufficient. Why is such a long method used?
Above the first colored frame are two instructions: the first writes the value of a register into memory (movss [rbp-10],xmm0), and the second writes back from the same memory to the same register. Why is the second instruction needed?
Under the first colored frame is the instruction lea rbp,[rbp+00], which does not change anything. Why are these instructions here?
It is also very common to encounter comparison instructions where the flags set after the comparison are not used in any way. There are hundreds of such instructions in the code. What is the point of these “empty” comparisons?