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

// --- FUN_005a0080 at 0x005A0080 (size: 49) ---


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



{

  *param_1 = &PTR_FUN_007e6888;

  FUN_00698e10();

  *param_1 = &PTR_FUN_0079c26c;

  FUN_0044ca90();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005a00c0 at 0x005A00C0 (size: 263) ---


undefined4 __fastcall FUN_005a00c0(int param_1)



{

  int iVar1;

  

  iVar1 = FUN_005df0f5(0x7c);

  if (iVar1 == 0) {

    DAT_008ee3cc = 0;

    return 0;

  }

  DAT_008ee3cc = FUN_005a6380(1);

  if (DAT_008ee3cc != 0) {

    iVar1 = FUN_005df0f5(0x7c);

    if (iVar1 == 0) {

      DAT_008ee3d0 = 0;

      return 0;

    }

    DAT_008ee3d0 = FUN_005a6380(0);

    if (DAT_008ee3d0 != 0) {

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

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

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

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

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

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

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

      *(undefined4 *)(param_1 + 0x79c) = 0x3f800000;

      *(undefined4 *)(param_1 + 0x7a0) = 0x3f800000;

      *(undefined4 *)(param_1 + 0x7a4) = 0x3f800000;

      *(undefined4 *)(param_1 + 0x7a8) = 0x3f800000;

      *(undefined4 *)(param_1 + 0x7ac) = 0x3f800000;

      *(undefined4 *)(param_1 + 0x7b0) = 0x3f800000;

      *(undefined4 *)(param_1 + 0x7b4) = 0x3f800000;

      *(undefined4 *)(param_1 + 0x7b8) = 0x3f800000;

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

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

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

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

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

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

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

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

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

      *(undefined4 *)(param_1 + 0x7f0) = 0xff000000;

      return 1;

    }

  }

  return 0;

}





// --- FUN_005a0280 at 0x005A0280 (size: 293) ---


void FUN_005a0280(int param_1)



{

  char cVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  

  cVar1 = FUN_0052ccd0();

  if (cVar1 == '\0') {

    FUN_0052ccf0();

    FUN_0054c5c0();

    if (DAT_008ee53c == 0) {

      iVar2 = FUN_0053a540();

      FUN_0054cd80(param_1 + 0x54,*(undefined4 *)(iVar2 + 0xc));

    }

    DAT_00867374 = DAT_0086736c;

    DAT_0081fcc8 = DAT_0081fcbc;

    DAT_0081fcb0 = 9;

    DAT_0081fcb4 = 6;

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

      FUN_0059e0f0(*(undefined4 *)(param_1 + 0x128),param_1 + 0x54);

      FUN_0059e5b0(*(undefined4 *)(param_1 + 0xf8),*(undefined4 *)(param_1 + 0xfc),

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

      DAT_00867374 = 0;

      return;

    }

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

    uVar3 = 0;

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

      iVar4 = 0;

      do {

        *DAT_008672e8 = *(int *)(iVar2 + 0x40) + iVar4;

        DAT_008672e8[1] = -1;

        DAT_008672e8 = DAT_008672e8 + 2;

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

        uVar3 = uVar3 + 1;

        iVar4 = iVar4 + 0x30;

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

    }

    (**(code **)(*DAT_0086734c + 0x40))();

    DAT_008672e8 = &DAT_008471c8;

    DAT_00867374 = 0;

  }

  return;

}





// --- FUN_005a0470 at 0x005A0470 (size: 166) ---


undefined4 FUN_005a0470(int param_1,char param_2)



{

  undefined4 uVar1;

  char cVar2;

  

  if (((param_2 == '\0') && (DAT_008ee3d8 != 0)) && (cVar2 = FUN_0050df80(), cVar2 == '\0')) {

    cVar2 = FUN_0050dfa0();

    if (cVar2 != '\0') {

      return 2;

    }

    FUN_0050dfc0();

  }

  if (DAT_00867344 == 0) {

    FUN_0054e090();

  }

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

    if (param_2 != '\0') {

      FUN_0054c5c0();

      uVar1 = DAT_00821e54;

      DAT_00821e54 = DAT_008672ec;

      FUN_0053a5c0(1);

      FUN_0053a5c0(2);

      DAT_00821e54 = uVar1;

      return 2;

    }

    FUN_0059e8a0(param_1,*(undefined4 *)(param_1 + 0x6c));

  }

  return 2;

}





// --- FUN_005a05a0 at 0x005A05A0 (size: 51) ---


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



{

  int iVar1;

  

  iVar1 = FUN_00698740();

  if (iVar1 != 0) {

    (**(code **)(**(int **)(param_1 + 0x468) + 400))

              (*(int **)(param_1 + 0x468),param_2,iVar1,0,*(undefined4 *)(param_3 + 0x34));

  }

  return;

}





// --- FUN_005a05e0 at 0x005A05E0 (size: 37) ---


undefined4 __fastcall FUN_005a05e0(int param_1)



{

  int iVar1;

  

  iVar1 = (**(code **)(**(int **)(param_1 + 0x468) + 0xc))(*(int **)(param_1 + 0x468));

  if (iVar1 == -0x7789f798) {

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

    return 0;

  }

  return 1;

}





// --- FUN_005a0610 at 0x005A0610 (size: 30) ---


void FUN_005a0610(undefined4 *param_1)



{

  (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x164))(*(int **)(DAT_00870340 + 0x468),*param_1);

  return;

}





// --- FUN_005a0630 at 0x005A0630 (size: 455) ---


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



undefined4 __fastcall FUN_005a0630(int param_1)



{

  uint uVar1;

  uint uVar2;

  bool bVar3;

  byte bVar4;

  undefined1 uVar5;

  undefined3 uVar6;

  undefined1 local_44c [1032];

  uint uStack_44;

  

  (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x14))

            (*(int **)(DAT_0086734c + 0x1c),*(undefined4 *)(param_1 + 0x304),0,local_44c);

  (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x38))

            (*(int **)(DAT_0086734c + 0x1c),*(undefined4 *)(param_1 + 0x304),

             *(undefined4 *)(param_1 + 0x308),param_1 + 0x30c);

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

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

  *(uint *)(param_1 + 0x30) = *(uint *)(param_1 + 0x3a4);

  *(uint *)(param_1 + 0x34) = *(uint *)(param_1 + 0x3a0);

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

  *(uint *)(param_1 + 0x3c) = *(uint *)(param_1 + 0x3ac);

  *(undefined4 *)(param_1 + 0x40) = *(undefined4 *)(param_1 + 0x3b0);

  if (8 < *(uint *)(param_1 + 0x3ac)) {

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

  }

  uVar1 = *(uint *)(param_1 + 0x39c);

  *(byte *)(param_1 + 0x45) = (byte)(uVar1 >> 0x17) & 1;

  *(byte *)(param_1 + 0x46) = (byte)(uVar1 >> 0x15) & 1;

  if (((*(byte *)(param_1 + 0x31c) & 0x20) == 0) || (-1 < *(char *)(param_1 + 0x32c))) {

    uVar5 = 0;

  }

  else {

    uVar5 = 1;

  }

  *(undefined1 *)(param_1 + 0x47) = uVar5;

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

  bVar3 = _DAT_007e6898 <= *(float *)(param_1 + 0x3bc);

  *(byte *)(param_1 + 0x48) = (byte)(uVar2 >> 5) & 1;

  *(byte *)(param_1 + 0x4a) = (byte)(uVar2 >> 0xb) & 1;

  *(byte *)(param_1 + 0x49) = (byte)(uVar2 >> 0xd) & 1;

  *(byte *)(param_1 + 0x4b) = (byte)(*(uint *)(param_1 + 0x32c) >> 7) & 1;

  *(byte *)(param_1 + 0x4c) = *(byte *)(param_1 + 0x32a) & 1;

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

  *(bool *)(param_1 + 0x4f) = bVar3;

  bVar4 = (byte)((uint)*(undefined4 *)(param_1 + 0x318) >> 0x18);

  *(byte *)(param_1 + 0x51) = bVar4 >> 5 & 1;

  *(byte *)(param_1 + 0x53) = (byte)(*(uint *)(param_1 + 0x32c) >> 0xb) & 1;

  *(byte *)(param_1 + 0x52) = (byte)((uint)*(undefined4 *)(param_1 + 0x330) >> 0x19) & 1;

  *(byte *)(param_1 + 0x50) = bVar4 >> 6 & 1;

  *(byte *)(param_1 + 0x54) = (byte)((uint)*(undefined4 *)(param_1 + 0x394) >> 8) & 1;

  if ((uStack_44 == 0x10de) && (uStack_44 = *(uint *)(param_1 + 0x3d8), (uStack_44 & 0xf00) == 0)) {

    uStack_44 = CONCAT31((int3)(uStack_44 >> 8),1);

    bVar3 = true;

  }

  else {

    uStack_44 = uStack_44 & 0xffffff00;

    bVar3 = false;

  }

  uVar6 = (undefined3)(uStack_44 >> 8);

  if ((((1 < *(uint *)(param_1 + 0x3a4)) && (1 < *(uint *)(param_1 + 0x3a0))) &&

      ((char)(uVar1 >> 8) < '\0')) && (((uVar1 & 0x10000) != 0 && (!bVar3)))) {

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

    return CONCAT31(uVar6,1);

  }

  return CONCAT31(uVar6,1);

}





// --- FUN_005a0880 at 0x005A0880 (size: 210) ---


undefined4 __thiscall

FUN_005a0880(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,char param_5,

            int param_6,uint param_7)



{

  int iVar1;

  uint uVar2;

  undefined4 uVar3;

  

  uVar2 = 0;

  if (param_7 != 0) {

    do {

      switch(*(undefined1 *)(param_6 + uVar2)) {

      case 0:

        if (param_5 != '\0') {

          uVar3 = 0x14;

          break;

        }

        goto switchD_005a08b1_default;

      case 1:

        if (param_5 != '\0') {

          uVar3 = 0x15;

          break;

        }

        goto switchD_005a08b1_default;

      case 2:

        if (param_5 != '\0') {

          uVar3 = 0x16;

          break;

        }

        goto switchD_005a08b1_default;

      case 3:

        uVar3 = 0x17;

        break;

      case 4:

        uVar3 = 0x18;

        break;

      case 5:

        uVar3 = 0x19;

        break;

      case 6:

        uVar3 = 0x1a;

        break;

      case 7:

        uVar3 = 0x1e;

        break;

      case 8:

        uVar3 = 0x1d;

        break;

      case 9:

        uVar3 = 0x1c;

        break;

      default:

        goto switchD_005a08b1_default;

      }

      iVar1 = (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x28))

                        (*(int **)(DAT_0086734c + 0x1c),*(undefined4 *)(param_1 + 0x304),

                         *(undefined4 *)(param_1 + 0x308),param_2,param_3,param_4,uVar3);

      if (iVar1 == 0) {

        return uVar3;

      }

switchD_005a08b1_default:

      uVar2 = uVar2 + 1;

    } while (uVar2 < param_7);

  }

  return 0;

}





// --- FUN_005a0980 at 0x005A0980 (size: 565) ---


undefined4 __thiscall FUN_005a0980(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  undefined1 local_90;

  undefined1 local_8f;

  undefined1 local_8e;

  undefined1 local_8d;

  undefined1 local_8c;

  undefined1 local_8b;

  undefined1 local_8a;

  undefined1 local_89;

  undefined1 local_88;

  undefined1 local_84;

  undefined1 local_83;

  undefined1 local_82;

  undefined1 local_81;

  undefined1 local_80;

  undefined1 local_7f;

  undefined1 local_7e;

  undefined1 local_7d;

  undefined1 local_7c;

  undefined1 local_78;

  undefined1 local_77;

  undefined1 local_76;

  undefined1 local_75;

  undefined1 local_74;

  int local_70;

  char local_64;

  char local_50;

  char local_4f;

  char local_4e;

  int local_38;

  char local_2c;

  char local_18;

  char local_17;

  char local_16;

  

  local_7c = 8;

  local_8e = 8;

  local_76 = 8;

  local_7e = 6;

  local_8f = 6;

  local_75 = 6;

  local_84 = 0;

  local_83 = 2;

  local_82 = 1;

  local_81 = 3;

  local_80 = 4;

  local_7f = 5;

  local_7d = 7;

  local_90 = 1;

  local_8d = 5;

  local_8c = 0;

  local_8b = 2;

  local_8a = 3;

  local_89 = 4;

  local_88 = 7;

  local_78 = 9;

  local_77 = 1;

  local_74 = 5;

  uVar1 = FUN_005a0880(param_2,1,3,1,&local_84,9);

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

  uVar1 = FUN_005a0880(param_2,0,3,1,&local_84,9);

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

  uVar1 = FUN_005a0880(param_2,0,3,1,&local_90,9);

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

  FUN_00535a80();

  FUN_00535a80();

  FUN_0043d290(*(undefined4 *)(param_1 + 0x68));

  FUN_0043d290(*(undefined4 *)(param_1 + 0x6c));

  if ((((local_70 != local_38) && (local_64 == local_2c)) && (local_50 == local_18)) &&

     ((local_4f == local_17 && (local_4e == local_16)))) {

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

  }

  uVar1 = FUN_005a0880(param_2,0,3,1,&local_78,5);

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

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

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

  *(undefined4 *)(param_1 + 0x78) = *(undefined4 *)(param_1 + 0x6c);

  uVar1 = FUN_005a0880(param_2,0,3,0,&local_84,9);

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

  uVar1 = FUN_005a0880(param_2,0,3,0,&local_90,9);

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

  FUN_00535a80();

  FUN_00535a80();

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

  FUN_0043d290(*(undefined4 *)(param_1 + 0x84));

  if (((local_38 != local_70) && (local_2c == local_64)) &&

     ((local_18 == local_50 && ((local_17 == local_4f && (local_16 == local_4e)))))) {

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

  }

  uVar1 = FUN_005a0880(param_2,0,3,0,&local_90,9);

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

  return 1;

}





// --- FUN_005a0bc0 at 0x005A0BC0 (size: 182) ---


bool __thiscall FUN_005a0bc0(int param_1,int param_2)



{

  uint uVar1;

  int unaff_EBX;

  int unaff_EBP;

  uint uVar2;

  uint *unaff_retaddr;

  uint uStack_14;

  int iStack_10;

  bool bStack_8;

  uint uStack_4;

  

  uVar1 = (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x18))

                    (*(int **)(DAT_0086734c + 0x1c),*(undefined4 *)(param_1 + 0x304),param_2);

  bStack_8 = *(char *)(param_1 + 0x10) == '\0';

  uVar2 = 0;

  *unaff_retaddr = 0;

  if (uVar1 != 0) {

    do {

      (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x1c))

                (*(int **)(DAT_0086734c + 0x1c),*(undefined4 *)(param_1 + 0x304),param_2,uVar2,

                 &stack0xffffffe4);

      if ((((iStack_10 == param_2) && (*(char *)(param_1 + 0x10) != '\0')) &&

          (unaff_EBP == *(int *)(param_1 + 8))) && (unaff_EBX == *(int *)(param_1 + 0xc))) {

        bStack_8 = true;

        if ((*unaff_retaddr < uStack_14) && (uStack_14 <= uStack_4)) {

          *unaff_retaddr = uStack_14;

        }

      }

      uVar2 = uVar2 + 1;

    } while (uVar2 < uVar1);

    return bStack_8;

  }

  return bStack_8;

}





// --- FUN_005a0c80 at 0x005A0C80 (size: 88) ---


void __fastcall FUN_005a0c80(int param_1)



{

  int *piVar1;

  

  FUN_0054fcc0();

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

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

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

  return;

}





// --- FUN_005a0ce0 at 0x005A0CE0 (size: 114) ---


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



void __fastcall FUN_005a0ce0(int param_1)



{

  float fVar1;

  float fVar2;

  int iVar3;

  

  if (DAT_0081ffb8 == 1) {

    *(undefined4 *)(param_1 + 0xa4) = 0x3faaaaab;

    return;

  }

  if (DAT_0081ffb8 != 2) {

    iVar3 = FUN_0054fd20();

    fVar1 = (float)iVar3;

    if (iVar3 < 0) {

      fVar1 = fVar1 + _DAT_0079920c;

    }

    iVar3 = FUN_0054fd30();

    fVar2 = (float)iVar3;

    if (iVar3 < 0) {

      fVar2 = fVar2 + _DAT_0079920c;

    }

    *(float *)(param_1 + 0xa4) = fVar1 / fVar2;

    return;

  }

  *(undefined4 *)(param_1 + 0xa4) = 0x3fe38e39;

  return;

}





// --- FUN_005a0d60 at 0x005A0D60 (size: 34) ---


void FUN_005a0d60(undefined4 param_1)



{

  int iVar1;

  

  iVar1 = 0xf;

  do {

    FUN_005a4520(iVar1,param_1);

    iVar1 = iVar1 + -1;

  } while (-1 < iVar1);

  return;

}





// --- FUN_005a0e10 at 0x005A0E10 (size: 37) ---


void __fastcall FUN_005a0e10(int param_1)



{

  if (*(char *)(param_1 + 0xac) != '\0') {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xa8))(*(int **)(param_1 + 0x468));

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

  }

  return;

}





// --- FUN_005a0f60 at 0x005A0F60 (size: 129) ---


void __fastcall FUN_005a0f60(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  

  iVar3 = 0;

  iVar2 = 0;

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

    iVar3 = param_1 + 0x43c;

    iVar2 = param_1 + 0x44c;

  }

  do {

    iVar1 = (**(code **)(**(int **)(param_1 + 0x46c) + 0xc))

                      (*(int **)(param_1 + 0x46c),iVar3,iVar2,*(undefined4 *)(param_1 + 0x45c),0,1);

  } while (iVar1 == -0x7789fde4);

  if (iVar1 == -0x7789f798) {

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

  }

  uVar4 = 0;

  do {

    FUN_005a47d0(uVar4,0);

    uVar4 = uVar4 + 1;

  } while (uVar4 < 8);

  FUN_0059ece0();

  FUN_005de390();

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

  return;

}





// --- FUN_005a0ff0 at 0x005A0FF0 (size: 136) ---


void __thiscall FUN_005a0ff0(int param_1,int param_2,char param_3)



{

  int *piVar1;

  

  if ((param_2 != *(int *)(param_1 + 0x7e4)) || (param_3 != '\0')) {

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

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

    if (param_2 != 0) {

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

      *(bool *)(param_1 + 0x794) = *(int *)(param_2 + 8) != 0;

      FUN_005a3ef0(0);

      FUN_005a3f40(0);

      return;

    }

    (**(code **)(*piVar1 + 0xc4))(piVar1,param_1 + 0x79c);

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

    FUN_005a3ef0(1);

    FUN_005a3f40(1);

  }

  return;

}





// --- FUN_005a1080 at 0x005A1080 (size: 106) ---


uint __thiscall FUN_005a1080(int param_1,int param_2,char param_3)



{

  int *piVar1;

  undefined3 uVar3;

  uint uVar2;

  undefined3 extraout_var;

  int *piVar4;

  undefined1 local_8 [8];

  

  if ((*(int *)(param_1 + 0x7f0) == param_2) &&

     (uVar3 = (undefined3)((uint)*(int *)(param_1 + 0x7f0) >> 8), param_3 == '\0')) {

LAB_005a10e0:

    return CONCAT31(uVar3,1);

  }

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

  uVar2 = 0;

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

    piVar4 = (int *)0x0;

    uVar2 = (**(code **)(*piVar1 + 0x4c))(piVar1,0,local_8,0,0);

    if (-1 < (int)uVar2) {

      *piVar4 = param_2;

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

      (**(code **)(**(int **)(param_1 + 0x7ec) + 0x50))(*(int **)(param_1 + 0x7ec),0);

      uVar3 = extraout_var;

      goto LAB_005a10e0;

    }

  }

  return uVar2 & 0xffffff00;

}





// --- FUN_005a10f0 at 0x005A10F0 (size: 354) ---


undefined4 __fastcall FUN_005a10f0(int param_1)



{

  uint uVar1;

  

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

  FUN_005a3ba0(0);

  FUN_005a3be0(0);

  FUN_005a3c20(7);

  FUN_005a3c60(1);

  FUN_005a3ca0(2,1,1);

  FUN_005a3d80(1);

  FUN_005a3dc0(0);

  FUN_005a3e00(0);

  FUN_005a3e20(8,0);

  FUN_005a3eb0(0);

  FUN_005a3ef0(1);

  FUN_005a4280(1);

  FUN_005a3f90(0);

  FUN_005a4080(&DAT_00821ec0,0,0x447a0000);

  FUN_005a41f0(0);

  uVar1 = 0;

  do {

    FUN_005a4230(uVar1,0);

    uVar1 = uVar1 + 1;

  } while (uVar1 < 8);

  FUN_005a42d0(0);

  FUN_005a4350(0);

  FUN_005a4390(3);

  FUN_005a43d0(1);

  uVar1 = 0;

  do {

    FUN_005a4420(uVar1,1,1);

    FUN_005a4460(uVar1,2,2,1);

    uVar1 = uVar1 + 1;

  } while (uVar1 < 0x10);

  uVar1 = 0;

  do {

    FUN_005a4550(uVar1,1,0,0);

    FUN_005a4610(uVar1,1,0,0);

    FUN_005a46c0(uVar1,uVar1);

    FUN_005a4710(uVar1,0);

    FUN_005a47d0(uVar1,0);

    uVar1 = uVar1 + 1;

  } while (uVar1 < 8);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xc4))(*(int **)(param_1 + 0x468),param_1 + 0x79c);

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

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

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

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

  return 1;

}





// --- FUN_005a1260 at 0x005A1260 (size: 183) ---


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



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  int *unaff_retaddr;

  

  iVar1 = *(int *)param_1[0x11a];

  uVar3 = FUN_00696c50();

  (**(code **)(iVar1 + 0x94))(param_1[0x11a],param_2,uVar3);

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

    uVar3 = 0;

  }

  else {

    uVar3 = FUN_00696c50();

  }

  (**(code **)(*(int *)param_1[0x11a] + 0x9c))((int *)param_1[0x11a],uVar3);

  (**(code **)(*param_3 + 0x10))();

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

    (**(code **)(*unaff_retaddr + 0x10))();

  }

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

    (**(code **)(*(int *)param_1[0x2f] + 0x14))();

  }

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

    (**(code **)(*(int *)param_1[0x30] + 0x14))();

  }

  param_1[0x2f] = (int)param_3;

  param_1[0x30] = (int)unaff_retaddr;

  iVar1 = param_3[0x28];

  param_1[0x27] = iVar1;

  iVar2 = param_3[0x29];

  param_1[0x28] = iVar2;

  (**(code **)(*param_1 + 0x40))(0,0,iVar1,iVar2,0);

  return;

}





// --- FUN_005a1320 at 0x005A1320 (size: 105) ---


int * __fastcall FUN_005a1320(int *param_1)



{

  char cVar1;

  int *piVar2;

  undefined4 uVar3;

  int iVar4;

  

  piVar2 = (int *)(**(code **)(*param_1 + 0x10))();

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

    cVar1 = (**(code **)(*piVar2 + 0x58))(param_1[0x118],param_1[0x119],0x15,0);

    if (cVar1 != '\0') {

      iVar4 = *(int *)param_1[0x11a];

      uVar3 = FUN_00696c50();

      iVar4 = (**(code **)(iVar4 + 0x84))(param_1[0x11a],0,uVar3);

      if ((iVar4 == 0) || (iVar4 != -0x7789f798)) {

        return piVar2;

      }

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

    }

  }

  return (int *)0x0;

}





// --- FUN_005a1390 at 0x005A1390 (size: 16) ---


void __fastcall FUN_005a1390(int param_1)



{

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

    FUN_006974d0();

    return;

  }

  return;

}





// --- FUN_005a13a0 at 0x005A13A0 (size: 40) ---


void __thiscall

FUN_005a13a0(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5

            )



{

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

    FUN_00698330(param_2,param_3,param_4,param_5,1);

  }

  return;

}





// --- FUN_005a13d0 at 0x005A13D0 (size: 136) ---


uint FUN_005a13d0(undefined4 param_1,undefined4 param_2,int param_3,uint param_4)



{

  int iVar1;

  int iVar2;

  undefined4 unaff_ESI;

  undefined4 unaff_retaddr;

  

  iVar2 = DAT_00870340;

  if (*(uint *)(param_3 + 0xb0) == param_4) {

    iVar1 = FUN_00698740();

    if (iVar1 != 0) {

      (**(code **)(**(int **)(iVar2 + 0x468) + 400))

                (*(int **)(iVar2 + 0x468),0,iVar1,0,*(undefined4 *)(param_3 + 0x34));

    }

    (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x164))

              (*(int **)(DAT_00870340 + 0x468),*(undefined4 *)(param_3 + 0x30));

    iVar2 = (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x144))

                      (*(int **)(DAT_00870340 + 0x468),unaff_ESI,param_3,unaff_retaddr);

    return (uint)(iVar2 == 0);

  }

  return *(uint *)(param_3 + 0xb0) & 0xffffff00;

}





// --- FUN_005a1460 at 0x005A1460 (size: 168) ---


bool FUN_005a1460(undefined4 param_1,int param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  char cVar2;

  int iVar3;

  int iVar4;

  

  iVar1 = param_2;

  iVar4 = 0;

  switch(param_1) {

  case 1:

    iVar4 = param_2;

    break;

  case 2:

    iVar4 = param_2 * 2;

    break;

  case 3:

    iVar4 = param_2 + 1;

    break;

  case 4:

    iVar4 = param_2 * 3;

    break;

  case 5:

  case 6:

    iVar4 = param_2 + 2;

  }

  iVar3 = FUN_0059ffc0(param_4,iVar4);

  if (iVar3 != 0) {

    cVar2 = FUN_00698790(0,iVar4,param_3,iVar3 + 0x30,0,&param_2);

    if (cVar2 != '\0') {

      cVar2 = FUN_005a13d0(param_1,iVar1,iVar3,*(undefined4 *)(iVar3 + 0xb0),param_2,iVar4);

      return cVar2 != '\0';

    }

  }

  return false;

}





// --- FUN_005a1520 at 0x005A1520 (size: 56) ---


undefined4 FUN_005a1520(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  undefined4 uVar1;

  

  if (DAT_00821e5c != '\0') {

    uVar1 = (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x14c))

                      (*(int **)(DAT_00870340 + 0x468),param_1,param_2,param_3,param_4);

    return uVar1;

  }

  return 1;

}





// --- FUN_005a1560 at 0x005A1560 (size: 7) ---


undefined1 __fastcall FUN_005a1560(int param_1)



{

  return *(undefined1 *)(param_1 + 0x4bc);

}





// --- FUN_005a1570 at 0x005A1570 (size: 55) ---


bool __fastcall FUN_005a1570(int param_1)



{

  uint uVar1;

  

  if (0xbfffff < *(uint *)(param_1 + 0x814)) {

    uVar1 = (**(code **)(**(int **)(param_1 + 0x468) + 0x10))(*(int **)(param_1 + 0x468));

    if (0x17fffff < uVar1) {

      return uVar1 < *(uint *)(param_1 + 0x814) >> 2;

    }

  }

  return true;

}





// --- FUN_005a15b0 at 0x005A15B0 (size: 35) ---


void __thiscall FUN_005a15b0(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  

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

  iVar2 = 8;

  do {

    if (*piVar1 == param_2) {

      *piVar1 = 0;

    }

    piVar1 = piVar1 + 9;

    iVar2 = iVar2 + -1;

  } while (iVar2 != 0);

  return;

}





// --- FUN_005a15e0 at 0x005A15E0 (size: 25) ---


void __thiscall FUN_005a15e0(int param_1,int param_2)



{

  if (*(int *)(param_1 + 0x4ec) == param_2) {

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

  }

  return;

}





// --- FUN_005a1600 at 0x005A1600 (size: 155) ---


void FUN_005a1600(void)



{

  DAT_008fc60c = DAT_00867378;

  DAT_008fc610 = DAT_0086737c;

  DAT_00836b68 = DAT_0081fc84;

  DAT_00836bd4 = DAT_0081fec0;

  DAT_00836bd8 = DAT_0081fec4;

  DAT_00836bdc = DAT_0081fec8;

  DAT_00836b6c = DAT_0081fcac;

  DAT_008fc61c = DAT_00867330;

  DAT_008fc614 = DAT_00847054;

  DAT_008fc618 = DAT_008672ec;

  DAT_008fc620 = DAT_00867374;

  DAT_00836b70 = DAT_0081fcc8;

  return;

}





// --- FUN_005a16a0 at 0x005A16A0 (size: 244) ---


void FUN_005a16a0(void)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  bool bVar4;

  

  iVar3 = DAT_008fc60c;

  iVar2 = DAT_00870340;

  if (DAT_008fc60c != *(int *)(DAT_00870340 + 0x7e4)) {

    bVar4 = DAT_008fc60c == 0;

    piVar1 = *(int **)(DAT_00870340 + 0x468);

    *(int *)(DAT_00870340 + 0x7e4) = DAT_008fc60c;

    if (bVar4) {

      (**(code **)(*piVar1 + 0xc4))(piVar1,iVar2 + 0x79c);

      *(undefined1 *)(iVar2 + 0x794) = 0;

      FUN_005a3ef0(1);

    }

    else {

      (**(code **)(*piVar1 + 0xc4))(piVar1,iVar3 + 0xc);

      *(bool *)(iVar2 + 0x794) = *(int *)(iVar3 + 8) != 0;

      FUN_005a3ef0(0);

    }

    FUN_005a3f40(bVar4);

  }

  DAT_0081fc84 = DAT_00836b68;

  DAT_0081fec0 = DAT_00836bd4;

  DAT_0086737c = DAT_008fc610;

  DAT_0081fec8 = DAT_00836bdc;

  DAT_0081fcac = DAT_00836b6c;

  DAT_0081fec4 = DAT_00836bd8;

  DAT_00867330 = DAT_008fc61c;

  FUN_0054dcf0(DAT_008fc614,DAT_008fc618);

  DAT_00867374 = DAT_008fc620;

  DAT_0081fcc8 = DAT_00836b70;

  return;

}





// --- FUN_005a17a0 at 0x005A17A0 (size: 193) ---


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



void FUN_005a17a0(int *param_1)



{

  float fVar1;

  uint uVar2;

  float10 fVar3;

  float local_c;

  float fStack_8;

  

  if (param_1[0x31] != 0) {

    fVar3 = (float10)(**(code **)(*param_1 + 0x6c))(&local_c);

    uVar2 = 0;

    if (fVar3 <= (float10)_DAT_007e6870) {

      if (param_1[0x31] != 0) {

        do {

          FUN_00511600();

          uVar2 = uVar2 + 1;

        } while (uVar2 < (uint)param_1[0x31]);

      }

    }

    else {

      fVar1 = _DAT_007938b0 / (float)fVar3;

      local_c = local_c * fVar1;

      fStack_8 = fVar1 * fStack_8;

      if (param_1[0x31] != 0) {

        do {

          FUN_0050fe10((float)fVar3,&stack0xfffffff0);

          uVar2 = uVar2 + 1;

        } while (uVar2 < (uint)param_1[0x31]);

        return;

      }

    }

  }

  return;

}





// --- FUN_005a1870 at 0x005A1870 (size: 59) ---


void __thiscall FUN_005a1870(int *param_1,int param_2)



{

  int iVar1;

  

  FUN_005a17a0(param_2);

  if (param_2 == 0) {

    iVar1 = 0;

  }

  else {

    iVar1 = param_2 + 0x38;

  }

  if (1 < *(uint *)(iVar1 + 4)) {

    FUN_006b6070(iVar1 + 8,*(uint *)(iVar1 + 4));

  }

  (**(code **)(*param_1 + 0x60))(param_2);

  return;

}





// --- FUN_005a18b0 at 0x005A18B0 (size: 62) ---


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



{

  uint uVar1;

  

  DAT_00867374 = 0;

  uVar1 = 0;

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

    do {

      if (*(int *)(*(int *)(param_2 + 8) + uVar1 * 4) != 0) {

        FUN_006b6010(param_3);

      }

      uVar1 = uVar1 + 1;

    } while (uVar1 < *(uint *)(param_2 + 4));

  }

  return;

}





// --- FUN_005a1b40 at 0x005A1B40 (size: 312) ---


undefined4 __fastcall FUN_005a1b40(int *param_1)



{

  char cVar1;

  int *piVar2;

  int iVar3;

  undefined4 uVar4;

  undefined4 uStack_1c;

  int *piStack_18;

  undefined4 uStack_14;

  undefined1 *puStack_10;

  undefined1 local_8 [8];

  

  puStack_10 = local_8;

  piStack_18 = (int *)param_1[0x11a];

  uStack_14 = 0;

  uStack_1c = 0x5a1b5c;

  (**(code **)(*piStack_18 + 0x98))();

  uStack_1c = 0x5a1b63;

  piVar2 = (int *)(**(code **)(*param_1 + 0x10))();

  uStack_1c = 1;

  param_1[0x2d] = (int)piVar2;

  uVar4 = uStack_14;

  cVar1 = (**(code **)(*piVar2 + 0x70))(uStack_14,0);

  if (cVar1 != '\0') {

    if (param_1[0x2d] == 0) {

      iVar3 = 0;

    }

    else {

      iVar3 = param_1[0x2d] + 0x30;

    }

    FUN_00446cd0(iVar3);

    param_1[0x2f] = param_1[0x2d];

    (**(code **)(*(int *)param_1[0x2d] + 0x10))();

    param_1[0x27] = *(int *)(param_1[0x2f] + 0xa0);

    param_1[0x28] = *(int *)(param_1[0x2f] + 0xa4);

    (**(code **)(*(int *)param_1[0x11a] + 0xa0))((int *)param_1[0x11a],&uStack_1c);

    piVar2 = (int *)(**(code **)(*param_1 + 0x10))();

    param_1[0x2e] = (int)piVar2;

    cVar1 = (**(code **)(*piVar2 + 0x70))(uVar4,0,1);

    if (cVar1 != '\0') {

      if (param_1[0x2e] == 0) {

        iVar3 = 0;

      }

      else {

        iVar3 = param_1[0x2e] + 0x30;

      }

      FUN_00446cd0(iVar3);

      param_1[0x30] = param_1[0x2e];

      (**(code **)(*(int *)param_1[0x2e] + 0x10))();

      (**(code **)(*(int *)param_1[0x11a] + 0x38))((int *)param_1[0x11a],0,param_1 + 0x11b);

      (**(code **)(*(int *)param_1[0x11a] + 0x5c))

                ((int *)param_1[0x11a],1,1,1,0,0x15,1,param_1 + 0x1fb,0);

      FUN_005a1080(0xff000000,1);

      return 1;

    }

  }

  return 0;

}





// --- FUN_005a1c80 at 0x005A1C80 (size: 240) ---


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



void __thiscall FUN_005a1c80(int param_1,float param_2,char param_3)



{

  float fVar1;

  undefined1 uVar2;

  int iVar3;

  undefined2 uVar4;

  uint uVar5;

  int iVar6;

  undefined2 local_600 [256];

  undefined2 auStack_400 [256];

  undefined2 auStack_200 [256];

  

  fVar1 = _DAT_007938b0;

  if ((param_2 <= _DAT_007938b0) && (fVar1 = param_2, param_2 < _DAT_007e68a0)) {

    fVar1 = _DAT_007e68a0;

  }

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

  iVar6 = 0;

  uVar5 = 0;

  do {

    iVar3 = FUN_005df4c4();

    iVar3 = iVar6 - iVar3;

    if (iVar3 < 0) {

      iVar3 = 0;

    }

    else if (0xffff < iVar3) {

      iVar3 = 0xffff;

    }

    uVar4 = (undefined2)iVar3;

    auStack_200[uVar5] = uVar4;

    auStack_400[uVar5] = uVar4;

    iVar6 = iVar6 + 0xff;

    local_600[uVar5] = uVar4;

    uVar5 = uVar5 + 1;

  } while (uVar5 < 0x100);

  if (((*(uint *)(param_1 + 0x318) >> 0x14 & 1) == 0) || (param_3 == '\0')) {

    uVar2 = 0;

  }

  else {

    uVar2 = 1;

  }

  (**(code **)(**(int **)(param_1 + 0x468) + 0x54))(*(int **)(param_1 + 0x468),0,uVar2,local_600);

  return;

}





// --- FUN_005a1d80 at 0x005A1D80 (size: 2194) ---


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



void __thiscall

FUN_005a1d80(uint param_1,undefined4 param_2,byte *param_3,undefined4 param_4,float *param_5,

            float *param_6)



{

  int *piVar1;

  undefined4 uVar2;

  bool bVar3;

  byte *pbVar4;

  float *pfVar5;

  uint uVar6;

  uint uVar7;

  int iVar8;

  int iVar9;

  byte bVar10;

  uint uVar11;

  uint uVar12;

  uint uVar13;

  float10 fVar14;

  byte bVar15;

  uint uStack_54;

  undefined4 uStack_48;

  int local_44;

  undefined4 uStack_40;

  undefined4 uStack_3c;

  undefined4 uStack_38;

  undefined4 uStack_34;

  undefined4 uStack_30;

  undefined4 uStack_2c;

  undefined4 uStack_28;

  undefined4 uStack_24;

  undefined4 uStack_20;

  undefined4 uStack_1c;

  undefined4 uStack_18;

  undefined4 uStack_14;

  undefined4 uStack_10;

  undefined4 uStack_c;

  

  pbVar4 = param_3;

  iVar8 = *(int *)(param_3 + 0x24);

  if ((_DAT_008ee590 & 1) == 0) {

    _DAT_008ee590 = _DAT_008ee590 | 1;

  }

  _DAT_008ee588 = *(undefined4 *)(param_1 + 0x194);

  _DAT_008ee57c = *(float *)(param_1 + 0x188) + *param_6;

  _DAT_008ee580 = *(float *)(param_1 + 0x18c) + param_6[1];

  _DAT_008ee584 = *(float *)(param_1 + 400) + param_6[2];

  local_44 = iVar8;

  FUN_00447490();

  fVar14 = (float10)FUN_005b2230(DAT_008379b0,DAT_008379b4);

  _DAT_008ee568 = (float)fVar14;

  FUN_005b2230(DAT_008379b0,DAT_008379b4);

  DAT_008ee58c = FUN_005df4c4();

  _DAT_008ee548 = *(float *)(param_3 + 0x7c) * *param_5;

  _DAT_008ee54c = *(float *)(param_3 + 0x80) * param_5[1];

  _DAT_008ee550 = *(float *)(param_3 + 0x84) * param_5[2];

  _DAT_008ee554 = *(float *)(param_3 + 0x88) * param_5[3];

  pfVar5 = (float *)&DAT_00821ed0;

  if (_DAT_007938b8 <= _DAT_008ee568) {

    pfVar5 = (float *)(param_3 + 0x8c);

  }

  _DAT_008ee558 = *pfVar5 * *param_5;

  _DAT_008ee55c = pfVar5[1] * param_5[1];

  _DAT_008ee560 = pfVar5[2] * param_5[2];

  _DAT_008ee564 = pfVar5[3] * param_5[3];

  _DAT_008ee56c = *(undefined4 *)(param_3 + 200);

  _DAT_008ee570 = *(undefined4 *)(param_3 + 0xcc);

  _DAT_008ee574 = *(undefined4 *)(param_3 + 0xd0);

  _DAT_008ee578 = *(undefined4 *)(param_3 + 0xd4);

  DAT_008ee540 = ((byte)*(undefined4 *)param_3 & 2) == 2;

  DAT_008ee541 = ((byte)*(undefined4 *)param_3 & 4) == 4;

  DAT_008ee543 = ((byte)*(undefined4 *)param_3 & 0x20) == 0x20;

  DAT_008ee544 = ((byte)*(undefined4 *)param_3 & 0x40) == 0x40;

  DAT_008ee545 = 1;

  if ((((*param_3 & 8) == 0) || (!(bool)DAT_008ee540)) ||

     (DAT_008ee542 = 1, _DAT_008ee568 <= DAT_00796344)) {

    DAT_008ee542 = 0;

  }

  (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x170))(*(int **)(DAT_00870340 + 0x468),0);

  FUN_005a3f90(DAT_008ee545);

  FUN_005a41f0(DAT_008ee540);

  uVar11 = iVar8 - 1;

  uVar12 = uVar11;

  uVar7 = param_1;

  do {

    if ((int)uVar12 < 0) {

      uVar2 = *(undefined4 *)(pbVar4 + 0x40);

      bVar10 = pbVar4[0x4c];

      iVar8 = *(int *)(pbVar4 + 0x34);

      iVar9 = *(int *)(pbVar4 + 0x38);

      bVar15 = pbVar4[0x44];

      if ((bVar10 == 0) && ((iVar8 != 5 || ((*(byte *)(uVar7 + 0x484) & 8) != 0)))) {

        param_4 = 0;

      }

      else {

        param_4 = 1;

        if ((bVar10 != 0) && (_DAT_008ee554 < _DAT_007958c0)) {

          bVar10 = 0;

        }

      }

      if (((char)param_5 != '\0') && (iVar9 != 2)) {

        bVar10 = 0;

        bVar15 = 0;

      }

      if (*(char *)(uVar7 + 0x47) == '\0') {

        if (iVar8 == 7) {

          iVar8 = 5;

        }

        else if (iVar8 == 8) {

          iVar8 = 6;

        }

        if (iVar9 == 7) {

          iVar9 = 5;

        }

        else if (iVar9 == 8) {

          iVar9 = 6;

        }

      }

      FUN_005a3ca0(iVar8,iVar9,*(undefined4 *)(pbVar4 + 0x3c));

      FUN_005a3e20(uVar2,bVar15);

      FUN_005a3be0(param_4);

      FUN_005a3c20(5);

      FUN_005a3c60(-(uint)(bVar10 != 0) & DAT_008ee58c);

      iVar8 = *(int *)(pbVar4 + 0x48);

      if (*(char *)(uVar7 + 0xc5) != '\0') {

        if (iVar8 == 2) {

          iVar8 = 3;

        }

        else if (iVar8 == 3) {

          iVar8 = 2;

        }

      }

      FUN_005a3d80(iVar8);

      FUN_005a42d0(DAT_008ee542);

      if (DAT_008ee541 == '\0') {

        if (DAT_008ee540 == '\0') {

          iVar8 = FUN_005df4c4();

          uVar12 = FUN_005df4c4();

          uVar13 = (iVar8 << 8 | uVar12) << 8;

          uVar12 = FUN_005df4c4();

        }

        else {

          iVar8 = FUN_005df4c4();

          uVar12 = FUN_005df4c4();

          uVar13 = (iVar8 << 8 | uVar12) << 8;

          uVar12 = FUN_005df4c4();

        }

      }

      else {

        iVar8 = FUN_005df4c4();

        uVar12 = FUN_005df4c4();

        uVar13 = (iVar8 << 8 | uVar12) << 8;

        uVar12 = FUN_005df4c4();

      }

      uVar6 = FUN_005df4c4();

      FUN_005a4350((uVar13 | uVar12) << 8 | uVar6);

      for (uVar12 = uVar11; -1 < (int)uVar12; uVar12 = uVar12 - 1) {

        iVar8 = *(int *)(*(int *)(pbVar4 + 0x1c) + uVar12 * 4);

        FUN_005a4610(uVar12,*(undefined4 *)(iVar8 + 0x28),*(undefined4 *)(iVar8 + 0x2c),

                     *(undefined4 *)(iVar8 + 0x30));

        FUN_005a4550(uVar12,*(undefined4 *)(iVar8 + 0x34),*(undefined4 *)(iVar8 + 0x38),

                     *(undefined4 *)(iVar8 + 0x3c));

      }

      if (param_1 < 8) {

        FUN_005a4610(param_1,1,2,1);

        FUN_005a4550(param_1,1,2,1);

      }

      for (; -1 < (int)uVar11; uVar11 = uVar11 - 1) {

        iVar8 = *(int *)(*(int *)(uVar7 + 0x7fc) + uVar11 * 4);

        if (iVar8 != -1) {

          iVar9 = *(int *)(*(int *)(pbVar4 + 0x1c) + iVar8 * 4);

          FUN_005a4760(iVar8,*(undefined4 *)(iVar9 + 0xc));

          FUN_005a4420(iVar8,*(undefined4 *)(iVar9 + 0x14),*(undefined4 *)(iVar9 + 0x18));

          FUN_005a4460(iVar8,*(undefined4 *)(iVar9 + 0x1c),*(undefined4 *)(iVar9 + 0x20),

                       *(undefined4 *)(iVar9 + 0x24));

        }

      }

      return;

    }

    iVar8 = *(int *)(*(int *)(pbVar4 + 0x1c) + uVar12 * 4);

    uVar13 = *(uint *)(iVar8 + 0x40);

    uVar6 = uVar13 & 0xff00;

    bVar3 = false;

    param_3 = (byte *)0x0;

    uVar13 = uVar13 & 0xffff00ff;

    if (uVar6 == 0) {

LAB_005a22a3:

      if (uVar6 == 0x500) {

        FUN_0065e760(uVar7 + 0x108);

        uStack_18 = DAT_008ee3e8;

        uStack_14 = DAT_008ee3ec;

        uStack_10 = DAT_008ee3f0;

      }

      else {

        if (uVar6 != 0x600) goto LAB_005a20fe;

        uStack_3c = 0;

        uStack_40 = 0;

        local_44 = 0;

        uStack_2c = 0;

        uStack_30 = 0;

        uStack_38 = 0;

        uStack_1c = 0;

        uStack_24 = 0;

        uStack_28 = 0;

        uStack_10 = 0;

        uStack_14 = 0;

        uStack_18 = 0;

        uStack_c = 0x3f800000;

        uStack_20 = 0x3f800000;

        uStack_34 = 0x3f800000;

        uStack_48 = 0x3f800000;

      }

LAB_005a21da:

      (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0xb0))

                (*(int **)(DAT_00870340 + 0x468),uVar12 + 0x10,&uStack_48);

      param_3 = (byte *)0x3;

      if (*(char *)(iVar8 + 0x44) != '\0') {

        param_3 = (byte *)0x103;

      }

    }

    else {

      uStack_3c = 0;

      uStack_40 = 0;

      local_44 = 0;

      uStack_2c = 0;

      uStack_30 = 0;

      uStack_38 = 0;

      uStack_1c = 0;

      uStack_24 = 0;

      uStack_28 = 0;

      uStack_10 = 0;

      uStack_14 = 0;

      uStack_18 = 0;

      uStack_c = 0x3f800000;

      uStack_20 = 0x3f800000;

      uStack_34 = 0x3f800000;

      uStack_48 = 0x3f800000;

      bVar3 = true;

      uVar13 = uVar12;

      if (0x400 < uVar6) {

        if (uVar6 == 0x500) {

LAB_005a229b:

          uVar13 = uVar12 | 0x30000;

        }

        else if (uVar6 == 0x600) {

LAB_005a2291:

          uVar13 = uVar12 | 0x10000;

        }

        goto LAB_005a22a3;

      }

      if (uVar6 == 0x400) {

        uVar13 = uVar12 | 0x40000;

      }

      else {

        if (uVar6 == 0x100) goto LAB_005a229b;

        if (uVar6 == 0x200) goto LAB_005a2291;

        if (uVar6 != 0x300) goto LAB_005a22a3;

        uVar13 = uVar12 | 0x20000;

      }

LAB_005a20fe:

      uVar6 = *(uint *)(pbVar4 + 0x30);

      if (uVar6 != 0) {

        uStack_3c = 0;

        uStack_40 = 0;

        local_44 = 0;

        uStack_2c = 0;

        uStack_30 = 0;

        uStack_38 = 0;

        uStack_1c = 0;

        uStack_24 = 0;

        uStack_28 = 0;

        uStack_10 = 0;

        uStack_14 = 0;

        uStack_18 = 0;

        uStack_c = 0x3f800000;

        uStack_20 = 0x3f800000;

        uStack_34 = 0x3f800000;

        uStack_48 = 0x3f800000;

        param_4 = 0;

        do {

          piVar1 = *(int **)(*(int *)(pbVar4 + 0x28) + param_4 * 4);

          uVar7 = (**(code **)(*piVar1 + 4))();

          if (uVar7 == uVar12) {

            bVar3 = true;

            (**(code **)(*piVar1 + 0x18))(&uStack_48);

          }

          param_4 = param_4 + 1;

          uVar7 = uStack_54;

        } while (param_4 < uVar6);

      }

      if (bVar3) goto LAB_005a21da;

    }

    FUN_005a46c0(uVar12,uVar13);

    FUN_005a4710(uVar12,param_3);

    uVar12 = uVar12 - 1;

  } while( true );

}





// --- FUN_005a2620 at 0x005A2620 (size: 114) ---


uint __fastcall FUN_005a2620(int param_1)



{

  int *piVar1;

  undefined4 *puVar2;

  undefined4 uVar3;

  int *piVar4;

  int local_4;

  

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

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

  local_4 = param_1;

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

    piVar4 = puVar2 + 1;

    *piVar4 = *piVar4 + -1;

    if (*piVar4 == 0) {

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

    }

    *piVar1 = 0;

  }

  piVar4 = (int *)FUN_006984f0(&local_4,8,piVar1);

  if ((-1 < *piVar4) && (piVar4 = (int *)0x0, *piVar1 != 0)) {

    *(undefined4 *)(*piVar1 + 0x1c) = 8;

    *(undefined4 *)(*piVar1 + 0x20) = 0xe;

    uVar3 = *(undefined4 *)(*piVar1 + 0x1c);

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

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

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

  }

  return (uint)piVar4 & 0xffffff00;

}





// --- FUN_005a26a0 at 0x005A26A0 (size: 36) ---


void __fastcall FUN_005a26a0(int param_1)



{

  char cVar1;

  

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

    cVar1 = FUN_005a2620();

    if (cVar1 == '\0') {

      return;

    }

  }

  FUN_006970b0();

  return;

}





// --- FUN_005a26d0 at 0x005A26D0 (size: 197) ---


uint FUN_005a26d0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

                 int param_5,int param_6,uint param_7)



{

  int iVar1;

  byte bVar2;

  char cVar3;

  uint uVar4;

  undefined1 local_9;

  uint local_8;

  

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

    return param_7 & 0xffffff00;

  }

  local_9 = 0;

  local_8 = 0;

  do {

    iVar1 = local_8 + (DAT_0083841c + 0x38) * 3;

    bVar2 = *(byte *)(iVar1 + param_6);

    uVar4 = CONCAT31((int3)((uint)iVar1 >> 8),bVar2);

    if (bVar2 == 0xff) break;

    uVar4 = (uint)bVar2 * 4;

    iVar1 = *(int *)(uVar4 + *(int *)(param_6 + 0x78));

    if (*(int *)(iVar1 + 0x88) == 0) break;

    FUN_005a1d80(*(undefined4 *)(*(int *)(param_5 + 0x78) + uVar4),iVar1,param_4,param_7,

                 &DAT_00821ed0,0);

    cVar3 = FUN_005a1460(param_1,param_2,param_3,param_4);

    if (cVar3 != '\0') {

      local_9 = 1;

    }

    uVar4 = local_8 + 1;

    local_8 = uVar4;

  } while (uVar4 < 3);

  return CONCAT31((int3)(uVar4 >> 8),local_9);

}





// --- FUN_005a27a0 at 0x005A27A0 (size: 109) ---


undefined4 * __fastcall FUN_005a27a0(undefined4 *param_1)



{

  param_1[1] = 1;

  *param_1 = &PTR_FUN_0079bfe8;

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  FUN_005d8650();

  *param_1 = &PTR_FUN_0079bffc;

  FUN_004474e0();

  *param_1 = &PTR_FUN_007e68a4;

  param_1[0x53] = 0;

  param_1[0x54] = 0;

  param_1[0x55] = 0;

  param_1[0x56] = 0;

  param_1[0x57] = 0;

  param_1[0x58] = 0;

  FUN_00699140();

  return param_1;

}





// --- FUN_005a2810 at 0x005A2810 (size: 30) ---


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



{

  FUN_005a2830();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005a2830 at 0x005A2830 (size: 151) ---


void __fastcall FUN_005a2830(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e68a4;

  thunk_FUN_00699160();

  if ((param_1[0x57] & 0x80000000) == 0x80000000) {

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

  }

  if ((param_1[0x54] & 0x80000000) == 0x80000000) {

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

  }

  *param_1 = &PTR_FUN_0079bffc;

  FUN_00447520();

  *param_1 = &PTR_FUN_0079bfe8;

  FUN_005d86a0();

  if ((param_1[0x29] & 0x80000000) == 0x80000000) {

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

  }

  *param_1 = &PTR_LAB_00796c4c;

  return;

}





// --- FUN_005a2ba0 at 0x005A2BA0 (size: 173) ---


void __fastcall FUN_005a2ba0(int *param_1)



{

  int iVar1;

  int aiStack_24 [2];

  

  aiStack_24[1] = 0x5a2bad;

  FUN_005a0ce0();

  aiStack_24[1] = 0x5a2bb4;

  FUN_005a4910();

  aiStack_24[1] = 0x5a2bbb;

  FUN_005a10f0();

  aiStack_24[0] = param_1[3];

  aiStack_24[1] = 0;

  (**(code **)(*param_1 + 0x40))(0,0,param_1[2]);

  FUN_00448be0();

  if ((char)param_1[4] != '\0') {

    (**(code **)(*(int *)param_1[0x11a] + 0x50))((int *)param_1[0x11a],1);

    FUN_005a1c80(param_1[0x1fd],0);

  }

  iVar1 = 3;

  do {

    aiStack_24[0] = 0;

    aiStack_24[1] = 0;

    (**(code **)(*param_1 + 0x2c))(7,aiStack_24,0x3f800000);

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

    Sleep(1);

    iVar1 = iVar1 + -1;

  } while (iVar1 != 0);

  return;

}





// --- FUN_005a2c50 at 0x005A2C50 (size: 148) ---


void FUN_005a2c50(void)



{

  void *pvVar1;

  LONG LVar2;

  int local_4;

  

  pvVar1 = DAT_008ee3cc;

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

    FUN_005a6280();

    operator_delete(pvVar1);

    DAT_008ee3cc = (void *)0x0;

  }

  pvVar1 = DAT_008ee3d0;

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

    FUN_005a6280();

    operator_delete(pvVar1);

    DAT_008ee3d0 = (void *)0x0;

  }

  FUN_005a0c80();

  FUN_00401340("RenderDeviceD3D.AllowDrawPrimUP");

  FUN_00436cf0(&local_4);

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

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

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

  }

  return;

}





// --- FUN_005a2cf0 at 0x005A2CF0 (size: 223) ---


undefined4 __thiscall FUN_005a2cf0(int param_1,undefined4 param_2)



{

  char cVar1;

  int iVar2;

  uint uVar3;

  undefined *puVar4;

  undefined *puVar5;

  undefined *puVar6;

  undefined4 uVar7;

  

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

  uVar3 = 0;

  uVar7 = param_2;

  while( true ) {

    switch(uVar3) {

    case 0:

      uVar7 = 0x31545844;

      break;

    case 1:

      uVar7 = 0x32545844;

      break;

    case 2:

      uVar7 = 0x33545844;

      break;

    case 3:

      uVar7 = 0x34545844;

      break;

    case 4:

      uVar7 = 0x35545844;

    }

    iVar2 = (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x28))

                      (*(int **)(DAT_0086734c + 0x1c),*(undefined4 *)(param_1 + 0x304),

                       *(undefined4 *)(param_1 + 0x308),param_2,0,3,uVar7);

    if (iVar2 != 0) break;

    uVar3 = uVar3 + 1;

    if (4 < uVar3) {

LAB_005a2d63:

      cVar1 = FUN_005a0980(param_2);

      if (cVar1 != '\0') {

        return 1;

      }

      uVar7 = 0;

      puVar6 = PTR_DAT_00818340;

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

      puVar5 = PTR_DAT_00818340;

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

      puVar4 = PTR_DAT_00818340;

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

      FUN_0043d090(0x80,puVar4,puVar5,puVar6,uVar7);

      return 0;

    }

  }

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

  goto LAB_005a2d63;

}





// --- FUN_005a2df0 at 0x005A2DF0 (size: 250) ---


uint __thiscall

FUN_005a2df0(int param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined1 param_5)



{

  int iVar1;

  uint uVar2;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  bool bVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  

  *(undefined1 *)(param_1 + 0x58) = param_5;

  uVar2 = FUN_005a2cf0(param_2);

  if (((char)uVar2 != '\0') && (uVar2 = 0, *(int *)(DAT_0086734c + 0x1c) != 0)) {

    bVar3 = *(int *)(param_1 + 0x60) != 0;

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

    *(bool *)(param_1 + 0x59) = bVar3;

    if (bVar3) {

      *(undefined4 *)(param_1 + 0x60) = param_3;

    }

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

    if ((((*(int *)(param_1 + 0x68) != 0) && (*(int *)(param_1 + 0x6c) != 0)) &&

        (*(int *)(param_1 + 0x70) != 0)) &&

       (((*(int *)(param_1 + 0x74) != 0 && (param_4 = *(int *)(param_1 + 0x78), param_4 != 0)) &&

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

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

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

      }

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

        *(int *)(param_1 + 0x84) = param_4;

      }

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

      if (iVar1 == 0) {

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

      }

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

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

      }

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

    }

    uVar6 = 0;

    FUN_00402730(&DAT_00795320);

    uVar5 = extraout_ECX;

    FUN_00402730(&DAT_00795320);

    uVar4 = extraout_ECX_00;

    FUN_00402730(&DAT_00795320);

    uVar2 = FUN_0043d090(0x80,uVar4,uVar5,param_4,uVar6);

  }

  return uVar2 & 0xffffff00;

}





// --- FUN_005a2ef0 at 0x005A2EF0 (size: 1023) ---


undefined4 __thiscall

FUN_005a2ef0(int param_1,int param_2,int *param_3,int *param_4,undefined4 param_5)



{

  byte bVar1;

  char cVar2;

  byte bVar3;

  int iVar4;

  int *extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  int *extraout_ECX_02;

  int *extraout_ECX_03;

  int *extraout_ECX_04;

  int *extraout_ECX_05;

  int *piVar5;

  undefined4 extraout_ECX_06;

  undefined4 extraout_ECX_07;

  undefined4 extraout_ECX_08;

  undefined4 extraout_ECX_09;

  int iVar6;

  int iVar7;

  int iVar8;

  uint uVar9;

  undefined4 uVar10;

  undefined4 uVar11;

  undefined4 uVar12;

  byte bStack_91;

  int local_90;

  int local_8c;

  undefined4 local_80;

  undefined4 uStack_7c;

  int iStack_74;

  byte bStack_6c;

  byte bStack_64;

  byte bStack_2c;

  

  *param_3 = 0;

  *param_4 = 0;

  bVar1 = 0;

  local_90 = 0;

  FUN_00535a80();

  if (*(char *)(param_2 + 0xc) == '\0') {

    (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x20))

              (*(int **)(DAT_0086734c + 0x1c),*(undefined4 *)(param_1 + 0x304),&local_80);

    local_90 = iStack_74;

    FUN_00535a80();

    FUN_0043d290(iStack_74);

    piVar5 = extraout_ECX;

    if ((iStack_74 == 0x29) || (bStack_64 < 0x10)) {

      iVar7 = 0;

      FUN_00402730(&DAT_00795320);

      uVar12 = extraout_ECX_08;

      FUN_00402730(&DAT_00795320);

      uVar11 = extraout_ECX_09;

      FUN_00402730(&DAT_00795320);

      uVar10 = 0x7c;

      goto LAB_005a32e0;

    }

    if (iStack_74 == 0) {

      FUN_00402730(&DAT_00795320);

      uVar12 = extraout_ECX_00;

      FUN_00402730(&DAT_00795320);

      uVar11 = extraout_ECX_01;

      FUN_00402730(&DAT_00795320);

      uVar10 = 0x7e;

      iVar7 = iStack_74;

      goto LAB_005a32e0;

    }

    uVar9 = (uint)bStack_64;

    *(undefined4 *)(param_1 + 0x460) = local_80;

    *(undefined4 *)(param_1 + 0x464) = uStack_7c;

  }

  else {

    uVar9 = *(uint *)(param_2 + 0x14);

    if (((uVar9 != 0x10) && (uVar9 != 0x18)) && (uVar9 != 0x20)) {

      return 0;

    }

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

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

  }

  iVar6 = 0;

  iVar7 = 0;

  iVar8 = 0;

  local_8c = 0;

  if (uVar9 == 0x10) {

    iVar7 = 0x18;

    iVar8 = 0x17;

    iVar6 = 0x18;

    local_8c = 0x17;

  }

  else if (uVar9 == 0x18) {

    iVar6 = 0x14;

    iVar7 = 0x14;

    iVar8 = 0x14;

    local_8c = 0x14;

  }

  else if (uVar9 == 0x20) {

    iVar7 = 0x16;

    iVar6 = 0x16;

    iVar8 = 0x16;

    local_8c = 0x15;

  }

  if (*(char *)(param_2 + 0xc) == '\0') {

    iVar7 = local_90;

    iVar8 = local_90;

  }

  iVar4 = (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x24))

                    (*(int **)(DAT_0086734c + 0x1c),*(undefined4 *)(param_1 + 0x304),

                     *(undefined4 *)(param_1 + 0x308),iVar7,iVar6,*(char *)(param_2 + 0xc) == '\0');

  piVar5 = extraout_ECX_02;

  if ((iVar4 == 0) &&

     ((*(char *)(param_2 + 0xc) == '\0' ||

      (cVar2 = FUN_005a0bc0(iVar7,*(undefined4 *)(param_2 + 0x10),param_5), piVar5 = extraout_ECX_03

      , cVar2 != '\0')))) {

    *param_3 = iVar6;

    piVar5 = param_3;

    local_90 = iVar7;

  }

  if (*param_3 == 0) {

    iVar7 = (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x24))

                      (*(int **)(DAT_0086734c + 0x1c),*(undefined4 *)(param_1 + 0x304),

                       *(undefined4 *)(param_1 + 0x308),iVar8,local_8c,

                       *(char *)(param_2 + 0xc) == '\0');

    if ((iVar7 == 0) &&

       ((*(char *)(param_2 + 0xc) == '\0' ||

        (cVar2 = FUN_005a0bc0(iVar8,*(undefined4 *)(param_2 + 0x10),param_5), cVar2 != '\0')))) {

      *param_3 = local_8c;

      local_90 = iVar8;

    }

    piVar5 = param_3;

    if (*param_3 != 0) goto LAB_005a313a;

  }

  else {

LAB_005a313a:

    if (local_90 != 0) {

      FUN_0043d290(local_90);

      uVar9 = 0;

      piVar5 = extraout_ECX_04;

      bVar3 = bStack_2c;

      do {

        bStack_91 = 0;

        switch(uVar9) {

        case 0:

          if (0x10 < bVar3) {

            if (*(char *)(param_1 + 0x24) != '\0') goto LAB_005a3184;

LAB_005a319b:

            iVar7 = 0x47;

LAB_005a31cc:

            iVar8 = (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x28))

                              (*(int **)(DAT_0086734c + 0x1c),*(undefined4 *)(param_1 + 0x304),

                               *(undefined4 *)(param_1 + 0x308),local_90,2,1,iVar7);

            piVar5 = extraout_ECX_05;

            bVar3 = bStack_2c;

            if (iVar8 == 0) {

              piVar5 = (int *)(uint)bStack_91;

              *param_4 = iVar7;

              bVar1 = bStack_91;

              goto LAB_005a3218;

            }

          }

          break;

        case 1:

          if (0x10 < bVar3) {

            if (*(char *)(param_1 + 0x24) != '\0') goto LAB_005a319b;

LAB_005a3184:

            iVar7 = 0x4b;

            bStack_91 = 1;

            goto LAB_005a31cc;

          }

          break;

        case 2:

          if (0x10 < bVar3) {

            iVar7 = 0x4d;

            goto LAB_005a31cc;

          }

          break;

        case 3:

          if (0x10 < bVar3) {

            iVar7 = 0x4f;

            goto LAB_005a31cc;

          }

          break;

        case 4:

          if (bVar3 < 0x11) {

            iVar7 = 0x50;

            goto LAB_005a31cc;

          }

          break;

        case 5:

          if (bVar3 < 0x11) {

            iVar7 = 0x49;

            goto LAB_005a31cc;

          }

        }

        uVar9 = uVar9 + 1;

      } while (uVar9 < 6);

LAB_005a3218:

      if (*param_4 != 0) {

        cVar2 = FUN_005a2df0(local_90,*param_3,*param_4,bVar1,*(undefined1 *)(param_2 + 0xc));

        if (cVar2 == '\0') {

          return 0;

        }

        FUN_00535a80();

        FUN_0043d290(*param_3);

        if ((bStack_6c & 2) == 0) {

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

        }

        return 1;

      }

    }

  }

  iVar7 = 0;

  FUN_00402730(&DAT_00795320);

  uVar12 = extraout_ECX_06;

  FUN_00402730(&DAT_00795320);

  uVar11 = extraout_ECX_07;

  FUN_00402730(&DAT_00795320);

  uVar10 = 0x80;

LAB_005a32e0:

  FUN_0043d090(uVar10,uVar11,uVar12,piVar5,iVar7);

  return 0;

}





// --- FUN_005a3310 at 0x005A3310 (size: 523) ---


void __fastcall FUN_005a3310(int param_1)



{

  char cVar1;

  undefined4 *puVar2;

  uint uVar3;

  LONG LVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  undefined4 *puVar8;

  uint local_328;

  int local_324 [201];

  

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

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

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

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

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  puVar2 = (undefined4 *)FUN_0059cb40();

  puVar8 = (undefined4 *)(param_1 + 0x474);

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

    *puVar8 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar8 = puVar8 + 1;

  }

  DAT_00821e5c = 1;

  FUN_005a00c0();

  FUN_0044dcb0();

  uVar6 = 0;

  do {

    uVar3 = *(uint *)(param_1 + 0x800) & 0x7fffffff;

    if (*(uint *)(param_1 + 0x804) < uVar3) {

LAB_005a3464:

      *(uint *)(*(int *)(param_1 + 0x7fc) + *(int *)(param_1 + 0x804) * 4) = uVar6;

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

    }

    else {

      uVar3 = uVar3 + 1;

      if (uVar3 < 9) {

        uVar3 = 8;

      }

      else if (uVar3 < 0x4001) {

        iVar5 = 0x1f;

        if (uVar3 != 0) {

          for (; uVar3 >> iVar5 == 0; iVar5 = iVar5 + -1) {

          }

        }

        uVar7 = 1 << ((byte)iVar5 & 0x1f);

        local_328 = uVar3;

        if (uVar7 < uVar3) {

          uVar3 = uVar7 * 2;

        }

      }

      else if ((uVar3 & 0x3fff) != 0) {

        uVar3 = uVar3 + (0x4000 - (uVar3 & 0x3fff));

      }

      cVar1 = FUN_004180a0(uVar3);

      if (cVar1 != '\0') goto LAB_005a3464;

    }

    uVar6 = uVar6 + 1;

    if (7 < uVar6) {

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

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

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

      FUN_00401340("Toggle for rendering all the DrawPrimitiveUP crap.");

      FUN_00401340("RenderDeviceD3D.AllowDrawPrimUP");

      FUN_004369a0(&DAT_00821e5c,2,local_324,&local_328,0,0,0,0);

      LVar4 = InterlockedDecrement((LONG *)(local_324[0] + -0x10));

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

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

      }

      puVar2 = (undefined4 *)(local_328 - 0x14);

      LVar4 = InterlockedDecrement((LONG *)(local_328 - 0x10));

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

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

      }

      return;

    }

  } while( true );

}





// --- FUN_005a3520 at 0x005A3520 (size: 49) ---


void __fastcall FUN_005a3520(int param_1)



{

  int *piVar1;

  

  FUN_005a2c50();

  FUN_00550ac0();

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

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

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

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

  }

  FUN_005a3310();

  return;

}





// --- FUN_005a3560 at 0x005A3560 (size: 531) ---


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



{

  uint *puVar1;

  uint *puVar2;

  char cVar3;

  uint uVar4;

  LONG LVar5;

  int iVar6;

  uint uVar7;

  undefined4 extraout_ECX;

  undefined4 *puVar8;

  uint *puVar9;

  undefined *puVar10;

  undefined *puVar11;

  undefined4 uVar12;

  undefined4 uVar13;

  uint local_8;

  uint local_4;

  

  puVar1 = param_2;

  local_8 = 0;

  cVar3 = FUN_005a2ef0(param_2,&param_2,&local_4,&local_8);

  puVar2 = param_3;

  if (cVar3 != '\0') {

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

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

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

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

    uVar4 = puVar1[1];

    *(uint *)(param_1 + 0x454) = uVar4;

    *(uint *)(param_1 + 0x444) = uVar4;

    uVar4 = puVar1[2];

    *(uint *)(param_1 + 0x458) = uVar4;

    *(uint *)(param_1 + 0x448) = uVar4;

    *(uint *)(param_1 + 0x45c) = *puVar1;

    puVar9 = param_3;

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

      *puVar9 = 0;

      puVar9 = puVar9 + 1;

    }

    *param_3 = puVar1[1];

    param_3[1] = puVar1[2];

    param_3[2] = (uint)param_2;

    param_3[3] = 1;

    param_3[4] = 0;

    param_3[5] = 0;

    param_3[6] = 1;

    param_3[7] = *puVar1;

    uVar4 = puVar1[3];

    param_3[10] = local_4;

    uVar7 = 0x80000000;

    param_3[9] = 1;

    param_3[0xb] = 0;

    param_3[0xc] = 0;

    param_3[0xd] = 0x80000000;

    param_3[8] = (uint)((char)uVar4 == '\0');

    if ((char)puVar1[3] != '\0') {

      param_3[0xc] = -(uint)(local_8 != 0) & local_8;

      uVar4 = *(uint *)(param_1 + 800);

      if ((uVar4 & 8) != 0) {

        uVar7 = 8;

      }

      if ((uVar4 & 4) != 0) {

        uVar7 = 4;

      }

      if ((uVar4 & 2) != 0) {

        uVar7 = 2;

      }

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

        uVar7 = 1;

      }

      if ((*(char *)((int)puVar1 + 0x19) == '\0') && ((int)uVar4 < 0)) {

        uVar7 = 0x80000000;

      }

      param_3[0xd] = uVar7;

      return 1;

    }

    uVar4 = GetSystemMetrics(0);

    uVar7 = GetSystemMetrics(1);

    if ((*puVar2 <= uVar4) && (puVar2[1] <= uVar7)) {

      return 1;

    }

    param_3 = (uint *)PTR_DAT_00818340;

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

    param_2 = (uint *)PTR_DAT_00818340;

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

    FUN_004827a0(*puVar2);

    FUN_004827a0(puVar2[1]);

    uVar13 = 0;

    uVar12 = extraout_ECX;

    FUN_00402730(&DAT_00795320);

    puVar11 = (undefined *)param_2;

    InterlockedIncrement((LONG *)((int)param_2 + -0x10));

    puVar10 = (undefined *)param_3;

    InterlockedIncrement((LONG *)((int)param_3 + -0x10));

    FUN_0043d090(0x6c,puVar10,puVar11,uVar12,uVar13);

    puVar8 = (undefined4 *)((int)param_2 + -0x14);

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

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

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

    }

    puVar8 = (undefined4 *)((int)param_3 + -0x14);

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

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

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

    }

  }

  return 0;

}





// --- FUN_005a3780 at 0x005A3780 (size: 395) ---


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



undefined4 __thiscall FUN_005a3780(int param_1,undefined4 *param_2)



{

  bool bVar1;

  char cVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  int iVar6;

  undefined4 uVar7;

  int iVar8;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  undefined4 *puVar9;

  undefined4 uVar10;

  undefined4 uVar11;

  undefined4 uVar12;

  uint local_50;

  undefined1 local_40 [60];

  

  FUN_00557b50();

  FUN_00446d30();

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

  for (iVar8 = 7; iVar8 != 0; iVar8 = iVar8 + -1) {

    *puVar9 = *param_2;

    param_2 = param_2 + 1;

    puVar9 = puVar9 + 1;

  }

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

    uVar3 = GetSystemMetrics(0);

    uVar4 = GetSystemMetrics(1);

    if ((uVar3 < *(uint *)(param_1 + 8)) || (uVar4 < *(uint *)(param_1 + 0xc))) {

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

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

    }

  }

  cVar2 = FUN_005a3560((undefined4 *)(param_1 + 4),local_40);

  if (cVar2 != '\0') {

    FUN_005a0c80();

    bVar1 = false;

    local_50 = 0;

    do {

      iVar8 = FUN_0040fa90();

      while( true ) {

        iVar5 = (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x40))

                          (*(int **)(DAT_00870340 + 0x468),local_40);

        iVar6 = FUN_0040fa90();

        if (_DAT_0079cac8 < (double)iVar6 - (double)iVar8) {

          bVar1 = true;

        }

        if (iVar5 != -0x7789f798) break;

        if (bVar1) goto LAB_005a3867;

        Sleep(200);

      }

      if (-1 < iVar5) {

        uVar7 = (**(code **)(**(int **)(param_1 + 0x468) + 0x10))(*(int **)(param_1 + 0x468));

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

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

        cVar2 = FUN_005a1b40();

        if (cVar2 == '\0') {

          return 0;

        }

        FUN_005a2ba0();

        FUN_00557850();

        return 1;

      }

LAB_005a3867:

      local_50 = local_50 + 1;

    } while (local_50 < 2);

    uVar12 = 0;

    uVar11 = extraout_ECX;

    FUN_00402730(&DAT_00795320);

    uVar10 = extraout_ECX_00;

    FUN_00402730(&DAT_00795320);

    uVar7 = extraout_ECX_01;

    FUN_00402730(&DAT_00795320);

    if (iVar5 == -0x7789fe84) {

      FUN_0043d090(0x79,uVar7,uVar10,uVar11,uVar12);

      return 0;

    }

    FUN_0043d090(0x69,uVar7,uVar10,uVar11,uVar12);

  }

  return 0;

}





// --- FUN_005a3910 at 0x005A3910 (size: 644) ---


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



undefined4 __thiscall FUN_005a3910(int *param_1,int param_2,undefined4 param_3,undefined4 param_4)



{

  bool bVar1;

  char cVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  int iVar6;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  uint extraout_ECX_02;

  undefined4 extraout_ECX_03;

  undefined4 extraout_ECX_04;

  undefined4 uVar7;

  undefined4 uVar8;

  undefined4 uVar9;

  undefined4 uVar10;

  uint local_54;

  uint local_50;

  int local_4c;

  undefined1 local_40 [60];

  

  cVar2 = FUN_0054fe50(param_2,param_3,param_4);

  if (cVar2 != '\0') {

    param_1[0xc1] = param_2;

    cVar2 = FUN_005a0630();

    if (cVar2 == '\0') {

      uVar9 = 0;

      uVar10 = extraout_ECX;

      FUN_00402730(&DAT_00795320);

      uVar8 = extraout_ECX_00;

      FUN_00402730(&DAT_00795320);

      uVar7 = extraout_ECX_01;

      FUN_00402730(&DAT_00795320);

      FUN_0043d090(0x80,uVar7,uVar8,uVar10,uVar9);

    }

    else {

      if ((char)param_1[4] == '\0') {

        uVar3 = GetSystemMetrics(0);

        uVar4 = GetSystemMetrics(1);

        if ((uVar3 < (uint)param_1[2]) || (uVar4 < (uint)param_1[3])) {

          param_1[2] = uVar3;

          param_1[3] = uVar4;

        }

      }

      cVar2 = FUN_005a3560(param_1 + 1,local_40);

      if (cVar2 != '\0') {

        local_50 = 0;

        do {

          uVar3 = 0x20;

          if (local_50 == 0) {

            uVar4 = (uint)*(byte *)(param_1 + 0x13);

            if ((*(byte *)(param_1 + 0x13) != 0) &&

               (uVar4 = (uint)*(byte *)((int)param_1 + 0x26), *(byte *)((int)param_1 + 0x26) != 0))

            {

              uVar3 = 0x50;

              goto LAB_005a3a17;

            }

          }

          else {

            if (local_50 == 1) {

              uVar4 = (uint)*(byte *)(param_1 + 0x13);

              if (*(byte *)(param_1 + 0x13) == 0) goto LAB_005a3ace;

              uVar3 = 0x40;

            }

            else if (local_50 == 2) {

              uVar3 = 0x20;

            }

LAB_005a3a17:

            uVar3 = uVar3 | 0x106;

            bVar1 = false;

            local_54 = 0;

            do {

              iVar5 = FUN_0040fa90();

              while( true ) {

                local_4c = (**(code **)(**(int **)(DAT_0086734c + 0x1c) + 0x40))

                                     (*(int **)(DAT_0086734c + 0x1c),param_1[0xc1],param_1[0xc2],

                                      param_1[8],uVar3,local_40,param_1 + 0x11a);

                iVar6 = FUN_0040fa90();

                if (_DAT_0079cac8 < (double)iVar6 - (double)iVar5) {

                  bVar1 = true;

                }

                if (local_4c != -0x7789f798) break;

                if (bVar1) goto LAB_005a3ab8;

                Sleep(200);

              }

              if (-1 < local_4c) goto LAB_005a3b49;

LAB_005a3ab8:

              local_54 = local_54 + 1;

              uVar4 = extraout_ECX_02;

            } while (local_54 < 2);

          }

LAB_005a3ace:

          local_50 = local_50 + 1;

        } while (local_50 < 3);

        if (local_4c < 0) {

          uVar10 = 0;

          FUN_00402730(&DAT_00795320);

          uVar8 = extraout_ECX_03;

          FUN_00402730(&DAT_00795320);

          uVar7 = extraout_ECX_04;

          FUN_00402730(&DAT_00795320);

          if (local_4c != -0x7789fe84) {

            FUN_0043d090(0x69,uVar7,uVar8,uVar4,uVar10);

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

            return 0;

          }

          FUN_0043d090(0x79,uVar7,uVar8,uVar4,uVar10);

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

          return 0;

        }

LAB_005a3b49:

        iVar5 = (**(code **)(*(int *)param_1[0x11a] + 0x10))((int *)param_1[0x11a]);

        param_1[0x205] = iVar5;

        if ((uVar3 & 0x20) != 0) {

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

        }

        cVar2 = FUN_005a1b40();

        if ((cVar2 != '\0') && (cVar2 = FUN_005a2620(), cVar2 != '\0')) {

          FUN_005a2ba0();

          return 1;

        }

      }

    }

  }

  return 0;

}





// --- FUN_005a3ba0 at 0x005A3BA0 (size: 58) ---


void __thiscall FUN_005a3ba0(int param_1,char param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_1 + 0x475) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x1b,param_2);

    *(char *)(param_1 + 0x475) = param_2;

  }

  return;

}





// --- FUN_005a3be0 at 0x005A3BE0 (size: 58) ---


void __thiscall FUN_005a3be0(int param_1,char param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_1 + 0x476) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xf,param_2);

    *(char *)(param_1 + 0x476) = param_2;

  }

  return;

}





// --- FUN_005a3c20 at 0x005A3C20 (size: 55) ---


void __thiscall FUN_005a3c20(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x478) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x19,param_2);

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

  }

  return;

}





// --- FUN_005a3c60 at 0x005A3C60 (size: 55) ---


void __thiscall FUN_005a3c60(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x47c) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x18,param_2);

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

  }

  return;

}





// --- FUN_005a3ca0 at 0x005A3CA0 (size: 222) ---


void __thiscall FUN_005a3ca0(int param_1,int param_2,int param_3,int param_4)



{

  char cVar1;

  

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x4f0) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x13,param_2);

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

  }

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x49c) != param_3)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x14,param_3);

    *(int *)(param_1 + 0x49c) = param_3;

  }

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x480) != param_4)) {

    if (*(char *)(param_1 + 0x53) != '\0') {

      (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xab,param_4);

    }

    *(int *)(param_1 + 0x480) = param_4;

  }

  if ((param_2 == 2) && (param_3 == 1)) {

    cVar1 = '\0';

  }

  else {

    cVar1 = '\x01';

  }

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_1 + 0x475) != cVar1)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x1b,cVar1);

    *(char *)(param_1 + 0x475) = cVar1;

  }

  return;

}





// --- FUN_005a3d80 at 0x005A3D80 (size: 55) ---


void __thiscall FUN_005a3d80(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x488) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x16,param_2);

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

  }

  return;

}





// --- FUN_005a3dc0 at 0x005A3DC0 (size: 59) ---


void __thiscall FUN_005a3dc0(int param_1,undefined4 param_2)



{

  undefined4 unaff_ESI;

  

  if (*(char *)(param_1 + 0x52) != '\0') {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xaf,param_2);

    *(undefined4 *)(param_1 + 0x48c) = unaff_ESI;

  }

  return;

}





// --- FUN_005a3e00 at 0x005A3E00 (size: 26) ---


void __thiscall FUN_005a3e00(int param_1,undefined1 param_2)



{

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),7,param_2);

  return;

}





// --- FUN_005a3e20 at 0x005A3E20 (size: 143) ---


void __thiscall FUN_005a3e20(int param_1,int param_2,char param_3)



{

  undefined4 uVar1;

  

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x494) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x17,param_2);

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

  }

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_1 + 0x498) != param_3)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xe,param_3);

    *(char *)(param_1 + 0x498) = param_3;

  }

  if ((param_3 == '\x01') || (param_2 != 8)) {

    uVar1 = 1;

  }

  else {

    uVar1 = 0;

  }

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),7,uVar1);

  return;

}





// --- FUN_005a3eb0 at 0x005A3EB0 (size: 58) ---


void __thiscall FUN_005a3eb0(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x4a0) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x8b,param_2);

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

  }

  return;

}





// --- FUN_005a3ef0 at 0x005A3EF0 (size: 66) ---


void __thiscall FUN_005a3ef0(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x4a8) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x91,param_2 == 1);

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

  }

  return;

}





// --- FUN_005a3f40 at 0x005A3F40 (size: 66) ---


void __thiscall FUN_005a3f40(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x4a4) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x93,param_2 == 1);

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

  }

  return;

}





// --- FUN_005a3f90 at 0x005A3F90 (size: 80) ---


void __thiscall FUN_005a3f90(int param_1,byte param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(byte *)(param_1 + 0x4bc) != param_2)) {

    param_2 = (*(char *)(param_1 + 0x4be) == '\0' && *(char *)(param_1 + 0x4bd) == '\0') & param_2;

    *(byte *)(param_1 + 0x4bc) = param_2;

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x1c,param_2);

  }

  return;

}





// --- FUN_005a3fe0 at 0x005A3FE0 (size: 48) ---


void __thiscall FUN_005a3fe0(int param_1,char param_2)



{

  if (((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_1 + 0x4bd) != param_2)) &&

     (*(char *)(param_1 + 0x4bd) = param_2, param_2 == '\x01')) {

    FUN_005a3f90();

    return;

  }

  return;

}





// --- FUN_005a4010 at 0x005A4010 (size: 48) ---


void __thiscall FUN_005a4010(int param_1,char param_2)



{

  if (((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_1 + 0x4be) != param_2)) &&

     (*(char *)(param_1 + 0x4be) = param_2, param_2 == '\x01')) {

    FUN_005a3f90();

    return;

  }

  return;

}





// --- FUN_005a4040 at 0x005A4040 (size: 58) ---


void __thiscall FUN_005a4040(int param_1,char param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_1 + 0x4bf) != param_2)) {

    *(char *)(param_1 + 0x4bf) = param_2;

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))

              (*(int **)(param_1 + 0x468),0x1c,param_2 == '\0');

  }

  return;

}





// --- FUN_005a4080 at 0x005A4080 (size: 301) ---


void __thiscall FUN_005a4080(int param_1,undefined4 *param_2,float param_3,float param_4)



{

  int iVar1;

  char cVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  undefined4 unaff_retaddr;

  

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

    cVar2 = FUN_00423f40(param_2);

    if (cVar2 != '\0') goto LAB_005a4126;

  }

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

  iVar3 = FUN_005df4c4();

  uVar4 = FUN_005df4c4();

  uVar5 = FUN_005df4c4();

  uVar6 = FUN_005df4c4();

  (**(code **)(iVar1 + 0xe4))

            (*(undefined4 *)(param_1 + 0x468),0x22,((iVar3 << 8 | uVar4) << 8 | uVar5) << 8 | uVar6)

  ;

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

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

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

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

LAB_005a4126:

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(float *)(param_1 + 0x4c4) != param_3)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x24,param_3);

    *(float *)(param_1 + 0x4c4) = param_3;

  }

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(float *)(param_1 + 0x4c0) != param_4)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x25,param_4);

    *(undefined4 *)(param_1 + 0x4c0) = unaff_retaddr;

  }

  return;

}





// --- FUN_005a41b0 at 0x005A41B0 (size: 51) ---


void FUN_005a41b0(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  undefined1 local_10 [16];

  

  FUN_00430cd0(*param_1);

  FUN_005a4080(local_10,param_2,param_3);

  return;

}





// --- FUN_005a41f0 at 0x005A41F0 (size: 61) ---


void __thiscall FUN_005a41f0(int param_1,char param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_1 + 0x4c8) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x89,param_2);

    *(char *)(param_1 + 0x4c8) = param_2;

  }

  return;

}





// --- FUN_005a4230 at 0x005A4230 (size: 65) ---


void __thiscall FUN_005a4230(int param_1,int param_2,char param_3)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_2 + 0x4c9 + param_1) != param_3)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xd4))(*(int **)(param_1 + 0x468),param_2,param_3);

    *(char *)(param_2 + 0x4c9 + param_1) = param_3;

  }

  return;

}





// --- FUN_005a4280 at 0x005A4280 (size: 70) ---


void __thiscall FUN_005a4280(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x4d8) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))

              (*(int **)(param_1 + 0x468),0x92,(param_2 != 1) - 1U & 2);

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

  }

  return;

}





// --- FUN_005a42d0 at 0x005A42D0 (size: 58) ---


void __thiscall FUN_005a42d0(int param_1,char param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_1 + 0x4dc) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x1d,param_2);

    *(char *)(param_1 + 0x4dc) = param_2;

  }

  return;

}





// --- FUN_005a4310 at 0x005A4310 (size: 58) ---


void __thiscall FUN_005a4310(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x4d4) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x94,param_2);

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

  }

  return;

}





// --- FUN_005a4350 at 0x005A4350 (size: 55) ---


void __thiscall FUN_005a4350(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x4e0) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x3c,param_2);

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

  }

  return;

}





// --- FUN_005a4390 at 0x005A4390 (size: 55) ---


void __thiscall FUN_005a4390(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(param_1 + 0x4e4) != param_2)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),8,param_2);

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

  }

  return;

}





// --- FUN_005a43d0 at 0x005A43D0 (size: 75) ---


void __thiscall FUN_005a43d0(int param_1,char param_2)



{

  if ((((*(char *)(param_1 + 0x470) != '\0') || (*(char *)(param_1 + 0x4e8) != param_2)) &&

      (*(char *)(param_1 + 0x1e) != '\0')) && (*(char *)(param_1 + 0x5a) != '\0')) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xa1,param_2);

    *(char *)(param_1 + 0x4e8) = param_2;

  }

  return;

}





// --- FUN_005a4420 at 0x005A4420 (size: 59) ---


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



{

  undefined4 unaff_ESI;

  

  (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),param_2,1,param_3);

  (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),param_2,2,unaff_ESI)

  ;

  return;

}





// --- FUN_005a4460 at 0x005A4460 (size: 187) ---


void __thiscall FUN_005a4460(int param_1,undefined4 param_2,undefined4 param_3,int param_4)



{

  int unaff_EDI;

  int iVar1;

  

  if (param_4 == 2) {

    if (DAT_0081ffa0 == 3) {

      param_4 = 3;

LAB_005a4482:

      if ((*(uint *)(param_1 + 0x34c) & 0x400) == 0) {

        param_4 = 2;

      }

    }

  }

  else if (param_4 == 3) goto LAB_005a4482;

  iVar1 = 6;

  (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),param_2,6,param_4);

  if (unaff_EDI == 2) {

    if (DAT_0081ffa0 != 3) goto LAB_005a44d8;

    unaff_EDI = 3;

  }

  else if (unaff_EDI != 3) goto LAB_005a44d8;

  if ((*(uint *)(param_1 + 0x34c) & 0x4000000) == 0) {

    unaff_EDI = 2;

  }

LAB_005a44d8:

  (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),param_2,5,unaff_EDI)

  ;

  if ((iVar1 == 2) && (DAT_0081ffa0 == 0)) {

    iVar1 = 1;

  }

  (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),param_2,7,iVar1);

  return;

}





// --- FUN_005a4520 at 0x005A4520 (size: 38) ---


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



{

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

  return;

}





// --- FUN_005a4550 at 0x005A4550 (size: 178) ---


void __thiscall FUN_005a4550(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  int iVar1;

  

  if ((*(char *)(param_1 + 0x470) != '\0') ||

     (iVar1 = param_1 + param_2 * 0x24, *(int *)(iVar1 + 0x680) != param_3)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),param_2,4,param_3)

    ;

    iVar1 = param_1 + param_2 * 0x24;

    *(int *)(iVar1 + 0x680) = param_3;

  }

  if ((*(char *)(param_1 + 0x470) != '\0') ||

     (*(int *)(param_1 + (param_2 * 9 + 0x19e) * 4) != param_4)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),param_2,5,param_4)

    ;

    *(int *)(param_1 + (param_2 * 9 + 0x19e) * 4) = param_4;

  }

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(iVar1 + 0x67c) != param_5)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),param_2,6,param_5)

    ;

    *(int *)(iVar1 + 0x67c) = param_5;

  }

  return;

}





// --- FUN_005a4610 at 0x005A4610 (size: 170) ---


void __thiscall FUN_005a4610(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  int iVar1;

  

  if ((*(char *)(param_1 + 0x470) != '\0') ||

     (iVar1 = param_1 + param_2 * 0x24, *(int *)(iVar1 + 0x68c) != param_3)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),param_2,1,param_3)

    ;

    iVar1 = param_1 + param_2 * 0x24;

    *(int *)(iVar1 + 0x68c) = param_3;

  }

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(iVar1 + 0x684) != param_4)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),param_2,2,param_4)

    ;

    *(int *)(iVar1 + 0x684) = param_4;

  }

  if ((*(char *)(param_1 + 0x470) != '\0') || (*(int *)(iVar1 + 0x688) != param_5)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),param_2,3,param_5)

    ;

    *(int *)(iVar1 + 0x688) = param_5;

  }

  return;

}





// --- FUN_005a46c0 at 0x005A46C0 (size: 70) ---


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



{

  if ((*(char *)(param_1 + 0x470) != '\0') ||

     (*(int *)(param_1 + 0x690 + param_2 * 0x24) != param_3)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))

              (*(int **)(param_1 + 0x468),param_2,0xb,param_3);

    *(int *)(param_1 + 0x690 + param_2 * 0x24) = param_3;

  }

  return;

}





// --- FUN_005a4710 at 0x005A4710 (size: 70) ---


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



{

  if ((*(char *)(param_1 + 0x470) != '\0') ||

     (*(int *)(param_1 + 0x694 + param_2 * 0x24) != param_3)) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))

              (*(int **)(param_1 + 0x468),param_2,0x18,param_3);

    *(int *)(param_1 + 0x694 + param_2 * 0x24) = param_3;

  }

  return;

}





// --- FUN_005a4760 at 0x005A4760 (size: 111) ---


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



{

  char cVar1;

  int iVar2;

  

  iVar2 = 0;

  if (param_3 != 0) {

    if (*(char *)(param_3 + 0x38) != '\0') {

      cVar1 = (**(code **)(*(int *)(param_3 + 0x30) + 0xc))();

      if (cVar1 == '\0') goto LAB_005a4794;

    }

    if (*(int *)(param_3 + 0x58) == 2) {

      iVar2 = FUN_006968d0();

    }

  }

LAB_005a4794:

  if ((*(char *)(param_1 + 0x470) != '\0') || (iVar2 != *(int *)(param_1 + 0x674 + param_2 * 0x24)))

  {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x104))(*(int **)(param_1 + 0x468),param_2,iVar2);

    *(int *)(param_1 + 0x674 + param_2 * 0x24) = iVar2;

  }

  return;

}





// --- FUN_005a47d0 at 0x005A47D0 (size: 68) ---


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



{

  if ((*(char *)(param_1 + 0x470) != '\0') ||

     (param_3 != *(int *)(param_1 + 0x674 + param_2 * 0x24))) {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x104))(*(int **)(param_1 + 0x468),param_2,param_3);

    *(int *)(param_1 + 0x674 + param_2 * 0x24) = param_3;

  }

  return;

}





// --- FUN_005a4820 at 0x005A4820 (size: 49) ---


void __thiscall FUN_005a4820(int param_1,undefined4 *param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  

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

  puVar3 = param_2;

  puVar4 = (undefined4 *)(param_1 + 200);

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

    *puVar4 = *puVar3;

    puVar3 = puVar3 + 1;

    puVar4 = puVar4 + 1;

  }

  (**(code **)(*piVar1 + 0xb0))(piVar1,0x100,param_2);

  return;

}





// --- FUN_005a4860 at 0x005A4860 (size: 46) ---


void __thiscall FUN_005a4860(int param_1,undefined4 *param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  

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

  puVar3 = param_2;

  puVar4 = (undefined4 *)(param_1 + 0x108);

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

    *puVar4 = *puVar3;

    puVar3 = puVar3 + 1;

    puVar4 = puVar4 + 1;

  }

  (**(code **)(*piVar1 + 0xb0))(piVar1,2,param_2);

  return;

}





// --- FUN_005a4890 at 0x005A4890 (size: 46) ---


void __thiscall FUN_005a4890(int param_1,undefined4 *param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  

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

  puVar3 = param_2;

  puVar4 = (undefined4 *)(param_1 + 0x148);

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

    *puVar4 = *puVar3;

    puVar3 = puVar3 + 1;

    puVar4 = puVar4 + 1;

  }

  (**(code **)(*piVar1 + 0xb0))(piVar1,3,param_2);

  return;

}





// --- FUN_005a48c0 at 0x005A48C0 (size: 79) ---


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



void FUN_005a48c0(int param_1,int param_2,int param_3,int param_4,float *param_5,float *param_6)



{

  float fVar1;

  float fVar2;

  float fVar3;

  

  fVar1 = _DAT_007938b0 / (float)param_3;

  fVar3 = _DAT_007938b0 / (float)param_4;

  fVar2 = (float)param_1 * fVar1;

  *param_5 = (fVar2 + fVar2) - _DAT_007938b0;

  fVar2 = (float)param_2 * fVar3;

  *param_6 = -((fVar2 + fVar2) - _DAT_007938b0);

  *param_5 = *param_5 - fVar1;

  *param_6 = *param_6 - fVar3;

  return;

}





// --- FUN_005a4910 at 0x005A4910 (size: 2771) ---


undefined4 __fastcall FUN_005a4910(int param_1)



{

  undefined4 uVar1;

  uint uVar2;

  uint uVar3;

  int *piVar4;

  undefined4 uVar5;

  

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),7,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),8,3);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),9,2);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xe,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xf,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x10,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x13,2);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x14,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x16,3);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x17,4);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x18,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x19,7);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x1a,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x1b,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x1c,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x1d,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x22,0xaaaaaa);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x23,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x24,0x43c80000);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x25,0x44fa0000);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x26,0x3e4ccccd);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x30,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x34,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x35,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x36,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x37,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x38,8);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x39,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x3a,0xffffffff);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x3b,0xffffffff);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x3c,0xffffffff);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x80,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x81,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x82,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x83,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x84,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x85,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x86,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x87,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x88,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x89,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x8b,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x8c,3);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x8d,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x8e,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x8f,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x91,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x92,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x93,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x94,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x97,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x98,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x9a,0x3f800000);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x9b,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x9c,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x9d,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x9e,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x9f,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xa0,0x3f800000);

  if ((*(char *)(param_1 + 0x5a) == '\0') || (*(char *)(param_1 + 0x1e) == '\0')) {

    uVar1 = 0;

  }

  else {

    uVar1 = 1;

  }

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xa1,uVar1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xa2,0xffffffff);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xa3,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xa5,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))

            (*(int **)(param_1 + 0x468),0xa6,*(undefined4 *)(param_1 + 0x3bc));

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xa7,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xa8,7);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xaa,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xab,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xac,3);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xad,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xae,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xb0,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xb2,0x3f800000);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xb3,0x3f800000);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xb4,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xb5,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xb6,0x3f800000);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xb7,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xb8,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xba,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xbb,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xbc,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xbd,8);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xc1,0xffffffff);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xc2,0);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0xc3,0);

  uVar2 = 0;

  do {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,1,1);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,2,2);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,3,0);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,4,1);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,5,2);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,6,0);

    uVar5 = 7;

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,7,0);

    uVar1 = 0;

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,8,0);

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

    (**(code **)(*piVar4 + 0x10c))(piVar4,uVar2,9,uVar5);

    uVar3 = uVar2;

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,10,uVar1);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,0xb,uVar2);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,0x16,piVar4)

    ;

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,0x17,uVar3);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,0x18,0);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,0x1a,1);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,0x1b,1);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x10c))(*(int **)(param_1 + 0x468),uVar2,0x1c,1);

    uVar2 = uVar2 + 1;

  } while (uVar2 < 8);

  uVar2 = 0;

  do {

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,1,1);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,2,1);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,3,3);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,4,0);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,5,2);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,6,2);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,7,1);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,8,0);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,9,0);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))

              (*(int **)(param_1 + 0x468),uVar2,10,*(undefined4 *)(param_1 + 0x378));

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,0xb,0);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,0xc,0);

    (**(code **)(**(int **)(param_1 + 0x468) + 0x114))(*(int **)(param_1 + 0x468),uVar2,0xd,0x100);

    uVar2 = uVar2 + 1;

  } while (uVar2 < 0x10);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x8c,3);

  (**(code **)(**(int **)(param_1 + 0x468) + 0xe4))(*(int **)(param_1 + 0x468),0x30,1);

  (**(code **)(**(int **)(param_1 + 0x468) + 0x134))

            (*(int **)(param_1 + 0x468),*(char *)(param_1 + 0x4c) == '\0');

  return 1;

}





// --- FUN_005a53f0 at 0x005A53F0 (size: 51) ---


void FUN_005a53f0(ushort param_1,undefined4 *param_2)



{

  int iVar1;

  uint uVar2;

  

  if (param_1 != 0) {

    uVar2 = (uint)param_1;

    do {

      iVar1 = FUN_0052e870(*param_2);

      if (iVar1 != 0) {

        *(int *)(iVar1 + 0x134) = *(int *)(iVar1 + 0x134) + -1;

      }

      param_2 = param_2 + 1;

      uVar2 = uVar2 - 1;

    } while (uVar2 != 0);

  }

  return;

}





// --- FUN_005a5430 at 0x005A5430 (size: 372) ---


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



void FUN_005a5430(int param_1,int *param_2,int param_3,uint *param_4,int param_5)



{

  undefined4 uVar1;

  uint uVar2;

  undefined4 *puVar3;

  int iVar4;

  undefined4 local_80 [32];

  

  *param_4 = 0;

  iVar4 = 0;

  if (*(char *)((int)param_2 + 0xe) != '\0') {

    do {

      uVar1 = FUN_0059c9a0(*(undefined4 *)(*param_2 + iVar4 * 4),1);

      *(undefined4 *)(param_2[2] + iVar4 * 4) = uVar1;

      iVar4 = iVar4 + 1;

    } while (iVar4 < (int)(uint)*(byte *)((int)param_2 + 0xe));

  }

  if (param_5 == 0) {

    uVar2 = (uint)*(byte *)((int)param_2 + 0xe);

    *param_4 = uVar2;

    if (param_1 == 0) {

      iVar4 = 0;

      if (uVar2 != 0) {

        do {

          *(undefined4 *)(param_3 + iVar4 * 4) = *(undefined4 *)(param_2[2] + iVar4 * 4);

          iVar4 = iVar4 + 1;

        } while (iVar4 < (int)*param_4);

        return;

      }

    }

    else {

      iVar4 = 0;

      if (uVar2 != 0) {

        do {

          *(undefined4 *)(param_3 + iVar4 * 4) =

               *(undefined4 *)(param_2[2] + -4 + ((uint)*(byte *)((int)param_2 + 0xe) - iVar4) * 4);

          iVar4 = iVar4 + 1;

        } while (iVar4 < (int)*param_4);

      }

    }

    return;

  }

  if (param_1 != 0) {

    uVar2 = (uint)*(byte *)((int)param_2 + 0xe);

    iVar4 = 0;

    if (uVar2 != 0) {

      puVar3 = (undefined4 *)(param_2[2] + -4 + uVar2 * 4);

      do {

        local_80[iVar4] = *puVar3;

        iVar4 = iVar4 + 1;

        puVar3 = puVar3 + -1;

      } while (iVar4 < (int)uVar2);

    }

    _DAT_0086730c = 0;

    _DAT_00847064 = 0x3f800000;

    _DAT_008470c8 = 1;

    FUN_006b7c40(local_80,uVar2,param_3,param_4,0);

    return;

  }

  _DAT_0086730c = 0;

  _DAT_00847064 = 0x3f800000;

  _DAT_008470c8 = 1;

  FUN_006b7c40(param_2[2],*(undefined1 *)((int)param_2 + 0xe),param_3,param_4,0);

  return;

}





// --- FUN_005a55b0 at 0x005A55B0 (size: 98) ---


void __thiscall FUN_005a55b0(int *param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

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

    FUN_005a5740(param_2);

    return;

  }

  iVar2 = thunk_FUN_005df0f5(param_2 * 8);

  uVar3 = 0;

  if (param_1[3] != 0) {

    do {

      iVar1 = *param_1;

      *(undefined4 *)(iVar2 + uVar3 * 8) = *(undefined4 *)(iVar1 + uVar3 * 8);

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

      uVar3 = uVar3 + 1;

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

  }

  operator_delete__((void *)*param_1);

  *param_1 = iVar2;

  param_1[3] = param_2;

  return;

}





// --- FUN_005a5620 at 0x005A5620 (size: 90) ---


void __thiscall FUN_005a5620(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    FUN_005a57d0(param_2);

    return;

  }

  iVar1 = thunk_FUN_005df0f5(param_2 * 4);

  uVar2 = 0;

  if (param_1[3] != 0) {

    do {

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

      uVar2 = uVar2 + 1;

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

  }

  operator_delete__((void *)*param_1);

  *param_1 = iVar1;

  param_1[3] = param_2;

  return;

}





// --- FUN_005a5680 at 0x005A5680 (size: 90) ---


void __thiscall FUN_005a5680(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    FUN_005a5850(param_2);

    return;

  }

  iVar1 = thunk_FUN_005df0f5(param_2 * 4);

  uVar2 = 0;

  if (param_1[3] != 0) {

    do {

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

      uVar2 = uVar2 + 1;

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

  }

  operator_delete__((void *)*param_1);

  *param_1 = iVar1;

  param_1[3] = param_2;

  return;

}





// --- FUN_005a56e0 at 0x005A56E0 (size: 90) ---


void __thiscall FUN_005a56e0(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    FUN_005a58d0(param_2);

    return;

  }

  iVar1 = thunk_FUN_005df0f5(param_2 * 4);

  uVar2 = 0;

  if (param_1[3] != 0) {

    do {

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

      uVar2 = uVar2 + 1;

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

  }

  operator_delete__((void *)*param_1);

  *param_1 = iVar1;

  param_1[3] = param_2;

  return;

}





// --- FUN_005a5740 at 0x005A5740 (size: 131) ---


void __thiscall FUN_005a5740(int *param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

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

    if (param_2 == 0) {

      param_1[3] = 0;

      operator_delete__((void *)*param_1);

      *param_1 = 0;

    }

    else {

      iVar2 = thunk_FUN_005df0f5(param_2 * 8);

      uVar3 = 0;

      param_1[3] = param_2;

      if (param_2 != 0) {

        do {

          iVar1 = *param_1;

          *(undefined4 *)(iVar2 + uVar3 * 8) = *(undefined4 *)(iVar1 + uVar3 * 8);

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

          uVar3 = uVar3 + 1;

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

      }

      operator_delete__((void *)*param_1);

      *param_1 = iVar2;

    }

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

      param_1[2] = param_2;

    }

    return;

  }

  FUN_005a55b0(param_2);

  return;

}





// --- FUN_005a57d0 at 0x005A57D0 (size: 123) ---


void __thiscall FUN_005a57d0(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    if (param_2 == 0) {

      param_1[3] = 0;

      operator_delete__((void *)*param_1);

      *param_1 = 0;

    }

    else {

      iVar1 = thunk_FUN_005df0f5(param_2 * 4);

      uVar2 = 0;

      param_1[3] = param_2;

      if (param_2 != 0) {

        do {

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

          uVar2 = uVar2 + 1;

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

      }

      operator_delete__((void *)*param_1);

      *param_1 = iVar1;

    }

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

      param_1[2] = param_2;

    }

    return;

  }

  FUN_005a5620(param_2);

  return;

}





// --- FUN_005a5850 at 0x005A5850 (size: 123) ---


void __thiscall FUN_005a5850(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    if (param_2 == 0) {

      param_1[3] = 0;

      operator_delete__((void *)*param_1);

      *param_1 = 0;

    }

    else {

      iVar1 = thunk_FUN_005df0f5(param_2 * 4);

      uVar2 = 0;

      param_1[3] = param_2;

      if (param_2 != 0) {

        do {

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

          uVar2 = uVar2 + 1;

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

      }

      operator_delete__((void *)*param_1);

      *param_1 = iVar1;

    }

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

      param_1[2] = param_2;

    }

    return;

  }

  FUN_005a5680(param_2);

  return;

}





// --- FUN_005a58d0 at 0x005A58D0 (size: 123) ---


void __thiscall FUN_005a58d0(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    if (param_2 == 0) {

      param_1[3] = 0;

      operator_delete__((void *)*param_1);

      *param_1 = 0;

    }

    else {

      iVar1 = thunk_FUN_005df0f5(param_2 * 4);

      uVar2 = 0;

      param_1[3] = param_2;

      if (param_2 != 0) {

        do {

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

          uVar2 = uVar2 + 1;

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

      }

      operator_delete__((void *)*param_1);

      *param_1 = iVar1;

    }

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

      param_1[2] = param_2;

    }

    return;

  }

  FUN_005a56e0(param_2);

  return;

}





// --- FUN_005a5950 at 0x005A5950 (size: 795) ---


void __fastcall FUN_005a5950(int param_1)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  bool bVar6;

  uint uStack_18;

  

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

    FUN_0054e060(1);

    DAT_00867330 = param_1;

    FUN_00506d90();

    FUN_0059e3f0(0);

    DAT_00870340[0x2c] = DAT_00870340[0x2c] + 1;

    if ((DAT_008ee834 != 0) || (bVar6 = DAT_008729c4 != 0, DAT_008729c4 = 0, bVar6)) {

      (**(code **)(*DAT_00870340 + 0x2c))(4,&DAT_00821fd0,0x3f800000);

    }

    for (iVar3 = *(int *)(param_1 + 0x60); iVar3 != 0; iVar3 = iVar3 + -1) {

      iVar1 = *(int *)(*(int *)(param_1 + 0x50) + -4 + iVar3 * 4);

      if (*(int *)(*(int *)(iVar1 + 0x100) + 0x44) != 0) {

        FUN_005a0ff0(0,0);

        FUN_0054c3c0(*(undefined4 *)(iVar1 + 0xfc));

        DAT_0081fec0 = 0x3f800000;

        DAT_0081fec4 = 0x3f800000;

        DAT_0081fec8 = 0x3f800000;

        DAT_0081fc84 = 0x3f800000;

        FUN_0054c9c0(3,iVar1 + 0x54);

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

          uStack_18 = 0xffffffff;

LAB_005a5a81:

          uStack_18 = uStack_18 & 0xffff;

          iVar4 = 0;

          do {

            FUN_0052d040(iVar4);

            uVar2 = 0;

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

              iVar5 = 0;

              do {

                if (*(int *)(*(int *)(iVar1 + 0x10c) + iVar5) == -1) {

                  FUN_0059cca0(*(undefined4 *)(*(int *)(iVar1 + 0x10c) + iVar5 + 8),0);

                }

                uVar2 = uVar2 + 1;

                iVar5 = iVar5 + 0x18;

              } while (uVar2 < *(uint *)(iVar1 + 0x108));

            }

            iVar4 = iVar4 + 1;

            uStack_18 = uStack_18 - 1;

          } while (uStack_18 != 0);

        }

        else {

          uStack_18 = *(uint *)(*(int *)(*(int *)(iVar1 + 0x138) + -4 + *(int *)(iVar1 + 0x134) * 4)

                               + 0x38);

          if ((short)uStack_18 != 0) goto LAB_005a5a81;

        }

        FUN_0054c9e0();

      }

    }

  }

  FUN_0054e060(0);

  FUN_0054ce30();

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

  do {

    if (iVar3 == 0) {

      for (iVar3 = *(int *)(param_1 + 0x60); iVar3 != 0; iVar3 = iVar3 + -1) {

        iVar1 = *(int *)(*(int *)(param_1 + 0x50) + -4 + iVar3 * 4);

        DAT_00867330 = *(int *)(*(int *)(iVar1 + 0x138) + -4 + *(int *)(iVar1 + 0x134) * 4);

        (**(code **)(*DAT_00870340 + 100))(iVar1);

      }

      DAT_0081fec0 = 0x3f800000;

      DAT_0081fec4 = 0x3f800000;

      DAT_0081fec8 = 0x3f800000;

      DAT_0081fc84 = 0x3f800000;

      FUN_0054e060(1);

      return;

    }

    iVar1 = *(int *)(*(int *)(param_1 + 0x50) + -4 + iVar3 * 4);

    if (*(int *)(*(int *)(iVar1 + 0x100) + 0x44) != 0) {

      FUN_005a0ff0(0,0);

      FUN_0054c3c0(*(undefined4 *)(iVar1 + 0xfc));

      DAT_0081fec0 = 0x3f800000;

      DAT_0081fec4 = 0x3f800000;

      DAT_0081fec8 = 0x3f800000;

      DAT_0081fc84 = 0x3f800000;

      FUN_0054c9c0(3,iVar1 + 0x54);

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

        uVar2 = 0xffffffff;

LAB_005a5bc1:

        iVar4 = 0;

        uVar2 = uVar2 & 0xffff;

        do {

          FUN_0052d040(iVar4);

          (**(code **)(*DAT_00870340 + 0x5c))(iVar1);

          iVar4 = iVar4 + 1;

          uVar2 = uVar2 - 1;

        } while (uVar2 != 0);

      }

      else {

        uVar2 = *(uint *)(*(int *)(*(int *)(iVar1 + 0x138) + -4 + *(int *)(iVar1 + 0x134) * 4) +

                         0x38);

        if ((short)uVar2 != 0) goto LAB_005a5bc1;

      }

      FUN_0054c9e0();

    }

    iVar3 = iVar3 + -1;

  } while( true );

}





// --- FUN_005a5c80 at 0x005A5C80 (size: 531) ---


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



undefined4 FUN_005a5c80(float param_1,ushort param_2)



{

  uint *puVar1;

  int *piVar2;

  int *piVar3;

  float *pfVar4;

  float fVar5;

  int iVar6;

  int iVar7;

  uint uVar8;

  undefined4 *puVar9;

  uint uVar10;

  int local_8;

  int local_4;

  

  iVar6 = (int)param_1;

  piVar3 = *(int **)(*(int *)((int)param_1 + 0x138) + -4 + *(int *)((int)param_1 + 0x134) * 4);

  uVar10 = 0;

  if (piVar3[0xe] == 0) {

    return 0;

  }

  FUN_0054c9c0(3,(int)param_1 + 0x54);

  piVar3[0xf] = 0;

  piVar3[0x10] = DAT_008ee6c8;

  puVar1 = (uint *)((int)param_1 + 0x108);

  param_1 = 0.0;

  if ((uint)piVar3[3] < *puVar1) {

    FUN_005a55b0(*puVar1);

  }

  if (*(int *)(iVar6 + 0x108) != 0) {

    local_8 = 0;

    do {

      puVar9 = *(undefined4 **)(local_8 + 8 + *(int *)(iVar6 + 0x10c));

      if ((uVar10 == param_2) && (*(int *)(*piVar3 + 4 + uVar10 * 8) == 0)) {

        *(undefined4 *)(*piVar3 + 4 + uVar10 * 8) = 1;

        *(undefined4 *)(*piVar3 + uVar10 * 8) = 1;

      }

      else {

        *(undefined4 *)(*piVar3 + uVar10 * 8) = 0;

        fVar5 = (float)puVar9[8] * *DAT_00867334 +

                DAT_00867334[1] * (float)puVar9[9] + DAT_00867334[2] * (float)puVar9[10] +

                (float)puVar9[0xb];

        if (fVar5 <= _DAT_007e6a00) {

          if (fVar5 < -_DAT_007e6a00) {

            iVar7 = 1;

            goto LAB_005a5d83;

          }

        }

        else {

          iVar7 = 0;

LAB_005a5d83:

          if (iVar7 != *(int *)(local_8 + 0xc + *(int *)(iVar6 + 0x10c))) {

            *(undefined4 *)(*piVar3 + 4 + uVar10 * 8) = 1;

            goto LAB_005a5dad;

          }

        }

        *(undefined4 *)(*piVar3 + 4 + uVar10 * 8) = 0;

        local_4 = 1;

      }

LAB_005a5dad:

      if ((*(int *)(*piVar3 + 4 + uVar10 * 8) == 1) &&

         (uVar8 = (uint)*(byte *)((int)puVar9 + 0xe), uVar8 != 0)) {

        puVar9 = (undefined4 *)*puVar9;

        do {

          pfVar4 = (float *)*puVar9;

          fVar5 = (DAT_00867334[1] - pfVar4[1]) * (DAT_00867334[1] - pfVar4[1]) +

                  (*DAT_00867334 - *pfVar4) * (*DAT_00867334 - *pfVar4) +

                  (DAT_00867334[2] - pfVar4[2]) * (DAT_00867334[2] - pfVar4[2]);

          if (param_1 < fVar5) {

            param_1 = fVar5;

          }

          puVar9 = puVar9 + 1;

          uVar8 = uVar8 - 1;

        } while (uVar8 != 0);

      }

      uVar10 = uVar10 + 1;

      local_8 = local_8 + 0x18;

    } while (uVar10 < *(uint *)(iVar6 + 0x108));

  }

  piVar3[0xd] = (int)param_1;

  if ((local_4 != 0) && (piVar3[0xe] != 0)) {

    uVar10 = 0;

    do {

      FUN_0054dcf0(piVar3 + 4,uVar10);

      uVar8 = 0;

      if (*(int *)(iVar6 + 0x108) != 0) {

        do {

          piVar2 = (int *)(*piVar3 + uVar8 * 8);

          if ((piVar2[1] == 0) && (*piVar2 == 0)) {

            *piVar2 = 1;

          }

          uVar8 = uVar8 + 1;

        } while (uVar8 < *(uint *)(iVar6 + 0x108));

      }

      uVar10 = uVar10 + 1;

    } while (uVar10 < (uint)piVar3[0xe]);

  }

  piVar3[0x11] = piVar3[0xe];

  FUN_0054c9e0();

  return 1;

}





// --- FUN_005a5ea0 at 0x005A5EA0 (size: 157) ---


void FUN_005a5ea0(int param_1,ushort param_2)



{

  int *piVar1;

  int *piVar2;

  uint uVar3;

  uint uVar4;

  

  FUN_0054c9c0(3,param_1 + 0x54);

  piVar2 = *(int **)(*(int *)(param_1 + 0x138) + -4 + *(int *)(param_1 + 0x134) * 4);

  uVar4 = piVar2[0x11];

  if (uVar4 < (uint)piVar2[0xe]) {

    do {

      FUN_0054dcf0(piVar2 + 4,uVar4);

      uVar3 = 0;

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

        do {

          if ((uVar3 == param_2) && (*(int *)(*piVar2 + 4 + uVar3 * 8) == 0)) {

            *(undefined4 *)(*piVar2 + 4 + uVar3 * 8) = 1;

          }

          piVar1 = (int *)(*piVar2 + uVar3 * 8);

          if ((*(int *)(*piVar2 + 4 + uVar3 * 8) == 0) && (*piVar1 == 0)) {

            *piVar1 = 1;

          }

          uVar3 = uVar3 + 1;

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

      }

      uVar4 = uVar4 + 1;

    } while (uVar4 < (uint)piVar2[0xe]);

  }

  FUN_0054c9e0();

  return;

}





// --- FUN_005a5f40 at 0x005A5F40 (size: 89) ---


void FUN_005a5f40(int param_1,int param_2)



{

  int iVar1;

  undefined4 *puVar2;

  int iVar3;

  int iVar4;

  

  iVar1 = *(int *)(param_1 + 0x10c) + param_2 * 0x18;

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

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

  iVar1 = *(int *)(iVar3 + 0x10c) + iVar4 * 0x18;

  puVar2 = (undefined4 *)

           (**(int **)(*(int *)(iVar3 + 0x138) + -4 + *(int *)(iVar3 + 0x134) * 4) + iVar4 * 8);

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

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

  }

  if (puVar2[1] != 0) {

    *puVar2 = 1;

  }

  return;

}





// --- FUN_005a5fa0 at 0x005A5FA0 (size: 184) ---


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



{

  uint uVar1;

  int iVar2;

  int *piVar3;

  uint uVar4;

  uint uVar5;

  

  uVar4 = 0;

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

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

    do {

      if (*(int *)(*piVar3 + 0x28) == *(int *)(param_3 + 0x28)) {

        return 0;

      }

      if (*(int *)(*piVar3 + 0x28) == *(int *)(param_2 + 0x28)) {

        uVar5 = uVar4;

        if (*(uint *)(param_1 + 0x60) <= uVar4) goto LAB_005a6006;

        piVar3 = *(int **)(param_1 + 0x50) + uVar4;

        goto LAB_005a5ff4;

      }

      uVar4 = uVar4 + 1;

      piVar3 = piVar3 + 1;

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

  }

  return 0;

  while( true ) {

    uVar5 = uVar5 + 1;

    piVar3 = piVar3 + 1;

    if (*(uint *)(param_1 + 0x60) <= uVar5) break;

LAB_005a5ff4:

    if (*(int *)(*piVar3 + 0x28) == *(int *)(param_3 + 0x28)) break;

  }

LAB_005a6006:

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

  if (uVar5 == uVar1) {

    if (*(uint *)(param_1 + 0x5c) <= uVar1) {

      FUN_005a5620(uVar1 + 100);

    }

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

  }

  for (; uVar4 < uVar5; uVar5 = uVar5 - 1) {

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

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

  }

  *(int *)(*(int *)(param_1 + 0x50) + uVar4 * 4) = param_3;

  return 1;

}





// --- FUN_005a6060 at 0x005A6060 (size: 181) ---


void __thiscall FUN_005a6060(int param_1,undefined4 param_2,float param_3)



{

  int iVar1;

  uint uVar2;

  undefined4 *puVar3;

  int iVar4;

  

  if (*(uint *)(param_1 + 0x70) <= *(uint *)(param_1 + 0x74)) {

    FUN_005a5680(*(uint *)(param_1 + 0x74) + 0x1e);

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

    if (uVar2 < *(uint *)(param_1 + 0x70)) {

      do {

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

        uVar2 = uVar2 + 1;

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

    }

  }

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

    puVar3 = (undefined4 *)FUN_005df0f5(8);

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

      puVar3 = (undefined4 *)0x0;

    }

    else {

      *puVar3 = 0;

      puVar3[1] = 0;

    }

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

  }

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

  *puVar3 = param_2;

  puVar3[1] = param_3;

  for (iVar4 = *(int *)(param_1 + 0x74); iVar4 != 0; iVar4 = iVar4 + -1) {

    iVar1 = *(int *)(*(int *)(param_1 + 100) + -4 + iVar4 * 4);

    if (param_3 < *(float *)(iVar1 + 4)) break;

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

  }

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

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

  return;

}





// --- FUN_005a6120 at 0x005A6120 (size: 127) ---


void FUN_005a6120(undefined4 param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  

  piVar1 = *(int **)(*(int *)(param_2 + 0x138) + -4 + *(int *)(param_2 + 0x134) * 4);

  iVar3 = FUN_005a5fa0(param_1,param_2);

  if ((iVar3 != 0) && (uVar4 = 0, *(int *)(param_2 + 0x108) != 0)) {

    iVar3 = 0;

    do {

      iVar2 = *piVar1;

      if ((*(int *)(iVar2 + uVar4 * 8) == 1) && (*(int *)(iVar2 + uVar4 * 8 + 4) == 1)) {

        FUN_005a6120(param_2,*(undefined4 *)(*(int *)(param_2 + 0x10c) + 4 + iVar3));

      }

      uVar4 = uVar4 + 1;

      iVar3 = iVar3 + 0x18;

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

  }

  return;

}





// --- FUN_005a61a0 at 0x005A61A0 (size: 213) ---


void __fastcall FUN_005a61a0(int param_1)



{

  undefined4 *puVar1;

  

  if (*(uint *)(param_1 + 0x144) <= *(uint *)(param_1 + 0x134)) {

    FUN_005a56e0(*(uint *)(param_1 + 0x134) + 1);

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

  }

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

    puVar1 = (undefined4 *)FUN_005df0f5(0x48);

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

      puVar1 = (undefined4 *)0x0;

    }

    else {

      *puVar1 = 0;

      puVar1[3] = 0;

      puVar1[2] = 0;

      puVar1[1] = 0x80;

      puVar1[5] = 0;

      puVar1[8] = 0;

      puVar1[7] = 0;

      puVar1[6] = 0x80;

      puVar1[9] = 0;

      puVar1[0xc] = 0;

      puVar1[0xb] = 0;

      puVar1[10] = 0x80;

      puVar1[0x10] = 0;

    }

    *(undefined4 **)(*(int *)(param_1 + 0x138) + *(int *)(param_1 + 0x134) * 4) = puVar1;

  }

  *(undefined4 *)(*(int *)(*(int *)(param_1 + 0x138) + *(int *)(param_1 + 0x134) * 4) + 0x38) = 0;

  *(undefined4 *)(*(int *)(*(int *)(param_1 + 0x138) + *(int *)(param_1 + 0x134) * 4) + 0x44) = 0;

  *(undefined4 *)(*(int *)(*(int *)(param_1 + 0x138) + *(int *)(param_1 + 0x134) * 4) + 0x40) = 0;

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

  return;

}





// --- FUN_005a6280 at 0x005A6280 (size: 159) ---


void __fastcall FUN_005a6280(undefined4 *param_1)



{

  void *pvVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  

  uVar4 = 0;

  if (param_1[0x1c] != 0) {

    do {

      pvVar1 = *(void **)(param_1[0x19] + uVar4 * 4);

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

        operator_delete(pvVar1);

        *(undefined4 *)(param_1[0x19] + uVar4 * 4) = 0;

      }

      uVar4 = uVar4 + 1;

    } while (uVar4 < (uint)param_1[0x1c]);

  }

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

  param_1[0x19] = 0;

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

  param_1[0x14] = 0;

  iVar2 = param_1[9];

  if (iVar2 != 0) {

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

    if (-1 < iVar3 + -1) {

      do {

        FUN_00695670();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

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

  }

  param_1[9] = 0;

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

  param_1[5] = 0;

  operator_delete__((void *)*param_1);

  *param_1 = 0;

  return;

}





// --- FUN_005a6320 at 0x005A6320 (size: 52) ---


void FUN_005a6320(ushort param_1,undefined4 *param_2)



{

  int iVar1;

  uint uVar2;

  

  if (param_1 != 0) {

    uVar2 = (uint)param_1;

    do {

      iVar1 = FUN_0052e870(*param_2);

      if (iVar1 != 0) {

        FUN_005a61a0();

      }

      param_2 = param_2 + 1;

      uVar2 = uVar2 - 1;

    } while (uVar2 != 0);

  }

  return;

}





// --- FUN_005a6360 at 0x005A6360 (size: 32) ---


void FUN_005a6360(undefined4 param_1,undefined4 param_2)



{

  FUN_005a6120(param_1,param_2);

  FUN_005a6880(param_1);

  return;

}





// --- FUN_005a6380 at 0x005A6380 (size: 87) ---


void __thiscall FUN_005a6380(undefined4 *param_1,undefined4 param_2)



{

  *param_1 = 0;

  param_1[3] = 0;

  param_1[2] = 0;

  param_1[1] = 0x80;

  param_1[5] = 0;

  param_1[8] = 0;

  param_1[7] = 0;

  param_1[6] = 0x80;

  param_1[9] = 0;

  param_1[0xc] = 0;

  param_1[0xb] = 0;

  param_1[10] = 0x80;

  param_1[0x10] = 0;

  param_1[0x14] = 0;

  param_1[0x17] = 0;

  param_1[0x16] = 0;

  param_1[0x15] = 0x80;

  param_1[0x19] = 0;

  param_1[0x1c] = 0;

  param_1[0x1b] = 0;

  param_1[0x1a] = 0x80;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x12] = param_2;

  return;

}





// --- FUN_005a63e0 at 0x005A63E0 (size: 301) ---


void FUN_005a63e0(int param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  uint local_4;

  

  iVar4 = param_1;

  local_4 = 0;

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

    param_1 = 0;

    do {

      iVar6 = *(int *)(iVar4 + 0x10c) + param_1;

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

      piVar1 = (int *)(**(int **)(*(int *)(iVar4 + 0x138) + -4 + *(int *)(iVar4 + 0x134) * 4) +

                      local_4 * 8);

      if ((((iVar2 != 0) && (piVar1[1] != 1)) && (*piVar1 != 0)) && (*(int *)(iVar2 + 0x134) != 0))

      {

        iVar3 = *(int *)(*(int *)(iVar2 + 0x138) + -4 + *(int *)(iVar2 + 0x134) * 4);

        if (*(int *)(iVar3 + 0x38) != 0) {

          if (*(int *)(iVar3 + 0x44) == 0) {

            iVar5 = FUN_005a5c80(iVar2,*(undefined2 *)(iVar6 + 0x10));

            if (iVar5 != 0) {

              FUN_005a6060(iVar2,*(undefined4 *)(iVar3 + 0x34));

            }

          }

          else {

            if (*(int *)(iVar3 + 0x44) == *(int *)(iVar3 + 0x38)) goto LAB_005a64e1;

            FUN_005a5ea0(iVar2,*(undefined2 *)(iVar6 + 0x10));

            if (*(int *)(iVar3 + 0x3c) == 0) {

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

            }

            else {

              FUN_005a6360(iVar2,iVar4);

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

            }

          }

          if (-1 < *(int *)(iVar6 + 0x10)) {

            FUN_005a5f40(iVar4,local_4);

          }

        }

      }

LAB_005a64e1:

      local_4 = local_4 + 1;

      param_1 = param_1 + 0x18;

    } while (local_4 < *(uint *)(iVar4 + 0x108));

  }

  return;

}





// --- FUN_005a6510 at 0x005A6510 (size: 273) ---


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



bool FUN_005a6510(int param_1,undefined4 param_2,int *param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  if ((DAT_008ee880 & 1) == 0) {

    DAT_008ee880 = DAT_008ee880 | 1;

    DAT_008ee838 = 0;

    _DAT_008ee844 = 0;

    _DAT_008ee840 = 0;

    _DAT_008ee83c = 0x80;

    DAT_008ee84c = 0;

    _DAT_008ee858 = 0;

    _DAT_008ee854 = 0;

    _DAT_008ee850 = 0x80;

    _DAT_008ee85c = 0;

    _DAT_008ee868 = 0;

    _DAT_008ee864 = 0;

    _DAT_008ee860 = 0x80;

    _DAT_008ee878 = 0;

    _atexit((_func_4879 *)&LAB_00777eb0);

  }

  _DAT_008ee870 = 0;

  iVar3 = FUN_0054ebd0(&DAT_008ee838,param_2,*param_3);

  if (iVar3 == 0) {

    return false;

  }

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

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

  iVar2 = *(int *)(iVar1 + 0xc + iVar3 * 0x18);

  FUN_0054c9c0(3,*(int *)(param_1 + 4) + 0x54);

  FUN_0054dcf0(&DAT_008ee848,0);

  FUN_005a5430(iVar2 == 0,*(undefined4 *)(iVar1 + iVar3 * 0x18 + 8),param_2,param_3,1);

  FUN_0054c9e0();

  return *param_3 != 0;

}





// --- FUN_005a6630 at 0x005A6630 (size: 583) ---


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



{

  int *piVar1;

  int iVar2;

  int iVar3;

  int *piVar4;

  int iVar5;

  undefined *puVar6;

  int local_10;

  int local_c;

  int local_8;

  int local_4;

  

  piVar1 = *(int **)(*(int *)(param_2 + 0x138) + -4 + *(int *)(param_2 + 0x134) * 4);

  iVar3 = 0;

  iVar5 = 0;

  local_c = 0;

  DAT_00867330 = piVar1;

  local_4 = param_1;

  if (0 < *(int *)(param_2 + 0x108)) {

    do {

      if ((*(int *)(*piVar1 + iVar5 * 8) != 0) && (*(int *)(*piVar1 + iVar5 * 8 + 4) != 1)) {

        piVar4 = (int *)(*(int *)(param_2 + 0x10c) + iVar3);

        if ((*(int *)(*(int *)(param_2 + 0x10c) + 4 + iVar3) == 0) && (iVar2 = *piVar4, iVar2 != -1)

           ) {

          iVar2 = FUN_0052e870(iVar2);

          piVar4[1] = iVar2;

          if (iVar2 == 0) goto LAB_005a66b1;

        }

        local_c = 1;

      }

LAB_005a66b1:

      iVar5 = iVar5 + 1;

      iVar3 = iVar3 + 0x18;

    } while (iVar5 < *(int *)(param_2 + 0x108));

    if (local_c != 0) {

      FUN_0054c9c0(3,param_2 + 0x54);

      if (param_3 < piVar1[0xe]) {

        do {

          FUN_0054dcf0(piVar1 + 4,param_3);

          local_8 = 0;

          if (0 < *(int *)(param_2 + 0x108)) {

            local_c = 0;

            do {

              iVar3 = local_4;

              piVar4 = (int *)(*piVar1 + local_8 * 8);

              if ((*piVar4 != 0) && (piVar4[1] != 1)) {

                iVar5 = *(int *)(param_2 + 0x10c);

                piVar4 = (int *)(iVar5 + local_c);

                FUN_005a5430(*(undefined4 *)(iVar5 + 0xc + local_c),

                             *(undefined4 *)(iVar5 + 8 + local_c),&DAT_008ee888,&local_10,1);

                if (local_10 != 0) {

                  iVar5 = piVar4[1];

                  if (*piVar4 == -1) {

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

                      if (DAT_00821f5c == 0) {

                        if (*(int *)(iVar3 + 0x48) == 0) goto LAB_005a6829;

                        puVar6 = (undefined *)0x0;

                        iVar5 = 0;

                      }

                      else {

                        puVar6 = &DAT_008ee888;

                        iVar5 = local_10;

                      }

LAB_005a6821:

                      FUN_0054ebd0(iVar3,puVar6,iVar5);

                    }

                  }

                  else if (iVar5 != 0) {

                    if ((piVar4[5] == 0) && (-1 < piVar4[4])) {

                      iVar3 = FUN_005a6510(piVar4,&DAT_008ee888,&local_10);

                      if (iVar3 == 0) {

                        FUN_0054dcf0(piVar1 + 4,param_3);

                        goto LAB_005a6829;

                      }

                      FUN_0054dcf0(piVar1 + 4,param_3);

                    }

                    if (*(int *)(iVar5 + 0x134) != 0) {

                      iVar3 = *(int *)(*(int *)(iVar5 + 0x138) + -4 + *(int *)(iVar5 + 0x134) * 4);

                      puVar6 = &DAT_008ee888;

                      iVar5 = local_10;

                      goto LAB_005a6821;

                    }

                  }

                }

              }

LAB_005a6829:

              local_8 = local_8 + 1;

              local_c = local_c + 0x18;

            } while (local_8 < *(int *)(param_2 + 0x108));

          }

          param_3 = param_3 + 1;

        } while (param_3 < piVar1[0xe]);

      }

      FUN_0054c9e0();

      return 1;

    }

  }

  return 0;

}





// --- FUN_005a6880 at 0x005A6880 (size: 53) ---


void FUN_005a6880(int param_1)



{

  int iVar1;

  

  iVar1 = FUN_005a6630(param_1,*(undefined4 *)

                                (*(int *)(*(int *)(param_1 + 0x138) + -4 +

                                         *(int *)(param_1 + 0x134) * 4) + 0x44));

  if (iVar1 != 0) {

    FUN_005a63e0(param_1);

  }

  return;

}





// --- FUN_005a68c0 at 0x005A68C0 (size: 166) ---


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



{

  int iVar1;

  int iVar2;

  

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

  DAT_008ee6c8 = DAT_008ee6c8 + 1;

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

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

  FUN_005a5c80(param_2,param_3);

  FUN_005a6060(param_2,0);

  while( true ) {

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

      return;

    }

    iVar1 = *(int *)(param_1 + 0x74) + -1;

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

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

    if (iVar1 == 0) break;

    if (*(uint *)(param_1 + 0x5c) <= *(uint *)(param_1 + 0x60)) {

      FUN_005a5620(*(uint *)(param_1 + 0x60) + 0x1e);

    }

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

    *(int *)(param_1 + 0x60) = iVar2 + 1;

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

    *(undefined4 *)(*(int *)(*(int *)(iVar1 + 0x138) + -4 + *(int *)(iVar1 + 0x134) * 4) + 0x3c) = 1

    ;

    iVar2 = FUN_005a6630(iVar1,0);

    if (iVar2 != 0) {

      FUN_005a63e0(iVar1);

    }

  }

  return;

}





// --- FUN_005a6970 at 0x005A6970 (size: 306) ---


void FUN_005a6970(int param_1)



{

  undefined **local_48;

  undefined4 local_44;

  undefined4 local_40;

  undefined4 local_3c;

  undefined4 local_38;

  undefined4 local_34;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  DAT_0081fec4 = 0x3f800000;

  DAT_0081fec0 = 0x3f800000;

  DAT_0081fec8 = 0x3f800000;

  DAT_0081fc84 = 0x3f800000;

  FUN_005a61a0();

  FUN_005a6320(*(undefined2 *)(param_1 + 0xe0),*(undefined4 *)(param_1 + 0xe4));

  local_48 = &PTR_LAB_00797910;

  local_44 = 0;

  local_40 = 0x3f800000;

  local_3c = 0;

  local_38 = 0;

  local_34 = 0;

  local_c = 0;

  local_8 = 0;

  local_4 = 0;

  FUN_00535b30();

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

  FUN_0054c9c0(3,&local_48);

  FUN_0054ebd0(*(undefined4 *)(*(int *)(param_1 + 0x138) + -4 + *(int *)(param_1 + 0x134) * 4),0,4);

  FUN_005a68c0(param_1,0xffff);

  FUN_005a5950(0);

  FUN_0054c9e0();

  FUN_005a53f0(*(undefined2 *)(param_1 + 0xe0),*(undefined4 *)(param_1 + 0xe4));

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

  return;

}





// --- FUN_005a6ab0 at 0x005A6AB0 (size: 268) ---


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



undefined4 FUN_005a6ab0(int *param_1,int param_2,undefined4 param_3,int param_4)



{

  float fVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  

  iVar2 = param_2;

  fVar1 = *DAT_00867334 * *(float *)(param_2 + 0x20) +

          DAT_00867334[1] * *(float *)(param_2 + 0x24) +

          DAT_00867334[2] * *(float *)(param_2 + 0x28) + *(float *)(param_2 + 0x2c);

  if (fVar1 <= _DAT_007e6a00) {

    iVar4 = 1;

    if (-_DAT_007e6a00 <= fVar1) {

      iVar4 = 2;

    }

  }

  else {

    iVar4 = 0;

  }

  if (*param_1 == 0) {

    if (iVar4 != 0) {

      return 0;

    }

  }

  else if (iVar4 != 1) {

    return 0;

  }

  FUN_005a5430(iVar4,param_2,&DAT_008ee908,&param_2,param_3);

  if (((param_2 != 0) && (iVar4 = FUN_0052e870(param_1[1]), iVar4 != 0)) &&

     (iVar5 = FUN_0054ebd0(*(undefined4 *)

                            (*(int *)(iVar4 + 0x138) + -4 + *(int *)(iVar4 + 0x134) * 4),

                           &DAT_008ee908,param_2), iVar3 = param_4, iVar5 != 0)) {

    if (param_4 != 2) {

      FUN_0059cca0(iVar2,param_4 == 1);

    }

    FUN_0054c9e0();

    if (iVar3 != 1) {

      FUN_005a68c0(iVar4,(short)param_1[2]);

    }

    return 1;

  }

  return 0;

}





// --- FUN_005a6bc0 at 0x005A6BC0 (size: 245) ---


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



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  (**(code **)(*DAT_0086734c + 0x40))();

  DAT_008672e8 = &DAT_008471c8;

  FUN_005a1600();

  DAT_0081fc84 = 0x3f800000;

  DAT_0081fec8 = 0x3f800000;

  DAT_0081fec0 = 0x3f800000;

  DAT_0081fec4 = 0x3f800000;

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

  iVar2 = param_2[1];

  FUN_005a6320(*(undefined2 *)(iVar1 + 0x10),*(undefined4 *)(iVar1 + 0x14));

  iVar3 = FUN_005a6ab0(iVar1,iVar2,param_3,param_4);

  if (iVar3 == 0) {

    if (param_4 == 3) {

      FUN_0059cca0(iVar2,0);

    }

    FUN_005a16a0();

  }

  else {

    if (param_4 != 1) {

      FUN_005a5950(1);

    }

    FUN_005a16a0();

    FUN_0054c9c0(3,DAT_008fb9b8);

    FUN_0054c5c0();

  }

  FUN_005a53f0(*(undefined2 *)(iVar1 + 0x10),*(undefined4 *)(iVar1 + 0x14));

  return;

}





// --- FUN_005a6cc0 at 0x005A6CC0 (size: 406) ---


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



void __thiscall FUN_005a6cc0(int param_1,int param_2,int param_3,int param_4,float *param_5)



{

  float fVar1;

  float fVar2;

  float *pfVar3;

  int iVar4;

  

  pfVar3 = param_5;

  *param_5 = *(float *)(param_1 + 0x38);

  param_5[1] = *(float *)(param_1 + 0x3c);

  param_5[2] = *(float *)(param_1 + 0x40);

  if (*(float *)(param_1 + 0x48) <= DAT_00796344) {

    param_5 = (float *)*param_5;

  }

  else {

    iVar4 = (param_3 * 0x6c1ac587 -

            (param_2 * param_3 * 0x5111bfef + 0x70892fb7) * (param_4 + 0xb2cd)) +

            param_2 * -0x421be3bd;

    fVar1 = (float)iVar4;

    if (iVar4 < 0) {

      fVar1 = fVar1 + _DAT_0079920c;

    }

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

  }

  if (*(float *)(param_1 + 0x4c) <= DAT_00796344) {

    fVar1 = pfVar3[1];

  }

  else {

    iVar4 = (param_3 * 0x6c1ac587 -

            (param_2 * param_3 * 0x5111bfef + 0x70892fb7) * (param_4 + 0x11c0f)) +

            param_2 * -0x421be3bd;

    fVar1 = (float)iVar4;

    if (iVar4 < 0) {

      fVar1 = fVar1 + _DAT_0079920c;

    }

    fVar1 = fVar1 * _DAT_007c6f10 * *(float *)(param_1 + 0x4c) + pfVar3[1];

  }

  iVar4 = (param_3 * 0x6c1ac587 - (param_3 * 0x6f7bd965 + 0x421be3bd) * param_2) + -0x17fcedfd;

  fVar2 = (float)iVar4;

  if (iVar4 < 0) {

    fVar2 = fVar2 + _DAT_0079920c;

  }

  fVar2 = fVar2 * _DAT_007c6f10;

  if (fVar2 < _DAT_007c97cc) {

    pfVar3[1] = fVar1;

    *pfVar3 = (float)param_5;

    return;

  }

  if (fVar2 < _DAT_007938b8) {

    *pfVar3 = -fVar1;

    pfVar3[1] = (float)param_5;

    return;

  }

  if (fVar2 < _DAT_0079c6dc) {

    *pfVar3 = -(float)param_5;

    pfVar3[1] = -fVar1;

    return;

  }

  *pfVar3 = fVar1;

  pfVar3[1] = -(float)param_5;

  return;

}





// --- FUN_005a6e60 at 0x005A6E60 (size: 157) ---


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



void __thiscall

FUN_005a6e60(int param_1,int param_2,int param_3,int param_4,undefined4 *param_5,int param_6)



{

  float fVar1;

  int iVar2;

  

  FUN_00425f10(param_1 + 4);

  *(undefined4 *)(param_6 + 0x34) = *param_5;

  *(undefined4 *)(param_6 + 0x38) = param_5[1];

  *(undefined4 *)(param_6 + 0x3c) = param_5[2];

  if (DAT_00796344 < *(float *)(param_1 + 0x58)) {

    iVar2 = (param_3 * 0x6c1ac587 -

            (param_2 * param_3 * 0x5111bfef + 0x70892fb7) * (param_4 + 0xf697)) +

            param_2 * -0x421be3bd;

    fVar1 = (float)iVar2;

    if (iVar2 < 0) {

      fVar1 = fVar1 + _DAT_0079920c;

    }

    FUN_00536b80(fVar1 * _DAT_007c6f10 * *(float *)(param_1 + 0x58));

  }

  return;

}





// --- FUN_005a6f00 at 0x005A6F00 (size: 94) ---


undefined4 * __fastcall FUN_005a6f00(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0x3f800000;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  FUN_00535b30();

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x11] = 0x3f800000;

  param_1[0x14] = 0x3f800000;

  param_1[0x15] = 0x3f800000;

  param_1[0x18] = 0x42b40000;

  return param_1;

}





// --- FUN_005a6f60 at 0x005A6F60 (size: 99) ---


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



{

  float10 fVar1;

  

  FUN_00425f10(param_1 + 4);

  *(undefined4 *)(param_4 + 0x34) = *param_3;

  *(undefined4 *)(param_4 + 0x38) = param_3[1];

  *(undefined4 *)(param_4 + 0x3c) = param_3[2];

  fVar1 = (float10)FUN_004576f0();

  FUN_00536b80((float)fVar1);

  return;

}





// --- FUN_005a6fd0 at 0x005A6FD0 (size: 47) ---


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



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  *param_1 = &PTR_LAB_007e6a68;

  param_1[0xc] = &PTR_LAB_007e6a50;

  return param_1;

}





// --- FUN_005a7020 at 0x005A7020 (size: 191) ---


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



{

  undefined4 *puVar1;

  int iVar2;

  

  if ((param_2 & 2) == 0) {

    *param_1 = DAT_008ee9a4;

    param_1[0x11] = 0x3f800000;

    param_1[0x12] = 0;

    param_1[0x13] = 0;

    param_1[0x14] = 0x3f800000;

    param_1[0x15] = 0x3f800000;

    param_1[0x19] = 0;

    param_1[0x16] = 0;

    param_1[0x1a] = 0;

    param_1[0x17] = 0;

    param_1[0x18] = 0x42b40000;

    param_1[0x1b] = 0;

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

      operator_delete(param_1);

    }

    return param_1;

  }

  iVar2 = param_1[-1];

  puVar1 = param_1 + iVar2 * 0x1c;

  if (-1 < iVar2 + -1) {

    do {

      iVar2 = iVar2 + -1;

      puVar1[-0x1c] = DAT_008ee9a4;

      puVar1[-0xb] = 0x3f800000;

      puVar1[-10] = 0;

      puVar1[-9] = 0;

      puVar1[-8] = 0x3f800000;

      puVar1[-7] = 0x3f800000;

      puVar1[-3] = 0;

      puVar1[-6] = 0;

      puVar1[-2] = 0;

      puVar1[-5] = 0;

      puVar1[-4] = 0x42b40000;

      puVar1[-1] = 0;

      puVar1 = puVar1 + -0x1c;

    } while (iVar2 != 0);

  }

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

    operator_delete__(param_1 + -1);

  }

  return param_1 + -1;

}





// --- FUN_005a7100 at 0x005A7100 (size: 281) ---


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



{

  int iVar1;

  

  if (3 < param_3) {

    *(undefined4 *)*param_2 = *param_1;

    *param_2 = *param_2 + 4;

    param_3 = param_3 - 4;

  }

  FUN_00535e70(param_2,param_3);

  if (3 < param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    if (3 < param_3 - 4) {

      *(undefined4 *)(iVar1 + 4) = param_1[0x12];

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

      if (3 < param_3 - 8) {

        *(undefined4 *)(iVar1 + 4) = param_1[0x13];

        iVar1 = *param_2;

        *param_2 = iVar1 + 4;

        if (3 < param_3 - 0xc) {

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

          iVar1 = *param_2;

          *param_2 = iVar1 + 4;

          if (3 < param_3 - 0x10) {

            *(undefined4 *)(iVar1 + 4) = param_1[0x15];

            iVar1 = *param_2;

            *param_2 = iVar1 + 4;

            if (3 < param_3 - 0x14) {

              *(undefined4 *)(iVar1 + 4) = param_1[0x16];

              iVar1 = *param_2;

              *param_2 = iVar1 + 4;

              if (3 < param_3 - 0x18) {

                *(undefined4 *)(iVar1 + 4) = param_1[0x17];

                iVar1 = *param_2;

                *param_2 = iVar1 + 4;

                if (3 < param_3 - 0x1c) {

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

                  iVar1 = *param_2;

                  *param_2 = iVar1 + 4;

                  if (3 < param_3 - 0x20) {

                    *(undefined4 *)(iVar1 + 4) = param_1[0x19];

                    iVar1 = *param_2;

                    *param_2 = iVar1 + 4;

                    if (3 < param_3 - 0x24) {

                      *(undefined4 *)(iVar1 + 4) = param_1[0x1a];

                      iVar1 = *param_2;

                      *param_2 = iVar1 + 4;

                      if (3 < param_3 - 0x28) {

                        *(undefined4 *)(iVar1 + 4) = param_1[0x1b];

                        *param_2 = *param_2 + 4;

                      }

                    }

                  }

                }

              }

            }

          }

        }

      }

    }

  }

  return;

}





// --- FUN_005a7220 at 0x005A7220 (size: 298) ---


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



{

  undefined4 uVar1;

  int iVar2;

  

  if (3 < param_3) {

    uVar1 = *(undefined4 *)*param_2;

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

    param_3 = param_3 - 4;

    *param_1 = uVar1;

  }

  iVar2 = FUN_00535ee0(param_2,param_3);

  if (iVar2 == 0) {

    return 0;

  }

  if (3 < param_3) {

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

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    if (3 < param_3 - 4) {

      param_1[0x12] = *(undefined4 *)(iVar2 + 4);

      iVar2 = *param_2;

      *param_2 = iVar2 + 4;

      if (3 < param_3 - 8) {

        param_1[0x13] = *(undefined4 *)(iVar2 + 4);

        iVar2 = *param_2;

        *param_2 = iVar2 + 4;

        if (3 < param_3 - 0xc) {

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

          iVar2 = *param_2;

          *param_2 = iVar2 + 4;

          if (3 < param_3 - 0x10) {

            param_1[0x15] = *(undefined4 *)(iVar2 + 4);

            iVar2 = *param_2;

            *param_2 = iVar2 + 4;

            if (3 < param_3 - 0x14) {

              param_1[0x16] = *(undefined4 *)(iVar2 + 4);

              iVar2 = *param_2;

              *param_2 = iVar2 + 4;

              if (3 < param_3 - 0x18) {

                param_1[0x17] = *(undefined4 *)(iVar2 + 4);

                iVar2 = *param_2;

                *param_2 = iVar2 + 4;

                if (3 < param_3 - 0x1c) {

                  param_1[0x18] = *(undefined4 *)(iVar2 + 4);

                  iVar2 = *param_2;

                  *param_2 = iVar2 + 4;

                  if (3 < param_3 - 0x20) {

                    param_1[0x19] = *(undefined4 *)(iVar2 + 4);

                    iVar2 = *param_2;

                    *param_2 = iVar2 + 4;

                    if (3 < param_3 - 0x24) {

                      param_1[0x1a] = *(undefined4 *)(iVar2 + 4);

                      iVar2 = *param_2;

                      *param_2 = iVar2 + 4;

                      if (3 < param_3 - 0x28) {

                        param_1[0x1b] = *(undefined4 *)(iVar2 + 4);

                        *param_2 = *param_2 + 4;

                      }

                    }

                  }

                }

              }

            }

          }

        }

      }

    }

  }

  return 1;

}





// --- FUN_005a7350 at 0x005A7350 (size: 33) ---


void __fastcall FUN_005a7350(int param_1)



{

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

    FUN_005a7020(3);

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

  }

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

  return;

}





// --- FUN_005a7410 at 0x005A7410 (size: 173) ---


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



{

  int iVar1;

  int *piVar2;

  int *piVar3;

  uint uVar4;

  

  if (*param_2 + 4U < *param_2 + param_3) {

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

    if (3 < param_3) {

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

      param_3 = param_3 - 4;

      *param_2 = *param_2 + 4;

    }

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

    piVar2 = (int *)thunk_FUN_005df0f5(iVar1 * 0x70 + 4);

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

      piVar3 = (int *)0x0;

    }

    else {

      piVar3 = piVar2 + 1;

      *piVar2 = iVar1;

      FUN_00401000(piVar3,0x70,iVar1,FUN_005a6f00);

    }

    uVar4 = 0;

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

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

      do {

        FUN_005a7220(param_2,param_3);

        uVar4 = uVar4 + 1;

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

    }

    return 1;

  }

  return 0;

}





// --- FUN_005a74c0 at 0x005A74C0 (size: 80) ---


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



{

  *param_1 = &PTR_LAB_007e6a68;

  param_1[0xc] = &PTR_LAB_007e6a50;

  if (param_1[0x10] != 0) {

    FUN_005a7020(3);

    param_1[0x10] = 0;

  }

  param_1[0xf] = 0;

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005a7510 at 0x005A7510 (size: 149) ---


void __thiscall FUN_005a7510(double *param_1,double param_2)



{

  double dVar1;

  int iVar2;

  int *piVar3;

  uint uVar4;

  float10 extraout_ST0;

  float10 fVar5;

  

  dVar1 = *param_1;

  floor((param_2 + dVar1) / param_1[8]);

  iVar2 = FUN_005df4c4();

  fVar5 = (float10)(param_2 + dVar1) - extraout_ST0 * (float10)param_1[8];

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

  floor((double)((float)fVar5 / *(float *)((int)param_1 + 0xc)));

  iVar2 = FUN_005df4c4();

  uVar4 = 0;

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

  if (*(int *)((int)param_1 + 0x34) != 1) {

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

    do {

      piVar3 = piVar3 + 1;

      if (iVar2 < *(int *)(*piVar3 + 4)) break;

      uVar4 = uVar4 + 1;

    } while (uVar4 < *(int *)((int)param_1 + 0x34) - 1U);

  }

  *(uint *)((int)param_1 + 0x6c) = uVar4;

  param_1[10] = (double)((float)param_2 -

                        ((float)fVar5 - (float)iVar2 * *(float *)((int)param_1 + 0xc)));

  return;

}





// --- FUN_005a75b0 at 0x005A75B0 (size: 141) ---


void __thiscall FUN_005a75b0(int param_1,double param_2)



{

  int iVar1;

  uint uVar2;

  int *piVar3;

  float10 fVar4;

  

  fVar4 = ((float10)param_2 - (float10)*(double *)(param_1 + 0x50)) /

          (float10)*(float *)(param_1 + 0xc);

  uVar2 = 0;

  if (*(int *)(param_1 + 0x1c) != 1) {

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

    do {

      piVar3 = piVar3 + 1;

      if (fVar4 < (float10)*(float *)(*piVar3 + 4)) break;

      uVar2 = uVar2 + 1;

    } while (uVar2 < *(int *)(param_1 + 0x1c) - 1U);

  }

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

  if (uVar2 != *(int *)(param_1 + 0x1c) - 1U) {

    piVar3 = (int *)(*(int *)(param_1 + 0x14) + uVar2 * 4);

    *(double *)(param_1 + 0x58) =

         (double)(*(float *)(piVar3[1] + 4) * *(float *)(param_1 + 0xc) +

                 (float)*(double *)(param_1 + 0x50));

    *(float *)(param_1 + 0x60) =

         (float)((fVar4 - (float10)*(float *)(*piVar3 + 4)) /

                ((float10)*(float *)(piVar3[1] + 4) - (float10)*(float *)(*piVar3 + 4)));

    return;

  }

  *(double *)(param_1 + 0x58) =

       (double)(*(float *)(param_1 + 0xc) + (float)*(double *)(param_1 + 0x50));

  iVar1 = *(int *)(*(int *)(param_1 + 0x14) + uVar2 * 4);

  *(float *)(param_1 + 0x60) =

       (float)((fVar4 - (float10)*(float *)(iVar1 + 4)) /

              ((float10)*(float *)(param_1 + 0xc) - (float10)*(float *)(iVar1 + 4)));

  return;

}





// --- FUN_005a7640 at 0x005A7640 (size: 293) ---


void __thiscall

FUN_005a7640(int param_1,char *param_2,undefined2 *param_3,undefined4 param_4,int param_5,

            undefined4 param_6,undefined4 param_7,int param_8)



{

  char cVar1;

  char *pcVar2;

  char *pcVar3;

  char *pcVar4;

  char *pcVar5;

  char *pcVar6;

  int iVar7;

  char local_28 [20];

  char local_14 [20];

  

  iVar7 = **(int **)(*(int *)(param_1 + 0x14) + param_8 * 4);

  pcVar6 = (char *)(iVar7 + 0x14);

  pcVar2 = pcVar6;

  do {

    cVar1 = *pcVar2;

    pcVar2 = pcVar2 + 1;

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

  if ((uint)((int)pcVar2 - (iVar7 + 0x15)) < 0x1e) {

    iVar7 = (int)param_3 - (int)pcVar6;

    do {

      cVar1 = *pcVar6;

      pcVar6[iVar7] = cVar1;

      pcVar6 = pcVar6 + 1;

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

  }

  else {

    *param_3 = 0x20;

  }

  iVar7 = **(int **)(*(int *)(param_1 + 0x2c) + param_5 * 4);

  pcVar6 = (char *)(iVar7 + 0x14);

  sprintf(local_14,"%d");

  sprintf(local_28,"%d",param_4);

  pcVar2 = pcVar6;

  do {

    cVar1 = *pcVar2;

    pcVar2 = pcVar2 + 1;

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

  pcVar3 = local_14;

  do {

    cVar1 = *pcVar3;

    pcVar3 = pcVar3 + 1;

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

  pcVar4 = local_28;

  do {

    cVar1 = *pcVar4;

    pcVar4 = pcVar4 + 1;

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

  pcVar5 = (char *)(*(int *)(param_1 + 0x38) + 0x14);

  do {

    cVar1 = *pcVar5;

    pcVar5 = pcVar5 + 1;

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

  if ((char *)0x3b <

      pcVar4 + (int)(pcVar5 + ((int)&stack0x00000000 * -2 - (*(int *)(param_1 + 0x38) + 0x15))) +

      (int)pcVar3 + (int)(pcVar2 + (0x43 - (iVar7 + 0x15)))) {

    param_2[0] = ' ';

    param_2[1] = '\0';

    return;

  }

  sprintf(param_2,"%s %s, %s %s",pcVar6);

  return;

}





// --- FUN_005a7770 at 0x005A7770 (size: 130) ---


undefined4 * __fastcall FUN_005a7770(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  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;

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

  param_1[0xe] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x14] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  param_1[0x15] = 0xbff00000;

  return param_1;

}





// --- FUN_005a7800 at 0x005A7800 (size: 163) ---


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



void __fastcall FUN_005a7800(int param_1)



{

  double dVar1;

  float10 fVar2;

  

  dVar1 = _DAT_008379a8 + *(double *)(param_1 + 0x78) + *(double *)(param_1 + 0x80);

  if (*(double *)(param_1 + 0x50) < _DAT_00795610) {

    FUN_005a7510(dVar1);

  }

  fVar2 = ((float10)dVar1 - (float10)*(double *)(param_1 + 0x50)) /

          (float10)*(float *)(param_1 + 0xc);

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

  if (*(double *)(param_1 + 0x58) <= dVar1) {

    if ((float10)_DAT_007938b0 <= fVar2) {

      FUN_005a7510(dVar1);

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

           (float)(((float10)dVar1 - (float10)*(double *)(param_1 + 0x50)) /

                  (float10)*(float *)(param_1 + 0xc));

    }

    FUN_005a75b0(dVar1);

    _DAT_008ee9c0 =

         (*(double *)(param_1 + 0x58) - *(double *)(param_1 + 0x78)) + *(double *)(param_1 + 0x80);

    return;

  }

  return;

}





// --- FUN_005a78b0 at 0x005A78B0 (size: 38) ---


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



{

  FUN_005a7640(param_2,param_3,*(undefined4 *)(param_1 + 100),*(undefined4 *)(param_1 + 0x6c),

               *(undefined4 *)(param_1 + 0x70),*(undefined4 *)(param_1 + 0x68),

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

  return;

}





// --- FUN_005a78e0 at 0x005A78E0 (size: 369) ---


void __fastcall FUN_005a78e0(undefined4 *param_1)



{

  int *piVar1;

  undefined4 *puVar2;

  LONG LVar3;

  uint local_4;

  

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[4] = 0;

  param_1[0x12] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0xbff00000;

  param_1[0x16] = 0;

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

  local_4 = 0;

  if (param_1[0xd] != 0) {

    do {

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

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

        puVar2 = (undefined4 *)*piVar1;

        LVar3 = InterlockedDecrement(puVar2 + 1);

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

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

        }

        operator_delete(piVar1);

      }

      local_4 = local_4 + 1;

    } while (local_4 < (uint)param_1[0xd]);

  }

  param_1[0xd] = 0;

  param_1[0xc] = 0;

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

  param_1[0xb] = 0;

  local_4 = 0;

  if (param_1[7] != 0) {

    do {

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

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

        puVar2 = (undefined4 *)*piVar1;

        LVar3 = InterlockedDecrement(puVar2 + 1);

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

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

        }

        operator_delete(piVar1);

      }

      local_4 = local_4 + 1;

    } while (local_4 < (uint)param_1[7]);

  }

  param_1[7] = 0;

  param_1[6] = 0;

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

  param_1[5] = 0;

  local_4 = 0;

  if (param_1[10] != 0) {

    do {

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

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

        puVar2 = (undefined4 *)*piVar1;

        LVar3 = InterlockedDecrement(puVar2 + 1);

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

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

        }

        operator_delete(piVar1);

      }

      local_4 = local_4 + 1;

    } while (local_4 < (uint)param_1[10]);

  }

  param_1[10] = 0;

  param_1[9] = 0;

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

  param_1[8] = 0;

  return;

}





// --- FUN_005a7a60 at 0x005A7A60 (size: 351) ---


int __fastcall FUN_005a7a60(int param_1)



{

  uint uVar1;

  uint uVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  int iVar6;

  

  uVar1 = *(int *)(*(int *)(param_1 + 0x38) + 8) - 1;

  iVar3 = 0;

  if (0xfffe < uVar1) {

    iVar3 = 4;

  }

  uVar1 = iVar3 + 2 + uVar1;

  uVar2 = uVar1 & 3;

  if (uVar2 == 0) {

    iVar3 = 0;

  }

  else {

    iVar3 = 4 - uVar2;

  }

  uVar1 = iVar3 + 0x14 + uVar1;

  uVar2 = uVar1 & 3;

  if (uVar2 == 0) {

    iVar3 = 0;

  }

  else {

    iVar3 = 4 - uVar2;

  }

  iVar3 = uVar1 + 4 + iVar3;

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

  if (iVar5 != 0) {

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

    do {

      uVar1 = *(int *)(*(int *)*puVar4 + 8) - 1;

      iVar6 = 0;

      if (0xfffe < uVar1) {

        iVar6 = 4;

      }

      uVar1 = iVar6 + 2 + uVar1;

      uVar2 = uVar1 & 3;

      if (uVar2 == 0) {

        iVar6 = 0;

      }

      else {

        iVar6 = 4 - uVar2;

      }

      uVar1 = iVar6 + 8 + uVar1;

      uVar2 = uVar1 & 3;

      if (uVar2 == 0) {

        iVar6 = 0;

      }

      else {

        iVar6 = 4 - uVar2;

      }

      iVar3 = iVar3 + iVar6 + uVar1;

      puVar4 = puVar4 + 1;

      iVar5 = iVar5 + -1;

    } while (iVar5 != 0);

  }

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

  iVar3 = iVar3 + 4;

  if (iVar5 != 0) {

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

    do {

      uVar1 = *(int *)(*(int *)*puVar4 + 8) - 1;

      iVar6 = 0;

      if (0xfffe < uVar1) {

        iVar6 = 4;

      }

      uVar1 = iVar6 + 2 + uVar1;

      uVar2 = uVar1 & 3;

      if (uVar2 == 0) {

        iVar6 = 0;

      }

      else {

        iVar6 = 4 - uVar2;

      }

      uVar1 = uVar1 + iVar6;

      uVar2 = uVar1 & 3;

      if (uVar2 == 0) {

        iVar6 = 0;

      }

      else {

        iVar6 = 4 - uVar2;

      }

      iVar3 = iVar3 + iVar6 + uVar1;

      puVar4 = puVar4 + 1;

      iVar5 = iVar5 + -1;

    } while (iVar5 != 0);

  }

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

  iVar3 = iVar3 + 4;

  if (iVar5 != 0) {

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

    do {

      uVar1 = *(int *)(*(int *)*puVar4 + 8) - 1;

      iVar6 = 0;

      if (0xfffe < uVar1) {

        iVar6 = 4;

      }

      uVar1 = iVar6 + 2 + uVar1;

      uVar2 = uVar1 & 3;

      if (uVar2 == 0) {

        iVar6 = 0;

      }

      else {

        iVar6 = 4 - uVar2;

      }

      uVar1 = iVar6 + 4 + uVar1;

      uVar2 = uVar1 & 3;

      if (uVar2 == 0) {

        iVar6 = 0;

      }

      else {

        iVar6 = 4 - uVar2;

      }

      iVar3 = iVar3 + iVar6 + uVar1;

      puVar4 = puVar4 + 1;

      iVar5 = iVar5 + -1;

    } while (iVar5 != 0);

  }

  return iVar3;

}





// --- FUN_005a7bd0 at 0x005A7BD0 (size: 540) ---


uint __thiscall FUN_005a7bd0(undefined4 *param_1,uint *param_2,uint *param_3)



{

  undefined4 *puVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  

  if (7 < *param_3) {

    puVar1 = (undefined4 *)*param_2;

    *puVar1 = *param_1;

    puVar1[1] = param_1[1];

    *param_2 = *param_2 + 8;

    *param_3 = *param_3 - 8;

  }

  if (3 < *param_3) {

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

    *param_2 = *param_2 + 4;

    uVar2 = *param_3;

    *param_3 = uVar2 - 4;

    if (3 < uVar2 - 4) {

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

      *param_2 = *param_2 + 4;

      uVar2 = *param_3;

      *param_3 = uVar2 - 4;

      if (3 < uVar2 - 4) {

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

        *param_2 = *param_2 + 4;

        *param_3 = *param_3 - 4;

      }

    }

  }

  iVar3 = FUN_004fd290(param_2,*param_3);

  *param_3 = *param_3 - iVar3;

  FUN_00500610(param_2,param_3);

  uVar2 = param_1[7];

  if (3 < *param_3) {

    *(uint *)*param_2 = uVar2;

    *param_2 = *param_2 + 4;

    *param_3 = *param_3 - 4;

  }

  uVar6 = 0;

  if (uVar2 != 0) {

    do {

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

      if (3 < *param_3) {

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

        *param_2 = *param_2 + 4;

        uVar5 = *param_3;

        *param_3 = uVar5 - 4;

        if (3 < uVar5 - 4) {

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

          *param_2 = *param_2 + 4;

          *param_3 = *param_3 - 4;

        }

      }

      iVar3 = FUN_004fd290(param_2,*param_3);

      uVar4 = *param_3 - iVar3;

      *param_3 = uVar4;

      uVar5 = *param_2 & 0x80000003;

      if ((int)uVar5 < 0) {

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

      }

      if ((uVar5 != 0) && (uVar5 = 4 - uVar5, uVar5 <= uVar4)) {

        *param_3 = uVar4 - uVar5;

        for (; uVar5 != 0; uVar5 = uVar5 - 1) {

          *(undefined1 *)*param_2 = 0;

          *param_2 = *param_2 + 1;

        }

      }

      uVar6 = uVar6 + 1;

    } while (uVar6 < uVar2);

  }

  uVar2 = param_1[10];

  if (3 < *param_3) {

    *(uint *)*param_2 = uVar2;

    *param_2 = *param_2 + 4;

    *param_3 = *param_3 - 4;

  }

  uVar6 = 0;

  if (uVar2 != 0) {

    do {

      iVar3 = FUN_004fd290(param_2,*param_3);

      uVar4 = *param_3 - iVar3;

      *param_3 = uVar4;

      uVar5 = *param_2 & 0x80000003;

      if ((int)uVar5 < 0) {

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

      }

      if ((uVar5 != 0) && (uVar5 = 4 - uVar5, uVar5 <= uVar4)) {

        *param_3 = uVar4 - uVar5;

        for (; uVar5 != 0; uVar5 = uVar5 - 1) {

          *(undefined1 *)*param_2 = 0;

          *param_2 = *param_2 + 1;

        }

      }

      uVar6 = uVar6 + 1;

    } while (uVar6 < uVar2);

  }

  uVar2 = param_1[0xd];

  if (3 < *param_3) {

    *(uint *)*param_2 = uVar2;

    *param_2 = *param_2 + 4;

    *param_3 = *param_3 - 4;

  }

  uVar6 = 0;

  if (uVar2 != 0) {

    do {

      if (3 < *param_3) {

        *(undefined4 *)*param_2 = *(undefined4 *)(*(int *)(param_1[0xb] + uVar6 * 4) + 4);

        *param_2 = *param_2 + 4;

        *param_3 = *param_3 - 4;

      }

      iVar3 = FUN_004fd290(param_2,*param_3);

      uVar4 = *param_3 - iVar3;

      *param_3 = uVar4;

      uVar5 = *param_2 & 0x80000003;

      if ((int)uVar5 < 0) {

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

      }

      if ((uVar5 != 0) && (uVar5 = 4 - uVar5, uVar5 <= uVar4)) {

        *param_3 = uVar4 - uVar5;

        for (; uVar5 != 0; uVar5 = uVar5 - 1) {

          *(undefined1 *)*param_2 = 0;

          *param_2 = *param_2 + 1;

        }

      }

      uVar6 = uVar6 + 1;

    } while (uVar6 < uVar2);

  }

  return *param_3;

}





// --- FUN_005a7df0 at 0x005A7DF0 (size: 128) ---


bool __thiscall FUN_005a7df0(int *param_1,int *param_2,uint *param_3)



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  

  if (3 < *param_3) {

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

    *param_2 = *param_2 + 4;

    *param_3 = *param_3 - 4;

  }

  iVar1 = FUN_004fd460(param_2,*param_3);

  if (iVar1 == 0) {

    return false;

  }

  uVar2 = *(int *)(*param_1 + 8) - 1;

  iVar1 = 0;

  if (0xfffe < uVar2) {

    iVar1 = 4;

  }

  uVar2 = iVar1 + 2 + uVar2;

  uVar3 = uVar2 & 3;

  if (uVar3 == 0) {

    iVar1 = 0;

  }

  else {

    iVar1 = 4 - uVar3;

  }

  *param_3 = *param_3 - (iVar1 + uVar2);

  FUN_00500610(param_2,param_3);

  return *param_3 != 0;

}





// --- FUN_005a7e70 at 0x005A7E70 (size: 108) ---


bool __thiscall FUN_005a7e70(int *param_1,undefined4 param_2,int *param_3)



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  

  iVar1 = FUN_004fd460(param_2,*param_3);

  if (iVar1 == 0) {

    return false;

  }

  uVar2 = *(int *)(*param_1 + 8) - 1;

  iVar1 = 0;

  if (0xfffe < uVar2) {

    iVar1 = 4;

  }

  uVar2 = iVar1 + 2 + uVar2;

  uVar3 = uVar2 & 3;

  if (uVar3 == 0) {

    iVar1 = 0;

  }

  else {

    iVar1 = 4 - uVar3;

  }

  *param_3 = *param_3 - (iVar1 + uVar2);

  FUN_00500610(param_2,param_3);

  return *param_3 != 0;

}





// --- FUN_005a7ee0 at 0x005A7EE0 (size: 152) ---


bool __thiscall FUN_005a7ee0(int *param_1,int *param_2,uint *param_3)



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  

  if (3 < *param_3) {

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

    *param_2 = *param_2 + 4;

    uVar2 = *param_3;

    *param_3 = uVar2 - 4;

    if (3 < uVar2 - 4) {

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

      *param_2 = *param_2 + 4;

      *param_3 = *param_3 - 4;

    }

  }

  iVar1 = FUN_004fd460(param_2,*param_3);

  if (iVar1 == 0) {

    return false;

  }

  uVar2 = *(int *)(*param_1 + 8) - 1;

  iVar1 = 0;

  if (0xfffe < uVar2) {

    iVar1 = 4;

  }

  uVar2 = iVar1 + 2 + uVar2;

  uVar3 = uVar2 & 3;

  if (uVar3 == 0) {

    iVar1 = 0;

  }

  else {

    iVar1 = 4 - uVar3;

  }

  *param_3 = *param_3 - (iVar1 + uVar2);

  FUN_00500610(param_2,param_3);

  return *param_3 != 0;

}





// --- FUN_005a7f80 at 0x005A7F80 (size: 71) ---


void __fastcall FUN_005a7f80(int param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  FUN_005a78e0();

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

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

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

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

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

  return;

}





// --- FUN_005a7fd0 at 0x005A7FD0 (size: 797) ---


bool __thiscall FUN_005a7fd0(undefined4 *param_1,int *param_2,uint *param_3)



{

  undefined4 *puVar1;

  int *piVar2;

  uint *puVar3;

  int iVar4;

  uint uVar5;

  int *piVar6;

  LONG *pLVar7;

  uint uVar8;

  uint uVar9;

  

  puVar3 = param_3;

  piVar2 = param_2;

  if (7 < *param_3) {

    puVar1 = (undefined4 *)*param_2;

    *param_1 = *puVar1;

    param_1[1] = puVar1[1];

    *param_2 = *param_2 + 8;

    *param_3 = *param_3 - 8;

  }

  if (3 < *param_3) {

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

    *param_2 = *param_2 + 4;

    uVar9 = *param_3;

    *param_3 = uVar9 - 4;

    if (3 < uVar9 - 4) {

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

      *param_2 = *param_2 + 4;

      uVar9 = *param_3;

      *param_3 = uVar9 - 4;

      if (3 < uVar9 - 4) {

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

        *param_2 = *param_2 + 4;

        *param_3 = *param_3 - 4;

      }

    }

  }

  uVar9 = param_1[4];

  *(double *)(param_1 + 0x10) = (double)((float)param_1[3] * (float)(int)uVar9);

  iVar4 = FUN_004fd460(param_2,*param_3);

  if (iVar4 != 0) {

    uVar5 = *(int *)(param_1[0xe] + 8) - 1;

    iVar4 = 0;

    if (0xfffe < uVar5) {

      iVar4 = 4;

    }

    uVar5 = iVar4 + 2 + uVar5;

    uVar8 = uVar5 & 3;

    if (uVar8 == 0) {

      iVar4 = 0;

    }

    else {

      iVar4 = 4 - uVar8;

    }

    *param_3 = *param_3 - (iVar4 + uVar5);

    FUN_00500610(param_2,param_3);

    if (3 < *param_3) {

      uVar9 = *(uint *)*param_2;

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

      *param_3 = *param_3 - 4;

    }

    if (uVar9 <= *param_3) {

      FUN_00500570(uVar9);

      param_2 = (int *)0x0;

      if (uVar9 != 0) {

        do {

          piVar6 = (int *)FUN_005df0f5(0xc);

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

            piVar6 = (int *)0x0;

          }

          else {

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

            *piVar6 = DAT_008ef11c;

            InterlockedIncrement(pLVar7);

            piVar6[1] = 0;

          }

          iVar4 = FUN_005a7ee0(piVar2,param_3);

          if (iVar4 == 0) {

            return false;

          }

          uVar5 = param_1[6];

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

LAB_005a8140:

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

            param_1[7] = param_1[7] + 1;

          }

          else {

            if (uVar5 == 0) {

              iVar4 = 8;

            }

            else {

              iVar4 = uVar5 * 2;

            }

            iVar4 = FUN_00500570(iVar4);

            if (iVar4 != 0) goto LAB_005a8140;

          }

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

        } while (param_2 < uVar9);

      }

      if (3 < *param_3) {

        uVar9 = *(uint *)*piVar2;

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

        *param_3 = *param_3 - 4;

      }

      param_3 = (uint *)uVar9;

      if (param_3 <= *puVar3) {

        FUN_00500570(param_3);

        param_2 = (int *)0x0;

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

          do {

            piVar6 = (int *)FUN_005df0f5(4);

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

              piVar6 = (int *)0x0;

            }

            else {

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

              *piVar6 = DAT_008ef11c;

              InterlockedIncrement(pLVar7);

            }

            iVar4 = FUN_005a7e70(piVar2,puVar3);

            if (iVar4 == 0) {

              return false;

            }

            uVar9 = param_1[9];

            if ((uint)param_1[10] < uVar9) {

LAB_005a81fa:

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

              param_1[10] = param_1[10] + 1;

            }

            else {

              if (uVar9 == 0) {

                iVar4 = 8;

              }

              else {

                iVar4 = uVar9 * 2;

              }

              iVar4 = FUN_00500570(iVar4);

              if (iVar4 != 0) goto LAB_005a81fa;

            }

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

          } while (param_2 < param_3);

        }

        if (3 < *puVar3) {

          param_3 = *(uint **)*piVar2;

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

          *puVar3 = *puVar3 - 4;

        }

        if (param_3 <= *puVar3) {

          FUN_00500570(param_3);

          param_2 = (int *)0x0;

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

            do {

              piVar6 = (int *)FUN_005df0f5(8);

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

                piVar6 = (int *)0x0;

              }

              else {

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

                *piVar6 = DAT_008ef11c;

                InterlockedIncrement(pLVar7);

                piVar6[1] = 0;

              }

              iVar4 = FUN_005a7df0(piVar2,puVar3);

              if (iVar4 == 0) {

                return false;

              }

              uVar9 = param_1[0xc];

              if ((uint)param_1[0xd] < uVar9) {

LAB_005a82b4:

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

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

              }

              else {

                if (uVar9 == 0) {

                  iVar4 = 8;

                }

                else {

                  iVar4 = uVar9 * 2;

                }

                iVar4 = FUN_00500570(iVar4);

                if (iVar4 != 0) goto LAB_005a82b4;

              }

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

            } while (param_2 < param_3);

          }

          return *puVar3 != 0;

        }

      }

    }

  }

  return false;

}





// --- FUN_005a82f0 at 0x005A82F0 (size: 48) ---


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



{

  FUN_0054a6f0(param_2,param_3,5);

  *param_1 = &PTR_FUN_007cc464;

  param_1[2] = &PTR_LAB_007cc450;

  param_1[4] = &PTR_LAB_007cc44c;

  return param_1;

}





// --- FUN_005a8440 at 0x005A8440 (size: 74) ---


undefined4 __fastcall FUN_005a8440(int param_1)



{

  int iVar1;

  uint uVar2;

  

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

    return 0;

  }

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

    iVar1 = thunk_FUN_005df0f5(*(int *)(param_1 + 0xc) << 2);

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

    if (iVar1 == 0) {

      return 0;

    }

    uVar2 = 0;

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

      do {

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

        uVar2 = uVar2 + 1;

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

    }

  }

  return 1;

}





// --- FUN_005a8490 at 0x005A8490 (size: 87) ---


void __thiscall FUN_005a8490(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_007e6af8;

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

  param_2[3] = uVar1;

  return;

}





// --- FUN_005a84f0 at 0x005A84F0 (size: 61) ---


uint * __thiscall FUN_005a84f0(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[5]) {

      if (*param_2 == *puVar1) {

        return puVar1 + 1;

      }

    }

  }

  return (uint *)0x0;

}





// --- FUN_005a8530 at 0x005A8530 (size: 87) ---


void __thiscall FUN_005a8530(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_007e6afc;

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

  param_2[3] = uVar1;

  return;

}





// --- FUN_005a8590 at 0x005A8590 (size: 88) ---


void __fastcall FUN_005a8590(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 + 0x14);

        FUN_005a9540();

        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_005a85f0 at 0x005A85F0 (size: 59) ---


uint * __thiscall FUN_005a85f0(int param_1,uint param_2)



{

  uint *puVar1;

  

  if ((*(uint *)(param_1 + 0x58) != 0) && (*(int *)(param_1 + 0x54) != 0)) {

    for (puVar1 = *(uint **)(*(int *)(param_1 + 0x54) + (param_2 % *(uint *)(param_1 + 0x58)) * 4);

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

      if (param_2 == *puVar1) {

        return puVar1 + 1;

      }

    }

  }

  return (uint *)0x0;

}





// --- FUN_005a8630 at 0x005A8630 (size: 61) ---


uint * __thiscall FUN_005a8630(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[4]) {

      if (*param_2 == *puVar1) {

        return puVar1 + 1;

      }

    }

  }

  return (uint *)0x0;

}





// --- FUN_005a8670 at 0x005A8670 (size: 91) ---


int __fastcall FUN_005a8670(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  undefined4 local_4;

  

  uVar3 = 0;

  iVar4 = 4;

  local_4 = 0;

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

    do {

      for (iVar1 = *(int *)(*(int *)(param_1 + 8) + uVar3 * 4); iVar1 != 0;

          iVar1 = *(int *)(iVar1 + 0x14)) {

        iVar2 = (**(code **)(*(int *)(iVar1 + 4) + 0xc))(&local_4,0);

        iVar4 = iVar4 + 4 + iVar2;

      }

      uVar3 = uVar3 + 1;

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

  }

  return iVar4;

}





// --- FUN_005a86d0 at 0x005A86D0 (size: 88) ---


void __fastcall FUN_005a86d0(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 + 0x10);

        FUN_005a9df0();

        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_005a8730 at 0x005A8730 (size: 629) ---


void __fastcall FUN_005a8730(int param_1)



{

  undefined4 uVar1;

  int *piVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  uint uVar6;

  int *piVar7;

  undefined4 uVar8;

  undefined4 uVar9;

  int local_74;

  uint local_70;

  undefined4 local_5c;

  uint local_58;

  int local_54;

  uint local_3c;

  int local_38;

  undefined1 local_28 [4];

  undefined4 *local_24;

  int *local_20;

  uint local_1c;

  

  FUN_005a8490(local_28);

  FUN_005a9dd0();

  FUN_005a9500();

joined_r0x005a8769:

  puVar4 = local_24;

  local_24 = puVar4;

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

    FUN_005a9e40(puVar4 + 1);

    uVar8 = 8;

    uVar1 = FUN_004220b0(*puVar4,0);

    FUN_0041a4e0(uVar1,uVar8);

    local_70 = 0;

    if (local_3c != 0) {

      local_74 = 0;

      do {

        iVar5 = local_74 + local_38;

        uVar8 = 8;

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

        FUN_0041a4e0(uVar1,uVar8);

        uVar6 = 0;

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

          iVar3 = 0;

          do {

            uVar9 = 8;

            uVar1 = *(undefined4 *)(*(int *)(iVar5 + 0x10) + iVar3 + 8);

            uVar8 = FUN_004220b0(*(undefined4 *)(*(int *)(iVar5 + 0x10) + 4 + iVar3),0);

            FUN_0041a4e0(uVar8,uVar9);

            uVar8 = 8;

            uVar1 = FUN_004220b0(uVar1,0);

            FUN_0041a4e0(uVar1,uVar8);

            uVar6 = uVar6 + 1;

            iVar3 = iVar3 + 0xc;

            puVar4 = local_24;

          } while (uVar6 < *(uint *)(iVar5 + 0xc));

        }

        local_70 = local_70 + 1;

        local_74 = local_74 + 0x14;

      } while (local_70 < local_3c);

    }

    local_24 = (undefined4 *)puVar4[4];

    if ((undefined4 *)puVar4[4] == (undefined4 *)0x0) {

      uVar6 = puVar4[5];

      do {

        uVar6 = uVar6 + 1;

        if (local_1c <= uVar6) {

          local_24 = (undefined4 *)0x0;

          goto joined_r0x005a8769;

        }

      } while (*(int *)((int)local_20 + uVar6 * 4) == 0);

      local_24 = *(undefined4 **)((int)local_20 + uVar6 * 4);

    }

    goto joined_r0x005a8769;

  }

  local_1c = *(uint *)(param_1 + 0x58);

  uVar6 = 0;

  if (local_1c != 0) {

    piVar7 = *(int **)(param_1 + 0x54);

    piVar2 = piVar7;

    do {

      if (*piVar2 != 0) {

        iVar5 = piVar7[uVar6];

        goto LAB_005a88bc;

      }

      uVar6 = uVar6 + 1;

      piVar2 = piVar2 + 1;

    } while (uVar6 < local_1c);

  }

  piVar7 = *(int **)(param_1 + 0x54);

  iVar5 = 0;

LAB_005a88bc:

  local_20 = piVar7;

  FUN_005a9520();

joined_r0x005a88cb:

  do {

    do {

      iVar3 = iVar5;

      if (iVar3 == 0) {

        FUN_005a9540();

        FUN_005a9df0();

        return;

      }

      FUN_005a9d50(iVar3 + 4);

      uVar8 = 8;

      uVar1 = FUN_004220b0(local_5c,0);

      FUN_0041a4e0(uVar1,uVar8);

      uVar6 = 0;

      if (local_58 != 0) {

        iVar5 = 0;

        do {

          uVar8 = 8;

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

          FUN_0041a4e0(uVar1,uVar8);

          uVar6 = uVar6 + 1;

          iVar5 = iVar5 + 0x14;

          piVar7 = local_20;

        } while (uVar6 < local_58);

      }

      FUN_005a9540();

      iVar5 = *(int *)(iVar3 + 0x14);

    } while (*(int *)(iVar3 + 0x14) != 0);

    uVar6 = *(uint *)(iVar3 + 0x18);

    do {

      uVar6 = uVar6 + 1;

      if (local_1c <= uVar6) {

        iVar5 = 0;

        goto joined_r0x005a88cb;

      }

    } while (piVar7[uVar6] == 0);

    iVar5 = piVar7[uVar6];

  } while( true );

}





// --- FUN_005a89b0 at 0x005A89B0 (size: 753) ---


undefined4 __thiscall

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



{

  uint *puVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  float10 fVar7;

  

  if ((*(uint *)(param_1 + 0x44) != 0) && (*(int *)(param_1 + 0x40) != 0)) {

    for (puVar1 = *(uint **)(*(int *)(param_1 + 0x40) + (param_2 % *(uint *)(param_1 + 0x44)) * 4);

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

      if (param_2 == *puVar1) {

        if (puVar1 != (uint *)0xfffffffc) goto LAB_005a8b74;

        break;

      }

    }

  }

  iVar2 = DAT_008ee9dc;

  if (((((((((((param_2 == DAT_00822094) || (param_2 == DAT_00822098)) || (param_2 == DAT_0082209c))

            || ((param_2 == DAT_008220a0 || (iVar2 = DAT_008ee9e0, param_2 == DAT_008220a4)))) ||

           (param_2 == DAT_008220a8)) ||

          (((param_2 == DAT_008220ac || (param_2 == DAT_008220b0)) ||

           ((iVar2 = DAT_008ee9e4, param_2 == DAT_008220b4 ||

            (((param_2 == DAT_008220b8 || (param_2 == DAT_008220bc)) || (param_2 == DAT_008220c0))))

           )))) || ((iVar2 = DAT_008ee9e8, param_2 == DAT_008220c4 || (param_2 == DAT_008220c8))))

        || ((param_2 == DAT_008220cc ||

            (((param_2 == DAT_008220d0 || (iVar2 = DAT_008ee9d4, param_2 == DAT_00822068)) ||

             ((param_2 == DAT_0082206c ||

              (((param_2 == DAT_00822070 || (param_2 == DAT_00822074)) || (param_2 == DAT_00822078))

              )))))))) ||

       (((iVar2 = DAT_008ee9d8, param_2 == DAT_00822080 || (param_2 == DAT_00822084)) ||

        (param_2 == DAT_00822088)))) ||

      (((param_2 == DAT_0082208c || (param_2 == DAT_00822090)) ||

       ((iVar2 = DAT_008220d4, param_2 == DAT_008220dc ||

        (iVar2 = DAT_008220d8, param_2 == DAT_008220e0)))))) &&

     ((iVar2 != DAT_008eea04 && (iVar2 = FUN_005a8630(), iVar2 != 0)))) {

LAB_005a8b74:

    iVar2 = FUN_005a9f60();

    if (iVar2 == 0) {

      return 0;

    }

    if (param_3 != 0) {

      iVar2 = FUN_005a84f0();

      if (iVar2 == 0) {

        return 0;

      }

      uVar5 = 0;

      if (*(int *)(iVar2 + 8) != 0) {

        iVar4 = 0;

        do {

          FUN_004220b0(*(undefined4 *)(iVar4 + 0x10 + *(int *)(iVar2 + 0xc)),0x18);

          piVar3 = (int *)FUN_00415430();

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

            return 0;

          }

          fVar7 = (float10)FUN_005a9370();

          FUN_005ad620(&param_3,(double)fVar7);

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

          uVar6 = 0;

          if (*(int *)(*(int *)(iVar2 + 0xc) + 4 + iVar4) != 0) {

            do {

              FUN_005ad040();

              uVar6 = uVar6 + 1;

            } while (uVar6 < *(uint *)(*(int *)(iVar2 + 0xc) + 4 + iVar4));

          }

          uVar5 = uVar5 + 1;

          iVar4 = iVar4 + 0x14;

        } while (uVar5 < *(uint *)(iVar2 + 8));

      }

    }

  }

  return 1;

}





// --- FUN_005a8d40 at 0x005A8D40 (size: 91) ---


int __fastcall FUN_005a8d40(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  undefined4 local_4;

  

  uVar3 = 0;

  iVar4 = 4;

  local_4 = 0;

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

    do {

      for (iVar1 = *(int *)(*(int *)(param_1 + 8) + uVar3 * 4); iVar1 != 0;

          iVar1 = *(int *)(iVar1 + 0x10)) {

        iVar2 = (**(code **)(*(int *)(iVar1 + 4) + 0xc))(&local_4,0);

        iVar4 = iVar4 + 4 + iVar2;

      }

      uVar3 = uVar3 + 1;

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

  }

  return iVar4;

}





// --- FUN_005a8ee0 at 0x005A8EE0 (size: 155) ---


undefined4 __thiscall FUN_005a8ee0(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[5]) {

      if (*param_2 == *puVar1) {

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

          return 0;

        }

        break;

      }

    }

  }

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

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

    return 0;

  }

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

  *puVar1 = *param_2;

  FUN_005a9d50(param_3);

  puVar1[5] = 0;

  uVar2 = *param_2 % uVar2;

  puVar1[6] = uVar2;

  puVar1[5] = *(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_005a8f80 at 0x005A8F80 (size: 72) ---


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



{

  *param_1 = &PTR_FUN_007e6b14;

  FUN_005a8590();

  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_005a9120 at 0x005A9120 (size: 155) ---


undefined4 __thiscall FUN_005a9120(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[4]) {

      if (*param_2 == *puVar1) {

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

          return 0;

        }

        break;

      }

    }

  }

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

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

    return 0;

  }

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

  *puVar1 = *param_2;

  FUN_005aa230(param_3);

  puVar1[4] = 0;

  uVar2 = *param_2 % uVar2;

  puVar1[5] = uVar2;

  puVar1[4] = *(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_005a91c0 at 0x005A91C0 (size: 72) ---


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



{

  *param_1 = &PTR_FUN_007e6b00;

  FUN_005a86d0();

  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_005a9210 at 0x005A9210 (size: 103) ---


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



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007e6b40;

  param_1[0xc] = &PTR_LAB_007e6b28;

  param_1[0xe] = &PTR_FUN_007e6b00;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 8;

  param_1[0x12] = 0;

  FUN_005a8440();

  param_1[0x13] = &PTR_FUN_007e6b14;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  param_1[0x16] = 0x20;

  param_1[0x17] = 0;

  FUN_005a8440();

  return param_1;

}





// --- FUN_005a9290 at 0x005A9290 (size: 30) ---


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



{

  FUN_005a92b0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005a92b0 at 0x005A92B0 (size: 125) ---


void __fastcall FUN_005a92b0(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007e6b40;

  param_1[0xc] = &PTR_LAB_007e6b28;

  param_1[0x13] = &PTR_FUN_007e6b14;

  FUN_005a8590();

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

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

    param_1[0x15] = 0;

  }

  param_1[0x16] = 0;

  param_1[0x13] = &PTR_FUN_0079385c;

  param_1[0xe] = &PTR_FUN_007e6b00;

  FUN_005a86d0();

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

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

    param_1[0x10] = 0;

  }

  param_1[0x11] = 0;

  param_1[0xe] = &PTR_FUN_0079385c;

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  return;

}





// --- FUN_005a9340 at 0x005A9340 (size: 34) ---


void __thiscall FUN_005a9340(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  int iVar1;

  undefined4 *puVar2;

  

  *param_1 = param_2;

  param_1[1] = param_3;

  puVar2 = param_1 + 2;

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

    *puVar2 = *param_1;

    param_1 = param_1 + 1;

    puVar2 = puVar2 + 1;

  }

  return;

}





// --- FUN_005a9370 at 0x005A9370 (size: 21) ---


float10 __thiscall FUN_005a9370(int param_1,int param_2)



{

  if (param_2 < 4) {

    return (float10)*(double *)(param_1 + param_2 * 8);

  }

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

}





// --- FUN_005a9390 at 0x005A9390 (size: 69) ---


int __fastcall FUN_005a9390(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  undefined4 local_4;

  

  iVar2 = 0;

  uVar4 = 0;

  local_4 = 0;

  iVar3 = 0xc;

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

    do {

      iVar1 = (**(code **)(*(int *)(*(int *)(param_1 + 0x10) + iVar2) + 0xc))(&local_4,0);

      iVar3 = iVar3 + iVar1;

      uVar4 = uVar4 + 1;

      iVar2 = iVar2 + 0xc;

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

  }

  return iVar3;

}





// --- FUN_005a93e0 at 0x005A93E0 (size: 69) ---


int __fastcall FUN_005a93e0(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  undefined4 local_4;

  

  iVar2 = 0;

  uVar4 = 0;

  local_4 = 0;

  iVar3 = 8;

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

    do {

      iVar1 = (**(code **)(*(int *)(*(int *)(param_1 + 0xc) + iVar2) + 0xc))(&local_4,0);

      iVar3 = iVar3 + iVar1;

      uVar4 = uVar4 + 1;

      iVar2 = iVar2 + 0x14;

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

  }

  return iVar3;

}





// --- FUN_005a94b0 at 0x005A94B0 (size: 71) ---


void __fastcall FUN_005a94b0(undefined4 *param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)param_1[4];

  *param_1 = &PTR_LAB_007e6b98;

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

    if (puVar1[-1] != 0) {

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

      param_1[4] = 0;

      *param_1 = &PTR_FUN_0079385c;

      return;

    }

    operator_delete__(puVar1 + -1);

    param_1[4] = 0;

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005a9500 at 0x005A9500 (size: 27) ---


void __fastcall FUN_005a9500(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007e6bac;

  param_1[1] = DAT_008eea08;

  param_1[2] = DAT_008eea08;

  return;

}





// --- FUN_005a9520 at 0x005A9520 (size: 26) ---


void __fastcall FUN_005a9520(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e6bc0;

  param_1[1] = DAT_008eea08;

  param_1[2] = 0;

  param_1[3] = 0;

  return;

}





// --- FUN_005a9540 at 0x005A9540 (size: 79) ---


void __fastcall FUN_005a9540(undefined4 *param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)param_1[3];

  *param_1 = &PTR_FUN_007e6bc0;

  param_1[1] = DAT_008eea08;

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

    if (puVar1[-1] != 0) {

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

      param_1[3] = 0;

      *param_1 = &PTR_FUN_0079385c;

      return;

    }

    operator_delete__(puVar1 + -1);

    param_1[3] = 0;

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005a95b0 at 0x005A95B0 (size: 144) ---


int __thiscall FUN_005a95b0(int param_1,int param_2)



{

  int iVar1;

  undefined4 uVar2;

  uint uVar3;

  

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

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

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

  }

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

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

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

  }

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

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

  uVar2 = thunk_FUN_005df0f5(iVar1 << 2);

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

  uVar2 = thunk_FUN_005df0f5(*(int *)(param_1 + 4) << 2);

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

  uVar3 = 0;

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

    do {

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

           *(undefined4 *)(*(int *)(param_2 + 8) + uVar3 * 4);

      *(undefined4 *)(*(int *)(param_1 + 0xc) + uVar3 * 4) =

           *(undefined4 *)(*(int *)(param_2 + 0xc) + uVar3 * 4);

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 4));

  }

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

  return param_1;

}





// --- FUN_005a9640 at 0x005A9640 (size: 180) ---


int __thiscall FUN_005a9640(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  int iVar5;

  int *piVar6;

  uint uVar7;

  

  if (param_1 != param_2) {

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

    piVar6 = (int *)0x0;

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

      if (puVar1[-1] == 0) {

        operator_delete__(puVar1 + -1);

      }

      else {

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

      }

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

    }

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

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

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

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

    if (iVar5 != 0) {

      piVar3 = (int *)thunk_FUN_005df0f5(iVar5 * 0xc + 4);

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

        piVar6 = piVar3 + 1;

        *piVar3 = iVar5;

        FUN_00401000(piVar6,0xc,iVar5,FUN_005a9500);

      }

      uVar7 = 0;

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

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

        iVar5 = 0;

        do {

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

          iVar4 = *(int *)(param_1 + 0x10) + iVar5;

          *(undefined4 *)(iVar4 + 4) = *(undefined4 *)(iVar2 + 4 + iVar5);

          *(undefined4 *)(iVar4 + 8) = *(undefined4 *)(iVar2 + iVar5 + 8);

          uVar7 = uVar7 + 1;

          iVar5 = iVar5 + 0xc;

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

      }

    }

  }

  return param_1;

}





// --- FUN_005a98c0 at 0x005A98C0 (size: 77) ---


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



{

  undefined4 *puVar1;

  undefined4 uVar2;

  

  if (param_3 < 8) {

    return 0;

  }

  puVar1 = (undefined4 *)*param_2;

  uVar2 = *puVar1;

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

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

  uVar2 = *(undefined4 *)*param_2;

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

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

  if (param_3 < (uint)(*param_2 - (int)puVar1)) {

    *param_2 = (int)puVar1;

    return 0;

  }

  return 1;

}





// --- FUN_005a9910 at 0x005A9910 (size: 30) ---


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



{

  FUN_005a9540();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005a9930 at 0x005A9930 (size: 180) ---


int __thiscall FUN_005a9930(int param_1,int param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  int *piVar3;

  uint uVar4;

  int iVar5;

  

  if (param_1 != param_2) {

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

    piVar3 = (int *)0x0;

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

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

      if (puVar1[-1] == 0) {

        operator_delete__(puVar1 + -1);

      }

      else {

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

      }

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

    }

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

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

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

    if (iVar5 != 0) {

      piVar2 = (int *)thunk_FUN_005df0f5(iVar5 * 0x14 + 4);

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

        piVar3 = piVar2 + 1;

        *piVar2 = iVar5;

        FUN_00401000(piVar3,0x14,iVar5,&LAB_005a9590);

      }

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

      uVar4 = 0;

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

        iVar5 = 0;

        do {

          FUN_005a95b0(*(int *)(param_2 + 0xc) + iVar5);

          uVar4 = uVar4 + 1;

          iVar5 = iVar5 + 0x14;

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

      }

    }

  }

  return param_1;

}





// --- FUN_005a9c90 at 0x005A9C90 (size: 177) ---


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



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 uVar3;

  int iVar4;

  

  if (param_3 < *(int *)(param_1 + 4) * 8 + 8U) {

    return 0;

  }

  puVar1 = (undefined4 *)*param_2;

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

  *param_2 = *param_2 + 4;

  uVar3 = thunk_FUN_005df0f5(*(int *)(param_1 + 4) << 2);

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

  uVar3 = thunk_FUN_005df0f5(*(int *)(param_1 + 4) << 2);

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

  iVar4 = 0;

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

    do {

      *(undefined4 *)(*(int *)(param_1 + 8) + iVar4 * 4) = *(undefined4 *)*param_2;

      iVar2 = *param_2;

      *param_2 = iVar2 + 4;

      *(undefined4 *)(*(int *)(param_1 + 0xc) + iVar4 * 4) = *(undefined4 *)(iVar2 + 4);

      *param_2 = *param_2 + 4;

      iVar4 = iVar4 + 1;

    } while (iVar4 < *(int *)(param_1 + 4));

  }

  uVar3 = *(undefined4 *)*param_2;

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

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

  if ((uint)(*param_2 - (int)puVar1) <= param_3) {

    return 1;

  }

  *param_2 = (int)puVar1;

  return 0;

}





// --- FUN_005a9d50 at 0x005A9D50 (size: 43) ---


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



{

  *param_1 = &PTR_FUN_007e6bc0;

  param_1[1] = DAT_008eea08;

  param_1[2] = 0;

  param_1[3] = 0;

  FUN_005a9930(param_2);

  return param_1;

}





// --- FUN_005a9d80 at 0x005A9D80 (size: 69) ---


int __fastcall FUN_005a9d80(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  undefined4 local_4;

  

  iVar2 = 0;

  uVar4 = 0;

  local_4 = 0;

  iVar3 = 4;

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

    do {

      iVar1 = (**(code **)(*(int *)(*(int *)(param_1 + 8) + iVar2) + 0xc))(&local_4,0);

      iVar3 = iVar3 + iVar1;

      uVar4 = uVar4 + 1;

      iVar2 = iVar2 + 0x14;

    } while (uVar4 < *(uint *)(param_1 + 4));

  }

  return iVar3;

}





// --- FUN_005a9dd0 at 0x005A9DD0 (size: 17) ---


void __fastcall FUN_005a9dd0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e6bfc;

  param_1[1] = 0;

  param_1[2] = 0;

  return;

}





// --- FUN_005a9df0 at 0x005A9DF0 (size: 71) ---


void __fastcall FUN_005a9df0(undefined4 *param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)param_1[2];

  *param_1 = &PTR_FUN_007e6bfc;

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

    if (puVar1[-1] != 0) {

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

      param_1[2] = 0;

      *param_1 = &PTR_FUN_0079385c;

      return;

    }

    operator_delete__(puVar1 + -1);

    param_1[2] = 0;

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005a9e40 at 0x005A9E40 (size: 161) ---


int __thiscall FUN_005a9e40(int param_1,int param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  int *piVar3;

  uint uVar4;

  int iVar5;

  

  if (param_1 != param_2) {

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

    piVar3 = (int *)0x0;

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

      if (puVar1[-1] == 0) {

        operator_delete__(puVar1 + -1);

      }

      else {

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

      }

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

    }

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

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

    if (iVar5 != 0) {

      piVar2 = (int *)thunk_FUN_005df0f5(iVar5 * 0x14 + 4);

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

        piVar3 = piVar2 + 1;

        *piVar2 = iVar5;

        FUN_00401000(piVar3,0x14,iVar5,&LAB_005a9430);

      }

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

      uVar4 = 0;

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

        iVar5 = 0;

        do {

          FUN_005a9640(*(int *)(param_2 + 8) + iVar5);

          uVar4 = uVar4 + 1;

          iVar5 = iVar5 + 0x14;

        } while (uVar4 < *(uint *)(param_1 + 4));

      }

    }

  }

  return param_1;

}





// --- FUN_005a9f60 at 0x005A9F60 (size: 263) ---


undefined4 __fastcall FUN_005a9f60(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  int iVar3;

  uint uVar4;

  int iVar5;

  int iVar6;

  uint local_34;

  undefined4 local_30;

  undefined **local_2c;

  undefined4 local_28;

  undefined4 local_24;

  undefined4 local_20;

  undefined4 local_1c;

  undefined **local_18;

  undefined4 local_14;

  int local_10;

  int local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_10 = DAT_008eea10;

  local_c = DAT_008eea10;

  local_2c = &PTR_FUN_007c95e4;

  local_20 = 0;

  local_1c = 0;

  local_18 = &PTR_FUN_007e6be8;

  local_14 = 0;

  local_8 = 0;

  local_4 = 0;

  local_30 = 1;

  local_34 = 0;

  uVar2 = 1;

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

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

    iVar5 = 0;

    do {

      iVar6 = 0;

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

      local_24 = *(undefined4 *)(iVar5 + 8 + iVar3);

      FUN_005ad100(&local_2c);

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

      uVar4 = 0;

      if (*(int *)(iVar5 + 0xc + iVar3) != 0) {

        do {

          iVar1 = *(int *)(iVar5 + iVar3 + 0x10);

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

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

          local_10 = *(int *)(iVar1 + iVar6 + 4);

          if ((local_10 == DAT_008eea10) || (local_c == DAT_008eea10)) {

            local_30 = 0;

          }

          FUN_005ad0a0(&local_18);

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

          uVar4 = uVar4 + 1;

          iVar6 = iVar6 + 0xc;

        } while (uVar4 < *(uint *)(iVar5 + 0xc + iVar3));

      }

      local_34 = local_34 + 1;

      iVar5 = iVar5 + 0x14;

      uVar2 = local_30;

    } while (local_34 < *(uint *)(param_1 + 4));

  }

  return uVar2;

}





// --- FUN_005aa1e0 at 0x005AA1E0 (size: 78) ---


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



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)param_1[2];

  *param_1 = &PTR_FUN_007e6bfc;

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

    if (puVar1[-1] == 0) {

      operator_delete__(puVar1 + -1);

    }

    else {

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

    }

    param_1[2] = 0;

  }

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005aa230 at 0x005AA230 (size: 33) ---


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



{

  param_1[1] = 0;

  param_1[2] = 0;

  *param_1 = &PTR_FUN_007e6bfc;

  FUN_005a9e40(param_2);

  return param_1;

}





// --- FUN_005aa260 at 0x005AA260 (size: 163) ---


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



{

  LONG *lpAddend;

  int iVar1;

  undefined4 *puVar2;

  LONG LVar3;

  uint uVar4;

  

  puVar2 = DAT_008ef11c;

  lpAddend = DAT_008ef11c + 1;

  InterlockedIncrement(lpAddend);

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

  uVar4 = iVar1 - 1;

  if (param_3 < uVar4) {

    if (uVar4 <= param_4) {

      param_4 = iVar1 - 2;

    }

    FUN_004910c0(*param_1 + 0x14 + param_3,(param_4 - param_3) + 1);

    *param_2 = puVar2;

    InterlockedIncrement(puVar2 + 1);

    LVar3 = InterlockedDecrement(puVar2 + 1);

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

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

    }

  }

  else {

    *param_2 = puVar2;

    InterlockedIncrement(lpAddend);

    LVar3 = InterlockedDecrement(lpAddend);

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

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

      return param_2;

    }

  }

  return param_2;

}





// --- FUN_005aa310 at 0x005AA310 (size: 206) ---


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



{

  undefined4 *puVar1;

  int iVar2;

  int *piVar3;

  int *piVar4;

  LONG LVar5;

  undefined4 *local_4;

  

  piVar4 = param_3;

  piVar3 = param_2;

  if (((undefined4 *)*param_2)[2] == 1) {

    return 0;

  }

  puVar1 = (undefined4 *)*param_3;

  local_4 = param_1;

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

    LVar5 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    iVar2 = *piVar3;

    *piVar4 = iVar2;

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

  }

  FUN_0048c3e0(&DAT_00795500);

  FUN_0048c3e0(&DAT_00795098);

  FUN_00566d10(&local_4,&param_2);

  FUN_00411870();

  _strlwr((char *)(*piVar4 + 0x14));

  piVar3 = param_2;

  LVar5 = InterlockedDecrement(param_2 + 1);

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

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

  }

  puVar1 = local_4;

  LVar5 = InterlockedDecrement(local_4 + 1);

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

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

  }

  return 1;

}





// --- FUN_005aa3e0 at 0x005AA3E0 (size: 120) ---


void __thiscall FUN_005aa3e0(int param_1,char *param_2,size_t param_3)



{

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

    return;

  }

  _snprintf(param_2,param_3,"0x%08X [%f %f %f] %f %f %f %f",*(undefined4 *)(param_1 + 4),

            (double)*(float *)(param_1 + 0x3c),(double)*(float *)(param_1 + 0x40),

            (double)*(float *)(param_1 + 0x44),(double)*(float *)(param_1 + 8),

            (double)*(float *)(param_1 + 0xc),(double)*(float *)(param_1 + 0x10),

            (double)*(float *)(param_1 + 0x14));

  return;

}





// --- FUN_005aa460 at 0x005AA460 (size: 167) ---


undefined4 __thiscall FUN_005aa460(int param_1,char *param_2)



{

  int iVar1;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

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

    iVar1 = sscanf(param_2,"0x%08X [%f %f %f] %f %f %f %f",param_1 + 4,param_1 + 0x3c,param_1 + 0x40

                   ,param_1 + 0x44,&param_2,&local_4,&local_8,&local_c);

    if (iVar1 == 5) {

      FUN_00536b80(param_2);

      FUN_00535b30();

      return 1;

    }

    if (iVar1 == 8) {

      FUN_00535dc0(param_2,local_4,local_8,local_c);

      FUN_00535b30();

      return 1;

    }

  }

  return 0;

}





// --- FUN_005aa510 at 0x005AA510 (size: 29) ---


int FUN_005aa510(void)



{

  int iVar1;

  undefined4 local_4;

  

  local_4 = 0;

  iVar1 = FUN_00535e70(&local_4,0);

  return iVar1 + 4;

}





// --- FUN_005aa530 at 0x005AA530 (size: 37) ---


bool __fastcall FUN_005aa530(int param_1)



{

  int iVar1;

  

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

  if (iVar1 == 0) {

    return false;

  }

  iVar1 = FUN_00535c10();

  return iVar1 != 0;

}





// --- FUN_005aa560 at 0x005AA560 (size: 56) ---


float10 FUN_005aa560(undefined4 param_1)



{

  float *pfVar1;

  undefined1 local_c [12];

  

  pfVar1 = (float *)FUN_0050aa30(local_c,param_1);

  return SQRT((float10)pfVar1[2] * (float10)pfVar1[2] +

              (float10)pfVar1[1] * (float10)pfVar1[1] + (float10)*pfVar1 * (float10)*pfVar1);

}





// --- FUN_005aa5a0 at 0x005AA5A0 (size: 44) ---


float10 FUN_005aa5a0(undefined4 param_1)



{

  float local_c;

  float local_8;

  

  FUN_0050aa30(&local_c,param_1);

  return SQRT((float10)local_c * (float10)local_c + (float10)local_8 * (float10)local_8);

}





// --- FUN_005aa5d0 at 0x005AA5D0 (size: 94) ---


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



float10 FUN_005aa5d0(undefined4 param_1)



{

  int iVar1;

  float10 fVar2;

  float local_c;

  float local_8;

  undefined4 local_4;

  

  FUN_0050aa30(&local_c,param_1);

  local_4 = 0;

  iVar1 = FUN_004524a0();

  if (iVar1 != 0) {

    return (float10)DAT_00796344;

  }

  fpatan((float10)local_8,(float10)local_c);

  fVar2 = (float10)_CIfmod();

  return fVar2;

}





// --- FUN_005aa630 at 0x005AA630 (size: 178) ---


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



uint FUN_005aa630(float param_1,undefined4 param_2)



{

  uint uVar1;

  float local_18;

  float local_14;

  float local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_c = 0;

  local_8 = 0;

  local_4 = 0;

  FUN_00452830(&local_18,param_2,&local_c);

  uVar1 = 8;

  if (DAT_00796344 <= local_18) {

    uVar1 = 0x10;

  }

  if (DAT_00796344 <= local_14) {

    uVar1 = uVar1 | 0x20;

  }

  else {

    uVar1 = uVar1 | 0x40;

  }

  if (local_10 < param_1 * (float)_DAT_007e6c70) {

    return uVar1 | 4;

  }

  if (local_10 < param_1 * (float)_DAT_007e6c68) {

    return uVar1 | 2;

  }

  return uVar1 | 1;

}





// --- FUN_005aa740 at 0x005AA740 (size: 82) ---


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



{

  int iVar1;

  undefined4 uVar2;

  undefined4 local_4;

  

  local_4 = 0;

  iVar1 = FUN_00535e70(&local_4,0);

  if (param_3 < iVar1 + 4U) {

    return 0;

  }

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

  *param_2 = *param_2 + 4;

  uVar2 = FUN_00535ee0(param_2,param_3);

  return uVar2;

}





// --- FUN_005aa7a0 at 0x005AA7A0 (size: 74) ---


void __thiscall FUN_005aa7a0(int param_1,int param_2)



{

  undefined4 *puVar1;

  

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

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

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

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

      FUN_00535f70(param_2);

      return;

    }

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

  }

  FUN_00535f70(param_2);

  return;

}





// --- FUN_005aa7f0 at 0x005AA7F0 (size: 78) ---


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



{

  int iVar1;

  

  if (0xf < param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    if (0xb < param_3) {

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      *param_2 = *param_2 + 4;

    }

  }

  return 0x10;

}





// --- FUN_005aa840 at 0x005AA840 (size: 82) ---


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



{

  int iVar1;

  

  if (0xf < param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    if (0xb < param_3) {

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      *param_2 = *param_2 + 4;

      return 1;

    }

  }

  return 0;

}





// --- FUN_005aa8a0 at 0x005AA8A0 (size: 192) ---


float10 FUN_005aa8a0(float param_1,float param_2,int param_3,float param_4,float param_5,int param_6

                    )



{

  float fVar1;

  float *pfVar2;

  float10 fVar3;

  float10 fVar4;

  float10 fVar5;

  undefined1 local_c [12];

  

  pfVar2 = (float *)FUN_0050aa30(local_c,param_6);

  fVar1 = SQRT(pfVar2[2] * pfVar2[2] + pfVar2[1] * pfVar2[1] + *pfVar2 * *pfVar2) -

          (param_1 + param_4);

  fVar3 = (float10)*(float *)(param_3 + 0x44);

  fVar4 = (float10)*(float *)(param_6 + 0x44);

  if (fVar3 <= fVar4) {

    fVar5 = fVar3 + (float10)param_2;

  }

  else {

    fVar5 = fVar4 + (float10)param_5;

    fVar4 = fVar3;

  }

  fVar4 = fVar4 - fVar5;

  if (fVar4 <= (float10)DAT_00796344) {

    if (DAT_00796344 < fVar1) {

      return (float10)fVar1;

    }

    fVar4 = -SQRT((float10)fVar1 * (float10)fVar1 + fVar4 * fVar4);

  }

  else if (DAT_00796344 < fVar1) {

    return SQRT((float10)fVar1 * (float10)fVar1 + fVar4 * fVar4);

  }

  return fVar4;

}





// --- FUN_005aa960 at 0x005AA960 (size: 68) ---


float10 FUN_005aa960(float param_1,undefined4 param_2,float param_3,undefined4 param_4)



{

  float *pfVar1;

  undefined1 local_c [12];

  

  pfVar1 = (float *)FUN_0050aa30(local_c,param_4);

  return SQRT((float10)pfVar1[2] * (float10)pfVar1[2] +

              (float10)pfVar1[1] * (float10)pfVar1[1] + (float10)*pfVar1 * (float10)*pfVar1) -

         ((float10)param_1 + (float10)param_3);

}





// --- FUN_005aa9b0 at 0x005AA9B0 (size: 125) ---


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



{

  LONG LVar1;

  undefined4 *puVar2;

  float10 fVar3;

  int local_4;

  

  local_4 = param_1;

  fVar3 = (float10)FUN_005364a0();

  FUN_00408670(&local_4,0,"0x%08X [%0.2f %0.2f %0.2f] %0.2f",*(undefined4 *)(param_1 + 4),

               (double)*(float *)(param_1 + 0x3c),(double)*(float *)(param_1 + 0x40),

               (double)*(float *)(param_1 + 0x44),(double)fVar3);

  *param_2 = local_4;

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

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

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

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

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

  }

  return param_2;

}





// --- FUN_005aaa30 at 0x005AAA30 (size: 89) ---


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



void FUN_005aaa30(undefined4 *param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4,

                 undefined4 *param_5,undefined4 *param_6,undefined4 *param_7,undefined4 *param_8)



{

  undefined4 uVar1;

  

  uVar1 = _DAT_007e6ccc;

  *param_1 = 0xff;

  *param_2 = 0xff;

  *param_3 = uVar1;

  uVar1 = _DAT_007e6cc0;

  *param_4 = 8;

  *param_5 = 1;

  *param_6 = uVar1;

  *param_7 = _DAT_007e6cc4;

  *param_8 = _DAT_007e6c9c;

  return;

}





// --- FUN_005aaa90 at 0x005AAA90 (size: 80) ---


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



undefined4 FUN_005aaa90(float *param_1)



{

  uint uVar1;

  int iVar2;

  

  uVar1 = 0;

  iVar2 = (int)&DAT_008eea38 - (int)param_1;

  while ((DAT_00796344 <= *param_1 && (*param_1 <= _DAT_007e6cc4 - _DAT_007e6cc0))) {

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

    uVar1 = uVar1 + 1;

    param_1 = param_1 + 1;

    if (0xff < uVar1) {

      return 1;

    }

  }

  return 0;

}





// --- FUN_005aaae0 at 0x005AAAE0 (size: 73) ---


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



float10 FUN_005aaae0(undefined4 param_1)



{

  switch(param_1) {

  default:

    return (float10)DAT_00796344;

  case 2:

    return (float10)_DAT_0079cc88;

  case 3:

    return (float10)_DAT_007bee9c;

  case 4:

    return (float10)_DAT_007bee98;

  case 5:

    return (float10)_DAT_007e6cd8;

  case 6:

    return (float10)_DAT_007e6cdc;

  case 7:

    return (float10)_DAT_007e6ce4;

  case 8:

    return (float10)_DAT_007e6ce0;

  }

}





// --- FUN_005aab50 at 0x005AAB50 (size: 84) ---


undefined1 FUN_005aab50(int param_1,int param_2)



{

  if (param_1 < 0) {

    if (param_2 < 0) {

      return 6;

    }

    return (0 < param_2) + '\x04';

  }

  if (param_1 < 1) {

    if (param_2 < 0) {

      return 2;

    }

    return 0 < param_2;

  }

  if (param_2 < 0) {

    return 8;

  }

  return (0 < param_2) * '\x04' + '\x03';

}





// --- FUN_005aabb0 at 0x005AABB0 (size: 178) ---


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



undefined4 FUN_005aabb0(uint param_1,float *param_2,int *param_3,int *param_4)



{

  uint uVar1;

  int iVar2;

  

  uVar1 = param_1 & 0xffff;

  if ((((uVar1 == 0) || (0x40 < uVar1)) && ((uVar1 < 0x100 || (0xfffd < uVar1)))) &&

     (uVar1 != 0xffff)) {

    return 0;

  }

  FUN_0043d820(param_1,param_3,param_4);

  floor((double)(*param_2 / _DAT_007e6ccc));

  iVar2 = FUN_005df4c4();

  *param_3 = *param_3 + iVar2;

  floor((double)(param_2[1] / _DAT_007e6ccc));

  iVar2 = FUN_005df4c4();

  iVar2 = *param_4 + iVar2;

  *param_4 = iVar2;

  if ((((-1 < *param_3) && (-1 < iVar2)) && (*param_3 < 0x7f8)) && (iVar2 < 0x7f8)) {

    return 1;

  }

  return 0;

}





// --- FUN_005aac70 at 0x005AAC70 (size: 229) ---


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



undefined4 FUN_005aac70(uint *param_1,float *param_2)



{

  uint *puVar1;

  float *pfVar2;

  uint uVar3;

  int iVar4;

  double dVar5;

  undefined4 local_4;

  

  pfVar2 = param_2;

  puVar1 = param_1;

  uVar3 = *param_1 & 0xffff;

  if ((((uVar3 != 0) && (uVar3 < 0x41)) || ((0xff < uVar3 && (uVar3 < 0xfffe)))) ||

     (uVar3 == 0xffff)) {

    if (ABS(*param_2) < _DAT_007e6cd4) {

      *param_2 = 0.0;

    }

    if (ABS(param_2[1]) < _DAT_007e6cd4) {

      param_2[1] = 0.0;

    }

    iVar4 = FUN_005aabb0(*param_1,param_2,&local_4,&param_1);

    if (iVar4 != 0) {

      uVar3 = FUN_004a1cd0(local_4,param_1);

      *puVar1 = uVar3;

      dVar5 = floor((double)(*pfVar2 / _DAT_008eee54));

      *pfVar2 = *pfVar2 - (float)dVar5 * _DAT_008eee54;

      dVar5 = floor((double)(pfVar2[1] / _DAT_008eee54));

      pfVar2[1] = pfVar2[1] - (float)dVar5 * _DAT_008eee54;

      return 1;

    }

  }

  *puVar1 = 0;

  return 0;

}





// --- FUN_005aad60 at 0x005AAD60 (size: 285) ---


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



undefined4 * FUN_005aad60(undefined4 *param_1,undefined4 param_2)



{

  LONG *lpAddend;

  double dVar1;

  double dVar2;

  undefined4 *puVar3;

  undefined *puVar4;

  LONG LVar5;

  undefined *puVar6;

  undefined4 *local_c;

  int local_8;

  int local_4;

  

  local_c = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  FUN_00497d70(param_2,&local_4,&local_8);

  local_8 = local_8 + -0x400;

  local_4 = local_4 + -0x400;

  dVar1 = (double)local_8 * _DAT_007a7e00 + _DAT_00799088;

  dVar2 = (double)local_4 * _DAT_007a7e00 + _DAT_00799088;

  if (_DAT_00795610 <= dVar2) {

    puVar6 = &DAT_007ac7b8;

    if (dVar2 <= _DAT_00795610) {

      puVar6 = &DAT_007938af;

    }

  }

  else {

    puVar6 = &DAT_007ac7b4;

  }

  if (_DAT_00795610 <= dVar1) {

    puVar4 = &DAT_0079ab78;

    if (dVar1 <= _DAT_00795610) {

      puVar4 = &DAT_007938af;

    }

  }

  else {

    puVar4 = &DAT_007ac7b0;

  }

  FUN_00487620(&local_c,"%.1f%s, %.1f%s",ABS(dVar1),puVar4,ABS(dVar2),puVar6);

  puVar3 = local_c;

  lpAddend = local_c + 1;

  *param_1 = local_c;

  InterlockedIncrement(lpAddend);

  LVar5 = InterlockedDecrement(lpAddend);

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

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

  }

  return param_1;

}





// --- FUN_005aae80 at 0x005AAE80 (size: 42) ---


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



{

  int iVar1;

  

  if (7 < param_3) {

    *(undefined4 *)*param_2 = *param_1;

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return 8;

}





// --- FUN_005aaeb0 at 0x005AAEB0 (size: 33) ---


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



{

  int iVar1;

  

  *param_1 = *(undefined4 *)*param_2;

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_005aaee0 at 0x005AAEE0 (size: 266) ---


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



undefined4 __fastcall FUN_005aaee0(float *param_1)



{

  float fVar1;

  int iVar2;

  undefined4 uVar3;

  

  uVar3 = 1;

  iVar2 = _isnan((double)*param_1);

  if (iVar2 == 0) {

    iVar2 = _isnan((double)param_1[1]);

    if (iVar2 == 0) {

      iVar2 = _isnan((double)param_1[2]);

      if (iVar2 == 0) {

        iVar2 = _isnan((double)param_1[3]);

        if (iVar2 == 0) {

          iVar2 = _isnan((double)param_1[4]);

          if (iVar2 == 0) {

            iVar2 = _isnan((double)param_1[5]);

            if (iVar2 == 0) {

              iVar2 = _isnan((double)param_1[6]);

              if (iVar2 == 0) goto LAB_005aaf76;

            }

          }

        }

      }

    }

  }

  uVar3 = 0;

LAB_005aaf76:

  fVar1 = param_1[3] * param_1[3] +

          param_1[4] * param_1[4] + param_1[5] * param_1[5] + param_1[6] * param_1[6];

  iVar2 = _isnan((double)fVar1);

  if ((iVar2 == 0) && (ABS(fVar1 - _DAT_007938b0) <= _DAT_007e6d10 * _DAT_007b817c)) {

    return uVar3;

  }

  return 0;

}





// --- FUN_005aaff0 at 0x005AAFF0 (size: 111) ---


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



{

  int iVar1;

  

  if (0x1b < param_3) {

    if (0xb < param_3) {

      *(undefined4 *)*param_2 = *param_1;

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      *param_2 = *param_2 + 4;

    }

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return 0x1c;

}





// --- FUN_005ab060 at 0x005AB060 (size: 104) ---


bool __thiscall FUN_005ab060(undefined4 *param_1,int *param_2,uint param_3)



{

  int iVar1;

  

  if (0xb < param_3) {

    *param_1 = *(undefined4 *)*param_2;

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  iVar1 = FUN_005aaee0();

  return iVar1 != 0;

}





// --- FUN_005ab0d0 at 0x005AB0D0 (size: 88) ---


undefined4 FUN_005ab0d0(int *param_1)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  

  uVar1 = FUN_005df4c4();

  uVar2 = FUN_005df4c4();

  uVar3 = FUN_005df4c4();

  *(uint *)*param_1 = ((uVar1 | 0xffffff00) << 8 | uVar2) << 8 | uVar3;

  *param_1 = *param_1 + 4;

  return 4;

}





// --- FUN_005ab130 at 0x005AB130 (size: 29) ---


undefined4 FUN_005ab130(int *param_1)



{

  undefined4 uVar1;

  

  uVar1 = *(undefined4 *)*param_1;

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

  FUN_00451a60(uVar1);

  return 1;

}





// --- FUN_005ab150 at 0x005AB150 (size: 204) ---


void FUN_005ab150(float *param_1,undefined4 param_2,int param_3,float *param_4)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float *pfVar7;

  float local_18;

  float local_14;

  float local_10;

  undefined1 local_c [12];

  

  local_10 = -param_4[3];

  local_18 = local_10 * *param_4;

  local_14 = local_10 * param_4[1];

  local_10 = local_10 * param_4[2];

  fVar4 = *(float *)(param_3 + 0x18) * *param_4 +

          *(float *)(param_3 + 0x24) * param_4[1] + *(float *)(param_3 + 0x30) * param_4[2];

  fVar5 = *(float *)(param_3 + 0x1c) * *param_4 +

          *(float *)(param_3 + 0x28) * param_4[1] + *(float *)(param_3 + 0x34) * param_4[2];

  fVar6 = *(float *)(param_3 + 0x20) * *param_4 +

          *(float *)(param_3 + 0x2c) * param_4[1] + *(float *)(param_3 + 0x38) * param_4[2];

  pfVar7 = (float *)FUN_004562a0(local_c,param_3,&local_18);

  fVar1 = pfVar7[2];

  fVar2 = pfVar7[1];

  fVar3 = *pfVar7;

  *param_1 = fVar4;

  param_1[1] = fVar5;

  param_1[2] = fVar6;

  param_1[3] = -(fVar4 * fVar3 + fVar5 * fVar2 + fVar6 * fVar1);

  return;

}





// --- FUN_005ab220 at 0x005AB220 (size: 385) ---


int __thiscall FUN_005ab220(float *param_1,float *param_2)



{

  float fVar1;

  float fVar2;

  int iVar3;

  int iVar4;

  float local_c;

  float local_8;

  float local_4;

  

  fVar2 = DAT_007e6d4c;

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

  if (fVar1 <= DAT_007e6d4c) {

    if (-DAT_007e6d4c <= fVar1) {

      return 3;

    }

    iVar4 = 1;

  }

  else {

    iVar4 = 0;

  }

  local_c = param_2[3];

  local_8 = param_2[4];

  local_4 = param_2[5];

  iVar3 = FUN_00444880(&local_c,DAT_007e6d4c);

  if (iVar4 == iVar3) {

    local_c = param_2[3];

    local_8 = param_2[1];

    local_4 = param_2[2];

    iVar3 = FUN_00444880(&local_c,fVar2);

    if (iVar4 == iVar3) {

      local_c = *param_2;

      local_4 = param_2[2];

      local_8 = param_2[4];

      iVar3 = FUN_00444880(&local_c,fVar2);

      if (iVar4 == iVar3) {

        local_c = *param_2;

        local_8 = param_2[1];

        local_4 = param_2[5];

        iVar3 = FUN_00444880(&local_c,fVar2);

        if (iVar4 == iVar3) {

          local_c = param_2[3];

          local_8 = param_2[4];

          local_4 = param_2[2];

          iVar3 = FUN_00444880(&local_c,fVar2);

          if (iVar4 == iVar3) {

            local_c = param_2[3];

            local_4 = param_2[5];

            local_8 = param_2[1];

            iVar3 = FUN_00444880(&local_c,fVar2);

            if (iVar4 == iVar3) {

              local_c = *param_2;

              local_8 = param_2[4];

              local_4 = param_2[5];

              iVar3 = FUN_00444880(&local_c,fVar2);

              if (iVar4 == iVar3) {

                return iVar4;

              }

            }

          }

        }

      }

    }

  }

  return 3;

}





// --- FUN_005ab3b0 at 0x005AB3B0 (size: 25) ---


undefined4 FUN_005ab3b0(undefined4 param_1,uint param_2)



{

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

    return 1;

  }

  return 0;

}





// --- FUN_005ab3d0 at 0x005AB3D0 (size: 13) ---


longlong FUN_005ab3d0(undefined4 param_1,uint param_2)



{

  return (ulonglong)(param_2 & 0x1f000000) << 0x20;

}





// --- FUN_005ab3e0 at 0x005AB3E0 (size: 15) ---


ulonglong FUN_005ab3e0(ulonglong param_1)



{

  return param_1 & 0xff0000ffffffff;

}





// --- FUN_005ab3f0 at 0x005AB3F0 (size: 34) ---


longlong FUN_005ab3f0(int param_1)



{

  uint uVar1;

  

  uVar1 = param_1 << 0x10;

  if ((uVar1 & 0xff0000) != uVar1) {

    uVar1 = uVar1 & 0xff0000;

  }

  return (ulonglong)uVar1 << 0x20;

}





// --- FUN_005ab420 at 0x005AB420 (size: 83) ---


undefined8 FUN_005ab420(int param_1,uint param_2,ushort param_3,undefined4 param_4,uint param_5)



{

  if ((param_1 != 0) || ((param_2 & 0xff000000) != param_2)) {

    param_2 = param_2 & 0xff000000;

  }

  if ((param_5 & 0xff0000) != param_5) {

    param_5 = param_5 & 0xff0000;

  }

  return CONCAT44(param_3 | param_2 | param_5,param_4);

}





// --- FUN_005ab480 at 0x005AB480 (size: 33) ---


void FUN_005ab480(void)



{

  return;

}





// --- FUN_005ab4b0 at 0x005AB4B0 (size: 66) ---


bool FUN_005ab4b0(undefined4 param_1,ushort param_2,undefined4 param_3,ushort param_4)



{

  ushort uVar1;

  int iVar2;

  

  if (param_2 == param_4) {

    return false;

  }

  uVar1 = param_2 - param_4;

  iVar2 = 1;

  if (param_2 < param_4) {

    uVar1 = param_4 - param_2;

    iVar2 = -1;

  }

  if (0x7fff < uVar1) {

    iVar2 = -iVar2;

  }

  return 0 < iVar2;

}





// --- FUN_005ab500 at 0x005AB500 (size: 121) ---


undefined4 FUN_005ab500(char *param_1,ulong *param_2)



{

  short sVar1;

  ulong uVar2;

  hostent *phVar3;

  uint uVar4;

  ulong *puVar5;

  

  FUN_005ab7c0();

  uVar2 = inet_addr(param_1);

  if (uVar2 != 0xffffffff) {

    *param_2 = uVar2;

    FUN_005ab800();

    return 1;

  }

  phVar3 = gethostbyname(param_1);

  if (phVar3 != (hostent *)0x0) {

    sVar1 = phVar3->h_length;

    puVar5 = (ulong *)*phVar3->h_addr_list;

    for (uVar4 = (uint)(int)sVar1 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

      *param_2 = *puVar5;

      puVar5 = puVar5 + 1;

      param_2 = param_2 + 1;

    }

    for (uVar4 = (int)sVar1 & 3; uVar4 != 0; uVar4 = uVar4 - 1) {

      *(char *)param_2 = (char)*puVar5;

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

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

    }

    FUN_005ab800();

    return 1;

  }

  WSAGetLastError();

  FUN_005ab800();

  return 0;

}





// --- FUN_005ab580 at 0x005AB580 (size: 106) ---


void FUN_005ab580(int param_1,undefined4 param_2,char param_3)



{

  u_short uVar1;

  char *_Format;

  char local_28 [39];

  undefined1 local_1;

  

  local_1 = 0;

  _Format = "%d.%d.%d.%d:%d";

  if (param_3 == '\0') {

    _Format = "%d.%d.%d.%d - Port:%d";

  }

  uVar1 = ntohs(*(u_short *)(param_1 + 2));

  _snprintf(local_28,0x27,_Format,(uint)*(byte *)(param_1 + 4),(uint)*(byte *)(param_1 + 5),

            (uint)*(byte *)(param_1 + 6),(uint)*(byte *)(param_1 + 7),(uint)uVar1);

  FUN_004034c0(local_28);

  return;

}





// --- FUN_005ab5f0 at 0x005AB5F0 (size: 174) ---


void __fastcall FUN_005ab5f0(undefined4 *param_1)



{

  param_1[1] = 1;

  param_1[2] = 0;

  param_1[0x23] = 0;

  param_1[0x41] = 0;

  *(undefined2 *)(param_1 + 0x42) = 0;

  param_1[0x43] = 0;

  param_1[0x44] = 0;

  param_1[0x45] = 0;

  param_1[0x46] = 0;

  param_1[0x47] = 0;

  param_1[0x48] = 0;

  *param_1 = &PTR_FUN_007cae40;

  param_1[0x49] = 0;

  param_1[0x4a] = 0;

  param_1[0x4b] = 0;

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

  *(undefined2 *)((int)param_1 + 0x132) = 0;

  *(undefined2 *)(param_1 + 0x4d) = 0;

  *(undefined2 *)((int)param_1 + 0x136) = 0;

  param_1[0x4046] = 0;

  param_1[0x4047] = 0xffcc;

  param_1[0x4045] = param_1 + 0x4e;

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

  param_1[0x4049] = 0;

  param_1[0x404a] = 0;

  param_1[0x404b] = 0;

  return;

}





// --- FUN_005ab6a0 at 0x005AB6A0 (size: 27) ---


undefined4 FUN_005ab6a0(void)



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = FUN_005df0f5(0x10130);

  if (iVar1 != 0) {

    uVar2 = FUN_005ab5f0();

    return uVar2;

  }

  return 0;

}





// --- FUN_005ab6c0 at 0x005AB6C0 (size: 221) ---


void __fastcall FUN_005ab6c0(int param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  uint uVar3;

  int *piVar4;

  

  uVar3 = 0;

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

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

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

    do {

      puVar1 = (undefined4 *)*piVar4;

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

        LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

        }

        *piVar4 = 0;

      }

      uVar3 = uVar3 + 1;

      piVar4 = piVar4 + 1;

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

  }

  uVar3 = 0;

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

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

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

    do {

      puVar1 = (undefined4 *)*piVar4;

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

        LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

        }

        *piVar4 = 0;

      }

      uVar3 = uVar3 + 1;

      piVar4 = piVar4 + 1;

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

  }

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

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

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

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

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

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

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

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

  return;

}





// --- FUN_005ab7a0 at 0x005AB7A0 (size: 30) ---


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



{

  FUN_0040e420();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005ab7c0 at 0x005AB7C0 (size: 51) ---


undefined4 __fastcall FUN_005ab7c0(undefined4 param_1)



{

  WSADATA local_190;

  

  DAT_008eefc8 = DAT_008eefc8 + 1;

  if (DAT_008eefc8 == 1) {

    WSAStartup(0x101,&local_190);

  }

  return param_1;

}





// --- FUN_005ab800 at 0x005AB800 (size: 15) ---


void FUN_005ab800(void)



{

  DAT_008eefc8 = DAT_008eefc8 + -1;

  if (DAT_008eefc8 == 0) {

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

                    /* WARNING: Treating indirect jump as call */

    WSACleanup();

    return;

  }

  return;

}





// --- FUN_005ab820 at 0x005AB820 (size: 76) ---


void FUN_005ab820(uint param_1,undefined4 param_2)



{

  uint *puVar1;

  int iVar2;

  

  iVar2 = DAT_008ef0dc;

  if (0 < DAT_008ef0dc) {

    puVar1 = (uint *)(&DAT_008eefd0 + DAT_008ef0dc * 8);

    do {

      if (*puVar1 <= param_1) break;

      puVar1[2] = *puVar1;

      puVar1[3] = puVar1[1];

      iVar2 = iVar2 + -1;

      puVar1 = puVar1 + -2;

    } while (0 < iVar2);

  }

  (&DAT_008eefdc)[iVar2 * 2] = param_2;

  (&DAT_008eefd8)[iVar2 * 2] = param_1;

  DAT_008ef0dc = DAT_008ef0dc + 1;

  return;

}





// --- FUN_005ab870 at 0x005AB870 (size: 72) ---


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



{

  uint uVar1;

  int iVar2;

  undefined4 *puVar3;

  

  if (param_1[1] + param_3 * 4 <= (uint)param_1[2]) {

    puVar3 = (undefined4 *)(*param_1 + param_1[1]);

    for (uVar1 = param_3 & 0x3fffffff; uVar1 != 0; uVar1 = uVar1 - 1) {

      *param_2 = *puVar3;

      puVar3 = puVar3 + 1;

      param_2 = param_2 + 1;

    }

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

      *(undefined1 *)param_2 = *(undefined1 *)puVar3;

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

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

    }

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

    return 1;

  }

  return 0;

}





// --- FUN_005ab8c0 at 0x005AB8C0 (size: 119) ---


bool FUN_005ab8c0(uint param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 *puVar1;

  LONG LVar2;

  int iVar3;

  

  for (iVar3 = 0; (param_1 != 0 && (iVar3 < DAT_008ef0dc)); iVar3 = iVar3 + 1) {

    if ((param_1 & (&DAT_008eefd8)[iVar3 * 2]) != 0) {

      param_1 = param_1 & ~(&DAT_008eefd8)[iVar3 * 2];

      puVar1 = (undefined4 *)(*(code *)(&DAT_008eefdc)[iVar3 * 2])(param_3);

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

        return false;

      }

      FUN_00549fc0(puVar1);

      LVar2 = InterlockedDecrement(puVar1 + 1);

      if (LVar2 == 0) {

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

      }

    }

  }

  return (param_1 & 0xffffff00) == 0;

}





// --- FUN_005ab940 at 0x005AB940 (size: 138) ---


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



{

  int *piVar1;

  int *piVar2;

  int *piVar3;

  int iVar4;

  int *piVar5;

  int iVar6;

  undefined4 uVar7;

  int unaff_EBX;

  

  piVar5 = param_2;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[1] = 1;

  param_1[2] = 0x100000;

  param_1[3] = 7;

  *param_1 = &PTR_FUN_007cae44;

  piVar1 = param_1 + 8;

  *piVar1 = (int)&PTR_FUN_00795878;

  piVar2 = param_2 + 1;

  iVar4 = *param_2 + *piVar2;

  piVar3 = param_2 + 2;

  param_2 = (int *)iVar4;

  iVar6 = (**(code **)(*piVar1 + 0x10))(&param_2,*piVar3 - *piVar2);

  if (iVar6 != 0) {

    piVar5[1] = unaff_EBX - *piVar5;

  }

  *(bool *)(param_1 + 0xb) = iVar6 != 0;

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

  param_1[5] = uVar7;

  param_1[4] = iVar4;

  return param_1;

}





// --- FUN_005ab9d0 at 0x005AB9D0 (size: 72) ---


void __thiscall

FUN_005ab9d0(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

            undefined4 param_5)



{

  param_1[6] = param_2;

  param_1[7] = param_3;

  param_1[8] = param_4;

  param_1[1] = 1;

  param_1[2] = 0x200;

  param_1[3] = 7;

  param_1[4] = param_1 + 6;

  param_1[5] = 0x10;

  *param_1 = &PTR_FUN_007e70f0;

  param_1[9] = param_5;

  return;

}





// --- FUN_005aba20 at 0x005ABA20 (size: 138) ---


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



{

  int *piVar1;

  int *piVar2;

  int *piVar3;

  int iVar4;

  int *piVar5;

  int iVar6;

  undefined4 uVar7;

  int unaff_EBX;

  

  piVar5 = param_2;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[1] = 1;

  param_1[2] = 0x200000;

  param_1[3] = 2;

  *param_1 = &PTR_FUN_007cb2c0;

  piVar1 = param_1 + 8;

  *piVar1 = (int)&PTR_FUN_00795878;

  piVar2 = param_2 + 1;

  iVar4 = *param_2 + *piVar2;

  piVar3 = param_2 + 2;

  param_2 = (int *)iVar4;

  iVar6 = (**(code **)(*piVar1 + 0x10))(&param_2,*piVar3 - *piVar2);

  if (iVar6 != 0) {

    piVar5[1] = unaff_EBX - *piVar5;

  }

  *(bool *)(param_1 + 0xb) = iVar6 != 0;

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

  param_1[5] = uVar7;

  param_1[4] = iVar4;

  return param_1;

}





// --- FUN_005abb30 at 0x005ABB30 (size: 31) ---


void __fastcall FUN_005abb30(int *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)*param_1;

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  return;

}





// --- FUN_005ac2d0 at 0x005AC2D0 (size: 70) ---


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



{

  LONG *lpAddend;

  

  param_1[4] = param_1 + 8;

  param_1[1] = 1;

  param_1[2] = 0x10000;

  param_1[3] = 7;

  param_1[5] = param_2;

  *param_1 = &PTR_FUN_007e70f8;

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

  param_1[6] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  return param_1;

}





// --- FUN_005ac320 at 0x005AC320 (size: 71) ---


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



{

  LONG *lpAddend;

  

  param_1[4] = param_2;

  param_1[1] = 1;

  param_1[2] = 0x10000;

  param_1[3] = 7;

  param_1[5] = param_3;

  *param_1 = &PTR_FUN_007e70f8;

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

  param_1[6] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  return param_1;

}





// --- FUN_005ac370 at 0x005AC370 (size: 39) ---


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



{

  FUN_005abb30();

  *param_1 = &PTR_FUN_007952f4;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005ac3a0 at 0x005AC3A0 (size: 198) ---


int FUN_005ac3a0(int *param_1,int *param_2)



{

  int *piVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  uint uVar7;

  

  piVar1 = param_2;

  iVar2 = (**(code **)(*param_2 + 4))();

  uVar3 = *(int *)(*param_1 + 8) - 1;

  iVar6 = 0;

  if (0xfffe < uVar3) {

    iVar6 = 4;

  }

  uVar3 = iVar6 + 2 + uVar3;

  uVar7 = uVar3 & 3;

  if (uVar7 == 0) {

    iVar6 = 0;

  }

  else {

    iVar6 = 4 - uVar7;

  }

  iVar6 = iVar6 + uVar3 + 4 + iVar2;

  iVar4 = FUN_005df0f5(0x10000);

  if (iVar4 == 0) {

    iVar4 = 0;

  }

  else {

    iVar4 = FUN_005ac2d0(iVar6);

  }

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

  iVar5 = FUN_004fd290(&param_2,iVar6);

  param_1 = (int *)(iVar6 - iVar5);

  if (3 < param_1) {

    *param_2 = iVar2;

    param_2 = param_2 + 1;

    param_1 = (int *)((int)param_1 - 4);

  }

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

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

    return iVar4;

  }

  (**(code **)(*piVar1 + 0x14))(1,&param_2,&param_1);

  return iVar4;

}





// --- FUN_005ac5f0 at 0x005AC5F0 (size: 148) ---


int __fastcall FUN_005ac5f0(int param_1)



{

  char **ppcVar1;

  int *piVar2;

  hostent *phVar3;

  undefined4 uVar4;

  int iVar5;

  char local_100 [256];

  

  FUN_005ab7c0();

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

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

  gethostname(local_100,0x100);

  phVar3 = gethostbyname(local_100);

  ppcVar1 = phVar3->h_addr_list;

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

  piVar2 = (int *)*ppcVar1;

  while ((piVar2 != (int *)0x0 && (*piVar2 != 0))) {

    iVar5 = *(int *)(param_1 + 4) + 1;

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

    piVar2 = (int *)ppcVar1[iVar5];

  }

  uVar4 = thunk_FUN_005df0f5(*(int *)(param_1 + 4) << 2);

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

  iVar5 = 0;

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

    do {

      *(undefined4 *)(*(int *)(param_1 + 8) + iVar5 * 4) = *(undefined4 *)ppcVar1[iVar5];

      iVar5 = iVar5 + 1;

    } while (iVar5 < *(int *)(param_1 + 4));

  }

  return param_1;

}





// --- FUN_005ac690 at 0x005AC690 (size: 23) ---


void __fastcall FUN_005ac690(int param_1)



{

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

  FUN_005ab800();

  return;

}





// --- FUN_005ac6b0 at 0x005AC6B0 (size: 32) ---


int __thiscall FUN_005ac6b0(int param_1,int param_2)



{

  int iVar1;

  

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

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

    if (param_2 != 0) {

      do {

        param_2 = param_2 + -1;

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

      } while (param_2 != 0);

      return iVar1;

    }

  }

  else {

    iVar1 = 0;

  }

  return iVar1;

}





// --- FUN_005ac6d0 at 0x005AC6D0 (size: 32) ---


int __thiscall FUN_005ac6d0(int param_1,int param_2)



{

  int iVar1;

  

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

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

    if (param_2 != 0) {

      do {

        param_2 = param_2 + -1;

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

      } while (param_2 != 0);

      return iVar1;

    }

  }

  else {

    iVar1 = 0;

  }

  return iVar1;

}





// --- FUN_005ac6f0 at 0x005AC6F0 (size: 98) ---


void __fastcall FUN_005ac6f0(int param_1)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  int iVar3;

  

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

  while (puVar2 = puVar1, puVar2 != (undefined4 *)0x0) {

    puVar1 = (undefined4 *)puVar2[5];

    iVar3 = FUN_005ae8e0(puVar2);

    if (iVar3 != 0) {

      if (puVar2[5] == 0) {

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

      }

      else {

        *(undefined4 *)(puVar2[5] + 0x10) = puVar2[4];

      }

      if (puVar2[4] == 0) {

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

      }

      else {

        *(undefined4 *)(puVar2[4] + 0x14) = puVar2[5];

      }

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

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

    }

  }

  return;

}





// --- FUN_005ac760 at 0x005AC760 (size: 104) ---


void __fastcall FUN_005ac760(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

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

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

    while (iVar1 = FUN_005aea30(puVar2), iVar1 == 0) {

      puVar2 = (undefined4 *)puVar2[5];

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

        return;

      }

    }

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

      if (puVar2[5] == 0) {

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

      }

      else {

        *(undefined4 *)(puVar2[5] + 0x10) = puVar2[4];

      }

      if (puVar2[4] == 0) {

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

      }

      else {

        *(undefined4 *)(puVar2[4] + 0x14) = puVar2[5];

      }

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

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

    }

  }

  return;

}





// --- FUN_005ac7d0 at 0x005AC7D0 (size: 104) ---


void __fastcall FUN_005ac7d0(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

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

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

    while (iVar1 = FUN_006b0d80(puVar2), iVar1 == 0) {

      puVar2 = (undefined4 *)puVar2[4];

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

        return;

      }

    }

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

      if (puVar2[4] == 0) {

        *(undefined4 *)(param_1 + 0x24) = puVar2[3];

      }

      else {

        *(undefined4 *)(puVar2[4] + 0xc) = puVar2[3];

      }

      if (puVar2[3] == 0) {

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

      }

      else {

        *(undefined4 *)(puVar2[3] + 0x10) = puVar2[4];

      }

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

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

    }

  }

  return;

}





// --- FUN_005ac840 at 0x005AC840 (size: 134) ---


void __fastcall FUN_005ac840(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

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

  while (iVar1 != 0) {

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

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

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

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

    }

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

  }

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

  while (iVar1 != 0) {

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

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

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

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

    }

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

  }

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

  while (iVar1 != 0) {

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

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

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

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

    }

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

  }

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

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

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

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

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

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

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

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

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

  return;

}





// --- FUN_005ac8d0 at 0x005AC8D0 (size: 227) ---


void __fastcall FUN_005ac8d0(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

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

  while (iVar1 != 0) {

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

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

      if (puVar2[5] == 0) {

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

      }

      else {

        *(undefined4 *)(puVar2[5] + 0x10) = puVar2[4];

      }

      if (puVar2[4] == 0) {

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

      }

      else {

        *(undefined4 *)(puVar2[4] + 0x14) = puVar2[5];

      }

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

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

    }

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

  }

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

  while (iVar1 != 0) {

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

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

      if (puVar2[5] == 0) {

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

      }

      else {

        *(undefined4 *)(puVar2[5] + 0x10) = puVar2[4];

      }

      if (puVar2[4] == 0) {

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

      }

      else {

        *(undefined4 *)(puVar2[4] + 0x14) = puVar2[5];

      }

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

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

    }

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

  }

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

  while (iVar1 != 0) {

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

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

      if (puVar2[4] == 0) {

        *(undefined4 *)(param_1 + 0x24) = puVar2[3];

      }

      else {

        *(undefined4 *)(puVar2[4] + 0xc) = puVar2[3];

      }

      if (puVar2[3] == 0) {

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

      }

      else {

        *(undefined4 *)(puVar2[3] + 0x10) = puVar2[4];

      }

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

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

    }

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

  }

  return;

}





// --- FUN_005ac9c0 at 0x005AC9C0 (size: 55) ---


undefined4 * __fastcall FUN_005ac9c0(undefined4 *param_1)



{

  FUN_005aebe0();

  *param_1 = &PTR_FUN_007e7100;

  param_1[1] = DAT_008ef100;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  return param_1;

}





// --- FUN_005aca00 at 0x005ACA00 (size: 22) ---


void __fastcall FUN_005aca00(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7100;

  FUN_005ac840();

  FUN_005aebf0();

  return;

}





// --- FUN_005aca20 at 0x005ACA20 (size: 156) ---


undefined4 __thiscall FUN_005aca20(int param_1,undefined4 *param_2)



{

  int iVar1;

  int iVar2;

  

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

    return 0;

  }

  for (iVar1 = *(int *)(param_1 + 8); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x14)) {

    iVar2 = FUN_005ae920(param_2);

    if (iVar2 != 0) {

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

      return 1;

    }

  }

  FUN_005ac6f0(param_2);

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

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

    return 0;

  }

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

    param_2[4] = 0;

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

  }

  else {

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

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

  }

  param_2[5] = 0;

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

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

  return 1;

}





// --- FUN_005acac0 at 0x005ACAC0 (size: 97) ---


undefined4 __thiscall FUN_005acac0(int param_1,undefined4 *param_2)



{

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

    FUN_005ac760(param_2);

    if (*(int *)(param_1 + 0x1c) != 0xff) {

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

        param_2[4] = 0;

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

      }

      else {

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

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

      }

      param_2[5] = 0;

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

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

      return 1;

    }

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

  }

  return 0;

}





// --- FUN_005acb30 at 0x005ACB30 (size: 97) ---


undefined4 __thiscall FUN_005acb30(int param_1,undefined4 *param_2)



{

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

    FUN_005ac7d0(param_2);

    if (*(int *)(param_1 + 0x28) != 0xff) {

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

        param_2[3] = 0;

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

      }

      else {

        param_2[3] = *(int *)(param_1 + 0x24);

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

      }

      param_2[4] = 0;

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

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

      return 1;

    }

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

  }

  return 0;

}





// --- FUN_005acda0 at 0x005ACDA0 (size: 611) ---


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



{

  char cVar1;

  byte bVar2;

  char *pcVar3;

  int *piVar4;

  int iVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  uint uVar9;

  int *piVar10;

  

  iVar6 = param_3;

  FUN_005ac8d0();

  pcVar3 = (char *)*param_2;

  cVar1 = *pcVar3;

  *param_2 = (uint)(pcVar3 + 1);

  if (cVar1 != '\x11') {

    return 0;

  }

  bVar2 = pcVar3[1];

  *param_2 = (uint)(pcVar3 + 2);

  uVar9 = (uint)bVar2;

  uVar7 = (uint)(byte)pcVar3[2];

  *param_2 = (uint)(pcVar3 + 3);

  uVar8 = (uint)(byte)pcVar3[3];

  *param_2 = (uint)(pcVar3 + 4);

  if (uVar9 != 0) {

    FUN_006854f0(0x4000000,param_1 + 4,param_2);

    param_3 = 0;

    if (uVar9 != 0) {

      do {

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

        piVar10 = (int *)0x0;

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

          *piVar4 = (int)&PTR_LAB_007c4524;

          iVar5 = DAT_008ef100;

          piVar4[2] = 0;

          piVar4[3] = 0;

          piVar4[4] = 0;

          piVar4[5] = 0;

          piVar4[1] = iVar5;

          piVar10 = piVar4;

        }

        iVar5 = (**(code **)(*piVar10 + 0x10))(param_2,pcVar3 + (iVar6 - *param_2));

        if (iVar5 == 0) {

          return 0;

        }

        FUN_005aca20(piVar10);

        param_3 = param_3 + 1;

      } while (param_3 < uVar9);

    }

  }

  uVar9 = 0;

  if (uVar7 != 0) {

    do {

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

      piVar10 = (int *)0x0;

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

        piVar4[1] = 0;

        *piVar4 = (int)&PTR_FUN_007e6be8;

        piVar4[2] = DAT_008ef100;

        iVar5 = DAT_008ef100;

        piVar4[4] = 0;

        piVar4[5] = 0;

        piVar4[3] = iVar5;

        piVar10 = piVar4;

      }

      iVar5 = (**(code **)(*piVar10 + 0x10))(param_2,pcVar3 + (iVar6 - *param_2));

      if (iVar5 == 0) {

        return 0;

      }

      FUN_005ac760(piVar10);

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

        (**(code **)*piVar10)(1);

      }

      else {

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

          piVar10[4] = 0;

          *(int **)(param_1 + 0x14) = piVar10;

        }

        else {

          piVar10[4] = *(int *)(param_1 + 0x18);

          *(int **)(*(int *)(param_1 + 0x18) + 0x14) = piVar10;

        }

        piVar10[5] = 0;

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

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

      }

      uVar9 = uVar9 + 1;

    } while (uVar9 < uVar7);

  }

  uVar7 = 0;

  if (uVar8 != 0) {

    do {

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

      piVar10 = (int *)0x0;

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

        piVar4[1] = 0;

        *piVar4 = (int)&PTR_FUN_007c95e4;

        iVar5 = DAT_008ef100;

        piVar4[3] = 0;

        piVar4[4] = 0;

        piVar4[2] = iVar5;

        piVar10 = piVar4;

      }

      iVar5 = (**(code **)(*piVar10 + 0x10))(param_2,pcVar3 + (iVar6 - *param_2));

      if (iVar5 == 0) {

        return 0;

      }

      FUN_005ac7d0(piVar10);

      if (*(int *)(param_1 + 0x28) == 0xff) {

        (**(code **)*piVar10)(1);

      }

      else {

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

          piVar10[3] = 0;

          *(int **)(param_1 + 0x20) = piVar10;

        }

        else {

          piVar10[3] = *(int *)(param_1 + 0x24);

          *(int **)(*(int *)(param_1 + 0x24) + 0x10) = piVar10;

        }

        piVar10[4] = 0;

        *(int **)(param_1 + 0x24) = piVar10;

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

      }

      uVar7 = uVar7 + 1;

    } while (uVar7 < uVar8);

  }

  uVar7 = *param_2 & 0x80000003;

  if ((int)uVar7 < 0) {

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

  }

  if (uVar7 != 0) {

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

      *(undefined1 *)*param_2 = 0;

      *param_2 = *param_2 + 1;

    }

  }

  return 1;

}





// --- FUN_005ad010 at 0x005AD010 (size: 43) ---


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



{

  *param_1 = &PTR_FUN_007e7100;

  FUN_005ac840();

  FUN_005aebf0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005ad040 at 0x005AD040 (size: 83) ---


void FUN_005ad040(int param_1)



{

  undefined4 *puVar1;

  

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

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

    *puVar1 = &PTR_LAB_007c4524;

    puVar1[1] = *(undefined4 *)(param_1 + 4);

    puVar1[2] = *(undefined4 *)(param_1 + 8);

    puVar1[3] = *(undefined4 *)(param_1 + 0xc);

    puVar1[4] = *(undefined4 *)(param_1 + 0x10);

    puVar1[5] = *(undefined4 *)(param_1 + 0x14);

    FUN_005aca20(puVar1);

    return;

  }

  FUN_005aca20(0);

  return;

}





// --- FUN_005ad0a0 at 0x005AD0A0 (size: 83) ---


void FUN_005ad0a0(int param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0x18);

  if (puVar1 != (undefined4 *)0x0) {

    *puVar1 = &PTR_FUN_007e6be8;

    puVar1[1] = *(undefined4 *)(param_1 + 4);

    puVar1[2] = *(undefined4 *)(param_1 + 8);

    puVar1[3] = *(undefined4 *)(param_1 + 0xc);

    puVar1[4] = *(undefined4 *)(param_1 + 0x10);

    puVar1[5] = *(undefined4 *)(param_1 + 0x14);

    FUN_005acac0(puVar1);

    return;

  }

  FUN_005acac0(0);

  return;

}





// --- FUN_005ad100 at 0x005AD100 (size: 77) ---


void FUN_005ad100(int param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0x14);

  if (puVar1 != (undefined4 *)0x0) {

    *puVar1 = &PTR_FUN_007c95e4;

    puVar1[1] = *(undefined4 *)(param_1 + 4);

    puVar1[2] = *(undefined4 *)(param_1 + 8);

    puVar1[3] = *(undefined4 *)(param_1 + 0xc);

    puVar1[4] = *(undefined4 *)(param_1 + 0x10);

    FUN_005acb30(puVar1);

    return;

  }

  FUN_005acb30(0);

  return;

}





// --- FUN_005ad150 at 0x005AD150 (size: 424) ---


int __thiscall FUN_005ad150(int param_1,uint param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 *puVar3;

  uint uVar4;

  int iVar5;

  

  iVar2 = param_2;

  iVar5 = *(int *)(param_2 + 8);

  uVar4 = 0;

  if (*(int *)(param_2 + 0x10) != 0) {

    do {

      puVar3 = (undefined4 *)FUN_005df0f5(0x18);

      if (puVar3 == (undefined4 *)0x0) {

        puVar3 = (undefined4 *)0x0;

      }

      else {

        *puVar3 = &PTR_LAB_007c4524;

        puVar3[1] = *(undefined4 *)(iVar5 + 4);

        puVar3[2] = *(undefined4 *)(iVar5 + 8);

        puVar3[3] = *(undefined4 *)(iVar5 + 0xc);

        puVar3[4] = *(undefined4 *)(iVar5 + 0x10);

        puVar3[5] = *(undefined4 *)(iVar5 + 0x14);

      }

      FUN_005aca20(puVar3);

      iVar5 = *(int *)(iVar5 + 0x14);

      uVar4 = uVar4 + 1;

    } while (uVar4 < *(uint *)(param_2 + 0x10));

  }

  piVar1 = (int *)(param_2 + 0x1c);

  iVar5 = *(int *)(param_2 + 0x14);

  param_2 = 0;

  if (*piVar1 != 0) {

    do {

      puVar3 = (undefined4 *)FUN_005df0f5(0x18);

      if (puVar3 != (undefined4 *)0x0) {

        *puVar3 = &PTR_FUN_007e6be8;

        puVar3[1] = *(undefined4 *)(iVar5 + 4);

        puVar3[2] = *(undefined4 *)(iVar5 + 8);

        puVar3[3] = *(undefined4 *)(iVar5 + 0xc);

        puVar3[4] = *(undefined4 *)(iVar5 + 0x10);

        puVar3[5] = *(undefined4 *)(iVar5 + 0x14);

        FUN_005ac760(puVar3);

        if (*(int *)(param_1 + 0x1c) == 0xff) {

          (**(code **)*puVar3)(1);

        }

        else {

          if (*(int *)(param_1 + 0x18) == 0) {

            puVar3[4] = 0;

            *(undefined4 **)(param_1 + 0x14) = puVar3;

          }

          else {

            puVar3[4] = *(int *)(param_1 + 0x18);

            *(undefined4 **)(*(int *)(param_1 + 0x18) + 0x14) = puVar3;

          }

          puVar3[5] = 0;

          *(undefined4 **)(param_1 + 0x18) = puVar3;

          *(int *)(param_1 + 0x1c) = *(int *)(param_1 + 0x1c) + 1;

        }

      }

      iVar5 = *(int *)(iVar5 + 0x14);

      param_2 = param_2 + 1;

    } while (param_2 < *(uint *)(iVar2 + 0x1c));

  }

  iVar5 = *(int *)(iVar2 + 0x20);

  param_2 = 0;

  if (*(int *)(iVar2 + 0x28) != 0) {

    do {

      puVar3 = (undefined4 *)FUN_005df0f5(0x14);

      if (puVar3 != (undefined4 *)0x0) {

        *puVar3 = &PTR_FUN_007c95e4;

        puVar3[1] = *(undefined4 *)(iVar5 + 4);

        puVar3[2] = *(undefined4 *)(iVar5 + 8);

        puVar3[3] = *(undefined4 *)(iVar5 + 0xc);

        puVar3[4] = *(undefined4 *)(iVar5 + 0x10);

        FUN_005ac7d0(puVar3);

        if (*(int *)(param_1 + 0x28) == 0xff) {

          (**(code **)*puVar3)(1);

        }

        else {

          if (*(int *)(param_1 + 0x24) == 0) {

            puVar3[3] = 0;

            *(undefined4 **)(param_1 + 0x20) = puVar3;

          }

          else {

            puVar3[3] = *(int *)(param_1 + 0x24);

            *(undefined4 **)(*(int *)(param_1 + 0x24) + 0x10) = puVar3;

          }

          puVar3[4] = 0;

          *(undefined4 **)(param_1 + 0x24) = puVar3;

          *(int *)(param_1 + 0x28) = *(int *)(param_1 + 0x28) + 1;

        }

      }

      iVar5 = *(int *)(iVar5 + 0x10);

      param_2 = param_2 + 1;

    } while (param_2 < *(uint *)(iVar2 + 0x28));

  }

  return param_1;

}





// --- FUN_005ad300 at 0x005AD300 (size: 435) ---


int __thiscall FUN_005ad300(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 *puVar3;

  int iVar4;

  int iVar5;

  

  iVar2 = param_2;

  FUN_005ac840();

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

  iVar5 = *(int *)(param_2 + 8);

  iVar4 = 0;

  if (0 < *(int *)(param_2 + 0x10)) {

    do {

      puVar3 = (undefined4 *)FUN_005df0f5(0x18);

      if (puVar3 == (undefined4 *)0x0) {

        puVar3 = (undefined4 *)0x0;

      }

      else {

        *puVar3 = &PTR_LAB_007c4524;

        puVar3[1] = *(undefined4 *)(iVar5 + 4);

        puVar3[2] = *(undefined4 *)(iVar5 + 8);

        puVar3[3] = *(undefined4 *)(iVar5 + 0xc);

        puVar3[4] = *(undefined4 *)(iVar5 + 0x10);

        puVar3[5] = *(undefined4 *)(iVar5 + 0x14);

      }

      FUN_005aca20(puVar3);

      iVar5 = *(int *)(iVar5 + 0x14);

      iVar4 = iVar4 + 1;

    } while (iVar4 < *(int *)(param_2 + 0x10));

  }

  piVar1 = (int *)(param_2 + 0x1c);

  iVar5 = *(int *)(param_2 + 0x14);

  param_2 = 0;

  if (0 < *piVar1) {

    do {

      puVar3 = (undefined4 *)FUN_005df0f5(0x18);

      if (puVar3 != (undefined4 *)0x0) {

        *puVar3 = &PTR_FUN_007e6be8;

        puVar3[1] = *(undefined4 *)(iVar5 + 4);

        puVar3[2] = *(undefined4 *)(iVar5 + 8);

        puVar3[3] = *(undefined4 *)(iVar5 + 0xc);

        puVar3[4] = *(undefined4 *)(iVar5 + 0x10);

        puVar3[5] = *(undefined4 *)(iVar5 + 0x14);

        FUN_005ac760(puVar3);

        if (*(int *)(param_1 + 0x1c) == 0xff) {

          (**(code **)*puVar3)(1);

        }

        else {

          if (*(int *)(param_1 + 0x18) == 0) {

            puVar3[4] = 0;

            *(undefined4 **)(param_1 + 0x14) = puVar3;

          }

          else {

            puVar3[4] = *(int *)(param_1 + 0x18);

            *(undefined4 **)(*(int *)(param_1 + 0x18) + 0x14) = puVar3;

          }

          puVar3[5] = 0;

          *(undefined4 **)(param_1 + 0x18) = puVar3;

          *(int *)(param_1 + 0x1c) = *(int *)(param_1 + 0x1c) + 1;

        }

      }

      iVar5 = *(int *)(iVar5 + 0x14);

      param_2 = param_2 + 1;

    } while (param_2 < *(int *)(iVar2 + 0x1c));

  }

  iVar5 = *(int *)(iVar2 + 0x20);

  param_2 = 0;

  if (0 < *(int *)(iVar2 + 0x28)) {

    do {

      puVar3 = (undefined4 *)FUN_005df0f5(0x14);

      if (puVar3 != (undefined4 *)0x0) {

        *puVar3 = &PTR_FUN_007c95e4;

        puVar3[1] = *(undefined4 *)(iVar5 + 4);

        puVar3[2] = *(undefined4 *)(iVar5 + 8);

        puVar3[3] = *(undefined4 *)(iVar5 + 0xc);

        puVar3[4] = *(undefined4 *)(iVar5 + 0x10);

        FUN_005ac7d0(puVar3);

        if (*(int *)(param_1 + 0x28) == 0xff) {

          (**(code **)*puVar3)(1);

        }

        else {

          if (*(int *)(param_1 + 0x24) == 0) {

            puVar3[3] = 0;

            *(undefined4 **)(param_1 + 0x20) = puVar3;

          }

          else {

            puVar3[3] = *(int *)(param_1 + 0x24);

            *(undefined4 **)(*(int *)(param_1 + 0x24) + 0x10) = puVar3;

          }

          puVar3[4] = 0;

          *(undefined4 **)(param_1 + 0x24) = puVar3;

          *(int *)(param_1 + 0x28) = *(int *)(param_1 + 0x28) + 1;

        }

      }

      iVar5 = *(int *)(iVar5 + 0x10);

      param_2 = param_2 + 1;

    } while (param_2 < *(int *)(iVar2 + 0x28));

  }

  return param_1;

}





// --- FUN_005ad4c0 at 0x005AD4C0 (size: 193) ---


void __fastcall FUN_005ad4c0(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  

  uVar3 = 0;

  uVar2 = FUN_004220b0(*(undefined4 *)(param_1 + 4),0);

  FUN_0041a4e0(uVar2,uVar3);

  for (iVar1 = *(int *)(param_1 + 8); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x14)) {

    uVar3 = 8;

    uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + 4),0);

    FUN_0041a4e0(uVar2,uVar3);

  }

  for (iVar1 = *(int *)(param_1 + 0x14); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x14)) {

    uVar3 = 8;

    uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + 8),0);

    FUN_0041a4e0(uVar2,uVar3);

    uVar3 = 8;

    uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + 0xc),0);

    FUN_0041a4e0(uVar2,uVar3);

  }

  for (iVar1 = *(int *)(param_1 + 0x20); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x10)) {

    uVar3 = 8;

    uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + 8),0);

    FUN_0041a4e0(uVar2,uVar3);

  }

  return;

}





// --- FUN_005ad590 at 0x005AD590 (size: 67) ---


undefined4 * __thiscall FUN_005ad590(undefined4 *param_1,int param_2)



{

  FUN_005aebe0();

  *param_1 = &PTR_FUN_007e7100;

  param_1[1] = *(undefined4 *)(param_2 + 4);

  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;

  FUN_005ad150(param_2);

  return param_1;

}





// --- FUN_005ad5e0 at 0x005AD5E0 (size: 47) ---


undefined4 * __thiscall FUN_005ad5e0(undefined4 *param_1,undefined4 param_2)



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  *param_1 = &PTR_LAB_007e7130;

  param_1[0xc] = &PTR_LAB_007e7118;

  return param_1;

}





// --- FUN_005ad620 at 0x005AD620 (size: 114) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_005ad620(int param_1,undefined4 *param_2,double param_3)



{

  int iVar1;

  int iVar2;

  

  if ((((*(int *)(param_1 + 0x38) != 0) && (iVar1 = *(int *)(param_1 + 0x3c), iVar1 != 0)) &&

      (param_3 < _DAT_007938c0 != (param_3 == _DAT_007938c0))) && (_DAT_00795610 <= param_3)) {

    iVar2 = FUN_005df4c4();

    *param_2 = *(undefined4 *)(iVar1 + iVar2 * 4);

    return;

  }

  *param_2 = DAT_008ef108;

  return;

}





// --- FUN_005ad6a0 at 0x005AD6A0 (size: 47) ---


void __thiscall FUN_005ad6a0(int param_1,undefined4 *param_2,int param_3)



{

  if (((-1 < param_3) && (param_3 < *(int *)(param_1 + 0x38))) && (*(int *)(param_1 + 0x3c) != 0)) {

    *param_2 = *(undefined4 *)(*(int *)(param_1 + 0x3c) + param_3 * 4);

    return;

  }

  *param_2 = DAT_008ef108;

  return;

}





// --- FUN_005ad730 at 0x005AD730 (size: 222) ---


undefined4 __thiscall FUN_005ad730(int param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 uVar3;

  int *piVar4;

  int *piVar5;

  uint uVar6;

  

  puVar1 = (undefined4 *)*param_2;

  if (param_3 < 4) {

    return 0;

  }

  *(undefined4 *)(param_1 + 8) = *puVar1;

  *param_2 = *param_2 + 4;

  if (param_3 < *(int *)(param_1 + 8) * 4 + 4U) {

    *param_2 = (int)puVar1;

    return 0;

  }

  if (*(int *)(param_1 + 0xc) != 0) {

    operator_delete__((void *)(*(int *)(param_1 + 0xc) + -4));

  }

  iVar2 = *(int *)(param_1 + 8);

  *(undefined4 *)(param_1 + 0xc) = 0;

  if (iVar2 != 0) {

    piVar4 = (int *)thunk_FUN_005df0f5(iVar2 * 4 + 4);

    if (piVar4 == (int *)0x0) {

      piVar5 = (int *)0x0;

    }

    else {

      piVar5 = piVar4 + 1;

      *piVar4 = iVar2;

      FUN_00401000(piVar5,4,iVar2,FUN_0050a140);

    }

    *(int **)(param_1 + 0xc) = piVar5;

    uVar6 = 0;

    if (*(int *)(param_1 + 8) != 0) {

      do {

        uVar3 = *(undefined4 *)*param_2;

        iVar2 = *(int *)(param_1 + 0xc);

        *param_2 = (int)((undefined4 *)*param_2 + 1);

        *(undefined4 *)(iVar2 + uVar6 * 4) = uVar3;

        uVar6 = uVar6 + 1;

      } while (uVar6 < *(uint *)(param_1 + 8));

    }

  }

  if (param_3 < (uint)(*param_2 - (int)puVar1)) {

    *param_2 = (int)puVar1;

    return 0;

  }

  return 1;

}





// --- FUN_005ad810 at 0x005AD810 (size: 78) ---


undefined4 * __thiscall FUN_005ad810(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_LAB_007e7130;

  param_1[0xc] = &PTR_LAB_007e7118;

  if (param_1[0xf] != 0) {

    operator_delete__((void *)(param_1[0xf] + -4));

    param_1[0xf] = 0;

  }

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005ad860 at 0x005AD860 (size: 13) ---


bool FUN_005ad860(int param_1)



{

  return param_1 == 0x10;

}





// --- FUN_005ad870 at 0x005AD870 (size: 86) ---


void __thiscall FUN_005ad870(int param_1,int param_2)



{

  if (param_2 == 4) {

    *(uint *)(param_1 + 0x68) = *(uint *)(param_1 + 0x68) & 0xfddfffff | 0x20;

    return;

  }

  if (param_2 == 0x40) {

    *(uint *)(param_1 + 0x68) = *(uint *)(param_1 + 0x68) & 0xffdfffdf | 0x2000000;

    return;

  }

  if (param_2 == 0x20) {

    *(uint *)(param_1 + 0x68) = *(uint *)(param_1 + 0x68) & 0xfdffffdf | 0x200000;

    return;

  }

  *(uint *)(param_1 + 0x68) = *(uint *)(param_1 + 0x68) & 0xfddfffdf;

  return;

}





// --- FUN_005ad8d0 at 0x005AD8D0 (size: 447) ---


void __thiscall FUN_005ad8d0(int param_1,uint *param_2)



{

  if (*(int *)(*(int *)(param_1 + 8) + 8) != 1) {

    *param_2 = *param_2 | 1;

  }

  if (*(int *)(param_1 + 0x28) != 0) {

    *param_2 = *param_2 | 0x10000;

  }

  if (*(int *)(param_1 + 0x2c) != 0) {

    *param_2 = *param_2 | 0x20000;

  }

  if (*(int *)(param_1 + 0x1c) != 0) {

    *param_2 = *param_2 | 0x4000;

  }

  if (*(int *)(param_1 + 0x20) != 0) {

    *param_2 = *param_2 | 0x8000;

  }

  if (*(int *)(param_1 + 0x30) != 0) {

    *param_2 = *param_2 | 2;

  }

  if (*(int *)(param_1 + 0x34) != 0) {

    *param_2 = *param_2 | 4;

  }

  if (*(int *)(param_1 + 0x3c) != 0) {

    *param_2 = *param_2 | 8;

  }

  if (*(int *)(param_1 + 0x40) != 0) {

    *param_2 = *param_2 | 0x10;

  }

  if (*(float *)(param_1 + 0x44) != DAT_00796344) {

    *param_2 = *param_2 | 0x20;

  }

  if (*(int *)(param_1 + 0x48) != 0) {

    *param_2 = *param_2 | 0x80000;

  }

  if (*(int *)(param_1 + 0x4c) != 0) {

    *param_2 = *param_2 | 0x80;

  }

  if (*(int *)(param_1 + 0x50) != 0) {

    *param_2 = *param_2 | 0x100;

  }

  if (*(int *)(param_1 + 0x54) != 0) {

    *param_2 = *param_2 | 0x200;

  }

  if (*(int *)(param_1 + 0x58) != 0) {

    *param_2 = *param_2 | 0x400;

  }

  if (*(int *)(param_1 + 0x5c) != 0) {

    *param_2 = *param_2 | 0x800;

  }

  if (*(int *)(param_1 + 0x60) != 0) {

    *param_2 = *param_2 | 0x1000;

  }

  if (*(int *)(param_1 + 100) != 0) {

    *param_2 = *param_2 | 0x2000;

  }

  if (*(int *)(param_1 + 0x24) != 0) {

    *param_2 = *param_2 | 0x40000;

  }

  if (*(int *)(param_1 + 0x6c) != 0) {

    *param_2 = *param_2 | 0x100000;

  }

  if (*(int *)(param_1 + 0x70) != 0) {

    *param_2 = *param_2 | 0x800000;

  }

  if (DAT_00796344 < *(float *)(param_1 + 0x98)) {

    *param_2 = *param_2 | 0x1000000;

  }

  if (0 < *(int *)(param_1 + 0x74)) {

    *param_2 = *param_2 | 0x200000;

  }

  if (*(int *)(param_1 + 0x78) != 0) {

    *param_2 = *param_2 | 0x400000;

  }

  if (*(int *)(param_1 + 0x7c) != 0) {

    *param_2 = *param_2 | 0x2000000;

  }

  if (*(int *)(param_1 + 0x84) != 0) {

    *param_2 = *param_2 | 0x8000000;

  }

  if (*(int *)(param_1 + 0x80) != 0) {

    *param_2 = *param_2 | 0x4000000;

  }

  if (*(int *)(param_1 + 0x88) != 0) {

    *param_2 = *param_2 | 0x10000000;

  }

  if (*(int *)(param_1 + 0x8c) != 0) {

    *param_2 = *param_2 | 0x20000000;

  }

  if (*(int *)(param_1 + 0x90) != 0) {

    *param_2 = *param_2 | 0x40;

  }

  if (*(int *)(param_1 + 0x14) != DAT_008ef110) {

    *param_2 = *param_2 | 0x40000000;

  }

  if (*(int *)(param_1 + 0x94) != 0) {

    *param_2 = *param_2 | 0x80000000;

  }

  return;

}





// --- FUN_005ada90 at 0x005ADA90 (size: 103) ---


void __fastcall FUN_005ada90(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  *param_1 = &PTR_FUN_007e7190;

  if ((undefined4 *)param_1[0x20] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[0x20])(1);

    param_1[0x20] = 0;

  }

  puVar1 = (undefined4 *)param_1[2];

  LVar2 = InterlockedDecrement(puVar1 + 1);

  if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

    (**(code **)*puVar1)(1);

  }

  puVar1 = (undefined4 *)param_1[1];

  LVar2 = InterlockedDecrement(puVar1 + 1);

  if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

    (**(code **)*puVar1)(1);

  }

  FUN_005aebf0();

  return;

}





// --- FUN_005adb00 at 0x005ADB00 (size: 30) ---


void * __thiscall FUN_005adb00(void *param_1,byte param_2)



{

  FUN_005ada90();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005adb20 at 0x005ADB20 (size: 498) ---


int __thiscall FUN_005adb20(int param_1,int param_2)



{

  undefined4 *puVar1;

  LONG LVar2;

  int iVar3;

  undefined4 uVar4;

  

  puVar1 = *(undefined4 **)(param_1 + 4);

  if (puVar1 != *(undefined4 **)(param_2 + 4)) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

    if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

    iVar3 = *(int *)(param_2 + 4);

    *(int *)(param_1 + 4) = iVar3;

    InterlockedIncrement((LONG *)(iVar3 + 4));

  }

  puVar1 = *(undefined4 **)(param_1 + 8);

  if (puVar1 != *(undefined4 **)(param_2 + 8)) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

    if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

    iVar3 = *(int *)(param_2 + 8);

    *(int *)(param_1 + 8) = iVar3;

    InterlockedIncrement((LONG *)(iVar3 + 4));

  }

  *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);

  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x10);

  *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(param_2 + 0x14);

  *(undefined4 *)(param_1 + 0x18) = *(undefined4 *)(param_2 + 0x18);

  *(undefined4 *)(param_1 + 0x30) = *(undefined4 *)(param_2 + 0x30);

  *(undefined4 *)(param_1 + 0x34) = *(undefined4 *)(param_2 + 0x34);

  *(undefined4 *)(param_1 + 0x38) = *(undefined4 *)(param_2 + 0x38);

  *(undefined4 *)(param_1 + 0x3c) = *(undefined4 *)(param_2 + 0x3c);

  *(undefined4 *)(param_1 + 0x40) = *(undefined4 *)(param_2 + 0x40);

  *(undefined4 *)(param_1 + 0x44) = *(undefined4 *)(param_2 + 0x44);

  *(undefined4 *)(param_1 + 0x48) = *(undefined4 *)(param_2 + 0x48);

  *(undefined4 *)(param_1 + 0x4c) = *(undefined4 *)(param_2 + 0x4c);

  *(undefined4 *)(param_1 + 0x50) = *(undefined4 *)(param_2 + 0x50);

  *(undefined4 *)(param_1 + 0x54) = *(undefined4 *)(param_2 + 0x54);

  *(undefined4 *)(param_1 + 0x58) = *(undefined4 *)(param_2 + 0x58);

  *(undefined4 *)(param_1 + 0x5c) = *(undefined4 *)(param_2 + 0x5c);

  *(undefined4 *)(param_1 + 0x60) = *(undefined4 *)(param_2 + 0x60);

  *(undefined4 *)(param_1 + 100) = *(undefined4 *)(param_2 + 100);

  *(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)(param_2 + 0x1c);

  *(undefined4 *)(param_1 + 0x20) = *(undefined4 *)(param_2 + 0x20);

  *(undefined4 *)(param_1 + 0x2c) = *(undefined4 *)(param_2 + 0x2c);

  *(undefined4 *)(param_1 + 0x28) = *(undefined4 *)(param_2 + 0x28);

  *(undefined4 *)(param_1 + 0x24) = *(undefined4 *)(param_2 + 0x24);

  *(undefined4 *)(param_1 + 0x68) = *(undefined4 *)(param_2 + 0x68);

  *(undefined4 *)(param_1 + 0x6c) = *(undefined4 *)(param_2 + 0x6c);

  *(undefined4 *)(param_1 + 0x70) = *(undefined4 *)(param_2 + 0x70);

  *(undefined4 *)(param_1 + 0x98) = *(undefined4 *)(param_2 + 0x98);

  *(undefined4 *)(param_1 + 0x74) = *(undefined4 *)(param_2 + 0x74);

  *(undefined4 *)(param_1 + 0x78) = *(undefined4 *)(param_2 + 0x78);

  *(undefined4 *)(param_1 + 0x7c) = *(undefined4 *)(param_2 + 0x7c);

  *(undefined4 *)(param_1 + 0x84) = *(undefined4 *)(param_2 + 0x84);

  if (*(undefined4 **)(param_1 + 0x80) == (undefined4 *)0x0) {

    if (*(int *)(param_2 + 0x80) != 0) {

      iVar3 = FUN_005df0f5(0x84);

      if (iVar3 == 0) {

        uVar4 = 0;

      }

      else {

        uVar4 = FUN_005b0060(*(undefined4 *)(param_2 + 0x80));

      }

      *(undefined4 *)(param_1 + 0x80) = uVar4;

    }

  }

  else if (*(int *)(param_2 + 0x80) == 0) {

    (**(code **)**(undefined4 **)(param_1 + 0x80))(1);

    *(undefined4 *)(param_1 + 0x80) = 0;

  }

  else {

    FUN_005affb0(*(int *)(param_2 + 0x80));

  }

  *(undefined4 *)(param_1 + 0x88) = *(undefined4 *)(param_2 + 0x88);

  *(undefined4 *)(param_1 + 0x8c) = *(undefined4 *)(param_2 + 0x8c);

  *(undefined4 *)(param_1 + 0x90) = *(undefined4 *)(param_2 + 0x90);

  *(undefined4 *)(param_1 + 0x94) = *(undefined4 *)(param_2 + 0x94);

  *(undefined4 *)(param_1 + 0x9c) = *(undefined4 *)(param_2 + 0x9c);

  *(undefined8 *)(param_1 + 0xa0) = *(undefined8 *)(param_2 + 0xa0);

  *(undefined4 *)(param_1 + 0xa8) = *(undefined4 *)(param_2 + 0xa8);

  return param_1;

}





// --- FUN_005add20 at 0x005ADD20 (size: 388) ---


void __fastcall FUN_005add20(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  FUN_0048c3e0(&DAT_007938af);

  puVar1 = (undefined4 *)param_1[1];

  if (puVar1 != param_1) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

    if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

    param_1[1] = param_1;

    InterlockedIncrement(param_1 + 1);

  }

  LVar2 = InterlockedDecrement(param_1 + 1);

  if ((LVar2 == 0) && (param_1 != (undefined4 *)0x0)) {

    (**(code **)*param_1)(1);

  }

  FUN_0048c3e0(&DAT_007938af);

  puVar1 = (undefined4 *)param_1[2];

  if (puVar1 != param_1) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

    if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

    param_1[2] = param_1;

    InterlockedIncrement(param_1 + 1);

  }

  LVar2 = InterlockedDecrement(param_1 + 1);

  if ((LVar2 == 0) && (param_1 != (undefined4 *)0x0)) {

    (**(code **)*param_1)(1);

  }

  param_1[3] = DAT_008ef110;

  param_1[4] = DAT_008ef110;

  param_1[5] = DAT_008ef110;

  param_1[6] = DAT_008ef110;

  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[7] = 0;

  param_1[8] = 0;

  param_1[0xb] = 0;

  param_1[10] = 0;

  param_1[9] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  param_1[0x26] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

  param_1[0x21] = 0;

  if ((undefined4 *)param_1[0x20] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[0x20])(1);

    param_1[0x20] = 0;

  }

  param_1[0x22] = 0;

  param_1[0x23] = 0;

  param_1[0x24] = 0;

  param_1[0x25] = 0;

  param_1[0x27] = 0;

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  return;

}





// --- FUN_005ae4d0 at 0x005AE4D0 (size: 76) ---


undefined4 * __fastcall FUN_005ae4d0(undefined4 *param_1)



{

  LONG *pLVar1;

  

  FUN_005aebe0();

  *param_1 = &PTR_FUN_007e7190;

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[1] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[2] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  param_1[0x20] = 0;

  FUN_005add20();

  return param_1;

}





// --- FUN_005ae520 at 0x005AE520 (size: 953) ---


undefined4 __thiscall FUN_005ae520(int param_1,int *param_2,uint param_3)



{

  char cVar1;

  byte bVar2;

  ushort uVar3;

  int iVar4;

  uint uVar5;

  undefined4 *puVar6;

  int *piVar7;

  uint uVar8;

  int iVar9;

  int *piVar10;

  

  piVar7 = param_2;

  iVar4 = *param_2;

  FUN_005add20();

  param_2 = (int *)0x0;

  iVar9 = FUN_004fd290(&param_2,0);

  if (iVar9 + 0x10U <= param_3) {

    param_2 = (int *)0x0;

    uVar5 = *(uint *)*piVar7;

    *piVar7 = (int)((uint *)*piVar7 + 1);

    FUN_004fd460(piVar7,param_3);

    FUN_006855a0(param_1 + 0xc,piVar7);

    FUN_006854f0(0x6000000,param_1 + 0x10,piVar7);

    *(undefined4 *)(param_1 + 0x38) = *(undefined4 *)*piVar7;

    iVar9 = *piVar7;

    *piVar7 = iVar9 + 4;

    *(undefined4 *)(param_1 + 0x68) = *(undefined4 *)(iVar9 + 4);

    *piVar7 = *piVar7 + 4;

    FUN_004fd1b0(piVar7);

    uVar8 = param_3;

    if ((*(uint *)(param_1 + 0x68) & 0x4000000) != 0) {

      param_2 = *(int **)*piVar7;

      *piVar7 = (int)((uint *)*piVar7 + 1);

    }

    if ((uVar5 & 1) != 0) {

      FUN_004fd460(piVar7,param_3);

    }

    if ((uVar5 & 2) != 0) {

      cVar1 = *(char *)*piVar7;

      *piVar7 = (int)((char *)*piVar7 + 1);

      *(int *)(param_1 + 0x30) = (int)cVar1;

    }

    if ((uVar5 & 4) != 0) {

      cVar1 = *(char *)*piVar7;

      *piVar7 = (int)((char *)*piVar7 + 1);

      *(int *)(param_1 + 0x34) = (int)cVar1;

    }

    if ((uVar5 & 0x100) != 0) {

      uVar3 = *(ushort *)*piVar7;

      *piVar7 = (int)((ushort *)*piVar7 + 1);

      *(uint *)(param_1 + 0x50) = (uint)uVar3;

    }

    if ((uVar5 & 8) != 0) {

      *(undefined4 *)(param_1 + 0x3c) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x10) != 0) {

      *(undefined4 *)(param_1 + 0x40) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x20) != 0) {

      *(undefined4 *)(param_1 + 0x44) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x80000) != 0) {

      *(undefined4 *)(param_1 + 0x48) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((char)uVar5 < '\0') {

      *(undefined4 *)(param_1 + 0x4c) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x200) != 0) {

      bVar2 = *(byte *)*piVar7;

      *piVar7 = (int)((byte *)*piVar7 + 1);

      *(uint *)(param_1 + 0x54) = (uint)bVar2;

    }

    if ((uVar5 & 0x400) != 0) {

      uVar3 = *(ushort *)*piVar7;

      *piVar7 = (int)((ushort *)*piVar7 + 1);

      *(uint *)(param_1 + 0x58) = (uint)uVar3;

    }

    if ((uVar5 & 0x800) != 0) {

      uVar3 = *(ushort *)*piVar7;

      *piVar7 = (int)((ushort *)*piVar7 + 1);

      *(uint *)(param_1 + 0x5c) = (uint)uVar3;

    }

    if ((uVar5 & 0x1000) != 0) {

      uVar3 = *(ushort *)*piVar7;

      *piVar7 = (int)((ushort *)*piVar7 + 1);

      *(uint *)(param_1 + 0x60) = (uint)uVar3;

    }

    if ((uVar5 & 0x2000) != 0) {

      uVar3 = *(ushort *)*piVar7;

      *piVar7 = (int)((ushort *)*piVar7 + 1);

      *(uint *)(param_1 + 100) = (uint)uVar3;

    }

    if ((uVar5 & 0x4000) != 0) {

      *(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((char)(uVar5 >> 8) < '\0') {

      *(undefined4 *)(param_1 + 0x20) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x10000) != 0) {

      *(undefined4 *)(param_1 + 0x28) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x20000) != 0) {

      *(undefined4 *)(param_1 + 0x2c) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x40000) != 0) {

      *(undefined4 *)(param_1 + 0x24) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x100000) != 0) {

      bVar2 = *(byte *)*piVar7;

      *piVar7 = (int)((byte *)*piVar7 + 1);

      *(uint *)(param_1 + 0x6c) = (uint)bVar2;

    }

    if ((uVar5 & 0x800000) != 0) {

      bVar2 = *(byte *)*piVar7;

      *piVar7 = (int)((byte *)*piVar7 + 1);

      *(uint *)(param_1 + 0x70) = (uint)bVar2;

    }

    if ((uVar5 & 0x8000000) != 0) {

      uVar3 = *(ushort *)*piVar7;

      *piVar7 = (int)((ushort *)*piVar7 + 1);

      *(uint *)(param_1 + 0x84) = (uint)uVar3;

    }

    if ((uVar5 & 0x1000000) != 0) {

      *(undefined4 *)(param_1 + 0x98) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x200000) != 0) {

      uVar3 = *(ushort *)*piVar7;

      *piVar7 = (int)((ushort *)*piVar7 + 1);

      *(uint *)(param_1 + 0x74) = (uint)uVar3;

    }

    if ((uVar5 & 0x400000) != 0) {

      uVar3 = *(ushort *)*piVar7;

      *piVar7 = (int)((ushort *)*piVar7 + 1);

      *(uint *)(param_1 + 0x78) = (uint)uVar3;

    }

    if ((uVar5 & 0x2000000) != 0) {

      *(undefined4 *)(param_1 + 0x7c) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x4000000) != 0) {

      iVar9 = FUN_005df0f5(0x84);

      if (iVar9 == 0) {

        piVar10 = (int *)0x0;

      }

      else {

        piVar10 = (int *)FUN_005aff60();

      }

      *(int **)(param_1 + 0x80) = piVar10;

      (**(code **)(*piVar10 + 0x10))(piVar7,uVar8);

    }

    if ((uVar5 & 0x20000000) != 0) {

      *(undefined4 *)(param_1 + 0x8c) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x40) != 0) {

      *(undefined4 *)(param_1 + 0x90) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if ((uVar5 & 0x10000000) != 0) {

      uVar3 = *(ushort *)*piVar7;

      *piVar7 = (int)((ushort *)*piVar7 + 1);

      *(uint *)(param_1 + 0x88) = (uint)uVar3;

    }

    if ((uVar5 & 0x40000000) != 0) {

      FUN_006854f0(0x6000000,param_1 + 0x14,piVar7);

    }

    if (((uint)param_2 & 1) != 0) {

      FUN_006854f0(0x6000000,param_1 + 0x18,piVar7);

    }

    if ((int)uVar5 < 0) {

      *(undefined4 *)(param_1 + 0x94) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if (((uint)param_2 & 2) != 0) {

      *(undefined4 *)(param_1 + 0x9c) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    if (((uint)param_2 & 4) != 0) {

      puVar6 = (undefined4 *)*piVar7;

      *(undefined4 *)(param_1 + 0xa0) = *puVar6;

      *(undefined4 *)(param_1 + 0xa4) = puVar6[1];

      *piVar7 = *piVar7 + 8;

    }

    if (((uint)param_2 & 8) != 0) {

      *(undefined4 *)(param_1 + 0xa8) = *(undefined4 *)*piVar7;

      *piVar7 = *piVar7 + 4;

    }

    FUN_004fd1b0(piVar7);

    if ((uint)(*piVar7 - iVar4) <= uVar8) {

      return 1;

    }

    *piVar7 = iVar4;

  }

  return 0;

}





// --- FUN_005ae8e0 at 0x005AE8E0 (size: 49) ---


undefined4 __thiscall FUN_005ae8e0(int param_1,int param_2)



{

  if (((*(int *)(param_1 + 8) != *(int *)(param_2 + 8)) ||

      (*(int *)(param_1 + 0xc) != *(int *)(param_2 + 0xc))) &&

     ((*(int *)(param_1 + 8) != 0 || (*(int *)(param_1 + 0xc) != 0x800)))) {

    return 0;

  }

  return 1;

}





// --- FUN_005ae920 at 0x005AE920 (size: 48) ---


undefined4 __thiscall FUN_005ae920(int param_1,int param_2)



{

  if (((*(int *)(param_1 + 8) == 0) && (*(int *)(param_1 + 0xc) == 0x800)) &&

     ((*(int *)(param_2 + 8) != 0 || (*(int *)(param_2 + 0xc) != 0x800)))) {

    return 1;

  }

  return 0;

}





// --- FUN_005ae950 at 0x005AE950 (size: 120) ---


uint __thiscall FUN_005ae950(int param_1,int *param_2,uint param_3)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  iVar1 = FUN_00685480(0x5000000,*(undefined4 *)(param_1 + 0xc),param_2,0);

  iVar2 = FUN_00685480(0x5000000,*(undefined4 *)(param_1 + 8),param_2,0);

  uVar3 = iVar1 + 1 + iVar2;

  if (uVar3 <= param_3) {

    *(undefined1 *)*param_2 = *(undefined1 *)(param_1 + 4);

    *param_2 = *param_2 + 1;

    iVar1 = FUN_00685480(0x5000000,*(undefined4 *)(param_1 + 8),param_2,uVar3 - 1);

    iVar1 = (uVar3 - 1) - iVar1;

    iVar2 = FUN_00685480(0x5000000,*(undefined4 *)(param_1 + 0xc),param_2,iVar1);

    uVar3 = iVar1 - iVar2;

  }

  return uVar3;

}





// --- FUN_005ae9d0 at 0x005AE9D0 (size: 92) ---


bool __thiscall FUN_005ae9d0(int param_1,undefined4 *param_2,uint param_3)



{

  byte bVar1;

  char cVar2;

  

  if (param_3 < 5) {

    return false;

  }

  bVar1 = *(byte *)*param_2;

  *param_2 = (byte *)*param_2 + 1;

  *(uint *)(param_1 + 4) = (uint)bVar1;

  cVar2 = FUN_006854f0(0x5000000,param_1 + 8,param_2);

  if (cVar2 == '\0') {

    return false;

  }

  cVar2 = FUN_006854f0(0x5000000,param_1 + 0xc,param_2);

  return cVar2 != '\0';

}





// --- FUN_005aea30 at 0x005AEA30 (size: 33) ---


undefined4 __thiscall FUN_005aea30(int param_1,int param_2)



{

  if ((*(int *)(param_1 + 4) == *(int *)(param_2 + 4)) &&

     (*(int *)(param_1 + 8) == *(int *)(param_2 + 8))) {

    return 1;

  }

  return 0;

}





// --- FUN_005aea60 at 0x005AEA60 (size: 82) ---


uint __thiscall FUN_005aea60(int param_1,int *param_2,uint param_3)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  iVar1 = FUN_00685480(0x1000000,*(undefined4 *)(param_1 + 8),param_2,0);

  uVar3 = iVar1 + 1;

  if (uVar3 <= param_3) {

    *(undefined1 *)*param_2 = *(undefined1 *)(param_1 + 4);

    *param_2 = *param_2 + 1;

    iVar2 = FUN_00685480(0x1000000,*(undefined4 *)(param_1 + 8),param_2,iVar1);

    uVar3 = iVar1 - iVar2;

  }

  return uVar3;

}





// --- FUN_005aeac0 at 0x005AEAC0 (size: 61) ---


bool __thiscall FUN_005aeac0(int param_1,undefined4 *param_2,uint param_3)



{

  byte bVar1;

  char cVar2;

  

  if (param_3 < 3) {

    return false;

  }

  bVar1 = *(byte *)*param_2;

  *param_2 = (byte *)*param_2 + 1;

  *(uint *)(param_1 + 4) = (uint)bVar1;

  cVar2 = FUN_006854f0(0x1000000,param_1 + 8,param_2);

  return cVar2 != '\0';

}





// --- FUN_005aeb60 at 0x005AEB60 (size: 122) ---


undefined4 __thiscall FUN_005aeb60(int param_1,int *param_2,uint param_3)



{

  byte bVar1;

  int iVar2;

  byte *pbVar3;

  char cVar4;

  uint uVar5;

  

  iVar2 = *param_2;

  if (3 < param_3) {

    cVar4 = FUN_006854f0(0x4000000,param_1 + 4,param_2);

    if ((cVar4 != '\0') && (pbVar3 = (byte *)*param_2, pbVar3 + 2 <= (byte *)(iVar2 + param_3))) {

      bVar1 = *pbVar3;

      *param_2 = (int)(pbVar3 + 1);

      *(uint *)(param_1 + 8) = (uint)bVar1 << 3;

      bVar1 = *(byte *)*param_2;

      *param_2 = (int)((byte *)*param_2 + 1);

      uVar5 = (uint)bVar1;

      *(uint *)(param_1 + 0xc) = uVar5;

      if (uVar5 == 0) {

        *(undefined4 *)(param_1 + 0xc) = 0x100;

      }

      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) << 3;

      return 1;

    }

  }

  return 0;

}





// --- FUN_005aebe0 at 0x005AEBE0 (size: 9) ---


void __fastcall FUN_005aebe0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e71a8;

  return;

}





// --- FUN_005aebf0 at 0x005AEBF0 (size: 7) ---


void __fastcall FUN_005aebf0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005aec00 at 0x005AEC00 (size: 77) ---


void __thiscall FUN_005aec00(int param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0xc);

  if (puVar1 == (undefined4 *)0x0) {

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = param_2;

    puVar1[1] = 0;

    puVar1[2] = 0;

  }

  puVar1[1] = *(undefined4 *)(param_1 + 8);

  puVar1[2] = 0;

  if (*(int *)(param_1 + 8) != 0) {

    *(undefined4 **)(*(int *)(param_1 + 8) + 8) = puVar1;

    *(undefined4 **)(param_1 + 8) = puVar1;

    *(int *)(param_1 + 0x10) = *(int *)(param_1 + 0x10) + 1;

    return;

  }

  *(undefined4 **)(param_1 + 4) = puVar1;

  *(undefined4 **)(param_1 + 8) = puVar1;

  *(int *)(param_1 + 0x10) = *(int *)(param_1 + 0x10) + 1;

  return;

}





// --- FUN_005aec50 at 0x005AEC50 (size: 40) ---


int __thiscall FUN_005aec50(int param_1,int param_2)



{

  int iVar1;

  int *piVar2;

  

  piVar2 = *(int **)(param_1 + 4);

  iVar1 = 0;

  if (0 < *(int *)(param_1 + 0x10)) {

    do {

      if (piVar2 == (int *)0x0) {

        return -1;

      }

      if (*piVar2 == param_2) {

        return iVar1;

      }

      piVar2 = (int *)piVar2[2];

      iVar1 = iVar1 + 1;

    } while (iVar1 < *(int *)(param_1 + 0x10));

  }

  return -1;

}





// --- FUN_005aec80 at 0x005AEC80 (size: 48) ---


undefined4 __thiscall FUN_005aec80(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  

  piVar1 = *(int **)(param_1 + 4);

  iVar2 = 0;

  if (0 < *(int *)(param_1 + 0x10)) {

    do {

      if (piVar1 == (int *)0x0) {

        return 0;

      }

      if (*piVar1 == param_2) {

        return 1;

      }

      piVar1 = (int *)piVar1[2];

      iVar2 = iVar2 + 1;

    } while (iVar2 < *(int *)(param_1 + 0x10));

  }

  return 0;

}





// --- FUN_005aecb0 at 0x005AECB0 (size: 36) ---


undefined4 __fastcall FUN_005aecb0(int param_1)



{

  int iVar1;

  

  if (*(int *)(param_1 + 0xc) != 0) {

    iVar1 = *(int *)(*(int *)(param_1 + 0xc) + 8);

    *(int *)(param_1 + 0xc) = iVar1;

    if (iVar1 != 0) {

      *(int *)(param_1 + 0x14) = *(int *)(param_1 + 0x14) + 1;

      return 1;

    }

    *(undefined4 *)(param_1 + 0x14) = 0xffffffff;

  }

  return 0;

}





// --- FUN_005aece0 at 0x005AECE0 (size: 13) ---


undefined4 __fastcall FUN_005aece0(int param_1)



{

  if (*(undefined4 **)(param_1 + 0xc) != (undefined4 *)0x0) {

    return **(undefined4 **)(param_1 + 0xc);

  }

  return 0;

}





// --- FUN_005aecf0 at 0x005AECF0 (size: 83) ---


int __thiscall FUN_005aecf0(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  if ((param_2 < 0) || (iVar3 = *(int *)(param_1 + 0x10), iVar3 <= param_2)) {

    iVar1 = 0;

  }

  else if (iVar3 >> 1 < param_2) {

    iVar2 = *(int *)(param_1 + 8);

    iVar3 = iVar3 + -1;

    iVar1 = iVar2;

    if (param_2 < iVar3) {

      while (iVar1 = 0, iVar2 != 0) {

        iVar2 = *(int *)(iVar2 + 4);

        iVar3 = iVar3 + -1;

        if (iVar3 <= param_2) {

          return iVar2;

        }

      }

    }

  }

  else {

    iVar3 = *(int *)(param_1 + 4);

    iVar2 = 0;

    iVar1 = iVar3;

    if (0 < param_2) {

      while (iVar1 = 0, iVar3 != 0) {

        iVar3 = *(int *)(iVar3 + 8);

        iVar2 = iVar2 + 1;

        if (param_2 <= iVar2) {

          return iVar3;

        }

      }

    }

  }

  return iVar1;

}





// --- FUN_005aed50 at 0x005AED50 (size: 82) ---


undefined4 __thiscall FUN_005aed50(int param_1,void *param_2)



{

  if (param_2 == (void *)0x0) {

    return 0;

  }

  if (*(int *)((int)param_2 + 4) == 0) {

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)((int)param_2 + 8);

  }

  else {

    *(undefined4 *)(*(int *)((int)param_2 + 4) + 8) = *(undefined4 *)((int)param_2 + 8);

  }

  if (*(int *)((int)param_2 + 8) == 0) {

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)((int)param_2 + 4);

  }

  else {

    *(undefined4 *)(*(int *)((int)param_2 + 8) + 4) = *(undefined4 *)((int)param_2 + 4);

  }

  operator_delete(param_2);

  *(int *)(param_1 + 0x10) = *(int *)(param_1 + 0x10) + -1;

  return 1;

}





// --- FUN_005aedb0 at 0x005AEDB0 (size: 30) ---


void __fastcall FUN_005aedb0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e71c0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0xffffffff;

  return;

}





// --- FUN_005aedd0 at 0x005AEDD0 (size: 207) ---


undefined4 __thiscall FUN_005aedd0(int param_1,undefined4 param_2,int param_3,int param_4)



{

  int iVar1;

  undefined4 *puVar2;

  

  iVar1 = FUN_005aecf0(param_3);

  if ((iVar1 == 0) && (param_3 != *(int *)(param_1 + 0x10))) {

    if (param_4 != 0) {

      FUN_005aec00(param_2);

      return 1;

    }

    return 0;

  }

  puVar2 = (undefined4 *)FUN_005df0f5(0xc);

  if (puVar2 == (undefined4 *)0x0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = param_2;

    puVar2[1] = 0;

    puVar2[2] = 0;

  }

  if (param_3 == *(int *)(param_1 + 0x10)) {

    puVar2[1] = *(undefined4 *)(param_1 + 8);

    puVar2[2] = 0;

    if (*(int *)(param_1 + 8) == 0) {

      *(undefined4 **)(param_1 + 4) = puVar2;

      *(undefined4 **)(param_1 + 8) = puVar2;

    }

    else {

      *(undefined4 **)(*(int *)(param_1 + 8) + 8) = puVar2;

      *(undefined4 **)(param_1 + 8) = puVar2;

    }

  }

  else {

    puVar2[1] = *(undefined4 *)(iVar1 + 4);

    puVar2[2] = iVar1;

    *(undefined4 **)(iVar1 + 4) = puVar2;

    if (puVar2[1] == 0) {

      *(undefined4 **)(param_1 + 4) = puVar2;

    }

    else {

      *(undefined4 **)(puVar2[1] + 8) = puVar2;

    }

  }

  if ((*(int *)(param_1 + 0xc) != 0) && (param_3 <= *(int *)(param_1 + 0x14))) {

    *(int *)(param_1 + 0x14) = *(int *)(param_1 + 0x14) + 1;

  }

  *(int *)(param_1 + 0x10) = *(int *)(param_1 + 0x10) + 1;

  return 1;

}





// --- FUN_005aeea0 at 0x005AEEA0 (size: 78) ---


void __thiscall FUN_005aeea0(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  

  piVar1 = *(int **)(param_1 + 4);

  iVar2 = 0;

  if (0 < *(int *)(param_1 + 0x10)) {

    do {

      if ((piVar1 == (int *)0x0) || (*piVar1 == param_2)) break;

      piVar1 = (int *)piVar1[2];

      iVar2 = iVar2 + 1;

    } while (iVar2 < *(int *)(param_1 + 0x10));

  }

  if (iVar2 == *(int *)(param_1 + 0x14)) {

    *(undefined4 *)(param_1 + 0x14) = 0xffffffff;

    *(undefined4 *)(param_1 + 0xc) = 0;

  }

  if (iVar2 < *(int *)(param_1 + 0x14)) {

    *(int *)(param_1 + 0x14) = *(int *)(param_1 + 0x14) + -1;

  }

  FUN_005aed50();

  return;

}





// --- FUN_005aeef0 at 0x005AEEF0 (size: 24) ---


undefined4 FUN_005aeef0(undefined4 param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005aecf0(param_1);

  if (puVar1 != (undefined4 *)0x0) {

    return *puVar1;

  }

  return 0;

}





// --- FUN_005aef10 at 0x005AEF10 (size: 167) ---


void __fastcall FUN_005aef10(int param_1)



{

  int iVar1;

  void *pvVar2;

  void *pvVar3;

  

  iVar1 = *(int *)(param_1 + 0x10);

  while (0 < iVar1) {

    iVar1 = *(int *)(param_1 + 0x10);

    if (iVar1 < 1) {

      pvVar3 = (void *)0x0;

    }

    else if (iVar1 < 0) {

      for (pvVar2 = *(void **)(param_1 + 8);

          (iVar1 = iVar1 + -1, pvVar3 = pvVar2, 0 < iVar1 &&

          (pvVar3 = (void *)0x0, pvVar2 != (void *)0x0)); pvVar2 = *(void **)((int)pvVar2 + 4)) {

      }

    }

    else {

      pvVar3 = *(void **)(param_1 + 4);

    }

    if (*(int *)(param_1 + 0x14) == 0) {

      *(undefined4 *)(param_1 + 0x14) = 0xffffffff;

      *(undefined4 *)(param_1 + 0xc) = 0;

    }

    if (0 < *(int *)(param_1 + 0x14)) {

      *(int *)(param_1 + 0x14) = *(int *)(param_1 + 0x14) + -1;

    }

    if (pvVar3 != (void *)0x0) {

      if (*(int *)((int)pvVar3 + 4) == 0) {

        *(undefined4 *)(param_1 + 4) = *(undefined4 *)((int)pvVar3 + 8);

      }

      else {

        *(undefined4 *)(*(int *)((int)pvVar3 + 4) + 8) = *(undefined4 *)((int)pvVar3 + 8);

      }

      if (*(int *)((int)pvVar3 + 8) == 0) {

        *(undefined4 *)(param_1 + 8) = *(undefined4 *)((int)pvVar3 + 4);

      }

      else {

        *(undefined4 *)(*(int *)((int)pvVar3 + 8) + 4) = *(undefined4 *)((int)pvVar3 + 4);

      }

      operator_delete(pvVar3);

      *(int *)(param_1 + 0x10) = *(int *)(param_1 + 0x10) + -1;

    }

    iVar1 = *(int *)(param_1 + 0x10);

  }

  return;

}





// --- FUN_005aefc0 at 0x005AEFC0 (size: 48) ---


undefined4 __thiscall FUN_005aefc0(int param_1,undefined4 param_2)



{

  int iVar1;

  

  iVar1 = FUN_005aecf0(param_2);

  *(int *)(param_1 + 0xc) = iVar1;

  if (iVar1 != 0) {

    *(undefined4 *)(param_1 + 0x14) = param_2;

    return 1;

  }

  *(undefined4 *)(param_1 + 0x14) = 0xffffffff;

  return 0;

}





// --- FUN_005af0a0 at 0x005AF0A0 (size: 126) ---


undefined4 __thiscall FUN_005af0a0(int param_1,int *param_2)



{

  int iVar1;

  undefined4 uVar2;

  int *piVar3;

  undefined4 *puVar4;

  

  piVar3 = param_2;

  FUN_005aef10();

  iVar1 = *(int *)*param_2;

  *param_2 = (int)((int *)*param_2 + 1);

  param_2 = (int *)iVar1;

  if (0 < iVar1) {

    do {

      puVar4 = (undefined4 *)*piVar3;

      uVar2 = *puVar4;

      *piVar3 = (int)(puVar4 + 1);

      puVar4 = (undefined4 *)FUN_005df0f5(0xc);

      if (puVar4 == (undefined4 *)0x0) {

        puVar4 = (undefined4 *)0x0;

      }

      else {

        *puVar4 = uVar2;

        puVar4[1] = 0;

        puVar4[2] = 0;

      }

      puVar4[1] = *(undefined4 *)(param_1 + 8);

      puVar4[2] = 0;

      if (*(int *)(param_1 + 8) == 0) {

        *(undefined4 **)(param_1 + 4) = puVar4;

      }

      else {

        *(undefined4 **)(*(int *)(param_1 + 8) + 8) = puVar4;

      }

      *(undefined4 **)(param_1 + 8) = puVar4;

      param_2 = (int *)((int)param_2 + -1);

      *(int *)(param_1 + 0x10) = *(int *)(param_1 + 0x10) + 1;

    } while (param_2 != (int *)0x0);

  }

  return 1;

}





// --- FUN_005af120 at 0x005AF120 (size: 22) ---


void __fastcall FUN_005af120(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e71c0;

  FUN_005aef10();

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005af140 at 0x005AF140 (size: 153) ---


void __thiscall FUN_005af140(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined4 uVar5;

  int iVar6;

  

  iVar1 = *(int *)(param_2 + 0x10);

  iVar6 = 0;

  if (iVar1 < 1) {

    iVar4 = 0;

  }

  else if (iVar1 < 0) {

    iVar3 = iVar1;

    for (iVar2 = *(int *)(param_2 + 8);

        (iVar3 = iVar3 + -1, iVar4 = iVar2, 0 < iVar3 && (iVar4 = 0, iVar2 != 0));

        iVar2 = *(int *)(iVar2 + 4)) {

    }

  }

  else {

    iVar4 = *(int *)(param_2 + 4);

  }

  *(int *)(param_2 + 0xc) = iVar4;

  if (iVar4 == 0) {

    *(undefined4 *)(param_2 + 0x14) = 0xffffffff;

  }

  else {

    *(undefined4 *)(param_2 + 0x14) = 0;

  }

  if (0 < iVar1) {

    do {

      if (*(undefined4 **)(param_2 + 0xc) == (undefined4 *)0x0) {

        uVar5 = 0;

      }

      else {

        uVar5 = **(undefined4 **)(param_2 + 0xc);

      }

      FUN_005aedd0(uVar5,*(undefined4 *)(param_1 + 0x10),1);

      if (*(int *)(param_2 + 0xc) != 0) {

        iVar1 = *(int *)(*(int *)(param_2 + 0xc) + 8);

        *(int *)(param_2 + 0xc) = iVar1;

        if (iVar1 == 0) {

          *(undefined4 *)(param_2 + 0x14) = 0xffffffff;

        }

        else {

          *(int *)(param_2 + 0x14) = *(int *)(param_2 + 0x14) + 1;

        }

      }

      iVar6 = iVar6 + 1;

    } while (iVar6 < *(int *)(param_2 + 0x10));

  }

  return;

}





// --- FUN_005af1e0 at 0x005AF1E0 (size: 42) ---


undefined4 * __thiscall FUN_005af1e0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007e71c0;

  FUN_005aef10();

  *param_1 = &PTR_FUN_0079385c;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005af210 at 0x005AF210 (size: 46) ---


undefined4 * __thiscall FUN_005af210(undefined4 *param_1,undefined4 param_2)



{

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  *param_1 = &PTR_FUN_007e71c0;

  param_1[5] = 0xffffffff;

  FUN_005af140(param_2);

  return param_1;

}





// --- FUN_005af240 at 0x005AF240 (size: 46) ---


undefined4 * __thiscall FUN_005af240(undefined4 *param_1,undefined4 param_2)



{

  LONG *lpAddend;

  

  FUN_00415460(param_2);

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0xc] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  *param_1 = &PTR_LAB_007e71e8;

  return param_1;

}





// --- FUN_005af290 at 0x005AF290 (size: 72) ---


undefined4 * __thiscall FUN_005af290(undefined4 *param_1,byte param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  *param_1 = &PTR_LAB_007e71e8;

  puVar2 = (undefined4 *)(param_1[0xc] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0xc] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  FUN_004154b0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005af300 at 0x005AF300 (size: 61) ---


undefined4 __fastcall FUN_005af300(undefined4 *param_1)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  int *piVar4;

  

  if ((int *)param_1[1] == (int *)0x0) {

    return 0;

  }

  iVar2 = (**(code **)(*(int *)param_1[1] + 4))(*param_1);

  uVar1 = *(uint *)(param_1[1] + 8);

  uVar3 = iVar2 + 1;

  if (uVar3 < uVar1) {

    iVar2 = *(int *)(param_1[1] + 4);

    piVar4 = (int *)(iVar2 + uVar3 * 4);

    do {

      if (*piVar4 != 0) {

        return *(undefined4 *)(iVar2 + uVar3 * 4);

      }

      uVar3 = uVar3 + 1;

      piVar4 = piVar4 + 1;

    } while (uVar3 < uVar1);

  }

  return 0;

}





// --- FUN_005af340 at 0x005AF340 (size: 76) ---


int __thiscall FUN_005af340(int *param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  

  if ((param_1[2] != 0) && (param_1[1] != 0)) {

    iVar1 = (**(code **)(*param_1 + 4))(param_2);

    for (iVar1 = *(int *)(param_1[1] + iVar1 * 4); iVar1 != 0; iVar1 = *(int *)(iVar1 + 8)) {

      iVar2 = (**(code **)(*param_1 + 8))(param_2,iVar1);

      if (iVar2 != 0) {

        return iVar1 + 4;

      }

    }

  }

  return 0;

}





// --- FUN_005af390 at 0x005AF390 (size: 48) ---


undefined4 __fastcall FUN_005af390(int param_1)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  

  uVar1 = *(uint *)(param_1 + 8);

  if (uVar1 == 0) {

    return 1;

  }

  uVar3 = 0x80000000;

  if (uVar1 < 0x80000001) {

    uVar2 = uVar1 & 0x80000000;

    while (uVar2 == 0) {

      uVar3 = uVar3 >> 1;

      uVar2 = uVar3 & uVar1;

    }

    if (uVar3 == uVar1) {

      return 1;

    }

    uVar3 = uVar3 * 2;

  }

  *(uint *)(param_1 + 8) = uVar3;

  return 0;

}





// --- FUN_005af3c0 at 0x005AF3C0 (size: 29) ---


void __thiscall FUN_005af3c0(int param_1,int param_2)



{

  if (param_2 != 0) {

    *(uint *)(param_1 + 4) = *(uint *)(param_1 + 4) | 1;

    return;

  }

  *(uint *)(param_1 + 4) = *(uint *)(param_1 + 4) & 0xfffffffe;

  return;

}





// --- FUN_005af450 at 0x005AF450 (size: 70) ---


int * __thiscall FUN_005af450(int param_1,int *param_2)



{

  int *piVar1;

  uint uVar2;

  int *piVar3;

  

  piVar1 = *(int **)(param_1 + 4);

  uVar2 = 0;

  if ((piVar1 != (int *)0x0) && (piVar3 = piVar1, *(uint *)(param_1 + 8) != 0)) {

    do {

      if (*piVar3 != 0) {

        *param_2 = piVar1[uVar2];

        param_2[1] = param_1;

        return param_2;

      }

      uVar2 = uVar2 + 1;

      piVar3 = piVar3 + 1;

    } while (uVar2 < *(uint *)(param_1 + 8));

  }

  *param_2 = 0;

  param_2[1] = param_1;

  return param_2;

}





// --- FUN_005af4a0 at 0x005AF4A0 (size: 89) ---


undefined4 __fastcall FUN_005af4a0(int param_1)



{

  int iVar1;

  uint uVar2;

  

  if (*(int *)(param_1 + 4) != 0) {

    return 0;

  }

  if (*(int *)(param_1 + 8) != 0) {

    FUN_005af390();

    iVar1 = thunk_FUN_005df0f5(*(int *)(param_1 + 8) << 2);

    *(int *)(param_1 + 4) = iVar1;

    if (iVar1 == 0) {

      return 0;

    }

    uVar2 = 0;

    if (*(int *)(param_1 + 8) != 0) {

      do {

        *(undefined4 *)(*(int *)(param_1 + 4) + uVar2 * 4) = 0;

        uVar2 = uVar2 + 1;

      } while (uVar2 < *(uint *)(param_1 + 8));

    }

  }

  return 1;

}





// --- FUN_005af500 at 0x005AF500 (size: 121) ---


undefined4 __thiscall FUN_005af500(int *param_1,undefined4 *param_2,undefined4 *param_3)



{

  int iVar1;

  undefined4 *puVar2;

  

  if (0xfffffe < (uint)param_1[3]) {

    return 0;

  }

  iVar1 = FUN_005af340(param_2);

  if (iVar1 == 0) {

    puVar2 = (undefined4 *)FUN_005df0f5(0xc);

    if (puVar2 != (undefined4 *)0x0) {

      *puVar2 = *param_2;

      puVar2[1] = *param_3;

      puVar2[2] = 0;

      iVar1 = (**(code **)(*param_1 + 4))(param_2);

      puVar2[2] = *(undefined4 *)(param_1[1] + iVar1 * 4);

      *(undefined4 **)(param_1[1] + iVar1 * 4) = puVar2;

      param_1[3] = param_1[3] + 1;

      return 1;

    }

  }

  return 0;

}





// --- FUN_005af580 at 0x005AF580 (size: 79) ---


void __fastcall FUN_005af580(int param_1)



{

  void *pvVar1;

  void *pvVar2;

  uint uVar3;

  

  if ((*(int *)(param_1 + 4) != 0) && (uVar3 = 0, *(int *)(param_1 + 8) != 0)) {

    do {

      pvVar2 = *(void **)(*(int *)(param_1 + 4) + uVar3 * 4);

      while (pvVar2 != (void *)0x0) {

        pvVar1 = *(void **)((int)pvVar2 + 8);

        operator_delete(pvVar2);

        pvVar2 = pvVar1;

      }

      *(undefined4 *)(*(int *)(param_1 + 4) + uVar3 * 4) = 0;

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 8));

  }

  *(undefined4 *)(param_1 + 0xc) = 0;

  return;

}





// --- FUN_005af600 at 0x005AF600 (size: 53) ---


undefined4 * __fastcall FUN_005af600(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7240;

  param_1[1] = 0;

  param_1[2] = 0x20;

  param_1[3] = 0;

  FUN_005af4a0();

  param_1[4] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_007e7260;

  param_1[4] = &PTR_LAB_007e724c;

  return param_1;

}





// --- FUN_005af650 at 0x005AF650 (size: 209) ---


uint __thiscall FUN_005af650(int param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  uint uVar2;

  int iVar3;

  undefined4 *puVar4;

  uint uVar5;

  int *piVar6;

  int *piVar7;

  

  uVar2 = FUN_005af730();

  if (uVar2 <= param_3) {

    iVar3 = 0;

    for (uVar5 = *(uint *)(param_1 + -8); uVar5 != 0; uVar5 = uVar5 >> 1) {

      iVar3 = iVar3 + 1;

    }

    *(uint *)*param_2 = iVar3 << 0x18 | *(uint *)(param_1 + -4);

    *param_2 = *param_2 + 4;

    piVar7 = *(int **)(param_1 + -0xc);

    puVar4 = (undefined4 *)0x0;

    if (piVar7 != (int *)0x0) {

      piVar6 = piVar7;

      if (*(undefined4 **)(param_1 + -8) != (undefined4 *)0x0) {

        do {

          if (*piVar6 != 0) {

            puVar4 = (undefined4 *)piVar7[(int)puVar4];

            goto joined_r0x005af6b6;

          }

          puVar4 = (undefined4 *)((int)puVar4 + 1);

          piVar6 = piVar6 + 1;

        } while (puVar4 < *(undefined4 **)(param_1 + -8));

      }

      puVar4 = (undefined4 *)0x0;

    }

joined_r0x005af6b6:

    puVar1 = puVar4;

    if (puVar1 != (undefined4 *)0x0) {

      if (3 < param_3) {

        *(undefined4 *)*param_2 = *puVar1;

        iVar3 = *param_2;

        *param_2 = iVar3 + 4;

        *(undefined4 *)(iVar3 + 4) = puVar1[1];

        *param_2 = *param_2 + 4;

      }

      if (puVar1 == (undefined4 *)0x0) {

        return uVar2;

      }

      puVar4 = (undefined4 *)puVar1[2];

      if ((undefined4 *)puVar1[2] == (undefined4 *)0x0) {

        iVar3 = (**(code **)(*(int *)(param_1 + -0x10) + 4))(puVar1);

        uVar5 = iVar3 + 1;

        if (uVar5 < *(uint *)(param_1 + -8)) {

          piVar7 = (int *)(*(int *)(param_1 + -0xc) + uVar5 * 4);

          do {

            if (*piVar7 != 0) {

              puVar4 = *(undefined4 **)(*(int *)(param_1 + -0xc) + uVar5 * 4);

              goto joined_r0x005af6b6;

            }

            uVar5 = uVar5 + 1;

            piVar7 = piVar7 + 1;

          } while (uVar5 < *(uint *)(param_1 + -8));

        }

        puVar4 = (undefined4 *)0x0;

      }

      goto joined_r0x005af6b6;

    }

  }

  return uVar2;

}





// --- FUN_005af730 at 0x005AF730 (size: 113) ---


int FUN_005af730(void)



{

  int iVar1;

  uint uVar2;

  int *piVar3;

  int iVar4;

  int local_8;

  int *local_4;

  

  iVar4 = 4;

  FUN_005af450(&local_8);

joined_r0x005af74b:

  do {

    do {

      iVar1 = local_8;

      if ((iVar1 == 0) || (iVar4 = iVar4 + 8, iVar1 == 0)) {

        return iVar4;

      }

      local_8 = *(int *)(iVar1 + 8);

    } while (*(int *)(iVar1 + 8) != 0);

    if (local_4 != (int *)0x0) {

      iVar1 = (**(code **)(*local_4 + 4))(iVar1);

      uVar2 = iVar1 + 1;

      if (uVar2 < (uint)local_4[2]) {

        piVar3 = (int *)(local_4[1] + uVar2 * 4);

        do {

          if (*piVar3 != 0) {

            local_8 = *(int *)(local_4[1] + uVar2 * 4);

            goto joined_r0x005af74b;

          }

          uVar2 = uVar2 + 1;

          piVar3 = piVar3 + 1;

        } while (uVar2 < (uint)local_4[2]);

      }

    }

    local_8 = 0;

  } while( true );

}





// --- FUN_005af7c0 at 0x005AF7C0 (size: 60) ---


void __fastcall FUN_005af7c0(undefined4 *param_1)



{

  param_1[4] = &PTR_LAB_007e724c;

  param_1[4] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_007e7240;

  FUN_005af580();

  if ((void *)param_1[1] != (void *)0x0) {

    operator_delete__((void *)param_1[1]);

    param_1[1] = 0;

  }

  param_1[2] = 0;

  return;

}





// --- FUN_005af800 at 0x005AF800 (size: 241) ---


bool __thiscall FUN_005af800(int param_1,int *param_2,uint param_3)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  int local_4;

  

  uVar5 = param_3;

  if (param_3 < 4) {

    return false;

  }

  local_4 = param_1;

  FUN_005af580();

  if (*(void **)(param_1 + -0xc) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + -0xc));

    *(undefined4 *)(param_1 + -0xc) = 0;

  }

  piVar2 = param_2;

  *(undefined4 *)(param_1 + -8) = 0;

  uVar4 = *(uint *)*param_2;

  *param_2 = (int)((uint *)*param_2 + 1);

  param_3 = uVar5 - 4;

  if (uVar4 >> 0x18 < 0x21) {

    if (uVar4 >> 0x18 == 0) {

      *(undefined4 *)(param_1 + -8) = 0;

    }

    else {

      *(int *)(param_1 + -8) = 1 << ((char)(uVar4 >> 0x18) - 1U & 0x1f);

    }

    uVar4 = uVar4 & 0xffffff;

    if (*(int *)(param_1 + -8) == 0) {

      return uVar4 == 0;

    }

    iVar3 = FUN_005af4a0();

    if (iVar3 != 0) {

      uVar5 = 0;

      if (uVar4 != 0) {

        do {

          if (param_3 < 4) {

            return false;

          }

          piVar1 = (int *)*piVar2;

          local_4 = *piVar1;

          *piVar2 = (int)(piVar1 + 1);

          param_2 = (int *)piVar1[1];

          *piVar2 = (int)(piVar1 + 2);

          iVar3 = FUN_005af500(&local_4,&param_2);

          if (iVar3 == 0) {

            return false;

          }

          uVar5 = uVar5 + 1;

        } while (uVar5 < uVar4);

      }

      return true;

    }

  }

  return false;

}





// --- FUN_005af900 at 0x005AF900 (size: 66) ---


undefined4 * __thiscall FUN_005af900(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007e7240;

  FUN_005af580();

  if ((void *)param_1[1] != (void *)0x0) {

    operator_delete__((void *)param_1[1]);

    param_1[1] = 0;

  }

  param_1[2] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005af950 at 0x005AF950 (size: 80) ---


undefined4 * __thiscall FUN_005af950(undefined4 *param_1,byte param_2)



{

  param_1[4] = &PTR_LAB_007e724c;

  param_1[4] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_007e7240;

  FUN_005af580();

  if ((void *)param_1[1] != (void *)0x0) {

    operator_delete__((void *)param_1[1]);

    param_1[1] = 0;

  }

  param_1[2] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005af9a0 at 0x005AF9A0 (size: 67) ---


undefined4 __thiscall FUN_005af9a0(int param_1,int param_2,int param_3)



{

  int iVar1;

  

  if (((*(byte *)(param_1 + 4) & 1) != 0) ||

     ((*(int *)(param_1 + 8) != 0 && (param_3 == *(int *)(param_1 + 8))))) {

    return 1;

  }

  param_3 = param_2;

  if ((param_2 != 0) && (iVar1 = FUN_00477380(&param_3), iVar1 != 0)) {

    return 1;

  }

  return 0;

}





// --- FUN_005af9f0 at 0x005AF9F0 (size: 68) ---


void FUN_005af9f0(undefined4 param_1)



{

  undefined *puVar1;

  undefined4 *puVar2;

  

  puVar1 = PTR_DAT_00818558;

  puVar2 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_1,param_1,0);

  if (puVar2 == (undefined4 *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  FUN_0046c280(*puVar2);

  return;

}





// --- FUN_005afa40 at 0x005AFA40 (size: 426) ---


bool __thiscall FUN_005afa40(int param_1,int *param_2,uint param_3)



{

  uint *puVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  int local_1c [2];

  undefined **local_14;

  void *local_10;

  undefined **local_4;

  

  uVar2 = param_3;

  if (param_3 < 4) {

    return false;

  }

  puVar1 = (uint *)*param_2;

  uVar3 = *puVar1;

  *param_2 = (int)(puVar1 + 1);

  if ((uVar3 & 0xffff0000) == 0) {

    param_3 = 0;

    uVar4 = 4;

  }

  else {

    param_3 = uVar3;

    if (uVar3 == 0) {

      uVar4 = 4;

    }

    else {

      uVar4 = 0xc;

    }

  }

  if (uVar2 < uVar4) {

    return false;

  }

  if (0x10000001 < param_3) {

    *(uint *)(param_1 + 4) = puVar1[1];

    iVar5 = *param_2;

    *param_2 = iVar5 + 4;

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar5 + 4);

    iVar5 = *param_2;

    *param_2 = iVar5 + 4;

    uVar3 = (iVar5 + 4) - (int)puVar1;

    if (uVar3 < uVar2) {

      iVar5 = uVar2 - uVar3;

    }

    else {

      iVar5 = 0;

    }

    iVar5 = (**(code **)(*(int *)(param_1 + 0x80) + 0x10))(param_2,iVar5);

    return iVar5 != 0;

  }

  FUN_005af600();

  if (param_3 == 0) {

    FUN_005af3c0(uVar3);

    if ((uint)(*param_2 - (int)puVar1) < uVar2) {

      iVar5 = uVar2 - (*param_2 - (int)puVar1);

      goto LAB_005afad6;

    }

  }

  else {

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)*param_2;

    iVar5 = *param_2;

    *param_2 = iVar5 + 4;

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar5 + 4);

    iVar5 = *param_2;

    *param_2 = iVar5 + 4;

    uVar3 = (iVar5 + 4) - (int)puVar1;

    if (uVar3 < uVar2) {

      iVar5 = uVar2 - uVar3;

      goto LAB_005afad6;

    }

  }

  iVar5 = 0;

LAB_005afad6:

  iVar5 = FUN_005af800(param_2,iVar5);

  if (iVar5 == 0) {

    FUN_005af7c0();

    return false;

  }

  FUN_005af450(local_1c);

  iVar5 = local_1c[0];

  while ((local_1c[0] = iVar5, iVar5 != 0 && (FUN_006891f0(iVar5,iVar5 + 4), iVar5 != 0))) {

    iVar5 = *(int *)(iVar5 + 8);

    if (iVar5 == 0) {

      iVar5 = FUN_005af300();

    }

  }

  local_4 = &PTR_FUN_0079385c;

  local_14 = &PTR_FUN_007e7240;

  FUN_005af580();

  if (local_10 != (void *)0x0) {

    operator_delete__(local_10);

  }

  return true;

}





// --- FUN_005afbf0 at 0x005AFBF0 (size: 319) ---


int __thiscall FUN_005afbf0(int param_1,int param_2)



{

  undefined *puVar1;

  int iVar2;

  undefined4 *puVar3;

  int *piVar4;

  uint *puVar5;

  uint uVar6;

  uint uVar7;

  uint *puVar8;

  uint *puVar9;

  uint *puVar10;

  undefined1 local_18 [4];

  undefined4 *local_14;

  int local_c;

  

  iVar2 = param_2;

  if (param_1 != param_2) {

    FUN_005870f0();

    puVar1 = PTR_DAT_00818558;

    param_2 = *(undefined4 *)(iVar2 + 0x6c);

    puVar3 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

    if (puVar3 == (undefined4 *)puVar1) {

      puVar3 = puVar3 + -1;

    }

    FUN_0046c280(*puVar3);

    puVar8 = (uint *)0x0;

    piVar4 = (int *)FUN_0052dcf0(local_18);

    local_c = *piVar4;

    puVar10 = (uint *)piVar4[2];

    local_14 = (undefined4 *)piVar4[1];

    while (puVar9 = puVar8, puVar10 != (uint *)0x0) {

      do {

        puVar5 = (uint *)FUN_005df0f5(0xc);

        puVar8 = (uint *)0x0;

        if (puVar5 != (uint *)0x0) {

          uVar6 = *puVar10;

          puVar5[1] = 0;

          *puVar5 = uVar6;

          puVar5[2] = puVar10[2];

          puVar8 = puVar5;

        }

        uVar6 = *puVar8 % *(uint *)(param_1 + 0x6c);

        if (puVar9 == (uint *)0x0) {

LAB_005afcc3:

          puVar3 = (undefined4 *)(*(int *)(param_1 + 100) + uVar6 * 4);

          *puVar3 = puVar8;

          if (puVar9 == (uint *)0x0) {

            *(undefined4 **)(param_1 + 0x68) = puVar3;

          }

LAB_005afcd9:

          *(int *)(param_1 + 0x70) = *(int *)(param_1 + 0x70) + 1;

        }

        else {

          uVar7 = *puVar9 % *(uint *)(param_1 + 0x6c);

          if (uVar6 == uVar7) {

            puVar9[1] = (uint)puVar8;

            goto LAB_005afcd9;

          }

          if (uVar7 < uVar6) goto LAB_005afcc3;

        }

        puVar10 = (uint *)puVar10[1];

        puVar9 = puVar8;

      } while (puVar10 != (uint *)0x0);

      do {

        local_14 = local_14 + 1;

        if (local_14 == (undefined4 *)(*(int *)(local_c + 0x60) + *(int *)(local_c + 0x68) * 4)) {

          return param_1;

        }

        puVar10 = (uint *)*local_14;

      } while (puVar10 == (uint *)0x0);

    }

  }

  return param_1;

}





// --- FUN_005afd40 at 0x005AFD40 (size: 441) ---


undefined4 __thiscall FUN_005afd40(int param_1,uint param_2,undefined4 param_3,undefined4 param_4)



{

  undefined4 uVar1;

  undefined4 uVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  uint uVar6;

  int iVar7;

  uint uVar8;

  undefined4 local_c;

  undefined4 local_8;

  int local_4;

  

  uVar6 = param_2;

  if (param_2 == 2) {

    FUN_005870f0();

    iVar3 = FUN_005413a0(2,&param_2,param_3,param_4);

    if (iVar3 != 0) {

      uVar6 = param_2 >> 0x18;

      if (DAT_007956cc <= uVar6) {

        uVar6 = DAT_007956cc - 1;

      }

      FUN_005af9f0(*(undefined4 *)(PTR_DAT_00818554 + uVar6 * 4));

      uVar8 = param_2 & 0xffffff;

      uVar6 = 0;

      iVar3 = 0;

      if (uVar8 != 0) {

        do {

          iVar7 = FUN_005df0f5(0xc);

          iVar5 = 0;

          if (iVar7 != 0) {

            *(undefined4 *)(iVar7 + 4) = 0;

            iVar5 = iVar7;

          }

          iVar7 = FUN_005413a0(2,iVar5,param_3,param_4);

          if (iVar7 == 0) {

            return 0;

          }

          iVar7 = FUN_005413a0(2,iVar5 + 8,param_3,param_4);

          if (iVar7 == 0) {

            return 0;

          }

          FUN_00599310(iVar5,iVar3);

          uVar6 = uVar6 + 1;

          iVar3 = iVar5;

        } while (uVar6 < uVar8);

      }

      return 1;

    }

  }

  else {

    uVar8 = *(uint *)(param_1 + -4);

    if (uVar8 < 0x1000000) {

      param_2 = uVar8;

      iVar3 = FUN_006b3a20(*(undefined4 *)(param_1 + -8));

      uVar2 = param_4;

      uVar1 = param_3;

      param_2 = uVar8 | (iVar3 - (int)PTR_DAT_00818554 >> 2) << 0x18;

      iVar3 = FUN_005413a0(uVar6,&param_2,param_3,param_4);

      if (iVar3 != 0) {

        puVar4 = (undefined4 *)FUN_0052dcf0(&local_c);

        local_c = *puVar4;

        local_8 = puVar4[1];

        local_4 = puVar4[2];

        if (local_4 == 0) {

          return 1;

        }

        while (iVar3 = local_4, iVar5 = FUN_005413a0(uVar6,local_4,uVar1,uVar2), iVar5 != 0) {

          iVar3 = FUN_005413a0(uVar6,iVar3 + 8,uVar1,uVar2);

          if (iVar3 == 0) {

            return 0;

          }

          FUN_00429ca0();

          if (local_4 == 0) {

            return 1;

          }

        }

      }

    }

  }

  return 0;

}





// --- FUN_005aff00 at 0x005AFF00 (size: 96) ---


undefined4 * __thiscall FUN_005aff00(undefined4 *param_1,byte param_2)



{

  param_1[0x1d] = &PTR_LAB_007e726c;

  param_1[0x1d] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_0079da04;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_0079da00;

  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_005aff60 at 0x005AFF60 (size: 65) ---


undefined4 * __fastcall FUN_005aff60(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7288;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = &PTR_FUN_0079da04;

  FUN_0046c1f0(0x40);

  param_1[0x20] = &PTR_FUN_007cab80;

  param_1[3] = &PTR_FUN_007e7284;

  param_1[0x20] = &PTR_LAB_007e726c;

  return param_1;

}





// --- FUN_005affb0 at 0x005AFFB0 (size: 41) ---


int __thiscall FUN_005affb0(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);

    FUN_005afbf0(param_2 + 0xc);

  }

  return param_1;

}





// --- FUN_005affe0 at 0x005AFFE0 (size: 95) ---


void __fastcall FUN_005affe0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7288;

  param_1[0x20] = &PTR_LAB_007e726c;

  param_1[0x20] = &PTR_FUN_0079385c;

  param_1[3] = &PTR_FUN_0079da04;

  FUN_005870f0();

  param_1[4] = &PTR_FUN_0079da00;

  if ((undefined4 *)param_1[0x1c] != param_1 + 5) {

    operator_delete__((undefined4 *)param_1[0x1c]);

  }

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





