Show login or register to anonymous user fro flag
If I understand the question correctly:


You should be able, through permissions, to restrict access to the Flags, so that anonymous users don't see it
you could use the default user login block, or create a custom one that redirects users, and place that block in the same position as the Flags, with a message like "To Flag objects, you must first login" and then restrict that block to show only to anonymous users