Move pop_user_ctx implementations to a .c file