Split some parts of ass_render_event into functions

The split doesn't necessarily follow any logic; for the most part
it just moves each processing loop into its own function.