Function is such a mess. Even C++ would clean this right up, and then you'd actually be able to read it. I'm not even going to claim this is beautiful or flawless or whatever, but <i>to me</i> this kind of C++ is head and shoulders above the C code in the article in terms of readability.<p><a href="https://godbolt.org/z/Mfnxq15Ma" rel="nofollow">https://godbolt.org/z/Mfnxq15Ma</a>