If possible, you could try to get the requirements and design to those and write something new.
If that's not possible, I would start flow-charting. I always do it by hand in whatever tool you have handy. Some languages have tools that can do this for you (Go and Java and I think PHP to name a few) if it's that big of a mess. From there, find your inputs and outputs and go back to the "rewrite it" part.