mono_varlist_insert_sorted (struct MonoCompile * cfg, struct GList * list, struct MonoMethodVar * mv, int sort_type)
{
  struct GList * D.21602;
  int D.21605;
  int D.21606;
  unsigned int D.21612;
  unsigned int D.21613;
  unsigned int D.21617;
  unsigned int D.21618;
  struct GList * l;

  if (list == 0B) goto <D.21600>; else goto <D.21601>;
  <D.21600>:
  D.21602 = monoeg_g_list_prepend (0B, mv);
  return D.21602;
  <D.21601>:
  l = list;
  goto <D.21473>;
  <D.21472>:
  {
    struct MonoMethodVar * v1;

    v1 = l->data;
    if (sort_type == 2) goto <D.21603>; else goto <D.21604>;
    <D.21603>:
    D.21605 = mv->spill_costs;
    D.21606 = v1->spill_costs;
    if (D.21605 >= D.21606) goto <D.21607>; else goto <D.21608>;
    <D.21607>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.21471>;
    <D.21608>:
    goto <D.21609>;
    <D.21604>:
    if (sort_type == 1) goto <D.21610>; else goto <D.21611>;
    <D.21610>:
    D.21612 = mv->range.last_use.abs_pos;
    D.21613 = v1->range.last_use.abs_pos;
    if (D.21612 <= D.21613) goto <D.21614>; else goto <D.21615>;
    <D.21614>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.21471>;
    <D.21615>:
    goto <D.21616>;
    <D.21611>:
    D.21617 = mv->range.first_use.abs_pos;
    D.21618 = v1->range.first_use.abs_pos;
    if (D.21617 <= D.21618) goto <D.21619>; else goto <D.21620>;
    <D.21619>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.21471>;
    <D.21620>:
    <D.21616>:
    <D.21609>:
  }
  l = l->next;
  <D.21473>:
  if (l != 0B) goto <D.21472>; else goto <D.21471>;
  <D.21471>:
  if (l == 0B) goto <D.21621>; else goto <D.21622>;
  <D.21621>:
  list = monoeg_g_list_append (list, mv);
  <D.21622>:
  D.21602 = list;
  return D.21602;
}


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

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


compare_by_first_use_func (const void * a, const void * b)
{
  gint D.21628;
  unsigned int D.21629;
  unsigned int D.21630;
  unsigned int D.21631;
  struct MonoMethodVar * v1;
  struct MonoMethodVar * v2;

  v1 = a;
  v2 = b;
  D.21629 = v1->range.first_use.abs_pos;
  D.21630 = v2->range.first_use.abs_pos;
  D.21631 = D.21629 - D.21630;
  D.21628 = (gint) D.21631;
  return D.21628;
}


mono_linear_scan (struct MonoCompile * cfg, struct GList * vars, struct GList * regs, regmask_t * used_mask)
{
  void * D.21635;
  struct MonoLiveInterval * D.21636;
  unsigned int D.21639;
  void * D.21640;
  unsigned int regnum.0;
  _Bool D.21642;
  long int D.21643;
  long int D.21644;
  unsigned int D.21647;
  unsigned int D.21648;
  unsigned int D.21651;
  unsigned int D.21652;
  int D.21654;
  void * D.21655;
  int D.21656;
  int D.21657;
  int D.21658;
  unsigned int D.21662;
  unsigned int max_regs.1;
  int D.21665;
  unsigned int D.21666;
  int D.21672;
  unsigned int D.21674;
  _Bool D.21678;
  long int D.21679;
  long int D.21680;
  void * D.21683;
  int D.21684;
  int D.21685;
  long long int D.21686;
  signed int D.21687;
  signed int used_regs.2;
  signed int D.21689;
  int D.21694;
  unsigned int D.21695;
  unsigned int D.21696;
  struct MonoInst * * D.21698;
  unsigned int D.21699;
  unsigned int D.21700;
  struct MonoInst * * D.21701;
  struct MonoInst * D.21702;
  short unsigned int D.21703;
  unsigned int D.21705;
  int D.21708;
  unsigned int D.21711;
  const char * D.21712;
  unsigned int D.21719;
  unsigned int D.21720;
  struct GList * l;
  struct GList * a;
  struct GList * active;
  struct MonoMethodVar * vmv;
  struct MonoMethodVar * amv;
  int max_regs;
  int n_regvars;
  int gains[32];
  regmask_t used_regs;
  gboolean cost_driven;

  try
    {
      active = 0B;
      used_regs = 0;
      if (vars != 0B) goto <D.21633>; else goto <D.21634>;
      <D.21633>:
      D.21635 = vars->data;
      D.21636 = MEM[(struct MonoMethodVar *)D.21635].interval;
      if (D.21636 != 0B) goto <D.21637>; else goto <D.21638>;
      <D.21637>:
      mono_linear_scan2 (cfg, vars, regs, used_mask);
      return;
      <D.21638>:
      <D.21634>:
      cost_driven = 1;
      D.21639 = monoeg_g_list_length (regs);
      max_regs = (int) D.21639;
      l = regs;
      goto <D.21503>;
      <D.21502>:
      {
        int regnum;

        D.21640 = l->data;
        regnum = (int) D.21640;
        regnum.0 = (unsigned int) regnum;
        D.21642 = regnum.0 > 31;
        D.21643 = (long int) D.21642;
        D.21644 = __builtin_expect (D.21643, 0);
        if (D.21644 != 0) goto <D.21645>; else goto <D.21646>;
        <D.21645>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 105, "regnum < G_N_ELEMENTS (gains)");
        <D.21646>:
        gains[regnum] = 0;
      }
      l = l->next;
      <D.21503>:
      if (l != 0B) goto <D.21502>; else goto <D.21504>;
      <D.21504>:
      l = vars;
      goto <D.21509>;
      <D.21508>:
      vmv = l->data;
      D.21647 = BIT_FIELD_REF <*cfg, 32, 3392>;
      D.21648 = D.21647 & 32768;
      if (D.21648 == 0) goto <D.21649>; else goto <D.21650>;
      <D.21649>:
      goto <D.21507>;
      <D.21506>:
      amv = active->data;
      D.21651 = amv->range.last_use.abs_pos;
      D.21652 = vmv->range.first_use.abs_pos;
      if (D.21651 > D.21652) goto <D.21505>; else goto <D.21653>;
      <D.21653>:
      active = monoeg_g_list_delete_link (active, active);
      D.21654 = amv->reg;
      D.21655 = (void *) D.21654;
      regs = monoeg_g_list_prepend (regs, D.21655);
      D.21654 = amv->reg;
      D.21654 = amv->reg;
      D.21656 = gains[D.21654];
      D.21657 = amv->spill_costs;
      D.21658 = D.21656 + D.21657;
      gains[D.21654] = D.21658;
      <D.21507>:
      if (active != 0B) goto <D.21506>; else goto <D.21505>;
      <D.21505>:
      <D.21650>:
      if (active != 0B) goto <D.21661>; else goto <D.21659>;
      <D.21661>:
      D.21662 = monoeg_g_list_length (active);
      max_regs.1 = (unsigned int) max_regs;
      if (D.21662 == max_regs.1) goto <D.21664>; else goto <D.21659>;
      <D.21664>:
      D.21665 = max_regs + -1;
      D.21666 = (unsigned int) D.21665;
      a = monoeg_g_list_nth (active, D.21666);
      amv = a->data;
      if (cost_driven != 0) goto <D.21671>; else goto <D.21667>;
      <D.21671>:
      D.21657 = amv->spill_costs;
      D.21672 = vmv->spill_costs;
      if (D.21657 < D.21672) goto <D.21668>; else goto <D.21667>;
      <D.21667>:
      if (cost_driven == 0) goto <D.21673>; else goto <D.21669>;
      <D.21673>:
      D.21651 = amv->range.last_use.abs_pos;
      D.21674 = vmv->range.last_use.abs_pos;
      if (D.21651 > D.21674) goto <D.21668>; else goto <D.21669>;
      <D.21668>:
      D.21654 = amv->reg;
      vmv->reg = D.21654;
      amv->reg = -1;
      active = monoeg_g_list_delete_link (active, a);
      if (cost_driven != 0) goto <D.21675>; else goto <D.21676>;
      <D.21675>:
      active = mono_varlist_insert_sorted (cfg, active, vmv, 2);
      goto <D.21677>;
      <D.21676>:
      active = mono_varlist_insert_sorted (cfg, active, vmv, 1);
      <D.21677>:
      goto <D.21670>;
      <D.21669>:
      vmv->reg = -1;
      <D.21670>:
      goto <D.21660>;
      <D.21659>:
      D.21678 = regs == 0B;
      D.21679 = (long int) D.21678;
      D.21680 = __builtin_expect (D.21679, 0);
      if (D.21680 != 0) goto <D.21681>; else goto <D.21682>;
      <D.21681>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 168, "regs");
      <D.21682>:
      D.21683 = regs->data;
      D.21684 = (int) D.21683;
      vmv->reg = D.21684;
      D.21685 = vmv->reg;
      D.21686 = 1 << D.21685;
      D.21687 = (signed int) D.21686;
      used_regs.2 = (signed int) used_regs;
      D.21689 = D.21687 | used_regs.2;
      used_regs = (regmask_t) D.21689;
      regs = monoeg_g_list_delete_link (regs, regs);
      active = mono_varlist_insert_sorted (cfg, active, vmv, 1);
      <D.21660>:
      l = l->next;
      <D.21509>:
      if (l != 0B) goto <D.21508>; else goto <D.21510>;
      <D.21510>:
      a = active;
      goto <D.21512>;
      <D.21511>:
      amv = a->data;
      D.21654 = amv->reg;
      D.21654 = amv->reg;
      D.21656 = gains[D.21654];
      D.21657 = amv->spill_costs;
      D.21658 = D.21656 + D.21657;
      gains[D.21654] = D.21658;
      a = a->next;
      <D.21512>:
      if (a != 0B) goto <D.21511>; else goto <D.21513>;
      <D.21513>:
      n_regvars = 0;
      l = vars;
      goto <D.21515>;
      <D.21514>:
      vmv = l->data;
      D.21685 = vmv->reg;
      if (D.21685 >= 0) goto <D.21690>; else goto <D.21691>;
      <D.21690>:
      D.21685 = vmv->reg;
      D.21694 = gains[D.21685];
      D.21695 = (unsigned int) D.21694;
      D.21696 = mono_arch_regalloc_cost (cfg, vmv);
      if (D.21695 > D.21696) goto <D.21697>; else goto <D.21692>;
      <D.21697>:
      D.21698 = cfg->varinfo;
      D.21699 = vmv->idx;
      D.21700 = D.21699 * 4;
      D.21701 = D.21698 + D.21700;
      D.21702 = *D.21701;
      D.21703 = D.21702->opcode;
      if (D.21703 != 366) goto <D.21704>; else goto <D.21692>;
      <D.21704>:
      D.21705 = cfg->verbose_level;
      if (D.21705 > 2) goto <D.21706>; else goto <D.21707>;
      <D.21706>:
      D.21698 = cfg->varinfo;
      D.21699 = vmv->idx;
      D.21700 = D.21699 * 4;
      D.21701 = D.21698 + D.21700;
      D.21702 = *D.21701;
      D.21708 = D.21702->dreg;
      D.21699 = vmv->idx;
      D.21685 = vmv->reg;
      D.21672 = vmv->spill_costs;
      printf ("ALLOCATED R%d(%d) TO HREG %d COST %d\n", D.21708, D.21699, D.21685, D.21672);
      <D.21707>:
      D.21698 = cfg->varinfo;
      D.21699 = vmv->idx;
      D.21700 = D.21699 * 4;
      D.21701 = D.21698 + D.21700;
      D.21702 = *D.21701;
      D.21702->opcode = 366;
      D.21698 = cfg->varinfo;
      D.21699 = vmv->idx;
      D.21700 = D.21699 * 4;
      D.21701 = D.21698 + D.21700;
      D.21702 = *D.21701;
      D.21685 = vmv->reg;
      D.21702->dreg = D.21685;
      n_regvars = n_regvars + 1;
      goto <D.21693>;
      <D.21692>:
      D.21705 = cfg->verbose_level;
      if (D.21705 > 2) goto <D.21709>; else goto <D.21710>;
      <D.21709>:
      D.21699 = vmv->idx;
      D.21672 = vmv->spill_costs;
      D.21711 = mono_arch_regalloc_cost (cfg, vmv);
      D.21685 = vmv->reg;
      D.21712 = mono_arch_regname (D.21685);
      printf ("COSTLY: R%d C%d C%d %s\n", D.21699, D.21672, D.21711, D.21712);
      <D.21710>:
      vmv->reg = -1;
      <D.21693>:
      <D.21691>:
      D.21685 = vmv->reg;
      if (D.21685 == -1) goto <D.21713>; else goto <D.21714>;
      <D.21713>:
      D.21705 = cfg->verbose_level;
      if (D.21705 > 2) goto <D.21715>; else goto <D.21716>;
      <D.21715>:
      D.21699 = vmv->idx;
      printf ("NOT REGVAR: %d\n", D.21699);
      <D.21716>:
      <D.21714>:
      l = l->next;
      <D.21515>:
      if (l != 0B) goto <D.21514>; else goto <D.21516>;
      <D.21516>:
      cfg->stat_n_regvars = n_regvars;
      used_regs = 0;
      l = vars;
      goto <D.21518>;
      <D.21517>:
      vmv = l->data;
      D.21685 = vmv->reg;
      if (D.21685 >= 0) goto <D.21717>; else goto <D.21718>;
      <D.21717>:
      D.21685 = vmv->reg;
      D.21686 = 1 << D.21685;
      D.21687 = (signed int) D.21686;
      used_regs.2 = (signed int) used_regs;
      D.21689 = D.21687 | used_regs.2;
      used_regs = (regmask_t) D.21689;
      <D.21718>:
      l = l->next;
      <D.21518>:
      if (l != 0B) goto <D.21517>; else goto <D.21519>;
      <D.21519>:
      D.21719 = *used_mask;
      D.21720 = D.21719 | used_regs;
      *used_mask = D.21720;
      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.21724;
  unsigned int n_regs.3;
  unsigned int D.21726;
  struct GList * D.21727;
  struct MonoLiveInterval * D.21728;
  struct MonoLiveRange2 * D.21729;
  struct MonoLiveInterval * D.21732;
  struct MonoLiveRange2 * D.21733;
  int D.21734;
  int D.21737;
  struct MonoLiveInterval * D.21740;
  struct MonoLiveRange2 * D.21741;
  int D.21742;
  int D.21745;
  int D.21748;
  int D.21751;
  struct MonoLiveInterval * D.21754;
  int D.21757;
  _Bool D.21760;
  long int D.21761;
  long int D.21762;
  int D.21765;
  struct MonoLiveRange2 * D.21766;
  int D.21767;
  int D.21770;
  int D.21771;
  int D.21772;
  int D.21773;
  int D.21777;
  int D.21780;
  int D.21781;
  int D.21782;
  int D.21785;
  int iftmp.4;
  struct MonoMethod * D.21789;
  unsigned int D.21790;
  unsigned int D.21791;
  int D.21795;
  unsigned int D.21800;
  void * D.21801;
  int D.21802;
  int D.21805;
  unsigned int D.21806;
  unsigned int D.21807;
  struct MonoInst * * D.21809;
  unsigned int D.21810;
  unsigned int D.21811;
  struct MonoInst * * D.21812;
  struct MonoInst * D.21813;
  short unsigned int D.21814;
  unsigned int D.21816;
  int D.21819;
  unsigned int D.21820;
  const char * D.21821;
  char * D.21824;
  unsigned int D.21825;
  const char * D.21826;
  long long int D.21829;
  signed int D.21830;
  signed int used_regs.5;
  signed int D.21832;
  unsigned int D.21833;
  unsigned int D.21834;
  struct GList * unhandled;
  struct GList * active;
  struct GList * inactive;
  struct GList * l;
  struct MonoMethodVar * vmv;
  gint32 free_pos[32];
  gint32 gains[32];
  regmask_t used_regs;
  int n_regs;
  int n_regvars;
  int i;

  try
    {
      used_regs = 0;
      l = vars;
      goto <D.21549>;
      <D.21548>:
      vmv = l->data;
      l = l->next;
      <D.21549>:
      if (l != 0B) goto <D.21548>; else goto <D.21550>;
      <D.21550>:
      D.21724 = monoeg_g_list_length (regs);
      n_regs = (int) D.21724;
      n_regs.3 = (unsigned int) n_regs;
      D.21726 = n_regs.3 * 4;
      memset (&gains, 0, D.21726);
      D.21727 = monoeg_g_list_copy (vars);
      unhandled = monoeg_g_list_sort (D.21727, compare_by_interval_start_pos_func);
      active = 0B;
      inactive = 0B;
      goto <D.21556>;
      <D.21587>:
      {
        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.21728 = current->interval;
        D.21729 = D.21728->range;
        if (D.21729 == 0B) goto <D.21730>; else goto <D.21731>;
        <D.21730>:
        // predicted unlikely by continue predictor.
        goto <D.21556>;
        <D.21731>:
        D.21728 = current->interval;
        D.21729 = D.21728->range;
        pos = D.21729->from;
        changed = 1;
        goto <D.21562>;
        <D.21561>:
        changed = 0;
        l = active;
        goto <D.21560>;
        <D.21559>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.21732 = v->interval;
          D.21733 = D.21732->last_range;
          D.21734 = D.21733->to;
          if (D.21734 < pos) goto <D.21735>; else goto <D.21736>;
          <D.21735>:
          active = monoeg_g_list_delete_link (active, l);
          changed = 1;
          goto <D.21558>;
          <D.21736>:
          D.21732 = v->interval;
          D.21737 = mono_linterval_covers (D.21732, pos);
          if (D.21737 == 0) goto <D.21738>; else goto <D.21739>;
          <D.21738>:
          inactive = monoeg_g_list_append (inactive, v);
          active = monoeg_g_list_delete_link (active, l);
          changed = 1;
          goto <D.21558>;
          <D.21739>:
        }
        l = l->next;
        <D.21560>:
        if (l != 0B) goto <D.21559>; else goto <D.21558>;
        <D.21558>:
        <D.21562>:
        if (changed != 0) goto <D.21561>; else goto <D.21563>;
        <D.21563>:
        changed = 1;
        goto <D.21569>;
        <D.21568>:
        changed = 0;
        l = inactive;
        goto <D.21567>;
        <D.21566>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.21740 = v->interval;
          D.21741 = D.21740->last_range;
          D.21742 = D.21741->to;
          if (D.21742 < pos) goto <D.21743>; else goto <D.21744>;
          <D.21743>:
          inactive = monoeg_g_list_delete_link (inactive, l);
          changed = 1;
          goto <D.21565>;
          <D.21744>:
          D.21740 = v->interval;
          D.21745 = mono_linterval_covers (D.21740, pos);
          if (D.21745 != 0) goto <D.21746>; else goto <D.21747>;
          <D.21746>:
          active = monoeg_g_list_append (active, v);
          inactive = monoeg_g_list_delete_link (inactive, l);
          changed = 1;
          goto <D.21565>;
          <D.21747>:
        }
        l = l->next;
        <D.21567>:
        if (l != 0B) goto <D.21566>; else goto <D.21565>;
        <D.21565>:
        <D.21569>:
        if (changed != 0) goto <D.21568>; else goto <D.21570>;
        <D.21570>:
        i = 0;
        goto <D.21572>;
        <D.21571>:
        free_pos[i] = 2147483647;
        i = i + 1;
        <D.21572>:
        if (i < n_regs) goto <D.21571>; else goto <D.21573>;
        <D.21573>:
        l = active;
        goto <D.21576>;
        <D.21575>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.21748 = v->reg;
          if (D.21748 >= 0) goto <D.21749>; else goto <D.21750>;
          <D.21749>:
          D.21748 = v->reg;
          free_pos[D.21748] = 0;
          <D.21750>:
        }
        l = l->next;
        <D.21576>:
        if (l != 0B) goto <D.21575>; else goto <D.21577>;
        <D.21577>:
        l = inactive;
        goto <D.21581>;
        <D.21580>:
        {
          struct MonoMethodVar * v;
          gint32 intersect_pos;

          v = l->data;
          D.21751 = v->reg;
          if (D.21751 >= 0) goto <D.21752>; else goto <D.21753>;
          <D.21752>:
          D.21728 = current->interval;
          D.21754 = v->interval;
          intersect_pos = mono_linterval_get_intersect_pos (D.21728, D.21754);
          if (intersect_pos != -1) goto <D.21755>; else goto <D.21756>;
          <D.21755>:
          D.21751 = v->reg;
          free_pos[D.21751] = intersect_pos;
          <D.21756>:
          <D.21753>:
        }
        l = l->next;
        <D.21581>:
        if (l != 0B) goto <D.21580>; else goto <D.21582>;
        <D.21582>:
        max_free_pos = -1;
        reg = -1;
        i = 0;
        goto <D.21584>;
        <D.21583>:
        D.21757 = free_pos[i];
        if (D.21757 > max_free_pos) goto <D.21758>; else goto <D.21759>;
        <D.21758>:
        reg = i;
        max_free_pos = free_pos[i];
        <D.21759>:
        i = i + 1;
        <D.21584>:
        if (i < n_regs) goto <D.21583>; else goto <D.21585>;
        <D.21585>:
        D.21760 = reg == -1;
        D.21761 = (long int) D.21760;
        D.21762 = __builtin_expect (D.21761, 0);
        if (D.21762 != 0) goto <D.21763>; else goto <D.21764>;
        <D.21763>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 402, "reg != -1");
        <D.21764>:
        D.21765 = free_pos[reg];
        D.21728 = current->interval;
        D.21766 = D.21728->last_range;
        D.21767 = D.21766->to;
        if (D.21765 >= D.21767) goto <D.21768>; else goto <D.21769>;
        <D.21768>:
        current->reg = reg;
        active = monoeg_g_list_append (active, current);
        D.21770 = current->reg;
        D.21770 = current->reg;
        D.21771 = gains[D.21770];
        D.21772 = current->spill_costs;
        D.21773 = D.21771 + D.21772;
        gains[D.21770] = D.21773;
        goto <D.21774>;
        <D.21769>:
        if (active != 0B) goto <D.21775>; else goto <D.21776>;
        <D.21775>:
        {
          struct GList * min_spill_pos;

          min_spill_pos = active;
          vmv = min_spill_pos->data;
          D.21777 = vmv->spill_costs;
          D.21772 = current->spill_costs;
          if (D.21777 < D.21772) goto <D.21778>; else goto <D.21779>;
          <D.21778>:
          D.21780 = vmv->reg;
          D.21780 = vmv->reg;
          D.21781 = gains[D.21780];
          D.21777 = vmv->spill_costs;
          D.21782 = D.21781 - D.21777;
          gains[D.21780] = D.21782;
          vmv->reg = -1;
          active = monoeg_g_list_delete_link (active, min_spill_pos);
          goto <D.21783>;
          <D.21779>:
          <D.21783>:
        }
        goto <D.21784>;
        <D.21776>:
        <D.21784>:
        <D.21774>:
      }
      <D.21556>:
      if (unhandled != 0B) goto <D.21587>; else goto <D.21588>;
      <D.21588>:
      i = 0;
      goto <D.21590>;
      <D.21589>:
      D.21785 = gains[i];
      if (D.21785 != 0) goto <D.21786>; else goto <D.21787>;
      <D.21786>:
      D.21785 = gains[i];
      D.21789 = cfg->method;
      D.21790 = BIT_FIELD_REF <*D.21789, 32, 160>;
      D.21791 = D.21790 & 256;
      if (D.21791 != 0) goto <D.21792>; else goto <D.21793>;
      <D.21792>:
      iftmp.4 = 1;
      goto <D.21794>;
      <D.21793>:
      iftmp.4 = 2;
      <D.21794>:
      D.21795 = D.21785 - iftmp.4;
      gains[i] = D.21795;
      D.21785 = gains[i];
      if (D.21785 < 0) goto <D.21796>; else goto <D.21797>;
      <D.21796>:
      gains[i] = 0;
      <D.21797>:
      <D.21787>:
      i = i + 1;
      <D.21590>:
      if (i < n_regs) goto <D.21589>; else goto <D.21591>;
      <D.21591>:
      n_regvars = 0;
      l = vars;
      goto <D.21594>;
      <D.21593>:
      vmv = l->data;
      D.21780 = vmv->reg;
      if (D.21780 >= 0) goto <D.21798>; else goto <D.21799>;
      <D.21798>:
      {
        int reg_index;

        reg_index = vmv->reg;
        D.21780 = vmv->reg;
        D.21800 = (unsigned int) D.21780;
        D.21801 = monoeg_g_list_nth_data (regs, D.21800);
        D.21802 = (int) D.21801;
        vmv->reg = D.21802;
        D.21805 = gains[reg_index];
        D.21806 = (unsigned int) D.21805;
        D.21807 = regalloc_cost (cfg, vmv);
        if (D.21806 > D.21807) goto <D.21808>; else goto <D.21803>;
        <D.21808>:
        D.21809 = cfg->varinfo;
        D.21810 = vmv->idx;
        D.21811 = D.21810 * 4;
        D.21812 = D.21809 + D.21811;
        D.21813 = *D.21812;
        D.21814 = D.21813->opcode;
        if (D.21814 != 366) goto <D.21815>; else goto <D.21803>;
        <D.21815>:
        D.21816 = cfg->verbose_level;
        if (D.21816 > 2) goto <D.21817>; else goto <D.21818>;
        <D.21817>:
        D.21809 = cfg->varinfo;
        D.21810 = vmv->idx;
        D.21811 = D.21810 * 4;
        D.21812 = D.21809 + D.21811;
        D.21813 = *D.21812;
        D.21819 = D.21813->dreg;
        D.21805 = gains[reg_index];
        D.21820 = regalloc_cost (cfg, vmv);
        D.21780 = vmv->reg;
        D.21821 = mono_arch_regname (D.21780);
        printf ("REGVAR R%d G%d C%d %s\n", D.21819, D.21805, D.21820, D.21821);
        <D.21818>:
        D.21809 = cfg->varinfo;
        D.21810 = vmv->idx;
        D.21811 = D.21810 * 4;
        D.21812 = D.21809 + D.21811;
        D.21813 = *D.21812;
        D.21813->opcode = 366;
        D.21809 = cfg->varinfo;
        D.21810 = vmv->idx;
        D.21811 = D.21810 * 4;
        D.21812 = D.21809 + D.21811;
        D.21813 = *D.21812;
        D.21780 = vmv->reg;
        D.21813->dreg = D.21780;
        n_regvars = n_regvars + 1;
        goto <D.21804>;
        <D.21803>:
        D.21816 = cfg->verbose_level;
        if (D.21816 > 2) goto <D.21822>; else goto <D.21823>;
        <D.21822>:
        D.21789 = cfg->method;
        D.21824 = mono_method_full_name (D.21789, 1);
        D.21809 = cfg->varinfo;
        D.21810 = vmv->idx;
        D.21811 = D.21810 * 4;
        D.21812 = D.21809 + D.21811;
        D.21813 = *D.21812;
        D.21819 = D.21813->dreg;
        D.21805 = gains[reg_index];
        D.21825 = regalloc_cost (cfg, vmv);
        D.21780 = vmv->reg;
        D.21826 = mono_arch_regname (D.21780);
        printf ("COSTLY: %s R%d G%d C%d %s\n", D.21824, D.21819, D.21805, D.21825, D.21826);
        <D.21823>:
        vmv->reg = -1;
        <D.21804>:
      }
      <D.21799>:
      l = l->next;
      <D.21594>:
      if (l != 0B) goto <D.21593>; else goto <D.21595>;
      <D.21595>:
      cfg->stat_n_regvars = n_regvars;
      used_regs = 0;
      l = vars;
      goto <D.21597>;
      <D.21596>:
      vmv = l->data;
      D.21780 = vmv->reg;
      if (D.21780 >= 0) goto <D.21827>; else goto <D.21828>;
      <D.21827>:
      D.21780 = vmv->reg;
      D.21829 = 1 << D.21780;
      D.21830 = (signed int) D.21829;
      used_regs.5 = (signed int) used_regs;
      D.21832 = D.21830 | used_regs.5;
      used_regs = (regmask_t) D.21832;
      <D.21828>:
      l = l->next;
      <D.21597>:
      if (l != 0B) goto <D.21596>; else goto <D.21598>;
      <D.21598>:
      D.21833 = *used_mask;
      D.21834 = D.21833 | used_regs;
      *used_mask = D.21834;
      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.21837;
  struct MonoLiveInterval * D.21839;
  struct MonoLiveRange2 * D.21840;
  struct MonoLiveInterval * D.21842;
  struct MonoLiveRange2 * D.21843;
  int D.21845;
  int D.21846;
  struct MonoMethodVar * v1;
  struct MonoMethodVar * v2;

  v1 = a;
  v2 = b;
  if (v1 == v2) goto <D.21835>; else goto <D.21836>;
  <D.21835>:
  D.21837 = 0;
  return D.21837;
  <D.21836>:
  D.21839 = v1->interval;
  D.21840 = D.21839->range;
  if (D.21840 != 0B) goto <D.21841>; else goto <D.21838>;
  <D.21841>:
  D.21842 = v2->interval;
  D.21843 = D.21842->range;
  if (D.21843 != 0B) goto <D.21844>; else goto <D.21838>;
  <D.21844>:
  D.21839 = v1->interval;
  D.21840 = D.21839->range;
  D.21845 = D.21840->from;
  D.21842 = v2->interval;
  D.21843 = D.21842->range;
  D.21846 = D.21843->from;
  D.21837 = D.21845 - D.21846;
  return D.21837;
  <D.21838>:
  D.21839 = v1->interval;
  D.21840 = D.21839->range;
  if (D.21840 != 0B) goto <D.21847>; else goto <D.21848>;
  <D.21847>:
  D.21837 = -1;
  return D.21837;
  <D.21848>:
  D.21837 = 1;
  return D.21837;
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.21852;
  int D.21857;
  void * D.21859;
  unsigned int D.21860;

  D.21852 = __builtin_constant_p (__len);
  if (D.21852 != 0) goto <D.21853>; else goto <D.21854>;
  <D.21853>:
  if (__len == 0) goto <D.21855>; else goto <D.21856>;
  <D.21855>:
  D.21857 = __builtin_constant_p (__ch);
  if (D.21857 == 0) goto <D.21850>; else goto <D.21858>;
  <D.21858>:
  if (__ch != 0) goto <D.21850>; else goto <D.21851>;
  <D.21850>:
  __warn_memset_zero_len ();
  D.21859 = __dest;
  return D.21859;
  <D.21851>:
  <D.21856>:
  <D.21854>:
  D.21860 = __builtin_object_size (__dest, 0);
  D.21859 = __builtin___memset_chk (__dest, __ch, __len, D.21860);
  return D.21859;
}


regalloc_cost (struct MonoCompile * cfg, struct MonoMethodVar * vmv)
{
  struct MonoInst * * D.21862;
  unsigned int D.21863;
  unsigned int D.21864;
  struct MonoInst * * D.21865;
  guint32 D.21866;
  short unsigned int D.21867;
  _Bool D.21868;
  struct MonoInst * ins;

  D.21862 = cfg->varinfo;
  D.21863 = vmv->idx;
  D.21864 = D.21863 * 4;
  D.21865 = D.21862 + D.21864;
  ins = *D.21865;
  D.21867 = ins->opcode;
  D.21868 = D.21867 == 330;
  D.21866 = (guint32) D.21868;
  return D.21866;
}


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

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


