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

// --- FUN_00550070 at 0x00550070 (size: 221) ---


undefined4 __thiscall FUN_00550070(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_0054ff40();

      return 1;

    }

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

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

      puVar1 = puVar3 + 1;

      *puVar3 = param_2;

      FUN_00401000(puVar1,0xdc,param_2,&LAB_0054d6d0);

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

        if (*param_1 != 0) {

          param_2 = param_1[2];

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

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

            do {

              FUN_0054fef0(*param_1 + iVar4);

              iVar4 = iVar4 + -0xdc;

              param_2 = param_2 + -1;

            } while (param_2 != 0);

          }

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

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

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_00550150 at 0x00550150 (size: 324) ---


undefined4 * __fastcall FUN_00550150(undefined4 *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  

  puVar2 = &DAT_008f8650;

  puVar3 = param_1;

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

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  puVar2 = &DAT_008f8650;

  puVar3 = param_1 + 0x10;

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

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  puVar2 = &DAT_008f8650;

  puVar3 = param_1 + 0x20;

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

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  param_1[0x30] = DAT_00820060;

  param_1[0x31] = DAT_00820064;

  param_1[0x32] = DAT_00820068;

  param_1[0x33] = DAT_0082006c;

  param_1[0x34] = DAT_00820050;

  param_1[0x35] = DAT_00820054;

  param_1[0x36] = DAT_00820058;

  param_1[0x37] = DAT_0082005c;

  param_1[0x38] = 0;

  param_1[0x3a] = 0;

  param_1[0x3c] = 0;

  param_1[0x3e] = 0;

  param_1[0x3f] = 0;

  param_1[0x39] = 0x42c80000;

  param_1[0x3b] = 0x3f800000;

  param_1[0x3d] = 0x3f800000;

  param_1[0x40] = 0;

  param_1[0x41] = 0;

  param_1[0x42] = 0;

  *(undefined1 *)(param_1 + 0x43) = 1;

  param_1[0x44] = DAT_00820050;

  param_1[0x45] = DAT_00820054;

  param_1[0x46] = DAT_00820058;

  param_1[0x47] = DAT_0082005c;

  param_1[0x84] = 0x3f800000;

  param_1[0x85] = 0x3f800000;

  param_1[0x86] = 0x3f800000;

  param_1[0x87] = 0x3f800000;

  param_1[0x8a] = 0x3f800000;

  param_1[0x8b] = 0x3f800000;

  param_1[0x88] = 0;

  param_1[0x89] = 0;

  puVar2 = param_1 + 0x48;

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

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

  return param_1;

}





// --- FUN_005502a0 at 0x005502A0 (size: 107) ---


void __fastcall FUN_005502a0(int param_1)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int local_4;

  

  local_4 = param_1;

  FUN_00401340("RenderDevice.Wireframe");

  FUN_00436cf0(&local_4);

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

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

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

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

  }

  FUN_0054fcc0();

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

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

    piVar1 = puVar3 + 1;

    *piVar1 = *piVar1 + -1;

    if (*piVar1 == 0) {

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

    }

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

  }

  return;

}





// --- FUN_00550310 at 0x00550310 (size: 889) ---


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



{

  char cVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  int iVar4;

  int iVar5;

  undefined4 *puVar6;

  undefined4 *puVar7;

  uint uVar8;

  undefined4 *puVar9;

  undefined4 *puVar10;

  undefined4 *puVar11;

  undefined4 local_dc [26];

  undefined4 local_74;

  undefined4 local_70;

  undefined4 local_6c;

  undefined4 local_68;

  undefined4 local_64;

  undefined4 local_60;

  undefined4 local_5c;

  undefined4 local_58;

  undefined4 local_54;

  undefined4 local_50;

  undefined4 local_4c;

  undefined4 local_48;

  undefined4 local_44;

  undefined4 local_40;

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

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

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

    param_1[2] = 0;

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

    if (cVar1 == '\0') {

      return param_1;

    }

  }

  puVar7 = (undefined4 *)*param_2;

  puVar11 = (undefined4 *)*param_1;

  puVar3 = puVar7 + param_2[2] * 0x37;

  if (puVar7 < puVar3) {

    puVar6 = puVar11 + 0x1e;

    puVar2 = puVar7 + 0x1e;

    do {

      puVar9 = puVar7;

      puVar10 = puVar11;

      for (iVar4 = 0x1a; iVar4 != 0; iVar4 = iVar4 + -1) {

        *puVar10 = *puVar9;

        puVar9 = puVar9 + 1;

        puVar10 = puVar10 + 1;

      }

      puVar6[-4] = puVar2[-4];

      puVar6[-3] = puVar2[-3];

      puVar6[-2] = puVar2[-2];

      puVar6[0xc] = puVar2[0xc];

      puVar6[0xd] = puVar2[0xd];

      puVar6[0xe] = puVar2[0xe];

      puVar6[-1] = puVar2[-1];

      *puVar6 = *puVar2;

      puVar6[1] = puVar2[1];

      puVar6[2] = puVar2[2];

      puVar6[3] = puVar2[3];

      puVar6[4] = puVar2[4];

      puVar6[5] = puVar2[5];

      puVar6[6] = puVar2[6];

      puVar6[7] = puVar2[7];

      puVar6[8] = puVar2[8];

      puVar6[9] = puVar2[9];

      puVar6[10] = puVar2[10];

      puVar6[0xb] = puVar2[0xb];

      puVar6[0xf] = puVar2[0xf];

      puVar6[0x10] = puVar2[0x10];

      puVar6[0x11] = puVar2[0x11];

      puVar6[0x12] = puVar2[0x12];

      puVar6[0x13] = puVar2[0x13];

      puVar6[0x14] = puVar2[0x14];

      puVar6[0x15] = puVar2[0x15];

      puVar6[0x16] = puVar2[0x16];

      puVar6[0x17] = puVar2[0x17];

      puVar6[0x18] = puVar2[0x18];

      puVar7 = puVar7 + 0x37;

      puVar11 = puVar11 + 0x37;

      puVar2 = puVar2 + 0x37;

      puVar6 = puVar6 + 0x37;

    } while (puVar7 < puVar3);

  }

  uVar8 = param_2[2];

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

    iVar4 = uVar8 * 0xdc;

    do {

      local_68 = 0x3f800000;

      local_64 = 0;

      local_60 = 0;

      local_5c = 0;

      local_34 = 0;

      local_30 = 0;

      local_2c = 0;

      FUN_00535b30();

      puVar3 = (undefined4 *)(*param_1 + iVar4);

      puVar7 = local_dc;

      puVar11 = puVar3;

      for (iVar5 = 0x1a; iVar5 != 0; iVar5 = iVar5 + -1) {

        *puVar11 = *puVar7;

        puVar7 = puVar7 + 1;

        puVar11 = puVar11 + 1;

      }

      puVar3[0x1a] = local_74;

      puVar3[0x1b] = local_70;

      puVar3[0x1c] = local_6c;

      puVar3[0x2a] = local_34;

      puVar3[0x2b] = local_30;

      puVar3[0x2c] = local_2c;

      puVar3[0x1d] = local_68;

      puVar3[0x1e] = local_64;

      puVar3[0x1f] = local_60;

      puVar3[0x20] = local_5c;

      puVar3[0x21] = local_58;

      puVar3[0x22] = local_54;

      puVar3[0x23] = local_50;

      puVar3[0x24] = local_4c;

      puVar3[0x25] = local_48;

      puVar3[0x26] = local_44;

      puVar3[0x27] = local_40;

      puVar3[0x28] = local_3c;

      puVar3[0x29] = local_38;

      puVar3[0x2d] = local_28;

      puVar3[0x2e] = local_24;

      puVar3[0x2f] = local_20;

      puVar3[0x30] = local_1c;

      puVar3[0x31] = local_18;

      puVar3[0x32] = local_14;

      puVar3[0x33] = local_10;

      puVar3[0x34] = local_c;

      puVar3[0x35] = local_8;

      puVar3[0x36] = local_4;

      uVar8 = uVar8 + 1;

      iVar4 = iVar4 + 0xdc;

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

  }

  param_1[2] = param_2[2];

  return param_1;

}





// --- FUN_00550690 at 0x00550690 (size: 433) ---


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



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  int iVar3;

  undefined4 *puVar4;

  

  puVar1 = param_2;

  puVar2 = param_2;

  puVar4 = param_1;

  for (iVar3 = 0x10; iVar3 != 0; iVar3 = iVar3 + -1) {

    *puVar4 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar4 = puVar4 + 1;

  }

  puVar2 = param_2 + 0x10;

  puVar4 = param_1 + 0x10;

  for (iVar3 = 0x10; iVar3 != 0; iVar3 = iVar3 + -1) {

    *puVar4 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar4 = puVar4 + 1;

  }

  puVar2 = param_2 + 0x20;

  puVar4 = param_1 + 0x20;

  for (iVar3 = 0x10; iVar3 != 0; iVar3 = iVar3 + -1) {

    *puVar4 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar4 = puVar4 + 1;

  }

  param_1[0x30] = param_2[0x30];

  param_1[0x31] = param_2[0x31];

  param_1[0x32] = param_2[0x32];

  param_1[0x33] = param_2[0x33];

  param_1[0x34] = param_2[0x34];

  param_1[0x35] = param_2[0x35];

  param_1[0x36] = param_2[0x36];

  param_1[0x37] = param_2[0x37];

  param_1[0x38] = param_2[0x38];

  param_1[0x39] = param_2[0x39];

  param_1[0x3a] = param_2[0x3a];

  param_1[0x3b] = param_2[0x3b];

  param_1[0x3c] = param_2[0x3c];

  param_1[0x3d] = param_2[0x3d];

  param_1[0x3e] = param_2[0x3e];

  param_1[0x3f] = param_2[0x3f];

  FUN_00550310(param_2 + 0x40);

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

  param_1[0x44] = param_2[0x44];

  param_1[0x45] = param_2[0x45];

  param_1[0x46] = param_2[0x46];

  param_1[0x47] = param_2[0x47];

  puVar2 = param_1 + 0x48;

  iVar3 = (int)param_2 - (int)param_1;

  param_2 = (undefined4 *)0xf;

  do {

    puVar4 = (undefined4 *)(iVar3 + (int)puVar2);

    *puVar2 = *puVar4;

    puVar2[1] = puVar4[1];

    puVar2[2] = puVar4[2];

    puVar2[3] = puVar4[3];

    puVar2 = puVar2 + 4;

    param_2 = (undefined4 *)((int)param_2 + -1);

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

  param_1[0x84] = puVar1[0x84];

  param_1[0x85] = puVar1[0x85];

  param_1[0x86] = puVar1[0x86];

  param_1[0x87] = puVar1[0x87];

  param_1[0x88] = puVar1[0x88];

  param_1[0x89] = puVar1[0x89];

  param_1[0x8a] = puVar1[0x8a];

  param_1[0x8b] = puVar1[0x8b];

  return param_1;

}





// --- FUN_00550850 at 0x00550850 (size: 620) ---


void __fastcall FUN_00550850(uint *param_1)



{

  undefined4 uVar1;

  LONG LVar2;

  int iVar3;

  uint *puVar4;

  uint *puVar5;

  uint local_270 [14];

  uint local_238;

  int local_234 [65];

  int local_130;

  uint local_12c;

  

  local_270[0] = 0;

  local_270[1] = 800;

  local_270[2] = 600;

  local_270[3] = local_270[3] & 0xffffff00;

  local_270[4] = 0;

  local_270[5] = 0x20;

  local_270[6] = local_270[6] & 0xff000000;

  puVar4 = local_270;

  puVar5 = param_1;

  for (iVar3 = 7; puVar5 = puVar5 + 1, iVar3 != 0; iVar3 = iVar3 + -1) {

    *puVar5 = *puVar4;

    puVar4 = puVar4 + 1;

  }

  local_270[0] = 0;

  local_270[1] = 0;

  local_270[2] = 0;

  local_270[3] = 0;

  local_270[4] = 0;

  local_270[5] = 0;

  local_270[6] = 0;

  local_270[7] = 0;

  local_270[8] = 0;

  local_270[9] = 0;

  local_270[10] = 0;

  local_270[0xb] = local_270[0xb] & 0xffff0000;

  puVar5 = local_270;

  puVar4 = param_1 + 10;

  for (iVar3 = 0xc; iVar3 != 0; iVar3 = iVar3 + -1) {

    *puVar4 = *puVar5;

    puVar5 = puVar5 + 1;

    puVar4 = puVar4 + 1;

  }

  local_238 = CONCAT13(local_238._3_1_,0x10001);

  param_1[9] = local_238;

  local_270[0] = 0;

  local_270[1] = 0;

  local_270[2] = 0;

  local_270[3] = 0;

  local_270[4] = 0;

  local_270[5] = 0;

  local_270[6] = 0;

  local_270[7] = 0;

  local_270[8] = 0;

  local_270[9] = 0;

  local_270[10] = 0;

  local_270[0xb] = 0;

  local_270[0xc] = 0;

  param_1[8] = 0;

  puVar5 = local_270;

  puVar4 = param_1 + 0x16;

  for (iVar3 = 0xd; iVar3 != 0; iVar3 = iVar3 + -1) {

    *puVar4 = *puVar5;

    puVar5 = puVar5 + 1;

    puVar4 = puVar4 + 1;

  }

  param_1[0x23] = 0;

  param_1[0x24] = 0;

  param_1[0x25] = 0;

  param_1[0x26] = 0;

  param_1[0x27] = 0;

  param_1[0x28] = 0;

  puVar5 = param_1 + 0x31;

  param_1[0x29] = 0x3f800000;

  param_1[0x2a] = 0x3f800000;

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

  *(undefined1 *)((int)param_1 + 0xad) = 0;

  param_1[0x2c] = 1;

  param_1[0x2d] = 0;

  param_1[0x2e] = 0;

  param_1[0x2f] = 0;

  param_1[0x30] = 0;

  *(undefined1 *)puVar5 = 0;

  *(undefined1 *)((int)param_1 + 0xc5) = 0;

  uVar1 = FUN_00550150();

  FUN_00550690(uVar1);

  if (((local_12c & 0x80000000) == 0x80000000) && (local_130 != 0)) {

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

  }

  param_1[0xbe] = 0;

  param_1[0xbf] = 0;

  param_1[0xc0] = 0;

  FUN_00401340("Enable wireframe rendering");

  FUN_00401340("RenderDevice.Wireframe");

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

    FUN_004369a0(puVar5,2,local_234,local_270 + 0xd,0,0,0,0);

  }

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

  if ((LVar2 == 0) && ((undefined4 *)(local_234[0] + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_234[0] + -0x14))(1);

  }

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

  if ((LVar2 == 0) && ((undefined4 *)(local_270[0xd] + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_270[0xd] + -0x14))(1);

  }

  return;

}





// --- FUN_00550ac0 at 0x00550AC0 (size: 16) ---


void FUN_00550ac0(void)



{

  FUN_005502a0();

  FUN_00550850();

  return;

}





// --- FUN_00550ad0 at 0x00550AD0 (size: 334) ---


void FUN_00550ad0(int param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  undefined4 uVar2;

  uint uVar3;

  undefined4 uVar4;

  int iVar5;

  uint uVar6;

  void *pvVar7;

  

  uVar2 = DAT_008379ac;

  uVar1 = DAT_008379a8;

  if ((DAT_0082008c == '\0') || (DAT_00838197 != '\0')) {

    iVar5 = 0;

    do {

      uVar6 = DAT_008703b8 + iVar5 & 0x8000000f;

      if ((int)uVar6 < 0) {

        uVar6 = (uVar6 - 1 | 0xfffffff0) + 1;

      }

      pvVar7 = (void *)(&DAT_00870520)[uVar6 * 4];

      if (pvVar7 == (void *)0x0) goto LAB_00550bb8;

      if (*(int *)((int)pvVar7 + 4) == 0) goto LAB_00550ba4;

      uVar3 = FUN_00553470();

      if ((uVar3 & 1) == 0) goto LAB_00550ba4;

      iVar5 = iVar5 + 1;

    } while (iVar5 < 0x10);

    iVar5 = 0;

    while( true ) {

      uVar6 = DAT_008703b8 + iVar5 & 0x8000000f;

      if ((int)uVar6 < 0) {

        uVar6 = (uVar6 - 1 | 0xfffffff0) + 1;

      }

      pvVar7 = (void *)(&DAT_00870520)[uVar6 * 4];

      if ((float)(&DAT_00870524)[uVar6 * 4] < *(float *)(param_1 + 0xc)) break;

      iVar5 = iVar5 + 1;

      if (0xf < iVar5) {

        return;

      }

    }

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

      FUN_00553450();

LAB_00550ba4:

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

        thunk_FUN_00553290();

        operator_delete(pvVar7);

      }

    }

LAB_00550bb8:

    iVar5 = FUN_005df0f5(0x20);

    if (iVar5 == 0) {

      uVar4 = 0;

    }

    else {

      uVar4 = FUN_005534d0(*(undefined4 *)(param_1 + 0x1c));

    }

    (&DAT_00870520)[uVar6 * 4] = uVar4;

    (&DAT_00870524)[uVar6 * 4] = *(undefined4 *)(param_1 + 0xc);

    DAT_008703b8 = uVar6 + 1 & 0x8000000f;

    (&DAT_00870528)[uVar6 * 4] = uVar1;

    (&DAT_0087052c)[uVar6 * 4] = uVar2;

    if ((int)DAT_008703b8 < 0) {

      DAT_008703b8 = (DAT_008703b8 - 1 | 0xfffffff0) + 1;

    }

    FUN_00553970(param_2,param_3);

  }

  return;

}





// --- FUN_00550c30 at 0x00550C30 (size: 181) ---


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



undefined4 FUN_00550c30(float param_1,float param_2,int *param_3,int param_4)



{

  float fVar1;

  int iVar2;

  

  if (_DAT_007cbc64 <= param_1) {

    param_2 = (_DAT_00870414 * param_2) / (param_1 * param_1);

  }

  if ((float)_DAT_007938c0 < param_2) {

    param_2 = (float)_DAT_007938c0;

  }

  fVar1 = DAT_00820078;

  if (param_4 != 0) {

    fVar1 = _DAT_00820080;

  }

  param_2 = param_2 * fVar1;

  if (param_2 < (float)_DAT_00795610 == (param_2 == (float)_DAT_00795610)) {

    ceil((double)(param_2 * 0.6931472 * (float)_DAT_00870418 * (float)_DAT_007cbd00));

    iVar2 = FUN_005df4c4();

    *param_3 = iVar2;

    if (DAT_00820070 <= iVar2) {

      return 1;

    }

    *param_3 = DAT_00820070;

    return 0;

  }

  *param_3 = DAT_00820070;

  return 0;

}





// --- FUN_00550cf0 at 0x00550CF0 (size: 43) ---


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



undefined4 FUN_00550cf0(float param_1)



{

  int iVar1;

  

  iVar1 = rand();

  if ((float)iVar1 * _DAT_007cbd08 < param_1) {

    return 1;

  }

  return 0;

}





// --- FUN_00550d20 at 0x00550D20 (size: 89) ---


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



{

  int iVar1;

  undefined4 uVar2;

  

  *param_1 = param_2;

  param_1[1] = 0;

  FUN_005528d0();

  param_1[6] = 1;

  param_1[8] = 0xffffffff;

  iVar1 = FUN_005df0f5(0x20);

  if (iVar1 != 0) {

    uVar2 = FUN_00553920(param_2,0,1,0);

    param_1[7] = uVar2;

    return param_1;

  }

  param_1[7] = 0;

  return param_1;

}





// --- FUN_00550d80 at 0x00550D80 (size: 242) ---


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



void FUN_00550d80(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  uint uVar1;

  int iVar2;

  undefined4 uVar3;

  float10 fVar4;

  float10 extraout_ST0;

  float local_4;

  

  if ((DAT_0082008c == '\0') || (DAT_00838197 != '\0')) {

    fVar4 = (float10)FUN_005364a0();

    local_4 = (float)fVar4;

    fVar4 = (float10)FUN_005aa560(&PTR_PTR_008200f0);

    FUN_005aa5d0(&PTR_PTR_008200f0);

    uVar3 = 0;

    if (DAT_008703b4 != 1) {

      _CIfmod();

      uVar1 = FUN_005df4c4();

      local_4 = (float)((uVar1 ^ (int)uVar1 >> 0x1f) - ((int)uVar1 >> 0x1f));

      if (_DAT_0079a1b0 <= (double)(int)local_4) {

        fsin(extraout_ST0 * (float10)_DAT_0079c504);

        uVar3 = FUN_005df4c4();

      }

    }

    iVar2 = FUN_00550c30((float)fVar4,param_3,&local_4,param_4);

    if (iVar2 != 0) {

      FUN_00550ad0(param_1,uVar3,local_4);

    }

  }

  return;

}





// --- FUN_00550e80 at 0x00550E80 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_007cbd18;

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

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

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00550ec0 at 0x00550EC0 (size: 257) ---


void FUN_00550ec0(void)



{

  void *pvVar1;

  uint uVar2;

  int iVar3;

  int local_c;

  int *local_8;

  int local_4;

  

  FUN_0052dcf0(&local_c);

  while (local_4 != 0) {

    do {

      FUN_00553450();

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

    } while (local_4 != 0);

    do {

      local_8 = local_8 + 1;

      if (local_8 == (int *)(*(int *)(local_c + 0x60) + *(int *)(local_c + 0x68) * 4))

      goto LAB_00550f14;

      local_4 = *local_8;

    } while (local_4 == 0);

  }

LAB_00550f14:

  iVar3 = 0;

  do {

    uVar2 = DAT_008703b8 + iVar3 & 0x8000000f;

    if ((int)uVar2 < 0) {

      uVar2 = (uVar2 - 1 | 0xfffffff0) + 1;

    }

    pvVar1 = (void *)(&DAT_00870520)[uVar2 * 4];

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

      FUN_00553450();

      thunk_FUN_00553290();

      operator_delete(pvVar1);

    }

    iVar3 = iVar3 + 1;

  } while (iVar3 < 0x10);

  FUN_00553f70();

  FUN_00553a60();

  if (DAT_008703bc != '\0') {

    thunk_FUN_00436cf0(&DAT_008703d8);

    thunk_FUN_00436cf0(&DAT_008703dc);

    thunk_FUN_00436cf0(&DAT_008703e0);

    thunk_FUN_00436cf0(&DAT_008703e4);

    thunk_FUN_00436cf0(&DAT_008703e8);

    thunk_FUN_00436cf0(&DAT_008703ec);

    thunk_FUN_00436cf0(&DAT_008703f0);

    thunk_FUN_00436cf0(&DAT_008703f4);

  }

  return;

}





// --- FUN_00550fd0 at 0x00550FD0 (size: 28) ---


void FUN_00550fd0(int param_1)



{

  DAT_008200f4 = *(undefined4 *)(param_1 + 4);

  FUN_00425f10(param_1 + 8);

  return;

}





// --- thunk_FUN_00550ec0 at 0x00550FF0 (size: 5) ---


void thunk_FUN_00550ec0(void)



{

  void *pvVar1;

  uint uVar2;

  int iVar3;

  int iStack_c;

  int *piStack_8;

  int iStack_4;

  

  FUN_0052dcf0(&iStack_c);

  while (iStack_4 != 0) {

    do {

      FUN_00553450();

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

    } while (iStack_4 != 0);

    do {

      piStack_8 = piStack_8 + 1;

      if (piStack_8 == (int *)(*(int *)(iStack_c + 0x60) + *(int *)(iStack_c + 0x68) * 4))

      goto LAB_00550f14;

      iStack_4 = *piStack_8;

    } while (iStack_4 == 0);

  }

LAB_00550f14:

  iVar3 = 0;

  do {

    uVar2 = DAT_008703b8 + iVar3 & 0x8000000f;

    if ((int)uVar2 < 0) {

      uVar2 = (uVar2 - 1 | 0xfffffff0) + 1;

    }

    pvVar1 = (void *)(&DAT_00870520)[uVar2 * 4];

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

      FUN_00553450();

      thunk_FUN_00553290();

      operator_delete(pvVar1);

    }

    iVar3 = iVar3 + 1;

  } while (iVar3 < 0x10);

  FUN_00553f70();

  FUN_00553a60();

  if (DAT_008703bc != '\0') {

    thunk_FUN_00436cf0(&DAT_008703d8);

    thunk_FUN_00436cf0(&DAT_008703dc);

    thunk_FUN_00436cf0(&DAT_008703e0);

    thunk_FUN_00436cf0(&DAT_008703e4);

    thunk_FUN_00436cf0(&DAT_008703e8);

    thunk_FUN_00436cf0(&DAT_008703ec);

    thunk_FUN_00436cf0(&DAT_008703f0);

    thunk_FUN_00436cf0(&DAT_008703f4);

  }

  return;

}





// --- FUN_00551000 at 0x00551000 (size: 591) ---


void FUN_00551000(void)



{

  LONG LVar1;

  undefined4 *puVar2;

  int local_4;

  

  FUN_00401340("Sound Volume");

  FUN_00431090(&DAT_008703dc,&local_4,0,0,0,0);

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

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

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

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

  }

  FUN_00401340("Ambient Sound Volume");

  FUN_00431090(&DAT_008703e4,&local_4,0,0,0,0);

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

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

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

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

  }

  FUN_00401340("Interface Sound Volume");

  FUN_00431090(&DAT_008703ec,&local_4,0,0,0,0);

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

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

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

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

  }

  FUN_00401340("Sound Features");

  FUN_00402160(&DAT_008703f0,&local_4,0,2,&DAT_008703f8,0);

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

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

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

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

  }

  FUN_00401340("Sound Disabled");

  FUN_00411d90(&DAT_008703d8,&local_4,0,0,0,0);

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

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

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

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

  }

  FUN_00401340("Ambient Sound Disabled");

  FUN_00411d90(&DAT_008703e0,&local_4,0,0,0,0);

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

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

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

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

  }

  FUN_00401340("Interface Sound Disabled");

  FUN_00411d90(&DAT_008703e8,&local_4,0,0,0,0);

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

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

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

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

  }

  FUN_00401340("Play Sound Only When Active");

  FUN_00411d90(&DAT_008703f4,&local_4,0,0,0,0);

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

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

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

  }

  DAT_008703bc = 1;

  return;

}





// --- FUN_00551250 at 0x00551250 (size: 59) ---


void FUN_00551250(undefined4 param_1)



{

  int iVar1;

  time_t tVar2;

  

  FUN_00551000();

  FUN_00553a90(param_1);

  FUN_00554390();

  iVar1 = FUN_00553a30();

  if (iVar1 == 0) {

    DAT_00820074 = 0;

    return;

  }

  tVar2 = time((time_t *)0x0);

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

                    /* WARNING: Treating indirect jump as call */

  srand((uint)tVar2);

  return;

}





// --- FUN_00551290 at 0x00551290 (size: 174) ---


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



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  undefined4 uVar4;

  int *piVar5;

  int local_4;

  

  local_4 = 0;

  if (((param_2 != 0) && (iVar2 = FUN_00552d20(param_1,&local_4), iVar2 != 0)) &&

     (*(int *)(local_4 + 0x7c) != 0)) {

    FUN_0042c860(0,0x3f800000);

    iVar2 = local_4;

    uVar1 = *(uint *)(local_4 + 0x7c);

    uVar3 = FUN_005df4c4();

    if (uVar3 < uVar1) {

      piVar5 = (int *)(*(int *)(iVar2 + 0x80) + uVar3 * 0x10);

      *param_3 = *piVar5;

      param_3[1] = piVar5[1];

      param_3[2] = piVar5[2];

      param_3[3] = piVar5[3];

      if (*param_3 != 0) {

        uVar4 = FUN_00508a10(param_3);

        return uVar4;

      }

    }

  }

  return 0;

}





// --- FUN_00551340 at 0x00551340 (size: 102) ---


void FUN_00551340(uint param_1,int param_2)



{

  uint *puVar1;

  

  if ((DAT_00820074 != '\0') && ((DAT_0082008c == '\0' || (DAT_00838197 != '\0')))) {

    puVar1 = *(uint **)(DAT_00870510 + (param_1 % DAT_00870518) * 4);

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

      while (*puVar1 != param_1) {

        puVar1 = (uint *)puVar1[1];

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

          return;

        }

      }

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

        FUN_00550d80(puVar1,param_2 + 0x48,DAT_00820078,0);

      }

    }

  }

  return;

}





// --- FUN_005513b0 at 0x005513B0 (size: 120) ---


uint FUN_005513b0(uint param_1,int param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5)



{

  int iVar1;

  uint uVar2;

  uint *puVar3;

  

  uVar2 = (uint)DAT_00820074;

  if ((DAT_00820074 != 0) &&

     ((DAT_0082008c == '\0' || (uVar2 = (uint)DAT_00838197, DAT_00838197 != 0)))) {

    puVar3 = *(uint **)(DAT_00870510 + (param_1 % DAT_00870518) * 4);

    uVar2 = DAT_00870510 + (param_1 % DAT_00870518) * 4;

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

      while (*puVar3 != param_1) {

        puVar3 = (uint *)puVar3[1];

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

          return uVar2;

        }

      }

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

        iVar1 = FUN_00550cf0(param_4);

        uVar2 = 0;

        if (iVar1 != 0) {

          uVar2 = FUN_00550d80(puVar3,param_2 + 0x48,param_5,0);

        }

      }

    }

  }

  return uVar2;

}





// --- FUN_00551430 at 0x00551430 (size: 130) ---


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



void FUN_00551430(undefined4 param_1,undefined4 param_2,undefined4 param_3,float param_4)



{

  int iVar1;

  int iVar2;

  undefined1 local_10 [8];

  float local_8;

  

  if (DAT_0082007c != '\0') {

    param_4 = _DAT_00820080 * param_4;

    FUN_005528d0();

    iVar1 = FUN_00551290(param_1,param_2,local_10);

    if ((iVar1 != 0) && (iVar2 = rand(), (float)iVar2 * _DAT_007cbd08 < local_8)) {

      FUN_00550d80(iVar1,param_3,param_4,1);

    }

  }

  return;

}





// --- FUN_005514c0 at 0x005514C0 (size: 155) ---


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



void FUN_005514c0(undefined4 param_1,undefined4 param_2,float param_3)



{

  int iVar1;

  int iVar2;

  float local_14;

  undefined1 local_10 [8];

  float local_8;

  

  if (DAT_0082007c != '\0') {

    param_3 = _DAT_00820080 * param_3;

    FUN_005528d0();

    iVar1 = FUN_00551290(param_1,param_2,local_10);

    if (iVar1 != 0) {

      local_14 = local_8;

      iVar2 = rand();

      if (((float)iVar2 * _DAT_007cbd08 < local_14) &&

         (iVar2 = FUN_00550c30(0,param_3,&local_14,1), iVar2 != 0)) {

        FUN_00550ad0(iVar1,0,local_14);

      }

    }

  }

  return;

}





// --- FUN_00551560 at 0x00551560 (size: 133) ---


void FUN_00551560(undefined4 param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  undefined4 local_14;

  undefined1 local_10 [8];

  undefined4 local_8;

  undefined4 local_4;

  

  if ((DAT_00820084 != '\0') && ((DAT_0082008c == '\0' || (DAT_00838197 != '\0')))) {

    FUN_005528d0();

    iVar1 = FUN_00551290(param_1,param_2,local_10);

    if ((iVar1 != 0) &&

       ((iVar2 = FUN_00550cf0(local_8), iVar2 != 0 &&

        (iVar2 = FUN_00550c30(0,local_4,&local_14,0), iVar2 != 0)))) {

      FUN_00550ad0(iVar1,0,local_14);

    }

  }

  return;

}





// --- FUN_005515f0 at 0x005515F0 (size: 127) ---


uint FUN_005515f0(uint param_1,undefined4 param_2)



{

  int iVar1;

  uint uVar2;

  uint *puVar3;

  undefined4 local_4;

  

  uVar2 = (uint)DAT_00820084;

  if ((DAT_00820084 != 0) &&

     ((DAT_0082008c == '\0' || (uVar2 = (uint)DAT_00838197, DAT_00838197 != 0)))) {

    puVar3 = *(uint **)(DAT_00870510 + (param_1 % DAT_00870518) * 4);

    uVar2 = DAT_00870510 + (param_1 % DAT_00870518) * 4;

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

      while (*puVar3 != param_1) {

        puVar3 = (uint *)puVar3[1];

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

          return uVar2;

        }

      }

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

        iVar1 = FUN_00550c30(0,param_2,&local_4,0);

        uVar2 = 0;

        if (iVar1 != 0) {

          uVar2 = FUN_00550ad0(puVar3,0,local_4);

        }

      }

    }

  }

  return uVar2;

}





// --- FUN_00551670 at 0x00551670 (size: 143) ---


undefined4 * __thiscall FUN_00551670(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_007cbd18;

  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_00551700 at 0x00551700 (size: 120) ---


void FUN_00551700(undefined4 param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  int iVar2;

  undefined1 local_10 [8];

  undefined4 local_8;

  

  if ((DAT_00820074 != '\0') && ((DAT_0082008c == '\0' || (DAT_00838197 != '\0')))) {

    FUN_005528d0();

    if ((*(int *)(param_2 + 0x28) != 0) &&

       ((iVar1 = FUN_00551290(param_1,*(int *)(param_2 + 0x28),local_10), iVar1 != 0 &&

        (iVar2 = FUN_00550cf0(local_8), iVar2 != 0)))) {

      FUN_00550d80(iVar1,param_2 + 0x48,param_3,0);

    }

  }

  return;

}





// --- FUN_00551780 at 0x00551780 (size: 120) ---


void FUN_00551780(undefined4 param_1,int param_2)



{

  int iVar1;

  int iVar2;

  undefined1 local_10 [8];

  undefined4 local_8;

  undefined4 local_4;

  

  if ((DAT_00820074 != '\0') && ((DAT_0082008c == '\0' || (DAT_00838197 != '\0')))) {

    FUN_005528d0();

    if ((*(int *)(param_2 + 0x28) != 0) &&

       ((iVar1 = FUN_00551290(param_1,*(int *)(param_2 + 0x28),local_10), iVar1 != 0 &&

        (iVar2 = FUN_00550cf0(local_8), iVar2 != 0)))) {

      FUN_00550d80(iVar1,param_2 + 0x48,local_4,0);

    }

  }

  return;

}





// --- FUN_00551800 at 0x00551800 (size: 104) ---


void FUN_00551800(uint param_1)



{

  uint *puVar1;

  int iVar2;

  undefined4 uVar3;

  

  puVar1 = *(uint **)(DAT_00870510 + (param_1 % DAT_00870518) * 4);

  do {

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

LAB_00551831:

      iVar2 = FUN_005df0f5(0x24);

      if (iVar2 != 0) {

        uVar3 = FUN_00550d20(param_1);

        FUN_0042bd40(uVar3);

        return;

      }

      FUN_0042bd40(0);

      return;

    }

    if (*puVar1 == param_1) {

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

        puVar1[6] = puVar1[6] + 1;

        return;

      }

      goto LAB_00551831;

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_00551870 at 0x00551870 (size: 111) ---


void FUN_00551870(uint param_1)



{

  void *pvVar1;

  void *pvVar2;

  uint *puVar3;

  

  puVar3 = *(uint **)(DAT_00870510 + (param_1 % DAT_00870518) * 4);

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

    while (*puVar3 != param_1) {

      puVar3 = (uint *)puVar3[1];

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

        return;

      }

    }

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

      puVar3 = puVar3 + 6;

      *puVar3 = *puVar3 - 1;

      if ((*puVar3 == 0) && (pvVar2 = (void *)FUN_004171e0(&param_1), pvVar2 != (void *)0x0)) {

        pvVar1 = *(void **)((int)pvVar2 + 0x1c);

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

          thunk_FUN_00553290();

          operator_delete(pvVar1);

        }

        operator_delete(pvVar2);

      }

    }

  }

  return;

}





// --- FUN_00551910 at 0x00551910 (size: 122) ---


void __thiscall FUN_00551910(int param_1,int param_2,float param_3,float param_4)



{

  int *piVar1;

  uint uVar2;

  

  uVar2 = 0;

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

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

    do {

      if (param_2 == *piVar1) break;

      uVar2 = uVar2 + 1;

      piVar1 = piVar1 + 1;

    } while (uVar2 < *(uint *)(param_1 + 0x5c));

  }

  if (uVar2 != *(uint *)(param_1 + 0x5c)) {

    if (param_3 < *(float *)(param_1 + 0x1c + uVar2 * 4)) {

      *(float *)(param_1 + 0x1c + uVar2 * 4) = param_3;

    }

    if (*(float *)(param_1 + 0x3c + uVar2 * 4) < param_4) {

      *(float *)(param_1 + 0x3c + uVar2 * 4) = param_4;

    }

    return;

  }

  *(int *)(param_1 + 0x60 + uVar2 * 4) = param_2;

  *(float *)(param_1 + 0x3c + uVar2 * 4) = param_4;

  *(float *)(param_1 + 0x1c + uVar2 * 4) = param_3;

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

  return;

}





// --- FUN_005519b0 at 0x005519B0 (size: 61) ---


void FUN_005519b0(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4)



{

  if (param_3 == 0) {

    FUN_005514c0(param_1,param_2,param_4);

    return;

  }

  FUN_00551430(param_1,param_2,param_3,param_4);

  return;

}





// --- FUN_005519f0 at 0x005519F0 (size: 103) ---


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



float10 FUN_005519f0(float *param_1)



{

  float fVar1;

  

  fVar1 = param_1[2] * param_1[2] + param_1[1] * param_1[1] + *param_1 * *param_1;

  if (_DAT_00820164 < fVar1) {

    return (float10)DAT_00796344;

  }

  if (fVar1 < _DAT_0082015c) {

    return (float10)_DAT_007938b0;

  }

  return (float10)_DAT_0082015c / (float10)fVar1;

}





// --- FUN_00551a60 at 0x00551A60 (size: 312) ---


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



undefined4 FUN_00551a60(float *param_1)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  undefined4 uVar5;

  

  fVar2 = *param_1;

  fVar1 = param_1[1];

  fVar3 = ABS(fVar2);

  fVar4 = ABS(fVar1);

  if (fVar2 * fVar2 + fVar1 * fVar1 < _DAT_0082015c * _DAT_007938b8) {

    return 0;

  }

  if ((fVar3 < _DAT_007cbe58) || (_DAT_007c6bc4 < fVar4 / fVar3)) {

    uVar5 = 1;

    if (fVar1 < DAT_00796344) {

      uVar5 = 2;

    }

    return uVar5;

  }

  if ((fVar4 < _DAT_007cbe58) || (_DAT_007c6bc4 < fVar3 / fVar4)) {

    if (DAT_00796344 <= fVar2) {

      return 3;

    }

    return 4;

  }

  if (fVar2 < DAT_00796344) {

    if (DAT_00796344 <= fVar1) {

      return 5;

    }

    return 6;

  }

  if (DAT_00796344 <= fVar1) {

    return 7;

  }

  return 8;

}





// --- FUN_00551bf0 at 0x00551BF0 (size: 40) ---


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



bool __fastcall FUN_00551bf0(int *param_1)



{

  float10 fVar1;

  

  fVar1 = (float10)(**(code **)(*param_1 + 4))();

  if (fVar1 < (float10)_DAT_00820168) {

    return false;

  }

  return *(int *)(param_1[3] + 0x14) != 0;

}





// --- FUN_00551c30 at 0x00551C30 (size: 86) ---


void __thiscall FUN_00551c30(int *param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

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

    iVar1 = param_1[1];

    iVar2 = thunk_FUN_005df0f5((param_2 + iVar1) * 4);

    uVar3 = 0;

    if (param_1[3] != 0) {

      do {

        *(undefined4 *)(iVar2 + uVar3 * 4) = *(undefined4 *)(*param_1 + uVar3 * 4);

        uVar3 = uVar3 + 1;

      } while (uVar3 < (uint)param_1[3]);

    }

    operator_delete__((void *)*param_1);

    *param_1 = iVar2;

    param_1[3] = param_2 + iVar1;

  }

  return;

}





// --- FUN_00551cd0 at 0x00551CD0 (size: 230) ---


int __thiscall FUN_00551cd0(int param_1,uint param_2,int param_3)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  int *piVar4;

  uint uVar5;

  

  iVar2 = param_2;

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

  uVar5 = 0;

  param_2 = 0;

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

    piVar4 = *(int **)(param_1 + 0x50);

    do {

      if ((*(int *)(*piVar4 + 0xc) == iVar2) && (*(int *)(*piVar4 + 0x10) == param_3)) {

        return (*(int **)(param_1 + 0x50))[uVar5];

      }

      uVar5 = uVar5 + 1;

      piVar4 = piVar4 + 1;

      param_2 = uVar5;

    } while (uVar5 < *(uint *)(param_1 + 0x4c));

  }

  FUN_00551c30(*(int *)(param_1 + 0x4c));

  if (iVar1 == 0) {

    puVar3 = (undefined4 *)FUN_005df0f5(0x80);

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

      puVar3[1] = 0;

      puVar3[2] = 0;

      *puVar3 = &PTR_LAB_007cbe7c;

      puVar3[6] = 0;

      puVar3[0x17] = 0;

      puVar3[3] = iVar2;

      puVar3[4] = param_3;

      goto LAB_00551d97;

    }

  }

  else {

    puVar3 = (undefined4 *)FUN_005df0f5(0x1c);

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

      puVar3[1] = 0;

      puVar3[2] = 0;

      *puVar3 = &PTR_LAB_007cbe9c;

      puVar3[6] = 0;

      puVar3[3] = iVar2;

      puVar3[4] = param_3;

      goto LAB_00551d97;

    }

  }

  puVar3 = (undefined4 *)0x0;

LAB_00551d97:

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

  *(int *)(param_1 + 0x4c) = iVar1 + 1;

  *(undefined4 **)(*(int *)(param_1 + 0x50) + iVar1 * 4) = puVar3;

  return *(int *)(*(int *)(param_1 + 0x50) + param_2 * 4);

}





// --- FUN_00551dc0 at 0x00551DC0 (size: 25) ---


void __fastcall FUN_00551dc0(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  return;

}





// --- FUN_00551de0 at 0x00551DE0 (size: 84) ---


void __fastcall FUN_00551de0(int param_1)



{

  uint uVar1;

  

  uVar1 = 0;

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

    do {

      operator_delete(*(void **)(*(int *)(param_1 + 8) + uVar1 * 4));

      uVar1 = uVar1 + 1;

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

  }

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

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

  operator_delete__(*(void **)(param_1 + 8));

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

  operator_delete__(*(void **)(param_1 + 8));

  return;

}





// --- FUN_00551e40 at 0x00551E40 (size: 212) ---


uint __thiscall FUN_00551e40(undefined4 *param_1,int *param_2,uint *param_3)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  

  if (3 < *param_3) {

    *(undefined4 *)*param_2 = *param_1;

    *param_2 = *param_2 + 4;

    uVar3 = *param_3;

    *param_3 = uVar3 - 4;

    if (3 < uVar3 - 4) {

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

      *param_2 = *param_2 + 4;

      *param_3 = *param_3 - 4;

    }

  }

  uVar3 = 0;

  if (param_1[4] != 0) {

    do {

      if (3 < *param_3) {

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

        *param_2 = *param_2 + 4;

        uVar1 = *param_3;

        *param_3 = uVar1 - 4;

        if (3 < uVar1 - 4) {

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

          *param_2 = *param_2 + 4;

          uVar1 = *param_3;

          *param_3 = uVar1 - 4;

          if (3 < uVar1 - 4) {

            *(undefined4 *)*param_2 = *(undefined4 *)(*(int *)(param_1[2] + uVar3 * 4) + 0xc);

            *param_2 = *param_2 + 4;

            *param_3 = *param_3 - 4;

          }

        }

      }

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

      iVar2 = *param_2;

      *param_2 = iVar2 + 4;

      if (3 < *param_3) {

        *(undefined4 *)(iVar2 + 4) = *(undefined4 *)(*(int *)(param_1[2] + uVar3 * 4) + 0x14);

        *param_2 = *param_2 + 4;

        *param_3 = *param_3 - 4;

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < (uint)param_1[4]);

  }

  return *param_3;

}





// --- FUN_00551f20 at 0x00551F20 (size: 14) ---


int __fastcall FUN_00551f20(int param_1)



{

  return *(int *)(param_1 + 0x10) * 0x14 + 8;

}





// --- FUN_005521a0 at 0x005521A0 (size: 65) ---


void __fastcall FUN_005521a0(int param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  

  uVar2 = 0;

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

    do {

      puVar1 = *(undefined4 **)(*(int *)(param_1 + 0x50) + uVar2 * 4);

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

        *puVar1 = &PTR_FUN_007cbe5c;

        operator_delete(puVar1);

      }

      *(undefined4 *)(*(int *)(param_1 + 0x50) + uVar2 * 4) = 0;

      uVar2 = uVar2 + 1;

    } while (uVar2 < *(uint *)(param_1 + 0x4c));

  }

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

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

  return;

}





// --- FUN_005521f0 at 0x005521F0 (size: 61) ---


void __thiscall FUN_005521f0(int param_1,int param_2)



{

  uint uVar1;

  

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

  FUN_00425f10(param_2 + 8);

  uVar1 = 0;

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

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

    do {

      (**(code **)**(undefined4 **)(*(int *)(param_1 + 0x50) + uVar1 * 4))();

      uVar1 = uVar1 + 1;

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

  }

  return;

}





// --- FUN_00552230 at 0x00552230 (size: 205) ---


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



void __thiscall FUN_00552230(int param_1,int param_2,undefined4 param_3)



{

  float fVar1;

  undefined4 uVar2;

  int *piVar3;

  uint uVar4;

  float10 fVar5;

  float local_c;

  float local_8;

  float local_4;

  

  if ((DAT_0082007c != '\0') &&

     (FUN_0050aa30(&local_c,param_3),

     local_c * local_c + local_8 * local_8 + local_4 * local_4 <= _DAT_00820164)) {

    fVar5 = (float10)FUN_005519f0(&local_c);

    fVar1 = (float)fVar5;

    uVar2 = FUN_00551a60(&local_c);

    if (fVar1 != DAT_00796344) {

      uVar4 = 0;

      *(float *)(param_1 + 0x48) = fVar1 + *(float *)(param_1 + 0x48);

      if (*(int *)(param_2 + 0x10) != 0) {

        do {

          piVar3 = (int *)FUN_00551cd0(param_2,uVar4);

          (**(code **)(*piVar3 + 0x14))(fVar1,&local_c,uVar2);

          uVar4 = uVar4 + 1;

        } while (uVar4 < *(uint *)(param_2 + 0x10));

      }

    }

  }

  return;

}





// --- FUN_00552300 at 0x00552300 (size: 119) ---


undefined4 * __fastcall FUN_00552300(undefined4 *param_1)



{

  undefined4 uVar1;

  

  *param_1 = &PTR_LAB_00797910;

  param_1[1] = 0;

  param_1[2] = 0x3f800000;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  FUN_00535b30();

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  uVar1 = thunk_FUN_005df0f5(0x20);

  param_1[0x14] = uVar1;

  param_1[0x17] = 8;

  param_1[0x16] = 0;

  param_1[0x15] = 8;

  param_1[0x18] = &PTR_FUN_007c7444;

  param_1[0x1a] = 0;

  uVar1 = thunk_FUN_005df0f5(0x100);

  param_1[0x19] = uVar1;

  param_1[0x1c] = 0x10;

  param_1[0x1b] = 0x10;

  return param_1;

}





// --- FUN_00552380 at 0x00552380 (size: 51) ---


void __fastcall FUN_00552380(undefined4 *param_1)



{

  FUN_005521a0();

  param_1[0x18] = &PTR_FUN_007c7444;

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

  operator_delete__((void *)param_1[0x14]);

  param_1[0x14] = 0;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005523c0 at 0x005523C0 (size: 212) ---


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



void FUN_005523c0(int *param_1)



{

  undefined4 uVar1;

  undefined4 uVar2;

  int iVar3;

  float10 fVar4;

  undefined **local_48;

  undefined4 local_44;

  

  local_48 = &PTR_LAB_00797910;

  local_44 = DAT_008200f4;

  FUN_00425f10(&DAT_008200f8);

  iVar3 = (**(code **)(*param_1 + 8))();

  if (iVar3 == 0) {

    param_1[1] = 0;

    return;

  }

  iVar3 = (**(code **)(*param_1 + 0xc))();

  if (iVar3 != 0) {

    iVar3 = (**(code **)(*param_1 + 0x1c))(&local_48);

    uVar1 = *(undefined4 *)(param_1[3] + 0x14);

    uVar2 = **(undefined4 **)(*(int *)(param_1[3] + 8) + param_1[4] * 4);

    if (iVar3 == 0) {

      fVar4 = (float10)(**(code **)(*param_1 + 4))();

      FUN_005514c0(uVar2,uVar1,(float)fVar4);

    }

    else {

      fVar4 = (float10)(**(code **)(*param_1 + 4))();

      FUN_005519b0(uVar2,uVar1,&local_48,(float)fVar4);

    }

  }

  fVar4 = (float10)(**(code **)(*param_1 + 0x10))();

  FUN_00508470((double)(fVar4 + (float10)_DAT_008379a8),param_1);

  param_1[1] = 1;

  return;

}





// --- FUN_005524a0 at 0x005524A0 (size: 99) ---


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



void __fastcall FUN_005524a0(int param_1)



{

  undefined4 local_14;

  undefined1 local_10 [12];

  

  local_14 = 0;

  if (DAT_0082007c != '\0') {

    while (((0 < *(int *)(param_1 + 0x68) && (*(double **)(param_1 + 100) != (double *)0x0)) &&

           (**(double **)(param_1 + 100) < _DAT_008379a8))) {

      FUN_005084f0(local_10,&local_14);

      FUN_005523c0(local_14);

    }

  }

  return;

}





// --- FUN_00552510 at 0x00552510 (size: 348) ---


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



undefined4 __thiscall FUN_00552510(undefined4 *param_1,int *param_2,uint *param_3)



{

  undefined4 uVar1;

  int *piVar2;

  uint uVar3;

  int *piVar4;

  uint *puVar5;

  int iVar6;

  undefined4 *puVar7;

  undefined4 *local_4;

  

  puVar5 = param_3;

  piVar4 = param_2;

  if (3 < *param_3) {

    uVar1 = *(undefined4 *)*param_2;

    *param_2 = (int)((undefined4 *)*param_2 + 1);

    *param_3 = *param_3 - 4;

    *param_1 = uVar1;

    if (3 < *param_3) {

      piVar2 = *(int **)*param_2;

      *param_2 = (int)((undefined4 *)*param_2 + 1);

      *param_3 = *param_3 - 4;

      param_2 = piVar2;

    }

  }

  iVar6 = FUN_00500570(param_2);

  if (iVar6 == 0) {

    return 0;

  }

  param_3 = (uint *)0x0;

  local_4 = param_1;

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

    do {

      puVar7 = (undefined4 *)FUN_005df0f5(0x18);

      if (3 < *puVar5) {

        local_4 = *(undefined4 **)*piVar4;

        *piVar4 = (int)((undefined4 *)*piVar4 + 1);

        *puVar5 = *puVar5 - 4;

      }

      *puVar7 = local_4;

      if (3 < *puVar5) {

        puVar7[2] = *(undefined4 *)*piVar4;

        *piVar4 = *piVar4 + 4;

        uVar3 = *puVar5;

        *puVar5 = uVar3 - 4;

        if (3 < uVar3 - 4) {

          puVar7[3] = *(undefined4 *)*piVar4;

          *piVar4 = *piVar4 + 4;

          *puVar5 = *puVar5 - 4;

        }

      }

      puVar7[1] = (uint)((float)puVar7[3] == (float)_DAT_00795610);

      if (3 < *puVar5) {

        puVar7[4] = *(undefined4 *)*piVar4;

        *piVar4 = *piVar4 + 4;

        uVar3 = *puVar5;

        *puVar5 = uVar3 - 4;

        if (3 < uVar3 - 4) {

          puVar7[5] = *(undefined4 *)*piVar4;

          *piVar4 = *piVar4 + 4;

          *puVar5 = *puVar5 - 4;

        }

      }

      uVar3 = param_1[3];

      if (uVar3 <= (uint)param_1[4]) {

        if (uVar3 == 0) {

          iVar6 = 8;

        }

        else {

          iVar6 = uVar3 * 2;

        }

        iVar6 = FUN_00500570(iVar6);

        if (iVar6 == 0) {

          return 0;

        }

      }

      *(undefined4 **)(param_1[2] + param_1[4] * 4) = puVar7;

      param_3 = (uint *)((int)param_3 + 1);

      param_1[4] = param_1[4] + 1;

    } while (param_3 < param_2);

  }

  return 1;

}





// --- FUN_00552670 at 0x00552670 (size: 67) ---


void __fastcall FUN_00552670(int param_1)



{

  int *piVar1;

  uint uVar2;

  

  if ((DAT_0082007c != '\0') && (uVar2 = 0, *(int *)(param_1 + 0x4c) != 0)) {

    do {

      piVar1 = *(int **)(*(int *)(param_1 + 0x50) + uVar2 * 4);

      (**(code **)(*piVar1 + 0x18))(*(undefined4 *)(param_1 + 0x48));

      if (piVar1[1] == 0) {

        FUN_005523c0(piVar1);

      }

      uVar2 = uVar2 + 1;

    } while (uVar2 < *(uint *)(param_1 + 0x4c));

  }

  return;

}





// --- FUN_005526c0 at 0x005526C0 (size: 70) ---


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



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007c6720;

  param_1[0xc] = &PTR_LAB_007c670c;

  FUN_005545e0();

  param_1[0xe] = &PTR_LAB_007cbf28;

  *param_1 = &PTR_LAB_007cbed0;

  param_1[0xc] = &PTR_LAB_007cbebc;

  return param_1;

}





// --- FUN_00552730 at 0x00552730 (size: 123) ---


void __thiscall FUN_00552730(int param_1,int *param_2,uint param_3)



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  undefined4 *puVar4;

  undefined4 *puVar5;

  

  if ((uint)(*(int *)(param_1 + 0x68) + 8 + *(int *)(param_1 + 100)) <= param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(param_1 + 100);

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    uVar3 = *(uint *)(param_1 + 0x68);

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

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

    for (uVar2 = uVar3 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) {

      *puVar4 = *puVar5;

      puVar5 = puVar5 + 1;

      puVar4 = puVar4 + 1;

    }

    for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) {

      *(undefined1 *)puVar4 = *(undefined1 *)puVar5;

      puVar5 = (undefined4 *)((int)puVar5 + 1);

      puVar4 = (undefined4 *)((int)puVar4 + 1);

    }

    puVar4 = (undefined4 *)(*param_2 + *(int *)(param_1 + 0x68));

    *param_2 = (int)puVar4;

    uVar3 = *(uint *)(param_1 + 100);

    puVar5 = *(undefined4 **)(param_1 + 0x10);

    for (uVar2 = uVar3 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) {

      *puVar4 = *puVar5;

      puVar5 = puVar5 + 1;

      puVar4 = puVar4 + 1;

    }

    for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) {

      *(undefined1 *)puVar4 = *(undefined1 *)puVar5;

      puVar5 = (undefined4 *)((int)puVar5 + 1);

      puVar4 = (undefined4 *)((int)puVar4 + 1);

    }

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

  }

  return;

}





// --- FUN_00552880 at 0x00552880 (size: 66) ---


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



{

  *param_1 = &PTR_LAB_007cbed0;

  param_1[0xc] = &PTR_LAB_007cbebc;

  param_1[0xe] = &PTR_LAB_007cbf28;

  FUN_005548e0();

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005528d0 at 0x005528D0 (size: 27) ---


void __fastcall FUN_005528d0(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0x3f800000;

  param_1[3] = 0x3f800000;

  return;

}





// --- FUN_005528f0 at 0x005528F0 (size: 78) ---


undefined4 __thiscall FUN_005528f0(int param_1,uint *param_2,undefined4 param_3)



{

  uint uVar1;

  int iVar2;

  

  (**(code **)(*(int *)(param_1 + -0x30) + 0x3c))();

  (**(code **)(*(int *)(param_1 + 8) + 0x10))(param_2,param_3);

  uVar1 = *param_2 & 0x80000003;

  if ((int)uVar1 < 0) {

    uVar1 = (uVar1 - 1 | 0xfffffffc) + 1;

  }

  if (uVar1 != 0) {

    for (iVar2 = 4 - uVar1; iVar2 != 0; iVar2 = iVar2 + -1) {

      *(undefined1 *)*param_2 = 0;

      *param_2 = *param_2 + 1;

    }

  }

  return 1;

}





// --- FUN_00552940 at 0x00552940 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_007cbf84;

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

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

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00552980 at 0x00552980 (size: 183) ---


void __thiscall FUN_00552980(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  int *piVar2;

  int iVar3;

  int *piVar4;

  uint uVar5;

  undefined4 uVar6;

  

  uVar5 = 0;

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

    iVar3 = 0;

    do {

      uVar6 = 8;

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

      FUN_0041a4e0(uVar1,uVar6);

      uVar5 = uVar5 + 1;

      iVar3 = iVar3 + 0x10;

    } while (uVar5 < *(uint *)(param_1 + 0x7c));

  }

  piVar4 = (int *)(*(int *)(param_1 + 0x6c) + *(int *)(param_1 + 0x74) * 4);

  if (*(int **)(param_1 + 0x70) != piVar4) {

    while (**(int **)(param_1 + 0x70) == 0) {

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

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

      if (piVar2 == piVar4) {

        return;

      }

    }

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

    iVar3 = *piVar4;

    while (iVar3 != 0) {

      do {

        FUN_00552980(param_2);

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

      } while (iVar3 != 0);

      do {

        piVar4 = piVar4 + 1;

        if (piVar4 == (int *)(*(int *)(param_1 + 0x6c) + *(int *)(param_1 + 0x74) * 4)) {

          return;

        }

        iVar3 = *piVar4;

      } while (iVar3 == 0);

    }

  }

  return;

}





// --- FUN_00552a40 at 0x00552A40 (size: 135) ---


int __fastcall FUN_00552a40(int param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int *piVar5;

  

  iVar3 = 8;

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

    iVar3 = *(int *)(param_1 + 0x7c) * 0x10 + 8;

  }

  piVar5 = (int *)(*(int *)(param_1 + 0x6c) + *(int *)(param_1 + 0x74) * 4);

  iVar3 = iVar3 + 4;

  if (*(int **)(param_1 + 0x70) != piVar5) {

    while (**(int **)(param_1 + 0x70) == 0) {

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

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

      if (piVar1 == piVar5) {

        return iVar3;

      }

    }

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

    iVar4 = *piVar5;

    while (iVar4 != 0) {

      do {

        iVar2 = FUN_00552a40();

        iVar4 = *(int *)(iVar4 + 8);

        iVar3 = iVar3 + iVar2;

      } while (iVar4 != 0);

      do {

        piVar5 = piVar5 + 1;

        if (piVar5 == (int *)(*(int *)(param_1 + 0x6c) + *(int *)(param_1 + 0x74) * 4)) {

          return iVar3;

        }

        iVar4 = *piVar5;

      } while (iVar4 == 0);

    }

  }

  return iVar3;

}





// --- FUN_00552cc0 at 0x00552CC0 (size: 81) ---


undefined4 __thiscall FUN_00552cc0(int param_1,uint param_2,int *param_3)



{

  int iVar1;

  

  iVar1 = *(int *)(*(int *)(param_1 + 0x6c) + (param_2 % *(uint *)(param_1 + 0x74)) * 4);

  if (iVar1 != 0) {

    while (*(uint *)(iVar1 + 4) != param_2) {

      iVar1 = *(int *)(iVar1 + 8);

      if (iVar1 == 0) {

        *param_3 = 0;

        return 0;

      }

    }

    if (iVar1 != 0) {

      *param_3 = iVar1;

      return 1;

    }

  }

  *param_3 = 0;

  return 0;

}





// --- FUN_00552d20 at 0x00552D20 (size: 8) ---


void FUN_00552d20(void)



{

  FUN_00552cc0();

  return;

}





// --- FUN_00552d30 at 0x00552D30 (size: 143) ---


undefined4 * __thiscall FUN_00552d30(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_007cbf84;

  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_00552dc0 at 0x00552DC0 (size: 106) ---


undefined4 * __fastcall FUN_00552dc0(undefined4 *param_1)



{

  undefined4 *puVar1;

  

  param_1[2] = 0;

  *param_1 = &PTR_FUN_007cbf88;

  FUN_00552d30(4);

  param_1[0x1f] = 0;

  param_1[0x20] = 0;

  param_1[1] = 0;

  puVar1 = (undefined4 *)thunk_FUN_005df0f5(0x14);

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

    *puVar1 = 1;

    puVar1[1] = 0;

    puVar1[2] = 0;

    puVar1[3] = 0x3f800000;

    puVar1[4] = 0x3f800000;

    param_1[0x20] = puVar1 + 1;

    param_1[0x1f] = param_1[0x1f] + 1;

    return param_1;

  }

  param_1[0x20] = 0;

  param_1[0x1f] = param_1[0x1f] + 1;

  return param_1;

}





// --- FUN_00552e30 at 0x00552E30 (size: 100) ---


uint __thiscall FUN_00552e30(int param_1,int param_2)



{

  int *piVar1;

  uint uVar2;

  int iVar3;

  

  uVar2 = *(uint *)(*(int *)(param_1 + 0x60) +

                   (*(uint *)(param_2 + 4) % *(uint *)(param_1 + 0x68)) * 4);

  do {

    if (uVar2 == 0) {

LAB_00552e5d:

      piVar1 = (int *)(*(int *)(param_1 + 0x60) +

                      (*(uint *)(param_2 + 4) % *(uint *)(param_1 + 0x68)) * 4);

      *(int *)(param_2 + 8) = *piVar1;

      *piVar1 = param_2;

      if (piVar1 < *(int **)(param_1 + 100)) {

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

      }

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

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

      return CONCAT31((int3)((uint)iVar3 >> 8),1);

    }

    if (*(uint *)(uVar2 + 4) == *(uint *)(param_2 + 4)) {

      if (uVar2 != 0) {

        return uVar2 & 0xffffff00;

      }

      goto LAB_00552e5d;

    }

    uVar2 = *(uint *)(uVar2 + 8);

  } while( true );

}





// --- FUN_00552ea0 at 0x00552EA0 (size: 119) ---


void __fastcall FUN_00552ea0(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  int *piVar5;

  

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

  do {

    if (iVar1 == 0) {

      return;

    }

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

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

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

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

        puVar4 = (undefined4 *)*piVar5;

        goto LAB_00552edf;

      }

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

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

    }

    piVar5 = (int *)0x0;

    puVar4 = (undefined4 *)0x0;

LAB_00552edf:

    puVar3 = (undefined4 *)*piVar5;

    if (puVar3 == puVar4) {

LAB_00552ef2:

      *piVar5 = puVar3[2];

    }

    else {

      do {

        puVar2 = puVar3;

        puVar3 = (undefined4 *)puVar2[2];

      } while (puVar3 != puVar4);

      if (puVar2 == (undefined4 *)0x0) goto LAB_00552ef2;

      puVar2[2] = puVar3[2];

    }

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

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

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

    }

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

  } while( true );

}





// --- FUN_00552f20 at 0x00552F20 (size: 104) ---


void __fastcall FUN_00552f20(int param_1)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  

  FUN_00552ea0();

  uVar2 = 0;

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

    iVar3 = 0;

    do {

      iVar1 = *(int *)(*(int *)(param_1 + 0x80) + iVar3);

      if (iVar1 != 0) {

        FUN_00551870(iVar1);

      }

      uVar2 = uVar2 + 1;

      iVar3 = iVar3 + 0x10;

    } while (uVar2 < *(uint *)(param_1 + 0x7c));

  }

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

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

    operator_delete__((void *)(*(int *)(param_1 + 0x80) + -4));

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

  }

  return;

}





// --- FUN_00552f90 at 0x00552F90 (size: 435) ---


undefined4 __thiscall FUN_00552f90(int param_1,int *param_2,uint param_3)



{

  undefined4 uVar1;

  int iVar2;

  int *piVar3;

  int *piVar4;

  int *piVar5;

  undefined4 *puVar6;

  int iVar7;

  

  piVar3 = param_2;

  FUN_00552f20();

  uVar1 = *(undefined4 *)*param_2;

  *param_2 = (int)((undefined4 *)*param_2 + 1);

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

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

  *param_2 = *param_2 + 4;

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

    operator_delete__((void *)(*(int *)(param_1 + 0x80) + -4));

  }

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

  piVar4 = (int *)thunk_FUN_005df0f5(iVar7 * 0x10 + 4);

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

    piVar5 = (int *)0x0;

  }

  else {

    piVar5 = piVar4 + 1;

    *piVar4 = iVar7;

    piVar4 = piVar5;

    if (-1 < iVar7 + -1) {

      do {

        *piVar4 = 0;

        piVar4[1] = 0;

        piVar4[2] = 0x3f800000;

        piVar4[3] = 0x3f800000;

        iVar7 = iVar7 + -1;

        piVar4 = piVar4 + 4;

      } while (iVar7 != 0);

    }

  }

  *(int **)(param_1 + 0x80) = piVar5;

  param_2 = (int *)0x0;

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

    iVar7 = 0;

    do {

      puVar6 = (undefined4 *)(*(int *)(param_1 + 0x80) + iVar7);

      if (0xf < param_3) {

        uVar1 = *(undefined4 *)*piVar3;

        *piVar3 = (int)((undefined4 *)*piVar3 + 1);

        *puVar6 = uVar1;

        puVar6[1] = *(undefined4 *)*piVar3;

        iVar2 = *piVar3;

        *piVar3 = iVar2 + 4;

        puVar6[2] = *(undefined4 *)(iVar2 + 4);

        iVar2 = *piVar3;

        *piVar3 = iVar2 + 4;

        puVar6[3] = *(undefined4 *)(iVar2 + 4);

        *piVar3 = *piVar3 + 4;

      }

      iVar2 = *(int *)(*(int *)(param_1 + 0x80) + iVar7);

      if (iVar2 != 0) {

        FUN_00551800(iVar2);

      }

      param_2 = (int *)((int)param_2 + 1);

      iVar7 = iVar7 + 0x10;

    } while (param_2 < *(uint *)(param_1 + 0x7c));

  }

  iVar7 = *(int *)*piVar3;

  *piVar3 = (int)((int *)*piVar3 + 1);

  for (; iVar7 != 0; iVar7 = iVar7 + -1) {

    piVar4 = (int *)FUN_005df0f5(0x84);

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

      piVar4 = (int *)0x0;

    }

    else {

      piVar4[2] = 0;

      *piVar4 = (int)&PTR_FUN_007cbf88;

      FUN_00552d30(4);

      piVar4[0x1f] = 0;

      piVar4[0x20] = 0;

      piVar4[1] = 0;

      puVar6 = (undefined4 *)thunk_FUN_005df0f5(0x14);

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

        piVar4[0x20] = 0;

        piVar4[0x1f] = piVar4[0x1f] + 1;

      }

      else {

        *puVar6 = 1;

        puVar6[1] = 0;

        puVar6[2] = 0;

        puVar6[3] = 0x3f800000;

        puVar6[4] = 0x3f800000;

        piVar4[0x20] = (int)(puVar6 + 1);

        piVar4[0x1f] = piVar4[0x1f] + 1;

      }

    }

    (**(code **)(*piVar4 + 0x10))(piVar3,param_3);

    FUN_00552e30(piVar4);

  }

  return 1;

}





// --- FUN_00553150 at 0x00553150 (size: 47) ---


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



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007cbfb0;

  param_1[0xc] = &PTR_LAB_007cbf9c;

  FUN_00552dc0();

  return param_1;

}





// --- FUN_005531a0 at 0x005531A0 (size: 95) ---


void __fastcall FUN_005531a0(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007cbfb0;

  param_1[0xc] = &PTR_LAB_007cbf9c;

  param_1[0xe] = &PTR_FUN_007cbf88;

  FUN_00552f20();

  param_1[0x11] = &PTR_FUN_007cbf84;

  if ((undefined4 *)param_1[0x29] != param_1 + 0x12) {

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

  }

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  param_1[0x2b] = 0;

  param_1[0x2c] = 0;

  param_1[0xe] = &PTR_FUN_0079385c;

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  return;

}





// --- FUN_00553210 at 0x00553210 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_007cbf88;

  FUN_00552f20();

  param_1[3] = &PTR_FUN_007cbf84;

  if ((undefined4 *)param_1[0x1b] != param_1 + 4) {

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

  }

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00553270 at 0x00553270 (size: 30) ---


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



{

  FUN_005531a0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00553290 at 0x00553290 (size: 86) ---


void __fastcall FUN_00553290(int param_1)



{

  int *piVar1;

  

  if (*(void **)(param_1 + 0xc) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0xc));

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

  }

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

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

  piVar1 = *(int **)(param_1 + 8);

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

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

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

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

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

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

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

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

  return;

}





// --- FUN_005532f0 at 0x005532F0 (size: 349) ---


/* WARNING: Type propagation algorithm not settling */



undefined4 __thiscall FUN_005532f0(int param_1,int param_2)



{

  undefined4 ****ppppuVar1;

  int *piVar2;

  undefined4 ****ppppuVar3;

  undefined4 ****ppppuVar4;

  int iVar5;

  undefined4 ****ppppuVar6;

  uint uVar7;

  uint uVar8;

  undefined4 *puVar9;

  undefined4 *puVar10;

  undefined4 ****ppppuVar11;

  undefined4 ****ppppuVar12;

  undefined4 ****local_64 [25];

  

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

  local_64[1] = (undefined4 ****)0x0;

  local_64[2] = (undefined4 ****)0x0;

  local_64[0] = (undefined4 ****)0x0;

  local_64[3] = (undefined4 ****)0x0;

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

    puVar10 = *(undefined4 **)(param_2 + 8);

    ppppuVar3 = local_64 + 3;

    ppppuVar4 = local_64 + 2;

    ppppuVar1 = local_64;

    iVar5 = (**(code **)(*piVar2 + 0x2c))(piVar2,0,*(undefined4 *)(param_1 + 0x14),local_64 + 1);

    if (iVar5 == 0) {

      ppppuVar12 = *(undefined4 *****)(param_1 + 0x14);

      if (DAT_008706fc == 0) {

        ppppuVar6 = ppppuVar12;

        if (ppppuVar1 < ppppuVar12) {

          ppppuVar6 = ppppuVar1;

        }

        puVar9 = puVar10;

        ppppuVar11 = ppppuVar4;

        for (uVar7 = (uint)ppppuVar6 >> 2; uVar7 != 0; uVar7 = uVar7 - 1) {

          *ppppuVar11 = (undefined4 ***)*puVar9;

          puVar9 = puVar9 + 1;

          ppppuVar11 = ppppuVar11 + 1;

        }

        for (uVar7 = (uint)ppppuVar6 & 3; uVar7 != 0; uVar7 = uVar7 - 1) {

          *(undefined1 *)ppppuVar11 = *(undefined1 *)puVar9;

          puVar9 = (undefined4 *)((int)puVar9 + 1);

          ppppuVar11 = (undefined4 ****)((int)ppppuVar11 + 1);

        }

        if ((ppppuVar1 < ppppuVar12) && (ppppuVar3 != (undefined4 ****)0x0)) {

          uVar8 = *(int *)(param_1 + 0x14) - (int)ppppuVar1;

          puVar10 = (undefined4 *)((int)ppppuVar1 + (int)puVar10);

          ppppuVar12 = ppppuVar3;

          for (uVar7 = uVar8 >> 2; uVar7 != 0; uVar7 = uVar7 - 1) {

            *ppppuVar12 = (undefined4 ***)*puVar10;

            puVar10 = puVar10 + 1;

            ppppuVar12 = ppppuVar12 + 1;

          }

          for (uVar8 = uVar8 & 3; uVar8 != 0; uVar8 = uVar8 - 1) {

            *(undefined1 *)ppppuVar12 = *(undefined1 *)puVar10;

            puVar10 = (undefined4 *)((int)puVar10 + 1);

            ppppuVar12 = (undefined4 ****)((int)ppppuVar12 + 1);

          }

        }

      }

      else {

        local_64[0] = *(undefined4 *****)(param_2 + 0x5c);

        local_64[3] = ppppuVar4;

        local_64[4] = ppppuVar1;

        iVar5 = acmStreamPrepareHeader(DAT_008706fc,&stack0xffffff8c,0);

        if (iVar5 == 0) {

          acmStreamConvert(DAT_008706fc,&stack0xffffff8c,4);

          local_64[0] = *(undefined4 *****)(param_2 + 0x5c);

          local_64[4] = ppppuVar1;

          acmStreamUnprepareHeader(DAT_008706fc,&stack0xffffff8c,0);

        }

      }

      (**(code **)(**(int **)(param_1 + 4) + 0x4c))

                (*(int **)(param_1 + 4),ppppuVar4,ppppuVar1,ppppuVar3,0);

      return 1;

    }

  }

  return 0;

}





// --- FUN_00553450 at 0x00553450 (size: 20) ---


bool __fastcall FUN_00553450(int param_1)



{

  int *piVar1;

  int iVar2;

  

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

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

    return false;

  }

  iVar2 = (**(code **)(*piVar1 + 0x48))(piVar1);

  return iVar2 == 0;

}





// --- FUN_00553470 at 0x00553470 (size: 34) ---


int * __fastcall FUN_00553470(int param_1)



{

  int iVar1;

  int *piVar2;

  int local_4;

  

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

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

    local_4 = param_1;

    iVar1 = (**(code **)(*piVar2 + 0x24))(piVar2,&local_4);

    if (iVar1 == 0) {

      return piVar2;

    }

  }

  return (int *)0xffffffff;

}





// --- FUN_005534a0 at 0x005534A0 (size: 29) ---


void FUN_005534a0(undefined4 param_1)



{

  undefined4 uVar1;

  

  uVar1 = FUN_004220b0(param_1,0xf);

  FUN_00415430(uVar1);

  return;

}





// --- thunk_FUN_00553290 at 0x005534C0 (size: 5) ---


void __fastcall thunk_FUN_00553290(int param_1)



{

  int *piVar1;

  

  if (*(void **)(param_1 + 0xc) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0xc));

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

  }

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

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

  piVar1 = *(int **)(param_1 + 8);

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

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

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

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

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

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

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

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

  return;

}





// --- FUN_005534d0 at 0x005534D0 (size: 128) ---


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



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  

  piVar1 = param_1 + 1;

  *piVar1 = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = DAT_00870734;

  iVar3 = FUN_00553a50();

  *param_1 = iVar3;

  if ((iVar3 != 0) && (piVar2 = *(int **)(iVar3 + 0x18), piVar2 != (int *)0x0)) {

    iVar3 = (**(code **)(*piVar2 + 0x14))(piVar2,*(undefined4 *)(param_2 + 4),piVar1);

    if (iVar3 == 0) {

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

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

      iVar3 = *(int *)(param_2 + 0x18);

      param_1[6] = iVar3;

      param_1[7] = *(int *)(param_2 + 0x1c);

      if (iVar3 != 0) {

        (*(code *)**(undefined4 **)*piVar1)((undefined4 *)*piVar1,&DAT_007fe7e0,param_1 + 2);

      }

    }

  }

  return param_1;

}





// --- FUN_00553550 at 0x00553550 (size: 602) ---


undefined4 __thiscall FUN_00553550(int *param_1,int param_2)



{

  short sVar1;

  int *piVar2;

  undefined4 *puVar3;

  undefined4 uVar4;

  int *piVar5;

  int iVar6;

  uint uVar7;

  uint *puVar8;

  int *local_4c;

  undefined4 local_48;

  short local_38 [10];

  uint local_24 [4];

  short *local_14;

  

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

  local_48 = 0;

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

    return 0;

  }

  if ((param_1[6] == 0) || (*(int *)(*param_1 + 0x1c) == 0)) {

    uVar7 = 0x100e0;

    param_1[6] = 0;

  }

  else {

    uVar7 = 0x100b0;

  }

  if (param_2 != 0) {

    uVar7 = uVar7 | 2;

  }

  local_4c = (int *)0x0;

  if (DAT_00820230 == 0) {

    if (param_1[3] == 0) {

      return 0;

    }

    iVar6 = FUN_005df0f5(0x68);

    if (iVar6 == 0) {

      return 0;

    }

    piVar5 = (int *)FUN_005545e0();

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

      return 0;

    }

    FUN_00401340(param_1[3]);

    iVar6 = FUN_005546e0(&param_2);

    FUN_004011b0();

    if (iVar6 == 0) {

      (**(code **)*piVar5)(1);

      return 0;

    }

    iVar6 = FUN_00554590();

    if (iVar6 == 0) {

      (**(code **)*piVar5)(1);

      return 0;

    }

  }

  else {

    if (param_1[7] == DAT_00870734) {

      return 0;

    }

    uVar4 = FUN_004220b0(param_1[7],0xf);

    local_4c = (int *)FUN_00415430(uVar4);

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

      return 0;

    }

    piVar5 = local_4c + 0xe;

  }

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

    return 0;

  }

  puVar8 = local_24;

  for (iVar6 = 9; iVar6 != 0; iVar6 = iVar6 + -1) {

    *puVar8 = 0;

    puVar8 = puVar8 + 1;

  }

  local_24[0] = 0x24;

  local_14 = (short *)piVar5[1];

  sVar1 = *local_14;

  local_24[1] = uVar7;

  if (sVar1 == 1) {

    local_24[2] = piVar5[0x17];

LAB_00553725:

    iVar6 = (**(code **)(*piVar2 + 0xc))(piVar2,local_24,param_1 + 1,0);

    if (iVar6 == 0) {

      param_1[5] = local_24[2];

      iVar6 = FUN_005532f0(piVar5);

      if (iVar6 != 0) {

        local_48 = 1;

      }

    }

  }

  else {

    local_38[0] = 1;

    local_38[1] = 1;

    local_14 = local_38;

    local_38[7] = 0x10;

    local_38[2] = 0x2b11;

    local_38[3] = 0;

    local_38[6] = 2;

    local_38[4] = 0x5622;

    local_38[5] = 0;

    local_38[8] = 0;

    iVar6 = acmStreamOpen(&DAT_008706fc,0,piVar5[1],local_38,0,0,0,4);

    if (iVar6 != 0) goto LAB_0055378f;

    iVar6 = acmStreamSize(DAT_008706fc,piVar5[0x17],&param_2,0);

    if (iVar6 == 0) {

      local_24[2] = param_2;

      goto LAB_00553725;

    }

  }

  if (sVar1 != 1) {

    acmStreamClose(DAT_008706fc,0);

    DAT_008706fc = 0;

  }

  if (((param_1[6] != 0) && (puVar3 = (undefined4 *)param_1[1], puVar3 != (undefined4 *)0x0)) &&

     (iVar6 = (**(code **)*puVar3)(puVar3,&DAT_007fe7e0,param_1 + 2), iVar6 != 0)) {

    param_1[6] = 0;

  }

LAB_0055378f:

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

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

  }

  return local_48;

}





// --- FUN_005537b0 at 0x005537B0 (size: 368) ---


undefined4 __fastcall FUN_005537b0(int param_1)



{

  short sVar1;

  int iVar2;

  int *piVar3;

  int *piVar4;

  undefined4 unaff_EDI;

  undefined4 uStack_1c;

  undefined4 local_18 [6];

  

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

  local_18[0] = 0;

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

    return 0;

  }

  iVar2 = (**(code **)(*piVar4 + 0x50))(piVar4);

  if (iVar2 == 0) {

    piVar4 = (int *)0x0;

    if (DAT_00820230 == 0) {

      if (*(int *)(param_1 + 0xc) == 0) {

        return uStack_1c;

      }

      iVar2 = FUN_005df0f5(0x68);

      if (iVar2 == 0) {

        return uStack_1c;

      }

      piVar3 = (int *)FUN_005545e0();

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

        return uStack_1c;

      }

      FUN_00401340(*(undefined4 *)(param_1 + 0xc));

      FUN_005546e0(&stack0xffffffe0);

      FUN_004011b0();

      iVar2 = FUN_00554590();

      if (iVar2 == 0) {

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

        return unaff_EDI;

      }

    }

    else {

      if (*(int *)(param_1 + 0x1c) == DAT_00870734) {

        return uStack_1c;

      }

      piVar4 = (int *)FUN_005534a0(*(int *)(param_1 + 0x1c));

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

        return uStack_1c;

      }

      piVar3 = piVar4 + 0xe;

    }

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

      sVar1 = *(short *)piVar3[1];

      if ((sVar1 == 1) ||

         ((iVar2 = (**(code **)(**(int **)(param_1 + 4) + 0x14))

                             (*(int **)(param_1 + 4),local_18,0x12,&stack0xffffffe0), iVar2 == 0 &&

          (iVar2 = acmStreamOpen(&DAT_008706fc,0,piVar3[1],local_18,0,0,0,0), iVar2 == 0)))) {

        iVar2 = FUN_005532f0(piVar3);

        if (iVar2 != 0) {

          uStack_1c = 1;

        }

        if (sVar1 != 1) {

          acmStreamClose(DAT_008706fc,0);

          DAT_008706fc = 0;

        }

      }

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

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

      }

    }

  }

  return uStack_1c;

}





// --- FUN_00553920 at 0x00553920 (size: 69) ---


int * __thiscall FUN_00553920(int *param_1,int param_2,int param_3,undefined4 param_4,int param_5)



{

  int iVar1;

  

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[5] = 0;

  param_1[4] = param_3;

  param_1[6] = param_5;

  param_1[7] = param_2;

  iVar1 = FUN_00553a50();

  *param_1 = iVar1;

  if (iVar1 != 0) {

    FUN_00553550(param_4);

  }

  return param_1;

}





// --- FUN_00553970 at 0x00553970 (size: 182) ---


undefined4 __thiscall FUN_00553970(int param_1,int param_2,int param_3)



{

  int *piVar1;

  int iVar2;

  undefined4 uVar3;

  

  if (param_2 < -0xf) {

    param_2 = -0xf;

  }

  else if (param_2 < 0x10) {

    if (param_2 == 0) goto LAB_005539ac;

  }

  else {

    param_2 = 0xf;

  }

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

  if ((piVar1 != (int *)0x0) && (*(int *)(param_1 + 0x18) == 0)) {

    (**(code **)(*piVar1 + 0x40))(piVar1,param_2 * 100);

  }

LAB_005539ac:

  if (param_3 < DAT_00820070) {

    param_3 = DAT_00820070;

  }

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

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

    (**(code **)(*piVar1 + 0x3c))(piVar1,param_3 * 100);

  }

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

  uVar3 = 0;

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

    iVar2 = (**(code **)(*piVar1 + 0x34))(piVar1,0);

    if (iVar2 == 0) {

      iVar2 = (**(code **)(**(int **)(param_1 + 4) + 0x30))(*(int **)(param_1 + 4),0,0,0);

      if (iVar2 == -0x7787ff6a) {

        iVar2 = FUN_005537b0();

        if (iVar2 == 0) {

          return 0;

        }

        iVar2 = (**(code **)(**(int **)(param_1 + 4) + 0x30))(*(int **)(param_1 + 4),0,0,0);

      }

      if (iVar2 == 0) {

        uVar3 = 1;

      }

    }

    return uVar3;

  }

  return 0;

}





// --- FUN_00553a30 at 0x00553A30 (size: 28) ---


undefined4 FUN_00553a30(void)



{

  int iVar1;

  

  if (DAT_00870758 != 0) {

    iVar1 = FUN_00554920();

    if (iVar1 != 0) {

      return 1;

    }

  }

  return 0;

}





// --- FUN_00553a50 at 0x00553A50 (size: 6) ---


undefined4 FUN_00553a50(void)



{

  return DAT_00870758;

}





// --- FUN_00553a60 at 0x00553A60 (size: 39) ---


void FUN_00553a60(void)



{

  void *pvVar1;

  

  pvVar1 = DAT_00870758;

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

    FUN_00554a60();

    operator_delete(pvVar1);

    DAT_00870758 = (void *)0x0;

  }

  return;

}





// --- FUN_00553a90 at 0x00553A90 (size: 232) ---


undefined4 FUN_00553a90(int param_1)



{

  void *pvVar1;

  LONG LVar2;

  int iVar3;

  int iVar4;

  undefined4 *puVar5;

  int local_4;

  

  iVar4 = param_1;

  pvVar1 = DAT_00870758;

  if (param_1 == 0) {

    FUN_00401340("SoundSetup Error");

    FUN_00401340("SoundSetup requires a valid HWND!  Sound will be disabled.");

    FUN_00439590(&param_1,&local_4,0,0);

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

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

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

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

    }

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

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

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

    }

  }

  else {

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

      FUN_00554a60();

      operator_delete(pvVar1);

      DAT_00870758 = (void *)0x0;

    }

    iVar3 = FUN_005df0f5(0x24);

    if (iVar3 == 0) {

      DAT_00870758 = (void *)0x0;

      return 0;

    }

    DAT_00870758 = (void *)FUN_00554930(iVar4);

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

      iVar4 = FUN_00554920();

      if (iVar4 != 0) {

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_00553b80 at 0x00553B80 (size: 77) ---


bool FUN_00553b80(uint param_1,int param_2)



{

  HMIDIOUT hmo;

  MMRESULT MVar1;

  

  hmo = DAT_00870a70;

  if (DAT_00870a70 == (HMIDIOUT)0x0) {

    return false;

  }

  (&DAT_008709b8)[param_1] = param_2;

  MVar1 = midiOutShortMsg(hmo,(uint)((&DAT_008709f8)[param_1] * param_2) / 100 << 0x10 | param_1 |

                              0x7b0);

  return MVar1 == 0;

}





// --- FUN_00553bd0 at 0x00553BD0 (size: 116) ---


void FUN_00553bd0(void)



{

  LPMIDIHDR pmh;

  uint uVar1;

  int iVar2;

  

  if (DAT_00870a74 != 0) {

    if (DAT_00870a60 != 0) {

      pmh = (LPMIDIHDR)&DAT_008707c0;

      iVar2 = 6;

      do {

        midiOutUnprepareHeader(DAT_00870a70,pmh,0x40);

        pmh = (LPMIDIHDR)&pmh[1].lpNext;

        iVar2 = iVar2 + -1;

        DAT_00870a60 = 0;

      } while (iVar2 != 0);

    }

    uVar1 = 0;

    do {

      if (*(int *)((int)&DAT_008707c0 + uVar1) != 0) {

        LocalFree(*(HLOCAL *)(*(int *)((int)&DAT_008707c0 + uVar1) + -4));

        *(undefined4 *)((int)&DAT_008707c0 + uVar1) = 0;

      }

      uVar1 = uVar1 + 0x54;

    } while (uVar1 < 0x1f8);

    DAT_00870a74 = 0;

  }

  return;

}





// --- FUN_00553c50 at 0x00553C50 (size: 59) ---


undefined4 FUN_00553c50(undefined4 param_1)



{

  bool bVar1;

  MMRESULT MVar2;

  HLOCAL pvVar3;

  int iVar4;

  uint uVar5;

  undefined4 uVar6;

  int iVar7;

  uint uVar8;

  int *piVar9;

  BYTE aBStack_8 [4];

  undefined4 uStack_4;

  

  bVar1 = false;

  if ((DAT_00870a70 == (HMIDISTRM)0x0) &&

     (MVar2 = midiStreamOpen(&DAT_00870a70,(LPUINT)&DAT_00820294,1,0x554120,0,0x30000), MVar2 != 0))

  {

    return 0;

  }

  iVar7 = 0;

  uVar8 = 0;

  do {

    *(undefined4 *)((int)&DAT_008707c4 + uVar8) = 0x400;

    pvVar3 = LocalAlloc(0x40,0x423);

    if (pvVar3 == (HLOCAL)0x0) {

      uVar5 = 0;

    }

    else {

      uVar5 = (int)pvVar3 + 0x23U & 0xffffffe0;

      *(HLOCAL *)(uVar5 - 4) = pvVar3;

    }

    *(uint *)((int)&DAT_008707c0 + uVar8) = uVar5;

    if (uVar5 == 0) {

      if (iVar7 == 0) {

        return 0;

      }

      piVar9 = &DAT_008707c0;

      do {

        if (*piVar9 != 0) {

          LocalFree(*(HLOCAL *)(*piVar9 + -4));

          *piVar9 = 0;

        }

        piVar9 = piVar9 + 0x15;

        iVar7 = iVar7 + -1;

      } while (iVar7 != 0);

      return 0;

    }

    uVar8 = uVar8 + 0x54;

    iVar7 = iVar7 + 1;

  } while (uVar8 < 0x1f8);

  DAT_00870a74 = 1;

  iVar7 = FUN_00555150(param_1);

  if (iVar7 != 0) {

    return 0;

  }

  aBStack_8[0] = '\b';

  aBStack_8[1] = '\0';

  aBStack_8[2] = '\0';

  aBStack_8[3] = '\0';

  uStack_4 = DAT_00870a98;

  MVar2 = midiStreamProperty(DAT_00870a70,aBStack_8,0x80000001);

  if (MVar2 == 0) {

    DAT_00870a48 = 6;

    DAT_00870a4c = 0;

    uVar6 = 1;

    do {

      iVar7 = DAT_00870a4c;

      (&DAT_00870800)[DAT_00870a4c * 0x15] = 0;

      (&DAT_00870804)[iVar7 * 0x15] = 0x400;

      (&DAT_0087080c)[iVar7 * 0x15] = 0;

      (&DAT_00870810)[iVar7 * 0x15] = 0;

      iVar4 = FUN_00555560(uVar6,&DAT_008707c0 + iVar7 * 0x15);

      iVar7 = DAT_00870a4c;

      if (iVar4 != 0) {

        if (iVar4 != -0x67) break;

        bVar1 = true;

      }

      (&DAT_008707c8)[DAT_00870a4c * 0x15] = (&DAT_00870808)[DAT_00870a4c * 0x15];

      if ((DAT_00870a60 == 0) &&

         (MVar2 = midiOutPrepareHeader

                            ((HMIDIOUT)DAT_00870a70,(LPMIDIHDR)(&DAT_008707c0 + iVar7 * 0x15),0x40),

         iVar7 = DAT_00870a4c, MVar2 != 0)) break;

      MVar2 = midiStreamOut(DAT_00870a70,(LPMIDIHDR)(&DAT_008707c0 + iVar7 * 0x15),0x40);

      if (MVar2 != 0) {

        DAT_00870a60 = 1;

        DAT_00870a4c = 0;

        return 1;

      }

      DAT_00870a48 = DAT_00870a48 + -1;

      uVar6 = 0;

      if (bVar1) {

        DAT_00870a4c = 0;

        DAT_00870a60 = 1;

        return 1;

      }

      DAT_00870a4c = DAT_00870a4c + 1;

      if (5 < DAT_00870a4c) {

        DAT_00870a4c = 0;

        DAT_00870a60 = 1;

        return 1;

      }

    } while( true );

  }

  FUN_00554af0();

  return 0;

}





// --- FUN_00553c8b at 0x00553C8B (size: 459) ---


undefined4

FUN_00553c8b(HLOCAL param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

            undefined4 param_5)



{

  HLOCAL pvVar1;

  int iVar2;

  MMRESULT MVar3;

  HLOCAL pvVar4;

  undefined4 uVar5;

  HLOCAL pvVar6;

  HLOCAL unaff_EBP;

  uint uVar7;

  int *piVar8;

  

  pvVar6 = (HLOCAL)0x0;

  uVar7 = 0;

  do {

    *(undefined4 *)((int)&DAT_008707c4 + uVar7) = 0x400;

    pvVar1 = LocalAlloc(0x40,0x423);

    if (pvVar1 == unaff_EBP) {

      pvVar4 = (HLOCAL)0x0;

    }

    else {

      pvVar4 = (HLOCAL)((int)pvVar1 + 0x23U & 0xffffffe0);

      *(HLOCAL *)((int)pvVar4 + -4) = pvVar1;

    }

    *(HLOCAL *)((int)&DAT_008707c0 + uVar7) = pvVar4;

    if (pvVar4 == unaff_EBP) {

      if (pvVar6 <= unaff_EBP) {

        return 0;

      }

      piVar8 = &DAT_008707c0;

      do {

        if ((HLOCAL)*piVar8 != unaff_EBP) {

          LocalFree(*(HLOCAL *)(*piVar8 + -4));

          *piVar8 = (int)unaff_EBP;

        }

        piVar8 = piVar8 + 0x15;

        pvVar6 = (HLOCAL)((int)pvVar6 + -1);

      } while (pvVar6 != (HLOCAL)0x0);

      return 0;

    }

    uVar7 = uVar7 + 0x54;

    pvVar6 = (HLOCAL)((int)pvVar6 + 1);

  } while (uVar7 < 0x1f8);

  DAT_00870a74 = 1;

  iVar2 = FUN_00555150(param_5);

  if (iVar2 != 0) {

    return 0;

  }

  param_2 = 8;

  param_3 = DAT_00870a98;

  MVar3 = midiStreamProperty(DAT_00870a70,(LPBYTE)&param_2,0x80000001);

  if (MVar3 == 0) {

    DAT_00870a48 = 6;

    DAT_00870a4c = (HLOCAL)0x0;

    uVar5 = 1;

    do {

      iVar2 = (int)DAT_00870a4c;

      (&DAT_00870800)[(int)DAT_00870a4c * 0x15] = unaff_EBP;

      (&DAT_00870804)[iVar2 * 0x15] = 0x400;

      (&DAT_0087080c)[iVar2 * 0x15] = unaff_EBP;

      (&DAT_00870810)[iVar2 * 0x15] = unaff_EBP;

      pvVar6 = (HLOCAL)FUN_00555560(uVar5,&DAT_008707c0 + iVar2 * 0x15);

      iVar2 = (int)DAT_00870a4c;

      if (pvVar6 != unaff_EBP) {

        if (pvVar6 != (HLOCAL)0xffffff99) break;

        param_1 = (HLOCAL)0x1;

      }

      (&DAT_008707c8)[(int)DAT_00870a4c * 0x15] = (&DAT_00870808)[(int)DAT_00870a4c * 0x15];

      if ((DAT_00870a60 == unaff_EBP) &&

         (MVar3 = midiOutPrepareHeader

                            ((HMIDIOUT)DAT_00870a70,(LPMIDIHDR)(&DAT_008707c0 + iVar2 * 0x15),0x40),

         iVar2 = (int)DAT_00870a4c, MVar3 != 0)) break;

      MVar3 = midiStreamOut(DAT_00870a70,(LPMIDIHDR)(&DAT_008707c0 + iVar2 * 0x15),0x40);

      if (MVar3 != 0) {

        DAT_00870a60 = (HLOCAL)0x1;

        DAT_00870a4c = unaff_EBP;

        return 1;

      }

      DAT_00870a48 = DAT_00870a48 + -1;

      uVar5 = 0;

      if (param_1 != unaff_EBP) {

        DAT_00870a4c = unaff_EBP;

        DAT_00870a60 = (HLOCAL)0x1;

        return 1;

      }

      DAT_00870a4c = (HLOCAL)((int)DAT_00870a4c + 1);

      if (5 < (int)DAT_00870a4c) {

        DAT_00870a4c = unaff_EBP;

        DAT_00870a60 = (HLOCAL)0x1;

        return 1;

      }

    } while( true );

  }

  FUN_00554af0();

  return 0;

}





// --- FUN_00553e60 at 0x00553E60 (size: 265) ---


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



void FUN_00553e60(void)



{

  MMRESULT MVar1;

  DWORD DVar2;

  

  if (DAT_00870a70 == (HMIDISTRM)0x0) {

    return;

  }

  if ((DAT_00870a5c == 0) && (DAT_00870a58 == 0)) {

    if (DAT_00870a54 == 200) goto LAB_00553ecd;

LAB_00553e9b:

    if (DAT_00870a54 != 300) {

      DAT_00870a54 = 100;

    }

  }

  else if (DAT_00870a54 != 200) goto LAB_00553e9b;

  MVar1 = midiStreamStop(DAT_00870a70);

  if (MVar1 != 0) {

    return;

  }

  _DAT_00870a64 = 0;

  DAT_00870a5c = 0;

LAB_00553ecd:

  MVar1 = midiOutReset((HMIDIOUT)DAT_00870a70);

  if ((MVar1 == 0) &&

     ((DVar2 = WaitForSingleObject(DAT_00870a8c,2000), DVar2 == 0x102 || (DAT_00870a54 == 200)))) {

    DAT_00870a54 = 0;

    if (DAT_00870a58 != 0) {

      FUN_00554af0();

      DAT_00870a58 = 0;

    }

    FUN_00553bd0();

    if (DAT_00870a70 != (HMIDISTRM)0x0) {

      midiStreamClose(DAT_00870a70);

      DAT_00870a70 = (HMIDISTRM)0x0;

      midiStreamOpen(&DAT_00870a70,(LPUINT)&DAT_00820294,1,0x554120,0,0x30000);

    }

    DAT_00870a7c = 0;

    DAT_00870a78 = 0;

    DAT_00820298 = 100;

  }

  return;

}





// --- FUN_00553f70 at 0x00553F70 (size: 60) ---


void FUN_00553f70(void)



{

  FUN_00553e60();

  if (DAT_00870a70 != (HMIDISTRM)0x0) {

    midiStreamClose(DAT_00870a70);

    DAT_00870a70 = (HMIDISTRM)0x0;

  }

  if (DAT_00870a8c != (HANDLE)0x0) {

    CloseHandle(DAT_00870a8c);

    DAT_00870a8c = (HANDLE)0x0;

  }

  DAT_00870a88 = 0;

  return;

}





// --- FUN_00553fb0 at 0x00553FB0 (size: 289) ---


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



undefined4 FUN_00553fb0(LPCSTR param_1,undefined4 param_2,int param_3,undefined4 param_4)



{

  int iVar1;

  MMRESULT MVar2;

  

  DAT_00870a40 = param_4;

  _DAT_00870a6c = 1;

  if ((DAT_00870a5c != 0) || (DAT_00870a58 != 0)) {

    if (param_3 == 0) {

      lstrcpyA(&DAT_00870770,param_1);

      DAT_00820298 = param_4;

      DAT_00870a7c = 1;

      DAT_00870a78 = param_2;

      return 1;

    }

    FUN_00553e60();

  }

  iVar1 = FUN_00553c50(param_1);

  if (iVar1 != 0) {

    iVar1 = 0;

    do {

      MVar2 = midiOutShortMsg(DAT_00870a70,

                              (uint)((&DAT_008709b8)[iVar1] * (&DAT_008709f8)[iVar1]) / 100 << 0x10

                              | iVar1 + 0xb0U | 0x700);

      if (MVar2 != 0) {

        return 0;

      }

      iVar1 = iVar1 + 1;

    } while (iVar1 < 0x10);

    DAT_00870a58 = 1;

    DAT_00870a54 = MVar2;

    if (DAT_00870a84 != (code *)0x0) {

      (*DAT_00870a84)();

    }

    MVar2 = midiStreamRestart((HMIDISTRM)DAT_00870a70);

    if (MVar2 == 0) {

      DAT_00870a5c = 1;

      DAT_00870a68 = param_2;

      DAT_00870a7c = 0;

      DAT_00870a78 = 0;

      DAT_00820298 = 100;

      return 1;

    }

  }

  return 0;

}





// --- FUN_005540e0 at 0x005540E0 (size: 51) ---


undefined4 FUN_005540e0(void)



{

  undefined4 uVar1;

  

  if (DAT_00870a7c != 0) {

    DAT_00870a7c = 0;

    uVar1 = FUN_00553fb0(&DAT_00870770,DAT_00870a78,1,DAT_00820298);

    return uVar1;

  }

  return 0;

}





// --- FUN_00554390 at 0x00554390 (size: 204) ---


undefined4 FUN_00554390(void)



{

  UINT UVar1;

  MMRESULT MVar2;

  int iVar3;

  undefined4 *puVar4;

  

  if (DAT_00870a88 != 0) {

    FUN_00553e60();

    if (DAT_00870a70 != (HMIDISTRM)0x0) {

      midiStreamClose(DAT_00870a70);

      DAT_00870a70 = (HMIDISTRM)0x0;

    }

    if (DAT_00870a8c != (HANDLE)0x0) {

      CloseHandle(DAT_00870a8c);

      DAT_00870a8c = (HANDLE)0x0;

    }

  }

  DAT_00870a88 = 0;

  DAT_00870a7c = 0;

  UVar1 = midiOutGetNumDevs();

  if (UVar1 != 0) {

    puVar4 = &DAT_008709f8;

    for (iVar3 = 0x10; iVar3 != 0; iVar3 = iVar3 + -1) {

      *puVar4 = 100;

      puVar4 = puVar4 + 1;

    }

    puVar4 = &DAT_008709b8;

    for (iVar3 = 0x10; iVar3 != 0; iVar3 = iVar3 + -1) {

      *puVar4 = 100;

      puVar4 = puVar4 + 1;

    }

    DAT_00870a40 = 100;

    if ((DAT_00870a8c == (HANDLE)0x0) &&

       (DAT_00870a8c = CreateEventA((LPSECURITY_ATTRIBUTES)0x0,0,0,"Wait For Buffer Return"),

       DAT_00870a8c == (HANDLE)0x0)) {

      return 0;

    }

    MVar2 = midiStreamOpen(&DAT_00870a70,(LPUINT)&DAT_00820294,1,0x554120,0,0x30000);

    if (MVar2 == 0) {

      DAT_00870a88 = 1;

      return 1;

    }

  }

  return 0;

}





// --- FUN_00554460 at 0x00554460 (size: 86) ---


undefined4 __fastcall FUN_00554460(int param_1)



{

  LONG LVar1;

  MMRESULT MVar2;

  

  LVar1 = mmioSeek(*(HMMIO *)(param_1 + 0xc),*(int *)(param_1 + 0x20) + 4,0);

  if (LVar1 == -1) {

    *(undefined4 *)(param_1 + 0x10) = 0x107;

  }

  else {

    ((LPMMCKINFO)(param_1 + 0x3c))->ckid = 0x61746164;

    MVar2 = mmioDescend(*(HMMIO *)(param_1 + 0xc),(LPMMCKINFO)(param_1 + 0x3c),

                        (MMCKINFO *)(param_1 + 0x14),0x10);

    *(MMRESULT *)(param_1 + 0x10) = MVar2;

    if (MVar2 == 0) {

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

      return 1;

    }

  }

  return 0;

}





// --- FUN_005544c0 at 0x005544C0 (size: 199) ---


uint __thiscall FUN_005544c0(int param_1,int param_2,uint param_3)



{

  char cVar1;

  uint uVar2;

  MMRESULT MVar3;

  HPSTR pcVar4;

  uint uVar5;

  _MMIOINFO local_48;

  

  MVar3 = mmioGetInfo(*(HMMIO *)(param_1 + 0xc),&local_48,0);

  *(MMRESULT *)(param_1 + 0x10) = MVar3;

  if (MVar3 == 0) {

    uVar2 = *(uint *)(param_1 + 0x40);

    if (uVar2 < param_3) {

      param_3 = uVar2;

    }

    uVar5 = 0;

    *(uint *)(param_1 + 0x40) = uVar2 - param_3;

    pcVar4 = local_48.pchEndRead;

    if (param_3 != 0) {

      do {

        if (local_48.pchNext == pcVar4) {

          MVar3 = mmioAdvance(*(HMMIO *)(param_1 + 0xc),&local_48,0);

          *(MMRESULT *)(param_1 + 0x10) = MVar3;

          if (MVar3 != 0) {

            return 0;

          }

          pcVar4 = local_48.pchEndRead;

          if (local_48.pchNext == local_48.pchEndRead) {

            *(undefined4 *)(param_1 + 0x10) = 0x105;

            return 0;

          }

        }

        cVar1 = *local_48.pchNext;

        local_48.pchNext = local_48.pchNext + 1;

        *(char *)(uVar5 + param_2) = cVar1;

        uVar5 = uVar5 + 1;

      } while (uVar5 < param_3);

    }

    MVar3 = mmioSetInfo(*(HMMIO *)(param_1 + 0xc),&local_48,0);

    *(MMRESULT *)(param_1 + 0x10) = MVar3;

    if (MVar3 == 0) {

      *(uint *)(param_1 + 100) = *(int *)(param_1 + 100) + param_3;

      return param_3;

    }

  }

  return 0;

}





// --- FUN_00554590 at 0x00554590 (size: 80) ---


int __fastcall FUN_00554590(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

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

    if (*(void **)(param_1 + 8) != (void *)0x0) {

      operator_delete__(*(void **)(param_1 + 8));

    }

    iVar2 = thunk_FUN_005df0f5(*(undefined4 *)(param_1 + 0x5c));

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

    iVar3 = 0;

    if (iVar2 != 0) {

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

      iVar2 = FUN_005544c0(iVar2,iVar1);

      if (iVar2 == iVar1) {

        iVar3 = iVar1;

      }

    }

    return iVar3;

  }

  return 0;

}





// --- FUN_005545e0 at 0x005545E0 (size: 89) ---


void __fastcall FUN_005545e0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007cc0d8;

  param_1[2] = 0;

  param_1[1] = 0;

  param_1[3] = 0;

  param_1[0x15] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x14] = 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[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  return;

}





// --- FUN_00554640 at 0x00554640 (size: 149) ---


void __fastcall FUN_00554640(int param_1)



{

  if (*(HMMIO *)(param_1 + 0xc) != (HMMIO)0x0) {

    mmioClose(*(HMMIO *)(param_1 + 0xc),0);

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

  }

  if (*(void **)(param_1 + 8) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 8));

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

  }

  if (*(void **)(param_1 + 4) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 4));

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

  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  return;

}





// --- FUN_005546e0 at 0x005546E0 (size: 501) ---


undefined4 __thiscall FUN_005546e0(int param_1,int *param_2)



{

  LPMMCKINFO pmmcki;

  LPMMCKINFO pmmcki_00;

  char *_Dest;

  HMMIO pHVar1;

  MMRESULT MVar2;

  LONG LVar3;

  int iVar4;

  undefined4 *puVar5;

  uint uVar6;

  uint local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_14 = 0;

  _Dest = (char *)thunk_FUN_005df0f5(*(undefined4 *)(*param_2 + -4));

  strncpy(_Dest,(char *)*param_2,*(size_t *)((char *)*param_2 + -4));

  pHVar1 = mmioOpenA(_Dest,(LPMMIOINFO)0x0,0x10000);

  *(HMMIO *)(param_1 + 0xc) = pHVar1;

  operator_delete__(_Dest);

  if (*(HMMIO *)(param_1 + 0xc) == (HMMIO)0x0) {

    *(undefined4 *)(param_1 + 0x10) = 0x103;

    return 0;

  }

  pmmcki = (LPMMCKINFO)(param_1 + 0x14);

  MVar2 = mmioDescend(*(HMMIO *)(param_1 + 0xc),pmmcki,(MMCKINFO *)0x0,0);

  *(MMRESULT *)(param_1 + 0x10) = MVar2;

  if (MVar2 == 0) {

    if ((pmmcki->ckid == 0x46464952) && (*(int *)(param_1 + 0x1c) == 0x45564157)) {

      pHVar1 = *(HMMIO *)(param_1 + 0xc);

      pmmcki_00 = (LPMMCKINFO)(param_1 + 0x28);

      pmmcki_00->ckid = 0x20746d66;

      MVar2 = mmioDescend(pHVar1,pmmcki_00,pmmcki,0x10);

      *(MMRESULT *)(param_1 + 0x10) = MVar2;

      if (MVar2 == 0) {

        LVar3 = mmioRead(*(HMMIO *)(param_1 + 0xc),(HPSTR)&local_10,0x10);

        if ((LVar3 != 0x10) ||

           (((short)local_10 != 1 &&

            (LVar3 = mmioRead(*(HMMIO *)(param_1 + 0xc),(HPSTR)&local_14,2), LVar3 != 2)))) {

LAB_00554839:

          *(undefined4 *)(param_1 + 0x10) = 0x105;

          FUN_00554640();

          return 0;

        }

        iVar4 = (local_14 & 0xffff) + 0x12;

        *(int *)(param_1 + 0x60) = iVar4;

        puVar5 = (undefined4 *)thunk_FUN_005df0f5(iVar4);

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

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

          *(undefined4 *)(param_1 + 0x10) = 0x102;

          FUN_00554640();

          return 0;

        }

        *puVar5 = local_10;

        puVar5[1] = local_c;

        puVar5[2] = local_8;

        puVar5[3] = local_4;

        *(short *)(*(int *)(param_1 + 4) + 0x10) = (short)local_14;

        if ((short)local_14 != 0) {

          uVar6 = mmioRead(*(HMMIO *)(param_1 + 0xc),(HPSTR)(*(int *)(param_1 + 4) + 0x12),

                           local_14 & 0xffff);

          *(uint *)(param_1 + 0x10) = uVar6;

          if (uVar6 != (local_14 & 0xffff)) goto LAB_00554839;

        }

        *(uint *)(param_1 + 0x54) = (uint)*(ushort *)(*(int *)(param_1 + 4) + 0xc);

        *(undefined4 *)(param_1 + 0x58) = *(undefined4 *)(*(int *)(param_1 + 4) + 8);

        MVar2 = mmioAscend(*(HMMIO *)(param_1 + 0xc),pmmcki_00,0);

        *(MMRESULT *)(param_1 + 0x10) = MVar2;

        if (MVar2 == 0) {

          FUN_00554460();

          *(int *)(param_1 + 0x5c) = *(int *)(param_1 + 0x40);

          *(uint *)(param_1 + 0x50) =

               (uint)(*(int *)(param_1 + 0x40) * 1000) / *(uint *)(param_1 + 0x58);

          return 1;

        }

      }

    }

    else {

      *(undefined4 *)(param_1 + 0x10) = 0x110;

    }

  }

  FUN_00554640();

  return 0;

}





// --- FUN_005548e0 at 0x005548E0 (size: 11) ---


void __fastcall FUN_005548e0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007cc0d8;

  FUN_00554640();

  return;

}





// --- FUN_005548f0 at 0x005548F0 (size: 36) ---


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



{

  *param_1 = &PTR_FUN_007cc0d8;

  FUN_00554640();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00554920 at 0x00554920 (size: 11) ---


bool __fastcall FUN_00554920(int param_1)



{

  return *(int *)(param_1 + 0x18) != 0;

}





// --- FUN_00554930 at 0x00554930 (size: 299) ---


undefined2 * __thiscall FUN_00554930(undefined2 *param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  int iVar3;

  undefined4 *puVar4;

  

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

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

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

  *(undefined4 *)(param_1 + 10) = param_2;

  *puVar4 = 0;

  *puVar1 = 0;

  *puVar2 = 0;

  iVar3 = DirectSoundCreate(0,puVar4,0);

  if (iVar3 == 0) {

    iVar3 = (**(code **)(*(int *)*puVar4 + 0x18))((int *)*puVar4,*(undefined4 *)(param_1 + 10),2);

    if (iVar3 != 0) {

      *puVar4 = 0;

      return param_1;

    }

    puVar4 = (undefined4 *)&stack0xffffffd0;

    for (iVar3 = 9; iVar3 != 0; iVar3 = iVar3 + -1) {

      *puVar4 = 0;

      puVar4 = puVar4 + 1;

    }

    iVar3 = (**(code **)(**(int **)(param_1 + 0xc) + 0xc))

                      (*(int **)(param_1 + 0xc),&stack0xffffffd0,puVar2,0);

    if (iVar3 == 0) {

      iVar3 = (*(code *)**(undefined4 **)*puVar2)((undefined4 *)*puVar2,&DAT_007fe7f0,puVar1);

      if (iVar3 == 0) {

        (**(code **)(*(int *)*puVar1 + 0x3c))((int *)*puVar1,0x3c23d70a,1);

        (**(code **)(*(int *)*puVar1 + 0x34))((int *)*puVar1,0xbf800000,0,0,0,0x3f800000,0,1);

        (**(code **)(*(int *)*puVar1 + 0x44))((int *)*puVar1);

        *param_1 = 1;

        param_1[1] = 2;

        param_1[7] = 0x10;

        *(undefined4 *)(param_1 + 2) = 0x2b11;

        param_1[6] = 4;

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

        param_1[8] = 0;

        (**(code **)(*(int *)*puVar2 + 0x38))((int *)*puVar2,param_1);

        (**(code **)(*(int *)*puVar2 + 0x30))((int *)*puVar2,0,0,1);

      }

    }

  }

  return param_1;

}





// --- FUN_00554a60 at 0x00554A60 (size: 65) ---


void __fastcall FUN_00554a60(int param_1)



{

  int *piVar1;

  

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

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

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

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

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

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

  return;

}





// --- FUN_00554ab0 at 0x00554AB0 (size: 55) ---


undefined4 FUN_00554ab0(LPVOID param_1,DWORD param_2)



{

  BOOL BVar1;

  DWORD local_4;

  

  BVar1 = ReadFile(DAT_008202a0,param_1,param_2,&local_4,(LPOVERLAPPED)0x0);

  if ((BVar1 != 0) && (local_4 == param_2)) {

    return 0;

  }

  return 1;

}





// --- FUN_00554af0 at 0x00554AF0 (size: 108) ---


void FUN_00554af0(void)



{

  HLOCAL hMem;

  HLOCAL hMem_00;

  int iVar1;

  uint uVar2;

  

  if (DAT_008202a0 != (HANDLE)0xffffffff) {

    CloseHandle(DAT_008202a0);

    DAT_008202a0 = (HANDLE)0xffffffff;

  }

  if (DAT_00870aa4 != (HLOCAL)0x0) {

    uVar2 = 0;

    hMem_00 = DAT_00870aa4;

    if (DAT_00870aa0 != 0) {

      iVar1 = 0;

      do {

        hMem = *(HLOCAL *)(iVar1 + 0xc + (int)hMem_00);

        if (hMem != (HLOCAL)0x0) {

          LocalFree(hMem);

          hMem_00 = DAT_00870aa4;

        }

        uVar2 = uVar2 + 1;

        iVar1 = iVar1 + 0x28;

      } while (uVar2 < DAT_00870aa0);

    }

    LocalFree(hMem_00);

    DAT_00870aa4 = (HLOCAL)0x0;

  }

  return;

}





// --- FUN_00554b60 at 0x00554B60 (size: 145) ---


undefined4 FUN_00554b60(DWORD param_1)



{

  HANDLE hFile;

  DWORD DVar1;

  DWORD DVar2;

  BOOL BVar3;

  

  DVar1 = param_1;

  hFile = DAT_008202a0;

  if ((param_1 != 0) && (*(int *)(param_1 + 0x24) != 0)) {

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

    DVar2 = SetFilePointer(hFile,*(LONG *)(param_1 + 0x20),(PLONG)0x0,0);

    if (DVar2 != 0xffffffff) {

      if (*(uint *)(DVar1 + 0x24) < 0x401) {

        *(uint *)(DVar1 + 8) = *(uint *)(DVar1 + 0x24);

      }

      else {

        *(undefined4 *)(DVar1 + 8) = 0x400;

      }

      BVar3 = ReadFile(DAT_008202a0,*(LPVOID *)(DVar1 + 0xc),*(DWORD *)(DVar1 + 8),&param_1,

                       (LPOVERLAPPED)0x0);

      *(DWORD *)(DVar1 + 0x24) = *(int *)(DVar1 + 0x24) - param_1;

      *(DWORD *)(DVar1 + 0x20) = param_1 + DVar2;

      *(DWORD *)(DVar1 + 8) = param_1;

      if ((BVar3 != 0) && (param_1 != 0)) {

        return 0;

      }

      *(DWORD *)(DVar1 + 8) = param_1;

    }

  }

  return 1;

}





// --- FUN_00554c00 at 0x00554C00 (size: 551) ---


undefined4 FUN_00554c00(void)



{

  int iVar1;

  undefined1 *puVar2;

  uint3 uVar3;

  int *piVar4;

  byte bVar5;

  int iVar6;

  int *unaff_ESI;

  int *unaff_EDI;

  

  iVar6 = DAT_00870aa8;

  iVar1 = unaff_EDI[0x12];

  piVar4 = (int *)(unaff_EDI[0x10] + iVar1 + *unaff_EDI);

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

    return 0xffffff9b;

  }

  if (iVar1 == 0) {

    unaff_EDI[0x13] = DAT_00870aa8;

  }

  if (DAT_00870a44 < (uint)(iVar6 - unaff_EDI[0x13])) {

    if (unaff_EDI[0x14] != 0) {

      unaff_EDI[0x14] = 0;

      return 0xffffff98;

    }

    unaff_EDI[0x14] = 1;

  }

  DAT_00870aa8 = *unaff_ESI;

  iVar6 = DAT_00870aa8 - iVar6;

  if (DAT_00870aac != 0) {

    DAT_00870aac = 0;

    if ((uint)(unaff_EDI[0x11] - iVar1) < 0xc) {

      DAT_00870aac = 0;

      return 0xffffff98;

    }

    if (DAT_00870a3c != 0) {

      *piVar4 = 0;

      piVar4[1] = 0;

      piVar4[2] = (DAT_00870a3c * 100) / DAT_00870a40 | 0x1000000;

      unaff_EDI[0x12] = unaff_EDI[0x12] + 0xc;

      piVar4 = piVar4 + 0x30;

    }

  }

  bVar5 = *(byte *)(unaff_ESI + 1);

  if (bVar5 < 0xf0) {

    if ((uint)(unaff_EDI[0x11] - unaff_EDI[0x12]) < 0xc) {

      return 0xffffff98;

    }

    piVar4[1] = 0;

    *piVar4 = iVar6;

    uVar3 = *(uint3 *)(unaff_ESI + 1);

    piVar4[2] = (uint)uVar3;

    bVar5 = *(byte *)(unaff_ESI + 1) & 0xf0;

    if ((((bVar5 == 0xb0) && (*(char *)((int)unaff_ESI + 5) == '\a')) || (bVar5 == 0xc0)) ||

       (bVar5 == 0x90)) {

      piVar4[2] = uVar3 | 0x40000000;

    }

    unaff_EDI[0x12] = unaff_EDI[0x12] + 0xc;

    return 0;

  }

  if ((bVar5 == 0xf0) || (bVar5 == 0xf7)) {

    if (DAT_00870ab0 != 0) {

      free((void *)unaff_ESI[3]);

      DAT_00870ab0 = DAT_00870ab0 + -1;

    }

    return 0;

  }

  if (*(char *)((int)unaff_ESI + 5) != 'Q') {

    if (DAT_00870ab0 != 0) {

      free((void *)unaff_ESI[3]);

      DAT_00870ab0 = DAT_00870ab0 + -1;

    }

    return 0xffffff97;

  }

  if ((uint)(unaff_EDI[0x11] - unaff_EDI[0x12]) < 0xc) {

    if (DAT_00870ab0 != 0) {

      free((void *)unaff_ESI[3]);

      DAT_00870ab0 = DAT_00870ab0 + -1;

    }

    return 0xffffff98;

  }

  piVar4[1] = 0;

  *piVar4 = iVar6;

  puVar2 = (undefined1 *)unaff_ESI[3];

  DAT_00870a3c = (uint)CONCAT21(CONCAT11(*puVar2,puVar2[1]),puVar2[2]);

  piVar4[2] = DAT_00870a3c;

  piVar4[2] = (uint)(piVar4[2] * 100) / DAT_00870a40 | 0x1000000;

  if (DAT_00870a3c != 0) {

    DAT_00870a44 = (uint)(DAT_00870a98 * 60000) / DAT_00870a3c;

  }

  if (DAT_00870ab0 != 0) {

    free((void *)unaff_ESI[3]);

    DAT_00870ab0 = DAT_00870ab0 + -1;

  }

  unaff_EDI[0x12] = unaff_EDI[0x12] + 0xc;

  return 0;

}





// --- FUN_00554e30 at 0x00554E30 (size: 54) ---


undefined4 FUN_00554e30(undefined1 *param_1)



{

  int iVar1;

  int unaff_ESI;

  

  if (*(int *)(unaff_ESI + 8) == 0) {

    iVar1 = FUN_00554b60();

    if (iVar1 != 0) {

      return 1;

    }

  }

  *param_1 = **(undefined1 **)(unaff_ESI + 0x10);

  *(int *)(unaff_ESI + 8) = *(int *)(unaff_ESI + 8) + -1;

  *(int *)(unaff_ESI + 0x10) = *(int *)(unaff_ESI + 0x10) + 1;

  return 0;

}





// --- FUN_00554e70 at 0x00554E70 (size: 91) ---


undefined4 FUN_00554e70(uint *param_1)



{

  byte bVar1;

  int iVar2;

  uint *unaff_ESI;

  uint uVar3;

  

  uVar3 = 0;

  if ((*unaff_ESI & 1) != 0) {

    return 1;

  }

  do {

    if (unaff_ESI[2] == 0) {

      if (unaff_ESI[9] == 0) {

        *unaff_ESI = *unaff_ESI | 1;

        return 1;

      }

      iVar2 = FUN_00554b60();

      if (iVar2 != 0) {

        return 1;

      }

    }

    bVar1 = *(byte *)unaff_ESI[4];

    unaff_ESI[4] = (uint)((byte *)unaff_ESI[4] + 1);

    unaff_ESI[2] = unaff_ESI[2] - 1;

    uVar3 = uVar3 << 7 | bVar1 & 0x7f;

    if (-1 < (char)bVar1) {

      *param_1 = uVar3;

      return 0;

    }

  } while( true );

}





// --- FUN_00554ed0 at 0x00554ED0 (size: 640) ---


undefined4 __fastcall FUN_00554ed0(int param_1)



{

  uint *puVar1;

  byte bVar2;

  uint *in_EAX;

  int iVar3;

  void *pvVar4;

  byte bVar5;

  uint uVar6;

  uint *unaff_EDI;

  int local_4;

  

  *unaff_EDI = 0;

  unaff_EDI[1] = 0;

  unaff_EDI[2] = 0;

  unaff_EDI[3] = 0;

  if ((*in_EAX & 1) != 0) {

    return 1;

  }

  local_4 = param_1;

  if (in_EAX[2] == 0) {

    if (in_EAX[9] == 0) {

      return 1;

    }

    iVar3 = FUN_00554b60();

    if (iVar3 != 0) {

      return 1;

    }

  }

  bVar2 = *(byte *)in_EAX[4];

  in_EAX[4] = (uint)((byte *)in_EAX[4] + 1);

  in_EAX[2] = in_EAX[2] - 1;

  if (-1 < (char)bVar2) {

    bVar5 = (byte)in_EAX[6];

    if (bVar5 == 0) {

      return 1;

    }

    *(byte *)((int)unaff_EDI + 5) = bVar2;

    *(byte *)(unaff_EDI + 1) = bVar5;

    unaff_EDI[2] = 2;

    if (((bVar5 & 0xf0) != 0xc0) && ((bVar5 & 0xf0) != 0xd0)) {

      if ((in_EAX[2] == 0) && (in_EAX[9] == 0)) goto LAB_005550c6;

      iVar3 = FUN_00554e30((int)unaff_EDI + 6);

      if (iVar3 != 0) {

        return 1;

      }

      unaff_EDI[2] = unaff_EDI[2] + 1;

    }

LAB_0055511e:

    *unaff_EDI = in_EAX[5];

    if ((*in_EAX & 1) == 0) {

      iVar3 = FUN_00554e70(&local_4);

      if (iVar3 != 0) {

        return 1;

      }

      in_EAX[5] = in_EAX[5] + local_4;

    }

    return 0;

  }

  bVar5 = bVar2 & 0xf0;

  if (bVar5 == 0xf0) {

    if ((bVar2 == 0xf0) || (bVar2 == 0xf7)) {

      puVar1 = unaff_EDI + 2;

      *(byte *)(unaff_EDI + 1) = bVar2;

      iVar3 = FUN_00554e70(puVar1);

      if (iVar3 != 0) {

        return 1;

      }

      if (*puVar1 <= in_EAX[9] + in_EAX[2]) {

        pvVar4 = malloc(*puVar1);

        unaff_EDI[3] = (uint)pvVar4;

        if (pvVar4 == (void *)0x0) {

          return 1;

        }

        DAT_00870ab0 = DAT_00870ab0 + 1;

        uVar6 = 0;

        if (*puVar1 != 0) {

          do {

            iVar3 = FUN_00554e30(unaff_EDI[3] + uVar6);

            if (iVar3 != 0) {

              return 1;

            }

            uVar6 = uVar6 + 1;

          } while (uVar6 < *puVar1);

        }

        goto LAB_0055511e;

      }

    }

    else {

      if (bVar2 != 0xff) {

        return 1;

      }

      *(undefined1 *)(unaff_EDI + 1) = 0xff;

      if ((in_EAX[2] != 0) || (in_EAX[9] != 0)) {

        iVar3 = FUN_00554e30((int)unaff_EDI + 5);

        if (iVar3 != 0) {

          return 1;

        }

        puVar1 = unaff_EDI + 2;

        iVar3 = FUN_00554e70(puVar1);

        if (iVar3 != 0) {

          return 1;

        }

        uVar6 = *puVar1;

        if (uVar6 != 0) {

          if (in_EAX[9] + in_EAX[2] < uVar6) goto LAB_005550c6;

          pvVar4 = malloc(uVar6);

          unaff_EDI[3] = (uint)pvVar4;

          if (pvVar4 == (void *)0x0) {

            return 1;

          }

          DAT_00870ab0 = DAT_00870ab0 + 1;

          uVar6 = 0;

          if (*puVar1 != 0) {

            do {

              iVar3 = FUN_00554e30(unaff_EDI[3] + uVar6);

              if (iVar3 != 0) {

                return 1;

              }

              uVar6 = uVar6 + 1;

            } while (uVar6 < *puVar1);

          }

        }

        if (*(char *)((int)unaff_EDI + 5) == '/') {

          *in_EAX = *in_EAX | 1;

        }

        goto LAB_0055511e;

      }

    }

  }

  else {

    *(byte *)(unaff_EDI + 1) = bVar2;

    *(byte *)(in_EAX + 6) = bVar2;

    if ((bVar5 == 0xc0) || (uVar6 = 2, bVar5 == 0xd0)) {

      uVar6 = 1;

    }

    unaff_EDI[2] = uVar6 + 1;

    if (uVar6 <= in_EAX[9] + in_EAX[2]) {

      iVar3 = FUN_00554e30((int)unaff_EDI + 5);

      if (iVar3 != 0) {

        return 1;

      }

      if ((uVar6 == 2) && (iVar3 = FUN_00554e30((int)unaff_EDI + 6), iVar3 != 0)) {

        return 1;

      }

      goto LAB_0055511e;

    }

  }

LAB_005550c6:

  *in_EAX = *in_EAX | 1;

  return 1;

}





// --- FUN_00555150 at 0x00555150 (size: 748) ---


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



undefined4 FUN_00555150(LPCSTR param_1)



{

  HANDLE hFile;

  BOOL BVar1;

  int iVar2;

  undefined4 *puVar3;

  HLOCAL pvVar4;

  DWORD DVar5;

  uint local_18;

  int local_14;

  DWORD local_10;

  DWORD local_c;

  ushort local_8;

  ushort local_6;

  ushort local_4;

  

  DAT_00870a98 = 0;

  _DAT_00870a9c = 0;

  DAT_00870aa0 = 0;

  DAT_00870aa8 = 0;

  _DAT_00870a94 = 0;

  DAT_00870aa4 = (undefined4 *)0x0;

  DAT_008202a0 = CreateFileA(param_1,0x80000000,1,(LPSECURITY_ATTRIBUTES)0x0,3,0x80,(HANDLE)0x0);

  if ((((DAT_008202a0 != (HANDLE)0xffffffff) &&

       (_DAT_00870a94 = GetFileSize(DAT_008202a0,(LPDWORD)0x0), _DAT_00870a94 != 0xffffffff)) &&

      (BVar1 = ReadFile(DAT_008202a0,&local_14,4,&local_c,(LPOVERLAPPED)0x0), BVar1 != 0)) &&

     (((local_c == 4 && (local_14 == 0x6468544d)) &&

      ((iVar2 = FUN_00554ab0(&local_18,4), iVar2 == 0 &&

       ((local_18 = (local_18 & 0xff0000 | local_18 >> 0x10) >> 8 |

                    (local_18 & 0xff00 | local_18 << 0x10) << 8, 5 < local_18 &&

        (iVar2 = FUN_00554ab0(&local_8,local_18), iVar2 == 0)))))))) {

    _DAT_00870a9c = (uint)(byte)local_8 << 8 | (uint)(local_8 >> 8);

    DAT_00870aa0 = (uint)(byte)local_6 << 8 | (uint)(local_6 >> 8);

    DAT_00870a98 = (uint)(byte)local_4 << 8 | (uint)(local_4 >> 8);

    puVar3 = LocalAlloc(0x40,DAT_00870aa0 * 0x28);

    DAT_00870aa4 = puVar3;

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

      local_c = 0;

      if (DAT_00870aa0 != 0) {

        do {

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

            return 0;

          }

          pvVar4 = LocalAlloc(0x40,0x400);

          puVar3[3] = pvVar4;

          if ((((pvVar4 == (HLOCAL)0x0) || (iVar2 = FUN_00554ab0(&local_14,4), iVar2 != 0)) ||

              (local_14 != 0x6b72544d)) || (iVar2 = FUN_00554ab0(&local_18,4), iVar2 != 0))

          goto LAB_0055542a;

          local_18 = (local_18 & 0xff0000 | local_18 >> 0x10) >> 8 |

                     (local_18 & 0xff00 | local_18 << 0x10) << 8;

          puVar3[1] = local_18;

          DVar5 = SetFilePointer(DAT_008202a0,0,(PLONG)0x0,1);

          puVar3[7] = DVar5;

          DVar5 = 0x400;

          if ((uint)puVar3[1] < 0x401) {

            DVar5 = puVar3[1];

          }

          BVar1 = ReadFile(DAT_008202a0,(LPVOID)puVar3[3],DVar5,&local_10,(LPOVERLAPPED)0x0);

          hFile = DAT_008202a0;

          if ((BVar1 == 0) || (local_10 != DVar5)) goto LAB_0055542a;

          puVar3[9] = puVar3[1] - local_10;

          puVar3[2] = local_10;

          DVar5 = SetFilePointer(hFile,0,(PLONG)0x0,1);

          puVar3[4] = puVar3[3];

          puVar3[8] = DVar5;

          *puVar3 = 0;

          *(undefined1 *)(puVar3 + 6) = 0;

          puVar3[5] = 0;

          if ((puVar3[2] == 0) && (puVar3[9] == 0)) {

            *puVar3 = 1;

          }

          else {

            iVar2 = FUN_00554e70(puVar3 + 5);

            if (iVar2 != 0) goto LAB_0055542a;

            SetFilePointer(DAT_008202a0,puVar3[7] + puVar3[1],(PLONG)0x0,0);

          }

          local_c = local_c + 1;

          puVar3 = puVar3 + 10;

        } while (local_c < DAT_00870aa0);

      }

      return 0;

    }

  }

LAB_0055542a:

  FUN_00554af0();

  return 1;

}





// --- FUN_00555440 at 0x00555440 (size: 285) ---


undefined4 FUN_00555440(void)



{

  HANDLE hFile;

  BOOL BVar1;

  DWORD DVar2;

  int iVar3;

  undefined4 *puVar4;

  DWORD local_8;

  uint local_4;

  

  DAT_00870aa8 = 0;

  local_4 = 0;

  puVar4 = DAT_00870aa4;

  if (DAT_00870aa0 != 0) {

    do {

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

        return 0;

      }

      SetFilePointer(DAT_008202a0,puVar4[7],(PLONG)0x0,0);

      DVar2 = 0x400;

      if ((uint)puVar4[1] < 0x401) {

        DVar2 = puVar4[1];

      }

      BVar1 = ReadFile(DAT_008202a0,(LPVOID)puVar4[3],DVar2,&local_8,(LPOVERLAPPED)0x0);

      hFile = DAT_008202a0;

      if ((BVar1 == 0) || (local_8 != DVar2)) {

LAB_0055554a:

        if (local_4 == 0) {

          return 0;

        }

        return 1;

      }

      puVar4[9] = puVar4[1] - local_8;

      puVar4[2] = local_8;

      DVar2 = SetFilePointer(hFile,0,(PLONG)0x0,1);

      puVar4[8] = DVar2;

      puVar4[4] = puVar4[3];

      *puVar4 = 0;

      *(undefined1 *)(puVar4 + 6) = 0;

      puVar4[5] = 0;

      if ((puVar4[2] == 0) && (puVar4[9] == 0)) {

        *puVar4 = 1;

      }

      else {

        iVar3 = FUN_00554e70(puVar4 + 5);

        if (iVar3 != 0) goto LAB_0055554a;

        SetFilePointer(DAT_008202a0,puVar4[7] + puVar4[1],(PLONG)0x0,0);

      }

      local_4 = local_4 + 1;

      puVar4 = puVar4 + 10;

    } while (local_4 < DAT_00870aa0);

  }

  return 0;

}





// --- FUN_00555560 at 0x00555560 (size: 573) ---


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



undefined4 FUN_00555560(byte param_1,int param_2)



{

  byte *pbVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  

  if (param_2 == 0) {

    return 0xffffff9b;

  }

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

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

    _DAT_00870a38 = 0;

    DAT_00870ad0 = 0;

    DAT_00870acc = (void *)0x0;

    _DAT_00870ac0 = 0;

    DAT_00870ac4 = 0;

    _DAT_00870ac8 = 0;

    _DAT_00870abc = (byte *)0x0;

    _DAT_00870ab8 = (byte *)0x0;

  }

  if ((DAT_00870ad0 & 1) == 0) {

    if ((DAT_00870ad0 & 2) != 0) {

      return 0xffffff9a;

    }

    if ((DAT_00870ad0 & 4) != 0) {

      DAT_00870ad0 = DAT_00870ad0 ^ 4;

      if (((char)DAT_00870ac4 == -1) && ((char)((uint)DAT_00870ac4 >> 8) == '/'))

      goto joined_r0x00555623;

      iVar2 = FUN_00554c00();

      if (iVar2 != 0) {

        if (iVar2 == -0x68) {

LAB_005556f4:

          DAT_00870ad0 = DAT_00870ad0 | 4;

          return 0;

        }

        if (iVar2 != -0x69) goto joined_r0x00555717;

      }

    }

  }

  else {

    if (DAT_00870a68 == 0) {

      return 0xffffff99;

    }

    FUN_00555440();

    _DAT_00870a38 = 0;

    DAT_00870ad0 = 0;

  }

LAB_00555640:

  do {

    do {

      pbVar1 = (byte *)0x0;

      uVar3 = 0xffffffff;

      uVar4 = 0;

      _DAT_00870abc = (byte *)0x0;

      _DAT_00870ab4 = 0xffffffff;

      _DAT_00870ab8 = DAT_00870aa4;

      if (DAT_00870aa0 == 0) {

LAB_00555772:

        DAT_00870ad0 = DAT_00870ad0 | 1;

        return 0;

      }

      do {

        if (_DAT_00870ab8 == (byte *)0x0) break;

        if (((*_DAT_00870ab8 & 1) == 0) && (*(uint *)(_DAT_00870ab8 + 0x14) < uVar3)) {

          pbVar1 = _DAT_00870ab8;

          uVar3 = *(uint *)(_DAT_00870ab8 + 0x14);

        }

        uVar4 = uVar4 + 1;

        _DAT_00870ab8 = _DAT_00870ab8 + 0x28;

      } while (uVar4 < DAT_00870aa0);

      _DAT_00870ab4 = uVar3;

      _DAT_00870abc = pbVar1;

      if (pbVar1 == (byte *)0x0) goto LAB_00555772;

      iVar2 = FUN_00554ed0();

      if (iVar2 != 0) {

        DAT_00870ad0 = DAT_00870ad0 | 2;

        return 0xffffff9b;

      }

      if (((char)DAT_00870ac4 == -1) && ((char)((uint)DAT_00870ac4 >> 8) == '/')) {

joined_r0x00555623:

        if (DAT_00870ab0 != 0) {

          free(DAT_00870acc);

          DAT_00870ab0 = DAT_00870ab0 + -1;

        }

        goto LAB_00555640;

      }

      iVar2 = FUN_00554c00();

    } while (iVar2 == 0);

    if (iVar2 == -0x68) goto LAB_005556f4;

  } while (iVar2 == -0x69);

joined_r0x00555717:

  if (DAT_00870ab0 != 0) {

    free(DAT_00870acc);

    DAT_00870ab0 = DAT_00870ab0 + -1;

  }

  return 1;

}





// --- FUN_005557a0 at 0x005557A0 (size: 11) ---


void __thiscall FUN_005557a0(undefined4 param_1,code *param_2)



{

  (*param_2)(param_1);

  return;

}





// --- FUN_005557b0 at 0x005557B0 (size: 78) ---


void __fastcall FUN_005557b0(int *param_1)



{

  undefined *puVar1;

  LONG LVar2;

  LONG *lpAddend;

  

  FUN_0065af10(*param_1);

  puVar1 = (undefined *)*param_1;

  if (puVar1 != PTR_DAT_00818344) {

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

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

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

    }

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

    *param_1 = (int)PTR_DAT_00818344;

    InterlockedIncrement(lpAddend);

  }

  return;

}





// --- FUN_00555800 at 0x00555800 (size: 16) ---


undefined4 FUN_00555800(undefined4 param_1)



{

  FUN_005557b0();

  return param_1;

}





// --- FUN_00555810 at 0x00555810 (size: 47) ---


undefined4 __thiscall FUN_00555810(undefined4 param_1,char *param_2)



{

  char cVar1;

  char *pcVar2;

  

  if ((param_2 != (char *)0x0) && (*param_2 != '\0')) {

    pcVar2 = param_2;

    do {

      cVar1 = *pcVar2;

      pcVar2 = pcVar2 + 1;

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

    FUN_00404ef0(param_2,(int)pcVar2 - (int)(param_2 + 1));

  }

  return param_1;

}





// --- FUN_00555840 at 0x00555840 (size: 28) ---


undefined4 __thiscall FUN_00555840(undefined4 param_1,undefined4 param_2)



{

  FUN_00406500(param_1,"0x%08X",param_2);

  return param_1;

}





// --- FUN_00555860 at 0x00555860 (size: 129) ---


void FUN_00555860(char *param_1)



{

  LONG LVar1;

  int iVar2;

  undefined4 uVar3;

  int local_404;

  char local_400 [1024];

  

  _vsnprintf(local_400,0x400,param_1,&stack0x00000008);

  FUN_00404a40(0,local_400);

  uVar3 = 0;

  iVar2 = local_404;

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

  FUN_0043ce80(iVar2,uVar3);

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

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

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

  }

  return;

}





// --- FUN_005558f0 at 0x005558F0 (size: 78) ---


char * FUN_005558f0(byte *param_1)



{

  char *_Dest;

  

  _Dest = (char *)thunk_FUN_005df0f5(0x10);

  _Dest[0xf] = '\0';

  _snprintf(_Dest,0xf,"%2.2d.%2.2d.%2.2d.%c%c%c%c.%c",(uint)*param_1,(uint)param_1[1],

            (uint)param_1[2],(int)(char)param_1[3],(int)(char)param_1[4],(int)(char)param_1[5],

            (int)(char)param_1[6],(int)(char)param_1[7]);

  return _Dest;

}





// --- FUN_00555940 at 0x00555940 (size: 73) ---


char * FUN_00555940(byte *param_1)



{

  char *_Dest;

  

  _Dest = (char *)thunk_FUN_005df0f5(0xe);

  _Dest[0xd] = '\0';

  _snprintf(_Dest,0xd,"%2.2d.%2.2d.%2.2d.%c%c%c%c",(uint)*param_1,(uint)param_1[1],(uint)param_1[2],

            (int)(char)param_1[3],(int)(char)param_1[4],(int)(char)param_1[5],(int)(char)param_1[6])

  ;

  return _Dest;

}





// --- FUN_00555990 at 0x00555990 (size: 132) ---


undefined4 FUN_00555990(undefined4 param_1)



{

  int iVar1;

  void *pvVar2;

  undefined1 local_8 [8];

  

  if (DAT_00870ae0 == 0) {

    iVar1 = FUN_00555aa0(param_1);

    if (iVar1 == 0) {

      return 0;

    }

    FUN_00555d10(local_8);

    pvVar2 = (void *)FUN_00555cb0();

    DAT_00870adc = FUN_005558f0(local_8);

    DAT_00870ad8 = FUN_00555940(local_8);

    DAT_00870ae0 = thunk_FUN_005df0f5(0x44);

    sprintf((char *)DAT_00870ae0,"%s Portal:%s",DAT_00870adc,pvVar2);

    operator_delete(pvVar2);

  }

  return 1;

}





// --- FUN_00555a20 at 0x00555A20 (size: 54) ---


void FUN_00555a20(void)



{

  FUN_00555c90();

  operator_delete(DAT_00870ae0);

  DAT_00870ae0 = (void *)0x0;

  operator_delete(DAT_00870adc);

  operator_delete(DAT_00870ad8);

  return;

}





// --- FUN_00555a60 at 0x00555A60 (size: 57) ---


DWORD FUN_00555a60(LPCSTR param_1)



{

  DWORD dwLen;

  DWORD local_4;

  

  dwLen = GetFileVersionInfoSizeA(param_1,&local_4);

  if (dwLen != 0) {

    DAT_00870ae4 = (LPVOID)thunk_FUN_005df0f5(dwLen);

    GetFileVersionInfoA(param_1,local_4,dwLen,DAT_00870ae4);

  }

  return dwLen;

}





// --- FUN_00555aa0 at 0x00555AA0 (size: 483) ---


/* WARNING: Type propagation algorithm not settling */



DWORD FUN_00555aa0(char *param_1)



{

  char cVar1;

  char *pcVar2;

  DWORD DVar3;

  uint uVar4;

  uint uVar5;

  int iVar6;

  char *pcVar7;

  undefined2 *puVar8;

  undefined1 local_508 [4];

  CHAR local_504 [259];

  char cStack_401;

  char local_400 [1024];

  

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

    operator_delete(DAT_00870ae4);

  }

  iVar6 = 1 - (int)param_1;

  do {

    cVar1 = *param_1;

    param_1[(int)(&cStack_401 + iVar6)] = cVar1;

    param_1 = param_1 + 1;

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

  pcVar2 = strchr(local_400,0x2e);

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

    pcVar2 = &cStack_401;

    do {

      pcVar7 = pcVar2;

      pcVar2 = pcVar7 + 1;

    } while (pcVar7[1] != '\0');

    *(undefined4 *)(pcVar7 + 1) = DAT_007cc128;

    pcVar7[5] = DAT_007cc12c;

  }

  pcVar2 = strchr(local_400,0x22);

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

    pcVar2 = _getcwd(local_504,0x104);

    if (pcVar2 != (char *)0x0) {

      puVar8 = (undefined2 *)(local_508 + 3);

      do {

        pcVar2 = (char *)((int)puVar8 + 1);

        puVar8 = (undefined2 *)((int)puVar8 + 1);

      } while (*pcVar2 != '\0');

      *puVar8 = DAT_0079550c;

      pcVar2 = local_400;

      do {

        cVar1 = *pcVar2;

        pcVar2 = pcVar2 + 1;

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

      uVar4 = (int)pcVar2 - (int)local_400;

      pcVar2 = local_508 + 3;

      do {

        pcVar7 = pcVar2 + 1;

        pcVar2 = pcVar2 + 1;

      } while (*pcVar7 != '\0');

      pcVar7 = local_400;

      for (uVar5 = uVar4 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {

        *(undefined4 *)pcVar2 = *(undefined4 *)pcVar7;

        pcVar7 = pcVar7 + 4;

        pcVar2 = pcVar2 + 4;

      }

      for (uVar4 = uVar4 & 3; uVar4 != 0; uVar4 = uVar4 - 1) {

        *pcVar2 = *pcVar7;

        pcVar7 = pcVar7 + 1;

        pcVar2 = pcVar2 + 1;

      }

      DVar3 = GetFileVersionInfoSizeA(local_504,(LPDWORD)local_508);

      if (DVar3 != 0) {

        DAT_00870ae4 = (void *)thunk_FUN_005df0f5(DVar3);

        GetFileVersionInfoA(local_504,(DWORD)local_508,DVar3,DAT_00870ae4);

        return 1;

      }

    }

    local_504[0] = '\0';

    _searchenv(local_400,"PATH",local_504);

    if (local_504[0] != '\0') {

      DVar3 = FUN_00555a60(local_504);

      return DVar3;

    }

    return 0;

  }

  iVar6 = 0;

  pcVar2 = &cStack_401;

  while (pcVar2 = pcVar2 + 1, local_400[0] != '\0') {

    if (*pcVar2 != '\"') {

      local_504[iVar6] = *pcVar2;

      iVar6 = iVar6 + 1;

    }

    local_400[0] = pcVar2[1];

  }

  local_504[iVar6] = '\0';

  DVar3 = GetFileVersionInfoSizeA(local_504,(LPDWORD)local_508);

  if (DVar3 != 0) {

    DAT_00870ae4 = (void *)thunk_FUN_005df0f5(DVar3);

    GetFileVersionInfoA(local_504,(DWORD)local_508,DVar3,DAT_00870ae4);

  }

  return DVar3;

}





// --- FUN_00555c90 at 0x00555C90 (size: 17) ---


void FUN_00555c90(void)



{

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

    operator_delete(DAT_00870ae4);

  }

  return;

}





// --- FUN_00555cb0 at 0x00555CB0 (size: 89) ---


char * FUN_00555cb0(void)



{

  char cVar1;

  char *pcVar2;

  char *pcVar3;

  uint local_8;

  char *local_4;

  

  if (DAT_00870ae4 != (LPCVOID)0x0) {

    pcVar2 = (char *)thunk_FUN_005df0f5(0x2d);

    VerQueryValueA(DAT_00870ae4,"\\StringFileInfo\\040904b0\\Comments",&local_4,&local_8);

    pcVar3 = pcVar2;

    if (local_8 != 0) {

      do {

        cVar1 = *local_4;

        local_4 = local_4 + 1;

        *pcVar3 = cVar1;

        pcVar3 = pcVar3 + 1;

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

    }

    return pcVar2;

  }

  return (char *)0x0;

}





// --- FUN_00555d10 at 0x00555D10 (size: 108) ---


undefined4 FUN_00555d10(int param_1)



{

  uint local_8;

  char *local_4;

  

  if (DAT_00870ae4 != (LPCVOID)0x0) {

    VerQueryValueA(DAT_00870ae4,"\\StringFileInfo\\040904b0\\TurbineBuildVersion",&local_4,&local_8)

    ;

    if (local_8 != 0) {

      sscanf(local_4,"%d.%d.%d.%c%c%c%c.%c",param_1,param_1 + 1,param_1 + 2,param_1 + 3,param_1 + 4,

             param_1 + 5,param_1 + 6,param_1 + 7);

      return 1;

    }

  }

  return 0;

}





// --- FUN_00555d80 at 0x00555D80 (size: 40) ---


void __fastcall FUN_00555d80(int *param_1)



{

  if (*param_1 != 0) {

    FUN_00556b40();

  }

  if (param_1[2] != 0) {

    FUN_00695670();

  }

  if (param_1[1] != 0) {

    FUN_00556230();

    return;

  }

  return;

}





// --- FUN_00555db0 at 0x00555DB0 (size: 69) ---


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



{

  if (*param_1 != 0) {

    FUN_00556950(param_2,param_3,param_4);

  }

  if (param_1[1] != 0) {

    FUN_00556050(param_2,param_3,param_4);

  }

  if (param_1[2] != 0) {

    FUN_00556da0(param_2,param_3,param_4);

  }

  return;

}





// --- FUN_00555e00 at 0x00555E00 (size: 13) ---


void __fastcall FUN_00555e00(int param_1)



{

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

    FUN_00556020();

    return;

  }

  return;

}





// --- FUN_00555e10 at 0x00555E10 (size: 43) ---


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



{

  int iVar1;

  

  if (*param_1 == 0) {

    iVar1 = FUN_00556550(param_1[3]);

    *param_1 = iVar1;

  }

  FUN_00556740(param_2,param_3);

  return;

}





// --- FUN_00555e40 at 0x00555E40 (size: 12) ---


void __fastcall FUN_00555e40(int *param_1)



{

  if (*param_1 != 0) {

    FUN_00556570();

    return;

  }

  return;

}





// --- FUN_00555e50 at 0x00555E50 (size: 52) ---


void __thiscall FUN_00555e50(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  undefined4 uVar1;

  

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

    uVar1 = FUN_00556420(*(undefined4 *)(param_1 + 0xc));

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

  }

  FUN_00556330(param_2,param_3,param_4);

  return;

}





// --- FUN_00555e90 at 0x00555E90 (size: 15) ---


undefined4 __fastcall FUN_00555e90(int param_1)



{

  undefined4 uVar1;

  

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

    uVar1 = FUN_006b5980();

    return uVar1;

  }

  return 0;

}





// --- FUN_00555ea0 at 0x00555EA0 (size: 41) ---


void __fastcall FUN_00555ea0(int param_1)



{

  undefined4 uVar1;

  

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

    uVar1 = FUN_00556d30(*(undefined4 *)(param_1 + 0xc));

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

  }

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

    FUN_00556e60();

    return;

  }

  return;

}





// --- FUN_00555ed0 at 0x00555ED0 (size: 13) ---


void __fastcall FUN_00555ed0(int param_1)



{

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

    FUN_00556ce0();

    return;

  }

  return;

}





// --- FUN_00555ee0 at 0x00555EE0 (size: 15) ---


undefined4 __fastcall FUN_00555ee0(int param_1)



{

  undefined4 uVar1;

  

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

    uVar1 = FUN_00556cf0();

    return uVar1;

  }

  return 0;

}





// --- FUN_00555ef0 at 0x00555EF0 (size: 99) ---


int * FUN_00555ef0(int param_1)



{

  int *piVar1;

  

  piVar1 = (int *)FUN_005df0f5(0x10);

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

    *piVar1 = 0;

    piVar1[1] = 0;

    piVar1[2] = 0;

    piVar1[3] = 0;

    piVar1[3] = param_1;

    if (*piVar1 != 0) {

      FUN_0050a150(param_1);

    }

    if (piVar1[1] != 0) {

      FUN_00556300(param_1);

    }

    if (piVar1[2] != 0) {

      FUN_00556cb0(param_1);

    }

    return piVar1;

  }

  return (int *)0x0;

}





// --- FUN_00555f60 at 0x00555F60 (size: 95) ---


void __fastcall FUN_00555f60(undefined4 *param_1)



{

  void *pvVar1;

  

  pvVar1 = (void *)*param_1;

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

    FUN_00556c90();

    operator_delete(pvVar1);

  }

  pvVar1 = (void *)param_1[1];

  *param_1 = 0;

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

    FUN_00556400();

    operator_delete(pvVar1);

  }

  pvVar1 = (void *)param_1[2];

  param_1[1] = 0;

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

    FUN_00556d10();

    operator_delete(pvVar1);

  }

  param_1[2] = 0;

  return;

}





// --- thunk_FUN_00555f60 at 0x00555FC0 (size: 5) ---


void __fastcall thunk_FUN_00555f60(undefined4 *param_1)



{

  void *pvVar1;

  

  pvVar1 = (void *)*param_1;

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

    FUN_00556c90();

    operator_delete(pvVar1);

  }

  pvVar1 = (void *)param_1[1];

  *param_1 = 0;

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

    FUN_00556400();

    operator_delete(pvVar1);

  }

  pvVar1 = (void *)param_1[2];

  param_1[1] = 0;

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

    FUN_00556d10();

    operator_delete(pvVar1);

  }

  param_1[2] = 0;

  return;

}





// --- FUN_00555fd0 at 0x00555FD0 (size: 21) ---


bool __fastcall FUN_00555fd0(int *param_1)



{

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

    return *(int *)*param_1 != 0;

  }

  return false;

}





// --- FUN_00555ff0 at 0x00555FF0 (size: 43) ---


void __fastcall FUN_00555ff0(int param_1)



{

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

    FUN_00511100(&stack0x00000004);

    FUN_005563a0();

  }

  return;

}





// --- FUN_00556020 at 0x00556020 (size: 40) ---


void __fastcall FUN_00556020(int *param_1)



{

  if (*param_1 != 0) {

    *param_1 = 0;

    param_1[0x15] = 0;

    FUN_0050f860();

    FUN_00510cc0();

    return;

  }

  return;

}





// --- FUN_00556050 at 0x00556050 (size: 469) ---


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



void __thiscall FUN_00556050(int *param_1,int param_2,float param_3,undefined4 param_4)



{

  float fVar1;

  int iVar2;

  float *pfVar3;

  int iVar4;

  int *piVar5;

  float *pfVar6;

  float10 fVar7;

  float10 fVar8;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if ((*param_1 != 0) && (param_1[0x15] != 0)) {

    iVar4 = param_1[0x14];

    pfVar6 = (float *)(param_2 + 0x34);

    iVar2 = FUN_0050ff60(*param_1);

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

    if (iVar2 == 0) {

      piVar5 = param_1 + 2;

    }

    pfVar3 = (float *)FUN_0050aa30(&local_c,piVar5);

    *pfVar6 = *pfVar3;

    *(float *)(param_2 + 0x38) = pfVar3[1];

    *(float *)(param_2 + 0x3c) = pfVar3[2];

    pfVar3 = (float *)FUN_0050cef0(&local_c,pfVar6);

    *pfVar6 = *pfVar3;

    *(float *)(param_2 + 0x38) = pfVar3[1];

    *(float *)(param_2 + 0x3c) = pfVar3[2];

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

    fVar7 = (float10)FUN_0050f490(iVar4 + 0x48,param_1[1],piVar5);

    fVar7 = (float10)FUN_005aa960((float)fVar7);

    fVar1 = (float)(fVar7 - (float10)_DAT_007cc28c);

    iVar4 = FUN_004524a0();

    if (iVar4 != 0) {

      local_c = 0;

      *pfVar6 = 0.0;

      local_8 = 0;

      local_4 = 0;

      *(undefined4 *)(param_2 + 0x38) = 0;

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

    }

    iVar4 = FUN_00512b90();

    if (iVar4 == 0) {

      fVar7 = (float10)0.0;

    }

    else {

      FUN_00512b90();

      fVar7 = (float10)FUN_005288c0();

      fVar7 = fVar7 * (float10)_DAT_007cc284;

    }

    if (fVar7 < (float10)_DAT_007cc294) {

      fVar7 = (float10)_DAT_007cc288;

    }

    fVar7 = fVar7 * (float10)(double)CONCAT44(param_4,param_3);

    if (ABS((float10)fVar1) <= fVar7) {

      *pfVar6 = fVar1 * *pfVar6;

      *(float *)(param_2 + 0x38) = fVar1 * *(float *)(param_2 + 0x38);

      fVar7 = (float10)fVar1;

    }

    else {

      *pfVar6 = (float)(fVar7 * (float10)*pfVar6);

      *(float *)(param_2 + 0x38) = (float)(fVar7 * (float10)*(float *)(param_2 + 0x38));

    }

    *(float *)(param_2 + 0x3c) = (float)(fVar7 * (float10)*(float *)(param_2 + 0x3c));

    fVar7 = (float10)FUN_005aa5d0(piVar5);

    fVar8 = (float10)FUN_005364a0();

    param_3 = (float)((float10)(float)fVar7 - fVar8);

    if (ABS((float10)(float)fVar7 - fVar8) < (float10)_DAT_007cc294) {

      param_3 = 0.0;

    }

    if (param_3 < -_DAT_007cc294) {

      param_3 = param_3 + _DAT_0079cc60;

    }

    FUN_00536b80(param_3);

  }

  return;

}





// --- FUN_00556230 at 0x00556230 (size: 56) ---


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



void __fastcall FUN_00556230(int *param_1)



{

  if ((*param_1 != 0) && (*(double *)(param_1 + 0x16) < _DAT_008379a8)) {

    *param_1 = 0;

    param_1[0x15] = 0;

    FUN_0050f860();

    FUN_00510cc0();

    return;

  }

  return;

}





// --- FUN_00556270 at 0x00556270 (size: 138) ---


void __fastcall FUN_00556270(int *param_1)



{

  undefined4 local_40;

  undefined4 local_3c;

  undefined4 local_38;

  undefined4 local_34;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if (*param_1 != 0) {

    FUN_0050f860();

  }

  *param_1 = 0;

  local_40 = 0x3f800000;

  local_3c = 0;

  local_38 = 0;

  local_34 = 0;

  local_c = 0;

  local_8 = 0;

  local_4 = 0;

  FUN_00535b30();

  param_1[3] = 0;

  FUN_00425f10(&local_40);

  param_1[0x15] = 0;

  return;

}





// --- FUN_00556300 at 0x00556300 (size: 37) ---


void __thiscall FUN_00556300(int param_1,undefined4 param_2)



{

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

    FUN_00556270();

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

    return;

  }

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

  return;

}





// --- FUN_00556330 at 0x00556330 (size: 106) ---


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



void __thiscall FUN_00556330(int *param_1,int param_2,int param_3)



{

  float fVar1;

  undefined4 uVar2;

  float fVar3;

  

  if (*param_1 != 0) {

    *param_1 = 0;

    param_1[0x15] = 0;

    FUN_0050f860();

    FUN_00510cc0();

  }

  fVar3 = _DAT_007cc290;

  uVar2 = DAT_007cc27c;

  param_1[1] = param_3;

  *param_1 = param_2;

  fVar1 = (float)_DAT_008379a8;

  param_1[0x15] = 0;

  *(double *)(param_1 + 0x16) = (double)(fVar3 + fVar1);

  FUN_0050f800(0,param_2,uVar2,(double)_DAT_007cc280);

  return;

}





// --- FUN_005563a0 at 0x005563A0 (size: 91) ---


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



{

  int in_stack_00000020;

  int in_stack_000000c4;

  

  if (param_3 == *param_1) {

    if (in_stack_000000c4 == 1) {

      param_1[0x15] = 1;

      param_1[3] = in_stack_00000020;

      FUN_00425f10(&stack0x00000024);

      return;

    }

    if (*param_1 != 0) {

      *param_1 = 0;

      param_1[0x15] = 0;

      FUN_0050f860();

      FUN_00510cc0();

    }

  }

  return;

}





// --- FUN_00556400 at 0x00556400 (size: 17) ---


void __fastcall FUN_00556400(int param_1)



{

  FUN_00556270();

  *(undefined ***)(param_1 + 8) = &PTR_FUN_0079385c;

  return;

}





// --- FUN_00556420 at 0x00556420 (size: 103) ---


/* WARNING: Removing unreachable block (ram,0x0055646f) */



undefined4 * FUN_00556420(undefined4 param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0x60);

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

    return (undefined4 *)0x0;

  }

  *puVar1 = 0;

  puVar1[1] = 0;

  puVar1[2] = &PTR_LAB_00797910;

  puVar1[3] = 0;

  puVar1[4] = 0x3f800000;

  puVar1[5] = 0;

  puVar1[6] = 0;

  puVar1[7] = 0;

  puVar1[0x11] = 0;

  puVar1[0x12] = 0;

  puVar1[0x13] = 0;

  FUN_00535b30();

  puVar1[0x14] = 0;

  puVar1[0x15] = 0;

  puVar1[0x14] = param_1;

  return puVar1;

}





// --- FUN_00556490 at 0x00556490 (size: 88) ---


undefined4 * __fastcall FUN_00556490(undefined4 *param_1)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)*param_1;

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

    return puVar2;

  }

  puVar1 = (undefined4 *)*puVar2;

  if (puVar2 == (undefined4 *)param_1[1]) {

    *param_1 = puVar1;

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

      param_1[1] = 0;

    }

    *puVar2 = 0;

    return puVar2;

  }

  if (puVar1 != (undefined4 *)param_1[1]) {

    do {

      puVar2 = puVar1;

      puVar1 = (undefined4 *)*puVar2;

    } while ((undefined4 *)*puVar2 != (undefined4 *)param_1[1]);

  }

  puVar1 = (undefined4 *)*puVar2;

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

    return (undefined4 *)0x0;

  }

  *puVar2 = *puVar1;

  *puVar1 = 0;

  if ((undefined4 *)param_1[1] == puVar1) {

    param_1[1] = puVar2;

  }

  return puVar1;

}





// --- FUN_005564f0 at 0x005564F0 (size: 83) ---


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



{

  param_1[5] = DAT_007cc33c;

  *param_1 = 0;

  param_1[1] = 0;

  param_1[4] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = &PTR_LAB_00797910;

  param_1[9] = 0;

  param_1[10] = 0x3f800000;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0x17] = 0;

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  FUN_00535b30();

  param_1[2] = param_2;

  return param_1;

}





// --- FUN_00556550 at 0x00556550 (size: 30) ---


undefined4 FUN_00556550(undefined4 param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = FUN_005df0f5(0x68);

  if (iVar1 != 0) {

    uVar2 = FUN_005564f0(param_1);

    return uVar2;

  }

  return 0;

}





// --- FUN_00556570 at 0x00556570 (size: 75) ---


void __fastcall FUN_00556570(int *param_1)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  

  iVar1 = *param_1;

  iVar3 = DAT_007cc33c;

  while (DAT_007cc33c = iVar3, iVar1 != 0) {

    piVar2 = (int *)*param_1;

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

      iVar1 = *piVar2;

      *param_1 = iVar1;

      if (iVar1 == 0) {

        param_1[1] = 0;

      }

      *piVar2 = 0;

      piVar2[2] = (int)&PTR_FUN_0079385c;

      operator_delete(piVar2);

    }

    iVar3 = DAT_007cc33c;

    iVar1 = *param_1;

  }

  param_1[4] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[5] = iVar3;

  return;

}





// --- FUN_005565c0 at 0x005565C0 (size: 174) ---


void __thiscall FUN_005565c0(int *param_1,int param_2)



{

  int iVar1;

  int *piVar2;

  float10 fVar3;

  

  if (param_1[2] == 0) {

    return;

  }

  piVar2 = (int *)*param_1;

  param_1[4] = 0;

  param_1[6] = 0;

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

    piVar2 = (int *)0x0;

  }

  else {

    iVar1 = *piVar2;

    *param_1 = iVar1;

    if (iVar1 == 0) {

      param_1[1] = 0;

    }

    *piVar2 = 0;

  }

  iVar1 = *param_1;

  if (iVar1 == 0) {

    param_1[5] = DAT_007cc33c;

    if (param_2 != 0) {

      FUN_00556570();

      goto LAB_00556655;

    }

  }

  else {

    if (*(int *)(iVar1 + 4) == 1) {

      fVar3 = (float10)FUN_005aa560(iVar1 + 8);

      param_1[5] = (int)(float)fVar3;

      goto LAB_00556655;

    }

    if (param_2 != 0) goto LAB_00556655;

  }

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

    return;

  }

  FUN_0043e8c0(piVar2 + 2);

LAB_00556655:

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

    piVar2[2] = (int)&PTR_FUN_0079385c;

    operator_delete(piVar2);

  }

  return;

}





// --- FUN_00556670 at 0x00556670 (size: 56) ---


undefined4 * __fastcall FUN_00556670(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = &PTR_LAB_00797910;

  param_1[3] = 0;

  param_1[4] = 0x3f800000;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  FUN_00535b30();

  return param_1;

}





// --- FUN_005566b0 at 0x005566B0 (size: 92) ---


undefined4 __thiscall FUN_005566b0(int param_1,undefined4 param_2,int param_3)



{

  undefined4 *puVar1;

  undefined1 local_4c [12];

  undefined1 local_40 [52];

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  FUN_00536390(param_1 + 8,param_3 + 8);

  puVar1 = (undefined4 *)FUN_00452830(local_4c,param_1,&DAT_00870b54);

  local_c = *puVar1;

  local_8 = puVar1[1];

  local_4 = puVar1[2];

  FUN_00425f10(local_40);

  return param_2;

}





// --- FUN_00556710 at 0x00556710 (size: 46) ---


void __fastcall FUN_00556710(int *param_1)



{

  int *piVar1;

  int iVar2;

  

  while (piVar1 = (int *)*param_1, piVar1 != (int *)0x0) {

    iVar2 = *piVar1;

    *param_1 = iVar2;

    if (iVar2 == 0) {

      param_1[1] = 0;

    }

    *piVar1 = 0;

    piVar1[2] = (int)&PTR_FUN_0079385c;

    operator_delete(piVar1);

  }

  return;

}





// --- FUN_00556740 at 0x00556740 (size: 523) ---


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



void __thiscall FUN_00556740(int *param_1,int param_2,int param_3)



{

  int *piVar1;

  int iVar2;

  void *pvVar3;

  int *piVar4;

  uint uVar5;

  float10 fVar6;

  float10 fVar7;

  undefined4 uVar8;

  

  if (param_1[2] != 0) {

    fVar6 = (float10)FUN_005aa560(param_2);

    fVar7 = (float10)FUN_0050f640();

    if (fVar7 < (float10)(float)fVar6) {

      iVar2 = FUN_005df0f5(0x60);

      if (iVar2 == 0) {

        iVar2 = 0;

      }

      else {

        iVar2 = FUN_00556670();

      }

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

      *(undefined4 *)(iVar2 + 0xc) = *(undefined4 *)(param_2 + 4);

      FUN_00425f10(param_2 + 8);

      if (param_1[3] != 0) {

        fVar6 = (float10)FUN_00512010();

        FUN_00536b80((float)fVar6);

      }

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

        *(int *)param_1[1] = iVar2;

        param_1[1] = iVar2;

        param_1[7] = 4;

        return;

      }

      *param_1 = iVar2;

      param_1[1] = iVar2;

      param_1[7] = 4;

      return;

    }

    fVar6 = (float10)FUN_005aa560(param_2);

    if (fVar6 < (float10)_DAT_007cc334 != (fVar6 == (float10)_DAT_007cc334)) {

      if (param_3 == 0) {

        uVar8 = 1;

        fVar6 = (float10)FUN_005364a0(1);

        FUN_00514c60((float)fVar6,uVar8);

      }

      FUN_00556570();

      return;

    }

    iVar2 = param_1[1];

    while (((iVar2 != 0 && (*(int *)(param_1[1] + 4) == 1)) &&

           (fVar6 = (float10)FUN_005aa560(param_2), fVar6 < (float10)_DAT_007cc334))) {

      pvVar3 = (void *)FUN_00556490();

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

        *(undefined ***)((int)pvVar3 + 8) = &PTR_FUN_0079385c;

        operator_delete(pvVar3);

      }

      iVar2 = param_1[1];

    }

    while( true ) {

      piVar1 = (int *)*param_1;

      uVar5 = 0;

      piVar4 = piVar1;

      if (piVar1 == (int *)0x0) break;

      do {

        piVar4 = (int *)*piVar4;

        uVar5 = uVar5 + 1;

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

      if (uVar5 < 0x14) break;

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

        iVar2 = *piVar1;

        *param_1 = iVar2;

        if (iVar2 == 0) {

          param_1[1] = 0;

        }

        *piVar1 = 0;

        piVar1[2] = (int)&PTR_FUN_0079385c;

        operator_delete(piVar1);

      }

    }

    param_1[3] = param_3;

    iVar2 = FUN_005df0f5(0x60);

    if (iVar2 == 0) {

      iVar2 = 0;

    }

    else {

      iVar2 = FUN_00556670();

    }

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

    *(undefined4 *)(iVar2 + 0xc) = *(undefined4 *)(param_2 + 4);

    FUN_00425f10(param_2 + 8);

    if (param_1[3] != 0) {

      fVar6 = (float10)FUN_00512010();

      FUN_00536b80((float)fVar6);

    }

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

      *(int *)param_1[1] = iVar2;

      param_1[1] = iVar2;

      return;

    }

    *param_1 = iVar2;

    param_1[1] = iVar2;

  }

  return;

}





// --- FUN_00556950 at 0x00556950 (size: 494) ---


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



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



{

  float fVar1;

  float fVar2;

  int iVar3;

  int iVar4;

  float10 fVar5;

  float local_4c;

  undefined1 auStack_40 [64];

  

  iVar4 = *param_1;

  if ((((iVar4 != 0) && (iVar3 = param_1[2], iVar3 != 0)) && ((*(byte *)(iVar3 + 0xac) & 1) != 0))

     && ((*(int *)(iVar4 + 4) != 2 && (*(int *)(iVar4 + 4) != 3)))) {

    fVar5 = (float10)FUN_005aa560(iVar4 + 8);

    fVar1 = (float)fVar5;

    if (fVar5 < (float10)_DAT_007cc334) {

LAB_005569ae:

      FUN_005565c0(1);

      return;

    }

    local_4c = 0.0;

    iVar4 = FUN_00512b90();

    if (iVar4 != 0) {

      if (DAT_00820428 == 0) {

        FUN_00512b90();

        fVar5 = (float10)FUN_005288c0();

      }

      else {

        FUN_00512b90();

        fVar5 = (float10)FUN_00528910();

      }

      local_4c = (float)(fVar5 * (float10)_DAT_007cc330);

    }

    if (local_4c < _DAT_007cc340) {

      local_4c = DAT_007cc32c;

    }

    iVar4 = param_1[4];

    param_1[6] = (int)((float)(double)CONCAT44(param_4,param_3) + (float)param_1[6]);

    param_1[4] = iVar4 + 1U;

    if (4 < iVar4 + 1U) {

      fVar2 = (float)param_1[5];

      iVar4 = FUN_0050f5c0();

      if ((iVar4 == 0) &&

         ((fVar2 - fVar1 < _DAT_007cc340 ||

          (((fVar2 - fVar1) / (float)param_1[6]) / local_4c < _DAT_007cc2cc)))) {

        if (_DAT_007cc338 <= fVar1) {

          param_1[7] = param_1[7] + 1;

          FUN_005565c0(0);

          return;

        }

        goto LAB_005569ae;

      }

      param_1[4] = 0;

      param_1[6] = 0;

      param_1[5] = (int)fVar1;

    }

    FUN_005566b0(auStack_40,iVar3 + 0x48);

    local_4c = local_4c * (float)(double)CONCAT44(param_4,param_3);

    fVar5 = (float10)FUN_00452410();

    if (fVar5 < (float10)_DAT_007cc334 != (fVar5 == (float10)_DAT_007cc334)) {

      FUN_005565c0(1);

    }

    if (local_4c < (float)fVar5) {

      FUN_0043d890(local_4c / (float)fVar5);

    }

    if (param_1[3] != 0) {

      FUN_00536b80(0);

    }

    FUN_00425f10(auStack_40);

  }

  return;

}





// --- FUN_00556b40 at 0x00556B40 (size: 334) ---


void __fastcall FUN_00556b40(int *param_1)



{

  int *piVar1;

  bool bVar2;

  bool bVar3;

  int iVar4;

  int *piVar5;

  int local_54;

  int local_50;

  int local_4c;

  undefined1 local_48 [4];

  int local_44;

  

  if (param_1[2] == 0) {

    return;

  }

  if ((uint)param_1[7] < 4) {

    iVar4 = *param_1;

    if (iVar4 != 0) {

      if (*(int *)(iVar4 + 4) == 3) {

        FUN_00511ec0(iVar4 + 0x50,1);

        FUN_005565c0(1);

        return;

      }

      if (*(int *)(iVar4 + 4) != 2) {

        return;

      }

      FUN_005565c0(1);

      return;

    }

    if (param_1[7] < 1) {

      return;

    }

  }

  piVar1 = (int *)param_1[1];

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

    bVar2 = false;

    bVar3 = false;

    FUN_00424d10();

    if ((piVar1[1] != 2) && (piVar1[1] != 3)) {

      FUN_0043e8c0(piVar1 + 2);

LAB_00556c30:

      iVar4 = FUN_00516db0(local_48,1);

      if (iVar4 != 0) {

        return;

      }

      if (bVar3) {

        FUN_00511ec0(&local_54,1);

        FUN_00556570();

        return;

      }

      goto LAB_00556c7f;

    }

    piVar5 = (int *)*param_1;

    local_54 = piVar1[0x14];

    local_50 = piVar1[0x15];

    local_4c = piVar1[0x16];

    bVar3 = true;

    if (piVar5 != piVar1) {

      do {

        if (piVar5[1] == 1) {

          local_44 = piVar5[3];

          FUN_00425f10(piVar5 + 4);

          bVar2 = true;

        }

        piVar5 = (int *)*piVar5;

      } while (piVar5 != piVar1);

      if (bVar2) goto LAB_00556c30;

    }

  }

  iVar4 = FUN_00516db0(param_1 + 8,1);

  if (iVar4 != 0) {

    return;

  }

LAB_00556c7f:

  FUN_00556570();

  return;

}





// --- FUN_00556c90 at 0x00556C90 (size: 17) ---


void __fastcall FUN_00556c90(int param_1)



{

  FUN_00556710();

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

  return;

}





// --- FUN_00556cb0 at 0x00556CB0 (size: 34) ---


void __thiscall FUN_00556cb0(int *param_1,int param_2)



{

  if (*param_1 != 0) {

    *param_1 = 0;

    param_1[1] = 0;

    param_1[2] = 0;

    *param_1 = param_2;

    return;

  }

  *param_1 = param_2;

  return;

}





// --- FUN_00556ce0 at 0x00556CE0 (size: 8) ---


void __fastcall FUN_00556ce0(int param_1)



{

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

  return;

}





// --- FUN_00556cf0 at 0x00556CF0 (size: 30) ---


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



undefined4 __fastcall FUN_00556cf0(int param_1)



{

  if (*(float *)(param_1 + 0x58) * (float)_DAT_007cc3d8 < *(float *)(param_1 + 8)) {

    return 1;

  }

  return 0;

}





// --- FUN_00556d10 at 0x00556D10 (size: 18) ---


void __fastcall FUN_00556d10(undefined4 *param_1)



{

  param_1[1] = 0;

  param_1[2] = 0;

  *param_1 = 0;

  param_1[3] = &PTR_FUN_0079385c;

  return;

}





// --- FUN_00556d30 at 0x00556D30 (size: 104) ---


int * FUN_00556d30(int param_1)



{

  int *piVar1;

  

  piVar1 = (int *)FUN_005df0f5(0x5c);

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

    *piVar1 = 0;

    piVar1[1] = 0;

    piVar1[2] = 0;

    piVar1[3] = (int)&PTR_LAB_00797910;

    piVar1[4] = 0;

    piVar1[5] = 0x3f800000;

    piVar1[6] = 0;

    piVar1[7] = 0;

    piVar1[8] = 0;

    piVar1[0x12] = 0;

    piVar1[0x13] = 0;

    piVar1[0x14] = 0;

    FUN_00535b30();

    piVar1[0x15] = 0;

    piVar1[0x16] = 0;

    if (*piVar1 != 0) {

      piVar1[1] = 0;

      piVar1[2] = 0;

      *piVar1 = 0;

    }

    *piVar1 = param_1;

    return piVar1;

  }

  return (int *)0x0;

}





// --- FUN_00556da0 at 0x00556DA0 (size: 189) ---


void __thiscall FUN_00556da0(int *param_1,int param_2)



{

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

    if ((*(byte *)(*param_1 + 0xac) & 1) != 0) {

      if ((float)param_1[2] < (float)param_1[0x16]) {

        if ((float)param_1[2] < (float)param_1[0x15] == ((float)param_1[2] == (float)param_1[0x15]))

        {

          FUN_0043d890(((float)param_1[0x16] - (float)param_1[2]) /

                       ((float)param_1[0x16] - (float)param_1[0x15]));

        }

      }

      else {

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

        *(undefined4 *)(param_2 + 0x38) = 0;

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

      }

    }

    param_1[2] = (int)(SQRT(*(float *)(param_2 + 0x3c) * *(float *)(param_2 + 0x3c) +

                            *(float *)(param_2 + 0x38) * *(float *)(param_2 + 0x38) +

                            *(float *)(param_2 + 0x34) * *(float *)(param_2 + 0x34)) +

                      (float)param_1[2]);

  }

  return;

}





// --- FUN_00556e60 at 0x00556E60 (size: 68) ---


void __thiscall FUN_00556e60(int *param_1,int param_2,int param_3,int param_4)



{

  float10 fVar1;

  

  param_1[1] = 1;

  param_1[4] = *(int *)(param_2 + 4);

  FUN_00425f10(param_2 + 8);

  param_1[0x15] = param_3;

  param_1[0x16] = param_4;

  fVar1 = (float10)FUN_005aa560(*param_1 + 0x48);

  param_1[2] = (int)(float)fVar1;

  return;

}





// --- FUN_00556eb0 at 0x00556EB0 (size: 20) ---


void FUN_00556eb0(void)



{

  if (DAT_00870be4 == 0) {

    DAT_00870be4 = FUN_0054bbb0();

  }

  return;

}





// --- FUN_00556ed0 at 0x00556ED0 (size: 14) ---


undefined4 FUN_00556ed0(void)



{

  if (DAT_00870be4 == 0) {

    return 0;

  }

  return *(undefined4 *)(DAT_00870be4 + 0xc);

}





// --- FUN_00556f00 at 0x00556F00 (size: 52) ---


bool FUN_00556f00(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

                 undefined4 param_5,undefined4 param_6)



{

  int *piVar1;

  int iVar2;

  

  piVar1 = (int *)FUN_00557440();

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

    return false;

  }

  iVar2 = (**(code **)(*piVar1 + 0x38))(piVar1,param_1,param_2,param_3,param_4,param_5,param_6);

  return iVar2 == 0;

}





// --- FUN_00556f40 at 0x00556F40 (size: 14) ---


undefined4 FUN_00556f40(void)



{

  if (DAT_00870be4 == 0) {

    return 0;

  }

  return *(undefined4 *)(DAT_00870be4 + 8);

}





// --- FUN_00556f70 at 0x00556F70 (size: 116) ---


undefined4 * FUN_00556f70(undefined4 *param_1,uint param_2)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  uint uVar3;

  

  puVar1 = (undefined4 *)thunk_FUN_005df0f5(param_2 + 8);

  puVar1[1] = param_2;

  uVar3 = param_2 >> 2;

  *puVar1 = 0xf7de;

  puVar2 = puVar1 + 2;

  for (; uVar3 != 0; uVar3 = uVar3 - 1) {

    *puVar2 = *param_1;

    param_1 = param_1 + 1;

    puVar2 = puVar2 + 1;

  }

  for (uVar3 = param_2 & 3; uVar3 != 0; uVar3 = uVar3 - 1) {

    *(undefined1 *)puVar2 = *(undefined1 *)param_1;

    param_1 = (undefined4 *)((int)param_1 + 1);

    puVar2 = (undefined4 *)((int)puVar2 + 1);

  }

  puVar2 = (undefined4 *)FUN_005df0f5(0x50);

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

    FUN_005a82f0(puVar1,param_2 + 8);

    *puVar2 = &PTR_FUN_007cc464;

    puVar2[2] = &PTR_LAB_007cc450;

    puVar2[4] = &PTR_LAB_007cc44c;

    *(undefined2 *)((int)puVar2 + 0x3e) = 4;

    return puVar2;

  }

  return (undefined4 *)0x0;

}





// --- FUN_00556ff0 at 0x00556FF0 (size: 30) ---


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



{

  FUN_0054a800();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00557070 at 0x00557070 (size: 97) ---


int __thiscall FUN_00557070(int *param_1,wchar_t *param_2,va_list param_3)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  iVar2 = _vscwprintf(param_2,param_3);

  puVar1 = (undefined4 *)*param_1;

  FUN_00543680(iVar2);

  _vsnwprintf((wchar_t *)(*param_1 + 0x14),iVar2 + 1,param_2,param_3);

  LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  return iVar2;

}





// --- FUN_005570e0 at 0x005570E0 (size: 108) ---


undefined4 FUN_005570e0(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  

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

    LVar1 = InterlockedDecrement(param_1 + 1);

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

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

    }

    return 0;

  }

  puVar3 = param_1;

  InterlockedIncrement(param_1 + 1);

  uVar2 = (**(code **)*DAT_00870be4)(puVar3);

  LVar1 = InterlockedDecrement(param_1 + 1);

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

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

  }

  return uVar2;

}





// --- FUN_00557150 at 0x00557150 (size: 20) ---


void FUN_00557150(undefined4 param_1,undefined4 param_2)



{

  FUN_00557070(param_2,&stack0x0000000c);

  return;

}





// --- FUN_00557170 at 0x00557170 (size: 73) ---


void FUN_00557170(void)



{

  int *piVar1;

  undefined4 *puVar2;

  LONG LVar3;

  undefined4 *puVar4;

  

  puVar2 = DAT_00870be4;

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

    piVar1 = DAT_00870be4 + 4;

    *DAT_00870be4 = &PTR_FUN_007cc468;

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

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

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

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

    }

    operator_delete(puVar2);

  }

  DAT_00870be4 = (undefined4 *)0x0;

  return;

}





// --- FUN_005571c0 at 0x005571C0 (size: 314) ---


undefined4 * __thiscall FUN_005571c0(int *param_1,undefined4 *param_2,undefined2 param_3)



{

  LONG *pLVar1;

  undefined4 *puVar2;

  LONG LVar3;

  int iVar4;

  DWORD DVar5;

  DWORD DVar6;

  undefined4 *unaff_EDI;

  wchar_t *pwVar7;

  undefined4 *puStack_1c;

  

  puVar2 = DAT_008ef12c;

  pLVar1 = DAT_008ef12c + 1;

  puStack_1c = (undefined4 *)0x5571dd;

  InterlockedIncrement(pLVar1);

  iVar4 = *(int *)(*param_1 + 8);

  if (iVar4 == 1) {

    *param_2 = puVar2;

    puStack_1c = (undefined4 *)0x5571f2;

    InterlockedIncrement(pLVar1);

    puStack_1c = (undefined4 *)0x5571f9;

    LVar3 = InterlockedDecrement(pLVar1);

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

      puStack_1c = (undefined4 *)0x557211;

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

      return param_2;

    }

  }

  else {

    puStack_1c = (undefined4 *)0x0;

    iVar4 = (*(code *)PTR_FUN_00837394)(param_3,0,*param_1 + 0x14,iVar4);

    if (iVar4 == 0) {

      DVar5 = GetLastError();

      DVar6 = GetLastError();

      pwVar7 = 

      L"Could not determine number of bytes needed to convert from codepage %hu! GetLastError %d (0x%08x)\n"

      ;

    }

    else {

      FUN_00543680(iVar4);

      puVar2 = puStack_1c;

      iVar4 = (*(code *)PTR_FUN_00837394)

                        (param_3,0,*param_1 + 0x14,*(undefined4 *)(*param_1 + 8),puStack_1c + 5,

                         iVar4);

      if (iVar4 != 0) {

        puVar2[2] = iVar4;

        *unaff_EDI = puVar2;

        InterlockedIncrement(puVar2 + 1);

        LVar3 = InterlockedDecrement(puVar2 + 1);

        if (LVar3 != 0) {

          return unaff_EDI;

        }

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

        return unaff_EDI;

      }

      DVar5 = GetLastError();

      DVar6 = GetLastError();

      pwVar7 = L"Failed conversion from codepage %hu! GetLastError %d (0x%08x)\n";

    }

    FUN_00557150(&puStack_1c,pwVar7,param_3,DVar6,DVar5);

    puVar2 = puStack_1c;

    pLVar1 = puStack_1c + 1;

    *unaff_EDI = puStack_1c;

    InterlockedIncrement(pLVar1);

    LVar3 = InterlockedDecrement(pLVar1);

    param_2 = unaff_EDI;

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

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

      return unaff_EDI;

    }

  }

  return param_2;

}





// --- FUN_00557300 at 0x00557300 (size: 34) ---


undefined4 * __fastcall FUN_00557300(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007cc468;

  param_1[1] = 0;

  param_1[3] = 0;

  FUN_00401340("chatclient.dll");

  return param_1;

}





// --- FUN_00557330 at 0x00557330 (size: 236) ---


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



{

  int *piVar1;

  int iVar2;

  undefined4 uVar3;

  LONG LVar4;

  int iVar5;

  int *piStack_4;

  

  param_1[3] = 1;

  piStack_4 = param_1;

  if (param_1[1] == 0) {

    iVar2 = (**(code **)(*param_1 + 4))();

    param_1[1] = iVar2;

    iVar2 = FUN_005df0f5(0x10);

    if (iVar2 == 0) {

      iVar2 = 0;

    }

    else {

      iVar2 = FUN_00557420();

    }

    param_1[2] = iVar2;

    uVar3 = FUN_005571c0(&piStack_4,0);

    iVar2 = param_1[1];

    iVar5 = param_1[4];

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

    iVar2 = FUN_00557620(iVar5,iVar2,uVar3);

    piVar1 = piStack_4;

    LVar4 = InterlockedDecrement(piStack_4 + 1);

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

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

    }

    if (iVar2 == 0) {

      LVar4 = InterlockedDecrement(param_2 + 1);

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

        (**(code **)*param_2)(1);

      }

      return 0;

    }

    iVar2 = InterlockedDecrement(param_2 + 1);

  }

  else {

    iVar2 = InterlockedDecrement(param_2 + 1);

  }

  if ((iVar2 == 0) && (param_2 != (undefined4 *)0x0)) {

    (**(code **)*param_2)(1);

  }

  return 1;

}





// --- FUN_00557420 at 0x00557420 (size: 32) ---


undefined4 * __fastcall FUN_00557420(undefined4 *param_1)



{

  FUN_006b6d80();

  param_1[2] = 0;

  param_1[3] = 0;

  *param_1 = &PTR_FUN_007cc4ec;

  DAT_00870c08 = param_1;

  return param_1;

}





// --- FUN_00557440 at 0x00557440 (size: 14) ---


undefined4 FUN_00557440(void)



{

  if (DAT_00870c08 == 0) {

    return 0;

  }

  return *(undefined4 *)(DAT_00870c08 + 8);

}





// --- FUN_00557450 at 0x00557450 (size: 92) ---


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



{

  int *piVar1;

  

  piVar1 = (int *)param_1[2];

  *param_1 = &PTR_FUN_007cc4ec;

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

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

    piVar1 = (int *)param_1[2];

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

      (**(code **)(*piVar1 + 8))(piVar1);

      param_1[2] = 0;

    }

  }

  if ((HMODULE)param_1[3] != (HMODULE)0x0) {

    FreeLibrary((HMODULE)param_1[3]);

    param_1[3] = 0;

  }

  FUN_006b6c70();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00557620 at 0x00557620 (size: 375) ---


undefined4 __thiscall FUN_00557620(int param_1,LPCSTR param_2,int param_3,int *param_4)



{

  int *piVar1;

  LPCSTR pCVar2;

  char cVar3;

  HMODULE pHVar4;

  LONG LVar5;

  int iVar6;

  undefined4 *puVar7;

  code *pcVar8;

  uint uVar9;

  int iVar10;

  LPCSTR pCVar11;

  int local_4;

  

  pCVar2 = param_2;

  local_4 = param_1;

  pHVar4 = LoadLibraryA(param_2);

  *(HMODULE *)(param_1 + 0xc) = pHVar4;

  if (pHVar4 == (HMODULE)0x0) {

    FUN_00408670(&param_2,0,"FATAL ERROR: Cannot load %s!\n",pCVar2);

    pCVar11 = param_2 + -0x14;

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

    if ((LVar5 == 0) && (pCVar11 != (LPCSTR)0x0)) {

      (*(code *)**(undefined4 **)pCVar11)(1);

    }

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

  }

  else {

    puVar7 = (undefined4 *)FUN_00403350(&local_4,0);

    FUN_006b66e0(*puVar7);

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

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

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

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

    }

    pcVar8 = (code *)(*(code *)PTR_FUN_00837388)(*(undefined4 *)(param_1 + 0xc),"CreateChatClient");

    if (pcVar8 == (code *)0x0) {

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

      if (LVar5 != 0) {

        return 0;

      }

      if (pCVar2 + -0x14 == (LPCSTR)0x0) {

        return 0;

      }

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

      return 0;

    }

    uVar9 = FUN_00405e80();

    cVar3 = (*pcVar8)((int *)(param_1 + 8),1,~uVar9 | 0x1600);

    if ((cVar3 != '\0') && (piVar1 = *(int **)(param_1 + 8), piVar1 != (int *)0x0)) {

      if (param_3 == 0) {

        iVar6 = 0;

        iVar10 = 0;

      }

      else {

        iVar6 = param_3 + 8;

        iVar10 = param_3 + 4;

      }

      iVar6 = (**(code **)(*piVar1 + 0x10))(piVar1,param_3,iVar10,iVar6,*param_4 + 0x14);

      if (iVar6 == 0) {

        FUN_004011b0();

        return 1;

      }

      FUN_004011b0();

      return 0;

    }

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

  }

  if ((iVar6 == 0) && (pCVar2 + -0x14 != (LPCSTR)0x0)) {

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

  }

  return 0;

}





// --- FUN_005577a0 at 0x005577A0 (size: 151) ---


undefined1 FUN_005577a0(void)



{

  undefined1 uVar1;

  HMODULE hLibModule;

  void *local_c;

  undefined1 *puStack_8;

  undefined4 local_4;

  

  local_4 = 0xffffffff;

  puStack_8 = &LAB_006c39c8;

  local_c = ExceptionList;

  ExceptionList = &local_c;

  hLibModule = LoadLibraryA("msxml4.dll");

  if (hLibModule == (HMODULE)0x0) {

    DAT_00870c58 = 0;

    ExceptionList = local_c;

    return 0;

  }

  DAT_00870c58 = 1;

  FUN_00557e40();

  local_4 = 0;

  DAT_00870c58 = FUN_00557e80();

  FreeLibrary(hLibModule);

  uVar1 = DAT_00870c58;

  local_4 = 0xffffffff;

  FUN_00557e60();

  ExceptionList = local_c;

  return uVar1;

}





// --- FUN_00557840 at 0x00557840 (size: 16) ---


void FUN_00557840(void)



{

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

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

                    /* WARNING: Treating indirect jump as call */

    (**(code **)(*DAT_00870c2c + 0x20))();

    return;

  }

  return;

}





// --- FUN_00557850 at 0x00557850 (size: 217) ---


/* WARNING: Function: __chkstk replaced with injection: alloca_probe */



undefined4 FUN_00557850(void)



{

  HWND pHVar1;

  char *pcVar2;

  HIMC pHVar3;

  undefined4 uStack_6004;

  char local_6000 [8168];

  undefined1 auStack_4018 [24];

  undefined1 local_4000 [16380];

  undefined4 uStack_4;

  

  uStack_4 = 0x55785a;

  if ((DAT_00870340 != 0) && (DAT_00870c34 != (code *)0x0)) {

    pcVar2 = _getcwd(local_6000,0x2000);

    if (pcVar2 != (char *)0x0) {

      (*(code *)PTR_FUN_00837394)(0,0,local_6000,0xffffffff,local_4000,0x2000);

      pHVar1 = DAT_008381a4;

      pHVar3 = ImmGetContext(DAT_008381a4);

      ImmReleaseContext(pHVar1,pHVar3);

      DAT_00870c2c = (int *)(*DAT_00870c34)(pHVar1,*(undefined4 *)(DAT_00870340 + 0x468),

                                            auStack_4018,0,0,0,0);

      ImmAssociateContext(pHVar1,pHVar3);

    }

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

      uStack_6004 = 0;

      (**(code **)(*DAT_00870c2c + 0x5c))(0x69,2,&uStack_6004);

      return 1;

    }

  }

  return 0;

}





// --- FUN_00557930 at 0x00557930 (size: 187) ---


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



undefined4 FUN_00557930(void)



{

  undefined *puVar1;

  char cVar2;

  

  if (DAT_00870c30 != (HMODULE)0x0) {

    return 1;

  }

  cVar2 = FUN_005577a0();

  if (cVar2 != '\0') {

    DAT_00870c30 = LoadLibraryA("keystone.dll");

    puVar1 = PTR_FUN_00837388;

    DAT_00870c34 = (*(code *)PTR_FUN_00837388)(DAT_00870c30,"KeystoneCreate");

    DAT_00870c38 = LoadLibraryA("plugins\\ACHelpPlugin.dll");

    DAT_00870c44 = (*(code *)puVar1)(DAT_00870c38,"ExecutePlugin");

    DAT_00870c48 = (*(code *)puVar1)(DAT_00870c38,"TerminatePlugin");

    DAT_00870c3c = LoadLibraryA("plugins\\ACPluginManager.dll");

    _DAT_00870c4c = (*(code *)puVar1)(DAT_00870c3c,"ExecutePlugin");

    DAT_00870c50 = (*(code *)puVar1)(DAT_00870c3c,"TerminatePlugin");

    if (DAT_00870c34 != 0) {

      return 1;

    }

    DAT_00870c54 = CreateAcceleratorTableA((LPACCEL)0x0,0);

  }

  return 0;

}





// --- FUN_005579f0 at 0x005579F0 (size: 61) ---


bool FUN_005579f0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int *piVar1;

  

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

    return false;

  }

  piVar1 = (int *)(**(code **)(*DAT_00870c2c + 0x24))(param_1,param_2,param_3,param_4);

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

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  return piVar1 != (int *)0x0;

}





// --- FUN_00557a30 at 0x00557A30 (size: 40) ---


bool FUN_00557a30(void)



{

  int *piVar1;

  

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

    return false;

  }

  piVar1 = (int *)(**(code **)(*DAT_00870c2c + 0x2c))();

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

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  return piVar1 != (int *)0x0;

}





// --- FUN_00557a60 at 0x00557A60 (size: 45) ---


bool FUN_00557a60(void)



{

  int *piVar1;

  

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

    return false;

  }

  piVar1 = (int *)(**(code **)(*DAT_00870c2c + 0x60))(&stack0x00000004);

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

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  return piVar1 != (int *)0x0;

}





// --- FUN_00557a90 at 0x00557A90 (size: 45) ---


undefined4 FUN_00557a90(undefined4 param_1,int param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

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

    return 0;

  }

  if (param_2 == 0) {

    param_2 = DAT_00870c54;

  }

  uVar1 = (**(code **)(*DAT_00870c2c + 0x6c))(param_1,param_2,param_3);

  return uVar1;

}





// --- FUN_00557ac0 at 0x00557AC0 (size: 47) ---


undefined4 FUN_00557ac0(void)



{

  int *piVar1;

  

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

    piVar1 = (int *)(**(code **)(*DAT_00870c2c + 0x2c))();

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

      (**(code **)(*piVar1 + 8))(piVar1);

      (**(code **)(*DAT_00870c2c + 0x28))(0);

      return 1;

    }

  }

  return 0;

}





// --- FUN_00557b50 at 0x00557B50 (size: 73) ---


undefined4 FUN_00557b50(void)



{

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

    if (DAT_00870c48 != (code *)0x0) {

      (*DAT_00870c48)();

    }

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

      if (DAT_00870c50 != (code *)0x0) {

        (*DAT_00870c50)();

      }

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

        (**(code **)(*DAT_00870c2c + 8))(DAT_00870c2c);

        DAT_00870c2c = (int *)0x0;

      }

    }

  }

  return 1;

}





// --- FUN_00557ba0 at 0x00557BA0 (size: 163) ---


undefined4 FUN_00557ba0(void)



{

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

    if (DAT_00870c48 != (code *)0x0) {

      (*DAT_00870c48)();

    }

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

      if (DAT_00870c50 != (code *)0x0) {

        (*DAT_00870c50)();

      }

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

        (**(code **)(*DAT_00870c2c + 8))(DAT_00870c2c);

        DAT_00870c2c = (int *)0x0;

      }

    }

  }

  if (DAT_00870c30 != (HMODULE)0x0) {

    FreeLibrary(DAT_00870c30);

  }

  if (DAT_00870c38 != (HMODULE)0x0) {

    FreeLibrary(DAT_00870c38);

  }

  if (DAT_00870c3c != (HMODULE)0x0) {

    FreeLibrary(DAT_00870c3c);

  }

  if (DAT_00870c54 != (HACCEL)0x0) {

    DestroyAcceleratorTable(DAT_00870c54);

  }

  DAT_00870c30 = (HMODULE)0x0;

  DAT_00870c34 = 0;

  DAT_00870c38 = (HMODULE)0x0;

  DAT_00870c3c = (HMODULE)0x0;

  DAT_00870c54 = (HACCEL)0x0;

  return 1;

}





// --- FUN_00557c50 at 0x00557C50 (size: 290) ---


undefined4 FUN_00557c50(int param_1,undefined4 param_2)



{

  LONG LVar1;

  int aiStack_a0 [37];

  void *local_c;

  undefined1 *puStack_8;

  int iStack_4;

  

  iStack_4 = 0xffffffff;

  puStack_8 = &LAB_006c39f6;

  local_c = ExceptionList;

  if (DAT_00870c2c != 0) {

    ExceptionList = &local_c;

    if (DAT_00870c48 != (code *)0x0) {

      ExceptionList = &local_c;

      (*DAT_00870c48)();

    }

    if (DAT_00870c44 != (code *)0x0) {

      if (param_1 == 0) {

        (*DAT_00870c44)(DAT_00870c2c,FUN_00509430,0);

      }

      else {

        FUN_0042dc80();

        iStack_4 = 0;

        FUN_0042c9c0(param_1,param_2);

        FUN_0042e980(aiStack_a0,0);

        iStack_4._0_1_ = 1;

        (*DAT_00870c44)(DAT_00870c2c,FUN_00509430,aiStack_a0[0]);

        iStack_4 = (uint)iStack_4._1_3_ << 8;

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

        if ((LVar1 == 0) && ((undefined4 *)(aiStack_a0[0] + -0x14) != (undefined4 *)0x0)) {

          (*(code *)**(undefined4 **)(aiStack_a0[0] + -0x14))(1);

        }

        iStack_4 = 0xffffffff;

        FUN_0042e590();

      }

      ExceptionList = local_c;

      return 1;

    }

  }

  ExceptionList = local_c;

  return 0;

}





// --- FUN_00557d80 at 0x00557D80 (size: 178) ---


bool __fastcall FUN_00557d80(wchar_t *param_1)



{

  size_t sVar1;

  int *piVar2;

  LONG LVar3;

  bool bVar4;

  void *local_c;

  undefined1 *puStack_8;

  undefined4 local_4;

  

  local_4 = 0xffffffff;

  puStack_8 = &LAB_006c3a08;

  local_c = ExceptionList;

  ExceptionList = &local_c;

  sVar1 = wcslen(L"acpluginmanager");

  FUN_004022d0(sVar1);

  wcscpy(param_1,L"acpluginmanager");

  local_4 = 0;

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

    bVar4 = false;

  }

  else {

    piVar2 = (int *)(**(code **)(*DAT_00870c2c + 0x14))(param_1);

    bVar4 = piVar2 != (int *)0x0;

    if (bVar4) {

      (**(code **)(*piVar2 + 8))(piVar2);

    }

  }

  local_4 = 0xffffffff;

  LVar3 = InterlockedDecrement((LONG *)(param_1 + -8));

  if ((LVar3 == 0) && (param_1 + -10 != (wchar_t *)0x0)) {

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

  }

  ExceptionList = local_c;

  return bVar4;

}





// --- FUN_00557e40 at 0x00557E40 (size: 32) ---


undefined4 __fastcall FUN_00557e40(undefined4 param_1)



{

  int *piVar1;

  

  piVar1 = DAT_00870e70;

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

    DAT_00870e70 = (int *)0x0;

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  return param_1;

}





// --- FUN_00557e60 at 0x00557E60 (size: 26) ---


void FUN_00557e60(void)



{

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

    (**(code **)(*DAT_00870e70 + 8))(DAT_00870e70);

    DAT_00870e70 = (int *)0x0;

  }

  return;

}





// --- FUN_00557e80 at 0x00557E80 (size: 139) ---


uint FUN_00557e80(void)



{

  undefined1 *puVar1;

  HRESULT HVar2;

  uint uVar3;

  LPUNKNOWN local_18;

  undefined1 *local_14;

  void *pvStack_10;

  undefined1 *puStack_c;

  undefined4 local_8;

  

  puStack_c = &LAB_006c3a20;

  pvStack_10 = ExceptionList;

  local_14 = &stack0xffffffdc;

  local_8 = 0;

  ExceptionList = &pvStack_10;

  puVar1 = &stack0xffffffdc;

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

    ExceptionList = &pvStack_10;

    (**(code **)(*DAT_00870e70 + 8))(DAT_00870e70);

    puVar1 = local_14;

  }

  local_14 = puVar1;

  HVar2 = CoCreateInstance((IID *)&DAT_007cc680,(LPUNKNOWN)0x0,7,(IID *)&DAT_007cc670,&local_18);

  if (-1 < HVar2) {

    HVar2 = OleRun(local_18);

    if (-1 < HVar2) {

      HVar2 = (*local_18->lpVtbl->QueryInterface)(local_18,(IID *)&DAT_007cc660,&DAT_00870e70);

    }

    (*local_18->lpVtbl->Release)(local_18);

    if (-1 < HVar2) {

      ExceptionList = pvStack_10;

      return (uint)(-1 < HVar2);

    }

  }

  DAT_00870e70 = (int *)0x0;

  uVar3 = FUN_00557f1b();

  return uVar3;

}





// --- Catch@00557f0b at 0x00557F0B (size: 13) ---


undefined * Catch_00557f0b(void)



{

  int unaff_EBP;

  

  *(undefined4 *)(unaff_EBP + -0x14) = 0x80004005;

  return &DAT_00557f18;

}





// --- FUN_00557f1b at 0x00557F1B (size: 24) ---


bool FUN_00557f1b(void)



{

  int unaff_EBP;

  int unaff_ESI;

  

  ExceptionList = *(void **)(unaff_EBP + -0xc);

  return -1 < unaff_ESI;

}





// --- FUN_005580b0 at 0x005580B0 (size: 46) ---


int __fastcall FUN_005580b0(void *param_1)



{

  int iVar1;

  

  iVar1 = FUN_00401ea0();

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

    *(undefined ***)((int)param_1 + 4) = &PTR_LAB_00793b6c;

    operator_delete(param_1);

  }

  return iVar1;

}





// --- FUN_00558190 at 0x00558190 (size: 145) ---


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



{

  int iVar1;

  int *piVar2;

  int *piVar3;

  int *unaff_ESI;

  int *local_4;

  

  local_4 = param_1;

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

    FUN_00403770(0);

    *param_2 = 0x80004002;

    return;

  }

  iVar1 = *param_3;

  param_3 = (int *)0x0;

  piVar3 = (int *)(**(code **)(iVar1 + 0xc))(&local_4,&DAT_007cc870,&param_3);

  piVar2 = local_4;

  iVar1 = *piVar3;

  piVar3 = (int *)*param_1;

  if (iVar1 < 0) {

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

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

    }

    *param_1 = 0;

    param_1[1] = 0;

    *unaff_ESI = iVar1;

    return;

  }

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

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

  }

  *param_1 = (int)piVar2;

  param_1[1] = 0;

  *unaff_ESI = iVar1;

  return;

}





// --- FUN_00558230 at 0x00558230 (size: 110) ---


void FUN_00558230(void)



{

  int *piVar1;

  undefined1 *puVar2;

  undefined *puVar3;

  int *piVar4;

  undefined4 uVar5;

  undefined1 local_4 [4];

  

  piVar1 = (int *)FUN_005df0f5(0xc);

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

    uVar5 = 0;

    puVar2 = local_4;

    *piVar1 = (int)&PTR_LAB_007cc8ac;

    puVar3 = &DAT_007cc6c0;

    piVar1[2] = 1;

    piVar1[1] = (int)&PTR_LAB_00793b6c;

    piVar4 = piVar1;

    FUN_00406d10(puVar2,&DAT_007cc6c0,piVar1,0);

    FUN_00406a90(puVar2,puVar3,piVar4,uVar5);

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

  }

  DAT_00846fd4 = (undefined4 *)FUN_005df0f5(4);

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

    *DAT_00846fd4 = &PTR_LAB_007cc88c;

    return;

  }

  DAT_00846fd4 = (undefined4 *)0x0;

  return;

}





// --- FUN_005582c0 at 0x005582C0 (size: 94) ---


void __thiscall FUN_005582c0(int param_1,int param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  if (*(undefined4 **)(param_1 + 0x1f8) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x1f8))(1);

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

  }

  if (param_2 != 0) {

    iVar1 = FUN_005df0f5(0x2c);

    if (iVar1 != 0) {

      uVar2 = FUN_005ad590(param_2);

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

      FUN_00693ae0();

      return;

    }

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

    FUN_00693ae0();

  }

  return;

}





// --- FUN_00558330 at 0x00558330 (size: 51) ---


void FUN_00558330(undefined4 param_1)



{

  int iVar1;

  int *piVar2;

  

  iVar1 = FUN_0055b0a0();

  if (iVar1 != 0) {

    piVar2 = (int *)FUN_0055a740();

    (**(code **)(*piVar2 + 0x24))(piVar2,param_1);

  }

  FUN_0058f4f0(param_1);

  FUN_00508fa0(param_1);

  return;

}





// --- FUN_00558370 at 0x00558370 (size: 121) ---


void __fastcall FUN_00558370(undefined4 *param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)(-(uint)(param_1 != (undefined4 *)0x8) & (uint)param_1);

  param_1[-2] = &PTR_LAB_007ccb34;

  param_1[-1] = &PTR_FUN_007ccb60;

  *param_1 = &PTR_LAB_007ccaf8;

  param_1[1] = &PTR_FUN_00801670;

  *puVar1 = &PTR_LAB_007ccabc;

  puVar1[1] = &PTR_FUN_00801670;

  if ((undefined4 *)puVar1[0x7e] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)puVar1[0x7e])(1);

    puVar1[0x7e] = 0;

  }

  FUN_00509c10();

  if (param_1 + -2 != (undefined4 *)0x0) {

    param_1[-1] = &PTR_FUN_007ccb60;

    FUN_0043c610();

    return;

  }

  ppuRam00000000 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  return;

}





// --- FUN_005583f0 at 0x005583F0 (size: 24) ---


undefined4 FUN_005583f0(undefined4 param_1)



{

  undefined4 uVar1;

  

  if (DAT_00842adc != 0) {

    uVar1 = FUN_005088e0(param_1);

    return uVar1;

  }

  return 0;

}





// --- FUN_00558410 at 0x00558410 (size: 24) ---


undefined4 FUN_00558410(undefined4 param_1)



{

  undefined4 uVar1;

  

  if (DAT_00842adc != 0) {

    uVar1 = FUN_00508890(param_1);

    return uVar1;

  }

  return 0;

}





// --- FUN_00558430 at 0x00558430 (size: 33) ---


void __thiscall FUN_00558430(undefined4 *param_1,int param_2)



{

  *param_1 = &PTR_FUN_007a8b64;

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

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

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

  return;

}





// --- FUN_00558460 at 0x00558460 (size: 45) ---


void __thiscall FUN_00558460(undefined4 *param_1,int param_2)



{

  *param_1 = &PTR_FUN_007a8b64;

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

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

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

  *param_1 = &PTR_FUN_007a8b80;

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

  return;

}





// --- FUN_005584c0 at 0x005584C0 (size: 71) ---


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



{

  *param_1 = &PTR_LAB_007ccabc;

  param_1[1] = &PTR_FUN_00801670;

  if ((undefined4 *)param_1[0x7e] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[0x7e])(1);

    param_1[0x7e] = 0;

  }

  FUN_00509c10();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00558510 at 0x00558510 (size: 34) ---


int __thiscall FUN_00558510(int param_1,byte param_2)



{

  FUN_00558370();

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

    operator_delete((void *)(param_1 + -8));

  }

  return param_1 + -8;

}





// --- FUN_00558660 at 0x00558660 (size: 383) ---


void FUN_00558660(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  

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

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

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

  iVar6 = *(int *)(param_2 + 0x1c);

  iVar7 = *(int *)(param_2 + 0x20);

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

  iVar8 = *(int *)(param_2 + 0x2c);

  FUN_005adb20(param_2);

  FUN_0058cca0();

  uVar4 = FUN_00508930(uVar3);

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

  if (param_3 != 0) {

    if (*(int *)(param_1 + 0x58) == 0) {

      if (((iVar1 != iVar6) || (iVar5 != iVar7)) || (iVar2 != iVar8)) {

        FUN_00547590(uVar3);

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

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

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

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

      }

    }

    else {

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

    }

  }

  if (iVar6 == 0) {

    if (DAT_0083da58 == 0) {

      iVar5 = 0;

    }

    else {

      iVar5 = *(int *)(DAT_0083da58 + 0xf4);

    }

    if ((((iVar5 != *(int *)(param_1 + 0xb8)) || (DAT_0083da58 == 0)) ||

        (*(int *)(DAT_0083da58 + 0xf4) == 0)) && (param_3 == 0)) goto LAB_005587ce;

    iVar5 = 0;

    iVar6 = 0;

  }

  else {

    iVar5 = FUN_005088e0(iVar6);

    if (iVar5 == 0) {

LAB_00558768:

      iVar5 = 0;

    }

    else {

      if ((((*(uint *)(param_1 + 0x100) & 0x800000) == 0) && (*(int *)(param_1 + 200) == 0)) &&

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

        iVar5 = FUN_0058cec0(uVar3);

      }

      else {

        iVar5 = FUN_0058cee0(uVar3);

      }

      if (iVar5 == -1) goto LAB_00558768;

    }

    iVar8 = 0;

    iVar7 = 0;

  }

  FUN_0058e9e0(iVar6,iVar5,iVar7,iVar8,1);

LAB_005587ce:

  FUN_0058f170();

  return;

}





// --- FUN_005587e0 at 0x005587E0 (size: 102) ---


undefined4 FUN_005587e0(undefined4 param_1,int param_2,uint param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  if (param_2 != 0) {

    iVar1 = FUN_005088e0(param_2);

    if (iVar1 != 0) {

      iVar2 = FUN_0058d410();

      if (iVar2 != 0) {

        iVar2 = FUN_006b3cb0(0x1000c,param_1);

        if (iVar2 != 0) {

          if (param_3 <= *(uint *)(iVar1 + 0xfc)) {

            FUN_0058da70(param_3,param_4);

          }

          return 1;

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558850 at 0x00558850 (size: 104) ---


void __thiscall FUN_00558850(int param_1,int param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0x18);

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

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = &PTR_FUN_007acafc;

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

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

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

    puVar2[4] = 0;

    puVar2[5] = 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 + 0x10) = puVar2;

  puVar2[5] = iVar1;

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

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

  return;

}





// --- FUN_005588c0 at 0x005588C0 (size: 116) ---


undefined4 FUN_005588c0(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x80000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00592750(param_1,param_4);

        }

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,8,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558940 at 0x00558940 (size: 127) ---


undefined4 FUN_00558940(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x80000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_005927a0(param_1,param_4);

        }

        FUN_0058f050(param_1,param_4);

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,8,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_005589c0 at 0x005589C0 (size: 116) ---


undefined4 FUN_005589c0(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x90000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00593250(param_1,param_4);

        }

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,9,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558a40 at 0x00558A40 (size: 127) ---


undefined4 FUN_00558a40(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x90000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00593af0(param_1,param_4);

        }

        FUN_0058f050(param_1,param_4);

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,9,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558ac0 at 0x00558AC0 (size: 116) ---


undefined4 FUN_00558ac0(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x40000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00592f60(param_1,param_4);

        }

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,4,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558b40 at 0x00558B40 (size: 127) ---


undefined4 FUN_00558b40(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x40000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00593060(param_1,param_4);

        }

        FUN_0058f050(param_1,param_4);

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,4,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558bc0 at 0x00558BC0 (size: 116) ---


undefined4 FUN_00558bc0(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x40000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00593150(param_1,param_4);

        }

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,4,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558c40 at 0x00558C40 (size: 130) ---


undefined4 FUN_00558c40(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x10000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591430(param_1,param_4);

        }

        FUN_0058ed50(param_1,param_4);

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,1,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558cd0 at 0x00558CD0 (size: 124) ---


undefined4

FUN_00558cd0(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

            undefined4 param_5)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0xe0000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591530(param_1,param_4,param_5);

        }

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,0xe,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558d50 at 0x00558D50 (size: 130) ---


undefined4 FUN_00558d50(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0xd0000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591640(param_1,param_4);

        }

        FUN_0058d4b0(param_1,param_4);

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,0xd,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558de0 at 0x00558DE0 (size: 124) ---


undefined4

FUN_00558de0(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

            undefined4 param_5)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x20000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591740(param_1,param_4,param_5);

        }

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,2,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558e60 at 0x00558E60 (size: 162) ---


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



{

  undefined4 *puVar1;

  int iVar2;

  int iVar3;

  LONG LVar4;

  

  iVar2 = FUN_005088e0(param_3);

  if (iVar2 != 0) {

    iVar3 = FUN_0058d410();

    if (iVar3 != 0) {

      iVar3 = FUN_006b3cb0(param_1 | 0x50000,param_2);

      if (iVar3 != 0) {

        if (*(int *)(iVar2 + 0x14c) != 0) {

          FUN_00591cc0(param_1,param_4);

        }

        puVar1 = (undefined4 *)*param_4;

        InterlockedIncrement(puVar1 + 1);

        LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

        }

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar2,5,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558f10 at 0x00558F10 (size: 130) ---


undefined4 FUN_00558f10(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x60000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591820(param_1,param_4);

        }

        FUN_0058efb0(param_1,param_4);

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,6,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00558fa0 at 0x00558FA0 (size: 130) ---


undefined4 FUN_00558fa0(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x70000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591920(param_1,param_4);

        }

        FUN_0058f050(param_1,param_4);

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,7,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00559030 at 0x00559030 (size: 119) ---


undefined4 FUN_00559030(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x30000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591da0(param_1,param_4);

        }

        if (DAT_008f958c != 0) {

          FUN_00694010(iVar1,3,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_005590b0 at 0x005590B0 (size: 114) ---


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



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x10000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591400(param_1);

        }

        if (DAT_008f958c != 0) {

          FUN_006940a0(iVar1,1,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00559130 at 0x00559130 (size: 114) ---


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



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0xe0000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591500(param_1);

        }

        if (DAT_008f958c != 0) {

          FUN_006940a0(iVar1,0xe,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_005591b0 at 0x005591B0 (size: 114) ---


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



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0xd0000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591610(param_1);

        }

        if (DAT_008f958c != 0) {

          FUN_006940a0(iVar1,0xd,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00559230 at 0x00559230 (size: 114) ---


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



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x20000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00591710(param_1);

        }

        if (DAT_008f958c != 0) {

          FUN_006940a0(iVar1,2,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_005592b0 at 0x005592B0 (size: 114) ---


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



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x50000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_005925f0(param_1);

        }

        if (DAT_008f958c != 0) {

          FUN_006940a0(iVar1,5,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00559330 at 0x00559330 (size: 114) ---


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



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x60000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00592220(param_1);

        }

        if (DAT_008f958c != 0) {

          FUN_006940a0(iVar1,6,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_005593b0 at 0x005593B0 (size: 114) ---


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



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x70000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_005918f0(param_1);

        }

        if (DAT_008f958c != 0) {

          FUN_006940a0(iVar1,7,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_00559430 at 0x00559430 (size: 114) ---


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



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005088e0(param_3);

  if (iVar1 != 0) {

    iVar2 = FUN_0058d410();

    if (iVar2 != 0) {

      iVar2 = FUN_006b3cb0(param_1 | 0x30000,param_2);

      if (iVar2 != 0) {

        if (*(int *)(iVar1 + 0x14c) != 0) {

          FUN_00592250(param_1);

        }

        if (DAT_008f958c != 0) {

          FUN_006940a0(iVar1,3,param_1);

        }

      }

    }

  }

  return 0;

}





// --- FUN_005594b0 at 0x005594B0 (size: 497) ---


int __thiscall

FUN_005594b0(int *param_1,uint param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5)



{

  uint uVar1;

  int iVar2;

  undefined4 *puVar3;

  int iVar4;

  int *piVar5;

  uint uVar6;

  undefined4 uVar7;

  

  uVar1 = param_2;

  for (iVar2 = *(int *)(param_1[0x24] +

                       ((param_2 >> ((byte)param_1[0x23] & 0x1f) ^ param_2) & param_1[0x22]) * 4);

      iVar2 != 0; iVar2 = *(int *)(iVar2 + 4)) {

    if (param_2 == *(uint *)(iVar2 + 8)) {

      return 0;

    }

  }

  iVar2 = *(int *)(param_1[0x30] +

                  ((param_2 >> ((byte)param_1[0x2f] & 0x1f) ^ param_2) & param_1[0x2e]) * 4);

  while( true ) {

    if (iVar2 == 0) {

      iVar2 = FUN_00509ab0(param_2,0);

      if (iVar2 == 0) {

        puVar3 = (undefined4 *)FUN_0051e280(&param_2);

        iVar2 = FUN_00514470(*puVar3,uVar1,1);

      }

      else {

        puVar3 = (undefined4 *)FUN_0051e280(&param_2);

        iVar4 = FUN_00514410(*puVar3);

        if (iVar4 == 0) {

          FUN_00508f30(iVar2);

          iVar2 = 0;

        }

        else {

          FUN_005085f0(*(undefined4 *)(iVar2 + 8));

          FUN_00508f10(*(undefined4 *)(iVar2 + 8));

        }

      }

      piVar5 = (int *)FUN_00509b60(uVar1,0);

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

        piVar5 = (int *)FUN_0054bb30(uVar1);

      }

      else {

        FUN_005085f0(piVar5[2]);

        FUN_00508f10(piVar5[2]);

        if (DAT_0083da58 == 0) {

          uVar6 = 0;

        }

        else {

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

        }

        if (uVar6 == uVar1) {

          (**(code **)(*piVar5 + 0x80))();

        }

      }

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

        FUN_00508850(piVar5);

        (**(code **)(*param_1 + 0x28))(piVar5,param_5,0);

      }

      if (iVar2 != 0) {

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

          FUN_0050ffa0(piVar5);

          FUN_00401dc0(iVar2);

        }

        iVar4 = FUN_00515a40(param_4,1);

        if (iVar4 != 0) {

          FUN_00510500(param_3);

          FUN_00509e40(iVar2,param_4);

          iVar4 = FUN_0051df90();

          if (iVar4 != 0) {

            param_2 = FUN_00508890(iVar4);

            uVar7 = FUN_0051dfa0();

            FUN_00516590(param_2,uVar7);

          }

          FUN_00508810(iVar2);

        }

      }

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

        FUN_006939a0(uVar1);

      }

      return iVar2;

    }

    if (param_2 == *(uint *)(iVar2 + 8)) break;

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

  }

  return 0;

}





// --- FUN_005596b0 at 0x005596B0 (size: 180) ---


void __thiscall FUN_005596b0(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  undefined4 uVar4;

  

  iVar1 = FUN_00508930(param_2);

  if (iVar1 == 0) {

    iVar1 = FUN_005df0f5(0x4c);

    if (iVar1 == 0) {

      iVar1 = 0;

    }

    else {

      iVar1 = FUN_006b5bc0(param_2);

    }

    uVar2 = (*(uint *)(iVar1 + 8) >> ((byte)*(undefined4 *)(param_1 + 0x1d4) & 0x1f) ^

            *(uint *)(iVar1 + 8)) & *(uint *)(param_1 + 0x1d0);

    *(undefined4 *)(iVar1 + 4) = *(undefined4 *)(*(int *)(param_1 + 0x1d8) + uVar2 * 4);

    *(int *)(*(int *)(param_1 + 0x1d8) + uVar2 * 4) = iVar1;

    iVar3 = FUN_005088e0(param_2);

    if (iVar3 != 0) {

      *(int *)(iVar3 + 0x50) = iVar1;

    }

  }

  FUN_005aef10();

  FUN_005aef10();

  for (iVar1 = *(int *)(param_3 + 4); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0xc)) {

    if (*(int *)(iVar1 + 8) == 0) {

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

    }

    else {

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

    }

    FUN_005aec00(uVar4);

  }

  return;

}





// --- FUN_00559770 at 0x00559770 (size: 60) ---


void FUN_00559770(undefined4 param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  iVar1 = FUN_005088e0(param_1);

  if (iVar1 != 0) {

    *(undefined4 *)(iVar1 + 0x50) = 0;

  }

  puVar2 = (undefined4 *)FUN_005085f0(param_1);

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

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_00559860 at 0x00559860 (size: 92) ---


void __fastcall FUN_00559860(undefined4 param_1)



{

  int *piVar1;

  undefined1 *puVar2;

  undefined *puVar3;

  int *piVar4;

  undefined4 uVar5;

  undefined1 local_c [4];

  int *local_8;

  undefined4 local_4;

  

  local_8 = (int *)0x0;

  local_4 = 0;

  FUN_00558190(local_c,param_1);

  piVar1 = local_8;

  uVar5 = 0;

  puVar2 = local_c;

  puVar3 = &DAT_007cc988;

  piVar4 = local_8;

  FUN_00406d10(puVar2,&DAT_007cc988,local_8,0);

  FUN_00406c90(puVar2,puVar3,piVar4,uVar5);

  FUN_005087c0();

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

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

  }

  return;

}





// --- FUN_005598c0 at 0x005598C0 (size: 28) ---


void FUN_005598c0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_005588c0(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_005598e0 at 0x005598E0 (size: 28) ---


void FUN_005598e0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00558940(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_00559900 at 0x00559900 (size: 28) ---


void FUN_00559900(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_005589c0(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_00559920 at 0x00559920 (size: 28) ---


void FUN_00559920(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00558a40(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_00559940 at 0x00559940 (size: 28) ---


void FUN_00559940(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00558ac0(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_00559960 at 0x00559960 (size: 28) ---


void FUN_00559960(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00558b40(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_00559980 at 0x00559980 (size: 28) ---


void FUN_00559980(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00558bc0(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_005599a0 at 0x005599A0 (size: 28) ---


void FUN_005599a0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00558c40(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_005599c0 at 0x005599C0 (size: 33) ---


void FUN_005599c0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

                 undefined4 param_5)



{

  FUN_00558cd0(param_3,param_1,param_2,param_4,param_5);

  return;

}





// --- FUN_005599f0 at 0x005599F0 (size: 28) ---


void FUN_005599f0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00558d50(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_00559a10 at 0x00559A10 (size: 33) ---


void FUN_00559a10(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

                 undefined4 param_5)



{

  FUN_00558de0(param_3,param_1,param_2,param_4,param_5);

  return;

}





// --- FUN_00559a40 at 0x00559A40 (size: 28) ---


void FUN_00559a40(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00558e60(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_00559a60 at 0x00559A60 (size: 28) ---


void FUN_00559a60(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00558f10(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_00559a80 at 0x00559A80 (size: 28) ---


void FUN_00559a80(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00558fa0(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_00559aa0 at 0x00559AA0 (size: 28) ---


void FUN_00559aa0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_00559030(param_3,param_1,param_2,param_4);

  return;

}





// --- FUN_00559ac0 at 0x00559AC0 (size: 43) ---


void FUN_00559ac0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_005588c0(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559af0 at 0x00559AF0 (size: 43) ---


void FUN_00559af0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558940(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559b20 at 0x00559B20 (size: 43) ---


void FUN_00559b20(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_005589c0(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559b50 at 0x00559B50 (size: 43) ---


void FUN_00559b50(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558a40(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559b80 at 0x00559B80 (size: 43) ---


void FUN_00559b80(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558ac0(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559bb0 at 0x00559BB0 (size: 43) ---


void FUN_00559bb0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558b40(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559be0 at 0x00559BE0 (size: 43) ---


void FUN_00559be0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558bc0(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559c10 at 0x00559C10 (size: 43) ---


void FUN_00559c10(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558c40(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559c40 at 0x00559C40 (size: 48) ---


void FUN_00559c40(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558cd0(param_2,param_1,uVar1,param_3,param_4);

  return;

}





// --- FUN_00559c70 at 0x00559C70 (size: 43) ---


void FUN_00559c70(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558d50(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559ca0 at 0x00559CA0 (size: 48) ---


void FUN_00559ca0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558de0(param_2,param_1,uVar1,param_3,param_4);

  return;

}





// --- FUN_00559cd0 at 0x00559CD0 (size: 43) ---


void FUN_00559cd0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558e60(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559d00 at 0x00559D00 (size: 43) ---


void FUN_00559d00(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558f10(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559d30 at 0x00559D30 (size: 43) ---


void FUN_00559d30(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00558fa0(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559d60 at 0x00559D60 (size: 43) ---


void FUN_00559d60(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083da58 == 0) {

    uVar1 = 0;

  }

  else {

    uVar1 = *(undefined4 *)(DAT_0083da58 + 0xf4);

  }

  FUN_00559030(param_2,param_1,uVar1,param_3);

  return;

}





// --- FUN_00559d90 at 0x00559D90 (size: 23) ---


void FUN_00559d90(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005590b0(param_3,param_1,param_2);

  return;

}





// --- FUN_00559db0 at 0x00559DB0 (size: 23) ---


void FUN_00559db0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00559130(param_3,param_1,param_2);

  return;

}





// --- FUN_00559dd0 at 0x00559DD0 (size: 23) ---


void FUN_00559dd0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005591b0(param_3,param_1,param_2);

  return;

}





// --- FUN_00559df0 at 0x00559DF0 (size: 23) ---


void FUN_00559df0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00559230(param_3,param_1,param_2);

  return;

}





// --- FUN_00559e10 at 0x00559E10 (size: 23) ---


void FUN_00559e10(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005592b0(param_3,param_1,param_2);

  return;

}





// --- FUN_00559e30 at 0x00559E30 (size: 23) ---


void FUN_00559e30(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00559330(param_3,param_1,param_2);

  return;

}





// --- FUN_00559e50 at 0x00559E50 (size: 23) ---


void FUN_00559e50(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005593b0(param_3,param_1,param_2);

  return;

}





// --- FUN_00559e70 at 0x00559E70 (size: 23) ---


void FUN_00559e70(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00559430(param_3,param_1,param_2);

  return;

}





// --- FUN_00559ec0 at 0x00559EC0 (size: 55) ---


void FUN_00559ec0(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083da58 != 0) {

    FUN_005590b0(param_2,param_1,*(undefined4 *)(DAT_0083da58 + 0xf4));

    return;

  }

  FUN_005590b0(param_2,param_1,0);

  return;

}





// --- FUN_00559f00 at 0x00559F00 (size: 55) ---


void FUN_00559f00(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083da58 != 0) {

    FUN_00559130(param_2,param_1,*(undefined4 *)(DAT_0083da58 + 0xf4));

    return;

  }

  FUN_00559130(param_2,param_1,0);

  return;

}





// --- FUN_00559f40 at 0x00559F40 (size: 55) ---


void FUN_00559f40(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083da58 != 0) {

    FUN_005591b0(param_2,param_1,*(undefined4 *)(DAT_0083da58 + 0xf4));

    return;

  }

  FUN_005591b0(param_2,param_1,0);

  return;

}





// --- FUN_00559f80 at 0x00559F80 (size: 55) ---


void FUN_00559f80(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083da58 != 0) {

    FUN_00559230(param_2,param_1,*(undefined4 *)(DAT_0083da58 + 0xf4));

    return;

  }

  FUN_00559230(param_2,param_1,0);

  return;

}





// --- FUN_00559fc0 at 0x00559FC0 (size: 55) ---


void FUN_00559fc0(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083da58 != 0) {

    FUN_005592b0(param_2,param_1,*(undefined4 *)(DAT_0083da58 + 0xf4));

    return;

  }

  FUN_005592b0(param_2,param_1,0);

  return;

}





// --- FUN_0055a000 at 0x0055A000 (size: 55) ---


void FUN_0055a000(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083da58 != 0) {

    FUN_00559330(param_2,param_1,*(undefined4 *)(DAT_0083da58 + 0xf4));

    return;

  }

  FUN_00559330(param_2,param_1,0);

  return;

}





// --- FUN_0055a040 at 0x0055A040 (size: 55) ---


void FUN_0055a040(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083da58 != 0) {

    FUN_005593b0(param_2,param_1,*(undefined4 *)(DAT_0083da58 + 0xf4));

    return;

  }

  FUN_005593b0(param_2,param_1,0);

  return;

}





// --- FUN_0055a080 at 0x0055A080 (size: 55) ---


void FUN_0055a080(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083da58 != 0) {

    FUN_00559430(param_2,param_1,*(undefined4 *)(DAT_0083da58 + 0xf4));

    return;

  }

  FUN_00559430(param_2,param_1,0);

  return;

}





// --- FUN_0055a0c0 at 0x0055A0C0 (size: 71) ---


void __fastcall FUN_0055a0c0(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[4];

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

      if (iVar1 == 0) {

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

      }

      else {

        *(undefined4 *)(iVar1 + 0x14) = 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_0055a110 at 0x0055A110 (size: 119) ---


int __thiscall FUN_0055a110(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  

  FUN_0055a0c0();

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

  while( true ) {

    if (iVar1 == 0) {

      return param_1;

    }

    puVar3 = (undefined4 *)FUN_005df0f5(0x18);

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

      puVar3 = (undefined4 *)0x0;

    }

    else {

      *puVar3 = &PTR_FUN_007acafc;

      puVar3[1] = *(undefined4 *)(iVar1 + 4);

      puVar3[2] = *(undefined4 *)(iVar1 + 8);

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

      puVar3[4] = 0;

      puVar3[5] = 0;

    }

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

      *(undefined4 **)(param_1 + 4) = puVar3;

    }

    else {

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

      *(undefined4 **)(iVar2 + 0x10) = puVar3;

      puVar3[5] = iVar2;

    }

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

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

    if (iVar1 == 0) break;

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

  }

  return param_1;

}





// --- FUN_0055a190 at 0x0055A190 (size: 26) ---


void FUN_0055a190(undefined4 param_1,undefined4 param_2)



{

  FUN_00508930(param_1);

  FUN_0055a110(param_2);

  return;

}





// --- FUN_0055a610 at 0x0055A610 (size: 30) ---


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



{

  FUN_00454920();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0055a690 at 0x0055A690 (size: 73) ---


void FUN_0055a690(void)



{

  undefined1 *Value;

  _OSVERSIONINFOA local_94;

  

  local_94.dwOSVersionInfoSize = 0x94;

  GetVersionExA(&local_94);

  if ((local_94.dwPlatformId != 2) || (Value = &LAB_00527400, local_94.dwMajorVersion < 5)) {

    Value = &LAB_0055a630;

  }

  InterlockedExchange((LONG *)&PTR_FUN_00820a9c,(LONG)Value);

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00820a9c)();

  return;

}





// --- FUN_0055a6e0 at 0x0055A6E0 (size: 87) ---


BSTR FUN_0055a6e0(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  BSTR pOVar3;

  

  (*(code *)PTR_FUN_00820a9c)();

  if (param_1 != 0) {

    uVar1 = (*(code *)PTR_FUN_00820a9c)();

    iVar2 = (*(code *)PTR_FUN_00837394)(uVar1,0,param_1,0xffffffff,0,0);

    pOVar3 = SysAllocStringLen((OLECHAR *)0x0,iVar2 - 1);

    if (pOVar3 != (BSTR)0x0) {

      (*(code *)PTR_FUN_00837394)(uVar1,0,param_1,0xffffffff,pOVar3,iVar2);

    }

    return pOVar3;

  }

  return (BSTR)0x0;

}





// --- FUN_0055a740 at 0x0055A740 (size: 15) ---


undefined4 FUN_0055a740(void)



{

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

    return *DAT_00871054;

  }

  return 0;

}





// --- FUN_0055a7d0 at 0x0055A7D0 (size: 12) ---


undefined4 FUN_0055a7d0(void)



{

  return 0x80004005;

}





// --- FUN_0055ae10 at 0x0055AE10 (size: 48) ---


LONG FUN_0055ae10(undefined4 *param_1)



{

  LONG LVar1;

  

  LVar1 = InterlockedDecrement(param_1 + 1);

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

    *param_1 = &PTR_LAB_007cd118;

    operator_delete(param_1);

  }

  return LVar1;

}





// --- FUN_0055aed0 at 0x0055AED0 (size: 42) ---


void __fastcall FUN_0055aed0(int param_1)



{

  undefined4 *puVar1;

  

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

    puVar1 = (undefined4 *)FUN_005df0f5(8);

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

      *puVar1 = &PTR_LAB_007cd118;

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

      return;

    }

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

  }

  return;

}





// --- FUN_0055af00 at 0x0055AF00 (size: 361) ---


undefined4 FUN_0055af00(void)



{

  char cVar1;

  LONG LVar2;

  int iVar3;

  HMODULE pHVar4;

  code *pcVar5;

  LPCSTR pCVar6;

  LPCSTR local_10;

  int local_c;

  int iStack_8;

  undefined4 uStack_4;

  

  local_10 = PTR_DAT_00818344;

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

  FUN_00401340("ACPlugin");

  cVar1 = FUN_006b0d60(&local_c,&local_10);

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

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

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

  }

  pCVar6 = local_10;

  if (cVar1 == '\0') {

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

  }

  else {

    pHVar4 = LoadLibraryA(local_10);

    if (pHVar4 == (HMODULE)0x0) {

      pCVar6 = local_10 + -0x14;

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

      if (LVar2 != 0) {

        return 0;

      }

      if (pCVar6 == (LPCSTR)0x0) {

        return 0;

      }

      (*(code *)**(undefined4 **)pCVar6)(1);

      return 0;

    }

    pcVar5 = (code *)(*(code *)PTR_FUN_00837388)(pHVar4,"CreateACPlugin");

    pCVar6 = local_10;

    if (pcVar5 != (code *)0x0) {

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

        DAT_00871054 = (int *)FUN_005df0f5(8);

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

          DAT_00871054 = (int *)0x0;

        }

        else {

          *DAT_00871054 = 0;

          DAT_00871054[1] = 0;

        }

      }

      iStack_8 = 0;

      uStack_4 = FUN_0055aed0();

      (*pcVar5)(&uStack_4,&iStack_8);

      if (*DAT_00871054 == 0) {

        *DAT_00871054 = iStack_8;

      }

      pCVar6 = local_10 + -0x14;

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

      if ((LVar2 == 0) && (pCVar6 != (LPCSTR)0x0)) {

        (*(code *)**(undefined4 **)pCVar6)(1);

      }

      return 1;

    }

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

  }

  if ((iVar3 == 0) && (pCVar6 + -0x14 != (LPCSTR)0x0)) {

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

  }

  return 0;

}





// --- FUN_0055b070 at 0x0055B070 (size: 39) ---


void FUN_0055b070(int param_1)



{

  if (((param_1 == 0) && (DAT_00871054 != 0)) && (*(int *)(DAT_00871054 + 4) != 0)) {

    FUN_0055aed0();

  }

  DAT_00871058 = param_1;

  return;

}





// --- FUN_0055b0a0 at 0x0055B0A0 (size: 64) ---


undefined4 FUN_0055b0a0(void)



{

  int *piVar1;

  undefined4 *puVar2;

  

  if ((DAT_00871054 != (int *)0x0) && (*DAT_00871054 != 0)) {

    piVar1 = DAT_00871054 + 1;

    puVar2 = (undefined4 *)*piVar1;

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

      puVar2 = (undefined4 *)FUN_005df0f5(8);

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

        puVar2 = (undefined4 *)0x0;

      }

      else {

        *puVar2 = &PTR_LAB_007cd118;

      }

      *piVar1 = (int)puVar2;

    }

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

      return 1;

    }

  }

  return 0;

}





// --- FUN_0055b160 at 0x0055B160 (size: 19) ---


void __fastcall FUN_0055b160(undefined4 *param_1)



{

  FUN_005b8c00();

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_0055b180 at 0x0055B180 (size: 102) ---


void __fastcall FUN_0055b180(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)param_1[6];

  *param_1 = &PTR_FUN_007cd440;

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  puVar1 = (undefined4 *)param_1[3];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  puVar1 = (undefined4 *)param_1[2];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_0055b1f0 at 0x0055B1F0 (size: 30) ---


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



{

  FUN_0055b180();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0055b2e0 at 0x0055B2E0 (size: 38) ---


void __fastcall FUN_0055b2e0(int param_1)



{

  uint uVar1;

  

  uVar1 = 0;

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

    do {

      (**(code **)(**(int **)(*(int *)(param_1 + 0x1c) + uVar1 * 4) + 0x20))();

      uVar1 = uVar1 + 1;

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

  }

  return;

}





// --- FUN_0055b310 at 0x0055B310 (size: 38) ---


void __fastcall FUN_0055b310(int param_1)



{

  uint uVar1;

  

  uVar1 = 0;

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

    do {

      (**(code **)(**(int **)(*(int *)(param_1 + 0x1c) + uVar1 * 4) + 0x24))();

      uVar1 = uVar1 + 1;

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

  }

  return;

}





// --- FUN_0055b340 at 0x0055B340 (size: 225) ---


void __fastcall FUN_0055b340(int param_1)



{

  uint uVar1;

  

  uVar1 = 0;

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

    do {

      (**(code **)(**(int **)(*(int *)(param_1 + 0x1c) + uVar1 * 4) + 0x28))();

      uVar1 = uVar1 + 1;

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x28) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x2c) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x30) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x34) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x38) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x3c) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x40) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x44) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x48) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x4c) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x50) + 0x14))();

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

  }

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

    (**(code **)(**(int **)(param_1 + 0x54) + 0x14))();

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

  }

  FUN_004fd160();

  return;

}





// --- FUN_0055b430 at 0x0055B430 (size: 98) ---


void __fastcall FUN_0055b430(int *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  LONG LVar3;

  undefined4 *puVar4;

  

  iVar1 = param_1[3];

  *(undefined1 *)(param_1 + 5) = 1;

  while (iVar1 != 0) {

    puVar2 = (undefined4 *)param_1[3];

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      iVar1 = puVar2[1];

      param_1[3] = iVar1;

      if (iVar1 == 0) {

        param_1[4] = 0;

      }

      puVar4 = (undefined4 *)*puVar2;

      operator_delete(puVar2);

    }

    (**(code **)(*param_1 + 0x28))(puVar4);

    LVar3 = InterlockedDecrement(puVar4 + 1);

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

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

    }

    iVar1 = param_1[3];

  }

  return;

}





// --- FUN_0055b4a0 at 0x0055B4A0 (size: 73) ---


uint __thiscall FUN_0055b4a0(int param_1,int *param_2,uint param_3)



{

  int *piVar1;

  uint uVar2;

  

  uVar2 = FUN_0055b4f0();

  if (uVar2 <= param_3) {

    if (3 < param_3) {

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

      *param_2 = *param_2 + 4;

    }

    for (piVar1 = *(int **)(param_1 + 4); piVar1 != (int *)0x0; piVar1 = (int *)piVar1[3]) {

      (**(code **)(*piVar1 + 0xc))(param_2,param_3);

    }

  }

  return uVar2;

}





// --- FUN_0055b4f0 at 0x0055B4F0 (size: 52) ---


int __fastcall FUN_0055b4f0(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[3]) {

    iVar2 = (**(code **)(*piVar1 + 0xc))(&local_4,0);

    iVar3 = iVar3 + iVar2;

  }

  return iVar3;

}





// --- FUN_0055b530 at 0x0055B530 (size: 97) ---


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



{

  FUN_004fd170();

  *param_1 = &PTR_LAB_007cd454;

  param_1[2] = 1;

  param_1[1] = &PTR_LAB_00793b6c;

  param_1[3] = 0;

  param_1[4] = 0;

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

  param_1[6] = param_2;

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

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  return param_1;

}





// --- FUN_0055b5a0 at 0x0055B5A0 (size: 59) ---


void __fastcall FUN_0055b5a0(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007cd454;

  if ((param_1[8] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[7]);

  }

  FUN_004c65a0();

  param_1[1] = &PTR_LAB_00793b6c;

  FUN_004fd150();

  return;

}





// --- FUN_0055b5e0 at 0x0055B5E0 (size: 98) ---


void __thiscall FUN_0055b5e0(int param_1,int param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0x14);

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

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = &PTR_FUN_007cd42c;

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

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

    puVar2[3] = 0;

    puVar2[4] = 0;

  }

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

    *(undefined4 **)(param_1 + 4) = puVar2;

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

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

    return;

  }

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

  *(undefined4 **)(iVar1 + 0xc) = puVar2;

  puVar2[4] = iVar1;

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

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

  return;

}





// --- FUN_0055b650 at 0x0055B650 (size: 294) ---


undefined4 __thiscall FUN_0055b650(int param_1,int *param_2,int param_3,undefined4 *param_4)



{

  undefined4 uVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  undefined4 *puVar5;

  LONG LVar6;

  undefined4 uVar7;

  

  iVar4 = (int)param_4;

  piVar3 = param_2;

  if (*(int *)(param_1 + 0x30) == 0) {

    return 0;

  }

  if (param_4 != (undefined4 *)*param_2) {

    return 0;

  }

  iVar2 = param_2[1];

  puVar5 = (undefined4 *)((int)param_2 + 5);

  uVar7 = 0;

  if (param_4 == (undefined4 *)0x2d6) {

    uVar7 = *puVar5;

    puVar5 = (undefined4 *)((int)param_2 + 9);

  }

  uVar1 = *puVar5;

  param_2 = puVar5 + 1;

  FUN_004fd1b0(&param_2);

  param_4 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  FUN_004fd460(&param_2,(int)piVar3 + (param_3 - (int)param_2));

  if (iVar4 == 0x2d6) {

    uVar7 = FUN_00559a40((char)iVar2,uVar7,uVar1,&param_4);

    puVar5 = param_4;

    LVar6 = InterlockedDecrement(param_4 + 1);

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

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

      return uVar7;

    }

  }

  else {

    uVar7 = FUN_00559cd0((char)iVar2,uVar1,&param_4);

    puVar5 = param_4;

    LVar6 = InterlockedDecrement(param_4 + 1);

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

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

    }

  }

  return uVar7;

}





// --- FUN_0055b780 at 0x0055B780 (size: 104) ---


void __fastcall FUN_0055b780(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  FUN_006b0dc0();

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

  while (iVar1 != 0) {

    puVar2 = *(undefined4 **)(param_1 + 4);

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

      iVar1 = puVar2[3];

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

      if (iVar1 == 0) {

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

      }

      else {

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

      }

      *puVar2 = &PTR_FUN_0079385c;

      operator_delete(puVar2);

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

    }

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

  }

  return;

}





// --- FUN_0055b7f0 at 0x0055B7F0 (size: 43) ---


int __fastcall FUN_0055b7f0(void *param_1)



{

  int iVar1;

  

  iVar1 = FUN_00401ea0();

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

    FUN_0055b5a0();

    operator_delete(param_1);

  }

  return iVar1;

}





// --- FUN_0055bc00 at 0x0055BC00 (size: 22) ---


void __fastcall FUN_0055bc00(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007cd418;

  FUN_0055b780();

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_0055bc20 at 0x0055BC20 (size: 123) ---


undefined4 FUN_0055bc20(int *param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int local_c [3];

  

  FUN_0055b780();

  if (param_2 < 4) {

    return 0;

  }

  iVar1 = *(int *)*param_1;

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

  FUN_006b0dc0();

  iVar3 = 0;

  if (0 < iVar1) {

    do {

      iVar2 = (**(code **)(local_c[0] + 0x10))(param_1,param_2);

      if (iVar2 == 0) {

        return 0;

      }

      FUN_0055b5e0(local_c);

      iVar3 = iVar3 + 1;

    } while (iVar3 < iVar1);

  }

  return 1;

}





// --- FUN_0055bca0 at 0x0055BCA0 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007cd418;

  FUN_0055b780();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0055bcd0 at 0x0055BCD0 (size: 6825) ---


undefined4 __thiscall FUN_0055bcd0(int param_1,uint *param_2,int param_3)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 uVar3;

  uint *puVar4;

  uint *puVar5;

  uint *puVar6;

  undefined4 *puVar7;

  undefined4 *puVar8;

  uint uVar9;

  undefined4 uVar10;

  uint uVar11;

  int local_1c0;

  uint local_1bc;

  uint local_1b8;

  uint local_1b4;

  undefined **local_1b0;

  uint local_1ac;

  undefined4 local_1a8;

  undefined4 local_1a4;

  undefined1 local_1a0 [36];

  undefined1 local_17c [100];

  undefined1 local_118 [280];

  

  iVar2 = param_3;

  puVar5 = param_2;

  uVar9 = *param_2;

  puVar4 = param_2 + 1;

  if (uVar9 < 0x27b) {

    if (uVar9 == 0x27a) {

      param_2 = puVar4;

      uVar3 = FUN_006a7880(param_1,puVar5,param_3);

      return uVar3;

    }

    if (uVar9 < 0x1ca) {

      if (uVar9 == 0x1c9) {

        param_2 = puVar4;

        uVar3 = FUN_006a6e70(param_1,puVar5,param_3);

        return uVar3;

      }

      if (uVar9 < 0xc4) {

        if (uVar9 == 0xc3) {

          param_2 = puVar4;

          FUN_00411850();

          FUN_00411850();

          FUN_00411850();

          param_2 = param_2 + 1;

          FUN_004fd460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          param_2 = param_2 + 1;

          FUN_004fd460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          FUN_004fd460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          FUN_005abb30();

          FUN_005abb30();

          FUN_005abb30();

          return 0;

        }

        switch(uVar9) {

        case 3:

          param_2 = puVar4;

          uVar3 = FUN_006a78b0(param_1,puVar5,param_3);

          return uVar3;

        case 4:

          param_2 = puVar4;

          uVar3 = FUN_006a5e00(param_1,puVar5,param_3);

          return uVar3;

        case 0x13:

          param_2 = puVar4;

          FUN_00564440(puVar4,param_3);

          FUN_0055b430();

          FUN_0055b2e0();

          return 0;

        case 0x20:

          param_2 = puVar4;

          FUN_0059a080();

          uVar9 = *param_2;

          param_2 = param_2 + 1;

          FUN_005b7c80(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          FUN_0056aec0(local_118,uVar9);

          FUN_005b8c00();

          return 0;

        case 0x21:

          param_2 = puVar4;

          uVar3 = FUN_006a6d30(param_1,puVar5,param_3);

          return uVar3;

        case 0x22:

          uVar9 = *puVar4;

          uVar11 = param_2[2];

          local_1b8 = param_2[3];

          local_1b0 = (undefined **)param_2[4];

          param_2 = param_2 + 5;

          iVar2 = FUN_005088e0(uVar9);

          if (iVar2 != 0) {

            FUN_0058e9e0(uVar11,local_1b8,0,0,1);

            return 0;

          }

          iVar2 = FUN_005088e0(uVar11);

          if (iVar2 != 0) {

            FUN_0058cc70(uVar9,local_1b8,local_1b0);

          }

          FUN_004fd0f0(uVar9,0,0,0,uVar11,local_1b8,0,0);

          return 0;

        case 0x23:

          uVar9 = *puVar4;

          uVar11 = param_2[2];

          param_2 = param_2 + 3;

          iVar2 = FUN_005088e0(uVar9);

          if (iVar2 != 0) {

            uVar10 = 1;

            uVar3 = FUN_0048e5f0(uVar11,1);

            FUN_0058e9e0(0,0,uVar3,uVar11,uVar10);

            return 0;

          }

          uVar3 = FUN_0048e5f0(uVar11);

LAB_0055c4d8:

          FUN_004fd0f0(uVar9,0,0,0,0,0,uVar3,uVar11);

          return 0;

        case 0x24:

          uVar9 = *puVar4;

          param_2 = param_2 + 2;

          iVar2 = FUN_005088e0(uVar9);

          if (iVar2 != 0) {

            thunk_FUN_0058eb50();

            FUN_0058d7d0();

            FUN_00509a40(uVar9);

            return 0;

          }

          FUN_004fd0f0(uVar9,0,0,0,0,0,0,0);

          return 0;

        case 0x29:

          param_2 = puVar4;

          uVar3 = FUN_006a6cb0(param_1,puVar5,param_3);

          return uVar3;

        case 0x2b:

          param_2 = puVar4;

          uVar3 = FUN_006a6420(param_1,puVar5,param_3);

          return uVar3;

        case 0x52:

          uVar9 = *puVar4;

          param_2 = param_2 + 2;

          if (uVar9 == *(uint *)(*(int *)(param_1 + 0x34) + 0x18)) {

            FUN_005652b0(0,0);

            FUN_0058d8e0(uVar9);

          }

          FUN_00559770(uVar9);

          return 0;

        case 0x62:

          param_2 = puVar4;

          FUN_00566ab0(puVar4,param_3);

          return 0;

        case 0x75:

          param_2 = puVar4;

          uVar3 = FUN_006a2bf0(param_1,puVar5,param_3);

          return uVar3;

        case 0xa0:

          uVar9 = param_2[2];

          param_2 = param_2 + 3;

          uVar11 = *puVar4;

          if (DAT_00871ed4 != 0) {

            uVar11 = DAT_00871ed4;

          }

          iVar2 = FUN_005088e0(uVar11);

          if (iVar2 != 0) {

            FUN_0058f910(uVar9,1);

          }

          if ((((uVar9 != 0x43e) && (uVar9 != 0x46a)) && (uVar9 != 0x4cf)) &&

             (((uVar9 != 0x3ef && (uVar9 != 0x2b)) && ((uVar9 != 0x1e && (uVar9 != 0x4ce)))))) {

            FUN_00572760(uVar9,&DAT_0083774c);

            return 0;

          }

          break;

        case 0xa3:

          param_2 = puVar4;

          uVar3 = FUN_006a6ea0(param_1,puVar5,param_3);

          return uVar3;

        case 0xa4:

          param_2 = puVar4;

          uVar3 = FUN_006a6e10(param_1,puVar5,param_3);

          return uVar3;

        case 0xb4:

          param_2 = puVar4;

          FUN_005d2df0();

          FUN_00411850();

          FUN_00411850();

          uVar9 = *param_2;

          local_1bc = param_2[1];

          param_2 = param_2 + 2;

          FUN_005d30b0(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          FUN_004fd460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          local_1b0 = (undefined **)*param_2;

          param_2 = param_2 + 1;

          FUN_004fd460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          FUN_005088e0(uVar9);

          FUN_006aa670(uVar9,local_1bc,local_1a0,&local_1c0,local_1b0,&local_1b8);

          FUN_005abb30();

          FUN_005abb30();

          FUN_005d3090();

          return 0;

        case 0xb6:

          puVar5 = param_2 + 2;

          puVar6 = param_2 + 3;

          param_2 = param_2 + 4;

          FUN_006aa550(*puVar4,*puVar5,*puVar6);

          return 0;

        case 0xb7:

          puVar5 = param_2 + 2;

          puVar6 = param_2 + 3;

          param_2 = param_2 + 4;

          FUN_006aa5b0(*puVar4,*puVar5,*puVar6);

          return 0;

        case 0xb8:

          param_2 = puVar4;

          FUN_005d2fc0();

          uVar9 = *param_2;

          uVar11 = param_2[1];

          param_2 = param_2 + 2;

          FUN_005d3460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          FUN_006aa610(uVar9,uVar11,local_1a0);

          FUN_0055b180();

          return 0;

        }

      }

      else {

        switch(uVar9) {

        case 0xc9:

          param_2 = puVar4;

          FUN_005b4350();

          uVar9 = *param_2;

          param_2 = param_2 + 1;

          FUN_005b4a30(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          FUN_006b05b0(uVar9,local_17c);

          FUN_005b4390();

          return 0;

        case 0x147:

          param_2 = puVar4;

          uVar3 = FUN_006a5830(param_1,puVar5,param_3);

          return uVar3;

        case 0x148:

          param_2 = puVar4;

          uVar3 = FUN_006a6390(param_1,puVar5,param_3);

          return uVar3;

        case 0x149:

          param_2 = puVar4;

          uVar3 = FUN_006a6300(param_1,puVar5,param_3);

          return uVar3;

        case 0x196:

          local_1b0 = &PTR_FUN_007cd418;

          local_1ac = 0;

          local_1a8 = 0;

          local_1a4 = 0;

          uVar9 = param_2[1];

          iVar2 = (int)param_2 + (param_3 - (int)(param_2 + 2));

          param_2 = param_2 + 2;

          FUN_0055bc20(&param_2,iVar2);

          FUN_00566610(uVar9,&local_1b0);

          FUN_0055bc00();

          return 0;

        case 0x197:

          puVar7 = (undefined4 *)((int)param_2 + 9);

          local_1bc = CONCAT31(local_1bc._1_3_,(char)*puVar4);

          puVar1 = (undefined4 *)((int)param_2 + 5);

          puVar8 = (undefined4 *)((int)param_2 + 0xd);

          param_2 = (uint *)((int)param_2 + 0x11);

          FUN_005587e0(local_1bc,*puVar1,*puVar7,*puVar8);

          return 0;

        case 0x19a:

          uVar9 = *puVar4;

          param_2 = param_2 + 2;

          iVar2 = FUN_005088e0(uVar9);

          if (iVar2 != 0) {

            FUN_0058e9e0(0,0,0,0,1);

            return 0;

          }

          uVar11 = 0;

          uVar3 = 0;

          goto LAB_0055c4d8;

        case 0x19e:

          param_2 = puVar4;

          FUN_0056d070(puVar4,param_3);

          return 0;

        case 0x1a7:

          param_2 = param_2 + 2;

          FUN_0056d250(*puVar4);

          return 0;

        case 0x1a8:

          param_2 = puVar4;

          uVar3 = FUN_006a3e00(param_1,puVar5,param_3);

          return uVar3;

        case 0x1ac:

          param_2 = puVar4;

          FUN_0056d160(puVar4,param_3);

          return 0;

        case 0x1ad:

          param_2 = puVar4;

          FUN_0056d160(puVar4,param_3);

          return 0;

        case 0x1b1:

          param_2 = puVar4;

          FUN_00411850();

          FUN_004fd460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          uVar9 = *param_2;

          local_1b0 = (undefined **)param_2[1];

          local_1ac = param_2[2];

          puVar5 = param_2 + 3;

          local_1bc = param_2[4];

          puVar4 = param_2 + 5;

          param_2 = param_2 + 6;

          FUN_0056c160(&local_1c0,uVar9,local_1b0,local_1ac,*puVar5,local_1bc,*puVar4,

                       (int)*puVar4 >> 0x1f);

          FUN_005abb30();

          return 0;

        case 0x1b2:

          param_2 = puVar4;

          FUN_00411850();

          FUN_004fd460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          uVar9 = *param_2;

          local_1b8 = param_2[1];

          local_1b4 = param_2[2];

          puVar5 = param_2 + 3;

          local_1b0 = (undefined **)param_2[4];

          local_1bc = param_2[5];

          puVar4 = param_2 + 6;

          param_2 = param_2 + 7;

          FUN_0056d670(&local_1c0,uVar9,local_1b8,local_1b4,*puVar5,local_1b0,local_1bc,*puVar4,

                       (int)*puVar4 >> 0x1f);

          FUN_005abb30();

          return 0;

        case 0x1b3:

          param_2 = puVar4;

          FUN_00411850();

          FUN_004fd460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          FUN_0056d4f0(&local_1c0);

          FUN_005abb30();

          return 0;

        case 0x1b4:

          param_2 = puVar4;

          FUN_00411850();

          FUN_004fd460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

          FUN_0056d370(&local_1c0);

          FUN_005abb30();

          return 0;

        case 0x1b8:

          param_2 = puVar4;

          FUN_0056ba60();

          return 0;

        case 0x1c0:

          param_2 = puVar4;

          uVar3 = FUN_006aa900(param_1,puVar5,param_3);

          return uVar3;

        case 0x1c3:

          param_2 = puVar4;

          uVar3 = FUN_006a3c60(param_1,puVar5,param_3);

          return uVar3;

        case 0x1c7:

          param_2 = puVar4;

          uVar3 = FUN_006a9470(param_1,puVar5,param_3);

          return uVar3;

        }

      }

    }

    else {

      switch(uVar9) {

      case 0x1ca:

        param_2 = puVar4;

        uVar3 = FUN_006a6e40(param_1,puVar5,param_3);

        return uVar3;

      case 0x1cb:

        param_2 = puVar4;

        uVar3 = FUN_006a9400(param_1,puVar5,param_3);

        return uVar3;

      case 0x1d1:

        param_2 = puVar4;

        uVar3 = FUN_006af610(param_1,puVar5,param_3);

        return uVar3;

      case 0x1d2:

        param_2 = puVar4;

        uVar3 = FUN_006afc60(param_1,puVar5,param_3);

        return uVar3;

      case 0x1d3:

        param_2 = puVar4;

        uVar3 = FUN_006af4d0(param_1,puVar5,param_3);

        return uVar3;

      case 0x1d4:

        param_2 = puVar4;

        uVar3 = FUN_006afb20(param_1,puVar5,param_3);

        return uVar3;

      case 0x1d5:

        param_2 = puVar4;

        uVar3 = FUN_006af550(param_1,puVar5,param_3);

        return uVar3;

      case 0x1d6:

        param_2 = puVar4;

        uVar3 = FUN_006afba0(param_1,puVar5,param_3);

        return uVar3;

      case 0x1d7:

        param_2 = puVar4;

        uVar3 = FUN_006af690(param_1,puVar5,param_3);

        return uVar3;

      case 0x1d8:

        param_2 = puVar4;

        uVar3 = FUN_006afce0(param_1,puVar5,param_3);

        return uVar3;

      case 0x1d9:

        param_2 = puVar4;

        uVar3 = FUN_006af510(param_1,puVar5,param_3);

        return uVar3;

      case 0x1da:

        param_2 = puVar4;

        uVar3 = FUN_006afb60(param_1,puVar5,param_3);

        return uVar3;

      case 0x1db:

        param_2 = puVar4;

        uVar3 = FUN_006af590(param_1,puVar5,param_3);

        return uVar3;

      case 0x1dc:

        param_2 = puVar4;

        uVar3 = FUN_006afbe0(param_1,puVar5,param_3);

        return uVar3;

      case 0x1dd:

        param_2 = puVar4;

        uVar3 = FUN_006af650(param_1,puVar5,param_3);

        return uVar3;

      case 0x1de:

        param_2 = puVar4;

        uVar3 = FUN_006afca0(param_1,puVar5,param_3);

        return uVar3;

      case 0x1e0:

        param_2 = puVar4;

        uVar3 = FUN_006a5a20(param_1,puVar5,param_3);

        return uVar3;

      case 0x1e2:

        param_2 = puVar4;

        uVar3 = FUN_006a5c20(param_1,puVar5,param_3);

        return uVar3;

      case 0x1ea:

        param_2 = puVar4;

        uVar3 = FUN_006a1ca0(param_1,puVar5,param_3);

        return uVar3;

      case 500:

        param_2 = puVar4;

        uVar3 = FUN_006a4840(param_1,puVar5,param_3);

        return uVar3;

      case 0x1fd:

        param_2 = puVar4;

        uVar3 = FUN_006ade80(param_1,puVar5,param_3);

        return uVar3;

      case 0x1fe:

        param_2 = puVar4;

        uVar3 = FUN_006ade50(param_1,puVar5,param_3);

        return uVar3;

      case 0x1ff:

        param_2 = puVar4;

        uVar3 = FUN_006addf0(param_1,puVar5,param_3);

        return uVar3;

      case 0x200:

        param_2 = puVar4;

        uVar3 = FUN_006add80(param_1,puVar5,param_3);

        return uVar3;

      case 0x201:

        param_2 = puVar4;

        uVar3 = FUN_006adee0(param_1,puVar5,param_3);

        return uVar3;

      case 0x202:

        param_2 = puVar4;

        uVar3 = FUN_006add50(param_1,puVar5,param_3);

        return uVar3;

      case 0x203:

        param_2 = puVar4;

        uVar3 = FUN_006ade20(param_1,puVar5,param_3);

        return uVar3;

      case 0x205:

        param_2 = puVar4;

        uVar3 = FUN_006adf10(param_1,puVar5,param_3);

        return uVar3;

      case 0x207:

        param_2 = puVar4;

        uVar3 = FUN_006adf40(param_1,puVar5,param_3);

        return uVar3;

      case 0x208:

        param_2 = puVar4;

        uVar3 = FUN_006addc0(param_1,puVar5,param_3);

        return uVar3;

      case 0x21d:

        param_2 = puVar4;

        uVar3 = FUN_006ac5e0(param_1,puVar5,param_3);

        return uVar3;

      case 0x225:

        param_2 = puVar4;

        uVar3 = FUN_006ac700(param_1,puVar5,param_3);

        return uVar3;

      case 0x226:

        param_2 = puVar4;

        uVar3 = FUN_006ab280(param_1,puVar5,param_3);

        return uVar3;

      case 0x227:

        param_2 = puVar4;

        uVar3 = FUN_006ab360(param_1,puVar5,param_3);

        return uVar3;

      case 0x228:

        param_2 = puVar4;

        uVar3 = FUN_006ac670(param_1,puVar5,param_3);

        return uVar3;

      case 0x248:

        param_2 = puVar4;

        uVar3 = FUN_006ab390(param_1,puVar5,param_3);

        return uVar3;

      case 599:

        param_2 = puVar4;

        uVar3 = FUN_006ab2e0(param_1,puVar5,param_3);

        return uVar3;

      case 0x259:

        param_2 = puVar4;

        uVar3 = FUN_006ab2b0(param_1,puVar5,param_3);

        return uVar3;

      case 0x264:

        param_2 = puVar4;

        uVar3 = FUN_006a9430(param_1,puVar5,param_3);

        return uVar3;

      case 0x271:

        param_2 = puVar4;

        uVar3 = FUN_006ac500(param_1,puVar5,param_3);

        return uVar3;

      case 0x274:

        param_2 = puVar4;

        uVar3 = FUN_006a3bb0(param_1,puVar5,param_3);

        return uVar3;

      case 0x276:

        param_2 = puVar4;

        uVar3 = FUN_006a1c40(param_1,puVar5,param_3);

        return uVar3;

      }

    }

  }

  else if (uVar9 < 0x2d7) {

    if (0x2d4 < uVar9) {

      param_2 = puVar4;

      FUN_0055b650(puVar5,param_3,uVar9);

      return 0;

    }

    switch(uVar9) {

    case 0x27c:

      param_2 = puVar4;

      uVar3 = FUN_006a83d0(param_1,puVar5,param_3);

      return uVar3;

    case 0x281:

      param_2 = puVar4;

      uVar3 = FUN_006a9880(param_1,puVar5,param_3);

      return uVar3;

    case 0x282:

      param_2 = puVar4;

      uVar3 = FUN_006a9920(param_1,puVar5,param_3);

      return uVar3;

    case 0x283:

      param_2 = puVar4;

      uVar3 = FUN_006a98b0(param_1,puVar5,param_3);

      return uVar3;

    case 0x284:

      param_2 = puVar4;

      uVar3 = FUN_006a9de0(param_1,puVar5,param_3);

      return uVar3;

    case 0x285:

      param_2 = puVar4;

      uVar3 = FUN_006a98e0(param_1,puVar5,param_3);

      return uVar3;

    case 0x28a:

      param_2 = puVar4;

      uVar3 = FUN_006a48c0(param_1,puVar5,param_3);

      return uVar3;

    case 0x28b:

      param_2 = puVar4;

      uVar3 = FUN_006a5fd0(param_1,puVar5,param_3);

      return uVar3;

    case 0x28c:

      param_2 = puVar4;

      uVar3 = FUN_006a9850(param_1,puVar5,param_3);

      return uVar3;

    case 0x295:

      param_2 = puVar4;

      uVar3 = FUN_006a4dd0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2ae:

      param_2 = puVar4;

      uVar3 = FUN_006ae8a0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2b1:

      param_2 = puVar4;

      uVar3 = FUN_006aec70(param_1,puVar5,param_3);

      return uVar3;

    case 0x2b3:

      param_2 = puVar4;

      uVar3 = FUN_006aed10(param_1,puVar5,param_3);

      return uVar3;

    case 0x2b4:

      param_2 = puVar4;

      uVar3 = FUN_006ad580(param_1,puVar5,param_3);

      return uVar3;

    case 0x2b8:

      param_2 = puVar4;

      uVar3 = FUN_006af5d0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2b9:

      param_2 = puVar4;

      uVar3 = FUN_006afc20(param_1,puVar5,param_3);

      return uVar3;

    case 699:

      param_2 = puVar4;

      uVar3 = FUN_006a5d10(param_1,puVar5,param_3);

      return uVar3;

    case 700:

      param_2 = puVar4;

      uVar3 = FUN_006a5b10(param_1,puVar5,param_3);

      return uVar3;

    case 0x2bd:

      param_2 = puVar4;

      uVar3 = FUN_006a5920(param_1,puVar5,param_3);

      return uVar3;

    case 0x2be:

      param_2 = puVar4;

      uVar3 = FUN_006a7800(param_1,puVar5,param_3);

      return uVar3;

    case 0x2bf:

      param_2 = puVar4;

      uVar3 = FUN_006a6de0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2c0:

      param_2 = puVar4;

      uVar3 = FUN_006a7660(param_1,puVar5,param_3);

      return uVar3;

    case 0x2c1:

      param_2 = puVar4;

      uVar3 = FUN_006a3e30(param_1,puVar5,param_3);

      return uVar3;

    case 0x2c2:

      param_2 = puVar4;

      uVar3 = FUN_006a4110(param_1,puVar5,param_3);

      return uVar3;

    case 0x2c3:

      param_2 = puVar4;

      uVar3 = FUN_006a3dd0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2c4:

      param_2 = puVar4;

      uVar3 = FUN_006a47b0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2c5:

      param_2 = puVar4;

      uVar3 = FUN_006a4720(param_1,puVar5,param_3);

      return uVar3;

    case 0x2c6:

      param_2 = puVar4;

      uVar3 = FUN_006a3da0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2c7:

      param_2 = puVar4;

      uVar3 = FUN_006a3d40(param_1,puVar5,param_3);

      return uVar3;

    case 0x2c8:

      param_2 = puVar4;

      uVar3 = FUN_006a4690(param_1,puVar5,param_3);

      return uVar3;

    case 0x2c9:

      param_2 = puVar4;

      uVar3 = FUN_006b03e0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2ca:

      param_2 = puVar4;

      uVar3 = FUN_006b0410(param_1,puVar5,param_3);

      return uVar3;

    case 0x2cb:

      param_2 = puVar4;

      uVar3 = FUN_006b03b0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2cc:

      param_2 = puVar4;

      uVar3 = FUN_006b0440(param_1,puVar5,param_3);

      return uVar3;

    case 0x2cd:

      param_2 = puVar4;

      uVar3 = FUN_006af960(param_1,puVar5,param_3);

      return uVar3;

    case 0x2ce:

      param_2 = puVar4;

      uVar3 = FUN_006b0000(param_1,puVar5,param_3);

      return uVar3;

    case 0x2cf:

      param_2 = puVar4;

      uVar3 = FUN_006af9a0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2d0:

      param_2 = puVar4;

      uVar3 = FUN_006b0050(param_1,puVar5,param_3);

      return uVar3;

    case 0x2d1:

      param_2 = puVar4;

      uVar3 = FUN_006af880(param_1,puVar5,param_3);

      return uVar3;

    case 0x2d2:

      param_2 = puVar4;

      uVar3 = FUN_006aff00(param_1,puVar5,param_3);

      return uVar3;

    case 0x2d3:

      param_2 = puVar4;

      uVar3 = FUN_006af8c0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2d4:

      param_2 = puVar4;

      uVar3 = FUN_006aff50(param_1,puVar5,param_3);

      return uVar3;

    }

  }

  else if (uVar9 < 0xea61) {

    if (uVar9 == 60000) {

      param_2 = puVar4;

      uVar3 = FUN_006ae870(param_1,puVar5,param_3);

      return uVar3;

    }

    switch(uVar9) {

    case 0x2d7:

      param_2 = puVar4;

      uVar3 = FUN_006b01f0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2d8:

      param_2 = puVar4;

      uVar3 = FUN_006b02c0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2d9:

      param_2 = puVar4;

      uVar3 = FUN_006af920(param_1,puVar5,param_3);

      return uVar3;

    case 0x2da:

      param_2 = puVar4;

      uVar3 = FUN_006affb0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2db:

      param_2 = puVar4;

      uVar3 = FUN_006b0230(param_1,puVar5,param_3);

      return uVar3;

    case 0x2dc:

      param_2 = puVar4;

      uVar3 = FUN_006b0310(param_1,puVar5,param_3);

      return uVar3;

    case 0x2dd:

      param_2 = puVar4;

      uVar3 = FUN_006af9f0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2de:

      param_2 = puVar4;

      uVar3 = FUN_006b00a0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2df:

      param_2 = puVar4;

      uVar3 = FUN_006afae0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2e0:

      param_2 = puVar4;

      uVar3 = FUN_006b01a0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2e1:

      param_2 = puVar4;

      uVar3 = FUN_006afaa0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2e2:

      param_2 = puVar4;

      uVar3 = FUN_006b0150(param_1,puVar5,param_3);

      return uVar3;

    case 0x2e3:

      param_2 = puVar4;

      uVar3 = FUN_006af6d0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2e4:

      param_2 = puVar4;

      uVar3 = FUN_006afd20(param_1,puVar5,param_3);

      return uVar3;

    case 0x2e5:

      param_2 = puVar4;

      uVar3 = FUN_006af840(param_1,puVar5,param_3);

      return uVar3;

    case 0x2e6:

      param_2 = puVar4;

      uVar3 = FUN_006afeb0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2e7:

      param_2 = puVar4;

      uVar3 = FUN_006af770(param_1,puVar5,param_3);

      return uVar3;

    case 0x2e8:

      param_2 = puVar4;

      uVar3 = FUN_006afdc0(param_1,puVar5,param_3);

      return uVar3;

    case 0x2e9:

      param_2 = puVar4;

      uVar3 = FUN_006af800(param_1,puVar5,param_3);

      return uVar3;

    case 0x2ea:

      param_2 = puVar4;

      uVar3 = FUN_006afe60(param_1,puVar5,param_3);

      return uVar3;

    case 0x2eb:

      param_2 = puVar4;

      uVar3 = FUN_006a5f30(param_1,puVar5,param_3);

      return uVar3;

    case 0x312:

      param_2 = puVar4;

      uVar3 = FUN_006a3d70(param_1,puVar5,param_3);

      return uVar3;

    case 0x314:

      param_2 = puVar4;

      uVar3 = FUN_006a6c30(param_1,puVar5,param_3);

      return uVar3;

    case 0x315:

      param_2 = puVar4;

      uVar3 = FUN_006a6750(param_1,puVar5,param_3);

      return uVar3;

    case 0x317:

      param_2 = puVar4;

      uVar3 = FUN_006a56f0(param_1,puVar5,param_3);

      return uVar3;

    case 0x318:

      param_2 = puVar4;

      uVar3 = FUN_006a5790(param_1,puVar5,param_3);

      return uVar3;

    }

  }

  else if (uVar9 < 0xf7c2) {

    if (uVar9 == 0xf7c1) {

      param_2 = puVar4;

      FUN_00563970(puVar4,param_3);

      return 0;

    }

    switch(uVar9) {

    case 0xf630:

      param_2 = puVar4;

      FUN_00411850();

      FUN_004fd460(&param_2,(int)puVar5 + (iVar2 - (int)param_2));

      FUN_00509420(local_1c0 + 0x14);

      FUN_005abb30();

      return 0;

    case 0xf643:

      param_2 = puVar4;

      FUN_0055f620(puVar4,param_3);

      return 0;

    case 0xf651:

      param_2 = param_2 + 2;

      FUN_0055e380(*puVar4);

      return 0;

    case 0xf653:

      param_2 = puVar4;

      FUN_0055e4a0();

      return 0;

    case 0xf655:

      param_2 = puVar4;

      FUN_0055e310();

      return 0;

    case 0xf658:

      param_2 = puVar4;

      FUN_00560440(puVar4,param_3);

      return 0;

    case 0xf659:

      param_2 = param_2 + 2;

      FUN_0055e2f0(*puVar4);

      return 0;

    }

  }

  else {

    switch(uVar9) {

    case 0xf7ca:

      param_2 = puVar4;

      uVar3 = FUN_006af390(param_1,puVar5,param_3);

      return uVar3;

    case 0xf7cb:

      param_2 = puVar4;

      uVar3 = FUN_006af430(param_1,puVar5,param_3);

      return uVar3;

    case 0xf7dc:

      param_2 = puVar4;

      FUN_00563810(puVar4,param_3);

      break;

    case 0xf7df:

      param_2 = puVar4;

      uVar3 = FUN_006a1c70(param_1,puVar5,param_3);

      return uVar3;

    case 0xf7e0:

      param_2 = puVar4;

      uVar3 = FUN_006a5e90(param_1,puVar5,param_3);

      return uVar3;

    case 0xf7e1:

      param_2 = puVar4;

      uVar3 = FUN_006ae7c0(param_1,puVar5,param_3);

      return uVar3;

    }

  }

  return 0;

}





// --- FUN_0055dee0 at 0x0055DEE0 (size: 361) ---


void FUN_0055dee0(int *param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  int *piVar4;

  int iVar5;

  undefined1 *puVar6;

  undefined *puVar7;

  undefined4 *puVar8;

  undefined4 uVar9;

  undefined4 local_28;

  int *local_24;

  undefined1 local_20 [4];

  undefined1 local_1c [4];

  int *local_18;

  undefined4 local_14;

  undefined **local_10;

  int local_8;

  undefined4 local_4;

  

  iVar3 = (int)param_1;

  local_28 = *(undefined4 *)((int)param_1 + 0x2c);

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

  local_10 = &PTR_FUN_007cd404;

  local_8 = 0;

  local_4 = 0;

  iVar2 = FUN_006b19b0(&local_28,iVar5);

  if (iVar2 == 0) {

    FUN_0055bcd0(*(undefined4 *)(iVar3 + 0x2c),*(undefined4 *)(iVar3 + 0x30));

    return;

  }

  if (local_8 == 0) {

    iVar3 = FUN_006b1960();

    FUN_0055bcd0(local_28,iVar5 - iVar3);

    return;

  }

  puVar8 = &param_1;

  puVar6 = local_20;

  puVar7 = &DAT_007cd2f8;

  param_1 = (int *)0x0;

  FUN_00406d10(puVar6,&DAT_007cd2f8,puVar8);

  FUN_00406570(puVar6,puVar7,puVar8);

  piVar1 = param_1;

  uVar9 = 0;

  local_18 = (int *)0x0;

  local_14 = 0;

  piVar4 = param_1;

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

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

  }

  FUN_00454590(local_1c,piVar4,uVar9);

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

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

  }

  piVar1 = local_18;

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

    piVar4 = (int *)FUN_005088e0(local_8);

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

      FUN_00509de0(local_8,local_4,iVar3);

    }

    else {

      param_1 = (int *)0x0;

      iVar5 = FUN_00509f30(local_4,iVar3,&param_1);

      if (iVar5 == 1) {

        (**(code **)(*local_24 + 0x24))(param_1);

        (**(code **)(*piVar4 + 8))();

      }

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

        FUN_00405f70();

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

        return;

      }

    }

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

  }

  return;

}





// --- FUN_0055e100 at 0x0055E100 (size: 44) ---


uint __fastcall FUN_0055e100(int *param_1)



{

  uint uVar1;

  

  if (((param_1[0x3b] != 2) || (param_1[0x3a] == 0)) && (param_1[0x3b] != 5)) {

    uVar1 = (**(code **)(*param_1 + 0x18))();

    return uVar1 >> 0xf & 1;

  }

  return 1;

}





// --- FUN_0055e130 at 0x0055E130 (size: 153) ---


void __fastcall FUN_0055e130(int param_1)



{

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  return;

}





// --- FUN_0055e1d0 at 0x0055E1D0 (size: 6) ---


undefined4 FUN_0055e1d0(void)



{

  return DAT_0087119c;

}





// --- FUN_0055e1e0 at 0x0055E1E0 (size: 49) ---


undefined4 __fastcall FUN_0055e1e0(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  if (*(int *)(param_1 + 0x2c) == 0) {

    iVar1 = FUN_005df0f5(0x268);

    if (iVar1 != 0) {

      uVar2 = FUN_00564660();

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

      return uVar2;

    }

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

  }

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

}





// --- FUN_0055e220 at 0x0055E220 (size: 79) ---


undefined4 __fastcall FUN_0055e220(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  

  if (*(int *)(param_1 + 0x2d4) == 0) {

    FUN_00567c00();

    uVar1 = FUN_00567c10();

    iVar2 = FUN_005df0f5(0x108);

    if (iVar2 != 0) {

      uVar1 = FUN_005875a0(uVar1);

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

      return uVar1;

    }

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

  }

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

}





// --- FUN_0055e2a0 at 0x0055E2A0 (size: 72) ---


void __thiscall FUN_0055e2a0(int param_1,char param_2)



{

  int iVar1;

  

  if (*(char *)(param_1 + 0x238) != param_2) {

    *(char *)(param_1 + 0x238) = param_2;

    iVar1 = FUN_00564d30();

    if (iVar1 != 0) {

      if (*(char *)(param_1 + 0x238) != '\0') {

        FUN_00564d30();

        FUN_00565610();

        return;

      }

      FUN_00564d30();

      FUN_00565630();

    }

  }

  return;

}





// --- FUN_0055e2f0 at 0x0055E2F0 (size: 28) ---


void __thiscall FUN_0055e2f0(int param_1,undefined4 param_2)



{

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

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

  FUN_006939e0(param_2);

  return;

}





// --- FUN_0055e310 at 0x0055E310 (size: 107) ---


void __fastcall FUN_0055e310(int param_1)



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  

  iVar1 = (**(code **)(*DAT_0083e72c + 0x24))();

  if (*(int *)(param_1 + 0x2c) == 0) {

    iVar2 = FUN_005df0f5(0x268);

    if (iVar2 == 0) {

      uVar3 = 0;

    }

    else {

      uVar3 = FUN_00564660();

    }

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

  }

  FUN_004fe960(*(undefined4 *)(*(int *)(param_1 + 0x2c) + 0x208));

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

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

  FUN_00693aa0(iVar1 + 4);

  return;

}





// --- FUN_0055e380 at 0x0055E380 (size: 236) ---


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



void __thiscall FUN_0055e380(int param_1,uint param_2)



{

  double dVar1;

  undefined4 uVar2;

  char local_80 [127];

  undefined1 local_1;

  

  if (param_2 < 2) {

    _snprintf(local_80,0x80,

              "*** YOUR SUBSCRIPTION EXPIRES IN LESS THAN %i %s. PLEASE LOG OUT. ***\n",1,"SECOND");

  }

  else if (param_2 < 0x3d) {

    _snprintf(local_80,0x80,

              "*** YOUR SUBSCRIPTION EXPIRES IN LESS THAN %i %s. PLEASE LOG OUT. ***\n",param_2,

              "SECONDS");

  }

  else {

    dVar1 = (double)(int)param_2;

    if ((int)param_2 < 0) {

      dVar1 = dVar1 + _DAT_00795518;

    }

    ceil(dVar1 * _DAT_007b2420);

    uVar2 = FUN_005df4c4();

    _snprintf(local_80,0x80,

              "*** WARNING: Your subscription to this game runs out in less than %i %s. ***\n",uVar2

              ,"minutes");

  }

  local_1 = 0;

  FUN_00564d30();

  FUN_00509420();

  dVar1 = (double)(int)param_2;

  *(undefined1 *)(param_1 + 0x223) = 1;

  if ((int)param_2 < 0) {

    dVar1 = dVar1 + _DAT_00795518;

  }

  *(double *)(param_1 + 0x228) = dVar1 + _DAT_008379a8;

  return;

}





// --- FUN_0055e470 at 0x0055E470 (size: 7) ---


undefined1 __fastcall FUN_0055e470(int param_1)



{

  return *(undefined1 *)(param_1 + 0x1ec);

}





// --- FUN_0055e480 at 0x0055E480 (size: 26) ---


void FUN_0055e480(undefined4 param_1)



{

  FUN_005478b0(param_1,&PTR_DAT_008183b4,&PTR_DAT_008183b4);

  return;

}





// --- FUN_0055e4a0 at 0x0055E4A0 (size: 73) ---


void __fastcall FUN_0055e4a0(int param_1)



{

  undefined4 uVar1;

  

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

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

  uVar1 = DAT_008379ac;

  *(undefined4 *)(param_1 + 0x200) = DAT_008379a8;

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

  FUN_005429e0();

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

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

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

  return;

}





// --- FUN_0055e4f0 at 0x0055E4F0 (size: 8) ---


void __fastcall FUN_0055e4f0(int param_1)



{

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

  return;

}





// --- FUN_0055e500 at 0x0055E500 (size: 35) ---


float10 FUN_0055e500(void)



{

  float10 fVar1;

  float10 extraout_ST1;

  

  _CIpow();

  fVar1 = (float10)_CIpow();

  return SQRT(fVar1 + extraout_ST1);

}





// --- FUN_0055e530 at 0x0055E530 (size: 26) ---


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



float10 FUN_0055e530(double param_1)



{

  float10 fVar1;

  

  fVar1 = (float10)param_1;

  if (fVar1 < (float10)_DAT_00795610) {

    fVar1 = -fVar1;

  }

  return fVar1 * (float10)_DAT_007cd7a8;

}





// --- FUN_0055e550 at 0x0055E550 (size: 77) ---


ushort FUN_0055e550(double param_1,uint param_2,double param_3,uint param_4)



{

  ushort uVar1;

  

  uVar1 = (ushort)(param_1 < param_3) << 8 | (ushort)(NAN(param_1) || NAN(param_3)) << 10 |

          (ushort)(param_1 == param_3) << 0xe;

  if (param_1 < param_3 != 0 || (param_1 == param_3) != 0) {

    uVar1 = (ushort)(param_1 < param_3) << 8 | (ushort)(NAN(param_1) || NAN(param_3)) << 10 |

            (ushort)(param_1 == param_3) << 0xe;

    if (param_1 >= param_3) {

      uVar1 = (ushort)(param_1 < param_3) << 8 | (ushort)(NAN(param_1) || NAN(param_3)) << 10 |

              (ushort)(param_1 == param_3) << 0xe;

      if (param_1 == param_3) {

        if (param_4 < param_2) goto LAB_0055e589;

        uVar1 = (ushort)(param_1 < param_3) << 8 | (ushort)(NAN(param_1) || NAN(param_3)) << 10 |

                (ushort)(param_1 == param_3) << 0xe;

      }

    }

    return uVar1;

  }

LAB_0055e589:

  return CONCAT11((char)(uVar1 >> 8),1);

}





// --- FUN_0055e5a0 at 0x0055E5A0 (size: 29) ---


float10 FUN_0055e5a0(void)



{

  int iVar1;

  

  iVar1 = FUN_00451ec0();

  if (iVar1 != 0) {

    return (float10)DAT_007cd6c0;

  }

  return (float10)DAT_007cd6c4;

}





// --- FUN_0055e5c0 at 0x0055E5C0 (size: 24) ---


bool FUN_0055e5c0(void)



{

  int iVar1;

  

  if (DAT_0083da58 != 0) {

    iVar1 = FUN_00451ec0();

    return iVar1 != 0;

  }

  return false;

}





// --- FUN_0055e5e0 at 0x0055E5E0 (size: 121) ---


undefined4 __thiscall FUN_0055e5e0(int param_1,int param_2,char param_3)



{

  char cVar1;

  int iVar2;

  undefined4 uVar3;

  

  if (param_2 == 0) {

    return 0;

  }

  FUN_006a97a0(param_2);

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

  if ((param_3 != '\0') || (cVar1 = FUN_005d4aa0(), cVar1 != '\0')) {

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

  }

  iVar2 = FUN_00588f70(param_2,*(undefined4 *)(param_1 + 0x1e8),uVar3,1,0);

  if (iVar2 == 0) {

    iVar2 = FUN_005583f0(param_2);

    if (iVar2 != 0) {

      FUN_0058cf00(0);

    }

    FUN_006a96a0();

    return 0;

  }

  return 1;

}





// --- FUN_0055e660 at 0x0055E660 (size: 27) ---


void __fastcall FUN_0055e660(int param_1)



{

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

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

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

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

  return;

}





// --- FUN_0055e680 at 0x0055E680 (size: 827) ---


undefined4 * __fastcall FUN_0055e680(undefined4 *param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x8000;

  }

  *param_1 = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x10000;

  }

  param_1[1] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x40000;

  }

  param_1[2] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x20000;

  }

  param_1[3] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x80000;

  }

  param_1[4] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x3500000;

  }

  param_1[5] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x800000;

  }

  param_1[6] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x300000;

  }

  param_1[7] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x40;

  }

  param_1[8] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 2;

  }

  param_1[9] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x4000000;

  }

  param_1[10] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x8000000;

  }

  param_1[0xb] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x10000000;

  }

  param_1[0xc] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x20000000;

  }

  param_1[0xd] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x40000000;

  }

  param_1[0xe] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 1;

  }

  param_1[0xf] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x200;

  }

  param_1[0x10] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x400;

  }

  param_1[0x11] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x800;

  }

  param_1[0x12] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x1000;

  }

  param_1[0x13] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x20;

  }

  param_1[0x14] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x2000;

  }

  param_1[0x15] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x4000;

  }

  param_1[0x16] = puVar1;

  puVar1 = (undefined4 *)FUN_005df0f5(8);

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

    *puVar1 = 0;

    puVar1[1] = 0x100;

    param_1[0x17] = puVar1;

    return param_1;

  }

  param_1[0x17] = 0;

  return param_1;

}





// --- FUN_0055e9c0 at 0x0055E9C0 (size: 216) ---


void __fastcall FUN_0055e9c0(undefined4 *param_1)



{

  *(undefined4 *)*param_1 = 0;

  *(undefined4 *)param_1[1] = 0;

  *(undefined4 *)param_1[2] = 0;

  *(undefined4 *)param_1[3] = 0;

  *(undefined4 *)param_1[4] = 0;

  *(undefined4 *)param_1[5] = 0;

  *(undefined4 *)param_1[6] = 0;

  *(undefined4 *)param_1[7] = 0;

  *(undefined4 *)param_1[8] = 0;

  *(undefined4 *)param_1[9] = 0;

  *(undefined4 *)param_1[10] = 0;

  *(undefined4 *)param_1[0xb] = 0;

  *(undefined4 *)param_1[0xc] = 0;

  *(undefined4 *)param_1[0xd] = 0;

  *(undefined4 *)param_1[0xe] = 0;

  *(undefined4 *)param_1[0xf] = 0;

  *(undefined4 *)param_1[0x10] = 0;

  *(undefined4 *)param_1[0x11] = 0;

  *(undefined4 *)param_1[0x12] = 0;

  *(undefined4 *)param_1[0x13] = 0;

  *(undefined4 *)param_1[0x14] = 0;

  *(undefined4 *)param_1[0x15] = 0;

  *(undefined4 *)param_1[0x16] = 0;

  *(undefined4 *)param_1[0x17] = 0;

  return;

}





// --- FUN_0055eb30 at 0x0055EB30 (size: 14) ---


void FUN_0055eb30(void)



{

  FUN_006a69c0(&stack0x00000004);

  return;

}





// --- FUN_0055eb40 at 0x0055EB40 (size: 1332) ---


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



undefined4 __thiscall FUN_0055eb40(int param_1,int param_2)



{

  undefined4 uVar1;

  int iVar2;

  undefined4 local_4;

  

  if (param_2 == 0) {

    DAT_008427a9 = 0;

    DAT_008427ac = 0;

    DAT_008427b4 = 0;

    DAT_00842788 = 0;

    DAT_00842784 = 0;

    goto LAB_0055f050;

  }

  if (param_2 == 1) {

    param_2 = 0x64960000;

    local_4._0_3_ = 0x960000;

    DAT_008427b4 = 0x42480000;

LAB_0055f03f:

    local_4 = CONCAT13(100,(undefined3)local_4);

    DAT_008427ac = 0x3ecccccd;

    DAT_00842784 = local_4;

    DAT_00842788 = param_2;

  }

  else if (param_2 == 2) {

    DAT_008427ac = 0x3e99999a;

    DAT_008427b4 = 0x42480000;

    DAT_00842788 = 0x64320096;

    DAT_00842784 = 0x64320096;

  }

  else {

    if (param_2 == 3) {

      local_4._0_3_ = 0x646464;

      param_2 = 0x64646464;

      DAT_008427b4 = 0x41f00000;

      goto LAB_0055f03f;

    }

    if (param_2 == 4) {

      DAT_008427ac = 0x3e99999a;

      DAT_008427b4 = 0x42480000;

      DAT_00842788 = 0x641e6400;

      DAT_00842784 = 0x641e6400;

    }

    else {

      if (param_2 != 5) {

        if (param_2 == 6) {

          DAT_008427a9 = 1;

          _DAT_008427b8 = 0;

          DAT_008427ac = 0x3f4ccccd;

          DAT_008427b0 = 0;

          DAT_008427b4 = 0x42200000;

          DAT_00842788 = 0x64969696;

          DAT_00842784 = 0x64000000;

          iVar2 = FUN_00564d30();

          *(undefined1 *)(iVar2 + 0x41) = 1;

          return 0;

        }

        if ((100 < param_2) && (param_2 < 0x7d)) {

          iVar2 = FUN_00558410(*(undefined4 *)(param_1 + 0x1e8));

          if (iVar2 == 0) {

            return 0;

          }

          iVar2 = FUN_00564d30();

          if (iVar2 == 0) {

            return 0;

          }

          switch(param_2) {

          case 0x65:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x76,uVar1);

            return 0;

          case 0x66:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x77,uVar1);

            return 0;

          case 0x67:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x78,uVar1);

            return 0;

          case 0x68:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x79,uVar1);

            return 0;

          case 0x69:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x7a,uVar1);

            return 0;

          case 0x6a:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x7b,uVar1);

            return 0;

          case 0x6b:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x7c,uVar1);

            return 0;

          case 0x6c:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x7d,uVar1);

            return 0;

          case 0x6d:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x7e,uVar1);

            return 0;

          case 0x6e:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x7f,uVar1);

            return 0;

          case 0x6f:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x80,uVar1);

            return 0;

          case 0x70:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x81,uVar1);

            return 0;

          case 0x71:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x82,uVar1);

            return 0;

          case 0x72:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x83,uVar1);

            return 0;

          default:

            return 0;

          case 0x75:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x84,uVar1);

            return 0;

          case 0x76:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x85,uVar1);

            return 0;

          case 0x77:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x86,uVar1);

            return 0;

          case 0x78:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x87,uVar1);

            return 0;

          case 0x79:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x88,uVar1);

            return 0;

          case 0x7a:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x89,uVar1);

            return 0;

          case 0x7b:

            uVar1 = FUN_00564d50();

            FUN_00551560(0x8a,uVar1);

            return 0;

          }

        }

        if (param_2 != 9999) {

          return 0;

        }

        param_2 = 0x32646464;

        local_4._0_3_ = 0x646464;

        DAT_008427b4 = 0x41f00000;

        goto LAB_0055f03f;

      }

      DAT_008427ac = 0x3f4ccccd;

      DAT_008427b4 = 0x42200000;

      DAT_00842788 = 0x64969696;

      DAT_00842784 = 0x64000000;

    }

  }

  DAT_008427a9 = 1;

LAB_0055f050:

  _DAT_008427b8 = 0;

  DAT_008427b0 = 0;

  iVar2 = FUN_00564d30();

  *(undefined1 *)(iVar2 + 0x41) = 0;

  return 0;

}





// --- FUN_0055f1b0 at 0x0055F1B0 (size: 84) ---


void __thiscall FUN_0055f1b0(int param_1,int param_2)



{

  int iVar1;

  

  if ((0 < *(int *)(param_1 + 0x2c0)) && (*(int *)(param_1 + 0x2a8) == param_2)) {

    iVar1 = FUN_005583f0(*(undefined4 *)(param_1 + 0x2ac));

    if (iVar1 != 0) {

      FUN_0058cf00(0);

    }

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

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

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

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

  }

  return;

}





// --- FUN_0055f210 at 0x0055F210 (size: 35) ---


undefined4 __fastcall FUN_0055f210(int param_1)



{

  if (*(char *)(param_1 + 0x211) != '\0') {

    FUN_005429e0();

    *(undefined1 *)(param_1 + 0x210) = 1;

  }

  return 0;

}





// --- FUN_0055f240 at 0x0055F240 (size: 463) ---


void __fastcall FUN_0055f240(undefined4 *param_1)



{

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

    operator_delete((void *)*param_1);

  }

  *param_1 = 0;

  if ((void *)param_1[1] != (void *)0x0) {

    operator_delete((void *)param_1[1]);

  }

  param_1[1] = 0;

  if ((void *)param_1[2] != (void *)0x0) {

    operator_delete((void *)param_1[2]);

  }

  param_1[2] = 0;

  if ((void *)param_1[3] != (void *)0x0) {

    operator_delete((void *)param_1[3]);

  }

  param_1[3] = 0;

  if ((void *)param_1[4] != (void *)0x0) {

    operator_delete((void *)param_1[4]);

  }

  param_1[4] = 0;

  if ((void *)param_1[5] != (void *)0x0) {

    operator_delete((void *)param_1[5]);

  }

  param_1[5] = 0;

  if ((void *)param_1[6] != (void *)0x0) {

    operator_delete((void *)param_1[6]);

  }

  param_1[6] = 0;

  if ((void *)param_1[7] != (void *)0x0) {

    operator_delete((void *)param_1[7]);

  }

  param_1[7] = 0;

  if ((void *)param_1[8] != (void *)0x0) {

    operator_delete((void *)param_1[8]);

  }

  param_1[8] = 0;

  if ((void *)param_1[9] != (void *)0x0) {

    operator_delete((void *)param_1[9]);

  }

  param_1[9] = 0;

  if ((void *)param_1[10] != (void *)0x0) {

    operator_delete((void *)param_1[10]);

  }

  param_1[10] = 0;

  if ((void *)param_1[0xb] != (void *)0x0) {

    operator_delete((void *)param_1[0xb]);

  }

  param_1[0xb] = 0;

  if ((void *)param_1[0xc] != (void *)0x0) {

    operator_delete((void *)param_1[0xc]);

  }

  param_1[0xc] = 0;

  if ((void *)param_1[0xd] != (void *)0x0) {

    operator_delete((void *)param_1[0xd]);

  }

  param_1[0xd] = 0;

  if ((void *)param_1[0xe] != (void *)0x0) {

    operator_delete((void *)param_1[0xe]);

  }

  param_1[0xe] = 0;

  if ((void *)param_1[0xf] != (void *)0x0) {

    operator_delete((void *)param_1[0xf]);

  }

  param_1[0xf] = 0;

  if ((void *)param_1[0x10] != (void *)0x0) {

    operator_delete((void *)param_1[0x10]);

  }

  param_1[0x10] = 0;

  if ((void *)param_1[0x11] != (void *)0x0) {

    operator_delete((void *)param_1[0x11]);

  }

  param_1[0x11] = 0;

  if ((void *)param_1[0x12] != (void *)0x0) {

    operator_delete((void *)param_1[0x12]);

  }

  param_1[0x12] = 0;

  if ((void *)param_1[0x13] != (void *)0x0) {

    operator_delete((void *)param_1[0x13]);

  }

  param_1[0x13] = 0;

  if ((void *)param_1[0x14] != (void *)0x0) {

    operator_delete((void *)param_1[0x14]);

  }

  param_1[0x14] = 0;

  if ((void *)param_1[0x15] != (void *)0x0) {

    operator_delete((void *)param_1[0x15]);

  }

  param_1[0x15] = 0;

  if ((void *)param_1[0x16] != (void *)0x0) {

    operator_delete((void *)param_1[0x16]);

  }

  param_1[0x16] = 0;

  if ((void *)param_1[0x17] != (void *)0x0) {

    operator_delete((void *)param_1[0x17]);

  }

  param_1[0x17] = 0;

  return;

}





// --- FUN_0055f420 at 0x0055F420 (size: 73) ---


uint __thiscall FUN_0055f420(int param_1,int *param_2,uint param_3)



{

  int *piVar1;

  uint uVar2;

  

  uVar2 = FUN_005d16a0();

  if (uVar2 <= param_3) {

    if (3 < param_3) {

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

      *param_2 = *param_2 + 4;

    }

    for (piVar1 = *(int **)(param_1 + 4); piVar1 != (int *)0x0; piVar1 = (int *)piVar1[4]) {

      (**(code **)(*piVar1 + 0xc))(param_2,param_3);

    }

  }

  return uVar2;

}





// --- FUN_0055f470 at 0x0055F470 (size: 126) ---


undefined4 __thiscall FUN_0055f470(int param_1,int param_2,undefined4 *param_3)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 *puVar3;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0x48);

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

    return 0;

  }

  puVar3 = puVar1;

  for (iVar2 = 0x10; iVar2 != 0; iVar2 = iVar2 + -1) {

    *puVar3 = *param_3;

    param_3 = param_3 + 1;

    puVar3 = puVar3 + 1;

  }

  puVar1[0x10] = 0;

  puVar1[0x11] = 0;

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

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

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

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

    return 1;

  }

  puVar1[0x10] = param_2;

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

  if (*(int *)(param_2 + 0x44) != 0) {

    *(undefined4 **)(*(int *)(param_2 + 0x44) + 0x40) = puVar1;

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

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

    return 1;

  }

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

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

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

  return 1;

}





// --- FUN_0055f4f0 at 0x0055F4F0 (size: 142) ---


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



{

  int iVar1;

  int *piVar2;

  int *piVar3;

  int *unaff_EBP;

  int *local_4;

  

  local_4 = param_1;

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

    piVar3 = (int *)*param_1;

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

      *param_1 = 0;

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

      param_1[1] = 0;

    }

    *param_2 = 0x80004002;

    return;

  }

  iVar1 = *param_3;

  param_3 = (int *)0x0;

  piVar3 = (int *)(**(code **)(iVar1 + 0xc))(&local_4,&DAT_007cd6d4,&param_3);

  piVar2 = local_4;

  iVar1 = *piVar3;

  piVar3 = (int *)*param_1;

  if (iVar1 < 0) {

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

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

    }

    *param_1 = 0;

    param_1[1] = 0;

    *unaff_EBP = iVar1;

    return;

  }

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

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

  }

  *param_1 = (int)piVar2;

  param_1[1] = 0;

  *unaff_EBP = iVar1;

  return;

}





// --- FUN_0055f580 at 0x0055F580 (size: 148) ---


void __thiscall FUN_0055f580(int *param_1,wchar_t *param_2)



{

  undefined4 *puVar1;

  LONG LVar2;

  size_t sVar3;

  

  if ((param_2 == (wchar_t *)0x0) || (*param_2 == L'\0')) {

    puVar1 = (undefined4 *)*param_1;

    if (puVar1 != DAT_008ef12c) {

      LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

      }

      puVar1 = DAT_008ef12c;

      *param_1 = (int)DAT_008ef12c;

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

                    /* WARNING: Treating indirect jump as call */

      InterlockedIncrement(puVar1 + 1);

      return;

    }

  }

  else {

    puVar1 = (undefined4 *)*param_1;

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    sVar3 = wcslen(param_2);

    FUN_00543680(sVar3);

    wcscpy((wchar_t *)(*param_1 + 0x14),param_2);

  }

  return;

}





// --- FUN_0055f620 at 0x0055F620 (size: 562) ---


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



{

  undefined4 *puVar1;

  int iVar2;

  int iVar3;

  int *piVar4;

  int iVar5;

  undefined4 uVar6;

  bool bVar7;

  undefined1 auStack_10 [16];

  

  iVar5 = param_3;

  puVar1 = param_2;

  uVar6 = *param_2;

  param_2 = param_2 + 1;

  switch(uVar6) {

  case 1:

    iVar2 = (**(code **)(*DAT_0083e72c + 0x24))();

    bVar7 = false;

    FUN_0055e1e0();

    iVar3 = FUN_005c4790();

    if (iVar3 == 2) {

      FUN_004ff180();

      FUN_004ff300(&param_2,(int)puVar1 + (iVar5 - (int)param_2));

      iVar5 = FUN_004fef70(auStack_10);

      bVar7 = iVar5 != 0;

      FUN_004feb40();

    }

    else {

      iVar3 = FUN_0055e1e0();

      piVar4 = (int *)FUN_004e8b20(*(undefined4 *)(iVar3 + 0x208));

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

        iVar5 = (**(code **)(*piVar4 + 0x10))(&param_2,(int)puVar1 + (iVar5 - (int)param_2));

        bVar7 = iVar5 != 0;

      }

    }

    FUN_006b0610(1);

    uVar6 = 0;

    FUN_0055e1e0(0);

    FUN_005c4780(uVar6);

    if (bVar7) {

      FUN_00693aa0(iVar2 + 4);

      return;

    }

    break;

  default:

    if (*(int *)(param_1 + 0x2c) == 0) {

      iVar5 = FUN_005df0f5(0x268);

      if (iVar5 == 0) {

        uVar6 = 0;

      }

      else {

        uVar6 = FUN_00564660();

      }

      *(undefined4 *)(param_1 + 0x2c) = uVar6;

    }

    FUN_005c4d40(0xffffffff);

    if (*(int *)(param_1 + 0x2c) == 0) {

      iVar5 = FUN_005df0f5(0x268);

      if (iVar5 == 0) {

        uVar6 = 0;

      }

      else {

        uVar6 = FUN_00564660();

      }

      *(undefined4 *)(param_1 + 0x2c) = uVar6;

    }

    FUN_005c4780(0);

    FUN_006b0610(0);

    break;

  case 3:

    uVar6 = 0xffffffff;

    FUN_0055e1e0(0xffffffff);

    FUN_005c4d40(uVar6);

    uVar6 = 0;

    FUN_0055e1e0(0);

    FUN_005c4780(uVar6);

    FUN_006b0610(3);

    return;

  case 4:

    uVar6 = 0xffffffff;

    FUN_0055e1e0(0xffffffff);

    FUN_005c4d40(uVar6);

    uVar6 = 0;

    FUN_0055e1e0(0);

    FUN_005c4780(uVar6);

    FUN_006b0610(4);

    return;

  case 5:

  case 6:

    uVar6 = 0xffffffff;

    FUN_0055e1e0(0xffffffff);

    FUN_005c4d40(uVar6);

    uVar6 = 0;

    FUN_0055e1e0(0);

    FUN_005c4780(uVar6);

    FUN_006b0610(5);

    return;

  case 7:

    uVar6 = 0xffffffff;

    FUN_0055e1e0(0xffffffff);

    FUN_005c4d40(uVar6);

    uVar6 = 0;

    FUN_0055e1e0(0);

    FUN_005c4780(uVar6);

    FUN_006b0610(7);

    return;

  }

  return;

}





// --- FUN_0055f870 at 0x0055F870 (size: 132) ---


int __thiscall FUN_0055f870(int param_1,int param_2,int param_3)



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  int iVar4;

  

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

    puVar3 = &param_2;

    iVar4 = param_2;

    FUN_0055e220(param_2,puVar3);

    FUN_00587c10(iVar4,puVar3);

    if (param_3 != 0) {

      FUN_006a45f0(param_2);

    }

    return param_2;

  }

  uVar1 = *(undefined4 *)(param_2 + 8);

  puVar3 = (undefined4 *)FUN_005df0f5(8);

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

    puVar3 = (undefined4 *)0x0;

  }

  else {

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

    *puVar3 = uVar1;

    puVar3[1] = uVar2;

  }

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

  if (*(int *)(param_1 + 0x2d0) == 0) {

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

  }

  return 0;

}





// --- FUN_0055f900 at 0x0055F900 (size: 41) ---


void __thiscall FUN_0055f900(int param_1,int param_2,int param_3)



{

  int *piVar1;

  

  for (piVar1 = *(int **)(param_1 + 0x2dc); piVar1 != (int *)0x0; piVar1 = (int *)piVar1[0x10]) {

    if ((*piVar1 == param_2) && (piVar1[1] == param_3)) {

      *(undefined1 *)(piVar1 + 0xe) = 1;

    }

  }

  return;

}





// --- FUN_0055f930 at 0x0055F930 (size: 33) ---


void __thiscall FUN_0055f930(int param_1,int param_2)



{

  int *piVar1;

  

  for (piVar1 = *(int **)(param_1 + 0x2dc); piVar1 != (int *)0x0; piVar1 = (int *)piVar1[0x10]) {

    if (*piVar1 == param_2) {

      *(undefined1 *)(piVar1 + 0xe) = 1;

    }

  }

  return;

}





// --- FUN_0055f960 at 0x0055F960 (size: 139) ---


undefined4 __thiscall FUN_0055f960(int param_1,uint *param_2)



{

  uint *puVar1;

  uint *puVar2;

  

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

    puVar1 = (uint *)0x0;

    for (puVar2 = *(uint **)(*(int *)(param_1 + 8) + (*param_2 % *(uint *)(param_1 + 0xc)) * 4);

        puVar2 != (uint *)0x0; puVar2 = (uint *)puVar2[0xc]) {

      if (*puVar2 == *param_2) {

        FUN_0059a0c0(puVar2 + 2);

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

          *(uint *)(*(int *)(param_1 + 8) + (*param_2 % *(uint *)(param_1 + 0xc)) * 4) = puVar2[0xc]

          ;

        }

        else {

          puVar1[0xc] = puVar2[0xc];

        }

        puVar2[2] = (uint)&PTR_FUN_0079385c;

        operator_delete(puVar2);

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

        return 1;

      }

      puVar1 = puVar2;

    }

  }

  return 0;

}





// --- FUN_0055f9f0 at 0x0055F9F0 (size: 99) ---


uint __thiscall FUN_0055f9f0(int param_1,void *param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  uVar2 = 0;

  if ((param_2 == (void *)0x0) || (*(void **)(param_1 + 4) == (void *)0x0)) {

    return (uint)param_2 & 0xffffff00;

  }

  if (param_2 == *(void **)(param_1 + 4)) {

    iVar1 = *(int *)((int)param_2 + 0x40);

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

    if (iVar1 == 0) {

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

      goto LAB_0055fa3d;

    }

  }

  else {

    *(undefined4 *)(*(int *)((int)param_2 + 0x44) + 0x40) = *(undefined4 *)((int)param_2 + 0x40);

    iVar1 = *(int *)((int)param_2 + 0x40);

    if (iVar1 == 0) {

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

      goto LAB_0055fa3d;

    }

    uVar2 = *(undefined4 *)((int)param_2 + 0x44);

  }

  *(undefined4 *)(iVar1 + 0x44) = uVar2;

LAB_0055fa3d:

  operator_delete(param_2);

  iVar1 = *(int *)(param_1 + 0xc) + -1;

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

  return CONCAT31((int3)((uint)iVar1 >> 8),1);

}





// --- FUN_0055fad0 at 0x0055FAD0 (size: 480) ---


undefined4 __thiscall FUN_0055fad0(int param_1,undefined4 param_2,int param_3)



{

  uint uVar1;

  int *piVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  undefined4 uVar6;

  wchar_t *pwVar7;

  undefined1 local_98 [4];

  undefined1 local_94 [4];

  undefined1 local_90 [144];

  

  piVar2 = (int *)FUN_005583f0(param_2);

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

    return 0;

  }

  uVar1 = piVar2[0x30];

  if ((uVar1 & 0x7fffffff) == 0) {

    return 0;

  }

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

  if (((((uVar1 & 0x800000) == 0) || (iVar5 == 0)) || (iVar3 = FUN_005583f0(iVar5), iVar3 == 0)) ||

     ((*(int *)(iVar3 + 0xe8) == 0 || (*(int *)(iVar3 + 0xe8) == piVar2[0x3a])))) {

    if ((((uVar1 & 0x200000) == 0) || ((iVar5 == 0 || (iVar5 = FUN_005583f0(iVar5), iVar5 == 0))))

       || (iVar5 = FUN_0055e100(), iVar5 == 0)) {

      if ((uVar1 & 0x1000000) == 0) {

        return 1;

      }

      iVar5 = FUN_0056b210();

      if (*(int *)(iVar5 + 0x1c) == 1) {

        return 1;

      }

      uVar6 = (**(code **)(*piVar2 + 0x18))();

      if ((char)((uint)uVar6 >> 8) < '\0') {

        return 1;

      }

      if (param_3 != 0) {

        return 0;

      }

      puVar4 = (undefined4 *)FUN_0058f8b0(local_94,2,0);

      uVar6 = *puVar4;

      pwVar7 = L"Cannot hold %s while in combat";

    }

    else {

      if (param_3 != 0) {

        return 0;

      }

      puVar4 = (undefined4 *)FUN_0058f8b0(local_94,0,0);

      uVar6 = *puVar4;

      pwVar7 = L"A shield may not be worn with the %s";

    }

    FUN_00480980(local_98,0,pwVar7,uVar6);

    FUN_004011b0();

    FUN_0042dc80();

    FUN_0042cbe0(local_98,1);

  }

  else {

    if (param_3 != 0) {

      return 0;

    }

    puVar4 = (undefined4 *)FUN_0058f8b0(local_94,2,0);

    FUN_00480980(local_98,0,L"Cannot be used with %s",*puVar4);

    FUN_004011b0();

    FUN_0042dc80();

    FUN_0042cbe0(local_98,1);

  }

  FUN_00693500(0x1a,local_90);

  FUN_0042e590();

  FUN_004011b0();

  return 0;

}





// --- FUN_0055fcb0 at 0x0055FCB0 (size: 380) ---


undefined4 __thiscall FUN_0055fcb0(int param_1,undefined4 param_2,int *param_3,int param_4)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 uVar4;

  wchar_t *pwVar5;

  undefined1 local_98 [4];

  undefined1 local_94 [4];

  undefined1 local_90 [144];

  

  *param_3 = 0;

  iVar1 = FUN_0058de80(0);

  if (iVar1 == 0) {

    return 0;

  }

  iVar1 = FUN_005583f0(param_2);

  if ((iVar1 != 0) && ((*(uint *)(iVar1 + 0xc0) & 0x8007fff) != 0)) {

    if ((*(uint *)(iVar1 + 0xbc) & *(uint *)(param_1 + 0x234)) == 0) {

      return 1;

    }

    iVar2 = FUN_005583f0(*(undefined4 *)(param_1 + 0x1e8));

    if ((iVar2 != 0) && (iVar2 = FUN_0058dc00(param_2), iVar2 != 0)) {

      *param_3 = 1;

    }

    if (param_4 == 0) {

      if (*param_3 == 0) {

        uVar4 = FUN_0058dc30(*(uint *)(param_1 + 0x230) & *(uint *)(iVar1 + 0xc0),

                             *(undefined4 *)(iVar1 + 0xbc));

        iVar1 = FUN_005583f0(uVar4);

        if (iVar1 == 0) {

          return 0;

        }

        puVar3 = (undefined4 *)FUN_0058f8b0(local_94,2,0);

        uVar4 = *puVar3;

        pwVar5 = L"You must remove your %s to wear that";

      }

      else {

        puVar3 = (undefined4 *)FUN_0058f8b0(local_94,2,0);

        uVar4 = *puVar3;

        pwVar5 = L"The %s is already being worn";

      }

      FUN_00480980(local_98,0,pwVar5,uVar4);

      FUN_004011b0();

      FUN_0042dc80();

      FUN_0042cbe0(local_98,1);

      FUN_00693500(0x1a,local_90);

      FUN_0042e590();

      FUN_004011b0();

    }

  }

  return 0;

}





// --- FUN_0055fe30 at 0x0055FE30 (size: 197) ---


void __thiscall FUN_0055fe30(int param_1,int param_2)



{

  uint uVar1;

  int iVar2;

  undefined4 local_48;

  int local_44;

  undefined1 local_40 [4];

  int local_3c;

  int local_38;

  uint local_34;

  undefined **local_30 [2];

  undefined4 local_28;

  undefined4 local_10;

  undefined4 local_c;

  

  local_44 = param_1 + 0x2ec;

  FUN_005d1400();

  if (*(int *)(param_2 + 0x14) != 0) {

    FUN_00497ef0(local_40);

joined_r0x0055fe6c:

    iVar2 = local_3c;

    if (iVar2 != 0) {

      FUN_0059a130(iVar2 + 8);

      local_10 = DAT_008379a8;

      local_c = DAT_008379ac;

      local_48 = local_28;

      FUN_00498270(&local_48,local_30);

      local_30[0] = &PTR_FUN_0079385c;

      local_3c = *(int *)(iVar2 + 0x30);

      if (*(int *)(iVar2 + 0x30) == 0) {

        uVar1 = *(uint *)(iVar2 + 0x34);

        do {

          uVar1 = uVar1 + 1;

          if (local_34 <= uVar1) {

            local_3c = 0;

            goto joined_r0x0055fe6c;

          }

        } while (*(int *)(local_38 + uVar1 * 4) == 0);

        local_3c = *(int *)(local_38 + uVar1 * 4);

      }

      goto joined_r0x0055fe6c;

    }

  }

  FUN_006a6ac0(param_2);

  return;

}





// --- FUN_0055ff00 at 0x0055FF00 (size: 222) ---


void __thiscall

FUN_0055ff00(int param_1,undefined4 param_2,undefined4 param_3,uint param_4,uint param_5,

            uint param_6,uint param_7,uint param_8,uint param_9,uint param_10,uint param_11,

            uint param_12)



{

  uint uVar1;

  uint uVar2;

  uint *puVar3;

  

  uVar2 = param_12;

  if ((*(uint *)(param_1 + 0x2f8) != 0) && (*(int *)(param_1 + 0x2f4) != 0)) {

    for (puVar3 = *(uint **)(*(int *)(param_1 + 0x2f4) + (param_4 % *(uint *)(param_1 + 0x2f8)) * 4)

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

      if (param_4 == *puVar3) {

        puVar3 = puVar3 + 2;

        goto LAB_0055ff3d;

      }

    }

  }

  puVar3 = (uint *)0x0;

LAB_0055ff3d:

  if (param_12 == 0) {

LAB_0055ff62:

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

      puVar3[3] = param_5;

      puVar3[4] = param_6;

      puVar3[5] = param_7;

      puVar3[6] = param_8;

      puVar3[7] = param_9;

      uVar1 = DAT_008379ac;

      puVar3[8] = DAT_008379a8;

      puVar3[9] = uVar1;

      goto LAB_0055ffc9;

    }

  }

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

    param_12 = param_4;

    FUN_0055f960(&param_12,&param_2);

    goto LAB_0055ff62;

  }

  param_10 = DAT_008379a8;

  param_11 = DAT_008379ac;

  param_12 = param_4;

  FUN_00498270(&param_12,&param_2);

LAB_0055ffc9:

  FUN_006a6a60(&param_2,uVar2);

  return;

}





// --- FUN_0055ffe0 at 0x0055FFE0 (size: 52) ---


void __fastcall FUN_0055ffe0(int param_1)



{

  void *pvVar1;

  int iVar2;

  

  while (pvVar1 = *(void **)(param_1 + 4), pvVar1 != (void *)0x0) {

    iVar2 = *(int *)((int)pvVar1 + 0x40);

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

    if (iVar2 == 0) {

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

    }

    else {

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

    }

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

      operator_delete(pvVar1);

    }

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

  }

  return;

}





