Solution (source code)

= Solution

Using the complex cosine identity,
$$
\cos(x+iy)=\cos x\cosh y-i\sin x\sinh y,
$$
we find
$$
(x+iy)\cos(x+iy)=x\cos x\cosh y+y\sin x\sinh y+i[y\cos x\cosh y-x\sin x\sinh y].
$$
Its <real part> is exactly the prescribed function. Thus a <harmonic conjugate> is $v=y\cos x\cosh y-x\sin x\sinh y$, and the general answer is
$$
\boxed{f(z)=z\cos z+iC,\qquad C\in\mathbb R.}
$$
To check the only freedom, two <analytic functions> with this <real part> differ by a function with zero real part. The <Cauchy-Riemann equations> then force both partial <derivatives> of its imaginary part to vanish, so it is constant on the connected domain. No normalization was supplied to fix $C$.