add pure c version