mono_varlist_insert_sorted (struct MonoCompile * cfg, struct GList * list, struct MonoMethodVar * mv, int sort_type)
{
  struct GList * D.22361;
  int D.22364;
  int D.22365;
  unsigned int D.22371;
  unsigned int D.22372;
  unsigned int D.22376;
  unsigned int D.22377;
  struct GList * l;

  if (list == 0B) goto <D.22359>; else goto <D.22360>;
  <D.22359>:
  D.22361 = monoeg_g_list_prepend (0B, mv);
  return D.22361;
  <D.22360>:
  l = list;
  goto <D.22232>;
  <D.22231>:
  {
    struct MonoMethodVar * v1;

    v1 = l->data;
    if (sort_type == 2) goto <D.22362>; else goto <D.22363>;
    <D.22362>:
    D.22364 = mv->spill_costs;
    D.22365 = v1->spill_costs;
    if (D.22364 >= D.22365) goto <D.22366>; else goto <D.22367>;
    <D.22366>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.22230>;
    <D.22367>:
    goto <D.22368>;
    <D.22363>:
    if (sort_type == 1) goto <D.22369>; else goto <D.22370>;
    <D.22369>:
    D.22371 = mv->range.last_use.abs_pos;
    D.22372 = v1->range.last_use.abs_pos;
    if (D.22371 <= D.22372) goto <D.22373>; else goto <D.22374>;
    <D.22373>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.22230>;
    <D.22374>:
    goto <D.22375>;
    <D.22370>:
    D.22376 = mv->range.first_use.abs_pos;
    D.22377 = v1->range.first_use.abs_pos;
    if (D.22376 <= D.22377) goto <D.22378>; else goto <D.22379>;
    <D.22378>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.22230>;
    <D.22379>:
    <D.22375>:
    <D.22368>:
  }
  l = l->next;
  <D.22232>:
  if (l != 0B) goto <D.22231>; else goto <D.22230>;
  <D.22230>:
  if (l == 0B) goto <D.22380>; else goto <D.22381>;
  <D.22380>:
  list = monoeg_g_list_append (list, mv);
  <D.22381>:
  D.22361 = list;
  return D.22361;
}


mono_varlist_sort (struct MonoCompile * cfg, struct GList * list, int sort_type)
{
  struct GList * D.22385;

  if (sort_type == 0) goto <D.22383>; else goto <D.22384>;
  <D.22383>:
  D.22385 = monoeg_g_list_sort (list, compare_by_first_use_func);
  return D.22385;
  <D.22384>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "linear-scan.c", 66);
  D.22385 = 0B;
  return D.22385;
}


compare_by_first_use_func (const void * a, const void * b)
{
  gint D.22387;
  unsigned int D.22388;
  unsigned int D.22389;
  unsigned int D.22390;
  struct MonoMethodVar * v1;
  struct MonoMethodVar * v2;

  v1 = a;
  v2 = b;
  D.22388 = v1->range.first_use.abs_pos;
  D.22389 = v2->range.first_use.abs_pos;
  D.22390 = D.22388 - D.22389;
  D.22387 = (gint) D.22390;
  return D.22387;
}


mono_linear_scan (struct MonoCompile * cfg, struct GList * vars, struct GList * regs, regmask_t * used_mask)
{
  void * D.22394;
  struct MonoLiveInterval * D.22395;
  unsigned int D.22398;
  void * D.22399;
  long int D.22400;
  unsigned int regnum.0;
  _Bool D.22402;
  long int D.22403;
  long int D.22404;
  unsigned char D.22407;
  unsigned char D.22408;
  unsigned int D.22411;
  unsigned int D.22412;
  int D.22414;
  long int D.22415;
  void * D.22416;
  int D.22417;
  int D.22418;
  int D.22419;
  unsigned int D.22423;
  unsigned int max_regs.1;
  int D.22426;
  unsigned int D.22427;
  int D.22433;
  unsigned int D.22435;
  _Bool D.22439;
  long int D.22440;
  long int D.22441;
  void * D.22444;
  long int D.22445;
  int D.22446;
  int D.22447;
  long long int D.22448;
  long long unsigned int D.22449;
  int D.22454;
  unsigned int D.22455;
  unsigned int D.22456;
  struct MonoInst * * D.22458;
  unsigned int D.22459;
  long unsigned int D.22460;
  long unsigned int D.22461;
  struct MonoInst * * D.22462;
  struct MonoInst * D.22463;
  short unsigned int D.22464;
  unsigned int D.22466;
  int D.22469;
  const char * D.22472;
  unsigned int D.22473;
  long unsigned int D.22480;
  long unsigned int D.22481;
  struct GList * l;
  struct GList * a;
  struct GList * active;
  struct MonoMethodVar * vmv;
  struct MonoMethodVar * amv;
  int max_regs;
  int n_regvars;
  int gains[64];
  regmask_t used_regs;
  gboolean cost_driven;

  try
    {
      active = 0B;
      used_regs = 0;
      if (vars != 0B) goto <D.22392>; else goto <D.22393>;
      <D.22392>:
      D.22394 = vars->data;
      D.22395 = MEM[(struct MonoMethodVar *)D.22394].interval;
      if (D.22395 != 0B) goto <D.22396>; else goto <D.22397>;
      <D.22396>:
      mono_linear_scan2 (cfg, vars, regs, used_mask);
      return;
      <D.22397>:
      <D.22393>:
      cost_driven = 1;
      D.22398 = monoeg_g_list_length (regs);
      max_regs = (int) D.22398;
      l = regs;
      goto <D.22262>;
      <D.22261>:
      {
        int regnum;

        D.22399 = l->data;
        D.22400 = (long int) D.22399;
        regnum = (int) D.22400;
        regnum.0 = (unsigned int) regnum;
        D.22402 = regnum.0 > 63;
        D.22403 = (long int) D.22402;
        D.22404 = __builtin_expect (D.22403, 0);
        if (D.22404 != 0) goto <D.22405>; else goto <D.22406>;
        <D.22405>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 105, "regnum < G_N_ELEMENTS (gains)");
        <D.22406>:
        gains[regnum] = 0;
      }
      l = l->next;
      <D.22262>:
      if (l != 0B) goto <D.22261>; else goto <D.22263>;
      <D.22263>:
      l = vars;
      goto <D.22268>;
      <D.22267>:
      vmv = l->data;
      D.22407 = BIT_FIELD_REF <*cfg, 8, 5608>;
      D.22408 = D.22407 & 128;
      if (D.22408 == 0) goto <D.22409>; else goto <D.22410>;
      <D.22409>:
      goto <D.22266>;
      <D.22265>:
      amv = active->data;
      D.22411 = amv->range.last_use.abs_pos;
      D.22412 = vmv->range.first_use.abs_pos;
      if (D.22411 > D.22412) goto <D.22264>; else goto <D.22413>;
      <D.22413>:
      active = monoeg_g_list_delete_link (active, active);
      D.22414 = amv->reg;
      D.22415 = (long int) D.22414;
      D.22416 = (void *) D.22415;
      regs = monoeg_g_list_prepend (regs, D.22416);
      D.22414 = amv->reg;
      D.22414 = amv->reg;
      D.22417 = gains[D.22414];
      D.22418 = amv->spill_costs;
      D.22419 = D.22417 + D.22418;
      gains[D.22414] = D.22419;
      <D.22266>:
      if (active != 0B) goto <D.22265>; else goto <D.22264>;
      <D.22264>:
      <D.22410>:
      if (active != 0B) goto <D.22422>; else goto <D.22420>;
      <D.22422>:
      D.22423 = monoeg_g_list_length (active);
      max_regs.1 = (unsigned int) max_regs;
      if (D.22423 == max_regs.1) goto <D.22425>; else goto <D.22420>;
      <D.22425>:
      D.22426 = max_regs + -1;
      D.22427 = (unsigned int) D.22426;
      a = monoeg_g_list_nth (active, D.22427);
      amv = a->data;
      if (cost_driven != 0) goto <D.22432>; else goto <D.22428>;
      <D.22432>:
      D.22418 = amv->spill_costs;
      D.22433 = vmv->spill_costs;
      if (D.22418 < D.22433) goto <D.22429>; else goto <D.22428>;
      <D.22428>:
      if (cost_driven == 0) goto <D.22434>; else goto <D.22430>;
      <D.22434>:
      D.22411 = amv->range.last_use.abs_pos;
      D.22435 = vmv->range.last_use.abs_pos;
      if (D.22411 > D.22435) goto <D.22429>; else goto <D.22430>;
      <D.22429>:
      D.22414 = amv->reg;
      vmv->reg = D.22414;
      amv->reg = -1;
      active = monoeg_g_list_delete_link (active, a);
      if (cost_driven != 0) goto <D.22436>; else goto <D.22437>;
      <D.22436>:
      active = mono_varlist_insert_sorted (cfg, active, vmv, 2);
      goto <D.22438>;
      <D.22437>:
      active = mono_varlist_insert_sorted (cfg, active, vmv, 1);
      <D.22438>:
      goto <D.22431>;
      <D.22430>:
      vmv->reg = -1;
      <D.22431>:
      goto <D.22421>;
      <D.22420>:
      D.22439 = regs == 0B;
      D.22440 = (long int) D.22439;
      D.22441 = __builtin_expect (D.22440, 0);
      if (D.22441 != 0) goto <D.22442>; else goto <D.22443>;
      <D.22442>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 168, "regs");
      <D.22443>:
      D.22444 = regs->data;
      D.22445 = (long int) D.22444;
      D.22446 = (int) D.22445;
      vmv->reg = D.22446;
      D.22447 = vmv->reg;
      D.22448 = 1 << D.22447;
      D.22449 = (long long unsigned int) D.22448;
      used_regs = D.22449 | used_regs;
      regs = monoeg_g_list_delete_link (regs, regs);
      active = mono_varlist_insert_sorted (cfg, active, vmv, 1);
      <D.22421>:
      l = l->next;
      <D.22268>:
      if (l != 0B) goto <D.22267>; else goto <D.22269>;
      <D.22269>:
      a = active;
      goto <D.22271>;
      <D.22270>:
      amv = a->data;
      D.22414 = amv->reg;
      D.22414 = amv->reg;
      D.22417 = gains[D.22414];
      D.22418 = amv->spill_costs;
      D.22419 = D.22417 + D.22418;
      gains[D.22414] = D.22419;
      a = a->next;
      <D.22271>:
      if (a != 0B) goto <D.22270>; else goto <D.22272>;
      <D.22272>:
      n_regvars = 0;
      l = vars;
      goto <D.22274>;
      <D.22273>:
      vmv = l->data;
      D.22447 = vmv->reg;
      if (D.22447 >= 0) goto <D.22450>; else goto <D.22451>;
      <D.22450>:
      D.22447 = vmv->reg;
      D.22454 = gains[D.22447];
      D.22455 = (unsigned int) D.22454;
      D.22456 = mono_arch_regalloc_cost (cfg, vmv);
      if (D.22455 > D.22456) goto <D.22457>; else goto <D.22452>;
      <D.22457>:
      D.22458 = cfg->varinfo;
      D.22459 = vmv->idx;
      D.22460 = (long unsigned int) D.22459;
      D.22461 = D.22460 * 8;
      D.22462 = D.22458 + D.22461;
      D.22463 = *D.22462;
      D.22464 = D.22463->opcode;
      if (D.22464 != 366) goto <D.22465>; else goto <D.22452>;
      <D.22465>:
      D.22466 = cfg->verbose_level;
      if (D.22466 > 2) goto <D.22467>; else goto <D.22468>;
      <D.22467>:
      D.22433 = vmv->spill_costs;
      D.22447 = vmv->reg;
      D.22459 = vmv->idx;
      D.22458 = cfg->varinfo;
      D.22459 = vmv->idx;
      D.22460 = (long unsigned int) D.22459;
      D.22461 = D.22460 * 8;
      D.22462 = D.22458 + D.22461;
      D.22463 = *D.22462;
      D.22469 = D.22463->dreg;
      printf ("ALLOCATED R%d(%d) TO HREG %d COST %d\n", D.22469, D.22459, D.22447, D.22433);
      <D.22468>:
      D.22458 = cfg->varinfo;
      D.22459 = vmv->idx;
      D.22460 = (long unsigned int) D.22459;
      D.22461 = D.22460 * 8;
      D.22462 = D.22458 + D.22461;
      D.22463 = *D.22462;
      D.22463->opcode = 366;
      D.22458 = cfg->varinfo;
      D.22459 = vmv->idx;
      D.22460 = (long unsigned int) D.22459;
      D.22461 = D.22460 * 8;
      D.22462 = D.22458 + D.22461;
      D.22463 = *D.22462;
      D.22447 = vmv->reg;
      D.22463->dreg = D.22447;
      n_regvars = n_regvars + 1;
      goto <D.22453>;
      <D.22452>:
      D.22466 = cfg->verbose_level;
      if (D.22466 > 2) goto <D.22470>; else goto <D.22471>;
      <D.22470>:
      D.22447 = vmv->reg;
      D.22472 = mono_arch_regname (D.22447);
      D.22473 = mono_arch_regalloc_cost (cfg, vmv);
      D.22433 = vmv->spill_costs;
      D.22459 = vmv->idx;
      printf ("COSTLY: R%d C%d C%d %s\n", D.22459, D.22433, D.22473, D.22472);
      <D.22471>:
      vmv->reg = -1;
      <D.22453>:
      <D.22451>:
      D.22447 = vmv->reg;
      if (D.22447 == -1) goto <D.22474>; else goto <D.22475>;
      <D.22474>:
      D.22466 = cfg->verbose_level;
      if (D.22466 > 2) goto <D.22476>; else goto <D.22477>;
      <D.22476>:
      D.22459 = vmv->idx;
      printf ("NOT REGVAR: %d\n", D.22459);
      <D.22477>:
      <D.22475>:
      l = l->next;
      <D.22274>:
      if (l != 0B) goto <D.22273>; else goto <D.22275>;
      <D.22275>:
      cfg->stat_n_regvars = n_regvars;
      used_regs = 0;
      l = vars;
      goto <D.22277>;
      <D.22276>:
      vmv = l->data;
      D.22447 = vmv->reg;
      if (D.22447 >= 0) goto <D.22478>; else goto <D.22479>;
      <D.22478>:
      D.22447 = vmv->reg;
      D.22448 = 1 << D.22447;
      D.22449 = (long long unsigned int) D.22448;
      used_regs = D.22449 | used_regs;
      <D.22479>:
      l = l->next;
      <D.22277>:
      if (l != 0B) goto <D.22276>; else goto <D.22278>;
      <D.22278>:
      D.22480 = *used_mask;
      D.22481 = D.22480 | used_regs;
      *used_mask = D.22481;
      monoeg_g_list_free (regs);
      monoeg_g_list_free (active);
      monoeg_g_list_free (vars);
    }
  finally
    {
      gains = {CLOBBER};
    }
}


mono_linear_scan2 (struct MonoCompile * cfg, struct GList * vars, struct GList * regs, regmask_t * used_mask)
{
  unsigned int D.22485;
  long unsigned int D.22486;
  long unsigned int D.22487;
  struct GList * D.22488;
  struct MonoLiveInterval * D.22489;
  struct MonoLiveRange2 * D.22490;
  struct MonoLiveInterval * D.22493;
  struct MonoLiveRange2 * D.22494;
  int D.22495;
  int D.22498;
  struct MonoLiveInterval * D.22501;
  struct MonoLiveRange2 * D.22502;
  int D.22503;
  int D.22506;
  int D.22509;
  int D.22512;
  struct MonoLiveInterval * D.22515;
  int D.22518;
  _Bool D.22521;
  long int D.22522;
  long int D.22523;
  int D.22526;
  struct MonoLiveRange2 * D.22527;
  int D.22528;
  int D.22531;
  int D.22532;
  int D.22533;
  int D.22534;
  int D.22538;
  int D.22541;
  int D.22542;
  int D.22543;
  int D.22546;
  int iftmp.2;
  struct MonoMethod * D.22550;
  unsigned char D.22551;
  unsigned char D.22552;
  int D.22556;
  unsigned int D.22561;
  void * D.22562;
  long int D.22563;
  int D.22564;
  int D.22567;
  unsigned int D.22568;
  unsigned int D.22569;
  struct MonoInst * * D.22571;
  unsigned int D.22572;
  long unsigned int D.22573;
  long unsigned int D.22574;
  struct MonoInst * * D.22575;
  struct MonoInst * D.22576;
  short unsigned int D.22577;
  unsigned int D.22579;
  const char * D.22582;
  unsigned int D.22583;
  int D.22584;
  const char * D.22587;
  unsigned int D.22588;
  char * D.22589;
  long long int D.22592;
  long long unsigned int D.22593;
  long unsigned int D.22594;
  long unsigned int D.22595;
  struct GList * unhandled;
  struct GList * active;
  struct GList * inactive;
  struct GList * l;
  struct MonoMethodVar * vmv;
  gint32 free_pos[64];
  gint32 gains[64];
  regmask_t used_regs;
  int n_regs;
  int n_regvars;
  int i;

  try
    {
      used_regs = 0;
      l = vars;
      goto <D.22308>;
      <D.22307>:
      vmv = l->data;
      l = l->next;
      <D.22308>:
      if (l != 0B) goto <D.22307>; else goto <D.22309>;
      <D.22309>:
      D.22485 = monoeg_g_list_length (regs);
      n_regs = (int) D.22485;
      D.22486 = (long unsigned int) n_regs;
      D.22487 = D.22486 * 4;
      memset (&gains, 0, D.22487);
      D.22488 = monoeg_g_list_copy (vars);
      unhandled = monoeg_g_list_sort (D.22488, compare_by_interval_start_pos_func);
      active = 0B;
      inactive = 0B;
      goto <D.22315>;
      <D.22346>:
      {
        struct MonoMethodVar * current;
        int pos;
        int reg;
        int max_free_pos;
        gboolean changed;

        current = unhandled->data;
        unhandled = monoeg_g_list_delete_link (unhandled, unhandled);
        D.22489 = current->interval;
        D.22490 = D.22489->range;
        if (D.22490 == 0B) goto <D.22491>; else goto <D.22492>;
        <D.22491>:
        // predicted unlikely by continue predictor.
        goto <D.22315>;
        <D.22492>:
        D.22489 = current->interval;
        D.22490 = D.22489->range;
        pos = D.22490->from;
        changed = 1;
        goto <D.22321>;
        <D.22320>:
        changed = 0;
        l = active;
        goto <D.22319>;
        <D.22318>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.22493 = v->interval;
          D.22494 = D.22493->last_range;
          D.22495 = D.22494->to;
          if (D.22495 < pos) goto <D.22496>; else goto <D.22497>;
          <D.22496>:
          active = monoeg_g_list_delete_link (active, l);
          changed = 1;
          goto <D.22317>;
          <D.22497>:
          D.22493 = v->interval;
          D.22498 = mono_linterval_covers (D.22493, pos);
          if (D.22498 == 0) goto <D.22499>; else goto <D.22500>;
          <D.22499>:
          inactive = monoeg_g_list_append (inactive, v);
          active = monoeg_g_list_delete_link (active, l);
          changed = 1;
          goto <D.22317>;
          <D.22500>:
        }
        l = l->next;
        <D.22319>:
        if (l != 0B) goto <D.22318>; else goto <D.22317>;
        <D.22317>:
        <D.22321>:
        if (changed != 0) goto <D.22320>; else goto <D.22322>;
        <D.22322>:
        changed = 1;
        goto <D.22328>;
        <D.22327>:
        changed = 0;
        l = inactive;
        goto <D.22326>;
        <D.22325>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.22501 = v->interval;
          D.22502 = D.22501->last_range;
          D.22503 = D.22502->to;
          if (D.22503 < pos) goto <D.22504>; else goto <D.22505>;
          <D.22504>:
          inactive = monoeg_g_list_delete_link (inactive, l);
          changed = 1;
          goto <D.22324>;
          <D.22505>:
          D.22501 = v->interval;
          D.22506 = mono_linterval_covers (D.22501, pos);
          if (D.22506 != 0) goto <D.22507>; else goto <D.22508>;
          <D.22507>:
          active = monoeg_g_list_append (active, v);
          inactive = monoeg_g_list_delete_link (inactive, l);
          changed = 1;
          goto <D.22324>;
          <D.22508>:
        }
        l = l->next;
        <D.22326>:
        if (l != 0B) goto <D.22325>; else goto <D.22324>;
        <D.22324>:
        <D.22328>:
        if (changed != 0) goto <D.22327>; else goto <D.22329>;
        <D.22329>:
        i = 0;
        goto <D.22331>;
        <D.22330>:
        free_pos[i] = 2147483647;
        i = i + 1;
        <D.22331>:
        if (i < n_regs) goto <D.22330>; else goto <D.22332>;
        <D.22332>:
        l = active;
        goto <D.22335>;
        <D.22334>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.22509 = v->reg;
          if (D.22509 >= 0) goto <D.22510>; else goto <D.22511>;
          <D.22510>:
          D.22509 = v->reg;
          free_pos[D.22509] = 0;
          <D.22511>:
        }
        l = l->next;
        <D.22335>:
        if (l != 0B) goto <D.22334>; else goto <D.22336>;
        <D.22336>:
        l = inactive;
        goto <D.22340>;
        <D.22339>:
        {
          struct MonoMethodVar * v;
          gint32 intersect_pos;

          v = l->data;
          D.22512 = v->reg;
          if (D.22512 >= 0) goto <D.22513>; else goto <D.22514>;
          <D.22513>:
          D.22515 = v->interval;
          D.22489 = current->interval;
          intersect_pos = mono_linterval_get_intersect_pos (D.22489, D.22515);
          if (intersect_pos != -1) goto <D.22516>; else goto <D.22517>;
          <D.22516>:
          D.22512 = v->reg;
          free_pos[D.22512] = intersect_pos;
          <D.22517>:
          <D.22514>:
        }
        l = l->next;
        <D.22340>:
        if (l != 0B) goto <D.22339>; else goto <D.22341>;
        <D.22341>:
        max_free_pos = -1;
        reg = -1;
        i = 0;
        goto <D.22343>;
        <D.22342>:
        D.22518 = free_pos[i];
        if (D.22518 > max_free_pos) goto <D.22519>; else goto <D.22520>;
        <D.22519>:
        reg = i;
        max_free_pos = free_pos[i];
        <D.22520>:
        i = i + 1;
        <D.22343>:
        if (i < n_regs) goto <D.22342>; else goto <D.22344>;
        <D.22344>:
        D.22521 = reg == -1;
        D.22522 = (long int) D.22521;
        D.22523 = __builtin_expect (D.22522, 0);
        if (D.22523 != 0) goto <D.22524>; else goto <D.22525>;
        <D.22524>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 402, "reg != -1");
        <D.22525>:
        D.22526 = free_pos[reg];
        D.22489 = current->interval;
        D.22527 = D.22489->last_range;
        D.22528 = D.22527->to;
        if (D.22526 >= D.22528) goto <D.22529>; else goto <D.22530>;
        <D.22529>:
        current->reg = reg;
        active = monoeg_g_list_append (active, current);
        D.22531 = current->reg;
        D.22531 = current->reg;
        D.22532 = gains[D.22531];
        D.22533 = current->spill_costs;
        D.22534 = D.22532 + D.22533;
        gains[D.22531] = D.22534;
        goto <D.22535>;
        <D.22530>:
        if (active != 0B) goto <D.22536>; else goto <D.22537>;
        <D.22536>:
        {
          struct GList * min_spill_pos;

          min_spill_pos = active;
          vmv = min_spill_pos->data;
          D.22538 = vmv->spill_costs;
          D.22533 = current->spill_costs;
          if (D.22538 < D.22533) goto <D.22539>; else goto <D.22540>;
          <D.22539>:
          D.22541 = vmv->reg;
          D.22541 = vmv->reg;
          D.22542 = gains[D.22541];
          D.22538 = vmv->spill_costs;
          D.22543 = D.22542 - D.22538;
          gains[D.22541] = D.22543;
          vmv->reg = -1;
          active = monoeg_g_list_delete_link (active, min_spill_pos);
          goto <D.22544>;
          <D.22540>:
          <D.22544>:
        }
        goto <D.22545>;
        <D.22537>:
        <D.22545>:
        <D.22535>:
      }
      <D.22315>:
      if (unhandled != 0B) goto <D.22346>; else goto <D.22347>;
      <D.22347>:
      i = 0;
      goto <D.22349>;
      <D.22348>:
      D.22546 = gains[i];
      if (D.22546 != 0) goto <D.22547>; else goto <D.22548>;
      <D.22547>:
      D.22546 = gains[i];
      D.22550 = cfg->method;
      D.22551 = BIT_FIELD_REF <*D.22550, 8, 264>;
      D.22552 = D.22551 & 1;
      if (D.22552 != 0) goto <D.22553>; else goto <D.22554>;
      <D.22553>:
      iftmp.2 = 1;
      goto <D.22555>;
      <D.22554>:
      iftmp.2 = 2;
      <D.22555>:
      D.22556 = D.22546 - iftmp.2;
      gains[i] = D.22556;
      D.22546 = gains[i];
      if (D.22546 < 0) goto <D.22557>; else goto <D.22558>;
      <D.22557>:
      gains[i] = 0;
      <D.22558>:
      <D.22548>:
      i = i + 1;
      <D.22349>:
      if (i < n_regs) goto <D.22348>; else goto <D.22350>;
      <D.22350>:
      n_regvars = 0;
      l = vars;
      goto <D.22353>;
      <D.22352>:
      vmv = l->data;
      D.22541 = vmv->reg;
      if (D.22541 >= 0) goto <D.22559>; else goto <D.22560>;
      <D.22559>:
      {
        int reg_index;

        reg_index = vmv->reg;
        D.22541 = vmv->reg;
        D.22561 = (unsigned int) D.22541;
        D.22562 = monoeg_g_list_nth_data (regs, D.22561);
        D.22563 = (long int) D.22562;
        D.22564 = (int) D.22563;
        vmv->reg = D.22564;
        D.22567 = gains[reg_index];
        D.22568 = (unsigned int) D.22567;
        D.22569 = regalloc_cost (cfg, vmv);
        if (D.22568 > D.22569) goto <D.22570>; else goto <D.22565>;
        <D.22570>:
        D.22571 = cfg->varinfo;
        D.22572 = vmv->idx;
        D.22573 = (long unsigned int) D.22572;
        D.22574 = D.22573 * 8;
        D.22575 = D.22571 + D.22574;
        D.22576 = *D.22575;
        D.22577 = D.22576->opcode;
        if (D.22577 != 366) goto <D.22578>; else goto <D.22565>;
        <D.22578>:
        D.22579 = cfg->verbose_level;
        if (D.22579 > 2) goto <D.22580>; else goto <D.22581>;
        <D.22580>:
        D.22541 = vmv->reg;
        D.22582 = mono_arch_regname (D.22541);
        D.22583 = regalloc_cost (cfg, vmv);
        D.22567 = gains[reg_index];
        D.22571 = cfg->varinfo;
        D.22572 = vmv->idx;
        D.22573 = (long unsigned int) D.22572;
        D.22574 = D.22573 * 8;
        D.22575 = D.22571 + D.22574;
        D.22576 = *D.22575;
        D.22584 = D.22576->dreg;
        printf ("REGVAR R%d G%d C%d %s\n", D.22584, D.22567, D.22583, D.22582);
        <D.22581>:
        D.22571 = cfg->varinfo;
        D.22572 = vmv->idx;
        D.22573 = (long unsigned int) D.22572;
        D.22574 = D.22573 * 8;
        D.22575 = D.22571 + D.22574;
        D.22576 = *D.22575;
        D.22576->opcode = 366;
        D.22571 = cfg->varinfo;
        D.22572 = vmv->idx;
        D.22573 = (long unsigned int) D.22572;
        D.22574 = D.22573 * 8;
        D.22575 = D.22571 + D.22574;
        D.22576 = *D.22575;
        D.22541 = vmv->reg;
        D.22576->dreg = D.22541;
        n_regvars = n_regvars + 1;
        goto <D.22566>;
        <D.22565>:
        D.22579 = cfg->verbose_level;
        if (D.22579 > 2) goto <D.22585>; else goto <D.22586>;
        <D.22585>:
        D.22541 = vmv->reg;
        D.22587 = mono_arch_regname (D.22541);
        D.22588 = regalloc_cost (cfg, vmv);
        D.22567 = gains[reg_index];
        D.22571 = cfg->varinfo;
        D.22572 = vmv->idx;
        D.22573 = (long unsigned int) D.22572;
        D.22574 = D.22573 * 8;
        D.22575 = D.22571 + D.22574;
        D.22576 = *D.22575;
        D.22584 = D.22576->dreg;
        D.22550 = cfg->method;
        D.22589 = mono_method_full_name (D.22550, 1);
        printf ("COSTLY: %s R%d G%d C%d %s\n", D.22589, D.22584, D.22567, D.22588, D.22587);
        <D.22586>:
        vmv->reg = -1;
        <D.22566>:
      }
      <D.22560>:
      l = l->next;
      <D.22353>:
      if (l != 0B) goto <D.22352>; else goto <D.22354>;
      <D.22354>:
      cfg->stat_n_regvars = n_regvars;
      used_regs = 0;
      l = vars;
      goto <D.22356>;
      <D.22355>:
      vmv = l->data;
      D.22541 = vmv->reg;
      if (D.22541 >= 0) goto <D.22590>; else goto <D.22591>;
      <D.22590>:
      D.22541 = vmv->reg;
      D.22592 = 1 << D.22541;
      D.22593 = (long long unsigned int) D.22592;
      used_regs = D.22593 | used_regs;
      <D.22591>:
      l = l->next;
      <D.22356>:
      if (l != 0B) goto <D.22355>; else goto <D.22357>;
      <D.22357>:
      D.22594 = *used_mask;
      D.22595 = D.22594 | used_regs;
      *used_mask = D.22595;
      monoeg_g_list_free (active);
      monoeg_g_list_free (inactive);
    }
  finally
    {
      free_pos = {CLOBBER};
      gains = {CLOBBER};
    }
}


compare_by_interval_start_pos_func (const void * a, const void * b)
{
  gint D.22598;
  struct MonoLiveInterval * D.22600;
  struct MonoLiveRange2 * D.22601;
  struct MonoLiveInterval * D.22603;
  struct MonoLiveRange2 * D.22604;
  int D.22606;
  int D.22607;
  struct MonoMethodVar * v1;
  struct MonoMethodVar * v2;

  v1 = a;
  v2 = b;
  if (v1 == v2) goto <D.22596>; else goto <D.22597>;
  <D.22596>:
  D.22598 = 0;
  return D.22598;
  <D.22597>:
  D.22600 = v1->interval;
  D.22601 = D.22600->range;
  if (D.22601 != 0B) goto <D.22602>; else goto <D.22599>;
  <D.22602>:
  D.22603 = v2->interval;
  D.22604 = D.22603->range;
  if (D.22604 != 0B) goto <D.22605>; else goto <D.22599>;
  <D.22605>:
  D.22600 = v1->interval;
  D.22601 = D.22600->range;
  D.22606 = D.22601->from;
  D.22603 = v2->interval;
  D.22604 = D.22603->range;
  D.22607 = D.22604->from;
  D.22598 = D.22606 - D.22607;
  return D.22598;
  <D.22599>:
  D.22600 = v1->interval;
  D.22601 = D.22600->range;
  if (D.22601 != 0B) goto <D.22608>; else goto <D.22609>;
  <D.22608>:
  D.22598 = -1;
  return D.22598;
  <D.22609>:
  D.22598 = 1;
  return D.22598;
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.22613;
  int D.22618;
  void * D.22620;
  long unsigned int D.22621;

  D.22613 = __builtin_constant_p (__len);
  if (D.22613 != 0) goto <D.22614>; else goto <D.22615>;
  <D.22614>:
  if (__len == 0) goto <D.22616>; else goto <D.22617>;
  <D.22616>:
  D.22618 = __builtin_constant_p (__ch);
  if (D.22618 == 0) goto <D.22611>; else goto <D.22619>;
  <D.22619>:
  if (__ch != 0) goto <D.22611>; else goto <D.22612>;
  <D.22611>:
  __warn_memset_zero_len ();
  D.22620 = __dest;
  return D.22620;
  <D.22612>:
  <D.22617>:
  <D.22615>:
  D.22621 = __builtin_object_size (__dest, 0);
  D.22620 = __builtin___memset_chk (__dest, __ch, __len, D.22621);
  return D.22620;
}


regalloc_cost (struct MonoCompile * cfg, struct MonoMethodVar * vmv)
{
  struct MonoInst * * D.22623;
  unsigned int D.22624;
  long unsigned int D.22625;
  long unsigned int D.22626;
  struct MonoInst * * D.22627;
  guint32 D.22628;
  short unsigned int D.22629;
  _Bool D.22630;
  struct MonoInst * ins;

  D.22623 = cfg->varinfo;
  D.22624 = vmv->idx;
  D.22625 = (long unsigned int) D.22624;
  D.22626 = D.22625 * 8;
  D.22627 = D.22623 + D.22626;
  ins = *D.22627;
  D.22629 = ins->opcode;
  D.22630 = D.22629 == 330;
  D.22628 = (guint32) D.22630;
  return D.22628;
}


printf (const char * restrict __fmt)
{
  int D.22632;

  D.22632 = __printf_chk (1, __fmt, __builtin_va_arg_pack ());
  return D.22632;
}


