mono_varlist_insert_sorted (struct MonoCompile * cfg, struct GList * list, struct MonoMethodVar * mv, int sort_type)
{
  struct GList * D.22451;
  int D.22454;
  int D.22455;
  unsigned int D.22461;
  unsigned int D.22462;
  unsigned int D.22466;
  unsigned int D.22467;
  struct GList * l;

  if (list == 0B) goto <D.22449>; else goto <D.22450>;
  <D.22449>:
  D.22451 = monoeg_g_list_prepend (0B, mv);
  return D.22451;
  <D.22450>:
  l = list;
  goto <D.22322>;
  <D.22321>:
  {
    struct MonoMethodVar * v1;

    v1 = l->data;
    if (sort_type == 2) goto <D.22452>; else goto <D.22453>;
    <D.22452>:
    D.22454 = mv->spill_costs;
    D.22455 = v1->spill_costs;
    if (D.22454 >= D.22455) goto <D.22456>; else goto <D.22457>;
    <D.22456>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.22320>;
    <D.22457>:
    goto <D.22458>;
    <D.22453>:
    if (sort_type == 1) goto <D.22459>; else goto <D.22460>;
    <D.22459>:
    D.22461 = mv->range.last_use.abs_pos;
    D.22462 = v1->range.last_use.abs_pos;
    if (D.22461 <= D.22462) goto <D.22463>; else goto <D.22464>;
    <D.22463>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.22320>;
    <D.22464>:
    goto <D.22465>;
    <D.22460>:
    D.22466 = mv->range.first_use.abs_pos;
    D.22467 = v1->range.first_use.abs_pos;
    if (D.22466 <= D.22467) goto <D.22468>; else goto <D.22469>;
    <D.22468>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.22320>;
    <D.22469>:
    <D.22465>:
    <D.22458>:
  }
  l = l->next;
  <D.22322>:
  if (l != 0B) goto <D.22321>; else goto <D.22320>;
  <D.22320>:
  if (l == 0B) goto <D.22470>; else goto <D.22471>;
  <D.22470>:
  list = monoeg_g_list_append (list, mv);
  <D.22471>:
  D.22451 = list;
  return D.22451;
}


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

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


compare_by_first_use_func (const void * a, const void * b)
{
  gint D.22477;
  unsigned int D.22478;
  unsigned int D.22479;
  unsigned int D.22480;
  struct MonoMethodVar * v1;
  struct MonoMethodVar * v2;

  v1 = a;
  v2 = b;
  D.22478 = v1->range.first_use.abs_pos;
  D.22479 = v2->range.first_use.abs_pos;
  D.22480 = D.22478 - D.22479;
  D.22477 = (gint) D.22480;
  return D.22477;
}


mono_linear_scan (struct MonoCompile * cfg, struct GList * vars, struct GList * regs, regmask_t * used_mask)
{
  void * D.22484;
  struct MonoLiveInterval * D.22485;
  unsigned int D.22488;
  void * D.22489;
  long int D.22490;
  unsigned int regnum.0;
  _Bool D.22492;
  long int D.22493;
  long int D.22494;
  long unsigned int D.22497;
  long unsigned int D.22498;
  unsigned int D.22501;
  unsigned int D.22502;
  int D.22504;
  long int D.22505;
  void * D.22506;
  int D.22507;
  int D.22508;
  int D.22509;
  unsigned int D.22513;
  unsigned int max_regs.1;
  int D.22516;
  unsigned int D.22517;
  int D.22523;
  unsigned int D.22525;
  _Bool D.22529;
  long int D.22530;
  long int D.22531;
  void * D.22534;
  long int D.22535;
  int D.22536;
  int D.22537;
  long long int D.22538;
  long long unsigned int D.22539;
  int D.22544;
  unsigned int D.22545;
  unsigned int D.22546;
  struct MonoInst * * D.22548;
  unsigned int D.22549;
  long unsigned int D.22550;
  long unsigned int D.22551;
  struct MonoInst * * D.22552;
  struct MonoInst * D.22553;
  short unsigned int D.22554;
  unsigned int D.22556;
  int D.22559;
  unsigned int D.22562;
  const char * D.22563;
  long unsigned int D.22570;
  long unsigned int D.22571;
  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.22482>; else goto <D.22483>;
      <D.22482>:
      D.22484 = vars->data;
      D.22485 = MEM[(struct MonoMethodVar *)D.22484].interval;
      if (D.22485 != 0B) goto <D.22486>; else goto <D.22487>;
      <D.22486>:
      mono_linear_scan2 (cfg, vars, regs, used_mask);
      return;
      <D.22487>:
      <D.22483>:
      cost_driven = 1;
      D.22488 = monoeg_g_list_length (regs);
      max_regs = (int) D.22488;
      l = regs;
      goto <D.22352>;
      <D.22351>:
      {
        int regnum;

        D.22489 = l->data;
        D.22490 = (long int) D.22489;
        regnum = (int) D.22490;
        regnum.0 = (unsigned int) regnum;
        D.22492 = regnum.0 > 63;
        D.22493 = (long int) D.22492;
        D.22494 = __builtin_expect (D.22493, 0);
        if (D.22494 != 0) goto <D.22495>; else goto <D.22496>;
        <D.22495>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 105, "regnum < G_N_ELEMENTS (gains)");
        <D.22496>:
        gains[regnum] = 0;
      }
      l = l->next;
      <D.22352>:
      if (l != 0B) goto <D.22351>; else goto <D.22353>;
      <D.22353>:
      l = vars;
      goto <D.22358>;
      <D.22357>:
      vmv = l->data;
      D.22497 = BIT_FIELD_REF <*cfg, 64, 5568>;
      D.22498 = D.22497 & 140737488355328;
      if (D.22498 == 0) goto <D.22499>; else goto <D.22500>;
      <D.22499>:
      goto <D.22356>;
      <D.22355>:
      amv = active->data;
      D.22501 = amv->range.last_use.abs_pos;
      D.22502 = vmv->range.first_use.abs_pos;
      if (D.22501 > D.22502) goto <D.22354>; else goto <D.22503>;
      <D.22503>:
      active = monoeg_g_list_delete_link (active, active);
      D.22504 = amv->reg;
      D.22505 = (long int) D.22504;
      D.22506 = (void *) D.22505;
      regs = monoeg_g_list_prepend (regs, D.22506);
      D.22504 = amv->reg;
      D.22504 = amv->reg;
      D.22507 = gains[D.22504];
      D.22508 = amv->spill_costs;
      D.22509 = D.22507 + D.22508;
      gains[D.22504] = D.22509;
      <D.22356>:
      if (active != 0B) goto <D.22355>; else goto <D.22354>;
      <D.22354>:
      <D.22500>:
      if (active != 0B) goto <D.22512>; else goto <D.22510>;
      <D.22512>:
      D.22513 = monoeg_g_list_length (active);
      max_regs.1 = (unsigned int) max_regs;
      if (D.22513 == max_regs.1) goto <D.22515>; else goto <D.22510>;
      <D.22515>:
      D.22516 = max_regs + -1;
      D.22517 = (unsigned int) D.22516;
      a = monoeg_g_list_nth (active, D.22517);
      amv = a->data;
      if (cost_driven != 0) goto <D.22522>; else goto <D.22518>;
      <D.22522>:
      D.22508 = amv->spill_costs;
      D.22523 = vmv->spill_costs;
      if (D.22508 < D.22523) goto <D.22519>; else goto <D.22518>;
      <D.22518>:
      if (cost_driven == 0) goto <D.22524>; else goto <D.22520>;
      <D.22524>:
      D.22501 = amv->range.last_use.abs_pos;
      D.22525 = vmv->range.last_use.abs_pos;
      if (D.22501 > D.22525) goto <D.22519>; else goto <D.22520>;
      <D.22519>:
      D.22504 = amv->reg;
      vmv->reg = D.22504;
      amv->reg = -1;
      active = monoeg_g_list_delete_link (active, a);
      if (cost_driven != 0) goto <D.22526>; else goto <D.22527>;
      <D.22526>:
      active = mono_varlist_insert_sorted (cfg, active, vmv, 2);
      goto <D.22528>;
      <D.22527>:
      active = mono_varlist_insert_sorted (cfg, active, vmv, 1);
      <D.22528>:
      goto <D.22521>;
      <D.22520>:
      vmv->reg = -1;
      <D.22521>:
      goto <D.22511>;
      <D.22510>:
      D.22529 = regs == 0B;
      D.22530 = (long int) D.22529;
      D.22531 = __builtin_expect (D.22530, 0);
      if (D.22531 != 0) goto <D.22532>; else goto <D.22533>;
      <D.22532>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 168, "regs");
      <D.22533>:
      D.22534 = regs->data;
      D.22535 = (long int) D.22534;
      D.22536 = (int) D.22535;
      vmv->reg = D.22536;
      D.22537 = vmv->reg;
      D.22538 = 1 << D.22537;
      D.22539 = (long long unsigned int) D.22538;
      used_regs = D.22539 | used_regs;
      regs = monoeg_g_list_delete_link (regs, regs);
      active = mono_varlist_insert_sorted (cfg, active, vmv, 1);
      <D.22511>:
      l = l->next;
      <D.22358>:
      if (l != 0B) goto <D.22357>; else goto <D.22359>;
      <D.22359>:
      a = active;
      goto <D.22361>;
      <D.22360>:
      amv = a->data;
      D.22504 = amv->reg;
      D.22504 = amv->reg;
      D.22507 = gains[D.22504];
      D.22508 = amv->spill_costs;
      D.22509 = D.22507 + D.22508;
      gains[D.22504] = D.22509;
      a = a->next;
      <D.22361>:
      if (a != 0B) goto <D.22360>; else goto <D.22362>;
      <D.22362>:
      n_regvars = 0;
      l = vars;
      goto <D.22364>;
      <D.22363>:
      vmv = l->data;
      D.22537 = vmv->reg;
      if (D.22537 >= 0) goto <D.22540>; else goto <D.22541>;
      <D.22540>:
      D.22537 = vmv->reg;
      D.22544 = gains[D.22537];
      D.22545 = (unsigned int) D.22544;
      D.22546 = mono_arch_regalloc_cost (cfg, vmv);
      if (D.22545 > D.22546) goto <D.22547>; else goto <D.22542>;
      <D.22547>:
      D.22548 = cfg->varinfo;
      D.22549 = vmv->idx;
      D.22550 = (long unsigned int) D.22549;
      D.22551 = D.22550 * 8;
      D.22552 = D.22548 + D.22551;
      D.22553 = *D.22552;
      D.22554 = D.22553->opcode;
      if (D.22554 != 366) goto <D.22555>; else goto <D.22542>;
      <D.22555>:
      D.22556 = cfg->verbose_level;
      if (D.22556 > 2) goto <D.22557>; else goto <D.22558>;
      <D.22557>:
      D.22548 = cfg->varinfo;
      D.22549 = vmv->idx;
      D.22550 = (long unsigned int) D.22549;
      D.22551 = D.22550 * 8;
      D.22552 = D.22548 + D.22551;
      D.22553 = *D.22552;
      D.22559 = D.22553->dreg;
      D.22549 = vmv->idx;
      D.22537 = vmv->reg;
      D.22523 = vmv->spill_costs;
      printf ("ALLOCATED R%d(%d) TO HREG %d COST %d\n", D.22559, D.22549, D.22537, D.22523);
      <D.22558>:
      D.22548 = cfg->varinfo;
      D.22549 = vmv->idx;
      D.22550 = (long unsigned int) D.22549;
      D.22551 = D.22550 * 8;
      D.22552 = D.22548 + D.22551;
      D.22553 = *D.22552;
      D.22553->opcode = 366;
      D.22548 = cfg->varinfo;
      D.22549 = vmv->idx;
      D.22550 = (long unsigned int) D.22549;
      D.22551 = D.22550 * 8;
      D.22552 = D.22548 + D.22551;
      D.22553 = *D.22552;
      D.22537 = vmv->reg;
      D.22553->dreg = D.22537;
      n_regvars = n_regvars + 1;
      goto <D.22543>;
      <D.22542>:
      D.22556 = cfg->verbose_level;
      if (D.22556 > 2) goto <D.22560>; else goto <D.22561>;
      <D.22560>:
      D.22549 = vmv->idx;
      D.22523 = vmv->spill_costs;
      D.22562 = mono_arch_regalloc_cost (cfg, vmv);
      D.22537 = vmv->reg;
      D.22563 = mono_arch_regname (D.22537);
      printf ("COSTLY: R%d C%d C%d %s\n", D.22549, D.22523, D.22562, D.22563);
      <D.22561>:
      vmv->reg = -1;
      <D.22543>:
      <D.22541>:
      D.22537 = vmv->reg;
      if (D.22537 == -1) goto <D.22564>; else goto <D.22565>;
      <D.22564>:
      D.22556 = cfg->verbose_level;
      if (D.22556 > 2) goto <D.22566>; else goto <D.22567>;
      <D.22566>:
      D.22549 = vmv->idx;
      printf ("NOT REGVAR: %d\n", D.22549);
      <D.22567>:
      <D.22565>:
      l = l->next;
      <D.22364>:
      if (l != 0B) goto <D.22363>; else goto <D.22365>;
      <D.22365>:
      cfg->stat_n_regvars = n_regvars;
      used_regs = 0;
      l = vars;
      goto <D.22367>;
      <D.22366>:
      vmv = l->data;
      D.22537 = vmv->reg;
      if (D.22537 >= 0) goto <D.22568>; else goto <D.22569>;
      <D.22568>:
      D.22537 = vmv->reg;
      D.22538 = 1 << D.22537;
      D.22539 = (long long unsigned int) D.22538;
      used_regs = D.22539 | used_regs;
      <D.22569>:
      l = l->next;
      <D.22367>:
      if (l != 0B) goto <D.22366>; else goto <D.22368>;
      <D.22368>:
      D.22570 = *used_mask;
      D.22571 = D.22570 | used_regs;
      *used_mask = D.22571;
      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.22575;
  long unsigned int D.22576;
  long unsigned int D.22577;
  struct GList * D.22578;
  struct MonoLiveInterval * D.22579;
  struct MonoLiveRange2 * D.22580;
  struct MonoLiveInterval * D.22583;
  struct MonoLiveRange2 * D.22584;
  int D.22585;
  int D.22588;
  struct MonoLiveInterval * D.22591;
  struct MonoLiveRange2 * D.22592;
  int D.22593;
  int D.22596;
  int D.22599;
  int D.22602;
  struct MonoLiveInterval * D.22605;
  int D.22608;
  _Bool D.22611;
  long int D.22612;
  long int D.22613;
  int D.22616;
  struct MonoLiveRange2 * D.22617;
  int D.22618;
  int D.22621;
  int D.22622;
  int D.22623;
  int D.22624;
  int D.22628;
  int D.22631;
  int D.22632;
  int D.22633;
  int D.22636;
  int iftmp.2;
  struct MonoMethod * D.22640;
  long unsigned int D.22641;
  long unsigned int D.22642;
  int D.22646;
  unsigned int D.22651;
  void * D.22652;
  long int D.22653;
  int D.22654;
  int D.22657;
  unsigned int D.22658;
  unsigned int D.22659;
  struct MonoInst * * D.22661;
  unsigned int D.22662;
  long unsigned int D.22663;
  long unsigned int D.22664;
  struct MonoInst * * D.22665;
  struct MonoInst * D.22666;
  short unsigned int D.22667;
  unsigned int D.22669;
  int D.22672;
  unsigned int D.22673;
  const char * D.22674;
  char * D.22677;
  unsigned int D.22678;
  const char * D.22679;
  long long int D.22682;
  long long unsigned int D.22683;
  long unsigned int D.22684;
  long unsigned int D.22685;
  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.22398>;
      <D.22397>:
      vmv = l->data;
      l = l->next;
      <D.22398>:
      if (l != 0B) goto <D.22397>; else goto <D.22399>;
      <D.22399>:
      D.22575 = monoeg_g_list_length (regs);
      n_regs = (int) D.22575;
      D.22576 = (long unsigned int) n_regs;
      D.22577 = D.22576 * 4;
      memset (&gains, 0, D.22577);
      D.22578 = monoeg_g_list_copy (vars);
      unhandled = monoeg_g_list_sort (D.22578, compare_by_interval_start_pos_func);
      active = 0B;
      inactive = 0B;
      goto <D.22405>;
      <D.22436>:
      {
        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.22579 = current->interval;
        D.22580 = D.22579->range;
        if (D.22580 == 0B) goto <D.22581>; else goto <D.22582>;
        <D.22581>:
        // predicted unlikely by continue predictor.
        goto <D.22405>;
        <D.22582>:
        D.22579 = current->interval;
        D.22580 = D.22579->range;
        pos = D.22580->from;
        changed = 1;
        goto <D.22411>;
        <D.22410>:
        changed = 0;
        l = active;
        goto <D.22409>;
        <D.22408>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.22583 = v->interval;
          D.22584 = D.22583->last_range;
          D.22585 = D.22584->to;
          if (D.22585 < pos) goto <D.22586>; else goto <D.22587>;
          <D.22586>:
          active = monoeg_g_list_delete_link (active, l);
          changed = 1;
          goto <D.22407>;
          <D.22587>:
          D.22583 = v->interval;
          D.22588 = mono_linterval_covers (D.22583, pos);
          if (D.22588 == 0) goto <D.22589>; else goto <D.22590>;
          <D.22589>:
          inactive = monoeg_g_list_append (inactive, v);
          active = monoeg_g_list_delete_link (active, l);
          changed = 1;
          goto <D.22407>;
          <D.22590>:
        }
        l = l->next;
        <D.22409>:
        if (l != 0B) goto <D.22408>; else goto <D.22407>;
        <D.22407>:
        <D.22411>:
        if (changed != 0) goto <D.22410>; else goto <D.22412>;
        <D.22412>:
        changed = 1;
        goto <D.22418>;
        <D.22417>:
        changed = 0;
        l = inactive;
        goto <D.22416>;
        <D.22415>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.22591 = v->interval;
          D.22592 = D.22591->last_range;
          D.22593 = D.22592->to;
          if (D.22593 < pos) goto <D.22594>; else goto <D.22595>;
          <D.22594>:
          inactive = monoeg_g_list_delete_link (inactive, l);
          changed = 1;
          goto <D.22414>;
          <D.22595>:
          D.22591 = v->interval;
          D.22596 = mono_linterval_covers (D.22591, pos);
          if (D.22596 != 0) goto <D.22597>; else goto <D.22598>;
          <D.22597>:
          active = monoeg_g_list_append (active, v);
          inactive = monoeg_g_list_delete_link (inactive, l);
          changed = 1;
          goto <D.22414>;
          <D.22598>:
        }
        l = l->next;
        <D.22416>:
        if (l != 0B) goto <D.22415>; else goto <D.22414>;
        <D.22414>:
        <D.22418>:
        if (changed != 0) goto <D.22417>; else goto <D.22419>;
        <D.22419>:
        i = 0;
        goto <D.22421>;
        <D.22420>:
        free_pos[i] = 2147483647;
        i = i + 1;
        <D.22421>:
        if (i < n_regs) goto <D.22420>; else goto <D.22422>;
        <D.22422>:
        l = active;
        goto <D.22425>;
        <D.22424>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.22599 = v->reg;
          if (D.22599 >= 0) goto <D.22600>; else goto <D.22601>;
          <D.22600>:
          D.22599 = v->reg;
          free_pos[D.22599] = 0;
          <D.22601>:
        }
        l = l->next;
        <D.22425>:
        if (l != 0B) goto <D.22424>; else goto <D.22426>;
        <D.22426>:
        l = inactive;
        goto <D.22430>;
        <D.22429>:
        {
          struct MonoMethodVar * v;
          gint32 intersect_pos;

          v = l->data;
          D.22602 = v->reg;
          if (D.22602 >= 0) goto <D.22603>; else goto <D.22604>;
          <D.22603>:
          D.22579 = current->interval;
          D.22605 = v->interval;
          intersect_pos = mono_linterval_get_intersect_pos (D.22579, D.22605);
          if (intersect_pos != -1) goto <D.22606>; else goto <D.22607>;
          <D.22606>:
          D.22602 = v->reg;
          free_pos[D.22602] = intersect_pos;
          <D.22607>:
          <D.22604>:
        }
        l = l->next;
        <D.22430>:
        if (l != 0B) goto <D.22429>; else goto <D.22431>;
        <D.22431>:
        max_free_pos = -1;
        reg = -1;
        i = 0;
        goto <D.22433>;
        <D.22432>:
        D.22608 = free_pos[i];
        if (D.22608 > max_free_pos) goto <D.22609>; else goto <D.22610>;
        <D.22609>:
        reg = i;
        max_free_pos = free_pos[i];
        <D.22610>:
        i = i + 1;
        <D.22433>:
        if (i < n_regs) goto <D.22432>; else goto <D.22434>;
        <D.22434>:
        D.22611 = reg == -1;
        D.22612 = (long int) D.22611;
        D.22613 = __builtin_expect (D.22612, 0);
        if (D.22613 != 0) goto <D.22614>; else goto <D.22615>;
        <D.22614>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 402, "reg != -1");
        <D.22615>:
        D.22616 = free_pos[reg];
        D.22579 = current->interval;
        D.22617 = D.22579->last_range;
        D.22618 = D.22617->to;
        if (D.22616 >= D.22618) goto <D.22619>; else goto <D.22620>;
        <D.22619>:
        current->reg = reg;
        active = monoeg_g_list_append (active, current);
        D.22621 = current->reg;
        D.22621 = current->reg;
        D.22622 = gains[D.22621];
        D.22623 = current->spill_costs;
        D.22624 = D.22622 + D.22623;
        gains[D.22621] = D.22624;
        goto <D.22625>;
        <D.22620>:
        if (active != 0B) goto <D.22626>; else goto <D.22627>;
        <D.22626>:
        {
          struct GList * min_spill_pos;

          min_spill_pos = active;
          vmv = min_spill_pos->data;
          D.22628 = vmv->spill_costs;
          D.22623 = current->spill_costs;
          if (D.22628 < D.22623) goto <D.22629>; else goto <D.22630>;
          <D.22629>:
          D.22631 = vmv->reg;
          D.22631 = vmv->reg;
          D.22632 = gains[D.22631];
          D.22628 = vmv->spill_costs;
          D.22633 = D.22632 - D.22628;
          gains[D.22631] = D.22633;
          vmv->reg = -1;
          active = monoeg_g_list_delete_link (active, min_spill_pos);
          goto <D.22634>;
          <D.22630>:
          <D.22634>:
        }
        goto <D.22635>;
        <D.22627>:
        <D.22635>:
        <D.22625>:
      }
      <D.22405>:
      if (unhandled != 0B) goto <D.22436>; else goto <D.22437>;
      <D.22437>:
      i = 0;
      goto <D.22439>;
      <D.22438>:
      D.22636 = gains[i];
      if (D.22636 != 0) goto <D.22637>; else goto <D.22638>;
      <D.22637>:
      D.22636 = gains[i];
      D.22640 = cfg->method;
      D.22641 = BIT_FIELD_REF <*D.22640, 64, 256>;
      D.22642 = D.22641 & 256;
      if (D.22642 != 0) goto <D.22643>; else goto <D.22644>;
      <D.22643>:
      iftmp.2 = 1;
      goto <D.22645>;
      <D.22644>:
      iftmp.2 = 2;
      <D.22645>:
      D.22646 = D.22636 - iftmp.2;
      gains[i] = D.22646;
      D.22636 = gains[i];
      if (D.22636 < 0) goto <D.22647>; else goto <D.22648>;
      <D.22647>:
      gains[i] = 0;
      <D.22648>:
      <D.22638>:
      i = i + 1;
      <D.22439>:
      if (i < n_regs) goto <D.22438>; else goto <D.22440>;
      <D.22440>:
      n_regvars = 0;
      l = vars;
      goto <D.22443>;
      <D.22442>:
      vmv = l->data;
      D.22631 = vmv->reg;
      if (D.22631 >= 0) goto <D.22649>; else goto <D.22650>;
      <D.22649>:
      {
        int reg_index;

        reg_index = vmv->reg;
        D.22631 = vmv->reg;
        D.22651 = (unsigned int) D.22631;
        D.22652 = monoeg_g_list_nth_data (regs, D.22651);
        D.22653 = (long int) D.22652;
        D.22654 = (int) D.22653;
        vmv->reg = D.22654;
        D.22657 = gains[reg_index];
        D.22658 = (unsigned int) D.22657;
        D.22659 = regalloc_cost (cfg, vmv);
        if (D.22658 > D.22659) goto <D.22660>; else goto <D.22655>;
        <D.22660>:
        D.22661 = cfg->varinfo;
        D.22662 = vmv->idx;
        D.22663 = (long unsigned int) D.22662;
        D.22664 = D.22663 * 8;
        D.22665 = D.22661 + D.22664;
        D.22666 = *D.22665;
        D.22667 = D.22666->opcode;
        if (D.22667 != 366) goto <D.22668>; else goto <D.22655>;
        <D.22668>:
        D.22669 = cfg->verbose_level;
        if (D.22669 > 2) goto <D.22670>; else goto <D.22671>;
        <D.22670>:
        D.22661 = cfg->varinfo;
        D.22662 = vmv->idx;
        D.22663 = (long unsigned int) D.22662;
        D.22664 = D.22663 * 8;
        D.22665 = D.22661 + D.22664;
        D.22666 = *D.22665;
        D.22672 = D.22666->dreg;
        D.22657 = gains[reg_index];
        D.22673 = regalloc_cost (cfg, vmv);
        D.22631 = vmv->reg;
        D.22674 = mono_arch_regname (D.22631);
        printf ("REGVAR R%d G%d C%d %s\n", D.22672, D.22657, D.22673, D.22674);
        <D.22671>:
        D.22661 = cfg->varinfo;
        D.22662 = vmv->idx;
        D.22663 = (long unsigned int) D.22662;
        D.22664 = D.22663 * 8;
        D.22665 = D.22661 + D.22664;
        D.22666 = *D.22665;
        D.22666->opcode = 366;
        D.22661 = cfg->varinfo;
        D.22662 = vmv->idx;
        D.22663 = (long unsigned int) D.22662;
        D.22664 = D.22663 * 8;
        D.22665 = D.22661 + D.22664;
        D.22666 = *D.22665;
        D.22631 = vmv->reg;
        D.22666->dreg = D.22631;
        n_regvars = n_regvars + 1;
        goto <D.22656>;
        <D.22655>:
        D.22669 = cfg->verbose_level;
        if (D.22669 > 2) goto <D.22675>; else goto <D.22676>;
        <D.22675>:
        D.22640 = cfg->method;
        D.22677 = mono_method_full_name (D.22640, 1);
        D.22661 = cfg->varinfo;
        D.22662 = vmv->idx;
        D.22663 = (long unsigned int) D.22662;
        D.22664 = D.22663 * 8;
        D.22665 = D.22661 + D.22664;
        D.22666 = *D.22665;
        D.22672 = D.22666->dreg;
        D.22657 = gains[reg_index];
        D.22678 = regalloc_cost (cfg, vmv);
        D.22631 = vmv->reg;
        D.22679 = mono_arch_regname (D.22631);
        printf ("COSTLY: %s R%d G%d C%d %s\n", D.22677, D.22672, D.22657, D.22678, D.22679);
        <D.22676>:
        vmv->reg = -1;
        <D.22656>:
      }
      <D.22650>:
      l = l->next;
      <D.22443>:
      if (l != 0B) goto <D.22442>; else goto <D.22444>;
      <D.22444>:
      cfg->stat_n_regvars = n_regvars;
      used_regs = 0;
      l = vars;
      goto <D.22446>;
      <D.22445>:
      vmv = l->data;
      D.22631 = vmv->reg;
      if (D.22631 >= 0) goto <D.22680>; else goto <D.22681>;
      <D.22680>:
      D.22631 = vmv->reg;
      D.22682 = 1 << D.22631;
      D.22683 = (long long unsigned int) D.22682;
      used_regs = D.22683 | used_regs;
      <D.22681>:
      l = l->next;
      <D.22446>:
      if (l != 0B) goto <D.22445>; else goto <D.22447>;
      <D.22447>:
      D.22684 = *used_mask;
      D.22685 = D.22684 | used_regs;
      *used_mask = D.22685;
      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.22688;
  struct MonoLiveInterval * D.22690;
  struct MonoLiveRange2 * D.22691;
  struct MonoLiveInterval * D.22693;
  struct MonoLiveRange2 * D.22694;
  int D.22696;
  int D.22697;
  struct MonoMethodVar * v1;
  struct MonoMethodVar * v2;

  v1 = a;
  v2 = b;
  if (v1 == v2) goto <D.22686>; else goto <D.22687>;
  <D.22686>:
  D.22688 = 0;
  return D.22688;
  <D.22687>:
  D.22690 = v1->interval;
  D.22691 = D.22690->range;
  if (D.22691 != 0B) goto <D.22692>; else goto <D.22689>;
  <D.22692>:
  D.22693 = v2->interval;
  D.22694 = D.22693->range;
  if (D.22694 != 0B) goto <D.22695>; else goto <D.22689>;
  <D.22695>:
  D.22690 = v1->interval;
  D.22691 = D.22690->range;
  D.22696 = D.22691->from;
  D.22693 = v2->interval;
  D.22694 = D.22693->range;
  D.22697 = D.22694->from;
  D.22688 = D.22696 - D.22697;
  return D.22688;
  <D.22689>:
  D.22690 = v1->interval;
  D.22691 = D.22690->range;
  if (D.22691 != 0B) goto <D.22698>; else goto <D.22699>;
  <D.22698>:
  D.22688 = -1;
  return D.22688;
  <D.22699>:
  D.22688 = 1;
  return D.22688;
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.22703;
  int D.22708;
  void * D.22710;
  long unsigned int D.22711;

  D.22703 = __builtin_constant_p (__len);
  if (D.22703 != 0) goto <D.22704>; else goto <D.22705>;
  <D.22704>:
  if (__len == 0) goto <D.22706>; else goto <D.22707>;
  <D.22706>:
  D.22708 = __builtin_constant_p (__ch);
  if (D.22708 == 0) goto <D.22701>; else goto <D.22709>;
  <D.22709>:
  if (__ch != 0) goto <D.22701>; else goto <D.22702>;
  <D.22701>:
  __warn_memset_zero_len ();
  D.22710 = __dest;
  return D.22710;
  <D.22702>:
  <D.22707>:
  <D.22705>:
  D.22711 = __builtin_object_size (__dest, 0);
  D.22710 = __builtin___memset_chk (__dest, __ch, __len, D.22711);
  return D.22710;
}


regalloc_cost (struct MonoCompile * cfg, struct MonoMethodVar * vmv)
{
  struct MonoInst * * D.22713;
  unsigned int D.22714;
  long unsigned int D.22715;
  long unsigned int D.22716;
  struct MonoInst * * D.22717;
  guint32 D.22718;
  short unsigned int D.22719;
  _Bool D.22720;
  struct MonoInst * ins;

  D.22713 = cfg->varinfo;
  D.22714 = vmv->idx;
  D.22715 = (long unsigned int) D.22714;
  D.22716 = D.22715 * 8;
  D.22717 = D.22713 + D.22716;
  ins = *D.22717;
  D.22719 = ins->opcode;
  D.22720 = D.22719 == 330;
  D.22718 = (guint32) D.22720;
  return D.22718;
}


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

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


