def get_classical_addresses_from_program(program) -> Dict[str, List[int]]:
    addresses: Dict[str, List[int]] = defaultdict(list)
    flattened_addresses = {}
    for instr in program:
        if isinstance(instr, Measurement) and instr.classical_reg:
            addresses[instr.classical_reg.name].append(instr.classical_reg.offset)
    for k, v in addresses.items():
        reduced_list = list(set(v))
        reduced_list.sort()
        flattened_addresses[k] = reduced_list
    return flattened_addresses