__attribute__((visibility ("hidden")))
mono_varlist_insert_sorted (struct MonoCompile * cfg, struct GList * list, struct MonoMethodVar * mv, int sort_type)
{
  struct GList * D.22281;
  int D.22284;
  int D.22285;
  unsigned int D.22291;
  unsigned int D.22292;
  unsigned int D.22296;
  unsigned int D.22297;
  struct GList * l;

  if (list == 0B) goto <D.22279>; else goto <D.22280>;
  <D.22279>:
  D.22281 = monoeg_g_list_prepend (0B, mv);
  return D.22281;
  <D.22280>:
  l = list;
  goto <D.22152>;
  <D.22151>:
  {
    struct MonoMethodVar * v1;

    v1 = l->data;
    if (sort_type == 2) goto <D.22282>; else goto <D.22283>;
    <D.22282>:
    D.22284 = mv->spill_costs;
    D.22285 = v1->spill_costs;
    if (D.22284 >= D.22285) goto <D.22286>; else goto <D.22287>;
    <D.22286>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.22150>;
    <D.22287>:
    goto <D.22288>;
    <D.22283>:
    if (sort_type == 1) goto <D.22289>; else goto <D.22290>;
    <D.22289>:
    D.22291 = mv->range.last_use.abs_pos;
    D.22292 = v1->range.last_use.abs_pos;
    if (D.22291 <= D.22292) goto <D.22293>; else goto <D.22294>;
    <D.22293>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.22150>;
    <D.22294>:
    goto <D.22295>;
    <D.22290>:
    D.22296 = mv->range.first_use.abs_pos;
    D.22297 = v1->range.first_use.abs_pos;
    if (D.22296 <= D.22297) goto <D.22298>; else goto <D.22299>;
    <D.22298>:
    list = monoeg_g_list_insert_before (list, l, mv);
    goto <D.22150>;
    <D.22299>:
    <D.22295>:
    <D.22288>:
  }
  l = l->next;
  <D.22152>:
  if (l != 0B) goto <D.22151>; else goto <D.22150>;
  <D.22150>:
  if (l == 0B) goto <D.22300>; else goto <D.22301>;
  <D.22300>:
  list = monoeg_g_list_append (list, mv);
  <D.22301>:
  D.22281 = list;
  return D.22281;
}


__attribute__((visibility ("hidden")))
mono_varlist_sort (struct MonoCompile * cfg, struct GList * list, int sort_type)
{
  struct GList * D.22305;

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


compare_by_first_use_func (const void * a, const void * b)
{
  gint D.22307;
  unsigned int D.22308;
  unsigned int D.22309;
  unsigned int D.22310;
  struct MonoMethodVar * v1;
  struct MonoMethodVar * v2;

  v1 = a;
  v2 = b;
  D.22308 = v1->range.first_use.abs_pos;
  D.22309 = v2->range.first_use.abs_pos;
  D.22310 = D.22308 - D.22309;
  D.22307 = (gint) D.22310;
  return D.22307;
}


__attribute__((visibility ("hidden")))
mono_linear_scan (struct MonoCompile * cfg, struct GList * vars, struct GList * regs, regmask_t * used_mask)
{
  void * D.22314;
  struct MonoLiveInterval * D.22315;
  unsigned int D.22318;
  void * D.22319;
  long int D.22320;
  unsigned int regnum.0;
  _Bool D.22322;
  long int D.22323;
  long int D.22324;
  long unsigned int D.22327;
  long unsigned int D.22328;
  unsigned int D.22331;
  unsigned int D.22332;
  int D.22334;
  long int D.22335;
  void * D.22336;
  int D.22337;
  int D.22338;
  int D.22339;
  unsigned int D.22343;
  unsigned int max_regs.1;
  int D.22346;
  unsigned int D.22347;
  int D.22353;
  unsigned int D.22355;
  _Bool D.22359;
  long int D.22360;
  long int D.22361;
  void * D.22364;
  long int D.22365;
  int D.22366;
  int D.22367;
  long long int D.22368;
  long long unsigned int D.22369;
  int D.22374;
  unsigned int D.22375;
  unsigned int D.22376;
  struct MonoInst * * D.22378;
  unsigned int D.22379;
  long unsigned int D.22380;
  long unsigned int D.22381;
  struct MonoInst * * D.22382;
  struct MonoInst * D.22383;
  short unsigned int D.22384;
  unsigned int D.22386;
  int D.22389;
  unsigned int D.22392;
  const char * D.22393;
  long unsigned int D.22400;
  long unsigned int D.22401;
  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.22312>; else goto <D.22313>;
      <D.22312>:
      D.22314 = vars->data;
      D.22315 = MEM[(struct MonoMethodVar *)D.22314].interval;
      if (D.22315 != 0B) goto <D.22316>; else goto <D.22317>;
      <D.22316>:
      mono_linear_scan2 (cfg, vars, regs, used_mask);
      return;
      <D.22317>:
      <D.22313>:
      cost_driven = 1;
      D.22318 = monoeg_g_list_length (regs);
      max_regs = (int) D.22318;
      l = regs;
      goto <D.22182>;
      <D.22181>:
      {
        int regnum;

        D.22319 = l->data;
        D.22320 = (long int) D.22319;
        regnum = (int) D.22320;
        regnum.0 = (unsigned int) regnum;
        D.22322 = regnum.0 > 63;
        D.22323 = (long int) D.22322;
        D.22324 = __builtin_expect (D.22323, 0);
        if (D.22324 != 0) goto <D.22325>; else goto <D.22326>;
        <D.22325>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 105, "regnum < G_N_ELEMENTS (gains)");
        <D.22326>:
        gains[regnum] = 0;
      }
      l = l->next;
      <D.22182>:
      if (l != 0B) goto <D.22181>; else goto <D.22183>;
      <D.22183>:
      l = vars;
      goto <D.22188>;
      <D.22187>:
      vmv = l->data;
      D.22327 = BIT_FIELD_REF <*cfg, 64, 5568>;
      D.22328 = D.22327 & 65536;
      if (D.22328 == 0) goto <D.22329>; else goto <D.22330>;
      <D.22329>:
      goto <D.22186>;
      <D.22185>:
      amv = active->data;
      D.22331 = amv->range.last_use.abs_pos;
      D.22332 = vmv->range.first_use.abs_pos;
      if (D.22331 > D.22332) goto <D.22184>; else goto <D.22333>;
      <D.22333>:
      active = monoeg_g_list_delete_link (active, active);
      D.22334 = amv->reg;
      D.22335 = (long int) D.22334;
      D.22336 = (void *) D.22335;
      regs = monoeg_g_list_prepend (regs, D.22336);
      D.22334 = amv->reg;
      D.22334 = amv->reg;
      D.22337 = gains[D.22334];
      D.22338 = amv->spill_costs;
      D.22339 = D.22337 + D.22338;
      gains[D.22334] = D.22339;
      <D.22186>:
      if (active != 0B) goto <D.22185>; else goto <D.22184>;
      <D.22184>:
      <D.22330>:
      if (active != 0B) goto <D.22342>; else goto <D.22340>;
      <D.22342>:
      D.22343 = monoeg_g_list_length (active);
      max_regs.1 = (unsigned int) max_regs;
      if (D.22343 == max_regs.1) goto <D.22345>; else goto <D.22340>;
      <D.22345>:
      D.22346 = max_regs + -1;
      D.22347 = (unsigned int) D.22346;
      a = monoeg_g_list_nth (active, D.22347);
      amv = a->data;
      if (cost_driven != 0) goto <D.22352>; else goto <D.22348>;
      <D.22352>:
      D.22338 = amv->spill_costs;
      D.22353 = vmv->spill_costs;
      if (D.22338 < D.22353) goto <D.22349>; else goto <D.22348>;
      <D.22348>:
      if (cost_driven == 0) goto <D.22354>; else goto <D.22350>;
      <D.22354>:
      D.22331 = amv->range.last_use.abs_pos;
      D.22355 = vmv->range.last_use.abs_pos;
      if (D.22331 > D.22355) goto <D.22349>; else goto <D.22350>;
      <D.22349>:
      D.22334 = amv->reg;
      vmv->reg = D.22334;
      amv->reg = -1;
      active = monoeg_g_list_delete_link (active, a);
      if (cost_driven != 0) goto <D.22356>; else goto <D.22357>;
      <D.22356>:
      active = mono_varlist_insert_sorted (cfg, active, vmv, 2);
      goto <D.22358>;
      <D.22357>:
      active = mono_varlist_insert_sorted (cfg, active, vmv, 1);
      <D.22358>:
      goto <D.22351>;
      <D.22350>:
      vmv->reg = -1;
      <D.22351>:
      goto <D.22341>;
      <D.22340>:
      D.22359 = regs == 0B;
      D.22360 = (long int) D.22359;
      D.22361 = __builtin_expect (D.22360, 0);
      if (D.22361 != 0) goto <D.22362>; else goto <D.22363>;
      <D.22362>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 168, "regs");
      <D.22363>:
      D.22364 = regs->data;
      D.22365 = (long int) D.22364;
      D.22366 = (int) D.22365;
      vmv->reg = D.22366;
      D.22367 = vmv->reg;
      D.22368 = 1 << D.22367;
      D.22369 = (long long unsigned int) D.22368;
      used_regs = D.22369 | used_regs;
      regs = monoeg_g_list_delete_link (regs, regs);
      active = mono_varlist_insert_sorted (cfg, active, vmv, 1);
      <D.22341>:
      l = l->next;
      <D.22188>:
      if (l != 0B) goto <D.22187>; else goto <D.22189>;
      <D.22189>:
      a = active;
      goto <D.22191>;
      <D.22190>:
      amv = a->data;
      D.22334 = amv->reg;
      D.22334 = amv->reg;
      D.22337 = gains[D.22334];
      D.22338 = amv->spill_costs;
      D.22339 = D.22337 + D.22338;
      gains[D.22334] = D.22339;
      a = a->next;
      <D.22191>:
      if (a != 0B) goto <D.22190>; else goto <D.22192>;
      <D.22192>:
      n_regvars = 0;
      l = vars;
      goto <D.22194>;
      <D.22193>:
      vmv = l->data;
      D.22367 = vmv->reg;
      if (D.22367 >= 0) goto <D.22370>; else goto <D.22371>;
      <D.22370>:
      D.22367 = vmv->reg;
      D.22374 = gains[D.22367];
      D.22375 = (unsigned int) D.22374;
      D.22376 = mono_arch_regalloc_cost (cfg, vmv);
      if (D.22375 > D.22376) goto <D.22377>; else goto <D.22372>;
      <D.22377>:
      D.22378 = cfg->varinfo;
      D.22379 = vmv->idx;
      D.22380 = (long unsigned int) D.22379;
      D.22381 = D.22380 * 8;
      D.22382 = D.22378 + D.22381;
      D.22383 = *D.22382;
      D.22384 = D.22383->opcode;
      if (D.22384 != 366) goto <D.22385>; else goto <D.22372>;
      <D.22385>:
      D.22386 = cfg->verbose_level;
      if (D.22386 > 2) goto <D.22387>; else goto <D.22388>;
      <D.22387>:
      D.22378 = cfg->varinfo;
      D.22379 = vmv->idx;
      D.22380 = (long unsigned int) D.22379;
      D.22381 = D.22380 * 8;
      D.22382 = D.22378 + D.22381;
      D.22383 = *D.22382;
      D.22389 = D.22383->dreg;
      D.22379 = vmv->idx;
      D.22367 = vmv->reg;
      D.22353 = vmv->spill_costs;
      printf ("ALLOCATED R%d(%d) TO HREG %d COST %d\n", D.22389, D.22379, D.22367, D.22353);
      <D.22388>:
      D.22378 = cfg->varinfo;
      D.22379 = vmv->idx;
      D.22380 = (long unsigned int) D.22379;
      D.22381 = D.22380 * 8;
      D.22382 = D.22378 + D.22381;
      D.22383 = *D.22382;
      D.22383->opcode = 366;
      D.22378 = cfg->varinfo;
      D.22379 = vmv->idx;
      D.22380 = (long unsigned int) D.22379;
      D.22381 = D.22380 * 8;
      D.22382 = D.22378 + D.22381;
      D.22383 = *D.22382;
      D.22367 = vmv->reg;
      D.22383->dreg = D.22367;
      n_regvars = n_regvars + 1;
      goto <D.22373>;
      <D.22372>:
      D.22386 = cfg->verbose_level;
      if (D.22386 > 2) goto <D.22390>; else goto <D.22391>;
      <D.22390>:
      D.22379 = vmv->idx;
      D.22353 = vmv->spill_costs;
      D.22392 = mono_arch_regalloc_cost (cfg, vmv);
      D.22367 = vmv->reg;
      D.22393 = mono_arch_regname (D.22367);
      printf ("COSTLY: R%d C%d C%d %s\n", D.22379, D.22353, D.22392, D.22393);
      <D.22391>:
      vmv->reg = -1;
      <D.22373>:
      <D.22371>:
      D.22367 = vmv->reg;
      if (D.22367 == -1) goto <D.22394>; else goto <D.22395>;
      <D.22394>:
      D.22386 = cfg->verbose_level;
      if (D.22386 > 2) goto <D.22396>; else goto <D.22397>;
      <D.22396>:
      D.22379 = vmv->idx;
      printf ("NOT REGVAR: %d\n", D.22379);
      <D.22397>:
      <D.22395>:
      l = l->next;
      <D.22194>:
      if (l != 0B) goto <D.22193>; else goto <D.22195>;
      <D.22195>:
      cfg->stat_n_regvars = n_regvars;
      used_regs = 0;
      l = vars;
      goto <D.22197>;
      <D.22196>:
      vmv = l->data;
      D.22367 = vmv->reg;
      if (D.22367 >= 0) goto <D.22398>; else goto <D.22399>;
      <D.22398>:
      D.22367 = vmv->reg;
      D.22368 = 1 << D.22367;
      D.22369 = (long long unsigned int) D.22368;
      used_regs = D.22369 | used_regs;
      <D.22399>:
      l = l->next;
      <D.22197>:
      if (l != 0B) goto <D.22196>; else goto <D.22198>;
      <D.22198>:
      D.22400 = *used_mask;
      D.22401 = D.22400 | used_regs;
      *used_mask = D.22401;
      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.22405;
  long unsigned int D.22406;
  long unsigned int D.22407;
  struct GList * D.22408;
  struct MonoLiveInterval * D.22409;
  struct MonoLiveRange2 * D.22410;
  struct MonoLiveInterval * D.22413;
  struct MonoLiveRange2 * D.22414;
  int D.22415;
  int D.22418;
  struct MonoLiveInterval * D.22421;
  struct MonoLiveRange2 * D.22422;
  int D.22423;
  int D.22426;
  int D.22429;
  int D.22432;
  struct MonoLiveInterval * D.22435;
  int D.22438;
  _Bool D.22441;
  long int D.22442;
  long int D.22443;
  int D.22446;
  struct MonoLiveRange2 * D.22447;
  int D.22448;
  int D.22451;
  int D.22452;
  int D.22453;
  int D.22454;
  int D.22458;
  int D.22461;
  int D.22462;
  int D.22463;
  int D.22466;
  int iftmp.2;
  struct MonoMethod * D.22470;
  long unsigned int D.22471;
  long unsigned int D.22472;
  int D.22476;
  unsigned int D.22481;
  void * D.22482;
  long int D.22483;
  int D.22484;
  int D.22487;
  unsigned int D.22488;
  unsigned int D.22489;
  struct MonoInst * * D.22491;
  unsigned int D.22492;
  long unsigned int D.22493;
  long unsigned int D.22494;
  struct MonoInst * * D.22495;
  struct MonoInst * D.22496;
  short unsigned int D.22497;
  unsigned int D.22499;
  int D.22502;
  unsigned int D.22503;
  const char * D.22504;
  char * D.22507;
  unsigned int D.22508;
  const char * D.22509;
  long long int D.22512;
  long long unsigned int D.22513;
  long unsigned int D.22514;
  long unsigned int D.22515;
  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.22228>;
      <D.22227>:
      vmv = l->data;
      l = l->next;
      <D.22228>:
      if (l != 0B) goto <D.22227>; else goto <D.22229>;
      <D.22229>:
      D.22405 = monoeg_g_list_length (regs);
      n_regs = (int) D.22405;
      D.22406 = (long unsigned int) n_regs;
      D.22407 = D.22406 * 4;
      memset (&gains, 0, D.22407);
      D.22408 = monoeg_g_list_copy (vars);
      unhandled = monoeg_g_list_sort (D.22408, compare_by_interval_start_pos_func);
      active = 0B;
      inactive = 0B;
      goto <D.22235>;
      <D.22266>:
      {
        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.22409 = current->interval;
        D.22410 = D.22409->range;
        if (D.22410 == 0B) goto <D.22411>; else goto <D.22412>;
        <D.22411>:
        // predicted unlikely by continue predictor.
        goto <D.22235>;
        <D.22412>:
        D.22409 = current->interval;
        D.22410 = D.22409->range;
        pos = D.22410->from;
        changed = 1;
        goto <D.22241>;
        <D.22240>:
        changed = 0;
        l = active;
        goto <D.22239>;
        <D.22238>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.22413 = v->interval;
          D.22414 = D.22413->last_range;
          D.22415 = D.22414->to;
          if (D.22415 < pos) goto <D.22416>; else goto <D.22417>;
          <D.22416>:
          active = monoeg_g_list_delete_link (active, l);
          changed = 1;
          goto <D.22237>;
          <D.22417>:
          D.22413 = v->interval;
          D.22418 = mono_linterval_covers (D.22413, pos);
          if (D.22418 == 0) goto <D.22419>; else goto <D.22420>;
          <D.22419>:
          inactive = monoeg_g_list_append (inactive, v);
          active = monoeg_g_list_delete_link (active, l);
          changed = 1;
          goto <D.22237>;
          <D.22420>:
        }
        l = l->next;
        <D.22239>:
        if (l != 0B) goto <D.22238>; else goto <D.22237>;
        <D.22237>:
        <D.22241>:
        if (changed != 0) goto <D.22240>; else goto <D.22242>;
        <D.22242>:
        changed = 1;
        goto <D.22248>;
        <D.22247>:
        changed = 0;
        l = inactive;
        goto <D.22246>;
        <D.22245>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.22421 = v->interval;
          D.22422 = D.22421->last_range;
          D.22423 = D.22422->to;
          if (D.22423 < pos) goto <D.22424>; else goto <D.22425>;
          <D.22424>:
          inactive = monoeg_g_list_delete_link (inactive, l);
          changed = 1;
          goto <D.22244>;
          <D.22425>:
          D.22421 = v->interval;
          D.22426 = mono_linterval_covers (D.22421, pos);
          if (D.22426 != 0) goto <D.22427>; else goto <D.22428>;
          <D.22427>:
          active = monoeg_g_list_append (active, v);
          inactive = monoeg_g_list_delete_link (inactive, l);
          changed = 1;
          goto <D.22244>;
          <D.22428>:
        }
        l = l->next;
        <D.22246>:
        if (l != 0B) goto <D.22245>; else goto <D.22244>;
        <D.22244>:
        <D.22248>:
        if (changed != 0) goto <D.22247>; else goto <D.22249>;
        <D.22249>:
        i = 0;
        goto <D.22251>;
        <D.22250>:
        free_pos[i] = 2147483647;
        i = i + 1;
        <D.22251>:
        if (i < n_regs) goto <D.22250>; else goto <D.22252>;
        <D.22252>:
        l = active;
        goto <D.22255>;
        <D.22254>:
        {
          struct MonoMethodVar * v;

          v = l->data;
          D.22429 = v->reg;
          if (D.22429 >= 0) goto <D.22430>; else goto <D.22431>;
          <D.22430>:
          D.22429 = v->reg;
          free_pos[D.22429] = 0;
          <D.22431>:
        }
        l = l->next;
        <D.22255>:
        if (l != 0B) goto <D.22254>; else goto <D.22256>;
        <D.22256>:
        l = inactive;
        goto <D.22260>;
        <D.22259>:
        {
          struct MonoMethodVar * v;
          gint32 intersect_pos;

          v = l->data;
          D.22432 = v->reg;
          if (D.22432 >= 0) goto <D.22433>; else goto <D.22434>;
          <D.22433>:
          D.22409 = current->interval;
          D.22435 = v->interval;
          intersect_pos = mono_linterval_get_intersect_pos (D.22409, D.22435);
          if (intersect_pos != -1) goto <D.22436>; else goto <D.22437>;
          <D.22436>:
          D.22432 = v->reg;
          free_pos[D.22432] = intersect_pos;
          <D.22437>:
          <D.22434>:
        }
        l = l->next;
        <D.22260>:
        if (l != 0B) goto <D.22259>; else goto <D.22261>;
        <D.22261>:
        max_free_pos = -1;
        reg = -1;
        i = 0;
        goto <D.22263>;
        <D.22262>:
        D.22438 = free_pos[i];
        if (D.22438 > max_free_pos) goto <D.22439>; else goto <D.22440>;
        <D.22439>:
        reg = i;
        max_free_pos = free_pos[i];
        <D.22440>:
        i = i + 1;
        <D.22263>:
        if (i < n_regs) goto <D.22262>; else goto <D.22264>;
        <D.22264>:
        D.22441 = reg == -1;
        D.22442 = (long int) D.22441;
        D.22443 = __builtin_expect (D.22442, 0);
        if (D.22443 != 0) goto <D.22444>; else goto <D.22445>;
        <D.22444>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "linear-scan.c", 402, "reg != -1");
        <D.22445>:
        D.22446 = free_pos[reg];
        D.22409 = current->interval;
        D.22447 = D.22409->last_range;
        D.22448 = D.22447->to;
        if (D.22446 >= D.22448) goto <D.22449>; else goto <D.22450>;
        <D.22449>:
        current->reg = reg;
        active = monoeg_g_list_append (active, current);
        D.22451 = current->reg;
        D.22451 = current->reg;
        D.22452 = gains[D.22451];
        D.22453 = current->spill_costs;
        D.22454 = D.22452 + D.22453;
        gains[D.22451] = D.22454;
        goto <D.22455>;
        <D.22450>:
        if (active != 0B) goto <D.22456>; else goto <D.22457>;
        <D.22456>:
        {
          struct GList * min_spill_pos;

          min_spill_pos = active;
          vmv = min_spill_pos->data;
          D.22458 = vmv->spill_costs;
          D.22453 = current->spill_costs;
          if (D.22458 < D.22453) goto <D.22459>; else goto <D.22460>;
          <D.22459>:
          D.22461 = vmv->reg;
          D.22461 = vmv->reg;
          D.22462 = gains[D.22461];
          D.22458 = vmv->spill_costs;
          D.22463 = D.22462 - D.22458;
          gains[D.22461] = D.22463;
          vmv->reg = -1;
          active = monoeg_g_list_delete_link (active, min_spill_pos);
          goto <D.22464>;
          <D.22460>:
          <D.22464>:
        }
        goto <D.22465>;
        <D.22457>:
        <D.22465>:
        <D.22455>:
      }
      <D.22235>:
      if (unhandled != 0B) goto <D.22266>; else goto <D.22267>;
      <D.22267>:
      i = 0;
      goto <D.22269>;
      <D.22268>:
      D.22466 = gains[i];
      if (D.22466 != 0) goto <D.22467>; else goto <D.22468>;
      <D.22467>:
      D.22466 = gains[i];
      D.22470 = cfg->method;
      D.22471 = BIT_FIELD_REF <*D.22470, 64, 256>;
      D.22472 = D.22471 & 36028797018963968;
      if (D.22472 != 0) goto <D.22473>; else goto <D.22474>;
      <D.22473>:
      iftmp.2 = 1;
      goto <D.22475>;
      <D.22474>:
      iftmp.2 = 2;
      <D.22475>:
      D.22476 = D.22466 - iftmp.2;
      gains[i] = D.22476;
      D.22466 = gains[i];
      if (D.22466 < 0) goto <D.22477>; else goto <D.22478>;
      <D.22477>:
      gains[i] = 0;
      <D.22478>:
      <D.22468>:
      i = i + 1;
      <D.22269>:
      if (i < n_regs) goto <D.22268>; else goto <D.22270>;
      <D.22270>:
      n_regvars = 0;
      l = vars;
      goto <D.22273>;
      <D.22272>:
      vmv = l->data;
      D.22461 = vmv->reg;
      if (D.22461 >= 0) goto <D.22479>; else goto <D.22480>;
      <D.22479>:
      {
        int reg_index;

        reg_index = vmv->reg;
        D.22461 = vmv->reg;
        D.22481 = (unsigned int) D.22461;
        D.22482 = monoeg_g_list_nth_data (regs, D.22481);
        D.22483 = (long int) D.22482;
        D.22484 = (int) D.22483;
        vmv->reg = D.22484;
        D.22487 = gains[reg_index];
        D.22488 = (unsigned int) D.22487;
        D.22489 = regalloc_cost (cfg, vmv);
        if (D.22488 > D.22489) goto <D.22490>; else goto <D.22485>;
        <D.22490>:
        D.22491 = cfg->varinfo;
        D.22492 = vmv->idx;
        D.22493 = (long unsigned int) D.22492;
        D.22494 = D.22493 * 8;
        D.22495 = D.22491 + D.22494;
        D.22496 = *D.22495;
        D.22497 = D.22496->opcode;
        if (D.22497 != 366) goto <D.22498>; else goto <D.22485>;
        <D.22498>:
        D.22499 = cfg->verbose_level;
        if (D.22499 > 2) goto <D.22500>; else goto <D.22501>;
        <D.22500>:
        D.22491 = cfg->varinfo;
        D.22492 = vmv->idx;
        D.22493 = (long unsigned int) D.22492;
        D.22494 = D.22493 * 8;
        D.22495 = D.22491 + D.22494;
        D.22496 = *D.22495;
        D.22502 = D.22496->dreg;
        D.22487 = gains[reg_index];
        D.22503 = regalloc_cost (cfg, vmv);
        D.22461 = vmv->reg;
        D.22504 = mono_arch_regname (D.22461);
        printf ("REGVAR R%d G%d C%d %s\n", D.22502, D.22487, D.22503, D.22504);
        <D.22501>:
        D.22491 = cfg->varinfo;
        D.22492 = vmv->idx;
        D.22493 = (long unsigned int) D.22492;
        D.22494 = D.22493 * 8;
        D.22495 = D.22491 + D.22494;
        D.22496 = *D.22495;
        D.22496->opcode = 366;
        D.22491 = cfg->varinfo;
        D.22492 = vmv->idx;
        D.22493 = (long unsigned int) D.22492;
        D.22494 = D.22493 * 8;
        D.22495 = D.22491 + D.22494;
        D.22496 = *D.22495;
        D.22461 = vmv->reg;
        D.22496->dreg = D.22461;
        n_regvars = n_regvars + 1;
        goto <D.22486>;
        <D.22485>:
        D.22499 = cfg->verbose_level;
        if (D.22499 > 2) goto <D.22505>; else goto <D.22506>;
        <D.22505>:
        D.22470 = cfg->method;
        D.22507 = mono_method_full_name (D.22470, 1);
        D.22491 = cfg->varinfo;
        D.22492 = vmv->idx;
        D.22493 = (long unsigned int) D.22492;
        D.22494 = D.22493 * 8;
        D.22495 = D.22491 + D.22494;
        D.22496 = *D.22495;
        D.22502 = D.22496->dreg;
        D.22487 = gains[reg_index];
        D.22508 = regalloc_cost (cfg, vmv);
        D.22461 = vmv->reg;
        D.22509 = mono_arch_regname (D.22461);
        printf ("COSTLY: %s R%d G%d C%d %s\n", D.22507, D.22502, D.22487, D.22508, D.22509);
        <D.22506>:
        vmv->reg = -1;
        <D.22486>:
      }
      <D.22480>:
      l = l->next;
      <D.22273>:
      if (l != 0B) goto <D.22272>; else goto <D.22274>;
      <D.22274>:
      cfg->stat_n_regvars = n_regvars;
      used_regs = 0;
      l = vars;
      goto <D.22276>;
      <D.22275>:
      vmv = l->data;
      D.22461 = vmv->reg;
      if (D.22461 >= 0) goto <D.22510>; else goto <D.22511>;
      <D.22510>:
      D.22461 = vmv->reg;
      D.22512 = 1 << D.22461;
      D.22513 = (long long unsigned int) D.22512;
      used_regs = D.22513 | used_regs;
      <D.22511>:
      l = l->next;
      <D.22276>:
      if (l != 0B) goto <D.22275>; else goto <D.22277>;
      <D.22277>:
      D.22514 = *used_mask;
      D.22515 = D.22514 | used_regs;
      *used_mask = D.22515;
      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.22518;
  struct MonoLiveInterval * D.22520;
  struct MonoLiveRange2 * D.22521;
  struct MonoLiveInterval * D.22523;
  struct MonoLiveRange2 * D.22524;
  int D.22526;
  int D.22527;
  struct MonoMethodVar * v1;
  struct MonoMethodVar * v2;

  v1 = a;
  v2 = b;
  if (v1 == v2) goto <D.22516>; else goto <D.22517>;
  <D.22516>:
  D.22518 = 0;
  return D.22518;
  <D.22517>:
  D.22520 = v1->interval;
  D.22521 = D.22520->range;
  if (D.22521 != 0B) goto <D.22522>; else goto <D.22519>;
  <D.22522>:
  D.22523 = v2->interval;
  D.22524 = D.22523->range;
  if (D.22524 != 0B) goto <D.22525>; else goto <D.22519>;
  <D.22525>:
  D.22520 = v1->interval;
  D.22521 = D.22520->range;
  D.22526 = D.22521->from;
  D.22523 = v2->interval;
  D.22524 = D.22523->range;
  D.22527 = D.22524->from;
  D.22518 = D.22526 - D.22527;
  return D.22518;
  <D.22519>:
  D.22520 = v1->interval;
  D.22521 = D.22520->range;
  if (D.22521 != 0B) goto <D.22528>; else goto <D.22529>;
  <D.22528>:
  D.22518 = -1;
  return D.22518;
  <D.22529>:
  D.22518 = 1;
  return D.22518;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
memset (void * __dest, int __ch, size_t __len)
{
  void * D.22531;
  long unsigned int D.22532;

  D.22532 = __builtin_object_size (__dest, 0);
  D.22531 = __builtin___memset_chk (__dest, __ch, __len, D.22532);
  return D.22531;
}


regalloc_cost (struct MonoCompile * cfg, struct MonoMethodVar * vmv)
{
  struct MonoInst * * D.22534;
  unsigned int D.22535;
  long unsigned int D.22536;
  long unsigned int D.22537;
  struct MonoInst * * D.22538;
  guint32 D.22539;
  short unsigned int D.22540;
  _Bool D.22541;
  struct MonoInst * ins;

  D.22534 = cfg->varinfo;
  D.22535 = vmv->idx;
  D.22536 = (long unsigned int) D.22535;
  D.22537 = D.22536 * 8;
  D.22538 = D.22534 + D.22537;
  ins = *D.22538;
  D.22540 = ins->opcode;
  D.22541 = D.22540 == 330;
  D.22539 = (guint32) D.22541;
  return D.22539;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__))
printf (const char * restrict __fmt)
{
  int D.22543;

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


