  Westerlund 1 is a young, massive Galactic starburst cluster that contains a
rich coeval population of Wolf-Rayet stars, hot- and cool-phase transitional
supergiants, and a magnetar. We use spectroscopic and photometric observations
of the eclipsing double-lined binary W13 to derive dynamical masses for the two
components, in order to determine limits for the progenitor masses of the
magnetar CXOU J164710.2-455216 and the population of evolved stars in Wd1. W13
has an orbital period of 9.2709+/-0.0015 days and near-contact configuration.
The shallow photometric eclipse rules out an inclination greater than 65
degrees, leading to lower limits for the masses of the emission-line optical
primary and supergiant optical secondary of 21.4+/-2.6Msun and 32.8+/-4.0Msun
respectively, rising to 23.2 +3.3/-3.0Msun and 35.4 +5.0/-4.6 Msun for our
best-fit inclination 62 +3/-4 degrees. Comparison with theoretical models of
Wolf-Rayet binary evolution suggest the emission-line object had an initial
mass in excess of 35Msun, with the most likely model featuring highly
non-conservative late-Case-A/Case-B mass transfer and an initial mass in excess
of 40Msun. This confirms the high magnetar progenitor mass inferred from its
membership in Wd1, and represents the first dynamical constraint on the
progenitor mass of any magnetar. The red supergiants in Wd1 must have similar
progenitor masses to W13 and are therefore amongst the most massive stars to
undergo a red supergiant phase, representing a challenge for population models
that suggest stars in this mass range end their redwards evolution as yellow
hypergiants. [ABRIDGED]
