There are four different endings for King's Quest IV. The Bad Ending occurs when you return to Daventry without the magic fruit, but with the hen that lays golden eggs. King Graham dies, but at least the kingdom has gold. The song was composed by William Goldstein.
King's Quest IV: The Perils of Rosella (DOS)
Five different types of output were designed for the DOS release, each output corresponds to a different group of devices, the Roland, Yamaha, OPL2, 3 Voice, and PC Speaker.
The file is sound.202 in the resource files.
It is unknown if the Amiga, Apple II, Apple II GS, or Atari ST ports have this song.