Here’s your problem:
if sys.ms-LST > T | sys.ms-LST = T
Lil always evaluates expressions right-to-left, which means this expression is understood like:
if sys.ms-(LST > (T | (sys.ms-(LST = T))))
…which probably isn’t what you wanted. You can fix it by adding brackets in the places you want:
if ((sys.ms-LST) > T) | ((sys.ms-LST) = T)
…or by leaning into the right-to-left pattern with something like this:
if !T<sys.ms-LST
After making that change, it plays the first four beats correctly.