The code looks almost like a riddle.
Lots of brackets and lots of SR blocks in the middle of the code.
This is an example of way too complex STL code for logic.
I think it is originally FBD code, due to the use of SR blocks in the middle of the network.
This my attempt to reproduce it in FBD and LAD.
When I switch to STL, the STL code looks not at all like the original.