Why dont you try to learn and decompile this on your own?
Read and rewrite into nasc

...
You have names of functions after "//", parameters are above the function.
Try and you will understand it eventually. Then compile back with nasc and check if it matches (well, labels won't match, but don't bother.