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

// --- FUN_005c0030 at 0x005C0030 (size: 300) ---


undefined4 __thiscall FUN_005c0030(int *param_1,uint param_2)



{

  uint *puVar1;

  int iVar2;

  uint uVar3;

  uint *puVar4;

  int iVar5;

  undefined4 *puVar6;

  

  uVar3 = param_2;

  if ((uint)param_1[2] <= param_2) {

    if (param_2 <= (param_1[1] & 0x7fffffffU)) {

      return 1;

    }

    if (param_2 == 0) {

      FUN_005bf860();

      return 1;

    }

    puVar4 = (uint *)thunk_FUN_005df0f5(param_2 * 0x34 + 4);

    if (puVar4 != (uint *)0x0) {

      puVar1 = puVar4 + 1;

      *puVar4 = param_2;

      FUN_00401000(puVar1,0x34,param_2,FUN_005bec80);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          iVar5 = param_1[2];

          if (-1 < iVar5 + -1) {

            puVar4 = puVar1 + (iVar5 + -1) * 0xd + 2;

            do {

              iVar2 = *param_1 + (-8 - (int)puVar1);

              puVar4[-1] = *(uint *)((int)puVar4 + iVar2 + 4);

              FUN_005ad300((int)puVar4 + iVar2 + 8);

              puVar4 = puVar4 + -0xd;

              iVar5 = iVar5 + -1;

            } while (iVar5 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar5 = *param_1, iVar5 != 0)) {

            param_2 = *(int *)(iVar5 + -4);

            puVar6 = (undefined4 *)(param_2 * 0x34 + iVar5);

            if (-1 < (int)(param_2 + -1)) {

              do {

                puVar6 = puVar6 + -0xd;

                *puVar6 = &PTR_LAB_007a0ad8;

                FUN_005aca00();

                param_2 = param_2 + -1;

              } while (param_2 != 0);

            }

            operator_delete__((void *)(iVar5 + -4));

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar3 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005c0170 at 0x005C0170 (size: 166) ---


undefined4 __fastcall FUN_005c0170(int *param_1)



{

  uint uVar1;

  uint *puVar2;

  uint *puVar3;

  int iVar4;

  int iVar5;

  

  uVar1 = param_1[2];

  if (uVar1 == (param_1[1] & 0x7fffffffU)) {

    return 0;

  }

  if (uVar1 == 0) {

    puVar3 = (uint *)0x0;

LAB_005c01e6:

    if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

      FUN_0047d710(3);

    }

    *param_1 = (int)puVar3;

    param_1[1] = param_1[2] | 0x80000000;

    return 1;

  }

  puVar2 = (uint *)thunk_FUN_005df0f5(uVar1 * 0x10 + 4);

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

    puVar3 = puVar2 + 1;

    *puVar2 = uVar1;

    FUN_00401000(puVar3,0x10,uVar1,FUN_005bf9e0);

    if (puVar3 != (uint *)0x0) {

      iVar4 = param_1[2];

      if (-1 < iVar4 + -1) {

        iVar5 = (iVar4 + -1) * 0x10;

        do {

          FUN_005bed30(*param_1 + iVar5);

          iVar5 = iVar5 + -0x10;

          iVar4 = iVar4 + -1;

        } while (iVar4 != 0);

      }

      goto LAB_005c01e6;

    }

  }

  return 0;

}





// --- FUN_005c0220 at 0x005C0220 (size: 126) ---


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



{

  undefined4 *puVar1;

  char cVar2;

  undefined4 *puVar3;

  uint uVar4;

  undefined4 *puVar5;

  

  if ((param_1[1] & 0x7fffffffU) < (param_2[1] & 0x7fffffffU)) {

    param_1[2] = 0;

    cVar2 = FUN_004180a0(param_2[1] & 0x7fffffff);

    if (cVar2 == '\0') {

      return param_1;

    }

  }

  puVar3 = (undefined4 *)*param_2;

  puVar1 = puVar3 + param_2[2];

  puVar5 = (undefined4 *)*param_1;

  for (; puVar3 < puVar1; puVar3 = puVar3 + 1) {

    *puVar5 = *puVar3;

    puVar5 = puVar5 + 1;

  }

  uVar4 = param_2[2];

  if (uVar4 < (uint)param_1[2]) {

    do {

      *(undefined4 *)(*param_1 + uVar4 * 4) = 0;

      uVar4 = uVar4 + 1;

    } while (uVar4 < (uint)param_1[2]);

  }

  param_1[2] = param_2[2];

  return param_1;

}





// --- FUN_005c02a0 at 0x005C02A0 (size: 208) ---


void __fastcall FUN_005c02a0(int *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  uint local_14;

  undefined **local_10;

  undefined *local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if ((*param_1 != 0) && (local_14 = param_1[1] & 0x7fffffff, -1 < (int)(local_14 - 1))) {

      local_10 = &PTR_FUN_007a0ec0;

      do {

        local_c = PTR_DAT_00818344;

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

        local_8 = DAT_008f0874;

        local_4 = DAT_008f0874;

        FUN_005bed30(&local_10);

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

        local_10 = &PTR_FUN_007a0ec0;

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

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

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

        }

        local_14 = local_14 - 1;

      } while (local_14 != 0);

    }

    return;

  }

  if (*param_1 != 0) {

    FUN_0047d710(3);

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_005c0380 at 0x005C0380 (size: 1190) ---


void __thiscall FUN_005c0380(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 uVar2;

  uint uVar3;

  undefined4 uVar4;

  undefined4 local_24;

  undefined4 local_20;

  

  uVar4 = 8;

  uVar2 = FUN_004220b0(*(undefined4 *)(param_1 + 0xc),0);

  FUN_0041a4e0(uVar2,uVar4);

  uVar4 = 8;

  uVar2 = FUN_004220b0(*(undefined4 *)(param_1 + 0x10),0);

  FUN_0041a4e0(uVar2,uVar4);

  uVar4 = 8;

  uVar2 = FUN_004220b0(*(undefined4 *)(param_1 + 0x14),0);

  FUN_0041a4e0(uVar2,uVar4);

  uVar4 = 8;

  uVar2 = FUN_004220b0(*(undefined4 *)(param_1 + 0x50),0);

  FUN_0041a4e0(uVar2,uVar4);

  uVar4 = 8;

  uVar2 = FUN_004220b0(*(undefined4 *)(param_1 + 0x54),0);

  FUN_0041a4e0(uVar2,uVar4);

  uVar4 = 8;

  uVar2 = FUN_004220b0(*(undefined4 *)(param_1 + 0x44),0);

  FUN_0041a4e0(uVar2,uVar4);

  uVar4 = 8;

  uVar2 = FUN_004220b0(*(undefined4 *)(param_1 + 0x48),0);

  FUN_0041a4e0(uVar2,uVar4);

  uVar4 = 8;

  uVar2 = FUN_004220b0(*(undefined4 *)(param_1 + 0x4c),0);

  FUN_0041a4e0(uVar2,uVar4);

  FUN_005ad4c0(param_2);

  uVar3 = 0;

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

    do {

      uVar4 = 0;

      uVar2 = FUN_004220b0(*(undefined4 *)(*(int *)(param_1 + 0x58) + uVar3 * 4),0);

      FUN_0041a4e0(uVar2,uVar4);

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0x60));

  }

  uVar3 = 0;

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

    do {

      uVar4 = 0;

      uVar2 = FUN_004220b0(*(undefined4 *)(*(int *)(param_1 + 0x70) + uVar3 * 4),0);

      FUN_0041a4e0(uVar2,uVar4);

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0x78));

  }

  local_20 = 0;

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

    local_24 = 0;

    do {

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(*(int *)(param_1 + 100) + local_24 + 4),0);

      FUN_0041a4e0(uVar2,uVar4);

      FUN_005ad4c0(param_2);

      local_20 = local_20 + 1;

      local_24 = local_24 + 0x3c;

    } while (local_20 < *(uint *)(param_1 + 0x6c));

  }

  local_20 = 0;

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

    local_24 = 0;

    do {

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

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + 4 + local_24),0);

      FUN_0041a4e0(uVar2,uVar4);

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + local_24 + 8),0);

      FUN_0041a4e0(uVar2,uVar4);

      FUN_005ad4c0(param_2);

      FUN_005ad4c0(param_2);

      local_20 = local_20 + 1;

      local_24 = local_24 + 100;

    } while (local_20 < *(uint *)(param_1 + 0x84));

  }

  local_20 = 0;

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

    local_24 = 0;

    do {

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(*(int *)(param_1 + 0x88) + local_24 + 4),0);

      FUN_0041a4e0(uVar2,uVar4);

      FUN_005ad4c0(param_2);

      local_20 = local_20 + 1;

      local_24 = local_24 + 0x34;

    } while (local_20 < *(uint *)(param_1 + 0x90));

  }

  local_20 = 0;

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

    local_24 = 0;

    do {

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(*(int *)(param_1 + 0x94) + local_24 + 4),0);

      FUN_0041a4e0(uVar2,uVar4);

      FUN_005ad4c0(param_2);

      local_20 = local_20 + 1;

      local_24 = local_24 + 0x34;

    } while (local_20 < *(uint *)(param_1 + 0x9c));

  }

  local_20 = 0;

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

    local_24 = 0;

    do {

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

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + 8 + local_24),0);

      FUN_0041a4e0(uVar2,uVar4);

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + local_24 + 0xc),0);

      FUN_0041a4e0(uVar2,uVar4);

      local_20 = local_20 + 1;

      local_24 = local_24 + 0x10;

    } while (local_20 < *(uint *)(param_1 + 0xa8));

  }

  local_20 = 0;

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

    local_24 = 0;

    do {

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

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + 8 + local_24),0);

      FUN_0041a4e0(uVar2,uVar4);

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + local_24 + 0xc),0);

      FUN_0041a4e0(uVar2,uVar4);

      local_20 = local_20 + 1;

      local_24 = local_24 + 0x10;

    } while (local_20 < *(uint *)(param_1 + 0xb4));

  }

  local_20 = 0;

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

    local_24 = 0;

    do {

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

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + 8 + local_24),0);

      FUN_0041a4e0(uVar2,uVar4);

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + local_24 + 0xc),0);

      FUN_0041a4e0(uVar2,uVar4);

      local_20 = local_20 + 1;

      local_24 = local_24 + 0x10;

    } while (local_20 < *(uint *)(param_1 + 0xc0));

  }

  local_20 = 0;

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

    local_24 = 0;

    do {

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

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + 8 + local_24),0);

      FUN_0041a4e0(uVar2,uVar4);

      uVar4 = 8;

      uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + local_24 + 0xc),0);

      FUN_0041a4e0(uVar2,uVar4);

      local_20 = local_20 + 1;

      local_24 = local_24 + 0x10;

    } while (local_20 < *(uint *)(param_1 + 0xcc));

  }

  return;

}





// --- FUN_005c0830 at 0x005C0830 (size: 261) ---


int * __thiscall FUN_005c0830(int *param_1,uint *param_2)



{

  undefined4 uVar1;

  char cVar2;

  int iVar3;

  undefined1 *puVar4;

  uint uVar5;

  int iVar6;

  uint uVar7;

  undefined1 local_2c [44];

  

  if ((param_1[1] & 0x7fffffffU) < (param_2[1] & 0x7fffffff)) {

    param_1[2] = 0;

    cVar2 = FUN_005bfe20(param_2[1] & 0x7fffffff);

    if (cVar2 == '\0') {

      return param_1;

    }

  }

  uVar7 = *param_2;

  uVar5 = param_2[2] * 0x3c + uVar7;

  if (uVar7 < uVar5) {

    puVar4 = (undefined1 *)(*param_1 + 8);

    do {

      *(undefined4 *)(puVar4 + -4) = *(undefined4 *)(uVar7 + 4);

      *puVar4 = *(undefined1 *)(uVar7 + 8);

      *(undefined4 *)(puVar4 + 4) = *(undefined4 *)(uVar7 + 0xc);

      FUN_005ad300(uVar7 + 0x10);

      uVar7 = uVar7 + 0x3c;

      puVar4 = puVar4 + 0x3c;

    } while (uVar7 < uVar5);

  }

  uVar7 = param_2[2];

  if (uVar7 < (uint)param_1[2]) {

    iVar6 = uVar7 * 0x3c;

    do {

      uVar1 = DAT_008f0874;

      FUN_005ac9c0();

      iVar3 = *param_1 + iVar6;

      *(undefined4 *)(iVar3 + 4) = uVar1;

      *(undefined1 *)(iVar3 + 8) = 0;

      *(undefined4 *)(iVar3 + 0xc) = uVar1;

      FUN_005ad300(local_2c);

      FUN_005aca00();

      uVar7 = uVar7 + 1;

      iVar6 = iVar6 + 0x3c;

    } while (uVar7 < (uint)param_1[2]);

  }

  param_1[2] = param_2[2];

  return param_1;

}





// --- FUN_005c0940 at 0x005C0940 (size: 302) ---


int * __thiscall FUN_005c0940(int *param_1,uint *param_2)



{

  int iVar1;

  undefined4 uVar2;

  char cVar3;

  uint uVar4;

  undefined4 *puVar5;

  int iVar6;

  uint uVar7;

  undefined1 local_58 [44];

  undefined1 local_2c [44];

  

  if ((param_1[1] & 0x7fffffffU) < (param_2[1] & 0x7fffffff)) {

    param_1[2] = 0;

    cVar3 = FUN_005bff60(param_2[1] & 0x7fffffff);

    if (cVar3 == '\0') {

      return param_1;

    }

  }

  uVar7 = *param_2;

  uVar4 = param_2[2] * 100 + uVar7;

  if (uVar7 < uVar4) {

    puVar5 = (undefined4 *)(*param_1 + 8);

    do {

      puVar5[-1] = *(undefined4 *)(uVar7 + 4);

      *puVar5 = *(undefined4 *)(uVar7 + 8);

      FUN_005ad300(uVar7 + 0xc);

      FUN_005ad300(uVar7 + 0x38);

      uVar7 = uVar7 + 100;

      puVar5 = puVar5 + 0x19;

    } while (uVar7 < uVar4);

  }

  uVar7 = param_2[2];

  if (uVar7 < (uint)param_1[2]) {

    iVar6 = uVar7 * 100;

    do {

      uVar2 = DAT_008f0874;

      FUN_005ac9c0();

      FUN_005ac9c0();

      iVar1 = *param_1;

      *(undefined4 *)(iVar1 + iVar6 + 4) = uVar2;

      *(undefined4 *)(iVar1 + iVar6 + 8) = uVar2;

      FUN_005ad300(local_58);

      FUN_005ad300(local_2c);

      FUN_005aca00();

      FUN_005aca00();

      uVar7 = uVar7 + 1;

      iVar6 = iVar6 + 100;

    } while (uVar7 < (uint)param_1[2]);

  }

  param_1[2] = param_2[2];

  return param_1;

}





// --- FUN_005c0a70 at 0x005C0A70 (size: 227) ---


int * __thiscall FUN_005c0a70(int *param_1,uint *param_2)



{

  undefined4 uVar1;

  char cVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined1 local_2c [44];

  

  if ((param_1[1] & 0x7fffffffU) < (param_2[1] & 0x7fffffff)) {

    param_1[2] = 0;

    cVar2 = FUN_005c0030(param_2[1] & 0x7fffffff);

    if (cVar2 == '\0') {

      return param_1;

    }

  }

  uVar5 = *param_2;

  uVar3 = param_2[2] * 0x34 + uVar5;

  if (uVar5 < uVar3) {

    iVar4 = *param_1 + 8;

    do {

      *(undefined4 *)(iVar4 + -4) = *(undefined4 *)(uVar5 + 4);

      FUN_005ad300(uVar5 + 8);

      uVar5 = uVar5 + 0x34;

      iVar4 = iVar4 + 0x34;

    } while (uVar5 < uVar3);

  }

  uVar5 = param_2[2];

  if (uVar5 < (uint)param_1[2]) {

    iVar4 = uVar5 * 0x34;

    do {

      uVar1 = DAT_008f0874;

      FUN_005ac9c0();

      *(undefined4 *)(*param_1 + iVar4 + 4) = uVar1;

      FUN_005ad300(local_2c);

      FUN_005aca00();

      uVar5 = uVar5 + 1;

      iVar4 = iVar4 + 0x34;

    } while (uVar5 < (uint)param_1[2]);

  }

  param_1[2] = param_2[2];

  return param_1;

}





// --- FUN_005c0b60 at 0x005C0B60 (size: 193) ---


void FUN_005c0b60(undefined4 param_1,int *param_2,int param_3)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined4 *puVar6;

  

  iVar4 = param_3;

  piVar2 = param_2;

  param_2 = (int *)param_2[2];

  FUN_00401a80(param_1,&param_2,param_3);

  bVar1 = false;

  if ((~*(byte *)(iVar4 + 4) & 1) != 0) {

    uVar5 = FUN_0040a8f0();

    uVar3 = (uint)param_2;

    if (uVar5 < param_2) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar2[2] < param_2) {

      FUN_005bee80(param_2);

      piVar2[2] = uVar3;

    }

    else if (param_2 < (uint)piVar2[2]) {

      piVar2[2] = (int)param_2;

      FUN_005bef90();

    }

    bVar1 = true;

  }

  puVar6 = (undefined4 *)*piVar2;

  if (puVar6 != puVar6 + piVar2[2] * 4) {

    do {

      (**(code **)*puVar6)(iVar4);

      if ((*(uint *)(iVar4 + 4) >> 2 & 1) != 0) {

        if (!bVar1) {

          return;

        }

        if (piVar2[2] == 0) {

          return;

        }

        piVar2[2] = 0;

        FUN_005bef90();

        return;

      }

      puVar6 = puVar6 + 4;

    } while (puVar6 != (undefined4 *)(piVar2[2] * 0x10 + *piVar2));

  }

  return;

}





// --- FUN_005c0c30 at 0x005C0C30 (size: 227) ---


void FUN_005c0c30(undefined4 param_1,int *param_2,int param_3)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined4 *puVar6;

  undefined4 *puVar7;

  

  iVar4 = param_3;

  piVar2 = param_2;

  param_2 = (int *)param_2[2];

  FUN_00401a80(param_1,&param_2,param_3);

  bVar1 = false;

  if ((~*(byte *)(iVar4 + 4) & 1) != 0) {

    uVar5 = FUN_0040a8f0();

    uVar3 = (uint)param_2;

    if (uVar5 < param_2) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar2[2] < param_2) {

      FUN_00415910(param_2);

      piVar2[2] = uVar3;

    }

    else if (param_2 < (uint)piVar2[2]) {

      piVar2[2] = (int)param_2;

      FUN_005bf070();

    }

    bVar1 = true;

  }

  puVar7 = (undefined4 *)*piVar2;

  if (puVar7 != puVar7 + piVar2[2]) {

    do {

      FUN_0040ad10(4);

      puVar6 = (undefined4 *)FUN_0040acf0(4);

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

        if ((*(byte *)(iVar4 + 4) & 1) == 0) {

          *puVar7 = *puVar6;

        }

        else {

          *puVar6 = *puVar7;

        }

      }

      if ((*(uint *)(iVar4 + 4) >> 2 & 1) != 0) {

        if (!bVar1) {

          return;

        }

        if (piVar2[2] == 0) {

          return;

        }

        piVar2[2] = 0;

        FUN_005bf070();

        return;

      }

      puVar7 = puVar7 + 1;

    } while (puVar7 != (undefined4 *)(*piVar2 + piVar2[2] * 4));

  }

  return;

}





// --- FUN_005c0d20 at 0x005C0D20 (size: 227) ---


void FUN_005c0d20(undefined4 param_1,int *param_2,int param_3)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined4 *puVar6;

  undefined4 *puVar7;

  

  iVar4 = param_3;

  piVar2 = param_2;

  param_2 = (int *)param_2[2];

  FUN_00401a80(param_1,&param_2,param_3);

  bVar1 = false;

  if ((~*(byte *)(iVar4 + 4) & 1) != 0) {

    uVar5 = FUN_0040a8f0();

    uVar3 = (uint)param_2;

    if (uVar5 < param_2) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar2[2] < param_2) {

      FUN_004180a0(param_2);

      piVar2[2] = uVar3;

    }

    else if (param_2 < (uint)piVar2[2]) {

      piVar2[2] = (int)param_2;

      FUN_005bf480();

    }

    bVar1 = true;

  }

  puVar7 = (undefined4 *)*piVar2;

  if (puVar7 != puVar7 + piVar2[2]) {

    do {

      FUN_0040ad10(4);

      puVar6 = (undefined4 *)FUN_0040acf0(4);

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

        if ((*(byte *)(iVar4 + 4) & 1) == 0) {

          *puVar7 = *puVar6;

        }

        else {

          *puVar6 = *puVar7;

        }

      }

      if ((*(uint *)(iVar4 + 4) >> 2 & 1) != 0) {

        if (!bVar1) {

          return;

        }

        if (piVar2[2] == 0) {

          return;

        }

        piVar2[2] = 0;

        FUN_005bf480();

        return;

      }

      puVar7 = puVar7 + 1;

    } while (puVar7 != (undefined4 *)(*piVar2 + piVar2[2] * 4));

  }

  return;

}





// --- FUN_005c0e10 at 0x005C0E10 (size: 142) ---


int __thiscall FUN_005c0e10(int param_1,int param_2)



{

  int iVar1;

  LONG LVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  if (iVar1 != *(int *)(param_2 + 4)) {

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

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

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

    }

    iVar1 = *(int *)(param_2 + 4);

    *(int *)(param_1 + 4) = iVar1;

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

  }

  *(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);

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

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

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

  FUN_005c0220(param_2 + 0x28);

  FUN_005c0220(param_2 + 0x34);

  return param_1;

}





// --- FUN_005c0ea0 at 0x005C0EA0 (size: 497) ---


int * __thiscall FUN_005c0ea0(int *param_1,uint *param_2)



{

  uint uVar1;

  char cVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  undefined4 *puVar6;

  uint uVar7;

  undefined4 local_30;

  undefined4 local_2c;

  undefined4 local_28;

  undefined4 local_24;

  undefined4 local_20;

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  

  if ((param_1[1] & 0x7fffffffU) < (param_2[1] & 0x7fffffff)) {

    param_1[2] = 0;

    cVar2 = FUN_005bfcf0(param_2[1] & 0x7fffffff);

    if (cVar2 == '\0') {

      return param_1;

    }

  }

  uVar1 = *param_2;

  uVar7 = uVar1 + param_2[2] * 0x48;

  if (uVar1 < uVar7) {

    puVar6 = (undefined4 *)(*param_1 + 0xc);

    puVar4 = (undefined4 *)(uVar1 + 0xc);

    iVar5 = ((uVar7 - uVar1) - 1) / 0x48 + 1;

    do {

      puVar6[-2] = puVar4[-2];

      puVar6[0xc] = puVar4[0xc];

      puVar6[0xd] = puVar4[0xd];

      puVar6[0xe] = puVar4[0xe];

      puVar6[-1] = puVar4[-1];

      *puVar6 = *puVar4;

      puVar6[1] = puVar4[1];

      puVar6[2] = puVar4[2];

      puVar6[3] = puVar4[3];

      puVar6[4] = puVar4[4];

      puVar6[5] = puVar4[5];

      puVar6[6] = puVar4[6];

      puVar6[7] = puVar4[7];

      puVar6[8] = puVar4[8];

      puVar6[9] = puVar4[9];

      puVar6[10] = puVar4[10];

      puVar6[0xb] = puVar4[0xb];

      puVar4 = puVar4 + 0x12;

      puVar6 = puVar6 + 0x12;

      iVar5 = iVar5 + -1;

    } while (iVar5 != 0);

  }

  uVar7 = param_2[2];

  if (uVar7 < (uint)param_1[2]) {

    iVar5 = uVar7 * 0x48;

    do {

      FUN_00535b30();

      iVar3 = *param_1;

      *(undefined4 *)(iVar3 + 4 + iVar5) = 0;

      iVar3 = iVar3 + iVar5;

      *(undefined4 *)(iVar3 + 0x3c) = 0;

      *(undefined4 *)(iVar3 + 0x40) = 0;

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

      *(undefined4 *)(iVar3 + 8) = 0x3f800000;

      *(undefined4 *)(iVar3 + 0xc) = 0;

      *(undefined4 *)(iVar3 + 0x10) = 0;

      *(undefined4 *)(iVar3 + 0x14) = 0;

      *(undefined4 *)(iVar3 + 0x18) = local_30;

      *(undefined4 *)(iVar3 + 0x1c) = local_2c;

      *(undefined4 *)(iVar3 + 0x20) = local_28;

      *(undefined4 *)(iVar3 + 0x24) = local_24;

      *(undefined4 *)(iVar3 + 0x28) = local_20;

      *(undefined4 *)(iVar3 + 0x2c) = local_1c;

      *(undefined4 *)(iVar3 + 0x30) = local_18;

      *(undefined4 *)(iVar3 + 0x34) = local_14;

      *(undefined4 *)(iVar3 + 0x38) = local_10;

      uVar7 = uVar7 + 1;

      iVar5 = iVar5 + 0x48;

    } while (uVar7 < (uint)param_1[2]);

  }

  param_1[2] = param_2[2];

  return param_1;

}





// --- FUN_005c10a0 at 0x005C10A0 (size: 166) ---


undefined4 __fastcall FUN_005c10a0(int *param_1)



{

  uint uVar1;

  uint *puVar2;

  uint *puVar3;

  int iVar4;

  int iVar5;

  

  uVar1 = param_1[2];

  if (uVar1 == (param_1[1] & 0x7fffffffU)) {

    return 0;

  }

  if (uVar1 == 0) {

    puVar3 = (uint *)0x0;

LAB_005c1116:

    if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

      FUN_0047d9b0(3);

    }

    *param_1 = (int)puVar3;

    param_1[1] = param_1[2] | 0x80000000;

    return 1;

  }

  puVar2 = (uint *)thunk_FUN_005df0f5(uVar1 * 0x40 + 4);

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

    puVar3 = puVar2 + 1;

    *puVar2 = uVar1;

    FUN_00401000(puVar3,0x40,uVar1,FUN_005bfa90);

    if (puVar3 != (uint *)0x0) {

      iVar4 = param_1[2];

      if (-1 < iVar4 + -1) {

        iVar5 = (iVar4 + -1) * 0x40;

        do {

          FUN_005c0e10(*param_1 + iVar5);

          iVar5 = iVar5 + -0x40;

          iVar4 = iVar4 + -1;

        } while (iVar4 != 0);

      }

      goto LAB_005c1116;

    }

  }

  return 0;

}





// --- FUN_005c1150 at 0x005C1150 (size: 200) ---


undefined4 __thiscall FUN_005c1150(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_005c02a0();

      return 1;

    }

    puVar3 = (uint *)thunk_FUN_005df0f5(param_2 * 0x10 + 4);

    if (puVar3 != (uint *)0x0) {

      puVar1 = puVar3 + 1;

      *puVar3 = param_2;

      FUN_00401000(puVar1,0x10,param_2,FUN_005bf9e0);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          param_2 = param_1[2];

          if (-1 < (int)(param_2 + -1)) {

            iVar4 = (param_2 + -1) * 0x10;

            do {

              FUN_005bed30(*param_1 + iVar4);

              iVar4 = iVar4 + -0x10;

              param_2 = param_2 + -1;

            } while (param_2 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

            FUN_0047d710(3);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005c1220 at 0x005C1220 (size: 121) ---


void __fastcall FUN_005c1220(int *param_1)



{

  uint uVar1;

  undefined4 uVar2;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if ((*param_1 != 0) && (uVar1 = param_1[1] & 0x7fffffff, -1 < (int)(uVar1 - 1))) {

      do {

        uVar2 = FUN_005bfa90();

        FUN_005c0e10(uVar2);

        FUN_0047d7d0();

        uVar1 = uVar1 - 1;

      } while (uVar1 != 0);

    }

    return;

  }

  if (*param_1 != 0) {

    FUN_0047d9b0(3);

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_005c12a0 at 0x005C12A0 (size: 285) ---


undefined4 * __fastcall FUN_005c12a0(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_LAB_007a0ecc;

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

  param_1[1] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  param_1[2] = 0;

  param_1[3] = DAT_008f0874;

  param_1[4] = DAT_008f0874;

  param_1[5] = DAT_008f0874;

  FUN_005ac9c0();

  param_1[0x11] = DAT_008f0874;

  param_1[0x12] = DAT_008f0874;

  param_1[0x13] = DAT_008f0874;

  param_1[0x14] = DAT_008f0874;

  param_1[0x15] = DAT_008f0874;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  param_1[0x22] = 0;

  param_1[0x23] = 0;

  param_1[0x24] = 0;

  param_1[0x25] = 0;

  param_1[0x26] = 0;

  param_1[0x27] = 0;

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  param_1[0x2b] = 0;

  param_1[0x2c] = 0;

  param_1[0x2d] = 0;

  param_1[0x2e] = 0;

  param_1[0x2f] = 0;

  param_1[0x30] = 0;

  param_1[0x31] = 0;

  param_1[0x32] = 0;

  param_1[0x33] = 0;

  param_1[0x34] = 0;

  param_1[0x35] = 0;

  param_1[0x36] = 0;

  return param_1;

}





// --- FUN_005c13c0 at 0x005C13C0 (size: 105) ---


void __thiscall FUN_005c13c0(int param_1,int param_2)



{

  undefined4 *puVar1;

  

  FUN_00402400(param_2);

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

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

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 8) = *puVar1;

    }

    else {

      *puVar1 = *(undefined4 *)(param_1 + 8);

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

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

    if ((*(byte *)(param_2 + 4) & 1) != 0) {

      *puVar1 = *(undefined4 *)(param_1 + 0xc);

      return;

    }

    *(undefined4 *)(param_1 + 0xc) = *puVar1;

  }

  return;

}





// --- FUN_005c15b0 at 0x005C15B0 (size: 269) ---


void __thiscall FUN_005c15b0(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  int *piVar2;

  int iVar3;

  uint uVar4;

  undefined4 uVar5;

  

  uVar5 = 8;

  uVar1 = FUN_004220b0(*(undefined4 *)(param_1 + 8),0);

  FUN_0041a4e0(uVar1,uVar5);

  uVar5 = 8;

  uVar1 = FUN_004220b0(*(undefined4 *)(param_1 + 0xc),0);

  FUN_0041a4e0(uVar1,uVar5);

  uVar5 = 8;

  uVar1 = FUN_004220b0(*(undefined4 *)(param_1 + 0x10),0);

  FUN_0041a4e0(uVar1,uVar5);

  uVar4 = 0;

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

    iVar3 = 0;

    do {

      uVar5 = 8;

      uVar1 = FUN_004220b0(*(undefined4 *)(*(int *)(param_1 + 0x40) + 8 + iVar3),0);

      FUN_0041a4e0(uVar1,uVar5);

      uVar4 = uVar4 + 1;

      iVar3 = iVar3 + 0x40;

    } while (uVar4 < *(uint *)(param_1 + 0x48));

  }

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

  do {

    if (piVar2 == (int *)(*(int *)(param_1 + 0xb0) + *(int *)(param_1 + 0xb8) * 4)) {

      piVar2 = (int *)0x0;

      iVar3 = 0;

joined_r0x005c167e:

      do {

        if (iVar3 == 0) {

          return;

        }

        do {

          FUN_005c0380(param_2);

          iVar3 = *(int *)(iVar3 + 4);

        } while (iVar3 != 0);

        do {

          piVar2 = piVar2 + 1;

          if (piVar2 == (int *)(*(int *)(param_1 + 0xb0) + *(int *)(param_1 + 0xb8) * 4)) {

            return;

          }

          iVar3 = *piVar2;

        } while (iVar3 == 0);

      } while( true );

    }

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

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

      iVar3 = *piVar2;

      goto joined_r0x005c167e;

    }

    piVar2 = *(int **)(param_1 + 0xb4) + 1;

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

  } while( true );

}





// --- FUN_005c16c0 at 0x005C16C0 (size: 391) ---


int * __thiscall FUN_005c16c0(int *param_1,uint *param_2)



{

  LONG *lpAddend;

  undefined *puVar1;

  undefined *puVar2;

  undefined4 uVar3;

  char cVar4;

  LONG LVar5;

  int *piVar6;

  uint uVar7;

  int iVar8;

  uint uVar9;

  int local_1c;

  uint local_18;

  

  if ((param_1[1] & 0x7fffffffU) < (param_2[1] & 0x7fffffff)) {

    param_1[2] = 0;

    cVar4 = FUN_005c1150(param_2[1] & 0x7fffffff);

    if (cVar4 == '\0') {

      return param_1;

    }

  }

  uVar7 = *param_2;

  uVar9 = param_2[2] * 0x10 + uVar7;

  if (uVar7 < uVar9) {

    piVar6 = (int *)(*param_1 + 4);

    do {

      iVar8 = *piVar6;

      if (iVar8 != *(int *)(uVar7 + 4)) {

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

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

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

        }

        iVar8 = *(int *)(uVar7 + 4);

        *piVar6 = iVar8;

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

      }

      piVar6[1] = *(int *)(uVar7 + 8);

      piVar6[2] = *(int *)(uVar7 + 0xc);

      uVar7 = uVar7 + 0x10;

      piVar6 = piVar6 + 4;

    } while (uVar7 < uVar9);

  }

  local_18 = param_2[2];

  if (local_18 < (uint)param_1[2]) {

    local_1c = local_18 << 4;

    do {

      puVar2 = PTR_DAT_00818344;

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

      InterlockedIncrement(lpAddend);

      uVar3 = DAT_008f0874;

      iVar8 = *param_1 + local_1c;

      puVar1 = *(undefined **)(iVar8 + 4);

      if (puVar1 != puVar2) {

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

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

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

        }

        *(undefined **)(iVar8 + 4) = puVar2;

        InterlockedIncrement(lpAddend);

      }

      *(undefined4 *)(iVar8 + 8) = uVar3;

      *(undefined4 *)(iVar8 + 0xc) = uVar3;

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

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

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

      }

      local_18 = local_18 + 1;

      local_1c = local_1c + 0x10;

    } while (local_18 < (uint)param_1[2]);

  }

  param_1[2] = param_2[2];

  return param_1;

}





// --- FUN_005c1850 at 0x005C1850 (size: 198) ---


void FUN_005c1850(undefined4 param_1,int *param_2,int param_3)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  

  iVar4 = param_3;

  piVar2 = param_2;

  param_2 = (int *)param_2[2];

  FUN_00401a80(param_1,&param_2,param_3);

  bVar1 = false;

  if ((~*(byte *)(iVar4 + 4) & 1) != 0) {

    uVar5 = FUN_0040a8f0();

    uVar3 = (uint)param_2;

    if (uVar5 < param_2) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar2[2] < param_2) {

      FUN_005bfcf0(param_2);

      piVar2[2] = uVar3;

    }

    else if (param_2 < (uint)piVar2[2]) {

      piVar2[2] = (int)param_2;

      FUN_005bed90();

    }

    bVar1 = true;

  }

  iVar6 = *piVar2;

  if (iVar6 != iVar6 + piVar2[2] * 0x48) {

    do {

      FUN_005aa7a0(iVar4);

      if ((*(uint *)(iVar4 + 4) >> 2 & 1) != 0) {

        if (!bVar1) {

          return;

        }

        if (piVar2[2] == 0) {

          return;

        }

        piVar2[2] = 0;

        FUN_005bed90();

        return;

      }

      iVar6 = iVar6 + 0x48;

    } while (iVar6 != *piVar2 + piVar2[2] * 0x48);

  }

  return;

}





// --- FUN_005c1920 at 0x005C1920 (size: 193) ---


void FUN_005c1920(undefined4 param_1,int *param_2,int param_3)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined4 *puVar6;

  

  iVar4 = param_3;

  piVar2 = param_2;

  param_2 = (int *)param_2[2];

  FUN_00401a80(param_1,&param_2,param_3);

  bVar1 = false;

  if ((~*(byte *)(iVar4 + 4) & 1) != 0) {

    uVar5 = FUN_0040a8f0();

    uVar3 = (uint)param_2;

    if (uVar5 < param_2) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar2[2] < param_2) {

      FUN_005bfe20(param_2);

      piVar2[2] = uVar3;

    }

    else if (param_2 < (uint)piVar2[2]) {

      piVar2[2] = (int)param_2;

      FUN_005bf110();

    }

    bVar1 = true;

  }

  puVar6 = (undefined4 *)*piVar2;

  if (puVar6 != puVar6 + piVar2[2] * 0xf) {

    do {

      (**(code **)*puVar6)(iVar4);

      if ((*(uint *)(iVar4 + 4) >> 2 & 1) != 0) {

        if (!bVar1) {

          return;

        }

        if (piVar2[2] == 0) {

          return;

        }

        piVar2[2] = 0;

        FUN_005bf110();

        return;

      }

      puVar6 = puVar6 + 0xf;

    } while (puVar6 != (undefined4 *)(piVar2[2] * 0x3c + *piVar2));

  }

  return;

}





// --- FUN_005c19f0 at 0x005C19F0 (size: 193) ---


void FUN_005c19f0(undefined4 param_1,int *param_2,int param_3)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined4 *puVar6;

  

  iVar4 = param_3;

  piVar2 = param_2;

  param_2 = (int *)param_2[2];

  FUN_00401a80(param_1,&param_2,param_3);

  bVar1 = false;

  if ((~*(byte *)(iVar4 + 4) & 1) != 0) {

    uVar5 = FUN_0040a8f0();

    uVar3 = (uint)param_2;

    if (uVar5 < param_2) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar2[2] < param_2) {

      FUN_005bff60(param_2);

      piVar2[2] = uVar3;

    }

    else if (param_2 < (uint)piVar2[2]) {

      piVar2[2] = (int)param_2;

      FUN_005bf230();

    }

    bVar1 = true;

  }

  puVar6 = (undefined4 *)*piVar2;

  if (puVar6 != puVar6 + piVar2[2] * 0x19) {

    do {

      (**(code **)*puVar6)(iVar4);

      if ((*(uint *)(iVar4 + 4) >> 2 & 1) != 0) {

        if (!bVar1) {

          return;

        }

        if (piVar2[2] == 0) {

          return;

        }

        piVar2[2] = 0;

        FUN_005bf230();

        return;

      }

      puVar6 = puVar6 + 0x19;

    } while (puVar6 != (undefined4 *)(piVar2[2] * 100 + *piVar2));

  }

  return;

}





// --- FUN_005c1ac0 at 0x005C1AC0 (size: 193) ---


void FUN_005c1ac0(undefined4 param_1,int *param_2,int param_3)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined4 *puVar6;

  

  iVar4 = param_3;

  piVar2 = param_2;

  param_2 = (int *)param_2[2];

  FUN_00401a80(param_1,&param_2,param_3);

  bVar1 = false;

  if ((~*(byte *)(iVar4 + 4) & 1) != 0) {

    uVar5 = FUN_0040a8f0();

    uVar3 = (uint)param_2;

    if (uVar5 < param_2) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar2[2] < param_2) {

      FUN_005c0030(param_2);

      piVar2[2] = uVar3;

    }

    else if (param_2 < (uint)piVar2[2]) {

      piVar2[2] = (int)param_2;

      FUN_005bf370();

    }

    bVar1 = true;

  }

  puVar6 = (undefined4 *)*piVar2;

  if (puVar6 != puVar6 + piVar2[2] * 0xd) {

    do {

      (**(code **)*puVar6)(iVar4);

      if ((*(uint *)(iVar4 + 4) >> 2 & 1) != 0) {

        if (!bVar1) {

          return;

        }

        if (piVar2[2] == 0) {

          return;

        }

        piVar2[2] = 0;

        FUN_005bf370();

        return;

      }

      puVar6 = puVar6 + 0xd;

    } while (puVar6 != (undefined4 *)(piVar2[2] * 0x34 + *piVar2));

  }

  return;

}





// --- FUN_005c1b90 at 0x005C1B90 (size: 82) ---


int __thiscall FUN_005c1b90(int param_1,int param_2)



{

  int iVar1;

  LONG LVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  if (iVar1 != *(int *)(param_2 + 4)) {

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

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

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

    }

    iVar1 = *(int *)(param_2 + 4);

    *(int *)(param_1 + 4) = iVar1;

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

  }

  FUN_005c0ea0(param_2 + 8);

  return param_1;

}





// --- FUN_005c1bf0 at 0x005C1BF0 (size: 173) ---


undefined4 __fastcall FUN_005c1bf0(int *param_1)



{

  uint uVar1;

  uint *puVar2;

  uint *puVar3;

  int iVar4;

  int iVar5;

  

  uVar1 = param_1[2];

  if (uVar1 == (param_1[1] & 0x7fffffffU)) {

    return 0;

  }

  if (uVar1 == 0) {

    puVar3 = (uint *)0x0;

LAB_005c1c6e:

    if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

      FUN_005bfc20(3);

    }

    *param_1 = (int)puVar3;

    param_1[1] = param_1[2] | 0x80000000;

    return 1;

  }

  puVar2 = (uint *)thunk_FUN_005df0f5(uVar1 * 0x14 + 4);

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

    puVar3 = puVar2 + 1;

    *puVar2 = uVar1;

    FUN_00401000(puVar3,0x14,uVar1,FUN_005bf950);

    if (puVar3 != (uint *)0x0) {

      iVar4 = param_1[2];

      if (-1 < iVar4 + -1) {

        iVar5 = (iVar4 + -1) * 0x14;

        do {

          FUN_005c1b90(*param_1 + iVar5);

          iVar5 = iVar5 + -0x14;

          iVar4 = iVar4 + -1;

        } while (iVar4 != 0);

      }

      goto LAB_005c1c6e;

    }

  }

  return 0;

}





// --- FUN_005c1ca0 at 0x005C1CA0 (size: 200) ---


undefined4 __thiscall FUN_005c1ca0(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_005c1220();

      return 1;

    }

    puVar3 = (uint *)thunk_FUN_005df0f5(param_2 * 0x40 + 4);

    if (puVar3 != (uint *)0x0) {

      puVar1 = puVar3 + 1;

      *puVar3 = param_2;

      FUN_00401000(puVar1,0x40,param_2,FUN_005bfa90);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          param_2 = param_1[2];

          if (-1 < (int)(param_2 + -1)) {

            iVar4 = (param_2 + -1) * 0x40;

            do {

              FUN_005c0e10(*param_1 + iVar4);

              iVar4 = iVar4 + -0x40;

              param_2 = param_2 + -1;

            } while (param_2 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

            FUN_0047d9b0(3);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005c1d70 at 0x005C1D70 (size: 156) ---


void __fastcall FUN_005c1d70(int *param_1)



{

  uint uVar1;

  undefined **local_14;

  undefined *local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if ((*param_1 != 0) && (uVar1 = param_1[1] & 0x7fffffff, -1 < (int)(uVar1 - 1))) {

      do {

        local_10 = PTR_DAT_00818344;

        local_14 = &PTR_LAB_007e87ac;

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

        local_c = 0;

        local_8 = 0;

        local_4 = 0;

        FUN_005c1b90(&local_14);

        FUN_005bf980();

        uVar1 = uVar1 - 1;

      } while (uVar1 != 0);

    }

    return;

  }

  if (*param_1 != 0) {

    FUN_005bfc20(3);

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_005c1e10 at 0x005C1E10 (size: 59) ---


undefined4 * __thiscall FUN_005c1e10(undefined4 *param_1,int param_2)



{

  int iVar1;

  

  *param_1 = &PTR_LAB_007e87ac;

  iVar1 = *(int *)(param_2 + 4);

  param_1[1] = iVar1;

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

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  FUN_005c0ea0(param_2 + 8);

  return param_1;

}





// --- FUN_005c1ee0 at 0x005C1EE0 (size: 310) ---


int __thiscall FUN_005c1ee0(int param_1,int param_2)



{

  int iVar1;

  LONG LVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  if (iVar1 != *(int *)(param_2 + 4)) {

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

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

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

    }

    iVar1 = *(int *)(param_2 + 4);

    *(int *)(param_1 + 4) = iVar1;

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

  }

  *(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);

  FUN_005ad300(param_2 + 0x18);

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

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

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

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

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

  FUN_005bfba0(param_2 + 0x58);

  FUN_005c0830(param_2 + 100);

  FUN_005bfba0(param_2 + 0x70);

  FUN_005c0940(param_2 + 0x7c);

  FUN_005c0a70(param_2 + 0x88);

  FUN_005c0a70(param_2 + 0x94);

  FUN_005c16c0(param_2 + 0xa0);

  FUN_005c16c0(param_2 + 0xac);

  FUN_005c16c0(param_2 + 0xb8);

  FUN_005c16c0(param_2 + 0xc4);

  FUN_005c0220(param_2 + 0xd0);

  return param_1;

}





// --- FUN_005c2020 at 0x005C2020 (size: 386) ---


int __thiscall FUN_005c2020(int param_1,uint *param_2)



{

  char cVar1;

  LONG LVar2;

  uint uVar3;

  uint uVar4;

  undefined4 *puVar5;

  uint local_44;

  undefined **local_40;

  undefined *local_3c;

  undefined4 local_38;

  undefined4 local_34;

  undefined4 local_30;

  undefined4 local_2c;

  undefined4 local_28;

  undefined4 local_24;

  undefined4 local_20;

  undefined4 local_1c;

  void *local_18;

  uint local_14;

  undefined4 local_10;

  void *local_c;

  uint local_8;

  undefined4 local_4;

  

  if ((*(uint *)(param_1 + 4) & 0x7fffffff) < (param_2[1] & 0x7fffffff)) {

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

    cVar1 = FUN_005c1ca0(param_2[1] & 0x7fffffff);

    if (cVar1 == '\0') {

      return param_1;

    }

  }

  uVar4 = *param_2;

  uVar3 = param_2[2] * 0x40 + uVar4;

  for (; uVar4 < uVar3; uVar4 = uVar4 + 0x40) {

    FUN_005c0e10(uVar4);

  }

  local_44 = param_2[2];

  if (local_44 < *(uint *)(param_1 + 8)) {

    local_40 = &PTR_LAB_007a0ec8;

    do {

      local_3c = PTR_DAT_00818344;

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

      local_38 = DAT_008f0874;

      local_34 = 0;

      local_30 = 0;

      local_2c = 0;

      local_28 = 0;

      local_24 = 0;

      local_20 = 0;

      local_1c = 0;

      local_18 = (void *)0x0;

      local_14 = 0;

      local_10 = 0;

      local_c = (void *)0x0;

      local_8 = 0;

      local_4 = 0;

      FUN_005c0e10(&local_40);

      local_40 = &PTR_LAB_007a0ec8;

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

        operator_delete__(local_c);

      }

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

        operator_delete__(local_18);

      }

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

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

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

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

      }

      local_44 = local_44 + 1;

    } while (local_44 < *(uint *)(param_1 + 8));

  }

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

  return param_1;

}





// --- FUN_005c21b0 at 0x005C21B0 (size: 193) ---


void FUN_005c21b0(undefined4 param_1,int *param_2,int param_3)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined4 *puVar6;

  

  iVar4 = param_3;

  piVar2 = param_2;

  param_2 = (int *)param_2[2];

  FUN_00401a80(param_1,&param_2,param_3);

  bVar1 = false;

  if ((~*(byte *)(iVar4 + 4) & 1) != 0) {

    uVar5 = FUN_0040a8f0();

    uVar3 = (uint)param_2;

    if (uVar5 < param_2) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar2[2] < param_2) {

      FUN_005c1150(param_2);

      piVar2[2] = uVar3;

    }

    else if (param_2 < (uint)piVar2[2]) {

      piVar2[2] = (int)param_2;

      FUN_005c0170();

    }

    bVar1 = true;

  }

  puVar6 = (undefined4 *)*piVar2;

  if (puVar6 != puVar6 + piVar2[2] * 4) {

    do {

      (**(code **)*puVar6)(iVar4);

      if ((*(uint *)(iVar4 + 4) >> 2 & 1) != 0) {

        if (!bVar1) {

          return;

        }

        if (piVar2[2] == 0) {

          return;

        }

        piVar2[2] = 0;

        FUN_005c0170();

        return;

      }

      puVar6 = puVar6 + 4;

    } while (puVar6 != (undefined4 *)(piVar2[2] * 0x10 + *piVar2));

  }

  return;

}





// --- FUN_005c2280 at 0x005C2280 (size: 213) ---


undefined4 __thiscall FUN_005c2280(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_005c1d70();

      return 1;

    }

    puVar3 = (uint *)thunk_FUN_005df0f5(param_2 * 0x14 + 4);

    if (puVar3 != (uint *)0x0) {

      puVar1 = puVar3 + 1;

      *puVar3 = param_2;

      FUN_00401000(puVar1,0x14,param_2,FUN_005bf950);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          param_2 = param_1[2];

          if (-1 < (int)(param_2 + -1)) {

            iVar4 = (param_2 + -1) * 0x14;

            do {

              FUN_005c1b90(*param_1 + iVar4);

              iVar4 = iVar4 + -0x14;

              param_2 = param_2 + -1;

            } while (param_2 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

            FUN_005bfc20(3);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005c2460 at 0x005C2460 (size: 369) ---


undefined4 * __thiscall FUN_005c2460(undefined4 *param_1,int param_2)



{

  int iVar1;

  

  *param_1 = &PTR_LAB_007a0ecc;

  iVar1 = *(int *)(param_2 + 4);

  param_1[1] = iVar1;

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

  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);

  FUN_005ad590(param_2 + 0x18);

  param_1[0x11] = *(undefined4 *)(param_2 + 0x44);

  param_1[0x12] = *(undefined4 *)(param_2 + 0x48);

  param_1[0x13] = *(undefined4 *)(param_2 + 0x4c);

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

  param_1[0x15] = *(undefined4 *)(param_2 + 0x54);

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x18] = 0;

  FUN_005bfba0(param_2 + 0x58);

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  FUN_005c0830(param_2 + 100);

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  FUN_005bfba0(param_2 + 0x70);

  param_1[0x1f] = 0;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  FUN_005c0940(param_2 + 0x7c);

  param_1[0x22] = 0;

  param_1[0x23] = 0;

  param_1[0x24] = 0;

  FUN_005c0a70(param_2 + 0x88);

  param_1[0x25] = 0;

  param_1[0x26] = 0;

  param_1[0x27] = 0;

  FUN_005c0a70(param_2 + 0x94);

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  FUN_005c16c0(param_2 + 0xa0);

  param_1[0x2b] = 0;

  param_1[0x2c] = 0;

  param_1[0x2d] = 0;

  FUN_005c16c0(param_2 + 0xac);

  param_1[0x2e] = 0;

  param_1[0x2f] = 0;

  param_1[0x30] = 0;

  FUN_005c16c0(param_2 + 0xb8);

  param_1[0x31] = 0;

  param_1[0x32] = 0;

  param_1[0x33] = 0;

  FUN_005c16c0(param_2 + 0xc4);

  param_1[0x34] = 0;

  param_1[0x35] = 0;

  param_1[0x36] = 0;

  FUN_005c0220(param_2 + 0xd0);

  return param_1;

}





// --- FUN_005c2830 at 0x005C2830 (size: 143) ---


undefined4 * __thiscall FUN_005c2830(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_007e87a8;

  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_005c28c0 at 0x005C28C0 (size: 143) ---


undefined4 * __thiscall FUN_005c28c0(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_007a0ec4;

  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_005c2950 at 0x005C2950 (size: 271) ---


undefined1 __thiscall FUN_005c2950(int *param_1,uint param_2,char param_3)



{

  LONG *lpAddend;

  int iVar1;

  undefined *puVar2;

  undefined *puVar3;

  char cVar4;

  uint uVar5;

  LONG LVar6;

  uint local_1c;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if ((param_1[1] & 0x7fffffffU) < param_2) {

    uVar5 = param_2;

    if (param_3 == '\0') {

      uVar5 = FUN_00453850(param_2);

    }

    cVar4 = FUN_005c2280(uVar5);

    if (cVar4 == '\0') {

      return 0;

    }

  }

  else {

    local_1c = param_2;

    if (param_2 < (uint)param_1[2]) {

      _param_3 = param_2 * 0x14;

      do {

        puVar3 = PTR_DAT_00818344;

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

        InterlockedIncrement(lpAddend);

        iVar1 = *param_1;

        local_c = 0;

        local_8 = 0;

        local_4 = 0;

        puVar2 = *(undefined **)(iVar1 + _param_3 + 4);

        if (puVar2 != puVar3) {

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

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

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

          }

          *(undefined **)(iVar1 + _param_3 + 4) = puVar3;

          InterlockedIncrement(lpAddend);

        }

        FUN_005c0ea0(&local_c);

        FUN_005bf980();

        local_1c = local_1c + 1;

        _param_3 = _param_3 + 0x14;

      } while (local_1c < (uint)param_1[2]);

    }

  }

  param_1[2] = param_2;

  return 1;

}





// --- FUN_005c2a60 at 0x005C2A60 (size: 193) ---


void FUN_005c2a60(undefined4 param_1,int *param_2,int param_3)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined4 *puVar6;

  

  iVar4 = param_3;

  piVar2 = param_2;

  param_2 = (int *)param_2[2];

  FUN_00401a80(param_1,&param_2,param_3);

  bVar1 = false;

  if ((~*(byte *)(iVar4 + 4) & 1) != 0) {

    uVar5 = FUN_0040a8f0();

    uVar3 = (uint)param_2;

    if (uVar5 < param_2) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar2[2] < param_2) {

      FUN_005c1ca0(param_2);

      piVar2[2] = uVar3;

    }

    else if (param_2 < (uint)piVar2[2]) {

      piVar2[2] = (int)param_2;

      FUN_005c10a0();

    }

    bVar1 = true;

  }

  puVar6 = (undefined4 *)*piVar2;

  if (puVar6 != puVar6 + piVar2[2] * 0x10) {

    do {

      (**(code **)*puVar6)(iVar4);

      if ((*(uint *)(iVar4 + 4) >> 2 & 1) != 0) {

        if (!bVar1) {

          return;

        }

        if (piVar2[2] == 0) {

          return;

        }

        piVar2[2] = 0;

        FUN_005c10a0();

        return;

      }

      puVar6 = puVar6 + 0x10;

    } while (puVar6 != (undefined4 *)(piVar2[2] * 0x40 + *piVar2));

  }

  return;

}





// --- FUN_005c2b30 at 0x005C2B30 (size: 120) ---


undefined4 __thiscall FUN_005c2b30(int param_1,undefined4 param_2,uint param_3)



{

  uint *puVar1;

  undefined1 local_dc [220];

  

  FUN_005c12a0();

  puVar1 = *(uint **)(*(int *)(param_1 + 0xb0) + (param_3 % *(uint *)(param_1 + 0xb8)) * 4);

  do {

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

LAB_005c2b80:

      FUN_005c2460(local_dc);

      FUN_0047daa0();

      return param_2;

    }

    if (*puVar1 == param_3) {

      if (puVar1 != (uint *)0x0) {

        FUN_005c1ee0(puVar1 + 2);

      }

      goto LAB_005c2b80;

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_005c2bb0 at 0x005C2BB0 (size: 198) ---


void FUN_005c2bb0(undefined4 param_1,int *param_2,int param_3)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined4 *puVar6;

  

  iVar4 = param_3;

  piVar2 = param_2;

  param_2 = (int *)param_2[2];

  FUN_00401a80(param_1,&param_2,param_3);

  bVar1 = false;

  if ((~*(byte *)(iVar4 + 4) & 1) != 0) {

    uVar5 = FUN_0040a8f0();

    uVar3 = (uint)param_2;

    if (uVar5 < param_2) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar2[2] < param_2) {

      FUN_005c2280(param_2);

      piVar2[2] = uVar3;

    }

    else if (param_2 < (uint)piVar2[2]) {

      piVar2[2] = (int)param_2;

      FUN_005c1bf0();

    }

    bVar1 = true;

  }

  puVar6 = (undefined4 *)*piVar2;

  if (puVar6 != puVar6 + piVar2[2] * 5) {

    do {

      (**(code **)*puVar6)(iVar4);

      if ((*(uint *)(iVar4 + 4) >> 2 & 1) != 0) {

        if (!bVar1) {

          return;

        }

        if (piVar2[2] == 0) {

          return;

        }

        piVar2[2] = 0;

        FUN_005c1bf0();

        return;

      }

      puVar6 = puVar6 + 5;

    } while (puVar6 != (undefined4 *)(*piVar2 + piVar2[2] * 0x14));

  }

  return;

}





// --- FUN_005c2c80 at 0x005C2C80 (size: 111) ---


void __fastcall FUN_005c2c80(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int *piVar4;

  

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

  do {

    if (iVar3 == 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);

        iVar3 = *piVar4;

        goto LAB_005c2cbf;

      }

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

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

    }

    piVar4 = (int *)0x0;

    iVar3 = 0;

LAB_005c2cbf:

    iVar2 = *piVar4;

    if (iVar2 == iVar3) {

LAB_005c2cd2:

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

    }

    else {

      do {

        iVar1 = iVar2;

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

      } while (iVar2 != iVar3);

      if (iVar1 == 0) goto LAB_005c2cd2;

      *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(iVar2 + 4);

    }

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

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

  } while( true );

}





// --- FUN_005c2cf0 at 0x005C2CF0 (size: 529) ---


void FUN_005c2cf0(undefined4 param_1,int param_2,uint param_3)



{

  int iVar1;

  undefined *puVar2;

  undefined *puVar3;

  uint uVar4;

  char cVar5;

  undefined *puVar6;

  byte *pbVar7;

  int *piVar8;

  undefined4 *puVar9;

  undefined4 *puVar10;

  uint uVar11;

  undefined4 *puVar12;

  undefined1 local_c [12];

  

  uVar4 = param_3;

  if ((~*(byte *)(param_3 + 4) & 1) != 0) {

    FUN_005c2c80();

  }

  puVar3 = PTR_DAT_00818558;

  puVar2 = PTR_DAT_00818554;

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    param_3 = *(uint *)(param_2 + 0x68);

    puVar6 = (undefined *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_3,param_3,0);

    if (puVar6 == puVar3) {

      puVar6 = puVar6 + -4;

    }

    uVar11 = (int)puVar6 - (int)puVar2 >> 2;

  }

  else {

    uVar11 = param_3 & 0xff;

  }

  FUN_0040ad10(1);

  pbVar7 = (byte *)FUN_0040acf0(1);

  if (pbVar7 != (byte *)0x0) {

    if ((*(byte *)(uVar4 + 4) & 1) == 0) {

      uVar11 = (uint)*pbVar7;

    }

    else {

      *pbVar7 = (byte)uVar11;

    }

  }

  if ((*(byte *)(uVar4 + 4) & 5) == 0) {

    if ((uVar11 & 0xff) < DAT_007956cc) {

      FUN_0042ab60(*(undefined4 *)(PTR_DAT_00818554 + (uVar11 & 0xff) * 4));

    }

    else {

      FUN_0040aa50();

    }

  }

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    param_3 = *(uint *)(param_2 + 0x6c);

  }

  FUN_00401a80(&param_3,&param_3,uVar4);

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    piVar8 = (int *)FUN_0052dcf0(local_c);

    iVar1 = *piVar8;

    puVar12 = (undefined4 *)piVar8[1];

    puVar9 = (undefined4 *)piVar8[2];

LAB_005c2df2:

    puVar10 = puVar9;

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

      do {

        FUN_0040ad10(4);

        puVar9 = (undefined4 *)FUN_0040acf0(4);

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

          if ((*(byte *)(uVar4 + 4) & 1) == 0) {

            *puVar10 = *puVar9;

          }

          else {

            *puVar9 = *puVar10;

          }

        }

        (**(code **)puVar10[2])(uVar4);

        puVar10 = (undefined4 *)puVar10[1];

      } while (puVar10 != (undefined4 *)0x0);

      do {

        puVar12 = puVar12 + 1;

        puVar9 = puVar10;

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

        puVar9 = (undefined4 *)*puVar12;

      } while (puVar9 == (undefined4 *)0x0);

      goto LAB_005c2df2;

    }

  }

  if ((*(byte *)(uVar4 + 4) & 5) == 0) {

    uVar11 = FUN_0040a8f0();

    if (uVar11 < param_3) {

LAB_005c2ef2:

      FUN_0040aa50();

    }

    else {

      uVar11 = 0;

      puVar12 = (undefined4 *)0x0;

      if (param_3 != 0) {

        while( true ) {

          puVar9 = (undefined4 *)FUN_005df0f5(0xe4);

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

            puVar9 = (undefined4 *)0x0;

          }

          else {

            puVar9[1] = 0;

            FUN_005c12a0();

          }

          FUN_0040ad10(4);

          puVar10 = (undefined4 *)FUN_0040acf0(4);

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

            if ((*(byte *)(uVar4 + 4) & 1) == 0) {

              *puVar9 = *puVar10;

            }

            else {

              *puVar10 = *puVar9;

            }

          }

          (**(code **)puVar9[2])(uVar4);

          if ((*(uint *)(uVar4 + 4) >> 2 & 1) != 0) break;

          cVar5 = FUN_00599310(puVar9,puVar12);

          if (cVar5 == '\0') goto LAB_005c2ef2;

          uVar11 = uVar11 + 1;

          puVar12 = puVar9;

          if (param_3 <= uVar11) {

            return;

          }

        }

      }

    }

  }

  return;

}





// --- FUN_005c2f10 at 0x005C2F10 (size: 335) ---


int __thiscall FUN_005c2f10(int param_1,int param_2)



{

  undefined *puVar1;

  int iVar2;

  undefined4 *puVar3;

  int *piVar4;

  uint uVar5;

  uint uVar6;

  uint *puVar7;

  uint *puVar8;

  uint *puVar9;

  undefined1 local_18 [4];

  undefined4 *local_14;

  int local_c;

  

  iVar2 = param_2;

  if (param_1 != param_2) {

    FUN_0047e210();

    puVar1 = PTR_DAT_00818558;

    param_2 = *(undefined4 *)(iVar2 + 0x6c);

    puVar3 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

    if (puVar3 == (undefined4 *)puVar1) {

      puVar3 = puVar3 + -1;

    }

    FUN_0046c280(*puVar3);

    puVar7 = (uint *)0x0;

    piVar4 = (int *)FUN_0052dcf0(local_18);

    local_c = *piVar4;

    puVar9 = (uint *)piVar4[2];

    local_14 = (undefined4 *)piVar4[1];

    while (puVar8 = puVar7, puVar9 != (uint *)0x0) {

      do {

        puVar7 = (uint *)FUN_005df0f5(0xe4);

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

          puVar7 = (uint *)0x0;

        }

        else {

          *puVar7 = *puVar9;

          puVar7[1] = 0;

          FUN_005c2460(puVar9 + 2);

        }

        uVar5 = *puVar7 % *(uint *)(param_1 + 0x6c);

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

LAB_005c2ff2:

          puVar3 = (undefined4 *)(*(int *)(param_1 + 100) + uVar5 * 4);

          *puVar3 = puVar7;

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

            *(undefined4 **)(param_1 + 0x68) = puVar3;

          }

LAB_005c3008:

          *(int *)(param_1 + 0x70) = *(int *)(param_1 + 0x70) + 1;

        }

        else {

          uVar6 = *puVar8 % *(uint *)(param_1 + 0x6c);

          if (uVar5 == uVar6) {

            puVar8[1] = (uint)puVar7;

            goto LAB_005c3008;

          }

          if (uVar6 < uVar5) goto LAB_005c2ff2;

        }

        puVar9 = (uint *)puVar9[1];

        puVar8 = puVar7;

      } while (puVar9 != (uint *)0x0);

      do {

        local_14 = local_14 + 1;

        if (local_14 == (undefined4 *)(*(int *)(local_c + 0x60) + *(int *)(local_c + 0x68) * 4)) {

          return param_1;

        }

        puVar9 = (uint *)*local_14;

      } while (puVar9 == (uint *)0x0);

    }

  }

  return param_1;

}





// --- FUN_005c3060 at 0x005C3060 (size: 120) ---


undefined4 * __fastcall FUN_005c3060(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_LAB_007a0ed4;

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

  param_1[1] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  param_1[2] = DAT_008f0874;

  param_1[3] = DAT_008f0874;

  param_1[4] = DAT_008f0874;

  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] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = &PTR_FUN_007a0ed0;

  FUN_005c28c0(0x17);

  return param_1;

}





// --- FUN_005c3220 at 0x005C3220 (size: 160) ---


int __thiscall FUN_005c3220(int param_1,int param_2)



{

  int iVar1;

  LONG LVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  if (iVar1 != *(int *)(param_2 + 4)) {

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

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

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

    }

    iVar1 = *(int *)(param_2 + 4);

    *(int *)(param_1 + 4) = iVar1;

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

  }

  *(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);

  FUN_005c0220(param_2 + 0x1c);

  FUN_005c0220(param_2 + 0x28);

  FUN_005bfaf0(param_2 + 0x34);

  FUN_005c2020(param_2 + 0x40);

  FUN_005c2f10(param_2 + 0x4c);

  return param_1;

}





// --- FUN_005c32c0 at 0x005C32C0 (size: 183) ---


undefined4 * __thiscall FUN_005c32c0(undefined4 *param_1,int param_2)



{

  int iVar1;

  

  *param_1 = &PTR_LAB_007a0ed4;

  iVar1 = *(int *)(param_2 + 4);

  param_1[1] = iVar1;

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

  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);

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  FUN_005c0220(param_2 + 0x1c);

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  FUN_005c0220(param_2 + 0x28);

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  FUN_005bfaf0(param_2 + 0x34);

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  FUN_005c2020(param_2 + 0x40);

  param_1[0x13] = &PTR_FUN_007a0ed0;

  FUN_005c28c0(*(undefined4 *)(param_2 + 0xb8));

  FUN_005c2f10(param_2 + 0x4c);

  return param_1;

}





// --- FUN_005c3380 at 0x005C3380 (size: 120) ---


undefined4 __thiscall FUN_005c3380(int param_1,undefined4 param_2,uint param_3)



{

  uint *puVar1;

  undefined1 local_c0 [192];

  

  FUN_005c3060();

  puVar1 = *(uint **)(*(int *)(param_1 + 0xa0) + (param_3 % *(uint *)(param_1 + 0xa8)) * 4);

  do {

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

LAB_005c33d0:

      FUN_005c32c0(local_c0);

      FUN_0047e300();

      return param_2;

    }

    if (*puVar1 == param_3) {

      if (puVar1 != (uint *)0x0) {

        FUN_005c3220(puVar1 + 2);

      }

      goto LAB_005c33d0;

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_005c3400 at 0x005C3400 (size: 130) ---


void __fastcall FUN_005c3400(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_005c343f;

      }

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

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

    }

    piVar4 = (int *)0x0;

    pvVar5 = (void *)0x0;

LAB_005c343f:

    pvVar3 = (void *)*piVar4;

    if (pvVar3 == pvVar5) {

LAB_005c3452:

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

    }

    else {

      do {

        pvVar2 = pvVar3;

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

      } while (pvVar3 != pvVar5);

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

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

    }

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

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

      FUN_0047e300();

      operator_delete(pvVar5);

    }

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

  } while( true );

}





// --- FUN_005c3490 at 0x005C3490 (size: 529) ---


void FUN_005c3490(undefined4 param_1,int param_2,uint param_3)



{

  int iVar1;

  undefined *puVar2;

  undefined *puVar3;

  uint uVar4;

  char cVar5;

  undefined *puVar6;

  byte *pbVar7;

  int *piVar8;

  undefined4 *puVar9;

  undefined4 *puVar10;

  uint uVar11;

  undefined4 *puVar12;

  undefined1 local_c [12];

  

  uVar4 = param_3;

  if ((~*(byte *)(param_3 + 4) & 1) != 0) {

    FUN_005c2c80();

  }

  puVar3 = PTR_DAT_00818558;

  puVar2 = PTR_DAT_00818554;

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    param_3 = *(uint *)(param_2 + 0x68);

    puVar6 = (undefined *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_3,param_3,0);

    if (puVar6 == puVar3) {

      puVar6 = puVar6 + -4;

    }

    uVar11 = (int)puVar6 - (int)puVar2 >> 2;

  }

  else {

    uVar11 = param_3 & 0xff;

  }

  FUN_0040ad10(1);

  pbVar7 = (byte *)FUN_0040acf0(1);

  if (pbVar7 != (byte *)0x0) {

    if ((*(byte *)(uVar4 + 4) & 1) == 0) {

      uVar11 = (uint)*pbVar7;

    }

    else {

      *pbVar7 = (byte)uVar11;

    }

  }

  if ((*(byte *)(uVar4 + 4) & 5) == 0) {

    if ((uVar11 & 0xff) < DAT_007956cc) {

      FUN_0042ab60(*(undefined4 *)(PTR_DAT_00818554 + (uVar11 & 0xff) * 4));

    }

    else {

      FUN_0040aa50();

    }

  }

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    param_3 = *(uint *)(param_2 + 0x6c);

  }

  FUN_00401a80(&param_3,&param_3,uVar4);

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    piVar8 = (int *)FUN_0052dcf0(local_c);

    iVar1 = *piVar8;

    puVar12 = (undefined4 *)piVar8[1];

    puVar9 = (undefined4 *)piVar8[2];

LAB_005c3592:

    puVar10 = puVar9;

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

      do {

        FUN_0040ad10(4);

        puVar9 = (undefined4 *)FUN_0040acf0(4);

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

          if ((*(byte *)(uVar4 + 4) & 1) == 0) {

            *puVar10 = *puVar9;

          }

          else {

            *puVar9 = *puVar10;

          }

        }

        (**(code **)puVar10[2])(uVar4);

        puVar10 = (undefined4 *)puVar10[1];

      } while (puVar10 != (undefined4 *)0x0);

      do {

        puVar12 = puVar12 + 1;

        puVar9 = puVar10;

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

        puVar9 = (undefined4 *)*puVar12;

      } while (puVar9 == (undefined4 *)0x0);

      goto LAB_005c3592;

    }

  }

  if ((*(byte *)(uVar4 + 4) & 5) == 0) {

    uVar11 = FUN_0040a8f0();

    if (uVar11 < param_3) {

LAB_005c3692:

      FUN_0040aa50();

    }

    else {

      uVar11 = 0;

      puVar12 = (undefined4 *)0x0;

      if (param_3 != 0) {

        while( true ) {

          puVar9 = (undefined4 *)FUN_005df0f5(200);

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

            puVar9 = (undefined4 *)0x0;

          }

          else {

            puVar9[1] = 0;

            FUN_005c3060();

          }

          FUN_0040ad10(4);

          puVar10 = (undefined4 *)FUN_0040acf0(4);

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

            if ((*(byte *)(uVar4 + 4) & 1) == 0) {

              *puVar9 = *puVar10;

            }

            else {

              *puVar10 = *puVar9;

            }

          }

          (**(code **)puVar9[2])(uVar4);

          if ((*(uint *)(uVar4 + 4) >> 2 & 1) != 0) break;

          cVar5 = FUN_00599310(puVar9,puVar12);

          if (cVar5 == '\0') goto LAB_005c3692;

          uVar11 = uVar11 + 1;

          puVar12 = puVar9;

          if (param_3 <= uVar11) {

            return;

          }

        }

      }

    }

  }

  return;

}





// --- FUN_005c36b0 at 0x005C36B0 (size: 252) ---


uint FUN_005c36b0(uint param_1,undefined4 param_2,undefined4 param_3)



{

  uint uVar1;

  int *piVar2;

  uint *puVar3;

  undefined1 local_19c [52];

  int local_168;

  uint local_160;

  undefined1 local_dc [220];

  

  FUN_005c3380(local_19c,param_2);

  FUN_005c2b30(local_dc,param_3);

  uVar1 = 0;

  if (local_160 != 0) {

    puVar3 = (uint *)(local_168 + 4);

    do {

      if (*puVar3 == param_1) {

        uVar1 = *(uint *)(uVar1 * 0x10 + 8 + local_168);

        goto LAB_005c3789;

      }

      uVar1 = uVar1 + 1;

      puVar3 = puVar3 + 4;

    } while (uVar1 < local_160);

  }

  piVar2 = (int *)FUN_00413a00(4,2,0x10000004);

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

    if ((piVar2[0x11] != 0) && (piVar2[0x10] != 0)) {

      for (puVar3 = *(uint **)(piVar2[0x10] + (param_1 % (uint)piVar2[0x11]) * 4);

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

        if (param_1 == *puVar3) {

          if (puVar3 != (uint *)0xfffffff8) {

            uVar1 = puVar3[6];

LAB_005c3789:

            FUN_0047daa0();

            FUN_0047e300();

            return uVar1;

          }

          break;

        }

      }

    }

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

  }

  FUN_0047daa0();

  FUN_0047e300();

  return 0xffffffff;

}





// --- FUN_005c37b0 at 0x005C37B0 (size: 252) ---


uint FUN_005c37b0(uint param_1,undefined4 param_2,undefined4 param_3)



{

  uint uVar1;

  int *piVar2;

  uint *puVar3;

  undefined1 local_19c [52];

  int local_168;

  uint local_160;

  undefined1 local_dc [220];

  

  FUN_005c3380(local_19c,param_2);

  FUN_005c2b30(local_dc,param_3);

  uVar1 = 0;

  if (local_160 != 0) {

    puVar3 = (uint *)(local_168 + 4);

    do {

      if (*puVar3 == param_1) {

        uVar1 = *(uint *)(uVar1 * 0x10 + 0xc + local_168);

        goto LAB_005c3889;

      }

      uVar1 = uVar1 + 1;

      puVar3 = puVar3 + 4;

    } while (uVar1 < local_160);

  }

  piVar2 = (int *)FUN_00413a00(4,2,0x10000004);

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

    if ((piVar2[0x11] != 0) && (piVar2[0x10] != 0)) {

      for (puVar3 = *(uint **)(piVar2[0x10] + (param_1 % (uint)piVar2[0x11]) * 4);

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

        if (param_1 == *puVar3) {

          if (puVar3 != (uint *)0xfffffff8) {

            uVar1 = puVar3[7];

LAB_005c3889:

            FUN_0047daa0();

            FUN_0047e300();

            return uVar1;

          }

          break;

        }

      }

    }

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

  }

  FUN_0047daa0();

  FUN_0047e300();

  return 0xffffffff;

}





// --- FUN_005c38b0 at 0x005C38B0 (size: 1267) ---


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



{

  int iVar1;

  undefined4 uVar2;

  int *piVar3;

  undefined4 *puVar4;

  int local_2c4;

  undefined **local_2c0;

  undefined4 local_2bc;

  undefined4 local_2b8;

  undefined4 local_2b4;

  undefined4 local_2b0;

  undefined4 local_2ac;

  undefined **local_2a8;

  undefined4 local_2a4;

  undefined4 local_2a0;

  undefined4 local_29c;

  undefined4 local_298;

  undefined4 local_294;

  undefined **local_290;

  undefined4 local_28c;

  undefined4 local_288;

  undefined4 local_284;

  undefined4 local_280;

  undefined4 local_27c;

  undefined **local_278;

  undefined4 local_274;

  undefined1 local_270 [52];

  undefined **local_23c;

  undefined4 local_238;

  char local_234;

  int local_230;

  undefined1 local_22c [44];

  undefined **local_200;

  undefined4 local_1fc;

  undefined4 local_1f8;

  undefined1 local_1f4 [44];

  undefined1 local_1c8 [44];

  undefined1 local_19c [24];

  undefined1 local_184 [56];

  undefined4 local_14c;

  undefined4 local_148;

  int iStack_144;

  int local_138;

  int iStack_12c;

  int local_120;

  int local_114;

  int local_108;

  undefined1 local_c0 [192];

  

  local_2a4 = DAT_008f0874;

  local_28c = DAT_008f0874;

  local_2bc = DAT_008f0874;

  local_2a8 = &PTR_LAB_007c4524;

  local_290 = &PTR_LAB_007c4524;

  local_2c0 = &PTR_LAB_007c4524;

  local_2a0 = 0;

  local_29c = 0;

  local_298 = 0;

  local_294 = 0;

  local_288 = 0;

  local_284 = 0;

  local_280 = 0;

  local_27c = 0;

  local_2b8 = 0;

  local_2b4 = 0;

  local_2b0 = 0;

  local_2ac = 0;

  FUN_005c3380(local_c0,*(undefined4 *)(param_1 + 4));

  FUN_005c2b30(local_19c,*(undefined4 *)(param_1 + 8));

  *(undefined4 *)(param_3 + 4) = local_14c;

  *param_2 = local_14c;

  FUN_005ad150(local_184);

  local_138 = *(int *)(param_1 + 0x20) * 0x3c + local_138;

  local_23c = &PTR_FUN_007a0ad0;

  local_238 = *(undefined4 *)(local_138 + 4);

  local_234 = *(char *)(local_138 + 8);

  local_230 = *(int *)(local_138 + 0xc);

  FUN_005ad590(local_138 + 0x10);

  FUN_005ad150(local_22c);

  iVar1 = FUN_005ac6d0(0);

  if (iVar1 != 0) {

    if (*(int *)(param_1 + 4) == 6) {

      param_2[1] = DAT_008f0874;

    }

    else {

      param_2[1] = *(undefined4 *)(iVar1 + 8);

    }

  }

  local_2c4 = 0;

  if ((local_230 == DAT_00823400) || (local_230 == DAT_00823418)) {

    local_2c4 = 1;

  }

  iVar1 = *(int *)(param_1 + 0xc) * 100 + local_120;

  local_200 = &PTR_FUN_007a0ad4;

  local_1fc = *(undefined4 *)(iVar1 + 4);

  local_1f8 = *(undefined4 *)(iVar1 + 8);

  FUN_005ad590(iVar1 + 0xc);

  FUN_005ad590(iVar1 + 0x38);

  if (local_234 == '\0') {

    FUN_005ad150(local_1f4);

    if (local_2c4 != 0) {

      iVar1 = FUN_005ac6b0(1);

      goto joined_r0x005c3ab3;

    }

LAB_005c3abc:

    iVar1 = FUN_005ac6b0(0);

    if (iVar1 == 0) goto LAB_005c3ae2;

  }

  else {

    FUN_005ad150(local_1c8);

    if (local_2c4 == 0) goto LAB_005c3abc;

    iVar1 = FUN_005ac6b0(1);

joined_r0x005c3ab3:

    if (iVar1 == 0) goto LAB_005c3abc;

  }

  param_2[2] = *(undefined4 *)(iVar1 + 0xc);

  param_2[5] = *(undefined4 *)(iVar1 + 8);

LAB_005c3ae2:

  local_114 = *(int *)(param_1 + 0x10) * 0x34 + local_114;

  local_278 = &PTR_LAB_007a0ad8;

  local_274 = *(undefined4 *)(local_114 + 4);

  FUN_005ad590(local_114 + 8);

  FUN_005ad150(local_270);

  if (((local_2c4 != 0) && (iVar1 = FUN_005ac6b0(1), iVar1 != 0)) ||

     (iVar1 = FUN_005ac6b0(0), iVar1 != 0)) {

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

    param_2[6] = *(undefined4 *)(iVar1 + 8);

  }

  local_108 = *(int *)(param_1 + 0x14) * 0x34 + local_108;

  local_274 = *(undefined4 *)(local_108 + 4);

  FUN_005ad300(local_108 + 8);

  FUN_005ad150(local_270);

  if (((local_2c4 != 0) && (iVar1 = FUN_005ac6b0(1), iVar1 != 0)) ||

     (iVar1 = FUN_005ac6b0(0), iVar1 != 0)) {

    param_2[4] = *(undefined4 *)(iVar1 + 0xc);

    param_2[7] = *(undefined4 *)(iVar1 + 8);

  }

  uVar2 = FUN_004220b0(local_148,0x18);

  piVar3 = (int *)FUN_00415430(uVar2);

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

    puVar4 = (undefined4 *)

             FUN_005ad620(&local_2c4,*(undefined4 *)(param_1 + 0x48),*(undefined4 *)(param_1 + 0x4c)

                         );

    local_2a4 = *puVar4;

    local_2a0 = 0;

    local_29c = 0xc0;

    FUN_005ad040(&local_2a8);

    param_2[10] = local_2a4;

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

    uVar2 = FUN_004220b0(*(undefined4 *)(iStack_144 + *(int *)(param_1 + 0x18) * 4),0x18);

    piVar3 = (int *)FUN_00415430(uVar2);

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

      puVar4 = (undefined4 *)

               FUN_005ad620(&local_2c4,*(undefined4 *)(param_1 + 0x50),

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

      local_28c = *puVar4;

      local_288 = 0xc0;

      local_284 = 0x40;

      FUN_005ad040(&local_290);

      param_2[8] = local_28c;

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

      local_2bc = *(undefined4 *)(iStack_12c + *(int *)(param_1 + 0x1c) * 4);

      local_2b8 = 0x100;

      local_2b4 = 0x40;

      FUN_005ad040(&local_2c0);

      param_2[9] = local_2bc;

      local_278 = &PTR_LAB_007a0ad8;

      FUN_005aca00();

      local_200 = &PTR_FUN_007a0ad4;

      FUN_005aca00();

      FUN_005aca00();

      local_23c = &PTR_FUN_007a0ad0;

      FUN_005aca00();

      FUN_0047daa0();

      FUN_0047e300();

      return 1;

    }

  }

  local_278 = &PTR_LAB_007a0ad8;

  FUN_005aca00();

  local_200 = &PTR_FUN_007a0ad4;

  FUN_005aca00();

  FUN_005aca00();

  local_23c = &PTR_FUN_007a0ad0;

  FUN_005aca00();

  FUN_0047daa0();

  FUN_0047e300();

  return 0;

}





// --- FUN_005c3db0 at 0x005C3DB0 (size: 297) ---


uint FUN_005c3db0(undefined4 param_1,undefined4 param_2,int param_3,char param_4)



{

  char cVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  undefined1 local_19c [100];

  int local_138;

  uint local_130;

  undefined1 local_c0 [192];

  

  if (param_3 == DAT_008f0874) {

    return 0;

  }

  FUN_005c3380(local_c0,param_1);

  FUN_005c2b30(local_19c,param_2);

  uVar3 = 0;

  if (local_130 != 0) {

    iVar4 = 0;

    do {

      cVar1 = *(char *)(iVar4 + 8 + local_138);

      FUN_005ad590(iVar4 + 0x10 + local_138);

      iVar2 = FUN_005ac6d0(0);

      if ((param_3 == *(int *)(iVar2 + 8)) && (cVar1 == param_4)) {

        FUN_005aca00();

        FUN_0047daa0();

        FUN_0047e300();

        return uVar3;

      }

      FUN_005aca00();

      uVar3 = uVar3 + 1;

      iVar4 = iVar4 + 0x3c;

    } while (uVar3 < local_130);

  }

  FUN_0047daa0();

  FUN_0047e300();

  return 0;

}





// --- FUN_005c3ee0 at 0x005C3EE0 (size: 354) ---


uint FUN_005c3ee0(undefined4 param_1,undefined4 param_2,int param_3,char param_4)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  undefined1 local_19c [124];

  int local_120;

  uint local_118;

  undefined1 local_c0 [192];

  

  if (param_3 == DAT_008f0874) {

    return 0;

  }

  FUN_005c3380(local_c0,param_1);

  FUN_005c2b30(local_19c,param_2);

  uVar2 = 0;

  if (local_118 != 0) {

    iVar3 = 0;

    do {

      iVar1 = iVar3 + local_120;

      FUN_005ad590(iVar1 + 0xc);

      FUN_005ad590(iVar1 + 0x38);

      iVar1 = FUN_005ac6b0(param_4 != '\0');

      if (param_3 == *(int *)(iVar1 + 0xc)) {

        FUN_005aca00();

        FUN_005aca00();

        FUN_0047daa0();

        FUN_0047e300();

        return uVar2;

      }

      FUN_005aca00();

      FUN_005aca00();

      uVar2 = uVar2 + 1;

      iVar3 = iVar3 + 100;

    } while (uVar2 < local_118);

  }

  FUN_0047daa0();

  FUN_0047e300();

  return 0;

}





// --- FUN_005c4050 at 0x005C4050 (size: 277) ---


uint FUN_005c4050(undefined4 param_1,undefined4 param_2,int param_3,char param_4)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  undefined1 local_19c [136];

  int local_114;

  uint local_10c;

  undefined1 local_c0 [192];

  

  if (param_3 == DAT_008f0874) {

    return 0;

  }

  FUN_005c3380(local_c0,param_1);

  FUN_005c2b30(local_19c,param_2);

  uVar3 = 0;

  if (local_10c != 0) {

    iVar2 = 0;

    do {

      FUN_005ad590(iVar2 + 8 + local_114);

      iVar1 = FUN_005ac6b0(param_4 != '\0');

      if (param_3 == *(int *)(iVar1 + 0xc)) {

        FUN_005aca00();

        FUN_0047daa0();

        FUN_0047e300();

        return uVar3;

      }

      FUN_005aca00();

      uVar3 = uVar3 + 1;

      iVar2 = iVar2 + 0x34;

    } while (uVar3 < local_10c);

  }

  FUN_0047daa0();

  FUN_0047e300();

  return 0;

}





// --- FUN_005c4170 at 0x005C4170 (size: 277) ---


uint FUN_005c4170(undefined4 param_1,undefined4 param_2,int param_3,char param_4)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  undefined1 local_19c [148];

  int local_108;

  uint local_100;

  undefined1 local_c0 [192];

  

  if (param_3 == DAT_008f0874) {

    return 0;

  }

  FUN_005c3380(local_c0,param_1);

  FUN_005c2b30(local_19c,param_2);

  uVar3 = 0;

  if (local_100 != 0) {

    iVar2 = 0;

    do {

      FUN_005ad590(iVar2 + 8 + local_108);

      iVar1 = FUN_005ac6b0(param_4 != '\0');

      if (param_3 == *(int *)(iVar1 + 0xc)) {

        FUN_005aca00();

        FUN_0047daa0();

        FUN_0047e300();

        return uVar3;

      }

      FUN_005aca00();

      uVar3 = uVar3 + 1;

      iVar2 = iVar2 + 0x34;

    } while (uVar3 < local_100);

  }

  FUN_0047daa0();

  FUN_0047e300();

  return 0;

}





// --- FUN_005c4290 at 0x005C4290 (size: 236) ---


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



void FUN_005c4290(undefined4 param_1,undefined4 param_2,int param_3,double *param_4)



{

  double dVar1;

  double dVar2;

  undefined4 uVar3;

  int *piVar4;

  uint uVar5;

  int local_1a8 [3];

  undefined1 local_19c [192];

  undefined1 local_dc [84];

  undefined4 local_88;

  

  uVar5 = 0;

  *(undefined4 *)param_4 = 0;

  *(undefined4 *)((int)param_4 + 4) = 0;

  if (param_3 != DAT_008f0874) {

    FUN_005c3380(local_19c,param_1);

    FUN_005c2b30(local_dc,param_2);

    uVar3 = FUN_004220b0(local_88,0x18);

    piVar4 = (int *)FUN_00415430(uVar3);

    if (piVar4[0xe] != 0) {

      do {

        FUN_005ad6a0(local_1a8,uVar5);

        if (param_3 == local_1a8[0]) break;

        uVar5 = uVar5 + 1;

      } while (uVar5 < (uint)piVar4[0xe]);

    }

    local_1a8[0] = uVar5 + 1;

    dVar1 = (double)local_1a8[0];

    if (local_1a8[0] < 0) {

      dVar1 = dVar1 + _DAT_00795518;

    }

    dVar2 = (double)piVar4[0xe];

    if (piVar4[0xe] < 0) {

      dVar2 = dVar2 + _DAT_00795518;

    }

    *param_4 = dVar1 / dVar2;

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

    FUN_0047daa0();

    FUN_0047e300();

  }

  return;

}





// --- FUN_005c4380 at 0x005C4380 (size: 342) ---


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



void FUN_005c4380(undefined4 param_1,undefined4 param_2,int param_3,uint *param_4,double *param_5)



{

  double dVar1;

  double dVar2;

  undefined4 uVar3;

  int *piVar4;

  uint uVar5;

  int local_1ac;

  uint local_1a8;

  undefined1 local_19c [88];

  int local_144;

  uint local_13c;

  undefined1 local_c0 [192];

  

  *param_4 = 0;

  *(undefined4 *)param_5 = 0;

  *(undefined4 *)((int)param_5 + 4) = 0;

  if (param_3 != DAT_008f0874) {

    FUN_005c3380(local_c0,param_1);

    FUN_005c2b30(local_19c,param_2);

    *param_4 = 0;

    if (local_13c != 0) {

      do {

        uVar3 = FUN_004220b0(*(undefined4 *)(local_144 + *param_4 * 4),0x18);

        piVar4 = (int *)FUN_00415430(uVar3);

        uVar5 = 0;

        if (piVar4[0xe] != 0) {

          do {

            FUN_005ad6a0(&local_1ac,uVar5);

            uVar5 = uVar5 + 1;

            if (param_3 == local_1ac) {

              dVar1 = (double)(int)uVar5;

              if ((int)uVar5 < 0) {

                dVar1 = dVar1 + _DAT_00795518;

              }

              dVar2 = (double)piVar4[0xe];

              if (piVar4[0xe] < 0) {

                dVar2 = dVar2 + _DAT_00795518;

              }

              *param_5 = dVar1 / dVar2;

              local_1a8 = uVar5;

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

              goto LAB_005c447e;

            }

          } while (uVar5 < (uint)piVar4[0xe]);

        }

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

        uVar5 = *param_4;

        *param_4 = uVar5 + 1;

      } while (uVar5 + 1 < local_13c);

    }

    *param_4 = 0;

    *(undefined4 *)param_5 = 0;

    *(undefined4 *)((int)param_5 + 4) = 0;

LAB_005c447e:

    FUN_0047daa0();

    FUN_0047e300();

  }

  return;

}





// --- FUN_005c44e0 at 0x005C44E0 (size: 155) ---


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



{

  uint uVar1;

  undefined1 local_19c [112];

  int local_12c;

  uint local_124;

  undefined1 local_c0 [192];

  

  *param_4 = 0;

  if (param_3 != DAT_008f0874) {

    FUN_005c3380(local_c0,param_1);

    FUN_005c2b30(local_19c,param_2);

    *param_4 = 0;

    if (local_124 != 0) {

      do {

        if (param_3 == *(int *)(local_12c + *param_4 * 4)) goto LAB_005c455b;

        uVar1 = *param_4 + 1;

        *param_4 = uVar1;

      } while (uVar1 < local_124);

    }

    *param_4 = 0;

LAB_005c455b:

    FUN_0047daa0();

    FUN_0047e300();

  }

  return;

}





// --- FUN_005c4580 at 0x005C4580 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_007e87b8;

  FUN_005c3400();

  param_1[1] = &PTR_FUN_007e87a8;

  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_005c45e0 at 0x005C45E0 (size: 52) ---


undefined4 * __fastcall FUN_005c45e0(undefined4 *param_1)



{

  FUN_00415460(DAT_008f0874);

  *param_1 = &PTR_LAB_007e87c0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = &PTR_FUN_007e87b8;

  FUN_005c2830(0x17);

  return param_1;

}





// --- FUN_005c4620 at 0x005C4620 (size: 136) ---


void __fastcall FUN_005c4620(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007e87c0;

  FUN_005c2950(0,1);

  FUN_005c3400();

  param_1[0xf] = &PTR_FUN_007e87b8;

  FUN_005c3400();

  param_1[0x10] = &PTR_FUN_007e87a8;

  if ((undefined4 *)param_1[0x28] != param_1 + 0x11) {

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

  }

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  param_1[0x2b] = 0;

  if (((param_1[0xd] & 0x80000000) == 0x80000000) && (param_1[0xc] != 0)) {

    FUN_005bfc20(3);

  }

  *param_1 = &PTR_LAB_007e8720;

  FUN_004154b0();

  return;

}





// --- FUN_005c4760 at 0x005C4760 (size: 30) ---


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



{

  FUN_005c4620();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005c4780 at 0x005C4780 (size: 13) ---


void __thiscall FUN_005c4780(int param_1,undefined4 param_2)



{

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

  return;

}





// --- FUN_005c4790 at 0x005C4790 (size: 7) ---


undefined4 __fastcall FUN_005c4790(int param_1)



{

  return *(undefined4 *)(param_1 + 0x220);

}





// --- FUN_005c47a0 at 0x005C47A0 (size: 126) ---


void __fastcall FUN_005c47a0(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  uVar3 = 1;

  iVar2 = 0;

  if (1 < *(uint *)(param_1 + 0x1ac)) {

    do {

      iVar1 = *(int *)(*(int *)(param_1 + 0x1b0) + uVar3 * 4);

      if (iVar1 == 2) {

        iVar1 = FUN_005c36b0(uVar3,*(undefined4 *)(param_1 + 0xd4),*(undefined4 *)(param_1 + 0xd8));

LAB_005c4807:

        iVar2 = iVar2 + iVar1;

      }

      else if (iVar1 == 3) {

        iVar1 = FUN_005c37b0(uVar3,*(undefined4 *)(param_1 + 0xd4),*(undefined4 *)(param_1 + 0xd8));

        goto LAB_005c4807;

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0x1ac));

  }

  *(int *)(param_1 + 0x1b8) = *(int *)(param_1 + 0x1b4) - iVar2;

  return;

}





// --- FUN_005c4830 at 0x005C4830 (size: 39) ---


float10 __thiscall FUN_005c4830(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  param_1[0x53] = param_3;

  param_1[0x52] = param_2;

  (**(code **)*param_1)();

  return (float10)*(double *)(param_1 + 0x52);

}





// --- FUN_005c4860 at 0x005C4860 (size: 39) ---


float10 __thiscall FUN_005c4860(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  param_1[0x55] = param_3;

  param_1[0x54] = param_2;

  (**(code **)*param_1)();

  return (float10)*(double *)(param_1 + 0x54);

}





// --- FUN_005c4890 at 0x005C4890 (size: 27) ---


undefined4 __thiscall FUN_005c4890(undefined4 *param_1,undefined4 param_2)



{

  param_1[0x3a] = param_2;

  (**(code **)*param_1)();

  return param_1[0x3a];

}





// --- FUN_005c48b0 at 0x005C48B0 (size: 27) ---


undefined4 __thiscall FUN_005c48b0(undefined4 *param_1,undefined4 param_2)



{

  param_1[0x3b] = param_2;

  (**(code **)*param_1)();

  return param_1[0x3b];

}





// --- FUN_005c48d0 at 0x005C48D0 (size: 33) ---


undefined4 __thiscall FUN_005c48d0(int param_1,int param_2)



{

  if ((param_2 < *(int *)(param_1 + 0x114)) && (-1 < param_2)) {

    return *(undefined4 *)(*(int *)(param_1 + 0x124) + param_2 * 4);

  }

  return 0;

}





// --- FUN_005c4900 at 0x005C4900 (size: 33) ---


undefined4 __thiscall FUN_005c4900(int param_1,int param_2)



{

  if ((param_2 < *(int *)(param_1 + 0x118)) && (-1 < param_2)) {

    return *(undefined4 *)(*(int *)(param_1 + 0x128) + param_2 * 4);

  }

  return 0;

}





// --- FUN_005c4930 at 0x005C4930 (size: 33) ---


undefined4 __thiscall FUN_005c4930(int param_1,int param_2)



{

  if ((param_2 < *(int *)(param_1 + 0x11c)) && (-1 < param_2)) {

    return *(undefined4 *)(*(int *)(param_1 + 300) + param_2 * 4);

  }

  return 0;

}





// --- FUN_005c4960 at 0x005C4960 (size: 33) ---


undefined4 __thiscall FUN_005c4960(int param_1,int param_2)



{

  if ((param_2 < *(int *)(param_1 + 0x120)) && (-1 < param_2)) {

    return *(undefined4 *)(*(int *)(param_1 + 0x130) + param_2 * 4);

  }

  return 0;

}





// --- FUN_005c4990 at 0x005C4990 (size: 76) ---


undefined4 __thiscall FUN_005c4990(int param_1,undefined4 param_2)



{

  switch(param_2) {

  case 1:

    return *(undefined4 *)(param_1 + 0x184);

  case 2:

    return *(undefined4 *)(param_1 + 0x188);

  case 3:

    return *(undefined4 *)(param_1 + 400);

  case 4:

    return *(undefined4 *)(param_1 + 0x18c);

  case 5:

    return *(undefined4 *)(param_1 + 0x194);

  case 6:

    return *(undefined4 *)(param_1 + 0x198);

  default:

    return 0;

  }

}





// --- FUN_005c4a00 at 0x005C4A00 (size: 223) ---


void FUN_005c4a00(undefined4 param_1,char *param_2)



{

  switch(param_1) {

  case 1:

    *(undefined4 *)param_2 = s_Strength_007e88c4._0_4_;

    *(undefined4 *)(param_2 + 4) = s_Strength_007e88c4._4_4_;

    param_2[8] = s_Strength_007e88c4[8];

    return;

  case 2:

    *(undefined4 *)param_2 = s_Endurance_007e88b8._0_4_;

    *(undefined4 *)(param_2 + 4) = s_Endurance_007e88b8._4_4_;

    *(undefined2 *)(param_2 + 8) = s_Endurance_007e88b8._8_2_;

    return;

  case 3:

    *(undefined4 *)param_2 = s_Quickness_007e88ac._0_4_;

    *(undefined4 *)(param_2 + 4) = s_Quickness_007e88ac._4_4_;

    *(undefined2 *)(param_2 + 8) = s_Quickness_007e88ac._8_2_;

    return;

  case 4:

    *(undefined4 *)param_2 = s_Coordination_007e889c._0_4_;

    *(undefined4 *)(param_2 + 4) = s_Coordination_007e889c._4_4_;

    *(undefined4 *)(param_2 + 8) = s_Coordination_007e889c._8_4_;

    param_2[0xc] = s_Coordination_007e889c[0xc];

    return;

  case 5:

    *(undefined4 *)param_2 = s_Focus_007e8894._0_4_;

    *(undefined2 *)(param_2 + 4) = s_Focus_007e8894._4_2_;

    return;

  case 6:

    *(undefined4 *)param_2 = DAT_007e888c;

    param_2[4] = DAT_007e8890;

    return;

  default:

    *param_2 = '\0';

    return;

  }

}





// --- FUN_005c4b00 at 0x005C4B00 (size: 125) ---


int __thiscall FUN_005c4b00(int param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  uint uVar4;

  

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

  uVar4 = 1;

  piVar3 = (int *)(param_1 + 0x230);

  do {

    iVar2 = 10;

    if ((*piVar3 == 1) || (uVar4 == param_2)) {

      switch(uVar4) {

      case 1:

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

        break;

      case 2:

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

        break;

      case 3:

        iVar2 = *(int *)(param_1 + 400);

        break;

      case 4:

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

        break;

      case 5:

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

        break;

      case 6:

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

      }

    }

    iVar1 = iVar1 - iVar2;

    uVar4 = uVar4 + 1;

    piVar3 = piVar3 + 1;

  } while (uVar4 < 7);

  return iVar1;

}





// --- FUN_005c4ba0 at 0x005C4BA0 (size: 18) ---


void __fastcall FUN_005c4ba0(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

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

  for (iVar1 = 6; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

  return;

}





// --- FUN_005c4bc0 at 0x005C4BC0 (size: 27) ---


void __thiscall FUN_005c4bc0(int param_1,uint param_2,undefined4 param_3)



{

  if ((param_2 != 0) && (param_2 < 7)) {

    *(undefined4 *)(param_1 + 0x22c + param_2 * 4) = param_3;

  }

  return;

}





// --- FUN_005c4be0 at 0x005C4BE0 (size: 29) ---


undefined4 __thiscall FUN_005c4be0(int param_1,uint param_2)



{

  if (param_2 < *(uint *)(param_1 + 0x1ac)) {

    return *(undefined4 *)(*(int *)(param_1 + 0x1b0) + param_2 * 4);

  }

  return 0;

}





// --- FUN_005c4c00 at 0x005C4C00 (size: 231) ---


undefined4 __thiscall FUN_005c4c00(int param_1,uint param_2,int param_3)



{

  int iVar1;

  int iVar2;

  

  if (*(uint *)(param_1 + 0x1ac) <= param_2) {

    return 0;

  }

  if (3 < param_3) {

    return 0;

  }

  if (param_3 < 1) {

    return 0;

  }

  iVar1 = *(int *)(*(int *)(param_1 + 0x1b0) + param_2 * 4);

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

  if (iVar1 == 2) {

    iVar1 = FUN_005c36b0(param_2,*(undefined4 *)(param_1 + 0xd4),*(undefined4 *)(param_1 + 0xd8));

LAB_005c4c7b:

    iVar2 = iVar2 + iVar1;

  }

  else if (iVar1 == 3) {

    iVar1 = FUN_005c37b0(param_2,*(undefined4 *)(param_1 + 0xd4),*(undefined4 *)(param_1 + 0xd8));

    goto LAB_005c4c7b;

  }

  if (param_3 == 2) {

    iVar1 = FUN_005c36b0(param_2,*(undefined4 *)(param_1 + 0xd4),*(undefined4 *)(param_1 + 0xd8));

  }

  else {

    if (param_3 != 3) goto LAB_005c4cbf;

    iVar1 = FUN_005c37b0(param_2,*(undefined4 *)(param_1 + 0xd4),*(undefined4 *)(param_1 + 0xd8));

  }

  iVar2 = iVar2 - iVar1;

LAB_005c4cbf:

  if (iVar2 < 0) {

    return 0;

  }

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

  *(int *)(*(int *)(param_1 + 0x1b0) + param_2 * 4) = param_3;

  return 1;

}





// --- FUN_005c4cf0 at 0x005C4CF0 (size: 68) ---


void __thiscall FUN_005c4cf0(int param_1,char *param_2)



{

  char cVar1;

  char *pcVar2;

  int iVar3;

  

  pcVar2 = param_2;

  do {

    cVar1 = *pcVar2;

    pcVar2 = pcVar2 + 1;

  } while (cVar1 != '\0');

  if ((uint)((int)pcVar2 - (int)(param_2 + 1)) < 0x21) {

    iVar3 = (param_1 + 0x1d0) - (int)param_2;

    do {

      cVar1 = *param_2;

      param_2[iVar3] = cVar1;

      param_2 = param_2 + 1;

    } while (cVar1 != '\0');

    FUN_005be6a0(param_1 + 0x1d0);

  }

  return;

}





// --- FUN_005c4d40 at 0x005C4D40 (size: 13) ---


void __thiscall FUN_005c4d40(int param_1,undefined4 param_2)



{

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

  return;

}





// --- FUN_005c4d50 at 0x005C4D50 (size: 22) ---


void __thiscall FUN_005c4d50(int param_1,undefined4 *param_2,int param_3)



{

  *param_2 = *(undefined4 *)(*(int *)(param_1 + 0x134) + param_3 * 4);

  return;

}





// --- FUN_005c4d70 at 0x005C4D70 (size: 22) ---


void __thiscall FUN_005c4d70(int param_1,undefined4 *param_2,int param_3)



{

  *param_2 = *(undefined4 *)(*(int *)(param_1 + 0x138) + param_3 * 4);

  return;

}





// --- FUN_005c4d90 at 0x005C4D90 (size: 22) ---


void __thiscall FUN_005c4d90(int param_1,undefined4 *param_2,int param_3)



{

  *param_2 = *(undefined4 *)(*(int *)(param_1 + 0x13c) + param_3 * 4);

  return;

}





// --- FUN_005c4db0 at 0x005C4DB0 (size: 22) ---


void __thiscall FUN_005c4db0(int param_1,undefined4 *param_2,int param_3)



{

  *param_2 = *(undefined4 *)(*(int *)(param_1 + 0x140) + param_3 * 4);

  return;

}





// --- FUN_005c4dd0 at 0x005C4DD0 (size: 523) ---


void __thiscall FUN_005c4dd0(int param_1,int param_2)



{

  bool bVar1;

  int iVar2;

  

  iVar2 = (*(int *)(param_1 + 0x194) - *(int *)(param_1 + 0x19c)) + *(int *)(param_1 + 400) +

          *(int *)(param_1 + 0x18c) + *(int *)(param_1 + 0x188) + *(int *)(param_1 + 0x184) +

          *(int *)(param_1 + 0x198);

  if (0 < iVar2) {

    bVar1 = false;

    do {

      do {

        if ((((bVar1) || (DAT_008234cc == 1)) && (bVar1 = true, param_2 != 1)) &&

           ((10 < *(int *)(param_1 + 0x184) && (*(int *)(param_1 + 0x230) == 0)))) {

          iVar2 = iVar2 + -1;

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

          if (iVar2 < 1) {

            DAT_008234cc = 2;

            return;

          }

        }

        if (((bVar1) || (DAT_008234cc == 2)) &&

           ((bVar1 = true, param_2 != 2 &&

            ((10 < *(int *)(param_1 + 0x188) && (*(int *)(param_1 + 0x234) == 0)))))) {

          iVar2 = iVar2 + -1;

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

          if (iVar2 < 1) {

            DAT_008234cc = 4;

            return;

          }

        }

        if ((((bVar1) || (DAT_008234cc == 4)) && (bVar1 = true, param_2 != 4)) &&

           ((10 < *(int *)(param_1 + 0x18c) && (*(int *)(param_1 + 0x23c) == 0)))) {

          iVar2 = iVar2 + -1;

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

          if (iVar2 < 1) {

            DAT_008234cc = 3;

            return;

          }

        }

        if (((bVar1) || (DAT_008234cc == 3)) &&

           ((bVar1 = true, param_2 != 3 &&

            ((10 < *(int *)(param_1 + 400) && (*(int *)(param_1 + 0x238) == 0)))))) {

          iVar2 = iVar2 + -1;

          *(int *)(param_1 + 400) = *(int *)(param_1 + 400) + -1;

          if (iVar2 < 1) {

            DAT_008234cc = 5;

            return;

          }

        }

        if ((((bVar1) || (DAT_008234cc == 5)) && (bVar1 = true, param_2 != 5)) &&

           ((10 < *(int *)(param_1 + 0x194) && (*(int *)(param_1 + 0x240) == 0)))) {

          iVar2 = iVar2 + -1;

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

          if (iVar2 < 1) {

            DAT_008234cc = 6;

            return;

          }

        }

      } while (((!bVar1) && (DAT_008234cc != 6)) ||

              ((bVar1 = true, param_2 == 6 ||

               ((*(int *)(param_1 + 0x198) < 0xb || (*(int *)(param_1 + 0x244) != 0))))));

      iVar2 = iVar2 + -1;

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

    } while (0 < iVar2);

    DAT_008234cc = 1;

  }

  return;

}





// --- FUN_005c4fe0 at 0x005C4FE0 (size: 41) ---


void __thiscall FUN_005c4fe0(int param_1,int param_2)



{

  if ((-1 < param_2) && (param_2 < *(int *)(*(int *)(param_1 + 0x254) + 0x38))) {

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

    return;

  }

  *(undefined4 *)(param_1 + 0x1f8) = 0xffffffff;

  return;

}





// --- FUN_005c5010 at 0x005C5010 (size: 874) ---


undefined4 * __fastcall FUN_005c5010(undefined4 *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int *piVar5;

  LONG LVar6;

  undefined4 *local_4;

  

  param_1[3] = param_1[0x35];

  param_1[4] = param_1[0x36];

  param_1[6] = param_1[0x38];

  param_1[7] = param_1[0x39];

  param_1[5] = param_1[0x37];

  param_1[9] = param_1[0x3b];

  iVar1 = param_1[0x3e];

  param_1[10] = param_1[0x3c];

  param_1[8] = param_1[0x3a];

  param_1[0xb] = param_1[0x3d];

  if ((iVar1 < (int)param_1[0x45]) && (-1 < iVar1)) {

    uVar3 = *(undefined4 *)(param_1[0x49] + iVar1 * 4);

  }

  else {

    uVar3 = 0;

  }

  param_1[0xf] = uVar3;

  iVar1 = param_1[0x40];

  *(undefined8 *)(param_1 + 0x18) = *(undefined8 *)(param_1 + 0x56);

  param_1[0xc] = param_1[0x3f];

  if ((iVar1 < (int)param_1[0x46]) && (-1 < iVar1)) {

    uVar3 = *(undefined4 *)(param_1[0x4a] + iVar1 * 4);

  }

  else {

    uVar3 = 0;

  }

  param_1[0x10] = uVar3;

  iVar1 = param_1[0x42];

  *(undefined8 *)(param_1 + 0x1a) = *(undefined8 *)(param_1 + 0x58);

  param_1[0xd] = param_1[0x41];

  if ((iVar1 < (int)param_1[0x47]) && (-1 < iVar1)) {

    uVar3 = *(undefined4 *)(param_1[0x4b] + iVar1 * 4);

  }

  else {

    uVar3 = 0;

  }

  param_1[0x11] = uVar3;

  iVar1 = param_1[0x44];

  *(undefined8 *)(param_1 + 0x1c) = *(undefined8 *)(param_1 + 0x5a);

  param_1[0xe] = param_1[0x43];

  if ((iVar1 < (int)param_1[0x48]) && (-1 < iVar1)) {

    uVar3 = *(undefined4 *)(param_1[0x4c] + iVar1 * 4);

  }

  else {

    uVar3 = 0;

  }

  param_1[0x12] = uVar3;

  *(undefined8 *)(param_1 + 0x1e) = *(undefined8 *)(param_1 + 0x5c);

  param_1[0x21] = param_1[0x61];

  param_1[0x20] = param_1[0x60];

  *(undefined8 *)(param_1 + 0x14) = *(undefined8 *)(param_1 + 0x52);

  param_1[0x24] = param_1[100];

  param_1[0x22] = param_1[0x62];

  param_1[0x23] = param_1[99];

  *(undefined8 *)(param_1 + 0x16) = *(undefined8 *)(param_1 + 0x54);

  param_1[0x25] = param_1[0x65];

  param_1[0x26] = param_1[0x66];

  local_4 = param_1;

  if ((void *)param_1[0x28] != (void *)0x0) {

    operator_delete__((void *)param_1[0x28]);

    param_1[0x28] = 0;

  }

  iVar1 = param_1[0x6b];

  param_1[0x27] = iVar1;

  if (0 < iVar1) {

    uVar3 = thunk_FUN_005df0f5(iVar1 << 2);

    param_1[0x28] = uVar3;

    uVar4 = 0;

    if (param_1[0x6b] != 0) {

      do {

        *(undefined4 *)(param_1[0x28] + uVar4 * 4) = *(undefined4 *)(param_1[0x6c] + uVar4 * 4);

        uVar4 = uVar4 + 1;

      } while (uVar4 < (uint)param_1[0x6b]);

    }

  }

  piVar5 = (int *)FUN_0048c3e0(param_1 + 0x74);

  puVar2 = (undefined4 *)param_1[0x29];

  if (puVar2 != (undefined4 *)*piVar5) {

    LVar6 = InterlockedDecrement(puVar2 + 1);

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

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

    }

    iVar1 = *piVar5;

    param_1[0x29] = iVar1;

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

  }

  puVar2 = local_4;

  LVar6 = InterlockedDecrement(local_4 + 1);

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

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

  }

  param_1[0x2c] = param_1[0x7e];

  param_1[0x2a] = param_1[0x82];

  if (param_1[3] == 0xc) {

    if (param_1[0x89] == 0) {

      FUN_00415640(&local_4,0x10000090,0xc);

      param_1[0x2b] = local_4;

      return param_1 + 2;

    }

    FUN_00415640(&local_4,0x10000092,0xc);

    param_1[0x2b] = local_4;

  }

  else {

    if (param_1[3] == 0xd) {

      if (param_1[0x89] == 0) {

        FUN_00415640(&local_4,0x10000091,0xc);

        param_1[0x2b] = local_4;

        return param_1 + 2;

      }

      uVar3 = 0x10000093;

    }

    else {

      FUN_00415640(&local_4,0x10000003,0xc);

      param_1[0x2b] = local_4;

      if (param_1[0x89] == 0) goto LAB_005c5379;

      uVar3 = 0x10000004;

    }

    FUN_00415640(&local_4,uVar3,0xc);

    param_1[0x2b] = local_4;

  }

  param_1[0x2d] = 1;

  if (param_1[0x8a] != 0) {

    param_1[0x2e] = 1;

  }

LAB_005c5379:

  return param_1 + 2;

}





// --- FUN_005c5390 at 0x005C5390 (size: 281) ---


void __fastcall FUN_005c5390(int param_1)



{

  int iVar1;

  uint uVar2;

  uint *puVar3;

  int iVar4;

  int iVar5;

  uint uVar6;

  

  *(undefined4 *)(param_1 + 0x1b8) = *(undefined4 *)(param_1 + 0x1b4);

  if (((*(int *)(param_1 + 0x1b0) != 0) && (*(int *)(param_1 + 0xd4) != 0)) &&

     (*(int *)(param_1 + 0xd8) != -1)) {

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

    uVar6 = 1;

    if (1 < *(int *)(param_1 + 0x1ac)) {

      do {

        uVar2 = *(uint *)(iVar1 + 0x44);

        if ((uVar2 != 0) && (iVar4 = *(int *)(iVar1 + 0x40), iVar4 != 0)) {

          for (puVar3 = *(uint **)(iVar4 + (uVar6 % uVar2) * 4); puVar3 != (uint *)0x0;

              puVar3 = (uint *)puVar3[0x18]) {

            if (uVar6 == *puVar3) {

              if (puVar3 != (uint *)0xfffffff8) {

                iVar4 = FUN_005c36b0(uVar6,*(undefined4 *)(param_1 + 0xd4),

                                     *(undefined4 *)(param_1 + 0xd8));

                iVar5 = FUN_005c37b0(uVar6,*(undefined4 *)(param_1 + 0xd4),

                                     *(undefined4 *)(param_1 + 0xd8));

                if ((-1 < iVar4) && (-1 < iVar5)) {

                  if (iVar4 < 1) {

                    if (iVar5 < 1) {

                      *(undefined4 *)(*(int *)(param_1 + 0x1b0) + uVar6 * 4) = 3;

                    }

                    else {

                      *(undefined4 *)(*(int *)(param_1 + 0x1b0) + uVar6 * 4) = 2;

                    }

                  }

                  else {

                    *(undefined4 *)(*(int *)(param_1 + 0x1b0) + uVar6 * 4) = 1;

                  }

                }

              }

              break;

            }

          }

        }

        uVar6 = uVar6 + 1;

      } while ((int)uVar6 < *(int *)(param_1 + 0x1ac));

    }

  }

  return;

}





// --- FUN_005c54b0 at 0x005C54B0 (size: 397) ---


void FUN_005c54b0(undefined4 param_1,int *param_2,int *param_3,int *param_4,int param_5)



{

  int iVar1;

  undefined4 uVar2;

  int *piVar3;

  int iVar4;

  int *piVar5;

  uint uVar6;

  int *piVar7;

  int local_18;

  int local_14;

  undefined1 local_10 [4];

  int *local_c;

  int local_8;

  uint local_4;

  

  *param_2 = 0;

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

    operator_delete__((void *)*param_3);

  }

  *param_3 = 0;

  if (*param_4 != 0) {

    operator_delete__((void *)(*param_4 + -4));

  }

  *param_4 = 0;

  uVar2 = FUN_004220b0(param_1,0x19);

  piVar3 = (int *)FUN_00415430(uVar2);

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

    iVar1 = piVar3[0x17];

    if (0 < iVar1) {

      iVar4 = thunk_FUN_005df0f5(iVar1 * 4);

      *param_3 = iVar4;

      piVar5 = (int *)thunk_FUN_005df0f5(iVar1 * 4 + 4);

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

        piVar7 = (int *)0x0;

      }

      else {

        piVar7 = piVar5 + 1;

        *piVar5 = iVar1;

        FUN_00401000(piVar7,4,iVar1,FUN_0050a140);

      }

      *param_4 = (int)piVar7;

    }

    FUN_005a8530(local_10);

    FUN_005a9520();

joined_r0x005c5581:

    piVar5 = local_c;

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

      FUN_005a9930(piVar5 + 1);

      if (local_18 != 0) {

        uVar6 = 0;

        if (*(uint *)(param_5 + 0xd8) != 0) {

          piVar7 = *(int **)(param_5 + 0xd0);

          do {

            if (*piVar7 == *piVar5) {

              if (uVar6 != 0xffffffff) {

                *(int *)(*param_3 + *param_2 * 4) = *piVar5;

                *(undefined4 *)(*param_4 + *param_2 * 4) = *(undefined4 *)(local_14 + 0x10);

                *param_2 = *param_2 + 1;

              }

              break;

            }

            uVar6 = uVar6 + 1;

            piVar7 = piVar7 + 1;

          } while (uVar6 < *(uint *)(param_5 + 0xd8));

        }

      }

      local_c = (int *)piVar5[5];

      if ((int *)piVar5[5] == (int *)0x0) {

        uVar6 = piVar5[6];

        do {

          uVar6 = uVar6 + 1;

          if (local_4 <= uVar6) {

            local_c = (int *)0x0;

            goto joined_r0x005c5581;

          }

        } while (*(int *)(local_8 + uVar6 * 4) == 0);

        local_c = *(int **)(local_8 + uVar6 * 4);

      }

      goto joined_r0x005c5581;

    }

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

    FUN_005a9540();

  }

  return;

}





// --- FUN_005c5640 at 0x005C5640 (size: 120) ---


int __thiscall FUN_005c5640(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  int extraout_ECX;

  int extraout_ECX_00;

  

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

  if (iVar1 < param_2) {

    iVar2 = FUN_005c4b00(1);

    param_1 = extraout_ECX;

    if (iVar2 == 0) {

      return iVar1;

    }

  }

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

  if (param_3 != 0) {

    FUN_005c4dd0(1);

    param_1 = extraout_ECX_00;

  }

  *(int *)(param_1 + 0x1a0) =

       (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x198)) - *(int *)(param_1 + 0x194)) -

         *(int *)(param_1 + 400)) - *(int *)(param_1 + 0x18c)) - *(int *)(param_1 + 0x188)) -

       *(int *)(param_1 + 0x184);

  return *(int *)(param_1 + 0x184);

}





// --- FUN_005c56c0 at 0x005C56C0 (size: 120) ---


int __thiscall FUN_005c56c0(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  int extraout_ECX;

  int extraout_ECX_00;

  

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

  if (iVar1 < param_2) {

    iVar2 = FUN_005c4b00(2);

    param_1 = extraout_ECX;

    if (iVar2 == 0) {

      return iVar1;

    }

  }

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

  if (param_3 != 0) {

    FUN_005c4dd0(2);

    param_1 = extraout_ECX_00;

  }

  *(int *)(param_1 + 0x1a0) =

       (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x198)) - *(int *)(param_1 + 0x194)) -

         *(int *)(param_1 + 400)) - *(int *)(param_1 + 0x18c)) - *(int *)(param_1 + 0x184)) -

       *(int *)(param_1 + 0x188);

  return *(int *)(param_1 + 0x188);

}





// --- FUN_005c5740 at 0x005C5740 (size: 120) ---


int __thiscall FUN_005c5740(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  int extraout_ECX;

  int extraout_ECX_00;

  

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

  if (iVar1 < param_2) {

    iVar2 = FUN_005c4b00(4);

    param_1 = extraout_ECX;

    if (iVar2 == 0) {

      return iVar1;

    }

  }

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

  if (param_3 != 0) {

    FUN_005c4dd0(4);

    param_1 = extraout_ECX_00;

  }

  *(int *)(param_1 + 0x1a0) =

       (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x198)) - *(int *)(param_1 + 0x194)) -

         *(int *)(param_1 + 400)) - *(int *)(param_1 + 0x188)) - *(int *)(param_1 + 0x184)) -

       *(int *)(param_1 + 0x18c);

  return *(int *)(param_1 + 0x18c);

}





// --- FUN_005c57c0 at 0x005C57C0 (size: 120) ---


int __thiscall FUN_005c57c0(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  int extraout_ECX;

  int extraout_ECX_00;

  

  iVar1 = *(int *)(param_1 + 400);

  if (iVar1 < param_2) {

    iVar2 = FUN_005c4b00(3);

    param_1 = extraout_ECX;

    if (iVar2 == 0) {

      return iVar1;

    }

  }

  *(int *)(param_1 + 400) = param_2;

  if (param_3 != 0) {

    FUN_005c4dd0(3);

    param_1 = extraout_ECX_00;

  }

  *(int *)(param_1 + 0x1a0) =

       (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x198)) - *(int *)(param_1 + 0x194)) -

         *(int *)(param_1 + 0x18c)) - *(int *)(param_1 + 0x188)) - *(int *)(param_1 + 0x184)) -

       *(int *)(param_1 + 400);

  return *(int *)(param_1 + 400);

}





// --- FUN_005c5840 at 0x005C5840 (size: 120) ---


int __thiscall FUN_005c5840(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  int extraout_ECX;

  int extraout_ECX_00;

  

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

  if (iVar1 < param_2) {

    iVar2 = FUN_005c4b00(5);

    param_1 = extraout_ECX;

    if (iVar2 == 0) {

      return iVar1;

    }

  }

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

  if (param_3 != 0) {

    FUN_005c4dd0(5);

    param_1 = extraout_ECX_00;

  }

  *(int *)(param_1 + 0x1a0) =

       (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x198)) - *(int *)(param_1 + 400)) -

         *(int *)(param_1 + 0x18c)) - *(int *)(param_1 + 0x188)) - *(int *)(param_1 + 0x184)) -

       *(int *)(param_1 + 0x194);

  return *(int *)(param_1 + 0x194);

}





// --- FUN_005c58c0 at 0x005C58C0 (size: 120) ---


int __thiscall FUN_005c58c0(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  int extraout_ECX;

  int extraout_ECX_00;

  

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

  if (iVar1 < param_2) {

    iVar2 = FUN_005c4b00(6);

    param_1 = extraout_ECX;

    if (iVar2 == 0) {

      return iVar1;

    }

  }

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

  if (param_3 != 0) {

    FUN_005c4dd0(6);

    param_1 = extraout_ECX_00;

  }

  *(int *)(param_1 + 0x1a0) =

       (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x194)) - *(int *)(param_1 + 400)) -

         *(int *)(param_1 + 0x18c)) - *(int *)(param_1 + 0x188)) - *(int *)(param_1 + 0x184)) -

       *(int *)(param_1 + 0x198);

  return *(int *)(param_1 + 0x198);

}





// --- FUN_005c5940 at 0x005C5940 (size: 39) ---


int __thiscall FUN_005c5940(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;

    do {

      if (uVar2 == param_2) {

        return iVar1;

      }

      if (iVar1 != 0) {

        iVar1 = *(int *)(iVar1 + 4);

      }

      uVar2 = uVar2 + 1;

    } while (iVar1 != 0);

  }

  return 0;

}





// --- FUN_005c5970 at 0x005C5970 (size: 440) ---


void __fastcall FUN_005c5970(int param_1)



{

  int iVar1;

  int extraout_ECX;

  int extraout_ECX_00;

  int extraout_ECX_01;

  int extraout_ECX_02;

  int extraout_ECX_03;

  int extraout_ECX_04;

  

  if (*(int *)(param_1 + 0x184) < 0x32) {

    iVar1 = FUN_005c4b00(1);

    param_1 = extraout_ECX;

    if (iVar1 != 0) goto LAB_005c598b;

  }

  else {

LAB_005c598b:

    *(undefined4 *)(param_1 + 0x184) = 0x32;

    *(int *)(param_1 + 0x1a0) =

         (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x198)) - *(int *)(param_1 + 0x194)) -

           *(int *)(param_1 + 400)) - *(int *)(param_1 + 0x18c)) - *(int *)(param_1 + 0x188)) +

         -0x32;

  }

  if (*(int *)(param_1 + 0x188) < 0x32) {

    iVar1 = FUN_005c4b00(2);

    param_1 = extraout_ECX_00;

    if (iVar1 != 0) goto LAB_005c59d2;

  }

  else {

LAB_005c59d2:

    *(undefined4 *)(param_1 + 0x188) = 0x32;

    *(int *)(param_1 + 0x1a0) =

         (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x198)) - *(int *)(param_1 + 0x194)) -

           *(int *)(param_1 + 400)) - *(int *)(param_1 + 0x18c)) - *(int *)(param_1 + 0x184)) +

         -0x32;

  }

  if (*(int *)(param_1 + 0x18c) < 0x32) {

    iVar1 = FUN_005c4b00(4);

    param_1 = extraout_ECX_01;

    if (iVar1 != 0) goto LAB_005c5a19;

  }

  else {

LAB_005c5a19:

    *(undefined4 *)(param_1 + 0x18c) = 0x32;

    *(int *)(param_1 + 0x1a0) =

         (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x198)) - *(int *)(param_1 + 0x194)) -

           *(int *)(param_1 + 400)) - *(int *)(param_1 + 0x188)) - *(int *)(param_1 + 0x184)) +

         -0x32;

  }

  if (*(int *)(param_1 + 400) < 0x32) {

    iVar1 = FUN_005c4b00(3);

    param_1 = extraout_ECX_02;

    if (iVar1 != 0) goto LAB_005c5a60;

  }

  else {

LAB_005c5a60:

    *(undefined4 *)(param_1 + 400) = 0x32;

    *(int *)(param_1 + 0x1a0) =

         (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x198)) - *(int *)(param_1 + 0x194)) -

           *(int *)(param_1 + 0x18c)) - *(int *)(param_1 + 0x188)) - *(int *)(param_1 + 0x184)) +

         -0x32;

  }

  if (*(int *)(param_1 + 0x194) < 0x32) {

    iVar1 = FUN_005c4b00(5);

    param_1 = extraout_ECX_03;

    if (iVar1 != 0) goto LAB_005c5aa7;

  }

  else {

LAB_005c5aa7:

    *(undefined4 *)(param_1 + 0x194) = 0x32;

    *(int *)(param_1 + 0x1a0) =

         (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x198)) - *(int *)(param_1 + 400)) -

           *(int *)(param_1 + 0x18c)) - *(int *)(param_1 + 0x188)) - *(int *)(param_1 + 0x184)) +

         -0x32;

  }

  if (*(int *)(param_1 + 0x198) < 0x32) {

    iVar1 = FUN_005c4b00(6);

    param_1 = extraout_ECX_04;

    if (iVar1 == 0) goto LAB_005c5b22;

  }

  *(undefined4 *)(param_1 + 0x198) = 0x32;

  *(int *)(param_1 + 0x1a0) =

       (((((*(int *)(param_1 + 0x19c) - *(int *)(param_1 + 0x194)) - *(int *)(param_1 + 400)) -

         *(int *)(param_1 + 0x18c)) - *(int *)(param_1 + 0x188)) - *(int *)(param_1 + 0x184)) +

       -0x32;

LAB_005c5b22:

  FUN_005c5390();

  return;

}





// --- FUN_005c5b30 at 0x005C5B30 (size: 243) ---


int __thiscall FUN_005c5b30(int param_1,uint param_2)



{

  int iVar1;

  undefined4 uVar2;

  int iVar3;

  undefined8 uVar4;

  undefined4 uVar5;

  int *piVar6;

  int local_78;

  undefined **local_74;

  undefined4 local_70;

  undefined4 local_6c;

  undefined4 local_68;

  undefined4 local_64;

  undefined4 local_60;

  undefined4 local_5c;

  undefined1 local_58 [32];

  int local_38;

  undefined4 local_30;

  undefined4 local_2c;

  undefined4 local_28;

  undefined4 local_24;

  undefined4 local_20;

  undefined4 local_1c;

  

  FUN_004f1ef0();

  iVar1 = FUN_004f2510(param_2,local_58);

  if (iVar1 != 0) {

    local_70 = local_30;

    local_64 = local_24;

    local_6c = local_2c;

    local_68 = local_28;

    local_74 = &PTR_FUN_007a11bc;

    local_60 = local_20;

    local_5c = local_1c;

    if (param_2 < *(uint *)(param_1 + 0x1ac)) {

      iVar1 = *(int *)(*(int *)(param_1 + 0x1b0) + param_2 * 4);

    }

    else {

      iVar1 = 0;

    }

    if (local_38 <= iVar1) {

      piVar6 = &local_78;

      local_78 = 0;

      uVar4 = FUN_005c4990(local_1c);

      uVar5 = (undefined4)uVar4;

      uVar2 = FUN_005c4990((int)((ulonglong)uVar4 >> 0x20));

      iVar3 = FUN_00592660(uVar2,uVar5,piVar6);

      if (iVar3 != 0) {

        if (iVar1 == 2) {

          local_78 = local_78 + 5;

        }

        else if (iVar1 == 3) {

          local_78 = local_78 + 10;

        }

        FUN_004f1f70();

        return local_78;

      }

    }

  }

  FUN_004f1f70();

  return 0;

}





// --- FUN_005c5c30 at 0x005C5C30 (size: 180) ---


uint __thiscall FUN_005c5c30(int param_1,uint param_2,undefined4 *param_3)



{

  undefined4 uVar1;

  uint in_EAX;

  undefined4 *puVar2;

  int iVar3;

  

  if (*(uint *)(param_1 + 0xc) < param_2) {

    return in_EAX & 0xffffff00;

  }

  puVar2 = (undefined4 *)FUN_005df0f5(0xc);

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

    *puVar2 = *param_3;

    puVar2[1] = 0;

    puVar2[2] = 0;

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

      iVar3 = FUN_005c5940(param_2);

      if (iVar3 == 0) {

        iVar3 = *(int *)(param_1 + 8);

        *(undefined4 **)(iVar3 + 4) = puVar2;

        puVar2[2] = iVar3;

        *(undefined4 **)(param_1 + 8) = puVar2;

        iVar3 = *(int *)(param_1 + 0xc) + 1;

        *(int *)(param_1 + 0xc) = iVar3;

        return CONCAT31((int3)((uint)iVar3 >> 8),1);

      }

      if (*(int *)(iVar3 + 8) == 0) {

        *(undefined4 **)(param_1 + 4) = puVar2;

      }

      else {

        *(undefined4 **)(*(int *)(iVar3 + 8) + 4) = puVar2;

      }

      uVar1 = *(undefined4 *)(iVar3 + 8);

      puVar2[1] = iVar3;

      puVar2[2] = uVar1;

      *(undefined4 **)(iVar3 + 8) = puVar2;

      iVar3 = *(int *)(param_1 + 0xc) + 1;

      *(int *)(param_1 + 0xc) = iVar3;

      return CONCAT31((int3)((uint)iVar3 >> 8),1);

    }

    if (param_2 == 0) {

      *(undefined4 **)(param_1 + 4) = puVar2;

      *(undefined4 **)(param_1 + 8) = puVar2;

      iVar3 = *(int *)(param_1 + 0xc) + 1;

      *(int *)(param_1 + 0xc) = iVar3;

      return CONCAT31((int3)((uint)iVar3 >> 8),1);

    }

  }

  return 0;

}





// --- FUN_005c5cf0 at 0x005C5CF0 (size: 129) ---


undefined4 * __thiscall FUN_005c5cf0(undefined4 *param_1,int param_2)



{

  int iVar1;

  

  *param_1 = &PTR_LAB_007a0ec8;

  iVar1 = *(int *)(param_2 + 4);

  param_1[1] = iVar1;

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

  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);

  param_1[7] = *(undefined4 *)(param_2 + 0x1c);

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

  param_1[9] = *(undefined4 *)(param_2 + 0x24);

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  FUN_005c0220(param_2 + 0x28);

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  FUN_005c0220(param_2 + 0x34);

  return param_1;

}





// --- FUN_005c5d80 at 0x005C5D80 (size: 36) ---


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



{

  *param_1 = &PTR_FUN_007e88d0;

  FUN_0049f850();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005c5db0 at 0x005C5DB0 (size: 311) ---


void __fastcall FUN_005c5db0(undefined4 *param_1)



{

  undefined4 *puVar1;

  int iVar2;

  void *pvVar3;

  

  *param_1 = &PTR_FUN_007e88d4;

  if ((void *)param_1[0x6c] != (void *)0x0) {

    operator_delete__((void *)param_1[0x6c]);

  }

  (**(code **)(*(int *)param_1[0x92] + 0x14))();

  while (puVar1 = (undefined4 *)param_1[0x71], puVar1 != (undefined4 *)0x0) {

    iVar2 = puVar1[1];

    param_1[0x71] = iVar2;

    if (iVar2 == 0) {

      param_1[0x72] = 0;

    }

    else {

      *(undefined4 *)(iVar2 + 8) = 0;

    }

    pvVar3 = (void *)*puVar1;

    operator_delete(puVar1);

    param_1[0x73] = param_1[0x73] + -1;

    operator_delete(pvVar3);

  }

  if ((void *)param_1[0x49] != (void *)0x0) {

    operator_delete__((void *)param_1[0x49]);

  }

  if ((void *)param_1[0x4a] != (void *)0x0) {

    operator_delete__((void *)param_1[0x4a]);

  }

  if ((void *)param_1[0x4b] != (void *)0x0) {

    operator_delete__((void *)param_1[0x4b]);

  }

  if ((void *)param_1[0x4c] != (void *)0x0) {

    operator_delete__((void *)param_1[0x4c]);

  }

  if (param_1[0x4d] != 0) {

    operator_delete__((void *)(param_1[0x4d] + -4));

  }

  if (param_1[0x4e] != 0) {

    operator_delete__((void *)(param_1[0x4e] + -4));

  }

  if (param_1[0x4f] != 0) {

    operator_delete__((void *)(param_1[0x4f] + -4));

  }

  if (param_1[0x50] != 0) {

    operator_delete__((void *)(param_1[0x50] + -4));

  }

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

    (**(code **)(*(int *)param_1[0x95] + 0x14))();

    param_1[0x95] = 0;

  }

  param_1[0x70] = &PTR_FUN_007e88d0;

  FUN_0049f850();

  FUN_005c8190();

  return;

}





// --- FUN_005c5ef0 at 0x005C5EF0 (size: 354) ---


void __thiscall FUN_005c5ef0(int *param_1,int param_2)



{

  int iVar1;

  float10 fVar2;

  undefined1 *puVar3;

  undefined1 local_19c [96];

  int iStack_13c;

  int iStack_130;

  int iStack_124;

  int local_118;

  int local_10c;

  int iStack_100;

  undefined1 local_c0 [192];

  

  if ((param_1[0x35] != 0) && (iVar1 = param_1[0x36], iVar1 != 0)) {

    puVar3 = local_19c;

    FUN_005c3380(local_c0,param_1[0x35]);

    FUN_005c2b30(puVar3,iVar1);

    FUN_0047e300();

    if (local_118 != 0) {

      iVar1 = (**(code **)(*param_1 + 4))(local_118,param_1[0x37]);

      param_1[0x37] = iVar1;

    }

    if (local_10c != 0) {

      iVar1 = (**(code **)(*param_1 + 4))(local_10c,param_1[0x38]);

      param_1[0x38] = iVar1;

    }

    if (iStack_100 != 0) {

      iVar1 = (**(code **)(*param_1 + 4))(iStack_100,param_1[0x39]);

      param_1[0x39] = iVar1;

    }

    fVar2 = (float10)(**(code **)(*param_1 + 0xc))();

    *(double *)(param_1 + 0x52) = (double)fVar2;

    (**(code **)*param_1)();

    fVar2 = (float10)(**(code **)(*param_1 + 0xc))();

    *(double *)(param_1 + 0x54) = (double)fVar2;

    (**(code **)*param_1)();

    if (iStack_13c != 0) {

      iVar1 = (**(code **)(*param_1 + 4))(iStack_13c,param_1[0x3a]);

      param_1[0x3a] = iVar1;

      (**(code **)*param_1)();

    }

    if (iStack_124 != 0) {

      iVar1 = (**(code **)(*param_1 + 4))(iStack_124,param_1[0x3b]);

      param_1[0x3b] = iVar1;

      (**(code **)*param_1)();

    }

    if (iStack_130 != 0) {

      if (param_2 == 0) {

        iVar1 = (**(code **)(*param_1 + 4))(iStack_130,param_1[0x3c]);

      }

      else {

        iVar1 = (**(code **)(*param_1 + 4))(7);

      }

      param_1[0x3c] = iVar1;

    }

    FUN_0047daa0();

  }

  return;

}





// --- FUN_005c6060 at 0x005C6060 (size: 534) ---


void __fastcall FUN_005c6060(int param_1)



{

  uint uVar1;

  LONG LVar2;

  int iVar3;

  int iVar4;

  undefined4 *puVar5;

  uint uVar6;

  int local_fc;

  undefined4 local_f0;

  undefined4 local_ec;

  undefined4 local_e8;

  undefined4 local_e4;

  undefined4 local_e0;

  undefined4 local_dc;

  void *local_d8;

  uint local_d4;

  uint local_d0;

  void *local_cc;

  uint local_c8;

  uint local_c4;

  undefined1 local_c0 [192];

  

  puVar5 = (undefined4 *)(param_1 + 0x230);

  for (iVar3 = 6; iVar3 != 0; iVar3 = iVar3 + -1) {

    *puVar5 = 0;

    puVar5 = puVar5 + 1;

  }

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

  if ((iVar3 == 0xc) || (iVar3 == 0xd)) {

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

  }

  if (((iVar3 != 0) && (*(int *)(param_1 + 0xd8) != 0)) &&

     (iVar4 = *(int *)(param_1 + 0x180), iVar4 != -1)) {

    iVar3 = FUN_005c3380(local_c0,iVar3);

    FUN_005c5cf0(iVar4 * 0x40 + *(int *)(iVar3 + 0x40));

    FUN_0047e300();

    FUN_005c5640(local_f0,0);

    FUN_005c56c0(local_ec,0);

    FUN_005c5740(local_e8,0);

    FUN_005c57c0(local_e4,0);

    FUN_005c5840(local_e0,0);

    FUN_005c58c0(local_dc,0);

    FUN_005c5390();

    uVar6 = 0;

    if (local_d0 != 0) {

      do {

        FUN_005c4c00(*(undefined4 *)((int)local_d8 + uVar6 * 4),2);

        uVar6 = uVar6 + 1;

      } while (uVar6 < local_d0);

    }

    uVar6 = 0;

    if (local_c4 != 0) {

      do {

        uVar1 = *(uint *)((int)local_cc + uVar6 * 4);

        if (uVar1 < *(uint *)(param_1 + 0x1ac)) {

          iVar3 = *(int *)(*(int *)(param_1 + 0x1b0) + uVar1 * 4);

          iVar4 = *(int *)(param_1 + 0x1b8);

          if (iVar3 == 2) {

            iVar3 = FUN_005c36b0(uVar1,*(undefined4 *)(param_1 + 0xd4),

                                 *(undefined4 *)(param_1 + 0xd8));

LAB_005c61d2:

            iVar4 = iVar4 + iVar3;

          }

          else if (iVar3 == 3) {

            iVar3 = FUN_005c37b0(uVar1,*(undefined4 *)(param_1 + 0xd4),

                                 *(undefined4 *)(param_1 + 0xd8));

            goto LAB_005c61d2;

          }

          iVar3 = FUN_005c37b0(uVar1,*(undefined4 *)(param_1 + 0xd4),*(undefined4 *)(param_1 + 0xd8)

                              );

          if (-1 < iVar4 - iVar3) {

            *(int *)(param_1 + 0x1b8) = iVar4 - iVar3;

            *(undefined4 *)(*(int *)(param_1 + 0x1b0) + uVar1 * 4) = 3;

          }

        }

        uVar6 = uVar6 + 1;

      } while (uVar6 < local_c4);

    }

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

      operator_delete__(local_cc);

    }

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

      operator_delete__(local_d8);

    }

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

    if ((LVar2 == 0) && ((undefined4 *)(local_fc + -0x14) != (undefined4 *)0x0)) {

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

    }

  }

  return;

}





// --- FUN_005c6280 at 0x005C6280 (size: 175) ---


undefined1 __fastcall FUN_005c6280(int param_1)



{

  undefined1 *puVar1;

  int iVar2;

  undefined1 local_1d0;

  undefined1 local_19c [100];

  int local_138;

  undefined1 local_c0 [192];

  

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar2 = *(int *)(param_1 + 0xd8), iVar2 != 0)) {

    puVar1 = local_19c;

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar1,iVar2);

    FUN_0047e300();

    if (*(int *)(param_1 + 0xf0) != -1) {

      FUN_004df000(*(int *)(param_1 + 0xf0) * 0x3c + local_138);

      FUN_005aca00();

      FUN_0047daa0();

      return local_1d0;

    }

    FUN_0047daa0();

  }

  return 0;

}





// --- FUN_005c6330 at 0x005C6330 (size: 299) ---


int __thiscall FUN_005c6330(int param_1,int param_2)



{

  int *piVar1;

  LONG LVar2;

  undefined1 *puVar3;

  int iVar4;

  int local_1a8;

  undefined4 local_1a4;

  undefined1 local_19c [160];

  int local_fc;

  undefined1 local_c0 [192];

  

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

  *piVar1 = 0;

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar4 = *(int *)(param_1 + 0xd8), iVar4 != 0)) {

    puVar3 = local_19c;

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar3,iVar4);

    FUN_0047e300();

    if (param_2 != -1) {

      FUN_005bfa20(param_2 * 0x10 + local_fc);

      FUN_005c54b0(local_1a4,piVar1,param_1 + 0x124,param_1 + 0x134,local_19c);

      if (*(int *)(param_1 + 0xf8) < 0) {

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

      }

      if (*piVar1 <= *(int *)(param_1 + 0xf8)) {

        *(int *)(param_1 + 0xf8) = *piVar1 + -1;

      }

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

      if ((LVar2 == 0) && ((undefined4 *)(local_1a8 + -0x14) != (undefined4 *)0x0)) {

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

      }

    }

    FUN_0047daa0();

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

    return param_2;

  }

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

  return param_2;

}





// --- FUN_005c6460 at 0x005C6460 (size: 275) ---


int __thiscall FUN_005c6460(int param_1,int param_2)



{

  int *piVar1;

  LONG LVar2;

  undefined1 *puVar3;

  int iVar4;

  int local_1a8;

  undefined4 local_1a4;

  undefined1 local_19c [172];

  int local_f0;

  undefined1 local_c0 [192];

  

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

  *piVar1 = 0;

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar4 = *(int *)(param_1 + 0xd8), iVar4 != 0)) {

    puVar3 = local_19c;

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar3,iVar4);

    FUN_0047e300();

    if (param_2 != -1) {

      FUN_005bfa20(param_2 * 0x10 + local_f0);

      FUN_005c54b0(local_1a4,piVar1,param_1 + 0x128,param_1 + 0x138,local_19c);

      if (*piVar1 <= *(int *)(param_1 + 0x100)) {

        *(int *)(param_1 + 0x100) = *piVar1 + -1;

      }

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

      if ((LVar2 == 0) && ((undefined4 *)(local_1a8 + -0x14) != (undefined4 *)0x0)) {

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

      }

    }

    FUN_0047daa0();

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

    return param_2;

  }

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

  return param_2;

}





// --- FUN_005c6580 at 0x005C6580 (size: 275) ---


int __thiscall FUN_005c6580(int param_1,int param_2)



{

  int *piVar1;

  LONG LVar2;

  undefined1 *puVar3;

  int iVar4;

  int local_1a8;

  undefined4 local_1a4;

  undefined1 local_19c [184];

  int local_e4;

  undefined1 local_c0 [192];

  

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

  *piVar1 = 0;

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar4 = *(int *)(param_1 + 0xd8), iVar4 != 0)) {

    puVar3 = local_19c;

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar3,iVar4);

    FUN_0047e300();

    if (param_2 != -1) {

      FUN_005bfa20(param_2 * 0x10 + local_e4);

      FUN_005c54b0(local_1a4,piVar1,param_1 + 300,param_1 + 0x13c,local_19c);

      if (*piVar1 <= *(int *)(param_1 + 0x108)) {

        *(int *)(param_1 + 0x108) = *piVar1 + -1;

      }

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

      if ((LVar2 == 0) && ((undefined4 *)(local_1a8 + -0x14) != (undefined4 *)0x0)) {

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

      }

    }

    FUN_0047daa0();

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

    return param_2;

  }

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

  return param_2;

}





// --- FUN_005c66a0 at 0x005C66A0 (size: 275) ---


int __thiscall FUN_005c66a0(int param_1,int param_2)



{

  int *piVar1;

  LONG LVar2;

  undefined1 *puVar3;

  int iVar4;

  int local_1a8;

  undefined4 local_1a4;

  undefined1 local_19c [196];

  int local_d8;

  undefined1 local_c0 [192];

  

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

  *piVar1 = 0;

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar4 = *(int *)(param_1 + 0xd8), iVar4 != 0)) {

    puVar3 = local_19c;

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar3,iVar4);

    FUN_0047e300();

    if (param_2 != -1) {

      FUN_005bfa20(param_2 * 0x10 + local_d8);

      FUN_005c54b0(local_1a4,piVar1,param_1 + 0x130,param_1 + 0x140,local_19c);

      if (*piVar1 <= *(int *)(param_1 + 0x110)) {

        *(int *)(param_1 + 0x110) = *piVar1 + -1;

      }

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

      if ((LVar2 == 0) && ((undefined4 *)(local_1a8 + -0x14) != (undefined4 *)0x0)) {

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

      }

    }

    FUN_0047daa0();

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

    return param_2;

  }

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

  return param_2;

}





// --- FUN_005c67c0 at 0x005C67C0 (size: 503) ---


/* WARNING: Removing unreachable block (ram,0x005c68c1) */

/* WARNING: Removing unreachable block (ram,0x005c68e2) */

/* WARNING: Removing unreachable block (ram,0x005c68fc) */



void __fastcall FUN_005c67c0(int param_1)



{

  uint uVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  int iVar5;

  undefined1 *puVar6;

  undefined4 uVar7;

  undefined1 local_19c [192];

  undefined1 local_dc [220];

  

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar5 = *(int *)(param_1 + 0xd8), iVar5 != 0)) {

    puVar6 = local_dc;

    FUN_005c3380(local_19c,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar6,iVar5);

    FUN_0047e300();

    FUN_005c5390();

    uVar4 = 0;

    do {

      uVar1 = FUN_00685400(*(undefined4 *)(param_1 + 0x1ac));

      if (uVar1 < *(uint *)(param_1 + 0x1ac)) {

        if (*(int *)(*(int *)(param_1 + 0x1b0) + uVar1 * 4) == 1) {

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

            uVar7 = 2;

LAB_005c6860:

            FUN_005c4c00(uVar1,uVar7);

          }

        }

        else if ((uVar1 < *(uint *)(param_1 + 0x1ac)) &&

                (*(int *)(*(int *)(param_1 + 0x1b0) + uVar1 * 4) == 2)) {

          uVar7 = 3;

          goto LAB_005c6860;

        }

      }

    } while ((*(int *)(param_1 + 0x1b8) != 0) && (uVar4 = uVar4 + 1, uVar4 < 100));

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

    if ((0 < iVar5) && (uVar4 = 0, *(int *)(param_1 + 0x1ac) != 0)) {

      do {

        if (uVar4 < *(uint *)(param_1 + 0x1ac)) {

          if (*(int *)(*(int *)(param_1 + 0x1b0) + uVar4 * 4) == 1) {

            iVar2 = FUN_005c36b0(uVar4,*(undefined4 *)(param_1 + 0xd4),

                                 *(undefined4 *)(param_1 + 0xd8));

            if (-1 < iVar5 - iVar2) {

              *(int *)(param_1 + 0x1b8) = iVar5 - iVar2;

              *(undefined4 *)(*(int *)(param_1 + 0x1b0) + uVar4 * 4) = 2;

            }

          }

          else if ((uVar4 < *(uint *)(param_1 + 0x1ac)) &&

                  (*(int *)(*(int *)(param_1 + 0x1b0) + uVar4 * 4) == 2)) {

            iVar2 = FUN_005c36b0(uVar4,*(undefined4 *)(param_1 + 0xd4),

                                 *(undefined4 *)(param_1 + 0xd8));

            iVar3 = FUN_005c37b0(uVar4,*(undefined4 *)(param_1 + 0xd4),

                                 *(undefined4 *)(param_1 + 0xd8));

            iVar3 = (iVar5 + iVar2) - iVar3;

            if (-1 < iVar3) {

              *(int *)(param_1 + 0x1b8) = iVar3;

              *(undefined4 *)(*(int *)(param_1 + 0x1b0) + uVar4 * 4) = 3;

            }

          }

        }

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

      } while ((iVar5 != 0) && (uVar4 = uVar4 + 1, uVar4 < *(uint *)(param_1 + 0x1ac)));

    }

    FUN_0047daa0();

  }

  return;

}





// --- FUN_005c69c0 at 0x005C69C0 (size: 127) ---


void __fastcall FUN_005c69c0(int param_1)



{

  int iVar1;

  undefined1 local_c0 [28];

  int local_a4;

  int local_9c;

  

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

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    if (local_9c != 0) {

      iVar1 = FUN_00685420(local_9c,0xffffffff);

      iVar1 = *(int *)(local_a4 + iVar1 * 4);

      if ((-1 < iVar1) && (iVar1 < *(int *)(*(int *)(param_1 + 0x254) + 0x38))) {

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

        FUN_0047e300();

        return;

      }

      *(undefined4 *)(param_1 + 0x1f8) = 0xffffffff;

    }

    FUN_0047e300();

  }

  return;

}





// --- FUN_005c6a40 at 0x005C6A40 (size: 43) ---


undefined4 __thiscall FUN_005c6a40(int param_1,int param_2,int param_3)



{

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

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

    FUN_005c6060();

  }

  return *(undefined4 *)(param_1 + 0x180);

}





// --- FUN_005c6a70 at 0x005C6A70 (size: 239) ---


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



{

  undefined1 *puVar1;

  int iVar2;

  int local_1cc;

  undefined1 local_19c [12];

  int local_190;

  int local_138;

  undefined1 local_c0 [192];

  

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar2 = *(int *)(param_1 + 0xd8), iVar2 != 0)) {

    puVar1 = local_19c;

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar1,iVar2);

    FUN_0047e300();

    if (*(int *)(param_1 + 0xf0) != -1) {

      FUN_004df000(*(int *)(param_1 + 0xf0) * 0x3c + local_138);

      if (local_1cc == DAT_008f08c4) {

        local_1cc = local_190;

      }

      *param_2 = local_1cc;

      FUN_005aca00();

      FUN_0047daa0();

      return param_2;

    }

    *param_2 = local_190;

    FUN_0047daa0();

    return param_2;

  }

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

  return param_2;

}





// --- FUN_005c6b60 at 0x005C6B60 (size: 641) ---


void __fastcall FUN_005c6b60(undefined4 *param_1)



{

  undefined1 local_1a8 [96];

  int local_148;

  int local_13c;

  int local_130;

  int local_124;

  int local_118;

  int local_10c;

  int iStack_100;

  int iStack_f4;

  int iStack_e8;

  int iStack_dc;

  undefined1 local_c8 [196];

  

  if ((param_1[0x35] != 0) && (param_1[0x36] != 0)) {

    FUN_005c3380(local_c8,param_1[0x35]);

    FUN_005c2b30(local_1a8,param_1[0x36]);

    if (local_124 <= (int)param_1[0x37]) {

      param_1[0x37] = local_124 + -1;

    }

    if (local_118 <= (int)param_1[0x38]) {

      param_1[0x38] = local_118 + -1;

    }

    if (local_10c <= (int)param_1[0x39]) {

      param_1[0x39] = local_10c + -1;

    }

    if (local_13c <= (int)param_1[0x3c]) {

      param_1[0x3c] = local_13c + -1;

    }

    if (local_130 <= (int)param_1[0x3b]) {

      param_1[0x3b] = local_130 + -1;

      (**(code **)*param_1)();

    }

    if (local_148 <= (int)param_1[0x3a]) {

      param_1[0x3a] = local_148 + -1;

      (**(code **)*param_1)();

    }

    if (iStack_100 <= (int)param_1[0x3d]) {

      FUN_005c6330(iStack_100 + -1);

    }

    if ((int)param_1[0x45] <= (int)param_1[0x3e]) {

      param_1[0x3e] = param_1[0x45] + -1;

    }

    if (iStack_f4 <= (int)param_1[0x3f]) {

      FUN_005c6460(iStack_f4 + -1);

    }

    if ((int)param_1[0x46] <= (int)param_1[0x40]) {

      param_1[0x40] = param_1[0x46] + -1;

    }

    if (iStack_e8 <= (int)param_1[0x41]) {

      FUN_005c6580(iStack_e8 + -1);

    }

    if ((int)param_1[0x47] <= (int)param_1[0x42]) {

      param_1[0x42] = param_1[0x47] + -1;

    }

    if (iStack_dc <= (int)param_1[0x43]) {

      FUN_005c66a0(iStack_dc + -1);

    }

    if ((int)param_1[0x48] <= (int)param_1[0x44]) {

      param_1[0x44] = param_1[0x48] + -1;

    }

    FUN_0047daa0();

    FUN_0047e300();

    return;

  }

  param_1[0x37] = 0xffffffff;

  param_1[0x38] = 0xffffffff;

  param_1[0x39] = 0xffffffff;

  param_1[0x52] = 0;

  param_1[0x53] = 0xbff00000;

  (**(code **)*param_1)();

  param_1[0x54] = 0;

  param_1[0x55] = 0xbff00000;

  (**(code **)*param_1)();

  param_1[0x3a] = 0xffffffff;

  (**(code **)*param_1)();

  param_1[0x3b] = 0xffffffff;

  (**(code **)*param_1)();

  param_1[0x3c] = 0xffffffff;

  FUN_005c6330(0xffffffff);

  param_1[0x3e] = 0xffffffff;

  param_1[0x56] = 0;

  param_1[0x57] = 0xbff00000;

  FUN_005c6460(0xffffffff);

  param_1[0x40] = 0xffffffff;

  param_1[0x58] = 0;

  param_1[0x59] = 0xbff00000;

  FUN_005c6580(0xffffffff);

  param_1[0x42] = 0xffffffff;

  param_1[0x5a] = 0;

  param_1[0x5b] = 0xbff00000;

  FUN_005c66a0(0xffffffff);

  param_1[0x44] = 0xffffffff;

  param_1[0x5c] = 0;

  param_1[0x5d] = 0xbff00000;

  return;

}





// --- FUN_005c6df0 at 0x005C6DF0 (size: 220) ---


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



void __thiscall FUN_005c6df0(int param_1,int param_2)



{

  int iVar1;

  undefined4 uVar2;

  undefined1 *puVar3;

  undefined1 local_19c [168];

  int local_f4;

  undefined1 local_c0 [192];

  

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar1 = *(int *)(param_1 + 0xd8), iVar1 != 0)) {

    puVar3 = local_19c;

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar3,iVar1);

    FUN_0047e300();

    if (local_f4 != 0) {

      if (param_2 == 0) {

        iVar1 = FUN_00685400(local_f4 + 1);

      }

      else {

        iVar1 = FUN_00685420(local_f4 + 1,*(int *)(param_1 + 0xf4) + 1);

      }

      FUN_005c6330(iVar1 + -1);

    }

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

      uVar2 = FUN_00685420(*(int *)(param_1 + 0x114),*(undefined4 *)(param_1 + 0xf8));

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

    }

    iVar1 = rand();

    *(double *)(param_1 + 0x158) = (double)iVar1 * _DAT_007ce670;

    FUN_0047daa0();

  }

  return;

}





// --- FUN_005c6ed0 at 0x005C6ED0 (size: 192) ---


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



void __fastcall FUN_005c6ed0(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  undefined1 *puVar3;

  undefined1 local_19c [180];

  int local_e8;

  undefined1 local_c0 [192];

  

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar2 = *(int *)(param_1 + 0xd8), iVar2 != 0)) {

    puVar3 = local_19c;

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar3,iVar2);

    FUN_0047e300();

    if (local_e8 != 0) {

      uVar1 = FUN_00685420(local_e8,*(undefined4 *)(param_1 + 0xfc));

      FUN_005c6460(uVar1);

    }

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

      uVar1 = FUN_00685420(*(int *)(param_1 + 0x118),*(undefined4 *)(param_1 + 0x100));

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

    }

    iVar2 = rand();

    *(double *)(param_1 + 0x160) = (double)iVar2 * _DAT_007ce670;

    FUN_0047daa0();

  }

  return;

}





// --- FUN_005c6f90 at 0x005C6F90 (size: 192) ---


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



void __fastcall FUN_005c6f90(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  undefined1 *puVar3;

  undefined1 local_19c [192];

  int local_dc;

  undefined1 local_c0 [192];

  

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar2 = *(int *)(param_1 + 0xd8), iVar2 != 0)) {

    puVar3 = local_19c;

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar3,iVar2);

    FUN_0047e300();

    if (local_dc != 0) {

      uVar1 = FUN_00685420(local_dc,*(undefined4 *)(param_1 + 0x104));

      FUN_005c6580(uVar1);

    }

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

      uVar1 = FUN_00685420(*(int *)(param_1 + 0x11c),*(undefined4 *)(param_1 + 0x108));

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

    }

    iVar2 = rand();

    *(double *)(param_1 + 0x168) = (double)iVar2 * _DAT_007ce670;

    FUN_0047daa0();

  }

  return;

}





// --- FUN_005c7050 at 0x005C7050 (size: 192) ---


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



void __fastcall FUN_005c7050(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  undefined1 *puVar3;

  undefined1 local_19c [204];

  int local_d0;

  undefined1 local_c0 [192];

  

  if ((*(int *)(param_1 + 0xd4) != 0) && (iVar2 = *(int *)(param_1 + 0xd8), iVar2 != 0)) {

    puVar3 = local_19c;

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(puVar3,iVar2);

    FUN_0047e300();

    if (local_d0 != 0) {

      uVar1 = FUN_00685420(local_d0,*(undefined4 *)(param_1 + 0x10c));

      FUN_005c66a0(uVar1);

    }

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

      uVar1 = FUN_00685420(*(int *)(param_1 + 0x120),*(undefined4 *)(param_1 + 0x110));

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

    }

    iVar2 = rand();

    *(double *)(param_1 + 0x170) = (double)iVar2 * _DAT_007ce670;

    FUN_0047daa0();

  }

  return;

}





// --- FUN_005c7110 at 0x005C7110 (size: 873) ---


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



void __fastcall FUN_005c7110(int param_1)



{

  uint uVar1;

  int iVar2;

  int *piVar3;

  LONG LVar4;

  int *piVar5;

  int *piVar6;

  int *piVar7;

  int *piVar8;

  int *piVar9;

  uint uVar10;

  int iVar11;

  undefined4 *puVar12;

  float10 fVar13;

  int local_210;

  int local_20c;

  double local_208;

  uint local_1fc;

  int local_1f8;

  uint local_1f4;

  double local_1f0;

  undefined **local_1e8;

  int local_1e4;

  int local_1d8;

  int local_1d4;

  int local_1d0;

  int local_1cc;

  int local_1c8;

  int local_1c4;

  void *local_1c0;

  uint local_1bc;

  uint local_1b8;

  void *local_1b4;

  uint local_1b0;

  uint local_1ac;

  undefined1 local_1a8 [64];

  int local_168;

  uint local_160;

  undefined1 local_e8 [228];

  

  uVar10 = 0xffffffff;

  local_1f4 = 0xffffffff;

  local_1f0 = 0.0;

  if ((*(int *)(param_1 + 0xd4) != 0) && (*(int *)(param_1 + 0xd8) != 0)) {

    FUN_005c3380(local_1a8,*(int *)(param_1 + 0xd4));

    FUN_005c2b30(local_e8,*(undefined4 *)(param_1 + 0xd8));

    local_1fc = 1;

    if (1 < local_160) {

      local_1f8 = 0x40;

      do {

        FUN_005c5cf0(local_1f8 + local_168);

        local_210 = *(int *)(param_1 + 0x184);

        piVar3 = &local_210;

        if (local_1d8 <= *(int *)(param_1 + 0x184)) {

          piVar3 = &local_1d8;

        }

        local_210 = *(int *)(param_1 + 0x188);

        piVar5 = &local_210;

        if (local_1d4 <= *(int *)(param_1 + 0x188)) {

          piVar5 = &local_1d4;

        }

        local_210 = *(int *)(param_1 + 0x18c);

        piVar6 = &local_210;

        if (local_1d0 <= *(int *)(param_1 + 0x18c)) {

          piVar6 = &local_1d0;

        }

        local_210 = *(int *)(param_1 + 400);

        piVar7 = &local_210;

        if (local_1cc <= *(int *)(param_1 + 400)) {

          piVar7 = &local_1cc;

        }

        local_210 = *(int *)(param_1 + 0x194);

        piVar8 = &local_210;

        if (local_1c8 <= *(int *)(param_1 + 0x194)) {

          piVar8 = &local_1c8;

        }

        local_210 = local_1d8 + local_1d4 + local_1d0 + local_1cc + local_1c8 + local_1c4;

        local_20c = *(int *)(param_1 + 0x198);

        piVar9 = &local_20c;

        if (local_1c4 <= *(int *)(param_1 + 0x198)) {

          piVar9 = &local_1c4;

        }

        if (local_210 < 1) {

          local_208 = 0.25;

        }

        else {

          local_20c = *piVar9 + *piVar3 + *piVar5 + *piVar6 + *piVar7 + *piVar8;

          fVar13 = (float10)_CIpow();

          local_208 = (double)(fVar13 * (float10)_DAT_007ae020);

        }

        local_20c = 0;

        uVar10 = 0;

        if (local_1b8 == 0) {

LAB_005c730a:

          fVar13 = (float10)local_208 + (float10)_DAT_007e88f0;

        }

        else {

          do {

            uVar1 = *(uint *)((int)local_1c0 + uVar10 * 4);

            if ((uVar1 < *(uint *)(param_1 + 0x1ac)) &&

               (1 < *(int *)(*(int *)(param_1 + 0x1b0) + uVar1 * 4))) {

              local_20c = local_20c + 1;

            }

            uVar10 = uVar10 + 1;

          } while (uVar10 < local_1b8);

          if ((int)local_1b8 < 1) goto LAB_005c730a;

          fVar13 = (float10)_CIpow();

          fVar13 = fVar13 * (float10)_DAT_007ae020 + (float10)local_208;

        }

        local_208 = (double)fVar13;

        iVar11 = 0;

        uVar10 = 0;

        local_20c = 0;

        if (local_1ac == 0) {

LAB_005c738a:

          fVar13 = (float10)local_208 + (float10)_DAT_007e88e8;

        }

        else {

          local_210 = local_1ac * 2;

          do {

            uVar1 = *(uint *)((int)local_1b4 + uVar10 * 4);

            if (uVar1 < *(uint *)(param_1 + 0x1ac)) {

              iVar2 = *(int *)(*(int *)(param_1 + 0x1b0) + uVar1 * 4);

              if (iVar2 == 2) {

                iVar11 = iVar11 + 1;

              }

              else if (iVar2 == 3) {

                iVar11 = iVar11 + 2;

              }

            }

            uVar10 = uVar10 + 1;

          } while (uVar10 < local_1ac);

          local_20c = iVar11;

          if (local_210 < 1) goto LAB_005c738a;

          fVar13 = (float10)_CIpow();

          fVar13 = fVar13 * (float10)_DAT_007ae020 + (float10)local_208;

        }

        if ((float10)local_1f0 < fVar13) {

          local_1f0 = (double)fVar13;

          local_1f4 = local_1fc;

        }

        uVar10 = local_1f4;

        local_1e8 = &PTR_LAB_007a0ec8;

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

          operator_delete__(local_1b4);

        }

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

          operator_delete__(local_1c0);

        }

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

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

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

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

        }

        local_1fc = local_1fc + 1;

        local_1f8 = local_1f8 + 0x40;

      } while (local_1fc < local_160);

    }

    if (local_1f0 < _DAT_007e8858) {

      uVar10 = 0;

    }

    if (uVar10 != *(uint *)(param_1 + 0x180)) {

      *(uint *)(param_1 + 0x180) = uVar10;

    }

    FUN_0047daa0();

    FUN_0047e300();

  }

  return;

}





// --- FUN_005c7480 at 0x005C7480 (size: 84) ---


void __thiscall FUN_005c7480(undefined4 *param_1,undefined4 param_2)



{

  param_1[0x36] = param_2;

  FUN_005c6b60();

  (**(code **)*param_1)();

  FUN_005c6330(param_1[0x3d]);

  FUN_005c6460(param_1[0x3f]);

  FUN_005c6580(param_1[0x41]);

  FUN_005c66a0(param_1[0x43]);

  return;

}





// --- FUN_005c74e0 at 0x005C74E0 (size: 144) ---


void __fastcall FUN_005c74e0(int param_1)



{

  int iVar1;

  undefined1 local_c0 [72];

  uint local_78;

  

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

  if ((iVar1 != 0) && (*(int *)(param_1 + 0xd8) != 0)) {

    if ((iVar1 != 0xc) && (iVar1 != 0xd)) {

      FUN_005c3380(local_c0,iVar1);

      if (1 < local_78) {

        iVar1 = FUN_00685420(local_78 - 1,*(int *)(param_1 + 0x180) + -1);

        *(int *)(param_1 + 0x180) = iVar1 + 1;

        if (iVar1 + 1 != -1) {

          FUN_005c6060();

        }

      }

      FUN_0047e300();

      return;

    }

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

    FUN_005c6060();

  }

  return;

}





// --- FUN_005c7570 at 0x005C7570 (size: 480) ---


void __fastcall FUN_005c7570(int param_1)



{

  undefined1 local_c0 [20];

  int local_ac;

  int local_a8;

  int local_78;

  

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

    FUN_005c3380(local_c0,*(int *)(param_1 + 0xd4));

    FUN_005c6b60();

    if (local_78 <= *(int *)(param_1 + 0x180)) {

      *(undefined4 *)(param_1 + 0x180) = 0xffffffff;

    }

    if (local_ac < *(int *)(param_1 + 0x19c)) {

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

      *(int *)(param_1 + 0x1a0) =

           -(*(int *)(param_1 + 0x198) + *(int *)(param_1 + 0x194) + *(int *)(param_1 + 400) +

             *(int *)(param_1 + 0x18c) + *(int *)(param_1 + 0x188) + *(int *)(param_1 + 0x184));

      FUN_005c5640(0,0);

      FUN_005c56c0(*(int *)(param_1 + 0x19c) / 6,0);

      FUN_005c5740(*(int *)(param_1 + 0x19c) / 6,0);

      FUN_005c57c0(*(int *)(param_1 + 0x19c) / 6,0);

      FUN_005c5840(*(int *)(param_1 + 0x19c) / 6,0);

      FUN_005c58c0(*(int *)(param_1 + 0x19c) / 6,0);

    }

    if (local_a8 < *(int *)(param_1 + 0x1b4)) {

      *(int *)(param_1 + 0x1b4) = local_a8;

    }

    FUN_005c47a0();

    if (*(int *)(param_1 + 0x1b8) < 0) {

      FUN_005c5390();

    }

    FUN_0047e300();

    return;

  }

  *(undefined4 *)(param_1 + 0x180) = 0xffffffff;

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

  *(int *)(param_1 + 0x1a0) =

       -(*(int *)(param_1 + 0x198) + *(int *)(param_1 + 0x194) + *(int *)(param_1 + 400) +

         *(int *)(param_1 + 0x18c) + *(int *)(param_1 + 0x188) + *(int *)(param_1 + 0x184));

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

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

  FUN_005c4cf0(&DAT_007938af);

  *(undefined4 *)(param_1 + 0x1f8) = 0xffffffff;

  FUN_005c5970();

  return;

}





// --- FUN_005c7750 at 0x005C7750 (size: 38) ---


void FUN_005c7750(undefined4 param_1)



{

  FUN_005c6df0(param_1);

  FUN_005c6ed0();

  FUN_005c6f90();

  FUN_005c7050();

  return;

}





// --- FUN_005c7780 at 0x005C7780 (size: 256) ---


void __thiscall FUN_005c7780(undefined4 *param_1,int param_2)



{

  undefined1 local_c0 [12];

  int local_b4;

  int local_ac;

  undefined4 local_a8;

  

  param_1[0x35] = param_2;

  if (param_2 != 0) {

    FUN_005c3380(local_c0,param_2);

    if (local_b4 != param_1[0x7f]) {

      param_1[0x81] = 1;

      param_1[0x7f] = local_b4;

    }

    param_1[0x67] = local_ac;

    param_1[0x68] =

         (((((local_ac - param_1[0x66]) - param_1[0x65]) - param_1[100]) - param_1[99]) -

         param_1[0x62]) - param_1[0x61];

    param_1[0x6d] = local_a8;

    param_1[0x6e] = local_a8;

    FUN_005c6060();

    FUN_005c69c0();

    FUN_0047e300();

  }

  FUN_005c7570();

  (**(code **)*param_1)();

  FUN_005c6330(param_1[0x3d]);

  FUN_005c6460(param_1[0x3f]);

  FUN_005c6580(param_1[0x41]);

  FUN_005c66a0(param_1[0x43]);

  return;

}





// --- FUN_005c7880 at 0x005C7880 (size: 383) ---


void __fastcall FUN_005c7880(undefined4 *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  param_1[0x88] = 0;

  param_1[0x31] = 0;

  param_1[0x32] = 0;

  param_1[0x33] = 0;

  param_1[0x34] = 0;

  puVar2 = param_1 + 0x8c;

  for (iVar1 = 6; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

  FUN_005c7780(0);

  FUN_005c7480(0);

  param_1[0x37] = 0xffffffff;

  param_1[0x38] = 0xffffffff;

  param_1[0x39] = 0xffffffff;

  param_1[0x52] = 0;

  param_1[0x53] = 0xbff00000;

  (**(code **)*param_1)();

  param_1[0x54] = 0;

  param_1[0x55] = 0xbff00000;

  (**(code **)*param_1)();

  param_1[0x3a] = 0xffffffff;

  (**(code **)*param_1)();

  param_1[0x3b] = 0xffffffff;

  (**(code **)*param_1)();

  param_1[0x3c] = 0xffffffff;

  FUN_005c6330(0xffffffff);

  param_1[0x3e] = 0xffffffff;

  param_1[0x56] = 0;

  param_1[0x57] = 0xbff00000;

  FUN_005c6460(0xffffffff);

  param_1[0x40] = 0xffffffff;

  param_1[0x58] = 0;

  param_1[0x59] = 0xbff00000;

  FUN_005c6580(0xffffffff);

  param_1[0x42] = 0xffffffff;

  param_1[0x5a] = 0;

  param_1[0x5b] = 0xbff00000;

  FUN_005c66a0(0xffffffff);

  param_1[0x44] = 0xffffffff;

  param_1[0x5c] = 0;

  param_1[0x5d] = 0xbff00000;

  param_1[0x60] = 0xffffffff;

  param_1[0x69] = 10;

  param_1[0x6a] = 100;

  param_1[0x67] = 0;

  param_1[0x68] = 0;

  param_1[0x6d] = 0;

  param_1[0x6e] = 0;

  FUN_005c4cf0(&DAT_007938af);

  param_1[0x7e] = 0xffffffff;

  param_1[0x89] = 0;

  param_1[0x8a] = 0;

  FUN_005c5970();

  param_1[0x81] = 0;

  param_1[0x7f] = 0x2000054;

  param_1[0x80] = 0x3000003;

  return;

}





// --- FUN_005c7a00 at 0x005C7A00 (size: 39) ---


void FUN_005c7a00(char param_1)



{

  undefined4 uVar1;

  

  if (param_1 == '\0') {

    uVar1 = 3;

  }

  else {

    uVar1 = 4;

  }

  uVar1 = FUN_0042c820(1,uVar1);

  FUN_005c7780(uVar1);

  return;

}





// --- FUN_005c7a30 at 0x005C7A30 (size: 803) ---


undefined4 * __fastcall FUN_005c7a30(undefined4 *param_1)



{

  byte bVar1;

  undefined4 uVar2;

  byte *pbVar3;

  LONG LVar4;

  undefined4 *puVar5;

  byte *pbVar6;

  int *piVar7;

  uint uVar8;

  int iVar9;

  bool bVar10;

  uint uVar11;

  bool bVar12;

  byte *local_70;

  undefined4 *local_6c;

  undefined1 local_68 [4];

  int *local_64;

  int iStack_60;

  uint uStack_5c;

  undefined4 *puStack_54;

  undefined4 *local_50;

  

  bVar10 = false;

  *param_1 = &PTR_FUN_007e88d4;

  FUN_005c8010();

  param_1[0x30] = 1;

  param_1[0x45] = 0;

  param_1[0x46] = 0;

  param_1[0x47] = 0;

  param_1[0x48] = 0;

  param_1[0x49] = 0;

  param_1[0x4a] = 0;

  param_1[0x4b] = 0;

  param_1[0x4c] = 0;

  param_1[0x4d] = 0;

  param_1[0x4e] = 0;

  param_1[0x4f] = 0;

  param_1[0x50] = 0;

  param_1[0x6b] = 0;

  param_1[0x6c] = 0;

  param_1[0x70] = &PTR_FUN_007e88d0;

  param_1[0x71] = 0;

  param_1[0x72] = 0;

  param_1[0x73] = 0;

  param_1[0x92] = 0;

  param_1[0x94] = 0;

  param_1[0x95] = 0;

  uVar2 = FUN_00413a00(0xe,2,0x10000002);

  param_1[0x95] = uVar2;

  param_1[0x82] = 0;

  FUN_005c7880();

  if ((void *)param_1[0x6c] != (void *)0x0) {

    operator_delete__((void *)param_1[0x6c]);

    param_1[0x6c] = 0;

  }

  uVar2 = FUN_00413a00(4,2,0x10000004);

  param_1[0x92] = uVar2;

  FUN_0049b830(local_68);

  FUN_004f1ef0();

  piVar7 = local_64;

joined_r0x005c7b4a:

  do {

    do {

      local_64 = piVar7;

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

        if (0 < (int)param_1[0x6b]) {

          uVar2 = thunk_FUN_005df0f5(param_1[0x6b] * 4);

          param_1[0x6c] = uVar2;

          uVar11 = 0;

          if (param_1[0x6b] != 0) {

            do {

              *(undefined4 *)(param_1[0x6c] + uVar11 * 4) = 0;

              uVar11 = uVar11 + 1;

            } while (uVar11 < (uint)param_1[0x6b]);

          }

        }

        uVar2 = FUN_00413a00(1,2,0x10000003);

        param_1[0x93] = uVar2;

        puVar5 = param_1 + 0x8c;

        for (iVar9 = 6; iVar9 != 0; iVar9 = iVar9 + -1) {

          *puVar5 = 0;

          puVar5 = puVar5 + 1;

        }

        LVar4 = InterlockedDecrement(local_50 + 1);

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

          (**(code **)*local_50)(1);

        }

        LVar4 = InterlockedDecrement(puStack_54 + 1);

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

          (**(code **)*puStack_54)(1);

        }

        return param_1;

      }

      FUN_004f1fc0(piVar7 + 2);

      pbVar3 = (byte *)FUN_005df0f5(0x24);

      if (pbVar3 == (byte *)0x0) {

        local_70 = (byte *)0x0;

      }

      else {

        local_6c = local_50;

        bVar10 = true;

        InterlockedIncrement(local_50 + 1);

        iVar9 = *piVar7;

        strncpy((char *)pbVar3,(char *)(local_50 + 5),0x1e);

        *(int *)(pbVar3 + 0x20) = iVar9;

        local_70 = pbVar3;

      }

      puVar5 = local_6c;

      if (bVar10) {

        bVar10 = false;

        LVar4 = InterlockedDecrement(local_6c + 1);

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

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

        }

      }

      uVar11 = 0xffffffff;

      while( true ) {

        puVar5 = (undefined4 *)param_1[0x71];

        uVar11 = uVar11 + 1;

        if ((puVar5 == (undefined4 *)0x0) || ((uint)param_1[0x73] <= uVar11)) break;

        uVar8 = 0;

        while (uVar8 != uVar11) {

          puVar5 = (undefined4 *)puVar5[1];

          uVar8 = uVar8 + 1;

          if (puVar5 == (undefined4 *)0x0) goto LAB_005c7c40;

        }

        if ((puVar5 == (undefined4 *)0x0) ||

           (pbVar3 = (byte *)*puVar5, pbVar6 = local_70, pbVar3 == (byte *)0x0)) break;

        do {

          bVar1 = *pbVar6;

          bVar12 = bVar1 < *pbVar3;

          if (bVar1 != *pbVar3) {

LAB_005c7c37:

            iVar9 = (1 - (uint)bVar12) - (uint)(bVar12 != 0);

            goto LAB_005c7c3c;

          }

          if (bVar1 == 0) break;

          bVar1 = pbVar6[1];

          bVar12 = bVar1 < pbVar3[1];

          if (bVar1 != pbVar3[1]) goto LAB_005c7c37;

          pbVar3 = pbVar3 + 2;

          pbVar6 = pbVar6 + 2;

        } while (bVar1 != 0);

        iVar9 = 0;

LAB_005c7c3c:

        if (iVar9 < 1) break;

      }

LAB_005c7c40:

      FUN_005c5c30(uVar11,&local_70);

      if ((uint)param_1[0x6b] < *local_64 + 1U) {

        param_1[0x6b] = *local_64 + 1U;

      }

      piVar7 = (int *)local_64[0x18];

    } while (piVar7 != (int *)0x0);

    uVar11 = local_64[0x19];

    do {

      uVar11 = uVar11 + 1;

      if (uStack_5c <= uVar11) {

        piVar7 = (int *)0x0;

        goto joined_r0x005c7b4a;

      }

    } while (*(int *)(iStack_60 + uVar11 * 4) == 0);

    piVar7 = *(int **)(iStack_60 + uVar11 * 4);

  } while( true );

}





// --- FUN_005c7d60 at 0x005C7D60 (size: 147) ---


void __thiscall FUN_005c7d60(int param_1,char param_2)



{

  undefined4 uVar1;

  

  FUN_005c7880();

  if (param_2 == '\0') {

    uVar1 = 3;

  }

  else {

    uVar1 = 4;

  }

  uVar1 = FUN_0042c820(1,uVar1);

  FUN_005c7780(uVar1);

  uVar1 = FUN_0042c820(1,2);

  FUN_005c7480(uVar1);

  FUN_005c5ef0(0);

  FUN_005c6df0(0);

  FUN_005c6ed0();

  FUN_005c6f90();

  FUN_005c7050();

  FUN_005c74e0();

  FUN_005c69c0();

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

  *(undefined4 *)(param_1 + 200) = 1;

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

  return;

}





// --- FUN_005c7e20 at 0x005C7E20 (size: 67) ---


uint __thiscall FUN_005c7e20(int *param_1,int *param_2,uint param_3)



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 8))();

  if (uVar2 <= param_3) {

    *(undefined4 *)*param_2 = 1;

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[1];

    *param_2 = *param_2 + 4;

    (**(code **)(param_1[6] + 0xc))(param_2,param_3);

  }

  return uVar2;

}





// --- FUN_005c7e70 at 0x005C7E70 (size: 60) ---


undefined4 __thiscall FUN_005c7e70(int *param_1,int *param_2,uint param_3)



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 8))();

  if (param_3 < uVar2) {

    return 0;

  }

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[1] = *(int *)(iVar1 + 4);

  *param_2 = *param_2 + 4;

  (**(code **)(param_1[6] + 0x10))(param_2,param_3);

  return 1;

}





// --- FUN_005c7eb0 at 0x005C7EB0 (size: 268) ---


undefined4 FUN_005c7eb0(int param_1)



{

  undefined *puVar1;

  char cVar2;

  LONG LVar3;

  int iVar4;

  undefined4 uVar5;

  undefined4 *puVar6;

  undefined *local_98;

  int local_94 [37];

  

  if (param_1 != 0) {

    local_98 = PTR_DAT_00818344;

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

    cVar2 = FUN_0041b060(0x10000006,param_1,&local_98);

    if (cVar2 != '\0') {

      FUN_0042dc80();

      puVar1 = local_98;

      iVar4 = *(int *)(local_98 + -8);

      if (iVar4 == -1) {

        iVar4 = FUN_004016b0(local_98);

        *(int *)(puVar1 + -8) = iVar4;

      }

      FUN_0042c9c0(iVar4,0x10000007);

      uVar5 = FUN_0042e980(local_94,0);

      FUN_00402070(uVar5);

      LVar3 = InterlockedDecrement((LONG *)(local_94[0] + -0x10));

      if ((LVar3 == 0) && ((undefined4 *)(local_94[0] + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(local_94[0] + -0x14))(1);

      }

      FUN_0042e590();

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

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

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

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

      }

      return 1;

    }

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

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

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

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

    }

  }

  return 0;

}





// --- FUN_005c7fc0 at 0x005C7FC0 (size: 44) ---


void __fastcall FUN_005c7fc0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007a7fe4;

  param_1[1] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = &PTR_FUN_0079385c;

  param_1[2] = &PTR_FUN_007a83d8;

  param_1[6] = &PTR_LAB_007a5164;

  return;

}





// --- FUN_005c7ff0 at 0x005C7FF0 (size: 31) ---


int __thiscall FUN_005c7ff0(int param_1,int param_2)



{

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

  FUN_004db900(param_2 + 8);

  return param_1;

}





// --- FUN_005c8010 at 0x005C8010 (size: 212) ---


undefined4 * __fastcall FUN_005c8010(undefined4 *param_1)



{

  undefined4 uVar1;

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007e8940;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  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] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  param_1[0x22] = 0;

  param_1[0x23] = 0;

  param_1[0x24] = 0;

  param_1[0x25] = 0;

  param_1[0x26] = 0;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[0x27] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[0x28] = 0xffffffff;

  uVar1 = DAT_008f08ec;

  param_1[0x2a] = 0;

  param_1[0x2b] = 0;

  param_1[0x2c] = 0;

  param_1[0x29] = uVar1;

  return param_1;

}





// --- FUN_005c8120 at 0x005C8120 (size: 7) ---


undefined4 __fastcall FUN_005c8120(int param_1)



{

  return *(undefined4 *)(param_1 + 0xac);

}





// --- FUN_005c8140 at 0x005C8140 (size: 77) ---


void __thiscall FUN_005c8140(int param_1,int *param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  puVar1 = *(undefined4 **)(param_1 + 0x9c);

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

    LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    iVar2 = *param_2;

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

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005c8190 at 0x005C8190 (size: 70) ---


void __fastcall FUN_005c8190(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  *param_1 = &PTR_FUN_007e8940;

  if ((void *)param_1[0x26] != (void *)0x0) {

    operator_delete__((void *)param_1[0x26]);

  }

  puVar1 = (undefined4 *)param_1[0x27];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005c81e0 at 0x005C81E0 (size: 722) ---


void __thiscall FUN_005c81e0(int param_1,int *param_2,int param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int iVar16;

  int iVar17;

  int iVar18;

  int iVar19;

  int iVar20;

  undefined4 *puVar21;

  uint uVar22;

  

  *(undefined4 *)*param_2 = 1;

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 8);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar3 = *(int *)(param_1 + 8);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0xc);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar4 = *(int *)(param_1 + 0xc);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x10);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x14);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar6 = *(int *)(param_1 + 0x14);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x18);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar7 = *(int *)(param_1 + 0x18);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x1c);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar8 = *(int *)(param_1 + 0x1c);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x20);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar9 = *(int *)(param_1 + 0x20);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x24);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar10 = *(int *)(param_1 + 0x24);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x34);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x28);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar11 = *(int *)(param_1 + 0x28);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x38);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x2c);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar12 = *(int *)(param_1 + 0x2c);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x3c);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x30);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar13 = *(int *)(param_1 + 0x30);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x40);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined8 *)(iVar1 + 4) = *(undefined8 *)(param_1 + 0x48);

  iVar1 = *param_2;

  *param_2 = iVar1 + 8;

  *(undefined8 *)(iVar1 + 8) = *(undefined8 *)(param_1 + 0x50);

  iVar1 = *param_2;

  *param_2 = iVar1 + 8;

  *(undefined8 *)(iVar1 + 8) = *(undefined8 *)(param_1 + 0x58);

  iVar1 = *param_2;

  *param_2 = iVar1 + 8;

  *(undefined8 *)(iVar1 + 8) = *(undefined8 *)(param_1 + 0x60);

  iVar1 = *param_2;

  *param_2 = iVar1 + 8;

  *(undefined8 *)(iVar1 + 8) = *(undefined8 *)(param_1 + 0x68);

  iVar1 = *param_2;

  *param_2 = iVar1 + 8;

  *(undefined8 *)(iVar1 + 8) = *(undefined8 *)(param_1 + 0x70);

  iVar1 = *param_2;

  *param_2 = iVar1 + 8;

  *(undefined4 *)(iVar1 + 8) = *(undefined4 *)(param_1 + 0x78);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar14 = *(int *)(param_1 + 0x78);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x7c);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar15 = *(int *)(param_1 + 0x7c);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x80);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar16 = *(int *)(param_1 + 0x80);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x84);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar17 = *(int *)(param_1 + 0x84);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x88);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar18 = *(int *)(param_1 + 0x88);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x8c);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar19 = *(int *)(param_1 + 0x8c);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x90);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  iVar20 = *(int *)(param_1 + 0x90);

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0xa0);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0xa4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0x94);

  puVar21 = (undefined4 *)(*param_2 + 4);

  *param_2 = (int)puVar21;

  uVar22 = 0;

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

    do {

      *puVar21 = *(undefined4 *)(*(int *)(param_1 + 0x98) + uVar22 * 4);

      puVar21 = (undefined4 *)(*param_2 + 4);

      *param_2 = (int)puVar21;

      uVar22 = uVar22 + 1;

    } while (uVar22 < *(uint *)(param_1 + 0x94));

  }

  FUN_004fd290(param_2,param_3 - (int)puVar21);

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0xac);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 0xb0);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(int *)(iVar1 + 4) =

       iVar2 + iVar3 + iVar4 + iVar5 + iVar6 + iVar7 + iVar8 + iVar9 + iVar10 + iVar11 + iVar12 +

       iVar13 + iVar14 + iVar15 + iVar16 + iVar17 + iVar18 + iVar19 + iVar20;

  *param_2 = *param_2 + 4;

  return;

}





// --- FUN_005c84f0 at 0x005C84F0 (size: 90) ---


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



{

  undefined4 *puVar1;

  LONG LVar2;

  

  *param_1 = &PTR_FUN_007e8940;

  if ((void *)param_1[0x26] != (void *)0x0) {

    operator_delete__((void *)param_1[0x26]);

  }

  puVar1 = (undefined4 *)param_1[0x27];

  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_005c85b0 at 0x005C85B0 (size: 1023) ---


uint __thiscall FUN_005c85b0(int param_1,uint *param_2,uint param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int iVar16;

  int iVar17;

  int iVar18;

  int iVar19;

  int *piVar20;

  undefined4 *puVar21;

  undefined4 uVar22;

  uint uVar23;

  int iVar24;

  uint local_14;

  uint local_10;

  int local_c [2];

  

  uVar23 = *param_2;

  local_c[0] = 0;

  local_10 = 0;

  local_14 = *(int *)(param_1 + 0x94) * 4 + 0x9c;

  iVar19 = FUN_004fd290(&local_10,0);

  if ((uVar23 - param_3) + 1 < iVar19 + 0x10 + local_14) {

    return 0;

  }

  iVar19 = *(int *)*param_2;

  piVar20 = (int *)*param_2 + 1;

  *param_2 = (uint)piVar20;

  local_10 = (uint)(iVar19 == 1);

  if (iVar19 == 1) {

    *(int *)(param_1 + 4) = *piVar20;

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    iVar19 = *(int *)(param_1 + 4);

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    iVar1 = *(int *)(param_1 + 8);

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

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

    *param_2 = uVar23 + 4;

    iVar3 = *(int *)(param_1 + 0x10);

    *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    iVar4 = *(int *)(param_1 + 0x14);

    *(undefined4 *)(param_1 + 0x18) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    *(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

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

    *param_2 = uVar23 + 4;

    iVar6 = *(int *)(param_1 + 0x1c);

    *(undefined4 *)(param_1 + 0x20) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    iVar7 = *(int *)(param_1 + 0x20);

    *(undefined4 *)(param_1 + 0x24) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    *(undefined4 *)(param_1 + 0x34) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    iVar8 = *(int *)(param_1 + 0x24);

    *param_2 = uVar23 + 4;

    *(undefined4 *)(param_1 + 0x28) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    iVar9 = *(int *)(param_1 + 0x28);

    *(undefined4 *)(param_1 + 0x38) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    *(undefined4 *)(param_1 + 0x2c) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    iVar10 = *(int *)(param_1 + 0x2c);

    *(undefined4 *)(param_1 + 0x3c) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    *(undefined4 *)(param_1 + 0x30) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    iVar11 = *(int *)(param_1 + 0x30);

    *(undefined4 *)(param_1 + 0x40) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    puVar21 = (undefined4 *)(uVar23 + 4);

    *param_2 = (uint)puVar21;

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

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

    uVar23 = *param_2;

    puVar21 = (undefined4 *)(uVar23 + 8);

    *param_2 = (uint)puVar21;

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

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

    uVar23 = *param_2;

    puVar21 = (undefined4 *)(uVar23 + 8);

    *param_2 = (uint)puVar21;

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

    *(undefined4 *)(param_1 + 0x5c) = *(undefined4 *)(uVar23 + 0xc);

    uVar23 = *param_2;

    puVar21 = (undefined4 *)(uVar23 + 8);

    *param_2 = (uint)puVar21;

    *(undefined4 *)(param_1 + 0x60) = *puVar21;

    *(undefined4 *)(param_1 + 100) = *(undefined4 *)(uVar23 + 0xc);

    uVar23 = *param_2;

    puVar21 = (undefined4 *)(uVar23 + 8);

    *param_2 = (uint)puVar21;

    *(undefined4 *)(param_1 + 0x68) = *puVar21;

    *(undefined4 *)(param_1 + 0x6c) = *(undefined4 *)(uVar23 + 0xc);

    uVar23 = *param_2;

    puVar21 = (undefined4 *)(uVar23 + 8);

    *param_2 = (uint)puVar21;

    *(undefined4 *)(param_1 + 0x70) = *puVar21;

    *(undefined4 *)(param_1 + 0x74) = *(undefined4 *)(uVar23 + 0xc);

    uVar23 = *param_2;

    *param_2 = uVar23 + 8;

    *(undefined4 *)(param_1 + 0x78) = *(undefined4 *)(uVar23 + 8);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    iVar12 = *(int *)(param_1 + 0x78);

    *(undefined4 *)(param_1 + 0x7c) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    iVar13 = *(int *)(param_1 + 0x7c);

    *(undefined4 *)(param_1 + 0x80) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    *(undefined4 *)(param_1 + 0x84) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    iVar14 = *(int *)(param_1 + 0x80);

    *param_2 = uVar23 + 4;

    iVar15 = *(int *)(param_1 + 0x84);

    *(undefined4 *)(param_1 + 0x88) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    iVar16 = *(int *)(param_1 + 0x88);

    *(undefined4 *)(param_1 + 0x8c) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    *(undefined4 *)(param_1 + 0x90) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    iVar17 = *(int *)(param_1 + 0x8c);

    *param_2 = uVar23 + 4;

    iVar18 = *(int *)(param_1 + 0x90);

    *(undefined4 *)(param_1 + 0xa0) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    puVar21 = (undefined4 *)(uVar23 + 4);

    *param_2 = (uint)puVar21;

    uVar22 = *puVar21;

    *param_2 = uVar23 + 8;

    *(undefined4 *)(param_1 + 0xa4) = uVar22;

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

    *param_2 = *param_2 + 4;

    if (*(void **)(param_1 + 0x98) != (void *)0x0) {

      operator_delete__(*(void **)(param_1 + 0x98));

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

    }

    local_14 = param_3 - *param_2;

    if (0 < *(int *)(param_1 + 0x94)) {

      uVar22 = thunk_FUN_005df0f5(*(int *)(param_1 + 0x94) << 2);

      *(undefined4 *)(param_1 + 0x98) = uVar22;

      uVar23 = 0;

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

        do {

          if (local_14 < 4) {

            return 0;

          }

          *(undefined4 *)(*(int *)(param_1 + 0x98) + uVar23 * 4) = *(undefined4 *)*param_2;

          local_14 = local_14 - 4;

          *param_2 = *param_2 + 4;

          uVar23 = uVar23 + 1;

        } while (uVar23 < *(uint *)(param_1 + 0x94));

      }

    }

    iVar24 = FUN_004fd460(param_2,local_14);

    if (iVar24 == 0) {

      return 0;

    }

    local_14 = param_3 - (int)*param_2;

    if (local_14 < 4) {

      return 0;

    }

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

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    if (local_14 - 4 < 4) {

      return 0;

    }

    *(undefined4 *)(param_1 + 0xac) = *(undefined4 *)(uVar23 + 4);

    uVar23 = *param_2;

    *param_2 = uVar23 + 4;

    if (local_14 - 8 < 4) {

      return 0;

    }

    *(undefined4 *)(param_1 + 0xb0) = *(undefined4 *)(uVar23 + 4);

    *param_2 = *param_2 + 4;

    local_14 = local_14 - 0xc;

    iVar24 = FUN_004fd180(local_c,param_2,&local_14);

    if (iVar24 == 0) {

      return 0;

    }

    if (local_c[0] ==

        iVar19 + iVar1 + iVar2 + iVar3 + iVar4 + iVar5 + iVar6 + iVar7 + iVar8 + iVar9 + iVar10 +

        iVar11 + iVar12 + iVar13 + iVar14 + iVar15 + iVar16 + iVar17 + iVar18) goto LAB_005c8996;

  }

  local_10 = 0;

LAB_005c8996:

  return *param_2 <= param_3 & local_10;

}





// --- FUN_005c89d0 at 0x005C89D0 (size: 1762) ---


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



undefined4 FUN_005c89d0(int *param_1,int param_2)



{

  byte bVar1;

  uint uVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  char cVar8;

  int *piVar9;

  int iVar10;

  int *piVar11;

  char *pcVar12;

  byte *pbVar13;

  uint uVar14;

  int *piVar15;

  uint uVar16;

  byte *pbVar17;

  bool bVar18;

  undefined1 auStack_1d8 [4];

  undefined1 local_1d4 [96];

  int local_174;

  int local_168;

  int local_15c;

  int local_150;

  int local_144;

  int local_138;

  int local_134;

  int local_12c;

  int local_128;

  int local_120;

  int local_11c;

  int local_114;

  int local_110;

  int local_108;

  undefined1 local_f8 [20];

  int local_e4;

  uint local_e0;

  int iStack_b0;

  undefined1 auStack_38 [4];

  undefined1 auStack_34 [4];

  undefined1 auStack_30 [4];

  undefined1 auStack_2c [4];

  undefined1 auStack_28 [4];

  byte abStack_24 [36];

  

  piVar9 = (int *)FUN_00415730(0xe,2,0x10000002);

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

    return 0;

  }

  uVar2 = param_1[1];

  if ((uVar2 == 0) || ((uint)piVar9[0x2b] < uVar2)) {

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

    return 0;

  }

  FUN_005c3380(local_f8,uVar2);

  if (((param_1[1] == 4) && (param_2 == 0)) || ((iVar10 = param_1[2], iVar10 != 1 && (iVar10 != 2)))

     ) goto LAB_005c8e78;

  FUN_005c2b30(local_1d4,iVar10);

  if ((local_150 <= param_1[3]) || (param_1[3] < 0)) {

    FUN_0047daa0();

    FUN_0047e300();

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

    return 0;

  }

  if ((((((((param_1[4] < local_144) && (-1 < param_1[4])) && (param_1[5] < local_138)) &&

         ((-1 < param_1[5] && (param_1[6] < local_174)))) && (-1 < param_1[6])) &&

       (((param_1[7] < local_15c && (-1 < param_1[7])) &&

        ((param_1[8] < local_168 &&

         (((-1 < param_1[8] && (iVar10 = param_1[9], iVar10 < local_12c)) && (-2 < iVar10)))))))) &&

      ((iVar10 < 0 ||

       ((iVar10 = FUN_004ef2f0(*(undefined4 *)(iVar10 * 0x10 + 8 + local_134)), iVar10 != 0 &&

        (iVar10 = FUN_005a85f0(param_1[0xd]), iVar10 != 0)))))) &&

     (((((iVar10 = param_1[10], iVar10 < local_120 &&

         ((-1 < iVar10 &&

          (iVar10 = FUN_004ef2f0(*(undefined4 *)(iVar10 * 0x10 + 8 + local_128)), iVar10 != 0)))) &&

        (iVar10 = FUN_005a85f0(param_1[0xe]), iVar10 != 0)) &&

       (((((((iVar10 = param_1[0xb], iVar10 < local_114 && (-1 < iVar10)) &&

            (iVar10 = FUN_004ef2f0(*(undefined4 *)(iVar10 * 0x10 + 8 + local_11c)), iVar10 != 0)) &&

           (((iVar10 = FUN_005a85f0(param_1[0xf]), iVar10 != 0 &&

             (iVar10 = param_1[0xc], iVar10 < local_108)) &&

            ((-1 < iVar10 &&

             ((iVar10 = FUN_004ef2f0(*(undefined4 *)(iVar10 * 0x10 + 8 + local_110)), iVar10 != 0 &&

              (iVar10 = FUN_005a85f0(param_1[0x10]), iVar10 != 0)))))))) &&

          ((*(double *)(param_1 + 0x12) <= _DAT_007938c0 &&

           ((((_DAT_00795610 <= *(double *)(param_1 + 0x12) &&

              (*(double *)(param_1 + 0x14) <= _DAT_007938c0)) &&

             (_DAT_00795610 <= *(double *)(param_1 + 0x14))) &&

            ((*(double *)(param_1 + 0x16) <= _DAT_007938c0 &&

             (_DAT_00795610 <= *(double *)(param_1 + 0x16))))))))) &&

         (((((*(double *)(param_1 + 0x18) <= _DAT_007938c0 &&

             ((_DAT_00795610 <= *(double *)(param_1 + 0x18) &&

              (*(double *)(param_1 + 0x1a) <= _DAT_007938c0)))) &&

            (_DAT_00795610 <= *(double *)(param_1 + 0x1a))) &&

           (((*(double *)(param_1 + 0x1c) <= _DAT_007938c0 &&

             (_DAT_00795610 <= *(double *)(param_1 + 0x1c))) && (iVar10 = param_1[0x1f], 9 < iVar10)

            ))) && (((iVar10 < 0x65 && (iVar3 = param_1[0x20], 9 < iVar3)) &&

                    ((iVar3 < 0x65 && ((iVar4 = param_1[0x21], 9 < iVar4 && (iVar4 < 0x65))))))))))

        && (iVar5 = param_1[0x22], 9 < iVar5)))) &&

      ((((iVar5 < 0x65 && (iVar6 = param_1[0x23], 9 < iVar6)) && (iVar6 < 0x65)) &&

       (((iVar7 = param_1[0x24], 9 < iVar7 && (iVar7 < 0x65)) &&

        ((iVar5 + iVar4 + iVar3 + iVar10 + iVar7 + iVar6 <= local_e4 &&

         (piVar11 = (int *)FUN_00413a00(4,2,0x10000004), piVar11 != (int *)0x0)))))))))) {

    uVar2 = param_1[0x25];

    iVar10 = 0;

    uVar14 = 0;

    if (uVar2 != 0) {

      piVar15 = (int *)param_1[0x26];

      do {

        iVar3 = *piVar15;

        if (iVar3 != 0) {

          if ((iVar3 < 1) || (3 < iVar3)) {

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

            goto LAB_005c8e6f;

          }

          iVar10 = iVar10 + 1;

        }

        uVar14 = uVar14 + 1;

        piVar15 = piVar15 + 1;

      } while (uVar14 < uVar2);

    }

    if (iVar10 == piVar11[0x12]) {

      uVar14 = 0;

      uVar16 = 0;

      if (uVar2 != 0) {

        do {

          iVar10 = *(int *)(param_1[0x26] + uVar16 * 4);

          if (iVar10 == 2) {

            iVar10 = FUN_005c36b0(uVar16,param_1[1],param_1[2]);

LAB_005c8e51:

            uVar14 = uVar14 + iVar10;

          }

          else if (iVar10 == 3) {

            iVar10 = FUN_005c37b0(uVar16,param_1[1],param_1[2]);

            goto LAB_005c8e51;

          }

          uVar16 = uVar16 + 1;

        } while (uVar16 < (uint)param_1[0x25]);

        if (local_e0 < uVar14) goto LAB_005c8e67;

      }

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

      iVar10 = *(int *)(param_1[0x27] + 8);

      if ((iVar10 != 1) && (iVar10 - 1U < 0x21)) {

        pcVar12 = (char *)(param_1[0x27] + 0x14);

        iVar10 = -(int)pcVar12;

        do {

          cVar8 = *pcVar12;

          pcVar12[(int)(abStack_24 + iVar10)] = cVar8;

          pcVar12 = pcVar12 + 1;

        } while (cVar8 != '\0');

        FUN_005be6a0(abStack_24);

        pbVar13 = (byte *)(param_1[0x27] + 0x14);

        pbVar17 = abStack_24;

        do {

          bVar1 = *pbVar17;

          bVar18 = bVar1 < *pbVar13;

          if (bVar1 != *pbVar13) {

LAB_005c8f18:

            iVar10 = (1 - (uint)bVar18) - (uint)(bVar18 != 0);

            goto LAB_005c8f1d;

          }

          if (bVar1 == 0) break;

          bVar1 = pbVar17[1];

          bVar18 = bVar1 < pbVar13[1];

          if (bVar1 != pbVar13[1]) goto LAB_005c8f18;

          pbVar17 = pbVar17 + 2;

          pbVar13 = pbVar13 + 2;

        } while (bVar1 != 0);

        iVar10 = 0;

LAB_005c8f1d:

        if ((((iVar10 == 0) && (iVar10 = param_1[0x1e], iVar10 < iStack_b0)) &&

            ((-1 < iVar10 || (iVar10 == -1)))) && ((uint)param_1[0x2a] < (uint)piVar9[0xe])) {

          FUN_00401340("Sanamar");

          cVar8 = FUN_00401920(auStack_1d8);

          if ((cVar8 == '\0') || (param_2 != 0)) {

            bVar18 = false;

          }

          else {

            bVar18 = true;

          }

          FUN_004011b0();

          if ((!bVar18) &&

             ((iVar10 = (**(code **)(*param_1 + 0x2c))(), iVar10 == 0 ||

              (iVar10 = (**(code **)(*param_1 + 0x28))(), iVar10 != 0)))) {

            iVar10 = (**(code **)(*param_1 + 0x28))();

            if (iVar10 == 0) {

LAB_005c9047:

              FUN_0047daa0();

              FUN_0047e300();

              FUN_0049b890();

              return 1;

            }

            piVar9 = (int *)FUN_004bdec0(auStack_1d8,0x10000004);

            iVar10 = *piVar9;

            piVar9 = (int *)(**(code **)(*param_1 + 0x20))(auStack_2c);

            if (*piVar9 == iVar10) goto LAB_005c9047;

            piVar9 = (int *)FUN_004bdec0(auStack_28,0x10000092);

            iVar10 = *piVar9;

            piVar9 = (int *)(**(code **)(*param_1 + 0x20))(auStack_38);

            if (*piVar9 == iVar10) goto LAB_005c9047;

            piVar9 = (int *)FUN_004bdec0(auStack_30,0x10000093);

            iVar10 = *piVar9;

            piVar9 = (int *)(**(code **)(*param_1 + 0x20))(auStack_34);

            if (*piVar9 == iVar10) goto LAB_005c9047;

          }

        }

      }

    }

    else {

LAB_005c8e67:

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

    }

  }

LAB_005c8e6f:

  FUN_0047daa0();

LAB_005c8e78:

  FUN_0047e300();

  FUN_0049b890();

  return 0;

}





// --- FUN_005c92b0 at 0x005C92B0 (size: 114) ---


void FUN_005c92b0(undefined4 param_1,undefined4 param_2,LPSTR param_3)



{

  NUMBERFMTA local_38;

  char local_20 [32];

  

  local_38.NumDigits = 0;

  local_38.LeadingZero = 0;

  local_38.Grouping = 3;

  local_38.lpDecimalSep = ".";

  local_38.lpThousandSep = ",";

  local_38.NegativeOrder = 1;

  sprintf(local_20,"%I64d",param_1,param_2);

  GetNumberFormatA(0x400,0,local_20,&local_38,param_3,0x20);

  return;

}





// --- FUN_005c9330 at 0x005C9330 (size: 53) ---


undefined4 FUN_005c9330(undefined4 param_1)



{

  int *piVar1;

  undefined4 uVar2;

  

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  uVar2 = FUN_005cabd0(param_1);

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

  return uVar2;

}





// --- FUN_005c9370 at 0x005C9370 (size: 53) ---


undefined4 FUN_005c9370(undefined4 param_1)



{

  int *piVar1;

  undefined4 uVar2;

  

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  uVar2 = FUN_005cabf0(param_1);

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

  return uVar2;

}





// --- FUN_005c93b0 at 0x005C93B0 (size: 106) ---


undefined4 FUN_005c93b0(int param_1,undefined4 param_2)



{

  int *piVar1;

  undefined4 uVar2;

  

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  if (param_1 != 2) {

    if (param_1 != 3) {

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

      return 0xffffffff;

    }

    uVar2 = FUN_005cabb0(param_2);

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

    return uVar2;

  }

  uVar2 = FUN_005cab90(param_2);

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

  return uVar2;

}





// --- FUN_005c9420 at 0x005C9420 (size: 105) ---


undefined4 FUN_005c9420(int param_1,undefined4 param_2)



{

  int *piVar1;

  undefined4 uVar2;

  

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  if (param_1 != 2) {

    if (param_1 != 3) {

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

      return 0;

    }

    uVar2 = FUN_005cadf0(param_2);

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

    return uVar2;

  }

  uVar2 = FUN_005cade0(param_2);

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

  return uVar2;

}





// --- FUN_005c9490 at 0x005C9490 (size: 53) ---


undefined4 FUN_005c9490(undefined4 param_1)



{

  int *piVar1;

  undefined4 uVar2;

  

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  uVar2 = FUN_005cae00(param_1);

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

  return uVar2;

}





// --- FUN_005c94d0 at 0x005C94D0 (size: 53) ---


undefined4 FUN_005c94d0(undefined4 param_1)



{

  int *piVar1;

  undefined4 uVar2;

  

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  uVar2 = FUN_005cae10(param_1);

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

  return uVar2;

}





// --- FUN_005c9510 at 0x005C9510 (size: 61) ---


undefined8 FUN_005c9510(undefined4 param_1)



{

  int *piVar1;

  undefined8 uVar2;

  

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  uVar2 = FUN_005cac10(param_1);

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

  return uVar2;

}





// --- FUN_005c9550 at 0x005C9550 (size: 37) ---


int FUN_005c9550(void)



{

  int iVar1;

  int *piVar2;

  

  piVar2 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  iVar1 = piVar2[0x14];

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

  return iVar1;

}





// --- FUN_005c9580 at 0x005C9580 (size: 37) ---


int FUN_005c9580(void)



{

  int iVar1;

  int *piVar2;

  

  piVar2 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  iVar1 = piVar2[0x12];

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

  return iVar1;

}





// --- FUN_005c95b0 at 0x005C95B0 (size: 37) ---


int FUN_005c95b0(void)



{

  int iVar1;

  int *piVar2;

  

  piVar2 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  iVar1 = piVar2[0xe];

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

  return iVar1;

}





// --- FUN_005c95e0 at 0x005C95E0 (size: 37) ---


int FUN_005c95e0(void)



{

  int iVar1;

  int *piVar2;

  

  piVar2 = (int *)FUN_00415730(3,2,0x10000009);

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

    return 0;

  }

  iVar1 = piVar2[0x10];

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

  return iVar1;

}





// --- FUN_005c9610 at 0x005C9610 (size: 25) ---


longlong FUN_005c9610(uint param_1,uint param_2)



{

  int *piVar1;

  longlong lVar2;

  longlong lVar3;

  

  if (param_2 <= param_1) {

    return 0;

  }

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    lVar2 = 0;

  }

  else {

    lVar2 = FUN_005cac10(param_2);

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

  }

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    return lVar2;

  }

  lVar3 = FUN_005cac10(param_1);

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

  return lVar2 - lVar3;

}





// --- FUN_005c9629 at 0x005C9629 (size: 147) ---


longlong FUN_005c9629(void)



{

  int *piVar1;

  undefined4 unaff_EDI;

  longlong lVar2;

  longlong lVar3;

  undefined4 in_stack_00000010;

  

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    lVar2 = 0;

  }

  else {

    lVar2 = FUN_005cac10(unaff_EDI);

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

  }

  piVar1 = (int *)FUN_00415730(3,2,0x10000009);

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

    return lVar2;

  }

  lVar3 = FUN_005cac10(in_stack_00000010);

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

  return lVar2 - lVar3;

}





// --- FUN_005c96c0 at 0x005C96C0 (size: 129) ---


undefined4 FUN_005c96c0(undefined4 *param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  int iVar3;

  LONG LVar4;

  

  iVar3 = (int)param_1;

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

    return 0;

  }

  piVar2 = (int *)FUN_00415730(4,2,0x10000004);

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

    iVar3 = FUN_0049b8b0(iVar3);

    if (iVar3 != 0) {

      puVar1 = *(undefined4 **)(iVar3 + 8);

      param_1 = puVar1;

      InterlockedIncrement(puVar1 + 1);

      FUN_0048a0a0(&param_1);

      LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

      }

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

      return 1;

    }

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

  }

  return 0;

}





// --- FUN_005c9750 at 0x005C9750 (size: 129) ---


undefined4 FUN_005c9750(undefined4 *param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  int iVar3;

  LONG LVar4;

  

  iVar3 = (int)param_1;

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

    return 0;

  }

  piVar2 = (int *)FUN_00415730(4,2,0x10000004);

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

    iVar3 = FUN_0049b8b0(iVar3);

    if (iVar3 != 0) {

      puVar1 = *(undefined4 **)(iVar3 + 4);

      param_1 = puVar1;

      InterlockedIncrement(puVar1 + 1);

      FUN_0048a0a0(&param_1);

      LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

      }

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

      return 1;

    }

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

  }

  return 0;

}





// --- FUN_005c97e0 at 0x005C97E0 (size: 122) ---


undefined4 FUN_005c97e0(int param_1)



{

  switch(param_1 + -1) {

  case 0:

    FUN_004034c0("Strength");

    return 1;

  case 1:

    FUN_004034c0("Endurance");

    return 1;

  case 2:

    FUN_004034c0("Quickness");

    return 1;

  case 3:

    FUN_004034c0("Coordination");

    return 1;

  case 4:

    FUN_004034c0("Focus");

    return 1;

  case 5:

    FUN_004034c0(&DAT_007e888c);

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005c9880 at 0x005C9880 (size: 122) ---


undefined4 FUN_005c9880(int param_1)



{

  switch(param_1 + -1) {

  case 0:

    FUN_004034c0("Maximum Health");

    return 1;

  case 1:

    FUN_004034c0("Health");

    return 1;

  case 2:

    FUN_004034c0("Maximum Stamina");

    return 1;

  case 3:

    FUN_004034c0("Stamina");

    return 1;

  case 4:

    FUN_004034c0("Maximum Mana");

    return 1;

  case 5:

    FUN_004034c0(&DAT_007e89c0);

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005c9920 at 0x005C9920 (size: 104) ---


char FUN_005c9920(undefined4 param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  char cVar2;

  LONG LVar3;

  undefined4 *local_4;

  

  local_4 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  cVar2 = FUN_005c96c0(param_1,&local_4);

  puVar1 = local_4;

  if (cVar2 != '\0') {

    FUN_004027b0(param_2,&DAT_007a0440,local_4 + 5);

  }

  LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  return cVar2;

}





// --- FUN_005c9990 at 0x005C9990 (size: 19) ---


undefined4 FUN_005c9990(undefined4 *param_1)



{

  uint uVar1;

  bool bVar2;

  bool bVar3;

  undefined4 *puVar4;

  int *piVar5;

  int iVar6;

  LONG LVar7;

  undefined4 *puVar8;

  undefined4 **ppuVar9;

  undefined4 *puStack_2c;

  int iStack_28;

  undefined4 *puStack_24;

  int *piStack_20;

  int iStack_18;

  uint uStack_10;

  int iStack_c;

  int iStack_8;

  int iStack_4;

  

  puVar8 = param_1;

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

    return 0;

  }

  piVar5 = (int *)FUN_00415730(4,2,0x10000004);

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

    return 0;

  }

  piStack_20 = piVar5;

  iVar6 = FUN_0049b8b0(puVar8);

  if (iVar6 == 0) {

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

    return 0;

  }

  iStack_18 = *(int *)(iVar6 + 0x28);

  uVar1 = *(uint *)(iVar6 + 0x2c);

  uStack_10 = *(uint *)(iVar6 + 0x30);

  iStack_c = *(int *)(iVar6 + 0x34);

  iStack_8 = *(int *)(iVar6 + 0x38);

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

  if ((uVar1 == 0) || (iStack_8 == 0)) {

    puStack_24 = (undefined4 *)0x0;

    bVar2 = false;

  }

  else {

    bVar2 = true;

    puStack_24 = (undefined4 *)0x1;

  }

  if ((uStack_10 == 0) || (iStack_4 == 0)) {

    iStack_28 = 0;

    bVar3 = false;

  }

  else {

    bVar3 = true;

    iStack_28 = 1;

  }

  if ((!bVar2) && (!bVar3)) {

    FUN_0049b890();

    return 0;

  }

  FUN_004034c0(&DAT_007e8a2c);

  if ((bVar2) && (bVar3)) {

    FUN_0048c3e0(&DAT_007e8a28);

    FUN_004914f0(&param_1);

    FUN_005abb30();

  }

  puVar8 = DAT_008ef11c;

  puStack_2c = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  param_1 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  puVar4 = puStack_24;

  iVar6 = iStack_28;

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

    FUN_005c97e0(iStack_8,&puStack_2c);

    puVar8 = puStack_2c;

    if (uVar1 < 2) {

      ppuVar9 = &puStack_2c;

    }

    else {

      FUN_00487620(&param_1,"(%u x %s)",uVar1,puStack_2c);

      ppuVar9 = &param_1;

    }

    FUN_004914f0(ppuVar9);

    iVar6 = iStack_28;

    if (iStack_28 == 0) goto LAB_005c9b8f;

    FUN_0048c3e0(&DAT_007e8a18);

    FUN_004914f0(&puStack_24);

    FUN_005abb30();

  }

  if (iVar6 != 0) {

    FUN_005c97e0(iStack_4,&puStack_2c);

    puVar8 = puStack_2c;

    if (uStack_10 < 2) {

      FUN_004914f0(&puStack_2c);

      puVar8 = puStack_2c;

    }

    else {

      FUN_00487620(&param_1,"(%u x %s)",uStack_10,puStack_2c);

      FUN_004914f0(&param_1);

    }

  }

LAB_005c9b8f:

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

    FUN_0048c3e0(&DAT_00798584);

    FUN_004914f0(&puStack_24);

    FUN_005abb30();

  }

  if (iStack_c != 1) {

    FUN_00487620(&param_1," / %u",iStack_c);

    FUN_004914f0(&param_1);

  }

  if (iStack_18 != 0) {

    FUN_00487620(&param_1,&DAT_007e8a0c,iStack_18);

    FUN_004914f0(&param_1);

  }

  FUN_0048c3e0(&DAT_007e8a08);

  FUN_004914f0(&puStack_24);

  puVar4 = puStack_24;

  LVar7 = InterlockedDecrement(puStack_24 + 1);

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

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

  }

  puVar4 = param_1;

  LVar7 = InterlockedDecrement(param_1 + 1);

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

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

  }

  LVar7 = InterlockedDecrement(puVar8 + 1);

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

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

  }

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

  return 1;

}





// --- FUN_005c99a3 at 0x005C99A3 (size: 739) ---


undefined4

FUN_005c99a3(undefined4 *param_1,int param_2,undefined4 *param_3,int *param_4,undefined4 param_5,

            int param_6,undefined4 param_7,uint param_8,int param_9,int param_10,int param_11,

            undefined4 param_12,undefined4 *param_13)



{

  uint uVar1;

  bool bVar2;

  bool bVar3;

  undefined4 *puVar4;

  int *piVar5;

  int iVar6;

  LONG LVar7;

  undefined4 unaff_EDI;

  undefined4 *puVar8;

  undefined4 *puVar9;

  

  piVar5 = (int *)FUN_00415730(4,2,0x10000004);

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

    return 0;

  }

  param_4 = piVar5;

  iVar6 = FUN_0049b8b0(unaff_EDI);

  if (iVar6 == 0) {

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

    return 0;

  }

  param_6 = *(int *)(iVar6 + 0x28);

  uVar1 = *(uint *)(iVar6 + 0x2c);

  param_8 = *(uint *)(iVar6 + 0x30);

  param_9 = *(int *)(iVar6 + 0x34);

  param_10 = *(int *)(iVar6 + 0x38);

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

  if ((uVar1 == 0) || (param_10 == 0)) {

    param_3 = (undefined4 *)0x0;

    bVar2 = false;

  }

  else {

    bVar2 = true;

    param_3 = (undefined4 *)0x1;

  }

  if ((param_8 == 0) || (param_11 == 0)) {

    param_2 = 0;

    bVar3 = false;

  }

  else {

    bVar3 = true;

    param_2 = 1;

  }

  if ((!bVar2) && (!bVar3)) {

    FUN_0049b890();

    return 0;

  }

  FUN_004034c0(&DAT_007e8a2c);

  if ((bVar2) && (bVar3)) {

    FUN_0048c3e0(&DAT_007e8a28);

    FUN_004914f0(&param_13);

    FUN_005abb30();

  }

  puVar8 = DAT_008ef11c;

  param_1 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  param_13 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  puVar4 = param_3;

  iVar6 = param_2;

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

    FUN_005c97e0(param_10,&param_1);

    puVar8 = param_1;

    if (uVar1 < 2) {

      puVar9 = &param_1;

    }

    else {

      FUN_00487620(&param_13,"(%u x %s)",uVar1,param_1);

      puVar9 = &param_13;

    }

    FUN_004914f0(puVar9);

    iVar6 = param_2;

    if (param_2 == 0) goto LAB_005c9b8f;

    FUN_0048c3e0(&DAT_007e8a18);

    FUN_004914f0(&param_3);

    FUN_005abb30();

  }

  if (iVar6 != 0) {

    FUN_005c97e0(param_11,&param_1);

    puVar8 = param_1;

    if (param_8 < 2) {

      FUN_004914f0(&param_1);

      puVar8 = param_1;

    }

    else {

      FUN_00487620(&param_13,"(%u x %s)",param_8,param_1);

      FUN_004914f0(&param_13);

    }

  }

LAB_005c9b8f:

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

    FUN_0048c3e0(&DAT_00798584);

    FUN_004914f0(&param_3);

    FUN_005abb30();

  }

  if (param_9 != 1) {

    FUN_00487620(&param_13," / %u",param_9);

    FUN_004914f0(&param_13);

  }

  if (param_6 != 0) {

    FUN_00487620(&param_13,&DAT_007e8a0c,param_6);

    FUN_004914f0(&param_13);

  }

  FUN_0048c3e0(&DAT_007e8a08);

  FUN_004914f0(&param_3);

  puVar4 = param_3;

  LVar7 = InterlockedDecrement(param_3 + 1);

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

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

  }

  puVar4 = param_13;

  LVar7 = InterlockedDecrement(param_13 + 1);

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

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

  }

  LVar7 = InterlockedDecrement(puVar8 + 1);

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

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

  }

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

  return 1;

}





// --- FUN_005c9c90 at 0x005C9C90 (size: 104) ---


char FUN_005c9c90(undefined4 param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  char cVar2;

  LONG LVar3;

  undefined4 *local_4;

  

  local_4 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  cVar2 = FUN_005c9990(param_1,&local_4);

  puVar1 = local_4;

  if (cVar2 != '\0') {

    FUN_004027b0(param_2,&DAT_007a0440,local_4 + 5);

  }

  LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  return cVar2;

}





// --- FUN_005c9d00 at 0x005C9D00 (size: 104) ---


char FUN_005c9d00(undefined4 param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  char cVar2;

  LONG LVar3;

  undefined4 *local_4;

  

  local_4 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  cVar2 = FUN_005c9750(param_1,&local_4);

  puVar1 = local_4;

  if (cVar2 != '\0') {

    FUN_004027b0(param_2,&DAT_007a0440,local_4 + 5);

  }

  LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  return cVar2;

}





// --- FUN_005c9d70 at 0x005C9D70 (size: 122) ---


undefined4 FUN_005c9d70(int param_1)



{

  switch(param_1 + -1) {

  case 0:

    FUN_00407e40(L"Strength");

    return 1;

  case 1:

    FUN_00407e40(L"Endurance");

    return 1;

  case 2:

    FUN_00407e40(L"Quickness");

    return 1;

  case 3:

    FUN_00407e40(L"Coordination");

    return 1;

  case 4:

    FUN_00407e40(L"Focus");

    return 1;

  case 5:

    FUN_00407e40(L"Self");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005c9e10 at 0x005C9E10 (size: 122) ---


undefined4 FUN_005c9e10(int param_1)



{

  switch(param_1 + -1) {

  case 0:

    FUN_00407e40(L"Measures your character\'s muscular power.");

    return 1;

  case 1:

    FUN_00407e40(L"Measures how healthy your character is.");

    return 1;

  case 2:

    FUN_00407e40(L"Measures how fast your character is.");

    return 1;

  case 3:

    FUN_00407e40(L"Measures your character\'s reflexes");

    return 1;

  case 4:

    FUN_00407e40(L"Measures your character\'s mind and senses.");

    return 1;

  case 5:

    FUN_00407e40(L"Measures your character\'s willpower.");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005c9eb0 at 0x005C9EB0 (size: 122) ---


undefined4 FUN_005c9eb0(int param_1)



{

  switch(param_1 + -1) {

  case 0:

    FUN_00407e40(L"Maximum Health");

    return 1;

  case 1:

    FUN_00407e40(L"Health");

    return 1;

  case 2:

    FUN_00407e40(L"Maximum Stamina");

    return 1;

  case 3:

    FUN_00407e40(L"Stamina");

    return 1;

  case 4:

    FUN_00407e40(L"Maximum Mana");

    return 1;

  case 5:

    FUN_00407e40(L"Mana");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005c9f50 at 0x005C9F50 (size: 71) ---


undefined4 FUN_005c9f50(int param_1)



{

  switch(param_1 + -1) {

  case 0:

  case 1:

    FUN_00407e40(L"(Endurance/2)\nIf you run out of health, you will die!");

    return 1;

  case 2:

  case 3:

    FUN_00407e40(L"(Endurance)\nAffects your actions and movement.");

    return 1;

  case 4:

  case 5:

    FUN_00407e40(L"(Self)\nAffects how much magic you can cast.");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005c9fb0 at 0x005C9FB0 (size: 69) ---


void FUN_005c9fb0(void)



{

  _CIpow();

  _CIpow();

  FUN_005df4c4();

  return;

}





// --- FUN_005ca000 at 0x005CA000 (size: 23) ---


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



float10 FUN_005ca000(double param_1)



{

  return ((float10)param_1 - (float10)_DAT_007938c0) * (float10)_DAT_00823c60 +

         (float10)_DAT_007938c0;

}





// --- FUN_005ca020 at 0x005CA020 (size: 1545) ---


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



undefined4 FUN_005ca020(int param_1,double param_2)



{

  undefined4 uVar1;

  char *pcVar2;

  undefined1 local_14 [4];

  undefined1 local_10 [4];

  undefined1 local_c [4];

  undefined1 local_8 [4];

  undefined1 local_4 [4];

  

  if (param_2 < _DAT_00795610) {

    return 0;

  }

  if (param_1 < 0x11) {

    if (param_1 == 0x10) {

      if (param_2 < _DAT_007a7e00 != (param_2 == _DAT_007a7e00)) {

        FUN_004034c0("singe");

        FUN_004034c0("singes");

        return 1;

      }

      if (param_2 < _DAT_007994a8 != (param_2 == _DAT_007994a8)) {

        FUN_004034c0("scorch");

        FUN_004034c0("scorches");

        return 1;

      }

      if (param_2 < _DAT_00799088 != (param_2 == _DAT_00799088)) {

        FUN_004034c0(&DAT_007e8ed4);

        FUN_004034c0("burns");

        return 1;

      }

      FUN_004034c0("incinerate");

      FUN_004034c0("incinerates");

      return 1;

    }

    switch(param_1) {

    case 1:

      if (param_2 < _DAT_007a7e00 != (param_2 == _DAT_007a7e00)) {

        FUN_004034c0("scratch");

        FUN_004034c0("scratches");

        return 1;

      }

      if (param_2 < _DAT_007994a8 != (param_2 == _DAT_007994a8)) {

        FUN_004034c0(&DAT_007e78a8);

        FUN_004034c0(&DAT_007e8f40);

        return 1;

      }

      if (param_2 < _DAT_00799088 != (param_2 == _DAT_00799088)) {

        FUN_004034c0("slash");

        FUN_004034c0("slashes");

        return 1;

      }

      FUN_004034c0("mangle");

      FUN_004034c0("mangles");

      return 1;

    case 2:

      if (param_2 < _DAT_007a7e00 == (param_2 == _DAT_007a7e00)) {

        if (param_2 < _DAT_007994a8 == (param_2 == _DAT_007994a8)) {

          if (param_2 < _DAT_00799088 == (param_2 == _DAT_00799088)) {

            pcVar2 = "gore";

          }

          else {

            pcVar2 = "impale";

          }

        }

        else {

          pcVar2 = "stab";

        }

      }

      else {

        pcVar2 = "nick";

      }

      FUN_004034c0(pcVar2);

      FUN_0048c3e0(&DAT_00795520);

      uVar1 = FUN_004a2b90(local_10,&param_2);

      FUN_0048a0a0(uVar1);

      break;

    default:

switchD_005ca05a_caseD_3:

      FUN_004034c0(&DAT_007e8e2c);

      FUN_004034c0(&DAT_007e8e24);

      return 0;

    case 4:

      if (param_2 < _DAT_007a7e00 != (param_2 == _DAT_007a7e00)) {

        FUN_004034c0("graze");

        FUN_004034c0("grazes");

        return 1;

      }

      if (param_2 < _DAT_007994a8 != (param_2 == _DAT_007994a8)) {

        FUN_004034c0(&DAT_007e8f84);

        FUN_004034c0("bashes");

        return 1;

      }

      if (param_2 < _DAT_00799088 != (param_2 == _DAT_00799088)) {

        FUN_004034c0("smash");

        FUN_004034c0("smashes");

        return 1;

      }

      FUN_004034c0("crush");

      FUN_004034c0("crushes");

      return 1;

    case 8:

      if (param_2 < _DAT_007a7e00 == (param_2 == _DAT_007a7e00)) {

        if (param_2 < _DAT_007994a8 == (param_2 == _DAT_007994a8)) {

          if (param_2 < _DAT_00799088 == (param_2 == _DAT_00799088)) {

            pcVar2 = "freeze";

          }

          else {

            pcVar2 = "frost";

          }

        }

        else {

          pcVar2 = "chill";

        }

      }

      else {

        pcVar2 = "numb";

      }

      FUN_004034c0(pcVar2);

      FUN_0048c3e0(&DAT_00795520);

      uVar1 = FUN_004a2b90(local_14,&param_2);

      FUN_0048a0a0(uVar1);

    }

  }

  else if (param_1 < 0x81) {

    if (param_1 == 0x80) {

      if (param_2 < _DAT_007a7e00 == (param_2 == _DAT_007a7e00)) {

        if (param_2 < _DAT_007994a8 == (param_2 == _DAT_007994a8)) {

          if (param_2 < _DAT_00799088 == (param_2 == _DAT_00799088)) {

            pcVar2 = "deplete";

          }

          else {

            pcVar2 = "siphon";

          }

        }

        else {

          pcVar2 = "exhaust";

        }

      }

      else {

        pcVar2 = "drain";

      }

      FUN_004034c0(pcVar2);

      FUN_0048c3e0(&DAT_00795520);

      uVar1 = FUN_004a2b90(local_8,&param_2);

      FUN_0048a0a0(uVar1);

    }

    else {

      if (param_1 != 0x20) {

        if (param_1 == 0x40) {

          if (param_2 < _DAT_007a7e00 != (param_2 == _DAT_007a7e00)) {

            FUN_004034c0("spark");

            FUN_004034c0("sparks");

            return 1;

          }

          if (param_2 < _DAT_007994a8 != (param_2 == _DAT_007994a8)) {

            FUN_004034c0("shock");

            FUN_004034c0("shocks");

            return 1;

          }

          if (param_2 < _DAT_00799088 != (param_2 == _DAT_00799088)) {

            FUN_004034c0(&DAT_007e8e8c);

            FUN_004034c0("jolts");

            return 1;

          }

          FUN_004034c0("blast");

          FUN_004034c0("blasts");

          return 1;

        }

        goto switchD_005ca05a_caseD_3;

      }

      if (param_2 < _DAT_007a7e00 == (param_2 == _DAT_007a7e00)) {

        if (param_2 < _DAT_007994a8 == (param_2 == _DAT_007994a8)) {

          if (param_2 < _DAT_00799088 == (param_2 == _DAT_00799088)) {

            pcVar2 = "dissolve";

          }

          else {

            pcVar2 = "corrode";

          }

        }

        else {

          pcVar2 = "sear";

        }

      }

      else {

        pcVar2 = "blister";

      }

      FUN_004034c0(pcVar2);

      FUN_0048c3e0(&DAT_00795520);

      uVar1 = FUN_004a2b90(local_c,&param_2);

      FUN_0048a0a0(uVar1);

    }

  }

  else {

    if (param_1 != 0x400) goto switchD_005ca05a_caseD_3;

    if (param_2 < _DAT_007a7e00 == (param_2 == _DAT_007a7e00)) {

      if (param_2 < _DAT_007994a8 == (param_2 == _DAT_007994a8)) {

        if (param_2 < _DAT_00799088 == (param_2 == _DAT_00799088)) {

          pcVar2 = "eradicate";

        }

        else {

          pcVar2 = "wither";

        }

      }

      else {

        pcVar2 = "twist";

      }

    }

    else {

      pcVar2 = "scar";

    }

    FUN_004034c0(pcVar2);

    FUN_0048c3e0(&DAT_00795520);

    uVar1 = FUN_004a2b90(local_4,&param_2);

    FUN_0048a0a0(uVar1);

  }

  FUN_005abb30();

  FUN_005abb30();

  return 1;

}





// --- FUN_005ca650 at 0x005CA650 (size: 33) ---


undefined4 FUN_005ca650(undefined4 param_1)



{

  switch(param_1) {

  case 1:

  case 2:

  case 4:

  case 5:

  case 6:

  case 7:

  case 8:

  case 10:

  case 0xb:

  case 0xc:

  case 0xd:

  case 0xe:

  case 0xf:

  case 0x10:

  case 0x11:

  case 0x12:

  case 0x13:

  case 0x14:

  case 0x15:

  case 0x16:

  case 0x17:

  case 0x18:

  case 0x19:

  case 0x1a:

  case 0x1b:

  case 0x1c:

  case 0x1d:

  case 0x1e:

  case 0x1f:

  case 0x20:

  case 0x21:

  case 0x22:

  case 0x23:

  case 0x24:

  case 0x25:

  case 0x26:

  case 0x27:

  case 0x28:

  case 0x29:

  case 0x2a:

  case 0x2b:

  case 0x2c:

  case 0x2d:

  case 0x2e:

  case 0x2f:

  case 0x30:

  case 0x31:

  case 0x32:

  case 0x33:

  case 0x34:

  case 0x35:

  case 0x36:

  case 0x37:

  case 0x39:

  case 0x3a:

  case 0x3b:

  case 0x3c:

  case 0x3d:

  case 0x3e:

  case 0x3f:

  case 0x40:

  case 0x42:

  case 0x43:

  case 0x44:

  case 0x45:

  case 0x46:

  case 0x47:

  case 0x49:

  case 0x4a:

  case 0x4b:

  case 0x4c:

  case 0x4d:

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005ca6d0 at 0x005CA6D0 (size: 4) ---


int __fastcall FUN_005ca6d0(int param_1)



{

  return param_1 + 0x18;

}





// --- FUN_005ca770 at 0x005CA770 (size: 151) ---


undefined4 __fastcall FUN_005ca770(int param_1)



{

  int iVar1;

  int iVar2;

  uint unaff_EBX;

  int *unaff_EBP;

  undefined4 unaff_ESI;

  undefined4 local_4;

  

  local_4 = 0;

  iVar1 = (**(code **)(*(int *)(param_1 + 8) + 0xc))(&local_4,0);

  iVar2 = (**(code **)(*(int *)(param_1 + 0x18) + 0xc))(&stack0xfffffff4,0);

  if ((uint)(iVar1 + 8 + iVar2) <= unaff_EBX) {

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)*unaff_EBP;

    *unaff_EBP = *unaff_EBP + 4;

    iVar1 = (**(code **)(*(int *)(param_1 + 8) + 0x10))(unaff_EBP,unaff_EBX);

    if (iVar1 != 0) {

      iVar1 = (**(code **)(*(int *)(param_1 + 0x18) + 0x10))(unaff_EBP,unaff_ESI);

      if (iVar1 != 0) {

        *(undefined4 *)(param_1 + 0x30) = *(undefined4 *)*unaff_EBP;

        *unaff_EBP = *unaff_EBP + 4;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005ca850 at 0x005CA850 (size: 68) ---


undefined4 __thiscall FUN_005ca850(int param_1,int *param_2,uint param_3)



{

  int iVar1;

  undefined4 *puVar2;

  

  if (param_3 < 0x10) {

    return 0;

  }

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)*param_2;

  iVar1 = *param_2;

  puVar2 = (undefined4 *)(iVar1 + 4);

  *param_2 = (int)puVar2;

  *(undefined4 *)(param_1 + 8) = *puVar2;

  *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(iVar1 + 8);

  iVar1 = *param_2;

  *param_2 = iVar1 + 8;

  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(iVar1 + 8);

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_005ca8a0 at 0x005CA8A0 (size: 52) ---


int __fastcall FUN_005ca8a0(int param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  undefined4 local_4;

  

  piVar1 = *(int **)(param_1 + 4);

  iVar3 = 4;

  local_4 = 0;

  for (; piVar1 != (int *)0x0; piVar1 = (int *)piVar1[6]) {

    iVar2 = (**(code **)(*piVar1 + 0xc))(&local_4,0);

    iVar3 = iVar3 + iVar2;

  }

  return iVar3;

}





// --- FUN_005ca8e0 at 0x005CA8E0 (size: 71) ---


void __fastcall FUN_005ca8e0(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  while (iVar1 != 0) {

    puVar2 = *(undefined4 **)(param_1 + 4);

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

      iVar1 = puVar2[6];

      *(int *)(param_1 + 4) = iVar1;

      if (iVar1 == 0) {

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

      }

      else {

        *(undefined4 *)(iVar1 + 0x1c) = 0;

      }

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

        *puVar2 = &PTR_FUN_0079385c;

        operator_delete(puVar2);

      }

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

    }

    iVar1 = *(int *)(param_1 + 4);

  }

  return;

}





// --- FUN_005ca930 at 0x005CA930 (size: 22) ---


void __fastcall FUN_005ca930(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e8ff4;

  FUN_005ca8e0();

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005ca9e0 at 0x005CA9E0 (size: 110) ---


void __thiscall FUN_005ca9e0(int param_1,int param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0x20);

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

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = &PTR_FUN_007e8fe0;

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

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

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

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

    puVar2[6] = 0;

    puVar2[7] = 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 + 0x18) = puVar2;

  puVar2[7] = iVar1;

  *(undefined4 **)(param_1 + 8) = puVar2;

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

  return;

}





// --- FUN_005caa50 at 0x005CAA50 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007e8ff4;

  FUN_005ca8e0();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005caa80 at 0x005CAA80 (size: 55) ---


void __fastcall FUN_005caa80(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e9008;

  param_1[1] = 0;

  param_1[2] = &PTR_FUN_007a4ed0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = &PTR_FUN_007e8ff4;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  return;

}





// --- FUN_005caac0 at 0x005CAAC0 (size: 47) ---


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



{

  FUN_005ca930();

  FUN_0048bcc0();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005caaf0 at 0x005CAAF0 (size: 118) ---


undefined4 FUN_005caaf0(undefined4 param_1,undefined4 param_2)



{

  switch(param_2) {

  case 1:

    FUN_0048c3e0("peace");

    return param_1;

  case 2:

    FUN_0048c3e0("melee");

    return param_1;

  default:

    FUN_0048c3e0("unknown");

    return param_1;

  case 4:

    FUN_0048c3e0("missile");

    return param_1;

  case 8:

    FUN_0048c3e0("magic");

    return param_1;

  }

}





// --- FUN_005cab90 at 0x005CAB90 (size: 28) ---


undefined4 __thiscall FUN_005cab90(int param_1,uint param_2)



{

  if ((param_2 <= *(uint *)(param_1 + 0x48)) && (*(int *)(param_1 + 0x4c) != 0)) {

    return *(undefined4 *)(*(int *)(param_1 + 0x4c) + param_2 * 4);

  }

  return 0xffffffff;

}





// --- FUN_005cabb0 at 0x005CABB0 (size: 28) ---


undefined4 __thiscall FUN_005cabb0(int param_1,uint param_2)



{

  if ((param_2 <= *(uint *)(param_1 + 0x50)) && (*(int *)(param_1 + 0x54) != 0)) {

    return *(undefined4 *)(*(int *)(param_1 + 0x54) + param_2 * 4);

  }

  return 0xffffffff;

}





// --- FUN_005cabd0 at 0x005CABD0 (size: 28) ---


undefined4 __thiscall FUN_005cabd0(int param_1,uint param_2)



{

  if ((param_2 <= *(uint *)(param_1 + 0x38)) && (*(int *)(param_1 + 0x3c) != 0)) {

    return *(undefined4 *)(*(int *)(param_1 + 0x3c) + param_2 * 4);

  }

  return 0xffffffff;

}





// --- FUN_005cabf0 at 0x005CABF0 (size: 28) ---


undefined4 __thiscall FUN_005cabf0(int param_1,uint param_2)



{

  if ((param_2 <= *(uint *)(param_1 + 0x40)) && (*(int *)(param_1 + 0x44) != 0)) {

    return *(undefined4 *)(*(int *)(param_1 + 0x44) + param_2 * 4);

  }

  return 0xffffffff;

}





// --- FUN_005cac10 at 0x005CAC10 (size: 37) ---


undefined8 __thiscall FUN_005cac10(int param_1,uint param_2)



{

  int iVar1;

  

  if (*(uint *)(param_1 + 0x58) < param_2) {

    param_2 = *(uint *)(param_1 + 0x58);

  }

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

  if (iVar1 == 0) {

    return 0;

  }

  return CONCAT44(*(undefined4 *)(iVar1 + 4 + param_2 * 8),*(undefined4 *)(iVar1 + param_2 * 8));

}





// --- FUN_005cac40 at 0x005CAC40 (size: 89) ---


undefined4 __thiscall FUN_005cac40(int param_1,undefined4 param_2,uint param_3)



{

  int iVar1;

  

  switch(param_2) {

  case 1:

    if (*(uint *)(param_1 + 0x38) < param_3) {

      return 0xffffffff;

    }

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

    break;

  case 2:

    if (*(uint *)(param_1 + 0x40) < param_3) {

      return 0xffffffff;

    }

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

    break;

  case 3:

    if (*(uint *)(param_1 + 0x48) < param_3) {

      return 0xffffffff;

    }

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

    break;

  case 4:

    if (*(uint *)(param_1 + 0x50) < param_3) {

      return 0xffffffff;

    }

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

    if (iVar1 == 0) {

      return 0xffffffff;

    }

    goto LAB_005cac93;

  default:

    goto switchD_005cac4a_default;

  }

  if (iVar1 != 0) {

LAB_005cac93:

    return *(undefined4 *)(iVar1 + param_3 * 4);

  }

switchD_005cac4a_default:

  return 0xffffffff;

}





// --- FUN_005cacb0 at 0x005CACB0 (size: 272) ---


int FUN_005cacb0(undefined4 param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  undefined8 uVar3;

  int local_8;

  

  switch(param_1) {

  case 1:

    break;

  case 2:

    break;

  case 3:

    break;

  case 4:

    break;

  case 5:

    break;

  default:

  }

  iVar1 = FUN_005df4c4();

  local_8 = 1;

  do {

    FUN_005cac40(param_1,iVar1);

    uVar3 = FUN_005cac40(param_1,iVar1 + 1);

    if ((int)uVar3 - 1U < param_2) {

      iVar2 = FUN_005df4c4();

      if (iVar2 == 0) {

        return iVar1;

      }

    }

    else {

      if ((uint)((ulonglong)uVar3 >> 0x20) <= param_2) {

        return iVar1;

      }

      iVar2 = FUN_005df4c4();

      if (iVar2 == 0) {

        return iVar1;

      }

      iVar2 = -iVar2;

    }

    iVar1 = iVar1 + iVar2;

    local_8 = local_8 + 1;

    if (0x10 < local_8) {

      return iVar1;

    }

  } while( true );

}





// --- FUN_005cade0 at 0x005CADE0 (size: 15) ---


void FUN_005cade0(undefined4 param_1)



{

  FUN_005cacb0(3,param_1);

  return;

}





// --- FUN_005cadf0 at 0x005CADF0 (size: 15) ---


void FUN_005cadf0(undefined4 param_1)



{

  FUN_005cacb0(4,param_1);

  return;

}





// --- FUN_005cae00 at 0x005CAE00 (size: 15) ---


void FUN_005cae00(undefined4 param_1)



{

  FUN_005cacb0(1,param_1);

  return;

}





// --- FUN_005cae10 at 0x005CAE10 (size: 15) ---


void FUN_005cae10(undefined4 param_1)



{

  FUN_005cacb0(2,param_1);

  return;

}





// --- FUN_005caff0 at 0x005CAFF0 (size: 74) ---


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



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x18] = 0;

  *param_1 = &PTR_LAB_007e9098;

  param_1[0xc] = &PTR_LAB_007e9080;

  return param_1;

}





// --- FUN_005cb050 at 0x005CB050 (size: 123) ---


void __fastcall FUN_005cb050(int param_1)



{

  if (*(void **)(param_1 + 0x3c) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x3c));

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

  }

  if (*(void **)(param_1 + 0x44) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x44));

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

  }

  if (*(void **)(param_1 + 0x4c) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x4c));

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

  }

  if (*(void **)(param_1 + 0x54) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x54));

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

  }

  if (*(void **)(param_1 + 0x5c) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x5c));

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

  }

  if (*(void **)(param_1 + 0x60) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x60));

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

  }

  return;

}





// --- FUN_005cb0ea at 0x005CB0EA (size: 871) ---


undefined4 FUN_005cb0ea(int param_1)



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  uint uVar4;

  int iVar5;

  uint uVar6;

  int unaff_EDI;

  int *in_stack_00000014;

  

  FUN_005cb050();

  *(undefined4 *)(unaff_EDI + 8) = *(undefined4 *)*in_stack_00000014;

  iVar5 = *in_stack_00000014;

  *in_stack_00000014 = iVar5 + 4;

  *(undefined4 *)(unaff_EDI + 0x10) = *(undefined4 *)(iVar5 + 4);

  iVar5 = *in_stack_00000014;

  *in_stack_00000014 = iVar5 + 4;

  *(undefined4 *)(unaff_EDI + 0x18) = *(undefined4 *)(iVar5 + 4);

  iVar5 = *in_stack_00000014;

  *in_stack_00000014 = iVar5 + 4;

  *(undefined4 *)(unaff_EDI + 0x20) = *(undefined4 *)(iVar5 + 4);

  iVar5 = *in_stack_00000014;

  *in_stack_00000014 = iVar5 + 4;

  *(undefined4 *)(unaff_EDI + 0x28) = *(undefined4 *)(iVar5 + 4);

  *in_stack_00000014 = *in_stack_00000014 + 4;

  uVar6 = 0;

  iVar5 = unaff_EDI;

  if (*(int *)(unaff_EDI + 8) != -1) {

    do {

      uVar1 = *(undefined4 *)*in_stack_00000014;

      *in_stack_00000014 = (int)((undefined4 *)*in_stack_00000014 + 1);

      uVar4 = *(uint *)(unaff_EDI + 8);

      if (uVar6 <= uVar4) {

        if (*(int *)(unaff_EDI + 0xc) == 0) {

          if (uVar4 != 0) {

            puVar3 = (undefined4 *)thunk_FUN_005df0f5(uVar4 * 4 + 4);

            *(undefined4 **)(unaff_EDI + 0xc) = puVar3;

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

              for (uVar4 = *(int *)(unaff_EDI + 8) * 4 + 4U >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

                *puVar3 = 0;

                puVar3 = puVar3 + 1;

              }

              for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

                *(undefined1 *)puVar3 = 0;

                puVar3 = (undefined4 *)((int)puVar3 + 1);

              }

              goto LAB_005cb195;

            }

          }

        }

        else {

LAB_005cb195:

          if (*(int *)(*(int *)(unaff_EDI + 0xc) + uVar6 * 4) == 0) {

            *(undefined4 *)(*(int *)(unaff_EDI + 0xc) + uVar6 * 4) = uVar1;

          }

        }

      }

      uVar6 = uVar6 + 1;

      iVar5 = param_1;

    } while (uVar6 < *(int *)(param_1 + 8) + 1U);

  }

  uVar6 = 0;

  if (*(int *)(iVar5 + 0x10) != -1) {

    do {

      uVar1 = *(undefined4 *)*in_stack_00000014;

      *in_stack_00000014 = (int)((undefined4 *)*in_stack_00000014 + 1);

      uVar4 = *(uint *)(unaff_EDI + 0x10);

      if (uVar6 <= uVar4) {

        if (*(int *)(unaff_EDI + 0x14) == 0) {

          if (uVar4 != 0) {

            puVar3 = (undefined4 *)thunk_FUN_005df0f5(uVar4 * 4 + 4);

            *(undefined4 **)(unaff_EDI + 0x14) = puVar3;

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

              for (uVar4 = *(int *)(unaff_EDI + 0x10) * 4 + 4U >> 2; uVar4 != 0; uVar4 = uVar4 - 1)

              {

                *puVar3 = 0;

                puVar3 = puVar3 + 1;

              }

              for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

                *(undefined1 *)puVar3 = 0;

                puVar3 = (undefined4 *)((int)puVar3 + 1);

              }

              goto LAB_005cb212;

            }

          }

        }

        else {

LAB_005cb212:

          if (*(int *)(*(int *)(unaff_EDI + 0x14) + uVar6 * 4) == 0) {

            *(undefined4 *)(*(int *)(unaff_EDI + 0x14) + uVar6 * 4) = uVar1;

          }

        }

      }

      uVar6 = uVar6 + 1;

      iVar5 = param_1;

    } while (uVar6 < *(int *)(param_1 + 0x10) + 1U);

  }

  uVar6 = 0;

  if (*(int *)(iVar5 + 0x18) != -1) {

    do {

      uVar1 = *(undefined4 *)*in_stack_00000014;

      *in_stack_00000014 = (int)((undefined4 *)*in_stack_00000014 + 1);

      uVar4 = *(uint *)(unaff_EDI + 0x18);

      if (uVar6 <= uVar4) {

        if (*(int *)(unaff_EDI + 0x1c) == 0) {

          if (uVar4 != 0) {

            puVar3 = (undefined4 *)thunk_FUN_005df0f5(uVar4 * 4 + 4);

            *(undefined4 **)(unaff_EDI + 0x1c) = puVar3;

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

              for (uVar4 = *(int *)(unaff_EDI + 0x18) * 4 + 4U >> 2; uVar4 != 0; uVar4 = uVar4 - 1)

              {

                *puVar3 = 0;

                puVar3 = puVar3 + 1;

              }

              for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

                *(undefined1 *)puVar3 = 0;

                puVar3 = (undefined4 *)((int)puVar3 + 1);

              }

              goto LAB_005cb292;

            }

          }

        }

        else {

LAB_005cb292:

          if (*(int *)(*(int *)(unaff_EDI + 0x1c) + uVar6 * 4) == 0) {

            *(undefined4 *)(*(int *)(unaff_EDI + 0x1c) + uVar6 * 4) = uVar1;

          }

        }

      }

      uVar6 = uVar6 + 1;

      iVar5 = param_1;

    } while (uVar6 < *(int *)(param_1 + 0x18) + 1U);

  }

  uVar6 = 0;

  if (*(int *)(iVar5 + 0x20) != -1) {

    do {

      uVar1 = *(undefined4 *)*in_stack_00000014;

      *in_stack_00000014 = (int)((undefined4 *)*in_stack_00000014 + 1);

      uVar4 = *(uint *)(unaff_EDI + 0x20);

      if (uVar6 <= uVar4) {

        if (*(int *)(unaff_EDI + 0x24) == 0) {

          if (uVar4 != 0) {

            puVar3 = (undefined4 *)thunk_FUN_005df0f5(uVar4 * 4 + 4);

            *(undefined4 **)(unaff_EDI + 0x24) = puVar3;

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

              for (uVar4 = *(int *)(unaff_EDI + 0x20) * 4 + 4U >> 2; uVar4 != 0; uVar4 = uVar4 - 1)

              {

                *puVar3 = 0;

                puVar3 = puVar3 + 1;

              }

              for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

                *(undefined1 *)puVar3 = 0;

                puVar3 = (undefined4 *)((int)puVar3 + 1);

              }

              goto LAB_005cb312;

            }

          }

        }

        else {

LAB_005cb312:

          if (*(int *)(*(int *)(unaff_EDI + 0x24) + uVar6 * 4) == 0) {

            *(undefined4 *)(*(int *)(unaff_EDI + 0x24) + uVar6 * 4) = uVar1;

          }

        }

      }

      uVar6 = uVar6 + 1;

      iVar5 = param_1;

    } while (uVar6 < *(int *)(param_1 + 0x20) + 1U);

  }

  uVar6 = 0;

  if (*(int *)(iVar5 + 0x28) != -1) {

    do {

      puVar3 = (undefined4 *)*in_stack_00000014;

      uVar1 = *puVar3;

      uVar2 = puVar3[1];

      *in_stack_00000014 = (int)(puVar3 + 2);

      uVar4 = *(uint *)(unaff_EDI + 0x28);

      if (uVar6 <= uVar4) {

        if (*(int *)(unaff_EDI + 0x2c) == 0) {

          if (uVar4 != 0) {

            puVar3 = (undefined4 *)thunk_FUN_005df0f5(uVar4 * 8 + 8);

            *(undefined4 **)(unaff_EDI + 0x2c) = puVar3;

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

              for (uVar4 = *(int *)(unaff_EDI + 0x28) * 8 + 8U >> 2; uVar4 != 0; uVar4 = uVar4 - 1)

              {

                *puVar3 = 0;

                puVar3 = puVar3 + 1;

              }

              for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

                *(undefined1 *)puVar3 = 0;

                puVar3 = (undefined4 *)((int)puVar3 + 1);

              }

              goto LAB_005cb399;

            }

          }

        }

        else {

LAB_005cb399:

          iVar5 = *(int *)(unaff_EDI + 0x2c);

          puVar3 = (undefined4 *)(iVar5 + uVar6 * 8);

          if (*(int *)(iVar5 + uVar6 * 8) == 0 && *(int *)(iVar5 + 4 + uVar6 * 8) == 0) {

            *puVar3 = uVar1;

            puVar3[1] = uVar2;

          }

        }

      }

      uVar6 = uVar6 + 1;

      iVar5 = param_1;

    } while (uVar6 < *(int *)(param_1 + 0x28) + 1U);

  }

  uVar6 = 0;

  if (*(int *)(iVar5 + 0x28) != -1) {

    do {

      uVar1 = *(undefined4 *)*in_stack_00000014;

      *in_stack_00000014 = (int)((undefined4 *)*in_stack_00000014 + 1);

      uVar4 = *(uint *)(unaff_EDI + 0x28);

      if (uVar6 <= uVar4) {

        if (*(int *)(unaff_EDI + 0x30) == 0) {

          if (uVar4 != 0) {

            puVar3 = (undefined4 *)thunk_FUN_005df0f5(uVar4 * 4 + 4);

            *(undefined4 **)(unaff_EDI + 0x30) = puVar3;

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

              for (uVar4 = *(int *)(unaff_EDI + 0x28) * 4 + 4U >> 2; uVar4 != 0; uVar4 = uVar4 - 1)

              {

                *puVar3 = 0;

                puVar3 = puVar3 + 1;

              }

              for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

                *(undefined1 *)puVar3 = 0;

                puVar3 = (undefined4 *)((int)puVar3 + 1);

              }

              goto LAB_005cb422;

            }

          }

        }

        else {

LAB_005cb422:

          if (*(int *)(*(int *)(unaff_EDI + 0x30) + uVar6 * 4) == 0) {

            *(undefined4 *)(*(int *)(unaff_EDI + 0x30) + uVar6 * 4) = uVar1;

          }

        }

      }

      uVar6 = uVar6 + 1;

    } while (uVar6 < *(int *)(param_1 + 0x28) + 1U);

  }

  return 1;

}





// --- FUN_005cb470 at 0x005CB470 (size: 57) ---


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



{

  *param_1 = &PTR_LAB_007e9098;

  param_1[0xc] = &PTR_LAB_007e9080;

  FUN_005cb050();

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005cb4d0 at 0x005CB4D0 (size: 79) ---


void __fastcall FUN_005cb4d0(undefined4 *param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)param_1[0xf];

  *param_1 = &PTR_LAB_007e9138;

  param_1[0xc] = &PTR_LAB_007e9124;

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

    if (puVar1[-1] == 0) {

      operator_delete__(puVar1 + -1);

    }

    else {

      (**(code **)*puVar1)(3);

    }

    param_1[0xf] = 0;

    param_1[0xe] = 0;

  }

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  return;

}





// --- FUN_005cb520 at 0x005CB520 (size: 99) ---


uint __thiscall FUN_005cb520(int param_1,int *param_2,uint param_3)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  

  uVar1 = *(int *)(param_1 + 8) * 0x14 + 4;

  if (uVar1 <= param_3) {

    *(int *)*param_2 = *(int *)(param_1 + 8);

    *param_2 = *param_2 + 4;

    uVar3 = 0;

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

      iVar2 = 0;

      do {

        (**(code **)(*(int *)(iVar2 + *(int *)(param_1 + 0xc)) + 0xc))(param_2,param_3);

        uVar3 = uVar3 + 1;

        iVar2 = iVar2 + 0x18;

      } while (uVar3 < *(uint *)(param_1 + 8));

    }

  }

  return uVar1;

}





// --- FUN_005cb5a0 at 0x005CB5A0 (size: 160) ---


bool __thiscall FUN_005cb5a0(int param_1,int param_2)



{

  int *piVar1;

  undefined4 *puVar2;

  int *piVar3;

  

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

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

    if (puVar2[-1] == 0) {

      operator_delete__(puVar2 + -1);

    }

    else {

      (**(code **)*puVar2)(3);

    }

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

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

  }

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

  if (param_2 != 0) {

    piVar3 = (int *)thunk_FUN_005df0f5(param_2 * 0x18 + 4);

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

      piVar1 = piVar3 + 1;

      *piVar3 = param_2;

      FUN_00401000(piVar1,0x18,param_2,&LAB_005cb4b0);

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

      return piVar1 != (int *)0x0;

    }

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

    return false;

  }

  return *(int *)(param_1 + 0x3c) == 0;

}





// --- FUN_005cb640 at 0x005CB640 (size: 47) ---


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



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  *param_1 = &PTR_LAB_007e9138;

  param_1[0xc] = &PTR_LAB_007e9124;

  return param_1;

}





// --- FUN_005cb670 at 0x005CB670 (size: 30) ---


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



{

  FUN_005cb4d0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005cb690 at 0x005CB690 (size: 118) ---


undefined4 __thiscall FUN_005cb690(int param_1,int *param_2,uint param_3)



{

  undefined4 uVar1;

  int iVar2;

  uint uVar3;

  

  if (param_3 < *(int *)(param_1 + 8) * 0x14 + 4U) {

    return 0;

  }

  uVar1 = *(undefined4 *)*param_2;

  *param_2 = (int)((undefined4 *)*param_2 + 1);

  iVar2 = FUN_005cb5a0(uVar1);

  if (iVar2 != 0) {

    uVar3 = 0;

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

      iVar2 = 0;

      do {

        (**(code **)(*(int *)(*(int *)(param_1 + 0xc) + iVar2) + 0x10))(param_2,param_3);

        uVar3 = uVar3 + 1;

        iVar2 = iVar2 + 0x18;

      } while (uVar3 < *(uint *)(param_1 + 8));

    }

    return 1;

  }

  return 0;

}





// --- FUN_005cb8b0 at 0x005CB8B0 (size: 30) ---


void __thiscall FUN_005cb8b0(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  

  *(undefined4 *)(param_1 + 4) = param_2;

  uVar1 = FUN_005c9420(param_2,*(undefined4 *)(param_1 + 8));

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

  return;

}





// --- FUN_005cb8d0 at 0x005CB8D0 (size: 81) ---


bool __thiscall FUN_005cb8d0(int param_1,int *param_2)



{

  int iVar1;

  uint uVar2;

  undefined4 uVar3;

  

  uVar2 = *(int *)(param_1 + 8) + *param_2;

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

  if (uVar2 < *(uint *)(param_1 + 8)) {

    *param_2 = -1 - *(uint *)(param_1 + 8);

    uVar3 = *(undefined4 *)(param_1 + 4);

    uVar2 = 0xffffffff;

    *(undefined4 *)(param_1 + 8) = 0xffffffff;

  }

  else {

    uVar3 = *(undefined4 *)(param_1 + 4);

    *(uint *)(param_1 + 8) = uVar2;

  }

  uVar3 = FUN_005c9420(uVar3,uVar2);

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

  return iVar1 != *(int *)(param_1 + 0x10);

}





// --- FUN_005cb930 at 0x005CB930 (size: 83) ---


undefined4 __fastcall FUN_005cb930(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  uVar2 = 1;

  if (((iVar1 != 1) && (iVar1 != 2)) && (iVar1 != 3)) {

    *(undefined4 *)(param_1 + 4) = 1;

    uVar2 = FUN_005c9420(1,*(undefined4 *)(param_1 + 8));

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

    uVar2 = 0;

  }

  iVar1 = FUN_005c9420(*(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 8));

  if (iVar1 != *(int *)(param_1 + 0x10)) {

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

    return 0;

  }

  return uVar2;

}





// --- FUN_005cba30 at 0x005CBA30 (size: 203) ---


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



undefined4 __thiscall FUN_005cba30(int param_1,int *param_2,uint param_3)



{

  int *piVar1;

  double dVar2;

  uint *puVar3;

  uint uVar4;

  int iVar5;

  double *pdVar6;

  

  puVar3 = (uint *)*param_2;

  if (0x1b < param_3) {

    uVar4 = *puVar3;

    *param_2 = (int)(puVar3 + 1);

    *(uint *)(param_1 + 0x10) = uVar4 & 0xffff;

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)*param_2;

    iVar5 = *param_2;

    *param_2 = iVar5 + 4;

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar5 + 4);

    iVar5 = *param_2;

    *param_2 = iVar5 + 4;

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(iVar5 + 4);

    iVar5 = *param_2;

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

    *param_2 = iVar5 + 4;

    *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(iVar5 + 4);

    iVar5 = *param_2;

    pdVar6 = (double *)(iVar5 + 4);

    *param_2 = (int)pdVar6;

    dVar2 = *pdVar6;

    *param_2 = iVar5 + 0xc;

    *(double *)(param_1 + 0x18) = _DAT_008379a8 - dVar2;

    FUN_005cb930();

    if ((uVar4 & 0xffff0000) < 0x10000) {

      if (*piVar1 != 0) {

        FUN_005cb8d0(piVar1);

      }

      *piVar1 = 0;

    }

    if ((uint)(*param_2 - (int)puVar3) <= param_3) {

      return 1;

    }

    *param_2 = (int)puVar3;

  }

  return 0;

}





// --- FUN_005cbb20 at 0x005CBB20 (size: 77) ---


undefined4 __thiscall FUN_005cbb20(int param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  int iVar2;

  

  puVar1 = (undefined4 *)*param_2;

  if (0xb < param_3) {

    *(undefined4 *)(param_1 + 4) = *puVar1;

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar2 + 4);

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(iVar2 + 4);

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    if ((uint)((iVar2 + 4) - (int)puVar1) <= param_3) {

      return 1;

    }

    *param_2 = (int)puVar1;

  }

  return 0;

}





// --- FUN_005cbb90 at 0x005CBB90 (size: 44) ---


undefined4 __thiscall FUN_005cbb90(int param_1,int *param_2,uint param_3)



{

  if (0xf < param_3) {

    FUN_004a3880(param_2,param_3);

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

    *param_2 = *param_2 + 4;

  }

  return 0x10;

}





// --- FUN_005cbbc0 at 0x005CBBC0 (size: 73) ---


undefined4 __thiscall FUN_005cbbc0(int param_1,int *param_2,uint param_3)



{

  int iVar1;

  int iVar2;

  

  iVar1 = *param_2;

  if (0xf < param_3) {

    FUN_005cbb20(param_2,param_3);

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

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    if ((uint)((iVar2 + 4) - iVar1) <= param_3) {

      return 1;

    }

    *param_2 = iVar1;

  }

  return 0;

}





// --- FUN_005cbc10 at 0x005CBC10 (size: 47) ---


undefined4 __thiscall FUN_005cbc10(int param_1,int param_2)



{

  if ((*(int *)(param_1 + 0x10) <= *(int *)(param_2 + 0x10)) &&

     ((*(int *)(param_1 + 0x10) != *(int *)(param_2 + 0x10) ||

      (*(double *)(param_1 + 0x18) <= *(double *)(param_2 + 0x18))))) {

    return 0;

  }

  return 1;

}





// --- FUN_005cbc40 at 0x005CBC40 (size: 55) ---


undefined4 __thiscall FUN_005cbc40(int param_1,float *param_2)



{

  if ((char)(*(uint *)(param_1 + 0x44) >> 8) < '\0') {

    *param_2 = *(float *)(param_1 + 0x4c) + *param_2;

    return 1;

  }

  if ((*(uint *)(param_1 + 0x44) & 0x4000) != 0) {

    *param_2 = *(float *)(param_1 + 0x4c) * *param_2;

    return 1;

  }

  return 0;

}





// --- FUN_005cbc80 at 0x005CBC80 (size: 112) ---


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



undefined4 __thiscall FUN_005cbc80(int param_1,int param_2)



{

  float fVar1;

  

  fVar1 = *(float *)(param_1 + 0x4c);

  if ((char)(*(uint *)(param_1 + 0x44) >> 8) < '\0') {

    if (DAT_00796344 < fVar1) {

      *(double *)(param_2 + 0x18) = (double)(fVar1 + (float)*(double *)(param_2 + 0x18));

      return 1;

    }

    *(double *)(param_2 + 0x20) = (double)(fVar1 + (float)*(double *)(param_2 + 0x20));

    return 1;

  }

  if ((*(uint *)(param_1 + 0x44) & 0x4000) == 0) {

    return 0;

  }

  if (_DAT_007938b0 < fVar1) {

    *(double *)(param_2 + 8) = (double)(fVar1 * (float)*(double *)(param_2 + 8));

    return 1;

  }

  *(double *)(param_2 + 0x10) = (double)(fVar1 * (float)*(double *)(param_2 + 0x10));

  return 1;

}





// --- FUN_005cbd10 at 0x005CBD10 (size: 45) ---


undefined4 __thiscall FUN_005cbd10(int param_1,undefined4 param_2)



{

  if ((*(byte *)(param_1 + 0x46) & 1) != 0) {

    switch(param_2) {

    case 0x21:

    case 0x22:

    case 0x29:

    case 0x2b:

    case 0x2c:

    case 0x2d:

    case 0x2e:

    case 0x2f:

    case 0x31:

      return 1;

    }

  }

  return 0;

}





// --- FUN_005cbd60 at 0x005CBD60 (size: 48) ---


undefined4 __thiscall FUN_005cbd60(int param_1,undefined4 param_2)



{

  if ((*(uint *)(param_1 + 0x44) & 0x20000) != 0) {

    switch(param_2) {

    case 6:

    case 7:

    case 0xf:

    case 0x30:

      return 1;

    }

  }

  return 0;

}





// --- FUN_005cbdd0 at 0x005CBDD0 (size: 92) ---


void __fastcall FUN_005cbdd0(undefined4 *param_1)



{

  undefined4 uVar1;

  undefined4 uVar2;

  

  uVar1 = DAT_007e9220;

  param_1[6] = DAT_007e9220;

  param_1[8] = uVar1;

  param_1[0xc] = DAT_007e9218;

  uVar2 = DAT_007e9224;

  uVar1 = DAT_007e9220;

  param_1[7] = DAT_007e9224;

  param_1[9] = uVar2;

  param_1[0xf] = uVar2;

  *param_1 = &PTR_LAB_007b2b04;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xe] = uVar1;

  param_1[0x10] = &PTR_FUN_007b2af0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  return;

}





// --- FUN_005cbe30 at 0x005CBE30 (size: 98) ---


void __thiscall FUN_005cbe30(undefined4 *param_1,undefined4 param_2)



{

  undefined4 uVar1;

  undefined4 uVar2;

  

  uVar1 = DAT_007e9220;

  param_1[6] = DAT_007e9220;

  param_1[8] = uVar1;

  uVar1 = DAT_007e9218;

  param_1[1] = param_2;

  param_1[0xc] = uVar1;

  uVar2 = DAT_007e9224;

  uVar1 = DAT_007e9220;

  param_1[7] = DAT_007e9224;

  param_1[9] = uVar2;

  param_1[0xf] = uVar2;

  *param_1 = &PTR_LAB_007b2b04;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xe] = uVar1;

  param_1[0x10] = &PTR_FUN_007b2af0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  return;

}





// --- FUN_005cbf70 at 0x005CBF70 (size: 240) ---


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



undefined4 __thiscall FUN_005cbf70(int param_1,int *param_2,uint param_3)



{

  uint uVar1;

  undefined4 *puVar2;

  int iVar3;

  uint *puVar4;

  

  if (param_3 < 0x30) {

    return 0;

  }

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)*param_2;

  iVar3 = *param_2;

  puVar4 = (uint *)(iVar3 + 4);

  *param_2 = (int)puVar4;

  uVar1 = *puVar4;

  *param_2 = iVar3 + 8;

  *(uint *)(param_1 + 0xc) = uVar1 & 0xffff;

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

  iVar3 = *param_2;

  puVar2 = (undefined4 *)(iVar3 + 4);

  *param_2 = (int)puVar2;

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

  *(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)(iVar3 + 8);

  *param_2 = *param_2 + 8;

  *(double *)(param_1 + 0x18) = _DAT_008379a8 + *(double *)(param_1 + 0x18);

  puVar2 = (undefined4 *)*param_2;

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

  *(undefined4 *)(param_1 + 0x24) = puVar2[1];

  iVar3 = *param_2;

  *param_2 = iVar3 + 8;

  *(undefined4 *)(param_1 + 0x28) = *(undefined4 *)(iVar3 + 8);

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

  *(undefined4 *)(param_1 + 0x2c) = *(undefined4 *)(iVar3 + 4);

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

  *(undefined4 *)(param_1 + 0x30) = *(undefined4 *)(iVar3 + 4);

  iVar3 = *param_2;

  puVar2 = (undefined4 *)(iVar3 + 4);

  *param_2 = (int)puVar2;

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

  *(undefined4 *)(param_1 + 0x3c) = *(undefined4 *)(iVar3 + 8);

  *param_2 = *param_2 + 8;

  *(double *)(param_1 + 0x38) = _DAT_008379a8 + *(double *)(param_1 + 0x38);

  iVar3 = (**(code **)(*(int *)(param_1 + 0x40) + 0x10))(param_2,param_3);

  if (iVar3 == 0) {

    return 0;

  }

  if (uVar1 >> 0x10 != 0) {

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)*param_2;

    *param_2 = *param_2 + 4;

  }

  return 1;

}





// --- FUN_005cc420 at 0x005CC420 (size: 153) ---


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



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007e9240;

  param_1[0xc] = &PTR_LAB_007e9228;

  param_1[0xe] = &PTR_LAB_007c4e8c;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  param_1[0xf] = &PTR_FUN_007a11bc;

  param_1[0x13] = 1;

  param_1[0x16] = &PTR_LAB_007c4e8c;

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x17] = &PTR_FUN_007a11bc;

  param_1[0x1b] = 1;

  param_1[0x1e] = &PTR_LAB_007c4e8c;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  param_1[0x22] = 0;

  param_1[0x24] = 0;

  param_1[0x25] = 0;

  param_1[0x1f] = &PTR_FUN_007a11bc;

  param_1[0x23] = 1;

  return param_1;

}





// --- FUN_005cc4d0 at 0x005CC4D0 (size: 30) ---


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



{

  FUN_005cc4f0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005cc4f0 at 0x005CC4F0 (size: 44) ---


void __fastcall FUN_005cc4f0(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007e9240;

  param_1[0xc] = &PTR_LAB_007e9228;

  param_1[0x1f] = &PTR_FUN_0079385c;

  param_1[0x1e] = &PTR_FUN_0079385c;

  param_1[0x17] = &PTR_FUN_0079385c;

  param_1[0x16] = &PTR_FUN_0079385c;

  param_1[0xf] = &PTR_FUN_0079385c;

  param_1[0xe] = &PTR_FUN_0079385c;

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  return;

}





// --- FUN_005cc600 at 0x005CC600 (size: 91) ---


int __fastcall FUN_005cc600(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  undefined4 local_4;

  

  uVar3 = 0;

  iVar4 = 4;

  local_4 = 0;

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

    do {

      for (iVar1 = *(int *)(*(int *)(param_1 + 8) + uVar3 * 4); iVar1 != 0;

          iVar1 = *(int *)(iVar1 + 0x60)) {

        iVar2 = (**(code **)(*(int *)(iVar1 + 8) + 0xc))(&local_4,0);

        iVar4 = iVar4 + 4 + iVar2;

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0xc));

  }

  return iVar4;

}





// --- FUN_005cc6e0 at 0x005CC6E0 (size: 191) ---


void __fastcall FUN_005cc6e0(int param_1)



{

  undefined4 *puVar1;

  void *pvVar2;

  void *pvVar3;

  LONG LVar4;

  uint local_8;

  

  if ((*(int *)(param_1 + 8) != 0) && (local_8 = 0, *(int *)(param_1 + 0xc) != 0)) {

    do {

      pvVar3 = *(void **)(*(int *)(param_1 + 8) + local_8 * 4);

      while (pvVar3 != (void *)0x0) {

        puVar1 = *(undefined4 **)((int)pvVar3 + 0x10);

        pvVar2 = *(void **)((int)pvVar3 + 0x60);

        *(undefined ***)((int)pvVar3 + 0x2c) = &PTR_FUN_0079385c;

        LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

        }

        puVar1 = *(undefined4 **)((int)pvVar3 + 0xc);

        LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

        }

        *(undefined ***)((int)pvVar3 + 8) = &PTR_FUN_0079385c;

        operator_delete(pvVar3);

        pvVar3 = pvVar2;

      }

      *(undefined4 *)(*(int *)(param_1 + 8) + local_8 * 4) = 0;

      local_8 = local_8 + 1;

    } while (local_8 < *(uint *)(param_1 + 0xc));

  }

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

  return;

}





// --- FUN_005cc7a0 at 0x005CC7A0 (size: 52) ---


void __fastcall FUN_005cc7a0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e9298;

  FUN_005cc6e0();

  if ((void *)param_1[2] != (void *)0x0) {

    operator_delete__((void *)param_1[2]);

    param_1[2] = 0;

  }

  param_1[3] = 0;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005cc920 at 0x005CC920 (size: 155) ---


undefined4 __thiscall FUN_005cc920(int param_1,uint *param_2,undefined4 param_3)



{

  uint *puVar1;

  uint uVar2;

  

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

    for (puVar1 = *(uint **)(*(int *)(param_1 + 8) + (*param_2 % *(uint *)(param_1 + 0xc)) * 4);

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

      if (*param_2 == *puVar1) {

        if (puVar1 != (uint *)0xfffffff8) {

          return 0;

        }

        break;

      }

    }

  }

  puVar1 = (uint *)FUN_005df0f5(0x68);

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

    return 0;

  }

  uVar2 = *(uint *)(param_1 + 0xc);

  *puVar1 = *param_2;

  FUN_005cc9c0(param_3);

  puVar1[0x18] = 0;

  uVar2 = *param_2 % uVar2;

  puVar1[0x19] = uVar2;

  puVar1[0x18] = *(uint *)(*(int *)(param_1 + 8) + uVar2 * 4);

  *(uint **)(*(int *)(param_1 + 8) + uVar2 * 4) = puVar1;

  *(int *)(param_1 + 0x10) = *(int *)(param_1 + 0x10) + 1;

  return 1;

}





// --- FUN_005cc9c0 at 0x005CC9C0 (size: 137) ---


undefined4 * __thiscall FUN_005cc9c0(undefined4 *param_1,int param_2)



{

  int iVar1;

  

  *param_1 = &PTR_FUN_007c4ed0;

  iVar1 = *(int *)(param_2 + 4);

  param_1[1] = iVar1;

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

  iVar1 = *(int *)(param_2 + 8);

  param_1[2] = iVar1;

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

  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);

  param_1[7] = *(undefined4 *)(param_2 + 0x1c);

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

  FUN_00480710(param_2 + 0x24);

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

  param_1[0x11] = *(undefined4 *)(param_2 + 0x44);

  param_1[0x12] = *(undefined4 *)(param_2 + 0x48);

  param_1[0x13] = *(undefined4 *)(param_2 + 0x4c);

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

  param_1[0x15] = *(undefined4 *)(param_2 + 0x54);

  return param_1;

}





// --- FUN_005cca50 at 0x005CCA50 (size: 72) ---


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



{

  *param_1 = &PTR_FUN_007e9298;

  FUN_005cc6e0();

  if ((void *)param_1[2] != (void *)0x0) {

    operator_delete__((void *)param_1[2]);

    param_1[2] = 0;

  }

  param_1[3] = 0;

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005ccaa0 at 0x005CCAA0 (size: 71) ---


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



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007e92c0;

  param_1[0xc] = &PTR_LAB_007e92ac;

  param_1[0xe] = &PTR_FUN_007e9298;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0x20;

  param_1[0x12] = 0;

  FUN_005a8440();

  return param_1;

}





// --- FUN_005ccb00 at 0x005CCB00 (size: 53) ---


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



{

  *param_1 = &PTR_LAB_007e92c0;

  param_1[0xc] = &PTR_LAB_007e92ac;

  FUN_005cc7a0();

  FUN_004f8190();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005ccb50 at 0x005CCB50 (size: 110) ---


undefined4 __thiscall FUN_005ccb50(int *param_1,uint param_2,undefined4 param_3)



{

  uint uVar1;

  int iVar2;

  undefined4 *puVar3;

  

  uVar1 = (**(code **)(*param_1 + 0x7c))();

  if (uVar1 <= param_2) {

    return 0;

  }

  if (param_1[0x16] == 0) {

    iVar2 = (**(code **)(*param_1 + 0x7c))();

    iVar2 = thunk_FUN_005df0f5(iVar2 << 2);

    param_1[0x16] = iVar2;

    if (iVar2 == 0) {

      return 0;

    }

    uVar1 = (**(code **)(*param_1 + 0x7c))();

    puVar3 = (undefined4 *)param_1[0x16];

    for (uVar1 = uVar1 & 0x3fffffff; uVar1 != 0; uVar1 = uVar1 - 1) {

      *puVar3 = 0;

      puVar3 = puVar3 + 1;

    }

    for (iVar2 = 0; iVar2 != 0; iVar2 = iVar2 + -1) {

      *(undefined1 *)puVar3 = 0;

      puVar3 = (undefined4 *)((int)puVar3 + 1);

    }

  }

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

  return 1;

}





// --- FUN_005ccbc0 at 0x005CCBC0 (size: 39) ---


undefined4 __thiscall FUN_005ccbc0(int *param_1,uint param_2)



{

  uint uVar1;

  

  uVar1 = (**(code **)(*param_1 + 0x80))();

  if ((param_2 < uVar1) && (param_1[0x17] != 0)) {

    return *(undefined4 *)(param_1[0x17] + param_2 * 4);

  }

  return 0;

}





// --- FUN_005ccbf0 at 0x005CCBF0 (size: 119) ---


undefined4 __thiscall FUN_005ccbf0(int *param_1,uint param_2,undefined4 param_3)



{

  uint uVar1;

  int iVar2;

  undefined4 *puVar3;

  

  uVar1 = (**(code **)(*param_1 + 0x80))();

  if (uVar1 <= param_2) {

    return 0;

  }

  if (param_1[0x17] == 0) {

    iVar2 = (**(code **)(*param_1 + 0x80))();

    iVar2 = thunk_FUN_005df0f5(iVar2 << 2);

    param_1[0x17] = iVar2;

    if (iVar2 == 0) {

      return 0;

    }

    uVar1 = (**(code **)(*param_1 + 0x80))();

    puVar3 = (undefined4 *)param_1[0x17];

    for (uVar1 = uVar1 & 0x3fffffff; uVar1 != 0; uVar1 = uVar1 - 1) {

      *puVar3 = 0;

      puVar3 = puVar3 + 1;

    }

    for (iVar2 = 0; iVar2 != 0; iVar2 = iVar2 + -1) {

      *(undefined1 *)puVar3 = 0;

      puVar3 = (undefined4 *)((int)puVar3 + 1);

    }

  }

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

  return 1;

}





// --- FUN_005ccc70 at 0x005CCC70 (size: 79) ---


void __fastcall FUN_005ccc70(int param_1)



{

  FUN_006b2d90();

  if (*(void **)(param_1 + 0x58) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x58));

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

  }

  if (*(void **)(param_1 + 0x5c) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x5c));

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

  }

  if (*(void **)(param_1 + 0x60) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x60));

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

  }

  return;

}





// --- FUN_005cccf0 at 0x005CCCF0 (size: 312) ---


int __thiscall

FUN_005cccf0(int *param_1,int *param_2,int *param_3,undefined4 param_4,undefined4 param_5,

            undefined4 param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9,

            undefined4 param_10,undefined4 param_11,int *param_12)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  

  iVar1 = FUN_006b2f20(param_4,param_5,param_6,param_7,param_8,param_9,param_10,param_11);

  *param_2 = 0;

  *param_3 = 0;

  *param_12 = 0;

  iVar1 = iVar1 + 4;

  uVar4 = 0;

  iVar2 = (**(code **)(*param_1 + 0x7c))();

  if (iVar2 != 0) {

    do {

      uVar3 = (**(code **)(*param_1 + 0x7c))();

      if (((uVar4 < uVar3) && (param_1[0x16] != 0)) && (*(int *)(param_1[0x16] + uVar4 * 4) != 0)) {

        iVar1 = iVar1 + 4;

        *param_2 = *param_2 + 1;

      }

      uVar4 = uVar4 + 1;

      uVar3 = (**(code **)(*param_1 + 0x7c))();

    } while (uVar4 < uVar3);

  }

  iVar1 = iVar1 + 4;

  uVar4 = 0;

  iVar2 = (**(code **)(*param_1 + 0x80))();

  if (iVar2 != 0) {

    do {

      uVar3 = (**(code **)(*param_1 + 0x80))();

      if (((uVar4 < uVar3) && (param_1[0x17] != 0)) && (*(int *)(param_1[0x17] + uVar4 * 4) != 0)) {

        iVar1 = iVar1 + 4;

        *param_3 = *param_3 + 1;

      }

      uVar4 = uVar4 + 1;

      uVar3 = (**(code **)(*param_1 + 0x80))();

    } while (uVar4 < uVar3);

  }

  iVar1 = iVar1 + 4;

  uVar4 = 0;

  iVar2 = (**(code **)(*param_1 + 0x84))();

  if (iVar2 != 0) {

    do {

      uVar3 = (**(code **)(*param_1 + 0x84))();

      if (((uVar4 < uVar3) && (param_1[0x18] != 0)) && (*(int *)(param_1[0x18] + uVar4 * 4) != 0)) {

        iVar1 = iVar1 + 4;

        *param_12 = *param_12 + 1;

      }

      uVar4 = uVar4 + 1;

      uVar3 = (**(code **)(*param_1 + 0x84))();

    } while (uVar4 < uVar3);

  }

  return iVar1;

}





// --- FUN_005cce30 at 0x005CCE30 (size: 43) ---


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



{

  FUN_006b3180(param_2);

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x18] = 0;

  *param_1 = &PTR_LAB_007e9330;

  param_1[0xc] = &PTR_LAB_007e9318;

  return param_1;

}





// --- FUN_005cce70 at 0x005CCE70 (size: 347) ---


uint __thiscall FUN_005cce70(int param_1,int *param_2,uint param_3)



{

  int *piVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  undefined4 local_2c;

  undefined4 local_28;

  undefined4 local_24;

  undefined1 local_20 [4];

  undefined1 local_1c [4];

  undefined1 local_18 [4];

  undefined1 local_14 [4];

  undefined1 local_10 [4];

  undefined1 local_c [4];

  undefined1 local_8 [4];

  undefined1 local_4 [4];

  

  piVar1 = (int *)(param_1 + -0x30);

  uVar2 = FUN_005cccf0(&local_2c,&local_28,local_4,local_8,local_c,local_10,local_14,local_18,

                       local_1c,local_20,&local_24);

  if (uVar2 <= param_3) {

    FUN_006b3200(param_2,param_3);

    *(undefined4 *)*param_2 = local_2c;

    iVar3 = *param_2;

    *param_2 = iVar3 + 4;

    *(undefined4 *)(iVar3 + 4) = local_28;

    iVar3 = *param_2;

    *param_2 = iVar3 + 4;

    *(undefined4 *)(iVar3 + 4) = local_24;

    *param_2 = *param_2 + 4;

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 0x7c))();

    if (iVar3 != 0) {

      do {

        uVar4 = (**(code **)(*piVar1 + 0x7c))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 0x28) != 0)) &&

           (*(int *)(*(int *)(param_1 + 0x28) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        uVar4 = (**(code **)(*piVar1 + 0x7c))();

      } while (uVar5 < uVar4);

    }

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 0x80))();

    if (iVar3 != 0) {

      do {

        uVar4 = (**(code **)(*piVar1 + 0x80))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 0x2c) != 0)) &&

           (*(int *)(*(int *)(param_1 + 0x2c) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        uVar4 = (**(code **)(*piVar1 + 0x80))();

      } while (uVar5 < uVar4);

    }

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 0x84))();

    if (iVar3 != 0) {

      do {

        uVar4 = (**(code **)(*piVar1 + 0x84))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 0x30) != 0)) &&

           (*(int *)(*(int *)(param_1 + 0x30) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        uVar4 = (**(code **)(*piVar1 + 0x84))();

      } while (uVar5 < uVar4);

    }

  }

  return uVar2;

}





// --- FUN_005cd110 at 0x005CD110 (size: 50) ---


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



{

  *param_1 = &PTR_LAB_007e9330;

  param_1[0xc] = &PTR_LAB_007e9318;

  FUN_005ccc70();

  FUN_006b31d0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005cd150 at 0x005CD150 (size: 30) ---


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



{

  FUN_006b31d0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005cd1b0 at 0x005CD1B0 (size: 81) ---


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



undefined4 __thiscall FUN_005cd1b0(int param_1,int *param_2,uint param_3)



{

  float fVar1;

  float *pfVar2;

  float fVar3;

  

  if (param_3 < 4) {

    return 0;

  }

  pfVar2 = (float *)*param_2;

  fVar1 = *pfVar2;

  fVar3 = (float)_DAT_00795ee0;

  *param_2 = (int)(pfVar2 + 1);

  if (fVar3 <= fVar1) {

    *(float *)(param_1 + 4) = fVar1 - _DAT_007c6bc4;

    return 1;

  }

  *param_2 = (int)(pfVar2 + 2);

  *(float *)(param_1 + 4) = pfVar2[2];

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_005cd210 at 0x005CD210 (size: 49) ---


void __thiscall FUN_005cd210(int param_1,int param_2)



{

  if (param_1 != param_2) {

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

    *(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);

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(param_2 + 8);

  }

  return;

}





// --- FUN_005cd250 at 0x005CD250 (size: 35) ---


void __fastcall FUN_005cd250(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e9484;

  param_1[1] = DAT_008f0ed0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  return;

}





// --- FUN_005cd280 at 0x005CD280 (size: 55) ---


void __thiscall FUN_005cd280(undefined4 *param_1,undefined4 *param_2)



{

  *param_1 = &PTR_FUN_007e9484;

  if (param_1 != param_2) {

    param_1[1] = param_2[1];

    param_1[3] = param_2[3];

    param_1[4] = param_2[4];

    param_1[5] = param_2[5];

    param_1[6] = param_2[6];

    param_1[2] = param_2[2];

  }

  return;

}





// --- FUN_005cd390 at 0x005CD390 (size: 153) ---


void __fastcall FUN_005cd390(int param_1)



{

  if (*(undefined4 **)(param_1 + 4) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 4))(1);

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

  }

  if (*(undefined4 **)(param_1 + 8) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 8))(1);

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

  }

  if (*(undefined4 **)(param_1 + 0xc) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0xc))(1);

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

  }

  if (*(undefined4 **)(param_1 + 0x10) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x10))(1);

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

  }

  if (*(undefined4 **)(param_1 + 0x14) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x14))(1);

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

  }

  if (*(undefined4 **)(param_1 + 0x18) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x18))(1);

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

  }

  if (*(undefined4 **)(param_1 + 0x1c) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x1c))(1);

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

  }

  if (*(undefined4 **)(param_1 + 0x20) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x20))(1);

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

  }

  if (*(undefined4 **)(param_1 + 0x24) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x24))(1);

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

  }

  return;

}





// --- FUN_005cd430 at 0x005CD430 (size: 208) ---


undefined4 __thiscall FUN_005cd430(int param_1,undefined4 param_2,int *param_3)



{

  int iVar1;

  

  switch(param_2) {

  case 1:

    iVar1 = *(int *)(param_1 + 4);

    if (iVar1 != 0) {

      *param_3 = *(int *)(iVar1 + 8) + *(int *)(iVar1 + 4);

      return 1;

    }

    break;

  case 2:

    iVar1 = *(int *)(param_1 + 8);

    if (iVar1 != 0) {

      *param_3 = *(int *)(iVar1 + 8) + *(int *)(iVar1 + 4);

      return 1;

    }

    break;

  case 3:

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

    if (iVar1 != 0) {

      *param_3 = *(int *)(iVar1 + 8) + *(int *)(iVar1 + 4);

      return 1;

    }

    break;

  case 4:

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

    if (iVar1 != 0) {

      *param_3 = *(int *)(iVar1 + 8) + *(int *)(iVar1 + 4);

      return 1;

    }

    break;

  case 5:

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

    if (iVar1 != 0) {

      *param_3 = *(int *)(iVar1 + 8) + *(int *)(iVar1 + 4);

      return 1;

    }

    break;

  case 6:

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

    if (iVar1 != 0) {

      *param_3 = *(int *)(iVar1 + 8) + *(int *)(iVar1 + 4);

      return 1;

    }

  }

  return 0;

}





// --- FUN_005cd520 at 0x005CD520 (size: 170) ---


undefined4 __thiscall FUN_005cd520(int param_1,undefined4 param_2,int *param_3)



{

  int iVar1;

  

  switch(param_2) {

  case 1:

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

    if (iVar1 != 0) {

      *param_3 = *(int *)(iVar1 + 8) + *(int *)(iVar1 + 4);

      return 1;

    }

    break;

  case 2:

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

    goto LAB_005cd559;

  case 3:

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

    if (iVar1 != 0) {

      *param_3 = *(int *)(iVar1 + 8) + *(int *)(iVar1 + 4);

      return 1;

    }

    break;

  case 4:

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

      *param_3 = *(int *)(*(int *)(param_1 + 0x20) + 0x10);

      return 1;

    }

    break;

  case 5:

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

    if (iVar1 != 0) {

      *param_3 = *(int *)(iVar1 + 8) + *(int *)(iVar1 + 4);

      return 1;

    }

    break;

  case 6:

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

LAB_005cd559:

    if (iVar1 != 0) {

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

      return 1;

    }

  }

  return 0;

}





// --- FUN_005cd5f0 at 0x005CD5F0 (size: 38) ---


void __fastcall FUN_005cd5f0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e9498;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  return;

}





// --- FUN_005cd620 at 0x005CD620 (size: 84) ---


undefined4 __thiscall FUN_005cd620(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  

  switch(param_2) {

  case 1:

    iVar1 = *(int *)(param_1 + 4);

    break;

  case 2:

    iVar1 = *(int *)(param_1 + 8);

    break;

  case 3:

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

    break;

  case 4:

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

    break;

  case 5:

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

    break;

  case 6:

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

    break;

  default:

    goto switchD_005cd62a_default;

  }

  if (iVar1 != 0) {

    *(undefined4 *)(param_3 + 4) = *(undefined4 *)(iVar1 + 4);

    *(undefined4 *)(param_3 + 8) = *(undefined4 *)(iVar1 + 8);

    *(undefined4 *)(param_3 + 0xc) = *(undefined4 *)(iVar1 + 0xc);

    return 1;

  }

switchD_005cd62a_default:

  return 0;

}





// --- FUN_005cd690 at 0x005CD690 (size: 427) ---


undefined4 __thiscall FUN_005cd690(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  undefined4 uVar2;

  

  switch(param_2) {

  case 1:

    iVar1 = *(int *)(param_1 + 4);

    if (iVar1 == 0) {

      iVar1 = FUN_005df0f5(0x10);

      if (iVar1 == 0) {

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

        return 1;

      }

      uVar2 = FUN_00558430(param_3);

      *(undefined4 *)(param_1 + 4) = uVar2;

      return 1;

    }

    break;

  case 2:

    iVar1 = *(int *)(param_1 + 8);

    if (iVar1 == 0) {

      iVar1 = FUN_005df0f5(0x10);

      if (iVar1 == 0) {

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

        return 1;

      }

      uVar2 = FUN_00558430(param_3);

      *(undefined4 *)(param_1 + 8) = uVar2;

      return 1;

    }

    break;

  case 3:

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

    if (iVar1 == 0) {

      iVar1 = FUN_005df0f5(0x10);

      if (iVar1 == 0) {

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

        return 1;

      }

      uVar2 = FUN_00558430(param_3);

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

      return 1;

    }

    break;

  case 4:

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

    if (iVar1 == 0) {

      iVar1 = FUN_005df0f5(0x10);

      if (iVar1 == 0) {

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

        return 1;

      }

      uVar2 = FUN_00558430(param_3);

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

      return 1;

    }

    break;

  case 5:

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

    if (iVar1 == 0) {

      iVar1 = FUN_005df0f5(0x10);

      if (iVar1 == 0) {

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

        return 1;

      }

      uVar2 = FUN_00558430(param_3);

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

      return 1;

    }

    break;

  case 6:

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

    if (iVar1 == 0) {

      iVar1 = FUN_005df0f5(0x10);

      if (iVar1 == 0) {

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

        return 1;

      }

      uVar2 = FUN_00558430(param_3);

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

      return 1;

    }

    break;

  default:

    return 0;

  }

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_3 + 4);

  *(undefined4 *)(iVar1 + 8) = *(undefined4 *)(param_3 + 8);

  *(undefined4 *)(iVar1 + 0xc) = *(undefined4 *)(param_3 + 0xc);

  return 1;

}





// --- FUN_005cd860 at 0x005CD860 (size: 422) ---


undefined4 __thiscall FUN_005cd860(int param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 *puVar1;

  

  switch(param_2) {

  case 1:

    if (*(int *)(param_1 + 4) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x10);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        *puVar1 = &PTR_FUN_007a8b64;

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

      }

      *(undefined4 **)(param_1 + 4) = puVar1;

    }

    *(undefined4 *)(*(int *)(param_1 + 4) + 8) = param_3;

    return 1;

  case 2:

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

      puVar1 = (undefined4 *)FUN_005df0f5(0x10);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        *puVar1 = &PTR_FUN_007a8b64;

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

      }

      *(undefined4 **)(param_1 + 8) = puVar1;

    }

    *(undefined4 *)(*(int *)(param_1 + 8) + 8) = param_3;

    return 1;

  case 3:

    if (*(int *)(param_1 + 0xc) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x10);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        *puVar1 = &PTR_FUN_007a8b64;

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

      }

      *(undefined4 **)(param_1 + 0xc) = puVar1;

    }

    *(undefined4 *)(*(int *)(param_1 + 0xc) + 8) = param_3;

    return 1;

  case 4:

    if (*(int *)(param_1 + 0x10) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x10);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        *puVar1 = &PTR_FUN_007a8b64;

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

      }

      *(undefined4 **)(param_1 + 0x10) = puVar1;

    }

    *(undefined4 *)(*(int *)(param_1 + 0x10) + 8) = param_3;

    return 1;

  case 5:

    if (*(int *)(param_1 + 0x14) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x10);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        *puVar1 = &PTR_FUN_007a8b64;

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

      }

      *(undefined4 **)(param_1 + 0x14) = puVar1;

    }

    *(undefined4 *)(*(int *)(param_1 + 0x14) + 8) = param_3;

    return 1;

  case 6:

    if (*(int *)(param_1 + 0x18) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x10);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        *puVar1 = &PTR_FUN_007a8b64;

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

      }

      *(undefined4 **)(param_1 + 0x18) = puVar1;

    }

    *(undefined4 *)(*(int *)(param_1 + 0x18) + 8) = param_3;

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005cda20 at 0x005CDA20 (size: 75) ---


undefined4 __thiscall FUN_005cda20(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  

  switch(param_2) {

  case 1:

  case 2:

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

    break;

  case 3:

  case 4:

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

    break;

  case 5:

  case 6:

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

    break;

  default:

    goto switchD_005cda2a_default;

  }

  if (iVar1 != 0) {

    *(undefined4 *)(param_3 + 4) = *(undefined4 *)(iVar1 + 4);

    *(undefined4 *)(param_3 + 8) = *(undefined4 *)(iVar1 + 8);

    *(undefined4 *)(param_3 + 0xc) = *(undefined4 *)(iVar1 + 0xc);

    *(undefined4 *)(param_3 + 0x10) = *(undefined4 *)(iVar1 + 0x10);

    return 1;

  }

switchD_005cda2a_default:

  return 0;

}





// --- FUN_005cda90 at 0x005CDA90 (size: 244) ---


undefined4 __thiscall FUN_005cda90(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  undefined4 uVar2;

  

  switch(param_2) {

  case 1:

  case 2:

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

    if (iVar1 == 0) {

      iVar1 = FUN_005df0f5(0x14);

      if (iVar1 == 0) {

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

        return 1;

      }

      uVar2 = FUN_00558460(param_3);

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

      return 1;

    }

    break;

  case 3:

  case 4:

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

    if (iVar1 == 0) {

      iVar1 = FUN_005df0f5(0x14);

      if (iVar1 == 0) {

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

        return 1;

      }

      uVar2 = FUN_00558460(param_3);

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

      return 1;

    }

    break;

  case 5:

  case 6:

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

    if (iVar1 == 0) {

      iVar1 = FUN_005df0f5(0x14);

      if (iVar1 == 0) {

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

        return 1;

      }

      uVar2 = FUN_00558460(param_3);

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

      return 1;

    }

    break;

  default:

    return 0;

  }

  *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_3 + 4);

  *(undefined4 *)(iVar1 + 8) = *(undefined4 *)(param_3 + 8);

  *(undefined4 *)(iVar1 + 0xc) = *(undefined4 *)(param_3 + 0xc);

  *(undefined4 *)(iVar1 + 0x10) = *(undefined4 *)(param_3 + 0x10);

  return 1;

}





// --- FUN_005cdba0 at 0x005CDBA0 (size: 440) ---


undefined4 __thiscall FUN_005cdba0(int param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 *puVar1;

  

  switch(param_2) {

  case 1:

    if (*(int *)(param_1 + 0x1c) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x14);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

        *puVar1 = &PTR_FUN_007a8b80;

        puVar1[4] = 0;

      }

      *(undefined4 **)(param_1 + 0x1c) = puVar1;

    }

    *(undefined4 *)(*(int *)(param_1 + 0x1c) + 8) = param_3;

    return 1;

  case 2:

    if (*(int *)(param_1 + 0x1c) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x14);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

        *puVar1 = &PTR_FUN_007a8b80;

        puVar1[4] = 0;

      }

      *(undefined4 **)(param_1 + 0x1c) = puVar1;

    }

    *(undefined4 *)(*(int *)(param_1 + 0x1c) + 0x10) = param_3;

    return 1;

  case 3:

    if (*(int *)(param_1 + 0x20) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x14);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

        *puVar1 = &PTR_FUN_007a8b80;

        puVar1[4] = 0;

      }

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

    }

    *(undefined4 *)(*(int *)(param_1 + 0x20) + 8) = param_3;

    return 1;

  case 4:

    if (*(int *)(param_1 + 0x20) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x14);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

        *puVar1 = &PTR_FUN_007a8b80;

        puVar1[4] = 0;

      }

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

    }

    *(undefined4 *)(*(int *)(param_1 + 0x20) + 0x10) = param_3;

    return 1;

  case 5:

    if (*(int *)(param_1 + 0x24) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x14);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

        *puVar1 = &PTR_FUN_007a8b80;

        puVar1[4] = 0;

      }

      *(undefined4 **)(param_1 + 0x24) = puVar1;

    }

    *(undefined4 *)(*(int *)(param_1 + 0x24) + 8) = param_3;

    return 1;

  case 6:

    if (*(int *)(param_1 + 0x24) == 0) {

      puVar1 = (undefined4 *)FUN_005df0f5(0x14);

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

        puVar1 = (undefined4 *)0x0;

      }

      else {

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar1[3] = 0;

        *puVar1 = &PTR_FUN_007a8b80;

        puVar1[4] = 0;

      }

      *(undefined4 **)(param_1 + 0x24) = puVar1;

    }

    *(undefined4 *)(*(int *)(param_1 + 0x24) + 0x10) = param_3;

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005ce420 at 0x005CE420 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007e9498;

  FUN_005cd390();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005ce450 at 0x005CE450 (size: 194) ---


undefined4 FUN_005ce450(undefined4 param_1,undefined4 param_2)



{

  char cVar1;

  int *piVar2;

  LONG LVar3;

  int local_8;

  int local_4;

  

  piVar2 = (int *)FUN_00415730(1,0x10000001,0x28);

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

    cVar1 = FUN_00415c90(param_1,param_2);

    if (cVar1 != '\0') {

      FUN_00401340(&DAT_00795098);

      FUN_00401340(&DAT_00795500);

      FUN_004053a0(&local_8,&local_4);

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

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

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

      }

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

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

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

      }

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

      return 1;

    }

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

  }

  return 0;

}





// --- FUN_005ce520 at 0x005CE520 (size: 41) ---


void __fastcall FUN_005ce520(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e94ac;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  return;

}





// --- FUN_005ce550 at 0x005CE550 (size: 69) ---


void __thiscall FUN_005ce550(int param_1,int param_2)



{

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 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);

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

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

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

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

  return;

}





// --- FUN_005ce5a0 at 0x005CE5A0 (size: 156) ---


void __thiscall FUN_005ce5a0(int *param_1,int *param_2,uint param_3)



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 8))();

  if (uVar2 <= param_3) {

    *(int *)*param_2 = param_1[1];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[2];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[3];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[4];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[5];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[6];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[7];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[8];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[9];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[10];

    *param_2 = *param_2 + 4;

  }

  return;

}





// --- FUN_005ce640 at 0x005CE640 (size: 161) ---


undefined4 __thiscall FUN_005ce640(int *param_1,int *param_2,uint param_3)



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 8))();

  if (param_3 < uVar2) {

    return 0;

  }

  param_1[1] = *(int *)*param_2;

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[2] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[3] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[4] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[5] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[6] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[7] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[8] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[9] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[10] = *(int *)(iVar1 + 4);

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_005ce6f0 at 0x005CE6F0 (size: 31) ---


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



{

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005ce710 at 0x005CE710 (size: 26) ---


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



{

  int iVar1;

  

  iVar1 = *(int *)(param_1 + 4);

  *param_2 = iVar1;

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

  return param_2;

}





// --- FUN_005ce730 at 0x005CE730 (size: 539) ---


undefined4 * __thiscall

FUN_005ce730(int param_1,undefined4 *param_2,int param_3,undefined4 *param_4,undefined4 *param_5)



{

  LONG *lpAddend;

  LONG LVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  undefined4 uVar4;

  undefined4 *puVar5;

  undefined4 *local_4;

  

  puVar5 = DAT_008ef11c;

  local_4 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  puVar3 = DAT_008ef12c;

  uVar2 = 0;

  InterlockedIncrement(DAT_008ef12c + 1);

  if (param_3 == *(int *)(param_1 + 4)) {

    uVar2 = 0x12;

    if (puVar3 != DAT_008f0f00) {

      LVar1 = InterlockedDecrement(puVar3 + 1);

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

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

      }

      puVar3 = DAT_008f0f00;

      InterlockedIncrement(DAT_008f0f00 + 1);

    }

  }

  else {

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

      uVar2 = 0x1b;

      puVar5 = &DAT_008f0f04;

    }

    else if (param_3 == *(int *)(param_1 + 0xc)) {

      uVar2 = 0x1c;

      puVar5 = &DAT_008f0f08;

    }

    else if (param_3 == *(int *)(param_1 + 0x10)) {

      uVar2 = 0x1d;

      puVar5 = &DAT_008f0f0c;

    }

    else if (param_3 == *(int *)(param_1 + 0x14)) {

      uVar2 = 0x1e;

      puVar5 = &DAT_008f0f10;

    }

    else if (param_3 == *(int *)(param_1 + 0x18)) {

      uVar2 = 0x12;

      puVar5 = &DAT_008f0f24;

    }

    else {

      if (param_3 == *(int *)(param_1 + 0x1c)) {

        puVar5 = &DAT_008f0f14;

      }

      else if (param_3 == *(int *)(param_1 + 0x20)) {

        puVar5 = &DAT_008f0f18;

      }

      else if (param_3 == *(int *)(param_1 + 0x24)) {

        puVar5 = &DAT_008f0f1c;

      }

      else {

        if (param_3 != *(int *)(param_1 + 0x28)) {

          uVar4 = 0;

          goto LAB_005ce7d8;

        }

        puVar5 = &DAT_008f0f20;

      }

      uVar2 = 0x20;

    }

    FUN_0048a0a0(puVar5);

  }

  uVar4 = 1;

  FUN_00487620(&local_4,"[%ws] <Tell:IIDString:0:%ws>%ws<\\Tell> says, \"%ws\"",puVar3 + 5,

               param_4 + 5,param_4 + 5,param_5 + 5);

  puVar5 = local_4;

LAB_005ce7d8:

  InterlockedIncrement(puVar5 + 1);

  InterlockedIncrement(puVar5 + 1);

  LVar1 = InterlockedDecrement(puVar5 + 1);

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

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

  }

  *param_2 = uVar2;

  lpAddend = puVar5 + 1;

  param_2[1] = puVar5;

  InterlockedIncrement(lpAddend);

  param_2[2] = uVar4;

  LVar1 = InterlockedDecrement(lpAddend);

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

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

  }

  LVar1 = InterlockedDecrement(puVar3 + 1);

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

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

  }

  LVar1 = InterlockedDecrement(lpAddend);

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

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

  }

  LVar1 = InterlockedDecrement(param_4 + 1);

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

    (**(code **)*param_4)(1);

  }

  LVar1 = InterlockedDecrement(param_5 + 1);

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

    (**(code **)*param_5)(1);

  }

  return param_2;

}





// --- FUN_005ce950 at 0x005CE950 (size: 17) ---


void __thiscall FUN_005ce950(undefined4 param_1,undefined4 *param_2)



{

  *param_2 = 0xc;

  param_2[1] = param_1;

  return;

}





// --- FUN_005ce970 at 0x005CE970 (size: 704) ---


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



undefined4 __fastcall FUN_005ce970(int param_1)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  bool bVar5;

  bool bVar6;

  

  if (*(float *)(param_1 + 8) < DAT_00796344) {

    return 0;

  }

  switch(*(undefined4 *)(param_1 + 4)) {

  case 1:

  case 10:

  case 0xd:

  case 0x10:

  case 0x12:

  case 0x14:

  case 0x15:

  case 0x16:

  case 0x17:

  case 0x18:

  case 0x19:

  case 0x1a:

  case 0x1f:

  case 0x20:

  case 0x21:

  case 0x23:

  case 0x24:

  case 0x25:

  case 0x26:

  case 0x27:

  case 0x28:

  case 0x29:

  case 0x2a:

  case 0x2b:

  case 0x2c:

  case 0x2d:

  case 0x2e:

  case 0x33:

  case 0x3a:

  case 0x3c:

  case 0x3d:

  case 0x40:

  case 0x41:

  case 0x43:

  case 0x44:

  case 0x46:

  case 0x4b:

  case 0x4f:

  case 0x50:

  case 0x51:

  case 0x53:

  case 0x54:

  case 0x55:

  case 0x56:

  case 0x58:

  case 0x6a:

  case 0x6b:

  case 0x6c:

  case 0x6d:

  case 0x72:

  case 0x7a:

  case 0x7e:

  case 0x7f:

    if (*(float *)(param_1 + 0xc) == DAT_00796344) {

      return 0;

    }

    goto LAB_005cea74;

  case 2:

    if (*(int *)(param_1 + 0x18) != 0 || *(int *)(param_1 + 0x1c) != 0) {

      return 1;

    }

    if (*(int *)(param_1 + 0x20) == 0 && *(int *)(param_1 + 0x24) == 0) {

      return 0;

    }

    return 1;

  case 3:

    if (*(int *)(param_1 + 100) == DAT_008f0efc) {

      return 0;

    }

    return 1;

  case 4:

  case 0xb:

    if ((*(float *)(param_1 + 0xb0) == DAT_00796344) && (*(float *)(param_1 + 0xb4) == DAT_00796344)

       ) {

      if (*(float *)(param_1 + 0xb8) != DAT_00796344) {

        return 0;

      }

      return 1;

    }

    break;

  case 5:

  case 0x34:

    if (DAT_00796344 <= *(float *)(param_1 + 0xc)) {

      if (*(int *)(param_1 + 0x54) == 0) {

        return 0;

      }

      return 1;

    }

    break;

  case 6:

  case 0xc:

  case 0xf:

  case 0x39:

  case 0x3f:

  case 0x42:

  case 0x48:

  case 0x4d:

  case 0x4e:

  case 0x57:

  case 0x5a:

  case 99:

  case 100:

  case 0x65:

  case 0x74:

  case 0x75:

  case 0x7c:

  case 0x7d:

    return 1;

  case 7:

    if ((DAT_00796344 <= *(float *)(param_1 + 0xc)) && (*(float *)(param_1 + 0xc) <= _DAT_007938b0))

    {

      if (*(int *)(param_1 + 0x58) == 0) {

        return 0;

      }

      return 1;

    }

    break;

  case 8:

  case 0x11:

    if (*(float *)(param_1 + 0xc) < (float)_DAT_00795610) {

      return 0;

    }

    return 1;

  case 9:

    if ((*(float *)(param_1 + 0xc) < DAT_00796344 == (*(float *)(param_1 + 0xc) == DAT_00796344)) &&

       (*(float *)(param_1 + 0xc) <= _DAT_007938b0)) {

      if (*(int *)(param_1 + 0x5c) == 0) {

        return 0;

      }

      return 1;

    }

    break;

  case 0xe:

  case 0x13:

  case 0x1b:

  case 0x49:

    if (*(int *)(param_1 + 0xbc) == 0) {

      return 0;

    }

    return 1;

  case 0x1c:

  case 0x1d:

  case 0x36:

  case 0x37:

    if (*(int *)(param_1 + 0x10) == 0) {

      return 0;

    }

  case 0x35:

  case 0x45:

  case 0x5b:

  case 0x5c:

  case 0x5d:

  case 0x5e:

  case 0x5f:

  case 0x60:

  case 0x61:

  case 0x62:

  case 0x6e:

  case 0x73:

  case 0x76:

    if (*(int *)(param_1 + 0x50) == 0) {

      return 0;

    }

    return 1;

  case 0x1e:

  case 0x3b:

  case 0x47:

  case 0x52:

  case 0x7b:

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

      return 0;

    }

    bVar5 = *(uint *)(param_1 + 0x38) < *(uint *)(param_1 + 0x3c);

    bVar6 = *(uint *)(param_1 + 0x38) == *(uint *)(param_1 + 0x3c);

    goto LAB_005cebc7;

  case 0x22:

  case 0x2f:

  case 0x30:

  case 0x77:

  case 0x78:

    if (*(int *)(param_1 + 0x10) == 0) {

      return 0;

    }

    return 1;

  case 0x31:

    uVar3 = *(uint *)(param_1 + 0x2c);

    uVar4 = *(uint *)(param_1 + 0x28);

    if ((uVar3 == 0) && (uVar4 == 0)) {

      return 1;

    }

    uVar1 = *(uint *)(param_1 + 0x30);

    uVar2 = *(uint *)(param_1 + 0x34);

    if ((uVar2 == 0) && (uVar1 == 0)) {

      return 1;

    }

    if (uVar3 < uVar2) {

      return 1;

    }

    if (uVar3 != uVar2) {

      return 0;

    }

    bVar5 = uVar4 < uVar1;

    bVar6 = uVar4 == uVar1;

    goto LAB_005cebc7;

  case 0x32:

    if (*(int *)(param_1 + 0x50) == 0) {

      return 0;

    }

    uVar3 = *(uint *)(param_1 + 0x38);

    if (uVar3 == 0) {

      return 1;

    }

    uVar4 = *(uint *)(param_1 + 0x3c);

    if (uVar4 == 0) {

      return 1;

    }

    bVar5 = uVar3 < uVar4;

    bVar6 = uVar3 == uVar4;

    goto LAB_005cebc7;

  case 0x38:

    if ((*(uint *)(param_1 + 0xd4) < 9) && (-1 < *(int *)(param_1 + 0xdc))) {

      if (3 < *(int *)(param_1 + 0xdc)) {

        return 0;

      }

      return 1;

    }

    break;

  case 0x3e:

    if (*(int *)(param_1 + 0x18) == 0 && *(int *)(param_1 + 0x1c) == 0) {

      return 0;

    }

    return 1;

  case 0x4a:

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

      if (*(int *)(param_1 + 0x78) < -1) {

        return 0;

      }

      return 1;

    }

    break;

  case 0x4c:

    if (*(int *)(param_1 + 100) == DAT_008f0efc) {

      return 0;

    }

    if (*(int *)(param_1 + 0x78) < 1) {

      return 0;

    }

LAB_005cea74:

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

      return 0;

    }

    return 1;

  case 0x59:

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

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

        return 0;

      }

      return 1;

    }

    break;

  case 0x66:

  case 0x67:

  case 0x68:

  case 0x69:

  case 0x79:

    if (*(int *)(*(int *)(param_1 + 0xc4) + 8) != 1) {

      return 1;

    }

    break;

  case 0x6f:

    bVar5 = *(int *)(param_1 + 0x10) == 0;

    bVar6 = *(int *)(param_1 + 0x10) == 1;

LAB_005cebc7:

    if (bVar5 || bVar6) {

      return 1;

    }

    break;

  case 0x70:

  case 0x71:

    if (*(int *)(param_1 + 0x18) != 0 || *(int *)(param_1 + 0x1c) != 0) {

      return 1;

    }

    return 0;

  }

  return 0;

}





// --- FUN_005ced20 at 0x005CED20 (size: 267) ---


undefined4 * __fastcall FUN_005ced20(undefined4 *param_1)



{

  LONG *pLVar1;

  

  *param_1 = &PTR_FUN_007e952c;

  FUN_005cd250();

  param_1[0x1f] = 0x3f800000;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  param_1[0x22] = 0;

  param_1[0x2c] = 0;

  param_1[0x2d] = 0;

  param_1[0x2e] = 0;

  FUN_00535b30();

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[0x30] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[0x31] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  param_1[0x38] = &PTR_LAB_00797910;

  param_1[0x39] = 0;

  param_1[0x3a] = 0x3f800000;

  param_1[0x3b] = 0;

  param_1[0x3c] = 0;

  param_1[0x3d] = 0;

  param_1[0x47] = 0;

  param_1[0x48] = 0;

  param_1[0x49] = 0;

  FUN_00535b30();

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[4] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[0xf] = 0;

  param_1[0xe] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x2f] = 0;

  param_1[0x32] = 0;

  param_1[0x33] = 0;

  param_1[0x34] = 0;

  param_1[0x35] = 0;

  param_1[0x36] = 0;

  param_1[0x37] = 0;

  param_1[3] = 0x3f800000;

  return param_1;

}





// --- FUN_005cee30 at 0x005CEE30 (size: 95) ---


void __fastcall FUN_005cee30(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)param_1[0x31];

  *param_1 = &PTR_FUN_007e952c;

  param_1[0x38] = &PTR_FUN_0079385c;

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  puVar1 = (undefined4 *)param_1[0x30];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  param_1[0x18] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005cee90 at 0x005CEE90 (size: 30) ---


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



{

  FUN_005cee30();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005ceeb0 at 0x005CEEB0 (size: 419) ---


int __thiscall FUN_005ceeb0(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  if (param_1 != param_2) {

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 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 + 0x18) = *(undefined4 *)(param_2 + 0x18);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    FUN_005cd210(param_2 + 0x60);

    FUN_00425f10(param_2 + 0x7c);

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

    puVar1 = *(undefined4 **)(param_1 + 0xc0);

    if (puVar1 != *(undefined4 **)(param_2 + 0xc0)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

      }

      iVar2 = *(int *)(param_2 + 0xc0);

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

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

    }

    puVar1 = *(undefined4 **)(param_1 + 0xc4);

    if (puVar1 != *(undefined4 **)(param_2 + 0xc4)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

      }

      iVar2 = *(int *)(param_2 + 0xc4);

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

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

    }

    *(undefined4 *)(param_1 + 200) = *(undefined4 *)(param_2 + 200);

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

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

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

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

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

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

    FUN_00425f10(param_2 + 0xe8);

  }

  return param_1;

}





// --- FUN_005cf060 at 0x005CF060 (size: 467) ---


int __fastcall FUN_005cf060(int param_1)



{

  int iVar1;

  int iVar2;

  undefined4 local_4;

  

  local_4 = 0;

  iVar1 = 0xc;

  switch(*(undefined4 *)(param_1 + 4)) {

  case 1:

  case 8:

  case 10:

  case 0xd:

  case 0x10:

  case 0x11:

  case 0x12:

  case 0x14:

  case 0x15:

  case 0x16:

  case 0x17:

  case 0x18:

  case 0x19:

  case 0x1a:

  case 0x1f:

  case 0x33:

  case 0x3a:

  case 0x3c:

  case 0x3d:

  case 0x40:

  case 0x41:

  case 0x43:

  case 0x44:

  case 0x4f:

  case 0x50:

  case 0x51:

  case 0x53:

  case 0x58:

  case 0x7a:

  case 0x7e:

  case 0x7f:

    iVar1 = FUN_004fd290(&local_4,0);

    return iVar1 + 0xc;

  case 2:

  case 0x3e:

    return 0x1c;

  case 3:

  case 0x4a:

    iVar1 = (**(code **)(*(int *)(param_1 + 0x60) + 0xc))(&local_4,0);

    return iVar1 + 0xc;

  case 4:

  case 6:

  case 0xb:

  case 0x57:

    iVar1 = FUN_00535e70(&local_4,0);

    return iVar1 + 0xc;

  case 5:

  case 7:

  case 9:

  case 0xe:

  case 0x13:

  case 0x1b:

  case 0x22:

  case 0x2f:

  case 0x30:

  case 0x34:

  case 0x49:

  case 0x5a:

  case 0x6e:

  case 0x6f:

  case 0x77:

  case 0x78:

    return 0x10;

  case 0x1c:

  case 0x1d:

  case 0x35:

  case 0x36:

  case 0x37:

  case 0x45:

  case 0x70:

  case 0x71:

    return 0x14;

  case 0x1e:

  case 0x3b:

  case 0x47:

  case 0x52:

  case 0x7b:

    iVar1 = FUN_004fd290(&local_4,0);

    return iVar1 + 0x14;

  case 0x20:

  case 0x21:

  case 0x23:

  case 0x2d:

  case 0x2e:

  case 0x46:

  case 0x54:

  case 0x55:

  case 0x56:

  case 0x66:

  case 0x67:

  case 0x68:

  case 0x69:

  case 0x6a:

  case 0x6b:

  case 0x6c:

  case 0x6d:

    iVar1 = FUN_004fd290(&local_4,0);

    return iVar1 + 0x10;

  case 0x24:

  case 0x27:

  case 0x28:

  case 0x29:

  case 0x2a:

  case 0x2b:

  case 0x2c:

    iVar1 = FUN_004fd290(&local_4,0);

    return iVar1 + 0x18;

  case 0x25:

    iVar1 = FUN_004fd290(&local_4,0);

    return iVar1 + 0x20;

  case 0x26:

  case 0x4b:

    iVar1 = FUN_004fd290(&local_4,0);

    iVar2 = FUN_004fd290(&local_4,0);

    return iVar1 + 0x10 + iVar2;

  case 0x31:

    return 0x28;

  case 0x32:

    return 0x24;

  case 0x38:

  case 0x73:

  case 0x76:

    return 0x18;

  case 0x3f:

  case 99:

  case 100:

    iVar1 = (**(code **)(*(int *)(param_1 + 0xe0) + 0xc))(&local_4,0);

    iVar1 = iVar1 + 0xc;

    break;

  case 0x4c:

    iVar1 = FUN_004fd290(&local_4,0);

    iVar2 = (**(code **)(*(int *)(param_1 + 0x60) + 0xc))(&local_4,0);

    return iVar1 + 0xc + iVar2;

  case 0x59:

    iVar1 = FUN_004fd290(&local_4,0);

    return iVar1 + 0x10;

  case 0x72:

    iVar1 = FUN_004fd290(&local_4,0);

    return iVar1 + 0x20;

  case 0x79:

    iVar1 = FUN_004fd290(&local_4,0);

    return iVar1 + 0xc;

  }

  return iVar1;

}





// --- FUN_005cf850 at 0x005CF850 (size: 169) ---


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



{

  LONG *pLVar1;

  

  *param_1 = &PTR_FUN_007e952c;

  FUN_005cd250();

  param_1[0x1f] = 0x3f800000;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  param_1[0x22] = 0;

  param_1[0x2c] = 0;

  param_1[0x2d] = 0;

  param_1[0x2e] = 0;

  FUN_00535b30();

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[0x30] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[0x31] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  param_1[0x38] = &PTR_LAB_00797910;

  param_1[0x39] = 0;

  param_1[0x3a] = 0x3f800000;

  param_1[0x3b] = 0;

  param_1[0x3c] = 0;

  param_1[0x3d] = 0;

  param_1[0x47] = 0;

  param_1[0x48] = 0;

  param_1[0x49] = 0;

  FUN_00535b30();

  FUN_005ceeb0(param_2);

  return param_1;

}





// --- FUN_005cf900 at 0x005CF900 (size: 116) ---


undefined4 __thiscall FUN_005cf900(int param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  undefined4 uVar4;

  int *piVar5;

  int iStack_14;

  undefined4 local_10;

  uint uStack_c;

  

  local_10 = 0;

  if (param_3 < 0xc) {

    return 0;

  }

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)*param_2;

  iVar2 = *param_2;

  *param_2 = iVar2 + 4;

  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar2 + 4);

  iVar2 = *param_2;

  *param_2 = iVar2 + 4;

  *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(iVar2 + 4);

  iVar2 = *param_2;

  puVar1 = (undefined4 *)(iVar2 + 4);

  *param_2 = (int)puVar1;

  switch(*(undefined4 *)(param_1 + 4)) {

  case 0:

  case 0xc:

  case 0xf:

  case 0x39:

  case 0x42:

  case 0x48:

  case 0x4d:

  case 0x4e:

  case 0x65:

  case 0x74:

  case 0x75:

  case 0x7c:

  case 0x7d:

    goto LAB_005d0077;

  case 1:

  case 8:

  case 10:

  case 0xd:

  case 0x10:

  case 0x11:

  case 0x12:

  case 0x14:

  case 0x15:

  case 0x16:

  case 0x17:

  case 0x18:

  case 0x19:

  case 0x1a:

  case 0x1f:

  case 0x33:

  case 0x3a:

  case 0x3c:

  case 0x3d:

  case 0x40:

  case 0x41:

  case 0x43:

  case 0x44:

  case 0x4f:

  case 0x50:

  case 0x51:

  case 0x53:

  case 0x58:

  case 0x79:

  case 0x7a:

  case 0x7e:

  case 0x7f:

    iVar2 = FUN_004fd290(&local_10,0);

    if (param_3 < iVar2 + 0xcU) {

      return 0;

    }

    iVar2 = FUN_004fd460(param_2,param_3);

    goto joined_r0x005d0071;

  case 2:

  case 0x3e:

    if (0x1b < param_3) {

      *(undefined4 *)(param_1 + 0x18) = *puVar1;

      *(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)(iVar2 + 8);

      iVar2 = *param_2;

      puVar1 = (undefined4 *)(iVar2 + 8);

      *param_2 = (int)puVar1;

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

      *(undefined4 *)(param_1 + 0x24) = *(undefined4 *)(iVar2 + 0xc);

      *param_2 = *param_2 + 8;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 3:

  case 0x4a:

    iVar2 = (**(code **)(*(int *)(param_1 + 0x60) + 0xc))(&local_10,0);

    uVar3 = iVar2 + 0xc;

    goto LAB_005cfb77;

  case 4:

  case 6:

  case 0xb:

  case 0x57:

    iVar2 = FUN_00535e70(&local_10,0);

    if (iVar2 + 0xcU <= param_3) {

      FUN_00535ee0(param_2,param_3);

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 5:

  case 0x34:

    if (0xf < param_3) {

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

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 7:

    if (0xf < param_3) {

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

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 9:

    if (0xf < param_3) {

      *(undefined4 *)(param_1 + 0x5c) = *puVar1;

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0xe:

  case 0x13:

  case 0x1b:

  case 0x49:

    if (0xf < param_3) {

      *(undefined4 *)(param_1 + 0xbc) = *puVar1;

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x1c:

  case 0x1d:

    if (0x13 < param_3) {

      *(undefined4 *)(param_1 + 0x10) = *puVar1;

      iVar2 = *param_2;

      *param_2 = iVar2 + 4;

      *(undefined4 *)(param_1 + 0x50) = *(undefined4 *)(iVar2 + 4);

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x1e:

  case 0x3b:

  case 0x47:

  case 0x52:

  case 0x7b:

    iVar2 = FUN_004fd290(&local_10,0);

    if ((iVar2 + 0x14U <= param_3) && (iVar2 = FUN_004fd460(param_2,param_3), iVar2 != 0)) {

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

      iVar2 = *param_2;

      *param_2 = iVar2 + 4;

      *(undefined4 *)(param_1 + 0x3c) = *(undefined4 *)(iVar2 + 4);

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x20:

  case 0x21:

  case 0x46:

  case 0x54:

  case 0x55:

  case 0x56:

  case 0x59:

  case 0x66:

  case 0x67:

  case 0x68:

  case 0x69:

  case 0x6a:

  case 0x6b:

  case 0x6c:

  case 0x6d:

    iVar2 = FUN_004fd290(&local_10,0);

    if ((iVar2 + 0xcU <= param_3) && (iVar2 = FUN_004fd460(param_2,param_3), iVar2 != 0)) {

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

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x22:

  case 0x2f:

  case 0x30:

  case 0x5a:

  case 0x77:

  case 0x78:

    if (0xf < param_3) {

      *(undefined4 *)(param_1 + 0x10) = *puVar1;

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x23:

  case 0x2d:

  case 0x2e:

    iVar2 = FUN_004fd290(&local_10,0);

    if ((iVar2 + 0xcU <= param_3) && (iVar2 = FUN_004fd460(param_2,param_3), iVar2 != 0)) {

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

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x24:

  case 0x27:

  case 0x28:

  case 0x29:

  case 0x2a:

  case 0x2b:

  case 0x2c:

    iVar2 = FUN_004fd290(&local_10,0);

    if ((iVar2 + 0xcU <= param_3) && (iVar2 = FUN_004fd460(param_2,param_3), iVar2 != 0)) {

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

      iVar2 = *param_2;

      *param_2 = iVar2 + 4;

      *(undefined4 *)(param_1 + 0x3c) = *(undefined4 *)(iVar2 + 4);

      iVar2 = *param_2;

      *param_2 = iVar2 + 4;

      *(undefined4 *)(param_1 + 0x50) = *(undefined4 *)(iVar2 + 4);

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x25:

    iVar2 = FUN_004fd290(&local_10,0);

    if ((iVar2 + 0xcU <= param_3) && (iVar2 = FUN_004fd460(param_2,param_3), iVar2 != 0)) {

      puVar1 = (undefined4 *)*param_2;

      *(undefined4 *)(param_1 + 0x40) = *puVar1;

      *(undefined4 *)(param_1 + 0x44) = puVar1[1];

      iVar2 = *param_2;

      puVar1 = (undefined4 *)(iVar2 + 8);

      *param_2 = (int)puVar1;

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

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

      iVar2 = *param_2;

      *param_2 = iVar2 + 8;

      *(undefined4 *)(param_1 + 0x50) = *(undefined4 *)(iVar2 + 8);

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x26:

  case 0x4b:

    iVar2 = FUN_004fd290(&local_10,0);

    uStack_c = iVar2 + 0xc;

    if ((((uStack_c <= param_3) && (iVar2 = FUN_004fd460(param_2,param_3), iVar2 != 0)) &&

        (iVar2 = FUN_004fd290(&local_10,0), iVar2 + uStack_c <= param_3)) &&

       (iVar2 = FUN_004fd460(param_2,param_3), iVar2 != 0)) {

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

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x31:

    *(undefined4 *)(param_1 + 200) = *puVar1;

    *(undefined4 *)(param_1 + 0xcc) = *(undefined4 *)(iVar2 + 8);

    iVar2 = *param_2;

    puVar1 = (undefined4 *)(iVar2 + 8);

    *param_2 = (int)puVar1;

    *(undefined4 *)(param_1 + 0x28) = *puVar1;

    *(undefined4 *)(param_1 + 0x2c) = *(undefined4 *)(iVar2 + 0xc);

    iVar2 = *param_2;

    puVar1 = (undefined4 *)(iVar2 + 8);

    *param_2 = (int)puVar1;

    *(undefined4 *)(param_1 + 0x30) = *puVar1;

    *(undefined4 *)(param_1 + 0x34) = *(undefined4 *)(iVar2 + 0xc);

    puVar1 = (undefined4 *)(*param_2 + 8);

    goto LAB_005cffee;

  case 0x32:

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

    iVar2 = *param_2;

    puVar1 = (undefined4 *)(iVar2 + 4);

    *param_2 = (int)puVar1;

    *(undefined4 *)(param_1 + 200) = *puVar1;

    *(undefined4 *)(param_1 + 0xcc) = *(undefined4 *)(iVar2 + 8);

    iVar2 = *param_2;

    *param_2 = iVar2 + 8;

    *(undefined4 *)(param_1 + 0x38) = *(undefined4 *)(iVar2 + 8);

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    *(undefined4 *)(param_1 + 0x3c) = *(undefined4 *)(iVar2 + 4);

    puVar1 = (undefined4 *)(*param_2 + 4);

LAB_005cffee:

    *param_2 = (int)puVar1;

    *(undefined4 *)(param_1 + 0xd0) = *puVar1;

    *param_2 = *param_2 + 4;

    uVar4 = FUN_005ce970();

    return uVar4;

  case 0x35:

  case 0x36:

  case 0x37:

  case 0x45:

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

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(iVar2 + 4);

    *param_2 = *param_2 + 4;

    uVar4 = FUN_005ce970();

    return uVar4;

  case 0x38:

    *(undefined4 *)(param_1 + 0xd4) = *puVar1;

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    *(undefined4 *)(param_1 + 0xd8) = *(undefined4 *)(iVar2 + 4);

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    *(undefined4 *)(param_1 + 0xdc) = *(undefined4 *)(iVar2 + 4);

    *param_2 = *param_2 + 4;

    uVar4 = FUN_005ce970();

    return uVar4;

  case 0x3f:

    iVar2 = (**(code **)(*(int *)(param_1 + 0xe0) + 0xc))(&local_10,0);

    if (param_3 < iVar2 + 0xcU) {

      return 0;

    }

    piVar5 = (int *)(param_1 + 0xe0);

    goto LAB_005cfb7e;

  case 0x4c:

    iVar2 = FUN_004fd290(&local_10,0);

    uStack_c = iVar2 + 0xc;

    if (param_3 < uStack_c) {

      return 0;

    }

    iVar2 = FUN_004fd460(param_2,param_3);

    if (iVar2 == 0) {

      return 0;

    }

    iVar2 = (**(code **)(*(int *)(param_1 + 0x60) + 0xc))(&local_10,0);

    uVar3 = iVar2 + iStack_14;

LAB_005cfb77:

    if (param_3 < uVar3) {

      return 0;

    }

    piVar5 = (int *)(param_1 + 0x60);

LAB_005cfb7e:

    iVar2 = (**(code **)(*piVar5 + 0x10))(param_2,param_3);

    goto joined_r0x005d0071;

  case 99:

  case 100:

    iVar2 = (**(code **)(*(int *)(param_1 + 0xe0) + 0xc))(&local_10,0);

    if (param_3 < iVar2 + 0xcU) {

      return 0;

    }

    iVar2 = (**(code **)(*(int *)(param_1 + 0xe0) + 0x10))(param_2,param_3);

joined_r0x005d0071:

    if (iVar2 != 0) {

LAB_005d0077:

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x6e:

    if (0xf < param_3) {

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

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x6f:

    if (0xf < param_3) {

      *(undefined4 *)(param_1 + 0x10) = *puVar1;

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x70:

  case 0x71:

    if (0x13 < param_3) goto LAB_005cfa20;

    break;

  case 0x72:

    iVar2 = FUN_004fd290(&local_10,0);

    if ((iVar2 + 0xcU <= param_3) && (iVar2 = FUN_004fd460(param_2,param_3), iVar2 != 0)) {

      puVar1 = (undefined4 *)*param_2;

      *(undefined4 *)(param_1 + 0x28) = *puVar1;

      *(undefined4 *)(param_1 + 0x2c) = puVar1[1];

      iVar2 = *param_2;

      puVar1 = (undefined4 *)(iVar2 + 8);

      *param_2 = (int)puVar1;

      *(undefined4 *)(param_1 + 0x30) = *puVar1;

      *(undefined4 *)(param_1 + 0x34) = *(undefined4 *)(iVar2 + 0xc);

      iVar2 = *param_2;

      *param_2 = iVar2 + 8;

      *(undefined4 *)(param_1 + 0x50) = *(undefined4 *)(iVar2 + 8);

      *param_2 = *param_2 + 4;

      uVar4 = FUN_005ce970();

      return uVar4;

    }

    break;

  case 0x73:

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

    puVar1 = (undefined4 *)(*param_2 + 4);

    *param_2 = (int)puVar1;

LAB_005cfa20:

    *(undefined4 *)(param_1 + 0x18) = *puVar1;

    *(undefined4 *)(param_1 + 0x1c) = puVar1[1];

    *param_2 = *param_2 + 8;

    uVar4 = FUN_005ce970();

    return uVar4;

  case 0x76:

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

    iVar2 = *param_2;

    puVar1 = (undefined4 *)(iVar2 + 4);

    *param_2 = (int)puVar1;

    *(undefined4 *)(param_1 + 200) = *puVar1;

    *(undefined4 *)(param_1 + 0xcc) = *(undefined4 *)(iVar2 + 8);

    *param_2 = *param_2 + 8;

    uVar4 = FUN_005ce970();

    return uVar4;

  }

  return 0;

}





