{
    "Function": "power",
    "File": "src/libraries/Math128x128.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [
        "revert Math128x128__PowerUnderflow(uint256,int256)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function power(uint256 x, int256 y) internal pure returns (uint256 result) {\n        bool invert;\n        uint256 absY;\n\n        if (y == 0) return Constants.SCALE;\n\n        assembly {\n            absY := y\n            if slt(absY, 0) {\n                absY := sub(0, absY)\n                invert := iszero(invert)\n            }\n        }\n\n        if (absY < 0x100000) {\n            result = Constants.SCALE;\n            assembly {\n                let pow := x\n                if gt(x, 0xffffffffffffffffffffffffffffffff) {\n                    pow := div(not(0), pow)\n                    invert := iszero(invert)\n                }\n\n                if and(absY, 0x1) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x2) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x4) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x8) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x10) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x20) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x40) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x80) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x100) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x200) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x400) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x800) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x1000) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x2000) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x4000) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x8000) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x10000) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x20000) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x40000) {\n                    result := shr(128, mul(result, pow))\n                }\n                pow := shr(128, mul(pow, pow))\n                if and(absY, 0x80000) {\n                    result := shr(128, mul(result, pow))\n                }\n            }\n        }\n\n        // revert if y is too big or if x^y underflowed\n        if (result == 0) revert Math128x128__PowerUnderflow(x, y);\n\n        return invert ? type(uint256).max / result : result;\n    }"
}