import yaml


def get_required_num_cores(cwl_content: bytes) -> int:
    """Takes a CWL file contents and extracts number of cores required.

    Args:
        cwl_content: The contents of a CWL file.

    Returns:
        The number of cores required, or 0 if not specified.
    """
    workflow = yaml.safe_load(cwl_content.decode())
    hints = workflow.get('hints')
    if hints is None:
        return 0

    resource_requirement = hints.get('ResourceRequirement')
    if resource_requirement is None:
        return 0

    cores_min = resource_requirement.get('coresMin')
    cores_max = resource_requirement.get('coresMax')

    if cores_min is not None:
        return cores_min
    if cores_max is not None:
        return cores_max
    return 0