Implementation of Henriksen's Algorithm in C