function readInstructions(program) {
let index = 0
const instructions = []
while (index < program.length) {
const instruction =
tryGetNextPushInstruction(program, index) ??
tryGetNextStorageAreaInstruction(program, index) ??
tryGetNextControlValueTableInstruction(program, index) ??
tryGetNextGraphicsStateInstruction(program, index) ??
tryGetReadWriteDataInstruction(program, index) ??
tryGetNextOutlineInstruction(program, index) ??
tryGetNextExceptionInstruction(program, index) ??
tryGetNextStackInstruction(program, index) ??
tryGetNextControlFlowInstruction(program, index) ??
tryGetNextLogicalInstruction(program, index) ??
tryGetNextMathInstruction(program, index) ??
tryGetNextCompensationInstruction(program, index)
instructions.push(instruction)
index += instruction.length
}
return instructions
}