Can someone please help me optimize this:

```
:0→S
:0→L
:0→T
:If G=21
:Then
:If 9=[A](Y,X-1
:Then
:1→[A](Y,X-1
:Output(Y,X-1," //1 space
:End
:If 9=[A](Y,X+1
:Then
:1→[A](Y,X+1
:Output(Y,X+1," //1 space
:End
:If 9=[A](Y-1,X
:Then
:1→[A](Y-1,X
:Output(Y-1,X," //1 space
:End
:If 9=[A](Y+1,X
:Then
:1→[A](Y+1,X
:Output(Y+1,X," //1 space
:End
:End
:If max(9={[A](Y,X-1),[A](Y,X+1),[A](Y-1,X),[A](Y+1,X
:"Open?→Str8
:2(5=[A](Y,X-1))+4(5=[A](Y,X+1))+(5=[A](Y-1,X))+3(5=[A](Y+1,X→L
:If Ans
:"Enter?→Str8
:max(6={[A](Y,X-1),[A](Y,X+1),[A](Y-1,X),[A](Y+1,X→S
:If Ans
:"Save?→Str8
:not([A](Y,X-1))+not([A](Y,X+1))+not([A](Y-1,X))+not([A](Y+1,X→T
:If Ans
:"Shop?→Str8
```

The above is supposed to look at the four spaces adjacent to (Y,X) and perform various functions depending on their value. It works, but after I optimized it to the best of my ability, it's still dreadfully slow. If anyone could help, it would be greatly appreciated.