Refactor prof_lookup() by extracting prof_lookup_global().