Translated if statement and block in AG_EventLoop