mov: Move code shared with CAF to a separate file