```\nfunction didLastOptionalReturnCallSucceed(\n    bool callStatus\n) private pure returns (bool success) {\n    assembly {\n        // Get how many bytes the call returned.\n        let returnDataSize := returndatasize()\n\n        // If the call reverted:\n        if iszero(callStatus) {\n            // Copy the revert message into memory.\n            returndatacopy(0, 0, returnDataSize)\n\n            // Revert with the same message.\n            revert(0, returnDataSize)\n        }\n\n        switch returnDataSize\n        case 32 {\n            // Copy the return data into memory.\n            returndatacopy(0, 0, returnDataSize)\n\n            // Set success to whether it returned true.\n            success := iszero(iszero(mload(0)))\n        }\n        case 0 {\n            // There was no return data.\n            success := 1\n        }\n        default {\n            // It returned some malformed input.\n            success := 0\n        }\n    }\n}\n```\n