static short symtab[]= {
  /* 0x01A1 - 0x01FF */
  0x0104,0x02D8,0x0141,-1,0x013D,0x015A,-1,-1,0x0160,0x015E,0x0164,0x0179,-1,0x017D,0x017B,-1,0x0105,0x02DB,0x0142,-1,0x013E,0x015B,0x02C7,-1,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C,0x0154,-1,-1,0x0102,-1,0x0139,0x0106,-1,0x010C,-1,0x0118,-1,0x011A,-1,-1,0x010E,0x0110,0x0143,0x0147,-1,-1,0x0150,-1,-1,0x0158,0x016E,-1,0x0170,-1,-1,0x0162,-1,0x0155,-1,-1,0x0103,-1,0x013A,0x0107,-1,0x010D,-1,0x0119,-1,0x011B,-1,-1,0x010F,0x0111,0x0144,0x0148,-1,-1,0x0151,-1,-1,0x0159,0x016F,-1,0x0171,-1,-1,0x0163,0x02D9,
  /* 0x02A1 - 0x02A1 */
  0x0126,
  /* 0x02A6 - 0x02AC */
  0x0124,-1,-1,0x0130,-1,0x011E,0x0134,
  /* 0x02B1 - 0x02B1 */
  0x0127,
  /* 0x02B6 - 0x02BC */
  0x0125,-1,-1,0x0131,-1,0x011F,0x0135,
  /* 0x02C5 - 0x02C6 */
  0x010A,0x0108,
  /* 0x02D5 - 0x02D8 */
  0x0120,-1,-1,0x011C,
  /* 0x02DD - 0x02DE */
  0x016C,0x015C,
  /* 0x02E5 - 0x02E6 */
  0x010B,0x0109,
  /* 0x02F5 - 0x02F8 */
  0x0121,-1,-1,0x011D,
  /* 0x02FD - 0x02FE */
  0x016D,0x015D,
  /* 0x03A2 - 0x03AC */
  0x0138,0x0156,-1,0x0128,0x013B,-1,-1,-1,0x0112,0x0122,0x0166,
  /* 0x03B3 - 0x03C0 */
  0x0157,-1,0x0129,0x013C,-1,-1,-1,0x0113,0x0123,0x0167,0x014A,-1,0x014B,0x0100,
  /* 0x03C7 - 0x03C7 */
  0x012E,
  /* 0x03CC - 0x03D3 */
  0x0116,-1,-1,0x012A,-1,0x0145,0x014C,0x0136,
  /* 0x03D9 - 0x03E0 */
  0x0172,-1,-1,-1,0x0168,0x016A,-1,0x0101,
  /* 0x03E7 - 0x03E7 */
  0x012F,
  /* 0x03EC - 0x03F3 */
  0x0117,-1,-1,0x012B,-1,0x0146,0x014D,0x0137,
  /* 0x03F9 - 0x03FE */
  0x0173,-1,-1,-1,0x0169,0x016B,
  /* 0x047E - 0x047E */
  0x203E,
  /* 0x04A1 - 0x04DF */
  0x3002,0x300C,0x300D,0x3001,0x30FB,0x30F2,0x30A1,0x30A3,0x30A5,0x30A7,0x30A9,0x30E3,0x30E5,0x30E7,0x30C3,0x30FC,0x30A2,0x30A4,0x30A6,0x30A8,0x30AA,0x30AB,0x30AD,0x30AF,0x30B1,0x30B3,0x30B5,0x30B7,0x30B9,0x30BB,0x30BD,0x30BF,0x30C1,0x30C4,0x30C6,0x30C8,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF,0x30D2,0x30D5,0x30D8,0x30DB,0x30DE,0x30DF,0x30E0,0x30E1,0x30E2,0x30E4,0x30E6,0x30E8,0x30E9,0x30EA,0x30EB,0x30EC,0x30ED,0x30EF,0x30F3,0x309B,0x309C,
  /* 0x05AC - 0x05AC */
  0x060C,
  /* 0x05BB - 0x05DA */
  0x061B,-1,-1,-1,0x061F,-1,0x0621,0x0622,0x0623,0x0624,0x0625,0x0626,0x0627,0x0628,0x0629,0x062A,0x062B,0x062C,0x062D,0x062E,0x062F,0x0630,0x0631,0x0632,0x0633,0x0634,0x0635,0x0636,0x0637,0x0638,0x0639,0x063A,
  /* 0x05E0 - 0x05F2 */
  0x0640,0x0641,0x0642,0x0643,0x0644,0x0645,0x0646,0x0647,0x0648,0x0649,0x064A,0x064B,0x064C,0x064D,0x064E,0x064F,0x0650,0x0651,0x0652,
  /* 0x06A1 - 0x06FF */
  0x0452,0x0453,0x0451,0x0454,0x0455,0x0456,0x0457,0x0458,0x0459,0x045A,0x045B,0x045C,0x0491,0x045E,0x045F,0x2116,0x0402,0x0403,0x0401,0x0404,0x0405,0x0406,0x0407,0x0408,0x0409,0x040A,0x040B,0x040C,0x0490,0x040E,0x040F,0x044E,0x0430,0x0431,0x0446,0x0434,0x0435,0x0444,0x0433,0x0445,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F,0x044F,0x0440,0x0441,0x0442,0x0443,0x0436,0x0432,0x044C,0x044B,0x0437,0x0448,0x044D,0x0449,0x0447,0x044A,0x042E,0x0410,0x0411,0x0426,0x0414,0x0415,0x0424,0x0413,0x0425,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F,0x042F,0x0420,0x0421,0x0422,0x0423,0x0416,0x0412,0x042C,0x042B,0x0417,0x0428,0x042D,0x0429,0x0427,0x042A,
  /* 0x07A1 - 0x07BB */
  0x0386,0x0388,0x0389,0x038A,0x03AA,-1,0x038C,0x038E,0x03AB,-1,0x038F,-1,-1,0x0385,0x2015,-1,0x03AC,0x03AD,0x03AE,0x03AF,0x03CA,0x0390,0x03CC,0x03CD,0x03CB,0x03B0,0x03CE,
  /* 0x07C1 - 0x07D9 */
  0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0,0x03A1,0x03A3,-1,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9,
  /* 0x07E1 - 0x07F9 */
  0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0,0x03C1,0x03C3,0x03C2,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9,
  /* 0x08A1 - 0x08B0 */
  0x23B7,0x250C,0x2500,0x2320,0x2321,0x2502,0x23A1,0x23A3,0x23A4,0x23A6,0x239B,0x239D,0x239E,0x23A0,0x23A8,0x23AC,
  /* 0x08BC - 0x08CF */
  0x2264,0x2260,0x2265,0x222B,0x2234,0x221D,0x221E,-1,-1,0x2207,-1,-1,0x223C,0x2243,-1,-1,-1,0x21D4,0x21D2,0x2261,
  /* 0x08D6 - 0x08DF */
  0x221A,-1,-1,-1,0x2282,0x2283,0x2229,0x222A,0x2227,0x2228,
  /* 0x08EF - 0x08EF */
  0x2202,
  /* 0x08F6 - 0x08F6 */
  0x0192,
  /* 0x08FB - 0x08FE */
  0x2190,0x2191,0x2192,0x2193,
  /* 0x09E0 - 0x09F8 */
  0x25C6,0x2592,0x2409,0x240C,0x240D,0x240A,-1,-1,0x2424,0x240B,0x2518,0x2510,0x250C,0x2514,0x253C,0x23BA,0x23BB,0x2500,0x23BC,0x23BD,0x251C,0x2524,0x2534,0x252C,0x2502,
  /* 0x0AA1 - 0x0ABE */
  0x2003,0x2002,0x2004,0x2005,0x2007,0x2008,0x2009,0x200A,0x2014,0x2013,-1,0x2423,-1,0x2026,0x2025,0x2153,0x2154,0x2155,0x2156,0x2157,0x2158,0x2159,0x215A,0x2105,-1,-1,0x2012,0x27E8,0x002E,0x27E9,
  /* 0x0AC3 - 0x0AFE */
  0x215B,0x215C,0x215D,0x215E,-1,-1,0x2122,0x2613,-1,0x25C1,0x25B7,0x25CB,0x25AF,0x2018,0x2019,0x201C,0x201D,0x211E,0x2030,0x2032,0x2033,-1,0x271D,-1,0x25AC,0x25C0,0x25B6,0x25CF,0x25AE,0x25E6,0x25AB,0x25AD,0x25B3,0x25BD,0x2606,0x2022,0x25AA,0x25B2,0x25BC,0x261C,0x261E,0x2663,0x2666,0x2665,-1,0x2720,0x2020,0x2021,0x2713,0x2717,0x266F,0x266D,0x2642,0x2640,0x260E,0x2315,0x2117,0x2038,0x201A,0x201E,
  /* 0x0BA3 - 0x0BA9 */
  0x003C,-1,-1,0x003E,-1,0x2228,0x2227,
  /* 0x0BC0 - 0x0BDC */
  0x00AF,-1,0x22A4,0x2229,0x230A,-1,0x005F,-1,-1,-1,0x2218,-1,0x2395,-1,0x22A5,0x25CB,-1,-1,-1,0x2308,-1,-1,0x222A,-1,0x2283,-1,0x2282,-1,0x22A3,
  /* 0x0BFC - 0x0BFC */
  0x22A2,
  /* 0x0CDF - 0x0CFA */
  0x2017,0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7,0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF,0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7,0x05E8,0x05E9,0x05EA,
  /* 0x0DA1 - 0x0DDA */
  0x0E01,0x0E02,0x0E03,0x0E04,0x0E05,0x0E06,0x0E07,0x0E08,0x0E09,0x0E0A,0x0E0B,0x0E0C,0x0E0D,0x0E0E,0x0E0F,0x0E10,0x0E11,0x0E12,0x0E13,0x0E14,0x0E15,0x0E16,0x0E17,0x0E18,0x0E19,0x0E1A,0x0E1B,0x0E1C,0x0E1D,0x0E1E,0x0E1F,0x0E20,0x0E21,0x0E22,0x0E23,0x0E24,0x0E25,0x0E26,0x0E27,0x0E28,0x0E29,0x0E2A,0x0E2B,0x0E2C,0x0E2D,0x0E2E,0x0E2F,0x0E30,0x0E31,0x0E32,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37,0x0E38,0x0E39,0x0E3A,
  /* 0x0DDF - 0x0DF9 */
  0x0E3F,0x0E40,0x0E41,0x0E42,0x0E43,0x0E44,0x0E45,0x0E46,0x0E47,0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D,-1,-1,0x0E50,0x0E51,0x0E52,0x0E53,0x0E54,0x0E55,0x0E56,0x0E57,0x0E58,0x0E59,
  /* 0x0EFF - 0x0EFF */
  0x20A9,
  /* 0x13BC - 0x13BE */
  0x0152,0x0153,0x0178,
  /* 0x20AC - 0x20AC */
  0x20AC,
  /* 0xFF08 - 0xFF0D */
  0x0008,0x0009,0x000A,0x000B,-1,0x000D,
  /* 0xFF1B - 0xFF1B */
  0x001B,
  /* 0xFF80 - 0xFF80 */
  0x0020,
  /* 0xFF89 - 0xFF8D */
  0x0009,-1,-1,-1,0x000D,
  /* 0xFFAA - 0xFFBD */
  0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,-1,-1,-1,0x003D
};
int PerlXlib_keysym_to_codepoint(KeySym keysym) {
    /* If Latin-1 or direct-to-unicode, skip table lookup */
    if ((keysym >= 0x0020 && keysym <= 0x007e) ||
        (keysym >= 0x00a0 && keysym <= 0x00ff))
        return keysym;
    if ((keysym & 0xff000000) == 0x01000000)
        return keysym & 0x00ffffff;
    if (keysym < 0x07A1) {
      if (keysym < 0x03B3) {
        if (keysym < 0x02D5) {
          if (keysym < 0x02B1) {
            if (keysym < 0x02A1) {
              if (keysym >= 0x01A1 && keysym < 0x0200) { return symtab[keysym - 417 + 0 ]; }
            } else {
              if (keysym < 0x02A2) { return symtab[keysym - 673 + 95 ]; }
              if (keysym >= 0x02A6 && keysym < 0x02AD) { return symtab[keysym - 678 + 96 ]; }
            }
          } else {
            if (keysym < 0x02B6) {
              if (keysym < 0x02B2) { return symtab[keysym - 689 + 103 ]; }
            } else {
              if (keysym < 0x02BD) { return symtab[keysym - 694 + 104 ]; }
              if (keysym >= 0x02C5 && keysym < 0x02C7) { return symtab[keysym - 709 + 111 ]; }
            }
          }
        } else {
          if (keysym < 0x02F5) {
            if (keysym < 0x02DD) {
              if (keysym < 0x02D9) { return symtab[keysym - 725 + 113 ]; }
            } else {
              if (keysym < 0x02DF) { return symtab[keysym - 733 + 117 ]; }
              if (keysym >= 0x02E5 && keysym < 0x02E7) { return symtab[keysym - 741 + 119 ]; }
            }
          } else {
            if (keysym < 0x02FD) {
              if (keysym < 0x02F9) { return symtab[keysym - 757 + 121 ]; }
            } else {
              if (keysym < 0x02FF) { return symtab[keysym - 765 + 125 ]; }
              if (keysym >= 0x03A2 && keysym < 0x03AD) { return symtab[keysym - 930 + 127 ]; }
            }
          }
        }
      } else {
        if (keysym < 0x03F9) {
          if (keysym < 0x03D9) {
            if (keysym < 0x03C7) {
              if (keysym < 0x03C1) { return symtab[keysym - 947 + 138 ]; }
            } else {
              if (keysym < 0x03C8) { return symtab[keysym - 967 + 152 ]; }
              if (keysym >= 0x03CC && keysym < 0x03D4) { return symtab[keysym - 972 + 153 ]; }
            }
          } else {
            if (keysym < 0x03E7) {
              if (keysym < 0x03E1) { return symtab[keysym - 985 + 161 ]; }
            } else {
              if (keysym < 0x03E8) { return symtab[keysym - 999 + 169 ]; }
              if (keysym >= 0x03EC && keysym < 0x03F4) { return symtab[keysym - 1004 + 170 ]; }
            }
          }
        } else {
          if (keysym < 0x05AC) {
            if (keysym < 0x047E) {
              if (keysym < 0x03FF) { return symtab[keysym - 1017 + 178 ]; }
            } else {
              if (keysym < 0x047F) { return symtab[keysym - 1150 + 184 ]; }
              if (keysym >= 0x04A1 && keysym < 0x04E0) { return symtab[keysym - 1185 + 185 ]; }
            }
          } else {
            if (keysym < 0x05E0) {
              if (keysym < 0x05AD) { return symtab[keysym - 1452 + 248 ]; }
              if (keysym >= 0x05BB && keysym < 0x05DB) { return symtab[keysym - 1467 + 249 ]; }
            } else {
              if (keysym < 0x05F3) { return symtab[keysym - 1504 + 281 ]; }
              if (keysym >= 0x06A1 && keysym < 0x0700) { return symtab[keysym - 1697 + 300 ]; }
            }
          }
        }
      }
    } else {
      if (keysym < 0x0BC0) {
        if (keysym < 0x08EF) {
          if (keysym < 0x08A1) {
            if (keysym < 0x07C1) {
              if (keysym < 0x07BC) { return symtab[keysym - 1953 + 395 ]; }
            } else {
              if (keysym < 0x07DA) { return symtab[keysym - 1985 + 422 ]; }
              if (keysym >= 0x07E1 && keysym < 0x07FA) { return symtab[keysym - 2017 + 447 ]; }
            }
          } else {
            if (keysym < 0x08BC) {
              if (keysym < 0x08B1) { return symtab[keysym - 2209 + 472 ]; }
            } else {
              if (keysym < 0x08D0) { return symtab[keysym - 2236 + 488 ]; }
              if (keysym >= 0x08D6 && keysym < 0x08E0) { return symtab[keysym - 2262 + 508 ]; }
            }
          }
        } else {
          if (keysym < 0x09E0) {
            if (keysym < 0x08F6) {
              if (keysym < 0x08F0) { return symtab[keysym - 2287 + 518 ]; }
            } else {
              if (keysym < 0x08F7) { return symtab[keysym - 2294 + 519 ]; }
              if (keysym >= 0x08FB && keysym < 0x08FF) { return symtab[keysym - 2299 + 520 ]; }
            }
          } else {
            if (keysym < 0x0AC3) {
              if (keysym < 0x09F9) { return symtab[keysym - 2528 + 524 ]; }
              if (keysym >= 0x0AA1 && keysym < 0x0ABF) { return symtab[keysym - 2721 + 549 ]; }
            } else {
              if (keysym < 0x0AFF) { return symtab[keysym - 2755 + 579 ]; }
              if (keysym >= 0x0BA3 && keysym < 0x0BAA) { return symtab[keysym - 2979 + 639 ]; }
            }
          }
        }
      } else {
        if (keysym < 0x13BC) {
          if (keysym < 0x0DA1) {
            if (keysym < 0x0BFC) {
              if (keysym < 0x0BDD) { return symtab[keysym - 3008 + 646 ]; }
            } else {
              if (keysym < 0x0BFD) { return symtab[keysym - 3068 + 675 ]; }
              if (keysym >= 0x0CDF && keysym < 0x0CFB) { return symtab[keysym - 3295 + 676 ]; }
            }
          } else {
            if (keysym < 0x0DDF) {
              if (keysym < 0x0DDB) { return symtab[keysym - 3489 + 704 ]; }
            } else {
              if (keysym < 0x0DFA) { return symtab[keysym - 3551 + 762 ]; }
              if (keysym >= 0x0EFF && keysym < 0x0F00) { return symtab[keysym - 3839 + 789 ]; }
            }
          }
        } else {
          if (keysym < 0xFF1B) {
            if (keysym < 0x20AC) {
              if (keysym < 0x13BF) { return symtab[keysym - 5052 + 790 ]; }
            } else {
              if (keysym < 0x20AD) { return symtab[keysym - 8364 + 793 ]; }
              if (keysym >= 0xFF08 && keysym < 0xFF0E) { return symtab[keysym - 65288 + 794 ]; }
            }
          } else {
            if (keysym < 0xFF89) {
              if (keysym < 0xFF1C) { return symtab[keysym - 65307 + 800 ]; }
              if (keysym >= 0xFF80 && keysym < 0xFF81) { return symtab[keysym - 65408 + 801 ]; }
            } else {
              if (keysym < 0xFF8E) { return symtab[keysym - 65417 + 802 ]; }
              if (keysym >= 0xFFAA && keysym < 0xFFBE) { return symtab[keysym - 65450 + 807 ]; }
            }
          }
        }
      }
    }

    return -1;
}