People tend to overestimate the actual complexity of code for a space shuttle; it's rocket science, therefore it must be some sort of complex black magic.
Most of the space shuttle is going to boil down to control theory. The code for a control system essentially looks like this:
while (true) {
readInputs();
smoothInputs();
computeUserDesiredSetpoints();
adjustVariablesToHitSetpoints();
makeActuatorsMove();
}
These functions are not computationally challenging. Even the complex mathematics boils down to "evaluate this function", and you can often get away without needing high precision if you have a feedback mechanism that can adjust for systematic error. There's also a lot of leeway on how simple or complex you can make the user direction: it is far more complex to implement a "perform a translunar injection orbit" than it is to say "burn thrusters at X heading at Y thrust for Z seconds" (think the difference between self-driving cars and cruise control).
Also there's the factor that every line on the space shuttle is a potential bug, and bugs might be deadly. There's a huge incentive to reduce the code to its absolute minimum.
The difference, of course, is that when smoothInputs() throws an exception, everybody dies.
There may not be very many lines of code in the shuttle command program, but every single one has a mountain of work behind it.
I wouldn't be surprised at all if fully half the tractor's code was buggy DRM junk. (And spaghetti code 12 times longer than if should have been at that)