I posted a reply, but I think ultimately this is just a coincidence. There's a naïve reason that "mov S P" looks redundant ("just use S instead of P later"), but in typical GPT fashion, this is specious, and can't actually be done. It's essentially trying to swap two variables without using a temporary. If x86 had a conditional swap instruction, it could, but it doesn't, and just doing "cmp,cmov,cmov" can't handle it.
Another giveaway is that removing that line in the real optimization changes the output of the provided snippet if C < B. It feels like a hard sell to say GPT picked this line for that subtle reason based on information not provided, but explained it with something only correct at surface level.