{
    "Function": "_findpos",
    "File": "contracts/RubiconMarket.sol",
    "Parent Contracts": [
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "_find",
        "isActive",
        "require(bool)",
        "_isPricedLtOrEq",
        "_isPricedLtOrEq",
        "_isPricedLtOrEq"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function _findpos(uint256 id, uint256 pos) internal view returns (uint256) {\n        require(id > 0);\n\n        // Look for an active order.\n        while (pos != 0 && !isActive(pos)) {\n            pos = _rank[pos].prev;\n        }\n\n        if (pos == 0) {\n            //if we got to the end of list without a single active offer\n            return _find(id);\n        } else {\n            // if we did find a nearby active offer\n            // Walk the order book down from there...\n            if (_isPricedLtOrEq(id, pos)) {\n                uint256 old_pos;\n\n                // Guaranteed to run at least once because of\n                // the prior if statements.\n                while (pos != 0 && _isPricedLtOrEq(id, pos)) {\n                    old_pos = pos;\n                    pos = _rank[pos].prev;\n                }\n                return old_pos;\n\n                // ...or walk it up.\n            } else {\n                while (pos != 0 && !_isPricedLtOrEq(id, pos)) {\n                    pos = _rank[pos].next;\n                }\n                return pos;\n            }\n        }\n    }"
}