add libdg_loop and dg_int_loop