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

// --- FUN_00480180 at 0x00480180 (size: 1384) ---


void __thiscall FUN_00480180(int param_1,int param_2)



{

  char cVar1;

  undefined4 uVar2;

  int iVar3;

  int *piVar4;

  int iVar5;

  undefined4 uVar6;

  undefined4 uVar7;

  

  *(int *)(param_1 + 0x600) = param_2;

  uVar2 = FUN_0055e1d0();

  *(undefined4 *)(param_1 + 0x5fc) = uVar2;

  iVar3 = FUN_0055e1e0();

  piVar4 = (int *)FUN_00463c00(0x100003a7);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x604) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003a8);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x608) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003a9);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x60c) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003aa);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x610) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003af);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x624) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003b0);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x628) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003b1);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x62c) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003b2);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x630) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003b3);

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

    iVar5 = 0;

  }

  else {

    iVar5 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(int *)(param_1 + 0x634) = iVar5;

  if (iVar5 != 0) {

    iVar5 = FUN_00463c00(0x1000030a);

    if (iVar5 != 0) {

      FUN_00460820(0xd,1);

    }

    iVar5 = FUN_00463c00(0x1000030b);

    if (iVar5 != 0) {

      FUN_00460820(0xd,1);

    }

  }

  piVar4 = (int *)FUN_00463c00(0x100003b5);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x638) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003b6);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x63c) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003b7);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x640) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003b8);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x644) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x10000325);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x614) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x10000326);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x618) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x10000323);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x61c) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x10000324);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x620) = uVar2;

  uVar2 = FUN_00463c00(0x100003ae);

  *(undefined4 *)(param_1 + 0x64c) = uVar2;

  uVar2 = FUN_00463c00(0x100003b4);

  *(undefined4 *)(param_1 + 0x650) = uVar2;

  param_2 = 0;

  uVar2 = 0;

  uVar7 = 0;

  do {

    switch(param_2) {

    case 0:

      uVar2 = 0x1000030f;

      uVar7 = 0x10000318;

      break;

    case 1:

      uVar2 = 0x10000310;

      uVar7 = 0x10000319;

      break;

    case 2:

      uVar2 = 0x10000311;

      uVar7 = 0x1000031a;

      break;

    case 3:

      uVar2 = 0x10000312;

      uVar7 = 0x1000031b;

      break;

    case 4:

      uVar2 = 0x10000313;

      uVar7 = 0x1000031c;

      break;

    case 5:

      uVar2 = 0x10000314;

      uVar7 = 0x1000031d;

      break;

    case 6:

      uVar2 = 0x10000315;

      uVar7 = 0x1000031e;

      break;

    case 7:

      uVar2 = 0x10000316;

      uVar7 = 0x1000031f;

      break;

    case 8:

      uVar2 = 0x10000317;

      uVar7 = 0x10000320;

    }

    iVar5 = param_2 * 0x1c + param_1;

    uVar6 = FUN_00463c00(uVar2);

    *(undefined4 *)(iVar5 + 0x7e8) = uVar6;

    uVar6 = FUN_00463c00(uVar7);

    *(undefined4 *)(iVar5 + 0x7ec) = uVar6;

    param_2 = param_2 + 1;

  } while (param_2 < 9);

  uVar2 = FUN_00463c00(0x1000030e);

  *(undefined4 *)(param_1 + 0x654) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x10000321);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(0xb);

  }

  *(undefined4 *)(param_1 + 0x648) = uVar2;

  piVar4 = (int *)FUN_00463c00(0x100003bb);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar4 + 0x94))(0xd);

  }

  *(undefined4 *)(param_1 + 0x664) = uVar2;

  iVar5 = FUN_005df0f5(0x60);

  if (iVar5 == 0) {

    uVar2 = 0;

  }

  else {

    uVar2 = FUN_004ef310();

  }

  *(undefined4 *)(param_1 + 0x668) = uVar2;

  FUN_004ef3f0(*(undefined4 *)(param_1 + 0x664));

  *(undefined4 *)(param_1 + 0x6c4) = 0x43340000;

  FUN_004ef220(0x43340000);

  *(undefined4 *)(param_1 + 0x6b8) = 0;

  *(undefined4 *)(param_1 + 0x6bc) = 0;

  *(undefined4 *)(param_1 + 0x6c0) = 0;

  iVar3 = *(int *)(iVar3 + 0xd4);

  if (iVar3 == 0xc) {

    uVar7 = 0xbfeccccd;

    uVar2 = 0x3feccccd;

  }

  else if (iVar3 == 0xd) {

    uVar7 = 0xc0433333;

    uVar2 = 0x40300000;

  }

  else {

    uVar2 = 0x3fd33333;

    uVar7 = 0xbf59999a;

    if (iVar3 != 7) {

      uVar7 = 0xbf0ccccd;

    }

  }

  *(undefined4 *)(param_1 + 0x684) = uVar2;

  *(undefined4 *)(param_1 + 0x680) = uVar7;

  *(undefined4 *)(param_1 + 0x67c) = 0;

  *(undefined4 *)(param_1 + 0x694) = 0;

  *(undefined4 *)(param_1 + 0x698) = uVar7;

  *(undefined4 *)(param_1 + 0x69c) = uVar2;

  FUN_004ef240((undefined4 *)(param_1 + 0x694),(undefined4 *)(param_1 + 0x6b8));

  *(undefined1 *)(param_1 + 0x67a) = 0;

  FUN_0047d860(1);

  iVar3 = FUN_0055e1e0();

  if (*(int *)(iVar3 + 0xd8) == 1) {

    uVar2 = 2;

  }

  else {

    if (*(int *)(iVar3 + 0xd8) != 2) goto LAB_004806b8;

    uVar2 = 1;

  }

  FUN_0055e1e0(uVar2);

  FUN_005c7480(uVar2);

  FUN_0047eca0();

LAB_004806b8:

  cVar1 = FUN_004603a0();

  if (cVar1 != '\0') {

    FUN_004ef660();

  }

  FUN_0047e3d0();

  FUN_0047e610(*(undefined4 *)(param_1 + 0x7d8));

  return;

}





// --- FUN_00480710 at 0x00480710 (size: 51) ---


void __thiscall FUN_00480710(undefined4 *param_1,int param_2)



{

  *param_1 = &PTR_FUN_007a11bc;

  param_1[1] = *(undefined4 *)(param_2 + 4);

  param_1[2] = *(undefined4 *)(param_2 + 8);

  param_1[3] = *(undefined4 *)(param_2 + 0xc);

  param_1[4] = *(undefined4 *)(param_2 + 0x10);

  param_1[5] = *(undefined4 *)(param_2 + 0x14);

  param_1[6] = *(undefined4 *)(param_2 + 0x18);

  return;

}





// --- FUN_00480760 at 0x00480760 (size: 27) ---


int * __thiscall FUN_00480760(int *param_1,int *param_2)



{

  int iVar1;

  

  iVar1 = *param_2;

  *param_1 = iVar1;

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

  return param_1;

}





// --- FUN_00480780 at 0x00480780 (size: 42) ---


uint __thiscall FUN_00480780(int param_1,int param_2)



{

  uint uVar1;

  int *piVar2;

  

  uVar1 = 0;

  if (*(uint *)(param_1 + 0x610) != 0) {

    piVar2 = *(int **)(param_1 + 0x608);

    do {

      if (*piVar2 == param_2) {

        return uVar1;

      }

      uVar1 = uVar1 + 1;

      piVar2 = piVar2 + 1;

    } while (uVar1 < *(uint *)(param_1 + 0x610));

  }

  return 0xffffffff;

}





// --- FUN_004807b0 at 0x004807B0 (size: 96) ---


int __fastcall FUN_004807b0(int param_1)



{

  LONG *pLVar1;

  

  pLVar1 = (LONG *)(PTR_DAT_00818340 + -0x10);

  *(undefined **)(param_1 + 0x18) = PTR_DAT_00818340;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(PTR_DAT_00818340 + -0x10);

  *(undefined **)(param_1 + 0x1c) = PTR_DAT_00818340;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(PTR_DAT_00818340 + -0x10);

  *(undefined **)(param_1 + 0x20) = PTR_DAT_00818340;

  InterlockedIncrement(pLVar1);

  *(undefined4 *)(param_1 + 0x44) = 0;

  *(undefined4 *)(param_1 + 0x48) = 0;

  *(undefined4 *)(param_1 + 0x4c) = 0;

  *(undefined4 *)(param_1 + 0x54) = 0;

  *(undefined4 *)(param_1 + 0x58) = 0;

  *(undefined ***)(param_1 + 0x40) = &PTR_FUN_007a11bc;

  *(undefined4 *)(param_1 + 0x50) = 1;

  return param_1;

}





// --- FUN_00480810 at 0x00480810 (size: 106) ---


void __fastcall FUN_00480810(int param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)(*(int *)(param_1 + 0x20) + -0x14);

  *(undefined ***)(param_1 + 0x40) = &PTR_FUN_0079385c;

  LVar1 = InterlockedDecrement((LONG *)(*(int *)(param_1 + 0x20) + -0x10));

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

    (**(code **)*puVar2)(1);

  }

  puVar2 = (undefined4 *)(*(int *)(param_1 + 0x1c) + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(*(int *)(param_1 + 0x1c) + -0x10));

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

    (**(code **)*puVar2)(1);

  }

  puVar2 = (undefined4 *)(*(int *)(param_1 + 0x18) + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(*(int *)(param_1 + 0x18) + -0x10));

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

    (**(code **)*puVar2)(1);

  }

  return;

}





// --- FUN_00480880 at 0x00480880 (size: 184) ---


undefined4 * __thiscall FUN_00480880(undefined4 *param_1,undefined4 *param_2)



{

  int iVar1;

  

  *param_1 = *param_2;

  param_1[1] = param_2[1];

  param_1[2] = param_2[2];

  param_1[3] = param_2[3];

  param_1[4] = param_2[4];

  param_1[5] = param_2[5];

  iVar1 = param_2[6];

  param_1[6] = iVar1;

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

  iVar1 = param_2[7];

  param_1[7] = iVar1;

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

  iVar1 = param_2[8];

  param_1[8] = iVar1;

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

  param_1[9] = param_2[9];

  param_1[10] = param_2[10];

  param_1[0xb] = param_2[0xb];

  param_1[0xc] = param_2[0xc];

  param_1[0xd] = param_2[0xd];

  *(undefined1 *)(param_1 + 0xe) = *(undefined1 *)(param_2 + 0xe);

  *(undefined1 *)((int)param_1 + 0x39) = *(undefined1 *)((int)param_2 + 0x39);

  param_1[0xf] = param_2[0xf];

  param_1[0x10] = &PTR_FUN_007a11bc;

  param_1[0x11] = param_2[0x11];

  param_1[0x12] = param_2[0x12];

  param_1[0x13] = param_2[0x13];

  param_1[0x14] = param_2[0x14];

  param_1[0x15] = param_2[0x15];

  param_1[0x16] = param_2[0x16];

  return param_1;

}





// --- FUN_00480940 at 0x00480940 (size: 64) ---


undefined4 * __thiscall FUN_00480940(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a11d0;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00480980 at 0x00480980 (size: 64) ---


undefined4 * FUN_00480980(undefined4 *param_1,undefined4 param_2,wchar_t *param_3)



{

  int iVar1;

  

  iVar1 = _vscwprintf(param_3,&stack0x00000010);

  FUN_004022d0(iVar1);

  _vsnwprintf((wchar_t *)*param_1,iVar1 + 1,param_3,&stack0x00000010);

  return param_1;

}





// --- FUN_004809c0 at 0x004809C0 (size: 750) ---


void FUN_004809c0(int param_1)



{

  int iVar1;

  char cVar2;

  int iVar3;

  undefined4 uVar4;

  LONG LVar5;

  int iVar6;

  int *piVar7;

  undefined4 *puVar8;

  int iStack_1c;

  int local_18;

  int iStack_14;

  int iStack_10;

  int iStack_c;

  int iStack_8;

  int iStack_4;

  

  iVar3 = FUN_0055e1e0();

  iVar1 = param_1;

  uVar4 = FUN_005c5b30(*(undefined4 *)(param_1 + 0x24));

  *(undefined4 *)(iVar1 + 0x28) = uVar4;

  uVar4 = FUN_00480980(&param_1,0,&DAT_007a11d4,uVar4);

  FUN_0046a740(uVar4);

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

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

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

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

  }

  iVar6 = *(int *)(iVar1 + 0x3c);

  if (iVar6 == 1) {

    if (*(int *)(iVar1 + 0x2c) < 999) {

      uVar4 = FUN_00480980(&iStack_8,0,&DAT_007a11d4,*(int *)(iVar1 + 0x2c));

      FUN_0046a740(uVar4);

      iStack_1c = iStack_8;

    }

    else {

      FUN_00402730(&DAT_00795320);

      FUN_0046a740(&iStack_1c);

    }

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

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

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

    }

    uVar4 = FUN_00480980(&iStack_4,0,&DAT_007a11d4,0);

    FUN_0046a740(uVar4);

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

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

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

    }

    (**(code **)(**(int **)(iVar1 + 0x14) + 0x9c))(0x1000001a);

    piVar7 = *(int **)(iVar1 + 0x10);

    if (*(int *)(iVar1 + 0x2c) <= *(int *)(iVar3 + 0x1b8)) goto LAB_00480bba;

  }

  else {

    if (iVar6 == 2) {

      iVar6 = *(int *)(iVar1 + 0x30) - *(int *)(iVar1 + 0x2c);

      if (iVar6 < 999) {

        uVar4 = FUN_00480980(&iStack_10,0,&DAT_007a11d4,iVar6);

        FUN_0046a740(uVar4);

        iVar6 = iStack_10;

      }

      else {

        FUN_00402730(&DAT_00795320);

        FUN_0046a740(&param_1);

        iVar6 = param_1;

      }

      LVar5 = InterlockedDecrement((LONG *)(iVar6 + -0x10));

      if ((LVar5 == 0) && ((undefined4 *)(iVar6 + -0x14) != (undefined4 *)0x0)) {

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

      }

      uVar4 = FUN_00480980(&iStack_c,0,&DAT_007a11d4,*(undefined4 *)(iVar1 + 0x2c));

      FUN_0046a740(uVar4);

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

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

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

      }

      if (*(int *)(iVar3 + 0x1b8) < *(int *)(iVar1 + 0x30) - *(int *)(iVar1 + 0x2c)) {

        (**(code **)(**(int **)(iVar1 + 0x10) + 0x9c))(0x1000001a);

      }

      else {

        (**(code **)(**(int **)(iVar1 + 0x10) + 0x9c))(0x1000001b);

      }

      cVar2 = *(char *)(iVar1 + 0x38);

    }

    else {

      if (iVar6 != 3) {

        return;

      }

      uVar4 = FUN_00480980(&local_18,0,&DAT_007a11d4,0);

      FUN_0046a740(uVar4);

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

      if ((LVar5 == 0) && ((undefined4 *)(local_18 + -0x14) != (undefined4 *)0x0)) {

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

      }

      uVar4 = FUN_00480980(&iStack_14,0,&DAT_007a11d4,

                           *(int *)(iVar1 + 0x30) - *(int *)(iVar1 + 0x2c));

      FUN_0046a740(uVar4);

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

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

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

      }

      (**(code **)(**(int **)(iVar1 + 0x10) + 0x9c))(0x1000001a);

      cVar2 = *(char *)(iVar1 + 0x39);

    }

    piVar7 = *(int **)(iVar1 + 0x14);

    if (cVar2 != '\0') {

LAB_00480bba:

      (**(code **)(*piVar7 + 0x9c))(0x1000001b);

      return;

    }

  }

  (**(code **)(*piVar7 + 0x9c))(0x1000001a);

  return;

}





// --- FUN_00480cb0 at 0x00480CB0 (size: 90) ---


void FUN_00480cb0(void)



{

  int iVar1;

  undefined4 uVar2;

  LONG LVar3;

  int local_4;

  

  iVar1 = FUN_0055e1e0();

  uVar2 = FUN_00480980(&local_4,0,&DAT_007a11d4,*(undefined4 *)(iVar1 + 0x1b8));

  FUN_0046a740(uVar2);

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

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

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

  }

  return;

}





// --- FUN_00480d10 at 0x00480D10 (size: 237) ---


void FUN_00480d10(void)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  LONG LVar4;

  int iVar5;

  undefined4 *puVar6;

  undefined1 local_68 [12];

  undefined1 local_5c [24];

  int iStack_44;

  int local_40;

  int local_3c;

  undefined **local_1c;

  

  piVar3 = (int *)FUN_0052dcf0(local_68);

  iVar5 = piVar3[2];

  iVar1 = *piVar3;

  piVar3 = (int *)piVar3[1];

  do {

    if (iVar5 == 0) {

      FUN_00480cb0();

      return;

    }

    FUN_00480880(iVar5 + 8);

    FUN_004809c0(local_5c);

    iVar2 = *(int *)(iVar5 + 4);

    iVar5 = iVar2;

    if (iVar2 == 0) {

      do {

        piVar3 = piVar3 + 1;

        iVar5 = iVar2;

        if (piVar3 == (int *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4)) break;

        iVar5 = *piVar3;

      } while (iVar5 == 0);

    }

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

    local_1c = &PTR_FUN_0079385c;

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

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

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

    }

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

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

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

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

    }

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

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

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

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

    }

  } while( true );

}





// --- FUN_00480e00 at 0x00480E00 (size: 283) ---


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



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  uint *puVar4;

  int *piVar5;

  

  iVar2 = *(int *)(param_1 + 0x67c);

  uVar1 = 0;

  if (*(uint *)(iVar2 + 0x610) != 0) {

    piVar5 = *(int **)(iVar2 + 0x608);

    do {

      if (*piVar5 == param_3) goto LAB_00480e31;

      uVar1 = uVar1 + 1;

      piVar5 = piVar5 + 1;

    } while (uVar1 < *(uint *)(iVar2 + 0x610));

  }

  uVar1 = 0xffffffff;

LAB_00480e31:

  if (param_4 == 0) {

    uVar3 = *(uint *)(iVar2 + 0x610);

  }

  else {

    uVar3 = 0;

    if (*(uint *)(iVar2 + 0x610) != 0) {

      puVar4 = *(uint **)(iVar2 + 0x608);

      do {

        if (*puVar4 == param_4) goto joined_r0x00480e76;

        uVar3 = uVar3 + 1;

        puVar4 = puVar4 + 1;

      } while (uVar3 < *(uint *)(iVar2 + 0x610));

    }

    uVar3 = 0xffffffff;

  }

joined_r0x00480e76:

  do {

    uVar1 = uVar1 + 1;

    if ((int)uVar3 <= (int)uVar1) {

      FUN_0046eb20(*param_2,uVar1);

      return;

    }

    FUN_0046dc50(uVar1);

    FUN_00460a60(0x1000000a,&param_4);

    for (puVar4 = *(uint **)(*(int *)(param_1 + 0x6e4) + (param_4 % *(uint *)(param_1 + 0x6ec)) * 4)

        ; puVar4 != (uint *)0x0; puVar4 = (uint *)puVar4[1]) {

      if (*puVar4 == param_4) {

        if (((puVar4 != (uint *)0x0) && (puVar4 != (uint *)0xfffffff8)) &&

           (iVar2 = wcscmp((wchar_t *)param_2[6],(wchar_t *)puVar4[8]), iVar2 < 0)) {

          FUN_0046eb20(*param_2,uVar1);

          return;

        }

        break;

      }

    }

  } while( true );

}





// --- FUN_00480f20 at 0x00480F20 (size: 143) ---


undefined4 * __thiscall FUN_00480f20(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_007a11d0;

  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_00480fb0 at 0x00480FB0 (size: 162) ---


void __thiscall FUN_00480fb0(int param_1,undefined4 *param_2)



{

  int iVar1;

  

  FUN_0055e1e0();

  FUN_0046e3a0(*param_2);

  FUN_004809c0(param_2);

  iVar1 = param_2[0xf];

  if (iVar1 == 1) {

    if ((int)param_2[0xd] < 2) {

      FUN_00480e00(param_2,*(undefined4 *)(param_1 + 0x660),*(undefined4 *)(param_1 + 0x664));

      return;

    }

    FUN_00480e00(param_2,*(undefined4 *)(param_1 + 0x664),0);

  }

  else {

    if (iVar1 == 2) {

      FUN_00480e00(param_2,*(undefined4 *)(param_1 + 0x65c),*(undefined4 *)(param_1 + 0x660));

      return;

    }

    if (iVar1 == 3) {

      FUN_00480e00(param_2,*(undefined4 *)(param_1 + 0x658),*(undefined4 *)(param_1 + 0x65c));

      return;

    }

  }

  return;

}





// --- FUN_00481060 at 0x00481060 (size: 182) ---


void FUN_00481060(undefined4 param_1)



{

  char cVar1;

  int iVar2;

  int iVar3;

  undefined4 local_4;

  

  cVar1 = FUN_00460a60(0x1000000a,&param_1);

  if (cVar1 == '\0') {

    return;

  }

  local_4 = param_1;

  iVar2 = FUN_00477380(&local_4);

  if (iVar2 == 0) {

    return;

  }

  iVar3 = FUN_0055e1e0();

  if (*(int *)(iVar2 + 0x3c) == 1) {

    if ((*(int *)(iVar3 + 0x1b8) < *(int *)(iVar2 + 0x2c)) ||

       (iVar3 = FUN_005c4c00(*(undefined4 *)(iVar2 + 0x24),2), iVar3 == 0)) goto LAB_00481109;

    *(undefined4 *)(iVar2 + 0x3c) = 2;

  }

  else {

    if (((*(int *)(iVar2 + 0x3c) != 2) ||

        (*(int *)(iVar3 + 0x1b8) < *(int *)(iVar2 + 0x30) - *(int *)(iVar2 + 0x2c))) ||

       (iVar3 = FUN_005c4c00(*(undefined4 *)(iVar2 + 0x24),3), iVar3 == 0)) goto LAB_00481109;

    *(undefined4 *)(iVar2 + 0x3c) = 3;

  }

  FUN_00480fb0(iVar2);

LAB_00481109:

  FUN_00480d10();

  return;

}





// --- FUN_00481120 at 0x00481120 (size: 169) ---


void FUN_00481120(undefined4 param_1)



{

  char cVar1;

  int iVar2;

  int iVar3;

  undefined4 local_4;

  

  cVar1 = FUN_00460a60(0x1000000a,&param_1);

  if (cVar1 == '\0') {

    return;

  }

  local_4 = param_1;

  iVar2 = FUN_00477380(&local_4);

  if (iVar2 == 0) {

    return;

  }

  FUN_0055e1e0();

  if ((*(int *)(iVar2 + 0x3c) == 3) && (*(char *)(iVar2 + 0x39) != '\0')) {

    iVar3 = FUN_005c4c00(*(undefined4 *)(iVar2 + 0x24),2);

    if (iVar3 == 0) goto LAB_004811bc;

    *(undefined4 *)(iVar2 + 0x3c) = 2;

  }

  else {

    if ((*(int *)(iVar2 + 0x3c) != 2) ||

       ((*(char *)(iVar2 + 0x38) == '\0' ||

        (iVar3 = FUN_005c4c00(*(undefined4 *)(iVar2 + 0x24),1), iVar3 == 0)))) goto LAB_004811bc;

    *(undefined4 *)(iVar2 + 0x3c) = 1;

  }

  FUN_00480fb0(iVar2);

LAB_004811bc:

  FUN_00480d10();

  return;

}





// --- FUN_004811d0 at 0x004811D0 (size: 1077) ---


void FUN_004811d0(int param_1)



{

  uint uVar1;

  int iVar2;

  undefined *puVar3;

  uint uVar4;

  uint uVar5;

  LONG LVar6;

  int *piVar7;

  size_t sVar8;

  LONG *lpAddend;

  undefined4 *puVar9;

  uint *puVar10;

  wchar_t *pwVar11;

  int local_130;

  wchar_t *pwStack_12c;

  undefined4 *local_128;

  int iStack_124;

  int iStack_120;

  uint uStack_118;

  uint uStack_110;

  uint uStack_10c;

  uint uStack_104;

  undefined1 auStack_100 [256];

  

  local_130 = FUN_0055e1e0();

  uVar1 = *(uint *)(*(int *)(local_130 + 0x248) + 0x44);

  if ((uVar1 != 0) && (iVar2 = *(int *)(*(int *)(local_130 + 0x248) + 0x40), iVar2 != 0)) {

    for (puVar10 = *(uint **)(iVar2 + (*(uint *)(param_1 + 0x24) % uVar1) * 4);

        puVar10 != (uint *)0x0; puVar10 = (uint *)puVar10[0x18]) {

      if (*(uint *)(param_1 + 0x24) == *puVar10) {

        puVar10 = puVar10 + 2;

        goto LAB_00481227;

      }

    }

  }

  puVar10 = (uint *)0x0;

LAB_00481227:

  puVar3 = *(undefined **)(param_1 + 0x20);

  puVar9 = (undefined4 *)(param_1 + 0x20);

  local_128 = puVar9;

  if (puVar3 != PTR_DAT_00818340) {

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

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

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

    }

    lpAddend = (LONG *)(PTR_DAT_00818340 + -0x10);

    *puVar9 = PTR_DAT_00818340;

    InterlockedIncrement(lpAddend);

  }

  if (puVar10 == (uint *)0x0) {

    return;

  }

  uStack_10c = puVar10[0xd];

  uStack_118 = puVar10[10];

  uStack_110 = puVar10[0xc];

  uVar1 = puVar10[0xb];

  uVar4 = puVar10[0xe];

  uVar5 = puVar10[0xf];

  uStack_104 = uVar5;

  piVar7 = (int *)FUN_00404a40(0,"Formula : ");

  iVar2 = *(int *)(*piVar7 + -4);

  if (iVar2 != 1) {

    FUN_00402490(*piVar7,iVar2 + -1);

  }

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

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

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

  }

  if ((uVar1 == 0) || (iStack_124 = 1, uVar4 == 0)) {

    iStack_124 = 0;

  }

  if ((uStack_110 == 0) || (iStack_120 = 1, uVar5 == 0)) {

    iStack_120 = 0;

  }

  if (iStack_124 != 0) {

    if (iStack_120 != 0) {

      sVar8 = wcslen(L"(");

      FUN_004022d0(sVar8);

      wcscpy(pwStack_12c,L"(");

      if (*(int *)(pwStack_12c + -2) != 1) {

        FUN_00402490(pwStack_12c,*(int *)(pwStack_12c + -2) + -1);

      }

      pwVar11 = pwStack_12c + -10;

      LVar6 = InterlockedDecrement((LONG *)(pwStack_12c + -8));

      if ((LVar6 == 0) && (pwVar11 != (wchar_t *)0x0)) {

        (*(code *)**(undefined4 **)pwVar11)(1);

      }

    }

    FUN_005c4a00(uVar4,auStack_100);

    if (uVar1 < 2) {

      piVar7 = (int *)FUN_00404a40(0,auStack_100);

    }

    else {

      piVar7 = (int *)FUN_00480980(&pwStack_12c,0,L"(%u x %s)",uVar1,auStack_100);

    }

    iVar2 = *(int *)(*piVar7 + -4);

    if (iVar2 != 1) {

      FUN_00402490(*piVar7,iVar2 + -1);

    }

    pwVar11 = pwStack_12c + -10;

    LVar6 = InterlockedDecrement((LONG *)(pwStack_12c + -8));

    if ((LVar6 == 0) && (pwVar11 != (wchar_t *)0x0)) {

      (*(code *)**(undefined4 **)pwVar11)(1);

    }

    if (iStack_120 == 0) goto LAB_004814f8;

    sVar8 = wcslen(L" + ");

    FUN_004022d0(sVar8);

    wcscpy(pwStack_12c,L" + ");

    if (*(int *)(pwStack_12c + -2) != 1) {

      FUN_00402490(pwStack_12c,*(int *)(pwStack_12c + -2) + -1);

    }

    LVar6 = InterlockedDecrement((LONG *)(pwStack_12c + -8));

    if ((LVar6 == 0) && (pwStack_12c + -10 != (wchar_t *)0x0)) {

      (*(code *)**(undefined4 **)(pwStack_12c + -10))(1);

    }

  }

  if (iStack_120 != 0) {

    FUN_005c4a00(uStack_104,auStack_100);

    if (uStack_110 < 2) {

      piVar7 = (int *)FUN_00404a40(0,auStack_100);

    }

    else {

      piVar7 = (int *)FUN_00480980(&local_130,0,L"(%u x %s)",uStack_110,auStack_100);

    }

    iVar2 = *(int *)(*piVar7 + -4);

    if (iVar2 != 1) {

      FUN_00402490(*piVar7,iVar2 + -1);

    }

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

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

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

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

    }

  }

LAB_004814f8:

  if ((iStack_124 != 0) && (iStack_120 != 0)) {

    piVar7 = (int *)FUN_00404a40(0,&DAT_00798584);

    iVar2 = *(int *)(*piVar7 + -4);

    if (iVar2 != 1) {

      FUN_00402490(*piVar7,iVar2 + -1);

    }

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

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

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

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

    }

  }

  if (uStack_10c != 1) {

    piVar7 = (int *)FUN_00480980(&local_130,0,L" / %u",uStack_10c);

    iVar2 = *(int *)(*piVar7 + -4);

    if (iVar2 != 1) {

      FUN_00402490(*piVar7,iVar2 + -1);

    }

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

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

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

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

    }

  }

  if (uStack_118 != 0) {

    piVar7 = (int *)FUN_00480980(&local_130,0,L" +%u",uStack_118);

    iVar2 = *(int *)(*piVar7 + -4);

    if (iVar2 != 1) {

      FUN_00402490(*piVar7,iVar2 + -1);

    }

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

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

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

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

    }

  }

  return;

}





// --- FUN_00481610 at 0x00481610 (size: 468) ---


void FUN_00481610(undefined *param_1)



{

  char cVar1;

  int iVar2;

  undefined4 uVar3;

  size_t sVar4;

  int iVar5;

  LONG LVar6;

  undefined4 *puVar7;

  wchar_t *pwVar8;

  undefined *local_8;

  int local_4;

  

  if ((param_1 == (undefined *)0x0) || (cVar1 = FUN_00460a60(0x1000000a,&local_4), cVar1 == '\0')) {

LAB_004817c6:

    FUN_00467ae0();

    FUN_00467ae0();

    return;

  }

  param_1 = (undefined *)local_4;

  iVar2 = FUN_00477380(&param_1);

  if (iVar2 == 0) goto LAB_004817c6;

  FUN_0055e1e0();

  param_1 = PTR_DAT_00818340;

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

  local_8 = PTR_DAT_00818340;

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

  FUN_004811d0(iVar2);

  iVar5 = *(int *)(*(int *)(iVar2 + 0x18) + -4);

  if (iVar5 != 1) {

    FUN_00402490(*(int *)(iVar2 + 0x18),iVar5 + -1);

  }

  uVar3 = FUN_005c5b30(*(undefined4 *)(iVar2 + 0x24));

  FUN_004300a0(&local_8,L" (%d)\n",uVar3);

  iVar5 = *(int *)(*(int *)(iVar2 + 0x1c) + -4);

  if (iVar5 != 1) {

    FUN_00402490(*(int *)(iVar2 + 0x1c),iVar5 + -1);

  }

  sVar4 = wcslen(L"\n");

  FUN_00402490(&DAT_0079d2e0,sVar4);

  iVar5 = FUN_005c4be0(*(undefined4 *)(iVar2 + 0x24));

  if (iVar5 == 2) {

    pwVar8 = L"Training Bonus  +5\n";

  }

  else {

    if (iVar5 != 3) goto LAB_0048172c;

    pwVar8 = L"Specialization Bonus  +10\n";

  }

  FUN_0040b8f0(pwVar8);

LAB_0048172c:

  iVar5 = *(int *)(*(int *)(iVar2 + 0x20) + -4);

  if (iVar5 != 1) {

    FUN_00402490(*(int *)(iVar2 + 0x20),iVar5 + -1);

  }

  sVar4 = wcslen(L"\n");

  FUN_00402490(&DAT_0079d2e0,sVar4);

  FUN_0046a740(&local_8);

  FUN_0046a740(&param_1);

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

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

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

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

  }

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

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

  if (LVar6 != 0) {

    return;

  }

  if (puVar7 == (undefined4 *)0x0) {

    return;

  }

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

  return;

}





// --- FUN_004817f0 at 0x004817F0 (size: 130) ---


void __fastcall FUN_004817f0(int param_1)



{

  int iVar1;

  void *pvVar2;

  void *pvVar3;

  int *piVar4;

  void *pvVar5;

  

  iVar1 = *(int *)(param_1 + 0x6c);

  do {

    if (iVar1 == 0) {

      return;

    }

    piVar4 = *(int **)(param_1 + 100);

    while (piVar4 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

      if (**(int **)(param_1 + 100) != 0) {

        piVar4 = *(int **)(param_1 + 100);

        pvVar5 = (void *)*piVar4;

        goto LAB_0048182f;

      }

      piVar4 = *(int **)(param_1 + 100) + 1;

      *(int **)(param_1 + 100) = piVar4;

    }

    piVar4 = (int *)0x0;

    pvVar5 = (void *)0x0;

LAB_0048182f:

    pvVar3 = (void *)*piVar4;

    if (pvVar3 == pvVar5) {

LAB_00481842:

      *piVar4 = *(int *)((int)pvVar3 + 4);

    }

    else {

      do {

        pvVar2 = pvVar3;

        pvVar3 = *(void **)((int)pvVar2 + 4);

      } while (pvVar3 != pvVar5);

      if (pvVar2 == (void *)0x0) goto LAB_00481842;

      *(undefined4 *)((int)pvVar2 + 4) = *(undefined4 *)((int)pvVar3 + 4);

    }

    *(int *)(param_1 + 0x6c) = *(int *)(param_1 + 0x6c) + -1;

    if (pvVar5 != (void *)0x0) {

      FUN_00480810();

      operator_delete(pvVar5);

    }

    iVar1 = *(int *)(param_1 + 0x6c);

  } while( true );

}





// --- FUN_00481880 at 0x00481880 (size: 161) ---


void FUN_00481880(int *param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = *param_1;

  if (iVar1 == 0x10000304) {

    if (param_1[2] != 1) goto LAB_00481913;

    uVar2 = (**(code **)(*(int *)param_1[1] + 0xa0))();

    FUN_00481060(uVar2);

  }

  else {

    if (iVar1 != 0x10000305) {

      if ((iVar1 == 0x100003f7) && (param_1[2] == 4)) {

        uVar2 = FUN_0046cf60();

        uVar2 = FUN_0046dc50(uVar2);

        FUN_00481610(uVar2);

        FUN_00462420(param_1);

        return;

      }

      goto LAB_00481913;

    }

    if (param_1[2] != 1) goto LAB_00481913;

    uVar2 = (**(code **)(*(int *)param_1[1] + 0xa0))();

    FUN_00481120(uVar2);

  }

  FUN_0046dc70(uVar2,1);

LAB_00481913:

  FUN_00462420(param_1);

  return;

}





// --- FUN_00481930 at 0x00481930 (size: 100) ---


undefined4 FUN_00481930(undefined4 *param_1,undefined4 param_2)



{

  char cVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(100);

  if (puVar2 == (undefined4 *)0x0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = *param_1;

    puVar2[1] = 0;

    FUN_00480880(param_2);

  }

  cVar1 = FUN_0042bd40(puVar2);

  if (cVar1 == '\0') {

    if (puVar2 != (undefined4 *)0x0) {

      FUN_00480810();

      operator_delete(puVar2);

    }

    return 0;

  }

  return 1;

}





// --- FUN_004819a0 at 0x004819A0 (size: 82) ---


undefined4 * __thiscall FUN_004819a0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a128c;

  FUN_004817f0();

  param_1[1] = &PTR_FUN_007a11d0;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00481a00 at 0x00481A00 (size: 100) ---


undefined4 * __thiscall FUN_00481a00(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00472670(param_2,param_3);

  param_1[0x17e] = &PTR_FUN_007ccb60;

  *param_1 = &PTR_FUN_007a1290;

  param_1[0x17e] = &PTR_FUN_007ccb60;

  FUN_004807b0();

  param_1[0x19d] = 0;

  param_1[0x19f] = 0;

  param_1[0x1a0] = &PTR_FUN_007a128c;

  FUN_00480f20(0x17);

  return param_1;

}





// --- FUN_00481aa0 at 0x00481AA0 (size: 138) ---


void __fastcall FUN_00481aa0(undefined4 *param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a1290;

  *puVar1 = &PTR_FUN_007ccb60;

  piVar2 = (int *)FUN_0043c680();

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

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  param_1[0x1a0] = &PTR_FUN_007a128c;

  FUN_004817f0();

  param_1[0x1a1] = &PTR_FUN_007a11d0;

  if ((undefined4 *)param_1[0x1b9] != param_1 + 0x1a2) {

    operator_delete__((undefined4 *)param_1[0x1b9]);

  }

  param_1[0x1b9] = 0;

  param_1[0x1ba] = 0;

  param_1[0x1bb] = 0;

  param_1[0x1bc] = 0;

  FUN_00480810();

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  return;

}





// --- FUN_00481b60 at 0x00481B60 (size: 30) ---


void * __thiscall FUN_00481b60(void *param_1,byte param_2)



{

  FUN_00481aa0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00481b80 at 0x00481B80 (size: 19) ---


void FUN_00481b80(void)



{

  FUN_00460270(0x1000003b,&LAB_00481b30);

  return;

}





// --- FUN_00481ba0 at 0x00481BA0 (size: 1503) ---


void __fastcall FUN_00481ba0(int param_1)



{

  int iVar1;

  undefined *puVar2;

  undefined4 uVar3;

  int *piVar4;

  undefined4 uVar5;

  LONG LVar6;

  int iVar7;

  int *piVar8;

  int iVar9;

  uint uVar10;

  uint *puVar11;

  undefined4 *puVar12;

  undefined4 *puVar13;

  undefined4 uVar14;

  int iStack_184;

  int iStack_180;

  int iStack_17c;

  int iStack_178;

  undefined4 uStack_174;

  undefined4 uStack_170;

  int local_16c;

  undefined4 uStack_168;

  undefined4 uStack_164;

  int iStack_160;

  int *piStack_158;

  int *piStack_150;

  undefined4 uStack_14c;

  undefined4 uStack_148;

  undefined4 uStack_144;

  int iStack_140;

  undefined4 uStack_13c;

  undefined1 auStack_138 [12];

  int iStack_12c;

  undefined4 uStack_128;

  uint uStack_124;

  uint uStack_120;

  uint uStack_11c;

  undefined1 uStack_118;

  undefined1 uStack_117;

  undefined4 uStack_114;

  uint uStack_10c;

  uint uStack_108;

  uint uStack_104;

  uint uStack_100;

  uint uStack_fc;

  uint uStack_f8;

  undefined1 auStack_c0 [52];

  int iStack_8c;

  uint uStack_84;

  

  local_16c = param_1;

  FUN_0046e460();

  iStack_184 = 0;

  do {

    puVar2 = PTR_DAT_00818340;

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

    FUN_0042dc80();

    FUN_0042dc80();

    uVar3 = FUN_0046f670(0,0);

    piVar4 = (int *)FUN_00463c00(0x100002f6);

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

      (**(code **)(*piVar4 + 0x94))(0xc);

    }

    uVar14 = 0x10000002;

    if (iStack_184 == 0) {

      uVar5 = FUN_004016b0("ID_CharGen_Specialized");

      FUN_0042c9c0(uVar5,uVar14);

      uVar5 = 0x10000002;

      uVar14 = FUN_004016b0("ID_CharGen_Specialized_Tooltip",0x10000002);

      FUN_0042c9c0(uVar14,uVar5);

      *(undefined4 *)(param_1 + 0x658) = uVar3;

    }

    else if (iStack_184 == 1) {

      uVar5 = FUN_004016b0("ID_CharGen_Trained");

      FUN_0042c9c0(uVar5,uVar14);

      uVar5 = 0x10000002;

      uVar14 = FUN_004016b0("ID_CharGen_Trained_Tooltip",0x10000002);

      FUN_0042c9c0(uVar14,uVar5);

      *(undefined4 *)(param_1 + 0x65c) = uVar3;

    }

    else if (iStack_184 == 2) {

      uVar5 = FUN_004016b0("ID_CharGen_UseableUntrained");

      FUN_0042c9c0(uVar5,uVar14);

      uVar5 = 0x10000002;

      uVar14 = FUN_004016b0("ID_CharGen_UseableUntrained_Tooltip",0x10000002);

      FUN_0042c9c0(uVar14,uVar5);

      *(undefined4 *)(param_1 + 0x660) = uVar3;

    }

    else {

      uVar5 = FUN_004016b0("ID_CharGen_UnuseableUntrained",0x10000002);

      FUN_0042c9c0(uVar5,uVar14);

      uVar5 = 0x10000002;

      uVar14 = FUN_004016b0("ID_CharGen_UnuseableUntrained_Tooltip",0x10000002);

      FUN_0042c9c0(uVar14,uVar5);

      *(undefined4 *)(param_1 + 0x664) = uVar3;

    }

    FUN_0046a350(auStack_c0);

    FUN_004618a0(&piStack_150);

    FUN_0042e590();

    FUN_0042e590();

    puVar12 = (undefined4 *)(puVar2 + -0x14);

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

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

      (**(code **)*puVar12)(1);

    }

    iStack_184 = iStack_184 + 1;

  } while (iStack_184 < 4);

  FUN_004817f0();

  iVar7 = FUN_0055e1e0();

  piStack_158 = *(int **)(iVar7 + 0x1c4);

  iStack_17c = *(int *)(iVar7 + 0x248) + 0x38;

  do {

    do {

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

        return;

      }

      iVar1 = *piStack_158;

      if ((*(uint *)(iStack_17c + 0xc) != 0) && (*(int *)(iStack_17c + 8) != 0)) {

        for (puVar11 = *(uint **)(*(int *)(iStack_17c + 8) +

                                 (*(uint *)(iVar1 + 0x20) % *(uint *)(iStack_17c + 0xc)) * 4);

            puVar11 != (uint *)0x0; puVar11 = (uint *)puVar11[0x18]) {

          if (*(uint *)(iVar1 + 0x20) == *puVar11) {

            puVar11 = puVar11 + 2;

            goto LAB_00481e01;

          }

        }

      }

      puVar11 = (uint *)0x0;

LAB_00481e01:

      piVar4 = (int *)FUN_0046f670(1,0);

    } while (piVar4 == (int *)0x0);

    (**(code **)(*piVar4 + 0x9c))(1);

    FUN_00460530(0x1000000a,*(undefined4 *)(iVar1 + 0x20));

    piVar8 = (int *)FUN_00463c00(0x10000301);

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

      return;

    }

    iVar9 = (**(code **)(*piVar8 + 0x94))(0xc);

    if (iVar9 == 0) {

      return;

    }

    piVar8 = (int *)FUN_00463c00(0x10000302);

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

      return;

    }

    iStack_17c = (**(code **)(*piVar8 + 0x94))(0xc);

    if (iStack_17c == 0) {

      return;

    }

    piVar8 = (int *)FUN_00463c00(0x10000303);

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

      return;

    }

    iStack_178 = (**(code **)(*piVar8 + 0x94))(0xc);

    if (iStack_178 == 0) {

      return;

    }

    piVar8 = (int *)FUN_00463c00(0x10000306);

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

      return;

    }

    iVar9 = (**(code **)(*piVar8 + 0x94))(0xc);

    if (iVar9 == 0) {

      return;

    }

    piVar8 = (int *)FUN_00463c00(0x10000305);

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

      return;

    }

    iStack_17c = (**(code **)(*piVar8 + 0x94))(1);

    if (iStack_17c == 0) {

      return;

    }

    piVar8 = (int *)FUN_00463c00(0x10000304);

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

      return;

    }

    iVar9 = (**(code **)(*piVar8 + 0x94))(1);

    if (iVar9 == 0) {

      return;

    }

    FUN_004807b0();

    uStack_14c = uStack_168;

    uStack_148 = uStack_174;

    uStack_144 = uStack_170;

    uStack_13c = uStack_164;

    piStack_150 = piVar4;

    iStack_140 = iVar9;

    uVar3 = FUN_00404a40(0,iVar1);

    FUN_00402070(uVar3);

    puVar12 = (undefined4 *)(iStack_178 + -0x14);

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

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

      (**(code **)*puVar12)(1);

    }

    uStack_114 = FUN_005c4be0(*(undefined4 *)(iVar1 + 0x20));

    iStack_12c = *(int *)(iVar1 + 0x20);

    uStack_128 = FUN_005c5b30(iStack_12c);

    uStack_124 = puVar11[4];

    uStack_120 = puVar11[5];

    uStack_11c = puVar11[8];

    uStack_fc = puVar11[0xe];

    uStack_10c = puVar11[10];

    uStack_108 = puVar11[0xb];

    uStack_104 = puVar11[0xc];

    uStack_100 = puVar11[0xd];

    uStack_f8 = puVar11[0xf];

    puVar12 = (undefined4 *)puVar11[1];

    InterlockedIncrement(puVar12 + 1);

    uVar3 = FUN_00404a40(0,puVar12 + 5);

    FUN_00402070(uVar3);

    puVar13 = (undefined4 *)(iStack_160 + -0x14);

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

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

      (**(code **)*puVar13)(1);

    }

    LVar6 = InterlockedDecrement(puVar12 + 1);

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

      (**(code **)*puVar12)(1);

    }

    uStack_118 = uStack_124 != 0;

    uStack_117 = uStack_120 != 0;

    FUN_005c3380(auStack_c0,*(undefined4 *)(iVar7 + 0xd4));

    uVar10 = 0;

    if (uStack_84 != 0) {

      piVar4 = (int *)(iStack_8c + 8);

      do {

        if (piVar4[-1] == iStack_12c) {

          if (*piVar4 == 0) {

            uStack_120 = uStack_120 - uStack_124;

            uStack_124 = 0;

            uStack_118 = 0;

          }

          if (piVar4[1] == 0) {

            uStack_120 = 0;

            uStack_117 = 0;

          }

          break;

        }

        uVar10 = uVar10 + 1;

        piVar4 = piVar4 + 4;

      } while (uVar10 < uStack_84);

    }

    FUN_0046a740(auStack_138);

    FUN_00480fb0(&piStack_150);

    iStack_180 = iStack_12c;

    FUN_00481930(&iStack_180,&piStack_150);

    piStack_158 = (int *)piStack_158[1];

    FUN_0047e300();

    FUN_00480810();

  } while( true );

}





// --- FUN_00482180 at 0x00482180 (size: 16) ---


void FUN_00482180(void)



{

  FUN_00481ba0();

  FUN_00480d10();

  return;

}





// --- FUN_00482190 at 0x00482190 (size: 201) ---


void __thiscall FUN_00482190(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  int *piVar2;

  

  *(undefined4 *)(param_1 + 0x678) = param_2;

  uVar1 = FUN_0055e1d0();

  *(undefined4 *)(param_1 + 0x674) = uVar1;

  FUN_0055e1e0();

  piVar2 = (int *)FUN_00463c00(0x100003f7);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(5);

  }

  *(undefined4 *)(param_1 + 0x67c) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100002f3);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x668) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100003fb);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x66c) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100003fc);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x670) = uVar1;

  FUN_00481ba0();

  FUN_00480cb0();

  return;

}





// --- FUN_00482260 at 0x00482260 (size: 138) ---


undefined4 * __thiscall FUN_00482260(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 *puVar1;

  int iVar2;

  

  FUN_00472670(param_2,param_3);

  param_1[0x17e] = &PTR_FUN_007ccb60;

  *param_1 = &PTR_FUN_007a16a0;

  param_1[0x17e] = &PTR_FUN_007ccb60;

  param_1[0x17f] = 0;

  param_1[0x180] = 0;

  param_1[0x181] = 0;

  param_1[0x182] = 0;

  param_1[0x183] = 0;

  param_1[0x184] = 0;

  param_1[0x185] = 0;

  param_1[0x186] = 0;

  puVar1 = param_1 + 0x187;

  iVar2 = 7;

  do {

    *puVar1 = 0;

    puVar1[1] = 0;

    puVar1[2] = 0;

    puVar1[3] = 0;

    puVar1[4] = 0;

    *(undefined1 *)(puVar1 + 5) = 0;

    puVar1 = puVar1 + 6;

    iVar2 = iVar2 + -1;

  } while (iVar2 != 0);

  return param_1;

}





// --- FUN_00482350 at 0x00482350 (size: 78) ---


undefined4 FUN_00482350(int param_1)



{

  undefined4 uVar1;

  

  uVar1 = 0;

  switch(*(undefined4 *)(param_1 + 0x2e4)) {

  case 0x100003e6:

    return 1;

  case 0x100003e7:

    return 2;

  case 0x100003e8:

    return 4;

  case 0x100003e9:

    return 3;

  case 0x100003ea:

    return 5;

  case 0x100003eb:

    uVar1 = 6;

  }

  return uVar1;

}





// --- FUN_004823c0 at 0x004823C0 (size: 207) ---


void __thiscall FUN_004823c0(int param_1,undefined4 param_2)



{

  byte *pbVar1;

  int iVar2;

  int *piVar3;

  char cVar4;

  int iVar5;

  uint uVar6;

  

  iVar5 = FUN_00482350(param_2);

  iVar2 = iVar5 * 3 + 0xc6;

  pbVar1 = (byte *)(param_1 + iVar2 * 8);

  if (*(char *)(param_1 + iVar2 * 8) == '\0') {

    param_1 = param_1 + iVar5 * 0x18;

    param_2 = 0;

    cVar4 = FUN_00460bf0(0x86,&param_2);

    if ((cVar4 != '\0') && (piVar3 = *(int **)(param_1 + 0x628), piVar3 != (int *)0x0)) {

      (**(code **)(*piVar3 + 0x9c))(0x10000019);

    }

    (**(code **)(**(int **)(param_1 + 0x620) + 0x9c))(0x10000019);

    *pbVar1 = 1;

  }

  else {

    piVar3 = *(int **)(param_1 + 0x628 + iVar5 * 0x18);

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

      (**(code **)(*piVar3 + 0x9c))(0x10000018);

    }

    (**(code **)(**(int **)(param_1 + iVar5 * 0x18 + 0x620) + 0x9c))(0x10000018);

    *pbVar1 = 0;

  }

  uVar6 = (uint)*pbVar1;

  FUN_0055e1e0(iVar5,uVar6);

  FUN_005c4bc0(iVar5,uVar6);

  return;

}





// --- FUN_00482490 at 0x00482490 (size: 61) ---


void __fastcall FUN_00482490(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  FUN_0055e1e0();

  FUN_005c4ba0();

  puVar2 = (undefined4 *)(param_1 + 0x634);

  iVar1 = 6;

  do {

    if (*(char *)(puVar2 + 5) != '\0') {

      FUN_004823c0(*puVar2);

    }

    puVar2 = puVar2 + 6;

    iVar1 = iVar1 + -1;

  } while (iVar1 != 0);

  return;

}





// --- FUN_004824d0 at 0x004824D0 (size: 29) ---


float10 __fastcall FUN_004824d0(undefined4 *param_1)



{

  wchar_t *_Str;

  int *piVar1;

  double dVar2;

  

  _Str = (wchar_t *)*param_1;

  piVar1 = _errno();

  *piVar1 = 0;

  dVar2 = wcstod(_Str,(wchar_t **)0x0);

  return (float10)dVar2;

}





// --- FUN_004824f0 at 0x004824F0 (size: 82) ---


undefined4 * __thiscall FUN_004824f0(undefined4 *param_1,byte param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a16a0;

  *puVar1 = &PTR_FUN_007ccb60;

  piVar2 = (int *)FUN_0043c680();

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

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00482550 at 0x00482550 (size: 19) ---


void FUN_00482550(void)



{

  FUN_00460270(0x1000003a,&LAB_00482320);

  return;

}





// --- FUN_00482570 at 0x00482570 (size: 478) ---


void __fastcall FUN_00482570(int param_1)



{

  int *piVar1;

  int iVar2;

  int *piVar3;

  undefined4 uVar4;

  char *pcVar5;

  undefined4 uVar6;

  

  if (*(int **)(param_1 + 0x618) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x618) + 0x9c))(0x10000016);

  }

  piVar1 = (int *)FUN_00463c00(0x100003d8);

  iVar2 = FUN_0055e1e0();

  uVar4 = *(undefined4 *)(iVar2 + 0x180);

  FUN_0042dc80();

  switch(uVar4) {

  case 0:

    piVar3 = (int *)FUN_00463c00(0x100003d9);

    (**(code **)(*piVar1 + 0x9c))(0x1000002b);

    pcVar5 = "ID_CharGen_CustomText";

    break;

  case 1:

    piVar3 = (int *)FUN_00463c00(0x100003da);

    (**(code **)(*piVar1 + 0x9c))(0x1000002c);

    pcVar5 = "ID_CharGen_BowText";

    break;

  case 2:

    piVar3 = (int *)FUN_00463c00(0x100003df);

    (**(code **)(*piVar1 + 0x9c))(0x10000031);

    pcVar5 = "ID_CharGen_SwashText";

    break;

  case 3:

    piVar3 = (int *)FUN_00463c00(0x100003db);

    (**(code **)(*piVar1 + 0x9c))(0x1000002d);

    pcVar5 = "ID_CharGen_LifeText";

    break;

  case 4:

    piVar3 = (int *)FUN_00463c00(0x100003dc);

    (**(code **)(*piVar1 + 0x9c))(0x1000002e);

    pcVar5 = "ID_CharGen_WarText";

    break;

  case 5:

    piVar3 = (int *)FUN_00463c00(0x100003dd);

    (**(code **)(*piVar1 + 0x9c))(0x1000002f);

    pcVar5 = "ID_CharGen_WayText";

    break;

  case 6:

    piVar3 = (int *)FUN_00463c00(0x100003de);

    (**(code **)(*piVar1 + 0x9c))(0x10000030);

    pcVar5 = "ID_CharGen_SoldierText";

    break;

  default:

    goto switchD_004825c3_default;

  }

  uVar6 = 0x10000002;

  uVar4 = FUN_004016b0(pcVar5,0x10000002);

  FUN_0042c9c0(uVar4,uVar6);

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

switchD_004825c3_default:

    piVar1 = (int *)0x0;

  }

  else {

    piVar1 = (int *)(**(code **)(*piVar3 + 0x94))(1);

  }

  *(int **)(param_1 + 0x618) = piVar1;

  (**(code **)(*piVar1 + 0x9c))(0x10000017);

  FUN_0046a350(&stack0xffffff6c);

  FUN_0042e590();

  return;

}





// --- FUN_00482770 at 0x00482770 (size: 37) ---


undefined4 FUN_00482770(undefined4 param_1)



{

  int *piVar1;

  undefined4 uVar2;

  

  piVar1 = (int *)FUN_00463c00(param_1);

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

                    /* WARNING: Could not recover jumptable at 0x0048278a. Too many branches */

                    /* WARNING: Treating indirect jump as call */

    uVar2 = (**(code **)(*piVar1 + 0x94))();

    return uVar2;

  }

  return 0;

}





// --- FUN_004827a0 at 0x004827A0 (size: 106) ---


void FUN_004827a0(undefined4 param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  undefined *local_4;

  

  local_4 = PTR_DAT_00818340;

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

  FUN_004027b0(&local_4,&DAT_007a1694,param_1);

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

    FUN_00402490(local_4,*(int *)(local_4 + -4) + -1);

  }

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

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

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

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

  }

  return;

}





// --- FUN_00482810 at 0x00482810 (size: 980) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void FUN_00482810(void)



{

  int iVar1;

  LONG LVar2;

  undefined4 uVar3;

  uint uVar4;

  undefined4 *puVar5;

  undefined *apuStack_18 [2];

  undefined *local_10;

  undefined *local_c;

  int local_8;

  int local_4;

  

  local_8 = FUN_0055e1e0();

  uVar4 = 1;

  do {

    iVar1 = FUN_005c4990(uVar4);

    local_c = PTR_DAT_00818340;

    local_4 = iVar1;

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

    local_10 = PTR_DAT_00818340;

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

    FUN_004027b0(&local_10,&DAT_0079fdd0,iVar1);

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

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

    }

    puVar5 = (undefined4 *)(local_10 + -0x14);

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

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

      (**(code **)*puVar5)(1);

    }

    FUN_0046a740(&local_c);

    FUN_00460760(0x86,(float)local_4 * _DAT_007a1870);

    puVar5 = (undefined4 *)(local_c + -0x14);

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

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

      (**(code **)*puVar5)(1);

    }

    uVar4 = uVar4 + 1;

  } while (uVar4 < 7);

  apuStack_18[0] = PTR_DAT_00818340;

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

  uVar3 = *(undefined4 *)(local_8 + 0x1a0);

  local_c = PTR_DAT_00818340;

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

  FUN_004027b0(&local_c,&DAT_007a1694,uVar3);

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

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

  }

  puVar5 = (undefined4 *)(local_c + -0x14);

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

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

    (**(code **)*puVar5)(1);

  }

  FUN_0046a740(apuStack_18);

  if (apuStack_18[0] != PTR_DAT_00818340) {

    puVar5 = (undefined4 *)(apuStack_18[0] + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(apuStack_18[0] + -0x10));

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

      (**(code **)*puVar5)(1);

    }

    apuStack_18[0] = PTR_DAT_00818340;

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

  }

  local_4 = FUN_005c4990(2);

  uVar3 = FUN_005df4c4();

  local_c = PTR_DAT_00818340;

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

  FUN_004027b0(&local_c,&DAT_007a1694,uVar3);

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

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

  }

  puVar5 = (undefined4 *)(local_c + -0x14);

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

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

    (**(code **)*puVar5)(1);

  }

  FUN_0046a740(apuStack_18);

  if (apuStack_18[0] != PTR_DAT_00818340) {

    puVar5 = (undefined4 *)(apuStack_18[0] + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(apuStack_18[0] + -0x10));

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

      (**(code **)*puVar5)(1);

    }

    apuStack_18[0] = PTR_DAT_00818340;

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

  }

  uVar3 = FUN_005c4990(2);

  local_c = PTR_DAT_00818340;

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

  FUN_004027b0(&local_c,&DAT_007a1694,uVar3);

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

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

  }

  puVar5 = (undefined4 *)(local_c + -0x14);

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

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

    (**(code **)*puVar5)(1);

  }

  FUN_0046a740(apuStack_18);

  if (apuStack_18[0] != PTR_DAT_00818340) {

    puVar5 = (undefined4 *)(apuStack_18[0] + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(apuStack_18[0] + -0x10));

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

      (**(code **)*puVar5)(1);

    }

    apuStack_18[0] = PTR_DAT_00818340;

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

  }

  uVar3 = FUN_005c4990(6);

  local_c = PTR_DAT_00818340;

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

  FUN_004027b0(&local_c,&DAT_007a1694,uVar3);

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

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

  }

  puVar5 = (undefined4 *)(local_c + -0x14);

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

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

    (**(code **)*puVar5)(1);

  }

  FUN_0046a740(apuStack_18);

  FUN_005c7110();

  FUN_00482570();

  puVar5 = (undefined4 *)(apuStack_18[0] + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(apuStack_18[0] + -0x10));

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

    (**(code **)*puVar5)(1);

  }

  return;

}





// --- FUN_00482bf0 at 0x00482BF0 (size: 36) ---


void FUN_00482bf0(void)



{

  FUN_0055e1e0();

  FUN_005c7110();

  FUN_00482570();

  FUN_00482810();

  return;

}





// --- FUN_00482c20 at 0x00482C20 (size: 41) ---


void FUN_00482c20(void)



{

  FUN_00482490();

  FUN_0055e1e0();

  FUN_005c7110();

  FUN_00482570();

  FUN_00482810();

  return;

}





// --- FUN_00482c50 at 0x00482C50 (size: 269) ---


void FUN_00482c50(undefined4 param_1,int param_2)



{

  undefined4 uVar1;

  int iVar2;

  int iVar3;

  

  FUN_0055e1e0();

  uVar1 = FUN_00482350(param_1);

  iVar2 = FUN_005c4990(uVar1);

  if ((-1 < param_2 - iVar2) && (iVar3 = FUN_005c4b00(uVar1), iVar3 < param_2 - iVar2)) {

    param_2 = FUN_005c4990(uVar1);

    iVar2 = FUN_005c4b00(uVar1);

    param_2 = param_2 + iVar2;

  }

  switch(uVar1) {

  case 1:

    FUN_005c5640(param_2,1);

    FUN_00482810();

    return;

  case 2:

    FUN_005c56c0(param_2,1);

    FUN_00482810();

    return;

  case 3:

    FUN_005c57c0(param_2,1);

    FUN_00482810();

    return;

  case 4:

    FUN_005c5740(param_2,1);

    FUN_00482810();

    return;

  case 5:

    FUN_005c5840(param_2,1);

    FUN_00482810();

    return;

  case 6:

    FUN_005c58c0(param_2,1);

  }

  FUN_00482810();

  return;

}





// --- FUN_00483110 at 0x00483110 (size: 840) ---


void __thiscall FUN_00483110(int param_1,undefined4 param_2)



{

  undefined *puVar1;

  undefined4 uVar2;

  int *piVar3;

  int iVar4;

  LONG LVar5;

  undefined4 *puVar6;

  undefined4 *puVar7;

  uint uVar8;

  undefined1 *puVar9;

  undefined *puStack_2c;

  uint local_28;

  int iStack_24;

  undefined1 auStack_20 [32];

  

  *(undefined4 *)(param_1 + 0x600) = param_2;

  uVar2 = FUN_0055e1d0();

  *(undefined4 *)(param_1 + 0x5fc) = uVar2;

  puVar7 = (undefined4 *)(param_1 + 0x634);

  uVar2 = FUN_00463c00(0x100003e6);

  *puVar7 = uVar2;

  uVar2 = FUN_00463c00(0x100003e7);

  *(undefined4 *)(param_1 + 0x64c) = uVar2;

  uVar2 = FUN_00463c00(0x100003e9);

  *(undefined4 *)(param_1 + 0x664) = uVar2;

  uVar2 = FUN_00463c00(0x100003e8);

  *(undefined4 *)(param_1 + 0x67c) = uVar2;

  uVar2 = FUN_00463c00(0x100003ea);

  *(undefined4 *)(param_1 + 0x694) = uVar2;

  uVar2 = FUN_00463c00(0x100003eb);

  *(undefined4 *)(param_1 + 0x6ac) = uVar2;

  local_28 = 1;

  do {

    piVar3 = (int *)FUN_00463c00(0x100002ec);

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

      uVar2 = 0;

    }

    else {

      uVar2 = (**(code **)(*piVar3 + 0x94))(1);

    }

    puVar7[1] = uVar2;

    piVar3 = (int *)FUN_00463c00(0x100002ed);

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

      iVar4 = 0;

    }

    else {

      iVar4 = (**(code **)(*piVar3 + 0x94))(0xc);

    }

    puVar7[2] = iVar4;

    *(undefined1 **)(iVar4 + 0x6a0) = &LAB_00466520;

    piVar3 = (int *)FUN_00463c00(0x100002ee);

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

      uVar2 = 0;

    }

    else {

      uVar2 = (**(code **)(*piVar3 + 0x94))(0xb);

    }

    puVar7[3] = uVar2;

    piVar3 = (int *)FUN_00463c00(0x100002ef);

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

      uVar2 = 0;

    }

    else {

      uVar2 = (**(code **)(*piVar3 + 0x94))(0xc);

    }

    puVar7[4] = uVar2;

    puVar9 = auStack_20;

    uVar8 = local_28;

    FUN_0055e1e0(local_28,puVar9);

    FUN_005c4a00(uVar8,puVar9);

    puStack_2c = PTR_DAT_00818340;

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

    puVar1 = PTR_DAT_00818344;

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

    FUN_00405000(auStack_20);

    piVar3 = (int *)FUN_00403350(&iStack_24,0);

    iVar4 = *(int *)(*piVar3 + -4);

    if (iVar4 != 1) {

      FUN_00402490(*piVar3,iVar4 + -1);

    }

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

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

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

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

    }

    FUN_0046a740(&puStack_2c);

    (**(code **)(*(int *)puVar7[1] + 0x9c))(0x10000018);

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

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

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

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

    }

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

    LVar5 = InterlockedDecrement((LONG *)(puStack_2c + -0x10));

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

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

    }

    local_28 = local_28 + 1;

    puVar7 = puVar7 + 6;

  } while (local_28 < 7);

  iVar4 = FUN_00463c00(0x100003e2);

  if (iVar4 == 0) {

LAB_00483377:

    uVar2 = 0;

  }

  else {

    piVar3 = (int *)FUN_00463c00(0x100002f1);

    if (piVar3 == (int *)0x0) goto LAB_00483377;

    uVar2 = (**(code **)(*piVar3 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x604) = uVar2;

  iVar4 = FUN_00463c00(0x100003e3);

  if (iVar4 == 0) {

LAB_004833ad:

    uVar2 = 0;

  }

  else {

    piVar3 = (int *)FUN_00463c00(0x100002f3);

    if (piVar3 == (int *)0x0) goto LAB_004833ad;

    uVar2 = (**(code **)(*piVar3 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x608) = uVar2;

  iVar4 = FUN_00463c00(0x100003e4);

  if (iVar4 == 0) {

LAB_004833e3:

    uVar2 = 0;

  }

  else {

    piVar3 = (int *)FUN_00463c00(0x100002f3);

    if (piVar3 == (int *)0x0) goto LAB_004833e3;

    uVar2 = (**(code **)(*piVar3 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x60c) = uVar2;

  iVar4 = FUN_00463c00(0x100003e5);

  if (iVar4 != 0) {

    piVar3 = (int *)FUN_00463c00(0x100002f3);

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

      uVar2 = (**(code **)(*piVar3 + 0x94))(0xc);

      goto LAB_0048341b;

    }

  }

  uVar2 = 0;

LAB_0048341b:

  *(undefined4 *)(param_1 + 0x610) = uVar2;

  piVar3 = (int *)FUN_00463c00(0x100003e0);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar3 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x614) = uVar2;

  FUN_00482570();

  return;

}





// --- FUN_00483460 at 0x00483460 (size: 144) ---


undefined4 * __thiscall FUN_00483460(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00472670(param_2,param_3);

  param_1[0x17e] = &PTR_FUN_007ccb60;

  param_1[0x17f] = 0;

  param_1[0x181] = 0;

  param_1[0x182] = 0;

  param_1[0x183] = 0;

  param_1[0x184] = 0;

  param_1[0x185] = 0;

  param_1[0x186] = 0;

  param_1[0x187] = 0;

  param_1[0x188] = 0;

  param_1[0x189] = 0;

  param_1[0x18a] = 0;

  param_1[0x18b] = 0;

  param_1[0x18c] = 0;

  param_1[0x18d] = 0;

  param_1[0x18e] = 0;

  *param_1 = &PTR_FUN_007a1a58;

  param_1[0x17e] = &PTR_FUN_007ccb60;

  return param_1;

}





// --- FUN_00483550 at 0x00483550 (size: 82) ---


undefined4 * __thiscall FUN_00483550(undefined4 *param_1,byte param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a1a58;

  *puVar1 = &PTR_FUN_007ccb60;

  piVar2 = (int *)FUN_0043c680();

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

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004835b0 at 0x004835B0 (size: 19) ---


void FUN_004835b0(void)



{

  FUN_00460270(0x10000039,&LAB_00483520);

  return;

}





// --- FUN_004835d0 at 0x004835D0 (size: 1508) ---
// --- FUN_004835d0 at 0x004835D0 --- ERROR: 'charmap' codec can't encode characters in position 1618-1619: character maps to <undefined>

// --- FUN_00483dd0 at 0x00483DD0 (size: 585) ---


void __thiscall FUN_00483dd0(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  int *piVar2;

  

  *(undefined4 *)(param_1 + 0x600) = param_2;

  uVar1 = FUN_0055e1d0();

  *(undefined4 *)(param_1 + 0x5fc) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100003bf);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x604) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100003c1);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x608) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100003c2);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x60c) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100003c3);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x610) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x10000590);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x614) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x10000591);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x618) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100005a9);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x61c) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100005bf);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x620) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100005c4);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x624) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100005e8);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x628) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100005f1);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x62c) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100005c7);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x630) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100005c8);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x634) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x100003c4);

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

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x638) = uVar1;

  uVar1 = FUN_00463c00(0x100003be);

  *(undefined4 *)(param_1 + 0x63c) = uVar1;

  FUN_004835d0();

  return;

}





// --- FUN_004840d0 at 0x004840D0 (size: 27) ---


undefined4 __fastcall FUN_004840d0(int *param_1)



{

  int iVar1;

  

  iVar1 = (**(code **)(*param_1 + 0x2e4))();

  param_1[0x1d8] = iVar1;

  param_1[0x1d7] = iVar1;

  return 1;

}





// --- FUN_004840f0 at 0x004840F0 (size: 39) ---


undefined4 __fastcall FUN_004840f0(int *param_1)



{

  param_1[0x1d8] = param_1[0x1d7];

  (**(code **)(*param_1 + 0x2d4))(0);

  (**(code **)(*param_1 + 0x2b8))();

  return 1;

}





// --- FUN_00484120 at 0x00484120 (size: 39) ---


undefined4 __fastcall FUN_00484120(int *param_1)



{

  param_1[0x1d8] = param_1[0x1d6];

  (**(code **)(*param_1 + 0x2d4))(0);

  (**(code **)(*param_1 + 0x2b8))();

  return 1;

}





// --- FUN_004841e0 at 0x004841E0 (size: 28) ---


void __fastcall FUN_004841e0(int *param_1)



{

  int iVar1;

  

  iVar1 = (**(code **)(*param_1 + 0x2e4))();

  param_1[0x1d8] = iVar1;

                    /* WARNING: Could not recover jumptable at 0x004841f6. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (**(code **)(*param_1 + 0x2b8))();

  return;

}





// --- FUN_004842c0 at 0x004842C0 (size: 82) ---


void __fastcall FUN_004842c0(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)(param_1[0x1d9] + -0x14);

  *param_1 = &PTR_FUN_007a20b0;

  param_1[8] = &PTR_LAB_007a1f70;

  param_1[0x18a] = &PTR_FUN_0079d180;

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x1d9] + -0x10));

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

    (**(code **)*puVar2)(1);

  }

  FUN_0046d220();

  FUN_004efed0();

  return;

}





// --- FUN_00484460 at 0x00484460 (size: 30) ---


void * __thiscall FUN_00484460(void *param_1,byte param_2)



{

  FUN_004842c0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00484480 at 0x00484480 (size: 94) ---


undefined4 * __thiscall FUN_00484480(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_004efe70();

  FUN_0046cd70(param_2,param_3);

  *param_1 = &PTR_FUN_007a20b0;

  param_1[8] = &PTR_LAB_007a1f70;

  param_1[0x18a] = &PTR_FUN_0079d180;

  param_1[0x1d6] = 0;

  param_1[0x1d7] = 0;

  param_1[0x1d8] = 0;

  FUN_00401340(&DAT_007938af);

  return param_1;

}





// --- FUN_004845c0 at 0x004845C0 (size: 348) ---


void __thiscall FUN_004845c0(int *param_1,int *param_2)



{

  int iVar1;

  int *piVar2;

  char cVar3;

  LONG LVar4;

  undefined4 local_20;

  undefined4 local_1c;

  void *pvStack_18;

  uint uStack_14;

  undefined4 uStack_10;

  int iStack_c;

  uint uStack_8;

  undefined4 uStack_4;

  

  piVar2 = param_2;

  iVar1 = param_1[0x1d9];

  if (iVar1 != *param_2) {

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

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

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

    }

    iVar1 = *piVar2;

    param_1[0x1d9] = iVar1;

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

  }

  param_2 = (int *)0x0;

  local_20 = 0;

  local_1c = 0;

  cVar3 = FUN_005de940(piVar2,&param_2,&local_20,&local_1c);

  if (cVar3 != '\0') {

    FUN_004eff00(local_20,param_2);

    FUN_004eff50(local_1c,param_2);

    pvStack_18 = (void *)0x0;

    uStack_14 = 0;

    uStack_10 = 0;

    cVar3 = FUN_00438750(piVar2,&pvStack_18);

    if (cVar3 == '\0') {

      if ((uStack_14 & 0x80000000) == 0x80000000) {

        operator_delete__(pvStack_18);

        return;

      }

    }

    else {

      iStack_c = 0;

      uStack_8 = 0;

      uStack_4 = 0;

      cVar3 = FUN_00438860(piVar2,&iStack_c);

      if (cVar3 != '\0') {

        (**(code **)(*param_1 + 0x2e0))(&iStack_c,&pvStack_18);

      }

      if (((uStack_8 & 0x80000000) == 0x80000000) && (iStack_c != 0)) {

        FUN_00407920(3);

      }

      if ((uStack_14 & 0x80000000) == 0x80000000) {

        operator_delete__(pvStack_18);

      }

    }

  }

  return;

}





// --- FUN_00484720 at 0x00484720 (size: 19) ---


void FUN_00484720(void)



{

  FUN_00460270(0x10000038,&LAB_004844e0);

  return;

}





// --- FUN_00484740 at 0x00484740 (size: 441) ---


void __thiscall FUN_00484740(int *param_1,int *param_2)



{

  int iVar1;

  int *piVar2;

  char cVar3;

  LONG LVar4;

  undefined4 uVar5;

  void *unaff_EBP;

  uint uVar6;

  uint local_20;

  undefined4 local_1c;

  void *pvStack_18;

  uint uStack_14;

  uint uStack_10;

  void *pvStack_c;

  uint uStack_8;

  uint uStack_4;

  

  piVar2 = param_2;

  iVar1 = param_1[0x1d9];

  if (iVar1 != *param_2) {

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

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

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

    }

    iVar1 = *piVar2;

    param_1[0x1d9] = iVar1;

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

  }

  param_2 = (int *)0x0;

  local_20 = 0;

  local_1c = 0;

  cVar3 = FUN_005de940(piVar2,&param_2,&local_20,&local_1c);

  if (cVar3 != '\0') {

    FUN_004eff00(local_20,param_2);

    FUN_004eff50(local_1c,param_2);

    pvStack_c = (void *)0x0;

    uStack_8 = 0;

    uStack_4 = 0;

    cVar3 = FUN_005deac0(piVar2,&pvStack_c);

    if (cVar3 == '\0') {

      if ((uStack_8 & 0x80000000) == 0x80000000) {

        operator_delete__(pvStack_c);

      }

    }

    else {

      pvStack_18 = (void *)0x0;

      uStack_14 = 0;

      uStack_10 = 0;

      cVar3 = FUN_00438750(piVar2,&pvStack_18);

      if (((cVar3 == '\0') || (uStack_10 == 0)) && (uVar6 = 0, uStack_4 != 0)) {

        do {

          if (uStack_10 < (uStack_14 & 0x7fffffff)) {

LAB_0048485a:

            *(uint *)((int)pvStack_18 + uStack_10 * 4) = uVar6;

            uStack_10 = uStack_10 + 1;

          }

          else {

            uVar5 = FUN_00453850((uStack_14 & 0x7fffffff) + 1);

            cVar3 = FUN_004180a0(uVar5);

            if (cVar3 != '\0') goto LAB_0048485a;

          }

          uVar6 = uVar6 + 1;

        } while (uVar6 < uStack_4);

      }

      (**(code **)(*param_1 + 0x2dc))(&pvStack_c,&pvStack_18,param_2);

      if ((local_20 & 0x80000000) == 0x80000000) {

        operator_delete__(unaff_EBP);

      }

      if ((uStack_14 & 0x80000000) == 0x80000000) {

        operator_delete__(pvStack_18);

        return;

      }

    }

  }

  return;

}





// --- FUN_004849d0 at 0x004849D0 (size: 41) ---


void __fastcall FUN_004849d0(int param_1)



{

  if (*(int **)(param_1 + 0x60c) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x60c) + 0x2b8))();

  }

  if (*(int **)(param_1 + 0x610) != (int *)0x0) {

                    /* WARNING: Could not recover jumptable at 0x004849f2. Too many branches */

                    /* WARNING: Treating indirect jump as call */

    (**(code **)(**(int **)(param_1 + 0x610) + 0x2b8))();

    return;

  }

  return;

}





// --- FUN_00484a00 at 0x00484A00 (size: 51) ---


byte __fastcall FUN_00484a00(int param_1)



{

  byte bVar1;

  byte bVar2;

  

  bVar1 = 0;

  if (*(int **)(param_1 + 0x60c) != (int *)0x0) {

    bVar1 = (**(code **)(**(int **)(param_1 + 0x60c) + 700))();

  }

  if (*(int **)(param_1 + 0x610) != (int *)0x0) {

    bVar2 = (**(code **)(**(int **)(param_1 + 0x610) + 700))();

    bVar1 = bVar1 | bVar2;

  }

  return bVar1;

}





// --- FUN_00484a40 at 0x00484A40 (size: 51) ---


void __thiscall FUN_00484a40(int param_1,undefined4 param_2)



{

  if (*(int **)(param_1 + 0x60c) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x60c) + 0x2cc))(param_2);

  }

  if (*(int **)(param_1 + 0x610) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x610) + 0x2cc))(param_2);

  }

  return;

}





// --- FUN_00484a80 at 0x00484A80 (size: 64) ---


byte __thiscall FUN_00484a80(int param_1,undefined4 param_2)



{

  byte bVar1;

  byte bVar2;

  

  bVar1 = 1;

  if (*(int **)(param_1 + 0x60c) != (int *)0x0) {

    bVar1 = (**(code **)(**(int **)(param_1 + 0x60c) + 0x2d4))(param_2);

    bVar1 = bVar1 & 1;

  }

  if (*(int **)(param_1 + 0x610) != (int *)0x0) {

    bVar2 = (**(code **)(**(int **)(param_1 + 0x610) + 0x2d4))(param_2);

    bVar1 = bVar1 & bVar2;

  }

  return bVar1;

}





// --- FUN_00484ac0 at 0x00484AC0 (size: 43) ---


undefined4 __fastcall FUN_00484ac0(int param_1)



{

  if (*(int **)(param_1 + 0x60c) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x60c) + 0x2c8))();

  }

  if (*(int **)(param_1 + 0x610) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x610) + 0x2c8))();

  }

  return 1;

}





// --- FUN_00484af0 at 0x00484AF0 (size: 43) ---


undefined4 __fastcall FUN_00484af0(int param_1)



{

  if (*(int **)(param_1 + 0x60c) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x60c) + 0x2c0))();

  }

  if (*(int **)(param_1 + 0x610) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x610) + 0x2c0))();

  }

  return 1;

}





// --- FUN_00484b20 at 0x00484B20 (size: 43) ---


undefined4 __fastcall FUN_00484b20(int param_1)



{

  if (*(int **)(param_1 + 0x60c) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x60c) + 0x2c4))();

  }

  if (*(int **)(param_1 + 0x610) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x610) + 0x2c4))();

  }

  return 1;

}





// --- FUN_00484b50 at 0x00484B50 (size: 53) ---


void __thiscall FUN_00484b50(int param_1,undefined4 param_2,undefined4 param_3)



{

  if (*(int **)(param_1 + 0x60c) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x60c) + 0x2d8))(param_2);

  }

  if (*(int **)(param_1 + 0x610) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x610) + 0x2d8))(param_3);

  }

  return;

}





// --- FUN_00484b90 at 0x00484B90 (size: 47) ---


void __thiscall FUN_00484b90(int param_1,undefined4 param_2,undefined4 param_3)



{

  if (*(int *)(param_1 + 0x60c) != 0) {

    FUN_00486f50(param_2);

  }

  if (*(int *)(param_1 + 0x610) != 0) {

    FUN_00485090(param_3);

  }

  return;

}





// --- FUN_00484c40 at 0x00484C40 (size: 86) ---


undefined4 * __thiscall FUN_00484c40(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  LONG *lpAddend;

  

  FUN_004efe70();

  FUN_00464900(param_2,param_3);

  param_1[0x183] = 0;

  param_1[0x184] = 0;

  *param_1 = &PTR_FUN_007a2520;

  param_1[7] = &PTR_LAB_007a23e8;

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x185] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  return param_1;

}





// --- FUN_00484d20 at 0x00484D20 (size: 112) ---


void __fastcall FUN_00484d20(int param_1)



{

  int *piVar1;

  int iVar2;

  

  FUN_004639a0();

  piVar1 = (int *)FUN_00463c00(0x10000219);

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

    iVar2 = (**(code **)(*piVar1 + 0x94))(0x10000035);

    if (iVar2 != 0) {

      iVar2 = iVar2 + -0x20;

      goto LAB_00484d52;

    }

  }

  iVar2 = 0;

LAB_00484d52:

  *(int *)(param_1 + 0x5f0) = iVar2;

  piVar1 = (int *)FUN_00463c00(0x1000021c);

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

    iVar2 = (**(code **)(*piVar1 + 0x94))(0x10000037);

    if (iVar2 != 0) {

      *(int *)(param_1 + 0x5f4) = iVar2 + -0x20;

      return;

    }

  }

  *(undefined4 *)(param_1 + 0x5f4) = 0;

  return;

}





// --- FUN_00484d90 at 0x00484D90 (size: 93) ---


undefined4 * __thiscall FUN_00484d90(undefined4 *param_1,byte param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)(param_1[0x185] + -0x14);

  *param_1 = &PTR_FUN_007a2520;

  param_1[7] = &PTR_LAB_007a23e8;

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x185] + -0x10));

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

    (**(code **)*puVar2)(1);

  }

  FUN_00464e00();

  FUN_004efed0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00484df0 at 0x00484DF0 (size: 19) ---


void FUN_00484df0(void)



{

  FUN_00460270(0x10000036,&LAB_00484cf0);

  return;

}





// --- FUN_00484ea0 at 0x00484EA0 (size: 39) ---


undefined4 __fastcall FUN_00484ea0(int *param_1)



{

  param_1[0x1ea] = param_1[0x1e9];

  (**(code **)(*param_1 + 0x2d4))(0);

  (**(code **)(*param_1 + 0x2b8))();

  return 1;

}





// --- FUN_00484ed0 at 0x00484ED0 (size: 39) ---


undefined4 __fastcall FUN_00484ed0(int *param_1)



{

  param_1[0x1ea] = param_1[0x1e8];

  (**(code **)(*param_1 + 0x2d4))(0);

  (**(code **)(*param_1 + 0x2b8))();

  return 1;

}





// --- FUN_00484f80 at 0x00484F80 (size: 7) ---


float10 __fastcall FUN_00484f80(int param_1)



{

  return (float10)*(float *)(param_1 + 0x7a8);

}





// --- FUN_00484f90 at 0x00484F90 (size: 37) ---


void __thiscall FUN_00484f90(int *param_1,int param_2)



{

  param_1[0x1ea] = param_2;

  (**(code **)(*param_1 + 0x2b8))();

  (**(code **)(*param_1 + 0x2d4))(0);

  return;

}





// --- FUN_00484fc0 at 0x00484FC0 (size: 82) ---


void __fastcall FUN_00484fc0(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)(param_1[0x1eb] + -0x14);

  *param_1 = &PTR_FUN_007a29a8;

  param_1[8] = &PTR_LAB_007a2868;

  param_1[0x18a] = &PTR_FUN_0079d180;

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x1eb] + -0x10));

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

    (**(code **)*puVar2)(1);

  }

  FUN_00470f80();

  FUN_004efed0();

  return;

}





// --- FUN_00485090 at 0x00485090 (size: 303) ---


void __thiscall FUN_00485090(int param_1,int *param_2)



{

  int iVar1;

  int *piVar2;

  char cVar3;

  LONG LVar4;

  undefined4 local_10;

  undefined4 local_c;

  int iStack_8;

  int iStack_4;

  

  piVar2 = param_2;

  if (*(int *)(param_1 + 0x7b0) == 0) {

    iVar1 = *(int *)(param_1 + 0x7ac);

    if (iVar1 != *param_2) {

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

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

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

      }

      iVar1 = *piVar2;

      *(int *)(param_1 + 0x7ac) = iVar1;

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

    }

    param_2 = (int *)0x0;

    local_10 = 0;

    local_c = 0;

    cVar3 = FUN_005de940(piVar2,&param_2,&local_10,&local_c);

    if (cVar3 != '\0') {

      FUN_004eff00(local_10,param_2);

      FUN_004eff50(local_c,param_2);

      if (*(char *)(param_1 + 0x7c2) == '\0') {

        iStack_4 = 0;

        iStack_8 = 0;

        cVar3 = FUN_005de9e0(piVar2,&iStack_4,&iStack_8);

        if (cVar3 != '\0') {

          *(int *)(param_1 + 0x7b4) = iStack_4;

          *(int *)(param_1 + 0x7b8) = iStack_8;

        }

      }

      else {

        iStack_8 = 0;

        iStack_4 = 0;

        cVar3 = FUN_005dea30(piVar2,&iStack_8,&iStack_4);

        if (cVar3 != '\0') {

          *(float *)(param_1 + 0x7b4) = (float)iStack_8;

          *(float *)(param_1 + 0x7b8) = (float)iStack_4;

          return;

        }

      }

    }

  }

  return;

}





// --- FUN_00485200 at 0x00485200 (size: 59) ---


void FUN_00485200(undefined4 *param_1,undefined4 param_2)



{

  undefined1 *puVar1;

  undefined4 *puVar2;

  undefined4 local_8;

  undefined1 local_4 [4];

  

  puVar2 = &local_8;

  puVar1 = local_4;

  local_8 = 0;

  FUN_00406d10(puVar1,param_2,&local_8);

  FUN_00406570(puVar1,param_2,puVar2);

  *param_1 = local_8;

  param_1[1] = 0;

  return;

}





// --- FUN_00485240 at 0x00485240 (size: 30) ---


void * __thiscall FUN_00485240(void *param_1,byte param_2)



{

  FUN_00484fc0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00485260 at 0x00485260 (size: 162) ---


int * __thiscall FUN_00485260(int *param_1,int *param_2,int *param_3)



{

  int *piVar1;

  int *piVar2;

  int *piVar3;

  int iVar4;

  int *local_4;

  

  piVar1 = param_3;

  local_4 = param_1;

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

    piVar3 = (int *)*param_1;

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

      *param_1 = 0;

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

      param_1[1] = 0;

    }

    iVar4 = -0x7fffbffe;

  }

  else {

    iVar4 = *param_3;

    param_3 = (int *)0x0;

    piVar3 = (int *)(**(code **)(iVar4 + 0xc))(&local_4,&DAT_007a2834,&param_3);

    piVar2 = param_3;

    iVar4 = *piVar3;

    piVar3 = (int *)*param_1;

    if (iVar4 < 0) {

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

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

      }

      *param_1 = 0;

      param_1[1] = 0;

      *param_2 = iVar4;

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

      return param_2;

    }

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

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

    }

    *param_1 = (int)piVar2;

    param_1[1] = 0;

  }

  *param_2 = iVar4;

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

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

  }

  return param_2;

}





// --- FUN_00485310 at 0x00485310 (size: 165) ---


undefined4 * __thiscall FUN_00485310(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  int *piVar1;

  

  FUN_004efe70();

  FUN_004703b0(param_2,param_3);

  *param_1 = &PTR_FUN_007a29a8;

  param_1[8] = &PTR_LAB_007a2868;

  param_1[0x18a] = &PTR_FUN_0079d180;

  param_1[0x1e8] = 0;

  param_1[0x1e9] = 0;

  param_1[0x1ea] = 0;

  FUN_00401340(&DAT_007938af);

  param_1[0x1ec] = 0;

  param_1[0x1ed] = 0;

  param_1[0x1ee] = 0x3f800000;

  param_1[0x1ef] = 10;

  *(undefined2 *)(param_1 + 0x1f0) = 1;

  *(undefined1 *)((int)param_1 + 0x7c2) = 0;

  piVar1 = (int *)FUN_0043c680();

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

    (**(code **)(*piVar1 + 4))(0x186a4,param_1);

  }

  return param_1;

}





// --- FUN_004853f0 at 0x004853F0 (size: 421) ---


void __thiscall FUN_004853f0(int *param_1,int param_2)



{

  char cVar1;

  int iVar2;

  LONG LVar3;

  char *pcVar4;

  char *local_12c;

  undefined4 *puStack_128;

  int *piStack_124;

  undefined1 auStack_120 [144];

  undefined1 local_90 [144];

  

  FUN_00401340(&DAT_007938af);

  iVar2 = _stricmp((char *)param_1[0x1eb],local_12c);

  pcVar4 = local_12c + -0x14;

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

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

    (*(code *)**(undefined4 **)pcVar4)(1);

  }

  if (iVar2 == 0) {

    param_1[0x1ec] = param_2;

    FUN_0042dc80();

    FUN_0042dc80();

    cVar1 = FUN_004f03e0(param_2,local_90,auStack_120);

    if (cVar1 != '\0') {

      (**(code **)(*param_1 + 0x2b0))(local_90);

      (**(code **)(*param_1 + 0x2b4))(&piStack_124);

      puStack_128 = (undefined4 *)0x0;

      piStack_124 = (int *)0x0;

      cVar1 = FUN_004f0560(param_1[0x1ec],&puStack_128);

      if (cVar1 != '\0') {

        if (*(char *)((int)param_1 + 0x7c2) == '\0') {

          local_12c = (char *)0x0;

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

            (**(code **)(*piStack_124 + 0x88))(&local_12c);

          }

          (**(code **)(*param_1 + 0x2d8))(local_12c);

        }

        else {

          local_12c = (char *)0x0;

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

            (**(code **)(*piStack_124 + 0x78))(&local_12c);

          }

          (**(code **)(*param_1 + 0x2d8))((float)(int)local_12c);

        }

      }

      if (puStack_128 != (undefined4 *)0x0) {

        iVar2 = puStack_128[1];

        puStack_128[1] = iVar2 + -1;

        if (iVar2 + -1 == 0) {

          (**(code **)*puStack_128)(1);

        }

        puStack_128 = (undefined4 *)0x0;

      }

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

        iVar2 = piStack_124[1];

        piStack_124[1] = iVar2 + -1;

        if (iVar2 + -1 == 0) {

          (**(code **)*piStack_124)(1);

        }

        piStack_124 = (int *)0x0;

      }

    }

    FUN_0042e590();

    FUN_0042e590();

  }

  return;

}





// --- FUN_004855a0 at 0x004855A0 (size: 62) ---


undefined4 * __thiscall FUN_004855a0(undefined4 *param_1,int *param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  undefined4 uVar3;

  

  *param_1 = 0;

  param_1[1] = 0;

  piVar2 = (int *)*param_2;

  uVar3 = 0;

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

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

  }

  puVar1 = (undefined4 *)FUN_00485260(&param_2,piVar2,uVar3);

  param_1[1] = *puVar1;

  return param_1;

}





// --- FUN_004855e0 at 0x004855E0 (size: 19) ---


void FUN_004855e0(void)



{

  FUN_00460270(0x10000037,&LAB_004853c0);

  return;

}





// --- FUN_004857e0 at 0x004857E0 (size: 498) ---


float10 __fastcall FUN_004857e0(int param_1)



{

  int iVar1;

  char cVar2;

  int *piVar3;

  int *piVar4;

  undefined1 *puVar5;

  undefined *puVar6;

  int **ppiVar7;

  undefined4 uVar8;

  float local_1c;

  int *local_18;

  undefined1 local_14 [4];

  undefined4 *local_10;

  int *piStack_c;

  int *local_8;

  undefined4 local_4;

  

  local_1c = 0.0;

  if (*(int *)(param_1 + 0x7b0) == 0) {

    if (*(int *)(*(int *)(param_1 + 0x7ac) + -4) != 1) {

      if (*(char *)(param_1 + 0x7c2) != '\0') {

        local_18 = (int *)0x0;

        FUN_005decd0(param_1 + 0x7ac,&local_18);

        return (float10)(int)local_18;

      }

      FUN_005ded50(param_1 + 0x7ac,&local_1c);

    }

  }

  else {

    ppiVar7 = &local_18;

    puVar5 = local_14;

    puVar6 = &DAT_007a2844;

    local_18 = (int *)0x0;

    FUN_00406d10(puVar5,&DAT_007a2844,ppiVar7);

    FUN_00406570(puVar5,puVar6,ppiVar7);

    piVar4 = local_18;

    uVar8 = 0;

    local_8 = (int *)0x0;

    local_4 = 0;

    piVar3 = local_18;

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

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

    }

    piVar3 = (int *)FUN_00485260(&local_10,piVar3,uVar8);

    iVar1 = *piVar3;

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

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

    }

    piVar4 = local_8;

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

      if (-1 < iVar1) {

        local_10 = (undefined4 *)0x0;

        piStack_c = (int *)0x0;

        FUN_0042a2d0(*(undefined4 *)(param_1 + 0x7b0));

        cVar2 = FUN_005d5e20(*(undefined4 *)(param_1 + 0x7b0),&local_10);

        if (cVar2 == '\0') {

          if (*(char *)(param_1 + 0x7c2) == '\0') {

            FUN_00429b80(*(undefined4 *)(param_1 + 0x7a0));

          }

          else {

            uVar8 = FUN_005df4c4();

            piVar4 = local_8;

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

              FUN_00429b10();

              (**(code **)(*piStack_c + 0x7c))(uVar8);

              piVar4 = local_8;

            }

          }

        }

        if (*(char *)(param_1 + 0x7c2) == '\0') {

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

            (**(code **)(*piStack_c + 0x88))(&local_1c);

          }

        }

        else {

          local_18 = (int *)0x0;

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

            (**(code **)(*piStack_c + 0x78))(&local_18);

          }

          local_1c = (float)(int)local_18;

        }

        if (local_10 != (undefined4 *)0x0) {

          iVar1 = local_10[1];

          local_10[1] = iVar1 + -1;

          if (iVar1 + -1 == 0) {

            (**(code **)*local_10)(1);

          }

          local_10 = (undefined4 *)0x0;

        }

        if ((piStack_c != (int *)0x0) &&

           (iVar1 = piStack_c[1], piStack_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

          (**(code **)*piStack_c)(1);

        }

      }

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

      return (float10)local_1c;

    }

  }

  return (float10)local_1c;

}





// --- FUN_004859e0 at 0x004859E0 (size: 24) ---


undefined1 __fastcall FUN_004859e0(int param_1)



{

  float10 fVar1;

  

  fVar1 = (float10)FUN_004857e0();

  *(float *)(param_1 + 0x7a8) = (float)fVar1;

  *(float *)(param_1 + 0x7a4) = (float)fVar1;

  return 1;

}





// --- FUN_00485a00 at 0x00485A00 (size: 25) ---


void __fastcall FUN_00485a00(int *param_1)



{

  float10 fVar1;

  

  fVar1 = (float10)FUN_004857e0();

  param_1[0x1ea] = (int)(float)fVar1;

                    /* WARNING: Could not recover jumptable at 0x00485a13. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (**(code **)(*param_1 + 0x2b8))();

  return;

}





// --- FUN_00485a20 at 0x00485A20 (size: 39) ---


undefined4 * __fastcall FUN_00485a20(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  FUN_0042dc80();

  FUN_0042dc80();

  return param_1;

}





// --- FUN_00485a90 at 0x00485A90 (size: 39) ---


undefined4 __fastcall FUN_00485a90(int *param_1)



{

  int iVar1;

  undefined8 uVar2;

  

  uVar2 = (**(code **)(*param_1 + 0x2dc))();

  iVar1 = (int)((ulonglong)uVar2 >> 0x20);

  param_1[0x1a6] = (int)uVar2;

  param_1[0x1a4] = (int)uVar2;

  param_1[0x1a7] = iVar1;

  param_1[0x1a5] = iVar1;

  return 1;

}





// --- FUN_00485ac0 at 0x00485AC0 (size: 53) ---


undefined4 __fastcall FUN_00485ac0(int *param_1)



{

  param_1[0x1a7] = param_1[0x1a5];

  param_1[0x1a6] = param_1[0x1a4];

  (**(code **)(*param_1 + 0x2d4))(0);

  (**(code **)(*param_1 + 0x2b8))();

  return 1;

}





// --- FUN_00485b00 at 0x00485B00 (size: 53) ---


undefined4 __fastcall FUN_00485b00(int *param_1)



{

  param_1[0x1a7] = param_1[0x1a3];

  param_1[0x1a6] = param_1[0x1a2];

  (**(code **)(*param_1 + 0x2d4))(0);

  (**(code **)(*param_1 + 0x2b8))();

  return 1;

}





// --- FUN_00485b60 at 0x00485B60 (size: 34) ---


void __fastcall FUN_00485b60(int *param_1)



{

  undefined8 uVar1;

  

  uVar1 = (**(code **)(*param_1 + 0x2dc))();

  *(undefined8 *)(param_1 + 0x1a6) = uVar1;

                    /* WARNING: Could not recover jumptable at 0x00485b7c. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (**(code **)(*param_1 + 0x2b8))();

  return;

}





// --- FUN_00485b90 at 0x00485B90 (size: 60) ---


void FUN_00485b90(uint *param_1,uint param_2,uint param_3,char param_4)



{

  if (param_4 != '\0') {

    *param_1 = *param_1 | param_2;

    param_1[1] = param_1[1] | param_3;

    return;

  }

  *param_1 = *param_1 & ~param_2;

  param_1[1] = param_1[1] & ~param_3;

  return;

}





// --- FUN_00485bd0 at 0x00485BD0 (size: 132) ---


void * __thiscall FUN_00485bd0(void *param_1,byte param_2)



{

  int iVar1;

  

  if ((param_2 & 2) == 0) {

    FUN_0042e590();

    FUN_0042e590();

    if ((param_2 & 1) != 0) {

      operator_delete(param_1);

    }

    return param_1;

  }

  iVar1 = *(int *)((int)param_1 + -4);

  if (-1 < iVar1 + -1) {

    do {

      FUN_0042e590();

      FUN_0042e590();

      iVar1 = iVar1 + -1;

    } while (iVar1 != 0);

  }

  if ((param_2 & 1) != 0) {

    operator_delete__((void *)((int)param_1 + -4));

  }

  return (void *)((int)param_1 + -4);

}





// --- FUN_00485c60 at 0x00485C60 (size: 55) ---


undefined4 * __thiscall FUN_00485c60(undefined4 *param_1,undefined4 *param_2)



{

  *param_1 = *param_2;

  param_1[1] = param_2[1];

  FUN_0042de30(param_2 + 2);

  FUN_0042de30(param_2 + 0x26);

  return param_1;

}





// --- FUN_00485ca0 at 0x00485CA0 (size: 217) ---


void __fastcall FUN_00485ca0(int *param_1)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  undefined1 local_120 [144];

  undefined1 local_90 [144];

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar2 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(uVar2 - 1)) {

        iVar3 = (uVar2 - 1) * 0x128;

        do {

          FUN_0042dc80();

          FUN_0042dc80();

          iVar1 = *param_1;

          *(undefined4 *)(iVar1 + iVar3) = 0;

          ((undefined4 *)(iVar1 + iVar3))[1] = 0;

          FUN_0042de30(local_120);

          FUN_0042de30(local_90);

          FUN_0042e590();

          FUN_0042e590();

          iVar3 = iVar3 + -0x128;

          uVar2 = uVar2 - 1;

        } while (uVar2 != 0);

      }

    }

    return;

  }

  if (*param_1 != 0) {

    FUN_00485bd0(3);

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_00485f30 at 0x00485F30 (size: 216) ---


undefined4 __thiscall FUN_00485f30(int *param_1,uint param_2)



{

  uint *puVar1;

  uint uVar2;

  uint *puVar3;

  int iVar4;

  

  uVar2 = param_2;

  if ((uint)param_1[2] <= param_2) {

    if (param_2 <= (param_1[1] & 0x7fffffffU)) {

      return 1;

    }

    if (param_2 == 0) {

      FUN_00485ca0();

      return 1;

    }

    puVar3 = (uint *)thunk_FUN_005df0f5(param_2 * 0x128 + 4);

    if (puVar3 != (uint *)0x0) {

      puVar1 = puVar3 + 1;

      *puVar3 = param_2;

      FUN_00401000(puVar1,0x128,param_2,FUN_00485a20);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          param_2 = param_1[2];

          if (-1 < (int)(param_2 + -1)) {

            iVar4 = (param_2 + -1) * 0x128;

            do {

              FUN_00485c60(*param_1 + iVar4);

              iVar4 = iVar4 + -0x128;

              param_2 = param_2 + -1;

            } while (param_2 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

            FUN_00485bd0(3);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_00486010 at 0x00486010 (size: 140) ---


undefined4 * __thiscall FUN_00486010(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  LONG *lpAddend;

  

  FUN_004efe70();

  FUN_0046e070(param_2,param_3);

  param_1[8] = &PTR_LAB_007a2fd0;

  *param_1 = &PTR_FUN_007a2cf0;

  param_1[0x1a2] = 0;

  param_1[0x1a3] = 0;

  param_1[0x1a4] = 0;

  param_1[0x1a5] = 0;

  param_1[0x1a6] = 0;

  param_1[0x1a7] = 0;

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x1a8] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  param_1[0x1a9] = 0;

  param_1[0x1aa] = 0;

  param_1[0x1ab] = 0;

  param_1[0x1ac] = 0;

  param_1[0x1ad] = 0;

  return param_1;

}





// --- FUN_00486110 at 0x00486110 (size: 107) ---


void __fastcall FUN_00486110(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  *param_1 = &PTR_FUN_007a2cf0;

  param_1[8] = &PTR_LAB_007a2fd0;

  if (((param_1[0x1ac] & 0x80000000) == 0x80000000) && (param_1[0x1ab] != 0)) {

    FUN_00485bd0(3);

  }

  puVar2 = (undefined4 *)(param_1[0x1a8] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x1a8] + -0x10));

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

    (**(code **)*puVar2)(1);

  }

  FUN_0046e140();

  FUN_004efed0();

  return;

}





// --- FUN_004861b0 at 0x004861B0 (size: 184) ---


void __fastcall FUN_004861b0(int *param_1)



{

  int iVar1;

  int *piVar2;

  undefined4 uVar3;

  int iVar4;

  uint uVar5;

  

  uVar5 = 0;

  if (param_1[0x1ad] != 0) {

    iVar4 = 0;

    do {

      iVar1 = FUN_0046f670(0,0);

      if (iVar1 != 0) {

        piVar2 = (int *)FUN_00463c00(0x10000219);

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

          iVar1 = (**(code **)(*piVar2 + 0x94))(1);

          if (iVar1 != 0) {

            FUN_004606b0(0x10000084,uVar5);

            FUN_0046a350(param_1[0x1ab] + 8 + iVar4);

            FUN_004618a0(param_1[0x1ab] + 0x98 + iVar4);

          }

        }

      }

      uVar5 = uVar5 + 1;

      iVar4 = iVar4 + 0x128;

    } while (uVar5 < (uint)param_1[0x1ad]);

  }

  iVar4 = param_1[8];

  uVar3 = FUN_0046dbf0(0,0xffffffff);

  uVar3 = FUN_0069fe60(uVar3);

  (**(code **)(iVar4 + 0x30))(uVar3);

                    /* WARNING: Could not recover jumptable at 0x00486262. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (**(code **)(*param_1 + 0x2b8))();

  return;

}





// --- FUN_00486270 at 0x00486270 (size: 30) ---


void * __thiscall FUN_00486270(void *param_1,byte param_2)



{

  FUN_00486110();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00486290 at 0x00486290 (size: 19) ---


void FUN_00486290(void)



{

  FUN_00460270(0x10000044,&LAB_00486180);

  return;

}





// --- FUN_004862b0 at 0x004862B0 (size: 113) ---


void __thiscall FUN_004862b0(char *param_1,undefined4 param_2,undefined4 param_3)



{

  int iVar1;

  LONG LVar2;

  

  FUN_00401340(&DAT_007938af);

  iVar1 = _stricmp(*(char **)(param_1 + 0x6a0),param_1);

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

  if ((LVar2 == 0) && (param_1 + -0x14 != (char *)0x0)) {

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

  }

  if (iVar1 == 0) {

    *(undefined4 *)(param_1 + 0x6a4) = param_2;

    *(undefined4 *)(param_1 + 0x6a8) = param_3;

  }

  return;

}





// --- FUN_00486330 at 0x00486330 (size: 117) ---


undefined4 __thiscall FUN_00486330(int *param_1,undefined4 *param_2)



{

  int iVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  

  if ((param_1[1] & 0x7fffffffU) <= (uint)param_1[2]) {

    uVar2 = FUN_00453850((param_1[1] & 0x7fffffffU) + 1);

    uVar2 = FUN_00485f30(uVar2);

    if ((char)uVar2 == '\0') {

      return uVar2;

    }

  }

  puVar3 = (undefined4 *)(param_1[2] * 0x128 + *param_1);

  *puVar3 = *param_2;

  puVar3[1] = param_2[1];

  FUN_0042de30(param_2 + 2);

  FUN_0042de30(param_2 + 0x26);

  iVar1 = param_1[2];

  param_1[2] = iVar1 + 1;

  return CONCAT31((int3)((uint)(iVar1 + 1) >> 8),1);

}





// --- FUN_00486510 at 0x00486510 (size: 333) ---


undefined8 __fastcall FUN_00486510(int param_1)



{

  int iVar1;

  int *piVar2;

  char cVar3;

  undefined1 *puVar4;

  undefined *puVar5;

  int *piVar6;

  int **ppiVar7;

  undefined4 uVar8;

  int *local_24;

  undefined1 local_20 [4];

  undefined1 local_1c [4];

  undefined4 *puStack_18;

  int *piStack_14;

  undefined4 local_10;

  undefined4 local_c;

  int *local_8;

  undefined4 local_4;

  

  local_10 = *(undefined4 *)(param_1 + 0x688);

  local_c = *(undefined4 *)(param_1 + 0x68c);

  if (*(int *)(param_1 + 0x6a4) == 0) goto LAB_00486656;

  ppiVar7 = &local_24;

  puVar4 = local_20;

  puVar5 = &DAT_007a2ccc;

  local_24 = (int *)0x0;

  FUN_00406d10(puVar4,&DAT_007a2ccc,ppiVar7);

  FUN_00406570(puVar4,puVar5,ppiVar7);

  piVar2 = local_24;

  uVar8 = 0;

  local_8 = (int *)0x0;

  local_4 = 0;

  piVar6 = local_24;

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

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

  }

  FUN_00485260(local_1c,piVar6,uVar8);

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

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

  }

  piVar2 = local_8;

  puStack_18 = (undefined4 *)0x0;

  piStack_14 = (int *)0x0;

  if (*(int *)(param_1 + 0x6a8) == 0) {

    cVar3 = FUN_005d5e20(*(undefined4 *)(param_1 + 0x6a4),&puStack_18);

LAB_004865e2:

    if ((cVar3 != '\0') && (piStack_14 != (int *)0x0)) {

      (**(code **)(*piStack_14 + 0xe8))(&local_10);

    }

    if (puStack_18 != (undefined4 *)0x0) {

      iVar1 = puStack_18[1];

      puStack_18[1] = iVar1 + -1;

      if (iVar1 + -1 == 0) {

        (**(code **)*puStack_18)(1);

      }

      puStack_18 = (undefined4 *)0x0;

    }

  }

  else if (*(int *)(param_1 + 0x6a8) == 1) {

    cVar3 = FUN_005d6690(*(undefined4 *)(param_1 + 0x18),*(undefined4 *)(param_1 + 0x6a4),

                         &puStack_18);

    goto LAB_004865e2;

  }

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

    iVar1 = piStack_14[1];

    piStack_14[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*piStack_14)(1);

    }

    piStack_14 = (int *)0x0;

  }

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

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

  }

LAB_00486656:

  return CONCAT44(local_c,local_10);

}





// --- FUN_00486660 at 0x00486660 (size: 146) ---


void FUN_00486660(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  undefined4 local_128;

  undefined4 local_124;

  

  local_124 = param_2;

  local_128 = param_1;

  FUN_0042dc80();

  FUN_0042dc80();

  FUN_0042c9c0(param_3,0x10000006);

  FUN_0042c9c0(param_4,0x10000006);

  FUN_00486330(&local_128);

  FUN_0042e590();

  FUN_0042e590();

  return;

}





// --- FUN_004867f0 at 0x004867F0 (size: 53) ---


undefined4 * __thiscall FUN_004867f0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a32e0;

  param_1[8] = &PTR_LAB_007a31a0;

  param_1[0x18a] = &PTR_FUN_0079d180;

  FUN_00486ec0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00486830 at 0x00486830 (size: 19) ---


void FUN_00486830(void)



{

  FUN_00460270(0x10000043,&LAB_00486780);

  return;

}





// --- FUN_00486ca0 at 0x00486CA0 (size: 27) ---


undefined4 __fastcall FUN_00486ca0(int *param_1)



{

  undefined1 uVar1;

  

  uVar1 = (**(code **)(*param_1 + 0x2e0))();

  *(undefined1 *)((int)param_1 + 0x742) = uVar1;

  *(undefined1 *)((int)param_1 + 0x741) = uVar1;

  return 1;

}





// --- FUN_00486cc0 at 0x00486CC0 (size: 39) ---


undefined4 __fastcall FUN_00486cc0(int *param_1)



{

  *(undefined1 *)((int)param_1 + 0x742) = *(undefined1 *)((int)param_1 + 0x741);

  (**(code **)(*param_1 + 0x2d4))(0);

  (**(code **)(*param_1 + 0x2b8))();

  return 1;

}





// --- FUN_00486cf0 at 0x00486CF0 (size: 39) ---


undefined4 __fastcall FUN_00486cf0(int *param_1)



{

  *(char *)((int)param_1 + 0x742) = (char)param_1[0x1d0];

  (**(code **)(*param_1 + 0x2d4))(0);

  (**(code **)(*param_1 + 0x2b8))();

  return 1;

}





// --- FUN_00486dd0 at 0x00486DD0 (size: 28) ---


void __fastcall FUN_00486dd0(int *param_1)



{

  undefined1 uVar1;

  

  uVar1 = (**(code **)(*param_1 + 0x2e0))();

  *(undefined1 *)((int)param_1 + 0x742) = uVar1;

                    /* WARNING: Could not recover jumptable at 0x00486de6. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (**(code **)(*param_1 + 0x2b8))();

  return;

}





// --- FUN_00486e10 at 0x00486E10 (size: 120) ---


undefined4 * __thiscall FUN_00486e10(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  LONG *lpAddend;

  

  FUN_004efe70();

  FUN_00471f10(param_2,param_3);

  *param_1 = &PTR_FUN_007a3770;

  param_1[8] = &PTR_LAB_007a3630;

  param_1[0x18a] = &PTR_FUN_0079d180;

  *(undefined1 *)(param_1 + 0x1d0) = 0;

  *(undefined1 *)((int)param_1 + 0x741) = 0;

  *(undefined1 *)((int)param_1 + 0x742) = 0;

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x1d1] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  param_1[0x1d2] = 0;

  param_1[0x1d3] = 0xffffffff;

  return param_1;

}





// --- FUN_00486ec0 at 0x00486EC0 (size: 82) ---


void __fastcall FUN_00486ec0(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)(param_1[0x1d1] + -0x14);

  *param_1 = &PTR_FUN_007a3770;

  param_1[8] = &PTR_LAB_007a3630;

  param_1[0x18a] = &PTR_FUN_0079d180;

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x1d1] + -0x10));

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

    (**(code **)*puVar2)(1);

  }

  FUN_00471f80();

  FUN_004efed0();

  return;

}





// --- FUN_00486f50 at 0x00486F50 (size: 136) ---


void __thiscall FUN_00486f50(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  char cVar2;

  undefined4 local_8;

  undefined4 local_4;

  

  uVar1 = param_2;

  if ((*(int *)(param_1 + 0x748) == 0) && (*(int *)(param_1 + 0x74c) == -1)) {

    FUN_00402070(param_2);

    param_2 = 0;

    local_8 = 0;

    local_4 = 0;

    cVar2 = FUN_005de940(uVar1,&param_2,&local_8,&local_4);

    if (cVar2 != '\0') {

      FUN_004eff00(local_8,param_2);

      FUN_004eff50(local_4,param_2);

    }

  }

  return;

}





// --- FUN_00486fe0 at 0x00486FE0 (size: 30) ---


void * __thiscall FUN_00486fe0(void *param_1,byte param_2)



{

  FUN_00486ec0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00487000 at 0x00487000 (size: 19) ---


void FUN_00487000(void)



{

  FUN_00460270(0x10000035,&LAB_00486f20);

  return;

}





// --- FUN_00487240 at 0x00487240 (size: 222) ---


void __thiscall FUN_00487240(int param_1,int *param_2)



{

  int iVar1;

  int *piVar2;

  undefined1 uVar3;

  int *piVar4;

  undefined1 *puVar5;

  undefined *puVar6;

  undefined4 *puVar7;

  undefined4 uVar8;

  undefined1 local_10 [4];

  undefined1 local_c [4];

  int *local_8;

  undefined4 local_4;

  

  if ((*(int *)(param_1 + 0x748) == 0) && (*(int *)(*(int *)(param_1 + 0x744) + -4) == 1)) {

    puVar7 = &param_2;

    puVar5 = local_10;

    puVar6 = &DAT_007a360c;

    *(int **)(param_1 + 0x74c) = param_2;

    param_2 = (int *)0x0;

    FUN_00406d10(puVar5,&DAT_007a360c,puVar7);

    FUN_00406570(puVar5,puVar6,puVar7);

    piVar2 = param_2;

    uVar8 = 0;

    local_8 = (int *)0x0;

    local_4 = 0;

    piVar4 = param_2;

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

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

    }

    piVar4 = (int *)FUN_00485260(local_c,piVar4,uVar8);

    iVar1 = *piVar4;

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

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

    }

    piVar2 = local_8;

    if ((local_8 != (int *)0x0) && (-1 < iVar1)) {

      uVar3 = FUN_005d3a30(*(undefined4 *)(param_1 + 0x74c));

      *(undefined1 *)(param_1 + 0x740) = uVar3;

    }

    piVar4 = (int *)FUN_0043c680();

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

      (**(code **)(*piVar4 + 4))(0x4dd21f,param_1);

    }

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

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

    }

  }

  return;

}





// --- FUN_00487430 at 0x00487430 (size: 34) ---


void __fastcall FUN_00487430(int param_1)



{

  if (*(int *)(param_1 + 0x788) != 0) {

    FUN_00478560(*(int *)(param_1 + 0x788));

    *(undefined4 *)(param_1 + 0x788) = 0;

  }

  return;

}





// --- FUN_00487480 at 0x00487480 (size: 97) ---


int __thiscall FUN_00487480(int *param_1,char *param_2,va_list param_3)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  iVar2 = _vscprintf(param_2,param_3);

  puVar1 = (undefined4 *)*param_1;

  FUN_00403560(iVar2);

  _vsnprintf((char *)(*param_1 + 0x14),iVar2 + 1,param_2,param_3);

  LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  return iVar2;

}





// --- FUN_004874f0 at 0x004874F0 (size: 94) ---


undefined4 __thiscall FUN_004874f0(int param_1,undefined4 *param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0x14);

  if (puVar2 == (undefined4 *)0x0) {

    return 0;

  }

  *puVar2 = *param_2;

  puVar2[1] = param_2[1];

  puVar2[2] = param_2[2];

  puVar2[3] = 0;

  puVar2[4] = 0;

  if (*(int *)(param_1 + 4) == 0) {

    *(undefined4 **)(param_1 + 4) = puVar2;

    *(undefined4 **)(param_1 + 8) = puVar2;

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    return 1;

  }

  iVar1 = *(int *)(param_1 + 8);

  *(undefined4 **)(iVar1 + 0xc) = puVar2;

  puVar2[4] = iVar1;

  *(undefined4 **)(param_1 + 8) = puVar2;

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

  return 1;

}





// --- FUN_00487570 at 0x00487570 (size: 53) ---


int __thiscall FUN_00487570(int param_1,undefined4 param_2)



{

  int iVar1;

  char cVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  while( true ) {

    if (iVar1 == 0) {

      return 0;

    }

    cVar2 = FUN_0068b260(param_2);

    if (cVar2 != '\0') break;

    if (iVar1 == 0) {

      return 0;

    }

    iVar1 = *(int *)(iVar1 + 0xc);

  }

  return iVar1;

}





// --- FUN_004875b0 at 0x004875B0 (size: 99) ---


void __fastcall FUN_004875b0(int *param_1)



{

  uint uVar1;

  undefined4 *puVar2;

  int iVar3;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) == 0x80000000) {

    operator_delete__((void *)*param_1);

    *param_1 = 0;

    param_1[1] = 0;

    return;

  }

  if (*param_1 != 0) {

    uVar1 = param_1[1] & 0x7fffffff;

    if (-1 < (int)(uVar1 - 1)) {

      iVar3 = (uVar1 - 1) * 0x14;

      do {

        puVar2 = (undefined4 *)(*param_1 + iVar3);

        *puVar2 = 0;

        iVar3 = iVar3 + -0x14;

        uVar1 = uVar1 - 1;

        puVar2[1] = 0xffffffff;

        puVar2[2] = 0;

        puVar2[3] = 0;

        puVar2[4] = 0;

      } while (uVar1 != 0);

    }

  }

  return;

}





// --- FUN_00487620 at 0x00487620 (size: 20) ---


void FUN_00487620(undefined4 param_1,undefined4 param_2)



{

  FUN_00487480(param_2,&stack0x0000000c);

  return;

}





// --- FUN_004878a0 at 0x004878A0 (size: 46) ---


int __thiscall FUN_004878a0(int param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  if ((iVar1 != 0) && (param_2 < *(uint *)(param_1 + 0xc))) {

    uVar2 = 0;

    while (uVar2 != param_2) {

      if (iVar1 != 0) {

        iVar1 = *(int *)(iVar1 + 0xc);

      }

      uVar2 = uVar2 + 1;

      if (iVar1 == 0) {

        return 0;

      }

    }

    if (iVar1 != 0) {

      return iVar1;

    }

  }

  return 0;

}





// --- FUN_004878d0 at 0x004878D0 (size: 105) ---


uint __thiscall FUN_004878d0(int *param_1,int *param_2)



{

  int iVar1;

  char cVar2;

  int iVar3;

  uint local_4;

  

  iVar3 = 0;

  local_4 = 0;

  if (param_1[2] != 0) {

    do {

      iVar1 = *param_1;

      if (*(int *)(iVar1 + iVar3) == *param_2) {

        cVar2 = FUN_0068b260(param_2 + 1);

        if ((cVar2 != '\0') && (*(int *)(iVar1 + iVar3 + 0x10) == param_2[4])) {

          return local_4;

        }

      }

      local_4 = local_4 + 1;

      iVar3 = iVar3 + 0x14;

    } while (local_4 < (uint)param_1[2]);

  }

  return 0xffffffff;

}





// --- FUN_00487940 at 0x00487940 (size: 105) ---


uint __thiscall FUN_00487940(int *param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)param_1[2];

  if (param_2 < puVar2) {

    puVar2 = (undefined4 *)((int)puVar2 + -1);

    param_1[2] = (int)puVar2;

    if (param_2 != puVar2) {

      puVar2 = (undefined4 *)(*param_1 + (int)puVar2 * 0x14);

      puVar1 = (undefined4 *)(*param_1 + (int)param_2 * 0x14);

      *puVar1 = *puVar2;

      puVar1[1] = puVar2[1];

      puVar1[2] = puVar2[2];

      puVar1[3] = puVar2[3];

      puVar1[4] = puVar2[4];

      puVar2 = (undefined4 *)(*param_1 + param_1[2] * 0x14);

      *puVar2 = 0;

      puVar2[1] = 0xffffffff;

      puVar2[2] = 0;

      puVar2[3] = 0;

      puVar2[4] = 0;

    }

    return CONCAT31((int3)((uint)puVar2 >> 8),1);

  }

  return (uint)puVar2 & 0xffffff00;

}





// --- FUN_004879b0 at 0x004879B0 (size: 230) ---


undefined4 __thiscall FUN_004879b0(int *param_1,uint param_2)



{

  uint uVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  

  uVar1 = param_2;

  if (param_2 < (uint)param_1[2]) {

    return 0;

  }

  if ((param_1[1] & 0x7fffffffU) < param_2) {

    if (param_2 == 0) {

      FUN_004875b0();

      return 1;

    }

    iVar2 = thunk_FUN_005df0f5(param_2 * 0x14);

    if (iVar2 == 0) {

      return 0;

    }

    FUN_00401000(iVar2,0x14,param_2,&LAB_00487550);

    if (*param_1 != 0) {

      param_2 = param_1[2];

      if (-1 < (int)(param_2 + -1)) {

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

        do {

          puVar3 = (undefined4 *)((int)puVar4 + *param_1 + (-0xc - iVar2));

          puVar4[-3] = *puVar3;

          puVar4[-2] = puVar3[1];

          puVar4[-1] = puVar3[2];

          *puVar4 = puVar3[3];

          puVar4[1] = puVar3[4];

          puVar4 = puVar4 + -5;

          param_2 = param_2 + -1;

        } while (param_2 != 0);

      }

      if ((param_1[1] & 0x80000000U) == 0x80000000) {

        operator_delete__((void *)*param_1);

      }

    }

    *param_1 = iVar2;

    param_1[1] = uVar1 | 0x80000000;

  }

  return 1;

}





// --- FUN_00487b40 at 0x00487B40 (size: 172) ---


undefined4 __thiscall FUN_00487b40(int param_1,uint param_2)



{

  int *piVar1;

  undefined4 *puVar2;

  

  piVar1 = DAT_00837ff4;

  if (((DAT_00837ff4 != (int *)0x0) && (-1 < (int)param_2)) &&

     (param_2 < *(uint *)(param_1 + 0x774))) {

    puVar2 = (undefined4 *)FUN_004878a0(param_2);

    if (puVar2 != (undefined4 *)0x0) {

      (**(code **)(*piVar1 + 0x8c))(*puVar2,puVar2[1],puVar2[2],*(undefined4 *)(param_1 + 0x744));

      (**(code **)(*piVar1 + 0x88))(*puVar2,puVar2[1],puVar2[2],1,*(undefined4 *)(param_1 + 0x744));

      FUN_006a3630(puVar2);

      if (*(undefined4 **)(param_1 + 0x14) != (undefined4 *)0x0) {

        (**(code **)**(undefined4 **)(param_1 + 0x14))(param_1);

      }

      return 1;

    }

  }

  return 0;

}





// --- FUN_00487e20 at 0x00487E20 (size: 36) ---


undefined4 * __thiscall FUN_00487e20(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a3c34;

  FUN_0049f850();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00487e50 at 0x00487E50 (size: 939) ---


undefined1 __thiscall FUN_00487e50(uint param_1,int param_2,uint param_3,int param_4,int param_5)



{

  undefined4 uVar1;

  int *piVar2;

  char cVar3;

  undefined1 uVar4;

  undefined4 *puVar5;

  LONG LVar6;

  int unaff_EBP;

  uint uVar7;

  int iVar8;

  undefined4 unaff_retaddr;

  uint local_34;

  void *pvStack_30;

  uint local_2c;

  uint uStack_28;

  undefined4 *puStack_20;

  undefined **ppuStack_18;

  undefined4 *puStack_14;

  undefined4 uStack_10;

  undefined4 uStack_c;

  undefined4 uStack_4;

  

  piVar2 = DAT_00837ff4;

  iVar8 = *(int *)(param_1 + 0x774);

  if ((param_5 <= *(int *)(param_1 + 0x774)) && (iVar8 = param_5, param_5 < 0)) {

    param_5 = 0;

    iVar8 = param_5;

  }

  param_5 = iVar8;

  if (param_2 == -1) {

    return 0;

  }

  if (param_4 == 0) {

    return 0;

  }

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

    return 0;

  }

  local_2c = param_1;

  (**(code **)(*DAT_00837ff4 + 0x7c))(&local_34,&param_2);

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

    ppuStack_18 = &PTR_FUN_007a3c34;

    puStack_14 = (undefined4 *)0x0;

    uStack_10 = 0;

    uStack_c = 0;

    (**(code **)(*piVar2 + 0x94))(*(undefined4 *)(param_1 + 0x744),&ppuStack_18);

    for (puStack_20 = puStack_14; puStack_20 != (undefined4 *)0x0;

        puStack_20 = (undefined4 *)puStack_20[1]) {

      uVar7 = 0;

      uVar1 = *puStack_20;

      pvStack_30 = (void *)0x0;

      local_2c = 0;

      uStack_28 = 0;

      cVar3 = (**(code **)(*piVar2 + 0x98))(param_1 + 0x778,uVar1,&pvStack_30);

      if (((cVar3 != '\0') && (uStack_28 != 0)) && (uStack_28 != 0)) {

        iVar8 = 0;

        do {

          (**(code **)(*piVar2 + 0x8c))

                    (*(undefined4 *)(iVar8 + (int)pvStack_30),

                     *(undefined4 *)(iVar8 + 4 + (int)pvStack_30),

                     *(undefined4 *)(iVar8 + 8 + (int)pvStack_30),uVar1);

          uVar7 = uVar7 + 1;

          iVar8 = iVar8 + 0x10;

          param_1 = local_34;

        } while (uVar7 < uStack_28);

      }

      if ((local_2c & 0x80000000) == 0x80000000) {

        operator_delete__(pvStack_30);

      }

    }

    if (((int)param_3 < 0) || (*(uint *)(param_1 + 0x774) <= param_3)) {

      if (*(uint *)(param_1 + 0x73c) <= *(uint *)(param_1 + 0x774)) {

        puVar5 = *(undefined4 **)(param_1 + 0x76c);

        if (puVar5 == (undefined4 *)0x0) {

          ppuStack_18 = &PTR_FUN_007a3c34;

          FUN_0049f850();

          goto LAB_0048817e;

        }

        (**(code **)(*piVar2 + 0x8c))(*puVar5,puVar5[1],puVar5[2],*(undefined4 *)(param_1 + 0x744));

        cVar3 = FUN_0068b190(puVar5);

        if (cVar3 == '\0') {

          (**(code **)(*piVar2 + 0x88))

                    (*puVar5,puVar5[1],puVar5[2],1,*(undefined4 *)(param_1 + 0x744));

        }

      }

      (**(code **)(*piVar2 + 0x88))

                (uStack_4,unaff_retaddr,param_2,*(undefined4 *)(param_1 + 0x740),

                 *(undefined4 *)(param_1 + 0x744));

      FUN_004874f0(&uStack_4);

    }

    else {

      puVar5 = (undefined4 *)FUN_004878a0(param_3);

      if (puVar5 != (undefined4 *)0x0) {

        (**(code **)(*piVar2 + 0x8c))(*puVar5,puVar5[1],puVar5[2],*(undefined4 *)(param_1 + 0x744));

        cVar3 = FUN_0068b190(puVar5);

        if (cVar3 == '\0') {

          (**(code **)(*piVar2 + 0x88))

                    (*puVar5,puVar5[1],puVar5[2],1,*(undefined4 *)(param_1 + 0x744));

        }

        *puVar5 = puStack_14;

        puVar5[1] = uStack_10;

        puVar5[2] = uStack_c;

        (**(code **)(*piVar2 + 0x9c))

                  (*(undefined4 *)(param_1 + 0x740),*(undefined4 *)(param_1 + 0x744));

        for (puVar5 = *(undefined4 **)(param_1 + 0x76c); puVar5 != (undefined4 *)0x0;

            puVar5 = (undefined4 *)puVar5[3]) {

          (**(code **)(*piVar2 + 0x88))

                    (*puVar5,puVar5[1],puVar5[2],*(undefined4 *)(param_1 + 0x740),

                     *(undefined4 *)(param_1 + 0x744));

        }

      }

    }

    if (*(undefined4 **)(param_1 + 0x14) != (undefined4 *)0x0) {

      (**(code **)**(undefined4 **)(param_1 + 0x14))(param_1);

    }

    uVar4 = FUN_006a3630(&uStack_4);

    ppuStack_18 = &PTR_FUN_007a3c34;

    FUN_0049f850();

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

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

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

    }

    return uVar4;

  }

LAB_0048817e:

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

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

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

  }

  return 0;

}





// --- FUN_00488200 at 0x00488200 (size: 77) ---


undefined4 __fastcall FUN_00488200(int *param_1)



{

  uint uVar1;

  

  if (param_1[0x1db] != 0) {

    uVar1 = 0;

    if (param_1[0x1dd] != 0) {

      do {

        FUN_00487b40(uVar1);

        uVar1 = uVar1 + 1;

      } while (uVar1 < (uint)param_1[0x1dd]);

    }

    FUN_00431730();

    (**(code **)(*param_1 + 0x2b8))();

  }

  return 1;

}





// --- FUN_00488250 at 0x00488250 (size: 109) ---


int __thiscall FUN_00488250(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 *puVar3;

  

  if (param_1 != param_2) {

    FUN_00431730();

    for (puVar1 = *(undefined4 **)(param_2 + 4); puVar1 != (undefined4 *)0x0;

        puVar1 = (undefined4 *)puVar1[3]) {

      puVar3 = (undefined4 *)FUN_005df0f5(0x14);

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

        *puVar3 = *puVar1;

        puVar3[1] = puVar1[1];

        puVar3[2] = puVar1[2];

        puVar3[3] = 0;

        puVar3[4] = 0;

        if (*(int *)(param_1 + 4) == 0) {

          *(undefined4 **)(param_1 + 4) = puVar3;

        }

        else {

          iVar2 = *(int *)(param_1 + 8);

          *(undefined4 **)(iVar2 + 0xc) = puVar3;

          puVar3[4] = iVar2;

        }

        *(undefined4 **)(param_1 + 8) = puVar3;

        *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

      }

      if (puVar1 == (undefined4 *)0x0) {

        return param_1;

      }

    }

  }

  return param_1;

}





// --- FUN_004882c0 at 0x004882C0 (size: 36) ---


undefined4 * __thiscall FUN_004882c0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a3c38;

  FUN_00431730();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004882f0 at 0x004882F0 (size: 83) ---


void FUN_004882f0(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  FUN_00404a40(0,param_1);

  FUN_005649f0(&param_1,param_2,param_3,param_4);

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

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

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

    (**(code **)*puVar2)(1);

  }

  return;

}





// --- FUN_00488350 at 0x00488350 (size: 224) ---


undefined4 * __thiscall FUN_00488350(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_004efe70();

  FUN_00468800(param_2,param_3);

  param_1[0x1cc] = 0;

  *param_1 = &PTR_FUN_007a3d98;

  param_1[8] = &PTR_LAB_007a3c58;

  param_1[0x18a] = &PTR_FUN_007a3c3c;

  param_1[0x1cd] = 0;

  param_1[0x1ce] = 0;

  param_1[0x1cf] = 0;

  param_1[0x1d0] = 0;

  param_1[0x1d1] = 0;

  param_1[0x1d3] = 0;

  param_1[0x1d4] = 0;

  param_1[0x1d5] = 0;

  param_1[0x1d2] = &PTR_FUN_007a3c38;

  param_1[0x1d6] = &PTR_FUN_007a3c38;

  param_1[0x1d7] = 0;

  param_1[0x1d8] = 0;

  param_1[0x1d9] = 0;

  param_1[0x1da] = &PTR_FUN_007a3c38;

  param_1[0x1db] = 0;

  param_1[0x1dc] = 0;

  param_1[0x1dd] = 0;

  param_1[0x1df] = 0;

  param_1[0x1e0] = 0;

  param_1[0x1de] = 0xffffffff;

  param_1[0x1e2] = 0;

  param_1[0x1e3] = 0;

  param_1[0x1e4] = 0;

  param_1[0x1e5] = 0;

  param_1[0x1e1] = 0xffffffff;

  return param_1;

}





// --- FUN_004884a0 at 0x004884A0 (size: 179) ---


void __fastcall FUN_004884a0(undefined4 *param_1)



{

  int *piVar1;

  

  *param_1 = &PTR_FUN_007a3d98;

  param_1[8] = &PTR_LAB_007a3c58;

  param_1[0x18a] = &PTR_FUN_007a3c3c;

  piVar1 = (int *)FUN_0043c680();

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

    (**(code **)(*piVar1 + 0xc))(param_1);

  }

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

    (**(code **)(*DAT_00837ff4 + 0x4c))(param_1 + 0x18a,0x20);

  }

  FUN_00465fb0(0xc);

  param_1[0x1da] = &PTR_FUN_007a3c38;

  FUN_00431730();

  param_1[0x1d6] = &PTR_FUN_007a3c38;

  FUN_00431730();

  param_1[0x1d2] = &PTR_FUN_007a3c38;

  FUN_00431730();

  if ((param_1[0x1ce] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[0x1cd]);

  }

  FUN_004679f0();

  FUN_004efed0();

  return;

}





// --- FUN_00488820 at 0x00488820 (size: 35) ---


undefined4 __fastcall FUN_00488820(int *param_1)



{

  FUN_00488250(param_1 + 0x1d2);

  (**(code **)(*param_1 + 0x2b8))();

  return 1;

}





// --- FUN_00488850 at 0x00488850 (size: 65) ---


void __fastcall FUN_00488850(int *param_1)



{

  FUN_00431730();

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

    (**(code **)(*DAT_00837ff4 + 0x90))(param_1[0x1d0],param_1[0x1d1],param_1 + 0x1da);

                    /* WARNING: Could not recover jumptable at 0x00488888. Too many branches */

                    /* WARNING: Treating indirect jump as call */

    (**(code **)(*param_1 + 0x2b8))();

    return;

  }

  return;

}





// --- FUN_00488a20 at 0x00488A20 (size: 426) ---


void __fastcall FUN_00488a20(int param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  undefined4 *puStack_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if (DAT_00837ff4 != 0) {

    *(undefined4 *)(param_1 + 0x794) = 1;

    if ((*(int *)(param_1 + 0x740) == 0x33) && (*(int *)(param_1 + 0x744) == 5)) {

      local_c = 0x80101;

      local_8 = 0;

      local_4 = 2;

      local_10 = 0;

      (**(code **)(*(int *)(param_1 + 0x628) + 0x14))(&local_c,&local_10);

      *(undefined4 *)(param_1 + 0x778) = 0xffffffff;

      *(undefined4 *)(param_1 + 0x77c) = 0;

      *(undefined4 *)(param_1 + 0x780) = 0;

      *(undefined4 *)(param_1 + 0x784) = 0xffffffff;

      puStack_14 = DAT_008ef11c;

      InterlockedIncrement(DAT_008ef11c + 1);

      FUN_00487620(&puStack_14,"The key for Camera Zoom In has been changed to the mouse wheel up.")

      ;

      puVar1 = puStack_14;

      uVar6 = 0;

      uVar5 = 1;

      puVar3 = puStack_14 + 5;

      uVar4 = 7;

      FUN_00564d30(puVar3,7,1,0);

      FUN_004882f0(puVar3,uVar4,uVar5,uVar6);

      LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

      }

    }

    if ((*(int *)(param_1 + 0x740) == 0x34) && (*(int *)(param_1 + 0x744) == 5)) {

      local_c = 0x80201;

      local_8 = 0;

      local_4 = 2;

      local_10 = 0;

      (**(code **)(*(int *)(param_1 + 0x628) + 0x14))(&local_c,&local_10);

      *(undefined4 *)(param_1 + 0x778) = 0xffffffff;

      *(undefined4 *)(param_1 + 0x77c) = 0;

      *(undefined4 *)(param_1 + 0x780) = 0;

      *(undefined4 *)(param_1 + 0x784) = 0xffffffff;

      puVar1 = DAT_008ef11c;

      InterlockedIncrement(DAT_008ef11c + 1);

      FUN_00487620(&stack0xffffffe4,

                   "The key for Camera Zoom Out has been changed to the mouse wheel down.");

      uVar6 = 0;

      uVar5 = 1;

      puVar3 = puVar1 + 5;

      uVar4 = 7;

      FUN_00564d30(puVar3,7,1,0);

      FUN_004882f0(puVar3,uVar4,uVar5,uVar6);

      LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

      }

    }

    *(undefined4 *)(param_1 + 0x794) = 0;

  }

  return;

}





// --- FUN_00488bd0 at 0x00488BD0 (size: 30) ---


void * __thiscall FUN_00488bd0(void *param_1,byte param_2)



{

  FUN_004884a0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00488bf0 at 0x00488BF0 (size: 19) ---


void FUN_00488bf0(void)



{

  FUN_00460270(0x10000034,&LAB_00488560);

  return;

}





// --- FUN_00488c10 at 0x00488C10 (size: 236) ---


void __thiscall

FUN_00488c10(int *param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5,

            undefined4 param_6)



{

  char cVar1;

  LONG LVar2;

  int unaff_retaddr;

  

  param_1[0x1d1] = param_3;

  param_1[0x1d0] = param_2;

  FUN_00431730();

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

    (**(code **)(*DAT_00837ff4 + 0x90))(param_1[0x1d0],param_1[0x1d1],param_1 + 0x1da);

    (**(code **)(*param_1 + 0x2b8))();

  }

  FUN_00488250(param_6);

  (**(code **)(*param_1 + 0x2b0))(param_4);

  cVar1 = FUN_0042ce00(1);

  if (cVar1 != '\0') {

    FUN_0042e980(&stack0x00000000,0);

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

      (**(code **)(param_1[8] + 0x110))(1);

      FUN_0042e510(param_4);

      FUN_004605f0(0x49);

      param_1[0x31] = param_1[0x31] | 0x20;

    }

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

    if ((LVar2 == 0) && ((undefined4 *)(unaff_retaddr + -0x14) != (undefined4 *)0x0)) {

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

    }

  }

  return;

}





// --- FUN_00488d30 at 0x00488D30 (size: 496) ---


bool __thiscall FUN_00488d30(int param_1,undefined4 param_2)



{

  int iVar1;

  char cVar2;

  int iVar3;

  undefined4 *local_8c;

  int *local_88;

  undefined4 uStack_84;

  undefined1 local_80 [124];

  

  cVar2 = FUN_0042ce00(1);

  if ((cVar2 != '\0') && (*(int *)(param_1 + 0x788) == 0)) {

    FUN_006823d0();

    local_8c = (undefined4 *)0x0;

    local_88 = (int *)0x0;

    FUN_0042a2d0(0x8e);

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

      FUN_00429b10();

      (**(code **)(*local_88 + 0xac))(2);

    }

    uStack_84 = FUN_00429a00();

    FUN_0042c290(&uStack_84,&local_8c);

    FUN_0042a2d0(0xc3);

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

      FUN_00429b10();

      (**(code **)(*local_88 + 0xac))(0x10000001);

    }

    uStack_84 = FUN_00429a00();

    FUN_0042c290(&uStack_84,&local_8c);

    FUN_0042a2d0(0xac);

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

      FUN_00429b10();

      (**(code **)(*local_88 + 0x74))(1);

    }

    uStack_84 = FUN_00429a00();

    FUN_0042c290(&uStack_84,&local_8c);

    FUN_0042a2d0(0xc5);

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

      FUN_00429b10();

      (**(code **)(*local_88 + 0xc4))(param_2);

    }

    uStack_84 = FUN_00429a00();

    FUN_0042c290(&uStack_84,&local_8c);

    iVar3 = FUN_00478810(local_80);

    *(int *)(param_1 + 0x788) = iVar3;

    if (local_8c != (undefined4 *)0x0) {

      iVar1 = local_8c[1];

      local_8c[1] = iVar1 + -1;

      if (iVar1 + -1 == 0) {

        (**(code **)*local_8c)(1);

      }

      local_8c = (undefined4 *)0x0;

    }

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

      iVar1 = local_88[1];

      local_88[1] = iVar1 + -1;

      if (iVar1 + -1 == 0) {

        (**(code **)*local_88)(1);

      }

      local_88 = (int *)0x0;

    }

    FUN_00681f60();

    return iVar3 != 0;

  }

  return false;

}





// --- FUN_00488f20 at 0x00488F20 (size: 1798) ---


/* WARNING: Removing unreachable block (ram,0x0048950b) */

/* WARNING: Removing unreachable block (ram,0x0048951c) */

/* WARNING: Removing unreachable block (ram,0x00489522) */

/* WARNING: Removing unreachable block (ram,0x0048905d) */

/* WARNING: Removing unreachable block (ram,0x00488fbe) */

/* WARNING: Removing unreachable block (ram,0x0048900c) */

/* WARNING: Removing unreachable block (ram,0x004894a0) */

/* WARNING: Removing unreachable block (ram,0x0048952e) */

/* WARNING: Removing unreachable block (ram,0x0048953f) */

/* WARNING: Removing unreachable block (ram,0x00489545) */



bool __fastcall FUN_00488f20(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  char *pcVar3;

  char cVar4;

  int iVar5;

  char *pcVar6;

  LONG LVar7;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  int *piVar8;

  undefined4 *puVar9;

  undefined4 uVar10;

  undefined *puVar11;

  undefined *puStack_1e8;

  undefined *puStack_1e4;

  uint uStack_1e0;

  int iStack_1dc;

  undefined *puStack_1d8;

  int local_1d4;

  int iStack_1d0;

  int iStack_1cc;

  int *piStack_1c8;

  int local_1c4;

  int *local_1c0;

  int iStack_1bc;

  int iStack_1b8;

  undefined4 uStack_1b4;

  undefined4 uStack_1b0;

  undefined4 uStack_1ac;

  undefined4 uStack_1a8;

  undefined4 uStack_1a4;

  undefined1 auStack_110 [268];

  int *piStack_4;

  

  piVar8 = DAT_00837ff4;

  if ((*(int *)(param_1 + 0x78c) == 0) && (local_1c0 = DAT_00837ff4, DAT_00837ff4 != (int *)0x0)) {

    local_1c4 = param_1;

    (**(code **)(*DAT_00837ff4 + 0x7c))(&local_1d4,param_1 + 0x778);

    local_1c0 = (int *)(**(code **)(*piVar8 + 0x44))();

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

      FUN_006823d0();

      FUN_0042a2d0(0x8e);

      uStack_1e0 = FUN_00429a00();

      FUN_0042c290(&uStack_1e0,&stack0xfffffe10);

      FUN_0042a2d0(0xc3);

      uStack_1e0 = FUN_00429a00();

      FUN_0042c290(&uStack_1e0,&stack0xfffffe10);

      FUN_0042a2d0(0xac);

      uStack_1e0 = FUN_00429a00();

      FUN_0042c290(&uStack_1e0,&stack0xfffffe10);

      FUN_0042dc80();

      piVar8 = piStack_4;

      if (piStack_4[2] == 1) {

        uVar10 = *(undefined4 *)*piStack_4;

        uVar1 = ((undefined4 *)*piStack_4)[4];

        puStack_1e8 = PTR_DAT_00818340;

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

        puStack_1e4 = PTR_DAT_00818340;

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

        cVar4 = FUN_006866e0(uVar1,uVar10,&puStack_1e8,&puStack_1e4);

        if (cVar4 == '\0') {

          FUN_004011b0();

          FUN_004011b0();

          FUN_0042e590();

          FUN_004234d0();

          FUN_00681f60();

          FUN_004011b0();

          return false;

        }

        FUN_0042c9c0(DAT_0083ee2c,0x10000004);

        uVar10 = extraout_ECX;

        FUN_0041ab80(&iStack_1dc);

        FUN_0042e9f0(DAT_0083ee44,uVar10);

        uVar10 = extraout_ECX_00;

        FUN_0041ab80(&puStack_1e8);

        FUN_0042e8e0(DAT_0083ee3c,uVar10);

        FUN_004011b0();

        FUN_004011b0();

        param_1 = iStack_1cc;

      }

      else {

        puStack_1e4 = PTR_DAT_00818344;

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

        uStack_1e0 = 0;

        if (piVar8[2] != 0) {

          local_1d4 = 0;

          do {

            uVar10 = *(undefined4 *)(*piVar8 + local_1d4);

            iVar5 = *piVar8 + local_1d4;

            uStack_1b0 = *(undefined4 *)(iVar5 + 4);

            uStack_1ac = *(undefined4 *)(iVar5 + 8);

            uStack_1a8 = *(undefined4 *)(iVar5 + 0xc);

            uVar1 = *(undefined4 *)(iVar5 + 0x10);

            puStack_1e8 = PTR_DAT_00818340;

            uStack_1b4 = uVar10;

            uStack_1a4 = uVar1;

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

            puStack_1d8 = PTR_DAT_00818340;

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

            cVar4 = FUN_006866e0(uVar1,uVar10,&puStack_1e8,&puStack_1d8);

            if (cVar4 == '\0') {

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

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

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

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

              }

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

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

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

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

              }

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

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

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

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

              }

              FUN_0042e590();

              FUN_004234d0();

              FUN_00681f60();

              iVar5 = InterlockedDecrement((LONG *)(iStack_1dc + -0x10));

              goto joined_r0x0048960f;

            }

            uVar10 = 0;

            piVar8 = &iStack_1b8;

            (**(code **)(*piStack_1c8 + 0x7c))(&local_1c4,&uStack_1b0,piVar8,0);

            FUN_00403350(piVar8,uVar10);

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

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

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

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

            }

            FUN_0042dc80();

            FUN_0042c9c0(DAT_0083ee1c,0x10000004);

            puVar11 = puStack_1e8;

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

            FUN_0042e8e0(DAT_0083ee3c,puVar11);

            iVar2 = iStack_1b8;

            iVar5 = iStack_1b8;

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

            FUN_0042e8e0(DAT_0083ee44,iVar5);

            FUN_0042e980(&iStack_1d0,0);

            FUN_00408fd0(&iStack_1bc,0);

            iVar5 = iStack_1bc;

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

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

            }

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

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

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

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

            }

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

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

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

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

            }

            pcVar3 = "\n";

            do {

              pcVar6 = pcVar3;

              pcVar3 = pcVar6 + 1;

            } while (*pcVar6 != '\0');

            FUN_00404ef0(&DAT_00795508,pcVar6 + -0x795508);

            FUN_0042e590();

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

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

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

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

            }

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

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

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

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

            }

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

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

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

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

            }

            uStack_1e0 = uStack_1e0 + 1;

            local_1d4 = local_1d4 + 0x14;

            param_1 = iStack_1cc;

            piVar8 = piStack_4;

          } while (uStack_1e0 < (uint)piStack_4[2]);

        }

        FUN_0042c9c0(DAT_0083ee30,0x10000004);

        iVar5 = iStack_1dc;

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

        FUN_0042e9f0(DAT_0083ee44,iVar5);

        puVar11 = puStack_1e4;

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

        FUN_0042e9f0(DAT_0083ee40,puVar11);

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

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

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

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

        }

      }

      FUN_0042a2d0(0xc5);

      iStack_1d0 = FUN_00429a00();

      FUN_0042c290(&iStack_1d0,&stack0xfffffe10);

      iVar5 = FUN_00478810(auStack_110);

      *(int *)(param_1 + 0x78c) = iVar5;

      FUN_0042e590();

      FUN_00681f60();

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

      if ((LVar7 == 0) && ((undefined4 *)(iStack_1dc + -0x14) != (undefined4 *)0x0)) {

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

      }

      return iVar5 != 0;

    }

    iVar5 = InterlockedDecrement((LONG *)(iStack_1dc + -0x10));

joined_r0x0048960f:

    if ((iVar5 == 0) && ((undefined4 *)(iStack_1dc + -0x14) != (undefined4 *)0x0)) {

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

    }

  }

  return false;

}





// --- FUN_00489630 at 0x00489630 (size: 621) ---


/* WARNING: Removing unreachable block (ram,0x0048982c) */

/* WARNING: Removing unreachable block (ram,0x0048983d) */

/* WARNING: Removing unreachable block (ram,0x00489843) */

/* WARNING: Removing unreachable block (ram,0x0048972f) */

/* WARNING: Removing unreachable block (ram,0x00489696) */

/* WARNING: Removing unreachable block (ram,0x004896e1) */

/* WARNING: Removing unreachable block (ram,0x004897c3) */

/* WARNING: Removing unreachable block (ram,0x0048984f) */

/* WARNING: Removing unreachable block (ram,0x00489860) */

/* WARNING: Removing unreachable block (ram,0x00489866) */



bool __fastcall FUN_00489630(int param_1)



{

  int iVar1;

  LONG LVar2;

  undefined4 uStack_120;

  int iStack_11c;

  undefined1 auStack_118 [4];

  undefined1 local_114 [272];

  

  if ((*(int *)(param_1 + 0x790) == 0) && (DAT_00837ff4 != (int *)0x0)) {

    (**(code **)(*DAT_00837ff4 + 0x7c))(local_114,param_1 + 0x778);

    FUN_006823d0();

    FUN_0042a2d0(0x8e);

    uStack_120 = FUN_00429a00();

    FUN_0042c290(&uStack_120,&stack0xfffffed8);

    FUN_0042a2d0(0xc3);

    uStack_120 = FUN_00429a00();

    FUN_0042c290(&uStack_120,&stack0xfffffed8);

    FUN_0042a2d0(0xac);

    uStack_120 = FUN_00429a00();

    FUN_0042c290(&uStack_120,&stack0xfffffed8);

    FUN_0042dc80();

    FUN_0042c9c0(DAT_0083ee28,0x10000004);

    iVar1 = iStack_11c;

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

    FUN_0042e9f0(DAT_0083ee44,iVar1);

    FUN_0042a2d0(0xc5);

    uStack_120 = FUN_00429a00();

    FUN_0042c290(&uStack_120,&stack0xfffffed8);

    iVar1 = FUN_00478810(auStack_118);

    *(int *)(param_1 + 0x790) = iVar1;

    FUN_0042e590();

    FUN_00681f60();

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

    if ((LVar2 == 0) && ((undefined4 *)(iStack_11c + -0x14) != (undefined4 *)0x0)) {

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

    }

    return iVar1 != 0;

  }

  return false;

}





// --- FUN_00489d00 at 0x00489D00 (size: 171) ---


char __thiscall FUN_00489d00(int param_1,undefined4 param_2)



{

  char cVar1;

  undefined4 uVar2;

  undefined1 *puStack_9c;

  undefined1 local_90 [144];

  

  puStack_9c = (undefined1 *)0x489d13;

  FUN_0042dc80();

  puStack_9c = (undefined1 *)0x10000004;

  uVar2 = FUN_004016b0("ID_ActionKeyMap_MapInstructions");

  FUN_0042c9c0(uVar2);

  FUN_00466830(&puStack_9c);

  FUN_0042e8e0(DAT_0083ee3c);

  puStack_9c = local_90;

  *(undefined4 *)(param_1 + 0x784) = param_2;

  cVar1 = FUN_00488d30();

  if (cVar1 != '\0') {

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

      puStack_9c = (undefined1 *)0x489d9e;

      FUN_0042e590();

      return '\0';

    }

    puStack_9c = (undefined1 *)0x20;

    (**(code **)(*DAT_00837ff4 + 0x48))(param_1 + 0x628);

  }

  puStack_9c = (undefined1 *)0x489d88;

  FUN_0042e590();

  return cVar1;

}





// --- FUN_00489db0 at 0x00489DB0 (size: 271) ---


void __thiscall FUN_00489db0(int param_1,int param_2)



{

  char cVar1;

  uint uVar2;

  int *piVar3;

  

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

    cVar1 = FUN_00477460(0x10000001);

    if (cVar1 == '\0') {

      if (*(int *)(param_2 + 4) == *(int *)(param_1 + 0x710)) {

        FUN_00488200();

        FUN_00468a50(param_2);

        return;

      }

      uVar2 = 0;

      if (*(uint *)(param_1 + 0x71c) != 0) {

        piVar3 = *(int **)(param_1 + 0x714);

        do {

          if (*(int *)(param_2 + 4) == *piVar3) {

            FUN_00489d00(uVar2);

            FUN_00468a50(param_2);

            return;

          }

          uVar2 = uVar2 + 1;

          piVar3 = piVar3 + 1;

        } while (uVar2 < *(uint *)(param_1 + 0x71c));

        FUN_00468a50(param_2);

        return;

      }

    }

  }

  else if (*(int *)(param_2 + 8) == 0x19) {

    cVar1 = FUN_00477460(0x10000001);

    if ((cVar1 == '\0') && (*(int *)(param_2 + 0xc) == 8)) {

      uVar2 = 0;

      if (*(uint *)(param_1 + 0x71c) != 0) {

        piVar3 = *(int **)(param_1 + 0x714);

        while (((*(int *)(param_2 + 4) != *piVar3 || (*(int *)(*piVar3 + 0x400) == 0xd)) ||

               (*(uint *)(param_1 + 0x754) <= uVar2))) {

          uVar2 = uVar2 + 1;

          piVar3 = piVar3 + 1;

          if (*(uint *)(param_1 + 0x71c) <= uVar2) {

            FUN_00468a50(param_2);

            return;

          }

        }

        FUN_00487b40(uVar2);

      }

    }

  }

  FUN_00468a50(param_2);

  return;

}





// --- FUN_00489ec0 at 0x00489EC0 (size: 31) ---


void __fastcall FUN_00489ec0(undefined4 *param_1)



{

  wchar_t *_Str;

  int *piVar1;

  

  _Str = (wchar_t *)*param_1;

  piVar1 = _errno();

  *piVar1 = 0;

  wcstol(_Str,(wchar_t **)0x0,0);

  return;

}





// --- FUN_00489ee0 at 0x00489EE0 (size: 61) ---


undefined4 * __fastcall FUN_00489ee0(undefined4 *param_1)



{

  LONG *pLVar1;

  

  *param_1 = &PTR_LAB_007a441c;

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[1] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[7] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  FUN_005bcf60();

  return param_1;

}





// --- FUN_00489f20 at 0x00489F20 (size: 71) ---


void __fastcall FUN_00489f20(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)param_1[7];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  puVar1 = (undefined4 *)param_1[1];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_0048a060 at 0x0048A060 (size: 64) ---


undefined4 * __thiscall FUN_0048a060(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a4430;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048a0a0 at 0x0048A0A0 (size: 65) ---


int * __thiscall FUN_0048a0a0(int *param_1,int *param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  puVar1 = (undefined4 *)*param_1;

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

    LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    iVar2 = *param_2;

    *param_1 = iVar2;

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

  }

  return param_1;

}





// --- FUN_0048a150 at 0x0048A150 (size: 155) ---


int __thiscall FUN_0048a150(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  puVar1 = *(undefined4 **)(param_1 + 4);

  if (puVar1 != *(undefined4 **)(param_2 + 4)) {

    LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    iVar2 = *(int *)(param_2 + 4);

    *(int *)(param_1 + 4) = iVar2;

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

  }

  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(param_2 + 8);

  *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);

  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x10);

  *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(param_2 + 0x14);

  *(undefined4 *)(param_1 + 0x18) = *(undefined4 *)(param_2 + 0x18);

  puVar1 = *(undefined4 **)(param_1 + 0x1c);

  if (puVar1 != *(undefined4 **)(param_2 + 0x1c)) {

    LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    iVar2 = *(int *)(param_2 + 0x1c);

    *(int *)(param_1 + 0x1c) = iVar2;

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

  }

  *(undefined4 *)(param_1 + 0x20) = *(undefined4 *)(param_2 + 0x20);

  return param_1;

}





// --- FUN_0048a1f0 at 0x0048A1F0 (size: 85) ---


undefined4 __thiscall FUN_0048a1f0(int param_1,uint param_2)



{

  uint *puVar1;

  

  if ((*(uint *)(param_1 + 0x44) != 0) && (*(int *)(param_1 + 0x40) != 0)) {

    puVar1 = *(uint **)(*(int *)(param_1 + 0x40) + (param_2 % *(uint *)(param_1 + 0x44)) * 4);

    if (puVar1 != (uint *)0x0) {

      while (param_2 != *puVar1) {

        puVar1 = (uint *)puVar1[10];

        if (puVar1 == (uint *)0x0) {

          return 0;

        }

      }

      if (puVar1 + 1 != (uint *)0x0) {

        FUN_0048a150(puVar1 + 1);

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_0048a250 at 0x0048A250 (size: 184) ---


void FUN_0048a250(undefined4 param_1,int param_2)



{

  int iVar1;

  undefined4 uVar2;

  int iVar3;

  undefined1 local_24 [12];

  int local_18;

  

  if (param_2 != 0) {

    FUN_00567c00();

    iVar1 = FUN_00567c10();

    if (iVar1 != 0) {

      uVar2 = FUN_005bd310(param_1);

      FUN_00489ee0();

      iVar1 = FUN_0048a1f0(uVar2,local_24);

      if ((iVar1 != 0) && (local_18 != DAT_0083ee6c)) {

        FUN_006a0660();

        iVar1 = FUN_00567c00();

        if ((iVar1 != 0) && (iVar1 = FUN_00569a50(local_18), iVar1 != 0)) {

          FUN_006a0570(1);

          iVar3 = FUN_005df0f5(0xc);

          if (iVar3 == 0) {

            uVar2 = 0;

          }

          else {

            uVar2 = FUN_00694a00(iVar1);

          }

          FUN_006a0610(uVar2);

        }

      }

      FUN_00489f20();

    }

  }

  return;

}





// --- FUN_0048a310 at 0x0048A310 (size: 418) ---


void __thiscall FUN_0048a310(int param_1,int param_2)



{

  char cVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  int *piVar5;

  LONG LVar6;

  undefined4 *puVar7;

  int iVar8;

  int local_4;

  

  local_4 = param_1;

  iVar2 = FUN_0055e1d0();

  if ((*(char *)(iVar2 + 0x216) != '\0') && (*(int *)(param_1 + 0x600) != 0)) {

    FUN_0055e1d0();

    iVar2 = param_2;

    FUN_005d5850(param_2);

    iVar8 = 0;

    if (0 < *(int *)(*(int *)(param_1 + 0x600) + 0x610)) {

      while ((((iVar3 = FUN_0046dc50(iVar8), iVar3 == 0 || (*(int *)(iVar3 + 0x2e4) != 0x10000467))

              || (cVar1 = FUN_00460d80(0x1000004c,&param_2), cVar1 == '\0')) ||

             ((iVar2 != DAT_0083ee6c && (param_2 != iVar2))))) {

        iVar8 = iVar8 + 1;

        if (*(int *)(*(int *)(param_1 + 0x600) + 0x610) <= iVar8) {

          return;

        }

      }

      FUN_0055e1d0();

      iVar2 = FUN_005d5850(param_2);

      if ((-1 < iVar2) && (iVar2 < 0x1389)) {

        FUN_00480980(&local_4,0,&DAT_007a11d4,iVar2);

        iVar2 = FUN_00476820(0x1000046b);

        if (iVar2 != 0) {

          FUN_0046a740(&local_4);

        }

        FUN_004011b0();

        return;

      }

      FUN_006a3170(param_2,0);

      FUN_0055e1d0();

      FUN_005d5a90(param_2,0);

      FUN_0055e1d0();

      uVar4 = FUN_005d5850(param_2);

      FUN_00480980(&local_4,0,&DAT_007a11d4,uVar4);

      piVar5 = (int *)FUN_00463c00(0x1000046b);

      if ((piVar5 != (int *)0x0) && (iVar2 = (**(code **)(*piVar5 + 0x94))(0xc), iVar2 != 0)) {

        FUN_0046a740(&local_4);

      }

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

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

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

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

      }

    }

  }

  return;

}





// --- FUN_0048a670 at 0x0048A670 (size: 143) ---


undefined4 * __thiscall FUN_0048a670(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_007a4430;

  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_0048a900 at 0x0048A900 (size: 226) ---


void FUN_0048a900(int param_1,int param_2)



{

  int iVar1;

  char cVar2;

  int iVar3;

  undefined4 uVar4;

  int *piVar5;

  LONG LVar6;

  undefined4 *puVar7;

  int local_4;

  

  if (param_1 != 0) {

    param_1 = DAT_0083ee6c;

    FUN_00460d80(0x1000004c,&param_1);

    cVar2 = FUN_0045ae70(&param_1,&local_4);

    iVar1 = param_2;

    if (cVar2 != '\0') {

      iVar3 = FUN_00586d60();

      if (*(int *)(local_4 + 4) != iVar3) {

        uVar4 = FUN_00586d60();

        *(undefined4 *)(local_4 + 4) = uVar4;

      }

      iVar3 = *(int *)(iVar1 + 0x88);

      if (*(int *)(local_4 + 0xc) != iVar3) {

        *(int *)(local_4 + 0xc) = iVar3;

      }

      piVar5 = (int *)FUN_00463c00(0x1000046a);

      if ((piVar5 != (int *)0x0) && (iVar3 = (**(code **)(*piVar5 + 0x94))(0xc), iVar3 != 0)) {

        uVar4 = FUN_00480980(&param_1,0,&DAT_007a11d4,*(undefined4 *)(iVar1 + 0x88));

        FUN_0046a740(uVar4);

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

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

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

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

        }

      }

    }

  }

  return;

}





// --- FUN_0048a9f0 at 0x0048A9F0 (size: 82) ---


undefined4 * __thiscall FUN_0048a9f0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a4434;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_007a4430;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048aa50 at 0x0048AA50 (size: 114) ---


undefined4 * __thiscall FUN_0048aa50(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00472670(param_2,param_3);

  param_1[0x17e] = &PTR_FUN_007ccb60;

  *param_1 = &PTR_FUN_007a46e0;

  param_1[0x17e] = &PTR_FUN_007a4438;

  param_1[0x17f] = 0;

  param_1[0x180] = 0;

  param_1[0x181] = 0;

  param_1[0x182] = 0;

  param_1[0x183] = 0;

  param_1[0x184] = &PTR_FUN_007a4434;

  FUN_0048a670(0x17);

  *(undefined1 *)(param_1 + 0x1a1) = 1;

  return param_1;

}





// --- FUN_0048ab00 at 0x0048AB00 (size: 177) ---


void __fastcall FUN_0048ab00(undefined4 *param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a46e0;

  *puVar1 = &PTR_FUN_007a4438;

  if (param_1[0x180] != 0) {

    FUN_0046e460();

  }

  piVar2 = (int *)FUN_0043c680();

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

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  param_1[0x184] = &PTR_FUN_007a4434;

  FUN_005870f0();

  param_1[0x185] = &PTR_FUN_007a4430;

  if ((undefined4 *)param_1[0x19d] != param_1 + 0x186) {

    operator_delete__((undefined4 *)param_1[0x19d]);

  }

  param_1[0x19d] = 0;

  param_1[0x19e] = 0;

  param_1[0x19f] = 0;

  param_1[0x1a0] = 0;

  if ((param_1[0x182] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[0x181]);

  }

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  return;

}





// --- FUN_0048abf0 at 0x0048ABF0 (size: 1204) ---


void __thiscall FUN_0048abf0(int param_1,int param_2)



{

  char cVar1;

  int iVar2;

  int iVar3;

  undefined4 *puVar4;

  undefined4 uVar5;

  uint *puVar6;

  int *piVar7;

  LONG LVar8;

  uint *puVar9;

  uint *puVar10;

  uint uVar11;

  undefined4 *puVar12;

  int local_b4;

  uint uStack_b0;

  int local_ac;

  int local_a8;

  int local_a4;

  undefined4 *local_a0;

  int iStack_9c;

  uint uStack_98;

  int aiStack_94 [37];

  

  FUN_0055e1d0();

  iVar2 = FUN_0055e220();

  if (iVar2 != 0) {

    local_a0 = (undefined4 *)(iVar2 + 4);

    local_b4 = 0;

    local_ac = 0;

    do {

      iVar2 = local_ac;

      puVar12 = *(undefined4 **)*local_a0;

      iVar3 = FUN_0046dc50(local_b4);

      if (puVar12 == (undefined4 *)0x0) {

        local_a4 = 8;

        if ((iVar3 != 0) && (cVar1 = FUN_00460b30(0x1000004d,&local_a4), cVar1 == '\0')) {

          local_a4 = 8;

        }

        if (local_a4 == iVar2) {

          FUN_0046e430(local_b4);

        }

      }

      else {

        local_a8 = 8;

        if ((iVar3 != 0) && (cVar1 = FUN_00460b30(0x1000004d,&local_a8), cVar1 == '\0')) {

          local_a8 = 8;

        }

        if (local_a8 == iVar2) {

          local_b4 = local_b4 + 1;

        }

        else {

          piVar7 = (int *)FUN_0046f770(0,local_b4);

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

            (**(code **)(*piVar7 + 0x94))(0xc);

            local_a8 = local_ac;

            FUN_004606b0(0x1000004d,local_ac);

            FUN_0042dc80();

            FUN_0042c9c0(*(undefined4 *)(*(int *)(param_1 + 0x604) + local_ac * 4),0x10000001);

            uVar5 = FUN_0042e980(aiStack_94,0);

            FUN_0046a740(uVar5);

            puVar4 = (undefined4 *)(aiStack_94[0] + -0x14);

            LVar8 = InterlockedDecrement((LONG *)(aiStack_94[0] + -0x10));

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

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

            }

            local_b4 = local_b4 + 1;

            FUN_0042e590();

          }

        }

      }

      if (param_2 == 1) {

        for (; puVar12 != (undefined4 *)0x0; puVar12 = (undefined4 *)*puVar12) {

          iVar2 = FUN_0046dc50(local_b4);

          if (((iVar2 == 0) ||

              (FUN_00460d80(0x1000004c,&uStack_b0), *(int *)(iVar2 + 0x2e4) == 0x10000466)) ||

             (uStack_b0 != puVar12[2])) {

            puVar4 = (undefined4 *)FUN_005df0f5(0x10);

            if (puVar4 == (undefined4 *)0x0) {

              puVar4 = (undefined4 *)0x0;

            }

            else {

              puVar4[3] = 0;

              *puVar4 = puVar12[2];

              uVar5 = FUN_00586d60();

              puVar4[1] = uVar5;

              puVar4[3] = puVar12[0x22];

              puVar4[2] = puVar12[4];

            }

            uStack_b0 = puVar12[2];

            puVar6 = (uint *)FUN_005df0f5(0xc);

            puVar10 = (uint *)0x0;

            if (puVar6 != (uint *)0x0) {

              puVar6[1] = 0;

              *puVar6 = uStack_b0;

              puVar6[2] = (uint)puVar4;

              puVar10 = puVar6;

            }

            puVar6 = (uint *)(*(int *)(param_1 + 0x674) +

                             (*puVar10 % *(uint *)(param_1 + 0x67c)) * 4);

            for (puVar9 = (uint *)*puVar6; puVar9 != (uint *)0x0; puVar9 = (uint *)puVar9[1]) {

              if (*puVar9 == *puVar10) {

                if (puVar9 != (uint *)0x0) {

                  operator_delete(puVar10);

                  goto LAB_0048ae77;

                }

                break;

              }

            }

            puVar10[1] = *puVar6;

            *puVar6 = (uint)puVar10;

            if (puVar6 < *(uint **)(param_1 + 0x678)) {

              *(uint **)(param_1 + 0x678) = puVar6;

            }

            *(int *)(param_1 + 0x680) = *(int *)(param_1 + 0x680) + 1;

LAB_0048ae77:

            iVar2 = FUN_0046f770(1,local_b4);

            if (iVar2 != 0) {

              FUN_004608d0(0x1000004c,uStack_b0);

              piVar7 = (int *)FUN_00463c00(0x10000469);

              if ((piVar7 != (int *)0x0) && (iVar3 = (**(code **)(*piVar7 + 0x94))(0xc), iVar3 != 0)

                 ) {

                FUN_00404a40(0,puVar12[3] + 0x14);

                FUN_0046a740(&iStack_9c);

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

                LVar8 = InterlockedDecrement((LONG *)(iStack_9c + -0x10));

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

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

                }

              }

              uVar5 = FUN_00463c00(0x10000468);

              FUN_0048a250(uStack_b0,uVar5);

              FUN_0048a900(iVar2,puVar12);

              FUN_0048a310(uStack_b0);

              piVar7 = (int *)FUN_00463c00(0x1000046b);

              if ((piVar7 != (int *)0x0) && (iVar2 = (**(code **)(*piVar7 + 0x94))(0xc), iVar2 != 0)

                 ) {

                *(undefined1 **)(iVar2 + 0x6a0) = &LAB_00466520;

              }

              local_b4 = local_b4 + 1;

            }

          }

          else {

            FUN_0048a900(iVar2,puVar12);

            local_b4 = local_b4 + 1;

          }

        }

      }

      else {

        iVar2 = FUN_0046dc50(local_b4);

        while ((iVar2 != 0 && (*(int *)(iVar2 + 0x2e4) == 0x10000467))) {

          uStack_98 = DAT_0083ee6c;

          FUN_00460d80(0x1000004c,&uStack_98);

          if ((puVar12 == (undefined4 *)0x0) || (uStack_98 != puVar12[2])) {

            uVar11 = uStack_98 % *(uint *)(param_1 + 0x67c);

            puVar10 = *(uint **)(*(int *)(param_1 + 0x674) + uVar11 * 4);

            for (puVar6 = puVar10; puVar6 != (uint *)0x0; puVar6 = (uint *)puVar6[1]) {

              if (*puVar6 == uStack_98) {

                if (puVar6 != (uint *)0x0) {

                  if (puVar10 == puVar6) goto LAB_0048b022;

                  do {

                    puVar9 = puVar10;

                    puVar10 = (uint *)puVar9[1];

                  } while (puVar10 != puVar6);

                  if (puVar9 == (uint *)0x0) {

LAB_0048b022:

                    *(uint *)(*(int *)(param_1 + 0x674) + uVar11 * 4) = puVar10[1];

                  }

                  else {

                    puVar9[1] = puVar10[1];

                  }

                  *(int *)(param_1 + 0x680) = *(int *)(param_1 + 0x680) + -1;

                  operator_delete(puVar6);

                }

                break;

              }

            }

            FUN_0046e430(local_b4);

          }

          else {

            FUN_0048a900(iVar2,puVar12);

            puVar12 = (undefined4 *)*puVar12;

            local_b4 = local_b4 + 1;

          }

          iVar2 = FUN_0046dc50(local_b4);

        }

      }

      local_ac = local_ac + 1;

      local_a0 = local_a0 + 1;

    } while (local_ac < 7);

    (**(code **)(*(int *)(param_1 + 0x5f8) + 0x250))();

  }

  return;

}





// --- FUN_0048b0b0 at 0x0048B0B0 (size: 30) ---


void * __thiscall FUN_0048b0b0(void *param_1,byte param_2)



{

  FUN_0048ab00();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048b0d0 at 0x0048B0D0 (size: 19) ---


void FUN_0048b0d0(void)



{

  FUN_00460270(0x1000002f,&LAB_0048abc0);

  return;

}





// --- FUN_0048b190 at 0x0048B190 (size: 165) ---


int FUN_0048b190(int param_1)



{

  uint uVar1;

  int iVar2;

  undefined3 uVar3;

  uint3 uVar4;

  bool bVar5;

  

  FUN_0055e1d0();

  uVar1 = FUN_00401db0();

  iVar2 = *(int *)(param_1 + 0xc) + -1;

  uVar3 = (undefined3)((uint)iVar2 >> 8);

  switch(iVar2) {

  case 0:

    if ((uVar1 & 8) == 0) {

      return CONCAT31(uVar3,1);

    }

    break;

  case 1:

    if ((uVar1 & 4) == 0) {

      return CONCAT31(uVar3,1);

    }

    break;

  case 2:

    if ((uVar1 & 2) == 0) {

      return CONCAT31(uVar3,1);

    }

    break;

  case 3:

    if ((uVar1 & 1) == 0) {

      return CONCAT31(uVar3,1);

    }

    break;

  case 4:

    if ((uVar1 & 0x2000) == 0) goto switchD_0048b1ad_default;

    break;

  default:

    goto switchD_0048b1ad_default;

  }

  iVar2 = FUN_005981d0();

  iVar2 = iVar2 + -1;

  uVar4 = (uint3)((uint)iVar2 >> 8);

  switch(iVar2) {

  case 0:

    bVar5 = (uVar1 & 0x10) == 0;

    break;

  case 1:

    bVar5 = (uVar1 & 0x20) == 0;

    break;

  case 2:

    bVar5 = (uVar1 & 0x40) == 0;

    break;

  case 3:

    if (-1 < (char)uVar1) {

      return CONCAT31(uVar4,1);

    }

    goto LAB_0048b22f;

  case 4:

    bVar5 = (uVar1 & 0x100) == 0;

    break;

  case 5:

    bVar5 = (uVar1 & 0x200) == 0;

    break;

  case 6:

    bVar5 = (uVar1 & 0x400) == 0;

    break;

  case 7:

    bVar5 = (uVar1 & 0x800) == 0;

    break;

  case 8:

    if ((uVar1 & 0x1000) == 0) goto switchD_0048b1ad_default;

    goto LAB_0048b22f;

  default:

    goto switchD_0048b1ad_default;

  }

  if (bVar5) {

switchD_0048b1ad_default:

    return CONCAT31((int3)((uint)iVar2 >> 8),1);

  }

LAB_0048b22f:

  return (uint)uVar4 << 8;

}





// --- FUN_0048b270 at 0x0048B270 (size: 399) ---


void __fastcall FUN_0048b270(int param_1)



{

  uint uVar1;

  

  FUN_0055e1d0();

  uVar1 = FUN_00401db0();

  (**(code **)(**(int **)(param_1 + 0x604) + 0x9c))((-((uVar1 & 1) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x608) + 0x9c))((-((uVar1 & 2) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x60c) + 0x9c))((-((uVar1 & 4) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x610) + 0x9c))((-((uVar1 & 8) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x614) + 0x9c))((-((uVar1 & 0x2000) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x618) + 0x9c))((-((uVar1 & 0x10) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x61c) + 0x9c))((-((uVar1 & 0x20) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x620) + 0x9c))((-((uVar1 & 0x40) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x624) + 0x9c))((-((uVar1 & 0x80) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x628) + 0x9c))((-((uVar1 & 0x100) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x62c) + 0x9c))((-((uVar1 & 0x200) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x630) + 0x9c))((-((uVar1 & 0x400) != 0) & 5U) + 1);

  (**(code **)(**(int **)(param_1 + 0x634) + 0x9c))((-((uVar1 & 0x800) != 0) & 5U) + 1);

  return;

}





// --- FUN_0048b400 at 0x0048B400 (size: 18) ---


void __fastcall FUN_0048b400(int param_1)



{

  if (*(int *)(param_1 + 0x610) != 0) {

    FUN_0046ed00(0);

  }

  return;

}





// --- FUN_0048b420 at 0x0048B420 (size: 163) ---


undefined4 * __fastcall FUN_0048b420(undefined4 *param_1)



{

  LONG *pLVar1;

  int iVar2;

  undefined4 *puVar3;

  

  *param_1 = &PTR_FUN_007a4ee4;

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[1] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[2] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  param_1[3] = 0;

  param_1[4] = DAT_0083ef0c;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0xbf800000;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = &PTR_FUN_007a4adc;

  puVar3 = param_1 + 0x10;

  for (iVar2 = 8; iVar2 != 0; iVar2 = iVar2 + -1) {

    *puVar3 = 0;

    puVar3 = puVar3 + 1;

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0xffffffff;

  param_1[0x20] = 0;

  FUN_00599710();

  return param_1;

}





// --- FUN_0048b4d0 at 0x0048B4D0 (size: 89) ---


void __fastcall FUN_0048b4d0(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  FUN_00599890();

  puVar1 = (undefined4 *)param_1[2];

  param_1[0xf] = &PTR_FUN_0079385c;

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  puVar1 = (undefined4 *)param_1[1];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_0048b530 at 0x0048B530 (size: 82) ---


undefined4 * __thiscall FUN_0048b530(undefined4 *param_1,byte param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a4d98;

  *puVar1 = &PTR_FUN_007a4af0;

  piVar2 = (int *)FUN_0043c680();

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

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048b590 at 0x0048B590 (size: 353) ---


void __fastcall FUN_0048b590(int param_1)



{

  int *piVar1;

  undefined4 uVar2;

  

  FUN_004639a0();

  piVar1 = (int *)FUN_00463c00(0x10000295);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(0x10000031);

  }

  *(undefined4 *)(param_1 + 0x5fc) = uVar2;

  *(undefined4 *)(param_1 + 0x600) = 0;

  uVar2 = FUN_00463c00(0x10000298);

  *(undefined4 *)(param_1 + 0x604) = uVar2;

  uVar2 = FUN_00463c00(0x10000299);

  *(undefined4 *)(param_1 + 0x608) = uVar2;

  uVar2 = FUN_00463c00(0x1000029a);

  *(undefined4 *)(param_1 + 0x60c) = uVar2;

  uVar2 = FUN_00463c00(0x1000029b);

  *(undefined4 *)(param_1 + 0x610) = uVar2;

  uVar2 = FUN_00463c00(0x100005c0);

  *(undefined4 *)(param_1 + 0x614) = uVar2;

  uVar2 = FUN_00463c00(0x1000029c);

  *(undefined4 *)(param_1 + 0x618) = uVar2;

  uVar2 = FUN_00463c00(0x1000029d);

  *(undefined4 *)(param_1 + 0x61c) = uVar2;

  uVar2 = FUN_00463c00(0x1000029e);

  *(undefined4 *)(param_1 + 0x620) = uVar2;

  uVar2 = FUN_00463c00(0x1000029f);

  *(undefined4 *)(param_1 + 0x624) = uVar2;

  uVar2 = FUN_00463c00(0x100002a0);

  *(undefined4 *)(param_1 + 0x628) = uVar2;

  uVar2 = FUN_00463c00(0x100002a1);

  *(undefined4 *)(param_1 + 0x62c) = uVar2;

  uVar2 = FUN_00463c00(0x100002a2);

  *(undefined4 *)(param_1 + 0x630) = uVar2;

  uVar2 = FUN_00463c00(0x1000054e);

  *(undefined4 *)(param_1 + 0x634) = uVar2;

  piVar1 = (int *)FUN_0043c680();

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

    param_1 = param_1 + 0x5f8;

    (**(code **)(*piVar1 + 4))(0x4dd1f0,param_1);

    (**(code **)(*piVar1 + 4))(0x4dd25f,param_1);

    (**(code **)(*piVar1 + 4))(0x4dd260,param_1);

  }

  return;

}





// --- FUN_0048b700 at 0x0048B700 (size: 19) ---


void FUN_0048b700(void)



{

  FUN_00460270(0x1000002e,&LAB_0048b130);

  return;

}





// --- FUN_0048b720 at 0x0048B720 (size: 247) ---


uint __thiscall FUN_0048b720(int param_1,int param_2)



{

  uint uVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  LONG LVar5;

  uint uVar6;

  undefined1 local_90 [4];

  undefined4 *puStack_8c;

  undefined4 *puStack_88;

  undefined **ppuStack_54;

  int iStack_14;

  

  FUN_00567c00();

  FUN_0048b420();

  uVar1 = *(uint *)(*(int *)(param_1 + 0x5fc) + 0x610);

  uVar6 = 0;

  if (uVar1 != 0) {

    do {

      piVar3 = (int *)FUN_0046dc50(uVar6);

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

           (iVar4 = (**(code **)(*piVar3 + 0x94))(0x10000032), iVar4 != 0)) &&

          (cVar2 = FUN_00567eb0(*(undefined4 *)(iVar4 + 0x600),local_90), cVar2 != '\0')) &&

         (*(int *)(param_2 + 0x7c) < iStack_14)) {

        FUN_0048b4d0();

        return uVar6;

      }

      uVar6 = uVar6 + 1;

    } while (uVar6 < uVar1);

  }

  FUN_00599890();

  ppuStack_54 = &PTR_FUN_0079385c;

  LVar5 = InterlockedDecrement(puStack_88 + 1);

  if ((LVar5 == 0) && (puStack_88 != (undefined4 *)0x0)) {

    (**(code **)*puStack_88)(1);

  }

  LVar5 = InterlockedDecrement(puStack_8c + 1);

  if ((LVar5 == 0) && (puStack_8c != (undefined4 *)0x0)) {

    (**(code **)*puStack_8c)(1);

  }

  return uVar1;

}





// --- FUN_0048b820 at 0x0048B820 (size: 150) ---


void __thiscall FUN_0048b820(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  

  iVar3 = 0;

  if (*(int *)(*(int *)(param_1 + 0x5fc) + 0x610) < 1) {

    *(int *)(param_1 + 0x600) = param_2;

    return;

  }

  do {

    piVar1 = (int *)FUN_0046dc50(iVar3);

    if ((piVar1 != (int *)0x0) && (iVar2 = (**(code **)(*piVar1 + 0x94))(0x10000032), iVar2 != 0)) {

      if ((param_2 == 0) || (*(int *)(iVar2 + 0x600) != param_2)) {

        FUN_004e1ed0(0);

      }

      else {

        FUN_004e1ed0(1);

        FUN_0046edb0(iVar3);

      }

    }

    iVar3 = iVar3 + 1;

  } while (iVar3 < *(int *)(*(int *)(param_1 + 0x5fc) + 0x610));

  *(int *)(param_1 + 0x600) = param_2;

  return;

}





// --- FUN_0048b8c0 at 0x0048B8C0 (size: 304) ---


void __thiscall FUN_0048b8c0(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  

  iVar2 = FUN_00463c00(param_2);

  if (iVar2 != 0) {

    iVar1 = *(int *)(iVar2 + 0x400);

    if (iVar2 == *(int *)(param_1 + 0x604)) {

      uVar4 = 1;

    }

    else if (iVar2 == *(int *)(param_1 + 0x608)) {

      uVar4 = 2;

    }

    else if (iVar2 == *(int *)(param_1 + 0x60c)) {

      uVar4 = 4;

    }

    else if (iVar2 == *(int *)(param_1 + 0x610)) {

      uVar4 = 8;

    }

    else if (iVar2 == *(int *)(param_1 + 0x614)) {

      uVar4 = 0x2000;

    }

    else if (iVar2 == *(int *)(param_1 + 0x618)) {

      uVar4 = 0x10;

    }

    else if (iVar2 == *(int *)(param_1 + 0x61c)) {

      uVar4 = 0x20;

    }

    else if (iVar2 == *(int *)(param_1 + 0x620)) {

      uVar4 = 0x40;

    }

    else if (iVar2 == *(int *)(param_1 + 0x624)) {

      uVar4 = 0x80;

    }

    else if (iVar2 == *(int *)(param_1 + 0x628)) {

      uVar4 = 0x100;

    }

    else if (iVar2 == *(int *)(param_1 + 0x62c)) {

      uVar4 = 0x200;

    }

    else if (iVar2 == *(int *)(param_1 + 0x630)) {

      uVar4 = 0x400;

    }

    else {

      if (iVar2 != *(int *)(param_1 + 0x634)) {

        return;

      }

      uVar4 = 0x800;

    }

    FUN_0055e1d0();

    uVar3 = FUN_00401db0();

    if (iVar1 == 6) {

      uVar4 = uVar3 | uVar4;

    }

    else {

      uVar4 = ~uVar4 & uVar3;

    }

    if (uVar4 != uVar3) {

      FUN_0055e1d0();

      FUN_00401dc0(uVar4);

      FUN_006a2850(uVar4);

    }

  }

  return;

}





// --- FUN_0048b9f0 at 0x0048B9F0 (size: 75) ---


void __thiscall FUN_0048b9f0(int param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  uint uVar2;

  

  uVar2 = FUN_0048ba40();

  if (uVar2 <= param_3) {

    if (3 < param_3) {

      *(undefined4 *)*param_2 = *(undefined4 *)(param_1 + 0xc);

      *param_2 = *param_2 + 4;

    }

    for (puVar1 = *(undefined4 **)(param_1 + 4); puVar1 != (undefined4 *)0x0;

        puVar1 = (undefined4 *)puVar1[1]) {

      if (3 < param_3) {

        *(undefined4 *)*param_2 = *puVar1;

        *param_2 = *param_2 + 4;

      }

    }

  }

  return;

}





// --- FUN_0048ba40 at 0x0048BA40 (size: 27) ---


int __fastcall FUN_0048ba40(int param_1)



{

  int iVar1;

  int iVar2;

  

  iVar2 = 4;

  for (iVar1 = *(int *)(param_1 + 4); iVar1 != 0; iVar1 = *(int *)(iVar1 + 4)) {

    iVar2 = iVar2 + 4;

  }

  return iVar2;

}





// --- FUN_0048ba60 at 0x0048BA60 (size: 30) ---


void * __thiscall FUN_0048ba60(void *param_1,byte param_2)



{

  FUN_0048b4d0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048ba80 at 0x0048BA80 (size: 117) ---


void FUN_0048ba80(undefined4 param_1)



{

  char cVar1;

  int iVar2;

  undefined4 uVar3;

  undefined1 local_90 [144];

  

  iVar2 = FUN_00567c00();

  if (iVar2 != 0) {

    FUN_0048b420();

    cVar1 = FUN_00567eb0(param_1,local_90);

    if (cVar1 != '\0') {

      cVar1 = FUN_0048b190(local_90);

      if (cVar1 == '\0') {

        uVar3 = FUN_0048b720(local_90);

        FUN_004e4e40(param_1,uVar3);

      }

    }

    FUN_0048b4d0();

  }

  return;

}





// --- FUN_0048bb00 at 0x0048BB00 (size: 162) ---


int * __thiscall FUN_0048bb00(int *param_1,int *param_2,int *param_3)



{

  int *piVar1;

  int *piVar2;

  int *piVar3;

  int iVar4;

  int *local_4;

  

  piVar1 = param_3;

  local_4 = param_1;

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

    piVar3 = (int *)*param_1;

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

      *param_1 = 0;

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

      param_1[1] = 0;

    }

    iVar4 = -0x7fffbffe;

  }

  else {

    iVar4 = *param_3;

    param_3 = (int *)0x0;

    piVar3 = (int *)(**(code **)(iVar4 + 0xc))(&local_4,&DAT_007a4988,&param_3);

    piVar2 = param_3;

    iVar4 = *piVar3;

    piVar3 = (int *)*param_1;

    if (iVar4 < 0) {

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

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

      }

      *param_1 = 0;

      param_1[1] = 0;

      *param_2 = iVar4;

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

      return param_2;

    }

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

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

    }

    *param_1 = (int)piVar2;

    param_1[1] = 0;

  }

  *param_2 = iVar4;

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

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

  }

  return param_2;

}





// --- FUN_0048bc30 at 0x0048BC30 (size: 65) ---


void __fastcall FUN_0048bc30(int param_1)



{

  int iVar1;

  void *pvVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  while (iVar1 != 0) {

    pvVar2 = *(void **)(param_1 + 4);

    if (pvVar2 != (void *)0x0) {

      iVar1 = *(int *)((int)pvVar2 + 4);

      *(int *)(param_1 + 4) = iVar1;

      if (iVar1 == 0) {

        *(undefined4 *)(param_1 + 8) = 0;

      }

      else {

        *(undefined4 *)(iVar1 + 8) = 0;

      }

      if (pvVar2 != (void *)0x0) {

        operator_delete(pvVar2);

      }

      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + -1;

    }

    iVar1 = *(int *)(param_1 + 4);

  }

  return;

}





// --- FUN_0048bc80 at 0x0048BC80 (size: 62) ---


undefined4 * __thiscall FUN_0048bc80(undefined4 *param_1,int *param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  undefined4 uVar3;

  

  *param_1 = 0;

  param_1[1] = 0;

  piVar2 = (int *)*param_2;

  uVar3 = 0;

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

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

  }

  puVar1 = (undefined4 *)FUN_0048bb00(&param_2,piVar2,uVar3);

  param_1[1] = *puVar1;

  return param_1;

}





// --- FUN_0048bcc0 at 0x0048BCC0 (size: 22) ---


void __fastcall FUN_0048bcc0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007a4ed0;

  FUN_0048bc30();

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_0048bce0 at 0x0048BCE0 (size: 82) ---


undefined4 FUN_0048bce0(int *param_1,uint param_2)



{

  int iVar1;

  undefined4 local_4;

  

  FUN_0048bc30();

  if (3 < param_2) {

    iVar1 = *(int *)*param_1;

    *param_1 = (int)((int *)*param_1 + 1);

    if (0 < iVar1) {

      do {

        local_4 = *(undefined4 *)*param_1;

        *param_1 = (int)((undefined4 *)*param_1 + 1);

        FUN_0048bd40(&local_4);

        iVar1 = iVar1 + -1;

      } while (iVar1 != 0);

    }

    return 1;

  }

  return 0;

}





// --- FUN_0048bd40 at 0x0048BD40 (size: 82) ---


void __thiscall FUN_0048bd40(int param_1,undefined4 *param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0xc);

  if (puVar2 == (undefined4 *)0x0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = *param_2;

    puVar2[1] = 0;

    puVar2[2] = 0;

  }

  if (*(int *)(param_1 + 4) == 0) {

    *(undefined4 **)(param_1 + 4) = puVar2;

    *(undefined4 **)(param_1 + 8) = puVar2;

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    return;

  }

  iVar1 = *(int *)(param_1 + 8);

  *(undefined4 **)(iVar1 + 4) = puVar2;

  puVar2[2] = iVar1;

  *(undefined4 **)(param_1 + 8) = puVar2;

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

  return;

}





// --- FUN_0048bda0 at 0x0048BDA0 (size: 42) ---


undefined4 * __thiscall FUN_0048bda0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a4ed0;

  FUN_0048bc30();

  *param_1 = &PTR_FUN_0079385c;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048bdd0 at 0x0048BDD0 (size: 261) ---


void FUN_0048bdd0(void)



{

  int *piVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined1 *puVar4;

  undefined *puVar5;

  int *piVar6;

  int **ppiVar7;

  undefined4 uVar8;

  int *local_24;

  undefined1 local_20 [4];

  undefined1 local_1c [4];

  int *local_18;

  undefined4 local_14;

  undefined **ppuStack_10;

  undefined4 *puStack_c;

  undefined4 uStack_8;

  undefined4 uStack_4;

  

  FUN_004e49f0();

  ppiVar7 = &local_24;

  puVar4 = local_20;

  puVar5 = &DAT_007a4998;

  local_24 = (int *)0x0;

  FUN_00406d10(puVar4,&DAT_007a4998,ppiVar7);

  FUN_00406570(puVar4,puVar5,ppiVar7);

  piVar1 = local_24;

  uVar8 = 0;

  local_18 = (int *)0x0;

  local_14 = 0;

  piVar6 = local_24;

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

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

  }

  local_24 = (int *)FUN_0048bb00(local_1c,piVar6,uVar8);

  local_24 = (int *)*local_24;

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

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

  }

  piVar1 = local_18;

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

    if ((int)local_24 < 0) {

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

      return;

    }

    iVar2 = FUN_0058fce0();

    if (iVar2 != 0) {

      ppuStack_10 = &PTR_FUN_007a4ed0;

      puStack_c = (undefined4 *)0x0;

      uStack_8 = 0;

      uStack_4 = 0;

      FUN_0058fd10(&ppuStack_10);

      for (puVar3 = puStack_c; puVar3 != (undefined4 *)0x0; puVar3 = (undefined4 *)puVar3[1]) {

        FUN_0048ba80(*puVar3);

      }

      FUN_0048b270();

      ppuStack_10 = &PTR_FUN_007a4ed0;

      FUN_0048bc30();

      ppuStack_10 = &PTR_FUN_0079385c;

    }

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

  }

  return;

}





// --- FUN_0048c030 at 0x0048C030 (size: 625) ---


undefined4 __fastcall FUN_0048c030(int param_1)



{

  undefined4 *puVar1;

  int iVar2;

  int *piVar3;

  LONG LVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  undefined4 *puStack_118;

  int *piStack_114;

  undefined4 *local_110;

  undefined4 *local_10c;

  undefined1 auStack_108 [120];

  undefined1 local_90 [144];

  

  if (*(int *)(param_1 + 0x600) == 0) {

    return 0;

  }

  iVar2 = FUN_00567c00();

  if (iVar2 == 0) {

    return 0;

  }

  local_10c = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  piVar3 = (int *)FUN_00567ef0(&local_110,*(undefined4 *)(param_1 + 0x600));

  FUN_00487620(&local_10c,

               "Are you sure you want to remove %s from your spellbook? You will no longer be able to cast this spell unless you learn it again!"

               ,*piVar3 + 0x14);

  puVar1 = local_110;

  LVar4 = InterlockedDecrement(local_110 + 1);

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

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

  }

  FUN_0042dc80();

  puVar1 = local_10c;

  uVar6 = 1;

  uVar5 = FUN_00404a40(0,local_10c + 5);

  FUN_0042cbe0(uVar5,uVar6);

  LVar4 = InterlockedDecrement(local_110 + -4);

  if ((LVar4 == 0) && (local_110 + -5 != (undefined4 *)0x0)) {

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

  }

  FUN_006823d0();

  puStack_118 = (undefined4 *)0x0;

  piStack_114 = (int *)0x0;

  FUN_0042a2d0(0x8e);

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

    FUN_00429b10();

    (**(code **)(*piStack_114 + 0xac))(1);

  }

  local_110 = (undefined4 *)FUN_00429a00();

  FUN_0042c290(&local_110,&puStack_118);

  FUN_0042a2d0(0xc5);

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

    FUN_00429b10();

    (**(code **)(*piStack_114 + 0xc4))(local_90);

  }

  local_110 = (undefined4 *)FUN_00429a00();

  FUN_0042c290(&local_110,&puStack_118);

  FUN_0042a2d0(0x1000003f);

  uVar5 = *(undefined4 *)(param_1 + 0x600);

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

    FUN_00429b10();

    (**(code **)(*piStack_114 + 0x7c))(uVar5);

  }

  local_110 = (undefined4 *)FUN_00429a00();

  FUN_0042c290(&local_110,&puStack_118);

  FUN_00478830(auStack_108,&LAB_0048bef0);

  if (puStack_118 != (undefined4 *)0x0) {

    iVar2 = puStack_118[1];

    puStack_118[1] = iVar2 + -1;

    if (iVar2 + -1 == 0) {

      (**(code **)*puStack_118)(1);

    }

    puStack_118 = (undefined4 *)0x0;

  }

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

    iVar2 = piStack_114[1];

    piStack_114[1] = iVar2 + -1;

    if (iVar2 + -1 == 0) {

      (**(code **)*piStack_114)(1);

    }

    piStack_114 = (int *)0x0;

  }

  FUN_00681f60();

  FUN_0042e590();

  LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  return 1;

}





// --- FUN_0048c3e0 at 0x0048C3E0 (size: 91) ---


int * __thiscall FUN_0048c3e0(int *param_1,char *param_2)



{

  char cVar1;

  char *pcVar2;

  LONG *lpAddend;

  

  if ((param_2 != (char *)0x0) && (*param_2 != '\0')) {

    pcVar2 = param_2;

    do {

      cVar1 = *pcVar2;

      pcVar2 = pcVar2 + 1;

    } while (cVar1 != '\0');

    FUN_00403560((int)pcVar2 - (int)(param_2 + 1));

    pcVar2 = (char *)(*param_1 + 0x14);

    do {

      cVar1 = *param_2;

      param_2 = param_2 + 1;

      *pcVar2 = cVar1;

      pcVar2 = pcVar2 + 1;

    } while (cVar1 != '\0');

    return param_1;

  }

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  *param_1 = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  return param_1;

}





// --- FUN_0048c440 at 0x0048C440 (size: 224) ---


void __fastcall FUN_0048c440(int param_1)



{

  int *piVar1;

  undefined4 uVar2;

  

  FUN_004639a0();

  piVar1 = (int *)FUN_00463c00(0x1000054b);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x5fc) = uVar2;

  piVar1 = (int *)FUN_00463c00(0x1000054c);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x600) = uVar2;

  piVar1 = (int *)FUN_00463c00(0x10000547);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x604) = uVar2;

  piVar1 = (int *)FUN_00463c00(0x1000053e);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(5);

  }

  *(undefined4 *)(param_1 + 0x608) = uVar2;

  piVar1 = (int *)FUN_00463c00(0x10000540);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x60c) = uVar2;

  piVar1 = (int *)FUN_0043c680();

  (**(code **)(*piVar1 + 4))(0x4dd27c,param_1 + 0x5f8);

  return;

}





// --- FUN_0048c520 at 0x0048C520 (size: 189) ---


void __fastcall FUN_0048c520(int param_1)



{

  uint uVar1;

  int iVar2;

  int *piVar3;

  

  iVar2 = *(int *)(param_1 + 0x608);

  uVar1 = 0;

  if (*(uint *)(iVar2 + 0x610) != 0) {

    piVar3 = *(int **)(iVar2 + 0x608);

    do {

      if (*piVar3 == *(int *)(iVar2 + 0x614)) goto LAB_0048c552;

      uVar1 = uVar1 + 1;

      piVar3 = piVar3 + 1;

    } while (uVar1 < *(uint *)(iVar2 + 0x610));

  }

  uVar1 = 0xffffffff;

LAB_0048c552:

  iVar2 = FUN_0046dc50(uVar1);

  if (iVar2 == 0) {

    (**(code **)(**(int **)(param_1 + 0x604) + 0x9c))(0xd);

  }

  else {

    (**(code **)(**(int **)(param_1 + 0x604) + 0x9c))(1);

    piVar3 = (int *)FUN_00463c00(0x10000542);

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

      (**(code **)(*piVar3 + 0x94))(0xc);

    }

  }

  if (*(uint *)(param_1 + 0x61c) < 100) {

    (**(code **)(**(int **)(param_1 + 0x5fc) + 0x9c))(1);

    (**(code **)(**(int **)(param_1 + 0x600) + 0x9c))(1);

    return;

  }

  (**(code **)(**(int **)(param_1 + 0x5fc) + 0x9c))(0xd);

  (**(code **)(**(int **)(param_1 + 0x600) + 0x9c))(0xd);

  return;

}





// --- FUN_0048c5e0 at 0x0048C5E0 (size: 216) ---


int __thiscall FUN_0048c5e0(int param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  int iVar2;

  int *piVar3;

  undefined4 *puVar4;

  int iVar5;

  LONG LVar6;

  int local_8;

  

  puVar1 = param_2;

  local_8 = 0;

  if (0 < *(int *)(*(int *)(param_1 + 0x608) + 0x610)) {

    do {

      iVar2 = FUN_0046dc50(local_8);

      if (iVar2 != 0) {

        piVar3 = (int *)FUN_00463c00(0x10000542);

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

          (**(code **)(*piVar3 + 0x94))(0xc);

        }

        puVar4 = (undefined4 *)FUN_00466830(&param_2);

        iVar5 = wcscmp((wchar_t *)*puVar1,(wchar_t *)*puVar4);

        puVar4 = param_2 + -5;

        LVar6 = InterlockedDecrement(param_2 + -4);

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

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

        }

        if (iVar5 < 0) {

          return iVar2;

        }

      }

      local_8 = local_8 + 1;

    } while (local_8 < *(int *)(*(int *)(param_1 + 0x608) + 0x610));

  }

  return 0;

}





// --- FUN_0048c6c0 at 0x0048C6C0 (size: 155) ---


undefined4 FUN_0048c6c0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  int *piVar2;

  

  uVar1 = FUN_0048c5e0(param_1,param_3);

  FUN_0046f670(0,uVar1);

  piVar2 = (int *)FUN_00463c00(0x10000542);

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

    piVar2 = (int *)(**(code **)(*piVar2 + 0x94))(0xc);

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

      FUN_0046a740(param_1);

      FUN_00460530(0x1000008f,param_1);

      if ((char)param_3 != '\0') {

        (**(code **)(*piVar2 + 0x9c))(0x10000057);

        return 1;

      }

      (**(code **)(*piVar2 + 0x9c))(0x10000056);

      return 1;

    }

  }

  return 0;

}





// --- FUN_0048c770 at 0x0048C770 (size: 80) ---


void __thiscall FUN_0048c770(int *param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 *puVar3;

  

  uVar2 = (**(code **)(*param_1 + 8))();

  if (uVar2 <= param_3) {

    *(int *)*param_2 = param_1[-1];

    puVar3 = (undefined4 *)(*param_2 + 4);

    *param_2 = (int)puVar3;

    for (puVar1 = (undefined4 *)param_1[-3]; puVar1 != (undefined4 *)0x0;

        puVar1 = (undefined4 *)puVar1[1]) {

      if (3 < param_3) {

        *puVar3 = *puVar1;

        puVar3 = (undefined4 *)(*param_2 + 4);

        *param_2 = (int)puVar3;

      }

      if (puVar1 == (undefined4 *)0x0) {

        return;

      }

    }

  }

  return;

}





// --- FUN_0048c802 at 0x0048C802 (size: 132) ---


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



{

  int iVar1;

  uint uVar2;

  undefined4 *puVar3;

  int *piVar4;

  int iVar5;

  uint unaff_EDI;

  

  piVar4 = param_3;

  iVar1 = *param_3;

  FUN_0049f850();

  uVar2 = *(uint *)*piVar4;

  *piVar4 = (int)((uint *)*piVar4 + 1);

  param_4 = 0;

  if (uVar2 != 0) {

    do {

      puVar3 = (undefined4 *)*piVar4;

      if ((unaff_EDI <= (uint)((int)puVar3 - iVar1)) || (unaff_EDI - ((int)puVar3 - iVar1) < 4)) {

        return 0;

      }

      param_3 = (int *)*puVar3;

      *piVar4 = (int)(puVar3 + 1);

      iVar5 = FUN_0048c890(&param_3);

      if (iVar5 == 0) {

        return 0;

      }

      param_4 = param_4 + 1;

    } while (param_4 < uVar2);

  }

  return 1;

}





// --- FUN_0048c890 at 0x0048C890 (size: 86) ---


undefined4 __thiscall FUN_0048c890(int param_1,undefined4 *param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0xc);

  if (puVar2 == (undefined4 *)0x0) {

    return 0;

  }

  *puVar2 = *param_2;

  puVar2[1] = 0;

  puVar2[2] = 0;

  if (*(int *)(param_1 + 4) == 0) {

    *(undefined4 **)(param_1 + 4) = puVar2;

    *(undefined4 **)(param_1 + 8) = puVar2;

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    return 1;

  }

  iVar1 = *(int *)(param_1 + 8);

  *(undefined4 **)(iVar1 + 4) = puVar2;

  puVar2[2] = iVar1;

  *(undefined4 **)(param_1 + 8) = puVar2;

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

  return 1;

}





// --- FUN_0048c8f0 at 0x0048C8F0 (size: 36) ---


undefined4 * __thiscall FUN_0048c8f0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a5160;

  FUN_0049f850();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048c920 at 0x0048C920 (size: 50) ---


undefined4 * __thiscall FUN_0048c920(undefined4 *param_1,byte param_2)



{

  param_1[4] = &PTR_LAB_007a5164;

  param_1[4] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_007a5160;

  FUN_0049f850();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048c960 at 0x0048C960 (size: 101) ---


void __fastcall FUN_0048c960(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  *param_1 = &PTR_FUN_007a5178;

  param_1[0xe] = &PTR_LAB_007a5164;

  param_1[0xe] = &PTR_FUN_0079385c;

  param_1[10] = &PTR_FUN_007a5160;

  FUN_0049f850();

  param_1[9] = &PTR_LAB_007a5164;

  param_1[9] = &PTR_FUN_0079385c;

  param_1[5] = &PTR_FUN_007a5160;

  FUN_0049f850();

  puVar1 = (undefined4 *)param_1[2];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_0048c9d0 at 0x0048C9D0 (size: 30) ---


void * __thiscall FUN_0048c9d0(void *param_1,byte param_2)



{

  FUN_0048c960();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048cad0 at 0x0048CAD0 (size: 99) ---


undefined4 * __thiscall FUN_0048cad0(undefined4 *param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  int *piVar2;

  LONG LVar3;

  LONG *lpAddend;

  undefined4 *puVar4;

  

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  *param_1 = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  piVar2 = (int *)FUN_00408fd0(&param_3,0);

  iVar1 = *(int *)(*piVar2 + -4);

  if (iVar1 != 1) {

    FUN_00404ef0(*piVar2,iVar1 + -1);

  }

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

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

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

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

  }

  return param_1;

}





// --- FUN_0048ce50 at 0x0048CE50 (size: 282) ---


void __fastcall FUN_0048ce50(int param_1)



{

  void *pvVar1;

  int iVar2;

  void *pvVar3;

  LONG LVar4;

  undefined4 *local_34;

  void *local_24;

  void *local_10;

  

  while (*(int *)(param_1 + 4) != 0) {

    FUN_005baed0();

    pvVar1 = *(void **)(param_1 + 4);

    pvVar3 = local_10;

    if (pvVar1 != (void *)0x0) {

      iVar2 = *(int *)((int)pvVar1 + 0x3c);

      *(int *)(param_1 + 4) = iVar2;

      if (iVar2 == 0) {

        *(undefined4 *)(param_1 + 8) = 0;

      }

      else {

        *(undefined4 *)(iVar2 + 0x40) = 0;

      }

      FUN_005baf40(pvVar1);

      if (pvVar1 != (void *)0x0) {

        FUN_0048c960();

        operator_delete(pvVar1);

      }

      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + -1;

    }

    while (local_10 = pvVar3, pvVar1 = local_24, local_10 != (void *)0x0) {

      pvVar3 = *(void **)((int)local_10 + 4);

      if (pvVar3 != (void *)0x0) {

        *(undefined4 *)((int)pvVar3 + 8) = 0;

      }

      if (local_10 != (void *)0x0) {

        operator_delete(local_10);

      }

    }

    while (local_24 = pvVar1, local_24 != (void *)0x0) {

      pvVar1 = *(void **)((int)local_24 + 4);

      if (pvVar1 != (void *)0x0) {

        *(undefined4 *)((int)pvVar1 + 8) = 0;

      }

      if (local_24 != (void *)0x0) {

        operator_delete(local_24);

      }

    }

    LVar4 = InterlockedDecrement(local_34 + 1);

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

      (**(code **)*local_34)(1);

    }

  }

  return;

}





// --- FUN_0048cf80 at 0x0048CF80 (size: 73) ---


uint __thiscall FUN_0048cf80(int *param_1,int *param_2,uint param_3)



{

  int *piVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 8))();

  if (uVar2 <= param_3) {

    *(int *)*param_2 = param_1[-1];

    *param_2 = *param_2 + 4;

    for (piVar1 = (int *)param_1[-3]; piVar1 != (int *)0x0; piVar1 = (int *)piVar1[0xf]) {

      (**(code **)(*piVar1 + 0xc))(param_2,param_3);

    }

  }

  return uVar2;

}





// --- FUN_0048d010 at 0x0048D010 (size: 20) ---


undefined4 FUN_0048d010(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  int *piVar3;

  uint uVar4;

  int iVar5;

  int aiStack_3c [15];

  

  piVar3 = param_1;

  if (param_2 < 4) {

    return 0;

  }

  iVar1 = *param_1;

  FUN_0048ce50();

  uVar2 = *(uint *)*param_1;

  *param_1 = (int)((uint *)*param_1 + 1);

  FUN_005baed0();

  param_1 = (int *)0x0;

  if (uVar2 != 0) {

    do {

      uVar4 = *piVar3 - iVar1;

      if (uVar4 < param_2) {

        iVar5 = param_2 - uVar4;

      }

      else {

        iVar5 = 0;

      }

      iVar5 = (**(code **)(aiStack_3c[0] + 0x10))(piVar3,iVar5);

      if (iVar5 == 0) {

LAB_0048d0ae:

        FUN_0048c960();

        return 0;

      }

      iVar5 = FUN_0048d0d0(aiStack_3c);

      if (iVar5 == 0) goto LAB_0048d0ae;

      param_1 = (int *)((int)param_1 + 1);

    } while (param_1 < uVar2);

  }

  FUN_0048c960();

  return 1;

}





// --- FUN_0048d024 at 0x0048D024 (size: 159) ---


undefined4 FUN_0048d024(void)



{

  int iVar1;

  uint uVar2;

  int *piVar3;

  uint uVar4;

  int iVar5;

  int unaff_retaddr;

  int *in_stack_00000040;

  uint in_stack_00000044;

  

  piVar3 = in_stack_00000040;

  iVar1 = *in_stack_00000040;

  FUN_0048ce50();

  uVar2 = *(uint *)*in_stack_00000040;

  *in_stack_00000040 = (int)((uint *)*in_stack_00000040 + 1);

  FUN_005baed0();

  in_stack_00000040 = (int *)0x0;

  if (uVar2 != 0) {

    do {

      uVar4 = *piVar3 - iVar1;

      if (uVar4 < in_stack_00000044) {

        iVar5 = in_stack_00000044 - uVar4;

      }

      else {

        iVar5 = 0;

      }

      iVar5 = (**(code **)(unaff_retaddr + 0x10))(piVar3,iVar5);

      if (iVar5 == 0) {

LAB_0048d0ae:

        FUN_0048c960();

        return 0;

      }

      iVar5 = FUN_0048d0d0(&stack0x00000000);

      if (iVar5 == 0) goto LAB_0048d0ae;

      in_stack_00000040 = (int *)((int)in_stack_00000040 + 1);

    } while (in_stack_00000040 < uVar2);

  }

  FUN_0048c960();

  return 1;

}





// --- FUN_0048d0d0 at 0x0048D0D0 (size: 112) ---


undefined4 __thiscall FUN_0048d0d0(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  

  iVar2 = FUN_005df0f5(0x44);

  if (iVar2 == 0) {

    return 0;

  }

  FUN_005bafc0(param_2);

  *(undefined4 *)(iVar2 + 0x3c) = 0;

  *(undefined4 *)(iVar2 + 0x40) = 0;

  if (*(int *)(param_1 + 4) == 0) {

    *(int *)(param_1 + 4) = iVar2;

    *(int *)(param_1 + 8) = iVar2;

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    return 1;

  }

  iVar1 = *(int *)(param_1 + 8);

  *(int *)(iVar1 + 0x3c) = iVar2;

  *(int *)(iVar2 + 0x40) = iVar1;

  *(int *)(param_1 + 8) = iVar2;

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

  return 1;

}





// --- FUN_0048d140 at 0x0048D140 (size: 36) ---


undefined4 * __thiscall FUN_0048d140(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a515c;

  FUN_0048ce50();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048d170 at 0x0048D170 (size: 50) ---


undefined4 * __thiscall FUN_0048d170(undefined4 *param_1,byte param_2)



{

  param_1[4] = &PTR_LAB_007a518c;

  param_1[4] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_007a515c;

  FUN_0048ce50();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048d1b0 at 0x0048D1B0 (size: 132) ---


undefined4 * __thiscall FUN_0048d1b0(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00472670(param_2,param_3);

  param_1[0x17e] = &PTR_FUN_007ccb60;

  param_1[0x17f] = 0;

  param_1[0x180] = 0;

  param_1[0x181] = 0;

  param_1[0x182] = 0;

  param_1[0x183] = 0;

  *param_1 = &PTR_FUN_007a5450;

  param_1[0x17e] = &PTR_FUN_007a51a8;

  param_1[0x185] = 0;

  param_1[0x186] = 0;

  param_1[0x187] = 0;

  param_1[0x188] = &PTR_FUN_0079385c;

  param_1[0x184] = &PTR_FUN_007a51a0;

  param_1[0x188] = &PTR_LAB_007a518c;

  return param_1;

}





// --- FUN_0048d270 at 0x0048D270 (size: 92) ---


void __fastcall FUN_0048d270(undefined4 *param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a5450;

  *puVar1 = &PTR_FUN_007a51a8;

  piVar2 = (int *)FUN_0043c680();

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

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  param_1[0x188] = &PTR_LAB_007a518c;

  param_1[0x188] = &PTR_FUN_0079385c;

  param_1[0x184] = &PTR_FUN_007a515c;

  FUN_0048ce50();

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  return;

}





// --- FUN_0048d300 at 0x0048D300 (size: 30) ---


void * __thiscall FUN_0048d300(void *param_1,byte param_2)



{

  FUN_0048d270();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048d320 at 0x0048D320 (size: 19) ---


void FUN_0048d320(void)



{

  FUN_00460270(0x10000047,&LAB_0048d2d0);

  return;

}





// --- FUN_0048d340 at 0x0048D340 (size: 135) ---


undefined4 __thiscall FUN_0048d340(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  FUN_0046dc70(0,1);

  iVar1 = param_2;

  iVar3 = 0;

  if (0 < *(int *)(*(int *)(param_1 + 0x608) + 0x610)) {

    do {

      iVar2 = FUN_0046dc50(iVar3);

      if (iVar2 != 0) {

        param_2 = 0;

        FUN_00460a60(0x10000085,&param_2);

        if (iVar1 == param_2) {

          FUN_0046e3e0(iVar2);

          return 1;

        }

      }

      iVar3 = iVar3 + 1;

    } while (iVar3 < *(int *)(*(int *)(param_1 + 0x608) + 0x610));

  }

  return 0;

}





// --- FUN_0048d3d0 at 0x0048D3D0 (size: 333) ---


void __fastcall FUN_0048d3d0(int param_1)



{

  int *piVar1;

  undefined4 uVar2;

  

  FUN_004639a0();

  piVar1 = (int *)FUN_00463c00(0x10000514);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x5fc) = uVar2;

  piVar1 = (int *)FUN_00463c00(0x10000515);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x600) = uVar2;

  piVar1 = (int *)FUN_00463c00(0x10000516);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x604) = uVar2;

  piVar1 = (int *)FUN_00463c00(0x10000517);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(5);

  }

  *(undefined4 *)(param_1 + 0x608) = uVar2;

  piVar1 = (int *)FUN_00463c00(0x1000051b);

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

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar1 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x60c) = uVar2;

  piVar1 = (int *)FUN_00463c00(0x1000052c);

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

    (**(code **)(*piVar1 + 0x94))(0x10000035);

  }

  FUN_00487240(0x27);

  piVar1 = (int *)FUN_0043c680();

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

    param_1 = param_1 + 0x5f8;

    (**(code **)(*piVar1 + 4))(0x4dd26f,param_1);

    (**(code **)(*piVar1 + 4))(0x4dd272,param_1);

    (**(code **)(*piVar1 + 4))(0x4dd273,param_1);

    (**(code **)(*piVar1 + 4))(0x4dd274,param_1);

    (**(code **)(*piVar1 + 4))(0x4dd275,param_1);

  }

  return;

}





// --- FUN_0048d520 at 0x0048D520 (size: 94) ---


undefined4 __thiscall FUN_0048d520(int param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  LONG LVar2;

  

  if (99 < *(uint *)(param_1 + 0x61c)) {

    FUN_00693550(0x561,&DAT_008ef120);

    return 0;

  }

  uVar1 = FUN_0048c3e0(*param_2);

  FUN_006a6b70(uVar1);

  LVar2 = InterlockedDecrement(param_2 + 1);

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

    (**(code **)*param_2)(1);

  }

  return 1;

}





// --- FUN_0048d580 at 0x0048D580 (size: 207) ---


void __fastcall FUN_0048d580(int param_1)



{

  uint uVar1;

  int iVar2;

  int *piVar3;

  

  iVar2 = *(int *)(param_1 + 0x608);

  uVar1 = 0;

  if (*(uint *)(iVar2 + 0x610) != 0) {

    piVar3 = *(int **)(iVar2 + 0x608);

    do {

      if (*piVar3 == *(int *)(iVar2 + 0x614)) goto LAB_0048d5b2;

      uVar1 = uVar1 + 1;

      piVar3 = piVar3 + 1;

    } while (uVar1 < *(uint *)(iVar2 + 0x610));

  }

  uVar1 = 0xffffffff;

LAB_0048d5b2:

  iVar2 = FUN_0046dc50(uVar1);

  if (iVar2 == 0) {

    (**(code **)(**(int **)(param_1 + 0x600) + 0x9c))(0xd);

  }

  else {

    (**(code **)(**(int **)(param_1 + 0x600) + 0x9c))(1);

    piVar3 = (int *)FUN_00463c00(0x1000051a);

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

      iVar2 = (**(code **)(*piVar3 + 0x94))(0xc);

      if ((iVar2 != 0) && (*(int *)(iVar2 + 0x400) == 0x10000054)) {

        (**(code **)(**(int **)(param_1 + 0x604) + 0x9c))(1);

        goto LAB_0048d624;

      }

    }

  }

  (**(code **)(**(int **)(param_1 + 0x604) + 0x9c))(0xd);

LAB_0048d624:

  if (*(uint *)(param_1 + 0x61c) < 100) {

    (**(code **)(**(int **)(param_1 + 0x5fc) + 0x9c))(1);

    return;

  }

  (**(code **)(**(int **)(param_1 + 0x5fc) + 0x9c))(0xd);

  return;

}





// --- FUN_0048d650 at 0x0048D650 (size: 250) ---


int __thiscall FUN_0048d650(int param_1,undefined4 *param_2,char param_3)



{

  undefined4 *puVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  undefined4 *puVar5;

  LONG LVar6;

  int local_8;

  

  puVar1 = param_2;

  local_8 = 0;

  if (0 < *(int *)(*(int *)(param_1 + 0x608) + 0x610)) {

    do {

      iVar2 = FUN_0046dc50(local_8);

      if (iVar2 != 0) {

        piVar3 = (int *)FUN_00463c00(0x1000051a);

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

          iVar4 = 0;

        }

        else {

          iVar4 = (**(code **)(*piVar3 + 0x94))(0xc);

        }

        if (param_3 == '\0') {

          if (*(int *)(iVar4 + 0x400) == 0x10000054) goto LAB_0048d728;

        }

        else if (*(int *)(iVar4 + 0x400) == 0x10000055) {

          return iVar2;

        }

        puVar5 = (undefined4 *)FUN_00466830(&param_2);

        iVar4 = wcscmp((wchar_t *)*puVar1,(wchar_t *)*puVar5);

        puVar5 = param_2 + -5;

        LVar6 = InterlockedDecrement(param_2 + -4);

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

          (**(code **)*puVar5)(1);

        }

        if (iVar4 < 0) {

          return iVar2;

        }

      }

LAB_0048d728:

      local_8 = local_8 + 1;

    } while (local_8 < *(int *)(*(int *)(param_1 + 0x608) + 0x610));

  }

  return 0;

}





// --- FUN_0048d760 at 0x0048D760 (size: 155) ---


undefined4 FUN_0048d760(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  int *piVar2;

  

  uVar1 = FUN_0048d650(param_1,param_3);

  FUN_0046f670(0,uVar1);

  piVar2 = (int *)FUN_00463c00(0x1000051a);

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

    piVar2 = (int *)(**(code **)(*piVar2 + 0x94))(0xc);

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

      FUN_0046a740(param_1);

      FUN_00460530(0x10000085,param_1);

      if ((char)param_3 != '\0') {

        (**(code **)(*piVar2 + 0x9c))(0x10000054);

        return 1;

      }

      (**(code **)(*piVar2 + 0x9c))(0x10000055);

      return 1;

    }

  }

  return 0;

}





// --- FUN_0048df20 at 0x0048DF20 (size: 140) ---


undefined4 __fastcall FUN_0048df20(int param_1)



{

  undefined4 uVar1;

  undefined4 uVar2;

  LONG LVar3;

  int iVar4;

  undefined4 uVar5;

  

  FUN_0046e460();

  FUN_0046dc70(0,1);

  for (iVar4 = *(int *)(param_1 + 0x614); iVar4 != 0; iVar4 = *(int *)(iVar4 + 0x3c)) {

    uVar5 = *(undefined4 *)(iVar4 + 4);

    uVar1 = CONCAT31((int3)((uint)*(int *)(iVar4 + 0xc) >> 8),*(int *)(iVar4 + 0xc) != 0);

    uVar2 = FUN_00404a40(0,*(int *)(iVar4 + 8) + 0x14);

    FUN_0048d760(uVar2,uVar5,uVar1);

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

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

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

    }

  }

  FUN_0048d580();

  return 1;

}





// --- FUN_0048dfb0 at 0x0048DFB0 (size: 193) ---


undefined4 __thiscall FUN_0048dfb0(int param_1,int param_2)



{

  undefined4 uVar1;

  uint uVar2;

  undefined4 uVar3;

  LONG LVar4;

  undefined4 local_38;

  int local_34;

  int local_30;

  

  FUN_005baed0();

  if (*(int *)(param_2 + 4) != 0) {

    FUN_005baf40(*(int *)(param_2 + 4));

    uVar1 = *(undefined4 *)(*(int *)(param_1 + 0x608) + 0x614);

    FUN_0048d340(local_38);

    uVar2 = (uint)(local_30 != 0);

    uVar3 = FUN_00404a40(0,local_34 + 0x14);

    FUN_0048d760(uVar3,local_38,uVar2);

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

    if ((LVar4 == 0) && ((undefined4 *)(param_2 + -0x14) != (undefined4 *)0x0)) {

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

    }

    FUN_0046dc70(uVar1,1);

    FUN_0048c960();

    return 1;

  }

  FUN_0048c960();

  return 0;

}





// --- FUN_0048e080 at 0x0048E080 (size: 141) ---


undefined4 __thiscall FUN_0048e080(int param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  

  iVar1 = FUN_005df0f5(0x44);

  if (iVar1 == 0) {

    return 0;

  }

  FUN_005bafc0(param_3);

  *(undefined4 *)(iVar1 + 0x3c) = 0;

  *(undefined4 *)(iVar1 + 0x40) = 0;

  if (*(int *)(param_1 + 4) == 0) {

    *(int *)(param_1 + 4) = iVar1;

    *(int *)(param_1 + 8) = iVar1;

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    return 1;

  }

  *(int *)(iVar1 + 0x3c) = param_2;

  *(undefined4 *)(iVar1 + 0x40) = *(undefined4 *)(param_2 + 0x40);

  if (*(int *)(param_2 + 0x40) != 0) {

    *(int *)(*(int *)(param_2 + 0x40) + 0x3c) = iVar1;

    *(int *)(param_2 + 0x40) = iVar1;

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    return 1;

  }

  *(int *)(param_1 + 4) = iVar1;

  *(int *)(param_2 + 0x40) = iVar1;

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

  return 1;

}





// --- FUN_0048e110 at 0x0048E110 (size: 110) ---


undefined4 __thiscall FUN_0048e110(int param_1,void *param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  uVar2 = 0;

  if ((param_2 == (void *)0x0) || (*(void **)(param_1 + 4) == (void *)0x0)) {

    return 0;

  }

  if (param_2 == *(void **)(param_1 + 4)) {

    iVar1 = *(int *)((int)param_2 + 0x3c);

    *(int *)(param_1 + 4) = iVar1;

    if (iVar1 == 0) {

      *(undefined4 *)(param_1 + 8) = 0;

      goto LAB_0048e15d;

    }

  }

  else {

    *(undefined4 *)(*(int *)((int)param_2 + 0x40) + 0x3c) = *(undefined4 *)((int)param_2 + 0x3c);

    iVar1 = *(int *)((int)param_2 + 0x3c);

    if (iVar1 == 0) {

      *(undefined4 *)(param_1 + 8) = *(undefined4 *)((int)param_2 + 0x40);

      goto LAB_0048e15d;

    }

    uVar2 = *(undefined4 *)((int)param_2 + 0x40);

  }

  *(undefined4 *)(iVar1 + 0x40) = uVar2;

LAB_0048e15d:

  FUN_0048c960();

  operator_delete(param_2);

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + -1;

  return 1;

}





// --- FUN_0048e180 at 0x0048E180 (size: 80) ---


undefined4 __thiscall FUN_0048e180(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 uVar2;

  int iVar3;

  int iVar4;

  

  iVar3 = *(int *)(param_1 + 4);

  iVar4 = 0;

  if (iVar3 != 0) {

    do {

      iVar1 = FUN_005bad70(param_2);

      if (iVar1 != 0) {

        iVar4 = iVar3;

      }

    } while ((iVar3 != 0) && (iVar3 = *(int *)(iVar3 + 0x3c), iVar3 != 0));

    if (iVar4 != 0) {

      FUN_005baf40(iVar4);

      uVar2 = FUN_0048e110(iVar4);

      return uVar2;

    }

  }

  return 0;

}





// --- FUN_0048e1d0 at 0x0048E1D0 (size: 183) ---


undefined4 __thiscall FUN_0048e1d0(int param_1,int param_2)



{

  undefined4 uVar1;

  LONG LVar2;

  uint uVar3;

  undefined1 local_3c [4];

  undefined4 local_38;

  int local_34;

  int local_30;

  

  FUN_005baed0();

  if (*(int *)(param_2 + 4) != 0) {

    FUN_005baf40(*(int *)(param_2 + 4));

    FUN_0048e080(*(undefined4 *)(param_1 + 0x614),local_3c);

    uVar3 = (uint)(local_30 != 0);

    uVar1 = FUN_00404a40(0,local_34 + 0x14);

    FUN_0048d760(uVar1,local_38,uVar3);

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

    if ((LVar2 == 0) && ((undefined4 *)(param_2 + -0x14) != (undefined4 *)0x0)) {

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

    }

    FUN_0048d580();

    FUN_0048c960();

    return 1;

  }

  FUN_0048c960();

  return 0;

}





// --- FUN_0048e290 at 0x0048E290 (size: 107) ---


undefined4 FUN_0048e290(int param_1)



{

  undefined1 local_3c [4];

  undefined4 local_38;

  

  FUN_005baed0();

  if (*(int *)(param_1 + 4) != 0) {

    FUN_005baf40(*(int *)(param_1 + 4));

    FUN_0048e180(local_3c);

    FUN_0048d340(local_38);

    FUN_0048d580();

    FUN_0048c960();

    return 1;

  }

  FUN_0048c960();

  return 0;

}





// --- FUN_0048e380 at 0x0048E380 (size: 132) ---


undefined4 * __thiscall FUN_0048e380(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00472670(param_2,param_3);

  param_1[0x17e] = &PTR_FUN_007ccb60;

  param_1[0x17f] = 0;

  param_1[0x180] = 0;

  param_1[0x181] = 0;

  param_1[0x182] = 0;

  param_1[0x183] = 0;

  *param_1 = &PTR_FUN_007a5ab0;

  param_1[0x17e] = &PTR_FUN_007a5808;

  param_1[0x185] = 0;

  param_1[0x186] = 0;

  param_1[0x187] = 0;

  param_1[0x188] = &PTR_FUN_0079385c;

  param_1[0x184] = &PTR_FUN_007a51a0;

  param_1[0x188] = &PTR_LAB_007a518c;

  return param_1;

}





// --- FUN_0048e440 at 0x0048E440 (size: 92) ---


void __fastcall FUN_0048e440(undefined4 *param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a5ab0;

  *puVar1 = &PTR_FUN_007a5808;

  piVar2 = (int *)FUN_0043c680();

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

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  param_1[0x188] = &PTR_LAB_007a518c;

  param_1[0x188] = &PTR_FUN_0079385c;

  param_1[0x184] = &PTR_FUN_007a515c;

  FUN_0048ce50();

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  return;

}





// --- FUN_0048e4d0 at 0x0048E4D0 (size: 30) ---


void * __thiscall FUN_0048e4d0(void *param_1,byte param_2)



{

  FUN_0048e440();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048e4f0 at 0x0048E4F0 (size: 19) ---


void FUN_0048e4f0(void)



{

  FUN_00460270(0x10000045,&LAB_0048e4a0);

  return;

}





// --- FUN_0048e510 at 0x0048E510 (size: 50) ---


int __thiscall FUN_0048e510(int param_1,int param_2)



{

  int iVar1;

  

  if (param_1 != param_2) {

    FUN_0048ce50();

    for (iVar1 = *(int *)(param_2 + 4); (iVar1 != 0 && (FUN_0048d0d0(iVar1), iVar1 != 0));

        iVar1 = *(int *)(iVar1 + 0x3c)) {

    }

  }

  return param_1;

}





// --- FUN_0048e5f0 at 0x0048E5F0 (size: 19) ---


undefined4 FUN_0048e5f0(void)



{

  if (DAT_0083da58 != 0) {

    return *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  return 0;

}





// --- FUN_0048e610 at 0x0048E610 (size: 150) ---


undefined4 * __thiscall FUN_0048e610(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00472670(param_2,param_3);

  param_1[0x17e] = &PTR_FUN_007ccb60;

  param_1[0x17f] = 0;

  param_1[0x180] = 0;

  param_1[0x181] = 0;

  param_1[0x182] = 0;

  param_1[0x183] = 0;

  param_1[0x184] = 0;

  param_1[0x185] = 0;

  param_1[0x186] = 0;

  param_1[0x187] = 0;

  param_1[0x188] = 0;

  param_1[0x189] = 0;

  param_1[0x18a] = 0;

  param_1[0x18b] = 0;

  param_1[0x18c] = 0;

  param_1[0x18d] = 0;

  param_1[0x18e] = 0;

  *param_1 = &PTR_FUN_007a6070;

  param_1[0x17e] = &PTR_FUN_007a5dc8;

  return param_1;

}





// --- FUN_0048e750 at 0x0048E750 (size: 180) ---


void __thiscall FUN_0048e750(int param_1,int param_2)



{

  int iVar1;

  undefined1 local_90 [144];

  

  if (*(int *)(param_1 + 0x5fc) != 0) {

    iVar1 = FUN_005ba1c0(param_2);

    if (iVar1 == 0) {

      FUN_0042dc80();

      FUN_0042c9c0(DAT_0083f138,0x10000001);

    }

    else {

      if (DAT_0083da58 == 0) {

        iVar1 = 0;

      }

      else {

        iVar1 = *(int *)(DAT_0083da58 + 0xf4);

      }

      if (param_2 != iVar1) {

        FUN_006a7070(param_2);

        return;

      }

      FUN_0042dc80();

      FUN_0042c9c0(DAT_0083f130,0x10000001);

    }

    FUN_00693500(0x1a,local_90);

    FUN_0042e590();

  }

  return;

}





// --- FUN_0048e810 at 0x0048E810 (size: 219) ---


void __thiscall FUN_0048e810(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  undefined1 auStack_90 [144];

  

  if (((*(int *)(param_1 + 0x5fc) != 0) &&

      (piVar1 = (int *)FUN_005583f0(param_2), piVar1 != (int *)0x0)) &&

     (iVar2 = (**(code **)(*piVar1 + 0x10))(), iVar2 != 0)) {

    iVar2 = FUN_005ba1c0(param_2);

    if (iVar2 == 0) {

      FUN_006a7210(param_2);

      return;

    }

    if (DAT_0083da58 == 0) {

      iVar2 = 0;

    }

    else {

      iVar2 = *(int *)(DAT_0083da58 + 0xf4);

    }

    if (param_2 == iVar2) {

      FUN_0042dc80();

      FUN_0042c9c0(DAT_0083f134,0x10000001);

    }

    else {

      FUN_0042dc80();

      FUN_0042c9c0(DAT_0083f13c,0x10000001);

    }

    FUN_00693500(0x1a,auStack_90);

    FUN_0042e590();

  }

  return;

}





// --- FUN_0048e910 at 0x0048E910 (size: 104) ---


void __fastcall FUN_0048e910(undefined4 *param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a6070;

  *puVar1 = &PTR_FUN_007a5dc8;

  piVar2 = (int *)FUN_0043c680();

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

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  FUN_00465fb0(1);

  FUN_00465fb0(3);

  FUN_00478560(param_1[0x182]);

  param_1[0x182] = 0;

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  return;

}





// --- FUN_0048e980 at 0x0048E980 (size: 19) ---


void FUN_0048e980(void)



{

  FUN_00460270(0x1000002d,&LAB_0048e6e0);

  return;

}





// --- FUN_0048e9a0 at 0x0048E9A0 (size: 786) ---


void __fastcall FUN_0048e9a0(int param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  LONG LVar5;

  undefined4 *puVar6;

  int aiStack_ac [3];

  

  if (*(int *)(param_1 + 0x5fc) == 0) {

    return;

  }

  (**(code **)(**(int **)(param_1 + 0x628) + 0x9c))();

  if (DAT_0083da58 == 0) {

    iVar3 = 0;

  }

  else {

    iVar3 = *(int *)(DAT_0083da58 + 0xf4);

  }

  if (*(int *)(*(int *)(param_1 + 0x5fc) + 0x1c) == iVar3) {

    aiStack_ac[2] = 1;

    aiStack_ac[1] = 0x48e9fa;

    (**(code **)(**(int **)(param_1 + 0x638) + 0x9c))();

    aiStack_ac[1] = 1;

    aiStack_ac[0] = 0x48ea0a;

    (**(code **)(**(int **)(param_1 + 0x62c) + 0x9c))();

    iVar3 = DAT_00871e54;

    aiStack_ac[0] = DAT_00871e54;

    piVar1 = (int *)FUN_005583f0();

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

LAB_0048ea6e:

      aiStack_ac[0] = 0xd;

      (**(code **)(**(int **)(param_1 + 0x630) + 0x9c))();

    }

    else {

      aiStack_ac[0] = 0x48ea24;

      iVar2 = (**(code **)(*piVar1 + 0x10))();

      if (iVar2 == 0) goto LAB_0048ea6e;

      aiStack_ac[0] = iVar3;

      iVar3 = FUN_005ba1c0();

      if (iVar3 == 0) {

        iVar3 = **(int **)(param_1 + 0x630);

        aiStack_ac[0] = 0x48ea57;

        iVar2 = FUN_005ba1b0();

        aiStack_ac[0] = (-(uint)(iVar2 != 0) & 0xc) + 1;

        (**(code **)(iVar3 + 0x9c))();

      }

      else {

        aiStack_ac[0] = 0xd;

        (**(code **)(**(int **)(param_1 + 0x630) + 0x9c))();

      }

    }

    if (*(int *)(param_1 + 0x600) != 0) {

      if (DAT_0083da58 == 0) {

        iVar3 = 0;

      }

      else {

        iVar3 = *(int *)(DAT_0083da58 + 0xf4);

      }

      (**(code **)(**(int **)(param_1 + 0x634) + 0x9c))

                (((*(int *)(param_1 + 0x600) == iVar3) - 1 & 0xfffffff4) + 0xd);

      if (DAT_0083da58 == 0) {

        iVar3 = 0;

      }

      else {

        iVar3 = *(int *)(DAT_0083da58 + 0xf4);

      }

      (**(code **)(**(int **)(param_1 + 0x624) + 0x9c))

                (((*(int *)(param_1 + 0x600) == iVar3) - 1 & 0xfffffff4) + 0xd);

      goto LAB_0048ebd1;

    }

    (**(code **)(**(int **)(param_1 + 0x634) + 0x9c))(0xd);

    piVar1 = *(int **)(param_1 + 0x624);

  }

  else {

    aiStack_ac[2] = 0xd;

    aiStack_ac[1] = 0x48eb20;

    (**(code **)(**(int **)(param_1 + 0x624) + 0x9c))();

    aiStack_ac[1] = 0xd;

    aiStack_ac[0] = 0x48eb30;

    (**(code **)(**(int **)(param_1 + 0x638) + 0x9c))();

    aiStack_ac[0] = 0xd;

    (**(code **)(**(int **)(param_1 + 0x634) + 0x9c))();

    (**(code **)(**(int **)(param_1 + 0x62c) + 0x9c))(0xd);

    iVar3 = DAT_00871e54;

    if (*(int *)(*(int *)(param_1 + 0x5fc) + 0x28) != 0) {

      piVar1 = (int *)FUN_005583f0(DAT_00871e54);

      if ((piVar1 != (int *)0x0) && (iVar2 = (**(code **)(*piVar1 + 0x10))(), iVar2 != 0)) {

        iVar3 = FUN_005ba1c0(iVar3);

        if (iVar3 == 0) {

          iVar3 = **(int **)(param_1 + 0x630);

          iVar2 = FUN_005ba1b0();

          (**(code **)(iVar3 + 0x9c))((-(iVar2 != 0) & 0xcU) + 1);

        }

        else {

          (**(code **)(**(int **)(param_1 + 0x630) + 0x9c))(0xd);

        }

      }

      goto LAB_0048ebd1;

    }

    piVar1 = *(int **)(param_1 + 0x630);

  }

  (**(code **)(*piVar1 + 0x9c))(0xd);

LAB_0048ebd1:

  if (*(int *)(*(int *)(param_1 + 0x5fc) + 0x28) == 0) {

    FUN_0042dc80();

    FUN_0042c9c0(DAT_0083f15c,0x10000001);

    uVar4 = FUN_0042e980(aiStack_ac,0);

    FUN_0046a740(uVar4);

    puVar6 = (undefined4 *)(aiStack_ac[0] + -0x14);

    LVar5 = InterlockedDecrement((LONG *)(aiStack_ac[0] + -0x10));

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

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

    }

  }

  else {

    FUN_0042dc80();

    FUN_0042c9c0(DAT_0083f12c,0x10000001);

    uVar4 = FUN_0042e980(aiStack_ac,0);

    FUN_0046a740(uVar4);

    puVar6 = (undefined4 *)(aiStack_ac[0] + -0x14);

    LVar5 = InterlockedDecrement((LONG *)(aiStack_ac[0] + -0x10));

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

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

      FUN_0042e590();

      return;

    }

  }

  FUN_0042e590();

  return;

}





// --- FUN_0048ecc0 at 0x0048ECC0 (size: 87) ---


void __thiscall FUN_0048ecc0(int param_1,undefined4 *param_2)



{

  uint uVar1;

  int *piVar2;

  undefined4 uVar3;

  int iVar4;

  uint uVar5;

  int *piVar6;

  

  uVar1 = *(uint *)(param_1 + 0xc);

  uVar5 = 0;

  if (uVar1 != 0) {

    piVar2 = *(int **)(param_1 + 8);

    piVar6 = piVar2;

    do {

      if (*piVar6 != 0) {

        iVar4 = piVar2[uVar5];

        param_2[2] = piVar2;

        param_2[1] = iVar4;

        *param_2 = &PTR_LAB_007a61a8;

        param_2[3] = uVar1;

        return;

      }

      uVar5 = uVar5 + 1;

      piVar6 = piVar6 + 1;

    } while (uVar5 < uVar1);

  }

  uVar3 = *(undefined4 *)(param_1 + 8);

  param_2[1] = 0;

  param_2[2] = uVar3;

  *param_2 = &PTR_LAB_007a61a8;

  param_2[3] = uVar1;

  return;

}





// --- FUN_0048ed20 at 0x0048ED20 (size: 48) ---


void __fastcall FUN_0048ed20(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)param_1[1];

  *param_1 = &PTR_FUN_007a61ac;

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_0048ed50 at 0x0048ED50 (size: 68) ---


undefined4 * __thiscall FUN_0048ed50(undefined4 *param_1,byte param_2)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)param_1[1];

  *param_1 = &PTR_FUN_007a61ac;

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048eda0 at 0x0048EDA0 (size: 59) ---


uint * __thiscall FUN_0048eda0(int param_1,uint param_2)



{

  uint *puVar1;

  

  if ((*(uint *)(param_1 + 0x10) != 0) && (*(int *)(param_1 + 0xc) != 0)) {

    for (puVar1 = *(uint **)(*(int *)(param_1 + 0xc) + (param_2 % *(uint *)(param_1 + 0x10)) * 4);

        puVar1 != (uint *)0x0; puVar1 = (uint *)puVar1[0xd]) {

      if (param_2 == *puVar1) {

        return puVar1 + 1;

      }

    }

  }

  return (uint *)0x0;

}





// --- FUN_0048ede0 at 0x0048EDE0 (size: 30) ---


void * __thiscall FUN_0048ede0(void *param_1,byte param_2)



{

  FUN_0048e910();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0048ee00 at 0x0048EE00 (size: 567) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



uint __thiscall FUN_0048ee00(int param_1,uint param_2)



{

  uint uVar1;

  char cVar2;

  uint uVar3;

  int iVar4;

  int *piVar5;

  undefined4 uVar6;

  LONG LVar7;

  uint *puVar8;

  undefined4 *puVar9;

  int local_b0;

  uint local_a8;

  int iStack_a4;

  undefined4 uStack_a0;

  undefined4 uStack_9c;

  undefined4 uStack_98;

  undefined4 uStack_94;

  

  iVar4 = *(int *)(param_1 + 0x5fc);

  uVar1 = *(uint *)(iVar4 + 0x10);

  uVar3 = iVar4 + 4;

  if ((uVar1 != 0) && (*(int *)(iVar4 + 0xc) != 0)) {

    uVar3 = param_2 / uVar1;

    puVar8 = *(uint **)(*(int *)(iVar4 + 0xc) + (param_2 % uVar1) * 4);

    if (puVar8 != (uint *)0x0) {

      while (param_2 != *puVar8) {

        puVar8 = (uint *)puVar8[0xd];

        if (puVar8 == (uint *)0x0) {

          return uVar3;

        }

      }

      if (puVar8 != (uint *)0xfffffffc) {

        uVar3 = *(uint *)(*(int *)(param_1 + 0x620) + 0x610);

        local_b0 = 0;

        if (0 < (int)uVar3) {

          do {

            iVar4 = FUN_0046dc50(local_b0);

            if ((((iVar4 != 0) && (cVar2 = FUN_00460a60(0x1000000d,&local_a8), cVar2 != '\0')) &&

                (local_a8 == param_2)) &&

               ((piVar5 = (int *)FUN_00463c00(0x10000284), piVar5 != (int *)0x0 &&

                (iVar4 = (**(code **)(*piVar5 + 0x94))(0xc), iVar4 != 0)))) {

              iVar4 = *(int *)(param_1 + 0x5fc);

              if (*(int *)(iVar4 + 0x20) != 0) {

                if (*(int *)(iVar4 + 0x24) == 0) {

                  uVar6 = FUN_005ba270();

                  FUN_005bacc0(puVar8[3]);

                  uStack_9c = 0;

                  uStack_94 = 0;

                  uStack_98 = 0;

                  uStack_a0 = uVar6;

                }

                else {

                  FUN_005bace0(*(undefined4 *)(iVar4 + 0x14));

                }

              }

              FUN_0042dc80();

              FUN_0042c9c0(DAT_0083f158,0x10000001);

              FUN_0042e000(DAT_0083f168,puVar8[3],0);

              iVar4 = FUN_005df4c4();

              FUN_0042e000(DAT_0083f164,iVar4,iVar4 >> 0x1f);

              uVar6 = FUN_0042e980(&iStack_a4,0);

              FUN_0046a740(uVar6);

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

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

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

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

              }

              FUN_0042e590();

            }

            uVar3 = *(uint *)(*(int *)(param_1 + 0x620) + 0x610);

            local_b0 = local_b0 + 1;

          } while (local_b0 < (int)uVar3);

        }

      }

    }

  }

  return uVar3;

}





// --- FUN_0048f040 at 0x0048F040 (size: 905) ---


uint __thiscall FUN_0048f040(int param_1,uint param_2)



{

  uint uVar1;

  uint uVar2;

  char cVar3;

  uint uVar4;

  int iVar5;

  int *piVar6;

  undefined4 uVar7;

  uint *puVar8;

  int iVar9;

  uint uStack_9c;

  uint uStack_98;

  uint local_94 [37];

  

  iVar9 = *(int *)(param_1 + 0x5fc);

  uVar1 = *(uint *)(iVar9 + 0x10);

  uVar4 = iVar9 + 4;

  if ((uVar1 != 0) && (*(int *)(iVar9 + 0xc) != 0)) {

    uVar4 = param_2 / uVar1;

    puVar8 = *(uint **)(*(int *)(iVar9 + 0xc) + (param_2 % uVar1) * 4);

    if (puVar8 != (uint *)0x0) {

      while (param_2 != *puVar8) {

        puVar8 = (uint *)puVar8[0xd];

        if (puVar8 == (uint *)0x0) {

          return uVar4;

        }

      }

      if (puVar8 != (uint *)0xfffffffc) {

        uVar4 = *(uint *)(*(int *)(param_1 + 0x620) + 0x610);

        iVar9 = 0;

        if (0 < (int)uVar4) {

          while (((iVar5 = FUN_0046dc50(iVar9), iVar5 == 0 ||

                  (cVar3 = FUN_00460a60(0x1000000d,local_94), cVar3 == '\0')) ||

                 (local_94[0] != param_2))) {

            uVar1 = *(uint *)(*(int *)(param_1 + 0x620) + 0x610);

            iVar9 = iVar9 + 1;

            if ((int)uVar1 <= iVar9) {

              return uVar1;

            }

          }

          piVar6 = (int *)FUN_00463c00(0x10000285);

          if ((piVar6 != (int *)0x0) && (iVar9 = (**(code **)(*piVar6 + 0x94))(7), iVar9 != 0)) {

            uVar1 = puVar8[10];

            uStack_98 = puVar8[7];

            uStack_9c = uVar1;

            FUN_00460760(0x69,(float)(int)uVar1 / (float)(int)uStack_98);

            piVar6 = (int *)FUN_00463c00(0x10000286);

            if ((piVar6 != (int *)0x0) && (iVar9 = (**(code **)(*piVar6 + 0x94))(0xc), iVar9 != 0))

            {

              FUN_0042dc80();

              FUN_0042c9c0(DAT_0083f144,0x10000001);

              FUN_0042e000(DAT_0083f160,uVar1,(int)uVar1 >> 0x1f);

              FUN_0042e000(DAT_0083f16c,uStack_98,(int)uStack_98 >> 0x1f);

              uVar7 = FUN_0042e980(&uStack_9c,0);

              FUN_0046a740(uVar7);

              FUN_004011b0();

              FUN_0042e590();

            }

          }

          piVar6 = (int *)FUN_00463c00(0x10000287);

          if ((piVar6 != (int *)0x0) && (iVar9 = (**(code **)(*piVar6 + 0x94))(7), iVar9 != 0)) {

            uVar1 = puVar8[0xb];

            uStack_98 = puVar8[8];

            uStack_9c = uVar1;

            FUN_00460760(0x69,(float)(int)uVar1 / (float)(int)uStack_98);

            piVar6 = (int *)FUN_00463c00(0x10000288);

            if ((piVar6 != (int *)0x0) && (iVar9 = (**(code **)(*piVar6 + 0x94))(0xc), iVar9 != 0))

            {

              FUN_0042dc80();

              FUN_0042c9c0(DAT_0083f154,0x10000001);

              FUN_0042e000(DAT_0083f160,uVar1,(int)uVar1 >> 0x1f);

              FUN_0042e000(DAT_0083f16c,uStack_98,(int)uStack_98 >> 0x1f);

              uVar7 = FUN_0042e980(&uStack_9c,0);

              FUN_0046a740(uVar7);

              FUN_004011b0();

              FUN_0042e590();

            }

          }

          piVar6 = (int *)FUN_00463c00(0x10000289);

          uVar4 = 0;

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

            iVar9 = (**(code **)(*piVar6 + 0x94))(7);

            uVar4 = 0;

            if (iVar9 != 0) {

              uVar1 = puVar8[0xc];

              uVar2 = puVar8[9];

              uStack_9c = uVar2;

              FUN_00460760(0x69,(float)(int)uVar1 / (float)(int)uVar2);

              piVar6 = (int *)FUN_00463c00(0x1000028a);

              uVar4 = 0;

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

                iVar9 = (**(code **)(*piVar6 + 0x94))(0xc);

                uVar4 = 0;

                if (iVar9 != 0) {

                  FUN_0042dc80();

                  FUN_0042c9c0(DAT_0083f148,0x10000001);

                  FUN_0042e000(DAT_0083f160,uVar1,(int)uVar1 >> 0x1f);

                  FUN_0042e000(DAT_0083f16c,uVar2,(int)uVar2 >> 0x1f);

                  uVar7 = FUN_0042e980(&stack0xffffff5c,0);

                  FUN_0046a740(uVar7);

                  FUN_004011b0();

                  uVar4 = FUN_0042e590();

                }

              }

            }

          }

        }

      }

    }

  }

  return uVar4;

}





// --- FUN_0048f3d0 at 0x0048F3D0 (size: 184) ---


void __fastcall FUN_0048f3d0(int param_1)



{

  int iVar1;

  char cVar2;

  int iVar3;

  int iVar4;

  int local_8;

  int local_4;

  

  iVar1 = DAT_00871e54;

  iVar4 = 0;

  local_4 = 0;

  if (0 < *(int *)(*(int *)(param_1 + 0x620) + 0x610)) {

    do {

      iVar3 = FUN_0046dc50(iVar4);

      if (iVar3 != 0) {

        local_8 = 0;

        cVar2 = FUN_00460a60(0x1000000d,&local_8);

        if (cVar2 != '\0') {

          if (iVar1 == local_8) {

            *(int *)(param_1 + 0x600) = iVar1;

            FUN_0046dc70(iVar3,0);

            return;

          }

          if (local_8 == *(int *)(param_1 + 0x600)) {

            local_4 = iVar3;

          }

        }

      }

      iVar4 = iVar4 + 1;

    } while (iVar4 < *(int *)(*(int *)(param_1 + 0x620) + 0x610));

  }

  FUN_0046dc70(local_4,0);

  FUN_0048e9a0();

  return;

}





// --- FUN_0048f4c0 at 0x0048F4C0 (size: 223) ---


void __thiscall FUN_0048f4c0(int param_1,int param_2)



{

  int iVar1;

  LONG LVar2;

  int local_94;

  undefined1 local_90 [144];

  

  if (*(int *)(param_1 + 0x5fc) != 0) {

    iVar1 = FUN_005ba1c0(param_2);

    if (iVar1 == 0) {

      FUN_0042dc80();

      FUN_00402730(L"That person is not in the fellowship.");

      FUN_0042cbe0(&local_94,1);

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

      if ((LVar2 == 0) && ((undefined4 *)(local_94 + -0x14) != (undefined4 *)0x0)) {

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

      }

    }

    else {

      if (DAT_0083da58 == 0) {

        iVar1 = 0;

      }

      else {

        iVar1 = *(int *)(DAT_0083da58 + 0xf4);

      }

      if (param_2 != iVar1) {

        FUN_006a6ed0(param_2);

        return;

      }

      FUN_0042dc80();

      FUN_0042c9c0(DAT_0083f140,0x10000001);

    }

    FUN_00693500(0x1a,local_90);

    FUN_0042e590();

  }

  return;

}





// --- FUN_0048f720 at 0x0048F720 (size: 751) ---


void __fastcall FUN_0048f720(int param_1)



{

  uint uVar1;

  int iVar2;

  undefined4 uVar3;

  LONG LVar4;

  int *piVar5;

  undefined4 extraout_ECX;

  undefined4 *puVar6;

  int unaff_EBP;

  undefined4 *puVar7;

  undefined4 uVar8;

  int iStack_13c;

  undefined1 auStack_138 [4];

  undefined4 *puStack_134;

  int iStack_130;

  uint uStack_12c;

  

  iVar2 = FUN_00569e30();

  if (*(int *)(iVar2 + 0x10) == 0) {

    if (*(undefined4 **)(param_1 + 0x5fc) != (undefined4 *)0x0) {

      (**(code **)**(undefined4 **)(param_1 + 0x5fc))(1);

    }

    *(undefined4 *)(param_1 + 0x5fc) = 0;

  }

  else {

    if (*(int *)(param_1 + 0x5fc) == 0) {

      iVar2 = FUN_005df0f5(0x44);

      if (iVar2 == 0) {

        uVar3 = 0;

      }

      else {

        uVar3 = FUN_0059b570();

      }

      *(undefined4 *)(param_1 + 0x5fc) = uVar3;

    }

    iVar2 = FUN_00569e30();

    FUN_005ba960(*(undefined4 *)(iVar2 + 0x10));

  }

  if (*(int *)(param_1 + 0x5fc) == 0) {

    FUN_00465f90(3);

    (**(code **)(**(int **)(param_1 + 0x610) + 0x18))(0);

    (**(code **)(**(int **)(param_1 + 0x60c) + 0x18))(1);

    return;

  }

  FUN_00465fb0(3);

  (**(code **)(**(int **)(param_1 + 0x60c) + 0x18))(0);

  (**(code **)(**(int **)(param_1 + 0x610) + 0x18))(1);

  FUN_0042dc80();

  uVar8 = 1;

  uVar3 = FUN_00404a40(0,*(int *)(*(int *)(param_1 + 0x5fc) + 0x18) + 0x14);

  FUN_0042cbe0(uVar3,uVar8);

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

  if ((LVar4 == 0) && ((undefined4 *)(unaff_EBP + -0x14) != (undefined4 *)0x0)) {

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

  }

  uVar3 = FUN_0042e980(&stack0xfffffebc,0);

  FUN_0046a740(uVar3);

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

  if ((LVar4 == 0) && ((undefined4 *)(unaff_EBP + -0x14) != (undefined4 *)0x0)) {

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

  }

  FUN_0046e460();

  FUN_0048ecc0(auStack_138);

LAB_0048f876:

  do {

    do {

      puVar6 = puStack_134;

      if (puVar6 == (undefined4 *)0x0) {

        FUN_0048f3d0();

        FUN_0042e590();

        return;

      }

      iVar2 = FUN_0046f670(0,0);

      if (iVar2 != 0) {

        uVar3 = *puVar6;

        FUN_00460530(0x1000000d,uVar3);

        piVar5 = (int *)FUN_00463c00(0x10000283);

        if ((piVar5 != (int *)0x0) && (iVar2 = (**(code **)(*piVar5 + 0x94))(0xc), iVar2 != 0)) {

          FUN_0042dc80();

          FUN_0042c9c0(DAT_0083f14c,0x10000001);

          puVar7 = (undefined4 *)puVar6[2];

          InterlockedIncrement(puVar7 + 1);

          uVar8 = extraout_ECX;

          FUN_00404a40(0,puVar7 + 5);

          FUN_0042e8e0(DAT_0083f174,uVar8);

          LVar4 = InterlockedDecrement(puVar7 + 1);

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

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

          }

          uVar8 = FUN_0042e980(&iStack_13c,0);

          FUN_0046a740(uVar8);

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

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

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

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

          }

          FUN_0042e590();

        }

        FUN_0048ee00(uVar3);

        FUN_0048f040(uVar3);

      }

      puStack_134 = (undefined4 *)puVar6[0xd];

    } while ((undefined4 *)puVar6[0xd] != (undefined4 *)0x0);

    uVar1 = puVar6[0xe];

    do {

      uVar1 = uVar1 + 1;

      if (uStack_12c <= uVar1) {

        puStack_134 = (undefined4 *)0x0;

        goto LAB_0048f876;

      }

    } while (*(int *)(iStack_130 + uVar1 * 4) == 0);

    puStack_134 = *(undefined4 **)(iStack_130 + uVar1 * 4);

  } while( true );

}





// --- FUN_0048fa10 at 0x0048FA10 (size: 353) ---


void FUN_0048fa10(void)



{

  char cVar1;

  byte bVar2;

  char *pcVar3;

  LONG LVar4;

  undefined4 uVar5;

  uint uVar6;

  undefined4 *puVar7;

  char *local_30;

  int local_2c;

  int iStack_28;

  char local_24 [36];

  

  FUN_00466830(&local_2c);

  FUN_00408fd0(&local_30,0);

  pcVar3 = local_30;

  do {

    cVar1 = *pcVar3;

    pcVar3[(int)(local_24 + -(int)local_30)] = cVar1;

    pcVar3 = pcVar3 + 1;

  } while (cVar1 != '\0');

  pcVar3 = local_30 + -0x14;

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

  if ((LVar4 == 0) && (pcVar3 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar3)(1);

  }

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

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

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

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

  }

  FUN_005be6a0(local_24);

  uVar5 = FUN_00404a40(0,local_24);

  FUN_0046a740(uVar5);

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

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

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

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

  }

  FUN_0055e1d0();

  bVar2 = FUN_005d3f30();

  uVar6 = (uint)bVar2;

  FUN_00466830(&iStack_28);

  FUN_00408fd0(&local_2c,0);

  uVar5 = FUN_0048c3e0(local_2c);

  FUN_006a7700(uVar5,uVar6);

  LVar4 = InterlockedDecrement((LONG *)(local_30 + 4));

  if ((LVar4 == 0) && (local_30 != (char *)0x0)) {

    (*(code *)**(undefined4 **)local_30)(1);

  }

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

  if ((LVar4 == 0) && ((undefined4 *)(local_2c + -0x14) != (undefined4 *)0x0)) {

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

  }

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

  if ((LVar4 == 0) && ((undefined4 *)(iStack_28 + -0x14) != (undefined4 *)0x0)) {

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

  }

  return;

}





// --- FUN_0048fdc0 at 0x0048FDC0 (size: 311) ---


void __thiscall FUN_0048fdc0(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  LONG LVar3;

  undefined4 *puVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  undefined4 uVar7;

  

  iVar1 = param_2;

  if (*(int *)(param_1 + 0x5fc) != 0) {

    if (DAT_0083da58 == 0) {

      iVar2 = 0;

    }

    else {

      iVar2 = *(int *)(DAT_0083da58 + 0xf4);

    }

    if (iVar2 == param_2) {

      *(undefined4 *)(param_1 + 0x600) = 0;

      FUN_00480980(&param_2,0,L"You are no longer a member of the %hs Fellowship.\n",

                   *(int *)(*(int *)(param_1 + 0x5fc) + 0x18) + 0x14);

      uVar7 = 0;

      uVar6 = 1;

      puVar4 = &param_2;

      uVar5 = 0;

      FUN_00564d30(puVar4,0,1,0);

      FUN_005649f0(puVar4,uVar5,uVar6,uVar7);

      if (*(undefined4 **)(param_1 + 0x5fc) != (undefined4 *)0x0) {

        (**(code **)**(undefined4 **)(param_1 + 0x5fc))(1);

      }

      *(undefined4 *)(param_1 + 0x5fc) = 0;

      FUN_0048f720();

    }

    else {

      iVar2 = FUN_005ba1c0(param_2);

      if (iVar2 == 0) {

        return;

      }

      if (*(int *)(param_1 + 0x600) == iVar1) {

        *(undefined4 *)(param_1 + 0x600) = 0;

      }

      iVar2 = FUN_0048eda0(iVar1);

      FUN_00480980(&param_2,0,L"%hs has left your Fellowship.\n",*(int *)(iVar2 + 4) + 0x14);

      uVar7 = 0;

      uVar6 = 1;

      puVar4 = &param_2;

      uVar5 = 0;

      FUN_00564d30(puVar4,0,1,0);

      FUN_005649f0(puVar4,uVar5,uVar6,uVar7);

      iVar2 = FUN_00569e30();

      if (*(int *)(iVar2 + 0x10) != 0) {

        FUN_005ba7c0(iVar1);

      }

      FUN_0048f720();

    }

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

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

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

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

    }

  }

  return;

}





