If we would write some code in rust, compile it to, for example, x86_64. And then de-compile it to C. It would be perfectly memory-safe C code, right?
As Rust is llvm based, you don't need to compile it to C. Just write a backend that translates LLVM IR to C instead of x86_64. The IR is very C looking, it's probably overly complex.
Compiling down to asm, lot of information is lost regarding memory layout etc, so it's not the best source for generating code.
Hey, LLVM to C is what Rellic does! https://github.com/lifting-bits/rellic