Here's the C code. It pretty much lifted every optimization trick it could find directly from your Rust code, as far as I can tell: https://github.com/simonw/research/blob/main/memchr-c-wrappe...