{
    "Function": "_calcMaxEnd",
    "File": "src/Drips.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [
        "_isBalanceEnough",
        "_isBalanceEnough",
        "_buildConfigs",
        "_currTimestamp",
        "_isBalanceEnough",
        "_isBalanceEnough"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function _calcMaxEnd(\n        uint128 balance,\n        DripsReceiver[] memory receivers,\n        uint32 hint1,\n        uint32 hint2\n    ) private view returns (uint32 maxEnd) {\n        unchecked {\n            (uint256[] memory configs, uint256 configsLen) = _buildConfigs(receivers);\n\n            uint256 enoughEnd = _currTimestamp();\n            // slither-disable-start incorrect-equality,timestamp\n            if (configsLen == 0 || balance == 0) {\n                return uint32(enoughEnd);\n            }\n\n            uint256 notEnoughEnd = type(uint32).max;\n            if (_isBalanceEnough(balance, configs, configsLen, notEnoughEnd)) {\n                return uint32(notEnoughEnd);\n            }\n\n            if (hint1 > enoughEnd && hint1 < notEnoughEnd) {\n                if (_isBalanceEnough(balance, configs, configsLen, hint1)) {\n                    enoughEnd = hint1;\n                } else {\n                    notEnoughEnd = hint1;\n                }\n            }\n\n            if (hint2 > enoughEnd && hint2 < notEnoughEnd) {\n                if (_isBalanceEnough(balance, configs, configsLen, hint2)) {\n                    enoughEnd = hint2;\n                } else {\n                    notEnoughEnd = hint2;\n                }\n            }\n\n            while (true) {\n                uint256 end = (enoughEnd + notEnoughEnd) / 2;\n                if (end == enoughEnd) {\n                    return uint32(end);\n                }\n                if (_isBalanceEnough(balance, configs, configsLen, end)) {\n                    enoughEnd = end;\n                } else {\n                    notEnoughEnd = end;\n                }\n            }\n            // slither-disable-end incorrect-equality,timestamp\n        }\n    }"
}