FAR: Function-preserving Attention Replacement for IMC-friendly Inference