import struct
from collections.abc import Collection


def make_data(actions: Collection[tuple[int, int, int]]) -> bytes:
	action_count = len(actions)

	byte_sup = 2 ** 8
	dword_sup = 2 ** 32
	checksum = action_count % dword_sup
	for action in actions:
		checksum ^= action[0] ^ action[1] ^ (action[2] % byte_sup)

	data = (
		(0x1020304050607080).to_bytes(8)
		+ (action_count).to_bytes(4, byteorder='little')
		+ (checksum).to_bytes(4, byteorder='little')
	) + b"".join([struct.pack('<LLL', *action) for action in actions])

	return data
