i didn't test this earlier but now i noticed it too.

the problem is in newton_addentity():

printf("%d", body);
entity->skill99 = (long)body; // save body pointer with entity
printf("%d", entity->skill99);

lite-c does some strange automatic var conversion. you have to remove the (long).