import re


def process_args(args: "list[str]") -> "dict":
    """Identify optional arguments from staged file names.

    Args:
        args (list[str]): A list of all command-line arguments.

    Returns:
        dict: A dictionary with three keys:
            "files": The staged files to process.
            "ignore_dirs": An optional list of directories to ignore so they
            are not searched for assemblies.
            "ignore_files": An optional list of file names to ignore so they
            are not processed for the module-used-by block comment.
    """
    ret = {
        "files": [],
        "ignore_dirs": [],
        "ignore_files": []
    }

    dir_pattern = re.compile("--ignore-dir=(.+)")
    file_pattern = re.compile("--ignore-file=(.+)")

    for arg in args:
        dir_match = re.match(dir_pattern, arg)
        if dir_match:
            ret["ignore_dirs"].append(dir_match.group(1).strip())
            continue

        file_match = re.match(file_pattern, arg)
        if file_match:
            ret["ignore_files"].append(file_match.group(1).strip())
            continue

        ret["files"].append(arg)
    return ret