Add C implementation

This adds a basic C implementation. It may not be very stable.