```\\nfunction safeApprove(ERC20 token, address to, uint256 amount) internal {\\n    bool callStatus;\\n\\n    assembly {\\n        // Get a pointer to some free memory.\\n        let freeMemoryPointer := mload(0x40)\\n\\n        // Write the abi-encoded calldata to memory piece by piece:\\n        mstore(\\n            freeMemoryPointer,\\n            0x095ea7b300000000000000000000000000000000000000000000000000000000\\n        ) // Begin with the function selector.\\n        mstore(\\n            add(freeMemoryPointer, 4),\\n            and(to, 0xffffffffffffffffffffffffffffffffffffffff)\\n        ) // Mask and append the "to" argument.\\n        mstore(add(freeMemoryPointer, 36), amount) // Finally append the "amount" argument. No mask as it's a full 32 byte value.\\n\\n        // Call the token and store if it succeeded or not.\\n        // We use 68 because the calldata length is 4 + 32 * 2.\\n        callStatus := call(gas(), token, 0, freeMemoryPointer, 68, 0, 0)\\n    }\\n\\n    require(didLastOptionalReturnCallSucceed(callStatus), "APPROVE_FAILED");\\n}\\n```\\n