def METHOD_NAME(x, size_src, size_dest):
    if isinstance(x, int):
        if x >= (1 << (size_src - 1)):
            x -= 1 << size_src
        return x & ((1 << size_dest) - 1)
    assert x.size == size_src
    return BitVecSignExtend(operand=x, size_dest=size_dest)