I recently wrote a brainfuck compiler using Rust [0], but I targeted x86-64 asm directly. I implemented some very basic optimization (as you show at the bottom of your post), but I'd imagine llvm is able to take things much further. I'd be curious to see a performance comparison.<p>[0]: <a href="https://github.com/JoshMcguigan/nerve" rel="nofollow">https://github.com/JoshMcguigan/nerve</a>