Once the world’s biggest moviemaker, Metro-Goldwyn-Mayer was weakened by corporate warfare and on the brink of collapse.