1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 04:45:33 +00:00
mpv/misc/codepoint_width.c
Kacper Michajłow 0c4c2caabf misc/codepoint_width: assume tabstop width to be 8
It has been hardcoded to the same value in stats.lua so keep the current
behaviour. Can be made configurable if requested in the future.
2024-10-21 20:06:48 +02:00

762 lines
48 KiB
C

#include "codepoint_width.h"
#include <stdbool.h>
#include <stdint.h>
typedef uint_least32_t char32_t;
// Generated by GraphemeTableGen (https://github.com/microsoft/terminal/blob/a7e47b711a2adc7b9e80eddea8168089f7d3b11e/src/tools/GraphemeTableGen/Program.cs)
// on 2024-09-21T14:12:16Z, from Unicode 16.0.0, 9285 bytes
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Manually adjusted for C compatibility
// To generate:
// 0. Install .NET 8.0
// 1. Download the tool from: https://github.com/microsoft/terminal/tree/main/src/tools/GraphemeTableGen
// 2. Download the Unicode data from: https://www.unicode.org/Public/UCD/latest/ucdxml/ucd.nounihan.grouped.zip
// 3. Build the project: `dotnet build GraphemeTableGen.csproj`
// 4. Run the tool: `./GraphemeTableGen ucd.nounihan.grouped.xml`
// 5. Copy the generated code and adjust it for C compatibility by replacing `constexpr` and `auto` keywords.
// clang-format off
static const uint16_t s_stage0[] = {
0x0000, 0x0020, 0x0040, 0x0060, 0x0080, 0x009f, 0x00bf, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca,
0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00d8, 0x00f8, 0x010a, 0x010e, 0x010b, 0x0108, 0x0113, 0x0133, 0x0153, 0x0153, 0x0153, 0x016f,
0x018f, 0x01a7, 0x01c7, 0x01e7, 0x0133, 0x0133, 0x0205, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0221, 0x0236, 0x00ca, 0x00ca,
0x0256, 0x0276, 0x0133, 0x0133, 0x0133, 0x028b, 0x02ab, 0x02b9, 0x0133, 0x02cc, 0x02ea, 0x0302, 0x0322, 0x033f, 0x035f, 0x037f,
0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca,
0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x039f,
0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca,
0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x039f,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x03bf, 0x03c7, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133, 0x0133,
0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153,
0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x03e7,
0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153,
0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x0153, 0x03e7,
};
static const uint16_t s_stage1[] = {
0x0000, 0x0004, 0x000c, 0x0014, 0x001c, 0x0024, 0x002a, 0x0031, 0x002a, 0x0037, 0x002a, 0x003f, 0x0047, 0x0049, 0x004f, 0x0057, 0x005f, 0x0065, 0x006d, 0x002a, 0x002a, 0x002a, 0x0073, 0x007b, 0x0083, 0x008a, 0x002a, 0x0091, 0x0098, 0x009f, 0x00a3, 0x00aa,
0x00b2, 0x00b8, 0x00be, 0x00c5, 0x00cd, 0x00d5, 0x00dd, 0x00e5, 0x00ed, 0x00f5, 0x00fd, 0x0105, 0x010d, 0x0115, 0x011d, 0x0125, 0x012d, 0x0135, 0x013d, 0x0145, 0x014d, 0x0155, 0x015d, 0x0164, 0x016b, 0x0173, 0x0175, 0x017d, 0x0182, 0x018a, 0x0192, 0x019a,
0x019d, 0x01a5, 0x01ad, 0x002a, 0x01b5, 0x01b9, 0x01bd, 0x01c2, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x01ca, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x01d0, 0x01d7, 0x01de, 0x01e6,
0x01ed, 0x002a, 0x01f5, 0x002a, 0x01fb, 0x002a, 0x002a, 0x002a, 0x0203, 0x0209, 0x0211, 0x0218, 0x0220, 0x0228, 0x0230, 0x0236, 0x023d, 0x002a, 0x002a, 0x0244, 0x002a, 0x002a, 0x002a, 0x0047, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
0x024c, 0x0254, 0x025c, 0x0262, 0x026a, 0x0272, 0x027a, 0x0282, 0x028a, 0x0292, 0x029a, 0x002a, 0x02a2, 0x002a, 0x02a9, 0x02b0, 0x002a, 0x02b8, 0x02bc, 0x02c4, 0x002a, 0x002a, 0x02cc, 0x02d4, 0x02dc, 0x02e4, 0x02ec, 0x02f4, 0x02fc, 0x0304, 0x030c, 0x002a,
0x002a, 0x002a, 0x002a, 0x0314, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x031c, 0x0322, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0326, 0x002a, 0x032d, 0x002a, 0x0043, 0x002a, 0x002a, 0x0335, 0x0339, 0x0341, 0x0341, 0x0341, 0x0347, 0x034d,
0x0355, 0x035b, 0x0341, 0x0363, 0x0341, 0x036a, 0x036e, 0x0374, 0x037b, 0x0381, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341,
0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0388, 0x0390, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0393, 0x039b, 0x017f, 0x002a, 0x002a, 0x002a, 0x002a, 0x03a3, 0x002a, 0x03ab, 0x03b3, 0x03bb, 0x03c3, 0x03cb, 0x03d3,
0x03d8, 0x03e0, 0x03e8, 0x03f0, 0x002a, 0x002a, 0x002a, 0x03f7, 0x03ff, 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x03ff, 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x03ff, 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x03ff, 0x0400, 0x0401,
0x0402, 0x0403, 0x0404, 0x0405, 0x03ff, 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x03ff, 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x040c, 0x0414, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc,
0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x041c, 0x002a, 0x002a, 0x002a, 0x002a,
0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0424, 0x042a, 0x002a, 0x0430, 0x0355, 0x0438, 0x043d, 0x0441, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0449, 0x002a, 0x002a, 0x002a, 0x0451, 0x002a, 0x0456, 0x002a, 0x002a, 0x002a,
0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x045e, 0x002a, 0x002a, 0x01f1, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0466, 0x046b, 0x002a, 0x002a, 0x002a,
0x002a, 0x0471, 0x0477, 0x002a, 0x00a7, 0x047f, 0x002a, 0x0487, 0x048f, 0x0497, 0x049f, 0x04a7, 0x04af, 0x04b7, 0x04bf, 0x04c2, 0x04ca, 0x002a, 0x04cf, 0x04d7, 0x04df, 0x04e6, 0x04ee, 0x04f3, 0x04fb, 0x04ff, 0x0507, 0x002a, 0x002a, 0x050a, 0x0512, 0x0516,
0x051e, 0x0521, 0x002a, 0x0528, 0x002a, 0x002a, 0x002a, 0x052e, 0x002a, 0x002a, 0x002a, 0x0536, 0x053e, 0x002a, 0x0544, 0x054c, 0x0554, 0x055c, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0560, 0x002a, 0x0568, 0x002a, 0x056f, 0x0577, 0x057e, 0x002a, 0x002a,
0x002a, 0x002a, 0x0581, 0x0589, 0x0591, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0595, 0x059d, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x05a2, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
0x002a, 0x05a8, 0x05af, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x05b6, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x05bd, 0x05c4, 0x05c8, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341,
0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x05d0, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341,
0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x05d8, 0x05e0, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x05e2, 0x0341, 0x0341, 0x0341, 0x0341, 0x05ea, 0x05f1, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x05f7, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x05ff, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0607, 0x060f, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0613, 0x061b, 0x002a, 0x002a, 0x0623, 0x002a, 0x002a, 0x0341, 0x062b, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0633, 0x063b, 0x0643, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
0x002a, 0x002a, 0x064b, 0x002a, 0x0652, 0x002a, 0x05af, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0655, 0x065b, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x065b, 0x002a, 0x002a, 0x002a, 0x0661, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
0x002a, 0x002a, 0x0667, 0x002a, 0x066f, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x0677,
0x0678, 0x0678, 0x067f, 0x0687, 0x068d, 0x0695, 0x069b, 0x06a3, 0x06ab, 0x0678, 0x0678, 0x06b3, 0x06ba, 0x06c2, 0x06c9, 0x06d1, 0x06d9, 0x06da, 0x06db, 0x06e3, 0x06eb, 0x06f3, 0x06f8, 0x06da, 0x0700, 0x06da, 0x0708, 0x002a, 0x0710, 0x002a, 0x0718, 0x0720,
0x0727, 0x072e, 0x0678, 0x0736, 0x073e, 0x06da, 0x06da, 0x0678, 0x0746, 0x074e, 0x0756, 0x002a, 0x002a, 0x002a, 0x002a, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x0678, 0x075e, 0x0341,
0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0341, 0x0342, 0x0766,
0x0047, 0x076e, 0x076e, 0x0047, 0x0047, 0x0047, 0x0776, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e,
0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x076e, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc,
0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x02bc, 0x077e,
};
static const uint16_t s_stage2[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0009, 0x0000, 0x0000, 0x0000, 0x0000,
0x0011, 0x0018, 0x0020, 0x0022, 0x002a, 0x0008, 0x0029, 0x0030,
0x0036, 0x003e, 0x0040, 0x0047, 0x004c, 0x0008, 0x004a, 0x002d,
0x004e, 0x002d, 0x0053, 0x0029, 0x005b, 0x0063, 0x0034, 0x0008,
0x004e, 0x002d, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x002a, 0x006b, 0x0049, 0x0008, 0x0008, 0x0008,
0x0008, 0x004c, 0x0008, 0x004c, 0x0008, 0x0008, 0x0008, 0x0072,
0x005a, 0x0079, 0x0081, 0x0008, 0x0008, 0x0008, 0x0008, 0x0089,
0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0008,
0x0008, 0x0091, 0x0092, 0x0098, 0x0028, 0x0091, 0x0092, 0x0098,
0x0028, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x004c,
0x0008, 0x0092, 0x0092, 0x0092, 0x0092, 0x0092, 0x0092, 0x004c,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00a0, 0x00a6, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00ad, 0x0089, 0x0089,
0x0089, 0x0089, 0x00af, 0x00b5, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x00bd, 0x0008, 0x0089, 0x00c5, 0x0008,
0x0008, 0x0008, 0x0008, 0x00a0, 0x0089, 0x0089, 0x0008, 0x0008,
0x00cd, 0x0008, 0x0008, 0x00a8, 0x00d5, 0x00dc, 0x00e3, 0x0008,
0x0008, 0x00e9, 0x00cc, 0x0008, 0x0008, 0x0008, 0x0089, 0x0089,
0x00a5, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00a8,
0x0089, 0x00cd, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00a0,
0x00a4, 0x00f1, 0x0008, 0x0008, 0x00a8, 0x00f9, 0x00fd, 0x00a2,
0x0008, 0x0008, 0x0008, 0x0101, 0x0008, 0x0008, 0x0008, 0x0008,
0x0109, 0x0089, 0x0008, 0x0008, 0x0008, 0x0008, 0x00ac, 0x0089,
0x0089, 0x0110, 0x0089, 0x0089, 0x0089, 0x0115, 0x0008, 0x0119,
0x011e, 0x011e, 0x011e, 0x011e, 0x0124, 0x012b, 0x0132, 0x00ad,
0x011e, 0x013a, 0x0008, 0x0008, 0x011e, 0x0141, 0x0008, 0x0119,
0x011e, 0x011e, 0x0149, 0x0150, 0x0156, 0x015d, 0x0164, 0x016a,
0x0172, 0x013a, 0x0008, 0x0179, 0x017b, 0x0182, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0186, 0x018d, 0x0194, 0x00cc,
0x0008, 0x0008, 0x0008, 0x0198, 0x0008, 0x0182, 0x0008, 0x0119,
0x011e, 0x011e, 0x0149, 0x01a0, 0x0156, 0x01a8, 0x01af, 0x0008,
0x0008, 0x013a, 0x0008, 0x0008, 0x01b6, 0x0141, 0x0008, 0x0119,
0x011e, 0x011e, 0x0149, 0x01a0, 0x01be, 0x015d, 0x0164, 0x01c6,
0x0172, 0x013a, 0x0008, 0x01ce, 0x0008, 0x00cb, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x01d0, 0x01d8, 0x01df, 0x016a,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x01e7, 0x0008, 0x0119,
0x011e, 0x011e, 0x0149, 0x011e, 0x01ef, 0x01f6, 0x01fd, 0x0203,
0x020b, 0x013a, 0x0008, 0x0008, 0x0008, 0x0141, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x020f, 0x0217, 0x021e, 0x0224,
0x0008, 0x013a, 0x0008, 0x016e, 0x0008, 0x022c, 0x0008, 0x0119,
0x011e, 0x011e, 0x011e, 0x011e, 0x0234, 0x023b, 0x0242, 0x016a,
0x0008, 0x013a, 0x0008, 0x0008, 0x0008, 0x0141, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0249, 0x0250, 0x0258,
0x0008, 0x0008, 0x0260, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x0267, 0x00a5, 0x00ce, 0x008a, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0267, 0x00a3, 0x0008, 0x008a, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00a6, 0x0008, 0x0008,
0x017c, 0x024a, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x00ad, 0x012c, 0x00b0, 0x00a9, 0x0089, 0x00ad, 0x0089, 0x0089,
0x0089, 0x00a3, 0x017b, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x00a9, 0x026e, 0x0276, 0x0008, 0x0008, 0x01d0,
0x027b, 0x00cd, 0x0008, 0x00e4, 0x0008, 0x0283, 0x00f1, 0x0008,
0x00f1, 0x0008, 0x0008, 0x0008, 0x0008, 0x028b, 0x028b, 0x028b,
0x028b, 0x028b, 0x028b, 0x028b, 0x028b, 0x0293, 0x0293, 0x0293,
0x0293, 0x0293, 0x029b, 0x029b, 0x029b, 0x029b, 0x029b, 0x029b,
0x029b, 0x029b, 0x0008, 0x0008, 0x0008, 0x00a9, 0x0008, 0x0008,
0x0008, 0x0008, 0x02a3, 0x0008, 0x0008, 0x0008, 0x02a9, 0x0008,
0x0008, 0x013a, 0x0008, 0x0008, 0x0008, 0x013a, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x02ae, 0x012d, 0x02b6, 0x012b,
0x00a4, 0x00f1, 0x0008, 0x0008, 0x0008, 0x0008, 0x02be, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0203, 0x0008, 0x0008,
0x0008, 0x0008, 0x00cc, 0x0008, 0x0008, 0x0008, 0x0008, 0x02c5,
0x02cc, 0x02d4, 0x02db, 0x0008, 0x0008, 0x00ce, 0x02e3, 0x0008,
0x0008, 0x0008, 0x0008, 0x02e7, 0x008a, 0x02ef, 0x012e, 0x02f7,
0x00dc, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0089,
0x0089, 0x008a, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x0114, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x02ff, 0x0305,
0x01d6, 0x0008, 0x0008, 0x0008, 0x0008, 0x00a0, 0x00a4, 0x0008,
0x0116, 0x0008, 0x0008, 0x0008, 0x030d, 0x0315, 0x0008, 0x0008,
0x0008, 0x0008, 0x031b, 0x0323, 0x022c, 0x0008, 0x0008, 0x0008,
0x0008, 0x032b, 0x032f, 0x030f, 0x0008, 0x0008, 0x0334, 0x0089,
0x026e, 0x018f, 0x033c, 0x00a6, 0x0008, 0x0344, 0x034c, 0x0351,
0x0022, 0x0359, 0x0361, 0x0367, 0x0008, 0x036e, 0x0008, 0x0008,
0x0376, 0x037c, 0x002c, 0x007a, 0x0025, 0x0008, 0x0008, 0x0008,
0x0008, 0x002c, 0x0008, 0x0008, 0x0089, 0x0089, 0x0089, 0x0089,
0x00cd, 0x0008, 0x0384, 0x004c, 0x0073, 0x0008, 0x038b, 0x002d,
0x0008, 0x036e, 0x0008, 0x0008, 0x0033, 0x0060, 0x0092, 0x0026,
0x0092, 0x0028, 0x0008, 0x004c, 0x0393, 0x0399, 0x0008, 0x03a0,
0x0008, 0x0028, 0x0008, 0x0008, 0x03a6, 0x0008, 0x007a, 0x0008,
0x0008, 0x0008, 0x0040, 0x03ae, 0x03a9, 0x03b3, 0x0068, 0x03b8,
0x007d, 0x0032, 0x0008, 0x03be, 0x002e, 0x0008, 0x03c6, 0x03c4,
0x0008, 0x0008, 0x03c4, 0x0008, 0x002b, 0x004c, 0x002b, 0x0008,
0x0008, 0x007a, 0x0008, 0x0008, 0x002e, 0x03ce, 0x0008, 0x03d6,
0x0008, 0x0008, 0x03de, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x03df, 0x0008, 0x0008, 0x0008, 0x03e7, 0x03ef, 0x03f7,
0x0008, 0x0008, 0x0008, 0x0008, 0x0092, 0x0092, 0x0092, 0x0092,
0x0092, 0x0092, 0x0092, 0x0092, 0x03ff, 0x0092, 0x0092, 0x0092,
0x0092, 0x0098, 0x0092, 0x0092, 0x0008, 0x0008, 0x0008, 0x0008,
0x0098, 0x0405, 0x040b, 0x0032, 0x0411, 0x0418, 0x0028, 0x0008,
0x034d, 0x007a, 0x0008, 0x0420, 0x0428, 0x042f, 0x0437, 0x043d,
0x0444, 0x0444, 0x044c, 0x0444, 0x0441, 0x044c, 0x0450, 0x0444,
0x0458, 0x045b, 0x0444, 0x0445, 0x0463, 0x0469, 0x0471, 0x0475,
0x0473, 0x047d, 0x0444, 0x0481, 0x0482, 0x0488, 0x048a, 0x048f,
0x045f, 0x048c, 0x0495, 0x049b, 0x04a3, 0x047d, 0x04ab, 0x03d9,
0x036e, 0x04b3, 0x039e, 0x002b, 0x04b7, 0x04bf, 0x04c6, 0x0008,
0x04ce, 0x0008, 0x004e, 0x0092, 0x0008, 0x0008, 0x04d6, 0x0008,
0x036e, 0x0008, 0x04b3, 0x04de, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x039d, 0x0008, 0x04e6, 0x0008, 0x0008, 0x04ee,
0x0008, 0x0008, 0x0008, 0x0008, 0x04f2, 0x0028, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x00ce, 0x00a6, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x00ce, 0x04fa, 0x04fa, 0x04fa,
0x0500, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x0504,
0x0008, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa,
0x04fa, 0x050c, 0x0008, 0x0008, 0x0008, 0x04fa, 0x04fa, 0x04fa,
0x04fa, 0x04fa, 0x0514, 0x051c, 0x051f, 0x0526, 0x04fa, 0x04fa,
0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fb, 0x052e, 0x04fa,
0x04fa, 0x04fa, 0x04fa, 0x0536, 0x04fa, 0x04fa, 0x04fa, 0x04fa,
0x04fa, 0x0526, 0x04fa, 0x04fb, 0x04fa, 0x04fa, 0x04fa, 0x04fa,
0x04fa, 0x04fa, 0x050c, 0x053e, 0x04fa, 0x04fa, 0x04fa, 0x04fb,
0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x0092, 0x04fa, 0x04fa, 0x04fa,
0x04fa, 0x04fa, 0x04fa, 0x051d, 0x0545, 0x04fa, 0x04fa, 0x04fa,
0x04fa, 0x0503, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa,
0x04fb, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x00ce, 0x0334, 0x054d, 0x0008, 0x0008, 0x0008, 0x00a8, 0x0008,
0x0008, 0x0008, 0x0008, 0x0553, 0x00ca, 0x0008, 0x0008, 0x055a,
0x0562, 0x0008, 0x0008, 0x056a, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x032b, 0x0258, 0x0572, 0x0008, 0x0008, 0x0008, 0x0089,
0x0089, 0x00a6, 0x00ce, 0x0008, 0x0008, 0x0008, 0x0008, 0x00a8,
0x054d, 0x0008, 0x0008, 0x00ce, 0x0089, 0x022c, 0x0008, 0x028b,
0x028b, 0x028b, 0x057a, 0x0115, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x057f, 0x0585, 0x058c, 0x0008, 0x0008, 0x0008, 0x00f1,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0593, 0x059a, 0x0008,
0x00ca, 0x05a1, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0562,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x05a9, 0x01c5,
0x00cc, 0x0008, 0x0008, 0x0008, 0x0008, 0x05b1, 0x05b9, 0x0008,
0x0008, 0x0008, 0x0008, 0x01d3, 0x05c1, 0x0008, 0x0008, 0x05c9,
0x05ca, 0x05ca, 0x05ce, 0x05ca, 0x05ca, 0x05ca, 0x05c9, 0x05ca,
0x05ca, 0x05ce, 0x05ca, 0x05ca, 0x05ca, 0x05c9, 0x05ca, 0x05ca,
0x05d3, 0x0008, 0x0293, 0x0293, 0x05db, 0x05e2, 0x029b, 0x029b,
0x029b, 0x029b, 0x029b, 0x05e6, 0x0008, 0x0008, 0x0008, 0x017b,
0x0008, 0x0008, 0x0008, 0x0008, 0x0089, 0x0089, 0x04fa, 0x053c,
0x0089, 0x0089, 0x04fa, 0x04fa, 0x04ff, 0x04fa, 0x04fb, 0x0504,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x05ea,
0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x053d, 0x0008, 0x0008, 0x0008,
0x01d0, 0x0008, 0x0008, 0x0008, 0x0008, 0x04fb, 0x0008, 0x0000,
0x05f2, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x00f1, 0x0008, 0x0008, 0x0008, 0x0008, 0x00cd, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x00a8, 0x00a5, 0x05f9, 0x00aa,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x02dc, 0x0008, 0x0008,
0x0008, 0x0008, 0x00aa, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x00a2, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0600, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00aa, 0x0606,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x060e,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0089, 0x008a,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0616, 0x00ce, 0x0116,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x061e, 0x0625, 0x00cb,
0x00eb, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00a5,
0x0008, 0x0008, 0x0008, 0x00ce, 0x026b, 0x00a3, 0x0008, 0x0224,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00ca, 0x0008, 0x0116,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x061b, 0x012c, 0x062d,
0x0634, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x063c,
0x0643, 0x017b, 0x00cc, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x00ce, 0x02f7, 0x00a5, 0x0008, 0x0008, 0x022c,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x064b, 0x0653,
0x0657, 0x016a, 0x0008, 0x065d, 0x00a3, 0x00a3, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x02f7, 0x0664, 0x066b,
0x0673, 0x0008, 0x067a, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x056d, 0x0089, 0x0682, 0x0008, 0x0008, 0x017b, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x02f7, 0x068a, 0x0691,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x016a,
0x015c, 0x0699, 0x00cd, 0x0008, 0x0008, 0x027d, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x02f7, 0x06a0, 0x00cd, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x06a8, 0x0594,
0x0008, 0x0008, 0x0008, 0x031c, 0x06b0, 0x00a4, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x063c, 0x0089, 0x0221, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x06b8, 0x06bf, 0x06c7, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x061d, 0x06cd,
0x06d5, 0x0008, 0x0008, 0x0008, 0x00ad, 0x00a5, 0x0008, 0x0008,
0x0008, 0x0008, 0x00a0, 0x06dd, 0x00ce, 0x0008, 0x0593, 0x02db,
0x0008, 0x0008, 0x0008, 0x0008, 0x06e4, 0x06ea, 0x012c, 0x00a6,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x016a, 0x008a, 0x0594,
0x0008, 0x0008, 0x00ac, 0x0089, 0x0089, 0x06f2, 0x06f9, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0700, 0x0707, 0x070e,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0716,
0x071e, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0726,
0x0008, 0x072e, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x024c,
0x0736, 0x073e, 0x0008, 0x0008, 0x00cb, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x037c, 0x037c, 0x00a7, 0x0089, 0x054d,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00a8, 0x0089, 0x02f5,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00a3, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x008a, 0x0008, 0x0008,
0x0008, 0x0008, 0x0743, 0x074a, 0x0008, 0x0008, 0x00ce, 0x0257,
0x0258, 0x0258, 0x0258, 0x0258, 0x0258, 0x00ce, 0x00a5, 0x0008,
0x0008, 0x0008, 0x0008, 0x0008, 0x0752, 0x0008, 0x075a, 0x0008,
0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x0008,
0x04fa, 0x04fa, 0x050c, 0x0008, 0x0008, 0x0008, 0x0008, 0x053e,
0x04fa, 0x053d, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x04fe, 0x0762, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x0533, 0x0008,
0x0769, 0x0008, 0x0008, 0x0771, 0x0008, 0x0508, 0x0008, 0x04fa,
0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x04fa, 0x0504, 0x0008,
0x0008, 0x0008, 0x0203, 0x0779, 0x0008, 0x0008, 0x0008, 0x0089,
0x0089, 0x0089, 0x0089, 0x0089, 0x054d, 0x0089, 0x0089, 0x008a,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x01d1,
0x0619, 0x0781, 0x0786, 0x078b, 0x00a4, 0x0008, 0x0008, 0x0008,
0x0606, 0x0008, 0x0008, 0x0195, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x0008, 0x04fa, 0x04fa, 0x04fb, 0x0008, 0x04fa,
0x04fa, 0x04fb, 0x0008, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089,
0x0089, 0x008a, 0x00a0, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089,
0x00a3, 0x00f1, 0x0008, 0x0562, 0x0008, 0x0008, 0x00a0, 0x00ad,
0x0089, 0x0008, 0x0008, 0x008a, 0x0089, 0x0089, 0x078d, 0x00b3,
0x00a5, 0x0008, 0x0008, 0x00ce, 0x0008, 0x0008, 0x0008, 0x0008,
0x0008, 0x0008, 0x017b, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x00aa, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00a8, 0x0008,
0x0008, 0x008a, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x00aa,
0x00a5, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0795,
0x0444, 0x0444, 0x0444, 0x0444, 0x0444, 0x0444, 0x0444, 0x0444,
0x0445, 0x0444, 0x0444, 0x0444, 0x0444, 0x0444, 0x0444, 0x0092,
0x079d, 0x0092, 0x0092, 0x0092, 0x07a5, 0x0092, 0x0092, 0x0092,
0x0092, 0x0092, 0x07ad, 0x07b5, 0x07b7, 0x0092, 0x07bf, 0x07c6,
0x07cb, 0x0092, 0x07ce, 0x0444, 0x0444, 0x0444, 0x0444, 0x07d3,
0x07d9, 0x07d9, 0x07d9, 0x07e1, 0x0444, 0x04fa, 0x07e9, 0x04fa,
0x051d, 0x07ef, 0x07f4, 0x04fa, 0x07f7, 0x07ff, 0x0444, 0x044e,
0x0444, 0x0444, 0x0444, 0x044c, 0x044c, 0x044c, 0x044c, 0x0800,
0x0447, 0x0808, 0x044c, 0x044c, 0x044c, 0x044c, 0x044c, 0x044c,
0x044c, 0x0809, 0x044c, 0x044c, 0x0450, 0x0444, 0x044c, 0x044c,
0x044c, 0x044c, 0x080f, 0x0450, 0x0444, 0x044c, 0x044c, 0x0816,
0x081e, 0x044c, 0x044c, 0x044c, 0x044c, 0x044c, 0x044c, 0x044c,
0x044d, 0x0826, 0x044c, 0x044c, 0x044c, 0x044c, 0x044c, 0x044c,
0x044c, 0x044c, 0x0829, 0x044c, 0x044c, 0x044c, 0x044c, 0x044c,
0x044c, 0x044c, 0x0830, 0x039b, 0x0838, 0x044c, 0x044c, 0x044c,
0x0444, 0x0444, 0x0472, 0x0444, 0x0444, 0x07fa, 0x0444, 0x0795,
0x0444, 0x0444, 0x0444, 0x0444, 0x0444, 0x0444, 0x0444, 0x0449,
0x044c, 0x044c, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x044e, 0x0795, 0x082b, 0x0448, 0x0444, 0x07fc, 0x0448, 0x044f,
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0840, 0x0444,
0x0008, 0x0008, 0x04e6, 0x0444, 0x044c, 0x0450, 0x0800, 0x0444,
0x0008, 0x0840, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
0x0444, 0x0008, 0x0842, 0x0008, 0x0008, 0x0008, 0x0008, 0x0444,
0x0008, 0x0008, 0x0008, 0x039b, 0x0444, 0x0444, 0x0008, 0x084a,
0x044c, 0x044c, 0x044c, 0x044c, 0x044c, 0x084f, 0x0853, 0x044c,
0x044c, 0x044c, 0x044c, 0x044c, 0x044c, 0x044c, 0x0444, 0x0444,
0x0444, 0x0444, 0x0444, 0x0444, 0x044c, 0x044f, 0x044c, 0x047f,
0x044c, 0x044c, 0x044c, 0x044c, 0x044c, 0x044c, 0x044d, 0x0446,
0x044c, 0x0829, 0x044c, 0x07ff, 0x044c, 0x0800, 0x0444, 0x0444,
0x0444, 0x0444, 0x0444, 0x0444, 0x0444, 0x0463, 0x085b, 0x0000,
0x0000, 0x0000, 0x0089, 0x0089, 0x0089, 0x0089, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0089, 0x0089,
0x0089, 0x0089, 0x0089, 0x0089, 0x0000, 0x0000, 0x0092, 0x0092,
0x0092, 0x0092, 0x0092, 0x0092, 0x0092, 0x0863,
};
static const uint8_t s_stage3[] = {
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x41, 0x40, 0xc0, 0x40, 0x40, 0xc0, 0x40, 0x40,
0xc0, 0x4c, 0xc0, 0x40, 0x40, 0x01, 0xcc, 0x40,
0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x40, 0xc0, 0xc0,
0xc0, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0xc0,
0x40, 0x40, 0x40, 0x40, 0xc0, 0x40, 0xc0, 0xc0,
0xc0, 0x40, 0xc0, 0xc0, 0x40, 0x40, 0x40, 0xc0,
0xc0, 0xc0, 0x40, 0xc0, 0x40, 0xc0, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0xc0, 0xc0, 0xc0, 0x40,
0x40, 0x40, 0x40, 0xc0, 0xc0, 0xc0, 0x40, 0xc0,
0x40, 0x40, 0x40, 0xc0, 0xc0, 0xc0, 0xc0, 0x40,
0xc0, 0x40, 0x40, 0xc0, 0x40, 0xc0, 0x40, 0xc0,
0x40, 0xc0, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x40,
0x40, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0xc0, 0xc0, 0xc0, 0xc0, 0x40, 0xc0, 0x40,
0xc0, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x40, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
0xc0, 0xc0, 0x40, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
0x40, 0x40, 0x40, 0x02, 0x02, 0x02, 0x02, 0x02,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x40, 0x02, 0x02,
0x40, 0x02, 0x02, 0x40, 0x02, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x40, 0x40, 0x02, 0x02, 0x02,
0x40, 0x01, 0x40, 0x40, 0x40, 0x02, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0x40, 0x02, 0x02, 0x02,
0x02, 0x02, 0x04, 0x40, 0x02, 0x02, 0x02, 0x02,
0x02, 0x40, 0x40, 0x02, 0x40, 0x02, 0x02, 0x02,
0x02, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x04, 0x40, 0x40, 0x40, 0x40, 0x40, 0x02, 0x40,
0x40, 0x02, 0x02, 0x40, 0x02, 0x02, 0x02, 0x02,
0x02, 0x40, 0x02, 0x02, 0x02, 0x40, 0x40, 0x40,
0x40, 0x04, 0x04, 0x40, 0x40, 0x40, 0x40, 0x40,
0x02, 0x02, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02,
0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4b, 0x4b,
0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x02, 0x42,
0x02, 0x40, 0x42, 0x42, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x42, 0x42, 0x42, 0x42, 0x0a,
0x42, 0x42, 0x40, 0x40, 0x02, 0x02, 0x40, 0x40,
0x40, 0x40, 0x02, 0x42, 0x42, 0x40, 0x40, 0x40,
0x40, 0x4b, 0x40, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b,
0x4b, 0x40, 0x4b, 0x40, 0x40, 0x40, 0x4b, 0x4b,
0x40, 0x40, 0x02, 0x40, 0x42, 0x42, 0x02, 0x02,
0x02, 0x02, 0x40, 0x40, 0x42, 0x40, 0x40, 0x42,
0x42, 0x0a, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x42, 0x40, 0x40, 0x40, 0x40, 0x4b, 0x4b,
0x40, 0x4b, 0x4b, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x02, 0x40, 0x02, 0x02, 0x42, 0x40, 0x40,
0x40, 0x40, 0x02, 0x40, 0x42, 0x42, 0x02, 0x02,
0x40, 0x40, 0x40, 0x40, 0x02, 0x40, 0x40, 0x02,
0x02, 0x02, 0x40, 0x40, 0x40, 0x02, 0x40, 0x40,
0x4b, 0x40, 0x4b, 0x4b, 0x40, 0x4b, 0x4b, 0x4b,
0x42, 0x02, 0x02, 0x02, 0x02, 0x02, 0x40, 0x02,
0x42, 0x40, 0x42, 0x42, 0x0a, 0x40, 0x40, 0x4b,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x4b, 0x4b,
0x40, 0x40, 0x02, 0x40, 0x42, 0x02, 0x40, 0x40,
0x40, 0x40, 0x40, 0x02, 0x02, 0x42, 0x40, 0x4b,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42,
0x02, 0x42, 0x42, 0x40, 0x40, 0x40, 0x42, 0x42,
0x40, 0x42, 0x42, 0x42, 0x02, 0x40, 0x40, 0x02,
0x42, 0x42, 0x42, 0x02, 0x40, 0x40, 0x40, 0x4b,
0x4b, 0x40, 0x40, 0x02, 0x40, 0x02, 0x02, 0x42,
0x42, 0x42, 0x42, 0x40, 0x02, 0x02, 0x40, 0x02,
0x02, 0x02, 0x0a, 0x40, 0x40, 0x40, 0x40, 0x40,
0x02, 0x02, 0x40, 0x4b, 0x4b, 0x4b, 0x40, 0x40,
0x40, 0x40, 0x40, 0x02, 0x40, 0x42, 0x02, 0x42,
0x42, 0x42, 0x42, 0x42, 0x40, 0x02, 0x42, 0x40,
0x42, 0x42, 0x02, 0x02, 0x40, 0x40, 0x40, 0x40,
0x40, 0x42, 0x42, 0x40, 0x02, 0x02, 0x42, 0x42,
0x40, 0x40, 0x40, 0x40, 0x4b, 0x4b, 0x4b, 0x02,
0x02, 0x40, 0x42, 0x42, 0x02, 0x02, 0x02, 0x02,
0x40, 0x42, 0x42, 0x40, 0x42, 0x42, 0x42, 0x0a,
0x44, 0x40, 0x40, 0x02, 0x40, 0x40, 0x40, 0x40,
0x42, 0x42, 0x02, 0x02, 0x02, 0x40, 0x02, 0x40,
0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
0x40, 0x40, 0x42, 0x42, 0x40, 0x40, 0x40, 0x40,
0x02, 0x40, 0x42, 0x02, 0x02, 0x02, 0x02, 0x42,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x40, 0x02,
0x02, 0x42, 0x42, 0x02, 0x02, 0x40, 0x40, 0x40,
0x40, 0x02, 0x02, 0x40, 0x40, 0x02, 0x40, 0x42,
0x02, 0x02, 0x40, 0x85, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x46, 0x46, 0x46, 0x46, 0x46,
0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47,
0x47, 0x47, 0x47, 0x40, 0x40, 0x02, 0x02, 0x02,
0x42, 0x40, 0x40, 0x02, 0x02, 0x42, 0x40, 0x40,
0x40, 0x40, 0x02, 0x02, 0x42, 0x02, 0x42, 0x42,
0x42, 0x42, 0x42, 0x42, 0x02, 0x42, 0x40, 0x40,
0x40, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02,
0x42, 0x42, 0x42, 0x42, 0x02, 0x42, 0x42, 0x42,
0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x02, 0x42,
0x42, 0x42, 0x42, 0x42, 0x02, 0x02, 0x02, 0x40,
0x40, 0x40, 0x40, 0x02, 0x42, 0x42, 0x02, 0x40,
0x40, 0x40, 0x40, 0x40, 0x42, 0x02, 0x42, 0x02,
0x40, 0x02, 0x40, 0x40, 0x02, 0x02, 0x02, 0x42,
0x42, 0x42, 0x02, 0x02, 0x02, 0x02, 0x02, 0x40,
0x40, 0x40, 0x40, 0x02, 0x42, 0x02, 0x02, 0x02,
0x42, 0x02, 0x42, 0x42, 0x42, 0x40, 0x42, 0x02,
0x02, 0x02, 0x02, 0x42, 0x42, 0x02, 0x02, 0x42,
0x02, 0x02, 0x02, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x02, 0x42, 0x02, 0x02, 0x42, 0x42, 0x42,
0x02, 0x42, 0x02, 0x40, 0x40, 0x40, 0x40, 0x42,
0x42, 0x42, 0x42, 0x02, 0x02, 0x02, 0x02, 0x40,
0x02, 0x02, 0x02, 0x02, 0x40, 0x40, 0x40, 0x40,
0x02, 0x40, 0x40, 0x42, 0x40, 0x40, 0x40, 0x01,
0x02, 0x0d, 0x01, 0x01, 0xc0, 0x40, 0x40, 0xc0,
0xc0, 0xc0, 0xc0, 0x40, 0x40, 0xc0, 0xc0, 0x40,
0x40, 0x41, 0x41, 0x01, 0x01, 0x01, 0x01, 0x01,
0x40, 0xc0, 0x40, 0xc0, 0xc0, 0x40, 0xc0, 0x40,
0x40, 0x40, 0xc0, 0x4c, 0x40, 0xc0, 0x40, 0x4c,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x01, 0x01,
0x01, 0x01, 0x01, 0x41, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x40, 0x40, 0x40, 0xc0,
0x40, 0xc0, 0x40, 0x40, 0xc0, 0xcc, 0x40, 0x40,
0x40, 0xc0, 0x40, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc,
0xcc, 0xcc, 0xcc, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x4c, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40,
0xc0, 0x40, 0xc0, 0x40, 0x40, 0x40, 0xc0, 0x40,
0x40, 0xc0, 0x40, 0x40, 0x40, 0xc0, 0x40, 0x40,
0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x40, 0xc0, 0x40,
0x40, 0x40, 0xc0, 0x40, 0x40, 0x40, 0xc0, 0xc0,
0x40, 0x40, 0xc0, 0xc0, 0xc0, 0xc0, 0x40, 0x40,
0x8c, 0x8c, 0x40, 0x40, 0x40, 0x40, 0x4c, 0x80,
0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4c, 0x40,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4c, 0x40,
0x8c, 0x8c, 0x8c, 0x8c, 0x4c, 0x4c, 0x4c, 0x8c,
0x4c, 0x4c, 0x8c, 0x40, 0x40, 0x40, 0x40, 0x4c,
0x4c, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0,
0xc0, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x4c,
0x4c, 0x40, 0x40, 0x40, 0x40, 0xc0, 0xc0, 0x40,
0x40, 0xcc, 0xc0, 0x40, 0x40, 0x40, 0x40, 0xc0,
0xc0, 0x40, 0x40, 0xc0, 0x40, 0x40, 0xc0, 0xc0,
0x40, 0x40, 0x40, 0x4c, 0x4c, 0x8c, 0x8c, 0x40,
0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0xcc, 0xc0, 0x4c,
0xcc, 0x4c, 0x4c, 0x4c, 0x4c, 0xcc, 0xcc, 0x4c,
0x4c, 0x4c, 0x40, 0x8c, 0x8c, 0x4c, 0x4c, 0x4c,
0x4c, 0xcc, 0x4c, 0xcc, 0x4c, 0x4c, 0x4c, 0x4c,
0x4c, 0x4c, 0x4c, 0x4c, 0x8c, 0x8c, 0x8c, 0x8c,
0x8c, 0x8c, 0x8c, 0x8c, 0x4c, 0x4c, 0x4c, 0x4c,
0xcc, 0xcc, 0x4c, 0xcc, 0xcc, 0xcc, 0x4c, 0xcc,
0xcc, 0x4c, 0xcc, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,
0x4c, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x4c, 0x4c, 0x4c, 0x8c, 0x4c, 0x4c, 0x4c,
0x4c, 0x4c, 0x4c, 0xcc, 0xcc, 0x4c, 0x4c, 0x8c,
0x8c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x8c, 0x8c,
0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x8c, 0xcc,
0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x8c,
0x8c, 0xcc, 0x8c, 0xcc, 0xcc, 0x8c, 0xcc, 0xcc,
0x8c, 0xcc, 0xcc, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,
0x8c, 0x40, 0x40, 0x4c, 0x4c, 0x4c, 0x40, 0x4c,
0x40, 0x4c, 0x40, 0x8c, 0x40, 0x40, 0x40, 0x40,
0x40, 0x40, 0x40, 0x4c, 0x40, 0x40, 0x4c, 0x40,
0x40, 0x40, 0x40, 0x8c, 0x40, 0x8c, 0x40, 0x40,
0x40, 0x8c, 0x8c, 0x8c, 0x40, 0x8c, 0x40, 0x40,
0x40, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x40, 0x40,
0x40, 0x40, 0x40, 0x8c, 0x8c, 0x8c, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0x40, 0x8c, 0x40, 0x40,
0x40, 0x40, 0x40, 0x4c, 0x4c, 0x4c, 0x40, 0x40,
0x40, 0x8c, 0x8c, 0x40, 0x40, 0x40, 0x40, 0x8c,
0xc0, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80,
0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x40, 0x40, 0x80, 0x80, 0x02, 0x02,
0x02, 0x02, 0x82, 0x82, 0x8c, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x8c, 0x80, 0x40, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x02,
0x02, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40,
0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x8c, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x40, 0x40, 0x02, 0x40, 0x40,
0x40, 0x02, 0x40, 0x40, 0x40, 0x42, 0x42, 0x02,
0x02, 0x42, 0x40, 0x40, 0x40, 0x40, 0x02, 0x40,
0x40, 0x40, 0x42, 0x42, 0x40, 0x40, 0x40, 0x40,
0x40, 0x40, 0x42, 0x42, 0x42, 0x42, 0x02, 0x02,
0x40, 0x40, 0x85, 0x85, 0x85, 0x85, 0x85, 0x40,
0x40, 0x40, 0x02, 0x42, 0x42, 0x02, 0x02, 0x42,
0x42, 0x02, 0x02, 0x42, 0x42, 0x40, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x42, 0x02, 0x02, 0x42, 0x42, 0x02,
0x02, 0x40, 0x40, 0x40, 0x40, 0x02, 0x42, 0x40,
0x40, 0x02, 0x40, 0x02, 0x02, 0x02, 0x40, 0x40,
0x02, 0x40, 0x40, 0x40, 0x42, 0x02, 0x02, 0x42,
0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x02,
0x40, 0x02, 0x42, 0x42, 0x40, 0x42, 0x02, 0x40,
0x40, 0x88, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
0x89, 0x89, 0x88, 0x89, 0x89, 0x89, 0x89, 0x40,
0x40, 0x40, 0x40, 0x46, 0x46, 0x46, 0x46, 0x46,
0x46, 0x46, 0x40, 0x40, 0x40, 0x47, 0x47, 0x47,
0x47, 0x47, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x01, 0x41, 0x01, 0x01, 0x01, 0x40, 0xc0,
0x40, 0x40, 0x02, 0x02, 0x02, 0x40, 0x02, 0x02,
0x40, 0x40, 0x40, 0x02, 0x02, 0x40, 0x40, 0x40,
0x02, 0x02, 0x02, 0x02, 0x40, 0x40, 0x42, 0x02,
0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x02, 0x40,
0x40, 0x02, 0x02, 0x40, 0x40, 0x40, 0x42, 0x42,
0x42, 0x02, 0x02, 0x02, 0x02, 0x42, 0x02, 0x02,
0x40, 0x40, 0x04, 0x40, 0x40, 0x42, 0x40, 0x44,
0x44, 0x40, 0x40, 0x40, 0x40, 0x02, 0x02, 0x02,
0x02, 0x40, 0x42, 0x02, 0x40, 0x40, 0x40, 0x40,
0x42, 0x42, 0x42, 0x02, 0x02, 0x42, 0x42, 0x02,
0x42, 0x02, 0x02, 0x40, 0x40, 0x40, 0x02, 0x02,
0x40, 0x42, 0x42, 0x02, 0x42, 0x42, 0x42, 0x42,
0x40, 0x40, 0x42, 0x42, 0x42, 0x40, 0x40, 0x42,
0x42, 0x40, 0x40, 0x02, 0x02, 0x40, 0x42, 0x40,
0x40, 0x42, 0x40, 0x42, 0x42, 0x42, 0x40, 0x42,
0x42, 0x02, 0x42, 0x02, 0x44, 0x02, 0x40, 0x40,
0x40, 0x40, 0x40, 0x02, 0x02, 0x40, 0x40, 0x40,
0x40, 0x40, 0x42, 0x42, 0x02, 0x02, 0x02, 0x42,
0x02, 0x40, 0x02, 0x42, 0x02, 0x42, 0x42, 0x42,
0x42, 0x02, 0x42, 0x02, 0x02, 0x40, 0x40, 0x40,
0x40, 0x42, 0x42, 0x42, 0x42, 0x02, 0x02, 0x42,
0x02, 0x02, 0x02, 0x42, 0x42, 0x02, 0x42, 0x02,
0x40, 0x40, 0x40, 0x02, 0x42, 0x02, 0x42, 0x42,
0x40, 0x40, 0x02, 0x02, 0x02, 0x02, 0x42, 0x02,
0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x40, 0x42,
0x40, 0x40, 0x02, 0x02, 0x42, 0x02, 0x44, 0x42,
0x44, 0x42, 0x02, 0x40, 0x40, 0x40, 0x40, 0x02,
0x02, 0x42, 0x42, 0x42, 0x42, 0x02, 0x40, 0x40,
0x40, 0x42, 0x40, 0x40, 0x40, 0x02, 0x42, 0x44,
0x02, 0x02, 0x02, 0x02, 0x40, 0x40, 0x40, 0x40,
0x44, 0x44, 0x44, 0x44, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x40, 0x42, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x42, 0x02, 0x02, 0x42, 0x02, 0x02,
0x40, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x40,
0x40, 0x02, 0x40, 0x02, 0x02, 0x40, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x44, 0x02, 0x40, 0x40,
0x42, 0x42, 0x42, 0x42, 0x42, 0x40, 0x02, 0x02,
0x40, 0x42, 0x42, 0x02, 0x42, 0x02, 0x40, 0x40,
0x40, 0x02, 0x02, 0x42, 0x42, 0x40, 0x02, 0x02,
0x44, 0x42, 0x40, 0x40, 0x40, 0x40, 0x02, 0x02,
0x02, 0x40, 0x40, 0x40, 0x42, 0x42, 0x02, 0x42,
0x02, 0x40, 0x40, 0x40, 0x40, 0x40, 0x46, 0x40,
0x40, 0x40, 0x46, 0x46, 0x46, 0x40, 0x40, 0x40,
0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x02, 0x40,
0x40, 0x40, 0x82, 0x82, 0x40, 0x40, 0x40, 0x40,
0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x80,
0x80, 0x40, 0x40, 0x80, 0x40, 0x40, 0x40, 0x40,
0x40, 0x80, 0x80, 0x80, 0x40, 0x40, 0x80, 0x40,
0x40, 0x01, 0x01, 0x01, 0x01, 0x40, 0x40, 0x40,
0x40, 0x42, 0x42, 0x42, 0x01, 0x01, 0x01, 0x01,
0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x40, 0x40,
0x02, 0x02, 0x02, 0x02, 0x02, 0x4c, 0x4c, 0x4c,
0x4c, 0x8c, 0x4c, 0x4c, 0x4c, 0xc0, 0xc0, 0xc0,
0x40, 0x40, 0x4c, 0x4c, 0x4c, 0xc0, 0xc0, 0xc0,
0xc0, 0xc0, 0xc0, 0x40, 0x4c, 0xc0, 0xc0, 0x40,
0x40, 0x4c, 0x4c, 0x4c, 0x4c, 0xcc, 0xcc, 0xc0,
0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0xcc, 0xc0,
0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x8c, 0xc0, 0x8c,
0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0xc0, 0xc0,
0xc0, 0xc0, 0xc0, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,
0x4c, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43,
0x43, 0x80, 0x8c, 0x8c, 0x4c, 0x4c, 0x4c, 0x4c,
0x4c, 0x80, 0x80, 0x8c, 0x80, 0x80, 0x80, 0x80,
0x80, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x80,
0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x8c,
0x8c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,
0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x4c, 0x8c,
0x8c, 0x8c, 0x4c, 0x4c, 0x4c, 0x4c, 0x8c, 0x4c,
0x4c, 0x4c, 0x8c, 0x4c, 0x4c, 0x4c, 0x8c, 0x8c,
0x8c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x8c, 0x4c,
0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x4c, 0x4c,
0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x40, 0x40,
0x4c, 0x4c, 0x4c, 0x8c, 0x8c, 0x8c, 0x8c, 0x4c,
0x40, 0x40, 0x40, 0x40, 0x4c, 0x4c, 0x4c, 0x4c,
0x4c, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x8c, 0x8c,
0x8c, 0x8c, 0x40, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
0x8c, 0x40, 0x8c, 0x41, 0x01, 0x41, 0x41, 0x41,
0x41, 0x41, 0x41, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
0xc0, 0x40, 0x40,
};
static const uint32_t s_joinRules[2][16] = {
{
0x03cfffcf, 0x0fffffff, 0x03cfffcf, 0x03cfff4f,
0x0000000c, 0x03c0c3cf, 0x03cf0fcf, 0x03cf3fcf,
0x03cf0fcf, 0x03cf3fcf, 0x030fffcf, 0x03cfffcf,
0x03cfffcf, 0x00cfffcf, 0x00000000, 0x00000000,
},
{
0x03cfffcf, 0x0fffffff, 0x03cfffcf, 0x03cfffcf,
0x0000000c, 0x03c0c3cf, 0x03cf0fcf, 0x03cf3fcf,
0x03cf0fcf, 0x03cf3fcf, 0x030fffcf, 0x03cfffcf,
0x03cfffcf, 0x00cfffcf, 0x00000000, 0x00000000,
},
};
static int ucdLookup(const char32_t cp)
{
const uint16_t s0 = s_stage0[cp >> 11];
const uint16_t s1 = s_stage1[s0 + ((cp >> 6) & 31)];
const uint16_t s2 = s_stage2[s1 + ((cp >> 3) & 7)];
const uint8_t s3 = s_stage3[s2 + ((cp >> 0) & 7)];
return s3;
}
static int ucdGraphemeJoins(const int state, const int lead, const int trail)
{
const int l = lead & 15;
const int t = trail & 15;
return (s_joinRules[state][l] >> (t * 2)) & 3;
}
static bool ucdGraphemeDone(const int state)
{
return state == 3;
}
static int ucdToCharacterWidth(const int val)
{
return val >> 6;
}
// clang-format on
// End of generated code
/*
* This file is part of mpv.
*
* mpv is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* mpv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/common.h"
int term_disp_width(bstr str, int max_width, const unsigned char **cut_pos)
{
static const int ambiguous_width = 1;
int width = 0;
const unsigned char *prev_pos = str.start;
while (str.len) {
int current_width = 0;
if (bstr_eatstart0(&str, "\033[")) {
while (str.len && !((*str.start >= '@' && *str.start <= '~') || *str.start == 'm'))
str = bstr_cut(str, 1);
str = bstr_cut(str, 1);
goto next;
}
prev_pos = str.start;
int cp = bstr_decode_utf8(str, &str);
// Stop processing on any invalid input
if (cp < 0)
return 0;
if (cp == '\r') {
width = 0;
goto next;
}
if (cp == '\t') {
// Assume tabstop width is 8
current_width = 8 - width % 8;
goto next;
}
if (cp < 0x20)
goto next;
if (cp <= 0x7E) {
current_width = 1;
goto next;
}
int state = 0;
while (true) {
int lead = ucdLookup(cp);
int w = ucdToCharacterWidth(lead);
if (w == 3)
w = ambiguous_width;
// U+FE0F Variation Selector-16 is used to turn unqualified Emojis into qualified ones.
// By convention, this turns them from being ambiguous width (= narrow) into wide ones.
// We achieve this here by explicitly giving this codepoint a wide width.
// Later down below we'll clamp width back to <= 2.
if (cp == 0xFE0F)
w = 2;
current_width += w;
if (!str.len)
break;
// Fetch next codepoint in grapheme cluster
bstr cluster_end;
cp = bstr_decode_utf8(str, &cluster_end);
// Stop processing on any invalid input
if (cp < 0)
return 0;
int trail = ucdLookup(cp);
state = ucdGraphemeJoins(state, lead, trail);
if (ucdGraphemeDone(state))
break;
str = cluster_end;
}
current_width = MPMIN(current_width, 2);
next:
if (width + current_width > max_width) {
assert(prev_pos < str.start + str.len);
*cut_pos = prev_pos;
break;
}
width += current_width;
if (width == max_width) {
if (str.len)
*cut_pos = str.start;
break;
}
}
return width;
}