Address cast code

When debugging in Remix IDE with optimize=true, I found that the address(0xAAAA) will generate opcodes:
PUSH1 0x1
PUSH1 0x1
PUSH1 0xa0

After the ‘SUB’ operation, the top element will be 0xffffffffffffffffffffffffffffffffffffffff. Why not directly push 0xffffffffffffffffffffffffffffffffffffffff? Does someone know where the source code generating these opcodes of the Solidity compiler is?

It may be the bytecode size optimization. This entire snippet is 9 bytes, but pushing a 20-byte value is 21 bytes plus the AND, so 22 in total. For higher optimizer runs the simpler and cheaper push may be used despite taking more space and costing more to deploy. You can try tweaking the runs parameter to see if this is the case.