Could you provide me with the same algorithm as above, but written Rust, and a version written HC11 Assembly?