Add original C implementation for reference.