They get to surrender, ideally, but...
And as the link from previous post demonstrated, there's a whole lot of potential ifs and buts to consider when determining if a surrender is valid or not, and probably some controversies about these rules to be found too.
Hypothetically, this situation...