Exploring different implementations of the same functionality in optimized assembly

Yes, specifically due to use of mem::uninitialized.

My understanding is getting a mutable reference to anything that's std::mem::uninitialized is "instant" UB. The only caveat is if you're using the mutable reference to immediately turn it into a raw ptr:

let mut x: SomeThing = std::mem::uninitialized();
let raw = &mut x as *mut _;

It's a bit odd, but I think the above is fine; there's no way to actually get a raw pointer without first going through a reference in cases like this. Although I'm not sure where cases like this will eventually settle, given the ongoing effort to formalize and refine the unsafe guidelines.

There was some discussion in a thread somewhat recently, probably key post being this one.