import struct, sys
f = open(r'C:/git/bt411/content/BTL4OPT.EXE', 'rb').read()
pe = struct.unpack_from('<I', f, 0x3c)[0]
nsec = struct.unpack_from('<H', f, pe + 6)[0]
optsz = struct.unpack_from('<H', f, pe + 20)[0]
base = struct.unpack_from('<I', f, pe + 24 + 28)[0]
secs = []
for i in range(nsec):
    s = pe + 24 + optsz + i * 40
    vsz, va, rsz, ro = struct.unpack_from('<IIII', f, s + 8)
    secs.append((base + va, rsz, ro))

def fo(va):
    for sva, rsz, ro in secs:
        if sva <= va < sva + rsz:
            return ro + (va - sva)
    raise ValueError(hex(va))

for va_s, n in [(a, int(b)) for a, b in (x.split(':') for x in sys.argv[1:])]:
    va = int(va_s, 16)
    vals = [struct.unpack_from('<I', f, fo(va) + i * 4)[0] for i in range(n)]
    print(hex(va), ' '.join(hex(v) for v in vals))
