monoeg_g_utf8_strup (const gchar * str, gssize len)
{
  gchar * D.5559;

  D.5559 = utf8_case_conv (str, len, 1);
  return D.5559;
}


utf8_case_conv (const gchar * str, gssize len, gboolean upper)
{
  long unsigned int i.0;
  long unsigned int D.5562;
  gunichar * D.5563;
  gunichar iftmp.1;
  unsigned int D.5567;
  long int ulen.2;
  gchar * D.5570;
  gunichar * ustr;
  glong i;
  glong ulen;
  gchar * utf8;

  try
    {
      ustr = monoeg_g_utf8_to_ucs4_fast (str, len, &ulen);
      i = 0;
      goto <D.5445>;
      <D.5444>:
      i.0 = (long unsigned int) i;
      D.5562 = i.0 * 4;
      D.5563 = ustr + D.5562;
      if (upper != 0) goto <D.5565>; else goto <D.5566>;
      <D.5565>:
      i.0 = (long unsigned int) i;
      D.5562 = i.0 * 4;
      D.5563 = ustr + D.5562;
      D.5567 = *D.5563;
      iftmp.1 = monoeg_g_unichar_toupper (D.5567);
      goto <D.5568>;
      <D.5566>:
      i.0 = (long unsigned int) i;
      D.5562 = i.0 * 4;
      D.5563 = ustr + D.5562;
      D.5567 = *D.5563;
      iftmp.1 = monoeg_g_unichar_tolower (D.5567);
      <D.5568>:
      *D.5563 = iftmp.1;
      i = i + 1;
      <D.5445>:
      ulen.2 = ulen;
      if (i < ulen.2) goto <D.5444>; else goto <D.5446>;
      <D.5446>:
      ulen.2 = ulen;
      utf8 = monoeg_g_ucs4_to_utf8 (ustr, ulen.2, 0B, 0B, 0B);
      monoeg_g_free (ustr);
      D.5570 = utf8;
      return D.5570;
    }
  finally
    {
      ulen = {CLOBBER};
    }
}


monoeg_g_utf8_strdown (const gchar * str, gssize len)
{
  gchar * D.5573;

  D.5573 = utf8_case_conv (str, len, 0);
  return D.5573;
}


monoeg_g_utf8_validate (const gchar * str, gssize max_len, const gchar * * end)
{
  gboolean D.5577;
  unsigned char D.5580;
  int D.5581;
  unsigned char D.5582;
  long unsigned int D.5583;
  int D.5584;
  sizetype D.5587;
  long int D.5591;
  long int D.5592;
  long int D.5593;
  long unsigned int D.5594;
  int D.5595;
  guchar * inptr;
  gboolean valid;
  guint length;
  guint min;
  gssize n;

  inptr = str;
  valid = 1;
  n = 0;
  if (max_len == 0) goto <D.5575>; else goto <D.5576>;
  <D.5575>:
  D.5577 = 0;
  return D.5577;
  <D.5576>:
  if (max_len < 0) goto <D.5578>; else goto <D.5579>;
  <D.5578>:
  goto <D.5485>;
  <D.5484>:
  D.5580 = *inptr;
  D.5581 = (int) D.5580;
  D.5582 = g_utf8_jump_table[D.5581];
  length = (guint) D.5582;
  D.5583 = (long unsigned int) length;
  D.5584 = utf8_validate (inptr, D.5583);
  if (D.5584 == 0) goto <D.5585>; else goto <D.5586>;
  <D.5585>:
  valid = 0;
  goto <D.5483>;
  <D.5586>:
  D.5587 = (sizetype) length;
  inptr = inptr + D.5587;
  <D.5485>:
  D.5580 = *inptr;
  if (D.5580 != 0) goto <D.5484>; else goto <D.5483>;
  <D.5483>:
  goto <D.5588>;
  <D.5579>:
  goto <D.5488>;
  <D.5487>:
  D.5580 = *inptr;
  if (D.5580 == 0) goto <D.5589>; else goto <D.5590>;
  <D.5589>:
  valid = 0;
  goto <D.5486>;
  <D.5590>:
  D.5580 = *inptr;
  D.5581 = (int) D.5580;
  D.5582 = g_utf8_jump_table[D.5581];
  length = (guint) D.5582;
  D.5591 = max_len - n;
  D.5592 = (long int) length;
  D.5593 = MIN_EXPR <D.5591, D.5592>;
  min = (guint) D.5593;
  D.5594 = (long unsigned int) min;
  D.5595 = utf8_validate (inptr, D.5594);
  if (D.5595 == 0) goto <D.5596>; else goto <D.5597>;
  <D.5596>:
  valid = 0;
  goto <D.5486>;
  <D.5597>:
  if (min < length) goto <D.5598>; else goto <D.5599>;
  <D.5598>:
  valid = 0;
  goto <D.5486>;
  <D.5599>:
  D.5587 = (sizetype) length;
  inptr = inptr + D.5587;
  D.5592 = (long int) length;
  n = D.5592 + n;
  <D.5488>:
  if (n < max_len) goto <D.5487>; else goto <D.5486>;
  <D.5486>:
  <D.5588>:
  if (end != 0B) goto <D.5600>; else goto <D.5601>;
  <D.5600>:
  *end = inptr;
  <D.5601>:
  D.5577 = valid;
  return D.5577;
}


utf8_validate (const unsigned char * inptr, size_t len)
{
  gboolean D.5603;
  signed char c.3;
  unsigned char D.5608;
  const unsigned char * D.5611;
  unsigned char D.5612;
  const unsigned char * D.5617;
  unsigned char D.5618;
  unsigned char D.5628;
  int D.5629;
  const unsigned char * D.5636;
  unsigned char D.5637;
  unsigned char D.5638;
  unsigned char D.5643;
  unsigned char D.5652;
  const unsigned char * ptr;
  unsigned char c;

  ptr = inptr + len;
  switch (len) <default: <D.5461>, case 1: <D.5472>, case 2: <D.5464>, case 3: <D.5463>, case 4: <D.5462>>
  <D.5461>:
  D.5603 = 0;
  return D.5603;
  <D.5462>:
  ptr = ptr + 18446744073709551615;
  c = *ptr;
  c.3 = (signed char) c;
  if (c.3 >= 0) goto <D.5604>; else goto <D.5607>;
  <D.5607>:
  if (c > 191) goto <D.5604>; else goto <D.5605>;
  <D.5604>:
  D.5603 = 0;
  return D.5603;
  <D.5605>:
  D.5608 = c + 66;
  if (D.5608 <= 1) goto <D.5609>; else goto <D.5610>;
  <D.5609>:
  D.5611 = ptr + 18446744073709551615;
  D.5612 = *D.5611;
  if (D.5612 == 191) goto <D.5613>; else goto <D.5614>;
  <D.5613>:
  D.5617 = ptr + 18446744073709551614;
  D.5618 = *D.5617;
  if (D.5618 == 143) goto <D.5615>; else goto <D.5619>;
  <D.5619>:
  D.5617 = ptr + 18446744073709551614;
  D.5618 = *D.5617;
  if (D.5618 == 159) goto <D.5615>; else goto <D.5620>;
  <D.5620>:
  D.5617 = ptr + 18446744073709551614;
  D.5618 = *D.5617;
  if (D.5618 == 175) goto <D.5615>; else goto <D.5621>;
  <D.5621>:
  D.5617 = ptr + 18446744073709551614;
  D.5618 = *D.5617;
  if (D.5618 == 191) goto <D.5615>; else goto <D.5616>;
  <D.5615>:
  D.5603 = 0;
  return D.5603;
  <D.5616>:
  <D.5614>:
  <D.5610>:
  <D.5463>:
  ptr = ptr + 18446744073709551615;
  c = *ptr;
  c.3 = (signed char) c;
  if (c.3 >= 0) goto <D.5622>; else goto <D.5624>;
  <D.5624>:
  if (c > 191) goto <D.5622>; else goto <D.5623>;
  <D.5622>:
  D.5603 = 0;
  return D.5603;
  <D.5623>:
  <D.5464>:
  ptr = ptr + 18446744073709551615;
  c = *ptr;
  c.3 = (signed char) c;
  if (c.3 >= 0) goto <D.5625>; else goto <D.5627>;
  <D.5627>:
  if (c > 191) goto <D.5625>; else goto <D.5626>;
  <D.5625>:
  D.5603 = 0;
  return D.5603;
  <D.5626>:
  D.5628 = *inptr;
  D.5629 = (int) D.5628;
  switch (D.5629) <default: <D.5471>, case 224: <D.5465>, case 237: <D.5467>, case 239: <D.5468>, case 240: <D.5469>, case 244: <D.5470>>
  <D.5465>:
  if (c <= 159) goto <D.5630>; else goto <D.5631>;
  <D.5630>:
  D.5603 = 0;
  return D.5603;
  <D.5631>:
  goto <D.5466>;
  <D.5467>:
  if (c > 159) goto <D.5632>; else goto <D.5633>;
  <D.5632>:
  D.5603 = 0;
  return D.5603;
  <D.5633>:
  goto <D.5466>;
  <D.5468>:
  if (c == 183) goto <D.5634>; else goto <D.5635>;
  <D.5634>:
  D.5636 = ptr + 1;
  D.5637 = *D.5636;
  D.5638 = D.5637 + 112;
  if (D.5638 <= 31) goto <D.5639>; else goto <D.5640>;
  <D.5639>:
  D.5603 = 0;
  return D.5603;
  <D.5640>:
  <D.5635>:
  if (c == 191) goto <D.5641>; else goto <D.5642>;
  <D.5641>:
  D.5636 = ptr + 1;
  D.5637 = *D.5636;
  D.5643 = D.5637 + 66;
  if (D.5643 <= 1) goto <D.5644>; else goto <D.5645>;
  <D.5644>:
  D.5603 = 0;
  return D.5603;
  <D.5645>:
  <D.5642>:
  goto <D.5466>;
  <D.5469>:
  if (c <= 143) goto <D.5646>; else goto <D.5647>;
  <D.5646>:
  D.5603 = 0;
  return D.5603;
  <D.5647>:
  goto <D.5466>;
  <D.5470>:
  if (c > 143) goto <D.5648>; else goto <D.5649>;
  <D.5648>:
  D.5603 = 0;
  return D.5603;
  <D.5649>:
  goto <D.5466>;
  <D.5471>:
  c.3 = (signed char) c;
  if (c.3 >= 0) goto <D.5650>; else goto <D.5651>;
  <D.5650>:
  D.5603 = 0;
  return D.5603;
  <D.5651>:
  goto <D.5466>;
  <D.5466>:
  <D.5472>:
  D.5628 = *inptr;
  D.5652 = D.5628 + 128;
  if (D.5652 <= 65) goto <D.5653>; else goto <D.5654>;
  <D.5653>:
  D.5603 = 0;
  return D.5603;
  <D.5654>:
  D.5628 = *inptr;
  if (D.5628 > 244) goto <D.5655>; else goto <D.5656>;
  <D.5655>:
  D.5603 = 0;
  return D.5603;
  <D.5656>:
  D.5603 = 1;
  return D.5603;
}


monoeg_utf8_get_char_validated (const gchar * str, gssize max_len)
{
  unsigned char D.5658;
  gunichar D.5661;
  long int D.5683;
  long int D.5684;
  long unsigned int D.5685;
  int D.5686;
  long unsigned int D.5692;
  int D.5693;
  unsigned int D.5696;
  unsigned char D.5697;
  unsigned int D.5698;
  unsigned char * inptr;
  gunichar u;
  int n;
  int i;

  inptr = str;
  D.5658 = *inptr;
  u = (gunichar) D.5658;
  if (max_len == 0) goto <D.5659>; else goto <D.5660>;
  <D.5659>:
  D.5661 = 4294967294;
  return D.5661;
  <D.5660>:
  if (u <= 127) goto <D.5662>; else goto <D.5663>;
  <D.5662>:
  D.5661 = u;
  return D.5661;
  <D.5663>:
  if (u <= 193) goto <D.5664>; else goto <D.5665>;
  <D.5664>:
  D.5661 = 4294967295;
  return D.5661;
  <D.5665>:
  if (u <= 223) goto <D.5666>; else goto <D.5667>;
  <D.5666>:
  u = u & 31;
  n = 2;
  goto <D.5668>;
  <D.5667>:
  if (u <= 239) goto <D.5669>; else goto <D.5670>;
  <D.5669>:
  u = u & 15;
  n = 3;
  goto <D.5671>;
  <D.5670>:
  if (u <= 247) goto <D.5672>; else goto <D.5673>;
  <D.5672>:
  u = u & 7;
  n = 4;
  goto <D.5674>;
  <D.5673>:
  if (u <= 251) goto <D.5675>; else goto <D.5676>;
  <D.5675>:
  u = u & 3;
  n = 5;
  goto <D.5677>;
  <D.5676>:
  if (u <= 253) goto <D.5678>; else goto <D.5679>;
  <D.5678>:
  u = u & 1;
  n = 6;
  goto <D.5680>;
  <D.5679>:
  D.5661 = 4294967295;
  return D.5661;
  <D.5680>:
  <D.5677>:
  <D.5674>:
  <D.5671>:
  <D.5668>:
  if (max_len > 0) goto <D.5681>; else goto <D.5682>;
  <D.5681>:
  D.5683 = (long int) n;
  D.5684 = MIN_EXPR <D.5683, max_len>;
  D.5685 = (long unsigned int) D.5684;
  D.5686 = utf8_validate (inptr, D.5685);
  if (D.5686 == 0) goto <D.5687>; else goto <D.5688>;
  <D.5687>:
  D.5661 = 4294967295;
  return D.5661;
  <D.5688>:
  D.5683 = (long int) n;
  if (D.5683 > max_len) goto <D.5689>; else goto <D.5690>;
  <D.5689>:
  D.5661 = 4294967294;
  return D.5661;
  <D.5690>:
  goto <D.5691>;
  <D.5682>:
  D.5692 = (long unsigned int) n;
  D.5693 = utf8_validate (inptr, D.5692);
  if (D.5693 == 0) goto <D.5694>; else goto <D.5695>;
  <D.5694>:
  D.5661 = 4294967295;
  return D.5661;
  <D.5695>:
  <D.5691>:
  i = 1;
  goto <D.5498>;
  <D.5497>:
  D.5696 = u << 6;
  inptr = inptr + 1;
  D.5658 = *inptr;
  D.5697 = D.5658 ^ 128;
  D.5698 = (unsigned int) D.5697;
  u = D.5696 | D.5698;
  i = i + 1;
  <D.5498>:
  if (i < n) goto <D.5497>; else goto <D.5499>;
  <D.5499>:
  D.5661 = u;
  return D.5661;
}


monoeg_g_utf8_strlen (const gchar * str, gssize max_len)
{
  glong D.5702;
  unsigned char D.5705;
  int D.5706;
  unsigned char D.5707;
  sizetype D.5708;
  long int D.5710;
  sizetype n.4;
  const guchar * inptr;
  glong clen;
  glong len;
  glong n;

  inptr = str;
  clen = 0;
  len = 0;
  if (max_len == 0) goto <D.5700>; else goto <D.5701>;
  <D.5700>:
  D.5702 = 0;
  return D.5702;
  <D.5701>:
  if (max_len < 0) goto <D.5703>; else goto <D.5704>;
  <D.5703>:
  goto <D.5509>;
  <D.5508>:
  D.5705 = *inptr;
  D.5706 = (int) D.5705;
  D.5707 = g_utf8_jump_table[D.5706];
  D.5708 = (sizetype) D.5707;
  inptr = inptr + D.5708;
  len = len + 1;
  <D.5509>:
  D.5705 = *inptr;
  if (D.5705 != 0) goto <D.5508>; else goto <D.5510>;
  <D.5510>:
  goto <D.5709>;
  <D.5704>:
  goto <D.5513>;
  <D.5512>:
  D.5705 = *inptr;
  D.5706 = (int) D.5705;
  D.5707 = g_utf8_jump_table[D.5706];
  n = (glong) D.5707;
  D.5710 = clen + n;
  if (D.5710 > max_len) goto <D.5511>; else goto <D.5711>;
  <D.5711>:
  n.4 = (sizetype) n;
  inptr = inptr + n.4;
  clen = clen + n;
  len = len + 1;
  <D.5513>:
  if (len < max_len) goto <D.5713>; else goto <D.5511>;
  <D.5713>:
  D.5705 = *inptr;
  if (D.5705 != 0) goto <D.5512>; else goto <D.5511>;
  <D.5511>:
  <D.5709>:
  D.5702 = len;
  return D.5702;
}


monoeg_g_utf8_get_char (const gchar * src)
{
  unsigned char D.5715;
  gunichar D.5718;
  unsigned int D.5731;
  unsigned char D.5732;
  unsigned int D.5733;
  unsigned char * inptr;
  gunichar u;
  int n;
  int i;

  inptr = src;
  D.5715 = *inptr;
  u = (gunichar) D.5715;
  if (u <= 127) goto <D.5716>; else goto <D.5717>;
  <D.5716>:
  D.5718 = u;
  return D.5718;
  <D.5717>:
  if (u <= 223) goto <D.5719>; else goto <D.5720>;
  <D.5719>:
  u = u & 31;
  n = 2;
  goto <D.5721>;
  <D.5720>:
  if (u <= 239) goto <D.5722>; else goto <D.5723>;
  <D.5722>:
  u = u & 15;
  n = 3;
  goto <D.5724>;
  <D.5723>:
  if (u <= 247) goto <D.5725>; else goto <D.5726>;
  <D.5725>:
  u = u & 7;
  n = 4;
  goto <D.5727>;
  <D.5726>:
  if (u <= 251) goto <D.5728>; else goto <D.5729>;
  <D.5728>:
  u = u & 3;
  n = 5;
  goto <D.5730>;
  <D.5729>:
  u = u & 1;
  n = 6;
  <D.5730>:
  <D.5727>:
  <D.5724>:
  <D.5721>:
  i = 1;
  goto <D.5522>;
  <D.5521>:
  D.5731 = u << 6;
  inptr = inptr + 1;
  D.5715 = *inptr;
  D.5732 = D.5715 ^ 128;
  D.5733 = (unsigned int) D.5732;
  u = D.5731 | D.5733;
  i = i + 1;
  <D.5522>:
  if (i < n) goto <D.5521>; else goto <D.5523>;
  <D.5523>:
  D.5718 = u;
  return D.5718;
}


monoeg_utf8_find_prev_char (const gchar * str, const gchar * p)
{
  gchar * D.5737;

  goto <D.5529>;
  <D.5528>:
  p = p + 18446744073709551615;
  if (1 != 0) goto <D.5735>; else goto <D.5736>;
  <D.5735>:
  D.5737 = p;
  return D.5737;
  <D.5736>:
  <D.5529>:
  if (p > str) goto <D.5528>; else goto <D.5530>;
  <D.5530>:
  D.5737 = 0B;
  return D.5737;
}


monoeg_utf8_prev_char (const gchar * str)
{
  gchar * D.5739;
  const gchar * p;

  p = str;
  p = p + 18446744073709551615;
  D.5739 = p;
  return D.5739;
}


monoeg_g_utf8_offset_to_pointer (const gchar * str, glong offset)
{
  char D.5743;
  int D.5744;
  unsigned char D.5745;
  sizetype D.5746;
  sizetype offset.5;
  gchar * D.5751;
  const gchar * p;

  p = str;
  if (offset > 0) goto <D.5741>; else goto <D.5742>;
  <D.5741>:
  <D.5540>:
  D.5743 = *p;
  D.5744 = (int) D.5743;
  D.5745 = g_utf8_jump_table[D.5744];
  D.5746 = (sizetype) D.5745;
  p = p + D.5746;
  offset = offset + -1;
  if (offset > 0) goto <D.5540>; else goto <D.5541>;
  <D.5541>:
  goto <D.5747>;
  <D.5742>:
  if (offset < 0) goto <D.5748>; else goto <D.5749>;
  <D.5748>:
  {
    const gchar * jump;

    jump = str;
    <D.5546>:
    offset.5 = (sizetype) offset;
    jump = jump + offset.5;
    goto <D.5543>;
    jump = jump + 18446744073709551615;
    <D.5543>:
    p = jump;
    <D.5544>:
    D.5743 = *p;
    D.5744 = (int) D.5743;
    D.5745 = g_utf8_jump_table[D.5744];
    D.5746 = (sizetype) D.5745;
    p = p + D.5746;
    offset = offset + 1;
    if (p < jump) goto <D.5544>; else goto <D.5545>;
    <D.5545>:
    if (offset < 0) goto <D.5546>; else goto <D.5547>;
    <D.5547>:
  }
  <D.5749>:
  <D.5747>:
  D.5751 = p;
  return D.5751;
}


monoeg_g_utf8_pointer_to_offset (const gchar * str, const gchar * pos)
{
  glong D.5755;
  char D.5759;
  int D.5760;
  unsigned char D.5761;
  sizetype D.5762;
  const gchar * inptr;
  const gchar * inend;
  glong offset;
  glong sign;

  offset = 0;
  sign = 1;
  if (pos == str) goto <D.5753>; else goto <D.5754>;
  <D.5753>:
  D.5755 = 0;
  return D.5755;
  <D.5754>:
  if (str < pos) goto <D.5756>; else goto <D.5757>;
  <D.5756>:
  inptr = str;
  inend = pos;
  goto <D.5758>;
  <D.5757>:
  inptr = pos;
  inend = str;
  sign = -1;
  <D.5758>:
  <D.5556>:
  D.5759 = *inptr;
  D.5760 = (int) D.5759;
  D.5761 = g_utf8_jump_table[D.5760];
  D.5762 = (sizetype) D.5761;
  inptr = inptr + D.5762;
  offset = offset + 1;
  if (inptr < inend) goto <D.5556>; else goto <D.5557>;
  <D.5557>:
  D.5755 = offset * sign;
  return D.5755;
}


