mono_unicode_from_external (const gchar * in, gsize * bytes)
{
  gunichar2 * D.5069;
  int D.4966;
  int iftmp.0;
  int D.4965;
  long unsigned int D.5075;
  long unsigned int D.5076;
  gchar * * D.5077;
  const char[15] * D.5078;
  unsigned char D.5079;
  int D.5080;
  unsigned char D.5081;
  int D.5082;
  _Bool D.5083;
  _Bool D.5084;
  _Bool D.5085;
  const unsigned char * D.5088;
  unsigned char D.5089;
  int D.5090;
  const unsigned char * D.5091;
  unsigned char D.5092;
  int D.5093;
  _Bool D.5094;
  _Bool D.5095;
  const unsigned char * D.5098;
  unsigned char D.5099;
  int D.5100;
  const unsigned char * D.5101;
  unsigned char D.5102;
  int D.5103;
  _Bool D.5104;
  _Bool D.5105;
  const unsigned char * D.5108;
  unsigned char D.5109;
  int D.5110;
  const unsigned char * D.5111;
  unsigned char D.5112;
  int D.5113;
  gchar * D.5115;
  long int lbytes.1;
  long unsigned int lbytes.2;
  long unsigned int D.5123;
  long int D.5124;
  long unsigned int D.5129;
  long unsigned int D.5130;
  int D.5131;
  gchar * res;
  gchar * * encodings;
  const gchar * encoding_list;
  int i;
  glong lbytes;

  try
    {
      res = 0B;
      if (in == 0B) goto <D.5067>; else goto <D.5068>;
      <D.5067>:
      D.5069 = 0B;
      return D.5069;
      <D.5068>:
      encoding_list = monoeg_g_getenv ("MONO_EXTERNAL_ENCODINGS");
      if (encoding_list == 0B) goto <D.5070>; else goto <D.5071>;
      <D.5070>:
      encoding_list = "";
      <D.5071>:
      encodings = monoeg_g_strsplit (encoding_list, ":", 0);
      i = 0;
      goto <D.4970>;
      <D.4969>:
      {
        size_t __s1_len;
        size_t __s2_len;

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

          D.5075 = (long unsigned int) i;
          D.5076 = D.5075 * 8;
          D.5077 = encodings + D.5076;
          __s2 = *D.5077;
          D.5078 = "default_locale";
          D.5079 = MEM[(const unsigned char *)D.5078];
          D.5080 = (int) D.5079;
          D.5081 = *__s2;
          D.5082 = (int) D.5081;
          __result = D.5080 - D.5082;
          {
            D.5083 = __s2_len != 0;
            D.5084 = __result == 0;
            D.5085 = D.5083 & D.5084;
            if (D.5085 != 0) goto <D.5086>; else goto <D.5087>;
            <D.5086>:
            D.5088 = &MEM[(void *)"default_locale" + 1B];
            D.5089 = *D.5088;
            D.5090 = (int) D.5089;
            D.5091 = __s2 + 1;
            D.5092 = *D.5091;
            D.5093 = (int) D.5092;
            __result = D.5090 - D.5093;
            D.5094 = __s2_len > 1;
            D.5084 = __result == 0;
            D.5095 = D.5094 & D.5084;
            if (D.5095 != 0) goto <D.5096>; else goto <D.5097>;
            <D.5096>:
            D.5098 = &MEM[(void *)"default_locale" + 2B];
            D.5099 = *D.5098;
            D.5100 = (int) D.5099;
            D.5101 = __s2 + 2;
            D.5102 = *D.5101;
            D.5103 = (int) D.5102;
            __result = D.5100 - D.5103;
            D.5104 = __s2_len > 2;
            D.5084 = __result == 0;
            D.5105 = D.5104 & D.5084;
            if (D.5105 != 0) goto <D.5106>; else goto <D.5107>;
            <D.5106>:
            D.5108 = &MEM[(void *)"default_locale" + 3B];
            D.5109 = *D.5108;
            D.5110 = (int) D.5109;
            D.5111 = __s2 + 3;
            D.5112 = *D.5111;
            D.5113 = (int) D.5112;
            __result = D.5110 - D.5113;
            <D.5107>:
            <D.5097>:
            <D.5087>:
          }
          D.4965 = __result;
        }
        iftmp.0 = -D.4965;
        goto <D.5114>;
        <D.5074>:
        D.5075 = (long unsigned int) i;
        D.5076 = D.5075 * 8;
        D.5077 = encodings + D.5076;
        D.5115 = *D.5077;
        iftmp.0 = __builtin_strcmp (D.5115, "default_locale");
        <D.5114>:
        D.4966 = iftmp.0;
      }
      if (D.4966 == 0) goto <D.5116>; else goto <D.5117>;
      <D.5116>:
      {
        gchar * utf8;

        utf8 = monoeg_g_locale_to_utf8 (in, -1, 0B, 0B, 0B);
        if (utf8 != 0B) goto <D.5118>; else goto <D.5119>;
        <D.5118>:
        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.5119>:
        monoeg_g_free (utf8);
      }
      goto <D.5122>;
      <D.5117>:
      D.5075 = (long unsigned int) i;
      D.5076 = D.5075 * 8;
      D.5077 = encodings + D.5076;
      D.5115 = *D.5077;
      D.5123 = strlen (in);
      D.5124 = (long int) D.5123;
      res = monoeg_g_convert (in, D.5124, "UTF8", D.5115, 0B, bytes, 0B);
      if (res != 0B) goto <D.5125>; else goto <D.5126>;
      <D.5125>:
      {
        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.5126>:
      <D.5122>:
      if (res != 0B) goto <D.5127>; else goto <D.5128>;
      <D.5127>:
      monoeg_g_strfreev (encodings);
      D.5129 = *bytes;
      D.5130 = D.5129 * 2;
      *bytes = D.5130;
      D.5069 = res;
      return D.5069;
      <D.5128>:
      i = i + 1;
      <D.4970>:
      D.5075 = (long unsigned int) i;
      D.5076 = D.5075 * 8;
      D.5077 = encodings + D.5076;
      D.5115 = *D.5077;
      if (D.5115 != 0B) goto <D.4969>; else goto <D.4971>;
      <D.4971>:
      monoeg_g_strfreev (encodings);
      D.5131 = monoeg_g_utf8_validate (in, -1, 0B);
      if (D.5131 != 0) goto <D.5132>; else goto <D.5133>;
      <D.5132>:
      {
        gunichar2 * unires;

        unires = monoeg_g_utf8_to_utf16 (in, -1, 0B, bytes, 0B);
        D.5129 = *bytes;
        D.5130 = D.5129 * 2;
        *bytes = D.5130;
        D.5069 = unires;
        return D.5069;
      }
      <D.5133>:
      D.5069 = 0B;
      return D.5069;
    }
  finally
    {
      lbytes = {CLOBBER};
    }
}


mono_utf8_from_external (const gchar * in)
{
  gchar * D.5138;
  int D.4988;
  int iftmp.3;
  int D.4987;
  long unsigned int D.5144;
  long unsigned int D.5145;
  gchar * * D.5146;
  const char[15] * D.5147;
  unsigned char D.5148;
  int D.5149;
  unsigned char D.5150;
  int D.5151;
  _Bool D.5152;
  _Bool D.5153;
  _Bool D.5154;
  const unsigned char * D.5157;
  unsigned char D.5158;
  int D.5159;
  const unsigned char * D.5160;
  unsigned char D.5161;
  int D.5162;
  _Bool D.5163;
  _Bool D.5164;
  const unsigned char * D.5167;
  unsigned char D.5168;
  int D.5169;
  const unsigned char * D.5170;
  unsigned char D.5171;
  int D.5172;
  _Bool D.5173;
  _Bool D.5174;
  const unsigned char * D.5177;
  unsigned char D.5178;
  int D.5179;
  const unsigned char * D.5180;
  unsigned char D.5181;
  int D.5182;
  gchar * D.5184;
  int D.5189;
  int D.5195;
  gchar * res;
  gchar * * encodings;
  const gchar * encoding_list;
  int i;

  res = 0B;
  if (in == 0B) goto <D.5136>; else goto <D.5137>;
  <D.5136>:
  D.5138 = 0B;
  return D.5138;
  <D.5137>:
  encoding_list = monoeg_g_getenv ("MONO_EXTERNAL_ENCODINGS");
  if (encoding_list == 0B) goto <D.5139>; else goto <D.5140>;
  <D.5139>:
  encoding_list = "";
  <D.5140>:
  encodings = monoeg_g_strsplit (encoding_list, ":", 0);
  i = 0;
  goto <D.4990>;
  <D.4989>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      D.5144 = (long unsigned int) i;
      D.5145 = D.5144 * 8;
      D.5146 = encodings + D.5145;
      __s2 = *D.5146;
      D.5147 = "default_locale";
      D.5148 = MEM[(const unsigned char *)D.5147];
      D.5149 = (int) D.5148;
      D.5150 = *__s2;
      D.5151 = (int) D.5150;
      __result = D.5149 - D.5151;
      {
        D.5152 = __s2_len != 0;
        D.5153 = __result == 0;
        D.5154 = D.5152 & D.5153;
        if (D.5154 != 0) goto <D.5155>; else goto <D.5156>;
        <D.5155>:
        D.5157 = &MEM[(void *)"default_locale" + 1B];
        D.5158 = *D.5157;
        D.5159 = (int) D.5158;
        D.5160 = __s2 + 1;
        D.5161 = *D.5160;
        D.5162 = (int) D.5161;
        __result = D.5159 - D.5162;
        D.5163 = __s2_len > 1;
        D.5153 = __result == 0;
        D.5164 = D.5163 & D.5153;
        if (D.5164 != 0) goto <D.5165>; else goto <D.5166>;
        <D.5165>:
        D.5167 = &MEM[(void *)"default_locale" + 2B];
        D.5168 = *D.5167;
        D.5169 = (int) D.5168;
        D.5170 = __s2 + 2;
        D.5171 = *D.5170;
        D.5172 = (int) D.5171;
        __result = D.5169 - D.5172;
        D.5173 = __s2_len > 2;
        D.5153 = __result == 0;
        D.5174 = D.5173 & D.5153;
        if (D.5174 != 0) goto <D.5175>; else goto <D.5176>;
        <D.5175>:
        D.5177 = &MEM[(void *)"default_locale" + 3B];
        D.5178 = *D.5177;
        D.5179 = (int) D.5178;
        D.5180 = __s2 + 3;
        D.5181 = *D.5180;
        D.5182 = (int) D.5181;
        __result = D.5179 - D.5182;
        <D.5176>:
        <D.5166>:
        <D.5156>:
      }
      D.4987 = __result;
    }
    iftmp.3 = -D.4987;
    goto <D.5183>;
    <D.5143>:
    D.5144 = (long unsigned int) i;
    D.5145 = D.5144 * 8;
    D.5146 = encodings + D.5145;
    D.5184 = *D.5146;
    iftmp.3 = __builtin_strcmp (D.5184, "default_locale");
    <D.5183>:
    D.4988 = iftmp.3;
  }
  if (D.4988 == 0) goto <D.5185>; else goto <D.5186>;
  <D.5185>:
  res = monoeg_g_locale_to_utf8 (in, -1, 0B, 0B, 0B);
  if (res != 0B) goto <D.5187>; else goto <D.5188>;
  <D.5187>:
  D.5189 = monoeg_g_utf8_validate (res, -1, 0B);
  if (D.5189 == 0) goto <D.5190>; else goto <D.5191>;
  <D.5190>:
  monoeg_g_free (res);
  res = 0B;
  <D.5191>:
  <D.5188>:
  goto <D.5192>;
  <D.5186>:
  D.5144 = (long unsigned int) i;
  D.5145 = D.5144 * 8;
  D.5146 = encodings + D.5145;
  D.5184 = *D.5146;
  res = monoeg_g_convert (in, -1, "UTF8", D.5184, 0B, 0B, 0B);
  <D.5192>:
  if (res != 0B) goto <D.5193>; else goto <D.5194>;
  <D.5193>:
  monoeg_g_strfreev (encodings);
  D.5138 = res;
  return D.5138;
  <D.5194>:
  i = i + 1;
  <D.4990>:
  D.5144 = (long unsigned int) i;
  D.5145 = D.5144 * 8;
  D.5146 = encodings + D.5145;
  D.5184 = *D.5146;
  if (D.5184 != 0B) goto <D.4989>; else goto <D.4991>;
  <D.4991>:
  monoeg_g_strfreev (encodings);
  D.5195 = monoeg_g_utf8_validate (in, -1, 0B);
  if (D.5195 != 0) goto <D.5196>; else goto <D.5197>;
  <D.5196>:
  D.5138 = monoeg_strdup (in);
  return D.5138;
  <D.5197>:
  D.5138 = 0B;
  return D.5138;
}


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

  if (str != 0B) goto <D.5199>; else goto <D.5200>;
  <D.5199>:
  D.5201 = __strdup (str);
  return D.5201;
  <D.5200>:
  D.5201 = 0B;
  return D.5201;
}


mono_unicode_to_external (const gunichar2 * uni)
{
  _Bool D.5203;
  long int D.5204;
  long int D.5205;
  gchar * D.5210;
  int D.5008;
  int iftmp.4;
  int D.5007;
  long unsigned int D.5214;
  long unsigned int D.5215;
  gchar * * D.5216;
  const char[15] * D.5217;
  unsigned char D.5218;
  int D.5219;
  unsigned char D.5220;
  int D.5221;
  _Bool D.5222;
  _Bool D.5223;
  _Bool D.5224;
  const unsigned char * D.5227;
  unsigned char D.5228;
  int D.5229;
  const unsigned char * D.5230;
  unsigned char D.5231;
  int D.5232;
  _Bool D.5233;
  _Bool D.5234;
  const unsigned char * D.5237;
  unsigned char D.5238;
  int D.5239;
  const unsigned char * D.5240;
  unsigned char D.5241;
  int D.5242;
  _Bool D.5243;
  _Bool D.5244;
  const unsigned char * D.5247;
  unsigned char D.5248;
  int D.5249;
  const unsigned char * D.5250;
  unsigned char D.5251;
  int D.5252;
  gchar * D.5254;
  gchar * utf8;
  const gchar * encoding_list;

  utf8 = monoeg_g_utf16_to_utf8 (uni, -1, 0B, 0B, 0B);
  D.5203 = utf8 == 0B;
  D.5204 = (long int) D.5203;
  D.5205 = __builtin_expect (D.5204, 0);
  if (D.5205 != 0) goto <D.5206>; else goto <D.5207>;
  <D.5206>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "strenc.c", 183, "utf8!=NULL");
  <D.5207>:
  encoding_list = monoeg_g_getenv ("MONO_EXTERNAL_ENCODINGS");
  if (encoding_list == 0B) goto <D.5208>; else goto <D.5209>;
  <D.5208>:
  D.5210 = utf8;
  return D.5210;
  <D.5209>:
  {
    gchar * res;
    gchar * * encodings;
    int i;

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

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

        D.5214 = (long unsigned int) i;
        D.5215 = D.5214 * 8;
        D.5216 = encodings + D.5215;
        __s2 = *D.5216;
        D.5217 = "default_locale";
        D.5218 = MEM[(const unsigned char *)D.5217];
        D.5219 = (int) D.5218;
        D.5220 = *__s2;
        D.5221 = (int) D.5220;
        __result = D.5219 - D.5221;
        {
          D.5222 = __s2_len != 0;
          D.5223 = __result == 0;
          D.5224 = D.5222 & D.5223;
          if (D.5224 != 0) goto <D.5225>; else goto <D.5226>;
          <D.5225>:
          D.5227 = &MEM[(void *)"default_locale" + 1B];
          D.5228 = *D.5227;
          D.5229 = (int) D.5228;
          D.5230 = __s2 + 1;
          D.5231 = *D.5230;
          D.5232 = (int) D.5231;
          __result = D.5229 - D.5232;
          D.5233 = __s2_len > 1;
          D.5223 = __result == 0;
          D.5234 = D.5233 & D.5223;
          if (D.5234 != 0) goto <D.5235>; else goto <D.5236>;
          <D.5235>:
          D.5237 = &MEM[(void *)"default_locale" + 2B];
          D.5238 = *D.5237;
          D.5239 = (int) D.5238;
          D.5240 = __s2 + 2;
          D.5241 = *D.5240;
          D.5242 = (int) D.5241;
          __result = D.5239 - D.5242;
          D.5243 = __s2_len > 2;
          D.5223 = __result == 0;
          D.5244 = D.5243 & D.5223;
          if (D.5244 != 0) goto <D.5245>; else goto <D.5246>;
          <D.5245>:
          D.5247 = &MEM[(void *)"default_locale" + 3B];
          D.5248 = *D.5247;
          D.5249 = (int) D.5248;
          D.5250 = __s2 + 3;
          D.5251 = *D.5250;
          D.5252 = (int) D.5251;
          __result = D.5249 - D.5252;
          <D.5246>:
          <D.5236>:
          <D.5226>:
        }
        D.5007 = __result;
      }
      iftmp.4 = -D.5007;
      goto <D.5253>;
      <D.5213>:
      D.5214 = (long unsigned int) i;
      D.5215 = D.5214 * 8;
      D.5216 = encodings + D.5215;
      D.5254 = *D.5216;
      iftmp.4 = __builtin_strcmp (D.5254, "default_locale");
      <D.5253>:
      D.5008 = iftmp.4;
    }
    if (D.5008 == 0) goto <D.5255>; else goto <D.5256>;
    <D.5255>:
    res = monoeg_g_locale_from_utf8 (utf8, -1, 0B, 0B, 0B);
    goto <D.5257>;
    <D.5256>:
    D.5214 = (long unsigned int) i;
    D.5215 = D.5214 * 8;
    D.5216 = encodings + D.5215;
    D.5254 = *D.5216;
    res = monoeg_g_convert (utf8, -1, D.5254, "UTF8", 0B, 0B, 0B);
    <D.5257>:
    if (res != 0B) goto <D.5258>; else goto <D.5259>;
    <D.5258>:
    monoeg_g_free (utf8);
    monoeg_g_strfreev (encodings);
    D.5210 = res;
    return D.5210;
    <D.5259>:
    i = i + 1;
    <D.5010>:
    D.5214 = (long unsigned int) i;
    D.5215 = D.5214 * 8;
    D.5216 = encodings + D.5215;
    D.5254 = *D.5216;
    if (D.5254 != 0B) goto <D.5009>; else goto <D.5011>;
    <D.5011>:
    monoeg_g_strfreev (encodings);
  }
  D.5210 = utf8;
  return D.5210;
}


mono_utf8_validate_and_len (const gchar * source, glong * oLength, const gchar * * oEnd)
{
  unsigned char D.5261;
  int D.5262;
  char D.5263;
  int D.5264;
  int D.5265;
  sizetype D.5266;
  signed char a.5;
  unsigned char D.5271;
  guchar * D.5274;
  unsigned char D.5275;
  guchar * D.5280;
  unsigned char D.5281;
  _Bool D.5282;
  _Bool D.5283;
  _Bool D.5284;
  unsigned char D.5286;
  guchar * D.5300;
  unsigned char D.5301;
  unsigned char D.5302;
  unsigned char D.5307;
  unsigned char D.5316;
  _Bool D.5321;
  _Bool D.5322;
  _Bool D.5323;
  long int D.5328;
  long int D.5329;
  _Bool D.5330;
  _Bool D.5331;
  _Bool D.5332;
  gboolean D.5335;
  gboolean retVal;
  gboolean lastRet;
  guchar * ptr;
  guchar * srcPtr;
  guint length;
  guchar a;

  retVal = 1;
  lastRet = 1;
  ptr = source;
  *oLength = 0;
  goto <D.5036>;
  <D.5035>:
  D.5261 = *ptr;
  D.5262 = (int) D.5261;
  D.5263 = trailingBytesForUTF8[D.5262];
  D.5264 = (int) D.5263;
  D.5265 = D.5264 + 1;
  length = (guint) D.5265;
  D.5266 = (sizetype) length;
  srcPtr = ptr + D.5266;
  switch (length) <default: <D.5023>, case 1: <D.5034>, case 2: <D.5026>, case 3: <D.5025>, case 4: <D.5024>>
  <D.5023>:
  retVal = 0;
  <D.5024>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.5 = (signed char) a;
  if (a.5 >= 0) goto <D.5267>; else goto <D.5270>;
  <D.5270>:
  if (a > 191) goto <D.5267>; else goto <D.5268>;
  <D.5267>:
  retVal = 0;
  <D.5268>:
  D.5271 = a + 66;
  if (D.5271 <= 1) goto <D.5272>; else goto <D.5273>;
  <D.5272>:
  D.5274 = srcPtr + 18446744073709551615;
  D.5275 = *D.5274;
  if (D.5275 == 191) goto <D.5276>; else goto <D.5277>;
  <D.5276>:
  D.5280 = srcPtr + 18446744073709551614;
  D.5281 = *D.5280;
  D.5282 = D.5281 == 143;
  D.5283 = D.5281 == 159;
  D.5284 = D.5282 | D.5283;
  if (D.5284 != 0) goto <D.5278>; else goto <D.5285>;
  <D.5285>:
  D.5280 = srcPtr + 18446744073709551614;
  D.5286 = *D.5280;
  if (D.5286 == 175) goto <D.5278>; else goto <D.5287>;
  <D.5287>:
  D.5280 = srcPtr + 18446744073709551614;
  D.5286 = *D.5280;
  if (D.5286 == 191) goto <D.5278>; else goto <D.5279>;
  <D.5278>:
  retVal = 0;
  <D.5279>:
  <D.5277>:
  <D.5273>:
  <D.5025>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.5 = (signed char) a;
  if (a.5 >= 0) goto <D.5288>; else goto <D.5290>;
  <D.5290>:
  if (a > 191) goto <D.5288>; else goto <D.5289>;
  <D.5288>:
  retVal = 0;
  <D.5289>:
  <D.5026>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.5 = (signed char) a;
  if (a.5 >= 0) goto <D.5291>; else goto <D.5293>;
  <D.5293>:
  if (a > 191) goto <D.5291>; else goto <D.5292>;
  <D.5291>:
  retVal = 0;
  <D.5292>:
  D.5261 = *ptr;
  D.5262 = (int) D.5261;
  switch (D.5262) <default: <D.5033>, case 224: <D.5027>, case 237: <D.5029>, case 239: <D.5030>, case 240: <D.5031>, case 244: <D.5032>>
  <D.5027>:
  if (a <= 159) goto <D.5294>; else goto <D.5295>;
  <D.5294>:
  retVal = 0;
  <D.5295>:
  goto <D.5028>;
  <D.5029>:
  if (a > 159) goto <D.5296>; else goto <D.5297>;
  <D.5296>:
  retVal = 0;
  <D.5297>:
  goto <D.5028>;
  <D.5030>:
  if (a == 183) goto <D.5298>; else goto <D.5299>;
  <D.5298>:
  D.5300 = srcPtr + 1;
  D.5301 = *D.5300;
  D.5302 = D.5301 + 112;
  if (D.5302 <= 31) goto <D.5303>; else goto <D.5304>;
  <D.5303>:
  retVal = 0;
  <D.5304>:
  <D.5299>:
  if (a == 191) goto <D.5305>; else goto <D.5306>;
  <D.5305>:
  D.5300 = srcPtr + 1;
  D.5301 = *D.5300;
  D.5307 = D.5301 + 66;
  if (D.5307 <= 1) goto <D.5308>; else goto <D.5309>;
  <D.5308>:
  retVal = 0;
  <D.5309>:
  <D.5306>:
  goto <D.5028>;
  <D.5031>:
  if (a <= 143) goto <D.5310>; else goto <D.5311>;
  <D.5310>:
  retVal = 0;
  <D.5311>:
  goto <D.5028>;
  <D.5032>:
  if (a > 143) goto <D.5312>; else goto <D.5313>;
  <D.5312>:
  retVal = 0;
  <D.5313>:
  goto <D.5028>;
  <D.5033>:
  a.5 = (signed char) a;
  if (a.5 >= 0) goto <D.5314>; else goto <D.5315>;
  <D.5314>:
  retVal = 0;
  <D.5315>:
  <D.5028>:
  <D.5034>:
  D.5261 = *ptr;
  D.5316 = D.5261 + 128;
  if (D.5316 <= 65) goto <D.5317>; else goto <D.5318>;
  <D.5317>:
  retVal = 0;
  <D.5318>:
  D.5261 = *ptr;
  if (D.5261 > 244) goto <D.5319>; else goto <D.5320>;
  <D.5319>:
  retVal = 0;
  <D.5320>:
  D.5321 = retVal == 0;
  D.5322 = lastRet != 0;
  D.5323 = D.5321 & D.5322;
  if (D.5323 != 0) goto <D.5324>; else goto <D.5325>;
  <D.5324>:
  if (oEnd != 0B) goto <D.5326>; else goto <D.5327>;
  <D.5326>:
  *oEnd = ptr;
  <D.5327>:
  lastRet = 0;
  <D.5325>:
  D.5266 = (sizetype) length;
  ptr = ptr + D.5266;
  D.5328 = *oLength;
  D.5329 = D.5328 + 1;
  *oLength = D.5329;
  <D.5036>:
  D.5261 = *ptr;
  if (D.5261 != 0) goto <D.5035>; else goto <D.5037>;
  <D.5037>:
  D.5330 = retVal != 0;
  D.5331 = oEnd != 0B;
  D.5332 = D.5330 & D.5331;
  if (D.5332 != 0) goto <D.5333>; else goto <D.5334>;
  <D.5333>:
  *oEnd = ptr;
  <D.5334>:
  D.5335 = retVal;
  return D.5335;
}


mono_utf8_validate_and_len_with_bounds (const gchar * source, glong max_bytes, glong * oLength, const gchar * * oEnd)
{
  sizetype max_bytes.6;
  gboolean D.5342;
  unsigned char D.5343;
  int D.5344;
  char D.5345;
  int D.5346;
  int D.5347;
  sizetype D.5348;
  signed char a.7;
  unsigned char D.5355;
  guchar * D.5358;
  unsigned char D.5359;
  guchar * D.5364;
  unsigned char D.5365;
  _Bool D.5366;
  _Bool D.5367;
  _Bool D.5368;
  unsigned char D.5370;
  guchar * D.5384;
  unsigned char D.5385;
  unsigned char D.5386;
  unsigned char D.5391;
  unsigned char D.5400;
  _Bool D.5405;
  _Bool D.5406;
  _Bool D.5407;
  long int D.5412;
  long int D.5413;
  _Bool D.5414;
  _Bool D.5415;
  _Bool D.5416;
  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.5338>; else goto <D.5339>;
  <D.5338>:
  if (oEnd != 0B) goto <D.5340>; else goto <D.5341>;
  <D.5340>:
  *oEnd = ptr;
  <D.5341>:
  D.5342 = 0;
  return D.5342;
  <D.5339>:
  goto <D.5065>;
  <D.5064>:
  D.5343 = *ptr;
  D.5344 = (int) D.5343;
  D.5345 = trailingBytesForUTF8[D.5344];
  D.5346 = (int) D.5345;
  D.5347 = D.5346 + 1;
  length = (guint) D.5347;
  D.5348 = (sizetype) length;
  srcPtr = ptr + D.5348;
  if (srcPtr >= end) goto <D.5349>; else goto <D.5350>;
  <D.5349>:
  retVal = 0;
  goto <D.5051>;
  <D.5350>:
  switch (length) <default: <D.5052>, case 1: <D.5063>, case 2: <D.5055>, case 3: <D.5054>, case 4: <D.5053>>
  <D.5052>:
  retVal = 0;
  <D.5053>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.7 = (signed char) a;
  if (a.7 >= 0) goto <D.5351>; else goto <D.5354>;
  <D.5354>:
  if (a > 191) goto <D.5351>; else goto <D.5352>;
  <D.5351>:
  retVal = 0;
  <D.5352>:
  D.5355 = a + 66;
  if (D.5355 <= 1) goto <D.5356>; else goto <D.5357>;
  <D.5356>:
  D.5358 = srcPtr + 18446744073709551615;
  D.5359 = *D.5358;
  if (D.5359 == 191) goto <D.5360>; else goto <D.5361>;
  <D.5360>:
  D.5364 = srcPtr + 18446744073709551614;
  D.5365 = *D.5364;
  D.5366 = D.5365 == 143;
  D.5367 = D.5365 == 159;
  D.5368 = D.5366 | D.5367;
  if (D.5368 != 0) goto <D.5362>; else goto <D.5369>;
  <D.5369>:
  D.5364 = srcPtr + 18446744073709551614;
  D.5370 = *D.5364;
  if (D.5370 == 175) goto <D.5362>; else goto <D.5371>;
  <D.5371>:
  D.5364 = srcPtr + 18446744073709551614;
  D.5370 = *D.5364;
  if (D.5370 == 191) goto <D.5362>; else goto <D.5363>;
  <D.5362>:
  retVal = 0;
  <D.5363>:
  <D.5361>:
  <D.5357>:
  <D.5054>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.7 = (signed char) a;
  if (a.7 >= 0) goto <D.5372>; else goto <D.5374>;
  <D.5374>:
  if (a > 191) goto <D.5372>; else goto <D.5373>;
  <D.5372>:
  retVal = 0;
  <D.5373>:
  <D.5055>:
  srcPtr = srcPtr + 18446744073709551615;
  a = *srcPtr;
  a.7 = (signed char) a;
  if (a.7 >= 0) goto <D.5375>; else goto <D.5377>;
  <D.5377>:
  if (a > 191) goto <D.5375>; else goto <D.5376>;
  <D.5375>:
  retVal = 0;
  <D.5376>:
  D.5343 = *ptr;
  D.5344 = (int) D.5343;
  switch (D.5344) <default: <D.5062>, case 224: <D.5056>, case 237: <D.5058>, case 239: <D.5059>, case 240: <D.5060>, case 244: <D.5061>>
  <D.5056>:
  if (a <= 159) goto <D.5378>; else goto <D.5379>;
  <D.5378>:
  retVal = 0;
  <D.5379>:
  goto <D.5057>;
  <D.5058>:
  if (a > 159) goto <D.5380>; else goto <D.5381>;
  <D.5380>:
  retVal = 0;
  <D.5381>:
  goto <D.5057>;
  <D.5059>:
  if (a == 183) goto <D.5382>; else goto <D.5383>;
  <D.5382>:
  D.5384 = srcPtr + 1;
  D.5385 = *D.5384;
  D.5386 = D.5385 + 112;
  if (D.5386 <= 31) goto <D.5387>; else goto <D.5388>;
  <D.5387>:
  retVal = 0;
  <D.5388>:
  <D.5383>:
  if (a == 191) goto <D.5389>; else goto <D.5390>;
  <D.5389>:
  D.5384 = srcPtr + 1;
  D.5385 = *D.5384;
  D.5391 = D.5385 + 66;
  if (D.5391 <= 1) goto <D.5392>; else goto <D.5393>;
  <D.5392>:
  retVal = 0;
  <D.5393>:
  <D.5390>:
  goto <D.5057>;
  <D.5060>:
  if (a <= 143) goto <D.5394>; else goto <D.5395>;
  <D.5394>:
  retVal = 0;
  <D.5395>:
  goto <D.5057>;
  <D.5061>:
  if (a > 143) goto <D.5396>; else goto <D.5397>;
  <D.5396>:
  retVal = 0;
  <D.5397>:
  goto <D.5057>;
  <D.5062>:
  a.7 = (signed char) a;
  if (a.7 >= 0) goto <D.5398>; else goto <D.5399>;
  <D.5398>:
  retVal = 0;
  <D.5399>:
  <D.5057>:
  <D.5063>:
  D.5343 = *ptr;
  D.5400 = D.5343 + 128;
  if (D.5400 <= 65) goto <D.5401>; else goto <D.5402>;
  <D.5401>:
  retVal = 0;
  <D.5402>:
  D.5343 = *ptr;
  if (D.5343 > 244) goto <D.5403>; else goto <D.5404>;
  <D.5403>:
  retVal = 0;
  <D.5404>:
  D.5405 = retVal == 0;
  D.5406 = lastRet != 0;
  D.5407 = D.5405 & D.5406;
  if (D.5407 != 0) goto <D.5408>; else goto <D.5409>;
  <D.5408>:
  if (oEnd != 0B) goto <D.5410>; else goto <D.5411>;
  <D.5410>:
  *oEnd = ptr;
  <D.5411>:
  lastRet = 0;
  <D.5409>:
  D.5348 = (sizetype) length;
  ptr = ptr + D.5348;
  D.5412 = *oLength;
  D.5413 = D.5412 + 1;
  *oLength = D.5413;
  <D.5065>:
  D.5343 = *ptr;
  if (D.5343 != 0) goto <D.5064>; else goto <D.5051>;
  <D.5051>:
  D.5414 = retVal != 0;
  D.5415 = oEnd != 0B;
  D.5416 = D.5414 & D.5415;
  if (D.5416 != 0) goto <D.5417>; else goto <D.5418>;
  <D.5417>:
  *oEnd = ptr;
  <D.5418>:
  D.5342 = retVal;
  return D.5342;
}


