Add C/C++ port of fit_sed