It says on the wiki site that if you're spotted by enemies while in stealth mode you miss out on the S rank and getting Lou and Magashi.

is there any way to take out the guards in the stealth mode areas without being detected? like with a rifle or a trap?