How to integrate $f(x) =\exp(-ax-b/x)$?

We assume $a>0,b>0$. Then by the change of variable $$ x=\sqrt{\frac ba}\cdot u $$ one gets $$ \int_0^\infty e^{\large-ax-\frac{b}{x}}dx=\sqrt{\frac ab}\cdot\int_0^\infty e^{\large-\sqrt{ab}\left(u+\frac1u \right)}du=2\sqrt{\frac ba}\cdot K_1\left(2 \sqrt{ab}\right) $$ where we have used a standard representation of the modified Bessel function (10.32).

Edit. From (10.32.9) one may write $$ \begin{align} 2K_1\!\left(2z\right)&=2\int_0^\infty e^{\large-2z\cosh t}\cosh t\:dt \\&=\int_0^\infty e^{\large-z\left(e^t+e^{-t}\right)}\left(e^t+e^{-t}\right)dt \\&=\int_0^\infty e^{\large-z\left(e^t+e^{-t}\right)}e^tdt+\int_0^\infty e^{\large-z\left(e^t+e^{-t}\right)}e^{-t}dt \\&=\int_1^\infty e^{\large-z\left(u+\frac1u \right)}du+\int_0^1 e^{\large-z\left(\frac1u+u\right)}du \\&=\int_0^\infty e^{\large-z\left(u+\frac1u \right)}du. \end{align} $$


$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ \begin{align} \int_{0}^{\infty}\exp\pars{-ax - {b \over x}}\,\dd x & = \int_{0}^{\infty} \exp\pars{-\root{ab}\bracks{\root{a \over b}x + {1 \over \root{a/b}x}}}\,\dd x \\[5mm] & \stackrel{x\ =\ \root{b/a}\exp\pars{\theta}}{=}\,\,\, \int_{-\infty}^{\infty}\exp\pars{-2\root{ab}\cosh\pars{\theta}} \,\root{b \over a}\expo{\theta}\,\dd\theta \\[5mm] & = \root{b \over a}\int_{-\infty}^{\infty}\exp\pars{-2\root{ab}\cosh\pars{\theta}} \bracks{\cosh{\theta} + \sinh{\theta}}\,\dd\theta \\[5mm] & = 2\root{b \over a}\int_{0}^{\infty}\exp\pars{-2\root{ab}\cosh\pars{\theta}} \cosh{\theta}\,\dd\theta \\[5mm] & = \bbx{2\root{b \over a}\,\mrm{K}_{1}\pars{2\root{ab}}}\,, \qquad\verts{\mrm{arg}\pars{2\root{ab}}} < {\pi \over 2}\label{1}\tag{1} \end{align}

$\ds{\mrm{K}_{\nu}}$ is a Modified Bessel Function. \eqref{1} is found with $\ds{\mathbf{\color{#000}{9.6.24}}}$ in A & S Table.