Added stg style C implementation.