Solve 1/2
new C version
C impl