Implementing a state machine in the safety plc

I need to implement a state machine with about 10 states in the safety plc. I’ve seen a suggestion like the below for making generic ladder logic state machines, but I don’t see how to make assignments to SAFEBYTE values in the plcnext safety world. Thanks!
(I know there better ways to do this little example, but it shows the ideas I need for my full state machine, which involves various human interactions with the robot system.)
S_ESTOPPED = SAFEBYTE#0
S_AWAIT_RESET = SAFEBYTE#1
S_AUTO = SAFEBYTE#2
[any estop pressed] ------ ( state := S_ESTOPPED )
[ state == S_ESTOPPED ] [ all estops released ] ---- ( state := S_AWAIT_RESET )
[ state == S_AWAIT_RESET ] [ reset pressed ] ----- ( state := S_AUTO )
[ state == S_AUTO ] ---- ( green light )