input: es_out: small refactors with early return and branch merges
This MR includes code refactor to simplify cases in the es_out.c code where:
- small if branches terminating with a return statement are used with a following (potentially huge) else branch
- a single if statement is used to branch a whole block right before the return
- nested if branches which could be merged together