L315-327 as follows?

```
e = expr - S.One
if not e.is_Mul or len(e.args) != 2: return
a, b = e.args
```

or replace L320-325 with

```
a, b = expr.args
if not a is S.One:
    a, b = b, a
if not (a is S.One and b.is_Mul and len(b.args) == 2):
    return
```