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nQgbmF0aXZlVHlwZV87CiAgICBib29sIG5hdGl2ZVJlbmRlcmFibGVfOwogICAgLy8gTXVsdGlzYW1wbGUgc3VwcG9ydAogICAgRUdMaW50IHNhbXBsZUJ1ZmZlcnNfOwogICAgRUdMaW50IHNhbXBsZXNfOwogICAgLy8gU3RlbmNpbCBidWZmZXIKICAgIEVHTGludCBzdGVuY2lsU2l6ZV87CiAgICBFR0xpbnQgc3VyZmFjZVR5cGVfOwogICAgLy8gVHJhbnNwYXJlbmN5CiAgICBFR0xpbnQgeHBhcmVudFR5cGVfOyAvLyBTaG91bGQgYmUgUkdCIG9yIE5PTkUKICAgIEVHTGludCB4cGFyZW50UmVkVmFsdWVfOwogICAgRUdMaW50IHhwYXJlbnRHcmVlblZhbHVlXzsKICAgIEVHTGludCB4cGFyZW50Qmx1ZVZhbHVlXzsKCnB1YmxpYzoKICAgIEVnbENvbmZpZygpIDoKICAgICAgICBoYW5kbGVfKDApLAogICAgICAgIGJ1ZmZlclNpemVfKDApLAogICAgICAgIHJlZFNpemVfKDApLAogICAgICAgIGdyZWVuU2l6ZV8oMCksCiAgICAgICAgYmx1ZVNpemVfKDApLAogICAgICAgIGx1bWluYW5jZVNpemVfKDApLAogICAgICAgIGFscGhhU2l6ZV8oMCksCiAgICAgICAgYWxwaGFNYXNrU2l6ZV8oMCksCiAgICAgICAgYmluZFRleFJHQl8oZmFsc2UpLAogICAgICAgIGJpbmRUZXhSR0JBXyhmYWxzZSksCiAgICAgICAgYnVmZmVyVHlwZV8oRUdMX1JHQl9CVUZGRVIpLAogICAgICAgIGNhdmVhdF8oMCksCiAgICAgICAgY29uZmlnSURfKDApLAogICAgICAgIGNvbmZvcm1hbnRfKDApLAogICAgICAgIGRlcHRoU2l6ZV8oMCksCiAgICAgICAgbGV2ZWxfKDApLAogICAgICAgIHBidWZmZXJXaWR0aF8oMCksCiAgICAgICAgcGJ1ZmZlckhlaWdodF8oMCksCiAgICAgICAgcGJ1ZmZlclBpeGVsc18oMCksCi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