def METHOD_NAME(
    self,
    stored: List[Tuple[int, int, CodeLocation]],
    restored: Iterable[List[Tuple[int, int, CodeLocation]]],
) -> Dict[int, Dict[str, List[Tuple[int, CodeLocation]]]]:
    def _collect(info: List[Tuple[int, int, CodeLocation]], output, keystr: str):
        for reg_offset, stack_offset, codeloc in info:
            if reg_offset not in output:
                output[reg_offset] = {}
            if keystr not in output[reg_offset]:
                output[reg_offset][keystr] = []
            output[reg_offset][keystr].append((stack_offset, codeloc))
    result: Dict[int, Dict[str, List[Tuple[int, CodeLocation]]]] = {}
    _collect(stored, result, "stored")
    for item in restored:
        _collect(item, result, "restored")
    # remove registers that are
    # (a) stored but not restored
    # (b) restored but not stored
    # (c) from different offsets
    # (d) the same as the return value register
    cc = self._func.calling_convention
    if cc is not None and isinstance(cc.RETURN_VAL, SimRegArg):
        ret_val_reg_offset = self.project.arch.registers[cc.RETURN_VAL.reg_name][0]
    else:
        ret_val_reg_offset = None
    # link register
    if archinfo.arch_arm.is_arm_arch(self.project.arch):
        lr_reg_offset = self.project.arch.registers["lr"][0]
    elif self.project.arch.name in {"MIPS32", "MIPS64"}:
        lr_reg_offset = self.project.arch.registers["ra"][0]
    elif self.project.arch.name in {"PPC32", "PPC64"}:
        lr_reg_offset = self.project.arch.registers["lr"][0]
    else:
        lr_reg_offset = None
    for reg in list(result.keys()):
        # stored link register should always be removed
        if lr_reg_offset is not None and reg == lr_reg_offset:
            if "restored" not in result[reg]:
                # add a dummy one
                result[reg]["restored"] = []
            continue
        if ret_val_reg_offset is not None and reg == ret_val_reg_offset:
            # (d)
            del result[reg]
            continue
        info = result[reg]
        if len(info.keys()) != 2:
            # (a) or (b)
            del result[reg]
            continue
        stack_offsets = {stack_offset for stack_offset, _ in info["stored"]} | {
            stack_offset for stack_offset, _ in info["restored"]
        }
        if len(stack_offsets) != 1:
            # (c)
            del result[reg]
            continue
    return result