monoeg_g_list_alloc ()
{
  struct GList * D.5644;

  D.5644 = monoeg_malloc0 (24);
  return D.5644;
}


monoeg_g_list_prepend (struct GList * list, void * data)
{
  struct GList * D.5646;
  struct GList * iftmp.0;

  if (list != 0B) goto <D.5648>; else goto <D.5649>;
  <D.5648>:
  iftmp.0 = list->prev;
  goto <D.5650>;
  <D.5649>:
  iftmp.0 = 0B;
  <D.5650>:
  D.5646 = new_node (iftmp.0, data, list);
  return D.5646;
}


new_node (struct GList * prev, void * data, struct GList * next)
{
  struct GList * D.5656;
  struct GList * node;

  node = monoeg_g_list_alloc ();
  node->data = data;
  node->prev = prev;
  node->next = next;
  if (prev != 0B) goto <D.5652>; else goto <D.5653>;
  <D.5652>:
  prev->next = node;
  <D.5653>:
  if (next != 0B) goto <D.5654>; else goto <D.5655>;
  <D.5654>:
  next->prev = node;
  <D.5655>:
  D.5656 = node;
  return D.5656;
}


monoeg_g_list_free_1 (struct GList * list)
{
  monoeg_g_free (list);
}


monoeg_g_list_free (struct GList * list)
{
  goto <D.5457>;
  <D.5456>:
  {
    struct GList * next;

    next = list->next;
    monoeg_g_list_free_1 (list);
    list = next;
  }
  <D.5457>:
  if (list != 0B) goto <D.5456>; else goto <D.5458>;
  <D.5458>:
}


monoeg_g_list_append (struct GList * list, void * data)
{
  struct GList * D.5658;
  struct GList * D.5659;
  struct GList * iftmp.1;
  struct GList * node;

  D.5658 = monoeg_g_list_last (list);
  node = new_node (D.5658, data, 0B);
  if (list != 0B) goto <D.5661>; else goto <D.5662>;
  <D.5661>:
  iftmp.1 = list;
  goto <D.5663>;
  <D.5662>:
  iftmp.1 = node;
  <D.5663>:
  D.5659 = iftmp.1;
  return D.5659;
}


monoeg_g_list_concat (struct GList * list1, struct GList * list2)
{
  struct GList * D.5669;
  struct GList * D.5670;
  struct GList * D.5671;
  struct GList * iftmp.2;

  if (list1 != 0B) goto <D.5665>; else goto <D.5666>;
  <D.5665>:
  if (list2 != 0B) goto <D.5667>; else goto <D.5668>;
  <D.5667>:
  D.5669 = monoeg_g_list_last (list1);
  list2->prev = D.5669;
  D.5670 = list2->prev;
  D.5670->next = list2;
  <D.5668>:
  <D.5666>:
  if (list1 != 0B) goto <D.5673>; else goto <D.5674>;
  <D.5673>:
  iftmp.2 = list1;
  goto <D.5675>;
  <D.5674>:
  iftmp.2 = list2;
  <D.5675>:
  D.5671 = iftmp.2;
  return D.5671;
}


monoeg_g_list_length (struct GList * list)
{
  guint D.5677;
  guint length;

  length = 0;
  goto <D.5473>;
  <D.5472>:
  length = length + 1;
  list = list->next;
  <D.5473>:
  if (list != 0B) goto <D.5472>; else goto <D.5474>;
  <D.5474>:
  D.5677 = length;
  return D.5677;
}


monoeg_g_list_remove (struct GList * list, const void * data)
{
  struct GList * D.5681;
  struct GList * D.5684;
  struct GList * current;

  current = monoeg_g_list_find (list, data);
  if (current == 0B) goto <D.5679>; else goto <D.5680>;
  <D.5679>:
  D.5681 = list;
  return D.5681;
  <D.5680>:
  if (current == list) goto <D.5682>; else goto <D.5683>;
  <D.5682>:
  list = list->next;
  <D.5683>:
  D.5684 = disconnect_node (current);
  monoeg_g_list_free_1 (D.5684);
  D.5681 = list;
  return D.5681;
}


disconnect_node (struct GList * node)
{
  struct GList * D.5686;
  struct GList * D.5689;
  struct GList * D.5692;

  D.5686 = node->next;
  if (D.5686 != 0B) goto <D.5687>; else goto <D.5688>;
  <D.5687>:
  D.5686 = node->next;
  D.5689 = node->prev;
  D.5686->prev = D.5689;
  <D.5688>:
  D.5689 = node->prev;
  if (D.5689 != 0B) goto <D.5690>; else goto <D.5691>;
  <D.5690>:
  D.5689 = node->prev;
  D.5686 = node->next;
  D.5689->next = D.5686;
  <D.5691>:
  D.5692 = node;
  return D.5692;
}


monoeg_g_list_remove_all (struct GList * list, const void * data)
{
  struct GList * D.5696;
  struct GList * D.5699;
  struct GList * current;

  current = monoeg_g_list_find (list, data);
  if (current == 0B) goto <D.5694>; else goto <D.5695>;
  <D.5694>:
  D.5696 = list;
  return D.5696;
  <D.5695>:
  goto <D.5486>;
  <D.5485>:
  if (current == list) goto <D.5697>; else goto <D.5698>;
  <D.5697>:
  list = list->next;
  <D.5698>:
  D.5699 = disconnect_node (current);
  monoeg_g_list_free_1 (D.5699);
  current = monoeg_g_list_find (list, data);
  <D.5486>:
  if (current != 0B) goto <D.5485>; else goto <D.5487>;
  <D.5487>:
  D.5696 = list;
  return D.5696;
}


monoeg_g_list_remove_link (struct GList * list, struct GList * link)
{
  struct GList * D.5703;

  if (list == link) goto <D.5701>; else goto <D.5702>;
  <D.5701>:
  list = list->next;
  <D.5702>:
  disconnect_node (link);
  link->next = 0B;
  link->prev = 0B;
  D.5703 = list;
  return D.5703;
}


monoeg_g_list_delete_link (struct GList * list, struct GList * link)
{
  struct GList * D.5705;

  list = monoeg_g_list_remove_link (list, link);
  monoeg_g_list_free_1 (link);
  D.5705 = list;
  return D.5705;
}


monoeg_g_list_find (struct GList * list, const void * data)
{
  void * D.5707;
  struct GList * D.5710;

  goto <D.5501>;
  <D.5500>:
  D.5707 = list->data;
  if (D.5707 == data) goto <D.5708>; else goto <D.5709>;
  <D.5708>:
  D.5710 = list;
  return D.5710;
  <D.5709>:
  list = list->next;
  <D.5501>:
  if (list != 0B) goto <D.5500>; else goto <D.5502>;
  <D.5502>:
  D.5710 = 0B;
  return D.5710;
}


monoeg_g_list_find_custom (struct GList * list, const void * data, gint (*GCompareFunc) (const void *, const void *) func)
{
  struct GList * D.5714;
  void * D.5715;
  int D.5716;

  if (func == 0B) goto <D.5712>; else goto <D.5713>;
  <D.5712>:
  D.5714 = 0B;
  return D.5714;
  <D.5713>:
  goto <D.5509>;
  <D.5508>:
  D.5715 = list->data;
  D.5716 = func (D.5715, data);
  if (D.5716 == 0) goto <D.5717>; else goto <D.5718>;
  <D.5717>:
  D.5714 = list;
  return D.5714;
  <D.5718>:
  list = list->next;
  <D.5509>:
  if (list != 0B) goto <D.5508>; else goto <D.5510>;
  <D.5510>:
  D.5714 = 0B;
  return D.5714;
}


monoeg_g_list_reverse (struct GList * list)
{
  struct GList * D.5720;
  struct GList * D.5721;
  struct GList * reverse;

  reverse = 0B;
  goto <D.5516>;
  <D.5515>:
  reverse = list;
  list = reverse->next;
  D.5720 = reverse->prev;
  reverse->next = D.5720;
  reverse->prev = list;
  <D.5516>:
  if (list != 0B) goto <D.5515>; else goto <D.5517>;
  <D.5517>:
  D.5721 = reverse;
  return D.5721;
}


monoeg_g_list_first (struct GList * list)
{
  struct GList * D.5725;
  struct GList * D.5726;

  if (list == 0B) goto <D.5723>; else goto <D.5724>;
  <D.5723>:
  D.5725 = 0B;
  return D.5725;
  <D.5724>:
  goto <D.5522>;
  <D.5521>:
  list = list->prev;
  <D.5522>:
  D.5726 = list->prev;
  if (D.5726 != 0B) goto <D.5521>; else goto <D.5523>;
  <D.5523>:
  D.5725 = list;
  return D.5725;
}


monoeg_g_list_last (struct GList * list)
{
  struct GList * D.5730;
  struct GList * D.5731;

  if (list == 0B) goto <D.5728>; else goto <D.5729>;
  <D.5728>:
  D.5730 = 0B;
  return D.5730;
  <D.5729>:
  goto <D.5528>;
  <D.5527>:
  list = list->next;
  <D.5528>:
  D.5731 = list->next;
  if (D.5731 != 0B) goto <D.5527>; else goto <D.5529>;
  <D.5529>:
  D.5730 = list;
  return D.5730;
}


monoeg_g_list_insert_sorted (struct GList * list, void * data, gint (*GCompareFunc) (const void *, const void *) func)
{
  struct GList * D.5735;
  void * D.5736;
  int D.5737;
  struct GList * iftmp.3;
  struct GList * prev;
  struct GList * current;
  struct GList * node;

  prev = 0B;
  if (func == 0B) goto <D.5733>; else goto <D.5734>;
  <D.5733>:
  D.5735 = list;
  return D.5735;
  <D.5734>:
  current = list;
  goto <D.5540>;
  <D.5539>:
  D.5736 = current->data;
  D.5737 = func (D.5736, data);
  if (D.5737 > 0) goto <D.5538>; else goto <D.5738>;
  <D.5738>:
  prev = current;
  current = current->next;
  <D.5540>:
  if (current != 0B) goto <D.5539>; else goto <D.5538>;
  <D.5538>:
  node = new_node (prev, data, current);
  if (list == current) goto <D.5740>; else goto <D.5741>;
  <D.5740>:
  iftmp.3 = node;
  goto <D.5742>;
  <D.5741>:
  iftmp.3 = list;
  <D.5742>:
  D.5735 = iftmp.3;
  return D.5735;
}


monoeg_g_list_insert_before (struct GList * list, struct GList * sibling, void * data)
{
  struct GList * D.5746;
  struct GList * D.5747;
  struct GList * iftmp.4;

  if (sibling != 0B) goto <D.5744>; else goto <D.5745>;
  <D.5744>:
  {
    struct GList * node;

    D.5746 = sibling->prev;
    node = new_node (D.5746, data, sibling);
    if (list == sibling) goto <D.5749>; else goto <D.5750>;
    <D.5749>:
    iftmp.4 = node;
    goto <D.5751>;
    <D.5750>:
    iftmp.4 = list;
    <D.5751>:
    D.5747 = iftmp.4;
    return D.5747;
  }
  <D.5745>:
  D.5747 = monoeg_g_list_append (list, data);
  return D.5747;
}


monoeg_g_list_foreach (struct GList * list, void (*GFunc) (void *, void *) func, void * user_data)
{
  void * D.5753;

  goto <D.5553>;
  <D.5552>:
  D.5753 = list->data;
  func (D.5753, user_data);
  list = list->next;
  <D.5553>:
  if (list != 0B) goto <D.5552>; else goto <D.5554>;
  <D.5554>:
}


monoeg_g_list_index (struct GList * list, const void * data)
{
  void * D.5754;
  gint D.5757;
  gint index;

  index = 0;
  goto <D.5561>;
  <D.5560>:
  D.5754 = list->data;
  if (D.5754 == data) goto <D.5755>; else goto <D.5756>;
  <D.5755>:
  D.5757 = index;
  return D.5757;
  <D.5756>:
  index = index + 1;
  list = list->next;
  <D.5561>:
  if (list != 0B) goto <D.5560>; else goto <D.5562>;
  <D.5562>:
  D.5757 = -1;
  return D.5757;
}


monoeg_g_list_nth (struct GList * list, guint n)
{
  struct GList * D.5760;

  goto <D.5569>;
  <D.5568>:
  if (n == 0) goto <D.5567>; else goto <D.5759>;
  <D.5759>:
  n = n + 4294967295;
  list = list->next;
  <D.5569>:
  if (list != 0B) goto <D.5568>; else goto <D.5567>;
  <D.5567>:
  D.5760 = list;
  return D.5760;
}


monoeg_g_list_nth_data (struct GList * list, guint n)
{
  void * D.5762;
  void * iftmp.5;
  struct GList * node;

  node = monoeg_g_list_nth (list, n);
  if (node != 0B) goto <D.5764>; else goto <D.5765>;
  <D.5764>:
  iftmp.5 = node->data;
  goto <D.5766>;
  <D.5765>:
  iftmp.5 = 0B;
  <D.5766>:
  D.5762 = iftmp.5;
  return D.5762;
}


monoeg_g_list_copy (struct GList * list)
{
  void * D.5770;
  struct GList * D.5771;
  struct GList * copy;

  copy = 0B;
  if (list != 0B) goto <D.5768>; else goto <D.5769>;
  <D.5768>:
  {
    struct GList * tmp;

    D.5770 = list->data;
    tmp = new_node (0B, D.5770, 0B);
    copy = tmp;
    list = list->next;
    goto <D.5581>;
    <D.5580>:
    D.5770 = list->data;
    tmp = new_node (tmp, D.5770, 0B);
    list = list->next;
    <D.5581>:
    if (list != 0B) goto <D.5580>; else goto <D.5582>;
    <D.5582>:
  }
  <D.5769>:
  D.5771 = copy;
  return D.5771;
}


monoeg_g_list_sort (struct GList * list, gint (*GCompareFunc) (const void *, const void *) func)
{
  struct GList * D.5776;
  struct GList * D.5777;
  struct GList * D.5778;
  struct GList * current;

  if (list == 0B) goto <D.5773>; else goto <D.5775>;
  <D.5775>:
  D.5776 = list->next;
  if (D.5776 == 0B) goto <D.5773>; else goto <D.5774>;
  <D.5773>:
  D.5777 = list;
  return D.5777;
  <D.5774>:
  list = do_sort (list, func);
  list->prev = 0B;
  current = list;
  goto <D.5641>;
  <D.5640>:
  D.5778 = current->next;
  D.5778->prev = current;
  current = current->next;
  <D.5641>:
  D.5778 = current->next;
  if (D.5778 != 0B) goto <D.5640>; else goto <D.5642>;
  <D.5642>:
  D.5777 = list;
  return D.5777;
}


do_sort (struct list_node * list, gint (*GCompareFunc) (const void *, const void *) func)
{
  void * D.5780;
  void * D.5781;
  int D.5782;
  struct GList * D.5786;
  struct list_node * D.5787;
  int D.5788;
  struct sort_info si;

  try
    {
      init_sort_info (&si, func);
      goto <D.5633>;
      <D.5632>:
      {
        struct list_node * next;
        struct list_node * tail;

        next = list->next;
        tail = next->next;
        D.5780 = list->data;
        D.5781 = next->data;
        D.5782 = func (D.5780, D.5781);
        if (D.5782 > 0) goto <D.5783>; else goto <D.5784>;
        <D.5783>:
        next->next = list;
        next = list;
        list = list->next;
        <D.5784>:
        next->next = 0B;
        insert_list (&si, list, 0);
        list = tail;
      }
      <D.5633>:
      if (list != 0B) goto <D.5785>; else goto <D.5634>;
      <D.5785>:
      D.5786 = list->next;
      if (D.5786 != 0B) goto <D.5632>; else goto <D.5634>;
      <D.5634>:
      D.5788 = si.n_ranks;
      D.5787 = sweep_up (&si, list, D.5788);
      return D.5787;
    }
  finally
    {
      si = {CLOBBER};
    }
}


init_sort_info (struct sort_info * si, gint (*GCompareFunc) (const void *, const void *) func)
{
  int D.5791;

  si->n_ranks = 0;
  D.5791 = si->n_ranks;
  si->min_rank = D.5791;
  si->func = func;
}


insert_list (struct sort_info * si, struct list_node * list, int rank)
{
  int D.5792;
  unsigned int rank.6;
  struct list_node * D.5798;
  gint (*<Tc8d>) (const void *, const void *) D.5799;
  struct list_node * D.5803;
  struct list_node * D.5804;
  int D.5810;
  int i;

  D.5792 = si->n_ranks;
  if (D.5792 < rank) goto <D.5793>; else goto <D.5794>;
  <D.5793>:
  rank.6 = (unsigned int) rank;
  if (rank.6 > 59) goto <D.5796>; else goto <D.5797>;
  <D.5796>:
  monoeg_g_log (0B, 16, "Rank \'%d\' should not exceed ((sizeof (size_t) * 8) - (((sizeof (list_node))>=2) + ((sizeof (list_node))>=4) + ((sizeof (list_node))>=8) + ((sizeof (list_node))>=16) + ((sizeof (list_node))>=32) + ((sizeof (list_node))>=64) + ((sizeof (list_node))>=128)) - 1)", rank);
  rank = 59;
  <D.5797>:
  D.5792 = si->n_ranks;
  D.5798 = sweep_up (si, 0B, D.5792);
  D.5799 = si->func;
  list = merge_lists (D.5798, list, D.5799);
  i = si->n_ranks;
  goto <D.5620>;
  <D.5619>:
  si->ranks[i] = 0B;
  i = i + 1;
  <D.5620>:
  if (i < rank) goto <D.5619>; else goto <D.5621>;
  <D.5621>:
  goto <D.5800>;
  <D.5794>:
  if (rank != 0) goto <D.5801>; else goto <D.5802>;
  <D.5801>:
  D.5803 = sweep_up (si, 0B, rank);
  D.5799 = si->func;
  list = merge_lists (D.5803, list, D.5799);
  <D.5802>:
  i = rank;
  goto <D.5623>;
  <D.5622>:
  D.5804 = si->ranks[i];
  D.5799 = si->func;
  list = merge_lists (D.5804, list, D.5799);
  si->ranks[i] = 0B;
  i = i + 1;
  <D.5623>:
  D.5792 = si->n_ranks;
  if (D.5792 > i) goto <D.5805>; else goto <D.5624>;
  <D.5805>:
  D.5804 = si->ranks[i];
  if (D.5804 != 0B) goto <D.5622>; else goto <D.5624>;
  <D.5624>:
  <D.5800>:
  if (i == 59) goto <D.5806>; else goto <D.5807>;
  <D.5806>:
  i = i + -1;
  <D.5807>:
  D.5792 = si->n_ranks;
  if (D.5792 <= i) goto <D.5808>; else goto <D.5809>;
  <D.5808>:
  D.5810 = i + 1;
  si->n_ranks = D.5810;
  <D.5809>:
  si->min_rank = i;
  si->ranks[i] = list;
}


merge_lists (struct list_node * first, struct list_node * second, gint (*GCompareFunc) (const void *, const void *) func)
{
  void * D.5811;
  void * D.5812;
  int D.5813;
  struct list_node * D.5817;
  struct list_node * iftmp.7;
  struct list_node * D.5823;
  struct list_node * list;
  struct list_node * * pos;

  try
    {
      list = 0B;
      pos = &list;
      goto <D.5602>;
      <D.5601>:
      D.5811 = first->data;
      D.5812 = second->data;
      D.5813 = func (D.5811, D.5812);
      if (D.5813 > 0) goto <D.5814>; else goto <D.5815>;
      <D.5814>:
      *pos = second;
      second = second->next;
      goto <D.5816>;
      <D.5815>:
      *pos = first;
      first = first->next;
      <D.5816>:
      D.5817 = *pos;
      pos = &D.5817->next;
      <D.5602>:
      if (first != 0B) goto <D.5818>; else goto <D.5603>;
      <D.5818>:
      if (second != 0B) goto <D.5601>; else goto <D.5603>;
      <D.5603>:
      if (first != 0B) goto <D.5820>; else goto <D.5821>;
      <D.5820>:
      iftmp.7 = first;
      goto <D.5822>;
      <D.5821>:
      iftmp.7 = second;
      <D.5822>:
      *pos = iftmp.7;
      D.5823 = list;
      return D.5823;
    }
  finally
    {
      list = {CLOBBER};
    }
}


sweep_up (struct sort_info * si, struct list_node * list, int upto)
{
  struct list_node * D.5826;
  gint (*<Tc8d>) (const void *, const void *) D.5827;
  struct list_node * D.5828;
  int i;

  i = si->min_rank;
  goto <D.5611>;
  <D.5610>:
  D.5826 = si->ranks[i];
  D.5827 = si->func;
  list = merge_lists (D.5826, list, D.5827);
  si->ranks[i] = 0B;
  i = i + 1;
  <D.5611>:
  if (i < upto) goto <D.5610>; else goto <D.5612>;
  <D.5612>:
  D.5828 = list;
  return D.5828;
}


