Inline leaf functions at call sites when there is only a single caller.

* While here, improve the `send_query/4` functions control flow.