print('entry'); var label; var state; var decisions = [2, 2, 1, 3, 2, 2, 1, 3, 2, 3, 3, 1, 3, 2, 1]; var index = 0; function check() { if (index == decisions.length) throw 'HALT'; return decisions[index++] } if (state == 2) { while(1) { print(2); state = check(); } } while(1) { print(4); state = check(); if (!(state == 4)) { break; } } print(3); state = check(); while(1) { print(1); state = check(); }