Using div_8 and cryptic_function(a) this is the simplified function:
function fss2(seq)
A = 0; i = 1
while i <= length(seq)
if seq[i] == cryptic_function(A)
A <<= 3; i += 1
else
A += 1
while div_8(A)==0 && A > 0
A >>= 3; i -= 1
end
end
end
return A >> 3
end