mono_unicode_from_external (const gchar * in, gsize * bytes)
{
  gunichar2 * D.5583;
  int D.5480;
  int iftmp.0;
  int D.5479;
  long unsigned int D.5589;
  long unsigned int D.5590;
  gchar * * D.5591;
  const char[15] * D.5592;
  unsigned char D.5593;
  int D.5594;
  unsigned char D.5595;
  int D.5596;
  const unsigned char * D.5601;
  unsigned char D.5602;
  int D.5603;
  const unsigned char * D.5604;
  unsigned char D.5605;
  int D.5606;
  const unsigned char * D.5611;
  unsigned char D.5612;
  int D.5613;
  const unsigned char * D.5614;
  unsigned char D.5615;
  int D.5616;
  const unsigned char * D.5621;
  unsigned char D.5622;
  int D.5623;
  const unsigned char * D.5624;
  unsigned char D.5625;
  int D.5626;
  gchar * D.5628;
  long int lbytes.1;
  long unsigned int lbytes.2;
  long unsigned int D.5636;
  long int D.5637;
  long unsigned int D.5642;
  long unsigned int D.5643;
  int D.5644;
  gchar * res;
  gchar * * encodings;
  const gchar * encoding_list;
  int i;
  glong lbytes;

  try
    {
      res = 0B;
      if (in == 0B) goto <D.5581>; else goto <D.5582>;
      <D.5581>:
      D.5583 = 0B;
      return D.5583;
      <D.5582>:
      encoding_list = monoeg_g_getenv ("MONO_EXTERNAL_ENCODINGS");
      if (encoding_list == 0B) goto <D.5584>; else goto <D.5585>;
      <D.5584>:
      encoding_list = "";
      <D.5585>:
      encodings = monoeg_g_strsplit (encoding_list, ":", 0);
      i = 0;
      goto <D.5484>;
      <D.5483>:
      {
        size_t __s1_len;
        size_t __s2_len;

        __s2_len = 14;
        if (__s2_len <= 3) goto <D.5587>; else goto <D.5588>;
        <D.5587>:
        {
          const unsigned char * __s2;
          int __result;

          D.5589 = (long unsigned int) i;
          D.5590 = D.5589 * 8;
          D.5591 = encodings + D.5590;
          __s2 = *D.5591;
          D.5592 = "default_locale";
          D.5593 = MEM[(const unsigned char *)D.5592];
          D.5594 = (int) D.5593;
          D.5595 = *__s2;
          D.5596 = (int) D.5595;
          __result = D.5594 - D.5596;
          {
            if (__s2_len != 0) goto <D.5597>; else goto <D.5598>;
            <D.5597>:
            if (__result == 0) goto <D.5599>; else goto <D.5600>;
            <D.5599>:
            D.5601 = &MEM[(void *)"default_locale" + 1B];
            D.5602 = *D.5601;
            D.5603 = (int) D.5602;
            D.5604 = __s2 + 1;
            D.5605 = *D.5604;
            D.5606 = (int) D.5605;
            __result = D.5603 - D.5606;
            if (__s2_len > 1) goto <D.5607>; else goto <D.5608>;
            <D.5607>:
            if (__result == 0) goto <D.5609>; else goto <D.5610>;
            <D.5609>:
            D.5611 = &MEM[(void *)"default_locale" + 2B];
            D.5612 = *D.5611;
            D.5613 = (int) D.5612;
            D.5614 = __s2 + 2;
            D.5615 = *D.5614;
            D.5616 = (int) D.5615;
            __result = D.5613 - D.5616;
            if (__s2_len > 2) goto <D.5617>; else goto <D.5618>;
            <D.5617>:
            if (__result == 0) goto <D.5619>; else goto <D.5620>;
            <D.5619>:
            D.5621 = &MEM[(void *)"default_locale" + 3B];
            D.5622 = *D.5621;
            D.5623 = (int) D.5622;
            D.5624 = __s2 + 3;
            D.5625 = *D.5624;
            D.5626 = (int) D.5625;
            __result = D.5623 - D.5626;
            <D.5620>:
            <D.5618>:
            <D.5610>:
            <D.5608>:
            <D.5600>:
            <D.5598>:
          }
          D.5479 = __result;
        }
        iftmp.0 = -D.5479;
        goto <D.5627>;
        <D.5588>:
        D.5589 = (long unsigned int) i;
        D.5590 = D.5589 * 8;
        D.5591 = encodings + D.5590;
        D.5628 = *D.5591;
        iftmp.0 = __builtin_strcmp (D.5628, "default_locale");
        <D.5627>:
        D.5480 = iftmp.0;
      }
      if (D.5480 == 0) goto <D.5629>; else goto <D.5630>;
      <D.5629>:
      {
        gchar * utf8;

        utf8 = monoeg_g_locale_to_utf8 (in, -1, 0B, 0B, 0B);
        if (utf8 != 0B) goto <D.5631>; else goto <D.5632>;
        <D.5631>:
        res = monoeg_g_utf8_to_utf16 (utf8, -1, 0B, &lbytes, 0B);
        lbytes.1 = lbytes;
        lbytes.2 = (long unsigned int) lbytes.1;
        *bytes = lbytes.2;
        <D.5632>:
        monoeg_g_free (utf8);
      }
      goto <D.5635>;
      <D.5630>:
      D.5636 = strlen (in);
      D.5637 = (long int) D.5636;
      D.5589 = (long unsigned int) i;
      D.5590 = D.5589 * 8;
      D.5591 = encodings + D.5590;
      D.5628 = *D.5591;
      res = monoeg_g_convert (in, D.5637, "UTF8", D.5628, 0B, bytes, 0B);
      if (res != 0B) goto <D.5638>; else goto <D.5639>;
      <D.5638>:
      {
        gchar * ptr;

        ptr = res;
        res = monoeg_g_utf8_to_utf16 (res, -1, 0B, &lbytes, 0B);
        lbytes.1 = lbytes;
        lbytes.2 = (long unsigned int) lbytes.1;
        *bytes = lbytes.2;
        monoeg_g_free (ptr);
      }
      <D.5639>:
      <D.5635>:
      if (res != 0B) goto <D.5640>; else goto <D.5641>;
      <D.5640>:
      monoeg_g_strfreev (encodings);
      D.5642 = *bytes;
      D.5643 = D.5642 * 2;
      *bytes = D.5643;
      D.5583 = res;
      return D.5583;
      <D.5641>:
      i = i + 1;
      <D.5484>:
      D.5589 = (long unsigned int) i;
      D.5590 = D.5589 * 8;
      D.5591 = encodings + D.5590;
      D.5628 = *D.5591;
      if (D.5628 != 0B) goto <D.5483>; else goto <D.5485>;
      <D.5485>:
      monoeg_g_strfreev (encodings);
      D.5644 = monoeg_g_utf8_validate (in, -1, 0B);
      if (D.5644 != 0) goto <D.5645>; else goto <D.5646>;
      <D.5645>:
      {
        gunichar2 * unires;

        unires = monoeg_g_utf8_to_utf16 (in, -1, 0B, bytes, 0B);
        D.5642 = *bytes;
        D.5643 = D.5642 * 2;
        *bytes = D.5643;
        D.5583 = unires;
        return D.5583;
      }
      <D.5646>:
      D.5583 = 0B;
      return D.5583;
    }
  finally
    {
      lbytes = {CLOBBER};
    }
}


mono_utf8_from_external (const gchar * in)
{
  gchar * D.5651;
  int D.5502;
  int iftmp.3;
  int D.5501;
  long unsigned int D.5657;
  long unsigned int D.5658;
  gchar * * D.5659;
  const char[15] * D.5660;
  unsigned char D.5661;
  int D.5662;
  unsigned char D.5663;
  int D.5664;
  const unsigned char * D.5669;
  unsigned char D.5670;
  int D.5671;
  const unsigned char * D.5672;
  unsigned char D.5673;
  int D.5674;
  const unsigned char * D.5679;
  unsigned char D.5680;
  int D.5681;
  const unsigned char * D.5682;
  unsigned char D.5683;
  int D.5684;
  const unsigned char * D.5689;
  unsigned char D.5690;
  int D.5691;
  const unsigned char * D.5692;
  unsigned char D.5693;
  int D.5694;
  gchar * D.5696;
  int D.5701;
  int D.5707;
  gchar * res;
  gchar * * encodings;
  const gchar * encoding_list;
  int i;

  res = 0B;
  if (in == 0B) goto <D.5649>; else goto <D.5650>;
  <D.5649>:
  D.5651 = 0B;
  return D.5651;
  <D.5650>:
  encoding_list = monoeg_g_getenv ("MONO_EXTERNAL_ENCODINGS");
  if (encoding_list == 0B) goto <D.5652>; else goto <D.5653>;
  <D.5652>:
  encoding_list = "";
  <D.5653>:
  encodings = monoeg_g_strsplit (encoding_list, ":", 0);
  i = 0;
  goto <D.5504>;
  <D.5503>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 14;
    if (__s2_len <= 3) goto <D.5655>; else goto <D.5656>;
    <D.5655>:
    {
      const unsigned char * __s2;
      int __result;

      D.5657 = (long unsigned int) i;
      D.5658 = D.5657 * 8;
      D.5659 = encodings + D.5658;
      __s2 = *D.5659;
      D.5660 = "default_locale";
      D.5661 = MEM[(const unsigned char *)D.5660];
      D.5662 = (int) D.5661;
      D.5663 = *__s2;
      D.5664 = (int) D.5663;
      __result = D.5662 - D.5664;
      {
        if (__s2_len != 0) goto <D.5665>; else goto <D.5666>;
        <D.5665>:
        if (__result == 0) goto <D.5667>; else goto <D.5668>;
        <D.5667>:
        D.5669 = &MEM[(void *)"default_locale" + 1B];
        D.5670 = *D.5669;
        D.5671 = (int) D.5670;
        D.5672 = __s2 + 1;
        D.5673 = *D.5672;
        D.5674 = (int) D.5673;
        __result = D.5671 - D.5674;
        if (__s2_len > 1) goto <D.5675>; else goto <D.5676>;
        <D.5675>:
        if (__result == 0) goto <D.5677>; else goto <D.5678>;
        <D.5677>:
        D.5679 = &MEM[(void *)"default_locale" + 2B];
        D.5680 = *D.5679;
        D.5681 = (int) D.5680;
        D.5682 = __s2 + 2;
        D.5683 = *D.5682;
        D.5684 = (int) D.5683;
        __result = D.5681 - D.5684;
        if (__s2_len > 2) goto <D.5685>; else goto <D.5686>;
        <D.5685>:
        if (__result == 0) goto <D.5687>; else goto <D.5688>;
        <D.5687>:
        D.5689 = &MEM[(void *)"default_locale" + 3B];
        D.5690 = *D.5689;
        D.5691 = (int) D.5690;
        D.5692 = __s2 + 3;
        D.5693 = *D.5692;
        D.5694 = (int) D.5693;
        __result = D.5691 - D.5694;
        <D.5688>:
        <D.5686>:
        <D.5678>:
        <D.5676>:
        <D.5668>:
        <D.5666>:
      }
      D.5501 = __result;
    }
    iftmp.3 = -D.5501;
    goto <D.5695>;
    <D.5656>:
    D.5657 = (long unsigned int) i;
    D.5658 = D.5657 * 8;
    D.5659 = encodings + D.5658;
    D.5696 = *D.5659;
    iftmp.3 = __builtin_strcmp (D.5696, "default_locale");
    <D.5695>:
    D.5502 = iftmp.3;
  }
  if (D.5502 == 0) goto <D.5697>; else goto <D.5698>;
  <D.5697>:
  res = monoeg_g_locale_to_utf8 (in, -1, 0B, 0B, 0B);
  if (res != 0B) goto <D.5699>; else goto <D.5700>;
  <D.5699>:
  D.5701 = monoeg_g_utf8_validate (res, -1, 0B);
  if (D.5701 == 0) goto <D.5702>; else goto <D.5703>;
  <D.5702>:
  monoeg_g_free (res);
  res = 0B;
  <D.5703>:
  <D.5700>:
  goto <D.5704>;
  <D.5698>:
  D.5657 = (long unsigned int) i;
  D.5658 = D.5657 * 8;
  D.5659 = encodings + D.5658;
  D.5696 = *D.5659;
  res = monoeg_g_convert (in, -1, "UTF8", D.5696, 0B, 0B, 0B);
  <D.5704>:
  if (res != 0B) goto <D.5705>; else goto <D.5706>;
  <D.5705>:
  monoeg_g_strfreev (encodings);
  D.5651 = res;
  return D.5651;
  <D.5706>:
  i = i + 1;
  <D.5504>:
  D.5657 = (long unsigned int) i;
  D.5658 = D.5657 * 8;
  D.5659 = encodings + D.5658;
  D.5696 = *D.5659;
  if (D.5696 != 0B) goto <D.5503>; else goto <D.5505>;
  <D.5505>:
  monoeg_g_strfreev (encodings);
  D.5707 = monoeg_g_utf8_validate (in, -1, 0B);
  if (D.5707 != 0) goto <D.5708>; else goto <D.5709>;
  <D.5708>:
  D.5651 = monoeg_strdup (in);
  return D.5651;
  <D.5709>:
  D.5651 = 0B;
  return D.5651;
}


monoeg_strdup (const gchar * str)
{
  gchar * D.5713;

  if (str != 0B) goto <D.5711>; else goto <D.5712>;
  <D.5711>:
  D.5713 = __strdup (str);
  return D.5713;
  <D.5712>:
  D.5713 = 0B;
  return D.5713;
}


mono_unicode_to_external (const gunichar2 * uni)
{
  _Bool D.5715;
  long int D.5716;
  long int D.5717;
  gchar * D.5722;
  int D.5522;
  int iftmp.4;
  int D.5521;
  long unsigned int D.5726;
  long unsigned int D.5727;
  gchar * * D.5728;
  const char[15] * D.5729;
  unsigned char D.5730;
  int D.5731;
  unsigned char D.5732;
  int D.5733;
  const unsigned char * D.5738;
  unsigned char D.5739;
  int D.5740;
  const unsigned char * D.5741;
  unsigned char D.5742;
  int D.5743;
  const unsigned char * D.5748;
  unsigned char D.5749;
  int D.5750;
  const unsigned char * D.5751;
  unsigned char D.5752;
  int D.5753;
  const unsigned char * D.5758;
  unsigned char D.5759;
  int D.5760;
  const unsigned char * D.5761;
  unsigned char D.5762;
  int D.5763;
  gchar * D.5765;
  gchar * utf8;
  const gchar * encoding_list;

  utf8 = monoeg_g_utf16_to_utf8 (uni, -1, 0B, 0B, 0B);
  D.5715 = utf8 == 0B;
  D.5716 = (long int) D.5715;
  D.5717 = __builtin_expect (D.5716, 0);
  if (D.5717 != 0) goto <D.5718>; else goto <D.5719>;
  <D.5718>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "strenc.c", 183, "utf8!=NULL");
  <D.5719>:
  encoding_list = monoeg_g_getenv ("MONO_EXTERNAL_ENCODINGS");
  if (encoding_list == 0B) goto <D.5720>; else goto <D.5721>;
  <D.5720>:
  D.5722 = utf8;
  return D.5722;
  <D.5721>:
  {
    gchar * res;
    gchar * * encodings;
    int i;

    encodings = monoeg_g_strsplit (encoding_list, ":", 0);
    i = 0;
    goto <D.5524>;
    <D.5523>:
    {
      size_t __s1_len;
      size_t __s2_len;

      __s2_len = 14;
      if (__s2_len <= 3) goto <D.5724>; else goto <D.5725>;
      <D.5724>:
      {
        const unsigned char * __s2;
        int __result;

        D.5726 = (long unsigned int) i;
        D.5727 = D.5726 * 8;
        D.5728 = encodings + D.5727;
        __s2 = *D.5728;
        D.5729 = "default_locale";
        D.5730 = MEM[(const unsigned char *)D.5729];
        D.5731 = (int) D.5730;
        D.5732 = *__s2;
        D.5733 = (int) D.5732;
        __result = D.5731 - D.5733;
        {
          if (__s2_len != 0) goto <D.5734>; else goto <D.5735>;
          <D.5734>:
          if (__result == 0) goto <D.5736>; else goto <D.5737>;
          <D.5736>:
          D.5738 = &MEM[(void *)"default_locale" + 1B];
          D.5739 = *D.5738;
          D.5740 = (int) D.5739;
          D.5741 = __s2 + 1;
          D.5742 = *D.5741;
          D.5743 = (int) D.5742;
          __result = D.5740 - D.5743;
          if (__s2_len > 1) goto <D.5744>; else goto <D.5745>;
          <D.5744>:
          if (__result == 0) goto <D.5746>; else goto <D.5747>;
          <D.5746>:
          D.5748 = &MEM[(void *)"default_locale" + 2B];
          D.5749 = *D.5748;
          D.5750 = (int) D.5749;
          D.5751 = __s2 + 2;
          D.5752 = *D.5751;
          D.5753 = (int) D.5752;
          __result = D.5750 - D.5753;
          if (__s2_len > 2) goto <D.5754>; else goto <D.5755>;
          <D.5754>:
          if (__result == 0) goto <D.5756>; else goto <D.5757>;
          <D.5756>:
          D.5758 = &MEM[(void *)"default_locale" + 3B];
          D.5759 = *D.5758;
          D.5760 = (int) D.5759;
          D.5761 = __s2 + 3;
          D.5762 = *D.5761;
          D.5763 = (int) D.5762;
          __result = D.5760 - D.5763;
          <D.5757>:
          <D.5755>:
          <D.5747>:
          <D.5745>:
          <D.5737>:
          <D.5735>:
        }
        D.5521 = __result;
      }
      iftmp.4 = -D.5521;
      goto <D.5764>;
      <D.5725>:
      D.5726 = (long unsigned int) i;
      D.5727 = D.5726 * 8;
      D.5728 = encodings + D.5727;
      D.5765 = *D.5728;
      iftmp.4 = __builtin_strcmp (D.5765, "default_locale");
      <D.5764>:
      D.5522 = iftmp.4;
    }
    if (D.5522 == 0) goto <D.5766>; else goto <D.5767>;
    <D.5766>:
    res = monoeg_g_locale_from_utf8 (utf8, -1, 0B, 0B, 0B);
    goto <D.5768>;
    <D.5767>:
    D.5726 = (long unsigned int) i;
    D.5727 = D.5726 * 8;
    D.5728 = encodings + D.5727;
    D.5765 = *D.5728;
    res = monoeg_g_convert (utf8, -1, D.5765, "UTF8", 0B, 0B, 0B);
    <D.5768>:
    if (res != 0B) goto <D.5769>; else goto <D.5770>;
    <D.5769>:
    monoeg_g_free (utf8);
    monoeg_g_strfreev (encodings);
    D.5722 = res;
    return D.5722;
    <D.5770>:
    i = i + 1;
    <D.5524>:
    D.5726 = (long unsigned int) i;
    D.5727 = D.5726 * 8;
    D.5728 = encodings + D.5727;
    D.5765 = *D.5728;
    if (D.5765 != 0B) goto <D.5523>; else goto <D.5525>;
    <D.5525>:
    monoeg_g_strfreev (encodings);
  }
  D.5722 = utf8;
  return D.5722;
}


mono_utf8_validate_and_len (const gchar * source, glong * oLength, const gchar * * oEnd)
{
  unsigned char D.5772;
  int D.5773;
  char D.5774;
  int D.5775;
  int D.5776;
  sizetype D.5777;
  signed char a.5;
  unsigned char D.5782;
  guchar * D.5785;
  unsigned char D.5786;
  guchar * D.5791;
  unsigned char D.5792;
  guchar * D.5808;
  unsigned char D.5809;
  unsigned char D.5810;
  unsigned char D.5815;
  unsigned char D.5824;
  long int D.5835;
  long int D.5836;
  gboolean D.5841;
  gboolean retVal;
  gboolean lastRet;
  guchar * ptr;
  guchar * srcPtr;
  guint length;
  guchar a;

  retVal = 1;
  lastRet = 1;
  ptr = source;
  *oLength = 0;
  goto <D.5550>;
  <D.5549>:
  D.5772 = *ptr;
  D.5773 = (int) D.5772;
  D.5774 = trailingBytesForUTF8[D.5773];
  D.5775 = (int) D.5774;
  D.5776 = D.5775 + 1;
  length = (guint) D.5776;
  D.5777 = (sizetype) length;
  srcPtr = ptr + D.5777;
  switch (length) <default: <D.5537>, case 1: <D.5548>, case 2: <D.5540>, case 3: <D.5539>, case 4: <D.5538>>
  <D.5537>:
  retVal = 0;
  <D.5538>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.5 = (signed char) a;
  if (a.5 >= 0) goto <D.5778>; else goto <D.5781>;
  <D.5781>:
  if (a > 191) goto <D.5778>; else goto <D.5779>;
  <D.5778>:
  retVal = 0;
  <D.5779>:
  D.5782 = a + 66;
  if (D.5782 <= 1) goto <D.5783>; else goto <D.5784>;
  <D.5783>:
  D.5785 = srcPtr + 18446744073709551615;
  D.5786 = *D.5785;
  if (D.5786 == 191) goto <D.5787>; else goto <D.5788>;
  <D.5787>:
  D.5791 = srcPtr + 18446744073709551614;
  D.5792 = *D.5791;
  if (D.5792 == 143) goto <D.5789>; else goto <D.5793>;
  <D.5793>:
  D.5791 = srcPtr + 18446744073709551614;
  D.5792 = *D.5791;
  if (D.5792 == 159) goto <D.5789>; else goto <D.5794>;
  <D.5794>:
  D.5791 = srcPtr + 18446744073709551614;
  D.5792 = *D.5791;
  if (D.5792 == 175) goto <D.5789>; else goto <D.5795>;
  <D.5795>:
  D.5791 = srcPtr + 18446744073709551614;
  D.5792 = *D.5791;
  if (D.5792 == 191) goto <D.5789>; else goto <D.5790>;
  <D.5789>:
  retVal = 0;
  <D.5790>:
  <D.5788>:
  <D.5784>:
  <D.5539>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.5 = (signed char) a;
  if (a.5 >= 0) goto <D.5796>; else goto <D.5798>;
  <D.5798>:
  if (a > 191) goto <D.5796>; else goto <D.5797>;
  <D.5796>:
  retVal = 0;
  <D.5797>:
  <D.5540>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.5 = (signed char) a;
  if (a.5 >= 0) goto <D.5799>; else goto <D.5801>;
  <D.5801>:
  if (a > 191) goto <D.5799>; else goto <D.5800>;
  <D.5799>:
  retVal = 0;
  <D.5800>:
  D.5772 = *ptr;
  D.5773 = (int) D.5772;
  switch (D.5773) <default: <D.5547>, case 224: <D.5541>, case 237: <D.5543>, case 239: <D.5544>, case 240: <D.5545>, case 244: <D.5546>>
  <D.5541>:
  if (a <= 159) goto <D.5802>; else goto <D.5803>;
  <D.5802>:
  retVal = 0;
  <D.5803>:
  goto <D.5542>;
  <D.5543>:
  if (a > 159) goto <D.5804>; else goto <D.5805>;
  <D.5804>:
  retVal = 0;
  <D.5805>:
  goto <D.5542>;
  <D.5544>:
  if (a == 183) goto <D.5806>; else goto <D.5807>;
  <D.5806>:
  D.5808 = srcPtr + 1;
  D.5809 = *D.5808;
  D.5810 = D.5809 + 112;
  if (D.5810 <= 31) goto <D.5811>; else goto <D.5812>;
  <D.5811>:
  retVal = 0;
  <D.5812>:
  <D.5807>:
  if (a == 191) goto <D.5813>; else goto <D.5814>;
  <D.5813>:
  D.5808 = srcPtr + 1;
  D.5809 = *D.5808;
  D.5815 = D.5809 + 66;
  if (D.5815 <= 1) goto <D.5816>; else goto <D.5817>;
  <D.5816>:
  retVal = 0;
  <D.5817>:
  <D.5814>:
  goto <D.5542>;
  <D.5545>:
  if (a <= 143) goto <D.5818>; else goto <D.5819>;
  <D.5818>:
  retVal = 0;
  <D.5819>:
  goto <D.5542>;
  <D.5546>:
  if (a > 143) goto <D.5820>; else goto <D.5821>;
  <D.5820>:
  retVal = 0;
  <D.5821>:
  goto <D.5542>;
  <D.5547>:
  a.5 = (signed char) a;
  if (a.5 >= 0) goto <D.5822>; else goto <D.5823>;
  <D.5822>:
  retVal = 0;
  <D.5823>:
  <D.5542>:
  <D.5548>:
  D.5772 = *ptr;
  D.5824 = D.5772 + 128;
  if (D.5824 <= 65) goto <D.5825>; else goto <D.5826>;
  <D.5825>:
  retVal = 0;
  <D.5826>:
  D.5772 = *ptr;
  if (D.5772 > 244) goto <D.5827>; else goto <D.5828>;
  <D.5827>:
  retVal = 0;
  <D.5828>:
  if (retVal == 0) goto <D.5829>; else goto <D.5830>;
  <D.5829>:
  if (lastRet != 0) goto <D.5831>; else goto <D.5832>;
  <D.5831>:
  if (oEnd != 0B) goto <D.5833>; else goto <D.5834>;
  <D.5833>:
  *oEnd = ptr;
  <D.5834>:
  lastRet = 0;
  <D.5832>:
  <D.5830>:
  D.5777 = (sizetype) length;
  ptr = ptr + D.5777;
  D.5835 = *oLength;
  D.5836 = D.5835 + 1;
  *oLength = D.5836;
  <D.5550>:
  D.5772 = *ptr;
  if (D.5772 != 0) goto <D.5549>; else goto <D.5551>;
  <D.5551>:
  if (retVal != 0) goto <D.5837>; else goto <D.5838>;
  <D.5837>:
  if (oEnd != 0B) goto <D.5839>; else goto <D.5840>;
  <D.5839>:
  *oEnd = ptr;
  <D.5840>:
  <D.5838>:
  D.5841 = retVal;
  return D.5841;
}


mono_utf8_validate_and_len_with_bounds (const gchar * source, glong max_bytes, glong * oLength, const gchar * * oEnd)
{
  sizetype max_bytes.6;
  gboolean D.5848;
  unsigned char D.5849;
  int D.5850;
  char D.5851;
  int D.5852;
  int D.5853;
  sizetype D.5854;
  signed char a.7;
  unsigned char D.5861;
  guchar * D.5864;
  unsigned char D.5865;
  guchar * D.5870;
  unsigned char D.5871;
  guchar * D.5887;
  unsigned char D.5888;
  unsigned char D.5889;
  unsigned char D.5894;
  unsigned char D.5903;
  long int D.5914;
  long int D.5915;
  gboolean retVal;
  gboolean lastRet;
  guchar * ptr;
  guchar * end;
  guchar * srcPtr;
  guint length;
  guchar a;

  retVal = 1;
  lastRet = 1;
  ptr = source;
  max_bytes.6 = (sizetype) max_bytes;
  end = ptr + max_bytes.6;
  *oLength = 0;
  if (max_bytes <= 0) goto <D.5844>; else goto <D.5845>;
  <D.5844>:
  if (oEnd != 0B) goto <D.5846>; else goto <D.5847>;
  <D.5846>:
  *oEnd = ptr;
  <D.5847>:
  D.5848 = 0;
  return D.5848;
  <D.5845>:
  goto <D.5579>;
  <D.5578>:
  D.5849 = *ptr;
  D.5850 = (int) D.5849;
  D.5851 = trailingBytesForUTF8[D.5850];
  D.5852 = (int) D.5851;
  D.5853 = D.5852 + 1;
  length = (guint) D.5853;
  D.5854 = (sizetype) length;
  srcPtr = ptr + D.5854;
  if (srcPtr >= end) goto <D.5855>; else goto <D.5856>;
  <D.5855>:
  retVal = 0;
  goto <D.5565>;
  <D.5856>:
  switch (length) <default: <D.5566>, case 1: <D.5577>, case 2: <D.5569>, case 3: <D.5568>, case 4: <D.5567>>
  <D.5566>:
  retVal = 0;
  <D.5567>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.7 = (signed char) a;
  if (a.7 >= 0) goto <D.5857>; else goto <D.5860>;
  <D.5860>:
  if (a > 191) goto <D.5857>; else goto <D.5858>;
  <D.5857>:
  retVal = 0;
  <D.5858>:
  D.5861 = a + 66;
  if (D.5861 <= 1) goto <D.5862>; else goto <D.5863>;
  <D.5862>:
  D.5864 = srcPtr + 18446744073709551615;
  D.5865 = *D.5864;
  if (D.5865 == 191) goto <D.5866>; else goto <D.5867>;
  <D.5866>:
  D.5870 = srcPtr + 18446744073709551614;
  D.5871 = *D.5870;
  if (D.5871 == 143) goto <D.5868>; else goto <D.5872>;
  <D.5872>:
  D.5870 = srcPtr + 18446744073709551614;
  D.5871 = *D.5870;
  if (D.5871 == 159) goto <D.5868>; else goto <D.5873>;
  <D.5873>:
  D.5870 = srcPtr + 18446744073709551614;
  D.5871 = *D.5870;
  if (D.5871 == 175) goto <D.5868>; else goto <D.5874>;
  <D.5874>:
  D.5870 = srcPtr + 18446744073709551614;
  D.5871 = *D.5870;
  if (D.5871 == 191) goto <D.5868>; else goto <D.5869>;
  <D.5868>:
  retVal = 0;
  <D.5869>:
  <D.5867>:
  <D.5863>:
  <D.5568>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.7 = (signed char) a;
  if (a.7 >= 0) goto <D.5875>; else goto <D.5877>;
  <D.5877>:
  if (a > 191) goto <D.5875>; else goto <D.5876>;
  <D.5875>:
  retVal = 0;
  <D.5876>:
  <D.5569>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.7 = (signed char) a;
  if (a.7 >= 0) goto <D.5878>; else goto <D.5880>;
  <D.5880>:
  if (a > 191) goto <D.5878>; else goto <D.5879>;
  <D.5878>:
  retVal = 0;
  <D.5879>:
  D.5849 = *ptr;
  D.5850 = (int) D.5849;
  switch (D.5850) <default: <D.5576>, case 224: <D.5570>, case 237: <D.5572>, case 239: <D.5573>, case 240: <D.5574>, case 244: <D.5575>>
  <D.5570>:
  if (a <= 159) goto <D.5881>; else goto <D.5882>;
  <D.5881>:
  retVal = 0;
  <D.5882>:
  goto <D.5571>;
  <D.5572>:
  if (a > 159) goto <D.5883>; else goto <D.5884>;
  <D.5883>:
  retVal = 0;
  <D.5884>:
  goto <D.5571>;
  <D.5573>:
  if (a == 183) goto <D.5885>; else goto <D.5886>;
  <D.5885>:
  D.5887 = srcPtr + 1;
  D.5888 = *D.5887;
  D.5889 = D.5888 + 112;
  if (D.5889 <= 31) goto <D.5890>; else goto <D.5891>;
  <D.5890>:
  retVal = 0;
  <D.5891>:
  <D.5886>:
  if (a == 191) goto <D.5892>; else goto <D.5893>;
  <D.5892>:
  D.5887 = srcPtr + 1;
  D.5888 = *D.5887;
  D.5894 = D.5888 + 66;
  if (D.5894 <= 1) goto <D.5895>; else goto <D.5896>;
  <D.5895>:
  retVal = 0;
  <D.5896>:
  <D.5893>:
  goto <D.5571>;
  <D.5574>:
  if (a <= 143) goto <D.5897>; else goto <D.5898>;
  <D.5897>:
  retVal = 0;
  <D.5898>:
  goto <D.5571>;
  <D.5575>:
  if (a > 143) goto <D.5899>; else goto <D.5900>;
  <D.5899>:
  retVal = 0;
  <D.5900>:
  goto <D.5571>;
  <D.5576>:
  a.7 = (signed char) a;
  if (a.7 >= 0) goto <D.5901>; else goto <D.5902>;
  <D.5901>:
  retVal = 0;
  <D.5902>:
  <D.5571>:
  <D.5577>:
  D.5849 = *ptr;
  D.5903 = D.5849 + 128;
  if (D.5903 <= 65) goto <D.5904>; else goto <D.5905>;
  <D.5904>:
  retVal = 0;
  <D.5905>:
  D.5849 = *ptr;
  if (D.5849 > 244) goto <D.5906>; else goto <D.5907>;
  <D.5906>:
  retVal = 0;
  <D.5907>:
  if (retVal == 0) goto <D.5908>; else goto <D.5909>;
  <D.5908>:
  if (lastRet != 0) goto <D.5910>; else goto <D.5911>;
  <D.5910>:
  if (oEnd != 0B) goto <D.5912>; else goto <D.5913>;
  <D.5912>:
  *oEnd = ptr;
  <D.5913>:
  lastRet = 0;
  <D.5911>:
  <D.5909>:
  D.5854 = (sizetype) length;
  ptr = ptr + D.5854;
  D.5914 = *oLength;
  D.5915 = D.5914 + 1;
  *oLength = D.5915;
  <D.5579>:
  D.5849 = *ptr;
  if (D.5849 != 0) goto <D.5578>; else goto <D.5565>;
  <D.5565>:
  if (retVal != 0) goto <D.5916>; else goto <D.5917>;
  <D.5916>:
  if (oEnd != 0B) goto <D.5918>; else goto <D.5919>;
  <D.5918>:
  *oEnd = ptr;
  <D.5919>:
  <D.5917>:
  D.5848 = retVal;
  return D.5848;
}


