[NFC][LLVM] Misc code cleanup in AsmWriter.cpp (#161522)
- Change function/variable names to follow LLVM coding standard.
- Use `auto` for variables initialized using `dyn_cast`.
- Use `ArrayRef` instead of const vector references for function
arguments.
- Use `interleaved` to print comma separated lists of integers.
- Inline some instances of `incorporateFunction` lambda that have a
single use.