This code is a fairly faithful transcription of the IBM 650 code, done in machine language, with fixed-point in 1956.
It is very hard to understand and one would have to take notes to reverse engineer its logic to find the mathematical logic.
Much of the hair is due to extreme memory pressure and some is due to an attempt to avoid repeat computations.
The 650 was a small computer then but production codes on large computers of the day used just about the same messy logic to save time and space.
I plan to produce another version with some modern ideas and ignoring memory pressures.