\(\sin x = \cos x \Rightarrow \tan x = 1 \Rightarrow x = \frac{\pi}{4}\) or \(x = \frac{\pi}{4} - \pi = -\frac{3\pi}{4}\) in \((-\pi, \pi)\).
At \(x=\frac{\pi}{4}\), the slopes are \(\cos\frac{\pi}{4} = \frac{1}{\sqrt2}\) and \(-\sin\frac{\pi}{4} = -\frac{1}{\sqrt2}\), which are unequal; at \(x=-\frac{3\pi}{4}\), the slopes are \(-\frac{1}{\sqrt2}\) and \(\frac{1}{\sqrt2}\), unequal. So \(f\) has a corner at both points.
Hence \(S = \left\{-\frac{3\pi}{4}, \frac{\pi}{4}\right\}\).
Option (1) lacks \(-\frac{3\pi}{4}\), option (2) lacks \(\frac{\pi}{4}\), option (3) lacks \(-\frac{3\pi}{4}\); only option (4) contains both points.
Answer: (4) \(\left\{-\frac{3\pi}{4}, -\frac{\pi}{4}, \frac{3\pi}{4}, \frac{\pi}{4}\right\}\)