\(\left(a-\dfrac{x^2+a^2}{x+a}\right)\left(\dfrac{2a}{x}-\dfrac{4a}{x-a}\right)\)
\(=\dfrac{ax+a^2-x^2-a^2}{x+a}\cdot\dfrac{2ax-2a^2-4ax}{x\left(x-a\right)}\)
\(=\dfrac{a\left(x-a\right)}{x+a}\cdot\dfrac{-2a^2-2ax}{x\left(x-a\right)}\)
\(=\dfrac{a}{x+a}\cdot\dfrac{-2a\left(a+x\right)}{x}\)
\(=\dfrac{-2a^2}{x}\)
\(\left(a-\dfrac{x^2+a^2}{x+a}\right)\left(\dfrac{2a}{x}-\dfrac{4a}{x-a}\right)\)
\(=\dfrac{ax+a^2-x^2-a^2}{x+a}.\dfrac{2a\left(x-a\right)-4ax}{x\left(x-a\right)}\)
\(=\dfrac{x\left(a-x\right)}{x+a}.\dfrac{-2a^2-2ax}{x\left(x-a\right)}\)
\(=\dfrac{x\left(a-x\right)}{x+a}.\dfrac{-2a\left(a+x\right)}{x\left(x-a\right)}\)
\(=2a\)