```\nfunction canRemoveLiquidity(address target, bytes calldata data)\n    internal\n    view\n    returns (bool, address[] memory, address[] memory)\n{\n    (,uint256[2] memory amounts) = abi.decode(\n        data[4:],\n        (uint256, uint256[2])\n    );\n\n    address[] memory tokensOut = new address[](1);\n    tokensOut[0] = target;\n\n    uint i; uint j;\n    address[] memory tokensIn = new address[](2);\n    while(i < 2) {\n        if(amounts[i] > 0)\n            tokensIn[j++] = IStableSwapPool(target).coins(i);\n        unchecked { ++i; }\n    }\n    assembly { mstore(tokensIn, j) }\n\n    return (true, tokensIn, tokensOut);\n}\n```\n