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

// --- FUN_005d0190 at 0x005D0190 (size: 2675) ---


uint __thiscall FUN_005d0190(undefined4 *param_1,int *param_2)



{

  bool bVar1;

  byte bVar2;

  int iVar3;

  LONG LVar4;

  

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

    return 0;

  }

  FUN_0048c3e0("allegiance");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

  if (iVar3 == 0) {

LAB_005d0265:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0(&DAT_007db4d4);

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

    LVar4 = InterlockedDecrement(param_1 + 1);

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

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

    }

    if (iVar3 == 0) goto LAB_005d0265;

    FUN_0048c3e0(&DAT_007e292c);

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

    LVar4 = InterlockedDecrement(param_1 + 1);

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

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

    }

    bVar1 = false;

    if (iVar3 == 0) goto LAB_005d0265;

  }

  LVar4 = InterlockedDecrement(param_2 + 1);

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

    (**(code **)*param_2)(1);

  }

  if (bVar1) {

    return 0x2000000;

  }

  FUN_0048c3e0("co-vassals");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d036a:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("covassals");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    LVar4 = InterlockedDecrement(param_2 + 1);

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

      (**(code **)*param_2)(1);

    }

    if (iVar3 == 0) goto LAB_005d036a;

    FUN_0048c3e0("covassal");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d036a;

    FUN_0048c3e0(&DAT_007db4d0);

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d036a;

    bVar1 = false;

  }

  LVar4 = InterlockedDecrement(param_1 + 1);

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

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

  }

  if (bVar1) {

    return 0x1000000;

  }

  FUN_0048c3e0("monarch");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

  if (iVar3 == 0) {

LAB_005d03f3:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0(&DAT_00795524);

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d03f3;

    bVar1 = false;

  }

  LVar4 = InterlockedDecrement(param_2 + 1);

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

    (**(code **)*param_2)(1);

  }

  if (bVar1) {

    return 0x4000;

  }

  FUN_0048c3e0("patron");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d0478:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0(&DAT_007db4cc);

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d0478;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 0x2000;

  }

  FUN_0048c3e0("vassals");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d051b:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("vassal");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d051b;

    FUN_0048c3e0(&DAT_007db4c8);

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d051b;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 0x1000;

  }

  FUN_0048c3e0("fellowship");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d068e:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("fellows");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d068e;

    FUN_0048c3e0("fellow");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d068e;

    FUN_0048c3e0(&DAT_007db4c4);

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d068e;

    FUN_0048c3e0("group");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d068e;

    FUN_0048c3e0(&DAT_007e28c4);

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d068e;

    FUN_0048c3e0("party");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d068e;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 0x800;

  }

  FUN_0048c3e0(&DAT_007e95f8);

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d0765:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0(&DAT_007e95f4);

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d0765;

    FUN_0048c3e0("advocate");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d0765;

    FUN_0048c3e0("advocate1");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d0765;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 8;

  }

  FUN_0048c3e0(&DAT_007e95d8);

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d07d8:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("advocate2");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d07d8;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 0x10;

  }

  FUN_0048c3e0(&DAT_007e95c8);

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d084b:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("advocate3");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d084b;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 0x20;

  }

  FUN_0048c3e0("abuse");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

  FUN_005abb30();

  if (iVar3 == 0) {

    return 1;

  }

  FUN_0048c3e0(&DAT_007e95b0);

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d08f9:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("admin");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d08f9;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 2;

  }

  FUN_0048c3e0(&DAT_007e95a4);

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d096c:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("audit");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d096c;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 4;

  }

  FUN_0048c3e0(&DAT_007e2954);

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

  FUN_005abb30();

  if (iVar3 == 0) {

    return 0x400;

  }

  FUN_0048c3e0(&DAT_007e9594);

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d0a1a:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("sentinel");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d0a1a;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 0x200;

  }

  FUN_0048c3e0("celestialhand");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d0a8d:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("celhan");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d0a8d;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 0x8000000;

  }

  FUN_0048c3e0("eldrytchweb");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d0b00:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("eldweb");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d0b00;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 0x10000000;

  }

  FUN_0048c3e0("radiantblood");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 == 0) {

LAB_005d0b73:

    bVar1 = true;

  }

  else {

    FUN_0048c3e0("radblo");

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 == 0) goto LAB_005d0b73;

    bVar1 = false;

  }

  FUN_005abb30();

  if (bVar1) {

    return 0x20000000;

  }

  FUN_0048c3e0("olthoi");

  iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_1 + 5));

  if (iVar3 != 0) {

    FUN_0048c3e0(&DAT_007e9540);

    iVar3 = _stricmp((char *)(*param_2 + 0x14),(char *)(param_2 + 5));

    FUN_005abb30();

    if (iVar3 != 0) {

      bVar2 = 0;

      goto LAB_005d0be8;

    }

  }

  bVar2 = 1;

LAB_005d0be8:

  FUN_005abb30();

  return -(uint)bVar2 & 0x40000000;

}





// --- FUN_005d0c10 at 0x005D0C10 (size: 224) ---


undefined4 FUN_005d0c10(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_0048a0a0(&DAT_008f0f00);

    return 1;

  case 2:

    FUN_0048a0a0(&DAT_008f0f04);

    return 1;

  case 3:

    FUN_0048a0a0(&DAT_008f0f08);

    return 1;

  case 4:

    FUN_0048a0a0(&DAT_008f0f0c);

    return 1;

  case 5:

    FUN_0048a0a0(&DAT_008f0f10);

    return 1;

  case 6:

    FUN_0048a0a0(&DAT_008f0f14);

    return 1;

  case 7:

    FUN_0048a0a0(&DAT_008f0f18);

    return 1;

  case 8:

    FUN_0048a0a0(&DAT_008f0f1c);

    return 1;

  case 9:

    FUN_0048a0a0(&DAT_008f0f20);

    return 1;

  case 10:

    FUN_0048a0a0(&DAT_008f0f24);

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005d0d20 at 0x005D0D20 (size: 545) ---


undefined4 FUN_005d0d20(uint param_1)



{

  if (param_1 < 0x1001) {

    if (param_1 == 0x1000) {

      FUN_004034c0("Vassals");

      return 1;

    }

    if (param_1 < 0x11) {

      if (param_1 == 0x10) {

        FUN_004034c0("Advocate 2");

        return 1;

      }

      switch(param_1) {

      case 1:

        FUN_004034c0("Abuse");

        return 1;

      case 2:

        FUN_004034c0("Admin");

        return 1;

      case 4:

        FUN_004034c0("Audit");

        return 1;

      case 8:

        FUN_004034c0("Advocate 1");

        return 1;

      }

    }

    else if (param_1 < 0x401) {

      if (param_1 == 0x400) {

        FUN_004034c0(&DAT_00799518);

        return 1;

      }

      if (param_1 == 0x20) {

        FUN_004034c0("Advocate 3");

        return 1;

      }

      if (param_1 == 0x200) {

        FUN_004034c0("Sentinel");

        return 1;

      }

    }

    else if (param_1 == 0x800) {

      FUN_004034c0("Fellowship");

      return 1;

    }

  }

  else if (param_1 < 0x4000001) {

    if (param_1 == 0x4000000) {

      FUN_004034c0("FellowBroadcast");

      return 1;

    }

    if (param_1 < 0x1000001) {

      if (param_1 == 0x1000000) {

        FUN_004034c0("Co-vassals");

        return 1;

      }

      if (param_1 == 0x2000) {

        FUN_004034c0("Patron");

        return 1;

      }

      if (param_1 == 0x4000) {

        FUN_004034c0("Monarch");

        return 1;

      }

    }

    else if (param_1 == 0x2000000) {

      FUN_004034c0("Allegiance");

      return 1;

    }

  }

  else if (param_1 < 0x20000001) {

    if (param_1 == 0x20000000) {

      FUN_004034c0("Radiant Blood");

      return 1;

    }

    if (param_1 == 0x8000000) {

      FUN_004034c0("Celestial Hand");

      return 1;

    }

    if (param_1 == 0x10000000) {

      FUN_004034c0("Eldrytch Web");

      return 1;

    }

  }

  else if (param_1 == 0x40000000) {

    FUN_004034c0("Olthoi");

    return 1;

  }

  return 0;

}





// --- FUN_005d0f70 at 0x005D0F70 (size: 182) ---


undefined4 FUN_005d0f70(undefined4 param_1,int *param_2)



{

  undefined4 *puVar1;

  LONG LVar2;

  undefined4 *local_c;

  undefined4 local_8;

  undefined4 *local_4;

  

  local_c = DAT_008ef12c;

  InterlockedIncrement(DAT_008ef12c + 1);

  local_8 = FUN_005d0c10(param_1,&local_c);

  FUN_00546290(&local_4,0);

  puVar1 = (undefined4 *)*param_2;

  if (puVar1 != local_4) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    *param_2 = (int)local_4;

    InterlockedIncrement(local_4 + 1);

  }

  LVar2 = InterlockedDecrement(local_4 + 1);

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

    (**(code **)*local_4)(1);

  }

  puVar1 = local_c;

  LVar2 = InterlockedDecrement(local_c + 1);

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

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

  }

  return local_8;

}





// --- FUN_005d1030 at 0x005D1030 (size: 85) ---


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



{

  *param_1 = &PTR_LAB_007e9784;

  param_1[0xd] = &PTR_LAB_00797910;

  param_1[0xe] = 0;

  param_1[0xf] = 0x3f800000;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  FUN_00535b30();

  FUN_005d1a30(param_2);

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  return param_1;

}





// --- FUN_005d10c0 at 0x005D10C0 (size: 89) ---


void __thiscall FUN_005d10c0(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  

  iVar2 = FUN_005df0f5(0x88);

  if (iVar2 == 0) {

    iVar2 = 0;

  }

  else {

    iVar2 = FUN_005d1030(param_2);

  }

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

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

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

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

    return;

  }

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

  *(int *)(iVar1 + 0x80) = iVar2;

  *(int *)(iVar2 + 0x84) = iVar1;

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

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

  return;

}





// --- FUN_005d1120 at 0x005D1120 (size: 76) ---


uint __thiscall FUN_005d1120(int param_1,int *param_2,uint param_3)



{

  int *piVar1;

  uint uVar2;

  

  uVar2 = FUN_005d1170();

  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[0x20]) {

      (**(code **)(*piVar1 + 0xc))(param_2,param_3);

    }

  }

  return uVar2;

}





// --- FUN_005d1170 at 0x005D1170 (size: 55) ---


int __fastcall FUN_005d1170(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[0x20]) {

    iVar2 = (**(code **)(*piVar1 + 0xc))(&local_4,0);

    iVar3 = iVar3 + iVar2;

  }

  return iVar3;

}





// --- FUN_005d11b0 at 0x005D11B0 (size: 117) ---


void __fastcall FUN_005d11b0(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  FUN_005d18d0();

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

  while (iVar1 != 0) {

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

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

      iVar1 = puVar2[0x20];

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

      if (iVar1 == 0) {

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

      }

      else {

        *(undefined4 *)(iVar1 + 0x84) = 0;

      }

      FUN_005d1a30(puVar2);

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

        puVar2[0xd] = &PTR_FUN_0079385c;

        *puVar2 = &PTR_FUN_0079385c;

        operator_delete(puVar2);

      }

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

    }

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

  }

  return;

}





// --- FUN_005d12d0 at 0x005D12D0 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007e9798;

  FUN_005d11b0();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d1300 at 0x005D1300 (size: 27) ---


void __fastcall FUN_005d1300(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e97ac;

  param_1[1] = &PTR_FUN_007e9798;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  return;

}





// --- FUN_005d1320 at 0x005D1320 (size: 61) ---


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



{

  *param_1 = &PTR_FUN_007e97ac;

  param_1[1] = &PTR_FUN_007e9798;

  FUN_005d11b0();

  param_1[1] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d1360 at 0x005D1360 (size: 155) ---


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



{

  uint *puVar1;

  uint uVar2;

  

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

    for (puVar1 = *(uint **)(*(int *)(param_1 + 8) + (*param_2 % *(uint *)(param_1 + 0xc)) * 4);

        puVar1 != (uint *)0x0; puVar1 = (uint *)puVar1[0xc]) {

      if (*param_2 == *puVar1) {

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

          return 0;

        }

        break;

      }

    }

  }

  puVar1 = (uint *)FUN_005df0f5(0x38);

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

    return 0;

  }

  uVar2 = *(uint *)(param_1 + 0xc);

  *puVar1 = *param_2;

  FUN_005d1ba0(param_3);

  puVar1[0xc] = 0;

  uVar2 = *param_2 % uVar2;

  puVar1[0xd] = uVar2;

  puVar1[0xc] = *(uint *)(*(int *)(param_1 + 8) + uVar2 * 4);

  *(uint **)(*(int *)(param_1 + 8) + uVar2 * 4) = puVar1;

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

  return 1;

}





// --- FUN_005d1400 at 0x005D1400 (size: 86) ---


void __fastcall FUN_005d1400(int param_1)



{

  void *pvVar1;

  void *pvVar2;

  uint uVar3;

  

  if ((*(int *)(param_1 + 8) != 0) && (uVar3 = 0, *(int *)(param_1 + 0xc) != 0)) {

    do {

      pvVar2 = *(void **)(*(int *)(param_1 + 8) + uVar3 * 4);

      while (pvVar2 != (void *)0x0) {

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

        *(undefined ***)((int)pvVar2 + 8) = &PTR_FUN_0079385c;

        operator_delete(pvVar2);

        pvVar2 = pvVar1;

      }

      *(undefined4 *)(*(int *)(param_1 + 8) + uVar3 * 4) = 0;

      uVar3 = uVar3 + 1;

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

  }

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

  return;

}





// --- FUN_005d1580 at 0x005D1580 (size: 72) ---


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



{

  *param_1 = &PTR_FUN_007e97f8;

  FUN_005d1400();

  if ((void *)param_1[2] != (void *)0x0) {

    operator_delete__((void *)param_1[2]);

    param_1[2] = 0;

  }

  param_1[3] = 0;

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d15d0 at 0x005D15D0 (size: 45) ---


undefined4 * __fastcall FUN_005d15d0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e980c;

  param_1[1] = &PTR_FUN_007e97f8;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0x20;

  param_1[5] = 0;

  FUN_005a8440();

  return param_1;

}





// --- FUN_005d1600 at 0x005D1600 (size: 91) ---


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



{

  *param_1 = &PTR_FUN_007e980c;

  param_1[1] = &PTR_FUN_007e97f8;

  FUN_005d1400();

  if ((void *)param_1[3] != (void *)0x0) {

    operator_delete__((void *)param_1[3]);

    param_1[3] = 0;

  }

  param_1[4] = 0;

  param_1[1] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d16a0 at 0x005D16A0 (size: 52) ---


int __fastcall FUN_005d16a0(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[4]) {

    iVar2 = (**(code **)(*piVar1 + 0xc))(&local_4,0);

    iVar3 = iVar3 + iVar2;

  }

  return iVar3;

}





// --- FUN_005d16e0 at 0x005D16E0 (size: 99) ---


void __thiscall FUN_005d16e0(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  

  iVar2 = FUN_005df0f5(0x18);

  if (iVar2 == 0) {

    iVar2 = 0;

  }

  else {

    FUN_005d1d00(param_2);

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

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

  }

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

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

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

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

    return;

  }

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

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

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

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

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

  return;

}





// --- FUN_005d1750 at 0x005D1750 (size: 101) ---


void __fastcall FUN_005d1750(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  FUN_005d1ce0();

  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;

      }

      FUN_005b7540(puVar2);

      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_005d1840 at 0x005D1840 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007e9858;

  FUN_005d1750();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d1870 at 0x005D1870 (size: 27) ---


void __fastcall FUN_005d1870(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e986c;

  param_1[1] = &PTR_FUN_007e9858;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  return;

}





// --- FUN_005d1890 at 0x005D1890 (size: 61) ---


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



{

  *param_1 = &PTR_FUN_007e986c;

  param_1[1] = &PTR_FUN_007e9858;

  FUN_005d1750();

  param_1[1] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d18d0 at 0x005D18D0 (size: 116) ---


undefined4 * __fastcall FUN_005d18d0(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007e9784;

  param_1[1] = 0;

  param_1[2] = DAT_008f0f98;

  param_1[4] = 0;

  param_1[5] = 0x4082c000;

  param_1[9] = 2;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[6] = 1;

  param_1[8] = 1;

  param_1[7] = 0xffffffff;

  param_1[10] = 0xffffffff;

  param_1[0xd] = &PTR_LAB_00797910;

  param_1[0xe] = 0;

  param_1[0xf] = 0x3f800000;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  FUN_00535b30();

  param_1[0x1f] = 0;

  return param_1;

}





// --- FUN_005d1a30 at 0x005D1A30 (size: 109) ---


int __thiscall FUN_005d1a30(int param_1,int param_2)



{

  if (param_1 != param_2) {

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

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

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

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

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

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

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

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

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

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

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

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

    FUN_00425f10(param_2 + 0x3c);

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

  }

  return param_1;

}





// --- FUN_005d1b70 at 0x005D1B70 (size: 41) ---


void __fastcall FUN_005d1b70(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e98b8;

  param_1[1] = DAT_008f0fac;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  return;

}





// --- FUN_005d1ba0 at 0x005D1BA0 (size: 67) ---


void __thiscall FUN_005d1ba0(undefined4 *param_1,undefined4 *param_2)



{

  *param_1 = &PTR_FUN_007e98b8;

  if (param_1 != param_2) {

    param_1[1] = param_2[1];

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

    param_1[4] = param_2[4];

    param_1[5] = param_2[5];

    param_1[6] = param_2[6];

    param_1[7] = param_2[7];

    param_1[8] = param_2[8];

  }

  return;

}





// --- FUN_005d1ce0 at 0x005D1CE0 (size: 20) ---


void __fastcall FUN_005d1ce0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e98cc;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  return;

}





// --- FUN_005d1d00 at 0x005D1D00 (size: 37) ---


void __thiscall FUN_005d1d00(undefined4 *param_1,undefined4 *param_2)



{

  *param_1 = &PTR_FUN_007e98cc;

  if (param_1 != param_2) {

    param_1[1] = param_2[1];

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

  }

  return;

}





// --- FUN_005d1e20 at 0x005D1E20 (size: 118) ---


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



{

  int iVar1;

  

  if (param_3 < 0x20) {

    return 0;

  }

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_005d1ea0 at 0x005D1EA0 (size: 288) ---


char * FUN_005d1ea0(undefined4 param_1,int param_2,char *param_3)



{

  char cVar1;

  char *pcVar2;

  char *pcVar3;

  

  switch(param_1) {

  case 0:

    pcVar3 = "HEAD";

    break;

  case 1:

    pcVar3 = "CHEST";

    break;

  case 2:

    pcVar3 = "ABDOMEN";

    break;

  case 3:

    pcVar3 = "UPPER_ARM";

    break;

  case 4:

    pcVar3 = "LOWER_ARM";

    break;

  case 5:

    pcVar3 = "HAND";

    break;

  case 6:

    pcVar3 = "UPPER_LEG";

    break;

  case 7:

    pcVar3 = "LOWER_LEG";

    break;

  case 8:

    pcVar3 = "FOOT";

    break;

  case 9:

    pcVar3 = "HORN";

    break;

  case 10:

    pcVar3 = "FRONT_LEG";

    break;

  default:

    pcVar3 = "Unknown";

    break;

  case 0xc:

    pcVar3 = "FRONT_FOOT";

    break;

  case 0xd:

    pcVar3 = "REAR_LEG";

    break;

  case 0xf:

    pcVar3 = "REAR_FOOT";

    break;

  case 0x10:

    pcVar3 = "TORSO";

    break;

  case 0x11:

    pcVar3 = "TAIL";

    break;

  case 0x12:

    pcVar3 = "ARM";

    break;

  case 0x13:

    pcVar3 = "LEG";

    break;

  case 0x14:

    pcVar3 = "CLAW";

    break;

  case 0x15:

    pcVar3 = "WINGS";

    break;

  case 0x16:

    pcVar3 = "BREATH";

    break;

  case 0x17:

    pcVar3 = "TENTACLE";

    break;

  case 0x18:

    pcVar3 = "UPPER_TENTACLE";

    break;

  case 0x19:

    pcVar3 = "LOWER_TENTACLE";

    break;

  case 0x1a:

    pcVar3 = "CLOAK";

    break;

  case 0x1b:

    pcVar3 = "NUM";

    break;

  case 0xffffffff:

    pcVar3 = "UNDEFINED";

  }

  pcVar2 = pcVar3;

  do {

    cVar1 = *pcVar2;

    pcVar2 = pcVar2 + 1;

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

  pcVar2 = pcVar2 + (1 - (int)(pcVar3 + 1));

  if (pcVar2 <= param_3) {

    param_2 = param_2 - (int)pcVar3;

    do {

      cVar1 = *pcVar3;

      pcVar3[param_2] = cVar1;

      pcVar3 = pcVar3 + 1;

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

    pcVar2 = (char *)0x0;

  }

  return pcVar2;

}





// --- FUN_005d2040 at 0x005D2040 (size: 84) ---


undefined4 __thiscall FUN_005d2040(int param_1,int *param_2)



{

  int iVar1;

  int *piVar2;

  uint uVar3;

  uint unaff_retaddr;

  

  piVar2 = param_2;

  iVar1 = *param_2;

  param_2 = (int *)0x0;

  uVar3 = (**(code **)(*(int *)(param_1 + 4) + 0xc))(&param_2,0);

  if (uVar3 <= unaff_retaddr) {

    (**(code **)(*(int *)(param_1 + 4) + 0x10))(piVar2,unaff_retaddr);

    if ((uint)(*piVar2 - iVar1) <= unaff_retaddr) {

      return 1;

    }

    *piVar2 = iVar1;

  }

  return 0;

}





// --- FUN_005d20f0 at 0x005D20F0 (size: 47) ---


void __fastcall FUN_005d20f0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e9a20;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  return;

}





// --- FUN_005d2120 at 0x005D2120 (size: 87) ---


void __thiscall FUN_005d2120(undefined4 *param_1,int param_2)



{

  *param_1 = &PTR_FUN_007e9a20;

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

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

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

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

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

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

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

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

  param_1[9] = *(undefined4 *)(param_2 + 0x24);

  param_1[10] = *(undefined4 *)(param_2 + 0x28);

  param_1[0xb] = *(undefined4 *)(param_2 + 0x2c);

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

  return;

}





// --- FUN_005d2180 at 0x005D2180 (size: 44) ---


void __fastcall FUN_005d2180(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e5450;

  if ((undefined4 *)param_1[0xf] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[0xf])(1);

    param_1[0xf] = 0;

  }

  param_1[4] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005d21b0 at 0x005D21B0 (size: 81) ---


void __thiscall FUN_005d21b0(int param_1,int param_2)



{

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

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

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

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

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

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

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

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

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

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

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

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

  return;

}





// --- FUN_005d2210 at 0x005D2210 (size: 129) ---


uint __thiscall FUN_005d2210(int *param_1,int *param_2,uint param_3)



{

  int iVar1;

  uint uVar2;

  

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

  if (uVar2 <= param_3) {

    *(uint *)*param_2 = (uint)(param_1[0xf] != 0);

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[1];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[2];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[3];

    *param_2 = *param_2 + 4;

    (**(code **)(param_1[4] + 0xc))(param_2,param_3);

    *(int *)*param_2 = param_1[0xe];

    *param_2 = *param_2 + 4;

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

      (**(code **)(*(int *)param_1[0xf] + 0xc))(param_2,param_3);

    }

  }

  return uVar2;

}





// --- FUN_005d23a0 at 0x005D23A0 (size: 192) ---


int __thiscall FUN_005d23a0(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 uVar3;

  

  if (param_2 != param_1) {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        FUN_005d21b0(*(int *)(param_2 + 0x3c));

        return param_1;

      }

      iVar2 = FUN_005df0f5(0x34);

      if (iVar2 != 0) {

        uVar3 = FUN_005d2120(*(undefined4 *)(param_2 + 0x3c));

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

        return param_1;

      }

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

      return param_1;

    }

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

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

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

    }

  }

  return param_1;

}





// --- FUN_005d2460 at 0x005D2460 (size: 76) ---


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



{

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  *param_1 = &PTR_FUN_007e5450;

  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[4] = &PTR_FUN_007e543c;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  FUN_005d23a0(param_2);

  return param_1;

}





// --- FUN_005d25e0 at 0x005D25E0 (size: 168) ---


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



{

  int iVar1;

  uint uVar2;

  

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

  if (uVar2 <= param_3) {

    *(int *)*param_2 = param_1[1];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[2];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[3];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[5];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[6];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[7];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[8];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[9];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[10];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[0xb];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[0xc];

    *param_2 = *param_2 + 4;

  }

  return;

}





// --- FUN_005d2690 at 0x005D2690 (size: 187) ---


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



{

  int iVar1;

  uint uVar2;

  

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

  if (param_3 < uVar2) {

    return 0;

  }

  param_1[1] = *(int *)*param_2;

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[2] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[3] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[5] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[6] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[7] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[8] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[9] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[10] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[0xb] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[0xc] = *(int *)(iVar1 + 4);

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_005d2750 at 0x005D2750 (size: 25) ---


void __fastcall FUN_005d2750(int param_1)



{

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

    (**(code **)**(undefined4 **)(param_1 + 0xc))(1);

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

  }

  return;

}





// --- FUN_005d2770 at 0x005D2770 (size: 127) ---


int __thiscall FUN_005d2770(int param_1,int param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  if (param_1 != param_2) {

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

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

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

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

        FUN_005adb20(*(int *)(param_2 + 0xc));

        return param_1;

      }

      (**(code **)**(undefined4 **)(param_1 + 0xc))(1);

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

      return param_1;

    }

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

      iVar1 = FUN_005df0f5(0xb0);

      if (iVar1 == 0) {

        uVar2 = 0;

      }

      else {

        uVar2 = FUN_005ae4d0();

      }

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

      FUN_005adb20(*(undefined4 *)(param_2 + 0xc));

    }

  }

  return param_1;

}





// --- FUN_005d27f0 at 0x005D27F0 (size: 18) ---


bool __thiscall FUN_005d27f0(int param_1,int param_2)



{

  return *(int *)(param_1 + 8) == *(int *)(param_2 + 8);

}





// --- FUN_005d2810 at 0x005D2810 (size: 20) ---


void __fastcall FUN_005d2810(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e9a34;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  return;

}





// --- FUN_005d2830 at 0x005D2830 (size: 37) ---


void __fastcall FUN_005d2830(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e9a34;

  if ((undefined4 *)param_1[3] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[3])(1);

    param_1[3] = 0;

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005d2860 at 0x005D2860 (size: 36) ---


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



{

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  *param_1 = &PTR_FUN_007e9a34;

  FUN_005d2770(param_2);

  return param_1;

}





// --- FUN_005d2a50 at 0x005D2A50 (size: 57) ---


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



{

  *param_1 = &PTR_FUN_007e9a34;

  if ((undefined4 *)param_1[3] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[3])(1);

    param_1[3] = 0;

  }

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d2a90 at 0x005D2A90 (size: 107) ---


uint __thiscall FUN_005d2a90(int param_1,int param_2)



{

  uint uVar1;

  

  uVar1 = 1;

  if (((*(uint *)(param_2 + 0x38) & *(uint *)(param_1 + 4)) != 0) &&

     ((*(byte *)(param_2 + 0x6b) & 1) == 0)) {

    uVar1 = *(uint *)(param_2 + 0x3c);

    if (*(uint *)(param_2 + 0x60) != 0) {

      uVar1 = uVar1 / *(uint *)(param_2 + 0x60);

    }

    if (uVar1 == 0) {

      return 2;

    }

    if ((*(int *)(param_1 + 0xc) != -1) && (*(int *)(param_1 + 0xc) < (int)uVar1)) {

      return ~(*(uint *)(param_2 + 0x38) >> 0x10) & 4;

    }

    if ((*(int *)(param_1 + 8) != -1) && ((int)uVar1 < *(int *)(param_1 + 8))) {

      return 3;

    }

    uVar1 = 0;

  }

  return uVar1;

}





// --- FUN_005d2b00 at 0x005D2B00 (size: 67) ---


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



{

  if (*(uint *)(param_2 + 0x60) != 0) {

    FUN_006b70c0(*(uint *)(param_2 + 0x3c) / *(uint *)(param_2 + 0x60),

                 *(undefined4 *)(param_2 + 0x38),*(undefined4 *)(param_1 + 0x18),param_3);

    return;

  }

  FUN_006b70c0(*(uint *)(param_2 + 0x3c),*(undefined4 *)(param_2 + 0x38),

               *(undefined4 *)(param_1 + 0x18),param_3);

  return;

}





// --- FUN_005d2b50 at 0x005D2B50 (size: 18) ---


bool FUN_005d2b50(undefined4 param_1)



{

  int iVar1;

  

  iVar1 = FUN_005d2a90(param_1);

  return iVar1 == 0;

}





// --- FUN_005d2b70 at 0x005D2B70 (size: 89) ---


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



{

  uint uVar1;

  int iVar2;

  undefined4 uVar3;

  

  iVar2 = FUN_005d2a90(param_3);

  if (iVar2 != 0) {

    return 0;

  }

  uVar1 = *(uint *)(param_3 + 0x60);

  if (uVar1 != 0) {

    uVar3 = FUN_006b7060(*(uint *)(param_3 + 0x3c) / uVar1,*(undefined4 *)(param_3 + 0x38),

                         *(undefined4 *)(param_1 + 0x14),uVar1);

    return uVar3;

  }

  uVar3 = FUN_006b7060(*(undefined4 *)(param_3 + 0x3c),*(undefined4 *)(param_3 + 0x38),

                       *(undefined4 *)(param_1 + 0x14),1);

  return uVar3;

}





// --- FUN_005d2bd0 at 0x005D2BD0 (size: 12) ---


void __thiscall FUN_005d2bd0(int param_1,undefined4 *param_2)



{

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

  return;

}





// --- FUN_005d2be0 at 0x005D2BE0 (size: 77) ---


undefined4 * __fastcall FUN_005d2be0(undefined4 *param_1)



{

  undefined4 uVar1;

  LONG *lpAddend;

  

  param_1[1] = 0;

  param_1[4] = 0;

  *param_1 = &PTR_FUN_007e9a48;

  param_1[2] = 0xffffffff;

  param_1[3] = 0xffffffff;

  param_1[5] = 0x3f666666;

  param_1[6] = 0x3f8ccccd;

  uVar1 = DAT_008f0fe4;

  param_1[8] = 0;

  param_1[7] = uVar1;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[9] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  return param_1;

}





// --- FUN_005d2c30 at 0x005D2C30 (size: 39) ---


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



{

  FUN_005abb30();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d2c80 at 0x005D2C80 (size: 148) ---


uint __thiscall FUN_005d2c80(int *param_1,int *param_2,uint param_3)



{

  int iVar1;

  uint uVar2;

  

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

  if (uVar2 <= param_3) {

    *(int *)*param_2 = param_1[1];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[2];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[3];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[5];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[6];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[7];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[8];

    *param_2 = *param_2 + 4;

    FUN_004fd290(param_2,param_3);

  }

  return uVar2;

}





// --- FUN_005d2d20 at 0x005D2D20 (size: 152) ---


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



{

  int iVar1;

  int iVar2;

  uint uVar3;

  int *piVar4;

  

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

  if (param_3 < uVar3) {

    return 0;

  }

  param_1[1] = *(int *)*param_2;

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[2] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[3] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[5] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[6] = *(int *)(iVar1 + 4);

  iVar1 = *param_2;

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

  *param_2 = (int)piVar4;

  iVar2 = *piVar4;

  *param_2 = iVar1 + 8;

  param_1[7] = iVar2;

  param_1[8] = *(int *)*param_2;

  *param_2 = *param_2 + 4;

  FUN_004fd460(param_2,param_3);

  return 1;

}





// --- FUN_005d2dc0 at 0x005D2DC0 (size: 42) ---


int __thiscall FUN_005d2dc0(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  

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

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

    iVar2 = 0;

    if (param_2 < 1) {

      return iVar1;

    }

    while (iVar1 != 0) {

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

      iVar2 = iVar2 + 1;

      if (param_2 <= iVar2) {

        return iVar1;

      }

    }

  }

  return 0;

}





// --- FUN_005d2df0 at 0x005D2DF0 (size: 33) ---


void __fastcall FUN_005d2df0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e9a5c;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 1;

  return;

}





// --- FUN_005d2e20 at 0x005D2E20 (size: 168) ---


void __thiscall FUN_005d2e20(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  

  if (param_3 == 0) {

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

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

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

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

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

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

      return;

    }

    *(int *)(*(int *)(param_1 + 4) + 0x1c) = param_2;

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

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

    return;

  }

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

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

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

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

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

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

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

      return;

    }

    *(int *)(*(int *)(param_1 + 8) + 0x20) = param_2;

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

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

    return;

  }

  if (param_3 < 0) {

LAB_005d2ea5:

    iVar1 = 0;

  }

  else {

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

    iVar2 = 0;

    if (0 < param_3) {

      do {

        if (iVar1 == 0) goto LAB_005d2ea5;

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

        iVar2 = iVar2 + 1;

      } while (iVar2 < param_3);

    }

  }

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

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

  *(int *)(*(int *)(iVar1 + 0x1c) + 0x20) = param_2;

  *(int *)(iVar1 + 0x1c) = param_2;

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

  return;

}





// --- FUN_005d2ed0 at 0x005D2ED0 (size: 108) ---


int __thiscall FUN_005d2ed0(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  

  if ((*(int *)(param_1 + 0xc) <= param_2) || (param_2 < 0)) {

    return 0;

  }

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

  iVar2 = 0;

  if (0 < param_2) {

    do {

      if (iVar1 == 0) {

        return 0;

      }

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

      iVar2 = iVar2 + 1;

    } while (iVar2 < param_2);

  }

  if (iVar1 != 0) {

    if (*(int *)(iVar1 + 0x1c) == 0) {

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

    }

    else {

      *(undefined4 *)(*(int *)(iVar1 + 0x1c) + 0x20) = *(undefined4 *)(iVar1 + 0x20);

    }

    if (*(int *)(iVar1 + 0x20) != 0) {

      *(undefined4 *)(*(int *)(iVar1 + 0x20) + 0x1c) = *(undefined4 *)(iVar1 + 0x1c);

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

      return iVar1;

    }

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

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

  }

  return iVar1;

}





// --- FUN_005d2f40 at 0x005D2F40 (size: 31) ---


void FUN_005d2f40(undefined4 param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005d2ed0(param_1);

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

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d2f60 at 0x005D2F60 (size: 90) ---


void __fastcall FUN_005d2f60(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

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

  while (iVar1 != 0) {

    if ((0 < *(int *)(param_1 + 0xc)) &&

       (puVar2 = *(undefined4 **)(param_1 + 4), puVar2 != (undefined4 *)0x0)) {

      if (puVar2[7] == 0) {

        *(undefined4 *)(param_1 + 4) = puVar2[8];

      }

      else {

        *(undefined4 *)(puVar2[7] + 0x20) = puVar2[8];

      }

      if (puVar2[8] == 0) {

        *(undefined4 *)(param_1 + 8) = puVar2[7];

      }

      else {

        *(undefined4 *)(puVar2[8] + 0x1c) = puVar2[7];

      }

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

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

    }

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

  }

  return;

}





// --- FUN_005d2fc0 at 0x005D2FC0 (size: 94) ---


undefined4 * __fastcall FUN_005d2fc0(undefined4 *param_1)



{

  LONG *pLVar1;

  

  *param_1 = &PTR_FUN_007cd440;

  param_1[1] = 0;

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[2] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[3] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  param_1[4] = 1;

  param_1[5] = 0;

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[6] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  param_1[7] = 0;

  param_1[8] = 0;

  return param_1;

}





// --- FUN_005d3020 at 0x005D3020 (size: 97) ---


undefined4 * __thiscall

FUN_005d3020(undefined4 *param_1,undefined4 param_2,int *param_3,int *param_4,int *param_5,

            undefined4 param_6)



{

  int iVar1;

  

  param_1[1] = param_2;

  *param_1 = &PTR_FUN_007cd440;

  iVar1 = *param_3;

  param_1[2] = iVar1;

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

  iVar1 = *param_4;

  param_1[3] = iVar1;

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

  param_1[5] = param_6;

  param_1[4] = 1;

  iVar1 = *param_5;

  param_1[6] = iVar1;

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

  param_1[7] = 0;

  param_1[8] = 0;

  return param_1;

}





// --- FUN_005d3090 at 0x005D3090 (size: 22) ---


void __fastcall FUN_005d3090(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e9a5c;

  FUN_005d2f60();

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005d30b0 at 0x005D30B0 (size: 269) ---


undefined4 __thiscall FUN_005d30b0(int param_1,int *param_2,int param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int *piVar4;

  int *piVar5;

  LONG *pLVar6;

  

  piVar4 = param_2;

  iVar1 = *param_2;

  FUN_005d2f60();

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

  iVar2 = *param_2;

  *param_2 = iVar2 + 4;

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

  iVar2 = *param_2;

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

  *param_2 = (int)piVar5;

  iVar3 = *piVar5;

  *param_2 = iVar2 + 8;

  param_2 = (int *)iVar3;

  if (0 < iVar3) {

    do {

      piVar5 = (int *)FUN_005df0f5(0x24);

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

        piVar5 = (int *)0x0;

      }

      else {

        *piVar5 = (int)&PTR_FUN_007cd440;

        piVar5[1] = 0;

        pLVar6 = (LONG *)(DAT_008ef11c + 4);

        piVar5[2] = DAT_008ef11c;

        InterlockedIncrement(pLVar6);

        pLVar6 = (LONG *)(DAT_008ef11c + 4);

        piVar5[3] = DAT_008ef11c;

        InterlockedIncrement(pLVar6);

        piVar5[4] = 1;

        piVar5[5] = 0;

        pLVar6 = (LONG *)(DAT_008ef11c + 4);

        piVar5[6] = DAT_008ef11c;

        InterlockedIncrement(pLVar6);

        piVar5[7] = 0;

        piVar5[8] = 0;

      }

      (**(code **)(*piVar5 + 0x10))(piVar4,(iVar1 + param_3) - *piVar4);

      piVar5[7] = *(int *)(param_1 + 8);

      piVar5[8] = 0;

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

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

      }

      else {

        *(int **)(*(int *)(param_1 + 8) + 0x20) = piVar5;

      }

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

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

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

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

  }

  return 1;

}





// --- FUN_005d31c0 at 0x005D31C0 (size: 189) ---


int __thiscall FUN_005d31c0(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 uVar3;

  LONG LVar4;

  

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

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

  if (puVar1 != *(undefined4 **)(param_2 + 8)) {

    LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

    }

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

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

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

  }

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

  if (puVar1 != *(undefined4 **)(param_2 + 0xc)) {

    LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    iVar2 = *(int *)(param_2 + 0xc);

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

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

  }

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

  if (puVar1 != *(undefined4 **)(param_2 + 0x18)) {

    LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

    }

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

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

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

  }

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

  uVar3 = *(undefined4 *)(param_2 + 0x10);

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

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

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

  return param_1;

}





// --- FUN_005d3280 at 0x005D3280 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007e9a5c;

  FUN_005d2f60();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d32b0 at 0x005D32B0 (size: 200) ---


undefined4 * __thiscall FUN_005d32b0(undefined4 *param_1,int param_2,int param_3)



{

  int *piVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 uVar4;

  LONG *lpAddend;

  LONG LVar5;

  

  *param_1 = &PTR_FUN_007cd440;

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

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

  param_1[2] = iVar2;

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

  iVar2 = *(int *)(param_2 + 0xc);

  param_1[3] = iVar2;

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

  if ((*(int *)(param_2 + 0x10) == 0) || (param_3 == 0)) {

    uVar4 = 0;

  }

  else {

    uVar4 = 1;

  }

  param_1[4] = uVar4;

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

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  piVar1 = param_1 + 6;

  *piVar1 = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[7] = 0;

  param_1[8] = 0;

  if (param_3 == 0) {

    FUN_004034c0(&DAT_007938af);

  }

  else {

    puVar3 = (undefined4 *)*piVar1;

    if (puVar3 != *(undefined4 **)(param_2 + 0x18)) {

      LVar5 = InterlockedDecrement(puVar3 + 1);

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

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

      }

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

      *piVar1 = iVar2;

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

      return param_1;

    }

  }

  return param_1;

}





// --- FUN_005d3460 at 0x005D3460 (size: 175) ---


undefined4 __thiscall FUN_005d3460(int param_1,int *param_2,int param_3)



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  uint *puVar4;

  

  puVar1 = (undefined4 *)*param_2;

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

  iVar2 = *param_2;

  *param_2 = iVar2 + 4;

  FUN_004fd460(param_2,(int)puVar1 + (param_3 - (iVar2 + 4)));

  FUN_004fd460(param_2,(int)puVar1 + (param_3 - *param_2));

  uVar3 = *(uint *)*param_2;

  puVar4 = (uint *)*param_2 + 1;

  *param_2 = (int)puVar4;

  if (uVar3 >> 0x10 == 0xffff) {

    if ((uVar3 & 0xffff) == 2) {

      *(uint *)(param_1 + 0x10) = *puVar4;

      iVar2 = *param_2;

      *param_2 = iVar2 + 4;

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

      *param_2 = *param_2 + 4;

    }

  }

  else {

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

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

  }

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

    FUN_004fd460(param_2,(int)puVar1 + (param_3 - *param_2));

    return 1;

  }

  FUN_004034c0(&DAT_007938af);

  return 1;

}





// --- FUN_005d3510 at 0x005D3510 (size: 165) ---


uint __thiscall FUN_005d3510(int param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  int iVar2;

  int iVar3;

  uint local_4;

  

  local_4 = 0;

  iVar2 = FUN_004fd290(&local_4,0);

  iVar3 = FUN_004fd290(&local_4,0);

  local_4 = iVar2 + 0x10 + iVar3;

  puVar1 = (undefined4 *)*param_2;

  if (local_4 <= param_3) {

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

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    FUN_004fd290(param_2,(int)puVar1 + (param_3 - (iVar2 + 4)));

    FUN_004fd290(param_2,(int)puVar1 + (param_3 - *param_2));

    *(undefined4 *)*param_2 = 0xffff0002;

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

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

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return local_4;

}





// --- FUN_005d35c0 at 0x005D35C0 (size: 125) ---


int __thiscall FUN_005d35c0(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  

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

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

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

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

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

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

  for (iVar1 = *(int *)(param_2 + 4); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x20)) {

    iVar2 = FUN_005df0f5(0x24);

    if (iVar2 == 0) {

      iVar2 = 0;

    }

    else {

      iVar2 = FUN_005d32b0(iVar1,1);

    }

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

    *(undefined4 *)(iVar2 + 0x20) = 0;

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

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

    }

    else {

      *(int *)(*(int *)(param_1 + 8) + 0x20) = iVar2;

    }

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

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

  }

  return param_1;

}





// --- FUN_005d3640 at 0x005D3640 (size: 92) ---


int __fastcall FUN_005d3640(int param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  undefined4 local_4;

  

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

  local_4 = 0;

  iVar3 = 0xc;

  for (; piVar1 != (int *)0x0; piVar1 = (int *)piVar1[8]) {

    if ((*(int *)(param_1 + 0x18) == 0) || (piVar1[4] == 0)) {

      iVar2 = FUN_005d3510(&local_4,0);

    }

    else {

      iVar2 = (**(code **)(*piVar1 + 0xc))(&local_4,0);

    }

    iVar3 = iVar3 + iVar2;

  }

  return iVar3;

}





// --- FUN_005d37a0 at 0x005D37A0 (size: 105) ---


undefined4 * __fastcall FUN_005d37a0(undefined4 *param_1)



{

  int iVar1;

  int iVar2;

  byte *pbVar3;

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007e6084;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[1] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[2] = 0;

  param_1[3] = 0xffffffff;

  FUN_004034c0(&DAT_007938af);

  FUN_00411870();

  iVar1 = param_1[1];

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

  for (pbVar3 = (byte *)(iVar1 + 0x14); pbVar3 != (byte *)(iVar2 + 0x13 + iVar1);

      pbVar3 = pbVar3 + 1) {

    *pbVar3 = *pbVar3 >> 4 | *pbVar3 << 4;

  }

  return param_1;

}





// --- FUN_005d3880 at 0x005D3880 (size: 90) ---


undefined4 __thiscall FUN_005d3880(int param_1,int *param_2)



{

  int iVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint unaff_retaddr;

  

  piVar2 = param_2;

  iVar1 = *param_2;

  param_2 = (int *)0x0;

  uVar3 = (**(code **)(*(int *)(param_1 + 8) + 0xc))(&param_2,0);

  if (uVar3 <= unaff_retaddr) {

    iVar4 = (**(code **)(*(int *)(param_1 + 8) + 0x10))(piVar2,unaff_retaddr);

    if (iVar4 != 0) {

      if ((uint)(*piVar2 - iVar1) <= unaff_retaddr) {

        return 1;

      }

      *piVar2 = iVar1;

    }

  }

  return 0;

}





// --- FUN_005d38e0 at 0x005D38E0 (size: 71) ---


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



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007e9a88;

  param_1[0xc] = &PTR_LAB_007e9a70;

  param_1[0xe] = &PTR_FUN_007e6070;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0x20;

  param_1[0x12] = 0;

  FUN_005a8440();

  return param_1;

}





// --- FUN_005d3970 at 0x005D3970 (size: 40) ---


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



{

  FUN_0059a370();

  FUN_004f8190();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d39a0 at 0x005D39A0 (size: 60) ---


bool __thiscall FUN_005d39a0(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 uVar2;

  

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

    iVar1 = FUN_005df0f5(0x4c);

    if (iVar1 == 0) {

      uVar2 = 0;

    }

    else {

      uVar2 = FUN_005d6880();

    }

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

  }

  iVar1 = FUN_005d68a0(param_2);

  return iVar1 != 0;

}





// --- FUN_005d39e0 at 0x005D39E0 (size: 15) ---


void __fastcall FUN_005d39e0(int param_1)



{

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

    FUN_005d67a0();

    return;

  }

  return;

}





// --- FUN_005d39f0 at 0x005D39F0 (size: 14) ---


int __thiscall FUN_005d39f0(int param_1,int param_2)



{

  return param_2 * 0x10 + 8 + param_1;

}





// --- FUN_005d3a00 at 0x005D3A00 (size: 31) ---


void __fastcall FUN_005d3a00(int param_1)



{

  if (*(undefined4 **)(param_1 + 0x88) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x88))(1);

  }

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

  return;

}





// --- FUN_005d3a20 at 0x005D3A20 (size: 13) ---


uint __fastcall FUN_005d3a20(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 6 & 1;

}





// --- FUN_005d3a30 at 0x005D3A30 (size: 33) ---


undefined4 FUN_005d3a30(undefined4 param_1)



{

  switch(param_1) {

  case 0:

  case 2:

  case 6:

  case 8:

  case 10:

  case 0xd:

  case 0xe:

  case 0xf:

  case 0x14:

  case 0x15:

  case 0x19:

  case 0x1b:

  case 0x23:

  case 0x24:

  case 0x25:

  case 0x2a:

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005d3a90 at 0x005D3A90 (size: 12) ---


uint __fastcall FUN_005d3a90(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 1 & 1;

}





// --- FUN_005d3aa0 at 0x005D3AA0 (size: 59) ---


void __thiscall FUN_005d3aa0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 1) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfffffffd;

    }

    else {

      uVar1 = param_1[0x23] | 2;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3ae0 at 0x005D3AE0 (size: 13) ---


uint __fastcall FUN_005d3ae0(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 2 & 1;

}





// --- FUN_005d3af0 at 0x005D3AF0 (size: 60) ---


void __thiscall FUN_005d3af0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 2) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfffffffb;

    }

    else {

      uVar1 = param_1[0x23] | 4;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3b30 at 0x005D3B30 (size: 13) ---


uint __fastcall FUN_005d3b30(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 3 & 1;

}





// --- FUN_005d3b40 at 0x005D3B40 (size: 60) ---


void __thiscall FUN_005d3b40(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 3) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfffffff7;

    }

    else {

      uVar1 = param_1[0x23] | 8;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3b80 at 0x005D3B80 (size: 13) ---


uint __fastcall FUN_005d3b80(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x11 & 1;

}





// --- FUN_005d3b90 at 0x005D3B90 (size: 64) ---


void __thiscall FUN_005d3b90(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x11) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfffdffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x20000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3bd0 at 0x005D3BD0 (size: 12) ---


byte __fastcall FUN_005d3bd0(int param_1)



{

  return *(byte *)(param_1 + 0x8e) & 1;

}





// --- FUN_005d3be0 at 0x005D3BE0 (size: 61) ---


void __thiscall FUN_005d3be0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if ((*(byte *)((int)param_1 + 0x8e) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfffeffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x10000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3c20 at 0x005D3C20 (size: 10) ---


uint __fastcall FUN_005d3c20(int param_1)



{

  return *(uint *)(param_1 + 0x90) & 1;

}





// --- FUN_005d3c30 at 0x005D3C30 (size: 57) ---


void __thiscall FUN_005d3c30(int *param_1,byte param_2)



{

  uint uVar1;

  

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

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffffffe;

    }

    else {

      uVar1 = param_1[0x24] | 1;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3c70 at 0x005D3C70 (size: 60) ---


void __thiscall FUN_005d3c70(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 6) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xffffffbf;

    }

    else {

      uVar1 = param_1[0x23] | 0x40;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3cb0 at 0x005D3CB0 (size: 13) ---


uint __fastcall FUN_005d3cb0(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 7 & 1;

}





// --- FUN_005d3cc0 at 0x005D3CC0 (size: 64) ---


void __thiscall FUN_005d3cc0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 7) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xffffff7f;

    }

    else {

      uVar1 = param_1[0x23] | 0x80;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3d00 at 0x005D3D00 (size: 13) ---


uint __fastcall FUN_005d3d00(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 8 & 1;

}





// --- FUN_005d3d10 at 0x005D3D10 (size: 64) ---


void __thiscall FUN_005d3d10(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 8) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfffffeff;

    }

    else {

      uVar1 = param_1[0x23] | 0x100;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3d50 at 0x005D3D50 (size: 13) ---


uint __fastcall FUN_005d3d50(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 9 & 1;

}





// --- FUN_005d3d60 at 0x005D3D60 (size: 64) ---


void __thiscall FUN_005d3d60(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 9) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfffffdff;

    }

    else {

      uVar1 = param_1[0x23] | 0x200;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3da0 at 0x005D3DA0 (size: 13) ---


uint __fastcall FUN_005d3da0(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 10 & 1;

}





// --- FUN_005d3db0 at 0x005D3DB0 (size: 64) ---


void __thiscall FUN_005d3db0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 10) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfffffbff;

    }

    else {

      uVar1 = param_1[0x23] | 0x400;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3df0 at 0x005D3DF0 (size: 13) ---


uint __fastcall FUN_005d3df0(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0xb & 1;

}





// --- FUN_005d3e00 at 0x005D3E00 (size: 64) ---


void __thiscall FUN_005d3e00(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0xb) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfffff7ff;

    }

    else {

      uVar1 = param_1[0x23] | 0x800;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3e40 at 0x005D3E40 (size: 13) ---


uint __fastcall FUN_005d3e40(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0xc & 1;

}





// --- FUN_005d3e50 at 0x005D3E50 (size: 64) ---


void __thiscall FUN_005d3e50(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0xc) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xffffefff;

    }

    else {

      uVar1 = param_1[0x23] | 0x1000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3e90 at 0x005D3E90 (size: 13) ---


uint __fastcall FUN_005d3e90(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0xd & 1;

}





// --- FUN_005d3ea0 at 0x005D3EA0 (size: 64) ---


void __thiscall FUN_005d3ea0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0xd) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xffffdfff;

    }

    else {

      uVar1 = param_1[0x23] | 0x2000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3ee0 at 0x005D3EE0 (size: 13) ---


uint __fastcall FUN_005d3ee0(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0xf & 1;

}





// --- FUN_005d3ef0 at 0x005D3EF0 (size: 64) ---


void __thiscall FUN_005d3ef0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0xf) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xffff7fff;

    }

    else {

      uVar1 = param_1[0x23] | 0x8000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3f30 at 0x005D3F30 (size: 13) ---


uint __fastcall FUN_005d3f30(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x12 & 1;

}





// --- FUN_005d3f40 at 0x005D3F40 (size: 64) ---


void __thiscall FUN_005d3f40(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x12) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfffbffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x40000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3f80 at 0x005D3F80 (size: 13) ---


uint __fastcall FUN_005d3f80(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x13 & 1;

}





// --- FUN_005d3f90 at 0x005D3F90 (size: 64) ---


void __thiscall FUN_005d3f90(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x13) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfff7ffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x80000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d3fd0 at 0x005D3FD0 (size: 13) ---


uint __fastcall FUN_005d3fd0(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x14 & 1;

}





// --- FUN_005d3fe0 at 0x005D3FE0 (size: 64) ---


void __thiscall FUN_005d3fe0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x14) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xffefffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x100000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4020 at 0x005D4020 (size: 13) ---


uint __fastcall FUN_005d4020(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x1d & 1;

}





// --- FUN_005d4030 at 0x005D4030 (size: 64) ---


void __thiscall FUN_005d4030(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x1d) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xdfffffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x20000000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4070 at 0x005D4070 (size: 13) ---


uint __fastcall FUN_005d4070(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x15 & 1;

}





// --- FUN_005d4080 at 0x005D4080 (size: 64) ---


void __thiscall FUN_005d4080(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x15) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xffdfffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x200000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d40c0 at 0x005D40C0 (size: 13) ---


uint __fastcall FUN_005d40c0(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x16 & 1;

}





// --- FUN_005d40d0 at 0x005D40D0 (size: 64) ---


void __thiscall FUN_005d40d0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x16) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xffbfffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x400000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4110 at 0x005D4110 (size: 13) ---


uint __fastcall FUN_005d4110(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x17 & 1;

}





// --- FUN_005d4120 at 0x005D4120 (size: 64) ---


void __thiscall FUN_005d4120(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x17) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xff7fffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x800000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4160 at 0x005D4160 (size: 13) ---


uint __fastcall FUN_005d4160(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x19 & 1;

}





// --- FUN_005d4170 at 0x005D4170 (size: 64) ---


void __thiscall FUN_005d4170(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x19) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfdffffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x2000000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d41b0 at 0x005D41B0 (size: 13) ---


uint __fastcall FUN_005d41b0(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x1a & 1;

}





// --- FUN_005d41c0 at 0x005D41C0 (size: 64) ---


void __thiscall FUN_005d41c0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x1a) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xfbffffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x4000000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4200 at 0x005D4200 (size: 13) ---


uint __fastcall FUN_005d4200(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x1b & 1;

}





// --- FUN_005d4210 at 0x005D4210 (size: 64) ---


void __thiscall FUN_005d4210(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x1b) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xf7ffffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x8000000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4250 at 0x005D4250 (size: 13) ---


uint __fastcall FUN_005d4250(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x1c & 1;

}





// --- FUN_005d4260 at 0x005D4260 (size: 64) ---


void __thiscall FUN_005d4260(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x1c) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xefffffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x10000000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d42a0 at 0x005D42A0 (size: 13) ---


uint __fastcall FUN_005d42a0(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0x14 & 1;

}





// --- FUN_005d42b0 at 0x005D42B0 (size: 64) ---


void __thiscall FUN_005d42b0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0x14) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffefffff;

    }

    else {

      uVar1 = param_1[0x24] | 0x100000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d42f0 at 0x005D42F0 (size: 64) ---


void __thiscall FUN_005d42f0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0x17) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xff7fffff;

    }

    else {

      uVar1 = param_1[0x24] | 0x800000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4330 at 0x005D4330 (size: 12) ---


byte __fastcall FUN_005d4330(int param_1)



{

  return *(byte *)(param_1 + 0x93) & 1;

}





// --- FUN_005d4340 at 0x005D4340 (size: 61) ---


void __thiscall FUN_005d4340(int *param_1,byte param_2)



{

  uint uVar1;

  

  if ((*(byte *)((int)param_1 + 0x93) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfeffffff;

    }

    else {

      uVar1 = param_1[0x24] | 0x1000000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4380 at 0x005D4380 (size: 13) ---


uint __fastcall FUN_005d4380(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0x16 & 1;

}





// --- FUN_005d4390 at 0x005D4390 (size: 64) ---


void __thiscall FUN_005d4390(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0x16) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffbfffff;

    }

    else {

      uVar1 = param_1[0x24] | 0x400000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d43d0 at 0x005D43D0 (size: 13) ---


uint __fastcall FUN_005d43d0(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0x15 & 1;

}





// --- FUN_005d43e0 at 0x005D43E0 (size: 64) ---


void __thiscall FUN_005d43e0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0x15) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffdfffff;

    }

    else {

      uVar1 = param_1[0x24] | 0x200000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4420 at 0x005D4420 (size: 13) ---


uint __fastcall FUN_005d4420(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0xf & 1;

}





// --- FUN_005d4430 at 0x005D4430 (size: 64) ---


void __thiscall FUN_005d4430(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0xf) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffff7fff;

    }

    else {

      uVar1 = param_1[0x24] | 0x8000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4470 at 0x005D4470 (size: 12) ---


byte __fastcall FUN_005d4470(int param_1)



{

  return *(byte *)(param_1 + 0x92) & 1;

}





// --- FUN_005d4480 at 0x005D4480 (size: 61) ---


void __thiscall FUN_005d4480(int *param_1,byte param_2)



{

  uint uVar1;

  

  if ((*(byte *)((int)param_1 + 0x92) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffeffff;

    }

    else {

      uVar1 = param_1[0x24] | 0x10000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d44c0 at 0x005D44C0 (size: 10) ---


uint __fastcall FUN_005d44c0(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x1f;

}





// --- FUN_005d44d0 at 0x005D44D0 (size: 64) ---


void __thiscall FUN_005d44d0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if ((byte)((uint)param_1[0x23] >> 0x1f) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0x7fffffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x80000000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4510 at 0x005D4510 (size: 13) ---


uint __fastcall FUN_005d4510(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0x12 & 1;

}





// --- FUN_005d4520 at 0x005D4520 (size: 64) ---


void __thiscall FUN_005d4520(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0x12) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffbffff;

    }

    else {

      uVar1 = param_1[0x24] | 0x40000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4560 at 0x005D4560 (size: 13) ---


uint __fastcall FUN_005d4560(int param_1)



{

  return *(uint *)(param_1 + 0x8c) >> 0x1e & 1;

}





// --- FUN_005d4570 at 0x005D4570 (size: 64) ---


void __thiscall FUN_005d4570(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x23] >> 0x1e) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x23] & 0xbfffffff;

    }

    else {

      uVar1 = param_1[0x23] | 0x40000000;

    }

    param_1[0x23] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d45b0 at 0x005D45B0 (size: 13) ---


uint __fastcall FUN_005d45b0(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 8 & 1;

}





// --- FUN_005d45c0 at 0x005D45C0 (size: 64) ---


void __thiscall FUN_005d45c0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 8) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffffeff;

    }

    else {

      uVar1 = param_1[0x24] | 0x100;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4600 at 0x005D4600 (size: 13) ---


uint __fastcall FUN_005d4600(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 9 & 1;

}





// --- FUN_005d4610 at 0x005D4610 (size: 64) ---


void __thiscall FUN_005d4610(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 9) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffffdff;

    }

    else {

      uVar1 = param_1[0x24] | 0x200;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4650 at 0x005D4650 (size: 13) ---


uint __fastcall FUN_005d4650(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 10 & 1;

}





// --- FUN_005d4660 at 0x005D4660 (size: 64) ---


void __thiscall FUN_005d4660(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 10) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffffbff;

    }

    else {

      uVar1 = param_1[0x24] | 0x400;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d46a0 at 0x005D46A0 (size: 13) ---


uint __fastcall FUN_005d46a0(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0xb & 1;

}





// --- FUN_005d46b0 at 0x005D46B0 (size: 64) ---


void __thiscall FUN_005d46b0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0xb) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffff7ff;

    }

    else {

      uVar1 = param_1[0x24] | 0x800;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d46f0 at 0x005D46F0 (size: 13) ---


uint __fastcall FUN_005d46f0(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0x13 & 1;

}





// --- FUN_005d4700 at 0x005D4700 (size: 64) ---


void __thiscall FUN_005d4700(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0x13) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfff7ffff;

    }

    else {

      uVar1 = param_1[0x24] | 0x80000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4740 at 0x005D4740 (size: 13) ---


uint __fastcall FUN_005d4740(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0x19 & 1;

}





// --- FUN_005d4750 at 0x005D4750 (size: 64) ---


void __thiscall FUN_005d4750(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0x19) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfdffffff;

    }

    else {

      uVar1 = param_1[0x24] | 0x2000000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4790 at 0x005D4790 (size: 64) ---


void __thiscall FUN_005d4790(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0xc) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffffefff;

    }

    else {

      uVar1 = param_1[0x24] | 0x1000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d47d0 at 0x005D47D0 (size: 12) ---


uint __fastcall FUN_005d47d0(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 1 & 1;

}





// --- FUN_005d47e0 at 0x005D47E0 (size: 59) ---


void __thiscall FUN_005d47e0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 1) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffffffd;

    }

    else {

      uVar1 = param_1[0x24] | 2;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4820 at 0x005D4820 (size: 13) ---


uint __fastcall FUN_005d4820(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 5 & 1;

}





// --- FUN_005d4830 at 0x005D4830 (size: 60) ---


void __thiscall FUN_005d4830(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 5) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffffffdf;

    }

    else {

      uVar1 = param_1[0x24] | 0x20;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4870 at 0x005D4870 (size: 13) ---


uint __fastcall FUN_005d4870(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 2 & 1;

}





// --- FUN_005d4880 at 0x005D4880 (size: 60) ---


void __thiscall FUN_005d4880(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 2) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffffffb;

    }

    else {

      uVar1 = param_1[0x24] | 4;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d48c0 at 0x005D48C0 (size: 13) ---


uint __fastcall FUN_005d48c0(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 3 & 1;

}





// --- FUN_005d48d0 at 0x005D48D0 (size: 60) ---


void __thiscall FUN_005d48d0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 3) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffffff7;

    }

    else {

      uVar1 = param_1[0x24] | 8;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4910 at 0x005D4910 (size: 13) ---


uint __fastcall FUN_005d4910(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 4 & 1;

}





// --- FUN_005d4920 at 0x005D4920 (size: 60) ---


void __thiscall FUN_005d4920(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 4) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffffffef;

    }

    else {

      uVar1 = param_1[0x24] | 0x10;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4960 at 0x005D4960 (size: 13) ---


uint __fastcall FUN_005d4960(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0xd & 1;

}





// --- FUN_005d4970 at 0x005D4970 (size: 64) ---


void __thiscall FUN_005d4970(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0xd) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffffdfff;

    }

    else {

      uVar1 = param_1[0x24] | 0x2000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d49b0 at 0x005D49B0 (size: 13) ---


uint __fastcall FUN_005d49b0(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0x11 & 1;

}





// --- FUN_005d49c0 at 0x005D49C0 (size: 64) ---


void __thiscall FUN_005d49c0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0x11) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xfffdffff;

    }

    else {

      uVar1 = param_1[0x24] | 0x20000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4a00 at 0x005D4A00 (size: 13) ---


uint __fastcall FUN_005d4a00(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 6 & 1;

}





// --- FUN_005d4a10 at 0x005D4A10 (size: 60) ---


void __thiscall FUN_005d4a10(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 6) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffffffbf;

    }

    else {

      uVar1 = param_1[0x24] | 0x40;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4a50 at 0x005D4A50 (size: 13) ---


uint __fastcall FUN_005d4a50(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 7 & 1;

}





// --- FUN_005d4a60 at 0x005D4A60 (size: 64) ---


void __thiscall FUN_005d4a60(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 7) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffffff7f;

    }

    else {

      uVar1 = param_1[0x24] | 0x80;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4aa0 at 0x005D4AA0 (size: 13) ---


uint __fastcall FUN_005d4aa0(int param_1)



{

  return *(uint *)(param_1 + 0x90) >> 0xe & 1;

}





// --- FUN_005d4ab0 at 0x005D4AB0 (size: 64) ---


void __thiscall FUN_005d4ab0(int *param_1,byte param_2)



{

  uint uVar1;

  

  if (((byte)((uint)param_1[0x24] >> 0xe) & 1) != param_2) {

    if (param_2 == 0) {

      uVar1 = param_1[0x24] & 0xffffbfff;

    }

    else {

      uVar1 = param_1[0x24] | 0x4000;

    }

    param_1[0x24] = uVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_005d4af0 at 0x005D4AF0 (size: 1057) ---


uint __thiscall FUN_005d4af0(int param_1,uint param_2)



{

  if (param_2 == 0) {

    return *(uint *)(param_1 + 0x8c) >> 1 & 1;

  }

  if (param_2 == 1) {

    return *(uint *)(param_1 + 0x8c) >> 2 & 1;

  }

  if (param_2 == 2) {

    return *(uint *)(param_1 + 0x8c) >> 3 & 1;

  }

  if (param_2 == 3) {

    return *(uint *)(param_1 + 0x8c) >> 0x11 & 1;

  }

  if (param_2 == 4) {

    return *(byte *)(param_1 + 0x8e) & 1;

  }

  if (param_2 == 5) {

    return *(uint *)(param_1 + 0x90) & 1;

  }

  if (param_2 == 6) {

    return *(uint *)(param_1 + 0x8c) >> 6 & 1;

  }

  if (param_2 == 7) {

    return *(uint *)(param_1 + 0x8c) >> 7 & 1;

  }

  if (param_2 == 8) {

    return *(uint *)(param_1 + 0x8c) >> 8 & 1;

  }

  if (param_2 == 9) {

    return *(uint *)(param_1 + 0x8c) >> 9 & 1;

  }

  if (param_2 == 10) {

    return *(uint *)(param_1 + 0x8c) >> 10 & 1;

  }

  if (param_2 == 0xb) {

    return *(uint *)(param_1 + 0x8c) >> 0xb & 1;

  }

  if (param_2 == 0xc) {

    return *(uint *)(param_1 + 0x8c) >> 0xc & 1;

  }

  if (param_2 == 0xd) {

    return *(uint *)(param_1 + 0x8c) >> 0xd & 1;

  }

  if (param_2 == 0xe) {

    return *(uint *)(param_1 + 0x8c) >> 0xf & 1;

  }

  if (param_2 == 0xf) {

    return *(uint *)(param_1 + 0x8c) >> 0x12 & 1;

  }

  if (param_2 == 0x10) {

    return *(uint *)(param_1 + 0x8c) >> 0x13 & 1;

  }

  if (param_2 == 0x11) {

    return *(uint *)(param_1 + 0x8c) >> 0x14 & 1;

  }

  if (param_2 == 0x12) {

    return *(uint *)(param_1 + 0x8c) >> 0x1d & 1;

  }

  if (param_2 == 0x13) {

    return *(uint *)(param_1 + 0x8c) >> 0x15 & 1;

  }

  if (param_2 == 0x14) {

    return *(uint *)(param_1 + 0x8c) >> 0x16 & 1;

  }

  if (param_2 == 0x15) {

    return *(uint *)(param_1 + 0x8c) >> 0x17 & 1;

  }

  if (param_2 == 0x16) {

    return *(uint *)(param_1 + 0x8c) >> 0x19 & 1;

  }

  if (param_2 == 0x17) {

    return *(uint *)(param_1 + 0x8c) >> 0x1a & 1;

  }

  if (param_2 == 0x18) {

    return *(uint *)(param_1 + 0x8c) >> 0x1b & 1;

  }

  if (param_2 == 0x19) {

    return *(uint *)(param_1 + 0x8c) >> 0x1c & 1;

  }

  if (param_2 == 0x2a) {

    return *(uint *)(param_1 + 0x90) >> 0xf & 1;

  }

  if (param_2 == 0x2b) {

    return *(byte *)(param_1 + 0x92) & 1;

  }

  if (param_2 == 0x1a) {

    return *(uint *)(param_1 + 0x8c) >> 0x1f;

  }

  if (param_2 == 0x2d) {

    return *(uint *)(param_1 + 0x90) >> 0x12 & 1;

  }

  if (param_2 == 0x1b) {

    return *(uint *)(param_1 + 0x8c) >> 0x1e & 1;

  }

  if (param_2 == 0x23) {

    return *(uint *)(param_1 + 0x90) >> 8 & 1;

  }

  if (param_2 == 0x24) {

    return *(uint *)(param_1 + 0x90) >> 9 & 1;

  }

  if (param_2 == 0x25) {

    return *(uint *)(param_1 + 0x90) >> 10 & 1;

  }

  if (param_2 == 0x26) {

    return *(uint *)(param_1 + 0x90) >> 0xb & 1;

  }

  if (param_2 == 0x27) {

    return *(uint *)(param_1 + 0x90) >> 0xc & 1;

  }

  if (param_2 == 0x1c) {

    return *(uint *)(param_1 + 0x90) >> 1 & 1;

  }

  if (param_2 == 0x1d) {

    return *(uint *)(param_1 + 0x90) >> 5 & 1;

  }

  if (param_2 == 0x1e) {

    return *(uint *)(param_1 + 0x90) >> 2 & 1;

  }

  if (param_2 == 0x1f) {

    return *(uint *)(param_1 + 0x90) >> 3 & 1;

  }

  if (param_2 == 0x20) {

    return *(uint *)(param_1 + 0x90) >> 4 & 1;

  }

  if (param_2 == 0x28) {

    return *(uint *)(param_1 + 0x90) >> 0xd & 1;

  }

  if (param_2 == 0x21) {

    return *(uint *)(param_1 + 0x90) >> 6 & 1;

  }

  if (param_2 == 0x2c) {

    return *(uint *)(param_1 + 0x90) >> 0x11 & 1;

  }

  if (param_2 == 0x22) {

    return *(uint *)(param_1 + 0x90) >> 7 & 1;

  }

  if (param_2 == 0x29) {

    return *(uint *)(param_1 + 0x90) >> 0xe & 1;

  }

  if (param_2 == 0x2e) {

    return *(uint *)(param_1 + 0x90) >> 0x13 & 1;

  }

  if (param_2 == 0x2f) {

    return *(uint *)(param_1 + 0x90) >> 0x14 & 1;

  }

  if (param_2 == 0x30) {

    return *(uint *)(param_1 + 0x90) >> 0x15 & 1;

  }

  if (param_2 == 0x31) {

    return *(uint *)(param_1 + 0x90) >> 0x16 & 1;

  }

  if (param_2 == 0x32) {

    return *(uint *)(param_1 + 0x90) >> 0x17 & 1;

  }

  if (param_2 == 0x33) {

    return *(byte *)(param_1 + 0x93) & 1;

  }

  if (param_2 == 0x34) {

    return *(uint *)(param_1 + 0x90) >> 0x19 & 1;

  }

  return param_2 & 0xffffff00;

}





// --- FUN_005d4f20 at 0x005D4F20 (size: 1015) ---


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



{

  if (param_2 == 0) {

    if (((byte)((uint)param_1[0x23] >> 1) & 1) != (byte)param_3) {

      if ((byte)param_3 != 0) {

        param_1[0x23] = param_1[0x23] | 2;

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

        return;

      }

      param_1[0x23] = param_1[0x23] & 0xfffffffd;

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

      return;

    }

  }

  else {

    if (param_2 == 1) {

      FUN_005d3af0(param_3);

      return;

    }

    if (param_2 == 2) {

      FUN_005d3b40(param_3);

      return;

    }

    if (param_2 == 3) {

      FUN_005d3b90(param_3);

      return;

    }

    if (param_2 == 4) {

      FUN_005d3be0(param_3);

      return;

    }

    if (param_2 == 5) {

      FUN_005d3c30(param_3);

      return;

    }

    if (param_2 == 6) {

      FUN_005d3c70(param_3);

      return;

    }

    if (param_2 == 7) {

      FUN_005d3cc0(param_3);

      return;

    }

    if (param_2 == 8) {

      FUN_005d3d10(param_3);

      return;

    }

    if (param_2 == 9) {

      FUN_005d3d60(param_3);

      return;

    }

    if (param_2 == 10) {

      FUN_005d3db0(param_3);

      return;

    }

    if (param_2 == 0xb) {

      FUN_005d3e00(param_3);

      return;

    }

    if (param_2 == 0xc) {

      FUN_005d3e50(param_3);

      return;

    }

    if (param_2 == 0xd) {

      FUN_005d3ea0(param_3);

      return;

    }

    if (param_2 == 0xe) {

      FUN_005d3ef0(param_3);

      return;

    }

    if (param_2 == 0xf) {

      FUN_005d3f40(param_3);

      return;

    }

    if (param_2 == 0x10) {

      FUN_005d3f90(param_3);

      return;

    }

    if (param_2 == 0x11) {

      FUN_005d3fe0(param_3);

      return;

    }

    if (param_2 == 0x12) {

      FUN_005d4030(param_3);

      return;

    }

    if (param_2 == 0x13) {

      FUN_005d4080(param_3);

      return;

    }

    if (param_2 == 0x14) {

      FUN_005d40d0(param_3);

      return;

    }

    if (param_2 == 0x15) {

      FUN_005d4120(param_3);

      return;

    }

    if (param_2 == 0x16) {

      FUN_005d4170(param_3);

      return;

    }

    if (param_2 == 0x17) {

      FUN_005d41c0(param_3);

      return;

    }

    if (param_2 == 0x18) {

      FUN_005d4210(param_3);

      return;

    }

    if (param_2 == 0x19) {

      FUN_005d4260(param_3);

      return;

    }

    if (param_2 == 0x2a) {

      FUN_005d4430(param_3);

      return;

    }

    if (param_2 == 0x2b) {

      FUN_005d4480(param_3);

      return;

    }

    if (param_2 == 0x1a) {

      FUN_005d44d0(param_3);

      return;

    }

    if (param_2 == 0x2d) {

      FUN_005d4520(param_3);

      return;

    }

    if (param_2 == 0x1b) {

      FUN_005d4570(param_3);

      return;

    }

    if (param_2 == 0x23) {

      FUN_005d45c0(param_3);

      return;

    }

    if (param_2 == 0x24) {

      FUN_005d4610(param_3);

      return;

    }

    if (param_2 == 0x25) {

      FUN_005d4660(param_3);

      return;

    }

    if (param_2 == 0x26) {

      FUN_005d46b0(param_3);

      return;

    }

    if (param_2 == 0x27) {

      FUN_005d4790(param_3);

      return;

    }

    if (param_2 == 0x1c) {

      FUN_005d47e0(param_3);

      return;

    }

    if (param_2 == 0x1d) {

      FUN_005d4830(param_3);

      return;

    }

    if (param_2 == 0x1e) {

      FUN_005d4880(param_3);

      return;

    }

    if (param_2 == 0x1f) {

      FUN_005d48d0(param_3);

      return;

    }

    if (param_2 == 0x20) {

      FUN_005d4920(param_3);

      return;

    }

    if (param_2 == 0x28) {

      FUN_005d4970(param_3);

      return;

    }

    if (param_2 == 0x21) {

      FUN_005d4a10(param_3);

      return;

    }

    if (param_2 == 0x2c) {

      FUN_005d49c0(param_3);

      return;

    }

    if (param_2 == 0x22) {

      FUN_005d4a60(param_3);

      return;

    }

    if (param_2 == 0x29) {

      FUN_005d4ab0(param_3);

      return;

    }

    if (param_2 == 0x2e) {

      FUN_005d4700(param_3);

      return;

    }

    if (param_2 == 0x2f) {

      FUN_005d42b0(param_3);

      return;

    }

    if (param_2 == 0x30) {

      FUN_005d43e0(param_3);

      return;

    }

    if (param_2 == 0x31) {

      FUN_005d4390(param_3);

      return;

    }

    if (param_2 == 0x32) {

      FUN_005d42f0(param_3);

      return;

    }

    if (param_2 == 0x33) {

      FUN_005d4340(param_3);

      return;

    }

    if (param_2 == 0x34) {

      FUN_005d4750(param_3);

    }

  }

  return;

}





// --- FUN_005d5320 at 0x005D5320 (size: 168) ---


int __thiscall FUN_005d5320(int param_1,int param_2,undefined4 *param_3)



{

  int iVar1;

  undefined4 uVar2;

  int iVar3;

  undefined4 *puVar4;

  

  puVar4 = (undefined4 *)FUN_005df0f5(0xc);

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

    puVar4 = (undefined4 *)0x0;

  }

  else {

    *puVar4 = *param_3;

    puVar4[1] = 0;

    puVar4[2] = 0;

  }

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

  iVar3 = param_2;

  if (iVar1 == 0) {

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

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

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

    return 0;

  }

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

    if (iVar1 == 0) goto LAB_005d5383;

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

  }

  if (iVar1 != 0) {

    if (*(int *)(iVar1 + 8) == 0) {

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

    }

    else {

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

    }

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

    puVar4[1] = iVar1;

    puVar4[2] = uVar2;

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

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

    return param_2;

  }

LAB_005d5383:

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

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

  puVar4[2] = iVar1;

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

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

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

  return iVar1;

}





// --- FUN_005d53d0 at 0x005D53D0 (size: 40) ---


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



{

  param_1[3] = param_2;

  *param_1 = &PTR_FUN_007e9ae0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[4] = 0;

  FUN_005a8440();

  return param_1;

}





// --- FUN_005d5400 at 0x005D5400 (size: 87) ---


void __thiscall FUN_005d5400(int param_1,undefined4 *param_2)



{

  uint uVar1;

  int *piVar2;

  undefined4 uVar3;

  int iVar4;

  uint uVar5;

  int *piVar6;

  

  uVar1 = *(uint *)(param_1 + 0xc);

  uVar5 = 0;

  if (uVar1 != 0) {

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

    piVar6 = piVar2;

    do {

      if (*piVar6 != 0) {

        iVar4 = piVar2[uVar5];

        param_2[2] = piVar2;

        param_2[1] = iVar4;

        *param_2 = &PTR_LAB_007b6124;

        param_2[3] = uVar1;

        return;

      }

      uVar5 = uVar5 + 1;

      piVar6 = piVar6 + 1;

    } while (uVar5 < uVar1);

  }

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

  param_2[1] = 0;

  param_2[2] = uVar3;

  *param_2 = &PTR_LAB_007b6124;

  param_2[3] = uVar1;

  return;

}





// --- FUN_005d5460 at 0x005D5460 (size: 38) ---


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



{

  if ((-1 < param_3) && (param_3 < 8)) {

    FUN_005d5320(param_2,&param_1);

  }

  return;

}





// --- FUN_005d5490 at 0x005D5490 (size: 51) ---


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



{

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

    *param_2 = &PTR_LAB_007b6124;

    param_2[1] = 0;

    param_2[2] = 0;

    param_2[3] = 0;

    return param_2;

  }

  FUN_005d5400(param_2);

  return param_2;

}





// --- FUN_005d54d0 at 0x005D54D0 (size: 65) ---


void __thiscall FUN_005d54d0(int param_1,undefined4 *param_2)



{

  int iVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  

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

  if (iVar1 == 0) {

    param_2[2] = 0;

    param_2[3] = 0;

    param_2[1] = 0;

    *param_2 = &PTR_LAB_007b6124;

    return;

  }

  uVar2 = *(undefined4 *)(iVar1 + 0xc);

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

  param_2[1] = 0;

  param_2[2] = uVar3;

  param_2[3] = uVar2;

  *param_2 = &PTR_LAB_007b6124;

  return;

}





// --- FUN_005d5520 at 0x005D5520 (size: 85) ---


void __thiscall FUN_005d5520(int param_1,uint *param_2)



{

  uint uVar1;

  

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

    *param_2 = *param_2 | 1;

  }

  uVar1 = *param_2;

  *param_2 = uVar1 | 0x400;

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

    *param_2 = uVar1 | 0x408;

  }

  uVar1 = *param_2;

  *param_2 = uVar1 | 0x60;

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

    *param_2 = uVar1 | 0x160;

  }

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

    *param_2 = *param_2 | 0x200;

  }

  return;

}





// --- FUN_005d5760 at 0x005D5760 (size: 61) ---


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



{

  uint *puVar1;

  

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

    for (puVar1 = *(uint **)(*(int *)(param_1 + 8) + (*param_2 % *(uint *)(param_1 + 0xc)) * 4);

        puVar1 != (uint *)0x0; puVar1 = (uint *)puVar1[2]) {

      if (*param_2 == *puVar1) {

        return puVar1 + 1;

      }

    }

  }

  return (uint *)0x0;

}





// --- FUN_005d57a0 at 0x005D57A0 (size: 173) ---


undefined4 __thiscall FUN_005d57a0(int param_1,int *param_2)



{

  int *piVar1;

  int iVar2;

  int *piVar3;

  void *pvVar4;

  

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

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

    return 0;

  }

  if (*piVar1 != *param_2) {

    iVar2 = piVar1[1];

    while( true ) {

      if (iVar2 == 0) {

        return 0;

      }

      piVar3 = (int *)piVar1[1];

      if (*piVar3 == *param_2) break;

      iVar2 = piVar3[1];

      piVar1 = piVar3;

    }

    *param_2 = *(int *)piVar1[1];

    pvVar4 = (void *)piVar1[1];

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

    piVar1[1] = iVar2;

    if (iVar2 == 0) {

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

    }

    else {

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

    }

    operator_delete(pvVar4);

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

    return 1;

  }

  *param_2 = *piVar1;

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

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

  if (iVar2 == 0) {

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

  }

  else {

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

  }

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

    operator_delete(piVar1);

  }

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

  return 1;

}





// --- FUN_005d5850 at 0x005D5850 (size: 34) ---


undefined4 __fastcall FUN_005d5850(int param_1)



{

  undefined4 *puVar1;

  

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

    puVar1 = (undefined4 *)FUN_005d5760(&stack0x00000004);

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

      return *puVar1;

    }

  }

  return 0;

}





// --- FUN_005d5880 at 0x005D5880 (size: 160) ---


void __thiscall FUN_005d5880(int param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  bool bVar4;

  

  bVar4 = false;

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

    iVar2 = FUN_005df0f5(0x14);

    if (iVar2 == 0) {

      iVar2 = 0;

    }

    else {

      iVar2 = FUN_006b8740();

    }

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

    bVar4 = iVar2 == 0;

  }

  if (!bVar4) {

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

    if (puVar1 != param_2) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

      }

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

      InterlockedIncrement(param_2 + 1);

    }

    FUN_006b8a60(1,&param_2);

  }

  puVar1 = param_2;

  LVar3 = InterlockedDecrement(param_2 + 1);

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

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

  }

  return;

}





// --- FUN_005d5920 at 0x005D5920 (size: 120) ---


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



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  undefined4 *puVar4;

  

  uVar3 = FUN_0056a0e0();

  if (uVar3 <= param_3) {

    *(uint *)*param_2 = *(int *)(param_1 + 0xc) << 0x10 | *(uint *)(param_1 + 0x10);

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

    *param_2 = (int)puVar4;

    uVar3 = 0;

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

      do {

        for (puVar1 = *(undefined4 **)(*(int *)(param_1 + 8) + uVar3 * 4);

            puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)puVar1[2]) {

          if (3 < param_3) {

            *puVar4 = *puVar1;

            iVar2 = *param_2;

            *param_2 = iVar2 + 4;

            *(undefined4 *)(iVar2 + 4) = puVar1[1];

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

            *param_2 = (int)puVar4;

          }

        }

        uVar3 = uVar3 + 1;

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

    }

  }

  return;

}





// --- FUN_005d59a0 at 0x005D59A0 (size: 79) ---


void __fastcall FUN_005d59a0(int param_1)



{

  void *pvVar1;

  void *pvVar2;

  uint uVar3;

  

  if ((*(int *)(param_1 + 8) != 0) && (uVar3 = 0, *(int *)(param_1 + 0xc) != 0)) {

    do {

      pvVar2 = *(void **)(*(int *)(param_1 + 8) + uVar3 * 4);

      while (pvVar2 != (void *)0x0) {

        pvVar1 = *(void **)((int)pvVar2 + 8);

        operator_delete(pvVar2);

        pvVar2 = pvVar1;

      }

      *(undefined4 *)(*(int *)(param_1 + 8) + uVar3 * 4) = 0;

      uVar3 = uVar3 + 1;

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

  }

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

  return;

}





// --- FUN_005d59f0 at 0x005D59F0 (size: 107) ---


void __fastcall FUN_005d59f0(int param_1)



{

  FUN_004034c0("%#H:%M:%S ");

  if (*(undefined4 **)(param_1 + 4) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 4))(1);

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

  }

  if (*(undefined4 **)(param_1 + 0x88) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x88))(1);

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

  }

  if (*(undefined4 **)(param_1 + 0x98) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x98))(1);

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

  }

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

                    /* WARNING: Treating indirect jump as call */

  (**(code **)(*(int *)(param_1 + 0x128) + 4))();

  return;

}





// --- FUN_005d5a60 at 0x005D5A60 (size: 41) ---


void FUN_005d5a60(undefined4 param_1,int param_2)



{

  if ((-1 < param_2) && (param_2 < 8)) {

    param_2 = param_1;

    FUN_005d57a0(&param_2);

  }

  return;

}





// --- FUN_005d5a90 at 0x005D5A90 (size: 135) ---


bool __thiscall FUN_005d5a90(int param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  

  iVar3 = param_3;

  if ((param_3 < 0) || (5000 < param_3)) {

    return false;

  }

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

    iVar1 = FUN_005df0f5(0x14);

    if (iVar1 == 0) {

      iVar1 = 0;

    }

    else {

      iVar1 = FUN_005d53d0(0x100);

    }

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

    if (iVar1 == 0) {

      return false;

    }

  }

  piVar2 = (int *)FUN_005d5760(&param_2);

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

    *piVar2 = iVar3;

    return true;

  }

  iVar3 = FUN_0052dfd0(&param_2,&param_3);

  return iVar3 != 0;

}





// --- FUN_005d5e20 at 0x005D5E20 (size: 32) ---


void FUN_005d5e20(undefined4 param_1,undefined4 param_2)



{

  FUN_00463700(&param_1,param_2);

  return;

}





// --- FUN_005d5e40 at 0x005D5E40 (size: 297) ---


bool __thiscall FUN_005d5e40(int param_1,int *param_2,uint param_3)



{

  int *piVar1;

  uint uVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  undefined4 local_10;

  undefined4 local_c;

  int local_8;

  uint local_4;

  

  uVar2 = param_3;

  piVar1 = param_2;

  if (param_3 < 4) {

    return false;

  }

  local_8 = *param_2;

  local_4 = param_3;

  FUN_005d59a0();

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

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

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

  }

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

  uVar3 = *(uint *)*piVar1;

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

  uVar5 = uVar3 >> 0x10;

  uVar3 = uVar3 & 0xffff;

  *(uint *)(param_1 + 0xc) = uVar5;

  if (uVar5 == 0) {

    return uVar3 == 0;

  }

  if (((0x10000 < uVar5) || (0x10000 < uVar3)) || (iVar4 = FUN_005a8440(), iVar4 == 0)) {

    return false;

  }

  param_3 = 0;

  if (uVar3 != 0) {

    do {

      param_2 = (int *)(uVar2 - 4);

      iVar4 = FUN_004fd180(&local_10,piVar1,&param_2);

      if (iVar4 == 0) {

        return false;

      }

      local_c = local_10;

      if (uVar2 - 4 < 4) {

        return false;

      }

      param_2 = *(int **)*piVar1;

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

      iVar4 = FUN_0052dfd0(&local_c,&param_2);

      if ((iVar4 == 0) && (*(int *)(param_1 + 4) == 0)) {

        return false;

      }

      param_3 = param_3 + 1;

    } while (param_3 < uVar3);

  }

  return (uint)(*piVar1 - local_8) <= local_4;

}





// --- FUN_005d5f70 at 0x005D5F70 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007e9ae0;

  FUN_0052fcf0();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d6080 at 0x005D6080 (size: 76) ---


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



{

  param_1[2] = &PTR_LAB_0079aa94;

  if ((param_1[0x10] & 0x80000000) == 0x80000000) {

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

  }

  FUN_0040b060();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d60f0 at 0x005D60F0 (size: 101) ---


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



{

  char cVar1;

  

  FUN_00681f60();

  param_1[2] = &PTR_LAB_0079aa94;

  cVar1 = FUN_004010d0(param_1[0x10],0x80000000);

  if (cVar1 != '\0') {

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

  }

  FUN_0040b060();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d6160 at 0x005D6160 (size: 176) ---


void __fastcall FUN_005d6160(undefined4 *param_1)



{

  char cVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int iVar4;

  

  *param_1 = &PTR_FUN_007e9b38;

  FUN_005d59f0();

  puVar3 = (undefined4 *)param_1[0x68];

  LVar2 = InterlockedDecrement(puVar3 + 1);

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

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

  }

  FUN_00681f60();

  param_1[0x29] = &PTR_LAB_0079aa94;

  cVar1 = FUN_004010d0(param_1[0x37],0x80000000);

  if (cVar1 != '\0') {

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

  }

  FUN_0040b060();

  param_1[0x27] = &PTR_FUN_0079385c;

  puVar3 = param_1 + 0x22;

  iVar4 = 8;

  do {

    puVar3 = puVar3 + -4;

    *puVar3 = &PTR_FUN_007a4ed0;

    FUN_0048bc30();

    iVar4 = iVar4 + -1;

    *puVar3 = &PTR_FUN_0079385c;

  } while (iVar4 != 0);

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005d62c0 at 0x005D62C0 (size: 127) ---


undefined4 * __thiscall

FUN_005d62c0(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  undefined4 uVar1;

  

  *param_1 = &PTR_FUN_00793b3c;

  param_1[1] = 0;

  param_1[2] = 0;

  FUN_00406d60();

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  *param_1 = &PTR_LAB_0079aa94;

  param_1[9] = &PTR_LAB_0079aa90;

  param_1[0xc] = &PTR_LAB_00795430;

  param_1[0xd] = param_1 + 0x10;

  param_1[0xe] = 8;

  param_1[0xf] = 0;

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

  uVar1 = FUN_00407060(param_3,param_4);

  FUN_00446770(uVar1);

  FUN_00406f90();

  return param_1;

}





// --- FUN_005d6340 at 0x005D6340 (size: 165) ---


undefined4 * __fastcall FUN_005d6340(undefined4 *param_1)



{

  undefined4 *puVar1;

  int iVar2;

  

  *param_1 = &PTR_FUN_007e9b38;

  param_1[1] = 0;

  puVar1 = param_1 + 2;

  iVar2 = 8;

  do {

    *puVar1 = &PTR_FUN_007a4ed0;

    puVar1[1] = 0;

    puVar1[2] = 0;

    puVar1[3] = 0;

    puVar1 = puVar1 + 4;

    iVar2 = iVar2 + -1;

  } while (iVar2 != 0);

  param_1[0x22] = 0;

  param_1[0x26] = 0;

  param_1[0x23] = 0x50c4a54a;

  param_1[0x24] = 0x2948700;

  param_1[0x25] = 0x3fff;

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

  param_1[0x27] = &PTR_FUN_007e9b00;

  FUN_0044ce60();

  FUN_006823d0();

  param_1[0x27] = &PTR_FUN_007e9b18;

  param_1[0x4a] = &PTR_LAB_007e9b30;

  FUN_0048c3e0("%#H:%M:%S ");

  return param_1;

}





// --- FUN_005d63f0 at 0x005D63F0 (size: 30) ---


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



{

  FUN_005d6160();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d6410 at 0x005D6410 (size: 51) ---


void __thiscall FUN_005d6410(int *param_1,undefined4 param_2)



{

  undefined4 uVar1;

  

  uVar1 = param_2;

  param_2 = FUN_00429a00();

  FUN_00429120(&param_2,uVar1);

  (**(code **)(*param_1 + 0x18))(uVar1,0);

  return;

}





// --- FUN_005d6450 at 0x005D6450 (size: 574) ---


undefined4 __thiscall FUN_005d6450(int param_1,uint param_2)



{

  int iVar1;

  int *piVar2;

  undefined4 uVar3;

  uint uVar4;

  uint uVar5;

  undefined4 *local_10;

  undefined4 *puStack_c;

  undefined4 *local_8;

  undefined4 *local_4;

  

  uVar4 = param_2 - 1;

  for (piVar2 = *(int **)(*(int *)(param_1 + 400) +

                         (int)(0x1000008c % (ulonglong)*(uint *)(param_1 + 0x198)) * 4);

      piVar2 != (int *)0x0; piVar2 = (int *)piVar2[1]) {

    if (*piVar2 == 0x1000008c) {

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

        piVar2 = piVar2 + 2;

        goto LAB_005d6495;

      }

      break;

    }

  }

  piVar2 = (int *)0x0;

LAB_005d6495:

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

    local_8 = (undefined4 *)0x0;

    local_4 = (undefined4 *)0x0;

    FUN_0042a2d0(0x1000008c);

    local_10 = (undefined4 *)FUN_00429a00();

    FUN_0042c290(&local_10,&local_8);

    for (piVar2 = *(int **)(*(int *)(param_1 + 400) +

                           (int)(0x1000008c % (ulonglong)*(uint *)(param_1 + 0x198)) * 4);

        piVar2 != (int *)0x0; piVar2 = (int *)piVar2[1]) {

      if (*piVar2 == 0x1000008c) {

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

          piVar2 = piVar2 + 2;

          goto LAB_005d6504;

        }

        break;

      }

    }

    piVar2 = (int *)0x0;

LAB_005d6504:

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

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

        iVar1 = local_8[1];

        local_8[1] = iVar1 + -1;

        if (iVar1 + -1 == 0) {

          (**(code **)*local_8)(1);

        }

        local_8 = (undefined4 *)0x0;

      }

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

        return 0;

      }

      iVar1 = local_4[1];

      local_4[1] = iVar1 + -1;

      if (iVar1 + -1 != 0) {

        return 0;

      }

      (**(code **)*local_4)(1);

      return 0;

    }

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

      iVar1 = local_8[1];

      local_8[1] = iVar1 + -1;

      if (iVar1 + -1 == 0) {

        (**(code **)*local_8)(1);

      }

      local_8 = (undefined4 *)0x0;

    }

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

      iVar1 = local_4[1];

      local_4[1] = iVar1 + -1;

      if (iVar1 + -1 == 0) {

        (**(code **)*local_4)(1);

      }

      local_4 = (undefined4 *)0x0;

    }

  }

  iVar1 = *piVar2;

  if (((iVar1 != 0) && (*(int *)(iVar1 + 0xc) == 0x11)) && (uVar4 < *(uint *)(iVar1 + 0xc0))) {

    param_2 = 0;

    if (((int *)piVar2[1] == (int *)0x0) ||

       ((**(code **)(*(int *)piVar2[1] + 0xf0))(&param_2), param_2 <= uVar4)) {

      local_10 = (undefined4 *)0x0;

      puStack_c = (undefined4 *)0x0;

      FUN_0042a2d0(0x1000008b);

      for (uVar5 = param_2; uVar5 <= uVar4; uVar5 = uVar5 + 1) {

        if (piVar2[1] != 0) {

          FUN_00429b10();

          (**(code **)(*(int *)piVar2[1] + 0xf8))(uVar5,&local_10);

        }

      }

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

        iVar1 = local_10[1];

        local_10[1] = iVar1 + -1;

        if (iVar1 + -1 == 0) {

          (**(code **)*local_10)(1);

        }

        local_10 = (undefined4 *)0x0;

      }

      if ((puStack_c != (undefined4 *)0x0) &&

         (iVar1 = puStack_c[1], puStack_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

        (**(code **)*puStack_c)(1);

      }

    }

    FUN_00429b10();

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

      uVar3 = (**(code **)(*(int *)piVar2[1] + 0x10c))(uVar4);

      return uVar3;

    }

  }

  return 0;

}





// --- FUN_005d6690 at 0x005D6690 (size: 47) ---


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



{

  uint uVar1;

  

  uVar1 = FUN_005d6450(param_1);

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

    uVar1 = (**(code **)(**(int **)(uVar1 + 4) + 0x118))(param_2,param_3);

    return uVar1;

  }

  return uVar1 & 0xffffff00;

}





// --- FUN_005d66c0 at 0x005D66C0 (size: 101) ---


char __thiscall FUN_005d66c0(int *param_1,undefined4 param_2,undefined4 param_3)



{

  char cVar1;

  int iVar2;

  undefined4 uVar3;

  undefined4 unaff_EBX;

  

  cVar1 = '\0';

  iVar2 = FUN_005d6450(param_2);

  if (iVar2 != 0) {

    uVar3 = FUN_00429a00();

    if (*(int *)(iVar2 + 4) == 0) {

      return '\0';

    }

    FUN_00429b10();

    cVar1 = (**(code **)(**(int **)(iVar2 + 4) + 0x11c))(uVar3,param_3);

    if (cVar1 != '\0') {

      (**(code **)(*param_1 + 0x18))(param_3,unaff_EBX);

    }

  }

  return cVar1;

}





// --- FUN_005d6730 at 0x005D6730 (size: 32) ---


void __thiscall

FUN_005d6730(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  param_1[1] = param_2;

  *param_1 = &PTR_FUN_007e9b54;

  param_1[2] = param_3;

  param_1[3] = param_4;

  return;

}





// --- FUN_005d6750 at 0x005D6750 (size: 20) ---


void __fastcall FUN_005d6750(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e9b54;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  return;

}





// --- FUN_005d6770 at 0x005D6770 (size: 43) ---


void __fastcall FUN_005d6770(int *param_1)



{

  int iVar1;

  

  iVar1 = 0x12;

  do {

    param_1 = param_1 + 1;

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

      (*(code *)**(undefined4 **)*param_1)(1);

      *param_1 = 0;

    }

    iVar1 = iVar1 + -1;

  } while (iVar1 != 0);

  return;

}





// --- FUN_005d67a0 at 0x005D67A0 (size: 44) ---


void __thiscall FUN_005d67a0(int param_1,int param_2)



{

  undefined4 *puVar1;

  

  if (((-1 < param_2) && (param_2 < 0x12)) &&

     (puVar1 = *(undefined4 **)(param_1 + 4 + param_2 * 4), puVar1 != (undefined4 *)0x0)) {

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

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

  }

  return;

}





// --- FUN_005d67d0 at 0x005D67D0 (size: 65) ---


int __fastcall FUN_005d67d0(int *param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  undefined4 local_4;

  

  iVar3 = 4;

  local_4 = 0;

  iVar2 = 0x12;

  do {

    param_1 = param_1 + 1;

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

      iVar1 = (**(code **)(*(int *)*param_1 + 0xc))(&local_4,0);

      iVar3 = iVar3 + iVar1;

    }

    iVar2 = iVar2 + -1;

  } while (iVar2 != 0);

  return iVar3;

}





// --- FUN_005d6880 at 0x005D6880 (size: 25) ---


undefined4 * __fastcall FUN_005d6880(undefined4 *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  *param_1 = &PTR_FUN_007e9b68;

  puVar2 = param_1;

  for (iVar1 = 0x12; puVar2 = puVar2 + 1, iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar2 = 0;

  }

  return param_1;

}





// --- FUN_005d68a0 at 0x005D68A0 (size: 133) ---


undefined4 __thiscall FUN_005d68a0(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  

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

  if ((iVar1 < 0) || (0x11 < iVar1)) {

    return 0;

  }

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

  if (iVar2 != 0) {

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

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

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

    return 1;

  }

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

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

    *puVar3 = &PTR_FUN_007e9b54;

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

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

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

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

    return 1;

  }

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

  return 1;

}





// --- FUN_005d6990 at 0x005D6990 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007e9b68;

  FUN_005d6770();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005d69c0 at 0x005D69C0 (size: 207) ---


DWORD FUN_005d69c0(void)



{

  HMODULE pHVar1;

  int iVar2;

  BOOL BVar3;

  DWORD DVar4;

  DWORD *unaff_retaddr;

  char *pcStack_24;

  ULARGE_INTEGER UStack_18;

  ULARGE_INTEGER UStack_10;

  LPCSTR pCStack_4;

  

  pcStack_24 = "GetDiskFreeSpaceExA";

  pHVar1 = GetModuleHandleA("kernel32.dll");

  iVar2 = (*(code *)PTR_FUN_00837388)(pHVar1);

  if (iVar2 != 0) {

    BVar3 = GetDiskFreeSpaceExA(pCStack_4,(PULARGE_INTEGER)&stack0xffffffe0,&UStack_18,&UStack_10);

    if (BVar3 == 0) {

      *unaff_retaddr = 0;

      unaff_retaddr[1] = 0;

      DVar4 = GetLastError();

      return DVar4;

    }

    *unaff_retaddr = UStack_10.s.LowPart;

    unaff_retaddr[1] = UStack_10.s.HighPart;

    return 0;

  }

  UStack_18.s.LowPart = 0;

  pcStack_24 = (char *)0x0;

  UStack_10.s.LowPart = 0;

  BVar3 = GetDiskFreeSpaceA(pCStack_4,(LPDWORD)&UStack_18,(LPDWORD)&stack0xffffffe0,

                            (LPDWORD)&pcStack_24,(LPDWORD)&UStack_10);

  unaff_retaddr[1] = 0;

  if (BVar3 != 0) {

    *unaff_retaddr = 0;

    return 0;

  }

  *unaff_retaddr = 0;

  DVar4 = GetLastError();

  return DVar4;

}





// --- FUN_005d7700 at 0x005D7700 (size: 156) ---


void FUN_005d7700(undefined4 param_1,undefined4 param_2)



{

  char *pcVar1;

  

  switch(param_1) {

  case 0x10000001:

    pcVar1 = "WEENIE_DEF";

    break;

  case 0x10000002:

    pcVar1 = "CHAR_GEN";

    break;

  case 0x10000003:

    pcVar1 = "ATTRIBUTE_2ND_TABLE";

    break;

  case 0x10000004:

    pcVar1 = "SKILL_TABLE";

    break;

  case 0x10000005:

    pcVar1 = "SPELL_TABLE";

    break;

  case 0x10000006:

    pcVar1 = "SPELLCOMPONENT_TABLE";

    break;

  case 0x10000007:

    pcVar1 = "W_TREASURE_SYSTEM";

    break;

  case 0x10000008:

    pcVar1 = "W_CRAFT_TABLE";

    break;

  case 0x10000009:

    pcVar1 = "XP_TABLE";

    break;

  case 0x1000000a:

    pcVar1 = "QUEST_DEF_DB";

    break;

  case 0x1000000b:

    pcVar1 = "GAME_EVENT_DB";

    break;

  case 0x1000000c:

    pcVar1 = "QUALITY_FILTER";

    break;

  case 0x1000000d:

    pcVar1 = "COMBAT_TABLE";

    break;

  case 0x1000000e:

    pcVar1 = "MUTATE_FILTER";

    break;

  default:

    goto switchD_005d7718_caseD_1000000f;

  case 0x10000010:

    pcVar1 = "CONTRACT_TABLE";

  }

  FUN_00405000(pcVar1);

switchD_005d7718_caseD_1000000f:

  FUN_0041f370(param_1,param_2);

  return;

}





// --- ImmReleaseContext at 0x005D8380 (size: 6) ---


BOOL ImmReleaseContext(HWND param_1,HIMC param_2)



{

  BOOL BVar1;

  

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

                    /* WARNING: Treating indirect jump as call */

  BVar1 = ImmReleaseContext(param_1,param_2);

  return BVar1;

}





// --- ImmGetContext at 0x005D8386 (size: 6) ---


HIMC ImmGetContext(HWND param_1)



{

  HIMC pHVar1;

  

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

                    /* WARNING: Treating indirect jump as call */

  pHVar1 = ImmGetContext(param_1);

  return pHVar1;

}





// --- ImmAssociateContext at 0x005D838C (size: 6) ---


HIMC ImmAssociateContext(HWND param_1,HIMC param_2)



{

  HIMC pHVar1;

  

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

                    /* WARNING: Treating indirect jump as call */

  pHVar1 = ImmAssociateContext(param_1,param_2);

  return pHVar1;

}





// --- FUN_005d83a0 at 0x005D83A0 (size: 30) ---


uint __thiscall FUN_005d83a0(int param_1,undefined1 param_2)



{

  if (*(uint *)(param_1 + 0x80) == 0) {

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

    return 1;

  }

  return *(uint *)(param_1 + 0x80) & 0xffffff00;

}





// --- FUN_005d83c0 at 0x005D83C0 (size: 87) ---


bool __thiscall

FUN_005d83c0(int param_1,int param_2,undefined4 param_3,undefined1 param_4,undefined1 param_5)



{

  int iVar1;

  

  if (param_2 != 0) {

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

    FUN_005d97f0();

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

    *(undefined1 *)(param_1 + 0x84) = param_4;

    *(undefined1 *)(param_1 + 0x87) = param_5;

    iVar1 = thunk_FUN_005df0f5(*(int *)(param_1 + 0xc) * param_2);

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

    return iVar1 != 0;

  }

  return false;

}





// --- FUN_005d8420 at 0x005D8420 (size: 62) ---


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



{

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

    if ((param_2 < *(uint *)(param_1 + 0x7c)) && (param_3 + param_2 <= *(uint *)(param_1 + 0x7c))) {

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

      return *(int *)(param_1 + 0xc) * param_2 + *(int *)(param_1 + 0x80);

    }

  }

  return 0;

}





// --- FUN_005d8460 at 0x005D8460 (size: 26) ---


undefined4 FUN_005d8460(int param_1,byte *param_2,undefined4 param_3)



{

  if ((*param_2 & 0x40) != 0) {

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

  }

  return 1;

}





// --- FUN_005d8480 at 0x005D8480 (size: 26) ---


undefined4 FUN_005d8480(int param_1,char *param_2,undefined4 param_3)



{

  if (*param_2 < '\0') {

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

  }

  return 1;

}





// --- FUN_005d84a0 at 0x005D84A0 (size: 45) ---


uint FUN_005d84a0(int param_1,uint *param_2,undefined4 *param_3)



{

  undefined4 *puVar1;

  

  if ((*param_2 & 0x10000000) != 0) {

    puVar1 = (undefined4 *)(param_2[0x19] + param_1);

    *puVar1 = *param_3;

    puVar1[1] = param_3[1];

    puVar1[2] = param_3[2];

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

  }

  return (uint)param_2 & 0xffffff00;

}





// --- FUN_005d84d0 at 0x005D84D0 (size: 45) ---


uint FUN_005d84d0(int param_1,uint *param_2,undefined4 *param_3)



{

  undefined4 *puVar1;

  

  if ((*param_2 & 0x20000000) != 0) {

    puVar1 = (undefined4 *)(param_2[0x1a] + param_1);

    *puVar1 = *param_3;

    puVar1[1] = param_3[1];

    puVar1[2] = param_3[2];

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

  }

  return (uint)param_2 & 0xffffff00;

}





// --- FUN_005d8500 at 0x005D8500 (size: 45) ---


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



{

  int iVar1;

  undefined4 uVar2;

  

  if (param_3 < *(uint *)(param_2 + 0x14)) {

    iVar1 = *(int *)(param_2 + 0x44 + param_3 * 4);

    *(undefined4 *)(iVar1 + param_1) = *param_4;

    uVar2 = param_4[1];

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

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

  }

  return param_3 & 0xffffff00;

}





// --- FUN_005d8530 at 0x005D8530 (size: 52) ---


undefined4 FUN_005d8530(int param_1,int param_2,uint param_3,undefined1 param_4,undefined4 param_5)



{

  if (param_3 < *(uint *)(param_2 + 0x18)) {

    *(undefined1 *)(*(int *)(param_2 + 0x6c) + param_1 + param_3) = param_4;

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

    return 1;

  }

  return 0;

}





// --- FUN_005d8570 at 0x005D8570 (size: 99) ---


void __fastcall FUN_005d8570(int *param_1)



{

  int iVar1;

  int iVar2;

  undefined4 local_8;

  undefined4 local_4;

  

  param_1[2] = 0;

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

    operator_delete__((void *)*param_1);

    *param_1 = 0;

    param_1[1] = 0;

    return;

  }

  if (*param_1 != 0) {

    iVar2 = (param_1[1] & 0x7fffffffU) - 1;

    while (-1 < iVar2) {

      iVar2 = iVar2 + -1;

      iVar1 = *param_1;

      *(undefined4 *)(iVar1 + 8 + iVar2 * 8) = local_8;

      *(undefined4 *)(iVar1 + 0xc + iVar2 * 8) = local_4;

    }

  }

  return;

}





// --- FUN_005d85e0 at 0x005D85E0 (size: 103) ---


void __fastcall FUN_005d85e0(int param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  FUN_005b2ea0();

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

    uVar2 = 0;

    do {

      puVar1 = (undefined4 *)(*(int *)(param_1 + 0xc) * uVar2 + *(int *)(param_1 + 0x80));

      if (*(char *)(param_1 + 0xac) != '\0') {

        local_8 = puVar1[2];

        local_c = *puVar1;

        local_4 = puVar1[1];

        puVar1 = &local_c;

      }

      FUN_00534e90(puVar1);

      uVar2 = uVar2 + 1;

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

  }

  return;

}





// --- FUN_005d8650 at 0x005D8650 (size: 77) ---


void __fastcall FUN_005d8650(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  

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

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

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

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

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

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

  puVar2 = &DAT_008ef180;

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

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

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

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

  FUN_0044dcb0();

  return;

}





// --- FUN_005d86a0 at 0x005D86A0 (size: 44) ---


void __fastcall FUN_005d86a0(int param_1)



{

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

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

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

  }

  FUN_0044dcb0();

  return;

}





// --- FUN_005d86d0 at 0x005D86D0 (size: 51) ---


void __fastcall FUN_005d86d0(int param_1)



{

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

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

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

  }

  FUN_0044dcb0();

  FUN_005d8650();

  return;

}





// --- FUN_005d8710 at 0x005D8710 (size: 111) ---


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



{

  int iVar1;

  char cVar2;

  uint uVar3;

  undefined4 local_8;

  undefined4 local_4;

  

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

    uVar3 = param_2;

    if (param_3 == '\0') {

      uVar3 = FUN_00453850(param_2);

    }

    cVar2 = FUN_00459e20(uVar3);

    if (cVar2 == '\0') {

      return 0;

    }

  }

  else {

    uVar3 = param_2;

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

      do {

        iVar1 = *param_1;

        *(undefined4 *)(iVar1 + uVar3 * 8) = local_8;

        *(undefined4 *)(iVar1 + 4 + uVar3 * 8) = local_4;

        uVar3 = uVar3 + 1;

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

    }

  }

  param_1[2] = param_2;

  return 1;

}





// --- FUN_005d8780 at 0x005D8780 (size: 34) ---


undefined4 __thiscall FUN_005d8780(int *param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = (**(code **)(*param_1 + 0xc))(param_2);

  if (iVar1 == 0) {

    return 0;

  }

  uVar2 = FUN_00448290(param_2);

  return uVar2;

}





// --- FUN_005d87b0 at 0x005D87B0 (size: 34) ---


undefined4 __thiscall FUN_005d87b0(int *param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = (**(code **)(*param_1 + 0xc))(param_2);

  if (iVar1 == 0) {

    return 0;

  }

  uVar2 = FUN_00426cb0(param_2);

  return uVar2;

}





// --- FUN_005d87e0 at 0x005D87E0 (size: 202) ---


void __thiscall FUN_005d87e0(int *param_1,int param_2)



{

  undefined4 *puVar1;

  uint *puVar2;

  uint uVar3;

  undefined4 *puVar4;

  uint uVar5;

  uint uVar6;

  

  uVar6 = param_1[2];

  FUN_0040ad10(4);

  puVar2 = (uint *)FUN_0040acf0(4);

  uVar5 = 0;

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

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

      uVar6 = *puVar2;

    }

    else {

      *puVar2 = uVar6;

    }

  }

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

    uVar3 = FUN_0040a8f0();

    if (uVar3 < uVar6) {

      FUN_0040aa50();

      return;

    }

    param_1[2] = 0;

    FUN_005d8710(uVar6,1);

  }

  if (param_1[2] != 0) {

    do {

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

      FUN_0040ad10(4);

      puVar4 = (undefined4 *)FUN_0040acf0(4);

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

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

          *puVar1 = *puVar4;

        }

        else {

          *puVar4 = *puVar1;

        }

      }

      FUN_0040ad10(4);

      puVar4 = (undefined4 *)FUN_0040acf0(4);

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

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

          puVar1[1] = *puVar4;

        }

        else {

          *puVar4 = puVar1[1];

        }

      }

      uVar5 = uVar5 + 1;

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

  }

  return;

}





// --- FUN_005d88b0 at 0x005D88B0 (size: 312) ---


void __thiscall FUN_005d88b0(int *param_1,int param_2)



{

  char cVar1;

  int *piVar2;

  int iVar3;

  int *piVar4;

  bool bVar5;

  

  FUN_0040ad10(4);

  piVar2 = (int *)FUN_0040acf0(4);

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

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

      param_1[2] = *piVar2;

    }

    else {

      *piVar2 = param_1[2];

    }

  }

  FUN_0040ad10(4);

  piVar2 = (int *)FUN_0040acf0(4);

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

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

      param_1[0x1f] = *piVar2;

    }

    else {

      *piVar2 = param_1[0x1f];

    }

  }

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

    iVar3 = param_1[0x20];

  }

  else {

    if (param_1[0x20] == 0) {

      *(undefined1 *)((int)param_1 + 0x86) = 1;

    }

    bVar5 = (param_1[2] & 0xff0000U) == 0;

    cVar1 = (**(code **)(*param_1 + 4))(param_1[0x1f],param_1[2],bVar5,bVar5,0xffffffff);

    if ((cVar1 == '\0') || (iVar3 = (**(code **)(*param_1 + 0xc))(0,param_1[0x1f]), iVar3 == 0)) {

      FUN_0040aa50();

      return;

    }

  }

  FUN_00401590(iVar3,param_1[3] * param_1[0x1f],param_2);

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

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

  }

  param_1 = param_1 + 0x22;

  FUN_0040ad10(0x18);

  piVar2 = (int *)FUN_0040acf0(0x18);

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

    iVar3 = 6;

    piVar4 = piVar2;

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

      piVar4 = param_1;

      param_1 = piVar2;

    }

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

      *param_1 = *piVar4;

      piVar4 = piVar4 + 1;

      param_1 = param_1 + 1;

    }

  }

  FUN_0042fc00(param_2);

  return;

}





// --- FUN_005d89f0 at 0x005D89F0 (size: 1085) ---


undefined4 FUN_005d89f0(int param_1,byte *param_2,int param_3)



{

  char cVar1;

  LONG LVar2;

  int *piVar3;

  undefined4 *puVar4;

  undefined4 uVar5;

  int iVar6;

  int *piVar7;

  uint uVar8;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  undefined4 extraout_ECX_02;

  undefined4 extraout_ECX_03;

  undefined4 extraout_ECX_04;

  undefined4 extraout_ECX_05;

  undefined4 extraout_ECX_06;

  undefined4 extraout_ECX_07;

  undefined4 extraout_ECX_08;

  uint uVar9;

  char *pcVar10;

  int local_74;

  undefined4 uStack_70;

  undefined1 auStack_6c [4];

  undefined1 auStack_68 [16];

  undefined4 local_58;

  undefined4 local_54;

  undefined4 local_50;

  undefined4 local_4c;

  undefined4 local_48;

  undefined4 local_44;

  undefined1 local_40 [12];

  undefined1 local_34 [48];

  

  if (param_1 != 0) {

    cVar1 = FUN_0065cc50(&DAT_008f102c);

    if (cVar1 != '\0') {

      FUN_0065cf90(param_1);

      piVar3 = (int *)FUN_0065c810();

      while( true ) {

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

          FUN_0065cae0();

          return 1;

        }

        cVar1 = FUN_0065cc50(&DAT_008f1034);

        if (cVar1 == '\0') break;

        cVar1 = FUN_0065c750(piVar3);

        uVar5 = extraout_ECX;

        if (cVar1 == '\0') goto LAB_005d8dd7;

        if ((*param_2 & 2) == 0) goto LAB_005d8e1b;

        puVar4 = (undefined4 *)(*(int *)(param_2 + 0x1c) + param_3);

        *puVar4 = local_58;

        puVar4[1] = local_54;

        puVar4[2] = local_50;

LAB_005d8db2:

        piVar3 = (int *)FUN_0065cb10();

      }

      cVar1 = FUN_0065cc50(&DAT_008f1038);

      if (cVar1 == '\0') {

        cVar1 = FUN_0065cc50(&DAT_008f1048);

        if (cVar1 == '\0') {

          cVar1 = FUN_0065cc50(&DAT_008f104c);

          if (cVar1 == '\0') {

            cVar1 = FUN_0065cc50(&DAT_008f103c);

            if (cVar1 == '\0') {

              cVar1 = FUN_0065cc50(&DAT_008f1040);

              if (cVar1 == '\0') {

                cVar1 = FUN_0065cc50(&DAT_008f1044);

                if (cVar1 == '\0') {

                  cVar1 = FUN_0065cc50(&DAT_008f1054);

                  if (cVar1 != '\0') {

                    iVar6 = FUN_0065ca40();

                    if (*(int *)(param_2 + 0x18) != iVar6) goto LAB_005d8e1b;

                    uVar9 = 0;

                    iVar6 = FUN_0065ca40();

                    if (iVar6 != 0) {

                      do {

                        piVar7 = (int *)(**(code **)(*piVar3 + 0xc))(uVar9);

                        if (piVar7 == (int *)0x0) goto LAB_005d8e1b;

                        iVar6 = FUN_0065ca40();

                        if (iVar6 != 2) {

                          pcVar10 = "invalid vertex weight";

                          uVar5 = extraout_ECX_06;

                          goto LAB_005d8e0d;

                        }

                        local_74 = 0;

                        cVar1 = FUN_005d8780(0,&uStack_70);

                        if (cVar1 == '\0') {

                          pcVar10 = "unable to read matrix index";

                          uVar5 = extraout_ECX_07;

                          goto LAB_005d8e0d;

                        }

                        cVar1 = FUN_005d87b0(1,&local_74);

                        if (cVar1 == '\0') {

                          pcVar10 = "unable to read vertex weight";

                          uVar5 = extraout_ECX_08;

                          goto LAB_005d8e0d;

                        }

                        cVar1 = FUN_005d8530(param_3,param_2,uVar9,uStack_70,local_74);

                        if (cVar1 == '\0') goto LAB_005d8e1b;

                        uVar9 = uVar9 + 1;

                        uVar8 = FUN_0065ca40();

                      } while (uVar9 < uVar8);

                    }

                  }

                }

                else {

                  iVar6 = FUN_0065ca40();

                  if (*(int *)(param_2 + 0x14) != iVar6) goto LAB_005d8e1b;

                  uVar9 = 0;

                  iVar6 = FUN_0065ca40();

                  if (iVar6 != 0) {

LAB_005d8c96:

                    piVar7 = (int *)(**(code **)(*piVar3 + 0xc))(uVar9);

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

                      iVar6 = FUN_0065ca40();

                      if (iVar6 != 2) {

                        pcVar10 = "invalid uv pair";

                        uVar5 = extraout_ECX_05;

LAB_005d8e0d:

                        FUN_00401340(pcVar10);

                        goto LAB_005d8e13;

                      }

                      FUN_005d87b0(0,auStack_6c);

                      FUN_005d87b0(1,auStack_68);

                      cVar1 = FUN_005d8500(param_3,param_2,uVar9,auStack_6c);

                      if (cVar1 != '\0') goto code_r0x005d8cf2;

                    }

                    goto LAB_005d8e1b;

                  }

                }

                goto LAB_005d8db2;

              }

              cVar1 = FUN_0065c4e0(piVar3,1,1);

              uVar5 = extraout_ECX_04;

              if (cVar1 != '\0') {

                uVar5 = FUN_00424000();

                cVar1 = FUN_005d8480(param_3,param_2,uVar5);

                goto joined_r0x005d8c53;

              }

            }

            else {

              cVar1 = FUN_0065c4e0(piVar3,1,1);

              uVar5 = extraout_ECX_03;

              if (cVar1 != '\0') {

                uVar5 = FUN_00424000();

                cVar1 = FUN_005d8460(param_3,param_2,uVar5);

                goto joined_r0x005d8c53;

              }

            }

          }

          else {

            cVar1 = FUN_0065c750(piVar3);

            uVar5 = extraout_ECX_02;

            if (cVar1 != '\0') {

              cVar1 = FUN_005d84d0(param_3,param_2,local_34);

              goto joined_r0x005d8c53;

            }

          }

        }

        else {

          cVar1 = FUN_0065c750(piVar3);

          uVar5 = extraout_ECX_01;

          if (cVar1 != '\0') {

            cVar1 = FUN_005d84a0(param_3,param_2,local_40);

joined_r0x005d8c53:

            if (cVar1 == '\0') goto LAB_005d8e1b;

            goto LAB_005d8db2;

          }

        }

      }

      else {

        cVar1 = FUN_0065c750(piVar3);

        uVar5 = extraout_ECX_00;

        if (cVar1 != '\0') {

          if ((*param_2 & 0x10) == 0) goto LAB_005d8e1b;

          puVar4 = (undefined4 *)(*(int *)(param_2 + 0x34) + param_3);

          *puVar4 = local_4c;

          puVar4[1] = local_48;

          puVar4[2] = local_44;

          goto LAB_005d8db2;

        }

      }

LAB_005d8dd7:

      FUN_00401340("invalid vertex");

      piVar7 = piVar3;

LAB_005d8e13:

      FUN_0065d620(piVar7,uVar5);

LAB_005d8e1b:

      FUN_0065cae0();

      return 0;

    }

    FUN_00401340("expected ");

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

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

    }

    iVar6 = local_74;

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

    FUN_0065d620(param_1,iVar6);

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

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

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

    }

  }

  return 0;

code_r0x005d8cf2:

  uVar9 = uVar9 + 1;

  uVar8 = FUN_0065ca40();

  if (uVar8 <= uVar9) goto LAB_005d8db2;

  goto LAB_005d8c96;

}





// --- FUN_005d8e30 at 0x005D8E30 (size: 1097) ---


/* WARNING: Removing unreachable block (ram,0x005d9110) */

/* WARNING: Removing unreachable block (ram,0x005d91d8) */

/* WARNING: Removing unreachable block (ram,0x005d91e8) */

/* WARNING: Removing unreachable block (ram,0x005d9127) */

/* WARNING: Removing unreachable block (ram,0x005d9243) */

/* WARNING: Removing unreachable block (ram,0x005d9248) */

/* WARNING: Removing unreachable block (ram,0x005d91c1) */

/* WARNING: Removing unreachable block (ram,0x005d9158) */

/* WARNING: Removing unreachable block (ram,0x005d91fd) */

/* WARNING: Removing unreachable block (ram,0x005d908d) */

/* WARNING: Removing unreachable block (ram,0x005d9090) */

/* WARNING: Removing unreachable block (ram,0x005d918e) */

/* WARNING: Removing unreachable block (ram,0x005d90a0) */

/* WARNING: Removing unreachable block (ram,0x005d921a) */

/* WARNING: Removing unreachable block (ram,0x005d9177) */

/* WARNING: Removing unreachable block (ram,0x005d919e) */

/* WARNING: Removing unreachable block (ram,0x005d91ab) */

/* WARNING: Removing unreachable block (ram,0x005d9262) */



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



{

  undefined4 *puVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  undefined4 local_50;

  undefined4 local_4c;

  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;

  

  uVar4 = DAT_008f1014;

  uVar3 = DAT_008f1010;

  uVar2 = DAT_008f100c;

  local_30 = DAT_008f100c;

  local_24 = DAT_008f100c;

  local_50 = 0xffffffff;

  local_4c = 0xffffffff;

  local_2c = DAT_008f1010;

  local_20 = DAT_008f1010;

  local_14 = DAT_008f1010;

  local_8 = DAT_008f1010;

  local_28 = DAT_008f1014;

  local_1c = DAT_008f1014;

  local_18 = DAT_008f100c;

  local_10 = DAT_008f1014;

  local_c = DAT_008f100c;

  local_4 = DAT_008f1014;

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if ((puVar1 != (undefined4 *)0x0) && ((*(byte *)(param_1 + 4) & 1) != 0)) {

    *puVar1 = 0;

  }

  FUN_0040ad10(0xc);

  puVar1 = (undefined4 *)FUN_0040acf0(0xc);

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

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

      local_30 = *puVar1;

      local_2c = puVar1[1];

      local_28 = puVar1[2];

    }

    else {

      *puVar1 = uVar2;

      puVar1[1] = uVar3;

      puVar1[2] = uVar4;

    }

  }

  FUN_0040ad10(0xc);

  puVar1 = (undefined4 *)FUN_0040acf0(0xc);

  uVar2 = local_24;

  uVar3 = local_1c;

  uVar4 = local_20;

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

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

      uVar2 = *puVar1;

      uVar3 = puVar1[2];

      uVar4 = puVar1[1];

    }

    else {

      *puVar1 = local_24;

      puVar1[1] = local_20;

      puVar1[2] = local_1c;

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

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

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

      local_50 = *puVar1;

    }

    else {

      *puVar1 = 0xffffffff;

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

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

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

      local_4c = *puVar1;

    }

    else {

      *puVar1 = 0xffffffff;

    }

  }

  local_20 = DAT_008f1010;

  local_24 = DAT_008f100c;

  local_1c = DAT_008f1014;

  if (param_4 != 0) {

    FUN_005b3880(&local_18,param_1);

    FUN_005b3880(&local_c,param_1);

    FUN_005b3880(&local_24,param_1);

  }

  FUN_005d87e0(param_1);

  FUN_005d87e0(param_1);

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if ((puVar1 != (undefined4 *)0x0) && ((*(byte *)(param_1 + 4) & 1) != 0)) {

    *puVar1 = 0;

  }

  if ((*param_2 & 2) != 0) {

    puVar1 = (undefined4 *)(param_2[7] + param_3);

    *puVar1 = local_30;

    puVar1[1] = local_2c;

    puVar1[2] = local_28;

  }

  if ((*param_2 & 0x10) != 0) {

    puVar1 = (undefined4 *)(param_2[0xd] + param_3);

    *puVar1 = uVar2;

    puVar1[1] = uVar4;

    puVar1[2] = uVar3;

  }

  if ((*param_2 & 0x40) != 0) {

    *(undefined4 *)(param_3 + param_2[0xf]) = local_50;

  }

  if ((char)(byte)*param_2 < '\0') {

    *(undefined4 *)(param_3 + param_2[0x10]) = local_4c;

  }

  if (param_2[5] == 0) {

    if ((*param_2 & 0x10000000) != 0) {

      puVar1 = (undefined4 *)(param_2[0x19] + param_3);

      *puVar1 = local_18;

      puVar1[1] = local_14;

      puVar1[2] = local_10;

    }

    if ((*param_2 & 0x20000000) != 0) {

      puVar1 = (undefined4 *)(param_2[0x1a] + param_3);

      *puVar1 = local_c;

      puVar1[1] = local_8;

      puVar1[2] = local_4;

    }

    if (param_2[6] == 0) {

      return 1;

    }

  }

  return 0;

}





// --- FUN_005d9280 at 0x005D9280 (size: 932) ---


/* WARNING: Removing unreachable block (ram,0x005d9454) */

/* WARNING: Removing unreachable block (ram,0x005d958d) */



byte __thiscall FUN_005d9280(int *param_1,int *param_2)



{

  char cVar1;

  byte bVar2;

  int *piVar3;

  LONG LVar4;

  int iVar5;

  uint uVar6;

  undefined4 *puVar7;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  undefined4 extraout_ECX_02;

  undefined4 extraout_ECX_03;

  undefined4 extraout_ECX_04;

  undefined4 extraout_ECX_05;

  undefined4 uVar8;

  undefined4 extraout_ECX_06;

  uint uVar9;

  uint uVar10;

  undefined4 extraout_ECX_07;

  byte bVar11;

  int unaff_EBX;

  uint unaff_EBP;

  undefined4 *puVar12;

  bool bVar13;

  undefined4 uStack_98;

  undefined1 auStack_94 [12];

  undefined1 auStack_88 [136];

  

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

    uStack_98 = CONCAT13(1,(undefined3)uStack_98);

    cVar1 = FUN_0065cc50(&DAT_008f1020);

    if (cVar1 != '\0') {

      uStack_98 = uStack_98 & 0xffffff;

    }

    piVar3 = (int *)(**(code **)(*param_2 + 0xc))(0);

    uVar8 = extraout_ECX;

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

LAB_005d93c4:

      FUN_00401340("invalid vertex array");

      FUN_0065d620(param_2,uVar8);

      return 0;

    }

    cVar1 = FUN_0065cc50(&DAT_008f1024);

    if (cVar1 == '\0') {

      FUN_00401340("expected ");

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

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

      }

      iVar5 = unaff_EBX;

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

      FUN_0065d620(piVar3,iVar5);

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

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

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

        return 0;

      }

    }

    else {

      iVar5 = (**(code **)(*piVar3 + 0xc))(0);

      uVar8 = extraout_ECX_00;

      if ((iVar5 == 0) ||

         (cVar1 = FUN_00448290(&stack0xffffff5c), uVar8 = extraout_ECX_01, cVar1 == '\0')) {

        FUN_00401340("invalid vertex type");

        FUN_0065d620(piVar3,uVar8);

        return 0;

      }

      uVar6 = (**(code **)(*param_2 + 0xc))(1);

      uVar8 = extraout_ECX_02;

      uStack_98 = uVar6;

      if (uVar6 == 0) goto LAB_005d93c4;

      cVar1 = FUN_0065cc50(&DAT_008f1028);

      if (cVar1 == '\0') {

        FUN_00401340("expected ");

        FUN_004087d0(&DAT_008f1028);

        uVar8 = extraout_ECX_03;

        FUN_0041ab80(&stack0xffffff60);

        FUN_0065d620(uVar6,uVar8);

        FUN_004011b0();

        return 0;

      }

      FUN_0044ce60();

      FUN_00406d60();

      iVar5 = FUN_0065ca90();

      uVar8 = extraout_ECX_04;

      if ((iVar5 == 0) || (cVar1 = FUN_00444f00(auStack_94), uVar8 = extraout_ECX_05, cVar1 == '\0')

         ) {

        FUN_00401340("corrupt vertex data");

        FUN_0065d620(uVar6,uVar8);

        FUN_00406f90();

      }

      else {

        FUN_00446770(auStack_94);

        FUN_00401a80(&uStack_98,param_1 + 0x1f,auStack_88);

        FUN_00406f90();

        FUN_005d83a0(1);

        bVar13 = (unaff_EBP & 0xff0000) == 0;

        cVar1 = (**(code **)(*param_1 + 4))

                          (param_1[0x1f],unaff_EBP & 0xffffff3f,bVar13,bVar13,0xffffffff);

        if (cVar1 == '\0') {

          uVar8 = extraout_ECX_06;

          FUN_00401340("could not allocate vertex array");

          FUN_0065d620(uVar6,uVar8);

        }

        else {

          puVar7 = (undefined4 *)(**(code **)(*param_1 + 0xc))(0,param_1[0x1f]);

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

            bVar11 = 1;

            uVar6 = 0;

            if (param_1[0x1f] != 0) {

              do {

                uVar10 = param_1[3];

                puVar12 = puVar7;

                for (uVar9 = uVar10 >> 2; uVar9 != 0; uVar9 = uVar9 - 1) {

                  *puVar12 = 0;

                  puVar12 = puVar12 + 1;

                }

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

                  *(undefined1 *)puVar12 = 0;

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

                }

                bVar2 = FUN_005d8e30(auStack_88,param_1 + 2,puVar7,1);

                uVar10 = uStack_98;

                bVar11 = bVar11 & bVar2;

                if (bVar11 == 0) {

                  uVar8 = extraout_ECX_07;

                  FUN_00401340("could not read vertex");

                  FUN_0065d620(uVar10,uVar8);

                  break;

                }

                puVar7 = (undefined4 *)((int)puVar7 + param_1[3]);

                uVar6 = uVar6 + 1;

              } while (uVar6 < (uint)param_1[0x1f]);

            }

            (**(code **)(*param_1 + 0x10))(1,1);

            FUN_0065e850();

            FUN_004466a0();

            return bVar11;

          }

        }

      }

      FUN_004466a0();

    }

  }

  return 0;

}





// --- FUN_005d9630 at 0x005D9630 (size: 396) ---


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



void __fastcall FUN_005d9630(int param_1)



{

  int iVar1;

  uint *puVar2;

  char cVar3;

  uint uVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  undefined1 local_6c [92];

  undefined1 *local_10;

  uint local_8;

  

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

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

    FUN_0045bac0(0x17);

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

    while (iVar1 = iVar1 + -1, -1 < iVar1) {

      uVar7 = 0;

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

        do {

          iVar5 = *(int *)(param_1 + 0xc) * iVar1 + *(int *)(param_1 + 0x80);

          if (_DAT_007e9e10 < *(float *)(*(int *)(param_1 + 0x78) + iVar5)) {

            uVar6 = (uint)*(byte *)(*(int *)(param_1 + 0x74) + iVar5);

            for (puVar2 = *(uint **)(local_10 + (uVar6 % local_8) * 4); puVar2 != (uint *)0x0;

                puVar2 = (uint *)puVar2[1]) {

              if (*puVar2 == uVar6) {

                if (puVar2 != (uint *)0x0) goto LAB_005d976d;

                break;

              }

            }

            uVar4 = *(uint *)(param_1 + 0xa4) & 0x7fffffff;

            if (uVar4 <= *(uint *)(param_1 + 0xa8)) {

              uVar4 = uVar4 + 1;

              if (uVar4 < 9) {

                uVar4 = 8;

              }

              else if (uVar4 < 0x4001) {

                iVar5 = 0x1f;

                if (uVar4 != 0) {

                  for (; uVar4 >> iVar5 == 0; iVar5 = iVar5 + -1) {

                  }

                }

                uVar8 = 1 << ((byte)iVar5 & 0x1f);

                if (uVar8 < uVar4) {

                  uVar4 = uVar8 * 2;

                }

              }

              else if ((uVar4 & 0x3fff) != 0) {

                uVar4 = uVar4 + (0x4000 - (uVar4 & 0x3fff));

              }

              cVar3 = FUN_004180a0(uVar4);

              if (cVar3 == '\0') goto LAB_005d976d;

            }

            *(uint *)(*(int *)(param_1 + 0xa0) + *(int *)(param_1 + 0xa8) * 4) = uVar6;

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

          }

LAB_005d976d:

          uVar7 = uVar7 + 1;

        } while (uVar7 < *(uint *)(param_1 + 0x20));

      }

    }

    FUN_005870f0();

    if (local_10 != local_6c) {

      operator_delete__(local_10);

    }

  }

  return;

}





// --- FUN_005d97c0 at 0x005D97C0 (size: 42) ---


void __thiscall FUN_005d97c0(int param_1,char param_2,char param_3)



{

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

  if (param_2 != '\0') {

    FUN_005d85e0();

  }

  if (param_3 != '\0') {

    FUN_005d9630();

  }

  return;

}





// --- FUN_005d97f0 at 0x005D97F0 (size: 613) ---


void __fastcall FUN_005d97f0(uint *param_1)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  uint *puVar5;

  

  uVar3 = *param_1;

  uVar4 = 0;

  uVar1 = uVar3 & 0xe;

  *(undefined1 *)(param_1 + 2) = 1;

  param_1[4] = 0;

  if (uVar1 == 6) {

    param_1[4] = 1;

  }

  if (uVar1 == 8) {

    param_1[4] = 2;

  }

  if (uVar1 == 10) {

    param_1[4] = 3;

  }

  if (uVar1 == 0xc) {

    param_1[4] = 4;

  }

  if (uVar1 == 0xe) {

    param_1[4] = 5;

  }

  uVar2 = uVar3 & 0xf00;

  param_1[5] = 0;

  if (uVar2 == 0x100) {

    param_1[5] = 1;

  }

  if (uVar2 == 0x200) {

    param_1[5] = 2;

  }

  if (uVar2 == 0x300) {

    param_1[5] = 3;

  }

  if (uVar2 == 0x400) {

    param_1[5] = 4;

  }

  if (uVar2 == 0x500) {

    param_1[5] = 5;

  }

  if (uVar2 == 0x600) {

    param_1[5] = 6;

  }

  if (uVar2 == 0x700) {

    param_1[5] = 7;

  }

  if (uVar2 == 0x800) {

    param_1[5] = 8;

  }

  param_1[6] = (uint)*(byte *)((int)param_1 + 2);

  if (*(byte *)((int)param_1 + 2) != 0) {

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

  }

  param_1[7] = 0;

  if (uVar1 != 0) {

    uVar4 = 0xc;

  }

  param_1[9] = uVar4 + 4;

  param_1[0xb] = uVar4 + 0xc;

  param_1[10] = uVar4 + 8;

  uVar1 = uVar4 + param_1[4] * 4;

  param_1[8] = uVar4;

  param_1[0xc] = uVar4 + 0x10;

  param_1[0xd] = uVar1;

  if ((uVar3 & 0x10) != 0) {

    uVar1 = uVar1 + 0xc;

  }

  param_1[0xe] = uVar1;

  if ((uVar3 & 0x20) != 0) {

    uVar1 = uVar1 + 4;

  }

  param_1[0xf] = uVar1;

  if ((uVar3 & 0x40) != 0) {

    uVar1 = uVar1 + 4;

  }

  param_1[0x10] = uVar1;

  if ((char)uVar3 < '\0') {

    uVar1 = uVar1 + 4;

  }

  uVar3 = 0;

  if (param_1[5] != 0) {

    puVar5 = param_1 + 0x11;

    do {

      *puVar5 = uVar1;

      uVar1 = uVar1 + 8;

      uVar3 = uVar3 + 1;

      puVar5 = puVar5 + 1;

    } while (uVar3 < param_1[5]);

  }

  uVar3 = *param_1;

  param_1[0x19] = uVar1;

  if ((uVar3 & 0x10000000) != 0) {

    uVar1 = uVar1 + 0xc;

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

  }

  param_1[0x1a] = uVar1;

  if ((uVar3 & 0x20000000) != 0) {

    uVar1 = uVar1 + 0xc;

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

  }

  param_1[0x1b] = uVar1;

  uVar1 = uVar1 + param_1[6];

  param_1[0x1c] = uVar1;

  uVar1 = uVar1 + param_1[6] * 4;

  param_1[1] = uVar1;

  if ((uVar3 & 0x1000000) != 0) {

    if (uVar1 < 0x20) {

      param_1[3] = uVar3 & 0xce00ffff;

      param_1[1] = 0x20;

      return;

    }

    if (uVar1 < 0x40) {

      param_1[3] = uVar3 & 0xce00ffff;

      param_1[1] = 0x40;

      return;

    }

    if (uVar1 < 0x60) {

      param_1[3] = uVar3 & 0xce00ffff;

      param_1[1] = 0x60;

      return;

    }

    if (uVar1 < 0x80) {

      param_1[3] = uVar3 & 0xce00ffff;

      param_1[1] = 0x80;

      return;

    }

    if (uVar1 < 0xa0) {

      param_1[3] = uVar3 & 0xce00ffff;

      param_1[1] = 0xa0;

      return;

    }

    if (uVar1 < 0xc0) {

      param_1[3] = uVar3 & 0xce00ffff;

      param_1[1] = 0xc0;

      return;

    }

    if (uVar1 < 0xe0) {

      param_1[3] = uVar3 & 0xce00ffff;

      param_1[1] = 0xe0;

      return;

    }

    if (uVar1 < 0x100) {

      param_1[1] = 0x100;

    }

  }

  param_1[3] = uVar3 & 0xce00ffff;

  return;

}





// --- FUN_005d9a60 at 0x005D9A60 (size: 79) ---


void __fastcall FUN_005d9a60(int param_1)



{

  int *piVar1;

  int iVar2;

  

  piVar1 = DAT_00837ff4;

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

    if (param_1 == 0) {

      iVar2 = 0;

    }

    else {

      iVar2 = param_1 + 8;

    }

    (**(code **)(*DAT_00837ff4 + 0x34))(0xc,iVar2,4000);

    if (*(char *)(param_1 + 0xc) != '\0') {

      (**(code **)(*piVar1 + 0x34))(3,param_1 + 8,4000);

      return;

    }

    (**(code **)(*piVar1 + 0x38))(3,param_1 + 8);

  }

  return;

}





// --- FUN_005d9ab0 at 0x005D9AB0 (size: 222) ---


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



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



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  float fVar4;

  float fVar5;

  int iVar6;

  

  iVar6 = param_2 * 0x24;

  *(undefined4 *)(iVar6 + 0x1c + *(int *)(param_1 + 0x58)) = param_3;

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

  uVar2 = *(uint *)(iVar1 + *(int *)(param_1 + 0x54) * 4 + param_2 * 0x24);

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

    *(undefined4 *)(iVar1 + 0x20 + iVar6) = 0;

    return;

  }

  uVar3 = *(uint *)(iVar1 + 0x1c + iVar6);

  fVar4 = (float)*(int *)(iVar1 + 0x1c + iVar6);

  if ((int)uVar3 < 0) {

    fVar4 = fVar4 + _DAT_0079920c;

  }

  fVar5 = (float)(int)uVar2;

  if ((int)uVar2 < 0) {

    fVar5 = fVar5 + _DAT_0079920c;

  }

  if (fVar5 * _DAT_007ea030 < fVar4) {

    *(undefined4 *)(iVar1 + 0x20 + iVar6) = 5;

    return;

  }

  if (uVar2 < uVar3) {

    *(undefined4 *)(iVar1 + 0x20 + iVar6) = 4;

    return;

  }

  if (fVar5 * _DAT_007ea02c < fVar4) {

    *(undefined4 *)(iVar1 + 0x20 + iVar6) = 3;

    return;

  }

  if (fVar5 * _DAT_007c97cc < fVar4) {

    *(undefined4 *)(iVar1 + 0x20 + iVar6) = 2;

    return;

  }

  *(undefined4 *)(iVar1 + 0x20 + iVar6) = 1;

  return;

}





// --- FUN_005d9b90 at 0x005D9B90 (size: 210) ---


void __fastcall FUN_005d9b90(int param_1)



{

  uint uVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  uint local_c;

  

  iVar3 = FUN_0054fd20();

  iVar4 = FUN_0054fd30();

  iVar5 = 0xaa;

  iVar6 = 0x14;

  local_c = 0;

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

    do {

      iVar2 = *(int *)(*(int *)(param_1 + 0x10) + local_c * 4);

      if ((*(char *)(iVar2 + 4) != '\0') && (iVar2 = *(int *)(iVar2 + 0xc), iVar2 != 0)) {

        if (iVar4 - 6U < (uint)(*(int *)(iVar2 + 0x18) + iVar6)) {

          iVar5 = iVar5 + 0x116;

          iVar6 = 0x14;

        }

        uVar1 = *(int *)(iVar2 + 0x14) + iVar5;

        if (iVar3 - 8U < uVar1) {

          if (iVar5 == 0xaa) {

            FUN_00699b60(0xaa,0x14);

            goto LAB_005d9c46;

          }

          if (iVar3 - 8U < uVar1) {

            iVar5 = 0xaa;

            iVar6 = 0x14;

          }

        }

        FUN_00699b60(iVar5,iVar6);

        iVar6 = iVar6 + 6 + *(int *)(iVar2 + 0x18);

      }

LAB_005d9c46:

      local_c = local_c + 1;

    } while (local_c < *(uint *)(param_1 + 0x18));

  }

  return;

}





// --- FUN_005d9d10 at 0x005D9D10 (size: 190) ---


void __fastcall FUN_005d9d10(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  undefined4 local_c;

  

  iVar4 = 0;

  local_c = 0;

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

    do {

      iVar5 = *(int *)(param_1 + 0x78) + iVar4;

      iVar2 = FUN_00414590(*(undefined4 *)(*(int *)(param_1 + 0x78) + iVar4));

      uVar1 = DAT_008379b4;

      if (iVar2 != 0) {

        iVar3 = *(int *)(iVar2 + 0x10c) - *(int *)(iVar2 + 0x108);

        if (iVar3 != *(int *)(iVar5 + 8)) {

          *(undefined4 *)(iVar5 + 0x18) = DAT_008379b0;

          *(undefined4 *)(iVar5 + 0x1c) = uVar1;

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

        }

        uVar1 = DAT_008379b4;

        iVar2 = *(int *)(iVar2 + 0x108);

        if (iVar2 != *(int *)(iVar5 + 0xc)) {

          *(undefined4 *)(iVar5 + 0x18) = DAT_008379b0;

          *(undefined4 *)(iVar5 + 0x1c) = uVar1;

          *(int *)(iVar5 + 0xc) = iVar2;

        }

        uVar1 = DAT_008379b4;

        if (*(int *)(iVar5 + 8) + *(int *)(iVar5 + 0xc) != 0) {

          *(undefined4 *)(iVar5 + 0x10) = DAT_008379b0;

          *(undefined4 *)(iVar5 + 0x14) = uVar1;

        }

      }

      local_c = local_c + 1;

      iVar4 = iVar4 + 0x20;

    } while (local_c < *(uint *)(param_1 + 0x80));

  }

  return;

}





// --- FUN_005d9dd0 at 0x005D9DD0 (size: 106) ---


void __thiscall FUN_005d9dd0(undefined4 param_1,undefined1 *param_2)



{

  char cVar1;

  int iVar2;

  int *local_4;

  

  local_4 = (int *)0x0;

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if (((cVar1 != '\0') && (iVar2 = (**(code **)(*local_4 + 0x44))(), iVar2 != 0)) &&

     (*(int *)(iVar2 + 0x10) == 2)) {

    *param_2 = **(undefined1 **)(iVar2 + 0xc);

  }

  return;

}





// --- FUN_005d9e40 at 0x005D9E40 (size: 106) ---


void __thiscall FUN_005d9e40(undefined4 param_1,undefined4 *param_2)



{

  char cVar1;

  int iVar2;

  int *local_4;

  

  local_4 = (int *)0x0;

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if (((cVar1 != '\0') && (iVar2 = (**(code **)(*local_4 + 0x44))(), iVar2 != 0)) &&

     (*(int *)(iVar2 + 0x10) == 4)) {

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

  }

  return;

}





// --- FUN_005d9eb0 at 0x005D9EB0 (size: 160) ---


int * __thiscall FUN_005d9eb0(int *param_1,byte param_2)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int *piVar4;

  int local_4;

  

  if ((param_2 & 2) == 0) {

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

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

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

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

    }

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

      operator_delete(param_1);

    }

    return param_1;

  }

  local_4 = param_1[-1];

  piVar4 = param_1 + local_4 * 9;

  if (-1 < local_4 + -1) {

    do {

      piVar1 = piVar4 + -9;

      piVar4 = piVar4 + -9;

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

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

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

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

      }

      local_4 = local_4 + -1;

    } while (local_4 != 0);

  }

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

    operator_delete__(param_1 + -1);

  }

  return param_1 + -1;

}





// --- FUN_005d9f60 at 0x005D9F60 (size: 167) ---


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



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int iVar4;

  int local_4;

  

  if ((param_2 & 2) == 0) {

    puVar3 = (undefined4 *)(*(int *)((int)param_1 + 4) + -0x14);

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

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

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

    }

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

      operator_delete(param_1);

    }

    return param_1;

  }

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

  if (-1 < local_4 + -1) {

    iVar4 = (int)param_1 + local_4 * 0x20 + 4;

    do {

      piVar1 = (int *)(iVar4 + -0x20);

      iVar4 = iVar4 + -0x20;

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

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

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

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

      }

      local_4 = local_4 + -1;

    } while (local_4 != 0);

  }

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

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

  }

  return (void *)((int)param_1 + -4);

}





// --- FUN_005da010 at 0x005DA010 (size: 110) ---


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



{

  int iVar1;

  LONG LVar2;

  

  *param_1 = *param_2;

  iVar1 = param_1[1];

  if (iVar1 != param_2[1]) {

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

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

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

    }

    iVar1 = param_2[1];

    param_1[1] = iVar1;

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

  }

  param_1[2] = param_2[2];

  param_1[3] = param_2[3];

  param_1[4] = param_2[4];

  param_1[5] = param_2[5];

  param_1[6] = param_2[6];

  param_1[7] = param_2[7];

  return param_1;

}





// --- FUN_005da080 at 0x005DA080 (size: 102) ---


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



{

  int iVar1;

  LONG LVar2;

  

  iVar1 = *param_1;

  if (iVar1 != *param_2) {

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

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

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

    }

    iVar1 = *param_2;

    *param_1 = iVar1;

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

  }

  param_1[1] = param_2[1];

  param_1[2] = param_2[2];

  param_1[3] = param_2[3];

  param_1[4] = param_2[4];

  param_1[5] = param_2[5];

  *(char *)(param_1 + 6) = (char)param_2[6];

  return param_1;

}





// --- FUN_005da0f0 at 0x005DA0F0 (size: 154) ---


int * __thiscall

FUN_005da0f0(int *param_1,int param_2,int param_3,int param_4,int param_5,int param_6,int param_7,

            undefined1 param_8)



{

  int iVar1;

  LONG LVar2;

  LONG *lpAddend;

  

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

  *param_1 = (int)PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  iVar1 = *param_1;

  if (iVar1 != param_2) {

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

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

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

    }

    *param_1 = param_2;

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

  }

  param_1[1] = param_3;

  param_1[4] = param_6;

  param_1[2] = param_4;

  param_1[3] = param_5;

  param_1[5] = param_7;

  *(undefined1 *)(param_1 + 6) = param_8;

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

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

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

  }

  return param_1;

}





// --- FUN_005da190 at 0x005DA190 (size: 191) ---


void __fastcall FUN_005da190(int param_1)



{

  if (*(undefined4 **)(param_1 + 0x84) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x84))(param_1);

  }

  FUN_005d9ab0(3,*(undefined4 *)(param_1 + 0x68));

  FUN_005d9ab0(4,*(undefined4 *)(param_1 + 0x70));

  FUN_005d9ab0(5,DAT_008f23f8 + DAT_008f23fc + DAT_008f2400 + DAT_008f2404 + DAT_008f2408 +

                 DAT_008f240c);

  FUN_005d9ab0(0,DAT_008f244c);

  FUN_005d9ab0(1,DAT_008f2450);

  FUN_005d9ab0(2,DAT_008f2454);

  FUN_005d9ab0(6,DAT_008f2490 + DAT_008f2494 + DAT_008f2498 + DAT_008f249c);

  FUN_005d9d10();

  return;

}





// --- FUN_005da250 at 0x005DA250 (size: 163) ---


void __thiscall FUN_005da250(int param_1,int param_2)



{

  int *piVar1;

  void *pvVar2;

  undefined4 *puVar3;

  uint uVar4;

  uint uVar5;

  

  uVar5 = 0;

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

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

    while (*(int *)*puVar3 != param_2) {

      uVar5 = uVar5 + 1;

      puVar3 = puVar3 + 1;

      if (*(uint *)(param_1 + 0x18) <= uVar5) {

        FUN_005d9b90();

        return;

      }

    }

    pvVar2 = (void *)(*(undefined4 **)(param_1 + 0x10))[uVar5];

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

      puVar3 = *(undefined4 **)((int)pvVar2 + 0xc);

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

        piVar1 = puVar3 + 1;

        *piVar1 = *piVar1 + -1;

        if (*piVar1 == 0) {

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

        }

        *(undefined4 *)((int)pvVar2 + 0xc) = 0;

      }

      operator_delete(pvVar2);

    }

    *(undefined4 *)(*(int *)(param_1 + 0x10) + uVar5 * 4) = 0;

    if (uVar5 < *(uint *)(param_1 + 0x18)) {

      uVar4 = *(uint *)(param_1 + 0x18) - 1;

      *(uint *)(param_1 + 0x18) = uVar4;

      if (uVar5 != uVar4) {

        *(undefined4 *)(*(int *)(param_1 + 0x10) + uVar5 * 4) =

             *(undefined4 *)(*(int *)(param_1 + 0x10) + uVar4 * 4);

        *(undefined4 *)(*(int *)(param_1 + 0x10) + *(int *)(param_1 + 0x18) * 4) = 0;

      }

    }

  }

  FUN_005d9b90();

  return;

}





// --- FUN_005da300 at 0x005DA300 (size: 171) ---


void __fastcall FUN_005da300(int *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  uint local_24;

  undefined1 local_20 [4];

  undefined *local_1c;

  

  param_1[2] = 0;

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

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

      do {

        local_1c = PTR_DAT_00818344;

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

        FUN_005da010(local_20);

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

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

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

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

        }

        local_24 = local_24 - 1;

      } while (local_24 != 0);

    }

    return;

  }

  if (*param_1 != 0) {

    FUN_005d9f60(3);

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_005da3c0 at 0x005DA3C0 (size: 200) ---


undefined4 __thiscall FUN_005da3c0(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_005da300();

      return 1;

    }

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

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

      puVar1 = puVar3 + 1;

      *puVar3 = param_2;

      FUN_00401000(puVar1,0x20,param_2,&LAB_004599e0);

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

        if (*param_1 != 0) {

          param_2 = param_1[2];

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

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

            do {

              FUN_005da010(*param_1 + iVar4);

              iVar4 = iVar4 + -0x20;

              param_2 = param_2 + -1;

            } while (param_2 != 0);

          }

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

            FUN_005d9f60(3);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005da490 at 0x005DA490 (size: 80) ---


void FUN_005da490(void)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  

  puVar4 = &DAT_008f20b0;

  do {

    piVar1 = (int *)*puVar4;

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

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

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

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

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

      }

      operator_delete(piVar1);

    }

    *puVar4 = 0;

    puVar4 = puVar4 + 1;

  } while ((int)puVar4 < 0x8f20cc);

  return;

}





// --- FUN_005da530 at 0x005DA530 (size: 495) ---


void __fastcall FUN_005da530(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  LONG LVar4;

  undefined4 *puVar5;

  int iStack_28;

  int iStack_24;

  int iStack_20;

  int iStack_1c;

  int iStack_18;

  int local_14;

  int local_10;

  uint local_c;

  undefined4 uStack_8;

  undefined4 local_4;

  

  local_c = 0;

  local_10 = param_1;

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

    do {

      iVar1 = *(int *)(*(int *)(param_1 + 0x3c) + local_c * 4);

      switch(*(int *)(iVar1 + 8)) {

      case 10:

      case 0xb:

      case 0xc:

      case 0xd:

      case 0xe:

        FUN_00699cd0(CONCAT31((int3)((uint)*(int *)(param_1 + 0x54) >> 8),

                              *(int *)(param_1 + 0x54) == *(int *)(iVar1 + 8) + -9));

        break;

      case 0x14:

        FUN_00401340("RenderDevice.Wireframe");

        FUN_005d9dd0(&uStack_8);

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

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

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

        }

        FUN_00699cd0(uStack_8);

        break;

      case 0x15:

        iStack_1c = 0;

        FUN_00401340("RenderD3D.AlphaDelayMask");

        FUN_005d9e40(&iStack_1c);

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

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

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

        }

        iVar3 = iStack_1c;

        FUN_00408670(&iStack_18,0,"Delayed Alpha [%x]",iStack_1c);

        FUN_00401340(iStack_18);

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

        if (iVar2 != iStack_28) {

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

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

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

          }

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

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

        }

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

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

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

        }

        FUN_00699cd0(iVar3 != 0);

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

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

        param_1 = local_10;

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

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

          param_1 = local_10;

        }

        break;

      case 0x16:

        FUN_00401340("RenderDeviceD3D.AllowDrawPrimUP");

        FUN_005d9dd0(&local_4);

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

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

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

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

        }

        FUN_00699cd0(local_4);

      }

      local_c = local_c + 1;

    } while (local_c < *(uint *)(param_1 + 0x44));

  }

  return;

}





// --- FUN_005da750 at 0x005DA750 (size: 282) ---


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



void __thiscall FUN_005da750(int param_1,int param_2)



{

  int iVar1;

  char cVar2;

  int iVar3;

  int iVar4;

  float fVar5;

  LONG LVar6;

  undefined4 uVar7;

  undefined8 uVar8;

  char local_800 [1024];

  char local_400 [1024];

  

  iVar3 = *(int *)(*(int *)(param_1 + 0x58) + param_2 * 0x24);

  iVar1 = *(int *)(param_1 + 0x58) + param_2 * 0x24;

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

  iVar4 = *(int *)(iVar1 + 0x1c);

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

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

  FUN_00699a30(0,*(undefined4 *)(param_1 + 100),iVar3,*(undefined4 *)(&DAT_008f2098 + iVar1 * 4));

  if (cVar2 == '\0') {

    sprintf(local_800,"%9i");

    uVar7 = *(undefined4 *)(param_1 + 100);

    uVar8 = CONCAT44(*(undefined4 *)(&DAT_008f2098 + iVar1 * 4),local_800);

  }

  else {

    fVar5 = (float)iVar4;

    if (iVar4 < 0) {

      fVar5 = fVar5 + _DAT_0079920c;

    }

    sprintf(local_800,"%.02f",(double)(fVar5 * _DAT_0079cdec));

    sprintf(local_400,"%6s MB",local_800);

    uVar7 = *(undefined4 *)(param_1 + 100);

    uVar8 = CONCAT44(*(undefined4 *)(&DAT_008f2098 + iVar1 * 4),local_400);

  }

  FUN_00699a30(0xb4,uVar7,uVar8);

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

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

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

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

  }

  return;

}





// --- FUN_005da8a0 at 0x005DA8A0 (size: 71) ---


void __fastcall FUN_005da8a0(int param_1)



{

  undefined4 uVar1;

  

  if ((*(char *)(param_1 + 0xd) != '\0') || (*(char *)(param_1 + 0xe) != '\0')) {

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

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

    FUN_005d9a60();

  }

  if (*(char *)(param_1 + 0xc) != '\0') {

    uVar1 = FUN_0054bd80();

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

    FUN_005da190();

    if (*(char *)(param_1 + 0xc) != '\0') {

      FUN_005da530();

      return;

    }

  }

  return;

}





// --- FUN_005da8f0 at 0x005DA8F0 (size: 7835) ---


/* WARNING (jumptable): Unable to track spacebase fully for stack */

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



void __fastcall FUN_005da8f0(int param_1)



{

  int *piVar1;

  int *piVar2;

  float fVar3;

  double dVar4;

  undefined4 uVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  uint uVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  undefined4 uVar15;

  undefined4 uVar16;

  undefined8 uVar17;

  uint uStack_58;

  int iStack_54;

  uint local_50;

  uint local_4c;

  _MEMORYSTATUS _Stack_28;

  

  if (*(char *)(param_1 + 0xc) != '\0') {

    FUN_005a4390();

    iVar6 = FUN_005df4c4();

    uVar7 = FUN_005df4c4();

    uVar8 = FUN_005df4c4();

    uVar9 = FUN_005df4c4();

    uVar9 = ((iVar6 << 8 | uVar7) << 8 | uVar8) << 8 | uVar9;

    FUN_005a26a0();

    local_50 = 0;

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

      do {

        piVar1 = *(int **)(*(int *)(param_1 + 0x10) + local_50 * 4);

        piVar2 = (int *)piVar1[3];

        (**(code **)(*piVar2 + 4))();

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

        iVar6 = piVar1[2];

        if (iVar6 == 6) {

          iVar6 = *piVar1;

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

            iVar14 = DAT_008f2400 + DAT_008f2404;

            iVar6 = DAT_008f2408 + DAT_008f240c;

            iVar13 = DAT_008f2418 + DAT_008f241c + DAT_008f2420;

            iVar10 = (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x10))();

            _Stack_28.dwLength = 0x20;

            GlobalMemoryStatus(&_Stack_28);

            iVar11 = DAT_008f2414 + DAT_008f2410 + DAT_008f2424 + DAT_008f2428 + DAT_008f2430 +

                     DAT_008f2434 + DAT_008f2444 + DAT_008f2448 + iVar13;

            sprintf(&DAT_008f1b60,"[%s]");

            FUN_00699a30(0,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,0xff000000);

            *(int *)(param_1 + 100) = *(int *)(param_1 + 100) + 0x10;

            FUN_005da750(3,piVar2);

            FUN_00699a30(0,*(undefined4 *)(param_1 + 100),"  Peak Process Memory",0xffcccccc);

            fVar3 = (float)*(int *)(param_1 + 0x6c);

            if (*(int *)(param_1 + 0x6c) < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

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

            FUN_005da750(4,piVar2);

            FUN_00699a30(0,*(undefined4 *)(param_1 + 100),"  Peak Virtual Memory",0xffcccccc);

            fVar3 = (float)*(int *)(param_1 + 0x74);

            if (*(int *)(param_1 + 0x74) < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar12 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar12,"Memory Available",0xffcccccc);

            fVar3 = (float)(int)_Stack_28.dwAvailVirtual;

            if ((int)_Stack_28.dwAvailVirtual < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar12 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar12,"Memory Accounted For",0xffcccccc);

            fVar3 = (float)iVar11;

            if (iVar11 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar11 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar11,"  ImgTex",0xffcccccc);

            fVar3 = (float)DAT_008f2444;

            if (DAT_008f2444 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar11 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar11,"  D3DXMesh",0xffcccccc);

            fVar3 = (float)DAT_008f2448;

            if (DAT_008f2448 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar11 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar11,"  Surfaces",0xffcccccc);

            fVar3 = (float)DAT_008f2410;

            if (DAT_008f2410 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar11 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar11,"  UISurfaces",0xffcccccc);

            fVar3 = (float)DAT_008f2414;

            if (DAT_008f2414 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar11 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar11,"  Meshes",0xffcccccc);

            fVar3 = (float)iVar13;

            if (iVar13 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"    Vertices",0xff999999);

            fVar3 = (float)DAT_008f2418;

            if (DAT_008f2418 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,0xffb2b2b2);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"    Triangles",0xff999999);

            fVar3 = (float)DAT_008f241c;

            if (DAT_008f241c < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,0xffb2b2b2);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"    Topology",0xff999999);

            fVar3 = (float)DAT_008f2420;

            if (DAT_008f2420 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,0xffb2b2b2);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"  Fonts",0xffcccccc);

            fVar3 = (float)DAT_008f2424;

            if (DAT_008f2424 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"  Audio",0xffcccccc);

            fVar3 = (float)DAT_008f2428;

            if (DAT_008f2428 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"  Movies",0xffcccccc);

            fVar3 = (float)DAT_008f2430;

            if (DAT_008f2430 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"  LandBlocks",0xffcccccc);

            fVar3 = (float)DAT_008f2434;

            if (DAT_008f2434 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

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

            FUN_005da750(5,piVar2);

            FUN_00699a30(0,*(undefined4 *)(param_1 + 100),"Video Mem Available",0xffcccccc);

            fVar3 = (float)iVar10;

            if (iVar10 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"  Textures",0xffcccccc);

            fVar3 = (float)DAT_008f23f8;

            if (DAT_008f23f8 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"  Surfaces",0xffcccccc);

            fVar3 = (float)DAT_008f23fc;

            if (DAT_008f23fc < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"  Vertex Buffers",0xffcccccc);

            fVar3 = (float)iVar14;

            if (iVar14 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"    Static",0xff999999);

            fVar3 = (float)DAT_008f2400;

            if (DAT_008f2400 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,0xffb2b2b2);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"    Dynamic",0xff999999);

            fVar3 = (float)DAT_008f2404;

            if (DAT_008f2404 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,0xffb2b2b2);

            iVar13 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar13,"  Index Buffers",0xffcccccc);

            fVar3 = (float)iVar6;

            if (iVar6 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar6 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar6,"    Static",0xff999999);

            fVar3 = (float)DAT_008f2408;

            if (DAT_008f2408 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,0xffb2b2b2);

            iVar6 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar6,"    Dynamic",0xff999999);

            fVar3 = (float)DAT_008f240c;

            if (DAT_008f240c < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,0xffb2b2b2);

            iVar6 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar6,"Compositor Resources",0xffcccccc);

            fVar3 = (float)DAT_008f243c;

            if (DAT_008f243c < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

            FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

            iVar6 = *(int *)(param_1 + 100) + 0xc;

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

            FUN_00699a30(0,iVar6,"Compositor Textures",0xffcccccc);

            fVar3 = (float)DAT_008f2440;

            if (DAT_008f2440 < 0) {

              fVar3 = fVar3 + _DAT_0079920c;

            }

            sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

            sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

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

            uVar17 = CONCAT44(uVar9,&DAT_008f1760);

            uVar16 = 0xac;

            goto LAB_005dc6f1;

          }

          if (iVar6 == *(int *)(param_1 + 0x20)) {

            sprintf(&DAT_008f1b60,"[%s]");

            FUN_00699a30(0,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,0xff000000);

            iVar6 = *(int *)(param_1 + 100) + 0x10;

            goto LAB_005dc6fe;

          }

          if (iVar6 == *(int *)(param_1 + 0x24)) {

            sprintf(&DAT_008f1b60,"[%s]");

            FUN_00699a30(0,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,0xff000000);

            *(int *)(param_1 + 100) = *(int *)(param_1 + 100) + 0x10;

            uVar16 = FUN_00424000();

            FUN_00699a30(0x80,*(undefined4 *)(param_1 + 100),"referenced  free",uVar16);

            iVar6 = *(int *)(param_1 + 100) + 0xc;

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

            uVar5 = DAT_008379b4;

            uVar16 = DAT_008379b0;

            local_4c = 0;

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

              iStack_54 = 0;

              do {

                iVar13 = *(int *)(param_1 + 0x78) + iStack_54;

                if ((double)CONCAT44(uVar5,uVar16) -

                    *(double *)(*(int *)(param_1 + 0x78) + 0x10 + iStack_54) < _DAT_007c7200) {

                  dVar4 = (double)CONCAT44(uVar5,uVar16) - *(double *)(iVar13 + 0x18);

                  uVar15 = 0xff999999;

                  uStack_58 = 0xffb2b2b2;

                  if (_DAT_007938c0 <= dVar4) {

                    if (dVar4 < _DAT_007c7200) {

                      uVar15 = 0xffcccccc;

                      uStack_58 = uVar9;

                    }

                  }

                  else {

                    uVar15 = 0xffffffff;

                    uStack_58 = 0xffffffff;

                  }

                  FUN_00699a30(0,iVar6,*(undefined4 *)(iVar13 + 4),uVar15);

                  sprintf(&DAT_008f1b60,"%9i");

                  FUN_00699a30(0x8c,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uStack_58);

                  sprintf(&DAT_008f1b60,"%9i");

                  FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uStack_58);

                  iVar6 = *(int *)(param_1 + 100) + 0xc;

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

                }

                iStack_54 = iStack_54 + 0x20;

                local_4c = local_4c + 1;

              } while (local_4c < *(uint *)(param_1 + 0x80));

            }

          }

          else if (iVar6 == *(int *)(param_1 + 0x2c)) {

            sprintf(&DAT_008f1b60,"[%s]");

            FUN_00699a30(0,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,0xff000000);

            iVar6 = *(int *)(param_1 + 100) + 0x10;

            uVar17 = 0xffffffff007ea05c;

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

            uVar16 = 0;

            goto LAB_005dc6f1;

          }

          goto LAB_005dc701;

        }

        iVar13 = iVar6 * 0x88;

        switch(iVar6) {

        case 0:

          sprintf(&DAT_008f1b60,"[%s]");

          FUN_00699a30(0,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,0xff000000);

          *(int *)(param_1 + 100) = *(int *)(param_1 + 100) + 0x10;

          FUN_005da750(0,piVar2);

          FUN_005da750(1,piVar2);

          FUN_005da750(2,piVar2);

          FUN_00699a30(0,*(undefined4 *)(param_1 + 100),"UISurfaces Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar10 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar10,"Textures Uploaded",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar10 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar10,"Texture Mem Uploaded",0xffcccccc);

          fVar3 = (float)*(int *)(&DAT_008f2464 + iVar13);

          if (*(int *)(&DAT_008f2464 + iVar13) < 0) {

            fVar3 = fVar3 + _DAT_0079920c;

          }

          sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

          sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

          FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

          iVar10 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar10,"Vertices Uploaded",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar10 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar10,"VB Memory Uploaded",0xffcccccc);

          fVar3 = (float)*(int *)(&DAT_008f246c + iVar13);

          if (*(int *)(&DAT_008f246c + iVar13) < 0) {

            fVar3 = fVar3 + _DAT_0079920c;

          }

          sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

          sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

          FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

          iVar10 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar10,"Recycled Dynamic Verts",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar10 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar10,"Indices Uploaded",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar10 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar10,"IB Memory Uploaded",0xffcccccc);

          fVar3 = (float)*(int *)(&DAT_008f2478 + iVar13);

          if (*(int *)(&DAT_008f2478 + iVar13) < 0) {

            fVar3 = fVar3 + _DAT_0079920c;

          }

          sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

          sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

          FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

          iVar13 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar13,"Particles Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar13 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar13,"Particle Systems",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar13 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar13,"Material Layers Applied",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar13 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar13,"D3D Texture Changes",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar13 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar13,"D3D Stream Changes",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

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

          FUN_005da750(6,piVar2);

          FUN_00699a30(0,*(undefined4 *)(param_1 + 100),"Texture Memory",0xffcccccc);

          fVar3 = (float)(int)(&DAT_008f2490)[iVar6 * 0x22];

          if ((int)(&DAT_008f2490)[iVar6 * 0x22] < 0) {

            fVar3 = fVar3 + _DAT_0079920c;

          }

          sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

          sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

          FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

          iVar13 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar13,"Surface Memory",0xffcccccc);

          fVar3 = (float)(int)(&DAT_008f2494)[iVar6 * 0x22];

          if ((int)(&DAT_008f2494)[iVar6 * 0x22] < 0) {

            fVar3 = fVar3 + _DAT_0079920c;

          }

          sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

          sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

          FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

          iVar13 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar13,"Vertex Buffer Memory",0xffcccccc);

          fVar3 = (float)(int)(&DAT_008f2498)[iVar6 * 0x22];

          if ((int)(&DAT_008f2498)[iVar6 * 0x22] < 0) {

            fVar3 = fVar3 + _DAT_0079920c;

          }

          sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

          sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

          FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

          iVar13 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar13,"Index Buffer Memory",0xffcccccc);

          fVar3 = (float)(int)(&DAT_008f249c)[iVar6 * 0x22];

          if ((int)(&DAT_008f249c)[iVar6 * 0x22] < 0) {

            fVar3 = fVar3 + _DAT_0079920c;

          }

          sprintf(&DAT_008f1b60,"%.02f",(double)(fVar3 * _DAT_0079cdec));

          sprintf(&DAT_008f1760,"%7s MB",&DAT_008f1b60);

          FUN_00699a30(0xac,*(undefined4 *)(param_1 + 100),&DAT_008f1760,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"Sounds Playing",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"Sounds Queued",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"UIElements Processed",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"AC1: Landscape Surfaces",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"AC1: Static Lights",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"AC1: Dynamic Lights",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"AC1: Frame Pushes",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"AC1: Poly Count",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"AC1: Landblocks Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"AC1: EnvCells Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"AC1: Objects Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"AC1: Portals Traversed",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

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

          uVar17 = CONCAT44(uVar9,&DAT_008f1b60);

          uVar16 = 0xb4;

          break;

        case 1:

          goto LAB_005db5ec;

        case 2:

          sprintf(&DAT_008f1b60,"[%s]");

          FUN_00699a30(0,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,0xff000000);

          iVar6 = *(int *)(param_1 + 100) + 0x10;

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

          FUN_00699a30(0,iVar6,"Triangles Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"Vertices Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"Batches Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

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

          uVar17 = CONCAT44(uVar9,&DAT_008f1b60);

          uVar16 = 0xb4;

          break;

        case 3:

          sprintf(&DAT_008f1b60,"[%s]");

          FUN_00699a30(0,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,0xff000000);

          iVar6 = *(int *)(param_1 + 100) + 0x10;

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

          FUN_00699a30(0,iVar6,"Triangles Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"Vertices Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"Batches Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

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

          uVar17 = CONCAT44(uVar9,&DAT_008f1b60);

          uVar16 = 0xb4;

          break;

        case 4:

LAB_005db5ec:

          sprintf(&DAT_008f1b60,"[%s]");

          FUN_00699a30(0,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,0xff000000);

          iVar6 = *(int *)(param_1 + 100) + 0x10;

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

          FUN_00699a30(0,iVar6,"Triangles Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"Vertices Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

          FUN_00699a30(0xb4,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,uVar9);

          iVar6 = *(int *)(param_1 + 100) + 0xc;

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

          FUN_00699a30(0,iVar6,"Batches Rendered",0xffcccccc);

          sprintf(&DAT_008f1b60,"%9i");

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

          uVar17 = CONCAT44(uVar9,&DAT_008f1b60);

          uVar16 = 0xb4;

          break;

        default:

          sprintf(&DAT_008f1760,"<Unknown/%i>");

          sprintf(&DAT_008f1b60,"[%s]",&DAT_008f1760);

          FUN_00699a30(0,*(undefined4 *)(param_1 + 100),&DAT_008f1b60,0xff000000);

          iVar6 = *(int *)(param_1 + 100) + 0x10;

          goto LAB_005dc6fe;

        }

LAB_005dc6f1:

        FUN_00699a30(uVar16,iVar6,uVar17);

        iVar6 = *(int *)(param_1 + 100) + 0xc;

LAB_005dc6fe:

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

LAB_005dc701:

        local_50 = local_50 + 1;

      } while (local_50 < *(uint *)(param_1 + 0x18));

    }

    (**(code **)(**(int **)(param_1 + 0x30) + 4))();

    (**(code **)(**(int **)(param_1 + 0x34) + 4))();

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

      uVar7 = 0;

      do {

        (**(code **)(**(int **)(*(int *)(param_1 + 0x3c) + uVar7 * 4) + 4))();

        uVar7 = uVar7 + 1;

      } while (uVar7 < *(uint *)(param_1 + 0x44));

    }

    (**(code **)(**(int **)(param_1 + 0x38) + 4))();

    uVar7 = 0;

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

      do {

        (**(code **)(**(int **)(*(int *)(param_1 + 0x48) + uVar7 * 4) + 4))();

        uVar7 = uVar7 + 1;

      } while (uVar7 < *(uint *)(param_1 + 0x50));

    }

    FUN_005a1390();

    FUN_005a4390();

  }

  return;

}





// --- FUN_005dc7b0 at 0x005DC7B0 (size: 210) ---


undefined4 __thiscall

FUN_005dc7b0(int param_1,int param_2,undefined4 param_3,undefined1 param_4,undefined4 param_5,

            undefined4 param_6,undefined4 param_7,undefined4 param_8,int *param_9)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int *piVar4;

  uint uVar5;

  undefined4 uVar6;

  

  piVar1 = param_9;

  *param_9 = 0;

  param_9 = (int *)0x0;

  piVar3 = (int *)FUN_00699bb0(&param_8,&param_9,param_5,param_6,param_7,param_8,6,4);

  if (*piVar3 < 0) {

    return 0;

  }

  FUN_006998a0(param_3);

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

  piVar3 = (int *)0x0;

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

    piVar4[3] = (int)param_9;

    *(undefined1 *)(piVar4 + 1) = param_4;

    *piVar4 = DAT_00824b20;

    piVar4[2] = param_2;

    *piVar1 = DAT_00824b20;

    DAT_00824b20 = DAT_00824b20 + 1;

    piVar3 = piVar4;

  }

  uVar5 = *(uint *)(param_1 + 0x14) & 0x7fffffff;

  if (uVar5 <= *(uint *)(param_1 + 0x18)) {

    uVar6 = FUN_00453850(uVar5 + 1);

    cVar2 = FUN_004180a0(uVar6);

    if (cVar2 == '\0') goto LAB_005dc86b;

  }

  *(int **)(*(int *)(param_1 + 0x10) + *(int *)(param_1 + 0x18) * 4) = piVar3;

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

LAB_005dc86b:

  FUN_005d9b90();

  return 1;

}





// --- FUN_005dc890 at 0x005DC890 (size: 1444) ---


void __fastcall FUN_005dc890(int param_1)



{

  undefined4 *puVar1;

  int iVar2;

  char cVar3;

  char *pcVar4;

  int *piVar5;

  LONG LVar6;

  uint uVar7;

  char *pcVar8;

  char *pcVar9;

  int iVar10;

  uint uVar11;

  uint uVar12;

  undefined4 uStack_3c;

  char *pcStack_38;

  char *pcStack_34;

  uint uStack_30;

  uint uStack_2c;

  undefined1 auStack_28 [4];

  undefined4 uStack_24;

  undefined4 uStack_20;

  undefined4 uStack_1c;

  undefined4 uStack_18;

  undefined *apuStack_14 [4];

  undefined *puStack_4;

  

  uVar11 = 0;

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

    do {

      puVar1 = *(undefined4 **)(*(int *)(param_1 + 0x3c) + uVar11 * 4);

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

        piVar5 = puVar1 + 1;

        *piVar5 = *piVar5 + -1;

        if (*piVar5 == 0) {

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

        }

        *(undefined4 *)(*(int *)(param_1 + 0x3c) + uVar11 * 4) = 0;

      }

      uVar11 = uVar11 + 1;

    } while (uVar11 < *(uint *)(param_1 + 0x44));

  }

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

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

  if ((*(uint *)(param_1 + 0x40) & 0x80000000) == 0x80000000) {

    operator_delete__((void *)*piVar5);

    *piVar5 = 0;

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

  }

  else if (*piVar5 != 0) {

    iVar10 = (*(uint *)(param_1 + 0x40) & 0x7fffffff) - 1;

    while (-1 < iVar10) {

      iVar10 = iVar10 + -1;

      *(undefined4 *)(*piVar5 + 4 + iVar10 * 4) = 0;

    }

  }

  uStack_30 = *(uint *)(*(int *)(param_1 + 0x30) + 0x40);

  pcStack_34 = (char *)0x0;

  iVar10 = 0;

  do {

    pcVar9 = (&PTR_s_Wireframe_00824a84)[(int)pcStack_34];

    uStack_3c = 0;

    if ((pcVar9 == (char *)0x0) || (*pcVar9 == '\0')) {

      pcStack_38 = PTR_DAT_00818344;

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

    }

    else {

      pcVar4 = pcVar9;

      do {

        cVar3 = *pcVar4;

        pcVar4 = pcVar4 + 1;

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

      FUN_00401280((int)pcVar4 - (int)(pcVar9 + 1));

      pcVar4 = pcStack_38;

      do {

        cVar3 = *pcVar9;

        pcVar9 = pcVar9 + 1;

        *pcVar4 = cVar3;

        pcVar4 = pcVar4 + 1;

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

    }

    piVar5 = (int *)FUN_0069a100(auStack_28,&uStack_3c,

                                 *(undefined4 *)(*(int *)(param_1 + 0x30) + 0x38),

                                 *(int *)(*(int *)(param_1 + 0x30) + 0x3c) + iVar10,uStack_30,0x14,4

                                 ,2,&pcStack_38);

    iVar2 = *piVar5;

    pcVar9 = pcStack_38 + -0x14;

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

    if ((LVar6 == 0) && (pcVar9 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar9)(1);

    }

    if (-1 < iVar2) {

      FUN_0050a150(pcStack_34 + 0x14);

      uStack_24 = 0x3f008081;

      uStack_20 = 0x3f0a8a8b;

      uStack_1c = 0x3ee6e6e7;

      uStack_18 = 0x3f333333;

      FUN_006998a0(&uStack_24);

      uVar11 = *(uint *)(param_1 + 0x40) & 0x7fffffff;

      if (uVar11 <= *(uint *)(param_1 + 0x44)) {

        uVar11 = uVar11 + 1;

        if (uVar11 < 9) {

          uVar11 = 8;

        }

        else if (uVar11 < 0x4001) {

          iVar2 = 0x1f;

          if (uVar11 != 0) {

            for (; uVar11 >> iVar2 == 0; iVar2 = iVar2 + -1) {

            }

          }

          uVar7 = 1 << ((byte)iVar2 & 0x1f);

          uStack_2c = uVar11;

          if (uVar7 < uVar11) {

            uVar11 = uVar7 * 2;

          }

        }

        else if ((uVar11 & 0x3fff) != 0) {

          uVar11 = uVar11 + (0x4000 - (uVar11 & 0x3fff));

        }

        cVar3 = FUN_004180a0(uVar11);

        if (cVar3 == '\0') goto LAB_005dcaab;

      }

      *(undefined4 *)(*(int *)(param_1 + 0x3c) + *(int *)(param_1 + 0x44) * 4) = uStack_3c;

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

    }

LAB_005dcaab:

    pcStack_34 = pcStack_34 + 1;

    iVar10 = iVar10 + 0x14;

  } while (pcStack_34 < (char *)0x3);

  uVar11 = 0;

  apuStack_14[0] = &DAT_007ea4d4;

  apuStack_14[1] = &DAT_007ea4d0;

  apuStack_14[2] = &DAT_007cd110;

  apuStack_14[3] = &DAT_007ea4cc;

  puStack_4 = &DAT_007ea4c8;

  pcStack_34 = (char *)0x0;

  do {

    pcVar9 = apuStack_14[(int)pcStack_34];

    uStack_3c = 0;

    if ((pcVar9 == (char *)0x0) || (*pcVar9 == '\0')) {

      pcStack_38 = PTR_DAT_00818344;

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

    }

    else {

      pcVar4 = pcVar9;

      do {

        cVar3 = *pcVar4;

        pcVar4 = pcVar4 + 1;

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

      FUN_00401280((int)pcVar4 - (int)(pcVar9 + 1));

      pcVar4 = pcStack_38;

      do {

        cVar3 = *pcVar9;

        pcVar9 = pcVar9 + 1;

        *pcVar4 = cVar3;

        pcVar4 = pcVar4 + 1;

      } while (cVar3 != '\0');

    }

    piVar5 = (int *)FUN_0069a100(auStack_28,&uStack_3c,

                                 *(int *)(*(int *)(param_1 + 0x30) + 0x38) + uVar11,

                                 *(int *)(*(int *)(param_1 + 0x30) + 0x3c) + 0x8e,0x1b,0x14,4,2,

                                 &pcStack_38);

    iVar10 = *piVar5;

    pcVar9 = pcStack_38 + -0x14;

    LVar6 = InterlockedDecrement((LONG *)(pcStack_38 + -0x10));

    if ((LVar6 == 0) && (pcVar9 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar9)(1);

    }

    if (-1 < iVar10) {

      FUN_0050a150(pcStack_34 + 10);

      uStack_24 = 0x3f008081;

      uStack_20 = 0x3f0a8a8b;

      uStack_1c = 0x3ee6e6e7;

      uStack_18 = 0x3f333333;

      FUN_006998a0(&uStack_24);

      uVar7 = *(uint *)(param_1 + 0x40) & 0x7fffffff;

      if (uVar7 <= *(uint *)(param_1 + 0x44)) {

        uVar7 = uVar7 + 1;

        if (uVar7 < 9) {

          uVar7 = 8;

        }

        else if (uVar7 < 0x4001) {

          iVar10 = 0x1f;

          if (uVar7 != 0) {

            for (; uVar7 >> iVar10 == 0; iVar10 = iVar10 + -1) {

            }

          }

          uVar12 = 1 << ((byte)iVar10 & 0x1f);

          uStack_2c = uVar7;

          if (uVar12 < uVar7) {

            uVar7 = uVar12 * 2;

          }

        }

        else if ((uVar7 & 0x3fff) != 0) {

          uVar7 = uVar7 + (0x4000 - (uVar7 & 0x3fff));

        }

        cVar3 = FUN_004180a0(uVar7);

        if (cVar3 == '\0') goto LAB_005dcc6e;

      }

      *(undefined4 *)(*(int *)(param_1 + 0x3c) + *(int *)(param_1 + 0x44) * 4) = uStack_3c;

      *(int *)(param_1 + 0x44) = *(int *)(param_1 + 0x44) + 1;

    }

LAB_005dcc6e:

    pcStack_34 = pcStack_34 + 1;

    uVar11 = uVar11 + 0x1b;

  } while (uVar11 < 0x87);

  uStack_2c = *(undefined4 *)(*(int *)(param_1 + 0x34) + 0x40);

  pcStack_38 = (char *)0x0;

  iVar10 = 0;

  do {

    pcVar4 = pcStack_38;

    pcVar9 = (&PTR_s_Memory_Counters_00824a90)[(int)pcStack_38];

    uStack_3c = 0;

    if ((pcVar9 == (char *)0x0) || (*pcVar9 == '\0')) {

      pcStack_34 = PTR_DAT_00818344;

      InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

    }

    else {

      pcVar8 = pcVar9;

      do {

        cVar3 = *pcVar8;

        pcVar8 = pcVar8 + 1;

      } while (cVar3 != '\0');

      FUN_00401280((int)pcVar8 - (int)(pcVar9 + 1));

      pcVar8 = pcStack_34;

      do {

        cVar3 = *pcVar9;

        pcVar9 = pcVar9 + 1;

        *pcVar8 = cVar3;

        pcVar8 = pcVar8 + 1;

      } while (cVar3 != '\0');

    }

    piVar5 = (int *)FUN_0069a100(auStack_28,&uStack_3c,

                                 *(undefined4 *)(*(int *)(param_1 + 0x34) + 0x38),

                                 *(int *)(*(int *)(param_1 + 0x34) + 0x3c) + iVar10,uStack_2c,0x14,4

                                 ,2,&pcStack_34);

    iVar2 = *piVar5;

    pcVar9 = pcStack_34 + -0x14;

    LVar6 = InterlockedDecrement((LONG *)(pcStack_34 + -0x10));

    if ((LVar6 == 0) && (pcVar9 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar9)(1);

    }

    if (-1 < iVar2) {

      FUN_0050a150(pcVar4 + 0x1e);

      uStack_24 = 0x3f008081;

      uStack_20 = 0x3f0a8a8b;

      uStack_1c = 0x3ee6e6e7;

      uStack_18 = 0x3f333333;

      FUN_006998a0(&uStack_24);

      uVar11 = *(uint *)(param_1 + 0x40) & 0x7fffffff;

      if (uVar11 <= *(uint *)(param_1 + 0x44)) {

        uVar11 = uVar11 + 1;

        if (uVar11 < 9) {

          uVar11 = 8;

        }

        else if (uVar11 < 0x4001) {

          iVar2 = 0x1f;

          if (uVar11 != 0) {

            for (; uVar11 >> iVar2 == 0; iVar2 = iVar2 + -1) {

            }

          }

          uVar7 = 1 << ((byte)iVar2 & 0x1f);

          uStack_30 = uVar11;

          if (uVar7 < uVar11) {

            uVar11 = uVar7 * 2;

          }

        }

        else if ((uVar11 & 0x3fff) != 0) {

          uVar11 = uVar11 + (0x4000 - (uVar11 & 0x3fff));

        }

        cVar3 = FUN_004180a0(uVar11);

        pcVar4 = pcStack_38;

        if (cVar3 == '\0') goto LAB_005dce1b;

      }

      *(undefined4 *)(*(int *)(param_1 + 0x3c) + *(int *)(param_1 + 0x44) * 4) = uStack_3c;

      *(int *)(param_1 + 0x44) = *(int *)(param_1 + 0x44) + 1;

      pcVar4 = pcStack_38;

    }

LAB_005dce1b:

    pcStack_38 = pcVar4 + 1;

    iVar10 = iVar10 + 0x14;

    if ((char *)0x3 < pcStack_38) {

      return;

    }

  } while( true );

}





// --- FUN_005dce40 at 0x005DCE40 (size: 601) ---


void __fastcall FUN_005dce40(int param_1)



{

  undefined4 *puVar1;

  int iVar2;

  char cVar3;

  char *pcVar4;

  int *piVar5;

  LONG LVar6;

  uint uVar7;

  char *pcVar8;

  int iVar9;

  uint uVar10;

  undefined4 uStack_28;

  char *pcStack_24;

  uint uStack_20;

  int iStack_1c;

  uint uStack_18;

  undefined1 auStack_14 [4];

  undefined4 uStack_10;

  undefined4 uStack_c;

  undefined4 uStack_8;

  undefined4 uStack_4;

  

  uVar10 = 0;

  if (*(int *)(param_1 + 0x50) != 0) {

    do {

      puVar1 = *(undefined4 **)(*(int *)(param_1 + 0x48) + uVar10 * 4);

      if (puVar1 != (undefined4 *)0x0) {

        piVar5 = puVar1 + 1;

        *piVar5 = *piVar5 + -1;

        if (*piVar5 == 0) {

          (**(code **)*puVar1)(1);

        }

        *(undefined4 *)(*(int *)(param_1 + 0x48) + uVar10 * 4) = 0;

      }

      uVar10 = uVar10 + 1;

    } while (uVar10 < *(uint *)(param_1 + 0x50));

  }

  piVar5 = (int *)(param_1 + 0x48);

  *(undefined4 *)(param_1 + 0x50) = 0;

  if ((*(uint *)(param_1 + 0x4c) & 0x80000000) == 0x80000000) {

    operator_delete__((void *)*piVar5);

    *piVar5 = 0;

    *(undefined4 *)(param_1 + 0x4c) = 0;

    uStack_20 = 0;

    iVar9 = 0;

  }

  else {

    if (*piVar5 != 0) {

      iVar9 = (*(uint *)(param_1 + 0x4c) & 0x7fffffff) - 1;

      while (-1 < iVar9) {

        iVar9 = iVar9 + -1;

        *(undefined4 *)(*piVar5 + 4 + iVar9 * 4) = 0;

      }

    }

    uStack_20 = 0;

    iVar9 = 0;

  }

  do {

    uVar10 = uStack_20;

    pcVar8 = (&PTR_s_Frame_Stats_00824a70)[uStack_20];

    uStack_28 = 0;

    if ((pcVar8 == (char *)0x0) || (*pcVar8 == '\0')) {

      pcStack_24 = PTR_DAT_00818344;

      InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

    }

    else {

      pcVar4 = pcVar8;

      do {

        cVar3 = *pcVar4;

        pcVar4 = pcVar4 + 1;

      } while (cVar3 != '\0');

      FUN_00401280((int)pcVar4 - (int)(pcVar8 + 1));

      pcVar4 = pcStack_24;

      do {

        cVar3 = *pcVar8;

        pcVar8 = pcVar8 + 1;

        *pcVar4 = cVar3;

        pcVar4 = pcVar4 + 1;

      } while (cVar3 != '\0');

    }

    iVar2 = *(int *)(param_1 + 0x38);

    piVar5 = (int *)FUN_0069a100(auStack_14,&uStack_28,*(undefined4 *)(iVar2 + 0x38),

                                 *(int *)(iVar2 + 0x3c) + iVar9,*(undefined4 *)(iVar2 + 0x40),0x14,4

                                 ,2,&pcStack_24);

    iVar2 = *piVar5;

    pcVar8 = pcStack_24 + -0x14;

    LVar6 = InterlockedDecrement((LONG *)(pcStack_24 + -0x10));

    if ((LVar6 == 0) && (pcVar8 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar8)(1);

    }

    if (-1 < iVar2) {

      uStack_10 = 0x3f008081;

      uStack_c = 0x3f0a8a8b;

      uStack_8 = 0x3ee6e6e7;

      uStack_4 = 0x3f333333;

      FUN_006998a0(&uStack_10);

      uVar7 = 0;

      if (*(uint *)(param_1 + 0x18) != 0) {

        piVar5 = *(int **)(param_1 + 0x10);

        do {

          if (*(uint *)(*piVar5 + 8) == uVar10) {

            iStack_1c = CONCAT31(iStack_1c._1_3_,1);

            goto LAB_005dcff4;

          }

          uVar7 = uVar7 + 1;

          piVar5 = piVar5 + 1;

        } while (uVar7 < *(uint *)(param_1 + 0x18));

      }

      iStack_1c = (uint)iStack_1c._1_3_ << 8;

LAB_005dcff4:

      FUN_00699cd0(iStack_1c);

      uVar10 = *(uint *)(param_1 + 0x4c) & 0x7fffffff;

      if (uVar10 <= *(uint *)(param_1 + 0x50)) {

        uVar10 = uVar10 + 1;

        if (uVar10 < 9) {

          uVar10 = 8;

        }

        else if (uVar10 < 0x4001) {

          iVar2 = 0x1f;

          if (uVar10 != 0) {

            for (; uVar10 >> iVar2 == 0; iVar2 = iVar2 + -1) {

            }

          }

          uVar7 = 1 << ((byte)iVar2 & 0x1f);

          uStack_18 = uVar10;

          if (uVar7 < uVar10) {

            uVar10 = uVar7 * 2;

          }

        }

        else if ((uVar10 & 0x3fff) != 0) {

          uVar10 = uVar10 + (0x4000 - (uVar10 & 0x3fff));

        }

        cVar3 = FUN_004180a0(uVar10);

        uVar10 = uStack_20;

        if (cVar3 == '\0') goto LAB_005dd087;

      }

      *(undefined4 *)(*(int *)(param_1 + 0x48) + *(int *)(param_1 + 0x50) * 4) = uStack_28;

      *(int *)(param_1 + 0x50) = *(int *)(param_1 + 0x50) + 1;

      uVar10 = uStack_20;

    }

LAB_005dd087:

    uStack_20 = uVar10 + 1;

    iVar9 = iVar9 + 0x14;

    if (4 < uStack_20) {

      return;

    }

  } while( true );

}





// --- FUN_005dd0a0 at 0x005DD0A0 (size: 220) ---


void __fastcall FUN_005dd0a0(int *param_1)



{

  int iVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int iVar4;

  uint local_28;

  int local_24 [6];

  undefined1 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      local_28 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(local_28 - 1)) {

        iVar4 = (local_28 - 1) * 0x24;

        do {

          FUN_00401340(&DAT_007938af);

          iVar1 = *param_1;

          local_24[1] = 0;

          local_24[2] = 0;

          local_24[3] = 0;

          local_24[4] = 0;

          local_c = 0;

          local_24[5] = 0;

          FUN_005da080(local_24);

          *(undefined4 *)(iVar1 + iVar4 + 0x1c) = local_8;

          *(undefined4 *)(iVar1 + iVar4 + 0x20) = local_4;

          puVar3 = (undefined4 *)(local_24[0] + -0x14);

          LVar2 = InterlockedDecrement((LONG *)(local_24[0] + -0x10));

          if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

            (**(code **)*puVar3)(1);

          }

          iVar4 = iVar4 + -0x24;

          local_28 = local_28 - 1;

        } while (local_28 != 0);

      }

    }

    return;

  }

  if (*param_1 != 0) {

    FUN_005d9eb0(3);

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_005dd180 at 0x005DD180 (size: 134) ---


undefined4 __thiscall FUN_005dd180(int *param_1,undefined4 param_2,uint param_3)



{

  int iVar1;

  char cVar2;

  undefined4 uVar3;

  uint uVar4;

  

  if ((uint)param_1[2] < param_3) {

    return 0;

  }

  if ((param_1[1] & 0x7fffffffU) <= (uint)param_1[2]) {

    uVar3 = FUN_00453850((param_1[1] & 0x7fffffffU) + 1);

    cVar2 = FUN_005da3c0(uVar3);

    if (cVar2 == '\0') {

      return 0;

    }

  }

  if (param_1[2] != 0) {

    iVar1 = *param_1;

    for (uVar4 = param_1[2] * 0x20 + -0x20 + iVar1; param_3 * 0x20 + iVar1 <= uVar4;

        uVar4 = uVar4 - 0x20) {

      FUN_005da010(uVar4);

    }

  }

  FUN_005da010(param_2);

  param_1[2] = param_1[2] + 1;

  return 1;

}





// --- FUN_005dd210 at 0x005DD210 (size: 261) ---


undefined4 __thiscall FUN_005dd210(int *param_1,uint param_2)



{

  uint *puVar1;

  uint *puVar2;

  int iVar3;

  int local_8;

  

  if ((uint)param_1[2] <= param_2) {

    if (param_2 <= (param_1[1] & 0x7fffffffU)) {

      return 1;

    }

    if (param_2 == 0) {

      FUN_005dd0a0();

      return 1;

    }

    puVar2 = (uint *)thunk_FUN_005df0f5(param_2 * 0x24 + 4);

    if (puVar2 != (uint *)0x0) {

      puVar1 = puVar2 + 1;

      *puVar2 = param_2;

      FUN_00401000(puVar1,0x24,param_2,&LAB_005da870);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          local_8 = param_1[2];

          if (-1 < local_8 + -1) {

            puVar2 = puVar2 + (local_8 + -1) * 9 + 9;

            do {

              iVar3 = (int)puVar2 + *param_1 + (-0x20 - (int)puVar1);

              FUN_005da080(iVar3);

              puVar2[-1] = *(uint *)(iVar3 + 0x1c);

              *puVar2 = *(uint *)(iVar3 + 0x20);

              puVar2 = puVar2 + -9;

              local_8 = local_8 + -1;

            } while (local_8 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

            FUN_005d9eb0(3);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = param_2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005dd320 at 0x005DD320 (size: 156) ---


undefined4 * __fastcall FUN_005dd320(undefined4 *param_1)



{

  param_1[1] = 1;

  param_1[2] = &PTR_FUN_00795824;

  *param_1 = &PTR_FUN_007ea4e4;

  param_1[2] = &PTR_LAB_007ea4d8;

  *(undefined1 *)(param_1 + 3) = 0;

  *(undefined1 *)((int)param_1 + 0xd) = 0;

  *(undefined1 *)((int)param_1 + 0xe) = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  FUN_005dd0a0();

  FUN_005d9a60();

  return param_1;

}





// --- FUN_005dd3d0 at 0x005DD3D0 (size: 815) ---


void __fastcall FUN_005dd3d0(undefined4 *param_1)



{

  int *piVar1;

  void *pvVar2;

  int iVar3;

  LONG LVar4;

  uint uVar5;

  int iVar6;

  undefined4 *puVar7;

  int iStack_8;

  

  uVar5 = 0;

  *param_1 = &PTR_FUN_007ea4e4;

  param_1[2] = &PTR_LAB_007ea4d8;

  *(undefined1 *)(param_1 + 3) = 0;

  if (param_1[6] != 0) {

    do {

      pvVar2 = *(void **)(param_1[4] + uVar5 * 4);

      if (pvVar2 != (void *)0x0) {

        puVar7 = *(undefined4 **)((int)pvVar2 + 0xc);

        if (puVar7 != (undefined4 *)0x0) {

          piVar1 = puVar7 + 1;

          *piVar1 = *piVar1 + -1;

          if (*piVar1 == 0) {

            (**(code **)*puVar7)(1);

          }

          *(undefined4 *)((int)pvVar2 + 0xc) = 0;

        }

        operator_delete(pvVar2);

      }

      *(undefined4 *)(param_1[4] + uVar5 * 4) = 0;

      uVar5 = uVar5 + 1;

    } while (uVar5 < (uint)param_1[6]);

  }

  param_1[6] = 0;

  if ((param_1[5] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[4]);

    param_1[4] = 0;

    param_1[5] = 0;

  }

  else if (param_1[4] != 0) {

    iVar3 = (param_1[5] & 0x7fffffff) - 1;

    while (-1 < iVar3) {

      iVar3 = iVar3 + -1;

      *(undefined4 *)(param_1[4] + 4 + iVar3 * 4) = 0;

    }

  }

  uVar5 = 0;

  if (param_1[0x11] != 0) {

    do {

      puVar7 = *(undefined4 **)(param_1[0xf] + uVar5 * 4);

      if (puVar7 != (undefined4 *)0x0) {

        piVar1 = puVar7 + 1;

        *piVar1 = *piVar1 + -1;

        if (*piVar1 == 0) {

          (**(code **)*puVar7)(1);

        }

        *(undefined4 *)(param_1[0xf] + uVar5 * 4) = 0;

      }

      uVar5 = uVar5 + 1;

    } while (uVar5 < (uint)param_1[0x11]);

  }

  param_1[0x11] = 0;

  if ((param_1[0x10] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[0xf]);

    param_1[0xf] = 0;

    param_1[0x10] = 0;

  }

  else if (param_1[0xf] != 0) {

    iVar3 = (param_1[0x10] & 0x7fffffff) - 1;

    while (-1 < iVar3) {

      iVar3 = iVar3 + -1;

      *(undefined4 *)(param_1[0xf] + 4 + iVar3 * 4) = 0;

    }

  }

  puVar7 = (undefined4 *)param_1[0xc];

  if (puVar7 != (undefined4 *)0x0) {

    piVar1 = puVar7 + 1;

    *piVar1 = *piVar1 + -1;

    if (*piVar1 == 0) {

      (**(code **)*puVar7)(1);

    }

    param_1[0xc] = 0;

  }

  puVar7 = (undefined4 *)param_1[0xd];

  if (puVar7 != (undefined4 *)0x0) {

    piVar1 = puVar7 + 1;

    *piVar1 = *piVar1 + -1;

    if (*piVar1 == 0) {

      (**(code **)*puVar7)(1);

    }

    param_1[0xd] = 0;

  }

  uVar5 = 0;

  if (param_1[0x14] != 0) {

    do {

      puVar7 = *(undefined4 **)(param_1[0x12] + uVar5 * 4);

      if (puVar7 != (undefined4 *)0x0) {

        piVar1 = puVar7 + 1;

        *piVar1 = *piVar1 + -1;

        if (*piVar1 == 0) {

          (**(code **)*puVar7)(1);

        }

        *(undefined4 *)(param_1[0x12] + uVar5 * 4) = 0;

      }

      uVar5 = uVar5 + 1;

    } while (uVar5 < (uint)param_1[0x14]);

  }

  param_1[0x14] = 0;

  if ((param_1[0x13] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[0x12]);

    param_1[0x12] = 0;

    param_1[0x13] = 0;

  }

  else if (param_1[0x12] != 0) {

    iVar3 = (param_1[0x13] & 0x7fffffff) - 1;

    while (-1 < iVar3) {

      iVar3 = iVar3 + -1;

      *(undefined4 *)(param_1[0x12] + 4 + iVar3 * 4) = 0;

    }

  }

  puVar7 = (undefined4 *)param_1[0xe];

  if (puVar7 != (undefined4 *)0x0) {

    piVar1 = puVar7 + 1;

    *piVar1 = *piVar1 + -1;

    if (*piVar1 == 0) {

      (**(code **)*puVar7)(1);

    }

    param_1[0xe] = 0;

  }

  FUN_005dd0a0();

  FUN_005da300();

  operator_delete((void *)param_1[0x21]);

  param_1[0x21] = 0;

  if (((param_1[0x1f] & 0x80000000) == 0x80000000) && (iVar3 = param_1[0x1e], iVar3 != 0)) {

    iStack_8 = *(int *)(iVar3 + -4);

    if (-1 < iStack_8 + -1) {

      iVar6 = iStack_8 * 0x20 + iVar3 + 4;

      do {

        piVar1 = (int *)(iVar6 + -0x20);

        iVar6 = iVar6 + -0x20;

        puVar7 = (undefined4 *)(*piVar1 + -0x14);

        LVar4 = InterlockedDecrement((LONG *)(*piVar1 + -0x10));

        if ((LVar4 == 0) && (puVar7 != (undefined4 *)0x0)) {

          (**(code **)*puVar7)(1);

        }

        iStack_8 = iStack_8 + -1;

      } while (iStack_8 != 0);

    }

    operator_delete__((void *)(iVar3 + -4));

  }

  if (((param_1[0x17] & 0x80000000) == 0x80000000) && (iVar3 = param_1[0x16], iVar3 != 0)) {

    iStack_8 = *(int *)(iVar3 + -4);

    iVar6 = iVar3 + iStack_8 * 0x24;

    if (-1 < iStack_8 + -1) {

      do {

        piVar1 = (int *)(iVar6 + -0x24);

        iVar6 = iVar6 + -0x24;

        puVar7 = (undefined4 *)(*piVar1 + -0x14);

        LVar4 = InterlockedDecrement((LONG *)(*piVar1 + -0x10));

        if ((LVar4 == 0) && (puVar7 != (undefined4 *)0x0)) {

          (**(code **)*puVar7)(1);

        }

        iStack_8 = iStack_8 + -1;

      } while (iStack_8 != 0);

    }

    operator_delete__((void *)(iVar3 + -4));

  }

  if ((param_1[0x13] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[0x12]);

  }

  if ((param_1[0x10] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[0xf]);

  }

  if ((param_1[5] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[4]);

  }

  param_1[2] = &PTR_FUN_00795824;

  if (DAT_00837ff4 != (int *)0x0) {

    (**(code **)(*DAT_00837ff4 + 0x3c))(param_1 + 2);

  }

  *param_1 = &PTR_LAB_00796c4c;

  return;

}





// --- FUN_005dd700 at 0x005DD700 (size: 204) ---


undefined4 __fastcall FUN_005dd700(int param_1)



{

  int *piVar1;

  undefined1 local_14 [4];

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  piVar1 = (int *)FUN_00699bb0(local_14,param_1 + 0x30,8,0x18,0x9a,0xaa,6,4);

  if (-1 < *piVar1) {

    local_10 = 0x3ec2c2c3;

    local_c = 0x3ed2d2d3;

    local_8 = 0x3eb0b0b1;

    local_4 = 0x3f333333;

    FUN_006998a0(&local_10);

    piVar1 = (int *)FUN_00699bb0(local_14,param_1 + 0x34,8,0xe0,0x9a,0x5c,6,4);

    if (-1 < *piVar1) {

      local_10 = 0x3ec2c2c3;

      local_c = 0x3ed2d2d3;

      local_8 = 0x3eb0b0b1;

      local_4 = 0x3f333333;

      FUN_006998a0(&local_10);

      FUN_005dc890();

      return 1;

    }

  }

  return 0;

}





// --- FUN_005dd7d0 at 0x005DD7D0 (size: 118) ---


undefined4 __fastcall FUN_005dd7d0(int param_1)



{

  int *piVar1;

  undefined1 local_14 [4];

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  piVar1 = (int *)FUN_00699bb0(local_14,param_1 + 0x38,8,0x15e,0x9a,0x96,6,4);

  if (-1 < *piVar1) {

    local_10 = 0x3ec2c2c3;

    local_c = 0x3ed2d2d3;

    local_8 = 0x3eb0b0b1;

    local_4 = 0x3f333333;

    FUN_006998a0(&local_10);

    FUN_005dce40();

    return 1;

  }

  return 0;

}





// --- FUN_005dd850 at 0x005DD850 (size: 146) ---


void __thiscall FUN_005dd850(int param_1,int param_2)



{

  uint uVar1;

  undefined4 uVar2;

  int *piVar3;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  uVar1 = 0;

  if (*(uint *)(param_1 + 0x18) != 0) {

    piVar3 = *(int **)(param_1 + 0x10);

    do {

      if (*(int *)(*piVar3 + 8) == param_2) {

        return;

      }

      uVar1 = uVar1 + 1;

      piVar3 = piVar3 + 1;

    } while (uVar1 < *(uint *)(param_1 + 0x18));

  }

  local_4 = 0x3f333333;

  if (param_2 == 0) {

    local_10 = 0x3ed2d2d3;

    local_c = 0x3eb0b0b1;

    local_8 = 0x3ebcbcbd;

    uVar2 = 0x1cc;

  }

  else {

    local_10 = 0x3eaaaaab;

    local_c = 0x3ec2c2c3;

    local_8 = 0x3ed8d8d9;

    uVar2 = 0xa0;

  }

  FUN_005dc7b0(param_2,&local_10,1,0,0,0x10e,uVar2,&param_2);

  return;

}





// --- FUN_005dd8f0 at 0x005DD8F0 (size: 123) ---


void __thiscall FUN_005dd8f0(int param_1,char param_2)



{

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if (param_2 == '\0') {

    if (*(int *)(param_1 + 0x1c) != 0) {

      FUN_005da250(*(int *)(param_1 + 0x1c));

      *(undefined4 *)(param_1 + 0x1c) = 0;

    }

  }

  else if (*(int *)(param_1 + 0x1c) == 0) {

    local_10 = 0x3edcdcdd;

    local_c = 0x3edcdcdd;

    local_8 = 0x3edcdcdd;

    local_4 = 0x3f333333;

    FUN_005dc7b0(6,&local_10,1,0,0,0x10e,0x168,param_1 + 0x1c);

    return;

  }

  return;

}





// --- FUN_005dd970 at 0x005DD970 (size: 120) ---


void __thiscall FUN_005dd970(int param_1,char param_2)



{

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if (param_2 == '\0') {

    if (*(int *)(param_1 + 0x20) != 0) {

      FUN_005da250(*(int *)(param_1 + 0x20));

      *(undefined4 *)(param_1 + 0x20) = 0;

    }

  }

  else if (*(int *)(param_1 + 0x20) == 0) {

    local_10 = 0x3ef0f0f1;

    local_c = 0x3ef0f0f1;

    local_8 = 0x3e20a0a1;

    local_4 = 0x3f333333;

    FUN_005dc7b0(6,&local_10,1,0,0,0x10e,0x78,param_1 + 0x20);

    return;

  }

  return;

}





// --- FUN_005dd9f0 at 0x005DD9F0 (size: 123) ---


void __thiscall FUN_005dd9f0(int param_1,char param_2)



{

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if (param_2 == '\0') {

    if (*(int *)(param_1 + 0x24) != 0) {

      FUN_005da250(*(int *)(param_1 + 0x24));

      *(undefined4 *)(param_1 + 0x24) = 0;

    }

  }

  else if (*(int *)(param_1 + 0x24) == 0) {

    local_10 = 0x3e70f0f1;

    local_c = 0x3ef0f0f1;

    local_8 = 0x3e70f0f1;

    local_4 = 0x3f333333;

    FUN_005dc7b0(6,&local_10,1,0,0,0x10e,0x1b8,param_1 + 0x24);

    return;

  }

  return;

}





// --- FUN_005dda70 at 0x005DDA70 (size: 123) ---


void __thiscall FUN_005dda70(int param_1,char param_2)



{

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if (param_2 == '\0') {

    if (*(int *)(param_1 + 0x2c) != 0) {

      FUN_005da250(*(int *)(param_1 + 0x2c));

      *(undefined4 *)(param_1 + 0x2c) = 0;

    }

  }

  else if (*(int *)(param_1 + 0x2c) == 0) {

    local_10 = 0x3e20a0a1;

    local_c = 0x3e20a0a1;

    local_8 = 0x3edcdcdd;

    local_4 = 0x3f333333;

    FUN_005dc7b0(6,&local_10,1,0,0,0x10e,700,param_1 + 0x2c);

    return;

  }

  return;

}





// --- FUN_005dde50 at 0x005DDE50 (size: 438) ---


void __fastcall FUN_005dde50(int param_1)



{

  char cVar1;

  int *piVar2;

  undefined4 uVar3;

  LONG LVar4;

  int iVar5;

  uint uVar6;

  int iVar7;

  char *pcVar8;

  char *local_54;

  int local_50;

  int *local_4c;

  undefined1 local_48 [16];

  undefined1 local_38 [16];

  undefined4 local_28;

  char *local_24;

  undefined4 local_20;

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_c;

  

  local_50 = param_1;

  FUN_005da300();

  piVar2 = (int *)FUN_00415730(2,1,0x24);

  if (piVar2 != (int *)0x0) {

    local_4c = piVar2;

    FUN_0041ad00(local_48);

    FUN_0041ac30(local_38);

    cVar1 = FUN_0041ab00(local_38);

    while (cVar1 != '\0') {

      uVar3 = FUN_0041ab50();

      FUN_0041ab60(&local_54);

      pcVar8 = PTR_DAT_00818344;

      local_24 = PTR_DAT_00818344;

      InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

      local_28 = uVar3;

      if (pcVar8 != local_54) {

        LVar4 = InterlockedDecrement((LONG *)(pcVar8 + -0x10));

        if ((LVar4 == 0) && (pcVar8 + -0x14 != (char *)0x0)) {

          (*(code *)**(undefined4 **)(pcVar8 + -0x14))(1);

        }

        pcVar8 = local_54;

        local_24 = local_54;

        InterlockedIncrement((LONG *)(local_54 + -0x10));

      }

      uVar6 = 0;

      local_20 = 0;

      local_1c = 0;

      local_18 = 0;

      local_14 = 0xc0c38780;

      local_10 = 0;

      local_c = 0xc0c38780;

      if (*(int *)(local_50 + 0x80) != 0) {

        iVar7 = 0;

        do {

          iVar5 = _stricmp(*(char **)(iVar7 + 4 + *(int *)(param_1 + 0x78)),pcVar8);

          if (-1 < iVar5) break;

          uVar6 = uVar6 + 1;

          iVar7 = iVar7 + 0x20;

        } while (uVar6 < *(uint *)(local_50 + 0x80));

      }

      FUN_005dd180(&local_28,uVar6);

      pcVar8 = local_24 + -0x14;

      LVar4 = InterlockedDecrement((LONG *)(local_24 + -0x10));

      if ((LVar4 == 0) && (pcVar8 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar8)(1);

      }

      pcVar8 = local_54 + -0x14;

      LVar4 = InterlockedDecrement((LONG *)(local_54 + -0x10));

      if ((LVar4 == 0) && (pcVar8 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar8)(1);

      }

      FUN_0041ad50();

      cVar1 = FUN_0041ab00(local_38);

      piVar2 = local_4c;

    }

    FUN_00695670();

    FUN_00695670();

    (**(code **)(*piVar2 + 0x14))();

  }

  return;

}





// --- FUN_005de010 at 0x005DE010 (size: 30) ---


void * __thiscall FUN_005de010(void *param_1,byte param_2)



{

  FUN_005dd3d0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005de0b0 at 0x005DE0B0 (size: 516) ---


void __thiscall FUN_005de0b0(int param_1,int *param_2)



{

  int *piVar1;

  char cVar2;

  int iVar3;

  char cVar4;

  LONG LVar5;

  uint uVar6;

  uint uVar7;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  int local_10;

  

  FUN_00401340(&DAT_007938af);

  cVar2 = (char)param_2[6];

  if (local_24 != *param_2) {

    LVar5 = InterlockedDecrement((LONG *)(local_24 + -0x10));

    if ((LVar5 == 0) && ((undefined4 *)(local_24 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(local_24 + -0x14))(1);

    }

    local_24 = *param_2;

    InterlockedIncrement((LONG *)(local_24 + -0x10));

  }

  local_20 = param_2[1];

  if (cVar2 != '\0') {

    local_20 = local_20 << 0x14;

  }

  local_1c = param_2[2];

  if (cVar2 != '\0') {

    local_1c = local_1c << 0x14;

  }

  local_18 = param_2[3];

  if (cVar2 != '\0') {

    local_18 = local_18 << 0x14;

  }

  local_14 = param_2[4];

  if (cVar2 != '\0') {

    local_14 = local_14 << 0x14;

  }

  local_10 = param_2[5];

  if (cVar2 != '\0') {

    local_10 = local_10 << 0x14;

  }

  uVar6 = *(uint *)(param_1 + 0x5c) & 0x7fffffff;

  if (uVar6 <= *(uint *)(param_1 + 0x60)) {

    uVar6 = uVar6 + 1;

    if (uVar6 < 9) {

      uVar6 = 8;

    }

    else if (uVar6 < 0x4001) {

      iVar3 = 0x1f;

      if (uVar6 != 0) {

        for (; uVar6 >> iVar3 == 0; iVar3 = iVar3 + -1) {

        }

      }

      uVar7 = 1 << ((byte)iVar3 & 0x1f);

      if (uVar7 < uVar6) {

        uVar6 = uVar7 * 2;

      }

    }

    else if ((uVar6 & 0x3fff) != 0) {

      uVar6 = uVar6 + (0x4000 - (uVar6 & 0x3fff));

    }

    cVar4 = FUN_005dd210(uVar6);

    if (cVar4 == '\0') goto LAB_005de28b;

  }

  piVar1 = (int *)(*(int *)(param_1 + 0x58) + *(int *)(param_1 + 0x60) * 0x24);

  iVar3 = *piVar1;

  if (iVar3 != local_24) {

    LVar5 = InterlockedDecrement((LONG *)(iVar3 + -0x10));

    if ((LVar5 == 0) && ((undefined4 *)(iVar3 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar3 + -0x14))(1);

    }

    *piVar1 = local_24;

    InterlockedIncrement((LONG *)(local_24 + -0x10));

  }

  piVar1[1] = local_20;

  piVar1[2] = local_1c;

  piVar1[3] = local_18;

  piVar1[4] = local_14;

  piVar1[5] = local_10;

  *(char *)(piVar1 + 6) = cVar2;

  piVar1[7] = 0;

  piVar1[8] = 0;

  *(int *)(param_1 + 0x60) = *(int *)(param_1 + 0x60) + 1;

LAB_005de28b:

  LVar5 = InterlockedDecrement((LONG *)(local_24 + -0x10));

  if ((LVar5 == 0) && ((undefined4 *)(local_24 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_24 + -0x14))(1);

  }

  return;

}





// --- FUN_005de2c0 at 0x005DE2C0 (size: 88) ---


undefined4 __fastcall FUN_005de2c0(int param_1)



{

  char cVar1;

  undefined4 uVar2;

  uint uVar3;

  

  *(undefined1 *)(param_1 + 0xc) = 0;

  uVar2 = FUN_0054bd80();

  *(undefined4 *)(param_1 + 0x54) = uVar2;

  uVar3 = 0;

  do {

    FUN_005de0b0(*(undefined4 *)((int)&DAT_008f20b0 + uVar3));

    uVar3 = uVar3 + 4;

  } while (uVar3 < 0x1c);

  FUN_005dde50();

  FUN_005dd850(0);

  cVar1 = FUN_005dd700();

  if (cVar1 != '\0') {

    cVar1 = FUN_005dd7d0();

    if (cVar1 != '\0') {

      return 1;

    }

  }

  return 0;

}





// --- FUN_005de320 at 0x005DE320 (size: 97) ---


void FUN_005de320(undefined4 *param_1,int *param_2)



{

  int *piVar1;

  undefined4 *puVar2;

  char cVar3;

  int iVar4;

  

  iVar4 = FUN_005df0f5(0x88);

  if (iVar4 == 0) {

    iVar4 = 0;

  }

  else {

    iVar4 = FUN_005dd320();

  }

  *param_2 = iVar4;

  if (iVar4 != 0) {

    cVar3 = FUN_005de2c0();

    if (cVar3 != '\0') {

      *param_1 = 0;

      return;

    }

    puVar2 = (undefined4 *)*param_2;

    if (puVar2 != (undefined4 *)0x0) {

      piVar1 = puVar2 + 1;

      *piVar1 = *piVar1 + -1;

      if (*piVar1 == 0) {

        (**(code **)*puVar2)(1);

      }

      *param_2 = 0;

    }

  }

  *param_1 = 0x80004005;

  return;

}





// --- FUN_005de390 at 0x005DE390 (size: 51) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void FUN_005de390(void)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  

  puVar2 = &DAT_008f20e8;

  puVar3 = &DAT_008f23f0;

  for (iVar1 = 0xc1; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  puVar2 = &DAT_008f2144;

  for (iVar1 = 0xaa; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

  _DAT_008f20e4 = 1;

  _DAT_008f20d0 = 0;

  return;

}





// --- FUN_005de3d0 at 0x005DE3D0 (size: 64) ---


undefined4 * __thiscall FUN_005de3d0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007ea660;

  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_005de410 at 0x005DE410 (size: 41) ---


void __fastcall FUN_005de410(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)(param_1[1] + -0x14);

  *param_1 = &PTR_FUN_007ea668;

  LVar1 = InterlockedDecrement((LONG *)(param_1[1] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  return;

}





// --- FUN_005de440 at 0x005DE440 (size: 65) ---


undefined4 * __thiscall FUN_005de440(undefined4 *param_1,byte param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)(param_1[1] + -0x14);

  *param_1 = &PTR_FUN_007ea668;

  LVar1 = InterlockedDecrement((LONG *)(param_1[1] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005de490 at 0x005DE490 (size: 49) ---


undefined4 * __fastcall FUN_005de490(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007ea668;

  FUN_00401340(&DAT_007938af);

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  *(undefined1 *)(param_1 + 6) = 0;

  *param_1 = &PTR_FUN_007ea6d8;

  return param_1;

}





// --- FUN_005de530 at 0x005DE530 (size: 36) ---


undefined4 * __thiscall FUN_005de530(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007ea6d8;

  FUN_005de410();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005de560 at 0x005DE560 (size: 62) ---


undefined4 * __fastcall FUN_005de560(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007ea668;

  FUN_00401340(&DAT_007938af);

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  *param_1 = &PTR_FUN_007ea748;

  param_1[6] = 0xffffffff;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  return param_1;

}





// --- FUN_005de5e0 at 0x005DE5E0 (size: 46) ---


undefined4 * __thiscall FUN_005de5e0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007ea748;

  FUN_004020c0();

  FUN_005de410();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005de640 at 0x005DE640 (size: 69) ---


undefined4 __thiscall FUN_005de640(int *param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  

  FUN_004180a0(param_1[2] + param_2[2]);

  iVar1 = param_2[2];

  while (iVar1 = iVar1 + -1, -1 < iVar1) {

    *(undefined4 *)(*param_1 + (param_1[2] + iVar1) * 4) = *(undefined4 *)(*param_2 + iVar1 * 4);

  }

  iVar1 = param_2[2];

  iVar2 = param_1[2];

  param_1[2] = iVar2 + iVar1;

  return CONCAT31((int3)((uint)(iVar2 + iVar1) >> 8),1);

}





// --- FUN_005de690 at 0x005DE690 (size: 59) ---


undefined4 * __fastcall FUN_005de690(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007ea668;

  FUN_00401340(&DAT_007938af);

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  *param_1 = &PTR_FUN_007ea7b8;

  param_1[8] = 0x3f800000;

  return param_1;

}





// --- FUN_005de750 at 0x005DE750 (size: 36) ---


undefined4 * __thiscall FUN_005de750(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007ea7b8;

  FUN_005de410();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005de780 at 0x005DE780 (size: 59) ---


undefined4 * __fastcall FUN_005de780(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007ea668;

  FUN_00401340(&DAT_007938af);

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  *param_1 = &PTR_FUN_007ea828;

  param_1[8] = 1;

  return param_1;

}





// --- FUN_005de820 at 0x005DE820 (size: 36) ---


undefined4 * __thiscall FUN_005de820(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007ea828;

  FUN_005de410();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005de850 at 0x005DE850 (size: 59) ---


undefined4 * __fastcall FUN_005de850(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007ea668;

  FUN_00401340(&DAT_007938af);

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  *param_1 = &PTR_FUN_007ea898;

  FUN_00401340(&DAT_007938af);

  return param_1;

}





// --- FUN_005de910 at 0x005DE910 (size: 46) ---


undefined4 * __thiscall FUN_005de910(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007ea898;

  FUN_004011b0();

  FUN_005de410();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005de940 at 0x005DE940 (size: 79) ---


undefined4

FUN_005de940(undefined4 param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4)



{

  int iVar1;

  undefined3 uVar2;

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  uVar2 = (undefined3)((uint)local_4 >> 8);

  if (local_4 != 0) {

    iVar1 = *(int *)(local_4 + 8);

    if (iVar1 != 0) {

      *param_2 = *(undefined4 *)(iVar1 + 0xc);

      *param_3 = *(undefined4 *)(iVar1 + 0x10);

      *param_4 = *(undefined4 *)(iVar1 + 0x14);

      uVar2 = (undefined3)((uint)param_3 >> 8);

    }

    return CONCAT31(uVar2,1);

  }

  return 0;

}





// --- FUN_005de990 at 0x005DE990 (size: 65) ---


undefined4 FUN_005de990(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    uVar1 = 1;

    if (*(int **)(local_4 + 8) != (int *)0x0) {

      uVar1 = (**(code **)(**(int **)(local_4 + 8) + 0x3c))(param_2,param_3);

    }

    return uVar1;

  }

  return 0;

}





// --- FUN_005de9e0 at 0x005DE9E0 (size: 65) ---


undefined4 FUN_005de9e0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    uVar1 = 1;

    if (*(int **)(local_4 + 8) != (int *)0x0) {

      uVar1 = (**(code **)(**(int **)(local_4 + 8) + 0x38))(param_2,param_3);

    }

    return uVar1;

  }

  return 0;

}





// --- FUN_005dea30 at 0x005DEA30 (size: 65) ---


undefined4 FUN_005dea30(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    uVar1 = 1;

    if (*(int **)(local_4 + 8) != (int *)0x0) {

      uVar1 = (**(code **)(**(int **)(local_4 + 8) + 0x14))(param_2,param_3);

    }

    return uVar1;

  }

  return 0;

}





// --- FUN_005dea80 at 0x005DEA80 (size: 60) ---


undefined4 FUN_005dea80(undefined4 param_1,undefined4 param_2)



{

  undefined4 uVar1;

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    uVar1 = 1;

    if (*(int **)(local_4 + 8) != (int *)0x0) {

      uVar1 = (**(code **)(**(int **)(local_4 + 8) + 0x28))(param_2);

    }

    return uVar1;

  }

  return 0;

}





// --- FUN_005deac0 at 0x005DEAC0 (size: 60) ---


undefined4 FUN_005deac0(undefined4 param_1,undefined4 param_2)



{

  undefined4 uVar1;

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    uVar1 = 1;

    if (*(int **)(local_4 + 8) != (int *)0x0) {

      uVar1 = (**(code **)(**(int **)(local_4 + 8) + 0x24))(param_2);

    }

    return uVar1;

  }

  return 0;

}





// --- FUN_005deb00 at 0x005DEB00 (size: 143) ---


undefined4 * __thiscall FUN_005deb00(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_007ea660;

  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_005deb90 at 0x005DEB90 (size: 60) ---


void FUN_005deb90(undefined4 param_1,undefined4 param_2)



{

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    (**(code **)(**(int **)(local_4 + 8) + 8))(param_2);

  }

  return;

}





// --- FUN_005debd0 at 0x005DEBD0 (size: 60) ---


void FUN_005debd0(undefined4 param_1,undefined4 param_2)



{

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    (**(code **)(**(int **)(local_4 + 8) + 0x10))(param_2);

  }

  return;

}





// --- FUN_005dec10 at 0x005DEC10 (size: 60) ---


void FUN_005dec10(undefined4 param_1,undefined4 param_2)



{

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    (**(code **)(**(int **)(local_4 + 8) + 0x20))(param_2);

  }

  return;

}





// --- FUN_005dec50 at 0x005DEC50 (size: 60) ---


void FUN_005dec50(undefined4 param_1,undefined4 param_2)



{

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    (**(code **)(**(int **)(local_4 + 8) + 0x34))(param_2);

  }

  return;

}





// --- FUN_005dec90 at 0x005DEC90 (size: 60) ---


void FUN_005dec90(undefined4 param_1,undefined4 param_2)



{

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    (**(code **)(**(int **)(local_4 + 8) + 4))(param_2);

  }

  return;

}





// --- FUN_005decd0 at 0x005DECD0 (size: 60) ---


void FUN_005decd0(undefined4 param_1,undefined4 param_2)



{

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    (**(code **)(**(int **)(local_4 + 8) + 0xc))(param_2);

  }

  return;

}





// --- FUN_005ded10 at 0x005DED10 (size: 60) ---


void FUN_005ded10(undefined4 param_1,undefined4 param_2)



{

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    (**(code **)(**(int **)(local_4 + 8) + 0x1c))(param_2);

  }

  return;

}





// --- FUN_005ded50 at 0x005DED50 (size: 60) ---


void FUN_005ded50(undefined4 param_1,undefined4 param_2)



{

  undefined1 local_c [8];

  int local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    (**(code **)(**(int **)(local_4 + 8) + 0x30))(param_2);

  }

  return;

}





// --- FUN_005ded90 at 0x005DED90 (size: 85) ---


int FUN_005ded90(undefined4 param_1)



{

  undefined4 local_c;

  undefined4 local_8;

  int local_4;

  

  FUN_00433100(&local_c,param_1);

  if (local_4 != 0) {

    FUN_00428ba0(local_c,local_8,local_4);

    return local_4;

  }

  return 0;

}





// --- FUN_005dedf0 at 0x005DEDF0 (size: 82) ---


undefined4 * __thiscall FUN_005dedf0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007ea908;

  FUN_00433a10();

  param_1[1] = &PTR_FUN_007ea660;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005dee50 at 0x005DEE50 (size: 259) ---


uint FUN_005dee50(undefined4 param_1,int param_2,undefined4 param_3,undefined4 param_4,

                 undefined4 param_5)



{

  char cVar1;

  int iVar2;

  undefined4 *puVar3;

  uint uVar4;

  undefined4 *local_10;

  undefined1 local_c [8];

  uint local_4;

  

  FUN_00433100(local_c,param_1);

  if (local_4 != 0) {

    return local_4 & 0xffffff00;

  }

  uVar4 = param_2 - 1;

  switch(uVar4) {

  case 0:

    iVar2 = FUN_005df0f5(0x24);

    uVar4 = 0;

    if (iVar2 == 0) goto switchD_005dee89_default;

    puVar3 = (undefined4 *)FUN_005de780();

    break;

  case 1:

    iVar2 = FUN_005df0f5(0x28);

    uVar4 = 0;

    if (iVar2 == 0) goto switchD_005dee89_default;

    puVar3 = (undefined4 *)FUN_005de560();

    break;

  case 2:

    iVar2 = FUN_005df0f5(0x24);

    uVar4 = 0;

    if (iVar2 == 0) goto switchD_005dee89_default;

    puVar3 = (undefined4 *)FUN_005de690();

    break;

  case 3:

    iVar2 = FUN_005df0f5(0x1c);

    uVar4 = 0;

    if (iVar2 == 0) goto switchD_005dee89_default;

    puVar3 = (undefined4 *)FUN_005de490();

    break;

  case 4:

    iVar2 = FUN_005df0f5(0x1c);

    uVar4 = 0;

    if (iVar2 == 0) goto switchD_005dee89_default;

    puVar3 = (undefined4 *)FUN_005de850();

    break;

  default:

    goto switchD_005dee89_default;

  }

  uVar4 = 0;

  if (puVar3 != (undefined4 *)0x0) {

    local_10 = puVar3;

    cVar1 = FUN_005defc0(param_1,param_2,param_3,param_4,param_5);

    if (cVar1 != '\0') {

      uVar4 = FUN_0068c4c0(param_1,&local_10);

      return uVar4;

    }

    uVar4 = (**(code **)*puVar3)(1);

  }

switchD_005dee89_default:

  return uVar4 & 0xffffff00;

}





// --- FUN_005def70 at 0x005DEF70 (size: 72) ---


undefined4 FUN_005def70(undefined4 param_1)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  

  piVar1 = (int *)FUN_005ded90(param_1);

  if (piVar1 != (int *)0x0) {

    puVar3 = (undefined4 *)(*piVar1 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(*piVar1 + -0x10));

    if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

    operator_delete(piVar1);

    return 1;

  }

  return 0;

}





// --- FUN_005defc0 at 0x005DEFC0 (size: 193) ---


undefined4 __thiscall

FUN_005defc0(int param_1,int *param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5,

            undefined4 param_6)



{

  int iVar1;

  int *piVar2;

  char cVar3;

  LONG LVar4;

  undefined4 *puVar5;

  

  piVar2 = param_2;

  cVar3 = FUN_004370c0(param_2,0);

  if (cVar3 == '\0') {

    param_2 = (int *)PTR_DAT_00818344;

    InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

    FUN_00402710(&param_2,

                 "UIPreferenceItem::Initialize: Attempted to initialize [%s] but the preference has not been registered!\n"

                 ,*piVar2);

    puVar5 = (undefined4 *)((int)param_2 + -0x14);

    LVar4 = InterlockedDecrement((LONG *)((int)param_2 + -0x10));

    if ((LVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

    }

    return 0;

  }

  iVar1 = *(int *)(param_1 + 4);

  if (iVar1 != *piVar2) {

    LVar4 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar4 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

    }

    iVar1 = *piVar2;

    *(int *)(param_1 + 4) = iVar1;

    InterlockedIncrement((LONG *)(iVar1 + -0x10));

  }

  *(undefined4 *)(param_1 + 8) = param_3;

  *(undefined4 *)(param_1 + 0x14) = param_6;

  *(undefined4 *)(param_1 + 0xc) = param_4;

  *(undefined4 *)(param_1 + 0x10) = param_5;

  return 1;

}





// --- thunk_FUN_005df0f5 at 0x005DF0F0 (size: 5) ---


void thunk_FUN_005df0f5(size_t param_1)



{

  int iVar1;

  void *pvVar2;

  

  while( true ) {

    pvVar2 = malloc(param_1);

    if (pvVar2 != (void *)0x0) break;

    iVar1 = _callnewh(param_1);

    if (iVar1 == 0) {

      std::_Nomemory();

    }

  }

  return;

}





// --- FUN_005df0f5 at 0x005DF0F5 (size: 37) ---


void FUN_005df0f5(size_t param_1)



{

  int iVar1;

  void *pvVar2;

  

  while( true ) {

    pvVar2 = malloc(param_1);

    if (pvVar2 != (void *)0x0) break;

    iVar1 = _callnewh(param_1);

    if (iVar1 == 0) {

      std::_Nomemory();

    }

  }

  return;

}





// --- __onexit at 0x005DF120 (size: 38) ---


/* Library Function - Single Match

    __onexit

   

   Library: Visual Studio 2003 Release */



void __onexit(_onexit_t param_1)



{

  if (DAT_009067d0 == -1) {

                    /* WARNING: Could not recover jumptable at 0x005df129. Too many branches */

                    /* WARNING: Treating indirect jump as call */

    _onexit(param_1);

    return;

  }

  __dllonexit(param_1,&DAT_009067d0,&DAT_009067cc);

  return;

}





// --- _atexit at 0x005DF146 (size: 18) ---


/* Library Function - Single Match

    _atexit

   

   Library: Visual Studio 2003 Release */



int __cdecl _atexit(_func_4879 *param_1)



{

  int iVar1;

  

  iVar1 = __onexit(param_1);

  return (iVar1 != 0) - 1;

}





// --- operator_delete at 0x005DF15E (size: 6) ---


void __cdecl operator_delete(void *param_1)



{

                    /* WARNING: Could not recover jumptable at 0x005df15e. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  operator_delete(param_1);

  return;

}





// --- operator_delete[] at 0x005DF164 (size: 6) ---


void __cdecl operator_delete__(void *param_1)



{

                    /* WARNING: Could not recover jumptable at 0x005df164. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  operator_delete__(param_1);

  return;

}





// --- entry at 0x005DF16A (size: 438) ---


/* WARNING: Function: __SEH_prolog replaced with injection: SEH_prolog */

/* WARNING: Function: __SEH_epilog replaced with injection: EH_epilog3 */

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



int entry(void)



{

  HMODULE pHVar1;

  undefined4 *puVar2;

  uint uVar3;

  int iVar4;

  int *piVar5;

  undefined4 uVar6;

  byte *pbVar7;

  _STARTUPINFOA local_7c;

  byte *local_38;

  int local_34;

  int local_30;

  char **local_2c;

  char **local_28;

  _startupinfo local_24;

  uint local_20;

  undefined4 uStack_c;

  undefined *local_8;

  

  local_8 = &DAT_007ea9c0;

  uStack_c = 0x5df176;

  pHVar1 = GetModuleHandleA((LPCSTR)0x0);

  if (((short)pHVar1->unused == 0x5a4d) &&

     (piVar5 = (int *)((int)&pHVar1->unused + pHVar1[0xf].unused), *piVar5 == 0x4550)) {

    if ((short)piVar5[6] == 0x10b) {

      if (0xe < (uint)piVar5[0x1d]) {

        iVar4 = piVar5[0x3a];

        goto LAB_005df1cd;

      }

    }

    else if (((short)piVar5[6] == 0x20b) && (0xe < (uint)piVar5[0x21])) {

      iVar4 = piVar5[0x3e];

LAB_005df1cd:

      local_20 = (uint)(iVar4 != 0);

      goto LAB_005df1d3;

    }

  }

  local_20 = 0;

LAB_005df1d3:

  local_8 = (undefined *)0x0;

  __set_app_type(2);

  _DAT_009067cc = 0xffffffff;

  DAT_009067d0 = 0xffffffff;

  puVar2 = (undefined4 *)__p__fmode();

  *puVar2 = DAT_008f2978;

  puVar2 = (undefined4 *)__p__commode();

  *puVar2 = DAT_008f2974;

  _DAT_009067c8 = *(undefined4 *)_adjust_fdiv_exref;

  FUN_005df730();

  FUN_005df7d0();

  if (DAT_008251c0 == 0) {

    __setusermatherr(FUN_005df7d0);

  }

  FUN_005df7be();

  initterm(&DAT_00817cb8,&DAT_00817cbc);

  _atexit((_func_4879 *)&LAB_005df774);

  local_24.newmode = DAT_008f2970;

  local_34 = __getmainargs(&local_30,&local_2c,&local_28,DAT_008f296c,&local_24);

  if (local_34 < 0) {

    _amsg_exit(8);

  }

  initterm(&DAT_0080b000,&DAT_00817cb4);

  local_38 = *(byte **)_acmdln_exref;

  if (*local_38 != 0x22) {

    do {

      if (*local_38 < 0x21) goto LAB_005df2be;

      local_38 = local_38 + 1;

    } while( true );

  }

  do {

    local_38 = local_38 + 1;

    if (*local_38 == 0) break;

  } while (*local_38 != 0x22);

  if (*local_38 != 0x22) goto LAB_005df2be;

  do {

    local_38 = local_38 + 1;

LAB_005df2be:

    pbVar7 = local_38;

  } while ((*local_38 != 0) && (*local_38 < 0x21));

  local_7c.dwFlags = 0;

  GetStartupInfoA(&local_7c);

  if ((local_7c.dwFlags & 1) == 0) {

    uVar3 = 10;

  }

  else {

    uVar3 = (uint)local_7c.wShowWindow;

  }

  uVar6 = 0;

  pHVar1 = GetModuleHandleA((LPCSTR)0x0);

  iVar4 = FUN_004013a0(pHVar1,uVar6,pbVar7,uVar3);

  if (local_20 == 0) {

                    /* WARNING: Subroutine does not return */

    exit(iVar4);

  }

  _cexit();

  return iVar4;

}





// --- __chkstk at 0x005DF350 (size: 61) ---


/* WARNING: This is an inlined function */

/* WARNING: Unable to track spacebase fully for stack */

/* Library Function - Single Match

    __chkstk

   

   Libraries: Visual Studio 2003 Debug, Visual Studio 2003 Release */



void __chkstk(void)



{

  uint in_EAX;

  undefined1 *puVar1;

  undefined4 unaff_retaddr;

  

  if (in_EAX < 0x1000) {

    *(undefined4 *)(&stack0x00000000 + -in_EAX) = unaff_retaddr;

    return;

  }

  puVar1 = &stack0x00000004;

  do {

    puVar1 = puVar1 + -0x1000;

    in_EAX = in_EAX - 0x1000;

  } while (0xfff < in_EAX);

  *(undefined4 *)(puVar1 + (-4 - in_EAX)) = unaff_retaddr;

  return;

}





// --- qsort at 0x005DF38E (size: 6) ---


void __cdecl

qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,_PtFuncCompare *_PtFuncCompare)



{

                    /* WARNING: Could not recover jumptable at 0x005df38e. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  qsort(_Base,_NumOfElements,_SizeOfElements,_PtFuncCompare);

  return;

}





// --- __allshl at 0x005DF3A0 (size: 31) ---


/* Library Function - Single Match

    __allshl

   

   Library: Visual Studio */



longlong __fastcall __allshl(byte param_1,int param_2)



{

  uint in_EAX;

  

  if (0x3f < param_1) {

    return 0;

  }

  if (param_1 < 0x20) {

    return CONCAT44(param_2 << (param_1 & 0x1f) | in_EAX >> 0x20 - (param_1 & 0x1f),

                    in_EAX << (param_1 & 0x1f));

  }

  return (ulonglong)(in_EAX << (param_1 & 0x1f)) << 0x20;

}





// --- __aullshr at 0x005DF3C0 (size: 31) ---


/* Library Function - Single Match

    __aullshr

   

   Library: Visual Studio */



ulonglong __fastcall __aullshr(byte param_1,uint param_2)



{

  uint in_EAX;

  

  if (0x3f < param_1) {

    return 0;

  }

  if (param_1 < 0x20) {

    return CONCAT44(param_2 >> (param_1 & 0x1f),

                    in_EAX >> (param_1 & 0x1f) | param_2 << 0x20 - (param_1 & 0x1f));

  }

  return (ulonglong)(param_2 >> (param_1 & 0x1f));

}





// --- __alldiv at 0x005DF3E0 (size: 170) ---


/* Library Function - Single Match

    __alldiv

   

   Library: Visual Studio */



undefined8 __alldiv(uint param_1,uint param_2,uint param_3,uint param_4)



{

  ulonglong uVar1;

  longlong lVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  bool bVar10;

  char cVar11;

  uint uVar9;

  

  cVar11 = (int)param_2 < 0;

  if ((bool)cVar11) {

    bVar10 = param_1 != 0;

    param_1 = -param_1;

    param_2 = -(uint)bVar10 - param_2;

  }

  if ((int)param_4 < 0) {

    cVar11 = cVar11 + '\x01';

    bVar10 = param_3 != 0;

    param_3 = -param_3;

    param_4 = -(uint)bVar10 - param_4;

  }

  uVar3 = param_1;

  uVar5 = param_3;

  uVar6 = param_2;

  uVar9 = param_4;

  if (param_4 == 0) {

    uVar3 = param_2 / param_3;

    iVar4 = (int)(((ulonglong)param_2 % (ulonglong)param_3 << 0x20 | (ulonglong)param_1) /

                 (ulonglong)param_3);

  }

  else {

    do {

      uVar8 = uVar9 >> 1;

      uVar5 = uVar5 >> 1 | (uint)((uVar9 & 1) != 0) << 0x1f;

      uVar7 = uVar6 >> 1;

      uVar3 = uVar3 >> 1 | (uint)((uVar6 & 1) != 0) << 0x1f;

      uVar6 = uVar7;

      uVar9 = uVar8;

    } while (uVar8 != 0);

    uVar1 = CONCAT44(uVar7,uVar3) / (ulonglong)uVar5;

    iVar4 = (int)uVar1;

    lVar2 = (ulonglong)param_3 * (uVar1 & 0xffffffff);

    uVar3 = (uint)((ulonglong)lVar2 >> 0x20);

    uVar5 = uVar3 + iVar4 * param_4;

    if (((CARRY4(uVar3,iVar4 * param_4)) || (param_2 < uVar5)) ||

       ((param_2 <= uVar5 && (param_1 < (uint)lVar2)))) {

      iVar4 = iVar4 + -1;

    }

    uVar3 = 0;

  }

  if (cVar11 == '\x01') {

    bVar10 = iVar4 != 0;

    iVar4 = -iVar4;

    uVar3 = -(uint)bVar10 - uVar3;

  }

  return CONCAT44(uVar3,iVar4);

}





// --- __allmul at 0x005DF490 (size: 52) ---


/* Library Function - Single Match

    __allmul

   

   Library: Visual Studio */



longlong __allmul(uint param_1,int param_2,uint param_3,int param_4)



{

  if (param_4 == 0 && param_2 == 0) {

    return (ulonglong)param_1 * (ulonglong)param_3;

  }

  return CONCAT44((int)((ulonglong)param_1 * (ulonglong)param_3 >> 0x20) +

                  param_2 * param_3 + param_1 * param_4,

                  (int)((ulonglong)param_1 * (ulonglong)param_3));

}





// --- FUN_005df4c4 at 0x005DF4C4 (size: 117) ---


ulonglong FUN_005df4c4(void)



{

  ulonglong uVar1;

  uint uVar2;

  float fVar3;

  float10 in_ST0;

  undefined4 local_20;

  undefined4 uStack_1c;

  

  uVar1 = (ulonglong)ROUND(in_ST0);

  local_20 = (uint)uVar1;

  uStack_1c = (float)(uVar1 >> 0x20);

  fVar3 = (float)in_ST0;

  if ((local_20 != 0) || (fVar3 = uStack_1c, (uVar1 & 0x7fffffff00000000) != 0)) {

    if ((int)fVar3 < 0) {

      uVar1 = uVar1 + (0x80000000 < (uint)-(float)(in_ST0 - (float10)(longlong)uVar1));

    }

    else {

      uVar2 = (uint)(0x80000000 < (uint)(float)(in_ST0 - (float10)(longlong)uVar1));

      uVar1 = CONCAT44((int)uStack_1c - (uint)(local_20 < uVar2),local_20 - uVar2);

    }

  }

  return uVar1;

}





// --- __aullrem at 0x005DF540 (size: 117) ---


/* Library Function - Single Match

    __aullrem

   

   Library: Visual Studio */



undefined8 __aullrem(uint param_1,uint param_2,uint param_3,uint param_4)



{

  ulonglong uVar1;

  longlong lVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  int iVar6;

  int iVar7;

  uint uVar8;

  uint uVar9;

  uint uVar10;

  bool bVar11;

  

  uVar3 = param_1;

  uVar4 = param_4;

  uVar9 = param_2;

  uVar10 = param_3;

  if (param_4 == 0) {

    iVar6 = (int)(((ulonglong)param_2 % (ulonglong)param_3 << 0x20 | (ulonglong)param_1) %

                 (ulonglong)param_3);

    iVar7 = 0;

  }

  else {

    do {

      uVar5 = uVar4 >> 1;

      uVar10 = uVar10 >> 1 | (uint)((uVar4 & 1) != 0) << 0x1f;

      uVar8 = uVar9 >> 1;

      uVar3 = uVar3 >> 1 | (uint)((uVar9 & 1) != 0) << 0x1f;

      uVar4 = uVar5;

      uVar9 = uVar8;

    } while (uVar5 != 0);

    uVar1 = CONCAT44(uVar8,uVar3) / (ulonglong)uVar10;

    uVar3 = (int)uVar1 * param_4;

    lVar2 = (uVar1 & 0xffffffff) * (ulonglong)param_3;

    uVar9 = (uint)((ulonglong)lVar2 >> 0x20);

    uVar4 = (uint)lVar2;

    uVar10 = uVar9 + uVar3;

    if (((CARRY4(uVar9,uVar3)) || (param_2 < uVar10)) || ((param_2 <= uVar10 && (param_1 < uVar4))))

    {

      bVar11 = uVar4 < param_3;

      uVar4 = uVar4 - param_3;

      uVar10 = (uVar10 - param_4) - (uint)bVar11;

    }

    iVar6 = -(uVar4 - param_1);

    iVar7 = -(uint)(uVar4 - param_1 != 0) - ((uVar10 - param_2) - (uint)(uVar4 < param_1));

  }

  return CONCAT44(iVar7,iVar6);

}





// --- _CIpow at 0x005DF5B6 (size: 6) ---


void _CIpow(void)



{

                    /* WARNING: Could not recover jumptable at 0x005df5b6. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  _CIpow();

  return;

}





// --- _CIfmod at 0x005DF5BC (size: 6) ---


void _CIfmod(void)



{

                    /* WARNING: Could not recover jumptable at 0x005df5bc. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  _CIfmod();

  return;

}





// --- _CIasin at 0x005DF5C2 (size: 6) ---


void _CIasin(void)



{

                    /* WARNING: Could not recover jumptable at 0x005df5c2. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  _CIasin();

  return;

}





// --- floor at 0x005DF5C8 (size: 6) ---


double __cdecl floor(double _X)



{

  double dVar1;

  

                    /* WARNING: Could not recover jumptable at 0x005df5c8. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  dVar1 = floor(_X);

  return dVar1;

}





// --- malloc at 0x005DF5CE (size: 6) ---


void * __cdecl malloc(size_t _Size)



{

  void *pvVar1;

  

                    /* WARNING: Could not recover jumptable at 0x005df5ce. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  pvVar1 = malloc(_Size);

  return pvVar1;

}





// --- _CIacos at 0x005DF5D4 (size: 6) ---


void _CIacos(void)



{

                    /* WARNING: Could not recover jumptable at 0x005df5d4. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  _CIacos();

  return;

}





// --- __ArrayUnwind at 0x005DF5E0 (size: 47) ---


/* WARNING: Function: __SEH_prolog replaced with injection: SEH_prolog */

/* WARNING: Function: __SEH_epilog replaced with injection: EH_epilog3 */

/* Library Function - Single Match

    void __stdcall __ArrayUnwind(void *,unsigned int,int,void (__thiscall*)(void *))

   

   Library: Visual Studio 2003 Release */



void __ArrayUnwind(void *param_1,uint param_2,int param_3,_func_void_void_ptr *param_4)



{

  void *unaff_EDI;

  

  while( true ) {

    param_3 = param_3 + -1;

    if (param_3 < 0) break;

    (*param_4)(unaff_EDI);

  }

  return;

}





// --- `eh_vector_destructor_iterator' at 0x005DF63E (size: 72) ---


/* WARNING: Function: __SEH_prolog replaced with injection: SEH_prolog */

/* WARNING: Function: __SEH_epilog replaced with injection: EH_epilog3 */

/* Library Function - Single Match

    void __stdcall `eh vector destructor iterator'(void *,unsigned int,int,void (__thiscall*)(void

   *))

   

   Library: Visual Studio 2003 Release */



void _eh_vector_destructor_iterator_

               (void *param_1,uint param_2,int param_3,_func_void_void_ptr *param_4)



{

  void *unaff_EDI;

  

  while( true ) {

    param_3 = param_3 + -1;

    if (param_3 < 0) break;

    (*param_4)(unaff_EDI);

  }

  FUN_005df686();

  return;

}





// --- FUN_005df686 at 0x005DF686 (size: 24) ---


void FUN_005df686(void)



{

  int unaff_EBP;

  

  if (*(int *)(unaff_EBP + -0x1c) == 0) {

    __ArrayUnwind(*(void **)(unaff_EBP + 8),*(uint *)(unaff_EBP + 0xc),*(int *)(unaff_EBP + 0x10),

                  *(_func_void_void_ptr **)(unaff_EBP + 0x14));

  }

  return;

}





// --- _finite at 0x005DF69E (size: 6) ---


int __cdecl _finite(double _X)



{

  int iVar1;

  

                    /* WARNING: Could not recover jumptable at 0x005df69e. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  iVar1 = _finite(_X);

  return iVar1;

}





// --- __aulldiv at 0x005DF6B0 (size: 104) ---


/* Library Function - Single Match

    __aulldiv

   

   Library: Visual Studio */



undefined8 __aulldiv(uint param_1,uint param_2,uint param_3,uint param_4)



{

  ulonglong uVar1;

  longlong lVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  uint uVar9;

  

  uVar3 = param_1;

  uVar8 = param_4;

  uVar6 = param_2;

  uVar9 = param_3;

  if (param_4 == 0) {

    uVar3 = param_2 / param_3;

    iVar4 = (int)(((ulonglong)param_2 % (ulonglong)param_3 << 0x20 | (ulonglong)param_1) /

                 (ulonglong)param_3);

  }

  else {

    do {

      uVar5 = uVar8 >> 1;

      uVar9 = uVar9 >> 1 | (uint)((uVar8 & 1) != 0) << 0x1f;

      uVar7 = uVar6 >> 1;

      uVar3 = uVar3 >> 1 | (uint)((uVar6 & 1) != 0) << 0x1f;

      uVar8 = uVar5;

      uVar6 = uVar7;

    } while (uVar5 != 0);

    uVar1 = CONCAT44(uVar7,uVar3) / (ulonglong)uVar9;

    iVar4 = (int)uVar1;

    lVar2 = (ulonglong)param_3 * (uVar1 & 0xffffffff);

    uVar3 = (uint)((ulonglong)lVar2 >> 0x20);

    uVar8 = uVar3 + iVar4 * param_4;

    if (((CARRY4(uVar3,iVar4 * param_4)) || (param_2 < uVar8)) ||

       ((param_2 <= uVar8 && (param_1 < (uint)lVar2)))) {

      iVar4 = iVar4 + -1;

    }

    uVar3 = 0;

  }

  return CONCAT44(uVar3,iVar4);

}





// --- _callnewh at 0x005DF718 (size: 6) ---


int __cdecl _callnewh(size_t _Size)



{

  int iVar1;

  

                    /* WARNING: Could not recover jumptable at 0x005df718. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  iVar1 = _callnewh(_Size);

  return iVar1;

}





// --- __dllonexit at 0x005DF71E (size: 6) ---


void __dllonexit(void)



{

                    /* WARNING: Could not recover jumptable at 0x005df71e. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  __dllonexit();

  return;

}





// --- _amsg_exit at 0x005DF72A (size: 6) ---


void __cdecl _amsg_exit(int param_1)



{

                    /* WARNING: Could not recover jumptable at 0x005df72a. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  _amsg_exit(param_1);

  return;

}





// --- FUN_005df730 at 0x005DF730 (size: 61) ---


/* WARNING: Function: __SEH_prolog replaced with injection: SEH_prolog */

/* WARNING: Function: __SEH_epilog replaced with injection: EH_epilog3 */



void FUN_005df730(void)



{

  undefined4 *local_20;

  

  for (local_20 = &DAT_0080854c; local_20 < &DAT_0080854c; local_20 = local_20 + 1) {

    if ((code *)*local_20 != (code *)0x0) {

      (*(code *)*local_20)();

    }

  }

  return;

}





// --- initterm at 0x005DF7B8 (size: 6) ---


void __cdecl initterm(void)



{

                    /* WARNING: Could not recover jumptable at 0x005df7b8. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  initterm();

  return;

}





// --- FUN_005df7be at 0x005DF7BE (size: 18) ---


void FUN_005df7be(void)



{

  _controlfp(0x10000,0x30000);

  return;

}





// --- FUN_005df7d0 at 0x005DF7D0 (size: 3) ---


undefined4 FUN_005df7d0(void)



{

  return 0;

}





// --- __SEH_prolog at 0x005DF7D4 (size: 59) ---


/* WARNING: This is an inlined function */

/* WARNING: Unable to track spacebase fully for stack */

/* Library Function - Single Match

    __SEH_prolog

   

   Library: Visual Studio */



void __SEH_prolog(undefined4 param_1,int param_2)



{

  undefined4 unaff_EBX;

  undefined4 unaff_ESI;

  undefined4 unaff_EDI;

  undefined4 unaff_retaddr;

  undefined4 auStack_18 [4];

  undefined1 local_8 [8];

  

  param_2 = -param_2;

  *(undefined4 *)((int)auStack_18 + param_2 + 0xc) = unaff_EBX;

  *(undefined4 *)((int)auStack_18 + param_2 + 8) = unaff_ESI;

  *(undefined4 *)((int)auStack_18 + param_2 + 4) = unaff_EDI;

  *(undefined4 *)((int)auStack_18 + param_2) = unaff_retaddr;

  ExceptionList = local_8;

  return;

}





// --- __SEH_epilog at 0x005DF80F (size: 17) ---


/* WARNING: This is an inlined function */

/* Library Function - Single Match

    __SEH_epilog

   

   Library: Visual Studio */



void __SEH_epilog(void)



{

  undefined4 *unaff_EBP;

  undefined4 unaff_retaddr;

  

  ExceptionList = (void *)unaff_EBP[-4];

  *unaff_EBP = unaff_retaddr;

  return;

}





// --- _controlfp at 0x005DF826 (size: 6) ---


uint __cdecl _controlfp(uint _NewValue,uint _Mask)



{

  uint uVar1;

  

                    /* WARNING: Could not recover jumptable at 0x005df826. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  uVar1 = _controlfp(_NewValue,_Mask);

  return uVar1;

}





// --- FUN_005df840 at 0x005DF840 (size: 50) ---


void FUN_005df840(undefined4 param_1,undefined4 param_2)



{

  undefined **local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_10 = &PTR__scalar_deleting_destructor__007eaa10;

  local_c = param_1;

  local_8 = param_2;

  local_4 = 0;

                    /* WARNING: Subroutine does not return */

  _CxxThrowException(&local_10,(ThrowInfo *)&DAT_00808640);

}





// --- ~_com_error at 0x005DF8C0 (size: 38) ---


/* Library Function - Single Match

    public: virtual __thiscall _com_error::~_com_error(void)

   

   Library: Visual Studio 2003 Release */



void __thiscall _com_error::~_com_error(_com_error *this)



{

  int *piVar1;

  

  piVar1 = *(int **)(this + 8);

  *(undefined ***)this = &PTR__scalar_deleting_destructor__007eaa10;

  if (piVar1 != (int *)0x0) {

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  if (*(HLOCAL *)(this + 0xc) != (HLOCAL)0x0) {

    LocalFree(*(HLOCAL *)(this + 0xc));

  }

  return;

}





// --- `scalar_deleting_destructor' at 0x005DF8F0 (size: 58) ---


/* Library Function - Single Match

    public: virtual void * __thiscall _com_error::`scalar deleting destructor'(unsigned int)

   

   Library: Visual Studio 2003 Release */



void * __thiscall _com_error::_scalar_deleting_destructor_(_com_error *this,uint param_1)



{

  int *piVar1;

  

  piVar1 = *(int **)(this + 8);

  *(undefined ***)this = &PTR__scalar_deleting_destructor__007eaa10;

  if (piVar1 != (int *)0x0) {

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  if (*(HLOCAL *)(this + 0xc) != (HLOCAL)0x0) {

    LocalFree(*(HLOCAL *)(this + 0xc));

  }

  if ((param_1 & 1) != 0) {

    operator_delete(this);

  }

  return this;

}





// --- FUN_005df930 at 0x005DF930 (size: 37) ---


void FUN_005df930(void)



{

  FUN_00405a60("kernel32.dll","WideCharToMultiByte",&PTR_FUN_00837398,DAT_009067bc,

               FID_conflict__GodotFailWideCharToMultiByte_32);

                    /* WARNING: Could not recover jumptable at 0x005df94f. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00837398)();

  return;

}





// --- FUN_005df97a at 0x005DF97A (size: 37) ---


void FUN_005df97a(void)



{

  FUN_00405a60("kernel32.dll","GetEnvironmentVariableW",&PTR_FUN_00837384,DAT_009067b4,&LAB_00405bea

              );

                    /* WARNING: Could not recover jumptable at 0x005df999. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00837384)();

  return;

}





// --- FUN_005df9c4 at 0x005DF9C4 (size: 37) ---


void FUN_005df9c4(void)



{

  FUN_00405a60("advapi32.dll","RegQueryValueExW",&PTR_FUN_00837354,DAT_009067ac,&LAB_00405dce);

                    /* WARNING: Could not recover jumptable at 0x005df9e3. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00837354)();

  return;

}





// --- FUN_005df9e9 at 0x005DF9E9 (size: 37) ---


void FUN_005df9e9(void)



{

  FUN_00405a60("advapi32.dll","RegOpenKeyExW",&PTR_FUN_00837350,DAT_009067a8,&LAB_00405dc8);

                    /* WARNING: Could not recover jumptable at 0x005dfa08. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00837350)();

  return;

}





// --- FUN_005dfa0e at 0x005DFA0E (size: 37) ---


void FUN_005dfa0e(void)



{

  FUN_00405a60("kernel32.dll","GetProcAddress",&PTR_FUN_00837388,DAT_009067a4,&LAB_00405bf7);

                    /* WARNING: Could not recover jumptable at 0x005dfa2d. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00837388)();

  return;

}





// --- FUN_005dfa58 at 0x005DFA58 (size: 37) ---


void FUN_005dfa58(void)



{

  FUN_00405a60("user32.dll","SetWindowLongA",&PTR_FUN_008373b0,DAT_0090679c,&LAB_00405d3f);

                    /* WARNING: Could not recover jumptable at 0x005dfa77. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_008373b0)();

  return;

}





// --- FUN_005dfa7d at 0x005DFA7D (size: 37) ---


void FUN_005dfa7d(void)



{

  FUN_00405a60("user32.dll","GetClipboardData",&PTR_FUN_008373a4,DAT_00906798,&DAT_00405cc4);

                    /* WARNING: Could not recover jumptable at 0x005dfa9c. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_008373a4)();

  return;

}





// --- FUN_005dfaa2 at 0x005DFAA2 (size: 37) ---


void FUN_005dfaa2(void)



{

  FUN_00405a60("user32.dll","IsClipboardFormatAvailable",&PTR_FUN_008373a8,DAT_00906794,

               &DAT_00405ced);

                    /* WARNING: Could not recover jumptable at 0x005dfac1. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_008373a8)();

  return;

}





// --- FUN_005dfac7 at 0x005DFAC7 (size: 37) ---


void FUN_005dfac7(void)



{

  FUN_00405a60("user32.dll","MessageBoxW",&PTR_FUN_008373ac,DAT_00906790,&LAB_00405d16);

                    /* WARNING: Could not recover jumptable at 0x005dfae6. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_008373ac)();

  return;

}





// --- VerQueryValueA at 0x005DFB12 (size: 6) ---


BOOL VerQueryValueA(LPCVOID pBlock,LPCSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen)



{

  BOOL BVar1;

  

                    /* WARNING: Could not recover jumptable at 0x005dfb12. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  BVar1 = VerQueryValueA(pBlock,lpSubBlock,lplpBuffer,puLen);

  return BVar1;

}





// --- GetFileVersionInfoA at 0x005DFB18 (size: 6) ---


BOOL GetFileVersionInfoA(LPCSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData)



{

  BOOL BVar1;

  

                    /* WARNING: Could not recover jumptable at 0x005dfb18. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  BVar1 = GetFileVersionInfoA(lptstrFilename,dwHandle,dwLen,lpData);

  return BVar1;

}





// --- GetFileVersionInfoSizeA at 0x005DFB1E (size: 6) ---


DWORD GetFileVersionInfoSizeA(LPCSTR lptstrFilename,LPDWORD lpdwHandle)



{

  DWORD DVar1;

  

                    /* WARNING: Could not recover jumptable at 0x005dfb1e. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  DVar1 = GetFileVersionInfoSizeA(lptstrFilename,lpdwHandle);

  return DVar1;

}





// --- acmStreamUnprepareHeader at 0x005DFB24 (size: 6) ---


void acmStreamUnprepareHeader(void)



{

                    /* WARNING: Could not recover jumptable at 0x005dfb24. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  acmStreamUnprepareHeader();

  return;

}





// --- acmStreamConvert at 0x005DFB2A (size: 6) ---


void acmStreamConvert(void)



{

                    /* WARNING: Could not recover jumptable at 0x005dfb2a. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  acmStreamConvert();

  return;

}





// --- acmStreamPrepareHeader at 0x005DFB30 (size: 6) ---


void acmStreamPrepareHeader(void)



{

                    /* WARNING: Could not recover jumptable at 0x005dfb30. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  acmStreamPrepareHeader();

  return;

}





// --- acmStreamClose at 0x005DFB36 (size: 6) ---


void acmStreamClose(void)



{

                    /* WARNING: Could not recover jumptable at 0x005dfb36. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  acmStreamClose();

  return;

}





// --- acmStreamSize at 0x005DFB3C (size: 6) ---


void acmStreamSize(void)



{

                    /* WARNING: Could not recover jumptable at 0x005dfb3c. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  acmStreamSize();

  return;

}





// --- acmStreamOpen at 0x005DFB42 (size: 6) ---


void acmStreamOpen(void)



{

                    /* WARNING: Could not recover jumptable at 0x005dfb42. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  acmStreamOpen();

  return;

}





// --- DirectSoundCreate at 0x005DFB48 (size: 6) ---


void DirectSoundCreate(void)



{

                    /* WARNING: Could not recover jumptable at 0x005dfb48. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  DirectSoundCreate();

  return;

}





// --- FUN_005dfb4e at 0x005DFB4E (size: 232) ---


int FUN_005dfb4e(int param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,

                undefined4 param_6,undefined4 param_7,undefined4 *param_8,int param_9,

                undefined4 param_10)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  undefined1 local_cc [72];

  undefined4 local_84;

  int local_64;

  undefined4 local_60;

  undefined4 local_5c;

  undefined4 local_58;

  undefined4 local_54 [4];

  undefined4 local_44;

  undefined4 local_40;

  undefined4 local_3c [8];

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  

  FUN_005efcf7();

  FUN_005f3682();

  if (param_1 == 0) {

    iVar2 = -0x7789f794;

  }

  else if ((param_4 == 0) || (param_8 == (undefined4 *)0x0)) {

    iVar2 = -0x7789f794;

  }

  else {

    if (param_9 == -1) {

      param_9 = 0x80004;

    }

    iVar1 = FUN_005f3856(local_cc,param_1,param_2,param_3,0,0);

    if (-1 < iVar1) {

      local_60 = param_5;

      local_5c = param_6;

      local_64 = param_4;

      local_58 = 0;

      local_54[0] = *param_8;

      local_54[1] = param_8[1];

      local_54[2] = param_8[2];

      local_54[3] = param_8[3];

      local_44 = 0;

      local_40 = 1;

      puVar3 = local_54;

      puVar4 = local_3c;

      for (iVar2 = 6; iVar2 != 0; iVar2 = iVar2 + -1) {

        *puVar4 = *puVar3;

        puVar3 = puVar3 + 1;

        puVar4 = puVar4 + 1;

      }

      local_1c = local_84;

      local_18 = param_10;

      local_14 = param_7;

      iVar1 = FUN_005f3545(local_cc,&local_64,param_9);

      iVar2 = 0;

      if (-1 < iVar1) goto LAB_005dfc1f;

    }

    iVar2 = iVar1;

  }

LAB_005dfc1f:

  thunk_FUN_005f3774();

  FUN_005efd01();

  return iVar2;

}





// --- FUN_005dfc36 at 0x005DFC36 (size: 220) ---


int FUN_005dfc36(int param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,

                undefined4 param_6,undefined4 param_7,undefined4 param_8,undefined4 *param_9,

                int param_10,undefined4 param_11)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  undefined1 local_bc [72];

  undefined4 local_74;

  int local_68;

  undefined4 local_64;

  undefined4 local_60;

  undefined4 local_5c;

  undefined4 local_58 [6];

  undefined4 local_40 [8];

  undefined4 local_20;

  undefined4 local_1c;

  undefined4 local_18;

  

  FUN_005efcf7();

  FUN_005f3827();

  if (((param_1 == 0) || (param_4 == 0)) || (param_9 == (undefined4 *)0x0)) {

    iVar1 = -0x7789f794;

  }

  else {

    if (param_10 == -1) {

      param_10 = 0x80004;

    }

    iVar1 = FUN_005f3d4a(local_bc,param_1,param_2,param_3,0,0);

    if (-1 < iVar1) {

      local_64 = param_5;

      local_60 = param_6;

      local_5c = param_7;

      local_68 = param_4;

      puVar2 = param_9;

      puVar3 = local_58;

      for (iVar1 = 6; iVar1 != 0; iVar1 = iVar1 + -1) {

        *puVar3 = *puVar2;

        puVar2 = puVar2 + 1;

        puVar3 = puVar3 + 1;

      }

      puVar2 = local_40;

      for (iVar1 = 6; iVar1 != 0; iVar1 = iVar1 + -1) {

        *puVar2 = *param_9;

        param_9 = param_9 + 1;

        puVar2 = puVar2 + 1;

      }

      local_20 = local_74;

      local_1c = param_11;

      local_18 = param_8;

      iVar1 = FUN_005f3545(local_bc,&local_68,param_10);

      if (-1 < iVar1) {

        iVar1 = 0;

      }

    }

  }

  thunk_FUN_005f382d();

  FUN_005efd01();

  return iVar1;

}





// --- FUN_005dfd12 at 0x005DFD12 (size: 532) ---


int FUN_005dfd12(int *param_1,int *param_2,int *param_3,int *param_4,int *param_5,int *param_6,

                uint param_7,int param_8)



{

  int *piVar1;

  undefined4 uVar2;

  int iVar3;

  int *piVar4;

  int *piVar5;

  bool bVar6;

  undefined4 local_cc;

  undefined4 local_c8;

  undefined4 local_c4;

  undefined1 local_a4 [64];

  undefined1 local_64 [12];

  int local_58;

  int local_4c;

  int local_48;

  undefined1 local_44 [12];

  int local_38;

  int local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  

  FUN_005f3682();

  piVar1 = param_4;

  if (param_1 == (int *)0x0) {

    iVar3 = -0x7789f794;

    goto LAB_005dff17;

  }

  if (param_4 == (int *)0x0) {

    iVar3 = -0x7789f794;

    goto LAB_005dff17;

  }

  (**(code **)(*param_1 + 0x30))(param_1,local_64);

  (**(code **)(*piVar1 + 0x30))(piVar1,local_44);

  if (((param_7 & 0xffff) == 5) || (param_8 != 0)) {

LAB_005dfe7d:

    uVar2 = 1;

    if (param_1 == piVar1) {

      uVar2 = 0x10001;

    }

    iVar3 = FUN_005f3856(&local_cc,piVar1,param_5,param_6,0,uVar2);

    if ((iVar3 < 0) ||

       (iVar3 = FUN_005dfb4e(param_1,param_2,param_3,local_cc,local_c8,local_c4,param_5,local_a4,

                             param_7,param_8), iVar3 < 0)) goto LAB_005dff17;

    if ((local_38 == 0) && (local_58 != 0)) {

      (**(code **)(*piVar1 + 0xc))(piVar1,&param_1);

      iVar3 = (**(code **)(*param_1 + 0xc))(param_1);

      (**(code **)(*param_1 + 8))(param_1);

      if (iVar3 != 0) {

        iVar3 = -0x7789f798;

        goto LAB_005dff17;

      }

    }

  }

  else {

    if (param_2 != param_5) {

      if ((param_2 != (int *)0x0) && (param_5 != (int *)0x0)) {

        iVar3 = 0x100;

        bVar6 = true;

        piVar4 = param_2;

        piVar5 = param_5;

        do {

          if (iVar3 == 0) break;

          iVar3 = iVar3 + -1;

          bVar6 = *piVar4 == *piVar5;

          piVar4 = piVar4 + 1;

          piVar5 = piVar5 + 1;

        } while (bVar6);

        if (bVar6) goto LAB_005dfda2;

      }

      goto LAB_005dfe7d;

    }

LAB_005dfda2:

    if (param_3 == (int *)0x0) {

      local_14 = 0;

      local_10 = 0;

      local_c = local_4c;

      local_8 = local_48;

    }

    else {

      local_14 = *param_3;

      local_10 = param_3[1];

      local_c = param_3[2];

      local_8 = param_3[3];

    }

    if (param_6 == (int *)0x0) {

      local_24 = 0;

      local_20 = 0;

      local_1c = local_2c;

      local_18 = local_28;

    }

    else {

      local_24 = *param_6;

      local_20 = param_6[1];

      local_1c = param_6[2];

      local_18 = param_6[3];

    }

    if ((local_c - local_14 != local_1c - local_24) || (local_8 - local_10 != local_18 - local_20))

    goto LAB_005dfe7d;

    (**(code **)(*piVar1 + 0xc))(piVar1,&param_4);

    FUN_005efb7f(1);

    iVar3 = -0x7fffbffb;

    if (local_58 == 0) {

      if (local_38 == 0) {

        iVar3 = (**(code **)(*param_4 + 0x88))(param_4,piVar1,&local_24,param_1,&local_14,0);

      }

      else if (local_38 == 2) {

        iVar3 = (**(code **)(*param_4 + 0x78))(param_4,piVar1,&local_24,param_1,&local_14);

      }

    }

    FUN_005efb7f(0);

    (**(code **)(*param_4 + 8))(param_4);

    if (iVar3 < 0) goto LAB_005dfe7d;

  }

  iVar3 = 0;

LAB_005dff17:

  thunk_FUN_005f3774();

  return iVar3;

}





// --- FUN_005dff26 at 0x005DFF26 (size: 136) ---


int FUN_005dff26(int param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,

                undefined4 param_6,undefined4 param_7,undefined4 param_8)



{

  undefined4 uVar1;

  int iVar2;

  int iVar3;

  undefined4 local_5c;

  undefined4 local_58;

  undefined4 local_54;

  undefined4 local_50;

  undefined1 local_34 [48];

  

  FUN_005f3827();

  if ((param_1 == 0) || (param_4 == 0)) {

    iVar3 = -0x7789f794;

  }

  else {

    uVar1 = 1;

    if (param_1 == param_4) {

      uVar1 = 0x10001;

    }

    iVar2 = FUN_005f3d4a(&local_5c,param_4,param_5,param_6,0,uVar1);

    if (-1 < iVar2) {

      iVar2 = FUN_005dfc36(param_1,param_2,param_3,local_5c,local_58,local_54,local_50,param_5,

                           local_34,param_7,param_8);

      iVar3 = 0;

      if (-1 < iVar2) goto LAB_005dff9f;

    }

    iVar3 = iVar2;

  }

LAB_005dff9f:

  thunk_FUN_005f382d();

  return iVar3;

}





// --- FUN_005dffae at 0x005DFFAE (size: 754) ---


uint FUN_005dffae(int *param_1,undefined4 param_2,uint param_3,uint param_4)



{

  int *piVar1;

  uint uVar2;

  int **ppiVar3;

  uint uVar4;

  bool bVar5;

  undefined1 local_64 [24];

  uint local_4c;

  uint local_48;

  undefined1 local_44 [16];

  uint local_34;

  uint local_30;

  uint local_2c;

  uint local_28;

  uint local_24;

  int local_20;

  int *local_1c;

  uint local_18;

  int local_14;

  int *local_10;

  int *local_c;

  int *local_8;

  

  piVar1 = param_1;

  if ((param_1 == (int *)0x0) ||

     (((local_14 = (**(code **)(*param_1 + 0x28))(param_1), local_14 != 3 && (local_14 != 4)) &&

      (local_14 != 5)))) {

    return 0x8876086c;

  }

  local_1c = piVar1;

  uVar2 = 5;

  if (param_4 != 0xffffffff) goto LAB_005e004e;

  if (local_14 == 3) {

    (**(code **)(*piVar1 + 0x44))(piVar1,0,local_64);

    if (((local_4c & local_4c - 1) == 0) && (param_4 = uVar2, (local_48 & local_48 - 1) == 0))

    goto LAB_005e004e;

    param_4 = 0;

LAB_005e0088:

    bVar5 = param_4 != 0;

    param_4 = uVar2;

    if (bVar5) goto LAB_005e004e;

  }

  else {

    if (local_14 == 4) {

      (**(code **)(*piVar1 + 0x44))(piVar1,0,local_44);

      if ((local_34 & local_34 - 1) != 0) goto LAB_005e0047;

      local_4c = local_30 & local_30 - 1;

    }

    else {

      if (local_14 != 5) goto LAB_005e0088;

      (**(code **)(*piVar1 + 0x44))(piVar1,0,local_64);

      local_4c = local_4c & local_4c - 1;

      local_2c = local_48;

    }

    if ((local_4c == 0) && (param_4 = uVar2, (local_2c & local_2c - 1) == 0)) goto LAB_005e004e;

  }

LAB_005e0047:

  param_4 = 0x80004;

LAB_005e004e:

  if (local_14 == 5) {

    param_4 = param_4 | 0x70000;

  }

  if ((param_4 & 0x400000) == 0) {

    param_4 = param_4 & 0xff9fffff;

  }

  else {

    param_4 = param_4 | 0x600000;

  }

  local_24 = (**(code **)(*piVar1 + 0x34))(piVar1);

  if (param_3 == 0xffffffff) {

    param_3 = 0;

  }

  if (param_3 < local_24) {

    param_1 = (int *)0x0;

    local_c = (int *)0x0;

    local_8 = (int *)0x0;

    local_10 = (int *)0x0;

    local_28 = ((local_14 != 5) - 1 & 5) + 1;

    if (((param_4 & 0xff) == 2) || (local_20 = 0, (param_4 & 0xff) == 5)) {

      local_20 = 1;

    }

    local_18 = 0;

    uVar2 = param_4;

    if (local_28 != 0) {

      do {

        if (local_14 == 3) {

          ppiVar3 = &param_1;

LAB_005e0127:

          uVar2 = (**(code **)(*local_1c + 0x48))(local_1c,param_3,ppiVar3);

        }

        else {

          if (local_14 == 4) {

            ppiVar3 = &local_c;

            goto LAB_005e0127;

          }

          if (local_14 == 5) {

            uVar2 = (**(code **)(*local_1c + 0x48))(local_1c,local_18,param_3,&param_1);

          }

        }

        uVar4 = param_3;

        if ((int)uVar2 < 0) goto LAB_005e025a;

LAB_005e021f:

        uVar4 = uVar4 + 1;

        if (uVar4 < local_24) {

          if (local_14 == 3) {

            ppiVar3 = &local_8;

LAB_005e016f:

            uVar2 = (**(code **)(*local_1c + 0x48))(local_1c,uVar4,ppiVar3);

          }

          else {

            if (local_14 == 4) {

              ppiVar3 = &local_10;

              goto LAB_005e016f;

            }

            if (local_14 == 5) {

              uVar2 = (**(code **)(*local_1c + 0x48))(local_1c,local_18,uVar4,&local_8);

            }

          }

          if (-1 < (int)uVar2) {

            if (local_14 == 3) {

LAB_005e0192:

              uVar2 = FUN_005dfd12(local_8,param_2,0,param_1,param_2,0,param_4,0);

            }

            else if (local_14 == 4) {

              uVar2 = FUN_005dff26(local_10,param_2,0,local_c,param_2,0,param_4,0);

            }

            else if (local_14 == 5) goto LAB_005e0192;

            if (-1 < (int)uVar2) {

              if (local_20 == 0) goto LAB_005e01ff;

              if (param_1 != (int *)0x0) {

                (**(code **)(*param_1 + 8))(param_1);

                param_1 = (int *)0x0;

              }

              if (local_c != (int *)0x0) {

                (**(code **)(*local_c + 8))(local_c);

              }

              param_1 = local_8;

              local_8 = (int *)0x0;

              local_c = local_10;

              goto LAB_005e021c;

            }

          }

          goto LAB_005e025a;

        }

        if (param_1 != (int *)0x0) {

          (**(code **)(*param_1 + 8))(param_1);

          param_1 = (int *)0x0;

        }

        if (local_c != (int *)0x0) {

          (**(code **)(*local_c + 8))(local_c);

          local_c = (int *)0x0;

        }

        local_18 = local_18 + 1;

      } while (local_18 < local_28);

    }

    uVar2 = 0;

LAB_005e025a:

    if (param_1 != (int *)0x0) {

      (**(code **)(*param_1 + 8))(param_1);

      param_1 = (int *)0x0;

    }

    if (local_c != (int *)0x0) {

      (**(code **)(*local_c + 8))(local_c);

      local_c = (int *)0x0;

    }

    if (local_8 != (int *)0x0) {

      (**(code **)(*local_8 + 8))(local_8);

      local_8 = (int *)0x0;

    }

    if (local_10 != (int *)0x0) {

      (**(code **)(*local_10 + 8))(local_10);

    }

  }

  else {

    uVar2 = 0x8876086c;

  }

  return uVar2;

LAB_005e01ff:

  if (local_8 != (int *)0x0) {

    (**(code **)(*local_8 + 8))(local_8);

    local_8 = (int *)0x0;

  }

  if (local_10 != (int *)0x0) {

    (**(code **)(*local_10 + 8))(local_10);

LAB_005e021c:

    local_10 = (int *)0x0;

  }

  goto LAB_005e021f;

}





