code: def write_instruction(fout, start_pos, ins):
      opcode, operands = ins.opcode, ins.operands
      fmt_operands = opcode_table[opcode]['operands']
      if ins.wide:
          fout.write(pack('>B', 0xC4))
          fout.write(pack('>B', opcode))
          fout.write(pack('>H', operands[0].value))
          if opcode == 0x84:
              fout.write(pack('>h', operands[1].value))
      elif fmt_operands:
          fout.write(pack('>B', opcode))
          for i, (fmt, _) in enumerate(fmt_operands):
              fout.write(fmt.value.pack(operands[i].value))
      elif opcode == 0xAB:
          fout.write(pack('>B', opcode))
          padding = 4 - (start_pos + 1) % 4
          padding = padding if padding != 4 else 0
          fout.write(pack(f'{padding}x'))
          fout.write(pack('>ii', operands[1].value, len(operands[0])))
          for key in sorted(operands[0].keys()):
              fout.write(pack('>ii', key, operands[0][key]))
      elif opcode == 0xAA:
          fout.write(pack('>B', opcode))
          padding = 4 - (start_pos + 1) % 4
          padding = padding if padding != 4 else 0
          fout.write(pack(f'{padding}x'))
          fout.write(pack(
              f'>iii{len(operands) - 3}i',
              operands[0].value,
              operands[1].value,
              operands[2].value,
              *(o.value for o in operands[3:])
          ))
      else:
          fout.write(pack('>B', opcode))