Regarding software that comes bundled with hardware, is not the actual software itself, but rather the buggy install package and the stealth marketing crap and spyware that attempts to hook into the web browser. Video device drivers are notorious for this.
The worst programming code I've seen on the job originated life as a completely different project, and then another less talented programmer (or perhaps the same programmer crunched for time) starts a new project by copying the codebase and hacking it into something else entirely. A square preg will fit into a round hole, if you hack around the edges long enough and bang it with a hammer a few times.
"The universe is complicated and for the most part beyond your control, but your life is only as complicated as you choose it to be."