My friend evaluated this to be $$ \int \bigl| a\sin(x)+b\cos(x) \bigr| {\rm d}x \\ = \sqrt{a^2+b^2} \left( \sin(x-\phi)\text{sign}(\cos(x-\phi)) +\frac{2}{\pi} \bigl(x-\arctan(\tan(x-\phi)) \bigr) \right) + C $$ where $\phi = \arctan \left(\frac{a}{b} \right)$.
My answer instead is much shorter, by simply looking for the intervals of $x$ for which I need to multiply by $-1$, I got
$$ (b\sin(x)-a\cos(x)) \cdot \text{sign}(a\sin(x)+b\cos(x)) + C $$
Why does my friend's solution look so big and complex and how did she even come up with the idea to do that?
She is probably starting by replacing the $a\sin x + b\cos x$ and rewriting in terms of a function with an amplitude and phase. One way to do this is to multiply by $1$ and draw a right triangle with angle $\phi$, adjacent side length $b$, and opposite side length $a$. Then one has
$$\begin{aligned} \left|a\sin x + b\cos x\right| &= \sqrt{a^{2}+b^{2}}\left|\frac{a}{\sqrt{a^{2}+b^{2}}}\,\sin x + \frac{b}{\sqrt{a^{2}+b^{2}}}\,\cos x\right| \\ &= \sqrt{a^{2}+b^{2}}\left|\sin\phi\sin x + \cos\phi\cos x\right| \\ &= \sqrt{a^{2}+b^{2}}\left|\cos(x-\phi)\right|.\end{aligned}$$
This procedure is motivated in physics/engineering as a more elegant way of writing solutions to the harmonic oscillator equation, as amplitude and phase both have physical interpretations and are often easier to determine given initial conditions.