Implemented ldmPredict function in C