The functions seem overly complicated. The body of this function is rechecking for an And operation to find the constant, but we already know we were looking at two Ands ORed together and the pieces are in variables. So just pass the correct pieces and check for two Constants.
Also since the two functions are almost identical, just pass in the opcode for the one difference so they can be combined.
Next step is to use m_APInt instead of ConstantInt.
Dropped the null check on CI2? This will crash: