[DDMD] [refactor] Move methods in clone.c into free functions