Auto merge of #147541 - saethlin:transmute-carefully, r=scottmcm

Change int-to-ptr transmute lowering back to inttoptr

This is a revert of https://github.com/rust-lang/rust/pull/121282, but with a regression test to cover the reported miscompile in https://github.com/rust-lang/rust/issues/147265 that was caused by the way the code here combines with https://github.com/rust-lang/rust/pull/138759.