Replace CONSTANT_INDEX operands with the literal Constant object from
    the constant pool.

    :param ins: Instruction to potentially modify.
    :param cf: The ClassFile instance used to resolve Constants.
    :return: Potentially modified instruction.

def expand_constants(ins: Instruction, *, cf) -> Instruction:
    """Replace CONSTANT_INDEX operands with the literal Constant object from
    the constant pool.

    :param ins: Instruction to potentially modify.
    :param cf: The ClassFile instance used to resolve Constants.
    :return: Potentially modified instruction.
    """
    for i, operand in enumerate(ins.operands):
        if not isinstance(operand, Operand):
            continue

        if operand.op_type == OperandTypes.CONSTANT_INDEX:
            ins.operands[i] = cf.constants[operand.value]

    return ins