{
    "Function": "simulate",
    "File": "contracts/lib/safe-contracts/contracts/handler/CompatibilityFallbackHandler.sol",
    "Parent Contracts": [
        "contracts/lib/safe-contracts/contracts/interfaces/ISignatureValidator.sol",
        "contracts/lib/safe-contracts/contracts/interfaces/ISignatureValidator.sol",
        "contracts/lib/safe-contracts/contracts/handler/DefaultCallbackHandler.sol",
        "contracts/lib/safe-contracts/contracts/interfaces/IERC165.sol",
        "contracts/lib/safe-contracts/contracts/interfaces/ERC721TokenReceiver.sol",
        "contracts/lib/safe-contracts/contracts/interfaces/ERC777TokensRecipient.sol",
        "contracts/lib/safe-contracts/contracts/interfaces/ERC1155TokenReceiver.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "mstore(uint256,uint256)",
        "revert(uint256,uint256)",
        "pop(uint256)",
        "mload(uint256)",
        "calldatasize()",
        "gas()",
        "returndatacopy(uint256,uint256,uint256)",
        "calldatasize()",
        "call(uint256,uint256,uint256,uint256,uint256,uint256,uint256)",
        "mload(uint256)",
        "returndatasize()",
        "mload(uint256)",
        "mload(uint256)",
        "mstore(uint256,uint256)",
        "calldatacopy(uint256,uint256,uint256)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function simulate(address targetContract, bytes calldata calldataPayload) external returns (bytes memory response) {\n        // Suppress compiler warnings about not using parameters, while allowing\n        // parameters to keep names for documentation purposes. This does not\n        // generate code.\n        targetContract;\n        calldataPayload;\n\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            let internalCalldata := mload(0x40)\n            // Store `simulateAndRevert.selector`.\n            // String representation is used to force right padding\n            mstore(internalCalldata, \"\\xb4\\xfa\\xba\\x09\")\n            // Abuse the fact that both this and the internal methods have the\n            // same signature, and differ only in symbol name (and therefore,\n            // selector) and copy calldata directly. This saves us approximately\n            // 250 bytes of code and 300 gas at runtime over the\n            // `abi.encodeWithSelector` builtin.\n            calldatacopy(add(internalCalldata, 0x04), 0x04, sub(calldatasize(), 0x04))\n\n            // `pop` is required here by the compiler, as top level expressions\n            // can't have return values in inline assembly. `call` typically\n            // returns a 0 or 1 value indicated whether or not it reverted, but\n            // since we know it will always revert, we can safely ignore it.\n            pop(\n                call(\n                    gas(),\n                    // address() has been changed to caller() to use the implementation of the Safe\n                    caller(),\n                    0,\n                    internalCalldata,\n                    calldatasize(),\n                    // The `simulateAndRevert` call always reverts, and\n                    // instead encodes whether or not it was successful in the return\n                    // data. The first 32-byte word of the return data contains the\n                    // `success` value, so write it to memory address 0x00 (which is\n                    // reserved Solidity scratch space and OK to use).\n                    0x00,\n                    0x20\n                )\n            )\n\n            // Allocate and copy the response bytes, making sure to increment\n            // the free memory pointer accordingly (in case this method is\n            // called as an internal function). The remaining `returndata[0x20:]`\n            // contains the ABI encoded response bytes, so we can just write it\n            // as is to memory.\n            let responseSize := sub(returndatasize(), 0x20)\n            response := mload(0x40)\n            mstore(0x40, add(response, responseSize))\n            returndatacopy(response, 0x20, responseSize)\n\n            if iszero(mload(0x00)) {\n                revert(add(response, 0x20), mload(response))\n            }\n        }\n    }"
}