{
    "Function": "flipToBurnToken",
    "File": "contracts/types/TokenId.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function flipToBurnToken(uint256 self) internal pure returns (uint256) {\n        unchecked {\n            // NOTE: This is a hack to avoid blowing up the contract size.\n            // We copy the logic from the countLegs function, using it here adds 5K to the contract size with IR for some reason\n            // Strip all bits except for the option ratios\n            uint256 optionRatios = self & OPTION_RATIO_MASK;\n\n            // The legs are filled in from least to most significant\n            // Each comparison here is to the start of the next leg's option ratio\n            // Since only the option ratios remain, we can be sure that no bits above the start of the inactive legs will be 1\n            if (optionRatios < 2 ** 64) {\n                optionRatios = 0;\n            } else if (optionRatios < 2 ** 112) {\n                optionRatios = 1;\n            } else if (optionRatios < 2 ** 160) {\n                optionRatios = 2;\n            } else if (optionRatios < 2 ** 208) {\n                optionRatios = 3;\n            } else {\n                optionRatios = 4;\n            }\n\n            // We need to ensure that only active legs are flipped\n            // In order to achieve this, we shift our long bit mask to the right by (4-# active legs)\n            // i.e the whole mask is used to flip all legs with 4 legs, but only the first leg is flipped with 1 leg so we shift by 3 legs\n            // We also clear the poolId area of the mask to ensure the bits that are shifted right into the area don't flip and cause issues\n            return self ^ ((LONG_MASK >> (48 * (4 - optionRatios))) & CLEAR_POOLID_MASK);\n        }\n    }"
}