Help in porting C to python

Hello, I need a small help in porting this code to python.
https://github.com/alguien-gh/scripts/blob/master/exploits/rom0x/unlzs.c

I can't understand the logic in here.

It seems to uncompress a file (or part of it). Websearch with lzs and python leads to:

https://github.com/fragglet/lhasa
Thanks! Can you port it to python?
Registered users can post here. Sign in or register to post.