Oh look, I implemented it in C.