The code is too broken to fix. There are bits and pieces every where and several blocks that are incomplete with no information on what they should do to fix them. You likely need to start with the original code that was modified from (first making sure that compiles and runs) and make small changes and try and compile it (and stop and fix it when it doesn't compile). It looks like you may need to find a basic tutorial on C (I expect there are a bunch if you google) so you understand the basic code blocks in C or you will likely not succeed.
Peter.