You will find that most of the code in UNIX is of a very high standard. Many sections which initially seem complex and obscure, appear in the light of further investigation and reflection, to be perfectly obvious and “the only way to fly”.
For this reason, the occasional comments in the notes on programming style, almost invariably refer to apparent lapses from the usual standard of near perfection.
What caused these? Sometimes it appears that the original code has been patched expediently. More than once apparent lapses have proved not to be such: the “bad” code has been found in fact to incorporate some subtle feature which was not at all apparent initially. And some allowance is certainly needed for occasional human weakness.
But on the whole you will find that the authors of UNIX, Ken Thompson and Dennis Ritchie, have created a program of great strength, integrity and effectiveness, which you should admire and seek to emulate.