Prototype implementation in C

Here's a C implementation of the prototype. There is still a lot of work to be done, but I think we should merge this now and resume working with smaller feature branches.

Feel free to *not* read/review all of this. I'm sending this pull request just in case you have questions/comments/suggestions about specific parts.