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

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


utf8_case_conv (const gchar * str, gssize len, gboolean upper)
{
  long unsigned int i.0;
  long unsigned int D.5151;
  gunichar * D.5152;
  gunichar iftmp.1;
  unsigned int D.5156;
  long int ulen.2;
  gchar * D.5159;
  gunichar * ustr;
  glong i;
  glong ulen;
  gchar * utf8;

  try
    {
      ustr = monoeg_g_utf8_to_ucs4_fast (str, len, &ulen);
      i = 0;
      goto <D.5034>;
      <D.5033>:
      i.0 = (long unsigned int) i;
      D.5151 = i.0 * 4;
      D.5152 = ustr + D.5151;
      if (upper != 0) goto <D.5154>; else goto <D.5155>;
      <D.5154>:
      i.0 = (long unsigned int) i;
      D.5151 = i.0 * 4;
      D.5152 = ustr + D.5151;
      D.5156 = *D.5152;
      iftmp.1 = monoeg_g_unichar_toupper (D.5156);
      goto <D.5157>;
      <D.5155>:
      i.0 = (long unsigned int) i;
      D.5151 = i.0 * 4;
      D.5152 = ustr + D.5151;
      D.5156 = *D.5152;
      iftmp.1 = monoeg_g_unichar_tolower (D.5156);
      <D.5157>:
      *D.5152 = iftmp.1;
      i = i + 1;
      <D.5034>:
      ulen.2 = ulen;
      if (i < ulen.2) goto <D.5033>; else goto <D.5035>;
      <D.5035>:
      ulen.2 = ulen;
      utf8 = monoeg_g_ucs4_to_utf8 (ustr, ulen.2, 0B, 0B, 0B);
      monoeg_g_free (ustr);
      D.5159 = utf8;
      return D.5159;
    }
  finally
    {
      ulen = {CLOBBER};
    }
}


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

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


monoeg_g_utf8_validate (const gchar * str, gssize max_len, const gchar * * end)
{
  gboolean D.5166;
  unsigned char D.5169;
  int D.5170;
  unsigned char D.5171;
  long unsigned int D.5172;
  int D.5173;
  sizetype D.5176;
  long int D.5180;
  long int D.5181;
  long int D.5182;
  long unsigned int D.5183;
  int D.5184;
  guchar * inptr;
  gboolean valid;
  guint length;
  guint min;
  gssize n;

  inptr = str;
  valid = 1;
  n = 0;
  if (max_len == 0) goto <D.5164>; else goto <D.5165>;
  <D.5164>:
  D.5166 = 0;
  return D.5166;
  <D.5165>:
  if (max_len < 0) goto <D.5167>; else goto <D.5168>;
  <D.5167>:
  goto <D.5074>;
  <D.5073>:
  D.5169 = *inptr;
  D.5170 = (int) D.5169;
  D.5171 = g_utf8_jump_table[D.5170];
  length = (guint) D.5171;
  D.5172 = (long unsigned int) length;
  D.5173 = utf8_validate (inptr, D.5172);
  if (D.5173 == 0) goto <D.5174>; else goto <D.5175>;
  <D.5174>:
  valid = 0;
  goto <D.5072>;
  <D.5175>:
  D.5176 = (sizetype) length;
  inptr = inptr + D.5176;
  <D.5074>:
  D.5169 = *inptr;
  if (D.5169 != 0) goto <D.5073>; else goto <D.5072>;
  <D.5072>:
  goto <D.5177>;
  <D.5168>:
  goto <D.5077>;
  <D.5076>:
  D.5169 = *inptr;
  if (D.5169 == 0) goto <D.5178>; else goto <D.5179>;
  <D.5178>:
  valid = 0;
  goto <D.5075>;
  <D.5179>:
  D.5169 = *inptr;
  D.5170 = (int) D.5169;
  D.5171 = g_utf8_jump_table[D.5170];
  length = (guint) D.5171;
  D.5180 = max_len - n;
  D.5181 = (long int) length;
  D.5182 = MIN_EXPR <D.5180, D.5181>;
  min = (guint) D.5182;
  D.5183 = (long unsigned int) min;
  D.5184 = utf8_validate (inptr, D.5183);
  if (D.5184 == 0) goto <D.5185>; else goto <D.5186>;
  <D.5185>:
  valid = 0;
  goto <D.5075>;
  <D.5186>:
  if (min < length) goto <D.5187>; else goto <D.5188>;
  <D.5187>:
  valid = 0;
  goto <D.5075>;
  <D.5188>:
  D.5176 = (sizetype) length;
  inptr = inptr + D.5176;
  D.5181 = (long int) length;
  n = D.5181 + n;
  <D.5077>:
  if (n < max_len) goto <D.5076>; else goto <D.5075>;
  <D.5075>:
  <D.5177>:
  if (end != 0B) goto <D.5189>; else goto <D.5190>;
  <D.5189>:
  *end = inptr;
  <D.5190>:
  D.5166 = valid;
  return D.5166;
}


utf8_validate (const unsigned char * inptr, size_t len)
{
  gboolean D.5192;
  signed char c.3;
  unsigned char D.5197;
  const unsigned char * D.5200;
  unsigned char D.5201;
  const unsigned char * D.5206;
  unsigned char D.5207;
  unsigned char D.5217;
  int D.5218;
  const unsigned char * D.5225;
  unsigned char D.5226;
  unsigned char D.5227;
  unsigned char D.5232;
  unsigned char D.5241;
  const unsigned char * ptr;
  unsigned char c;

  ptr = inptr + len;
  switch (len) <default: <D.5050>, case 1: <D.5061>, case 2: <D.5053>, case 3: <D.5052>, case 4: <D.5051>>
  <D.5050>:
  D.5192 = 0;
  return D.5192;
  <D.5051>:
  ptr = ptr + 18446744073709551615;
  c = *ptr;
  c.3 = (signed char) c;
  if (c.3 >= 0) goto <D.5193>; else goto <D.5196>;
  <D.5196>:
  if (c > 191) goto <D.5193>; else goto <D.5194>;
  <D.5193>:
  D.5192 = 0;
  return D.5192;
  <D.5194>:
  D.5197 = c + 66;
  if (D.5197 <= 1) goto <D.5198>; else goto <D.5199>;
  <D.5198>:
  D.5200 = ptr + 18446744073709551615;
  D.5201 = *D.5200;
  if (D.5201 == 191) goto <D.5202>; else goto <D.5203>;
  <D.5202>:
  D.5206 = ptr + 18446744073709551614;
  D.5207 = *D.5206;
  if (D.5207 == 143) goto <D.5204>; else goto <D.5208>;
  <D.5208>:
  D.5206 = ptr + 18446744073709551614;
  D.5207 = *D.5206;
  if (D.5207 == 159) goto <D.5204>; else goto <D.5209>;
  <D.5209>:
  D.5206 = ptr + 18446744073709551614;
  D.5207 = *D.5206;
  if (D.5207 == 175) goto <D.5204>; else goto <D.5210>;
  <D.5210>:
  D.5206 = ptr + 18446744073709551614;
  D.5207 = *D.5206;
  if (D.5207 == 191) goto <D.5204>; else goto <D.5205>;
  <D.5204>:
  D.5192 = 0;
  return D.5192;
  <D.5205>:
  <D.5203>:
  <D.5199>:
  <D.5052>:
  ptr = ptr + 18446744073709551615;
  c = *ptr;
  c.3 = (signed char) c;
  if (c.3 >= 0) goto <D.5211>; else goto <D.5213>;
  <D.5213>:
  if (c > 191) goto <D.5211>; else goto <D.5212>;
  <D.5211>:
  D.5192 = 0;
  return D.5192;
  <D.5212>:
  <D.5053>:
  ptr = ptr + 18446744073709551615;
  c = *ptr;
  c.3 = (signed char) c;
  if (c.3 >= 0) goto <D.5214>; else goto <D.5216>;
  <D.5216>:
  if (c > 191) goto <D.5214>; else goto <D.5215>;
  <D.5214>:
  D.5192 = 0;
  return D.5192;
  <D.5215>:
  D.5217 = *inptr;
  D.5218 = (int) D.5217;
  switch (D.5218) <default: <D.5060>, case 224: <D.5054>, case 237: <D.5056>, case 239: <D.5057>, case 240: <D.5058>, case 244: <D.5059>>
  <D.5054>:
  if (c <= 159) goto <D.5219>; else goto <D.5220>;
  <D.5219>:
  D.5192 = 0;
  return D.5192;
  <D.5220>:
  goto <D.5055>;
  <D.5056>:
  if (c > 159) goto <D.5221>; else goto <D.5222>;
  <D.5221>:
  D.5192 = 0;
  return D.5192;
  <D.5222>:
  goto <D.5055>;
  <D.5057>:
  if (c == 183) goto <D.5223>; else goto <D.5224>;
  <D.5223>:
  D.5225 = ptr + 1;
  D.5226 = *D.5225;
  D.5227 = D.5226 + 112;
  if (D.5227 <= 31) goto <D.5228>; else goto <D.5229>;
  <D.5228>:
  D.5192 = 0;
  return D.5192;
  <D.5229>:
  <D.5224>:
  if (c == 191) goto <D.5230>; else goto <D.5231>;
  <D.5230>:
  D.5225 = ptr + 1;
  D.5226 = *D.5225;
  D.5232 = D.5226 + 66;
  if (D.5232 <= 1) goto <D.5233>; else goto <D.5234>;
  <D.5233>:
  D.5192 = 0;
  return D.5192;
  <D.5234>:
  <D.5231>:
  goto <D.5055>;
  <D.5058>:
  if (c <= 143) goto <D.5235>; else goto <D.5236>;
  <D.5235>:
  D.5192 = 0;
  return D.5192;
  <D.5236>:
  goto <D.5055>;
  <D.5059>:
  if (c > 143) goto <D.5237>; else goto <D.5238>;
  <D.5237>:
  D.5192 = 0;
  return D.5192;
  <D.5238>:
  goto <D.5055>;
  <D.5060>:
  c.3 = (signed char) c;
  if (c.3 >= 0) goto <D.5239>; else goto <D.5240>;
  <D.5239>:
  D.5192 = 0;
  return D.5192;
  <D.5240>:
  goto <D.5055>;
  <D.5055>:
  <D.5061>:
  D.5217 = *inptr;
  D.5241 = D.5217 + 128;
  if (D.5241 <= 65) goto <D.5242>; else goto <D.5243>;
  <D.5242>:
  D.5192 = 0;
  return D.5192;
  <D.5243>:
  D.5217 = *inptr;
  if (D.5217 > 244) goto <D.5244>; else goto <D.5245>;
  <D.5244>:
  D.5192 = 0;
  return D.5192;
  <D.5245>:
  D.5192 = 1;
  return D.5192;
}


monoeg_utf8_get_char_validated (const gchar * str, gssize max_len)
{
  unsigned char D.5247;
  gunichar D.5250;
  long int D.5272;
  long int D.5273;
  long unsigned int D.5274;
  int D.5275;
  long unsigned int D.5281;
  int D.5282;
  unsigned int D.5285;
  unsigned char D.5286;
  unsigned int D.5287;
  unsigned char * inptr;
  gunichar u;
  int n;
  int i;

  inptr = str;
  D.5247 = *inptr;
  u = (gunichar) D.5247;
  if (max_len == 0) goto <D.5248>; else goto <D.5249>;
  <D.5248>:
  D.5250 = 4294967294;
  return D.5250;
  <D.5249>:
  if (u <= 127) goto <D.5251>; else goto <D.5252>;
  <D.5251>:
  D.5250 = u;
  return D.5250;
  <D.5252>:
  if (u <= 193) goto <D.5253>; else goto <D.5254>;
  <D.5253>:
  D.5250 = 4294967295;
  return D.5250;
  <D.5254>:
  if (u <= 223) goto <D.5255>; else goto <D.5256>;
  <D.5255>:
  u = u & 31;
  n = 2;
  goto <D.5257>;
  <D.5256>:
  if (u <= 239) goto <D.5258>; else goto <D.5259>;
  <D.5258>:
  u = u & 15;
  n = 3;
  goto <D.5260>;
  <D.5259>:
  if (u <= 247) goto <D.5261>; else goto <D.5262>;
  <D.5261>:
  u = u & 7;
  n = 4;
  goto <D.5263>;
  <D.5262>:
  if (u <= 251) goto <D.5264>; else goto <D.5265>;
  <D.5264>:
  u = u & 3;
  n = 5;
  goto <D.5266>;
  <D.5265>:
  if (u <= 253) goto <D.5267>; else goto <D.5268>;
  <D.5267>:
  u = u & 1;
  n = 6;
  goto <D.5269>;
  <D.5268>:
  D.5250 = 4294967295;
  return D.5250;
  <D.5269>:
  <D.5266>:
  <D.5263>:
  <D.5260>:
  <D.5257>:
  if (max_len > 0) goto <D.5270>; else goto <D.5271>;
  <D.5270>:
  D.5272 = (long int) n;
  D.5273 = MIN_EXPR <D.5272, max_len>;
  D.5274 = (long unsigned int) D.5273;
  D.5275 = utf8_validate (inptr, D.5274);
  if (D.5275 == 0) goto <D.5276>; else goto <D.5277>;
  <D.5276>:
  D.5250 = 4294967295;
  return D.5250;
  <D.5277>:
  D.5272 = (long int) n;
  if (D.5272 > max_len) goto <D.5278>; else goto <D.5279>;
  <D.5278>:
  D.5250 = 4294967294;
  return D.5250;
  <D.5279>:
  goto <D.5280>;
  <D.5271>:
  D.5281 = (long unsigned int) n;
  D.5282 = utf8_validate (inptr, D.5281);
  if (D.5282 == 0) goto <D.5283>; else goto <D.5284>;
  <D.5283>:
  D.5250 = 4294967295;
  return D.5250;
  <D.5284>:
  <D.5280>:
  i = 1;
  goto <D.5087>;
  <D.5086>:
  D.5285 = u << 6;
  inptr = inptr + 1;
  D.5247 = *inptr;
  D.5286 = D.5247 ^ 128;
  D.5287 = (unsigned int) D.5286;
  u = D.5285 | D.5287;
  i = i + 1;
  <D.5087>:
  if (i < n) goto <D.5086>; else goto <D.5088>;
  <D.5088>:
  D.5250 = u;
  return D.5250;
}


monoeg_g_utf8_strlen (const gchar * str, gssize max_len)
{
  glong D.5291;
  unsigned char D.5294;
  int D.5295;
  unsigned char D.5296;
  sizetype D.5297;
  long int D.5299;
  sizetype n.4;
  const guchar * inptr;
  glong clen;
  glong len;
  glong n;

  inptr = str;
  clen = 0;
  len = 0;
  if (max_len == 0) goto <D.5289>; else goto <D.5290>;
  <D.5289>:
  D.5291 = 0;
  return D.5291;
  <D.5290>:
  if (max_len < 0) goto <D.5292>; else goto <D.5293>;
  <D.5292>:
  goto <D.5098>;
  <D.5097>:
  D.5294 = *inptr;
  D.5295 = (int) D.5294;
  D.5296 = g_utf8_jump_table[D.5295];
  D.5297 = (sizetype) D.5296;
  inptr = inptr + D.5297;
  len = len + 1;
  <D.5098>:
  D.5294 = *inptr;
  if (D.5294 != 0) goto <D.5097>; else goto <D.5099>;
  <D.5099>:
  goto <D.5298>;
  <D.5293>:
  goto <D.5102>;
  <D.5101>:
  D.5294 = *inptr;
  D.5295 = (int) D.5294;
  D.5296 = g_utf8_jump_table[D.5295];
  n = (glong) D.5296;
  D.5299 = clen + n;
  if (D.5299 > max_len) goto <D.5100>; else goto <D.5300>;
  <D.5300>:
  n.4 = (sizetype) n;
  inptr = inptr + n.4;
  clen = clen + n;
  len = len + 1;
  <D.5102>:
  if (len < max_len) goto <D.5302>; else goto <D.5100>;
  <D.5302>:
  D.5294 = *inptr;
  if (D.5294 != 0) goto <D.5101>; else goto <D.5100>;
  <D.5100>:
  <D.5298>:
  D.5291 = len;
  return D.5291;
}


monoeg_g_utf8_get_char (const gchar * src)
{
  unsigned char D.5304;
  gunichar D.5307;
  unsigned int D.5320;
  unsigned char D.5321;
  unsigned int D.5322;
  unsigned char * inptr;
  gunichar u;
  int n;
  int i;

  inptr = src;
  D.5304 = *inptr;
  u = (gunichar) D.5304;
  if (u <= 127) goto <D.5305>; else goto <D.5306>;
  <D.5305>:
  D.5307 = u;
  return D.5307;
  <D.5306>:
  if (u <= 223) goto <D.5308>; else goto <D.5309>;
  <D.5308>:
  u = u & 31;
  n = 2;
  goto <D.5310>;
  <D.5309>:
  if (u <= 239) goto <D.5311>; else goto <D.5312>;
  <D.5311>:
  u = u & 15;
  n = 3;
  goto <D.5313>;
  <D.5312>:
  if (u <= 247) goto <D.5314>; else goto <D.5315>;
  <D.5314>:
  u = u & 7;
  n = 4;
  goto <D.5316>;
  <D.5315>:
  if (u <= 251) goto <D.5317>; else goto <D.5318>;
  <D.5317>:
  u = u & 3;
  n = 5;
  goto <D.5319>;
  <D.5318>:
  u = u & 1;
  n = 6;
  <D.5319>:
  <D.5316>:
  <D.5313>:
  <D.5310>:
  i = 1;
  goto <D.5111>;
  <D.5110>:
  D.5320 = u << 6;
  inptr = inptr + 1;
  D.5304 = *inptr;
  D.5321 = D.5304 ^ 128;
  D.5322 = (unsigned int) D.5321;
  u = D.5320 | D.5322;
  i = i + 1;
  <D.5111>:
  if (i < n) goto <D.5110>; else goto <D.5112>;
  <D.5112>:
  D.5307 = u;
  return D.5307;
}


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

  goto <D.5118>;
  <D.5117>:
  p = p + 18446744073709551615;
  if (1 != 0) goto <D.5324>; else goto <D.5325>;
  <D.5324>:
  D.5326 = p;
  return D.5326;
  <D.5325>:
  <D.5118>:
  if (p > str) goto <D.5117>; else goto <D.5119>;
  <D.5119>:
  D.5326 = 0B;
  return D.5326;
}


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

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


monoeg_g_utf8_offset_to_pointer (const gchar * str, glong offset)
{
  char D.5332;
  int D.5333;
  unsigned char D.5334;
  sizetype D.5335;
  sizetype offset.5;
  gchar * D.5340;
  const gchar * p;

  p = str;
  if (offset > 0) goto <D.5330>; else goto <D.5331>;
  <D.5330>:
  <D.5129>:
  D.5332 = *p;
  D.5333 = (int) D.5332;
  D.5334 = g_utf8_jump_table[D.5333];
  D.5335 = (sizetype) D.5334;
  p = p + D.5335;
  offset = offset + -1;
  if (offset > 0) goto <D.5129>; else goto <D.5130>;
  <D.5130>:
  goto <D.5336>;
  <D.5331>:
  if (offset < 0) goto <D.5337>; else goto <D.5338>;
  <D.5337>:
  {
    const gchar * jump;

    jump = str;
    <D.5135>:
    offset.5 = (sizetype) offset;
    jump = jump + offset.5;
    goto <D.5132>;
    jump = jump + 18446744073709551615;
    <D.5132>:
    p = jump;
    <D.5133>:
    D.5332 = *p;
    D.5333 = (int) D.5332;
    D.5334 = g_utf8_jump_table[D.5333];
    D.5335 = (sizetype) D.5334;
    p = p + D.5335;
    offset = offset + 1;
    if (p < jump) goto <D.5133>; else goto <D.5134>;
    <D.5134>:
    if (offset < 0) goto <D.5135>; else goto <D.5136>;
    <D.5136>:
  }
  <D.5338>:
  <D.5336>:
  D.5340 = p;
  return D.5340;
}


monoeg_g_utf8_pointer_to_offset (const gchar * str, const gchar * pos)
{
  glong D.5344;
  char D.5348;
  int D.5349;
  unsigned char D.5350;
  sizetype D.5351;
  const gchar * inptr;
  const gchar * inend;
  glong offset;
  glong sign;

  offset = 0;
  sign = 1;
  if (pos == str) goto <D.5342>; else goto <D.5343>;
  <D.5342>:
  D.5344 = 0;
  return D.5344;
  <D.5343>:
  if (str < pos) goto <D.5345>; else goto <D.5346>;
  <D.5345>:
  inptr = str;
  inend = pos;
  goto <D.5347>;
  <D.5346>:
  inptr = pos;
  inend = str;
  sign = -1;
  <D.5347>:
  <D.5145>:
  D.5348 = *inptr;
  D.5349 = (int) D.5348;
  D.5350 = g_utf8_jump_table[D.5349];
  D.5351 = (sizetype) D.5350;
  inptr = inptr + D.5351;
  offset = offset + 1;
  if (inptr < inend) goto <D.5145>; else goto <D.5146>;
  <D.5146>:
  D.5344 = offset * sign;
  return D.5344;
}


