To understand how an Avisynth graph runs you need to start at the end and work backwards calculating which frame numbers get asked for at each filter.
So first ...
Code:
# External App
Ask for frame 0
# Trim(9,0)
Ask for frame 9
# filters (5 frame temporal ref)
Ask for frame 7,8,9,10,11
# Loop(10,0,0)
Ask for frame 0,0,0,1,2
# Cache
Ask for frame 0,1,2
And next ...
Code:
# External App
Ask for frame 1
# Trim(9,0)
Ask for frame 10
# filters (5 frame temporal ref)
Ask for frame 8,9,10,11,12
# Loop(10,0,0)
Ask for frame 0,0,1,2,3
# Cache
Ask for frame 3