Kim Asendorf algorithm