Dissonant counterpoint algorithm in C