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

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


utf8_case_conv (const gchar * str, gssize len, gboolean upper)
{
  unsigned int i.0;
  unsigned int D.4718;
  gunichar * D.4719;
  gunichar iftmp.1;
  unsigned int D.4723;
  long int ulen.2;
  gchar * D.4726;
  gunichar * ustr;
  glong i;
  glong ulen;
  gchar * utf8;

  try
    {
      ustr = monoeg_g_utf8_to_ucs4_fast (str, len, &ulen);
      i = 0;
      goto <D.4601>;
      <D.4600>:
      i.0 = (unsigned int) i;
      D.4718 = i.0 * 4;
      D.4719 = ustr + D.4718;
      if (upper != 0) goto <D.4721>; else goto <D.4722>;
      <D.4721>:
      i.0 = (unsigned int) i;
      D.4718 = i.0 * 4;
      D.4719 = ustr + D.4718;
      D.4723 = *D.4719;
      iftmp.1 = monoeg_g_unichar_toupper (D.4723);
      goto <D.4724>;
      <D.4722>:
      i.0 = (unsigned int) i;
      D.4718 = i.0 * 4;
      D.4719 = ustr + D.4718;
      D.4723 = *D.4719;
      iftmp.1 = monoeg_g_unichar_tolower (D.4723);
      <D.4724>:
      *D.4719 = iftmp.1;
      i = i + 1;
      <D.4601>:
      ulen.2 = ulen;
      if (i < ulen.2) goto <D.4600>; else goto <D.4602>;
      <D.4602>:
      ulen.2 = ulen;
      utf8 = monoeg_g_ucs4_to_utf8 (ustr, ulen.2, 0B, 0B, 0B);
      monoeg_g_free (ustr);
      D.4726 = utf8;
      return D.4726;
    }
  finally
    {
      ulen = {CLOBBER};
    }
}


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

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


monoeg_g_utf8_validate (const gchar * str, gssize max_len, const gchar * * end)
{
  gboolean D.4733;
  unsigned char D.4736;
  int D.4737;
  unsigned char D.4738;
  int D.4739;
  int D.4745;
  unsigned int D.4746;
  int D.4747;
  unsigned int n.3;
  unsigned int D.4753;
  guchar * inptr;
  gboolean valid;
  guint length;
  guint min;
  gssize n;

  inptr = str;
  valid = 1;
  n = 0;
  if (max_len == 0) goto <D.4731>; else goto <D.4732>;
  <D.4731>:
  D.4733 = 0;
  return D.4733;
  <D.4732>:
  if (max_len < 0) goto <D.4734>; else goto <D.4735>;
  <D.4734>:
  goto <D.4641>;
  <D.4640>:
  D.4736 = *inptr;
  D.4737 = (int) D.4736;
  D.4738 = g_utf8_jump_table[D.4737];
  length = (guint) D.4738;
  D.4739 = utf8_validate (inptr, length);
  if (D.4739 == 0) goto <D.4740>; else goto <D.4741>;
  <D.4740>:
  valid = 0;
  goto <D.4639>;
  <D.4741>:
  inptr = inptr + length;
  <D.4641>:
  D.4736 = *inptr;
  if (D.4736 != 0) goto <D.4640>; else goto <D.4639>;
  <D.4639>:
  goto <D.4742>;
  <D.4735>:
  goto <D.4644>;
  <D.4643>:
  D.4736 = *inptr;
  if (D.4736 == 0) goto <D.4743>; else goto <D.4744>;
  <D.4743>:
  valid = 0;
  goto <D.4642>;
  <D.4744>:
  D.4736 = *inptr;
  D.4737 = (int) D.4736;
  D.4738 = g_utf8_jump_table[D.4737];
  length = (guint) D.4738;
  D.4745 = max_len - n;
  D.4746 = (unsigned int) D.4745;
  min = MIN_EXPR <D.4746, length>;
  D.4747 = utf8_validate (inptr, min);
  if (D.4747 == 0) goto <D.4748>; else goto <D.4749>;
  <D.4748>:
  valid = 0;
  goto <D.4642>;
  <D.4749>:
  if (min < length) goto <D.4750>; else goto <D.4751>;
  <D.4750>:
  valid = 0;
  goto <D.4642>;
  <D.4751>:
  inptr = inptr + length;
  n.3 = (unsigned int) n;
  D.4753 = n.3 + length;
  n = (gssize) D.4753;
  <D.4644>:
  if (n < max_len) goto <D.4643>; else goto <D.4642>;
  <D.4642>:
  <D.4742>:
  if (end != 0B) goto <D.4754>; else goto <D.4755>;
  <D.4754>:
  *end = inptr;
  <D.4755>:
  D.4733 = valid;
  return D.4733;
}


utf8_validate (const unsigned char * inptr, size_t len)
{
  gboolean D.4757;
  signed char c.4;
  unsigned char D.4762;
  const unsigned char * D.4765;
  unsigned char D.4766;
  const unsigned char * D.4771;
  unsigned char D.4772;
  unsigned char D.4782;
  int D.4783;
  const unsigned char * D.4790;
  unsigned char D.4791;
  unsigned char D.4792;
  unsigned char D.4797;
  unsigned char D.4806;
  const unsigned char * ptr;
  unsigned char c;

  ptr = inptr + len;
  switch (len) <default: <D.4617>, case 1: <D.4628>, case 2: <D.4620>, case 3: <D.4619>, case 4: <D.4618>>
  <D.4617>:
  D.4757 = 0;
  return D.4757;
  <D.4618>:
  ptr = ptr + 4294967295;
  c = *ptr;
  c.4 = (signed char) c;
  if (c.4 >= 0) goto <D.4758>; else goto <D.4761>;
  <D.4761>:
  if (c > 191) goto <D.4758>; else goto <D.4759>;
  <D.4758>:
  D.4757 = 0;
  return D.4757;
  <D.4759>:
  D.4762 = c + 66;
  if (D.4762 <= 1) goto <D.4763>; else goto <D.4764>;
  <D.4763>:
  D.4765 = ptr + 4294967295;
  D.4766 = *D.4765;
  if (D.4766 == 191) goto <D.4767>; else goto <D.4768>;
  <D.4767>:
  D.4771 = ptr + 4294967294;
  D.4772 = *D.4771;
  if (D.4772 == 143) goto <D.4769>; else goto <D.4773>;
  <D.4773>:
  D.4771 = ptr + 4294967294;
  D.4772 = *D.4771;
  if (D.4772 == 159) goto <D.4769>; else goto <D.4774>;
  <D.4774>:
  D.4771 = ptr + 4294967294;
  D.4772 = *D.4771;
  if (D.4772 == 175) goto <D.4769>; else goto <D.4775>;
  <D.4775>:
  D.4771 = ptr + 4294967294;
  D.4772 = *D.4771;
  if (D.4772 == 191) goto <D.4769>; else goto <D.4770>;
  <D.4769>:
  D.4757 = 0;
  return D.4757;
  <D.4770>:
  <D.4768>:
  <D.4764>:
  <D.4619>:
  ptr = ptr + 4294967295;
  c = *ptr;
  c.4 = (signed char) c;
  if (c.4 >= 0) goto <D.4776>; else goto <D.4778>;
  <D.4778>:
  if (c > 191) goto <D.4776>; else goto <D.4777>;
  <D.4776>:
  D.4757 = 0;
  return D.4757;
  <D.4777>:
  <D.4620>:
  ptr = ptr + 4294967295;
  c = *ptr;
  c.4 = (signed char) c;
  if (c.4 >= 0) goto <D.4779>; else goto <D.4781>;
  <D.4781>:
  if (c > 191) goto <D.4779>; else goto <D.4780>;
  <D.4779>:
  D.4757 = 0;
  return D.4757;
  <D.4780>:
  D.4782 = *inptr;
  D.4783 = (int) D.4782;
  switch (D.4783) <default: <D.4627>, case 224: <D.4621>, case 237: <D.4623>, case 239: <D.4624>, case 240: <D.4625>, case 244: <D.4626>>
  <D.4621>:
  if (c <= 159) goto <D.4784>; else goto <D.4785>;
  <D.4784>:
  D.4757 = 0;
  return D.4757;
  <D.4785>:
  goto <D.4622>;
  <D.4623>:
  if (c > 159) goto <D.4786>; else goto <D.4787>;
  <D.4786>:
  D.4757 = 0;
  return D.4757;
  <D.4787>:
  goto <D.4622>;
  <D.4624>:
  if (c == 183) goto <D.4788>; else goto <D.4789>;
  <D.4788>:
  D.4790 = ptr + 1;
  D.4791 = *D.4790;
  D.4792 = D.4791 + 112;
  if (D.4792 <= 31) goto <D.4793>; else goto <D.4794>;
  <D.4793>:
  D.4757 = 0;
  return D.4757;
  <D.4794>:
  <D.4789>:
  if (c == 191) goto <D.4795>; else goto <D.4796>;
  <D.4795>:
  D.4790 = ptr + 1;
  D.4791 = *D.4790;
  D.4797 = D.4791 + 66;
  if (D.4797 <= 1) goto <D.4798>; else goto <D.4799>;
  <D.4798>:
  D.4757 = 0;
  return D.4757;
  <D.4799>:
  <D.4796>:
  goto <D.4622>;
  <D.4625>:
  if (c <= 143) goto <D.4800>; else goto <D.4801>;
  <D.4800>:
  D.4757 = 0;
  return D.4757;
  <D.4801>:
  goto <D.4622>;
  <D.4626>:
  if (c > 143) goto <D.4802>; else goto <D.4803>;
  <D.4802>:
  D.4757 = 0;
  return D.4757;
  <D.4803>:
  goto <D.4622>;
  <D.4627>:
  c.4 = (signed char) c;
  if (c.4 >= 0) goto <D.4804>; else goto <D.4805>;
  <D.4804>:
  D.4757 = 0;
  return D.4757;
  <D.4805>:
  goto <D.4622>;
  <D.4622>:
  <D.4628>:
  D.4782 = *inptr;
  D.4806 = D.4782 + 128;
  if (D.4806 <= 65) goto <D.4807>; else goto <D.4808>;
  <D.4807>:
  D.4757 = 0;
  return D.4757;
  <D.4808>:
  D.4782 = *inptr;
  if (D.4782 > 244) goto <D.4809>; else goto <D.4810>;
  <D.4809>:
  D.4757 = 0;
  return D.4757;
  <D.4810>:
  D.4757 = 1;
  return D.4757;
}


monoeg_utf8_get_char_validated (const gchar * str, gssize max_len)
{
  unsigned char D.4812;
  gunichar D.4815;
  int D.4837;
  unsigned int D.4838;
  int D.4839;
  unsigned int n.5;
  int D.4846;
  unsigned int D.4849;
  unsigned char D.4850;
  unsigned int D.4851;
  unsigned char * inptr;
  gunichar u;
  int n;
  int i;

  inptr = str;
  D.4812 = *inptr;
  u = (gunichar) D.4812;
  if (max_len == 0) goto <D.4813>; else goto <D.4814>;
  <D.4813>:
  D.4815 = 4294967294;
  return D.4815;
  <D.4814>:
  if (u <= 127) goto <D.4816>; else goto <D.4817>;
  <D.4816>:
  D.4815 = u;
  return D.4815;
  <D.4817>:
  if (u <= 193) goto <D.4818>; else goto <D.4819>;
  <D.4818>:
  D.4815 = 4294967295;
  return D.4815;
  <D.4819>:
  if (u <= 223) goto <D.4820>; else goto <D.4821>;
  <D.4820>:
  u = u & 31;
  n = 2;
  goto <D.4822>;
  <D.4821>:
  if (u <= 239) goto <D.4823>; else goto <D.4824>;
  <D.4823>:
  u = u & 15;
  n = 3;
  goto <D.4825>;
  <D.4824>:
  if (u <= 247) goto <D.4826>; else goto <D.4827>;
  <D.4826>:
  u = u & 7;
  n = 4;
  goto <D.4828>;
  <D.4827>:
  if (u <= 251) goto <D.4829>; else goto <D.4830>;
  <D.4829>:
  u = u & 3;
  n = 5;
  goto <D.4831>;
  <D.4830>:
  if (u <= 253) goto <D.4832>; else goto <D.4833>;
  <D.4832>:
  u = u & 1;
  n = 6;
  goto <D.4834>;
  <D.4833>:
  D.4815 = 4294967295;
  return D.4815;
  <D.4834>:
  <D.4831>:
  <D.4828>:
  <D.4825>:
  <D.4822>:
  if (max_len > 0) goto <D.4835>; else goto <D.4836>;
  <D.4835>:
  D.4837 = MIN_EXPR <n, max_len>;
  D.4838 = (unsigned int) D.4837;
  D.4839 = utf8_validate (inptr, D.4838);
  if (D.4839 == 0) goto <D.4840>; else goto <D.4841>;
  <D.4840>:
  D.4815 = 4294967295;
  return D.4815;
  <D.4841>:
  if (max_len < n) goto <D.4842>; else goto <D.4843>;
  <D.4842>:
  D.4815 = 4294967294;
  return D.4815;
  <D.4843>:
  goto <D.4844>;
  <D.4836>:
  n.5 = (unsigned int) n;
  D.4846 = utf8_validate (inptr, n.5);
  if (D.4846 == 0) goto <D.4847>; else goto <D.4848>;
  <D.4847>:
  D.4815 = 4294967295;
  return D.4815;
  <D.4848>:
  <D.4844>:
  i = 1;
  goto <D.4654>;
  <D.4653>:
  D.4849 = u << 6;
  inptr = inptr + 1;
  D.4812 = *inptr;
  D.4850 = D.4812 ^ 128;
  D.4851 = (unsigned int) D.4850;
  u = D.4849 | D.4851;
  i = i + 1;
  <D.4654>:
  if (i < n) goto <D.4653>; else goto <D.4655>;
  <D.4655>:
  D.4815 = u;
  return D.4815;
}


monoeg_g_utf8_strlen (const gchar * str, gssize max_len)
{
  glong D.4855;
  unsigned char D.4858;
  int D.4859;
  unsigned char D.4860;
  sizetype D.4861;
  long int D.4863;
  sizetype n.6;
  const guchar * inptr;
  glong clen;
  glong len;
  glong n;

  inptr = str;
  clen = 0;
  len = 0;
  if (max_len == 0) goto <D.4853>; else goto <D.4854>;
  <D.4853>:
  D.4855 = 0;
  return D.4855;
  <D.4854>:
  if (max_len < 0) goto <D.4856>; else goto <D.4857>;
  <D.4856>:
  goto <D.4665>;
  <D.4664>:
  D.4858 = *inptr;
  D.4859 = (int) D.4858;
  D.4860 = g_utf8_jump_table[D.4859];
  D.4861 = (sizetype) D.4860;
  inptr = inptr + D.4861;
  len = len + 1;
  <D.4665>:
  D.4858 = *inptr;
  if (D.4858 != 0) goto <D.4664>; else goto <D.4666>;
  <D.4666>:
  goto <D.4862>;
  <D.4857>:
  goto <D.4669>;
  <D.4668>:
  D.4858 = *inptr;
  D.4859 = (int) D.4858;
  D.4860 = g_utf8_jump_table[D.4859];
  n = (glong) D.4860;
  D.4863 = clen + n;
  if (D.4863 > max_len) goto <D.4667>; else goto <D.4864>;
  <D.4864>:
  n.6 = (sizetype) n;
  inptr = inptr + n.6;
  clen = clen + n;
  len = len + 1;
  <D.4669>:
  if (len < max_len) goto <D.4866>; else goto <D.4667>;
  <D.4866>:
  D.4858 = *inptr;
  if (D.4858 != 0) goto <D.4668>; else goto <D.4667>;
  <D.4667>:
  <D.4862>:
  D.4855 = len;
  return D.4855;
}


monoeg_g_utf8_get_char (const gchar * src)
{
  unsigned char D.4868;
  gunichar D.4871;
  unsigned int D.4884;
  unsigned char D.4885;
  unsigned int D.4886;
  unsigned char * inptr;
  gunichar u;
  int n;
  int i;

  inptr = src;
  D.4868 = *inptr;
  u = (gunichar) D.4868;
  if (u <= 127) goto <D.4869>; else goto <D.4870>;
  <D.4869>:
  D.4871 = u;
  return D.4871;
  <D.4870>:
  if (u <= 223) goto <D.4872>; else goto <D.4873>;
  <D.4872>:
  u = u & 31;
  n = 2;
  goto <D.4874>;
  <D.4873>:
  if (u <= 239) goto <D.4875>; else goto <D.4876>;
  <D.4875>:
  u = u & 15;
  n = 3;
  goto <D.4877>;
  <D.4876>:
  if (u <= 247) goto <D.4878>; else goto <D.4879>;
  <D.4878>:
  u = u & 7;
  n = 4;
  goto <D.4880>;
  <D.4879>:
  if (u <= 251) goto <D.4881>; else goto <D.4882>;
  <D.4881>:
  u = u & 3;
  n = 5;
  goto <D.4883>;
  <D.4882>:
  u = u & 1;
  n = 6;
  <D.4883>:
  <D.4880>:
  <D.4877>:
  <D.4874>:
  i = 1;
  goto <D.4678>;
  <D.4677>:
  D.4884 = u << 6;
  inptr = inptr + 1;
  D.4868 = *inptr;
  D.4885 = D.4868 ^ 128;
  D.4886 = (unsigned int) D.4885;
  u = D.4884 | D.4886;
  i = i + 1;
  <D.4678>:
  if (i < n) goto <D.4677>; else goto <D.4679>;
  <D.4679>:
  D.4871 = u;
  return D.4871;
}


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

  goto <D.4685>;
  <D.4684>:
  p = p + 4294967295;
  if (1 != 0) goto <D.4888>; else goto <D.4889>;
  <D.4888>:
  D.4890 = p;
  return D.4890;
  <D.4889>:
  <D.4685>:
  if (p > str) goto <D.4684>; else goto <D.4686>;
  <D.4686>:
  D.4890 = 0B;
  return D.4890;
}


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

  p = str;
  p = p + 4294967295;
  D.4892 = p;
  return D.4892;
}


monoeg_g_utf8_offset_to_pointer (const gchar * str, glong offset)
{
  char D.4896;
  unsigned char D.4897;
  int D.4898;
  unsigned char D.4899;
  sizetype D.4900;
  sizetype offset.7;
  gchar * D.4905;
  const gchar * p;

  p = str;
  if (offset > 0) goto <D.4894>; else goto <D.4895>;
  <D.4894>:
  <D.4696>:
  D.4896 = *p;
  D.4897 = (unsigned char) D.4896;
  D.4898 = (int) D.4897;
  D.4899 = g_utf8_jump_table[D.4898];
  D.4900 = (sizetype) D.4899;
  p = p + D.4900;
  offset = offset + -1;
  if (offset > 0) goto <D.4696>; else goto <D.4697>;
  <D.4697>:
  goto <D.4901>;
  <D.4895>:
  if (offset < 0) goto <D.4902>; else goto <D.4903>;
  <D.4902>:
  {
    const gchar * jump;

    jump = str;
    <D.4702>:
    offset.7 = (sizetype) offset;
    jump = jump + offset.7;
    goto <D.4699>;
    jump = jump + 4294967295;
    <D.4699>:
    p = jump;
    <D.4700>:
    D.4896 = *p;
    D.4897 = (unsigned char) D.4896;
    D.4898 = (int) D.4897;
    D.4899 = g_utf8_jump_table[D.4898];
    D.4900 = (sizetype) D.4899;
    p = p + D.4900;
    offset = offset + 1;
    if (p < jump) goto <D.4700>; else goto <D.4701>;
    <D.4701>:
    if (offset < 0) goto <D.4702>; else goto <D.4703>;
    <D.4703>:
  }
  <D.4903>:
  <D.4901>:
  D.4905 = p;
  return D.4905;
}


monoeg_g_utf8_pointer_to_offset (const gchar * str, const gchar * pos)
{
  glong D.4909;
  char D.4913;
  unsigned char D.4914;
  int D.4915;
  unsigned char D.4916;
  sizetype D.4917;
  const gchar * inptr;
  const gchar * inend;
  glong offset;
  glong sign;

  offset = 0;
  sign = 1;
  if (pos == str) goto <D.4907>; else goto <D.4908>;
  <D.4907>:
  D.4909 = 0;
  return D.4909;
  <D.4908>:
  if (str < pos) goto <D.4910>; else goto <D.4911>;
  <D.4910>:
  inptr = str;
  inend = pos;
  goto <D.4912>;
  <D.4911>:
  inptr = pos;
  inend = str;
  sign = -1;
  <D.4912>:
  <D.4712>:
  D.4913 = *inptr;
  D.4914 = (unsigned char) D.4913;
  D.4915 = (int) D.4914;
  D.4916 = g_utf8_jump_table[D.4915];
  D.4917 = (sizetype) D.4916;
  inptr = inptr + D.4917;
  offset = offset + 1;
  if (inptr < inend) goto <D.4712>; else goto <D.4713>;
  <D.4713>:
  D.4909 = offset * sign;
  return D.4909;
}


