But you can, in principle, understand a compiler. Also they're made by the same people who use them. Did blacksmiths get mad when they invented the first anvils?
While optimization may be done in unpredictable ways, it does not (by definition) change the effective behavior of the program. If you write a program to calculate prime numbers, it will always calculate prime numbers, no matter how the compiler optimizes it. If you tell an LLM to write code to calculate prime numbers, you are at the mercy of chance. (Maybe not for such a simple program, where the solution is directly in the training data, but you get the idea.)
While optimization may be done in unpredictable ways, it does not (by definition) change the effective behavior of the program. If you write a program to calculate prime numbers, it will always calculate prime numbers, no matter how the compiler optimizes it. If you tell an LLM to write code to calculate prime numbers, you are at the mercy of chance. (Maybe not for such a simple program, where the solution is directly in the training data, but you get the idea.)