mini_wapi_hps (int argc, char * * argv)
{
  void * _wapi_shared_layout.0;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.1;
  void * _wapi_fileshare_layout.2;
  struct _WapiFileShareLayout * _wapi_fileshare_layout.3;
  unsigned int D.22408;
  int D.22409;
  long int D.22410;
  <unnamed type> D.22411;
  unsigned int D.22414;
  const char * D.22415;
  unsigned int D.22416;
  unsigned int D.22417;
  const char * iftmp.4;
  int D.22419;
  const gchar * (*<T3a85>) (struct _WapiHandleShared *) D.22423;
  const gchar * D.22424;
  unsigned int D.22425;
  unsigned int D.22426;
  long long unsigned int D.22429;
  long long int D.22430;
  long long unsigned int D.22431;
  long long int D.22432;
  int D.22433;
  unsigned int D.22434;
  unsigned int D.22435;
  guint32 i;
  guint32 now;

  _wapi_shared_layout.0 = _wapi_shm_attach (0);
  _wapi_shared_layout = _wapi_shared_layout.0;
  _wapi_shared_layout.1 = _wapi_shared_layout;
  if (_wapi_shared_layout.1 == 0B) goto <D.22400>; else goto <D.22401>;
  <D.22400>:
  monoeg_g_log (0B, 4, "Failed to attach shared memory!");
  <D.22333>:
  goto <D.22333>;
  exit (-1);
  <D.22401>:
  _wapi_fileshare_layout.2 = _wapi_shm_attach (1);
  _wapi_fileshare_layout = _wapi_fileshare_layout.2;
  _wapi_fileshare_layout.3 = _wapi_fileshare_layout;
  if (_wapi_fileshare_layout.3 == 0B) goto <D.22404>; else goto <D.22405>;
  <D.22404>:
  monoeg_g_log (0B, 4, "Failed to attach fileshare shared memory!");
  <D.22334>:
  goto <D.22334>;
  exit (-1);
  <D.22405>:
  if (argc > 1) goto <D.22406>; else goto <D.22407>;
  <D.22406>:
  _wapi_shm_semaphores_init ();
  _wapi_collection_init ();
  _wapi_handle_collect ();
  <D.22407>:
  _wapi_shared_layout.1 = _wapi_shared_layout;
  D.22408 = _wapi_shared_layout.1->collection_count;
  _wapi_shared_layout.1 = _wapi_shared_layout;
  D.22409 = _wapi_shared_layout.1->sem_key;
  monoeg_g_print ("collection: %d sem: 0x%x\n", D.22408, D.22409);
  D.22410 = time (0B);
  now = (guint32) D.22410;
  i = 0;
  goto <D.22337>;
  <D.22336>:
  {
    struct _WapiHandleShared * shared;

    _wapi_shared_layout.1 = _wapi_shared_layout;
    shared = &_wapi_shared_layout.1->handles[i];
    D.22411 = shared->type;
    if (D.22411 != 0) goto <D.22412>; else goto <D.22413>;
    <D.22412>:
    D.22414 = shared->handle_refs;
    D.22411 = shared->type;
    D.22415 = _wapi_handle_typename[D.22411];
    D.22416 = shared->timestamp;
    D.22417 = now - D.22416;
    D.22419 = shared->signalled;
    if (D.22419 != 0) goto <D.22420>; else goto <D.22421>;
    <D.22420>:
    iftmp.4 = "Sg";
    goto <D.22422>;
    <D.22421>:
    iftmp.4 = "Un";
    <D.22422>:
    D.22411 = shared->type;
    D.22423 = details[D.22411];
    D.22424 = D.22423 (shared);
    monoeg_g_print ("%3x (%3d) [%7s] %4u %s (%s)\n", i, D.22414, D.22415, D.22417, iftmp.4, D.22424);
    <D.22413>:
  }
  i = i + 1;
  <D.22337>:
  if (i <= 255) goto <D.22336>; else goto <D.22338>;
  <D.22338>:
  _wapi_fileshare_layout.3 = _wapi_fileshare_layout;
  D.22425 = _wapi_fileshare_layout.3->hwm;
  monoeg_g_print ("Fileshare hwm: %d\n", D.22425);
  i = 0;
  goto <D.22341>;
  <D.22340>:
  {
    struct _WapiFileShare * file_share;

    _wapi_fileshare_layout.3 = _wapi_fileshare_layout;
    file_share = &_wapi_fileshare_layout.3->share_info[i];
    D.22426 = file_share->handle_refs;
    if (D.22426 != 0) goto <D.22427>; else goto <D.22428>;
    <D.22427>:
    D.22429 = file_share->device;
    D.22430 = (long long int) D.22429;
    D.22431 = file_share->inode;
    D.22432 = (long long int) D.22431;
    D.22433 = file_share->opened_by_pid;
    D.22434 = file_share->sharemode;
    D.22435 = file_share->access;
    D.22426 = file_share->handle_refs;
    monoeg_g_print ("dev: 0x%llx ino: %lld open pid: %d share: 0x%x access: 0x%x refs: %d\n", D.22430, D.22432, D.22433, D.22434, D.22435, D.22426);
    <D.22428>:
  }
  i = i + 1;
  <D.22341>:
  _wapi_fileshare_layout.3 = _wapi_fileshare_layout;
  D.22425 = _wapi_fileshare_layout.3->hwm;
  if (D.22425 >= i) goto <D.22340>; else goto <D.22342>;
  <D.22342>:
  exit (0);
}


namedevent_details (struct _WapiHandleShared * handle)
{
  gchar * iftmp.5;
  const char * iftmp.6;
  int D.22441;
  unsigned int D.22445;
  const gchar * D.22446;
  static gchar buf[80];
  gchar * name;
  struct _WapiHandle_namedevent * event;

  event = &handle->u.namedevent;
  name = &event->sharedns.name;
  if (name != 0B) goto <D.22437>; else goto <D.22438>;
  <D.22437>:
  iftmp.5 = name;
  goto <D.22439>;
  <D.22438>:
  iftmp.5 = "";
  <D.22439>:
  D.22441 = event->manual;
  if (D.22441 != 0) goto <D.22442>; else goto <D.22443>;
  <D.22442>:
  iftmp.6 = "Manual";
  goto <D.22444>;
  <D.22443>:
  iftmp.6 = "Auto";
  <D.22444>:
  D.22445 = event->set_count;
  monoeg_g_snprintf (&buf, 80, "[%15s] %s count: %5u", iftmp.5, iftmp.6, D.22445);
  D.22446 = &buf;
  return D.22446;
}


namedsem_details (struct _WapiHandleShared * handle)
{
  gchar * iftmp.7;
  unsigned int D.22452;
  int D.22453;
  const gchar * D.22454;
  static gchar buf[80];
  gchar * name;
  struct _WapiHandle_namedsem * sem;

  sem = &handle->u.namedsem;
  name = &sem->sharedns.name;
  if (name != 0B) goto <D.22449>; else goto <D.22450>;
  <D.22449>:
  iftmp.7 = name;
  goto <D.22451>;
  <D.22450>:
  iftmp.7 = "";
  <D.22451>:
  D.22452 = sem->val;
  D.22453 = sem->max;
  monoeg_g_snprintf (&buf, 80, "[%15s] val: %5u, max: %5d", iftmp.7, D.22452, D.22453);
  D.22454 = &buf;
  return D.22454;
}


namedmutex_details (struct _WapiHandleShared * handle)
{
  gchar * iftmp.8;
  int D.22460;
  long unsigned int D.22461;
  unsigned int D.22462;
  const gchar * D.22463;
  static gchar buf[80];
  gchar * name;
  struct _WapiHandle_namedmutex * mut;

  mut = &handle->u.namedmutex;
  name = &mut->sharedns.name;
  if (name != 0B) goto <D.22457>; else goto <D.22458>;
  <D.22457>:
  iftmp.8 = name;
  goto <D.22459>;
  <D.22458>:
  iftmp.8 = "";
  <D.22459>:
  D.22460 = mut->pid;
  D.22461 = mut->tid;
  D.22462 = mut->recursion;
  monoeg_g_snprintf (&buf, 80, "[%15s] own: %5d:%5ld, count: %5u", iftmp.8, D.22460, D.22461, D.22462);
  D.22463 = &buf;
  return D.22463;
}


process_details (struct _WapiHandleShared * handle)
{
  gchar * iftmp.9;
  int D.22469;
  unsigned int D.22470;
  const gchar * D.22471;
  static gchar buf[80];
  gchar * name;
  struct _WapiHandle_process * proc;

  proc = &handle->u.process;
  name = &proc->proc_name;
  if (name != 0B) goto <D.22466>; else goto <D.22467>;
  <D.22466>:
  iftmp.9 = name;
  goto <D.22468>;
  <D.22467>:
  iftmp.9 = "";
  <D.22468>:
  D.22469 = proc->id;
  D.22470 = proc->exitstatus;
  monoeg_g_snprintf (&buf, 80, "[%25.25s] pid: %5u exit: %u", iftmp.9, D.22469, D.22470);
  D.22471 = &buf;
  return D.22471;
}


unshared_details (struct _WapiHandleShared * handle)
{
  const gchar * D.22473;

  D.22473 = "unshared details";
  return D.22473;
}


unused_details (struct _WapiHandleShared * handle)
{
  const gchar * D.22475;

  D.22475 = "unused details";
  return D.22475;
}


mini_wapi_semdel (int argc, char * * argv)
{
  void * _wapi_shared_layout.10;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.11;
  int D.22482;
  int D.22483;
  int * D.22488;
  int D.22489;
  const gchar * D.22490;
  int sem_id;
  int ret;

  _wapi_shared_layout.10 = _wapi_shm_attach (0);
  _wapi_shared_layout = _wapi_shared_layout.10;
  _wapi_shared_layout.11 = _wapi_shared_layout;
  if (_wapi_shared_layout.11 == 0B) goto <D.22478>; else goto <D.22481>;
  <D.22481>:
  _wapi_shared_layout.11 = _wapi_shared_layout;
  D.22482 = _wapi_shared_layout.11->sem_key;
  if (D.22482 == 0) goto <D.22478>; else goto <D.22479>;
  <D.22478>:
  exit (0);
  <D.22479>:
  _wapi_shared_layout.11 = _wapi_shared_layout;
  D.22483 = _wapi_shared_layout.11->sem_key;
  sem_id = semget (D.22483, 8, 384);
  if (sem_id != -1) goto <D.22484>; else goto <D.22485>;
  <D.22484>:
  ret = semctl (sem_id, 0, 0);
  if (ret == -1) goto <D.22486>; else goto <D.22487>;
  <D.22486>:
  D.22488 = __errno_location ();
  D.22489 = *D.22488;
  D.22490 = monoeg_g_strerror (D.22489);
  monoeg_g_log (0B, 32, "Error deleting semaphore: %s", D.22490);
  <D.22487>:
  <D.22485>:
  exit (0);
}


mini_wapi_seminfo (int argc, char * * argv)
{
  void * _wapi_shared_layout.12;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.13;
  int D.22496;
  int D.22497;
  int D.22500;
  short unsigned int D.22503;
  int D.22504;
  int sem_id;
  int ret;
  typedef union semun unionunion semun;
  union semun arg;
  ushort vals[8];

  try
    {
      _wapi_shared_layout.12 = _wapi_shm_attach (0);
      _wapi_shared_layout = _wapi_shared_layout.12;
      _wapi_shared_layout.13 = _wapi_shared_layout;
      if (_wapi_shared_layout.13 == 0B) goto <D.22492>; else goto <D.22495>;
      <D.22495>:
      _wapi_shared_layout.13 = _wapi_shared_layout;
      D.22496 = _wapi_shared_layout.13->sem_key;
      if (D.22496 == 0) goto <D.22492>; else goto <D.22493>;
      <D.22492>:
      exit (0);
      <D.22493>:
      _wapi_shared_layout.13 = _wapi_shared_layout;
      D.22497 = _wapi_shared_layout.13->sem_key;
      sem_id = semget (D.22497, 8, 384);
      if (sem_id != -1) goto <D.22498>; else goto <D.22499>;
      <D.22498>:
      _wapi_shared_layout.13 = _wapi_shared_layout;
      D.22500 = _wapi_shared_layout.13->sem_key;
      monoeg_g_print ("Getting values for sem: 0x%x\n", D.22500);
      arg.array = &vals;
      ret = semctl (sem_id, 0, 13, arg);
      if (ret != -1) goto <D.22501>; else goto <D.22502>;
      <D.22501>:
      monoeg_g_print ("Namespace: ");
      sem_explain (sem_id, &vals, 0);
      monoeg_g_print ("Fileshare: ");
      sem_explain (sem_id, &vals, 2);
      monoeg_g_print ("Handles: ");
      sem_explain (sem_id, &vals, 3);
      monoeg_g_print ("Count lock: ");
      sem_explain (sem_id, &vals, 6);
      D.22503 = vals[7];
      D.22504 = (int) D.22503;
      monoeg_g_print ("Count: %d\n", D.22504);
      <D.22502>:
      <D.22499>:
      exit (0);
    }
  finally
    {
      arg = {CLOBBER};
      vals = {CLOBBER};
    }
}


sem_explain (int sem_id, ushort * vals, int which)
{
  unsigned int which.14;
  unsigned int D.22506;
  ushort * D.22507;
  short unsigned int D.22508;
  int D.22509;
  pid_t pid;

  which.14 = (unsigned int) which;
  D.22506 = which.14 * 2;
  D.22507 = vals + D.22506;
  D.22508 = *D.22507;
  D.22509 = (int) D.22508;
  monoeg_g_print ("%d ", D.22509);
  which.14 = (unsigned int) which;
  D.22506 = which.14 * 2;
  D.22507 = vals + D.22506;
  D.22508 = *D.22507;
  if (D.22508 != 0) goto <D.22510>; else goto <D.22511>;
  <D.22510>:
  monoeg_g_print ("(Unlocked)");
  goto <D.22512>;
  <D.22511>:
  pid = semctl (sem_id, which, 11);
  monoeg_g_print ("(Locked by %d)", pid);
  <D.22512>:
  monoeg_g_print ("\n");
}


