// Decompiled from acclient.exe — chunk 0x00570000
// Ghidra 12.0.4 + pyghidra headless

// --- FUN_00570060 at 0x00570060 (size: 636) ---


undefined4 FUN_00570060(undefined4 param_1,undefined4 *param_2,int *param_3)



{

  int iVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  int *piVar4;

  undefined4 uVar5;

  LONG LVar6;

  int *piVar7;

  int *piVar8;

  int *piVar9;

  int *piVar10;

  int *piVar11;

  int *piVar12;

  int *piVar13;

  int *piVar14;

  undefined4 *local_28;

  int iStack_24;

  int iStack_20;

  int iStack_1c;

  int iStack_18;

  int iStack_14;

  int iStack_10;

  int iStack_c;

  int iStack_8;

  int iStack_4;

  

  uVar2 = param_2;

  FUN_0048c3e0(param_2);

  uVar5 = FUN_005d0190(&local_28);

  puVar3 = local_28;

  LVar6 = InterlockedDecrement(local_28 + 1);

  if ((LVar6 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  param_2 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  FUN_005d0d20(uVar5,&param_2);

  FUN_00401340(&DAT_007d1468);

  FUN_00401340(param_2 + 5);

  FUN_00401340(" - Sends a broadcast to your ");

  FUN_00401340(uVar2);

  FUN_00401340(&DAT_007d1444);

  piVar4 = param_3;

  piVar7 = &iStack_18;

  piVar14 = &iStack_14;

  piVar13 = &iStack_1c;

  piVar12 = &iStack_10;

  piVar11 = &iStack_20;

  piVar10 = &iStack_c;

  piVar9 = &iStack_24;

  piVar8 = &iStack_8;

  FUN_0040bbc0(&iStack_4,&local_28);

  FUN_0040bbc0(piVar8,piVar9);

  FUN_0040bbc0(piVar10,piVar11);

  FUN_0040bbc0(piVar12,piVar13);

  piVar7 = (int *)FUN_0040bbc0(piVar14,piVar7);

  iVar1 = *piVar4;

  if (iVar1 != *piVar7) {

    LVar6 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar6 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

    }

    iVar1 = *piVar7;

    *piVar4 = iVar1;

    InterlockedIncrement((LONG *)(iVar1 + -0x10));

  }

  LVar6 = InterlockedDecrement((LONG *)(iStack_14 + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iStack_14 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_14 + -0x14))(1);

  }

  LVar6 = InterlockedDecrement((LONG *)(iStack_10 + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iStack_10 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_10 + -0x14))(1);

  }

  LVar6 = InterlockedDecrement((LONG *)(iStack_c + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iStack_c + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_c + -0x14))(1);

  }

  LVar6 = InterlockedDecrement((LONG *)(iStack_8 + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iStack_8 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_8 + -0x14))(1);

  }

  LVar6 = InterlockedDecrement((LONG *)(iStack_4 + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iStack_4 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_4 + -0x14))(1);

  }

  LVar6 = InterlockedDecrement(local_28 + -4);

  if ((LVar6 == 0) && (local_28 + -5 != (undefined4 *)0x0)) {

    (**(code **)local_28[-5])(1);

  }

  LVar6 = InterlockedDecrement((LONG *)(iStack_24 + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iStack_24 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_24 + -0x14))(1);

  }

  LVar6 = InterlockedDecrement((LONG *)(iStack_20 + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iStack_20 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_20 + -0x14))(1);

  }

  LVar6 = InterlockedDecrement((LONG *)(iStack_1c + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iStack_1c + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_1c + -0x14))(1);

  }

  LVar6 = InterlockedDecrement((LONG *)(iStack_18 + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iStack_18 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_18 + -0x14))(1);

  }

  puVar3 = param_2;

  LVar6 = InterlockedDecrement(param_2 + 1);

  if ((LVar6 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  return 1;

}





// --- FUN_005709ac at 0x005709AC (size: 147) ---


uint __thiscall FUN_005709ac(int param_1,undefined4 param_2,int param_3,undefined4 *param_4)



{

  LONG LVar1;

  int iVar2;

  uint uVar3;

  uint unaff_EBX;

  undefined4 *puVar4;

  bool in_ZF;

  

  puVar4 = param_4;

  if (!in_ZF) {

    FUN_00402730(L"Please specify if you want tells on or off.");

    FUN_005649f0(&param_3,0x1a,unaff_EBX,*(undefined4 *)(param_1 + 0x8c));

    puVar4 = (undefined4 *)(param_3 + -0x14);

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)();

    }

    return unaff_EBX & 0xff;

  }

  iVar2 = _stricmp((char *)*param_4,"on");

  if (iVar2 != 0) {

    iVar2 = _stricmp((char *)*puVar4,"off");

    if (iVar2 == 0) {

      unaff_EBX = 0;

    }

  }

  uVar3 = FUN_006a4b20(unaff_EBX & 0xff,3);

  return uVar3;

}





// --- FUN_00570dc0 at 0x00570DC0 (size: 352) ---


undefined4 __thiscall FUN_00570dc0(int param_1,int param_2)



{

  LONG LVar1;

  undefined4 uVar2;

  int iVar3;

  undefined4 *puVar4;

  int local_8;

  int local_4;

  

  iVar3 = param_2;

  if (param_2 < 2) {

    FUN_00401340(&DAT_007938af);

    if (iVar3 != 0) {

      uVar2 = FUN_0056fc60(&local_4,&param_2,&stack0x00000008);

      FUN_00402070(uVar2);

      LVar1 = InterlockedDecrement((LONG *)(local_4 + -0x10));

      if ((LVar1 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

      }

      if (*(uint *)(local_8 + -4) < 0x11) {

        FUN_0047a300(&local_8);

      }

      else {

        FUN_00402730(L"The file name must be 16 characters or less.");

        FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

        puVar4 = (undefined4 *)(param_2 + -0x14);

        LVar1 = InterlockedDecrement((LONG *)(param_2 + -0x10));

        if ((LVar1 == 0) && (puVar4 != (undefined4 *)0x0)) {

          (**(code **)*puVar4)(1);

        }

      }

      LVar1 = InterlockedDecrement((LONG *)(local_8 + -0x10));

      if (LVar1 != 0) {

        return 1;

      }

      if ((undefined4 *)(local_8 + -0x14) == (undefined4 *)0x0) {

        return 1;

      }

      (*(code *)**(undefined4 **)(local_8 + -0x14))(1);

      return 1;

    }

    FUN_0047a300(&local_8);

    iVar3 = local_8;

  }

  else {

    FUN_00402730(L"Please use @help saveui for proper usage.");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    iVar3 = param_2;

  }

  LVar1 = InterlockedDecrement((LONG *)(iVar3 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(iVar3 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar3 + -0x14))(1);

    return 1;

  }

  return 1;

}





// --- FUN_00570f20 at 0x00570F20 (size: 352) ---


undefined4 __thiscall FUN_00570f20(int param_1,int param_2)



{

  LONG LVar1;

  undefined4 uVar2;

  int iVar3;

  undefined4 *puVar4;

  int local_8;

  int local_4;

  

  iVar3 = param_2;

  if (param_2 < 2) {

    FUN_00401340(&DAT_007938af);

    if (iVar3 != 0) {

      uVar2 = FUN_0056fc60(&local_4,&param_2,&stack0x00000008);

      FUN_00402070(uVar2);

      LVar1 = InterlockedDecrement((LONG *)(local_4 + -0x10));

      if ((LVar1 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

      }

      if (*(uint *)(local_8 + -4) < 0x11) {

        FUN_0047a110(&local_8);

      }

      else {

        FUN_00402730(L"The file name must be 16 characters or less.");

        FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

        puVar4 = (undefined4 *)(param_2 + -0x14);

        LVar1 = InterlockedDecrement((LONG *)(param_2 + -0x10));

        if ((LVar1 == 0) && (puVar4 != (undefined4 *)0x0)) {

          (**(code **)*puVar4)(1);

        }

      }

      LVar1 = InterlockedDecrement((LONG *)(local_8 + -0x10));

      if (LVar1 != 0) {

        return 1;

      }

      if ((undefined4 *)(local_8 + -0x14) == (undefined4 *)0x0) {

        return 1;

      }

      (*(code *)**(undefined4 **)(local_8 + -0x14))(1);

      return 1;

    }

    FUN_0047a110(&local_8);

    iVar3 = local_8;

  }

  else {

    FUN_00402730(L"Please use @help loadui for proper usage.");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    iVar3 = param_2;

  }

  LVar1 = InterlockedDecrement((LONG *)(iVar3 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(iVar3 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar3 + -0x14))(1);

    return 1;

  }

  return 1;

}





// --- FUN_00571080 at 0x00571080 (size: 122) ---


undefined4 __thiscall FUN_00571080(int param_1,int param_2)



{

  LONG LVar1;

  int iVar2;

  int local_4;

  

  local_4 = param_1;

  if (param_2 < 1) {

    FUN_00401340("#auto");

    FUN_0047a300(&local_4);

    iVar2 = local_4;

  }

  else {

    FUN_00402730(L"Please use @help saveautoui for proper usage.");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    iVar2 = param_2;

  }

  LVar1 = InterlockedDecrement((LONG *)(iVar2 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(iVar2 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar2 + -0x14))(1);

  }

  return 1;

}





// --- FUN_00571100 at 0x00571100 (size: 122) ---


undefined4 __thiscall FUN_00571100(int param_1,int param_2)



{

  LONG LVar1;

  int iVar2;

  int local_4;

  

  local_4 = param_1;

  if (param_2 < 1) {

    FUN_00401340("#auto");

    FUN_0047a110(&local_4);

    iVar2 = local_4;

  }

  else {

    FUN_00402730(L"Please use @help loadautoui for proper usage.");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    iVar2 = param_2;

  }

  LVar1 = InterlockedDecrement((LONG *)(iVar2 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(iVar2 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar2 + -0x14))(1);

  }

  return 1;

}





// --- FUN_00571220 at 0x00571220 (size: 96) ---


undefined4 __thiscall FUN_00571220(int param_1,int param_2)



{

  LONG LVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  

  if (param_2 != 0) {

    FUN_00402730(L"Please see @help House for more information on how to use this command");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    puVar3 = (undefined4 *)(param_2 + -0x14);

    LVar1 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar1 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

    return 1;

  }

  uVar2 = FUN_006abf00();

  return uVar2;

}





// --- FUN_00571280 at 0x00571280 (size: 96) ---


undefined4 __thiscall FUN_00571280(int param_1,int param_2)



{

  LONG LVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  

  if (param_2 != 0) {

    FUN_00402730(L"Please see @help House for more information on how to use this command");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    puVar3 = (undefined4 *)(param_2 + -0x14);

    LVar1 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar1 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

    return 1;

  }

  uVar2 = FUN_006abf90();

  return uVar2;

}





// --- FUN_005712e0 at 0x005712E0 (size: 478) ---


undefined1 FUN_005712e0(undefined4 param_1,char *param_2)



{

  undefined1 uVar1;

  int iVar2;

  LONG LVar3;

  undefined4 uVar4;

  char *pcVar5;

  char *local_8;

  int local_4;

  

  FUN_0056fc60(&local_8,&param_1,&param_2);

  FUN_00401340("apartment");

  iVar2 = _stricmp(local_8,param_2);

  pcVar5 = param_2 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

  if ((LVar3 == 0) && (pcVar5 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar5)(1);

  }

  if (iVar2 == 0) {

    uVar4 = 4;

  }

  else {

    FUN_00401340("cottage");

    iVar2 = _stricmp(local_8,param_2);

    pcVar5 = param_2 + -0x14;

    LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar3 == 0) && (pcVar5 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar5)(1);

    }

    if (iVar2 == 0) {

      uVar4 = 1;

    }

    else {

      FUN_00401340("villa");

      iVar2 = _stricmp(local_8,param_2);

      pcVar5 = param_2 + -0x14;

      LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

      if ((LVar3 == 0) && (pcVar5 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar5)(1);

      }

      if (iVar2 == 0) {

        uVar4 = 2;

      }

      else {

        FUN_00401340("mansion");

        iVar2 = _stricmp(local_8,param_2);

        pcVar5 = param_2 + -0x14;

        LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

        if ((LVar3 == 0) && (pcVar5 != (char *)0x0)) {

          (*(code *)**(undefined4 **)pcVar5)(1);

        }

        if (iVar2 != 0) {

          FUN_00402730(L"Please see @help hslist for more information on how to use this command");

          FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(local_4 + 0x8c));

          FUN_004011b0();

          FUN_004011b0();

          return 1;

        }

        uVar4 = 3;

      }

    }

  }

  uVar1 = FUN_006ab6f0(uVar4);

  LVar3 = InterlockedDecrement((LONG *)(local_8 + -0x10));

  if ((LVar3 == 0) && (local_8 + -0x14 != (char *)0x0)) {

    (*(code *)**(undefined4 **)(local_8 + -0x14))(1);

  }

  return uVar1;

}





// --- FUN_00571620 at 0x00571620 (size: 577) ---


int FUN_00571620(int param_1,int param_2)



{

  undefined *puVar1;

  char cVar2;

  uint uVar3;

  LONG LVar4;

  uint uVar5;

  undefined4 *puVar6;

  int local_20;

  undefined *local_1c;

  undefined *local_18;

  undefined *local_14;

  undefined **local_10;

  uint local_c;

  uint local_8;

  undefined4 *local_4;

  

  local_4 = &param_1;

  local_20 = 0;

  local_10 = &PTR_FUN_0079548c;

  local_c = 0;

  local_8 = 0;

  cVar2 = FUN_0040b790(&param_2,0);

  while (cVar2 != '\0') {

    local_14 = PTR_DAT_00818344;

    InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

    local_1c = PTR_DAT_00818344;

    InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

    local_18 = PTR_DAT_00818344;

    InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

    FUN_0040c4c0(&local_14,&local_1c,&local_18);

    puVar1 = local_1c;

    if (*(int *)(local_1c + -4) != 1) {

      FUN_0040b720(&local_1c);

      local_20 = local_20 + 1;

    }

    uVar5 = local_c + 1;

    uVar3 = (*(code *)*local_10)();

    if (uVar3 < uVar5) {

      uVar5 = (*(code *)*local_10)();

    }

    puVar6 = (undefined4 *)(local_18 + -0x14);

    local_c = uVar5;

    local_8 = uVar5;

    LVar4 = InterlockedDecrement((LONG *)(local_18 + -0x10));

    if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    puVar6 = (undefined4 *)(puVar1 + -0x14);

    LVar4 = InterlockedDecrement((LONG *)(puVar1 + -0x10));

    if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    puVar6 = (undefined4 *)(local_14 + -0x14);

    LVar4 = InterlockedDecrement((LONG *)(local_14 + -0x10));

    if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    cVar2 = FUN_0040b790(&param_2,0);

  }

  local_18 = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  local_1c = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  local_14 = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  FUN_0040c4c0(&local_18,&local_1c,&local_14);

  puVar1 = local_1c;

  if (*(int *)(local_1c + -4) != 1) {

    FUN_0040b720(&local_1c);

    local_20 = local_20 + 1;

  }

  puVar6 = (undefined4 *)(local_14 + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(local_14 + -0x10));

  if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  puVar6 = (undefined4 *)(puVar1 + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(puVar1 + -0x10));

  if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  puVar6 = (undefined4 *)(local_18 + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(local_18 + -0x10));

  if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  puVar6 = (undefined4 *)(param_1 + -0x14);

  local_10 = &PTR_LAB_00795478;

  LVar4 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  puVar6 = (undefined4 *)(param_2 + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(param_2 + -0x10));

  if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return local_20;

}





// --- FUN_00571870 at 0x00571870 (size: 43) ---


int __fastcall FUN_00571870(void *param_1)



{

  int iVar1;

  

  iVar1 = FUN_00401ea0();

  if ((iVar1 == 0) && (param_1 != (void *)0x0)) {

    FUN_0056f860();

    operator_delete(param_1);

  }

  return iVar1;

}





// --- FUN_005718a0 at 0x005718A0 (size: 180) ---


undefined4 FUN_005718a0(int *param_1,int *param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  int *piVar3;

  LONG LVar4;

  int iVar5;

  

  puVar1 = (undefined4 *)*param_1;

  param_1 = puVar1;

  InterlockedIncrement(puVar1 + 1);

  piVar3 = (int *)FUN_004fe0a0(&param_1);

  LVar4 = InterlockedDecrement(puVar1 + 1);

  if ((LVar4 == 0) && (puVar1 != (undefined4 *)0x0)) {

    (**(code **)*puVar1)(1);

  }

  piVar2 = param_2;

  if (piVar3 != (int *)0x0) {

    puVar1 = (undefined4 *)*param_2;

    if (puVar1 != (undefined4 *)*piVar3) {

      LVar4 = InterlockedDecrement(puVar1 + 1);

      if ((LVar4 == 0) && (puVar1 != (undefined4 *)0x0)) {

        (**(code **)*puVar1)(1);

      }

      iVar5 = *piVar3;

      *piVar2 = iVar5;

      InterlockedIncrement((LONG *)(iVar5 + 4));

    }

    iVar5 = FUN_004fe3a0(piVar2);

    if (iVar5 != 0) {

      FUN_0048a0a0(iVar5 + 4);

      FUN_0048a0a0(iVar5 + 8);

      return 1;

    }

  }

  return 0;

}





// --- FUN_00571960 at 0x00571960 (size: 1598) ---


undefined4 FUN_00571960(int *param_1,int *param_2,int *param_3)



{

  int *piVar1;

  int iVar2;

  LONG LVar3;

  int *piVar4;

  undefined4 uVar5;

  int iVar6;

  undefined4 *puVar7;

  char *pcVar8;

  undefined4 uVar9;

  undefined4 uVar10;

  undefined *local_1c;

  undefined4 *local_18;

  int iStack_14;

  int local_10;

  int local_c;

  int local_8 [2];

  

  local_18 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  piVar4 = param_1;

  iVar2 = FUN_005d0d20(param_1,&local_18);

  if (iVar2 == 0) {

    FUN_004034c0("<unknown>");

  }

  local_1c = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  piVar1 = param_2;

  iVar2 = *param_2;

  if (*(int *)(iVar2 + 8) == 1) {

    if (piVar4 < (int *)0x4001) {

      if (piVar4 != (int *)0x4000) {

        if (piVar4 == (int *)0x800) {

          iVar6 = 0x13;

          FUN_00402710(&local_1c,"[Fellowship] You say, \"",iVar2 + 0x14);

          goto LAB_00571e0e;

        }

        if ((piVar4 != (int *)0x1000) && (piVar4 != (int *)0x2000)) goto LAB_00571b19;

      }

      iVar6 = 0xb;

      FUN_00401340("You say to your ");

      if (param_1[-1] != 1) {

        FUN_00404ef0(param_1,param_1[-1] + -1);

      }

      piVar1 = param_1 + -5;

      LVar3 = InterlockedDecrement(param_1 + -4);

      if ((LVar3 == 0) && (piVar1 != (int *)0x0)) {

        (**(code **)*piVar1)(1);

      }

      FUN_00401340(local_18 + 5);

      if (param_2[-1] != 1) {

        FUN_00404ef0(param_2,param_2[-1] + -1);

      }

      piVar1 = param_2 + -5;

      LVar3 = InterlockedDecrement(param_2 + -4);

      if ((LVar3 == 0) && (piVar1 != (int *)0x0)) {

        (**(code **)*piVar1)(1);

      }

      FUN_00401340(&DAT_007d1e18);

      if (*(int *)(iStack_14 + -4) != 1) {

        FUN_00404ef0(iStack_14,*(int *)(iStack_14 + -4) + -1);

      }

      LVar3 = InterlockedDecrement((LONG *)(iStack_14 + -0x10));

      if ((LVar3 == 0) && ((undefined4 *)(iStack_14 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(iStack_14 + -0x14))(1);

      }

    }

    else {

      if (piVar4 == (int *)0x1000000) {

        iVar6 = 10;

        FUN_00402710(&local_1c,"[Co-Vassals] You say, \"",iVar2 + 0x14);

        goto LAB_00571e0e;

      }

      if (piVar4 == (int *)0x2000000) {

        iVar6 = 10;

        FUN_00402710(&local_1c,"[Allegiance Broadcast] You say, \"",iVar2 + 0x14);

        goto LAB_00571e0e;

      }

      if (piVar4 == (int *)0x4000000) {

        iVar6 = 0x13;

        FUN_00405000(&DAT_007938af);

        goto LAB_00571e0e;

      }

LAB_00571b19:

      if (piVar4 == (int *)0x400) {

        iVar6 = 0xf;

      }

      else {

        iVar6 = (-(uint)(piVar4 != (int *)0x1) & 0xfffffffb) + 0xe;

      }

      FUN_00401340("You say on the ");

      FUN_004087d0(&local_10);

      FUN_004011b0();

      FUN_00401340(local_18 + 5);

      FUN_004087d0(&local_c);

      FUN_004011b0();

      FUN_00401340(" channel, \"");

      FUN_004087d0(local_8);

      FUN_004011b0();

    }

    goto LAB_00571e0e;

  }

  if (piVar4 < (int *)0x4001) {

    if (piVar4 == (int *)0x4000) {

      iVar6 = 10;

      FUN_00402710(&local_1c,"Your follower <Tell:IIDString:0:%s>%s<\\Tell> says to you, \"",

                   iVar2 + 0x14,iVar2 + 0x14);

      iVar2 = *piVar1;

      InterlockedIncrement((LONG *)(iVar2 + 4));

      FUN_0058a3c0(iVar2);

      goto LAB_00571e0e;

    }

    if (piVar4 != (int *)0x800) {

      if (piVar4 != (int *)0x1000) {

        if (piVar4 == (int *)0x2000) {

          iVar6 = 10;

          FUN_00402710(&local_1c,"Your vassal <Tell:IIDString:0:%s>%s<\\Tell> says to you, \"",

                       iVar2 + 0x14,iVar2 + 0x14);

          FUN_00480760(piVar1);

          FUN_0058a480();

          goto LAB_00571e0e;

        }

        goto LAB_00571cd4;

      }

      pcVar8 = "Your patron <Tell:IIDString:0:%s>%s<\\Tell> says to you, \"";

      goto LAB_00571e01;

    }

    pcVar8 = "[Fellowship] <Tell:IIDString:0:%s>%s<\\Tell> says, \"";

    iVar6 = 0x13;

  }

  else {

    if (piVar4 == (int *)0x1000000) {

      pcVar8 = "[Co-Vassals] <Tell:IIDString:0:%s>%s<\\Tell> says, \"";

    }

    else {

      if (piVar4 != (int *)0x2000000) {

LAB_00571cd4:

        if (piVar4 == (int *)0x400) {

          iVar6 = 0xf;

        }

        else {

          iVar6 = (-(uint)(piVar4 != (int *)0x1) & 0xfffffffa) + 0xe;

        }

        FUN_00401340("<Tell:IIDString:0:%s>");

        if (param_1[-1] != 1) {

          FUN_00404ef0(param_1,param_1[-1] + -1);

        }

        FUN_004011b0();

        FUN_00401340(*piVar1 + 0x14);

        if (param_2[-1] != 1) {

          FUN_00404ef0(param_2,param_2[-1] + -1);

        }

        FUN_004011b0();

        FUN_00401340("<\\Tell> says on the ");

        if (*(int *)(local_8[0] + -4) != 1) {

          FUN_00404ef0(local_8[0],*(int *)(local_8[0] + -4) + -1);

        }

        FUN_004011b0();

        FUN_00401340(local_18 + 5);

        if (*(int *)(local_c + -4) != 1) {

          FUN_00404ef0(local_c,*(int *)(local_c + -4) + -1);

        }

        FUN_004011b0();

        FUN_00401340(" channel, \"");

        if (*(int *)(local_10 + -4) != 1) {

          FUN_00404ef0(local_10,*(int *)(local_10 + -4) + -1);

        }

        FUN_004011b0();

        goto LAB_00571e0e;

      }

      pcVar8 = "[Allegiance Broadcast] <Tell:IIDString:0:%s>%s<\\Tell> says, \"";

    }

LAB_00571e01:

    iVar6 = 10;

  }

  FUN_00402710(&local_1c,pcVar8,iVar2 + 0x14,iVar2 + 0x14);

LAB_00571e0e:

  FUN_00401340(*param_3 + 0x14);

  if (param_1[-1] != 1) {

    FUN_00404ef0(param_1,param_1[-1] + -1);

  }

  piVar1 = param_1 + -5;

  LVar3 = InterlockedDecrement(param_1 + -4);

  if ((LVar3 == 0) && (piVar1 != (int *)0x0)) {

    (**(code **)*piVar1)(1);

  }

  if (piVar4 == (int *)0x4000000) {

    FUN_00401340(&DAT_00795508);

    piVar4 = param_2;

    if (param_2[-1] != 1) {

      FUN_00404ef0(param_2,param_2[-1] + -1);

      piVar4 = param_2;

    }

  }

  else {

    FUN_00401340(&DAT_007d1c18);

    piVar4 = param_1;

    if (param_1[-1] != 1) {

      FUN_00404ef0(param_1,param_1[-1] + -1);

      piVar4 = param_1;

    }

  }

  LVar3 = InterlockedDecrement(piVar4 + -4);

  if ((LVar3 == 0) && (piVar4 + -5 != (int *)0x0)) {

    (**(code **)piVar4[-5])(1);

  }

  FUN_0048c3e0(&DAT_007938af);

  iVar2 = FUN_0058a000(0,&param_1,iVar6);

  piVar4 = param_1;

  LVar3 = InterlockedDecrement(param_1 + 1);

  if ((LVar3 == 0) && (piVar4 != (int *)0x0)) {

    (**(code **)*piVar4)(1);

  }

  if (iVar2 == 0) {

    uVar10 = 0;

    uVar9 = 1;

    uVar5 = FUN_00403350(&param_1,0);

    FUN_005649f0(uVar5,iVar6,uVar9,uVar10);

    piVar4 = param_1 + -5;

    LVar3 = InterlockedDecrement(param_1 + -4);

    if ((LVar3 == 0) && (piVar4 != (int *)0x0)) {

      (**(code **)*piVar4)(1);

    }

  }

  puVar7 = (undefined4 *)(local_1c + -0x14);

  LVar3 = InterlockedDecrement((LONG *)(local_1c + -0x10));

  if ((LVar3 == 0) && (puVar7 != (undefined4 *)0x0)) {

    (**(code **)*puVar7)(1);

  }

  puVar7 = local_18;

  LVar3 = InterlockedDecrement(local_18 + 1);

  if ((LVar3 == 0) && (puVar7 != (undefined4 *)0x0)) {

    (**(code **)*puVar7)(1);

  }

  return 0;

}





// --- FUN_00571fa0 at 0x00571FA0 (size: 194) ---


undefined4 FUN_00571fa0(int *param_1,int *param_2)



{

  undefined4 uVar1;

  LONG LVar2;

  int *piVar3;

  undefined4 *puVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  undefined4 uVar7;

  undefined *local_4;

  

  local_4 = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  if (*(int *)(*param_1 + 8) == 1) {

    FUN_00402710(&local_4,"You have played for %s.\n",*param_2 + 0x14);

  }

  else {

    FUN_00402710(&local_4,"%s has played for %s.\n",*param_1 + 0x14,*param_2 + 0x14);

  }

  uVar7 = 0;

  uVar6 = 1;

  uVar5 = 0;

  uVar1 = FUN_00403350(&param_2,0);

  FUN_005649f0(uVar1,uVar5,uVar6,uVar7);

  piVar3 = param_2 + -5;

  LVar2 = InterlockedDecrement(param_2 + -4);

  if ((LVar2 == 0) && (piVar3 != (int *)0x0)) {

    (**(code **)*piVar3)(1);

  }

  puVar4 = (undefined4 *)(local_4 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

    (**(code **)*puVar4)(1);

  }

  return 0;

}





// --- FUN_00572070 at 0x00572070 (size: 764) ---


undefined4 FUN_00572070(int *param_1,int *param_2,uint param_3,undefined4 param_4)



{

  bool bVar1;

  uint uVar2;

  int *piVar3;

  uint uVar4;

  int iVar5;

  undefined4 uVar6;

  LONG LVar7;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  int *piVar8;

  undefined4 *puVar9;

  int *piVar10;

  char *pcVar11;

  undefined *local_24;

  int local_20;

  undefined1 local_1c [4];

  int *local_18 [2];

  int local_10;

  int *local_c;

  int local_8;

  

  uVar2 = param_3;

  bVar1 = false;

  if (*(int *)(DAT_0083da58 + 0xf8) == 0) {

    return 0;

  }

  if (param_3 == 0) {

    return 0;

  }

  local_24 = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  if (DAT_0083da58 == 0) {

    uVar4 = 0;

  }

  else {

    uVar4 = *(uint *)(DAT_0083da58 + 0xf4);

  }

  if (uVar2 == uVar4) {

    FUN_00402710(&local_24,"You say, \"%s\"\n",*param_1 + 0x14);

    FUN_004c3010(&local_24,param_4,1,0);

    goto LAB_0057233f;

  }

  iVar5 = FUN_0058a690(uVar2,param_4);

  if (iVar5 == 0) {

    FUN_004011b0();

    return 0;

  }

  local_18[0] = (int *)0x0;

  local_c = (int *)FUN_00560f80();

  piVar10 = (int *)*param_2;

  param_2 = piVar10;

  InterlockedIncrement(piVar10 + 1);

  local_20 = *param_1;

  InterlockedIncrement((LONG *)(local_20 + 4));

  FUN_0048c3e0(&DAT_007d1eb8);

  iVar5 = FUN_00542ea0(local_1c);

  FUN_005abb30();

  if (iVar5 < 0) {

    FUN_0048c3e0(&DAT_007d1eb4);

    iVar5 = FUN_00542ea0(local_1c);

    FUN_005abb30();

    piVar8 = local_18[0];

    if (-1 < iVar5) {

      uVar6 = extraout_ECX_00;

      FUN_0048c3e0(&DAT_007d1eb4);

      FUN_0056f9a0(0,1,uVar6);

      piVar8 = (int *)0x1;

      piVar10 = param_2;

    }

  }

  else {

    uVar6 = extraout_ECX;

    FUN_0048c3e0(&DAT_007d1eb8);

    FUN_0056f9a0(0,1,uVar6);

    bVar1 = true;

    piVar8 = local_18[0];

    piVar10 = param_2;

  }

  if ((piVar8 == local_c) || (bVar1)) {

    bVar1 = false;

  }

  else {

    bVar1 = true;

  }

  local_10 = 0;

  uVar6 = FUN_00485200(local_18,&DAT_007d0eb8);

  FUN_0048bc80(uVar6);

  if (local_18[0] != (int *)0x0) {

    (**(code **)(*local_18[0] + 0x14))();

  }

  piVar3 = local_c;

  if ((((local_c == (int *)0x0) || (local_8 < 0)) || (FUN_00590ca0(0x81,&local_10), local_10 == 0))

     && (bVar1)) {

    if (piVar8 == (int *)0x0) {

      uVar6 = FUN_00682870(&param_1);

    }

    else {

      uVar6 = FUN_00682710(&param_1);

    }

    FUN_0048a0a0(uVar6);

    FUN_005abb30();

    pcVar11 = "%s %s\n";

    iVar5 = local_20;

LAB_00572303:

    FUN_00402710(&local_24,pcVar11,piVar10 + 5,iVar5 + 0x14);

  }

  else {

    if ((param_3 < 0x50000001) || (0x6fffffff < param_3)) {

      iVar5 = *param_1;

      pcVar11 = "%s says, \"%s\"\n";

      goto LAB_00572303;

    }

    FUN_00402710(&local_24,"<Tell:IIDString:%d:%s>%s<\\Tell> says, \"%s\"\n",param_3,piVar10 + 5,

                 piVar10 + 5,*param_1 + 0x14);

  }

  FUN_004c3010(&local_24,param_4,1,0);

  if (piVar3 != (int *)0x0) {

    (**(code **)(*piVar3 + 0x14))();

  }

  FUN_005abb30();

  FUN_005abb30();

LAB_0057233f:

  puVar9 = (undefined4 *)(local_24 + -0x14);

  LVar7 = InterlockedDecrement((LONG *)(local_24 + -0x10));

  if ((LVar7 == 0) && (puVar9 != (undefined4 *)0x0)) {

    (**(code **)*puVar9)(1);

  }

  return 0;

}





// --- FUN_00572370 at 0x00572370 (size: 1003) ---


undefined4

FUN_00572370(int *param_1,int *param_2,undefined *param_3,undefined *param_4,undefined4 param_5)



{

  undefined4 *puVar1;

  bool bVar2;

  char *pcVar3;

  LONG LVar4;

  int *piVar5;

  int iVar6;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  undefined4 extraout_ECX_02;

  code *pcVar7;

  undefined4 *puVar8;

  int *piVar9;

  undefined *puVar10;

  undefined4 *puVar11;

  undefined4 uVar12;

  undefined *local_20;

  int local_1c;

  undefined4 *local_18;

  int aiStack_14 [2];

  int local_c;

  int *piStack_8;

  undefined4 uStack_4;

  

  bVar2 = false;

  if (*(int *)(DAT_0083da58 + 0xf8) != 0) {

    local_20 = PTR_DAT_00818344;

    InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

    if (param_3 == param_4) {

      FUN_00402710(&local_20,"You think, \"%s\"\n",*param_1 + 0x14);

      FUN_004c3010(&local_20,param_5,1,0);

      pcVar7 = InterlockedDecrement_exref;

    }

    else {

      local_1c = 0;

      local_c = FUN_00560f80();

      puVar8 = (undefined4 *)*param_2;

      param_2 = puVar8;

      InterlockedIncrement(puVar8 + 1);

      puVar1 = (undefined4 *)*param_1;

      InterlockedIncrement(puVar1 + 1);

      FUN_0048c3e0(&DAT_007d1eb8);

      puVar11 = local_18;

      pcVar3 = strstr((char *)(puVar8 + 5),(char *)(local_18 + 5));

      if (pcVar3 == (char *)0x0) {

        pcVar3 = (char *)0xffffffff;

      }

      else {

        pcVar3 = pcVar3 + (-0x14 - (int)puVar8);

      }

      LVar4 = InterlockedDecrement(puVar11 + 1);

      uVar12 = extraout_ECX;

      if ((LVar4 == 0) && (puVar11 != (undefined4 *)0x0)) {

        (**(code **)*puVar11)(1);

        uVar12 = extraout_ECX_00;

      }

      if ((int)pcVar3 < 0) {

        FUN_0048c3e0(&DAT_007d1eb4);

        iVar6 = FUN_00542ea0(&local_18);

        LVar4 = InterlockedDecrement(local_18 + 1);

        uVar12 = extraout_ECX_01;

        if ((LVar4 == 0) && (local_18 != (undefined4 *)0x0)) {

          (**(code **)*local_18)(1);

          uVar12 = extraout_ECX_02;

        }

        if (-1 < iVar6) {

          FUN_0048c3e0(&DAT_007d1eb4);

          FUN_0056f9a0(0,1,uVar12);

          local_1c = 1;

          puVar8 = param_2;

        }

      }

      else {

        FUN_0048c3e0(&DAT_007d1eb8);

        FUN_0056f9a0(0,1,uVar12);

        bVar2 = true;

        puVar8 = param_2;

      }

      if ((local_1c == local_c) || (bVar2)) {

        bVar2 = false;

      }

      else {

        bVar2 = true;

      }

      puVar11 = &param_2;

      piVar9 = &local_c;

      puVar10 = &DAT_007d0eb8;

      aiStack_14[0] = 0;

      param_2 = (int *)0x0;

      FUN_00406d10(piVar9,&DAT_007d0eb8,puVar11);

      FUN_00406570(piVar9,puVar10,puVar11);

      piVar9 = param_2;

      uVar12 = 0;

      piStack_8 = (int *)0x0;

      uStack_4 = 0;

      piVar5 = param_2;

      if (param_2 != (int *)0x0) {

        (**(code **)(*param_2 + 0x10))(param_2,0);

      }

      piVar5 = (int *)FUN_0048bb00(&local_18,piVar5,uVar12);

      iVar6 = *piVar5;

      if (piVar9 != (int *)0x0) {

        (**(code **)(*piVar9 + 0x14))();

      }

      if ((((piStack_8 == (int *)0x0) || (iVar6 < 0)) ||

          (FUN_00590ca0(0x81,aiStack_14), aiStack_14[0] == 0)) && (bVar2)) {

        if (local_1c == 0) {

          uVar12 = FUN_00682870(&param_1);

        }

        else {

          uVar12 = FUN_00682710(&param_1);

        }

        FUN_0048a0a0(uVar12);

        FUN_005abb30();

        FUN_00402710(&local_20,"%s %s\n",puVar8 + 5,puVar1 + 5);

        FUN_004c3010(&local_20,param_5,1,0);

      }

      else {

        if (DAT_0083da58 == 0) {

          puVar10 = (undefined *)0x0;

        }

        else {

          puVar10 = *(undefined **)(DAT_0083da58 + 0xf4);

        }

        if (param_4 == puVar10) {

          param_4 = PTR_DAT_00818344;

          InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

          puVar10 = param_3;

          if ((param_3 < (undefined *)0x50000001) || ((undefined *)0x6fffffff < param_3)) {

            FUN_00402710(&param_4,"%s tells you, \"%s\"\n",puVar8 + 5,*param_1 + 0x14);

          }

          else {

            FUN_00402710(&param_4,"<Tell:IIDString:%d:%s>%s<\\Tell> tells you, \"%s\"\n",param_3,

                         puVar8 + 5,puVar8 + 5,*param_1 + 0x14);

          }

          FUN_004c3010(&param_4,param_5,1,0);

          if (((undefined *)0x50000000 < puVar10) && (puVar10 < (undefined *)0x70000000)) {

            FUN_00589fd0(puVar10);

            FUN_00401340(puVar8 + 5);

            FUN_0058a330(&param_1);

            FUN_004011b0();

          }

          FUN_004011b0();

        }

      }

      if (piStack_8 != (int *)0x0) {

        (**(code **)(*piStack_8 + 0x14))();

      }

      pcVar7 = InterlockedDecrement_exref;

      LVar4 = InterlockedDecrement(puVar1 + 1);

      if ((LVar4 == 0) && (puVar1 != (undefined4 *)0x0)) {

        (**(code **)*puVar1)(1);

      }

      LVar4 = InterlockedDecrement(puVar8 + 1);

      if ((LVar4 == 0) && (puVar8 != (undefined4 *)0x0)) {

        (**(code **)*puVar8)(1);

      }

    }

    puVar8 = (undefined4 *)(local_20 + -0x14);

    iVar6 = (*pcVar7)(local_20 + -0x10);

    if ((iVar6 == 0) && (puVar8 != (undefined4 *)0x0)) {

      (**(code **)*puVar8)(1);

    }

  }

  return 0;

}





// --- FUN_00572760 at 0x00572760 (size: 15079) ---


void FUN_00572760(uint param_1,int *param_2)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  undefined4 uVar4;

  LONG LVar5;

  undefined4 *puVar6;

  bool bVar7;

  undefined1 *puVar8;

  wchar_t *pwVar9;

  wchar_t *pwVar10;

  undefined1 *puVar11;

  undefined1 *puVar12;

  undefined *local_3cc;

  undefined1 local_3c8 [4];

  undefined1 local_3c4 [4];

  undefined1 local_3c0 [4];

  undefined1 local_3bc [4];

  undefined1 local_3b8 [4];

  undefined1 local_3b4 [4];

  undefined1 local_3b0 [4];

  undefined1 local_3ac [4];

  undefined1 local_3a8 [4];

  undefined1 local_3a4 [4];

  undefined1 local_3a0 [4];

  undefined1 local_39c [4];

  undefined1 local_398 [4];

  undefined1 local_394 [4];

  undefined1 local_390 [4];

  undefined1 local_38c [4];

  undefined1 local_388 [4];

  undefined1 local_384 [4];

  undefined1 local_380 [4];

  undefined1 local_37c [4];

  undefined1 local_378 [4];

  undefined1 local_374 [4];

  undefined1 local_370 [4];

  undefined1 local_36c [4];

  undefined1 local_368 [4];

  undefined1 local_364 [4];

  undefined1 local_360 [4];

  undefined1 local_35c [4];

  undefined1 local_358 [4];

  undefined1 local_354 [4];

  undefined1 local_350 [4];

  undefined1 local_34c [4];

  undefined1 local_348 [4];

  undefined1 local_344 [4];

  undefined1 local_340 [4];

  undefined1 local_33c [4];

  undefined1 local_338 [4];

  undefined1 local_334 [4];

  undefined1 local_330 [4];

  undefined1 local_32c [4];

  undefined1 local_328 [4];

  undefined1 local_324 [4];

  undefined1 local_320 [4];

  undefined1 local_31c [4];

  undefined1 local_318 [4];

  undefined1 local_314 [4];

  undefined1 local_310 [4];

  undefined1 local_30c [4];

  undefined1 local_308 [4];

  undefined1 local_304 [4];

  undefined1 local_300 [4];

  undefined1 local_2fc [4];

  undefined1 local_2f8 [4];

  undefined1 local_2f4 [4];

  undefined1 local_2f0 [4];

  undefined1 local_2ec [4];

  undefined1 local_2e8 [4];

  undefined1 local_2e4 [4];

  undefined1 local_2e0 [4];

  undefined1 local_2dc [4];

  undefined1 local_2d8 [4];

  undefined1 local_2d4 [4];

  undefined1 local_2d0 [4];

  undefined1 local_2cc [4];

  undefined1 local_2c8 [4];

  undefined1 local_2c4 [4];

  undefined1 local_2c0 [4];

  undefined1 local_2bc [4];

  undefined1 local_2b8 [4];

  undefined1 local_2b4 [4];

  undefined1 local_2b0 [4];

  undefined1 local_2ac [4];

  undefined1 local_2a8 [4];

  undefined1 local_2a4 [4];

  undefined1 local_2a0 [4];

  undefined1 local_29c [4];

  undefined1 local_298 [4];

  undefined1 local_294 [4];

  undefined1 local_290 [4];

  undefined1 local_28c [4];

  undefined1 local_288 [4];

  undefined1 local_284 [4];

  undefined1 local_280 [4];

  undefined1 local_27c [4];

  undefined1 local_278 [4];

  undefined1 local_274 [4];

  undefined1 local_270 [4];

  undefined1 local_26c [4];

  undefined1 local_268 [4];

  undefined1 local_264 [4];

  undefined1 local_260 [4];

  undefined1 local_25c [4];

  undefined1 local_258 [4];

  undefined1 local_254 [4];

  undefined1 local_250 [4];

  undefined1 local_24c [4];

  undefined1 local_248 [4];

  undefined1 local_244 [4];

  undefined1 local_240 [4];

  undefined1 local_23c [4];

  undefined1 local_238 [4];

  undefined1 local_234 [4];

  undefined1 local_230 [4];

  undefined1 local_22c [4];

  undefined1 local_228 [4];

  undefined1 local_224 [4];

  undefined1 local_220 [4];

  undefined1 local_21c [4];

  undefined1 local_218 [4];

  undefined1 local_214 [4];

  undefined1 local_210 [4];

  undefined1 local_20c [4];

  undefined1 local_208 [4];

  undefined1 local_204 [4];

  undefined1 local_200 [4];

  undefined1 local_1fc [4];

  undefined1 local_1f8 [4];

  undefined1 local_1f4 [4];

  undefined1 local_1f0 [4];

  undefined1 local_1ec [4];

  undefined1 local_1e8 [4];

  undefined1 local_1e4 [4];

  undefined1 local_1e0 [4];

  undefined1 local_1dc [4];

  undefined1 local_1d8 [4];

  undefined1 local_1d4 [4];

  undefined1 local_1d0 [4];

  undefined1 local_1cc [4];

  undefined1 local_1c8 [4];

  undefined1 local_1c4 [4];

  undefined1 local_1c0 [4];

  undefined1 local_1bc [4];

  undefined1 local_1b8 [4];

  undefined1 local_1b4 [4];

  undefined1 local_1b0 [4];

  undefined1 local_1ac [4];

  undefined1 local_1a8 [4];

  undefined1 local_1a4 [4];

  undefined1 local_1a0 [4];

  undefined1 local_19c [4];

  undefined1 local_198 [4];

  undefined1 local_194 [4];

  undefined1 local_190 [4];

  undefined1 local_18c [4];

  undefined1 local_188 [4];

  undefined1 local_184 [4];

  undefined1 local_180 [4];

  undefined1 local_17c [4];

  undefined1 local_178 [4];

  undefined1 local_174 [4];

  undefined1 local_170 [4];

  undefined1 local_16c [4];

  undefined1 local_168 [4];

  undefined1 local_164 [4];

  undefined1 local_160 [4];

  undefined1 local_15c [4];

  undefined1 local_158 [4];

  undefined1 local_154 [4];

  undefined1 local_150 [4];

  undefined1 local_14c [4];

  undefined1 local_148 [4];

  undefined1 local_144 [4];

  undefined1 local_140 [4];

  undefined1 local_13c [4];

  undefined1 local_138 [4];

  undefined1 local_134 [4];

  undefined1 local_130 [4];

  undefined1 local_12c [4];

  undefined1 local_128 [4];

  undefined1 local_124 [4];

  undefined1 local_120 [4];

  undefined1 local_11c [4];

  undefined1 local_118 [4];

  undefined1 local_114 [4];

  undefined1 local_110 [4];

  undefined1 local_10c [4];

  undefined1 local_108 [4];

  undefined1 local_104 [4];

  undefined1 local_100 [4];

  undefined1 local_fc [4];

  undefined1 local_f8 [4];

  undefined1 local_f4 [4];

  undefined1 local_f0 [4];

  undefined1 local_ec [4];

  undefined1 local_e8 [4];

  undefined1 local_e4 [4];

  undefined1 local_e0 [4];

  undefined1 local_dc [4];

  undefined1 local_d8 [4];

  undefined1 local_d4 [4];

  undefined1 local_d0 [4];

  undefined1 local_cc [4];

  undefined1 local_c8 [4];

  undefined1 local_c4 [4];

  undefined1 local_c0 [4];

  undefined1 local_bc [4];

  undefined1 local_b8 [4];

  undefined1 local_b4 [4];

  undefined1 local_b0 [4];

  undefined1 local_ac [4];

  undefined1 local_a8 [4];

  undefined1 local_a4 [4];

  undefined1 local_a0 [4];

  undefined1 local_9c [4];

  undefined1 local_98 [4];

  undefined1 local_94 [4];

  undefined1 local_90 [4];

  undefined1 local_8c [4];

  undefined1 local_88 [4];

  undefined1 local_84 [4];

  undefined1 local_80 [4];

  undefined1 local_7c [4];

  undefined1 local_78 [4];

  undefined1 local_74 [4];

  undefined1 local_70 [4];

  undefined1 local_6c [4];

  undefined1 local_68 [4];

  undefined1 local_64 [4];

  undefined1 local_60 [4];

  undefined1 local_5c [4];

  undefined1 local_58 [4];

  undefined1 local_54 [4];

  undefined4 local_50;

  undefined1 local_4c [4];

  undefined1 local_48 [4];

  undefined1 local_44 [4];

  undefined1 local_40 [4];

  undefined1 local_3c [4];

  undefined1 local_38 [4];

  undefined1 local_34 [4];

  undefined1 local_30 [4];

  undefined1 local_2c [8];

  undefined1 local_24 [4];

  undefined1 local_20 [4];

  undefined1 local_1c [4];

  undefined1 local_18 [4];

  undefined1 local_14 [4];

  undefined1 local_10 [4];

  undefined1 local_c [4];

  undefined1 local_8 [4];

  undefined1 local_4 [4];

  

  local_50 = 0;

  local_3cc = PTR_DAT_00818340;

  InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

  if (param_1 < 0x3f) {

    if ((param_1 == 0x3e) || ((param_1 == 0x23 || (param_1 == 0x36)))) {

LAB_005727ae:

      iVar2 = FUN_0056b210();

      if (iVar2 != 0) {

        FUN_0056b210();

        cVar1 = FUN_0056b5a0();

        if (cVar1 != '\0') {

          FUN_0056b210();

          FUN_0056bbd0();

        }

      }

    }

  }

  else if ((param_1 == 0x43) || (param_1 == 0x3f7)) goto LAB_005727ae;

  if (param_1 < 0x4e9) {

    if (param_1 == 0x4e8) {

      iVar2 = *param_2;

      pwVar9 = L"The %s cannot be used while on a hook and only the owner may open the hook.\n";

      goto LAB_005746fa;

    }

    if (param_1 < 0x48b) {

      if (param_1 == 0x48a) {

        FUN_00402730(L"You must be a monarch to purchase this dwelling.\n");

        FUN_005649f0(local_2b8,0,1,0);

        goto LAB_00576215;

      }

      if (0x408 < param_1) {

        switch(param_1) {

        case 0x40a:

          FUN_00402730(L"You are unprepared to cast a spell");

          FUN_005649f0(local_198,0x1a,1,0);

          break;

        case 0x40b:

          FUN_00402730(L"You\'ve already sworn your Allegiance");

          FUN_005649f0(local_310,0x1a,1,0);

          break;

        case 0x40c:

          FUN_00402730(L"You don\'t have enough experience available to swear Allegiance");

          FUN_005649f0(local_c8,0x1a,1,0);

          break;

        default:

          goto switchD_0057282b_caseD_18;

        case 0x413:

          iVar2 = *param_2;

          pwVar9 = L"%s is already one of your followers";

          goto LAB_00575cc0;

        case 0x414:

          FUN_00402730(L"You are not in an allegiance!");

          FUN_005649f0(local_188,0x1a,1,0);

          break;

        case 0x416:

          iVar2 = *param_2;

          pwVar9 = L"%s cannot have any more Vassals";

          goto LAB_00573b06;

        case 0x41d:

          FUN_00402730(L"You must be the leader of a Fellowship");

          FUN_005649f0(local_308,0x1a,1,0);

          break;

        case 0x41e:

          FUN_00402730(L"Your Fellowship is full");

          FUN_005649f0(local_44,0x1a,1,0);

          break;

        case 0x41f:

          FUN_00402730(L"That Fellowship name is not permitted");

          FUN_005649f0(local_300,0x1a,1,0);

          break;

        case 0x422:

          FUN_00402730(L"That channel doesn\'t exist.");

          FUN_005649f0(local_180,0x1a,1,0);

          break;

        case 0x423:

          FUN_00402730(L"You can\'t use that channel.");

          FUN_005649f0(local_2f8,0x1a,1,0);

          break;

        case 0x424:

          FUN_00402730(L"You\'re already on that channel.");

          FUN_005649f0(local_c0,0x1a,1,0);

          break;

        case 0x425:

          FUN_00402730(L"You\'re not currently on that channel.");

          FUN_005649f0(local_2f0,0x1a,1,0);

          break;

        case 0x427:

          FUN_00402730(L"You cannot merge different stacks!");

          FUN_005649f0(local_348,0x1a,1,0);

          break;

        case 0x428:

          FUN_00402730(L"You cannot merge enchanted items!");

          FUN_005649f0(local_4c,0x1a,1,0);

          break;

        case 0x429:

          FUN_00402730(L"You must control at least one stack!");

          FUN_005649f0(local_340,0x1a,1,0);

          break;

        case 0x432:

        case 0x433:

        case 0x435:

          FUN_00402730(L"Your craft attempt fails.");

          FUN_005649f0(local_178,0x1a,1,0);

          break;

        case 0x434:

          FUN_00402730(L"Given that number of items, you cannot craft anything.");

          FUN_005649f0(local_2e0,0x1a,1,0);

          break;

        case 0x437:

          FUN_00402730(

                      L"Either you or one of the items involved does not pass the requirements for this craft interaction."

                      );

          FUN_005649f0(local_60,0x1a,1,0);

          break;

        case 0x438:

          FUN_00402730(L"You do not have all the neccessary items.");

          FUN_005649f0(local_170,0x1a,1,0);

          break;

        case 0x439:

          FUN_00402730(L"Not all the items are avaliable.");

          FUN_005649f0(local_2e8,0x1a,1,0);

          break;

        case 0x43a:

          FUN_00402730(L"You must be at rest in peace mode to do trade skills.");

          FUN_005649f0(local_2d8,0x1a,1,0);

          break;

        case 0x43b:

          FUN_00402730(L"You are not trained in that trade skill.");

          FUN_005649f0(local_b8,0x1a,1,0);

          break;

        case 0x43c:

          FUN_00402730(L"Your hands must be free.");

          FUN_005649f0(local_2d0,0x1a,1,0);

          break;

        case 0x43d:

          FUN_00402730(L"You cannot link to that portal!\n");

          FUN_005649f0(local_318,7,1,0);

          break;

        case 0x43e:

          FUN_00402730(L"You have solved this quest too recently!\n");

          FUN_005649f0(local_338,0,1,0);

          break;

        case 0x43f:

          FUN_00402730(L"You have solved this quest too many times!\n");

          FUN_005649f0(local_d0,0,1,0);

          break;

        case 0x445:

          FUN_00402730(

                      L"This item requires you to complete a specific quest before you can pick it up!\n"

                      );

          FUN_005649f0(local_330,0,1,0);

          break;

        case 0x45c:

          FUN_00402730(L"Player killers may not interact with that portal!\n");

          FUN_005649f0(local_328,7,1,0);

          break;

        case 0x45d:

          FUN_00402730(L"Non-player killers may not interact with that portal!\n");

          FUN_005649f0(local_68,7,1,0);

          break;

        case 0x45e:

        case 0x45f:

          FUN_00402730(L"You do not own a house!");

          FUN_005649f0(local_2c8,0x1a,1,0);

          break;

        case 0x466:

          FUN_00402730(

                      L"You must purchase Asheron\'s Call: Dark Majesty to interact with that portal.\n"

                      );

          FUN_005649f0(local_320,7,1,0);

          break;

        case 0x469:

          FUN_00402730(L"You have used all the hooks you are allowed to use for this house.\n");

          FUN_005649f0(local_160,0,1,0);

          break;

        case 0x46a:

          FUN_00402070(param_2);

          FUN_00402730(L" doesn\'t know what to do with that.\n");

          FUN_00408800(local_1a0);

          FUN_004011b0();

          FUN_005649f0(&local_3cc,0,1,0);

          goto switchD_0057282b_caseD_18;

        case 0x474:

          FUN_00402730(L"You must complete a quest to interact with that portal.\n");

          FUN_005649f0(local_190,7,1,0);

          break;

        case 0x47f:

          FUN_00402730(L"You must own a house to use this command.");

          FUN_005649f0(local_168,0x1a,1,0);

          break;

        case 0x480:

        case 0x481:

          FUN_00402730(L"Your monarch does not own a mansion or a villa!");

          FUN_005649f0(local_3c,0x1a,1,0);

          break;

        case 0x482:

          FUN_00402730(L"Your monarch has closed the mansion to the Allegiance.");

          FUN_005649f0(local_2c0,0x1a,1,0);

          break;

        case 0x488:

          iVar2 = *param_2;

          pwVar9 = L"You must be above level %s to purchase this dwelling.\n";

          goto LAB_005746fa;

        case 0x489:

          iVar2 = *param_2;

          pwVar9 = L"You must be at or below level %s to purchase this dwelling.\n";

          goto LAB_005746b3;

        }

        goto LAB_00576215;

      }

      if (param_1 == 0x408) {

        FUN_00402730(L"Your spell cannot be cast inside");

        FUN_005649f0(local_1a8,0x1a,1,0);

        goto LAB_00576215;

      }

      if (0x4f < param_1) {

        if (0x3ee < param_1) {

          switch(param_1) {

          case 0x3ef:

            FUN_00402070(param_2);

            FUN_00402730(L" is not accepting gifts right now.\n");

            FUN_00408800(local_e0);

            FUN_004011b0();

            goto LAB_00576047;

          default:

            goto switchD_0057282b_caseD_18;

          case 0x3f1:

            FUN_00402730(L"You failed to go to non-combat mode.");

            FUN_005649f0(local_54,0x1a,1,0);

            break;

          case 0x3f7:

            FUN_00402730(L"You are too fatigued to attack!");

            FUN_005649f0(local_380,0x1a,1,0);

            break;

          case 0x3f8:

            FUN_00402730(L"You are out of ammunition!");

            FUN_005649f0(local_1c0,0x1a,1,0);

            break;

          case 0x3f9:

            FUN_00402730(L"Your missile attack misfired!");

            FUN_005649f0(local_378,0x1a,1,0);

            break;

          case 0x3fa:

            FUN_00402730(L"You\'ve attempted an impossible spell path!");

            FUN_005649f0(local_d8,0x1a,1,0);

            break;

          case 0x3fe:

            FUN_00402730(L"You don\'t know that spell!");

            FUN_005649f0(local_370,0x1a,1,0);

            break;

          case 0x3ff:

            FUN_00402730(L"Incorrect target type");

            FUN_005649f0(local_1b8,0x1a,1,0);

            break;

          case 0x400:

            FUN_00402730(L"You don\'t have all the components for this spell.");

            FUN_005649f0(local_368,0x1a,1,0);

            break;

          case 0x401:

            FUN_00402730(L"You don\'t have enough Mana to cast this spell.");

            FUN_005649f0(local_70,0x1a,1,0);

            break;

          case 0x402:

            FUN_00402730(L"Your spell fizzled.\n");

            FUN_005649f0(local_360,7,1,0);

            break;

          case 0x403:

            FUN_00402730(L"Your spell\'s target is missing!");

            FUN_005649f0(local_1b0,0x1a,1,0);

            break;

          case 0x404:

            FUN_00402730(L"Your projectile spell mislaunched!");

            FUN_005649f0(local_358,0x1a,1,0);

            break;

          case 0x407:

            FUN_00402730(L"Your spell cannot be cast outside");

            FUN_005649f0(local_350,0x1a,1,0);

          }

          goto LAB_00576215;

        }

        if (param_1 == 0x3ee) {

          FUN_00402730(L"The container is closed!");

          FUN_005649f0(local_388,0x1a,1,0);

          goto LAB_00576215;

        }

        switch(param_1) {

        case 0x50:

          iVar2 = *param_2;

          pwVar9 = L"You fail to affect %s because beneficial spells do not affect %s!\n";

          goto LAB_00572c24;

        case 0x51:

          iVar2 = *param_2;

          pwVar9 = L"You fail to affect %s because you are not a player killer!\n";

          break;

        case 0x52:

          iVar2 = *param_2;

          pwVar9 = L"You fail to affect %s because %s is not a player killer!\n";

          goto LAB_00572bee;

        case 0x53:

          iVar2 = *param_2;

          pwVar9 = 

          L"You fail to affect %s because you are not the same sort of player killer as %s!\n";

LAB_00572c24:

          FUN_004027b0(&local_3cc,pwVar9,iVar2,iVar2);

          goto LAB_00572c31;

        case 0x54:

          iVar2 = *param_2;

          pwVar9 = L"You fail to affect %s because you are acting across a house boundary!\n";

          break;

        default:

          goto switchD_0057282b_caseD_18;

        }

LAB_0057495b:

        FUN_004027b0(&local_3cc,pwVar9,iVar2);

        goto LAB_00574968;

      }

      if (param_1 == 0x4f) {

        iVar2 = *param_2;

        pwVar9 = L"You fail to affect %s because $s cannot be harmed!\n";

        goto LAB_00572bee;

      }

      switch(param_1) {

      case 0x17:

        FUN_00402730(L"You failed to go to non-combat mode.");

        FUN_005649f0(local_1e0,0x1a,1,0);

        break;

      default:

        goto switchD_0057282b_caseD_18;

      case 0x1d:

        FUN_00402730(L"You\'re too busy!");

        FUN_005649f0(local_40,0x1a,1,0);

        break;

      case 0x1e:

        goto switchD_0057282b_caseD_1e;

      case 0x20:

        FUN_00402730(L"You must control both objects!");

        FUN_005649f0(local_3b8,0x1a,1,0);

        break;

      case 0x23:

      case 0x37:

      case 0x38:

      case 0x39:

        FUN_00564d30();

        FUN_005652b0(0,1);

        FUN_00402730(L"Unable to move to object!");

        FUN_005649f0(local_f0,0x1a,1,0);

        break;

      case 0x24:

        FUN_005649f0(&DAT_0087189c,0x1a,1,0);

        goto switchD_0057282b_caseD_18;

      case 0x26:

        FUN_00402730(L"That is not a valid command.");

        FUN_005649f0(local_398,0x1a,1,0);

        break;

      case 0x28:

        FUN_00402730(L"The item is under someone else\'s control!");

        FUN_005649f0(local_3a8,0x1a,1,0);

        break;

      case 0x29:

        FUN_00402730(L"You cannot pick that up!");

        FUN_005649f0(local_78,0x1a,1,0);

        break;

      case 0x2a:

        FUN_00402730(L"You are too encumbered to carry that!");

        FUN_005649f0(local_3a0,0x1a,1,0);

        break;

      case 0x2b:

        FUN_00402070(param_2);

        FUN_00402730(L" cannot carry anymore.\n");

        FUN_00408800(local_e8);

        FUN_004011b0();

        goto LAB_00576047;

      case 0x36:

        FUN_00402730(L"Action cancelled!");

        FUN_005649f0(local_1d8,0x1a,1,0);

        break;

      case 0x3a:

        FUN_00402730(L"You can\'t do that... you\'re dead!");

        FUN_005649f0(local_3c0,0x1a,1,0);

        break;

      case 0x3d:

        FUN_00402730(L"You charged too far!");

        FUN_005649f0(local_3b0,0x1a,1,0);

        break;

      case 0x3e:

        FUN_00402730(L"You are too tired to do that!");

        FUN_005649f0(local_1d0,0x1a,1,0);

        break;

      case 0x48:

        FUN_005649f0(&DAT_00871898,0x1a,1,0);

        goto switchD_0057282b_caseD_18;

      case 0x49:

        FUN_005649f0(&DAT_008718a0,0x1a,1,0);

        goto switchD_0057282b_caseD_18;

      case 0x4a:

        FUN_00402730(L"Ack! You killed yourself!\n");

        FUN_005649f0(local_1c8,0,1,0);

        break;

      case 0x4d:

        FUN_00402730(L"Invalid PK status!");

        FUN_005649f0(local_390,0x1a,1,0);

        break;

      case 0x4e:

        FUN_004027b0(&local_3cc,L"You fail to affect %s because you cannot affect anyone!\n",

                     *param_2);

        FUN_005649f0(&local_3cc,7,1,0);

        goto switchD_0057282b_caseD_18;

      }

      goto LAB_00576215;

    }

    switch(param_1) {

    case 0x48b:

      iVar2 = *param_2;

      pwVar9 = L"You must be above allegiance rank %s to purchase this dwelling.\n";

      goto LAB_005746b3;

    case 0x48c:

      iVar2 = *param_2;

      pwVar9 = L"You must be at or below allegiance rank %s to purchase this dwelling.\n";

      goto LAB_0057603a;

    default:

      goto switchD_0057282b_caseD_18;

    case 0x48e:

      FUN_00402730(L"Your offer of Allegiance has been ignored.");

      FUN_005649f0(local_110,0x1a,1,0);

      break;

    case 0x48f:

      FUN_00402730(L"You are already involved in something!");

      FUN_005649f0(local_b0,0x1a,1,0);

      break;

    case 0x490:

      FUN_00402730(L"You must be a monarch to use this command.");

      FUN_005649f0(local_2a8,0x1a,1,0);

      break;

    case 0x491:

      FUN_00402730(L"You must specify a character to boot.");

      FUN_005649f0(local_218,0x1a,1,0);

      break;

    case 0x492:

      FUN_00402730(L"You can\'t boot yourself!");

      FUN_005649f0(local_88,0x1a,1,0);

      break;

    case 0x493:

      FUN_00402730(L"That character does not exist.");

      FUN_005649f0(local_58,0x1a,1,0);

      break;

    case 0x494:

      FUN_00402730(L"That person is not a member of your Allegiance!");

      FUN_005649f0(local_38,0x1a,1,0);

      break;

    case 0x495:

      FUN_00402730(L"No patron from which to break!");

      FUN_005649f0(local_200,0x1a,1,0);

      break;

    case 0x496:

      FUN_00402730(L"Your Allegiance has been dissolved!\n");

      FUN_005649f0(local_100,0,1,0);

      break;

    case 0x497:

      FUN_00402730(L"Your patron\'s Allegiance to you has been broken!\n");

      FUN_005649f0(local_1f8,0,1,0);

      break;

    case 0x498:

      FUN_00402730(L"You have moved too far!");

      FUN_005649f0(local_2b0,0x1a,1,0);

      break;

    case 0x499:

      FUN_00402730(L"That is not a valid destination!");

      FUN_005649f0(local_158,0x1a,1,0);

      break;

    case 0x49a:

      FUN_00402730(L"You must purchase Asheron\'s Call -- Dark Majesty to use this function.");

      FUN_005649f0(local_2a0,0x1a,1,0);

      break;

    case 0x49b:

      FUN_00402730(L"You fail to link with the lifestone!\n");

      FUN_005649f0(local_230,7,1,0);

      break;

    case 0x49c:

      FUN_00402730(L"You wandered too far to link with the lifestone!\n");

      FUN_005649f0(local_118,7,1,0);

      break;

    case 0x49d:

      FUN_00402730(L"You successfully link with the lifestone!\n");

      FUN_005649f0(local_228,7,1,0);

      break;

    case 0x49e:

      FUN_00402730(L"You must have linked with a lifestone in order to recall to it!\n");

      FUN_005649f0(local_48,7,1,0);

      break;

    case 0x49f:

      FUN_00402730(L"You fail to recall to the lifestone!\n");

      FUN_005649f0(local_220,7,1,0);

      break;

    case 0x4a0:

      FUN_00402730(L"You fail to link with the portal!\n");

      FUN_005649f0(local_270,7,1,0);

      break;

    case 0x4a1:

      FUN_00402730(L"You successfully link with the portal!\n");

      FUN_005649f0(local_138,7,1,0);

      break;

    case 0x4a2:

      FUN_00402730(L"You fail to recall to the portal!\n");

      FUN_005649f0(local_268,7,1,0);

      break;

    case 0x4a3:

      FUN_00402730(L"You must have linked with a portal in order to recall to it!\n");

      FUN_005649f0(local_2c,7,1,0);

      break;

    case 0x4a4:

      FUN_00402730(L"You fail to summon the portal!\n");

      FUN_005649f0(local_260,7,1,0);

      break;

    case 0x4a5:

      FUN_00402730(L"You must have linked with a portal in order to summon it!\n");

      FUN_005649f0(local_130,7,1,0);

      break;

    case 0x4a6:

      FUN_00402730(L"You fail to teleport!\n");

      FUN_005649f0(local_258,7,1,0);

      break;

    case 0x4a7:

      FUN_00402730(L"You have been teleported too recently!\n");

      FUN_005649f0(local_98,7,1,0);

      break;

    case 0x4a8:

      FUN_00402730(L"You must be an Advocate to interact with that portal.\n");

      FUN_005649f0(local_250,7,1,0);

      break;

    case 0x4aa:

      FUN_00402730(L"Players may not interact with that portal.\n");

      FUN_005649f0(local_128,7,1,0);

      break;

    case 0x4ab:

      FUN_00402730(L"You are not powerful enough to interact with that portal!\n");

      FUN_005649f0(local_30,7,1,0);

      break;

    case 0x4ac:

      FUN_00402730(L"You are too powerful to interact with that portal!\n");

      FUN_005649f0(local_248,7,1,0);

      break;

    case 0x4ad:

      FUN_00402730(L"You cannot recall to that portal!\n");

      FUN_005649f0(local_120,7,1,0);

      break;

    case 0x4ae:

      FUN_00402730(L"You cannot summon that portal!\n");

      FUN_005649f0(local_238,7,1,0);

      break;

    case 0x4af:

      FUN_00402730(L"The lock is already unlocked.");

      FUN_005649f0(local_a8,0x1a,1,0);

      break;

    case 0x4b0:

      FUN_00402730(L"You can\'t lock or unlock that!");

      FUN_005649f0(local_290,0x1a,1,0);

      break;

    case 0x4b1:

      FUN_00402730(L"You can\'t lock or unlock what is open!");

      FUN_005649f0(local_148,0x1a,1,0);

      break;

    case 0x4b2:

      FUN_00402730(L"The key doesn\'t fit this lock.\n");

      FUN_005649f0(local_288,0,1,0);

      break;

    case 0x4b3:

      FUN_00402730(L"The lock has been used too recently.");

      FUN_005649f0(local_34,0x1a,1,0);

      break;

    case 0x4b4:

      FUN_00402730(L"You aren\'t trained in lockpicking!");

      FUN_005649f0(local_280,0x1a,1,0);

      break;

    case 0x4b5:

      FUN_00402730(L"You must specify a character to query.");

      FUN_005649f0(local_210,0x1a,1,0);

      break;

    case 0x4b6:

      FUN_00402730(L"Please use the allegiance panel to view your own information.");

      FUN_005649f0(local_108,0x1a,1,0);

      break;

    case 0x4b7:

      FUN_00402730(L"You have used that command too recently.");

      FUN_005649f0(local_208,0x1a,1,0);

      break;

    case 0x4b8:

    case 0x4b9:

    case 0x4ba:

      FUN_006a32d0(param_1);

      goto switchD_0057282b_caseD_18;

    case 0x4bd:

      FUN_00402730(L"You do not own that salvage tool!\n");

      FUN_005649f0(local_1f0,0,1,0);

      break;

    case 0x4be:

      FUN_00402730(L"You do not own that item!\n");

      FUN_005649f0(local_f8,0,1,0);

      break;

    case 0x4bf:

      iVar2 = *param_2;

      bVar7 = *(int *)(iVar2 + -4) == 1;

      if (bVar7) {

        piVar3 = (int *)FUN_00402730(L"item");

        iVar2 = *piVar3;

      }

      FUN_004027b0(&local_3cc,L"The %s was not suitable for salvaging.",iVar2);

      if (bVar7) {

        FUN_004011b0();

      }

      FUN_005649f0(&local_3cc,0x1a,1,0);

      goto switchD_0057282b_caseD_18;

    case 0x4c0:

      pwVar9 = (wchar_t *)*param_2;

      if (*(int *)(pwVar9 + -2) == 1) {

        pwVar9 = L"item";

      }

      pwVar10 = L"The %s contains the wrong material.";

      goto LAB_005742f0;

    case 0x4c1:

      FUN_00402730(L"The material cannot be created.\n");

      FUN_005649f0(local_1e8,0,1,0);

      break;

    case 0x4c2:

      FUN_00402730(L"The list of items you are attempting to salvage is invalid.\n");

      FUN_005649f0(local_3c8,0,1,0);

      break;

    case 0x4c3:

      FUN_00402730(L"You cannot salvage items that you are trading!\n");

      FUN_005649f0(local_3c4,0,1,0);

      break;

    case 0x4c4:

      FUN_00402730(L"You must be a guest in this house to interact with that portal.\n");

      FUN_005649f0(local_240,7,1,0);

      break;

    case 0x4c5:

      FUN_00402730(L"Your Allegiance Rank is too low to use that item\'s magic.");

      FUN_005649f0(local_140,0x1a,1,0);

      break;

    case 0x4c6:

      pwVar9 = (wchar_t *)*param_2;

      pwVar10 = L"You must be %s to use that item\'s magic.";

      goto LAB_005742f0;

    case 0x4c7:

      FUN_00402730(L"Your Arcane Lore skill is too low to use that item\'s magic.");

      FUN_005649f0(local_278,0x1a,1,0);

      break;

    case 0x4c8:

      FUN_00402730(L"That item doesn\'t have enough Mana.");

      FUN_005649f0(local_a0,0x1a,1,0);

      break;

    case 0x4c9:

      pwVar9 = (wchar_t *)*param_2;

      pwVar10 = L"Your %s is too low to use that item\'s magic.";

LAB_005742f0:

      FUN_004027b0(&local_3cc,pwVar10,pwVar9);

      FUN_005649f0(&local_3cc,0x1a,1,0);

      goto switchD_0057282b_caseD_18;

    case 0x4ca:

      iVar2 = *param_2;

      pwVar9 = L"Only %s may use that item\'s magic.";

LAB_00573b06:

      FUN_004027b0(&local_3cc,pwVar9,iVar2);

      FUN_005649f0(&local_3cc,0x1a,1,0);

      goto switchD_0057282b_caseD_18;

    case 0x4cb:

      iVar2 = *param_2;

      pwVar9 = L"You must have %s specialized to use that item\'s magic.";

      goto LAB_00575cc0;

    case 0x4cc:

      FUN_00402730(L"You have been involved in a player killer battle too recently to do that!\n");

      FUN_005649f0(local_90,7,1,0);

      break;

    case 0x4ce:

switchD_0057282b_caseD_1e:

      FUN_00402070(param_2);

      FUN_00402730(L" is too busy to accept gifts right now.\n");

      FUN_00408800(local_298);

      FUN_004011b0();

      goto LAB_00576047;

    case 0x4cf:

      FUN_00402070(param_2);

      FUN_00402730(L" cannot accept stacked objects. Try giving one at a time.\n");

      FUN_00408800(local_150);

      FUN_004011b0();

      goto LAB_00576047;

    case 0x4d0:

      FUN_00402730(L"You have failed to alter your skill.\n");

      FUN_005649f0(local_394,0,1,0);

      break;

    case 0x4d1:

      iVar2 = *param_2;

      pwVar9 = 

      L"Your %s skill must be trained, not untrained or specialized, in order to be altered in this way!\n"

      ;

      goto LAB_005746b3;

    case 0x4d2:

      iVar2 = *param_2;

      pwVar9 = L"You do not have enough skill credits to specialize your %s skill.\n";

      goto LAB_0057603a;

    case 0x4d3:

      iVar2 = *param_2;

      pwVar9 = 

      L"You have too many available experience points to be able to absorb the experience points from your %s skill. Please spend some of your experience points and try again.\n"

      ;

      goto LAB_005746fa;

    case 0x4d4:

      iVar2 = *param_2;

      pwVar9 = L"Your %s skill is already untrained!\n";

      goto LAB_005746b3;

    case 0x4d5:

      FUN_004027b0(&local_3cc,

                   L"You are currently wielding items which require a certain level of %s.  Your %s skill cannot be lowered while you are wielding these items.  Please remove these items and try again.\n"

                   ,*param_2,*param_2);

      FUN_005649f0(&local_3cc,0,1,0);

      goto switchD_0057282b_caseD_18;

    case 0x4d6:

      iVar2 = *param_2;

      pwVar9 = L"You have succeeded in specializing your %s skill!\n";

      goto LAB_0057603a;

    case 0x4d7:

      iVar2 = *param_2;

      pwVar9 = L"You have succeeded in lowering your %s skill from specialized to trained!\n";

      goto LAB_005746fa;

    case 0x4d8:

      iVar2 = *param_2;

      pwVar9 = L"You have succeeded in untraining your %s skill!\n";

      goto LAB_005746b3;

    case 0x4d9:

      iVar2 = *param_2;

      pwVar9 = 

      L"Although you cannot untrain your %s skill, you have succeeded in recovering all the experience you had invested in it.\n"

      ;

      goto LAB_0057603a;

    case 0x4da:

      iVar2 = *param_2;

      pwVar9 = 

      L"You have too many credits invested in specialized skills already! Before you can specialize your %s skill, you will need to unspecialize some other skill.\n"

      ;

      goto LAB_005746b3;

    case 0x4dd:

      FUN_00402730(L"You have failed to alter your attributes.\n");

      FUN_005649f0(local_38c,0,1,0);

      break;

    case 0x4de:

    case 0x4df:

      FUN_00402730(&DAT_0079d2e0);

      uVar4 = FUN_004086c0(local_4,local_384);

      FUN_00402070(uVar4);

      FUN_004011b0();

      FUN_004011b0();

      FUN_005649f0(&local_3cc,0,1,0);

      goto switchD_0057282b_caseD_18;

    case 0x4e0:

      FUN_00402730(

                  L"You are currently wielding items which require a certain level of skill. Your attributes cannot be transferred while you are wielding these items. Please remove these items and try again.\n"

                  );

      FUN_005649f0(local_37c,0,1,0);

      break;

    case 0x4e1:

      FUN_00402730(L"You have succeeded in transferring your attributes!\n");

      FUN_005649f0(local_374,0,1,0);

      break;

    case 0x4e2:

      FUN_00402730(

                  L"This hook is a duplicated housing object. You may not add items to a duplicated housing object. Please empty the hook and allow it to reset.\n"

                  );

      FUN_005649f0(local_3bc,0,1,0);

      break;

    case 0x4e3:

      FUN_00402730(L"That item is of the wrong type to be placed on this hook.\n");

      FUN_005649f0(local_3ac,0,1,0);

      break;

    case 0x4e4:

      FUN_00402730(

                  L"This chest is a duplicated housing object. You may not add items to a duplicated housing object. Please empty everything -- including backpacks -- out of the chest and allow the chest to reset.\n"

                  );

      FUN_005649f0(local_3a4,0,1,0);

      break;

    case 0x4e5:

      FUN_00402730(

                  L"This hook was a duplicated housing object. Since it is now empty, it will be deleted momentarily. Once it is gone, it is safe to use the other, non-duplicated hook that is here.\n"

                  );

      FUN_005649f0(local_3b4,0,1,0);

      break;

    case 0x4e6:

      FUN_00402730(

                  L"This chest was a duplicated housing object. Since it is now empty, it will be deleted momentarily. Once it is gone, it is safe to use the other, non-duplicated chest that is here.\n"

                  );

      FUN_005649f0(local_39c,0,1,0);

      break;

    case 0x4e7:

      FUN_00402730(

                  L"You cannot swear allegiance to anyone because you own a monarch-only house. Please abandon your house and try again.\n"

                  );

      FUN_005649f0(local_80,0,1,0);

    }

    goto LAB_00576215;

  }

  switch(param_1) {

  case 0x4e9:

    iVar2 = *param_2;

    pwVar9 = 

    L"The %s cannot be used while on a hook, use the \'@house hooks on\' command to make the hook openable.\n"

    ;

    goto LAB_0057603a;

  case 0x4ea:

    iVar2 = *param_2;

    pwVar9 = L"The %s can only be used while on a hook.\n";

    goto LAB_0057603a;

  case 0x4eb:

    FUN_00402730(L"You can\'t do that while in the air!");

    FUN_005649f0(local_36c,0x1a,1,0);

    break;

  case 0x4ec:

    FUN_00402730(

                L"You cannot modify your player killer status while you are recovering from a PK death.\n"

                );

    FUN_005649f0(local_254,0,1,0);

    break;

  case 0x4ed:

    FUN_00402730(L"Advocates may not change their player killer status!\n");

    FUN_005649f0(local_24c,0,1,0);

    break;

  case 0x4ee:

    FUN_00402730(L"Your level is too low to change your player killer status with this object.\n");

    FUN_005649f0(local_244,0,1,0);

    break;

  case 0x4ef:

    FUN_00402730(L"Your level is too high to change your player killer status with this object.\n");

    FUN_005649f0(local_23c,0,1,0);

    break;

  case 0x4f0:

    FUN_00402730(

                L"You feel a harsh dissonance, and you sense that an act of killing you have committed recently is interfering with the conversion.\n"

                );

    FUN_005649f0(local_234,0,1,0);

    break;

  case 0x4f1:

    FUN_00402730(

                L"Bael\'Zharon\'s power flows through you again. You are once more a player killer.\n"

                );

    FUN_005649f0(local_22c,0,1,0);

    break;

  case 0x4f2:

    FUN_00402730(

                L"Bael\'Zharon has granted you respite after your moment of weakness. You are temporarily no longer a player killer.\n"

                );

    FUN_005649f0(local_224,0,1,0);

    break;

  case 0x4f3:

    FUN_00402730(L"Lite Player Killers may not interact with that portal!\n");

    FUN_005649f0(local_2fc,7,1,0);

    break;

  case 0x4f4:

    iVar2 = *param_2;

    pwVar9 = L"%s fails to affect you because $s cannot affect anyone!\n";

    goto LAB_00572bee;

  case 0x4f5:

    FUN_004027b0(&local_3cc,L"%s fails to affect you because you cannot be harmed!\n",*param_2);

    goto LAB_00572c31;

  case 0x4f6:

    iVar2 = *param_2;

    pwVar9 = L"%s fails to affect you because %s is not a player killer!\n";

LAB_00572bee:

    FUN_004027b0(&local_3cc,pwVar9,iVar2,iVar2);

LAB_00572bfb:

    FUN_005649f0(&local_3cc,7,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x4f7:

    FUN_00402730(L" fails to affect you because you are not a player killer!\n");

    uVar4 = FUN_004086c0(local_20,local_204);

    FUN_00402070(uVar4);

    FUN_004011b0();

    FUN_004011b0();

    FUN_005649f0(&local_3cc,7,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x4f8:

    FUN_00402730(&DAT_007d3fa0);

    FUN_00402730(L" fails to affect you because you are not the same sort of player killer as ");

    puVar12 = local_1f4;

    puVar11 = local_10;

    puVar8 = local_18;

    FUN_004086c0(local_8,local_1fc);

    FUN_004086c0(puVar8,param_2);

    uVar4 = FUN_004086c0(puVar11,puVar12);

    FUN_00402070(uVar4);

    FUN_004011b0();

    FUN_004011b0();

    FUN_004011b0();

    FUN_004011b0();

    FUN_004011b0();

    goto LAB_00574968;

  case 0x4f9:

    FUN_00402730(L" fails to affect you across a house boundary!\n");

    uVar4 = FUN_004086c0(local_24,local_1ec);

    FUN_00402070(uVar4);

    FUN_004011b0();

    FUN_004011b0();

LAB_00574968:

    FUN_005649f0(&local_3cc,7,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x4fa:

    FUN_00402070(param_2);

    FUN_00402730(L" is an invalid target.\n");

    FUN_00408800(local_314);

    FUN_004011b0();

LAB_00572c31:

    FUN_005649f0(&local_3cc,7,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x4fb:

    iVar2 = *param_2;

    pwVar9 = L"You are an invalid target for the spell of %s.\n";

    goto LAB_0057495b;

  case 0x4fc:

    FUN_00402730(L"You aren\'t trained in healing!");

    FUN_005649f0(local_344,0x1a,1,0);

    break;

  case 0x4fd:

    FUN_00402730(L"You don\'t own that healing kit!");

    FUN_005649f0(local_33c,0x1a,1,0);

    break;

  case 0x4fe:

    FUN_00402730(L"You can\'t heal that!");

    FUN_005649f0(local_334,0x1a,1,0);

    break;

  case 0x4ff:

    FUN_00402070(param_2);

    FUN_00402730(L" is already at full health!");

    FUN_00408800(local_32c);

    FUN_004011b0();

    FUN_005649f0(&local_3cc,0x1a,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x500:

    FUN_00402730(L"You aren\'t ready to heal!");

    FUN_005649f0(local_324,0x1a,1,0);

    break;

  case 0x501:

    FUN_00402730(L"You can only use Healing Kits on player characters.");

    FUN_005649f0(local_31c,0x1a,1,0);

    break;

  case 0x502:

    FUN_00402730(L"The Lifestone\'s magic protects you from the attack!\n");

    FUN_005649f0(local_2e4,7,1,0);

    break;

  case 0x503:

    FUN_00402730(L"The portal\'s residual energy protects you from the attack!\n");

    FUN_005649f0(local_2f4,7,1,0);

    break;

  case 0x504:

    FUN_00402730(

                L"You are enveloped in a feeling of warmth as you are brought back into the protection of the Light. You are once again a Non-Player Killer.\n"

                );

    FUN_005649f0(local_21c,0,1,0);

    break;

  case 0x505:

    FUN_00402730(L"You\'re too close to your sanctuary!");

    FUN_005649f0(local_164,0x1a,1,0);

    break;

  case 0x506:

    FUN_00402730(L"You can\'t do that -- you\'re trading!");

    FUN_005649f0(local_354,0x1a,1,0);

    break;

  case 0x507:

    FUN_00402730(

                L"Only Non-Player Killers may enter PK Lite. Please see @help pklite for more details about this command.\n"

                );

    FUN_005649f0(local_214,0,1,0);

    break;

  case 0x508:

    FUN_00402730(L"A cold wind touches your heart. You are now a Player Killer Lite.\n");

    FUN_005649f0(local_20c,0,1,0);

    break;

  case 0x509:

    FUN_00402070(param_2);

    FUN_00402730(L" has no appropriate targets equipped for this spell.\n");

    FUN_00408800(local_30c);

    FUN_004011b0();

    FUN_005649f0(&local_3cc,7,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x50a:

    FUN_004027b0(&local_3cc,L"You have no appropriate targets equipped for %s\'s spell.\n",*param_2)

    ;

    goto LAB_00572bfb;

  case 0x50b:

    FUN_00402730(L" is now an open fellowship; anyone may recruit new members.\n");

    uVar4 = FUN_004086c0(local_1c,local_1d4);

    FUN_00402070(uVar4);

    FUN_004011b0();

    FUN_004011b0();

    goto LAB_005746c0;

  case 0x50c:

    FUN_00402730(L" is now a closed fellowship.\n");

    uVar4 = FUN_004086c0(local_14,local_1cc);

    FUN_00402070(uVar4);

    FUN_004011b0();

    FUN_004011b0();

    goto LAB_005746c0;

  case 0x50d:

    FUN_00402730(L" is now the leader of this fellowship.\n");

    uVar4 = FUN_004086c0(local_c,local_1c4);

    FUN_00402070(uVar4);

    FUN_004011b0();

    FUN_004011b0();

    goto LAB_005746c0;

  case 0x50e:

    iVar2 = *param_2;

    pwVar9 = L"You have passed leadership of the fellowship to %s\n";

    goto LAB_0057603a;

  case 0x50f:

    FUN_00402730(L"You do not belong to a Fellowship.");

    FUN_005649f0(local_1bc,0x1a,1,0);

    break;

  case 0x510:

    FUN_004027b0(&local_3cc,

                 L"You may not hook any more %s on your house.  You already have the maximum number of %s hooked or you are not permitted to hook any on your type of house.\n"

                 ,*param_2,*param_2);

    goto LAB_005746c0;

  default:

    goto switchD_0057282b_caseD_18;

  case 0x512:

    FUN_00402730(

                L"You are now using the maximum number of hooks.  You cannot use another hook until you take an item off one of your hooks.\n"

                );

    FUN_005649f0(local_13c,0,1,0);

    break;

  case 0x513:

    FUN_00402730(

                L"You are no longer using the maximum number of hooks.  You may again add items to your hooks.\n"

                );

    FUN_005649f0(local_134,0,1,0);

    break;

  case 0x514:

    FUN_004027b0(&local_3cc,

                 L"You now have the maximum number of %s hooked.  You cannot hook any additional %s until you remove one or more from your house.\n"

                 ,*param_2,*param_2);

    goto LAB_005746c0;

  case 0x515:

    FUN_004027b0(&local_3cc,

                 L"You no longer have the maximum number of %s hooked.  You may hook additional %s.\n"

                 ,*param_2,*param_2);

    goto LAB_00574707;

  case 0x516:

    FUN_00402730(L"You are not permitted to use that hook.\n");

    FUN_005649f0(local_12c,0,1,0);

    break;

  case 0x517:

    FUN_00402730(L" is not close enough to your level.\n");

    uVar4 = FUN_004086c0(&local_50,local_1b4);

    FUN_00402070(uVar4);

    FUN_004011b0();

    FUN_004011b0();

    goto LAB_00574707;

  case 0x518:

    FUN_00407e40(L"This fellowship is locked; ");

    FUN_00408800(param_2);

    FUN_00402730(L" cannot be recruited into the fellowship.\n");

    FUN_00408800(local_174);

    FUN_004011b0();

    goto LAB_00576047;

  case 0x519:

    FUN_00402730(L"The fellowship is locked, you were not added to the fellowship.\n");

    FUN_005649f0(local_16c,0,1,0);

    break;

  case 0x51a:

    FUN_00402730(L"Only the original owner may use that item\'s magic.");

    FUN_005649f0(local_304,0x1a,1,0);

    break;

  case 0x51b:

    iVar2 = *param_2;

    pwVar9 = L"You have entered the %s channel.\n";

    goto LAB_0057603a;

  case 0x51c:

    iVar2 = *param_2;

    pwVar9 = L"You have left the %s channel.\n";

    goto LAB_005746fa;

  case 0x51e:

    FUN_00402070(param_2);

    FUN_00402730(

                L" will not receive your message, please use urgent assistance to speak with an in-game representative\n"

                );

    FUN_00408800(local_1ac);

    FUN_004011b0();

    goto LAB_00574707;

  case 0x51f:

    FUN_00480980(local_1a4,0,L"Message Blocked: %s",*param_2);

    FUN_005649f0(local_1a4,0x1a,1,0);

    break;

  case 0x520:

    FUN_00402730(L"You cannot add anymore people to the list of players that you can hear.\n");

    FUN_005649f0(local_18c,0,1,0);

    break;

  case 0x521:

    FUN_00402070(param_2);

    FUN_00402730(L" has been added to the list of people you can hear.\n");

    FUN_00408800(local_19c);

    FUN_004011b0();

    goto LAB_005746c0;

  case 0x522:

    FUN_00402070(param_2);

    FUN_00402730(L" has been removed from the list of people you can hear.\n");

    FUN_00408800(local_194);

    FUN_004011b0();

    goto LAB_005746c0;

  case 0x523:

    FUN_00402730(L"You are now deaf to player\'s screams.\n");

    FUN_005649f0(local_184,0,1,0);

    break;

  case 0x524:

    FUN_00402730(L"You can hear all players once again.\n");

    FUN_005649f0(local_17c,0,1,0);

    break;

  case 0x525:

    iVar2 = *param_2;

    pwVar9 = L"You fail to remove %s from your loud list.\n";

    goto LAB_0057603a;

  case 0x526:

    FUN_00402730(L"You chicken out.");

    FUN_005649f0(local_15c,0x1a,1,0);

    break;

  case 0x527:

    FUN_00402730(L"You cannot posssibly succeed.");

    FUN_005649f0(local_154,0x1a,1,0);

    break;

  case 0x528:

    FUN_00407e40(L"The fellowship is locked; you cannot open locked fellowships.\n");

    goto LAB_005746c0;

  case 0x529:

    FUN_00402730(L"Trade Complete!");

    FUN_005649f0(local_ec,0x1a,1,0);

    FUN_004011b0();

    iVar2 = FUN_0055b0a0();

    if (iVar2 != 0) {

      piVar3 = (int *)FUN_0055a740();

      (**(code **)(*piVar3 + 0x50))(piVar3);

    }

    goto switchD_0057282b_caseD_18;

  case 0x52a:

    FUN_00402730(L"That is not a salvaging tool.");

    FUN_005649f0(local_14c,0x1a,1,0);

    break;

  case 0x52b:

    FUN_00402730(L"That person is not available now.");

    FUN_005649f0(local_35c,0x1a,1,0);

    break;

  case 0x52c:

    iVar2 = *param_2;

    pwVar9 = L"You are now snooping on %s.\n";

    goto LAB_005746b3;

  case 0x52d:

    iVar2 = *param_2;

    pwVar9 = L"You are no longer snooping on %s.\n";

    goto LAB_0057603a;

  case 0x52e:

    iVar2 = *param_2;

    pwVar9 = L"You fail to snoop on %s.\n";

    goto LAB_005746fa;

  case 0x52f:

    iVar2 = *param_2;

    pwVar9 = L"%s attempted to snoop on you.\n";

    goto LAB_005746b3;

  case 0x530:

    iVar2 = *param_2;

    pwVar9 = L"%s is already being snooped on, only one person may snoop on another at a time.\n";

    goto LAB_0057603a;

  case 0x531:

    iVar2 = *param_2;

    pwVar9 = L"%s is in limbo and cannot receive your message.\n";

    goto LAB_005746fa;

  case 0x532:

    FUN_00402730(

                L"You must wait 30 days after purchasing a house before you may purchase another with any character on the same account. This applies to all housing except apartments.\n"

                );

    FUN_005649f0(local_114,0,1,0);

    break;

  case 0x533:

    iVar2 = *param_2;

    pwVar9 = 

    L"You have been booted from your allegiance chat room. Use \"@allegiance chat on\" to rejoin. (%s).\n"

    ;

    goto LAB_0057603a;

  case 0x534:

    iVar2 = *param_2;

    pwVar9 = L"%s has been booted from the allegiance chat room.\n";

    goto LAB_005746fa;

  case 0x535:

    FUN_00402730(L"You do not have the authority within your allegiance to do that.\n");

    FUN_005649f0(local_28c,0,1,0);

    break;

  case 0x536:

    iVar2 = *param_2;

    pwVar9 = L"The account of %s is already banned from the allegiance.\n";

    goto LAB_005746fa;

  case 0x537:

    iVar2 = *param_2;

    pwVar9 = L"The account of %s is not banned from the allegiance.\n";

    goto LAB_005746b3;

  case 0x538:

    iVar2 = *param_2;

    pwVar9 = L"The account of %s was not unbanned from the allegiance.\n";

    goto LAB_0057603a;

  case 0x539:

    iVar2 = *param_2;

    pwVar9 = L"The account of %s has been banned from the allegiance.\n";

    goto LAB_005746fa;

  case 0x53a:

    iVar2 = *param_2;

    pwVar9 = L"The account of %s is no longer banned from the allegiance.\n";

    goto LAB_005746b3;

  case 0x53b:

    FUN_00402730(L"Banned Characters: ");

    FUN_005649f0(local_284,0,1,0);

    FUN_004011b0();

    FUN_005649f0(param_2,0,1,0);

    FUN_00402730(&DAT_0079d2e0);

    FUN_005649f0(local_27c,0,1,0);

    break;

  case 0x53e:

    iVar2 = *param_2;

    pwVar9 = L"%s is banned from the allegiance!\n";

    goto LAB_005746fa;

  case 0x53f:

    iVar2 = *param_2;

    pwVar9 = L"You are banned from %s\'s allegiance!\n";

    goto LAB_005746b3;

  case 0x540:

    FUN_00402730(L"You have the maximum number of accounts banned.!\n");

    FUN_005649f0(local_2dc,0,1,0);

    break;

  case 0x541:

    iVar2 = *param_2;

    pwVar9 = L"%s is now an allegiance officer.\n";

    goto LAB_005746b3;

  case 0x542:

    iVar2 = *param_2;

    pwVar9 = L"An unspecified error occurred while attempting to set %s as an allegiance officer.\n"

    ;

    goto LAB_005746fa;

  case 0x543:

    iVar2 = *param_2;

    pwVar9 = L"%s is no longer an allegiance officer.\n";

    goto LAB_005746b3;

  case 0x544:

    iVar2 = *param_2;

    pwVar9 = 

    L"An unspecified error occurred while attempting to remove %s as an allegiance officer.\n";

    goto LAB_0057603a;

  case 0x545:

    FUN_00402730(

                L"You already have the maximum number of allegiance officers. You must remove some before you add any more.\n"

                );

    FUN_005649f0(local_2cc,0,1,0);

    break;

  case 0x546:

    FUN_00402730(L"Your allegiance officers have been cleared.\n");

    FUN_005649f0(local_2bc,0,1,0);

    break;

  case 0x547:

    iVar2 = *param_2;

    pwVar9 = L"You must wait %s before communicating again!\n";

    goto LAB_005746b3;

  case 0x548:

    FUN_00402730(L"You cannot join any chat channels while gagged.\n");

    FUN_005649f0(local_25c,0,1,0);

    break;

  case 0x549:

    iVar2 = *param_2;

    pwVar9 = 

    L"Your allegiance officer status has been modified. You now hold the position of: %s.\n";

    goto LAB_0057603a;

  case 0x54a:

    FUN_00402730(L"You are no longer an allegiance officer.\n");

    FUN_005649f0(local_2c4,0,1,0);

    break;

  case 0x54b:

    iVar2 = *param_2;

    pwVar9 = L"%s is already an allegiance officer of that level.\n";

    goto LAB_0057603a;

  case 0x54c:

    FUN_00402730(L"Your allegiance does not have a hometown.\n");

    FUN_005649f0(local_2ac,0,1,0);

    break;

  case 0x54d:

    iVar2 = *param_2;

    pwVar9 = L"The %s is currently in use.\n";

LAB_00575cc0:

    FUN_004027b0(&local_3cc,pwVar9,iVar2);

    FUN_005649f0(&local_3cc,0x1a,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x54e:

    FUN_00402730(

                L"The hook does not contain a usable item. You cannot open the hook because you do not own the house to which it belongs.\n"

                );

    FUN_005649f0(local_124,0,1,0);

    break;

  case 0x54f:

    FUN_00402730(

                L"The hook does not contain a usable item. Use the \'@house hooks on\'command to make the hook openable.\n"

                );

    FUN_005649f0(local_11c,0,1,0);

    break;

  case 0x550:

    FUN_00402730(L"Out of Range!");

    FUN_005649f0(local_364,0x1a,1,0);

    break;

  case 0x551:

    iVar2 = *param_2;

    pwVar9 = L"You are not listening to the %s channel!\n";

    goto LAB_005746fa;

  case 0x552:

    FUN_00402730(L"You must purchase Asheron\'s Call -- Throne of Destiny to use this function.");

    FUN_005649f0(local_e4,0x1a,1,0);

    break;

  case 0x553:

    FUN_00402730(L"You must purchase Asheron\'s Call -- Throne of Destiny to use this item.");

    FUN_005649f0(local_dc,0x1a,1,0);

    break;

  case 0x554:

    FUN_00402730(L"You must purchase Asheron\'s Call -- Throne of Destiny to use this portal.");

    FUN_005649f0(local_d4,0x1a,1,0);

    break;

  case 0x555:

    FUN_00402730(L"You must purchase Asheron\'s Call -- Throne of Destiny to access this quest.");

    FUN_005649f0(local_cc,0x1a,1,0);

    break;

  case 0x556:

    FUN_00402730(L"You have failed to complete the augmentation.\n");

    FUN_005649f0(local_10c,0,1,0);

    break;

  case 0x557:

    FUN_00402730(L"You have used this augmentation too many times already.\n");

    FUN_005649f0(local_104,0,1,0);

    break;

  case 0x558:

    FUN_00402730(L"You have used augmentations of this type too many times already.\n");

    FUN_005649f0(local_fc,0,1,0);

    break;

  case 0x559:

    FUN_00402730(

                L"You do not have enough unspent experience available to purchase this augmentation.\n"

                );

    FUN_005649f0(local_f4,0,1,0);

    break;

  case 0x55a:

    iVar2 = *param_2;

    pwVar9 = L"%s\n";

    goto LAB_005746b3;

  case 0x55b:

    iVar2 = *param_2;

    pwVar9 = L"Congratulations! You have succeeded in acquiring the %s augmentation.\n";

    goto LAB_0057603a;

  case 0x55c:

    iVar2 = *param_2;

    pwVar9 = 

    L"Although your augmentation will not allow you to untrain your %s skill, you have succeeded in recovering all the experience you had invested in it.\n"

    ;

    goto LAB_0057603a;

  case 0x55d:

    FUN_00402730(

                L"You must exit the Training Academy before that command will be available to you.\n"

                );

    FUN_005649f0(local_2ec,0,1,0);

    break;

  case 0x55e:

    FUN_005649f0(param_2,0,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x55f:

    FUN_00402730(L"Only Player Killer characters may use this command!\n");

    FUN_005649f0(local_1e4,0,1,0);

    break;

  case 0x560:

    FUN_00402730(L"Only Player Killer Lite characters may use this command!\n");

    FUN_005649f0(local_1dc,0,1,0);

    break;

  case 0x561:

    FUN_00402730(

                L"You may only have a maximum of 50 friends at once. If you wish to add more friends, you must first remove some."

                );

    FUN_005649f0(local_264,0x1a,1,0);

    break;

  case 0x562:

    iVar2 = *param_2;

    pwVar9 = L"%s is already on your friends list!\n";

    goto LAB_005746fa;

  case 0x563:

    iVar2 = *param_2;

    pwVar9 = L"That character is not on your friends list!\n";

    goto LAB_005746b3;

  case 0x564:

    FUN_00402730(L"Only the character who owns the house may use this command.");

    FUN_005649f0(local_144,0,1,0);

    break;

  case 0x565:

    FUN_004027b0(&local_3cc,

                 L"That allegiance name is invalid because it is empty. Please use the @allegiance name clear command to clear your allegiance name.\n"

                );

    goto LAB_00574707;

  case 0x566:

    FUN_004027b0(&local_3cc,L"That allegiance name is too long. Please choose another name.\n");

    goto LAB_00576047;

  case 0x567:

    FUN_004027b0(&local_3cc,

                 L"That allegiance name contains illegal characters. Please choose another name using only letters, spaces, - and \'.\n"

                );

    goto LAB_005746c0;

  case 0x568:

    FUN_004027b0(&local_3cc,

                 L"That allegiance name is not appropriate. Please choose another name.\n");

    goto LAB_00574707;

  case 0x569:

    FUN_004027b0(&local_3cc,L"That allegiance name is already in use. Please choose another name.\n"

                );

    goto LAB_00576047;

  case 0x56a:

    iVar2 = *param_2;

    pwVar9 = 

    L"You may only change your allegiance name once every 24 hours. You may change your allegiance name again in %s.\n"

    ;

    goto LAB_005746fa;

  case 0x56b:

    FUN_004027b0(&local_3cc,L"Your allegiance name has been cleared.\n");

    goto LAB_00576047;

  case 0x56c:

    FUN_004027b0(&local_3cc,L"That is already the name of your allegiance!\n");

    goto LAB_005746c0;

  case 0x56d:

    iVar2 = *param_2;

    pwVar9 = L"%s is the monarch and cannot be promoted or demoted.\n";

    goto LAB_005746b3;

  case 0x56e:

    iVar2 = *param_2;

    pwVar9 = L"That level of allegiance officer is now known as: %s.\n";

    goto LAB_0057603a;

  case 0x56f:

    FUN_00402730(L"That is an invalid officer level.\n");

    FUN_005649f0(local_2d4,0,1,0);

    break;

  case 0x570:

    FUN_00402730(L"That allegiance officer title is not appropriate.\n");

    FUN_005649f0(local_2b4,0,1,0);

    break;

  case 0x571:

    FUN_004027b0(&local_3cc,L"That allegiance name is too long. Please choose another name.\n");

    goto LAB_005746c0;

  case 0x572:

    FUN_004027b0(&local_3cc,L"All of your allegiance officer titles have been cleared.\n");

    goto LAB_00574707;

  case 0x573:

    FUN_004027b0(&local_3cc,

                 L"That allegiance title contains illegal characters. Please choose another name using only letters, spaces, - and \'.\n"

                );

    goto LAB_005746c0;

  case 0x574:

    iVar2 = *param_2;

    pwVar9 = L"Your allegiance is currently: %s.\n";

    goto LAB_0057603a;

  case 0x575:

    iVar2 = *param_2;

    pwVar9 = L"Your allegiance is now: %s.\n";

    goto LAB_005746fa;

  case 0x576:

    iVar2 = *param_2;

    pwVar9 = 

    L"You may not accept the offer of allegiance from %s because your allegiance is locked.\n";

LAB_005746b3:

    FUN_004027b0(&local_3cc,pwVar9,iVar2);

    goto LAB_005746c0;

  case 0x577:

    iVar2 = *param_2;

    pwVar9 = L"You may not swear allegiance at this time because the allegiance of %s is locked.\n";

    goto LAB_0057603a;

  case 0x578:

    iVar2 = *param_2;

    pwVar9 = L"You have pre-approved %s to join your allegiance.\n";

    goto LAB_005746fa;

  case 0x579:

    FUN_00402730(L"You have not pre-approved any vassals to join your allegiance.\n");

    FUN_005649f0(local_274,0,1,0);

    break;

  case 0x57a:

    iVar2 = *param_2;

    pwVar9 = L"%s is already a member of your allegiance!\n";

    goto LAB_0057603a;

  case 0x57b:

    iVar2 = *param_2;

    pwVar9 = L"%s has been pre-approved to join your allegiance.\n";

    goto LAB_005746fa;

  case 0x57c:

    FUN_00402730(L"You have cleared the pre-approved vassal for your allegiance.\n");

    FUN_005649f0(local_26c,0,1,0);

    break;

  case 0x57d:

    FUN_00402730(L"That character is already gagged!\n");

    FUN_005649f0(local_2a4,0,1,0);

    break;

  case 0x57e:

    FUN_00402730(L"That character is not currently gagged!\n");

    FUN_005649f0(local_29c,0,1,0);

    break;

  case 0x57f:

    iVar2 = *param_2;

    pwVar9 = 

    L"Your allegiance chat privileges have been temporarily removed by %s. Until they are restored, you may not view or speak in the allegiance chat channel."

    ;

    goto LAB_005746fa;

  case 0x580:

    FUN_004027b0(&local_3cc,

                 L"%s is now temporarily unable to view or speak in allegiance chat. The gag will run out in 5 minutes, or %s may be explicitly ungagged before then."

                 ,*param_2,*param_2);

    goto LAB_005746c0;

  case 0x581:

    FUN_00402730(L"Your allegiance chat privileges have been restored.\n");

    FUN_005649f0(local_294,0,1,0);

    break;

  case 0x582:

    iVar2 = *param_2;

    pwVar9 = L"Your allegiance chat privileges have been restored by %s.";

LAB_005746fa:

    FUN_004027b0(&local_3cc,pwVar9,iVar2);

LAB_00574707:

    FUN_005649f0(&local_3cc,0,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x583:

    FUN_004027b0(&local_3cc,L"You have restored allegiance chat privileges to %s.",*param_2,*param_2

                );

LAB_005746c0:

    FUN_005649f0(&local_3cc,0,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x584:

    FUN_00402730(L"You cannot pick up more of that item!");

    FUN_005649f0(local_34c,0x1a,1,0);

    break;

  case 0x585:

    FUN_00402730(L"You are restricted to clothes and armor created for your race.");

    FUN_005649f0(local_c4,0x1a,1,0);

    break;

  case 0x586:

    FUN_00402730(L"That item was specifically created for another race.");

    FUN_005649f0(local_bc,0x1a,1,0);

    break;

  case 0x587:

    FUN_00402730(L"Olthoi cannot interact with that!\n");

    FUN_005649f0(local_b4,7,1,0);

    break;

  case 0x588:

    FUN_00402730(L"Olthoi cannot use regular lifestones! Asheron would not allow it!\n");

    FUN_005649f0(local_ac,7,1,0);

    break;

  case 0x589:

    FUN_00402730(L"The vendor looks at you in horror!\n");

    FUN_005649f0(local_a4,7,1,0);

    break;

  case 0x58a:

    iVar2 = *param_2;

    pwVar9 = L"%s cowers from you!\n";

LAB_0057603a:

    FUN_004027b0(&local_3cc,pwVar9,iVar2);

LAB_00576047:

    FUN_005649f0(&local_3cc,0,1,0);

    goto switchD_0057282b_caseD_18;

  case 0x58b:

    FUN_00402730(L"As a mindless engine of destruction an Olthoi cannot join a fellowship!\n");

    FUN_005649f0(local_9c,7,1,0);

    break;

  case 0x58c:

    FUN_00402730(L"The Olthoi only have an allegiance to the Olthoi Queen!\n");

    FUN_005649f0(local_94,7,1,0);

    break;

  case 0x58d:

    FUN_00402730(L"You cannot use that item!\n");

    FUN_005649f0(local_8c,7,1,0);

    break;

  case 0x58e:

    FUN_00402730(L"This person will not interact with you!\n");

    FUN_005649f0(local_84,7,1,0);

    break;

  case 0x58f:

    FUN_00402730(L"Only Olthoi may pass through this portal!\n");

    FUN_005649f0(local_7c,7,1,0);

    break;

  case 0x590:

    FUN_00402730(L"Olthoi may not pass through this portal!\n");

    FUN_005649f0(local_74,7,1,0);

    break;

  case 0x591:

    FUN_00402730(L"You may not pass through this portal while Vitae weakens you!\n");

    FUN_005649f0(local_6c,7,1,0);

    break;

  case 0x592:

    FUN_00402730(

                L"This character must be two weeks old or have been created on an account at least two weeks old to use this portal!\n"

                );

    FUN_005649f0(local_64,7,1,0);

    break;

  case 0x593:

    FUN_00402730(L"Olthoi characters can only use Lifestone and PK Arena recalls!\n");

    FUN_005649f0(local_5c,7,1,0);

  }

LAB_00576215:

  FUN_004011b0();

switchD_0057282b_caseD_18:

  puVar6 = (undefined4 *)(local_3cc + -0x14);

  LVar5 = InterlockedDecrement((LONG *)(local_3cc + -0x10));

  if ((LVar5 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return;

}





// --- FUN_00576890 at 0x00576890 (size: 334) ---


undefined4 * FUN_00576890(undefined4 *param_1,int param_2,undefined4 *param_3)



{

  char cVar1;

  int iVar2;

  undefined *puVar3;

  LONG LVar4;

  char *pcVar5;

  char *pcVar6;

  int iVar7;

  undefined4 *puVar8;

  int local_4;

  

  puVar3 = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  iVar7 = param_2;

  puVar8 = param_3;

  if (param_2 != 0) {

    while( true ) {

      FUN_00401340(*puVar8);

      if (*(int *)(local_4 + -4) != 1) {

        FUN_00404ef0(local_4,*(int *)(local_4 + -4) + -1);

      }

      LVar4 = InterlockedDecrement((LONG *)(local_4 + -0x10));

      if ((LVar4 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

      }

      if (iVar7 + -1 == 0) break;

      param_2 = CONCAT31(param_2._1_3_,0x20);

      iVar2 = *(int *)(puVar3 + -4);

      if ((*(int *)(puVar3 + -0x10) == 1) && (iVar2 + 1U <= *(uint *)(puVar3 + -0xc))) {

        *(uint *)(puVar3 + -4) = iVar2 + 1U;

        *(undefined4 *)(puVar3 + -8) = 0xffffffff;

      }

      else {

        FUN_00401280(iVar2);

        pcVar5 = puVar3;

        pcVar6 = puVar3;

        do {

          cVar1 = *pcVar5;

          pcVar5 = pcVar5 + 1;

          *pcVar6 = cVar1;

          pcVar6 = pcVar6 + 1;

        } while (cVar1 != '\0');

        LVar4 = InterlockedDecrement((LONG *)(puVar3 + -0x10));

        if ((LVar4 == 0) && ((undefined4 *)(puVar3 + -0x14) != (undefined4 *)0x0)) {

          (*(code *)**(undefined4 **)(puVar3 + -0x14))(1);

        }

      }

      strncpy(puVar3 + iVar2 + -1,(char *)&param_2,1);

      puVar3[*(int *)(puVar3 + -4) + -1] = 0;

      iVar7 = iVar7 + -1;

      puVar8 = puVar8 + 1;

    }

  }

  *param_1 = puVar3;

  InterlockedIncrement((LONG *)(puVar3 + -0x10));

  LVar4 = InterlockedDecrement((LONG *)(puVar3 + -0x10));

  if ((LVar4 == 0) && ((undefined4 *)(puVar3 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(puVar3 + -0x14))(1);

  }

  return param_1;

}





// --- FUN_005769e0 at 0x005769E0 (size: 156) ---


int * FUN_005769e0(int *param_1,undefined4 param_2,undefined4 param_3)



{

  LONG LVar1;

  undefined1 *extraout_ECX;

  int iVar2;

  undefined1 *puVar3;

  int local_4;

  

  FUN_00576890(&local_4,param_2,param_3);

  iVar2 = DAT_00837748;

  InterlockedIncrement((LONG *)(DAT_00837748 + -0x10));

  FUN_00435720(1,1,iVar2);

  puVar3 = extraout_ECX;

  FUN_00401280(1);

  *puVar3 = 0x2b;

  puVar3[1] = 0;

  FUN_00435720(1,0,puVar3);

  *param_1 = local_4;

  InterlockedIncrement((LONG *)(local_4 + -0x10));

  LVar1 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

  }

  return param_1;

}





// --- FUN_00576a80 at 0x00576A80 (size: 1333) ---


undefined4 FUN_00576a80(int param_1,int param_2)



{

  char cVar1;

  int *piVar2;

  LONG LVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  uint uVar7;

  undefined4 *puVar8;

  undefined4 uVar9;

  undefined4 *local_1c;

  undefined4 *local_18;

  int local_14;

  undefined **ppuStack_10;

  uint uStack_c;

  undefined4 uStack_8;

  int *piStack_4;

  

  piVar2 = (int *)FUN_0056fc60(&local_18,&param_1,&param_2);

  iVar6 = *piVar2;

  InterlockedIncrement((LONG *)(iVar6 + -0x10));

  puVar8 = local_18 + -5;

  LVar3 = InterlockedDecrement(local_18 + -4);

  if ((LVar3 == 0) && (puVar8 != (undefined4 *)0x0)) {

    (**(code **)*puVar8)(1);

  }

  FUN_00401340(&DAT_007d14dc);

  iVar4 = FUN_00404b40(&local_1c,0);

  puVar8 = local_1c + -5;

  LVar3 = InterlockedDecrement(local_1c + -4);

  if ((LVar3 == 0) && (puVar8 != (undefined4 *)0x0)) {

    (**(code **)*puVar8)(1);

  }

  if (iVar4 == 0) {

    FUN_0055e1d0();

    uVar9 = 1;

  }

  else {

    FUN_00401340(&DAT_007d14d8);

    iVar4 = FUN_00404b40(&local_1c,0);

    puVar8 = local_1c + -5;

    LVar3 = InterlockedDecrement(local_1c + -4);

    if ((LVar3 == 0) && (puVar8 != (undefined4 *)0x0)) {

      (**(code **)*puVar8)(1);

    }

    if (iVar4 != 0) {

      FUN_00401340(&DAT_007db0e8);

      iVar4 = FUN_00404b40(&local_1c,0);

      puVar8 = local_1c + -5;

      LVar3 = InterlockedDecrement(local_1c + -4);

      if ((LVar3 == 0) && (puVar8 != (undefined4 *)0x0)) {

        (**(code **)*puVar8)(1);

      }

      if (iVar4 != 0) {

        FUN_00401340(&DAT_007db0d0);

        iVar6 = FUN_00404b40(&local_18,0);

        LVar3 = InterlockedDecrement(local_18 + -4);

        if ((LVar3 == 0) && (local_18 + -5 != (undefined4 *)0x0)) {

          (**(code **)local_18[-5])(1);

        }

        if (iVar6 == 0) {

          piVar2 = (int *)FUN_00576890(&param_2,param_1,param_2);

          iVar6 = *piVar2;

          param_1 = iVar6;

          InterlockedIncrement((LONG *)(iVar6 + -0x10));

          FUN_004011b0();

          if (*(int *)(iVar6 + -4) == 1) {

            FUN_00402730(L"Please specify an actual name.");

            FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(local_14 + 0x8c));

            FUN_004011b0();

          }

          else {

            FUN_0048c3e0(iVar6);

            FUN_006a8620(&param_2,1);

            FUN_005abb30();

          }

        }

        else {

          FUN_00401340("ungag");

          iVar6 = FUN_00404b40(&local_18,0);

          FUN_004011b0();

          if (iVar6 != 0) {

            FUN_004011b0();

            return 0;

          }

          uVar9 = FUN_00576890(&param_1,param_1,param_2);

          FUN_0041ab80(uVar9);

          FUN_004011b0();

          if (*(int *)(param_2 + -4) == 1) {

            FUN_00402730(L"Please specify an actual name.");

            FUN_005649f0(&param_1,0x1a,1,*(undefined4 *)(local_14 + 0x8c));

            FUN_004011b0();

            FUN_004011b0();

            FUN_004011b0();

            return 1;

          }

          FUN_0048c3e0(param_2);

          FUN_006a8620(&param_1,0);

          FUN_005abb30();

        }

        FUN_004011b0();

        FUN_004011b0();

        return 1;

      }

      piVar2 = (int *)FUN_00576890(&local_14,param_1,param_2);

      param_1 = *piVar2;

      InterlockedIncrement((LONG *)(param_1 + -0x10));

      LVar3 = InterlockedDecrement((LONG *)(local_14 + -0x10));

      if ((LVar3 == 0) && ((undefined4 *)(local_14 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(local_14 + -0x14))(1);

      }

      piStack_4 = &param_1;

      ppuStack_10 = &PTR_FUN_0079548c;

      uStack_8 = 0;

      uStack_c = 0;

      FUN_00401340("No reason given.");

      cVar1 = FUN_0040b580(0x2c,0);

      if (cVar1 != '\0') {

        uVar7 = uStack_c + 1;

        uVar5 = (*(code *)*ppuStack_10)();

        if (uVar5 < uVar7) {

          uVar7 = (*(code *)*ppuStack_10)();

        }

        uStack_c = uVar7;

        FUN_0040b1b0(*(int *)(*piStack_4 + -4) + -1);

        uVar9 = FUN_0040bfb0(&local_14);

        FUN_00402070(uVar9);

        FUN_004011b0();

        if (uStack_c == 0) {

          uStack_c = 0;

        }

        else {

          uStack_c = uStack_c - 1;

        }

        FUN_0040c010();

        iVar4 = DAT_00837748;

        InterlockedIncrement((LONG *)(DAT_00837748 + -0x10));

        FUN_00435720(1,1,iVar4);

      }

      FUN_0048c3e0(param_2);

      FUN_0048c3e0(param_1);

      FUN_006a8540(&local_1c,&local_18);

      LVar3 = InterlockedDecrement(local_1c + 1);

      if ((LVar3 == 0) && (local_1c != (undefined4 *)0x0)) {

        (**(code **)*local_1c)(1);

      }

      LVar3 = InterlockedDecrement(local_18 + 1);

      if ((LVar3 == 0) && (local_18 != (undefined4 *)0x0)) {

        (**(code **)*local_18)(1);

      }

      puVar8 = (undefined4 *)(param_2 + -0x14);

      LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

      if ((LVar3 == 0) && (puVar8 != (undefined4 *)0x0)) {

        (**(code **)*puVar8)(1);

      }

      puVar8 = (undefined4 *)(param_1 + -0x14);

      ppuStack_10 = &PTR_LAB_00795478;

      LVar3 = InterlockedDecrement((LONG *)(param_1 + -0x10));

      if ((LVar3 == 0) && (puVar8 != (undefined4 *)0x0)) {

        (**(code **)*puVar8)(1);

      }

      iVar4 = InterlockedDecrement((LONG *)(iVar6 + -0x10));

      goto joined_r0x00576dc1;

    }

    FUN_0055e1d0();

    uVar9 = 0;

  }

  FUN_005d4570(uVar9);

  iVar4 = InterlockedDecrement((LONG *)(iVar6 + -0x10));

joined_r0x00576dc1:

  if ((iVar4 == 0) && ((undefined4 *)(iVar6 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar6 + -0x14))(1);

    return 1;

  }

  return 1;

}





// --- FUN_00576fc0 at 0x00576FC0 (size: 173) ---


undefined1 FUN_00576fc0(undefined4 param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  undefined1 uVar3;

  LONG LVar4;

  

  FUN_00576890(&param_2,param_1,param_2);

  puVar2 = param_2;

  if (param_2[-1] != 1) {

    FUN_0048c3e0(param_2);

    uVar3 = FUN_006a4e50(0x2000000,&param_2);

    puVar1 = param_2;

    LVar4 = InterlockedDecrement(param_2 + 1);

    if ((LVar4 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

    puVar1 = puVar2 + -5;

    LVar4 = InterlockedDecrement(puVar2 + -4);

    if ((LVar4 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

    return uVar3;

  }

  puVar2 = param_2 + -5;

  LVar4 = InterlockedDecrement(param_2 + -4);

  if ((LVar4 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  return 0;

}





// --- FUN_00577070 at 0x00577070 (size: 698) ---


undefined1 __thiscall FUN_00577070(int param_1,int param_2,undefined4 *param_3)



{

  undefined1 uVar1;

  int *piVar2;

  LONG LVar3;

  int iVar4;

  int iVar5;

  undefined4 *puVar6;

  undefined4 *puVar7;

  int local_4;

  

  piVar2 = (int *)FUN_0056fc60(&local_4,&param_2,&param_3);

  iVar5 = *piVar2;

  InterlockedIncrement((LONG *)(iVar5 + -0x10));

  puVar6 = (undefined4 *)(local_4 + -0x14);

  LVar3 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  FUN_00401340(&DAT_007db0fc);

  iVar4 = FUN_00404b40(&local_4,0);

  LVar3 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar3 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

  }

  if (iVar4 == 0) {

    uVar1 = FUN_006a7d90();

  }

  else {

    FUN_005769e0(&param_3,param_2,param_3);

    puVar6 = param_3;

    if (param_3[-1] == 1) {

      FUN_00402730(L"Please specify an actual name.");

      FUN_005649f0(&param_3,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

      puVar7 = param_3 + -5;

      LVar3 = InterlockedDecrement(param_3 + -4);

      if ((LVar3 == 0) && (puVar7 != (undefined4 *)0x0)) {

        (**(code **)*puVar7)(1);

      }

      puVar7 = puVar6 + -5;

      LVar3 = InterlockedDecrement(puVar6 + -4);

      if ((LVar3 == 0) && (puVar7 != (undefined4 *)0x0)) {

        (**(code **)*puVar7)(1);

      }

      LVar3 = InterlockedDecrement((LONG *)(iVar5 + -0x10));

      if ((LVar3 == 0) && ((undefined4 *)(iVar5 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(iVar5 + -0x14))(1);

      }

      return 1;

    }

    FUN_00401340(&DAT_007db0f8);

    iVar4 = FUN_00404b40(&param_2,0);

    puVar6 = (undefined4 *)(param_2 + -0x14);

    LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    puVar6 = param_3;

    if (iVar4 != 0) {

      FUN_00401340("remove");

      iVar5 = FUN_00404b40(&param_2,0);

      puVar6 = (undefined4 *)(param_2 + -0x14);

      LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

      if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

        (**(code **)*puVar6)(1);

      }

      if (iVar5 == 0) {

        FUN_0048c3e0(param_3);

        uVar1 = FUN_006a88e0(&param_2);

        FUN_005abb30();

        FUN_004011b0();

        FUN_004011b0();

        return uVar1;

      }

      FUN_004011b0();

      FUN_004011b0();

      return 0;

    }

    FUN_0048c3e0(param_3);

    uVar1 = FUN_006a8480(&param_3);

    puVar7 = param_3;

    LVar3 = InterlockedDecrement(param_3 + 1);

    if ((LVar3 == 0) && (puVar7 != (undefined4 *)0x0)) {

      (**(code **)*puVar7)(1);

    }

    puVar7 = puVar6 + -5;

    LVar3 = InterlockedDecrement(puVar6 + -4);

    if ((LVar3 == 0) && (puVar7 != (undefined4 *)0x0)) {

      (**(code **)*puVar7)(1);

    }

  }

  LVar3 = InterlockedDecrement((LONG *)(iVar5 + -0x10));

  if ((LVar3 == 0) && ((undefined4 *)(iVar5 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar5 + -0x14))(1);

  }

  return uVar1;

}





// --- FUN_00577330 at 0x00577330 (size: 235) ---


undefined1 __thiscall FUN_00577330(int param_1,undefined4 param_2,undefined4 *param_3)



{

  undefined4 *puVar1;

  undefined1 uVar2;

  LONG LVar3;

  undefined4 *puVar4;

  

  FUN_005769e0(&param_3,param_2,param_3);

  puVar1 = param_3;

  if (param_3[-1] == 1) {

    FUN_00402730(L"Please specify an actual name.");

    FUN_005649f0(&param_3,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    puVar4 = param_3 + -5;

    LVar3 = InterlockedDecrement(param_3 + -4);

    if ((LVar3 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

    LVar3 = InterlockedDecrement(puVar1 + -4);

    if ((LVar3 == 0) && (puVar1 + -5 != (undefined4 *)0x0)) {

      (**(code **)puVar1[-5])(1);

    }

    return 1;

  }

  FUN_0048c3e0(param_3);

  uVar2 = FUN_006a8720(&param_3);

  puVar4 = param_3;

  LVar3 = InterlockedDecrement(param_3 + 1);

  if ((LVar3 == 0) && (puVar4 != (undefined4 *)0x0)) {

    (**(code **)*puVar4)(1);

  }

  LVar3 = InterlockedDecrement(puVar1 + -4);

  if ((LVar3 == 0) && (puVar1 + -5 != (undefined4 *)0x0)) {

    (**(code **)puVar1[-5])(1);

  }

  return uVar2;

}





// --- FUN_00577420 at 0x00577420 (size: 26) ---


undefined1 FUN_00577420(int param_1,undefined4 param_2)



{

  bool bVar1;

  undefined1 uVar2;

  int *piVar3;

  LONG LVar4;

  int iVar5;

  int iVar6;

  long lVar7;

  char *pcVar8;

  char *pcStack_c;

  int local_8;

  int iStack_4;

  

  if (param_1 == 0) {

    uVar2 = FUN_006a7eb0();

    return uVar2;

  }

  piVar3 = (int *)FUN_0056fc60(&iStack_4,&param_1,&param_2);

  iVar6 = *piVar3;

  InterlockedIncrement((LONG *)(iVar6 + -0x10));

  LVar4 = InterlockedDecrement((LONG *)(iStack_4 + -0x10));

  if ((LVar4 == 0) && ((undefined4 *)(iStack_4 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_4 + -0x14))(1);

  }

  FUN_00401340(&DAT_007db0fc);

  iVar5 = FUN_00404b40(&pcStack_c,0);

  pcVar8 = pcStack_c + -0x14;

  LVar4 = InterlockedDecrement((LONG *)(pcStack_c + -0x10));

  if ((LVar4 == 0) && (pcVar8 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar8)(1);

  }

  if (iVar5 == 0) {

    uVar2 = FUN_006a7eb0();

LAB_005774d4:

    LVar4 = InterlockedDecrement((LONG *)(iVar6 + -0x10));

    if ((LVar4 == 0) && ((undefined4 *)(iVar6 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar6 + -0x14))(1);

    }

    return uVar2;

  }

  FUN_00401340("clear");

  iVar5 = FUN_00404b40(&pcStack_c,0);

  pcVar8 = pcStack_c + -0x14;

  LVar4 = InterlockedDecrement((LONG *)(pcStack_c + -0x10));

  if ((LVar4 == 0) && (pcVar8 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar8)(1);

  }

  if (iVar5 == 0) {

    uVar2 = FUN_006a7ad0();

    goto LAB_005774d4;

  }

  FUN_00401340("remove");

  iVar6 = FUN_00404b40(&pcStack_c,0);

  pcVar8 = pcStack_c + -0x14;

  LVar4 = InterlockedDecrement((LONG *)(pcStack_c + -0x10));

  if ((LVar4 == 0) && (pcVar8 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar8)(1);

  }

  if (iVar6 == 0) {

    FUN_005769e0(&param_1,param_1,param_2);

    if (*(int *)(param_1 + -4) != 1) {

      FUN_0048c3e0(param_1);

      uVar2 = FUN_006a89a0(&param_2);

      FUN_005abb30();

      FUN_004011b0();

      FUN_004011b0();

      return uVar2;

    }

    FUN_00402730(L"Please specify the name of an allegiance member.");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(local_8 + 0x8c));

    FUN_004011b0();

    goto LAB_005775eb;

  }

  FUN_00401340(&DAT_007db210);

  iVar6 = FUN_00404b40(&iStack_4,0);

  if (iVar6 == 0) {

LAB_00577696:

    bVar1 = true;

  }

  else {

    FUN_00401340(&DAT_007db0f8);

    iVar6 = FUN_00404b40(&pcStack_c,0);

    FUN_004011b0();

    bVar1 = false;

    if (iVar6 == 0) goto LAB_00577696;

  }

  FUN_004011b0();

  if (!bVar1) {

    FUN_004011b0();

    return 0;

  }

  FUN_0056fc60(&pcStack_c,&param_1,&param_2);

  lVar7 = strtol(pcStack_c,(char **)0x0,0);

  if ((lVar7 < 1) || (3 < lVar7)) {

    FUN_00402730(

                L"Please specify a valid officer level as a number between 1 and 3. Check the game help files for more information on officer levels."

                );

    FUN_005649f0(&param_1,0x1a,1,*(undefined4 *)(local_8 + 0x8c));

    FUN_004011b0();

  }

  else {

    FUN_005769e0(&param_1,param_1,param_2);

    if (*(int *)(param_1 + -4) != 1) {

      FUN_0048c3e0(param_1);

      uVar2 = FUN_006a8be0(&param_2,lVar7);

      FUN_005abb30();

      FUN_004011b0();

      FUN_004011b0();

      FUN_004011b0();

      return uVar2;

    }

    FUN_00402730(L"Please specify the name of an allegiance member.");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(local_8 + 0x8c));

    FUN_004011b0();

    FUN_004011b0();

  }

LAB_005775eb:

  FUN_004011b0();

  FUN_004011b0();

  return 1;

}





// --- FUN_0057743a at 0x0057743A (size: 929) ---


undefined1

FUN_0057743a(char *param_1,int param_2,int param_3,undefined4 param_4,int param_5,undefined4 param_6

            )



{

  bool bVar1;

  undefined1 uVar2;

  int *piVar3;

  LONG LVar4;

  int iVar5;

  int iVar6;

  long lVar7;

  undefined4 *puVar8;

  char *pcVar9;

  

  piVar3 = (int *)FUN_0056fc60(&param_3,&param_5,&param_6);

  iVar6 = *piVar3;

  InterlockedIncrement((LONG *)(iVar6 + -0x10));

  puVar8 = (undefined4 *)(param_3 + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  if ((LVar4 == 0) && (puVar8 != (undefined4 *)0x0)) {

    (**(code **)*puVar8)(1);

  }

  FUN_00401340(&DAT_007db0fc);

  iVar5 = FUN_00404b40(&param_1,0);

  pcVar9 = param_1 + -0x14;

  LVar4 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar4 == 0) && (pcVar9 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar9)(1);

  }

  if (iVar5 == 0) {

    uVar2 = FUN_006a7eb0();

LAB_005774d4:

    LVar4 = InterlockedDecrement((LONG *)(iVar6 + -0x10));

    if ((LVar4 == 0) && ((undefined4 *)(iVar6 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar6 + -0x14))(1);

    }

    return uVar2;

  }

  FUN_00401340("clear");

  iVar5 = FUN_00404b40(&param_1,0);

  pcVar9 = param_1 + -0x14;

  LVar4 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar4 == 0) && (pcVar9 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar9)(1);

  }

  if (iVar5 == 0) {

    uVar2 = FUN_006a7ad0();

    goto LAB_005774d4;

  }

  FUN_00401340("remove");

  iVar6 = FUN_00404b40(&param_1,0);

  pcVar9 = param_1 + -0x14;

  LVar4 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar4 == 0) && (pcVar9 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar9)(1);

  }

  if (iVar6 == 0) {

    FUN_005769e0(&param_5,param_5,param_6);

    if (*(int *)(param_5 + -4) != 1) {

      FUN_0048c3e0(param_5);

      uVar2 = FUN_006a89a0(&param_6);

      FUN_005abb30();

      FUN_004011b0();

      FUN_004011b0();

      return uVar2;

    }

    FUN_00402730(L"Please specify the name of an allegiance member.");

    FUN_005649f0(&param_6,0x1a,1,*(undefined4 *)(param_2 + 0x8c));

    FUN_004011b0();

    goto LAB_005775eb;

  }

  FUN_00401340(&DAT_007db210);

  iVar6 = FUN_00404b40(&param_3,0);

  if (iVar6 == 0) {

LAB_00577696:

    bVar1 = true;

  }

  else {

    FUN_00401340(&DAT_007db0f8);

    iVar6 = FUN_00404b40(&param_1,0);

    FUN_004011b0();

    bVar1 = false;

    if (iVar6 == 0) goto LAB_00577696;

  }

  FUN_004011b0();

  if (!bVar1) {

    FUN_004011b0();

    return 0;

  }

  FUN_0056fc60(&param_1,&param_5,&param_6);

  lVar7 = strtol(param_1,(char **)0x0,0);

  if ((lVar7 < 1) || (3 < lVar7)) {

    FUN_00402730(

                L"Please specify a valid officer level as a number between 1 and 3. Check the game help files for more information on officer levels."

                );

    FUN_005649f0(&param_5,0x1a,1,*(undefined4 *)(param_2 + 0x8c));

    FUN_004011b0();

  }

  else {

    FUN_005769e0(&param_5,param_5,param_6);

    if (*(int *)(param_5 + -4) != 1) {

      FUN_0048c3e0(param_5);

      uVar2 = FUN_006a8be0(&param_6,lVar7);

      FUN_005abb30();

      FUN_004011b0();

      FUN_004011b0();

      FUN_004011b0();

      return uVar2;

    }

    FUN_00402730(L"Please specify the name of an allegiance member.");

    FUN_005649f0(&param_6,0x1a,1,*(undefined4 *)(param_2 + 0x8c));

    FUN_004011b0();

    FUN_004011b0();

  }

LAB_005775eb:

  FUN_004011b0();

  FUN_004011b0();

  return 1;

}





// --- FUN_005777e0 at 0x005777E0 (size: 26) ---


undefined1 FUN_005777e0(int param_1,undefined4 param_2)



{

  undefined1 uVar1;

  int *piVar2;

  LONG LVar3;

  int iVar4;

  int iVar5;

  long lVar6;

  char *pcVar7;

  char *pcStack_8;

  int local_4;

  

  if (param_1 == 0) {

    uVar1 = FUN_006a7e20();

    return uVar1;

  }

  piVar2 = (int *)FUN_0056fc60(&pcStack_8,&param_1,&param_2);

  iVar5 = *piVar2;

  InterlockedIncrement((LONG *)(iVar5 + -0x10));

  pcVar7 = pcStack_8 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(pcStack_8 + -0x10));

  if ((LVar3 == 0) && (pcVar7 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar7)(1);

  }

  FUN_00401340(&DAT_007db0fc);

  iVar4 = FUN_00404b40(&pcStack_8,0);

  pcVar7 = pcStack_8 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(pcStack_8 + -0x10));

  if ((LVar3 == 0) && (pcVar7 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar7)(1);

  }

  if (iVar4 == 0) {

    uVar1 = FUN_006a7e20();

  }

  else {

    FUN_00401340("clear");

    iVar4 = FUN_00404b40(&pcStack_8,0);

    pcVar7 = pcStack_8 + -0x14;

    LVar3 = InterlockedDecrement((LONG *)(pcStack_8 + -0x10));

    if ((LVar3 == 0) && (pcVar7 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar7)(1);

    }

    if (iVar4 != 0) {

      FUN_00401340(&DAT_007db210);

      iVar5 = FUN_00404b40(&pcStack_8,0);

      pcVar7 = pcStack_8 + -0x14;

      LVar3 = InterlockedDecrement((LONG *)(pcStack_8 + -0x10));

      if ((LVar3 == 0) && (pcVar7 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar7)(1);

      }

      if (iVar5 == 0) {

        FUN_0056fc60(&pcStack_8,&param_1,&param_2);

        lVar6 = strtol(pcStack_8,(char **)0x0,0);

        if ((0 < lVar6) && (lVar6 < 4)) {

          FUN_005769e0(&param_2,param_1,param_2);

          FUN_0048c3e0(param_2);

          uVar1 = FUN_006a8ce0(lVar6,&param_1);

          FUN_005abb30();

          FUN_004011b0();

          FUN_004011b0();

          FUN_004011b0();

          return uVar1;

        }

        FUN_00402730(L"Please specify a valid officer level as a number between 1 and 3.");

        FUN_005649f0(&param_1,0x1a,1,*(undefined4 *)(local_4 + 0x8c));

        FUN_004011b0();

        FUN_004011b0();

        FUN_004011b0();

        return 1;

      }

      FUN_004011b0();

      return 0;

    }

    uVar1 = FUN_006a7a40();

  }

  LVar3 = InterlockedDecrement((LONG *)(iVar5 + -0x10));

  if ((LVar3 == 0) && ((undefined4 *)(iVar5 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar5 + -0x14))(1);

  }

  return uVar1;

}





// --- FUN_005777fa at 0x005777FA (size: 595) ---


undefined1

FUN_005777fa(char *param_1,int param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5)



{

  undefined1 uVar1;

  int *piVar2;

  LONG LVar3;

  int iVar4;

  int iVar5;

  long lVar6;

  char *pcVar7;

  

  piVar2 = (int *)FUN_0056fc60(&param_1,&param_4,&param_5);

  iVar5 = *piVar2;

  InterlockedIncrement((LONG *)(iVar5 + -0x10));

  pcVar7 = param_1 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar3 == 0) && (pcVar7 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar7)(1);

  }

  FUN_00401340(&DAT_007db0fc);

  iVar4 = FUN_00404b40(&param_1,0);

  pcVar7 = param_1 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar3 == 0) && (pcVar7 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar7)(1);

  }

  if (iVar4 == 0) {

    uVar1 = FUN_006a7e20();

  }

  else {

    FUN_00401340("clear");

    iVar4 = FUN_00404b40(&param_1,0);

    pcVar7 = param_1 + -0x14;

    LVar3 = InterlockedDecrement((LONG *)(param_1 + -0x10));

    if ((LVar3 == 0) && (pcVar7 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar7)(1);

    }

    if (iVar4 != 0) {

      FUN_00401340(&DAT_007db210);

      iVar5 = FUN_00404b40(&param_1,0);

      pcVar7 = param_1 + -0x14;

      LVar3 = InterlockedDecrement((LONG *)(param_1 + -0x10));

      if ((LVar3 == 0) && (pcVar7 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar7)(1);

      }

      if (iVar5 == 0) {

        FUN_0056fc60(&param_1,&param_4,&param_5);

        lVar6 = strtol(param_1,(char **)0x0,0);

        if ((0 < lVar6) && (lVar6 < 4)) {

          FUN_005769e0(&param_5,param_4,param_5);

          FUN_0048c3e0(param_5);

          uVar1 = FUN_006a8ce0(lVar6,&param_4);

          FUN_005abb30();

          FUN_004011b0();

          FUN_004011b0();

          FUN_004011b0();

          return uVar1;

        }

        FUN_00402730(L"Please specify a valid officer level as a number between 1 and 3.");

        FUN_005649f0(&param_4,0x1a,1,*(undefined4 *)(param_2 + 0x8c));

        FUN_004011b0();

        FUN_004011b0();

        FUN_004011b0();

        return 1;

      }

      FUN_004011b0();

      return 0;

    }

    uVar1 = FUN_006a7a40();

  }

  LVar3 = InterlockedDecrement((LONG *)(iVar5 + -0x10));

  if ((LVar3 == 0) && ((undefined4 *)(iVar5 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar5 + -0x14))(1);

  }

  return uVar1;

}





// --- FUN_00577a50 at 0x00577A50 (size: 483) ---


undefined1 FUN_00577a50(int param_1,undefined4 *param_2)



{

  int iVar1;

  undefined1 uVar2;

  int *piVar3;

  LONG LVar4;

  int iVar5;

  undefined4 *puVar6;

  int local_4;

  

  if (param_1 == 0) {

    uVar2 = FUN_006a7f40();

    return uVar2;

  }

  piVar3 = (int *)FUN_0056fc60(&local_4,&param_1,&param_2);

  iVar1 = *piVar3;

  InterlockedIncrement((LONG *)(iVar1 + -0x10));

  puVar6 = (undefined4 *)(local_4 + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  FUN_00401340(&DAT_007db210);

  iVar5 = FUN_00404b40(&local_4,0);

  LVar4 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar4 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

  }

  if (iVar5 == 0) {

    FUN_00576890(&param_1,param_1,param_2);

    iVar5 = DAT_00837748;

    InterlockedIncrement((LONG *)(DAT_00837748 + -0x10));

    FUN_00435720(1,1,iVar5);

    FUN_0048c3e0(param_1);

    uVar2 = FUN_006a8b20(&param_2);

    puVar6 = param_2;

    LVar4 = InterlockedDecrement(param_2 + 1);

    if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    puVar6 = (undefined4 *)(param_1 + -0x14);

    LVar4 = InterlockedDecrement((LONG *)(param_1 + -0x10));

    if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

  }

  else {

    FUN_00401340("clear");

    iVar5 = FUN_00404b40(&param_1,0);

    puVar6 = (undefined4 *)(param_1 + -0x14);

    LVar4 = InterlockedDecrement((LONG *)(param_1 + -0x10));

    if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    if (iVar5 != 0) {

      LVar4 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

      if ((LVar4 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

      }

      return 0;

    }

    uVar2 = FUN_006a79b0();

  }

  LVar4 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

  if ((LVar4 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

  }

  return uVar2;

}





// --- FUN_00577c40 at 0x00577C40 (size: 27) ---


undefined1 FUN_00577c40(char *param_1,char *param_2)



{

  char *_Str1;

  undefined1 uVar1;

  int *piVar2;

  LONG LVar3;

  int iVar4;

  int iVar5;

  undefined4 *puVar6;

  undefined4 uVar7;

  int iStack_4;

  

  if (param_1 == (char *)0x0) {

    uVar1 = FUN_006a7cc0(4);

    return uVar1;

  }

  piVar2 = (int *)FUN_0056fc60(&iStack_4,&param_1,&param_2);

  iVar5 = *piVar2;

  InterlockedIncrement((LONG *)(iVar5 + -0x10));

  puVar6 = (undefined4 *)(iStack_4 + -0x14);

  LVar3 = InterlockedDecrement((LONG *)(iStack_4 + -0x10));

  if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  FUN_00401340(&DAT_007d14d8);

  iVar4 = FUN_00404b40(&iStack_4,0);

  puVar6 = (undefined4 *)(iStack_4 + -0x14);

  LVar3 = InterlockedDecrement((LONG *)(iStack_4 + -0x10));

  if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  if (iVar4 == 0) {

    uVar7 = 1;

  }

  else {

    FUN_00401340(&DAT_007d14dc);

    iVar4 = FUN_00404b40(&iStack_4,0);

    puVar6 = (undefined4 *)(iStack_4 + -0x14);

    LVar3 = InterlockedDecrement((LONG *)(iStack_4 + -0x10));

    if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    if (iVar4 != 0) {

      FUN_00401340("toggle");

      iVar5 = FUN_00404b40(&iStack_4,0);

      LVar3 = InterlockedDecrement((LONG *)(iStack_4 + -0x10));

      if ((LVar3 == 0) && ((undefined4 *)(iStack_4 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(iStack_4 + -0x14))(1);

      }

      if (iVar5 == 0) {

        uVar1 = FUN_006a7cc0(3);

        FUN_004011b0();

        return uVar1;

      }

      FUN_00401340("check");

      iVar5 = FUN_00404b40(&iStack_4,0);

      FUN_004011b0();

      if (iVar5 == 0) {

        uVar1 = FUN_006a7cc0(4);

        FUN_004011b0();

        return uVar1;

      }

      FUN_00401340("bypass");

      iVar5 = FUN_00404b40(&iStack_4,0);

      FUN_004011b0();

      if (iVar5 == 0) {

        FUN_005769e0(&param_1,param_1,param_2);

        _Str1 = param_1;

        if (*(int *)(param_1 + -4) == 1) {

          uVar1 = FUN_006a7cc0(5);

        }

        else {

          FUN_00401340("clear");

          iVar5 = _stricmp(_Str1,param_2);

          FUN_004011b0();

          if (iVar5 == 0) {

            uVar1 = FUN_006a7cc0(6);

          }

          else {

            FUN_0048c3e0(_Str1);

            uVar1 = FUN_006a8a60(&param_2);

            FUN_005abb30();

          }

        }

        FUN_004011b0();

        FUN_004011b0();

        return uVar1;

      }

      FUN_004011b0();

      return 0;

    }

    uVar7 = 2;

  }

  uVar1 = FUN_006a7cc0(uVar7);

  LVar3 = InterlockedDecrement((LONG *)(iVar5 + -0x10));

  if ((LVar3 == 0) && ((undefined4 *)(iVar5 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar5 + -0x14))(1);

  }

  return uVar1;

}





// --- FUN_00577c5b at 0x00577C5B (size: 708) ---


undefined1 FUN_00577c5b(int param_1,undefined4 param_2,char *param_3,char *param_4)



{

  char *_Str1;

  undefined1 uVar1;

  int *piVar2;

  LONG LVar3;

  int iVar4;

  int iVar5;

  undefined4 *puVar6;

  undefined4 uVar7;

  

  piVar2 = (int *)FUN_0056fc60(&param_1,&param_3,&param_4);

  iVar5 = *piVar2;

  InterlockedIncrement((LONG *)(iVar5 + -0x10));

  puVar6 = (undefined4 *)(param_1 + -0x14);

  LVar3 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  FUN_00401340(&DAT_007d14d8);

  iVar4 = FUN_00404b40(&param_1,0);

  puVar6 = (undefined4 *)(param_1 + -0x14);

  LVar3 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  if (iVar4 == 0) {

    uVar7 = 1;

  }

  else {

    FUN_00401340(&DAT_007d14dc);

    iVar4 = FUN_00404b40(&param_1,0);

    puVar6 = (undefined4 *)(param_1 + -0x14);

    LVar3 = InterlockedDecrement((LONG *)(param_1 + -0x10));

    if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    if (iVar4 != 0) {

      FUN_00401340("toggle");

      iVar5 = FUN_00404b40(&param_1,0);

      puVar6 = (undefined4 *)(param_1 + -0x14);

      LVar3 = InterlockedDecrement((LONG *)(param_1 + -0x10));

      if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

        (**(code **)*puVar6)(1);

      }

      if (iVar5 == 0) {

        uVar1 = FUN_006a7cc0(3);

        FUN_004011b0();

        return uVar1;

      }

      FUN_00401340("check");

      iVar5 = FUN_00404b40(&param_1,0);

      FUN_004011b0();

      if (iVar5 == 0) {

        uVar1 = FUN_006a7cc0(4);

        FUN_004011b0();

        return uVar1;

      }

      FUN_00401340("bypass");

      iVar5 = FUN_00404b40(&param_1,0);

      FUN_004011b0();

      if (iVar5 == 0) {

        FUN_005769e0(&param_3,param_3,param_4);

        _Str1 = param_3;

        if (*(int *)(param_3 + -4) == 1) {

          uVar1 = FUN_006a7cc0(5);

        }

        else {

          FUN_00401340("clear");

          iVar5 = _stricmp(_Str1,param_4);

          FUN_004011b0();

          if (iVar5 == 0) {

            uVar1 = FUN_006a7cc0(6);

          }

          else {

            FUN_0048c3e0(_Str1);

            uVar1 = FUN_006a8a60(&param_4);

            FUN_005abb30();

          }

        }

        FUN_004011b0();

        FUN_004011b0();

        return uVar1;

      }

      FUN_004011b0();

      return 0;

    }

    uVar7 = 2;

  }

  uVar1 = FUN_006a7cc0(uVar7);

  LVar3 = InterlockedDecrement((LONG *)(iVar5 + -0x10));

  if ((LVar3 == 0) && ((undefined4 *)(iVar5 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar5 + -0x14))(1);

  }

  return uVar1;

}





// --- FUN_00577f20 at 0x00577F20 (size: 22) ---


uint FUN_00577f20(uint param_1,undefined4 *param_2)



{

  int iVar1;

  undefined1 uVar2;

  byte bVar3;

  uint uVar4;

  int *piVar5;

  LONG LVar6;

  int iVar7;

  undefined4 *puVar8;

  int iStack_8;

  int iStack_4;

  

  if (param_1 == 0) {

    uVar4 = FUN_006a7fd0();

    return uVar4;

  }

  piVar5 = (int *)FUN_0056fc60(&iStack_8,&param_1,&param_2);

  iVar1 = *piVar5;

  iStack_4 = iVar1;

  InterlockedIncrement((LONG *)(iVar1 + -0x10));

  puVar8 = (undefined4 *)(iStack_8 + -0x14);

  LVar6 = InterlockedDecrement((LONG *)(iStack_8 + -0x10));

  if ((LVar6 == 0) && (puVar8 != (undefined4 *)0x0)) {

    (**(code **)*puVar8)(1);

  }

  FUN_00401340(&DAT_007db210);

  iVar7 = FUN_00404b40(&iStack_8,0);

  LVar6 = InterlockedDecrement((LONG *)(iStack_8 + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iStack_8 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iStack_8 + -0x14))(1);

  }

  if (iVar7 == 0) {

    FUN_00576890(&param_1,param_1,param_2);

    iVar7 = param_1;

    FUN_0048c3e0(param_1);

    uVar2 = FUN_006a8dd0(&param_2);

    puVar8 = param_2;

    param_1 = CONCAT31(param_1._1_3_,uVar2);

    LVar6 = InterlockedDecrement(param_2 + 1);

    if ((LVar6 == 0) && (puVar8 != (undefined4 *)0x0)) {

      (**(code **)*puVar8)(1);

    }

    puVar8 = (undefined4 *)(iVar7 + -0x14);

    LVar6 = InterlockedDecrement((LONG *)(iVar7 + -0x10));

    if ((LVar6 == 0) && (puVar8 != (undefined4 *)0x0)) {

      (**(code **)*puVar8)(1);

    }

    LVar6 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar6 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

    }

    return param_1 & 0xff;

  }

  FUN_00401340("clear");

  iVar7 = FUN_00404b40(&param_1,0);

  puVar8 = (undefined4 *)(param_1 + -0x14);

  LVar6 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar6 == 0) && (puVar8 != (undefined4 *)0x0)) {

    (**(code **)*puVar8)(1);

  }

  if (iVar7 == 0) {

    bVar3 = FUN_006a7b60();

    LVar6 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar6 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

    }

    return (uint)bVar3;

  }

  LVar6 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

  if ((LVar6 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

  }

  return 0;

}





// --- FUN_00577f36 at 0x00577F36 (size: 449) ---


uint FUN_00577f36(undefined4 param_1,undefined4 param_2,uint param_3,undefined4 *param_4)



{

  int iVar1;

  undefined1 uVar2;

  byte bVar3;

  int *piVar4;

  LONG LVar5;

  int iVar6;

  undefined4 *puVar7;

  int unaff_retaddr;

  

  piVar4 = (int *)FUN_0056fc60(&stack0x00000000,&param_3,&param_4);

  iVar1 = *piVar4;

  InterlockedIncrement((LONG *)(iVar1 + -0x10));

  LVar5 = InterlockedDecrement((LONG *)(unaff_retaddr + -0x10));

  if ((LVar5 == 0) && ((undefined4 *)(unaff_retaddr + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(unaff_retaddr + -0x14))(1);

  }

  FUN_00401340(&DAT_007db210);

  iVar6 = FUN_00404b40(&stack0x00000000,0);

  LVar5 = InterlockedDecrement((LONG *)(unaff_retaddr + -0x10));

  if ((LVar5 == 0) && ((undefined4 *)(unaff_retaddr + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(unaff_retaddr + -0x14))(1);

  }

  if (iVar6 == 0) {

    FUN_00576890(&param_3,param_3,param_4);

    iVar6 = param_3;

    FUN_0048c3e0(param_3);

    uVar2 = FUN_006a8dd0(&param_4);

    puVar7 = param_4;

    param_3 = CONCAT31(param_3._1_3_,uVar2);

    LVar5 = InterlockedDecrement(param_4 + 1);

    if ((LVar5 == 0) && (puVar7 != (undefined4 *)0x0)) {

      (**(code **)*puVar7)(1);

    }

    puVar7 = (undefined4 *)(iVar6 + -0x14);

    LVar5 = InterlockedDecrement((LONG *)(iVar6 + -0x10));

    if ((LVar5 == 0) && (puVar7 != (undefined4 *)0x0)) {

      (**(code **)*puVar7)(1);

    }

    LVar5 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar5 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

    }

    return param_3 & 0xff;

  }

  FUN_00401340("clear");

  iVar6 = FUN_00404b40(&param_3,0);

  puVar7 = (undefined4 *)(param_3 + -0x14);

  LVar5 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  if ((LVar5 == 0) && (puVar7 != (undefined4 *)0x0)) {

    (**(code **)*puVar7)(1);

  }

  if (iVar6 == 0) {

    bVar3 = FUN_006a7b60();

    LVar5 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar5 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

    }

    return (uint)bVar3;

  }

  LVar5 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

  if ((LVar5 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

  }

  return 0;

}





// --- FUN_00578270 at 0x00578270 (size: 215) ---


undefined1 __thiscall FUN_00578270(int param_1,undefined4 *param_2,int param_3)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  int iVar3;

  undefined1 uVar4;

  int iVar5;

  LONG LVar6;

  

  puVar1 = param_2;

  if ((int)param_2 < 1) {

    return 0;

  }

  FUN_0048c3e0(*(undefined4 *)(param_1 + 0x88));

  iVar5 = FUN_005d0190(&param_2);

  puVar2 = param_2;

  LVar6 = InterlockedDecrement(param_2 + 1);

  if ((LVar6 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  if ((iVar5 != 0) && (iVar5 != 0x400)) {

    FUN_00576890(&param_3,puVar1,param_3);

    iVar3 = param_3;

    FUN_0048c3e0(param_3);

    uVar4 = FUN_006a4e50(iVar5,&param_2);

    puVar1 = param_2;

    LVar6 = InterlockedDecrement(param_2 + 1);

    if ((LVar6 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

    puVar1 = (undefined4 *)(iVar3 + -0x14);

    LVar6 = InterlockedDecrement((LONG *)(iVar3 + -0x10));

    if ((LVar6 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

    return uVar4;

  }

  return 0;

}





// --- FUN_00578820 at 0x00578820 (size: 374) ---


undefined4 FUN_00578820(int param_1,undefined4 param_2,int param_3)



{

  LONG LVar1;

  int iVar2;

  code *pcVar3;

  char *pcVar4;

  

  if (param_1 == 0) {

    FUN_00401340("@reply - Sends some text to the last person who @tell\'d you.\n");

    if (iRamfffffffc != 1) {

      FUN_00404ef0(0,iRamfffffffc + -1);

    }

    pcVar3 = InterlockedDecrement_exref;

    LVar1 = InterlockedDecrement((LONG *)0xfffffff0);

    if (LVar1 == 0) {

      (*(code *)*puRamffffffec)(1);

    }

    FUN_00401340("@pr - Sends some text to the last person who @p\'d you.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    pcVar4 = "@mr - Sends some text to the last person who @m\'d you.\n";

  }

  else {

    FUN_00401340(

                "@reply <text> - Sends the text to the last person who @tell\'d you. You may also use @r or @rp.\n"

                );

    if (*(int *)(param_1 + -4) != 1) {

      FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

    }

    pcVar3 = InterlockedDecrement_exref;

    LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

    }

    FUN_00401340(

                "@pr <text> - Sends the text to the last vassal who used @p to send  you a message.\n"

                );

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    pcVar4 = 

    "@mr <text> - Sends the text to the last person who used @m to send  you a message. This only works for monarchs.\n"

    ;

  }

  FUN_00401340(pcVar4);

  if (*(int *)(param_3 + -4) != 1) {

    FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

  }

  iVar2 = (*pcVar3)(param_3 + -0x10);

  if ((iVar2 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

  }

  return 1;

}





// --- FUN_00578e30 at 0x00578E30 (size: 345) ---


undefined4 FUN_00578e30(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  LONG LVar2;

  

  if (param_1 == 0) {

    FUN_00401340("@afk - Set your away-from-keyboard status.\n");

    if (iRamfffffffc != 1) {

      FUN_00404ef0(0,iRamfffffffc + -1);

    }

    iVar1 = InterlockedDecrement((LONG *)0xfffffff0);

    param_3 = 0;

  }

  else {

    FUN_00401340(

                "@afk - Turns on AFK (away-from-keyboard) mode. When set to AFK, other players that send you directed chatyou will receive a customizable message that your are not currently at the keyboard.\n"

                );

    if (*(int *)(param_1 + -4) != 1) {

      FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

    }

    LVar2 = InterlockedDecrement((LONG *)(param_1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

    }

    FUN_00401340(

                "@afk on - Turns on AFK mode. When set to AFK, other players that send you directed chatyou will receive a customizable message that your are not currently at the keyboard.\n"

                );

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@afk off - Turn off AFK mode.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340(

                "@afk msg <message> - Set the message that will be sent to players that send you directed chat while you are in AFK mode. Issuing \"@afk msg\" with no message will set your AFK message back to the default. Your custom AFK message is limited to 192 characters.\n"

                );

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    iVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  }

  if ((iVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

  }

  return 1;

}





// --- FUN_005792d0 at 0x005792D0 (size: 80) ---


undefined4 __fastcall FUN_005792d0(int param_1)



{

  LONG LVar1;

  

  FUN_00401340("@lifestone - Returns you to the last lifestone you used without killing you.\n");

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_00579320 at 0x00579320 (size: 80) ---


undefined4 __fastcall FUN_00579320(int param_1)



{

  LONG LVar1;

  

  FUN_00401340("@marketplace - Teleports you to the Marketplace of Dereth.\n");

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_00579370 at 0x00579370 (size: 720) ---


undefined1 __thiscall FUN_00579370(int param_1,char *param_2,undefined4 *param_3)



{

  bool bVar1;

  undefined1 uVar2;

  int iVar3;

  LONG LVar4;

  undefined4 *puVar5;

  char *pcVar6;

  undefined4 *puVar7;

  char *local_c;

  char *local_8;

  char *local_4;

  

  FUN_0056fc60(&local_c,&param_2,&param_3);

  FUN_00401340(&DAT_007db0f8);

  pcVar6 = local_c;

  iVar3 = _stricmp(local_c,local_4);

  if (iVar3 != 0) {

    FUN_00401340("remove");

    iVar3 = _stricmp(pcVar6,local_8);

    LVar4 = InterlockedDecrement((LONG *)(local_8 + -0x10));

    if ((LVar4 == 0) && (local_8 + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(local_8 + -0x14))(1);

    }

    bVar1 = true;

    if (iVar3 != 0) goto LAB_0057940c;

  }

  bVar1 = false;

LAB_0057940c:

  LVar4 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar4 == 0) && (local_4 + -0x14 != (char *)0x0)) {

    (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

  }

  if (bVar1) {

    FUN_00402730(L"Please specify a valid permit command.");

    FUN_005649f0(&param_3,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    puVar5 = param_3 + -5;

    LVar4 = InterlockedDecrement(param_3 + -4);

    if ((LVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

    }

    LVar4 = InterlockedDecrement((LONG *)(local_c + -0x10));

    if ((LVar4 == 0) && (local_c + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(local_c + -0x14))(1);

      return 1;

    }

  }

  else {

    FUN_005769e0(&param_3,param_2,param_3);

    if (param_3[-1] != 1) {

      FUN_00401340(&DAT_007db0f8);

      iVar3 = _stricmp(local_c,param_2);

      pcVar6 = param_2 + -0x14;

      LVar4 = InterlockedDecrement((LONG *)(param_2 + -0x10));

      if ((LVar4 == 0) && (pcVar6 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar6)(1);

      }

      puVar5 = param_3;

      FUN_0048c3e0(param_3);

      if (iVar3 == 0) {

        uVar2 = FUN_006a3970(&param_3);

        puVar7 = param_3;

        LVar4 = InterlockedDecrement(param_3 + 1);

        if ((LVar4 == 0) && (puVar7 != (undefined4 *)0x0)) {

          (**(code **)*puVar7)(1);

        }

      }

      else {

        uVar2 = FUN_006a3af0(&param_3);

        puVar7 = param_3;

        LVar4 = InterlockedDecrement(param_3 + 1);

        if ((LVar4 == 0) && (puVar7 != (undefined4 *)0x0)) {

          (**(code **)*puVar7)(1);

        }

      }

      puVar7 = puVar5 + -5;

      LVar4 = InterlockedDecrement(puVar5 + -4);

      if ((LVar4 == 0) && (puVar7 != (undefined4 *)0x0)) {

        (**(code **)*puVar7)(1);

      }

      LVar4 = InterlockedDecrement((LONG *)(local_c + -0x10));

      if ((LVar4 == 0) && (local_c + -0x14 != (char *)0x0)) {

        (*(code *)**(undefined4 **)(local_c + -0x14))(1);

      }

      return uVar2;

    }

    FUN_00402730(L"Please specify a person for the permit command.");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    pcVar6 = param_2 + -0x14;

    LVar4 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar4 == 0) && (pcVar6 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar6)(1);

    }

    puVar5 = param_3 + -5;

    LVar4 = InterlockedDecrement(param_3 + -4);

    if ((LVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

    }

    LVar4 = InterlockedDecrement((LONG *)(local_c + -0x10));

    if ((LVar4 == 0) && (local_c + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(local_c + -0x14))(1);

    }

  }

  return 1;

}





// --- FUN_00579750 at 0x00579750 (size: 80) ---


undefined4 __fastcall FUN_00579750(int param_1)



{

  LONG LVar1;

  

  FUN_00401340("@pkarena - Teleports you to the PK Arena. You must be PK to use this command.\n");

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_00579850 at 0x00579850 (size: 80) ---


undefined4 __fastcall FUN_00579850(int param_1)



{

  LONG LVar1;

  

  FUN_00401340("@pklarena - Teleports you to the PKL Arena. You must be PKL to use this command.\n")

  ;

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_00579950 at 0x00579950 (size: 224) ---


undefined4 FUN_00579950(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  LONG LVar2;

  char *pcVar3;

  

  if (param_1 == 0) {

    pcVar3 = "@help emote - How to perform text and action emotes.\n";

  }

  else {

    if (param_1 != 1) {

      FUN_00401340(

                  "The @emote command causes your character to emote some text, by performing an action in the third person. For example, if you typed the following while logged in as a character named Arville:\n    @emote looks around the town curiously.\nthen the chat windows of everyone around you would display:\n    Arville looks around the town curiously.\nYou can use any of these shorter forms of the command as well:\n         @e <text>\n         @em <text>\n         ; <text>\n         : <text>\n\n"

                  );

      if (*(int *)(param_1 + -4) != 1) {

        FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

      }

      LVar2 = InterlockedDecrement((LONG *)(param_1 + -0x10));

      if ((LVar2 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

      }

      FUN_00401340(

                  "You can also use a variety of standard emotes. These emotes come with special animations as well as text. Type @emotes to see a list.\n\n"

                  );

      if (*(int *)(param_3 + -4) != 1) {

        FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

      }

      iVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

      param_1 = param_3;

      goto LAB_00579a1a;

    }

    pcVar3 = "@emote - Performs a text emote.\n@emotes - Lists all standard emotes.\n";

  }

  FUN_00401340(pcVar3);

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  iVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

LAB_00579a1a:

  if ((iVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_00579d80 at 0x00579D80 (size: 203) ---


undefined1 __thiscall FUN_00579d80(int param_1,int param_2,int param_3)



{

  undefined1 uVar1;

  LONG LVar2;

  undefined4 *puVar3;

  

  FUN_005769e0(&param_3,param_2,param_3);

  if (*(int *)(param_3 + -4) == 1) {

    FUN_00402730(L"You must specify the name of the friend you wish to add.");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    puVar3 = (undefined4 *)(param_2 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

    puVar3 = (undefined4 *)(param_3 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

    return 1;

  }

  uVar1 = FUN_006a6830(&param_3);

  puVar3 = (undefined4 *)(param_3 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  return uVar1;

}





// --- FUN_00579e50 at 0x00579E50 (size: 283) ---


undefined1 __thiscall FUN_00579e50(int param_1,char *param_2,char *param_3)



{

  undefined1 uVar1;

  LONG LVar2;

  int iVar3;

  char *pcVar4;

  

  FUN_005769e0(&param_3,param_2,param_3);

  if (*(int *)(param_3 + -4) == 1) {

    FUN_00402730(L"You must specify the name of the friend you wish to remove.");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    pcVar4 = param_2 + -0x14;

    LVar2 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar2 == 0) && (pcVar4 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar4)(1);

    }

    pcVar4 = param_3 + -0x14;

    LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar2 == 0) && (pcVar4 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar4)(1);

    }

    return 1;

  }

  FUN_00401340(&DAT_007de2ec);

  iVar3 = _stricmp(param_3,param_2);

  pcVar4 = param_2 + -0x14;

  LVar2 = InterlockedDecrement((LONG *)(param_2 + -0x10));

  if ((LVar2 == 0) && (pcVar4 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar4)(1);

  }

  if (iVar3 == 0) {

    uVar1 = FUN_006a68d0();

  }

  else {

    uVar1 = FUN_006a6920(&param_3);

  }

  pcVar4 = param_3 + -0x14;

  LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  if ((LVar2 == 0) && (pcVar4 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar4)(1);

  }

  return uVar1;

}





// --- FUN_00579f70 at 0x00579F70 (size: 950) ---


undefined1 FUN_00579f70(undefined4 param_1,char *param_2)



{

  bool bVar1;

  undefined1 uVar2;

  int iVar3;

  LONG LVar4;

  char *pcVar5;

  char *pcVar6;

  undefined4 uVar7;

  char *local_c;

  char *local_8;

  int local_4;

  

  FUN_0056fc60(&local_c,&param_1,&param_2);

  FUN_00401340(&DAT_007db0f8);

  iVar3 = _stricmp(local_c,local_8);

  pcVar5 = local_8 + -0x14;

  LVar4 = InterlockedDecrement((LONG *)(local_8 + -0x10));

  if ((LVar4 == 0) && (pcVar5 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar5)(1);

  }

  if (iVar3 == 0) {

    bVar1 = true;

  }

  else {

    FUN_00401340("remove");

    iVar3 = _stricmp(local_c,local_8);

    LVar4 = InterlockedDecrement((LONG *)(local_8 + -0x10));

    if ((LVar4 == 0) && (local_8 + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(local_8 + -0x14))(1);

    }

    if (iVar3 != 0) {

      FUN_00401340("remove_all");

      iVar3 = _stricmp(local_c,param_2);

      pcVar5 = param_2 + -0x14;

      LVar4 = InterlockedDecrement((LONG *)(param_2 + -0x10));

      if ((LVar4 == 0) && (pcVar5 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar5)(1);

      }

      if (iVar3 != 0) {

        FUN_00401340(&DAT_007db0fc);

        iVar3 = _stricmp(local_c,param_2);

        pcVar5 = param_2 + -0x14;

        LVar4 = InterlockedDecrement((LONG *)(param_2 + -0x10));

        if ((LVar4 == 0) && (pcVar5 != (char *)0x0)) {

          (*(code *)**(undefined4 **)pcVar5)(1);

        }

        if (iVar3 != 0) {

          FUN_00401340(&DAT_007de394);

          iVar3 = _stricmp(local_c,param_2);

          FUN_004011b0();

          if (iVar3 != 0) {

            FUN_00401340("add_allegiance");

            iVar3 = _stricmp(local_c,param_2);

            FUN_004011b0();

            if (iVar3 == 0) {

              uVar7 = 1;

            }

            else {

              FUN_00401340("remove_allegiance");

              iVar3 = _stricmp(local_c,param_2);

              FUN_004011b0();

              if (iVar3 != 0) {

                FUN_00402730(

                            L"Please see @help House for more information on how to use this command"

                            );

                FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(local_4 + 0x8c));

                FUN_004011b0();

                FUN_004011b0();

                return 1;

              }

              uVar7 = 0;

            }

            uVar2 = FUN_006ab7c0(uVar7);

            FUN_004011b0();

            return uVar2;

          }

        }

        uVar2 = FUN_006abcd0();

        FUN_004011b0();

        return uVar2;

      }

      uVar2 = FUN_006abac0();

      LVar4 = InterlockedDecrement((LONG *)(local_c + -0x10));

      if (LVar4 != 0) {

        return uVar2;

      }

      if (local_c + -0x14 == (char *)0x0) {

        return uVar2;

      }

      (*(code *)**(undefined4 **)(local_c + -0x14))(1);

      return uVar2;

    }

    bVar1 = false;

  }

  FUN_005769e0(&param_2,param_1,param_2);

  pcVar5 = param_2;

  if (*(int *)(param_2 + -4) != 1) {

    FUN_0048c3e0(param_2);

    if (bVar1) {

      uVar2 = FUN_006ac1c0();

    }

    else {

      uVar2 = FUN_006ac440(&param_2);

    }

    pcVar6 = param_2;

    LVar4 = InterlockedDecrement((LONG *)(param_2 + 4));

    if ((LVar4 == 0) && (pcVar6 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar6)(1);

    }

    LVar4 = InterlockedDecrement((LONG *)(pcVar5 + -0x10));

    if ((LVar4 == 0) && (pcVar5 + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(pcVar5 + -0x14))(1);

    }

    LVar4 = InterlockedDecrement((LONG *)(local_c + -0x10));

    if ((LVar4 == 0) && (local_c + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(local_c + -0x14))(1);

    }

    return uVar2;

  }

  FUN_00402730(L"Please specify the guest\'s name.");

  FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(local_4 + 0x8c));

  pcVar6 = param_2 + -0x14;

  LVar4 = InterlockedDecrement((LONG *)(param_2 + -0x10));

  if ((LVar4 == 0) && (pcVar6 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar6)(1);

  }

  LVar4 = InterlockedDecrement((LONG *)(pcVar5 + -0x10));

  if ((LVar4 == 0) && (pcVar5 + -0x14 != (char *)0x0)) {

    (*(code *)**(undefined4 **)(pcVar5 + -0x14))(1);

  }

  LVar4 = InterlockedDecrement((LONG *)(local_c + -0x10));

  if ((LVar4 == 0) && (local_c + -0x14 != (char *)0x0)) {

    (*(code *)**(undefined4 **)(local_c + -0x14))(1);

    return 1;

  }

  return 1;

}





// --- FUN_0057a330 at 0x0057A330 (size: 1038) ---


undefined1 FUN_0057a330(undefined4 param_1,char *param_2)



{

  undefined1 uVar1;

  int iVar2;

  LONG LVar3;

  undefined4 *puVar4;

  char *pcVar5;

  char *pcVar6;

  undefined4 uVar7;

  char local_d;

  char *local_c;

  char *local_8;

  int local_4;

  

  FUN_0056fc60(&local_c,&param_1,&param_2);

  FUN_00401340(&DAT_007db0f8);

  iVar2 = _stricmp(local_c,local_8);

  pcVar5 = local_8 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(local_8 + -0x10));

  if ((LVar3 == 0) && (pcVar5 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar5)(1);

  }

  if (iVar2 == 0) {

    local_d = '\x01';

  }

  else {

    FUN_00401340("remove");

    iVar2 = _stricmp(local_c,local_8);

    LVar3 = InterlockedDecrement((LONG *)(local_8 + -0x10));

    if ((LVar3 == 0) && (local_8 + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(local_8 + -0x14))(1);

    }

    if (iVar2 != 0) {

      FUN_00401340("remove_all");

      iVar2 = _stricmp(local_c,param_2);

      pcVar5 = param_2 + -0x14;

      LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

      if ((LVar3 == 0) && (pcVar5 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar5)(1);

      }

      if (iVar2 != 0) {

        FUN_00401340(&DAT_007db0fc);

        iVar2 = _stricmp(local_c,param_2);

        pcVar5 = param_2 + -0x14;

        LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

        if ((LVar3 == 0) && (pcVar5 != (char *)0x0)) {

          (*(code *)**(undefined4 **)pcVar5)(1);

        }

        if (iVar2 != 0) {

          FUN_00401340(&DAT_007de394);

          iVar2 = _stricmp(local_c,param_2);

          FUN_004011b0();

          if (iVar2 != 0) {

            FUN_00401340("add_allegiance");

            iVar2 = _stricmp(local_c,param_2);

            FUN_004011b0();

            if (iVar2 == 0) {

              uVar7 = 1;

            }

            else {

              FUN_00401340("remove_allegiance");

              iVar2 = _stricmp(local_c,param_2);

              FUN_004011b0();

              if (iVar2 != 0) {

                FUN_00402730(

                            L"Please see @help House for more information on how to use this command"

                            );

                FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(local_4 + 0x8c));

                FUN_004011b0();

                FUN_004011b0();

                return 1;

              }

              uVar7 = 0;

            }

            uVar1 = FUN_006ab890(uVar7);

            FUN_004011b0();

            return uVar1;

          }

        }

        uVar1 = FUN_006abcd0();

        FUN_004011b0();

        return uVar1;

      }

      uVar1 = FUN_006abb50();

      goto LAB_0057a57d;

    }

    local_d = '\0';

  }

  FUN_005769e0(&param_2,param_1,param_2);

  pcVar5 = param_2;

  if (*(int *)(param_2 + -4) == 1) {

    FUN_00402730(L"Please specify an actual name.");

    FUN_005649f0(&param_2,0x1a,1,*(undefined4 *)(local_4 + 0x8c));

    pcVar6 = param_2 + -0x14;

    LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar3 == 0) && (pcVar6 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar6)(1);

    }

    LVar3 = InterlockedDecrement((LONG *)(pcVar5 + -0x10));

    if ((LVar3 == 0) && (pcVar5 + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(pcVar5 + -0x14))(1);

    }

    LVar3 = InterlockedDecrement((LONG *)(local_c + -0x10));

    if ((LVar3 == 0) && (local_c + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(local_c + -0x14))(1);

      return 1;

    }

    return 1;

  }

  FUN_00401340(&DAT_007de2ec);

  iVar2 = _stricmp(pcVar5,param_2);

  pcVar6 = param_2 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

  if ((LVar3 == 0) && (pcVar6 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar6)(1);

  }

  if (iVar2 == 0) {

    if (local_d == '\0') {

      uVar1 = FUN_006abb50();

    }

    else {

      uVar1 = FUN_006ab4e0();

    }

    LVar3 = InterlockedDecrement((LONG *)(pcVar5 + -0x10));

    if ((LVar3 != 0) || (pcVar5 + -0x14 == (char *)0x0)) goto LAB_0057a57d;

    puVar4 = *(undefined4 **)(pcVar5 + -0x14);

  }

  else {

    FUN_0048c3e0(pcVar5);

    uVar1 = FUN_006ac340(&param_2,local_d);

    pcVar6 = param_2;

    LVar3 = InterlockedDecrement((LONG *)(param_2 + 4));

    if ((LVar3 == 0) && (pcVar6 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar6)(1);

    }

    LVar3 = InterlockedDecrement((LONG *)(pcVar5 + -0x10));

    if ((LVar3 != 0) || (pcVar5 + -0x14 == (char *)0x0)) goto LAB_0057a57d;

    puVar4 = *(undefined4 **)(pcVar5 + -0x14);

  }

  (*(code *)*puVar4)(1);

LAB_0057a57d:

  LVar3 = InterlockedDecrement((LONG *)(local_c + -0x10));

  if ((LVar3 == 0) && (local_c + -0x14 != (char *)0x0)) {

    (*(code *)**(undefined4 **)(local_c + -0x14))(1);

  }

  return uVar1;

}





// --- FUN_0057a740 at 0x0057A740 (size: 344) ---


undefined1 __thiscall FUN_0057a740(int param_1,undefined4 param_2,char *param_3)



{

  char *_Str1;

  undefined1 uVar1;

  LONG LVar2;

  int iVar3;

  char *pcVar4;

  

  FUN_005769e0(&param_3,param_2,param_3);

  _Str1 = param_3;

  if (*(int *)(param_3 + -4) == 1) {

    FUN_00402730(L"Please see @help House for more information on how to use this command");

    FUN_005649f0(&param_3,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    pcVar4 = param_3 + -0x14;

    LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar2 == 0) && (pcVar4 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar4)(1);

    }

    LVar2 = InterlockedDecrement((LONG *)(_Str1 + -0x10));

    if ((LVar2 == 0) && (_Str1 + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(_Str1 + -0x14))(1);

    }

    return 1;

  }

  FUN_00401340(&DAT_007de2ec);

  iVar3 = _stricmp(_Str1,param_3);

  pcVar4 = param_3 + -0x14;

  LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  if ((LVar2 == 0) && (pcVar4 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar4)(1);

  }

  if (iVar3 == 0) {

    uVar1 = FUN_006ab570();

    LVar2 = InterlockedDecrement((LONG *)(_Str1 + -0x10));

    if ((LVar2 == 0) && (_Str1 + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(_Str1 + -0x14))(1);

      return uVar1;

    }

  }

  else {

    FUN_0048c3e0(_Str1);

    uVar1 = FUN_006ac280(&param_3);

    pcVar4 = param_3;

    LVar2 = InterlockedDecrement((LONG *)(param_3 + 4));

    if ((LVar2 == 0) && (pcVar4 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar4)(1);

    }

    LVar2 = InterlockedDecrement((LONG *)(_Str1 + -0x10));

    if ((LVar2 == 0) && (_Str1 + -0x14 != (char *)0x0)) {

      (*(code *)**(undefined4 **)(_Str1 + -0x14))(1);

    }

  }

  return uVar1;

}





// --- FUN_0057a960 at 0x0057A960 (size: 80) ---


undefined4 __fastcall FUN_0057a960(int param_1)



{

  LONG LVar1;

  

  FUN_00401340(

              "@squelch - Shows the current list of squelched characters.\n@squelch [-account] <name> - Squelches all messages from a character. With the account flag, this command also stops everything except normal chat coming from the target\'s other characters.\n@squelch [-message_type] <character> - This will filter out all text messages of a certain type  from a specific character.  For example, the following will filter out all tell messages from Oswald:\n     Example: @squelch -tell Oswald.\n@squelch -reply [-account] [-message_type] - This filters out all text messages from whoever last tell\'d you.  You may also use the -account flag and/or limit the squelch by indicating specific message types. For example, this will filter out all tell messages from the account of Oswald, assuming that Oswald was the last person who sent you an @tell:\n     Example: @squelch -reply -account -tell\n\n"

              );

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057a9b0 at 0x0057A9B0 (size: 80) ---


undefined4 __fastcall FUN_0057a9b0(int param_1)



{

  LONG LVar1;

  

  FUN_00401340(

              "@unsquelch - Shows the current list of squelched characters.\n@unsquelch <name> - Removes all squelches from a character, including account squelch.\n@unsquelch [-message_type] <character> : This allows text messages of type message_type to come from a squelched character. For example the following allows assessment messages from a character name Oswald:\n     Example: @unsquelch -assessment Oswald\n@unsquelch -reply [-account] [-message_type] : This allows text messages of type message_type from whoever last sent you an @tell. For example, the following will allow any character on Oswald\'s account to once again send you @tells, assuming that Oswald was the last person who sent you an @tell:\n     Example: @squelch -reply -account -tell\n\n"

              );

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057aa00 at 0x0057AA00 (size: 992) ---


undefined4 __thiscall

FUN_0057aa00(int param_1,int param_2,int param_3,wchar_t *param_4,undefined1 *param_5,int *param_6,

            undefined4 *param_7)



{

  bool bVar1;

  LONG LVar2;

  int iVar3;

  int *piVar4;

  size_t sVar5;

  int iVar6;

  wchar_t *pwVar7;

  char *pcVar8;

  undefined4 *puVar9;

  char *local_14;

  int local_10;

  char *local_c;

  char *pcStack_8;

  undefined4 uStack_4;

  

  *param_5 = 0;

  *param_7 = 1;

  local_10 = param_1;

  FUN_00405000(&DAT_007938af);

  if (param_2 < 1) {

    FUN_00402730(L"Not enough arguements.");

    FUN_005649f0(&param_4,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    pwVar7 = param_4 + -10;

    LVar2 = InterlockedDecrement((LONG *)(param_4 + -8));

    if ((LVar2 == 0) && (pwVar7 != (wchar_t *)0x0)) {

      (*(code *)**(undefined4 **)pwVar7)(1);

    }

    return 1;

  }

  iVar6 = 0;

  bVar1 = false;

  if (0 < param_2) {

    do {

      pcVar8 = *(char **)(param_3 + iVar6 * 4);

      if (*pcVar8 != '-') break;

      FUN_00401340(pcVar8 + 1);

      FUN_00401340("reply");

      iVar3 = _stricmp(local_14,local_c);

      pcVar8 = local_c + -0x14;

      LVar2 = InterlockedDecrement((LONG *)(local_c + -0x10));

      if ((LVar2 == 0) && (pcVar8 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar8)(1);

      }

      if (iVar3 == 0) {

        pcVar8 = local_14 + -0x14;

        bVar1 = true;

        LVar2 = InterlockedDecrement((LONG *)(local_14 + -0x10));

        if ((LVar2 == 0) && (pcVar8 != (char *)0x0)) {

          (*(code *)**(undefined4 **)pcVar8)(1);

        }

      }

      else {

        FUN_00401340("account");

        iVar3 = _stricmp(local_14,pcStack_8);

        pcVar8 = pcStack_8 + -0x14;

        LVar2 = InterlockedDecrement((LONG *)(pcStack_8 + -0x10));

        if ((LVar2 == 0) && (pcVar8 != (char *)0x0)) {

          (*(code *)**(undefined4 **)pcVar8)(1);

        }

        if (iVar3 == 0) {

          *param_5 = 1;

        }

        else {

          uStack_4 = 0;

          iVar3 = FUN_006b1460(local_14,&uStack_4);

          if (iVar3 == 0) {

            FUN_00402710(&local_14,"\"%s\" is not a valid squelch category.",

                         *(undefined4 *)(param_3 + iVar6 * 4));

            FUN_004c3010(&local_14,0x1a,1,*(undefined4 *)(local_10 + 0x8c));

            LVar2 = InterlockedDecrement((LONG *)(local_14 + -0x10));

            if ((LVar2 == 0) && (local_14 + -0x14 != (char *)0x0)) {

              (*(code *)**(undefined4 **)(local_14 + -0x14))(1);

            }

            return 0;

          }

          *param_7 = uStack_4;

        }

        pcVar8 = local_14 + -0x14;

        LVar2 = InterlockedDecrement((LONG *)(local_14 + -0x10));

        if ((LVar2 == 0) && (pcVar8 != (char *)0x0)) {

          (*(code *)**(undefined4 **)pcVar8)(1);

        }

      }

      iVar6 = iVar6 + 1;

    } while (iVar6 < param_2);

    if (bVar1) {

      piVar4 = (int *)FUN_0058a380(&param_4);

      iVar6 = *param_6;

      if (iVar6 != *piVar4) {

        LVar2 = InterlockedDecrement((LONG *)(iVar6 + -0x10));

        if ((LVar2 == 0) && ((undefined4 *)(iVar6 + -0x14) != (undefined4 *)0x0)) {

          (*(code *)**(undefined4 **)(iVar6 + -0x14))(1);

        }

        iVar6 = *piVar4;

        *param_6 = iVar6;

        InterlockedIncrement((LONG *)(iVar6 + -0x10));

      }

      pwVar7 = param_4 + -10;

      LVar2 = InterlockedDecrement((LONG *)(param_4 + -8));

      if ((LVar2 == 0) && (pwVar7 != (wchar_t *)0x0)) {

        (*(code *)**(undefined4 **)pwVar7)(1);

      }

      if (*(int *)(*param_6 + -4) != 1) {

        return 1;

      }

      sVar5 = wcslen(L"A player must @tell you before you can squelch them with this command.");

      FUN_004022d0(sVar5);

      wcscpy(param_4,L"A player must @tell you before you can squelch them with this command.");

      FUN_005649f0(&param_4,0x1a,1,*(undefined4 *)(local_10 + 0x8c));

      goto LAB_0057adc2;

    }

  }

  piVar4 = (int *)FUN_005769e0(&param_2,param_2 - iVar6,param_3 + iVar6 * 4);

  iVar6 = *param_6;

  if (iVar6 != *piVar4) {

    LVar2 = InterlockedDecrement((LONG *)(iVar6 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(iVar6 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar6 + -0x14))(1);

    }

    iVar6 = *piVar4;

    *param_6 = iVar6;

    InterlockedIncrement((LONG *)(iVar6 + -0x10));

  }

  puVar9 = (undefined4 *)(param_2 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(param_2 + -0x10));

  if ((LVar2 == 0) && (puVar9 != (undefined4 *)0x0)) {

    (**(code **)*puVar9)(1);

  }

  if ((char)param_4 == '\0') {

    return 1;

  }

  if (*(int *)(*param_6 + -4) != 1) {

    return 1;

  }

  FUN_00402730(L"You have not specified a squelch target.");

  FUN_005649f0(&param_4,0x1a,1,*(undefined4 *)(local_10 + 0x8c));

LAB_0057adc2:

  pwVar7 = param_4 + -10;

  LVar2 = InterlockedDecrement((LONG *)(param_4 + -8));

  if ((LVar2 == 0) && (pwVar7 != (wchar_t *)0x0)) {

    (*(code *)**(undefined4 **)pwVar7)(1);

  }

  return 1;

}





// --- FUN_0057ade0 at 0x0057ADE0 (size: 148) ---


undefined4 __fastcall FUN_0057ade0(int param_1)



{

  undefined4 uVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  undefined *local_8;

  int local_4;

  

  local_8 = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  FUN_0058ace0(&local_8);

  uVar6 = *(undefined4 *)(param_1 + 0x8c);

  uVar5 = 1;

  uVar4 = 0;

  uVar1 = FUN_00403350(&local_4,0);

  FUN_005649f0(uVar1,uVar4,uVar5,uVar6);

  LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar2 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

  }

  puVar3 = (undefined4 *)(local_8 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(local_8 + -0x10));

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  return 1;

}





// --- FUN_0057ae80 at 0x0057AE80 (size: 80) ---


undefined4 __fastcall FUN_0057ae80(int param_1)



{

  LONG LVar1;

  

  FUN_00401340("@age - Displays your total gameplay time.\n");

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057aed0 at 0x0057AED0 (size: 80) ---


undefined4 __fastcall FUN_0057aed0(int param_1)



{

  LONG LVar1;

  

  FUN_00401340("@birth - Displays when your character was created.\n");

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057af20 at 0x0057AF20 (size: 80) ---


undefined4 __fastcall FUN_0057af20(int param_1)



{

  LONG LVar1;

  

  FUN_00401340(

              "@day - A toggle that lightens the outdoor landscape. Note that this command may take several seconds to take effect. \n"

              );

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057afd0 at 0x0057AFD0 (size: 80) ---


undefined4 __fastcall FUN_0057afd0(int param_1)



{

  LONG LVar1;

  

  FUN_00401340("@framerate - Toggles the framerate display.\n");

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057b370 at 0x0057B370 (size: 80) ---


undefined4 __fastcall FUN_0057b370(int param_1)



{

  LONG LVar1;

  

  FUN_00401340("@version - Tells you what version of the software you are using.\n");

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057b3c0 at 0x0057B3C0 (size: 80) ---


undefined4 __fastcall FUN_0057b3c0(int param_1)



{

  LONG LVar1;

  

  FUN_00401340("@clear - Clears the chat box of all text.\n");

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057b5b0 at 0x0057B5B0 (size: 80) ---


undefined4 __fastcall FUN_0057b5b0(int param_1)



{

  LONG LVar1;

  

  FUN_00401340("@title <new title> - Sets the title of the popup chat window.\n");

  if (*(int *)(param_1 + -4) != 1) {

    FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

  }

  LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057b9f0 at 0x0057B9F0 (size: 156) ---


undefined4 FUN_0057b9f0(void)



{

  int iVar1;

  int *piVar2;

  char cVar3;

  int *piVar4;

  undefined1 *puVar5;

  undefined *puVar6;

  int **ppiVar7;

  undefined4 uVar8;

  int *local_14;

  undefined1 local_10 [4];

  undefined1 local_c [4];

  int *local_8;

  undefined4 local_4;

  

  ppiVar7 = &local_14;

  puVar5 = local_10;

  puVar6 = &DAT_007d0eb8;

  local_14 = (int *)0x0;

  FUN_00406d10(puVar5,&DAT_007d0eb8,ppiVar7);

  FUN_00406570(puVar5,puVar6,ppiVar7);

  piVar2 = local_14;

  uVar8 = 0;

  local_8 = (int *)0x0;

  local_4 = 0;

  piVar4 = local_14;

  if (local_14 != (int *)0x0) {

    (**(code **)(*local_14 + 0x10))(local_14,0);

  }

  piVar4 = (int *)FUN_0048bb00(local_c,piVar4,uVar8);

  iVar1 = *piVar4;

  if (piVar2 != (int *)0x0) {

    (**(code **)(*piVar2 + 0x14))();

  }

  piVar2 = local_8;

  if (local_8 != (int *)0x0) {

    if (-1 < iVar1) {

      cVar3 = FUN_00593e30();

      if (cVar3 != '\0') {

        (**(code **)(*piVar2 + 0x14))();

        return 1;

      }

    }

    (**(code **)(*piVar2 + 0x14))();

  }

  return 0;

}





// --- FUN_0057ba90 at 0x0057BA90 (size: 186) ---


undefined4 __fastcall FUN_0057ba90(int param_1)



{

  undefined4 uVar1;

  LONG LVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  int local_8;

  int local_4;

  

  if (DAT_008712c4 != 0) {

    FUN_00408670(&local_8,0,"Chat log %s closed.\n",*(undefined4 *)(param_1 + 0x98));

    uVar5 = *(undefined4 *)(param_1 + 0x8c);

    uVar4 = 1;

    uVar3 = 0;

    uVar1 = FUN_00403350(&local_4,0);

    FUN_005649f0(uVar1,uVar3,uVar4,uVar5);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

    }

    fclose((FILE *)DAT_008712c4);

    DAT_008712c4 = 0;

    LVar2 = InterlockedDecrement((LONG *)(local_8 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(local_8 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(local_8 + -0x14))(1);

    }

    return 1;

  }

  return 0;

}





// --- FUN_0057bb50 at 0x0057BB50 (size: 73) ---


void __fastcall FUN_0057bb50(int param_1)



{

  undefined *puVar1;

  undefined4 *puVar2;

  undefined4 local_4;

  

  puVar1 = PTR_DAT_00818558;

  local_4 = *(undefined4 *)(param_1 + 0x68);

  puVar2 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&local_4,local_4,0);

  if ((puVar2 != (undefined4 *)puVar1) || (puVar2 = puVar2 + -1, puVar2 != (undefined4 *)puVar1)) {

    puVar2 = puVar2 + 1;

  }

  FUN_0057d7d0(*puVar2);

  return;

}





// --- FUN_0057bbc0 at 0x0057BBC0 (size: 20) ---


undefined4 FUN_0057bbc0(undefined4 param_1)



{

  FUN_00572760(param_1,&DAT_0083774c);

  return 0;

}





// --- FUN_0057bcc0 at 0x0057BCC0 (size: 575) ---


undefined1 __thiscall FUN_0057bcc0(int param_1,int param_2,int param_3)



{

  char cVar1;

  undefined1 uVar2;

  LONG LVar3;

  char *pcVar4;

  undefined4 uVar5;

  undefined4 *puVar6;

  bool bVar7;

  undefined4 uVar8;

  undefined4 uVar9;

  int iVar10;

  undefined4 uVar11;

  undefined4 *local_18;

  int local_14;

  undefined **local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 *local_4;

  

  FUN_005769e0(&param_3,param_2,param_3);

  if (*(int *)(param_3 + -4) == 1) {

    FUN_00402730(L"Please specify an actual name.");

    FUN_005649f0(&local_18,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    LVar3 = InterlockedDecrement(local_18 + -4);

    if ((LVar3 == 0) && (local_18 + -5 != (undefined4 *)0x0)) {

      (**(code **)local_18[-5])(1);

    }

    puVar6 = (undefined4 *)(param_3 + -0x14);

    LVar3 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    return 1;

  }

  FUN_00401340("-account");

  local_4 = &param_3;

  local_10 = &PTR_FUN_0079548c;

  local_c = 0;

  local_8 = 0;

  cVar1 = FUN_0056f710(&param_2,0);

  bVar7 = cVar1 != '\0';

  if (bVar7) {

    local_8 = local_c;

    FUN_0040b0f0(*(undefined4 *)(param_2 + -4));

    FUN_0040c9a0(&PTR_DAT_00818344);

  }

  iVar10 = DAT_00837748;

  InterlockedIncrement((LONG *)(DAT_00837748 + -0x10));

  FUN_00435720(1,1,iVar10);

  pcVar4 = " (Account)";

  if (!bVar7) {

    pcVar4 = "";

  }

  FUN_00408670(&local_14,0,"Attempting to boot %s%s...\n",param_3,pcVar4);

  uVar11 = *(undefined4 *)(param_1 + 0x8c);

  uVar9 = 1;

  uVar8 = 0;

  uVar5 = FUN_00403350(&local_18,0);

  FUN_005649f0(uVar5,uVar8,uVar9,uVar11);

  puVar6 = local_18 + -5;

  LVar3 = InterlockedDecrement(local_18 + -4);

  if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  FUN_0048c3e0(param_3);

  uVar2 = FUN_006a87e0(&local_18,bVar7);

  LVar3 = InterlockedDecrement(local_18 + 1);

  if ((LVar3 == 0) && (local_18 != (undefined4 *)0x0)) {

    (**(code **)*local_18)(1);

  }

  LVar3 = InterlockedDecrement((LONG *)(local_14 + -0x10));

  if ((LVar3 == 0) && ((undefined4 *)(local_14 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_14 + -0x14))(1);

  }

  puVar6 = (undefined4 *)(param_2 + -0x14);

  local_10 = &PTR_LAB_00795478;

  LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

  if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  puVar6 = (undefined4 *)(param_3 + -0x14);

  LVar3 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return uVar2;

}





// --- FUN_0057bf70 at 0x0057BF70 (size: 584) ---


undefined4 FUN_0057bf70(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  LONG LVar2;

  

  if (param_1 == 0) {

    FUN_00401340("@help chatting - How to chat publically and privately.\n");

    if (iRamfffffffc != 1) {

      FUN_00404ef0(0,iRamfffffffc + -1);

    }

    iVar1 = InterlockedDecrement((LONG *)0xfffffff0);

    param_3 = 0;

  }

  else {

    FUN_00401340("@chat - Sets whether or not you receive normal chat.\n");

    if (*(int *)(param_1 + -4) != 1) {

      FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

    }

    LVar2 = InterlockedDecrement((LONG *)(param_1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

    }

    FUN_00401340("@notell - Sets whether or not you receive @tell\'s.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00578820(0,"@reply",param_3);

    FUN_00401340("@retell - Sends some text to the last person you @tell\'d.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@say - Says some text to everyone around you.");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@tell - Sends a private message to another character.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00570060(0,&DAT_007db4d4,param_3);

    FUN_00570060(0,&DAT_007db4d0,param_3);

    FUN_00570060(0,&DAT_00795524,param_3);

    FUN_00570060(0,&DAT_007db4cc,param_3);

    FUN_00570060(0,&DAT_007db4c8,param_3);

    FUN_00570060(0,&DAT_007db4c4,param_3);

    FUN_00401340("@afk - Set your away-from-keyboard status.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    iVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  }

  if ((iVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057c680 at 0x0057C680 (size: 435) ---


undefined4 FUN_0057c680(int param_1,undefined4 param_2,int param_3)



{

  LONG LVar1;

  

  if (param_1 == 0) {

    FUN_00401340("@help death - Commands for making, finding, and looting corpses.\n");

    if (iRamfffffffc != 1) {

      FUN_00404ef0(0,iRamfffffffc + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)0xfffffff0);

    if (LVar1 == 0) {

      (*(code *)*puRamffffffec)(1);

      return 1;

    }

  }

  else {

    FUN_00401340("@permit - Commands to give or revoke permission for others to loot your corpse.\n"

                );

    if (*(int *)(param_1 + -4) != 1) {

      FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

    }

    FUN_00401340(

                "@consent - Commands to help you manage the corpse-looting permissions that others give you.\n"

                );

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@corpse - Displays the location of your last outdoor death.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340(

                "@die - Kills your character and leaves a corpse, returning you to your lifestone.\n"

                );

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_005792d0(0,"@lifestone",param_3);

    FUN_00579320(0,"@marketplace",param_3);

    FUN_00579750(0,"@pkarena",param_3);

    FUN_00579850(0,"@pklarena",param_3);

  }

  return 1;

}





// --- FUN_0057cf60 at 0x0057CF60 (size: 310) ---


undefined4 FUN_0057cf60(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  LONG LVar2;

  undefined4 *puVar3;

  

  if (param_1 == 0) {

    FUN_00401340("@help squelch - Commands that let you block out messages from other players.\n");

    if (iRamfffffffc != 1) {

      FUN_00404ef0(0,iRamfffffffc + -1);

    }

    puVar3 = (undefined4 *)0xffffffec;

    iVar1 = InterlockedDecrement((LONG *)0xfffffff0);

  }

  else if (param_1 == 1) {

    FUN_00401340(

                "@squelch - Squelches a character or account.\n@unsquelch - Unsquelches a squelched character or account.\n@messagetypes - Lists all types of messages that can be squelched or filtered.\n"

                );

    if (CONCAT13(uRam00000000,iRamfffffffc._1_3_) != 1) {

      FUN_00404ef0(1,CONCAT13(uRam00000000,iRamfffffffc._1_3_) + -1);

    }

    puVar3 = (undefined4 *)0xffffffed;

    iVar1 = InterlockedDecrement((LONG *)0xfffffff1);

  }

  else {

    FUN_00401340(

                "The @squelch commands let you block out messages from specific characters or players. The @unsquelch commands lets squelched messages reach you again. Use the options on these commands to squelch all message types or just some types of messages; one character or an entire account. You may have up to 32 players squelched at once. Note that NPCs cannot be permanently squelched.\n\n"

                );

    if (*(int *)(param_1 + -4) != 1) {

      FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

    }

    LVar2 = InterlockedDecrement((LONG *)(param_1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

    }

    FUN_0057a960(2,&DAT_007938af,param_3);

    FUN_0057a9b0(2,&DAT_007938af,param_3);

    FUN_00401340("Type @messagetypes for a complete list of message types.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    puVar3 = (undefined4 *)(param_3 + -0x14);

    iVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  }

  if ((iVar1 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  return 1;

}





// --- FUN_0057d0a0 at 0x0057D0A0 (size: 318) ---


bool __thiscall FUN_0057d0a0(int param_1,int param_2,undefined4 *param_3,uint param_4)



{

  undefined *puVar1;

  char cVar2;

  int iVar3;

  LONG LVar4;

  undefined4 *puVar5;

  wchar_t *pwVar6;

  undefined *local_4;

  

  local_4 = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  if (param_2 == 0) {

    iVar3 = FUN_0058aed0();

    puVar5 = (undefined4 *)(local_4 + -0x14);

    LVar4 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

    }

    return iVar3 != 0;

  }

  if (*(char *)*param_3 == '-') {

    cVar2 = FUN_0057aa00(param_2,param_3,0,&param_2,&local_4,&param_3);

    puVar1 = local_4;

    if (cVar2 == '\0') {

      iVar3 = InterlockedDecrement((LONG *)(local_4 + -0x10));

      goto LAB_0057d1c5;

    }

    if (((char)param_2 != '\x01') && (*(int *)(local_4 + -4) == 1)) {

      FUN_006a4b20(param_4 & 0xff,param_3);

      FUN_004011b0();

      return true;

    }

    pwVar6 = L"Incorrect usage, use @help for proper arguements.";

  }

  else {

    pwVar6 = L"You must specify a valid message type prefixed by a dash.";

  }

  FUN_00402730(pwVar6);

  FUN_005649f0(&param_4,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

  puVar5 = (undefined4 *)(param_4 - 0x14);

  LVar4 = InterlockedDecrement((LONG *)(param_4 - 0x10));

  if ((LVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

    (**(code **)*puVar5)(1);

  }

  puVar1 = local_4;

  iVar3 = InterlockedDecrement((LONG *)(local_4 + -0x10));

LAB_0057d1c5:

  if ((iVar3 == 0) && ((undefined4 *)(puVar1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(puVar1 + -0x14))(1);

  }

  return true;

}





// --- FUN_0057d1e0 at 0x0057D1E0 (size: 389) ---


undefined4 FUN_0057d1e0(int param_1,undefined4 param_2,int param_3)



{

  LONG LVar1;

  

  if (param_1 == 0) {

    FUN_00401340("@help status - Commands that display useful information.\n");

    if (iRamfffffffc != 1) {

      FUN_00404ef0(0,iRamfffffffc + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)0xfffffff0);

    if (LVar1 == 0) {

      (*(code *)*puRamffffffec)(1);

      return 1;

    }

  }

  else {

    FUN_0057ae80(0,&DAT_007e1a3c,param_3);

    FUN_0057aed0(0,"@birth",param_3);

    FUN_0057af20(0,&DAT_007e1a2c,param_3);

    FUN_00401340("@endurance - Explains how endurance affects your character.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_0057afd0(0,"@framerate",param_3);

    FUN_00401340("@loc - Displays your current position.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340(

                "@pklite - Sets your status to Player Killer Lite. Type @help pklite for more details.\n"

                );

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_0057b370(0,"@version",param_3);

  }

  return 1;

}





// --- FUN_0057d490 at 0x0057D490 (size: 409) ---


undefined4 FUN_0057d490(int param_1,undefined4 param_2,int param_3)



{

  LONG LVar1;

  

  if (param_1 == 0) {

    FUN_00401340("@help text - Commands that help you manage your text window.\n");

    if (iRamfffffffc != 1) {

      FUN_00404ef0(0,iRamfffffffc + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)0xfffffff0);

    if (LVar1 == 0) {

      (*(code *)*puRamffffffec)(1);

      return 1;

    }

  }

  else {

    FUN_0057b3c0(0,"@clear",param_3);

    FUN_00401340("@filter - Commands to filter out incoming messages.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@unfilter - Commands to remove filters from incoming messages.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340(

                "@loadfile - Reads in the given text file and executes each line in the chat entry field.\n"

                );

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@log - Commands to echo chat text to a logfile.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_0057b5b0(0,"@title",param_3);

  }

  return 1;

}





// --- FUN_0057d670 at 0x0057D670 (size: 114) ---


bool __thiscall FUN_0057d670(int param_1,int *param_2)



{

  int iVar1;

  LONG LVar2;

  

  FUN_0057ba90();

  DAT_008712c4 = (int)fopen((char *)*param_2,"a+");

  iVar1 = *(int *)(param_1 + 0x98);

  if (iVar1 != *param_2) {

    LVar2 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

    }

    iVar1 = *param_2;

    *(int *)(param_1 + 0x98) = iVar1;

    InterlockedIncrement((LONG *)(iVar1 + -0x10));

  }

  return DAT_008712c4 != 0;

}





// --- FUN_0057d6f0 at 0x0057D6F0 (size: 143) ---


undefined4 * __thiscall FUN_0057d6f0(undefined4 *param_1,undefined4 param_2)



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_007d10fc;

  puVar1 = PTR_DAT_00818558;

  puVar2 = (uint *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

  if (puVar2 == (uint *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

  param_1[0x19] = (undefined4 *)param_1[0x18] + param_1[0x1a];

  puVar6 = (undefined4 *)param_1[0x18];

  for (uVar4 = param_1[0x1a] & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

  for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

    *(undefined1 *)puVar6 = 0;

    puVar6 = (undefined4 *)((int)puVar6 + 1);

  }

  return param_1;

}





// --- FUN_0057d780 at 0x0057D780 (size: 77) ---


void __thiscall FUN_0057d780(int param_1,int param_2)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  

  if (*(int *)(param_1 + 0x68) * 2 < *(int *)(param_1 + 0x6c) + 1) {

    FUN_0057bb50();

  }

  uVar1 = *(uint *)(param_1 + 0x68);

  uVar3 = FUN_0041aa50();

  uVar3 = uVar3 % uVar1;

  iVar2 = *(int *)(param_1 + 0x60);

  *(undefined4 *)(param_2 + 4) = *(undefined4 *)(iVar2 + uVar3 * 4);

  *(int *)(iVar2 + uVar3 * 4) = param_2;

  uVar1 = iVar2 + uVar3 * 4;

  if (uVar1 < *(uint *)(param_1 + 100)) {

    *(uint *)(param_1 + 100) = uVar1;

  }

  *(int *)(param_1 + 0x6c) = *(int *)(param_1 + 0x6c) + 1;

  return;

}





// --- FUN_0057d7d0 at 0x0057D7D0 (size: 320) ---


undefined4 __thiscall FUN_0057d7d0(int param_1,int param_2)



{

  uint uVar1;

  int iVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  int iVar6;

  undefined4 *puVar7;

  uint uVar8;

  int iVar9;

  int *piVar10;

  

  iVar2 = param_2;

  if (param_2 == *(int *)(param_1 + 0x68)) {

    return 0;

  }

  iVar6 = *(int *)(param_1 + 0x6c);

  iVar3 = 0;

  do {

    if (iVar6 == 0) {

      if (*(void **)(param_1 + 0x60) != (void *)(param_1 + 4)) {

        operator_delete__(*(void **)(param_1 + 0x60));

      }

      *(undefined4 *)(param_1 + 0x60) = 0;

      *(undefined4 *)(param_1 + 100) = 0;

      *(undefined4 *)(param_1 + 0x68) = 0;

      *(undefined4 *)(param_1 + 0x6c) = 0;

      FUN_00693b20(iVar2);

      puVar4 = (undefined4 *)PTR_DAT_00818558;

      iVar2 = param_2;

      while (iVar3 != 0) {

        param_2 = *(int *)(param_1 + 0x68);

        iVar6 = *(int *)(iVar3 + 4);

        PTR_DAT_00818558 = (undefined *)puVar4;

        if (param_2 * 2 < *(int *)(param_1 + 0x6c) + 1) {

          puVar7 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,puVar4,&param_2,param_2,0);

          if ((puVar7 != puVar4) || (puVar7 = puVar7 + -1, puVar7 != puVar4)) {

            puVar7 = puVar7 + 1;

          }

          FUN_0057d7d0(*puVar7);

          iVar2 = param_2;

        }

        param_2 = iVar2;

        uVar1 = *(uint *)(param_1 + 0x68);

        uVar8 = FUN_0041aa50();

        uVar8 = uVar8 % uVar1;

        iVar2 = *(int *)(param_1 + 0x60);

        *(undefined4 *)(iVar3 + 4) = *(undefined4 *)(iVar2 + uVar8 * 4);

        *(int *)(iVar2 + uVar8 * 4) = iVar3;

        uVar1 = iVar2 + uVar8 * 4;

        if (uVar1 < *(uint *)(param_1 + 100)) {

          *(uint *)(param_1 + 100) = uVar1;

        }

        *(int *)(param_1 + 0x6c) = *(int *)(param_1 + 0x6c) + 1;

        puVar4 = (undefined4 *)PTR_DAT_00818558;

        iVar2 = param_2;

        iVar3 = iVar6;

      }

      PTR_DAT_00818558 = (undefined *)puVar4;

      return 1;

    }

    piVar10 = *(int **)(param_1 + 100);

    while (piVar10 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

      if (**(int **)(param_1 + 100) != 0) {

        piVar10 = *(int **)(param_1 + 100);

        iVar9 = *piVar10;

        goto LAB_0057d81f;

      }

      piVar10 = *(int **)(param_1 + 100) + 1;

      *(int **)(param_1 + 100) = piVar10;

    }

    piVar10 = (int *)0x0;

    iVar9 = 0;

LAB_0057d81f:

    iVar6 = *piVar10;

    if (iVar6 == iVar9) {

LAB_0057d832:

      *piVar10 = *(int *)(iVar6 + 4);

    }

    else {

      do {

        iVar5 = iVar6;

        iVar6 = *(int *)(iVar5 + 4);

      } while (iVar6 != iVar9);

      if (iVar5 == 0) goto LAB_0057d832;

      *(undefined4 *)(iVar5 + 4) = *(undefined4 *)(iVar6 + 4);

    }

    *(int *)(param_1 + 0x6c) = *(int *)(param_1 + 0x6c) + -1;

    *(int *)(iVar9 + 4) = iVar3;

    iVar6 = *(int *)(param_1 + 0x6c);

    iVar3 = iVar9;

  } while( true );

}





// --- FUN_0057d960 at 0x0057D960 (size: 80) ---


undefined4 FUN_0057d960(undefined4 param_1,int *param_2)



{

  LONG LVar1;

  int unaff_retaddr;

  

  FUN_00404a40(0,*param_2 + 0x14);

  FUN_00572760(param_1,&param_2);

  LVar1 = InterlockedDecrement((LONG *)(unaff_retaddr + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(unaff_retaddr + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(unaff_retaddr + -0x14))(1);

  }

  return 0;

}





// --- FUN_0057d9b0 at 0x0057D9B0 (size: 1084) ---


/* WARNING: Removing unreachable block (ram,0x0057db8b) */

/* WARNING: Removing unreachable block (ram,0x0057db8f) */

/* WARNING: Removing unreachable block (ram,0x0057dd92) */



undefined4 FUN_0057d9b0(undefined4 param_1,int *param_2,int *param_3)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  bool bVar3;

  undefined4 *puVar4;

  int iVar5;

  char *pcVar6;

  LONG LVar7;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  undefined4 extraout_ECX_02;

  code *pcVar8;

  int *piVar9;

  undefined *puVar10;

  int *piVar11;

  int **ppiVar12;

  undefined4 uVar13;

  int local_1c;

  int *local_14;

  undefined4 uStack_10;

  undefined4 *local_c;

  int local_8 [2];

  

  iVar5 = FUN_0058a690(param_1,0xc);

  if (iVar5 != 0) {

    local_1c = 0;

    local_14 = (int *)0x0;

    local_8[0] = FUN_00560f80();

    puVar1 = (undefined4 *)*param_2;

    InterlockedIncrement(puVar1 + 1);

    puVar2 = (undefined4 *)*param_3;

    InterlockedIncrement(puVar2 + 1);

    param_2 = DAT_008ef11c;

    InterlockedIncrement(DAT_008ef11c + 1);

    FUN_0048c3e0(&DAT_007d1eb8);

    puVar4 = local_c;

    pcVar6 = strstr((char *)(puVar1 + 5),(char *)(local_c + 5));

    if (pcVar6 == (char *)0x0) {

      pcVar6 = (char *)0xffffffff;

    }

    else {

      pcVar6 = pcVar6 + (-0x14 - (int)puVar1);

    }

    LVar7 = InterlockedDecrement(puVar4 + 1);

    uVar13 = extraout_ECX;

    if ((LVar7 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

      uVar13 = extraout_ECX_00;

    }

    if ((int)pcVar6 < 0) {

      FUN_0048c3e0(&DAT_007d1eb4);

      pcVar6 = strstr((char *)(puVar1 + 5),(char *)(local_c + 5));

      if (pcVar6 == (char *)0x0) {

        pcVar6 = (char *)0xffffffff;

      }

      else {

        pcVar6 = pcVar6 + (-0x14 - (int)puVar1);

      }

      LVar7 = InterlockedDecrement(local_c + 1);

      uVar13 = extraout_ECX_01;

      if ((LVar7 == 0) && (local_c != (undefined4 *)0x0)) {

        (**(code **)*local_c)(1);

        uVar13 = extraout_ECX_02;

      }

      if (-1 < (int)pcVar6) {

        FUN_0048c3e0(&DAT_007d1eb4);

        FUN_0056f9a0(0,1,uVar13);

        local_1c = 1;

      }

    }

    else {

      FUN_0048c3e0(&DAT_007d1eb8);

      FUN_0056f9a0(0,1,uVar13);

      local_14 = (int *)0x1;

    }

    if ((local_1c == local_8[0]) || (local_14 != (int *)0x0)) {

      bVar3 = false;

    }

    else {

      bVar3 = true;

    }

    ppiVar12 = &local_14;

    piVar9 = local_8;

    puVar10 = &DAT_007d0eb8;

    uStack_10 = 0;

    local_14 = (int *)0x0;

    FUN_00406d10(piVar9,&DAT_007d0eb8,ppiVar12);

    FUN_00406570(piVar9,puVar10,ppiVar12);

    piVar9 = local_14;

    uVar13 = 0;

    piVar11 = local_14;

    if (local_14 != (int *)0x0) {

      (**(code **)(*local_14 + 0x10))(local_14,0);

    }

    FUN_0048bb00(&local_c,piVar11,uVar13);

    if (piVar9 != (int *)0x0) {

      (**(code **)(*piVar9 + 0x14))();

    }

    if (bVar3) {

      if (local_1c == 0) {

        uVar13 = FUN_00682870(&param_3);

        FUN_0048a0a0(uVar13);

      }

      else {

        uVar13 = FUN_00682710(&param_3);

        FUN_0048a0a0(uVar13);

      }

      piVar9 = param_3;

      LVar7 = InterlockedDecrement(param_3 + 1);

      if ((LVar7 == 0) && (piVar9 != (int *)0x0)) {

        (**(code **)*piVar9)(1);

      }

      FUN_00487620(&param_2,"%s %s\n",puVar1 + 5,puVar2 + 5);

    }

    else {

      FUN_004034c0(puVar1 + 5);

      piVar9 = param_3;

      iVar5 = *param_3;

      if (*(int *)(iVar5 + 8) == 0) {

        pcVar6 = (char *)(iVar5 + 0x13);

      }

      else {

        pcVar6 = (char *)(iVar5 + 0x14);

      }

      pcVar8 = InterlockedDecrement_exref;

      if (*pcVar6 != '\'') {

        FUN_0048c3e0(&DAT_00795098);

        piVar11 = param_3;

        if ((param_3[2] != 1) && (param_3 != DAT_008ef11c)) {

          FUN_004910c0(param_3 + 5,param_3[2] + -1);

        }

        pcVar8 = InterlockedDecrement_exref;

        LVar7 = InterlockedDecrement(piVar11 + 1);

        if (LVar7 == 0) {

          (**(code **)*piVar11)(1);

        }

      }

      FUN_0048c3e0(*piVar9 + 0x14);

      piVar9 = param_3;

      if ((param_3[2] != 1) && (param_3 != DAT_008ef11c)) {

        FUN_004910c0(param_3 + 5,param_3[2] + -1);

      }

      iVar5 = (*pcVar8)(piVar9 + 1);

      if (iVar5 == 0) {

        (**(code **)*piVar9)(1);

      }

      FUN_0048c3e0(&DAT_00795508);

      piVar9 = param_2;

      if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

        FUN_004910c0(param_2 + 5,param_2[2] + -1);

      }

      iVar5 = (*pcVar8)(piVar9 + 1);

      if (iVar5 == 0) {

        (**(code **)*piVar9)(1);

      }

    }

    piVar9 = param_2;

    FUN_00404a40(0,param_2 + 5);

    FUN_005649f0(&param_3,0xc,1,0);

    piVar11 = param_3 + -5;

    LVar7 = InterlockedDecrement(param_3 + -4);

    if ((LVar7 == 0) && (piVar11 != (int *)0x0)) {

      (**(code **)*piVar11)(1);

    }

    LVar7 = InterlockedDecrement(piVar9 + 1);

    if ((LVar7 == 0) && (piVar9 != (int *)0x0)) {

      (**(code **)*piVar9)(1);

    }

    LVar7 = InterlockedDecrement(puVar2 + 1);

    if ((LVar7 == 0) && (puVar2 != (undefined4 *)0x0)) {

      (**(code **)*puVar2)(1);

    }

    LVar7 = InterlockedDecrement(puVar1 + 1);

    if ((LVar7 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

  }

  return 0;

}





// --- FUN_0057ddf0 at 0x0057DDF0 (size: 160) ---


undefined4 FUN_0057ddf0(undefined4 *param_1,undefined4 *param_2,undefined4 param_3)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  LONG LVar3;

  undefined4 uVar4;

  

  puVar1 = param_1;

  if (DAT_0083da58 == 0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    puVar2 = *(undefined4 **)(DAT_0083da58 + 0xf4);

  }

  if (param_1 == puVar2) {

    return 0;

  }

  FUN_0048c3e0(&DAT_007d1eb8);

  FUN_004a2b90(&param_2,&param_1);

  puVar2 = param_1;

  LVar3 = InterlockedDecrement(param_1 + 1);

  if ((LVar3 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  uVar4 = FUN_0057d9b0(puVar1,&param_2,param_3);

  puVar1 = param_2;

  LVar3 = InterlockedDecrement(param_2 + 1);

  if ((LVar3 == 0) && (puVar1 != (undefined4 *)0x0)) {

    (**(code **)*puVar1)(1);

  }

  return uVar4;

}





// --- FUN_0057de90 at 0x0057DE90 (size: 346) ---


undefined4 FUN_0057de90(int param_1)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  int local_c;

  undefined4 *puStack_8;

  

  FUN_00404a40(0,"The following channels are available to you:\n");

  FUN_005649f0(&local_c,0,1,0);

  puVar3 = (undefined4 *)(local_c + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(local_c + -0x10));

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  puVar3 = DAT_008ef11c;

  piVar1 = *(int **)(param_1 + 4);

  InterlockedIncrement(DAT_008ef11c + 1);

  for (; piVar1 != (int *)0x0; piVar1 = (int *)piVar1[1]) {

    FUN_004034c0(&DAT_007e1b2c);

    puVar4 = (undefined4 *)*piVar1;

    if ((puVar4[2] != 1) && (puVar4 != DAT_008ef11c)) {

      FUN_004910c0(puVar4 + 5,puVar4[2] + -1);

    }

    FUN_0048c3e0(&DAT_00795508);

    puVar4 = puStack_8;

    if ((puStack_8[2] != 1) && (puStack_8 != DAT_008ef11c)) {

      FUN_004910c0(puStack_8 + 5,puStack_8[2] + -1);

    }

    LVar2 = InterlockedDecrement(puVar4 + 1);

    if (LVar2 == 0) {

      (**(code **)*puVar4)(1);

    }

    FUN_00404a40(0,puVar3 + 5);

    FUN_005649f0(&local_c,0,1,0);

    puVar4 = (undefined4 *)(local_c + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_c + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  LVar2 = InterlockedDecrement(puVar3 + 1);

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  return 0;

}





// --- FUN_0057e000 at 0x0057E000 (size: 346) ---


undefined4 FUN_0057e000(int param_1)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  int local_c;

  undefined4 *puStack_8;

  

  FUN_00404a40(0,"The following characters are currently listening on the channel:\n");

  FUN_005649f0(&local_c,0,1,0);

  puVar3 = (undefined4 *)(local_c + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(local_c + -0x10));

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  puVar3 = DAT_008ef11c;

  piVar1 = *(int **)(param_1 + 4);

  InterlockedIncrement(DAT_008ef11c + 1);

  for (; piVar1 != (int *)0x0; piVar1 = (int *)piVar1[1]) {

    FUN_004034c0(&DAT_007e1b2c);

    puVar4 = (undefined4 *)*piVar1;

    if ((puVar4[2] != 1) && (puVar4 != DAT_008ef11c)) {

      FUN_004910c0(puVar4 + 5,puVar4[2] + -1);

    }

    FUN_0048c3e0(&DAT_00795508);

    puVar4 = puStack_8;

    if ((puStack_8[2] != 1) && (puStack_8 != DAT_008ef11c)) {

      FUN_004910c0(puStack_8 + 5,puStack_8[2] + -1);

    }

    LVar2 = InterlockedDecrement(puVar4 + 1);

    if (LVar2 == 0) {

      (**(code **)*puVar4)(1);

    }

    FUN_00404a40(0,puVar3 + 5);

    FUN_005649f0(&local_c,0,1,0);

    puVar4 = (undefined4 *)(local_c + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_c + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  LVar2 = InterlockedDecrement(puVar3 + 1);

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  return 0;

}





// --- FUN_0057e170 at 0x0057E170 (size: 81) ---


undefined4 FUN_0057e170(int *param_1)



{

  LONG LVar1;

  int *piVar2;

  

  FUN_00404a40(0,*param_1 + 0x14);

  FUN_005649f0(&param_1,0x1a,1,0);

  piVar2 = param_1 + -5;

  LVar1 = InterlockedDecrement(param_1 + -4);

  if ((LVar1 == 0) && (piVar2 != (int *)0x0)) {

    (**(code **)*piVar2)(1);

  }

  return 0;

}





// --- FUN_0057e1d0 at 0x0057E1D0 (size: 212) ---


undefined4 FUN_0057e1d0(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  LONG LVar2;

  

  if (param_1 == 0) {

    FUN_00401340("@help allegiances - Commands to help you deal with your Allegiance.\n");

    if (iRamfffffffc != 1) {

      FUN_00404ef0(0,iRamfffffffc + -1);

    }

    iVar1 = InterlockedDecrement((LONG *)0xfffffff0);

    param_3 = 0;

  }

  else {

    FUN_00401340("@allegiance - Commands to help manage your allegiance.\n");

    if (*(int *)(param_1 + -4) != 1) {

      FUN_00404ef0(param_1,*(int *)(param_1 + -4) + -1);

    }

    LVar2 = InterlockedDecrement((LONG *)(param_1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

    }

    FUN_00401340(

                "@allegiance motd - Displays or sets the message of the day for your allegiance, see @help motd for more information.\n"

                );

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    iVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  }

  if ((iVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

  }

  return 1;

}





// --- FUN_0057e820 at 0x0057E820 (size: 645) ---


undefined4 __thiscall

FUN_0057e820(int param_1,int param_2,undefined4 *param_3,int *param_4,int param_5)



{

  int iVar1;

  LONG LVar2;

  undefined4 uVar3;

  undefined4 *puVar4;

  undefined4 *puVar5;

  undefined1 local_10 [8];

  undefined1 local_8 [4];

  int iStack_4;

  

  iVar1 = FUN_00556ed0();

  if ((iVar1 == 0) || (param_2 == 0)) {

    uVar3 = *(undefined4 *)(param_1 + 0x8c);

    FUN_00404a40(0,"Turbine chat is not available.\n");

    FUN_005649f0(&param_5,0,1,uVar3);

    puVar4 = (undefined4 *)(param_5 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(param_5 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  else {

    if ((char)param_5 == '\0') {

      param_5 = DAT_008ef11c;

      InterlockedIncrement((LONG *)(DAT_008ef11c + 4));

      FUN_005d0f70(param_3,&param_5);

      FUN_00404a40(0,param_5 + 0x14);

      FUN_00572760(0x551,&param_2);

      LVar2 = InterlockedDecrement((LONG *)(iStack_4 + -0x10));

      if ((LVar2 == 0) && ((undefined4 *)(iStack_4 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(iStack_4 + -0x14))(1);

      }

      puVar4 = param_3;

      LVar2 = InterlockedDecrement(param_3 + 1);

      if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

        (**(code **)*puVar4)(1);

      }

      return 1;

    }

    if ((*(int *)(*param_4 + -4) != 1) && (iVar1 = FUN_0056fb20(param_4), iVar1 != 0)) {

      iVar1 = FUN_0056f330(0);

      if (iVar1 != 0) {

        FUN_00401a40();

        FUN_00402710(&param_5,"You must wait %ds before communicating again!",0);

        FUN_004c3010(&param_5,0,1,*(undefined4 *)(param_1 + 0x8c));

        FUN_004011b0();

        return 0;

      }

      iVar1 = FUN_005df0f5(0xc);

      if (iVar1 == 0) {

        iVar1 = 0;

      }

      else {

        iVar1 = FUN_005031e0();

      }

      uVar3 = FUN_0048e5f0();

      FUN_0051c6f0(uVar3);

      *(undefined4 **)(iVar1 + 8) = param_3;

      puVar4 = (undefined4 *)FUN_00403350(&param_5,0);

      uVar3 = *puVar4;

      puVar4 = (undefined4 *)FUN_005ce950(local_10);

      puVar5 = (undefined4 *)FUN_005ce950(local_8);

      iVar1 = FUN_00556f00(param_2,uVar3,*puVar5,puVar5[1],*puVar4,puVar4[1]);

      FUN_004011b0();

      if (iVar1 != 0) {

        return 1;

      }

      FUN_00401a40();

      FUN_00411850();

      FUN_005d0f70(param_3,&param_5);

      FUN_00402710(&param_2,"Failed to send text to channel: %s\n",param_5 + 0x14);

      FUN_004c3010(&param_2,0,1,*(undefined4 *)(param_1 + 0x8c));

      FUN_005abb30();

      FUN_004011b0();

      return 0;

    }

  }

  return 0;

}





// --- FUN_0057eec0 at 0x0057EEC0 (size: 299) ---


undefined4 __thiscall FUN_0057eec0(int param_1,undefined *param_2)



{

  char cVar1;

  LONG LVar2;

  int iVar3;

  undefined4 uVar4;

  undefined4 *puVar5;

  undefined4 uVar6;

  undefined4 uVar7;

  undefined4 uVar8;

  int local_4;

  

  local_4 = param_1;

  if (param_2 == (undefined *)0x0) {

    iVar3 = FUN_00556ed0();

    if (iVar3 != 0) {

      FUN_004882f0("Using Turbine Chat.\n",0,1,*(undefined4 *)(param_1 + 0x8c));

    }

    param_2 = PTR_DAT_00818344;

    InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

    FUN_00402710(&param_2,"Client version %s\n",DAT_00870ae0);

    uVar8 = *(undefined4 *)(param_1 + 0x8c);

    uVar7 = 1;

    uVar6 = 0;

    uVar4 = FUN_00403350(&local_4,0);

    FUN_005649f0(uVar4,uVar6,uVar7,uVar8);

    puVar5 = (undefined4 *)(local_4 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

    }

    cVar1 = FUN_0057b9f0();

    if (cVar1 != '\0') {

      FUN_00547610();

    }

    puVar5 = (undefined4 *)(param_2 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar2 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

    }

  }

  else {

    FUN_00402730(L"Unexpected arguments to @version");

    FUN_005649f0(&local_4,0x1a,1,*(undefined4 *)(param_1 + 0x8c));

    puVar5 = (undefined4 *)(local_4 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

      return 1;

    }

  }

  return 1;

}





// --- FUN_0057eff0 at 0x0057EFF0 (size: 523) ---


undefined4 __fastcall FUN_0057eff0(int param_1)



{

  int *piVar1;

  char cVar2;

  int iVar3;

  int *piVar4;

  LONG LVar5;

  void *pvVar6;

  uint uVar7;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 uVar8;

  undefined4 *puVar9;

  uint uVar10;

  int iVar11;

  undefined ***pppuVar12;

  undefined4 *local_24;

  int local_20;

  undefined1 auStack_1c [8];

  int iStack_14;

  undefined **local_10;

  undefined4 *local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_c = (undefined4 *)0x0;

  local_8 = 0;

  local_4 = 0;

  pppuVar12 = &local_10;

  local_10 = &PTR_FUN_00795074;

  iVar11 = param_1;

  FUN_00401340(&DAT_007e1f7c);

  iVar3 = *(int *)(param_1 + 0x84);

  InterlockedIncrement((LONG *)(iVar3 + -0x10));

  iVar3 = FUN_00571620(iVar3,iVar11,pppuVar12);

  piVar1 = (int *)(param_1 + 0x88);

  cVar2 = FUN_00405120(piVar1);

  if (cVar2 == '\0') {

    local_10 = &PTR_FUN_00795074;

    FUN_00405210();

    return 0;

  }

  uVar10 = iVar3 - 1;

  piVar4 = (int *)FUN_00404f80(&local_20,1,0xffffffff);

  iVar3 = *piVar1;

  if (iVar3 != *piVar4) {

    local_24 = (undefined4 *)(iVar3 + -0x14);

    LVar5 = InterlockedDecrement((LONG *)(iVar3 + -0x10));

    if ((LVar5 == 0) && (local_24 != (undefined4 *)0x0)) {

      (**(code **)*local_24)(1);

    }

    iVar3 = *piVar4;

    *piVar1 = iVar3;

    InterlockedIncrement((LONG *)(iVar3 + -0x10));

  }

  LVar5 = InterlockedDecrement((LONG *)(local_20 + -0x10));

  uVar8 = extraout_ECX;

  if ((LVar5 == 0) && ((undefined4 *)(local_20 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_20 + -0x14))(1);

    uVar8 = extraout_ECX_00;

  }

  FUN_00401340(&DAT_0079552c);

  FUN_00435720(0,1,uVar8);

  pvVar6 = (void *)thunk_FUN_005df0f5(uVar10 * 4);

  uVar7 = 0;

  if (uVar10 != 0) {

    puVar9 = local_c;

    if (uVar10 == 0) goto LAB_0057f118;

    do {

      *(undefined4 *)((int)pvVar6 + uVar7 * 4) = *puVar9;

LAB_0057f118:

      if (puVar9 != (undefined4 *)0x0) {

        puVar9 = (undefined4 *)puVar9[1];

      }

      uVar7 = uVar7 + 1;

    } while (uVar7 < uVar10);

  }

  iVar3 = *piVar1;

  local_20 = iVar3;

  InterlockedIncrement((LONG *)(iVar3 + -0x10));

  FUN_0041aeb0(auStack_1c,&local_20);

  LVar5 = InterlockedDecrement((LONG *)(iVar3 + -0x10));

  if ((LVar5 == 0) && ((undefined4 *)(iVar3 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(iVar3 + -0x14))(1);

  }

  if ((iStack_14 == 0) || (*(code **)(iStack_14 + 8) == (code *)0x0)) {

    cVar2 = FUN_00578270(uVar10,pvVar6);

    if (cVar2 == '\0') {

      FUN_0048c3e0(*(undefined4 *)(param_1 + 0x84));

      FUN_006a53e0(&local_24);

      puVar9 = local_24;

      LVar5 = InterlockedDecrement(local_24 + 1);

      if ((LVar5 == 0) && (puVar9 != (undefined4 *)0x0)) {

        (**(code **)*puVar9)(1);

      }

    }

  }

  else {

    cVar2 = (**(code **)(iStack_14 + 8))(uVar10,pvVar6);

    if (cVar2 == '\0') {

      FUN_00572760(0x26,&DAT_0083774c);

    }

  }

  operator_delete__(pvVar6);

  local_10 = &PTR_FUN_00795074;

  FUN_00405210();

  return 1;

}





// --- FUN_0057f200 at 0x0057F200 (size: 515) ---


undefined4 __thiscall FUN_0057f200(int param_1,int param_2,int param_3)



{

  char cVar1;

  LONG LVar2;

  undefined4 uVar3;

  int iVar4;

  undefined4 *puVar5;

  code *pcVar6;

  undefined **ppuVar7;

  undefined4 uVar8;

  undefined4 uVar9;

  undefined4 uVar10;

  int local_4;

  

  local_4 = param_1;

  FUN_00576890(&param_3,param_2,param_3);

  if (*(int *)(param_3 + -4) == 1) {

    cVar1 = FUN_0057ba90();

    if (cVar1 != '\0') {

      FUN_00402730(L"Chat output now directed only to the screen.\n");

      FUN_005649f0(&param_2,0,1,*(undefined4 *)(param_1 + 0x8c));

      pcVar6 = InterlockedDecrement_exref;

      puVar5 = (undefined4 *)(param_2 + -0x14);

      LVar2 = InterlockedDecrement((LONG *)(param_2 + -0x10));

      if ((LVar2 == 0) && (puVar5 != (undefined4 *)0x0)) {

        (**(code **)*puVar5)(1);

      }

      goto LAB_0057f3de;

    }

    FUN_00402730(L"Please specify a file to append chat messages to.\n");

    FUN_005649f0(&param_2,0,1,*(undefined4 *)(param_1 + 0x8c));

    pcVar6 = InterlockedDecrement_exref;

  }

  else {

    ppuVar7 = &PTR_DAT_008183b4;

    FUN_0040ce00(&local_4,&param_3,&PTR_DAT_008183b4);

    cVar1 = FUN_00401920(ppuVar7);

    pcVar6 = InterlockedDecrement_exref;

    puVar5 = (undefined4 *)(local_4 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

    }

    if (cVar1 != '\0') {

      FUN_00401340(&DAT_007e20b8);

      if (*(int *)(local_4 + -4) != 1) {

        FUN_00404ef0(local_4,*(int *)(local_4 + -4) + -1);

      }

      puVar5 = (undefined4 *)(local_4 + -0x14);

      LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

      if ((LVar2 == 0) && (puVar5 != (undefined4 *)0x0)) {

        (**(code **)*puVar5)(1);

      }

    }

    FUN_00408670(&param_2,0,

                 "Copying chat to %s.  Run command again with no arguments to turn off logging.\n",

                 param_3);

    cVar1 = FUN_0057d670(&param_3);

    if (cVar1 == '\0') {

      FUN_00402710(&param_2,"Failed to redirect to file %s!\n",param_3);

    }

    uVar10 = *(undefined4 *)(param_1 + 0x8c);

    uVar9 = 1;

    uVar8 = 0;

    uVar3 = FUN_00403350(&local_4,0);

    FUN_005649f0(uVar3,uVar8,uVar9,uVar10);

    puVar5 = (undefined4 *)(local_4 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

    }

  }

  puVar5 = (undefined4 *)(param_2 + -0x14);

  iVar4 = (*pcVar6)(param_2 + -0x10);

  if ((iVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

    (**(code **)*puVar5)(1);

  }

LAB_0057f3de:

  puVar5 = (undefined4 *)(param_3 + -0x14);

  iVar4 = (*pcVar6)(param_3 + -0x10);

  if ((iVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

    (**(code **)*puVar5)(1);

  }

  return 1;

}





// --- FUN_0057f460 at 0x0057F460 (size: 58) ---


undefined4 FUN_0057f460(undefined4 param_1)



{

  undefined1 local_c [8];

  int local_4;

  

  FUN_0041aeb0(local_c,param_1);

  if (local_4 != 0) {

    return 0;

  }

  FUN_0057d780(param_1);

  return 1;

}





// --- FUN_0057f4a0 at 0x0057F4A0 (size: 85) ---


int FUN_0057f4a0(undefined4 param_1)



{

  undefined4 local_c;

  undefined4 local_8;

  int local_4;

  

  FUN_0041aeb0(&local_c,param_1);

  if (local_4 != 0) {

    FUN_00428ba0(local_c,local_8,local_4);

    return local_4;

  }

  return 0;

}





// --- FUN_0057f500 at 0x0057F500 (size: 934) ---


undefined4 FUN_0057f500(int param_1,undefined4 param_2,int param_3)



{

  LONG LVar1;

  

  if (param_1 == 0) {

    FUN_00401340("@help commands - Lists all commands.\n");

    if (iRamfffffffc != 1) {

      FUN_00404ef0(0,iRamfffffffc + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)0xfffffff0);

    if (LVar1 == 0) {

      (*(code *)*puRamffffffec)(1);

      return 1;

    }

  }

  else {

    FUN_0057e1d0(2,"@allegiances",param_3);

    FUN_00570060(0,&DAT_007db4d4,param_3);

    FUN_00570060(0,&DAT_007db4d0,param_3);

    FUN_00570060(0,&DAT_00795524,param_3);

    FUN_00570060(0,&DAT_007db4cc,param_3);

    FUN_00570060(0,&DAT_007db4c8,param_3);

    FUN_00570060(0,&DAT_007db4c4,param_3);

    FUN_0057bf70(2,"@chatting",param_3);

    FUN_0057c680(2,"@death",param_3);

    FUN_00401340("@emote - Performs a text emote.\n@emotes - Lists all standard emotes.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@fillcomps - Helps you buy components in bulk.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@saveui <filename> - Saves the current user interface.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@loadui <filename> - Loads a previously saved user interface.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@saveui <filename> - Saves the current user interface.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@loadui <filename> - Loads a previously saved user interface.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@lockui - Toggles the locked state of the UI layout.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340("@friends - Helps you manage your friends list.\n");

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340(

                "@house - Commands that help you manage your house, including guest and storage management.\n"

                );

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_00401340(

                "@squelch - Squelches a character or account.\n@unsquelch - Unsquelches a squelched character or account.\n@messagetypes - Lists all types of messages that can be squelched or filtered.\n"

                );

    if (*(int *)(param_3 + -4) != 1) {

      FUN_00404ef0(param_3,*(int *)(param_3 + -4) + -1);

    }

    LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

    if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(param_3 + -0x14))(1);

    }

    FUN_0057d1e0(2,"@status",param_3);

    FUN_0057d490(2,"@text",param_3);

  }

  return 1;

}





// --- FUN_0057f8b0 at 0x0057F8B0 (size: 166) ---


undefined1 FUN_0057f8b0(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined1 uVar2;

  int iVar3;

  undefined4 uVar4;

  LONG LVar5;

  undefined4 *puVar6;

  

  iVar1 = param_1;

  if (param_1 == 0) {

    FUN_00572760(0x26,&DAT_0083774c);

    return 0;

  }

  FUN_00589f20();

  iVar3 = FUN_004f1b20();

  if (iVar3 == 0) {

    FUN_00572760(0x414,&DAT_0083774c);

    return 0;

  }

  FUN_00576890(&param_1,iVar1,param_2);

  FUN_0055e1d0();

  uVar4 = FUN_005d4560();

  uVar2 = FUN_0057e820(iVar3,1,&param_1,uVar4);

  puVar6 = (undefined4 *)(param_1 + -0x14);

  LVar5 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar5 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return uVar2;

}





// --- FUN_0057f960 at 0x0057F960 (size: 137) ---


undefined1 FUN_0057f960(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined1 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  LONG LVar5;

  undefined4 *puVar6;

  

  iVar1 = param_1;

  if (param_1 == 0) {

    FUN_00572760(0x26,&DAT_0083774c);

    return 0;

  }

  FUN_00589f20();

  uVar3 = FUN_004f8d90();

  FUN_00576890(&param_1,iVar1,param_2);

  FUN_0055e1d0();

  uVar4 = FUN_005d45b0();

  uVar2 = FUN_0057e820(uVar3,2,&param_1,uVar4);

  puVar6 = (undefined4 *)(param_1 + -0x14);

  LVar5 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar5 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return uVar2;

}





// --- FUN_0057f9f0 at 0x0057F9F0 (size: 137) ---


undefined1 FUN_0057f9f0(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined1 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  LONG LVar5;

  undefined4 *puVar6;

  

  iVar1 = param_1;

  if (param_1 == 0) {

    FUN_00572760(0x26,&DAT_0083774c);

    return 0;

  }

  FUN_00589f20();

  uVar3 = FUN_004f8da0();

  FUN_00576890(&param_1,iVar1,param_2);

  FUN_0055e1d0();

  uVar4 = FUN_005d4600();

  uVar2 = FUN_0057e820(uVar3,3,&param_1,uVar4);

  puVar6 = (undefined4 *)(param_1 + -0x14);

  LVar5 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar5 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return uVar2;

}





// --- FUN_0057fa80 at 0x0057FA80 (size: 137) ---


undefined1 FUN_0057fa80(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined1 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  LONG LVar5;

  undefined4 *puVar6;

  

  iVar1 = param_1;

  if (param_1 == 0) {

    FUN_00572760(0x26,&DAT_0083774c);

    return 0;

  }

  FUN_00589f20();

  uVar3 = FUN_0051df70();

  FUN_00576890(&param_1,iVar1,param_2);

  FUN_0055e1d0();

  uVar4 = FUN_005d4650();

  uVar2 = FUN_0057e820(uVar3,4,&param_1,uVar4);

  puVar6 = (undefined4 *)(param_1 + -0x14);

  LVar5 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar5 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return uVar2;

}





// --- FUN_0057fb10 at 0x0057FB10 (size: 137) ---


undefined1 FUN_0057fb10(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined1 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  LONG LVar5;

  undefined4 *puVar6;

  

  iVar1 = param_1;

  if (param_1 == 0) {

    FUN_00572760(0x26,&DAT_0083774c);

    return 0;

  }

  FUN_00589f20();

  uVar3 = FUN_004f32b0();

  FUN_00576890(&param_1,iVar1,param_2);

  FUN_0055e1d0();

  uVar4 = FUN_005d46a0();

  uVar2 = FUN_0057e820(uVar3,5,&param_1,uVar4);

  puVar6 = (undefined4 *)(param_1 + -0x14);

  LVar5 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar5 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return uVar2;

}





// --- FUN_0057fba0 at 0x0057FBA0 (size: 134) ---


undefined1 FUN_0057fba0(int param_1,undefined4 param_2)



{

  undefined1 uVar1;

  undefined4 uVar2;

  int iVar3;

  LONG LVar4;

  undefined4 *puVar5;

  

  iVar3 = param_1;

  if (param_1 == 0) {

    FUN_00572760(0x26,&DAT_0083774c);

    return 0;

  }

  FUN_00589f20();

  uVar2 = FUN_004f24e0();

  FUN_00576890(&param_1,iVar3,param_2);

  iVar3 = FUN_00560f80();

  uVar1 = FUN_0057e820(uVar2,10,&param_1,iVar3 != 0);

  puVar5 = (undefined4 *)(param_1 + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

    (**(code **)*puVar5)(1);

  }

  return uVar1;

}





// --- FUN_0057fc30 at 0x0057FC30 (size: 137) ---


undefined1 FUN_0057fc30(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined1 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  LONG LVar5;

  undefined4 *puVar6;

  

  iVar1 = param_1;

  if (param_1 == 0) {

    FUN_00572760(0x26,&DAT_0083774c);

    return 0;

  }

  FUN_00589f20();

  uVar3 = FUN_006bd100();

  FUN_00576890(&param_1,iVar1,param_2);

  FUN_0055e1d0();

  uVar4 = FUN_005d46f0();

  uVar2 = FUN_0057e820(uVar3,6,&param_1,uVar4);

  puVar6 = (undefined4 *)(param_1 + -0x14);

  LVar5 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar5 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return uVar2;

}





// --- FUN_0057fcc0 at 0x0057FCC0 (size: 2605) ---


undefined4 FUN_0057fcc0(void)



{

  int *piVar1;

  LONG LVar2;

  char cVar3;

  undefined4 *puVar4;

  bool bVar5;

  int local_10;

  code *apcStack_c [2];

  int iStack_4;

  

  local_10 = 0;

  FUN_00401340(&DAT_007db4d4);

  piVar1 = (int *)FUN_0057f4a0(&local_10);

  puVar4 = (undefined4 *)(local_10 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

  if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

    (**(code **)*puVar4)(1);

  }

  if (piVar1 != (int *)0x0) {

    puVar4 = (undefined4 *)(*piVar1 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(*piVar1 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

    operator_delete(piVar1);

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    FUN_00401340(&DAT_007db4d4);

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[2] = (int)FUN_0057f8b0;

    piVar1[4] = (int)&LAB_005783f0;

    piVar1[1] = 0;

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    FUN_00401340("guild");

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[2] = (int)FUN_0057f8b0;

    piVar1[4] = (int)&LAB_005783f0;

    piVar1[1] = 0;

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    apcStack_c[0] = FUN_0057f8b0;

    FUN_00401340(&DAT_007e2168);

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[4] = (int)&LAB_005783f0;

    piVar1[1] = 0;

    piVar1[2] = (int)apcStack_c[0];

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    FUN_00401340("general");

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[2] = (int)FUN_0057f960;

    piVar1[4] = (int)&LAB_00578440;

    piVar1[1] = 0;

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    apcStack_c[0] = FUN_0057f960;

    FUN_00401340(&DAT_007e215c);

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[4] = (int)&LAB_00578440;

    piVar1[1] = 0;

    piVar1[2] = (int)apcStack_c[0];

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    FUN_00401340("trade");

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[2] = (int)FUN_0057f9f0;

    piVar1[4] = (int)&LAB_00578490;

    piVar1[1] = 0;

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    apcStack_c[0] = FUN_0057f9f0;

    FUN_00401340(&DAT_007e2150);

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[4] = (int)&LAB_00578490;

    piVar1[1] = 0;

    piVar1[2] = (int)apcStack_c[0];

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  cVar3 = '\0';

  piVar1 = (int *)FUN_005df0f5(0x18);

  if (piVar1 == (int *)0x0) {

    piVar1 = (int *)0x0;

  }

  else {

    FUN_00401340(&DAT_007e214c);

    *piVar1 = local_10;

    cVar3 = -0x80;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[2] = (int)FUN_0057fa80;

    piVar1[4] = (int)&LAB_005784e0;

    piVar1[1] = 0;

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (cVar3 < '\0') {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    apcStack_c[0] = FUN_0057fa80;

    FUN_00401340(&DAT_007e2144);

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[4] = (int)&LAB_005784e0;

    piVar1[1] = 0;

    piVar1[2] = (int)apcStack_c[0];

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    FUN_00401340("roleplay");

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[2] = (int)FUN_0057fb10;

    piVar1[4] = (int)&LAB_00578530;

    piVar1[1] = 0;

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    apcStack_c[0] = FUN_0057fb10;

    FUN_00401340(&DAT_007e2134);

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[4] = (int)&LAB_00578530;

    piVar1[1] = 0;

    piVar1[2] = (int)apcStack_c[0];

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    FUN_00401340("society");

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[2] = (int)FUN_0057fc30;

    piVar1[4] = (int)&LAB_005785d0;

    piVar1[1] = 0;

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    apcStack_c[0] = FUN_0057fc30;

    FUN_00401340(&DAT_007e2128);

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[4] = (int)&LAB_005785d0;

    piVar1[1] = 0;

    piVar1[2] = (int)apcStack_c[0];

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    FUN_00401340("olthoi");

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[2] = (int)FUN_0057fba0;

    piVar1[4] = (int)&LAB_00578580;

    piVar1[1] = 0;

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  piVar1 = (int *)FUN_005df0f5(0x18);

  bVar5 = piVar1 == (int *)0x0;

  if (bVar5) {

    piVar1 = (int *)0x0;

  }

  else {

    apcStack_c[0] = FUN_0057fba0;

    FUN_00401340(&DAT_007e211c);

    *piVar1 = local_10;

    InterlockedIncrement((LONG *)(local_10 + -0x10));

    piVar1[4] = (int)&LAB_00578580;

    piVar1[1] = 0;

    piVar1[2] = (int)apcStack_c[0];

    piVar1[3] = 0;

    piVar1[5] = 0;

  }

  FUN_0041aeb0(apcStack_c,piVar1);

  if (iStack_4 == 0) {

    FUN_0057d780(piVar1);

  }

  if (!bVar5) {

    puVar4 = (undefined4 *)(local_10 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_10 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  return 1;

}





