Maybe the C code was just badly written
Use some of the -W* flags (-Wall -Wpedantic -Wconversion, ...) and specify the standard -std=c90.
Avoid undefined behaviors:
- https://en.cppreference.com/w/c/language/behavior
- https://wiki.sei.cmu.edu/confluence/display/c
(Also use cppcheck, valgrind, gdb, astyle, make, ...)
Done.
Fun fact: JS and C are both standardized by ISO.
P.S. and old code definitely needs them, as at the time compilers didn't optimize so aggressively and lots of code does weird stuff with memory, shifts, etc.
-- https://www.bell-labs.com/usr/dmr/www/chist.html
Unfortunately since 1979, majority of C devs think they know better.