// Decompiled from acclient.exe using Ghidra 12.0.4 + pyghidra
// Target: AC client physics/terrain/movement functions
// Binary: C:/Turbine/Asheron's Call/acclient.exe

// ============================================================
// KNOWN ADDRESSES (from ACME ClientReference.cs)
// ============================================================

// --- CLandBlockStruct_ConstructPolygons at 0x00531D10 ---
// FUNCTION NOT FOUND

// --- CLandBlockStruct_GetCellRotation at 0x00532170 ---
// FUNCTION NOT FOUND

// --- CLandBlockStruct_ConstructVertices at 0x005328D0 ---
// FUNCTION NOT FOUND

// --- LandDefs_get_vars at 0x005A9980 ---
// FUNCTION NOT FOUND

// ============================================================
// PATTERN-MATCHED FUNCTIONS
// ============================================================

// ============================================================
// REGION: CLandBlockStruct + terrain (0x00530000 - 0x00536000)
// ============================================================

// --- FUN_00530000 at 0x00530000 ---


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



{

  int iVar1;

  

  iVar1 = FUN_00531f10();

  if (iVar1 + 4U <= param_3) {

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

    *param_2 = *param_2 + 4;

    FUN_00531f20(param_2,param_3);

  }

  return iVar1 + 4U;

}




// --- FUN_00530050 at 0x00530050 ---


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



{

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

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

  *param_2 = *param_2 + 4;

  FUN_00532d10(param_2,param_3);

  return 1;

}




// --- FUN_00530090 at 0x00530090 ---


void __fastcall FUN_00530090(int param_1)



{

  int iVar1;

  int iVar2;

  

  if (*(int *)(param_1 + 0x40) == 9) {

    iVar1 = 0;

    if (0 < *(int *)(param_1 + 0x48)) {

      do {

        iVar2 = 0;

        if (0 < *(int *)(param_1 + 0x48)) {

          do {

            FUN_0052c0a0();

            iVar2 = iVar2 + 1;

          } while (iVar2 < *(int *)(param_1 + 0x48));

        }

        iVar1 = iVar1 + 1;

      } while (iVar1 < *(int *)(param_1 + 0x48));

    }

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

  }

  return;

}




// --- FUN_005300f0 at 0x005300F0 ---


void __fastcall FUN_005300f0(int param_1)



{

  int iVar1;

  int iVar2;

  

  if ((*(int *)(param_1 + 0x48) == 8) && (*(int *)(param_1 + 0xe8) == 0)) {

    iVar1 = 0;

    do {

      iVar2 = 0;

      if (0 < *(int *)(param_1 + 0x48)) {

        do {

          FUN_0052c030();

          iVar2 = iVar2 + 1;

        } while (iVar2 < *(int *)(param_1 + 0x48));

      }

      iVar1 = iVar1 + 1;

    } while (iVar1 < *(int *)(param_1 + 0x48));

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

  }

  return;

}




// --- FUN_00530150 at 0x00530150 ---


void __fastcall FUN_00530150(int param_1)



{

  uint uVar1;

  int iVar2;

  

  uVar1 = 0;

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

    iVar2 = 0;

    do {

      *(int *)(*(int *)(param_1 + 0x90) + 0xf0 + iVar2) = param_1;

      uVar1 = uVar1 + 1;

      iVar2 = iVar2 + 0x108;

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

  }

  return;

}




// --- FUN_005301a0 at 0x005301A0 ---


void __fastcall FUN_005301a0(int param_1)



{

  FUN_0052eca0(*(undefined4 *)(param_1 + 0x120),*(undefined4 *)(param_1 + 0x124),param_1);

  return;

}




// --- FUN_005301c0 at 0x005301C0 ---


void __fastcall FUN_005301c0(int param_1)



{

  FUN_0052ece0(*(undefined4 *)(param_1 + 0x120),*(undefined4 *)(param_1 + 0x124));

  return;

}




// --- FUN_005301e0 at 0x005301E0 ---


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



{

  ulonglong uVar1;

  int iVar2;

  undefined4 uVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int local_8;

  int local_4;

  

  if (*(void **)(param_1 + 0x128) == (void *)0x0) {

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

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

    uVar3 = thunk_FUN_005df0f5(iVar2 * 4);

  }

  else {

    if ((uint)(*(int *)(param_1 + 0x48) * *(int *)(param_1 + 0x48)) <= *(uint *)(param_1 + 300))

    goto LAB_00530242;

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

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

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

    uVar3 = thunk_FUN_005df0f5(iVar2 * 4);

  }

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

LAB_00530242:

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

  if (iVar2 == 1) {

    **(undefined4 **)(param_1 + 0x128) = *(undefined4 *)(param_1 + 0x90);

    return 1;

  }

  uVar1 = 8 / (longlong)iVar2;

  switch(param_2) {

  case 0:

    local_8 = (int)((ulonglong)*param_3 / (uVar1 & 0xffffffff));

    local_4 = (int)((ulonglong)param_3[1] / (uVar1 & 0xffffffff));

    break;

  case 1:

    local_8 = (int)((ulonglong)*param_3 / (uVar1 & 0xffffffff));

    local_4 = 0;

    break;

  case 2:

    local_8 = (int)((ulonglong)*param_3 / (uVar1 & 0xffffffff));

    local_4 = iVar2 + -1;

    break;

  case 3:

    local_4 = (int)((ulonglong)param_3[1] / (uVar1 & 0xffffffff));

    local_8 = 0;

    break;

  case 4:

    local_4 = (int)((ulonglong)param_3[1] / (uVar1 & 0xffffffff));

    local_8 = iVar2 + -1;

    break;

  case 5:

    local_8 = iVar2 + -1;

    local_4 = 0;

    break;

  case 6:

    local_8 = iVar2 + -1;

    local_4 = local_8;

    break;

  case 7:

    local_8 = 0;

    local_4 = 0;

    break;

  case 8:

    local_4 = iVar2 + -1;

    local_8 = 0;

  }

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

  if ((local_8 == *(int *)(param_1 + 0xf4)) && (local_4 == *(int *)(param_1 + 0xf8))) {

    return 0;

  }

  *(int *)(param_1 + 0xf4) = local_8;

  *(int *)(param_1 + 0xf8) = local_4;

  if (local_4 < local_8) {

    iVar7 = (iVar2 - local_4) + -1;

    if (iVar7 < local_8) {

      iVar7 = local_8;

    }

  }

  else {

    iVar7 = (iVar2 - local_8) + -1;

    if (iVar7 < local_4) {

      iVar7 = local_4;

    }

  }

  param_3 = (uint *)(iVar2 * iVar2 + -1);

  iVar6 = 1;

  *(int *)(*(int *)(param_1 + 0x128) + (int)param_3 * 4) =

       (iVar2 * local_8 + local_4) * 0x108 + *(int *)(param_1 + 0x90);

  if (0 < iVar7) {

    do {

      iVar2 = 0;

      if (0 < iVar6) {

        do {

          iVar4 = 0;

          do {

            iVar5 = *(int *)((int)&DAT_0081f038 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081f018 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081eff8 + iVar4) + local_8;

            iVar9 = *(int *)((int)&DAT_0081efb8 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081efd8 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081ef98 + iVar4) + local_4;

            iVar8 = *(int *)(param_1 + 0x48) + -1;

            if ((((iVar5 <= iVar8) && (iVar9 <= iVar8)) && (-1 < iVar5)) && (-1 < iVar9)) {

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

              *(int *)(*(int *)(param_1 + 0x128) + (int)param_3 * 4) =

                   (*(int *)(param_1 + 0x48) * iVar5 + iVar9) * 0x108 + *(int *)(param_1 + 0x90);

            }

            iVar5 = *(int *)((int)&DAT_0081f03c + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081f01c + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081effc + iVar4) + local_8;

            iVar9 = *(int *)((int)&DAT_0081efbc + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081efdc + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081ef9c + iVar4) + local_4;

            iVar8 = *(int *)(param_1 + 0x48) + -1;

            if (((iVar5 <= iVar8) && (iVar9 <= iVar8)) && ((-1 < iVar5 && (-1 < iVar9)))) {

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

              *(int *)(*(int *)(param_1 + 0x128) + (int)param_3 * 4) =

                   (*(int *)(param_1 + 0x48) * iVar5 + iVar9) * 0x108 + *(int *)(param_1 + 0x90);

            }

            iVar5 = *(int *)((int)&DAT_0081f040 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081f020 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081f000 + iVar4) + local_8;

            iVar9 = *(int *)((int)&DAT_0081efc0 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081efe0 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081efa0 + iVar4) + local_4;

            iVar8 = *(int *)(param_1 + 0x48) + -1;

            if (((iVar5 <= iVar8) && (iVar9 <= iVar8)) && ((-1 < iVar5 && (-1 < iVar9)))) {

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

              *(int *)(*(int *)(param_1 + 0x128) + (int)param_3 * 4) =

                   (*(int *)(param_1 + 0x48) * iVar5 + iVar9) * 0x108 + *(int *)(param_1 + 0x90);

            }

            iVar5 = *(int *)((int)&DAT_0081f044 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081f024 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081f004 + iVar4) + local_8;

            iVar9 = *(int *)((int)&DAT_0081efc4 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081efe4 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081efa4 + iVar4) + local_4;

            iVar8 = *(int *)(param_1 + 0x48) + -1;

            if ((((iVar5 <= iVar8) && (iVar9 <= iVar8)) && (-1 < iVar5)) && (-1 < iVar9)) {

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

              *(int *)(*(int *)(param_1 + 0x128) + (int)param_3 * 4) =

                   (*(int *)(param_1 + 0x48) * iVar5 + iVar9) * 0x108 + *(int *)(param_1 + 0x90);

            }

            iVar4 = iVar4 + 0x10;

          } while (iVar4 < 0x20);

          iVar2 = iVar2 + 1;

        } while (iVar2 < iVar6);

      }

      iVar6 = iVar6 + 1;

    } while (iVar6 <= iVar7);

  }

  return 1;

}




// --- FUN_00530650 at 0x00530650 ---


void __thiscall FUN_00530650(int param_1,undefined4 param_2)



{

  int iVar1;

  

  if (*(uint *)(param_1 + 0x114) <= *(uint *)(param_1 + 0x104)) {

    FUN_00508200(*(uint *)(param_1 + 0x114) + 0x28);

  }

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

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

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

  return;

}




// --- FUN_00530690 at 0x00530690 ---


undefined4 * __fastcall FUN_00530690(undefined4 *param_1)



{

  FUN_00415460(DAT_00845b04);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007c6720;

  param_1[0xc] = &PTR_LAB_007c670c;

  FUN_00531b70();

  *param_1 = &PTR_LAB_007c9d88;

  param_1[0xc] = &PTR_LAB_007c9d70;

  param_1[0x28] = 0x3f800000;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  param_1[0x2b] = 0;

  param_1[0x35] = 0;

  param_1[0x36] = 0;

  param_1[0x37] = 0;

  FUN_00535b30();

  param_1[0x38] = 0;

  param_1[0x39] = 0;

  param_1[0x3a] = 0;

  param_1[0x3b] = 0;

  param_1[0x3f] = 0;

  param_1[0x40] = 0;

  param_1[0x41] = 0;

  param_1[0x3c] = 9;

  param_1[0x42] = 0;

  param_1[0x45] = 0;

  param_1[0x44] = 0;

  param_1[0x43] = 0x80;

  param_1[0x46] = 0;

  param_1[0x47] = 0;

  param_1[0x48] = 0;

  param_1[0x49] = 0;

  param_1[0x4a] = 0;

  param_1[0x4b] = 0;

  param_1[0x3d] = 0xffffffff;

  param_1[0x3e] = 0xffffffff;

  return param_1;

}




// --- FUN_00530790 at 0x00530790 ---


void __fastcall FUN_00530790(int param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  

  uVar2 = 0;

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

    do {

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

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

        FUN_005160a0();

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

      }

      uVar2 = uVar2 + 1;

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

  }

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

  return;

}




// --- FUN_005307e0 at 0x005307E0 ---


void __fastcall FUN_005307e0(int param_1)



{

  FUN_00530790();

  FUN_0052fe80();

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

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

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

  }

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

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

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

  *(undefined4 *)(param_1 + 0xf0) = 9;

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

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

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

  }

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

  return;

}




// --- FUN_00530850 at 0x00530850 ---


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



void FUN_00530850(void)



{

  _DAT_00845cb8 = 0;

  _DAT_00845cbc = 0x3f800000;

  _DAT_00845cc0 = 0x3f800000;

  _DAT_00845cc4 = 0x3f800000;

  _DAT_00845cc8 = 0x3f800000;

  _DAT_00845ccc = 0;

  _DAT_00845cd0 = 0;

  _DAT_00845cd4 = 0;

  return;

}




// --- FUN_005308b0 at 0x005308B0 ---


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



uint __thiscall FUN_005308b0(uint param_1,uint param_2,float *param_3)



{

  int iVar1;

  float fVar2;

  uint local_4;

  

  local_4 = param_1;

  FUN_00497d70(param_2,&local_4,&param_2);

  local_4 = local_4 & 0x80000007;

  if ((int)local_4 < 0) {

    local_4 = (local_4 - 1 | 0xfffffff8) + 1;

  }

  param_2 = param_2 & 0x80000007;

  if ((int)param_2 < 0) {

    param_2 = (param_2 - 1 | 0xfffffff8) + 1;

  }

  fVar2 = ((float)(int)param_2 + (float)(int)param_2 + _DAT_007938b0) * _DAT_00845b00;

  if (((float)(int)local_4 + (float)(int)local_4 + _DAT_007938b0) * _DAT_00845b00 < *param_3) {

    if (fVar2 < param_3[1]) {

      return (*(byte *)(*(int *)(param_1 + 0x54) + 0x14 + (param_2 + local_4 * 9) * 2) & 0x7c) >> 2;

    }

    return *(byte *)(*(int *)(param_1 + 0x54) + (param_2 + (local_4 + 1) * 9) * 2) >> 2 & 0x1f;

  }

  iVar1 = param_2 + local_4 * 8;

  if (fVar2 < param_3[1]) {

    return (*(byte *)(*(int *)(param_1 + 0x54) + 2 + (local_4 + iVar1) * 2) & 0x7c) >> 2;

  }

  return (*(byte *)(*(int *)(param_1 + 0x54) + (local_4 + iVar1) * 2) & 0x7c) >> 2;

}




// --- FUN_00530a30 at 0x00530A30 ---


void __fastcall FUN_00530a30(int *param_1)



{

  FUN_00530090();

  FUN_0052ece0(param_1[0x48],param_1[0x49]);

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

                    /* WARNING: Treating indirect jump as call */

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

  return;

}




// --- FUN_00530a60 at 0x00530A60 ---


uint __thiscall FUN_00530a60(uint param_1,uint param_2)



{

  uint uVar1;

  int iVar2;

  uint local_4;

  

  uVar1 = param_2;

  local_4 = param_1;

  FUN_00497d70(param_2,&param_2,&local_4);

  iVar2 = (*(int *)(param_1 + 0x48) * (param_2 & 7) + (local_4 & 7)) * 0x108;

  return iVar2 + *(int *)(param_1 + 0x90) &

         (*(uint *)(iVar2 + 0x28 + *(int *)(param_1 + 0x90)) != uVar1) - 1;

}




// --- FUN_00530ac0 at 0x00530AC0 ---


void __fastcall FUN_00530ac0(int param_1)



{

  undefined4 *puVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  int iVar4;

  uint local_60;

  uint local_5c;

  undefined4 local_58;

  undefined4 local_54;

  undefined4 local_50;

  undefined4 local_4c;

  uint local_44;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if (((*(int *)(param_1 + 0x48) == 8) && (*(int *)(param_1 + 0x100) != 0)) &&

     (*(int *)(param_1 + 0x11c) == 0)) {

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

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

    local_58 = 0;

    iVar4 = *(int *)(*(int *)(param_1 + 0x100) + 0x44);

    if (iVar4 != 0) {

      uVar2 = thunk_FUN_005df0f5(iVar4 << 2);

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

    }

    local_5c = 0;

    if (*(int *)(*(int *)(param_1 + 0x100) + 0x44) != 0) {

      do {

        puVar1 = *(undefined4 **)(*(int *)(*(int *)(param_1 + 0x100) + 0x48) + local_5c * 4);

        puVar3 = (undefined4 *)FUN_006b62e0(*puVar1,puVar1[0x12],puVar1[0x13],puVar1[0x11]);

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

          local_44 = *(uint *)(param_1 + 0x28);

          FUN_00425f10(puVar1 + 1);

          local_50 = local_8;

          local_4c = local_4;

          local_54 = local_c;

          local_60 = local_44;

          iVar4 = FUN_005aac70(&local_60,&local_54);

          iVar4 = FUN_00530a60(-(uint)(iVar4 != 0) & local_60);

          if (iVar4 == 0) {

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

          }

          else {

            FUN_00514c20(puVar1 + 1);

            FUN_006b6490(iVar4);

            *(undefined4 **)(*(int *)(param_1 + 0x11c) + *(int *)(param_1 + 0x118) * 4) = puVar3;

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

            FUN_006b60f0(param_1 + 0x124,&local_58,param_1 + 0x120);

          }

        }

        local_5c = local_5c + 1;

      } while (local_5c < *(uint *)(*(int *)(param_1 + 0x100) + 0x44));

    }

  }

  return;

}




// --- FUN_00530c30 at 0x00530C30 ---


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



void __fastcall FUN_00530c30(int param_1)



{

  int iVar1;

  uint uVar2;

  int local_50;

  float local_4c;

  float local_48;

  float local_44;

  undefined1 local_40 [52];

  float local_c;

  float local_8;

  float local_4;

  

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

    uVar2 = 0;

  }

  else {

    uVar2 = *(uint *)(*(int *)(param_1 + 0x100) + 0x38);

  }

  if (uVar2 < *(uint *)(param_1 + 0x104)) {

    do {

      iVar1 = *(int *)(*(int *)(param_1 + 0x108) + uVar2 * 4);

      if (iVar1 != 0) {

        FUN_00425f10(iVar1 + 0x50);

        local_4c = local_c;

        local_48 = local_8;

        local_44 = local_4;

        iVar1 = FUN_00533a30(&local_4c,&local_50);

        if (iVar1 != 0) {

          if (_DAT_007c9d6c < ABS(*(float *)(local_50 + 0x28))) {

            local_44 = -((local_4c * *(float *)(local_50 + 0x20) +

                          local_48 * *(float *)(local_50 + 0x24) + *(float *)(local_50 + 0x2c)) /

                        *(float *)(local_50 + 0x28));

          }

          if (_DAT_007c9d6c < ABS(local_44 - local_4)) {

            local_c = local_4c;

            local_8 = local_48;

            local_4 = local_44;

            FUN_00514c20(local_40);

          }

        }

      }

      uVar2 = uVar2 + 1;

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

  }

  return;

}




// --- FUN_00530d30 at 0x00530D30 ---


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



undefined4 __thiscall FUN_00530d30(int param_1,float *param_2)



{

  int iVar1;

  byte bVar2;

  byte bVar3;

  int iVar4;

  bool bVar5;

  float fVar6;

  float fVar7;

  float fVar8;

  float fVar9;

  int iVar10;

  int iVar11;

  ushort uVar12;

  

  fVar6 = DAT_007c9cf0;

  fVar9 = DAT_007c9cc0;

  fVar7 = DAT_007c9cf0 - DAT_007c9cc0;

  floor((double)(*param_2 / DAT_007c9cf0));

  iVar10 = FUN_005df4c4();

  floor((double)(param_2[1] / fVar6));

  iVar11 = FUN_005df4c4();

  iVar4 = *(int *)(param_1 + 0x54);

  iVar1 = iVar10 + iVar11 + iVar10 * 8;

  uVar12 = *(ushort *)(iVar4 + iVar1 * 2) & 3;

  if ((((uVar12 == 0) && ((*(byte *)(iVar4 + 2 + iVar1 * 2) & 3) == 0)) &&

      ((*(byte *)(iVar4 + 0x12 + iVar1 * 2) & 3) == 0)) &&

     ((*(byte *)(iVar4 + 0x14 + iVar1 * 2) & 3) == 0)) {

    return 0;

  }

  bVar2 = *(byte *)(iVar4 + 2 + iVar1 * 2);

  fVar8 = *param_2 - (float)iVar10 * fVar6;

  fVar6 = param_2[1] - (float)iVar11 * fVar6;

  if (uVar12 == 0) {

    bVar3 = *(byte *)(iVar4 + 0x12 + iVar1 * 2);

    if ((bVar2 & 3) == 0) {

      bVar2 = *(byte *)(iVar4 + 0x14 + iVar1 * 2);

      if ((bVar3 & 3) != 0) {

        if ((bVar2 & 3) != 0) {

          uVar12 = (ushort)(fVar8 < fVar7) << 8 | (ushort)(fVar8 == fVar7) << 0xe;

          goto LAB_00530e9a;

        }

        fVar6 = (_DAT_007c9de4 - fVar8) + fVar6;

        goto LAB_00530f58;

      }

      if ((bVar2 & 3) == 0) {

        return 0;

      }

      fVar8 = _DAT_007c9de0 - fVar8;

    }

    else {

      bVar2 = *(byte *)(iVar4 + 0x14 + iVar1 * 2);

      if ((bVar3 & 3) != 0) {

        if ((bVar2 & 3) != 0) {

          if (fVar7 < fVar8) {

            return 1;

          }

          goto LAB_00530edd;

        }

        fVar8 = (fVar6 + fVar8) - _DAT_007c9de4;

LAB_00530e90:

        uVar12 = (ushort)(fVar9 < ABS(fVar8)) << 8 | (ushort)(fVar9 == ABS(fVar8)) << 0xe;

LAB_00530e9a:

        if (uVar12 != 0) {

          return 0;

        }

        return 1;

      }

      if ((bVar2 & 3) != 0) {

        uVar12 = (ushort)(fVar6 < fVar7) << 8 | (ushort)(fVar6 == fVar7) << 0xe;

        goto LAB_00530e9a;

      }

      fVar8 = _DAT_007c9de4 + fVar8;

    }

    fVar6 = fVar8 - fVar6;

  }

  else {

    bVar3 = *(byte *)(iVar4 + 0x12 + iVar1 * 2);

    if ((bVar2 & 3) != 0) {

      bVar2 = *(byte *)(iVar4 + 0x14 + iVar1 * 2);

      if ((bVar3 & 3) != 0) {

        if ((bVar2 & 3) != 0) {

          return 1;

        }

        if (fVar8 < fVar9) {

          return 1;

        }

LAB_00530e20:

        if (fVar6 < fVar9) {

          return 1;

        }

        return 0;

      }

      bVar5 = fVar8 < fVar9;

      if ((bVar2 & 3) != 0) {

        if (bVar5) {

          return 1;

        }

LAB_00530edd:

        if (fVar7 < fVar6) {

          return 1;

        }

        return 0;

      }

      goto LAB_00530f5a;

    }

    bVar2 = *(byte *)(iVar4 + 0x14 + iVar1 * 2);

    if ((bVar3 & 3) == 0) {

      if ((bVar2 & 3) != 0) {

        fVar8 = fVar8 - fVar6;

        goto LAB_00530e90;

      }

      fVar6 = fVar6 + fVar8;

    }

    else if ((bVar2 & 3) != 0) {

      if (fVar7 < fVar8) {

        return 1;

      }

      goto LAB_00530e20;

    }

  }

LAB_00530f58:

  bVar5 = fVar6 < fVar9;

LAB_00530f5a:

  if (bVar5) {

    return 1;

  }

  return 0;

}




// --- FUN_00530f80 at 0x00530F80 ---


bool __fastcall FUN_00530f80(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  int *piVar3;

  uint uVar4;

  bool bVar5;

  

  bVar5 = true;

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

    uVar4 = *(uint *)(param_1 + 0x28) & 0xfffffffe | 0xfffe;

    uVar1 = FUN_004220b0(uVar4,2);

    iVar2 = thunk_FUN_00413a30(uVar1);

    if ((iVar2 != 2) && (iVar2 != 1)) {

      return false;

    }

    uVar1 = FUN_004220b0(uVar4,2);

    piVar3 = (int *)FUN_00415430(uVar1);

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

      iVar2 = FUN_0052f420();

      bVar5 = iVar2 != 0;

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

    }

  }

  return bVar5;

}




// --- FUN_00531000 at 0x00531000 ---


void __fastcall FUN_00531000(int param_1)



{

  FUN_0052ece0(*(undefined4 *)(param_1 + 0x120),*(undefined4 *)(param_1 + 0x124));

  FUN_00530090();

  FUN_00530790();

  FUN_0052fe80();

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

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

  return;

}




// --- thunk_FUN_005301e0 at 0x00531040 ---


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



{

  ulonglong uVar1;

  int iVar2;

  undefined4 uVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iStack_8;

  int iStack_4;

  

  if (*(void **)(param_1 + 0x128) == (void *)0x0) {

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

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

    uVar3 = thunk_FUN_005df0f5(iVar2 * 4);

  }

  else {

    if ((uint)(*(int *)(param_1 + 0x48) * *(int *)(param_1 + 0x48)) <= *(uint *)(param_1 + 300))

    goto LAB_00530242;

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

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

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

    uVar3 = thunk_FUN_005df0f5(iVar2 * 4);

  }

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

LAB_00530242:

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

  if (iVar2 == 1) {

    **(undefined4 **)(param_1 + 0x128) = *(undefined4 *)(param_1 + 0x90);

    return 1;

  }

  uVar1 = 8 / (longlong)iVar2;

  switch(param_2) {

  case 0:

    iStack_8 = (int)((ulonglong)*param_3 / (uVar1 & 0xffffffff));

    iStack_4 = (int)((ulonglong)param_3[1] / (uVar1 & 0xffffffff));

    break;

  case 1:

    iStack_8 = (int)((ulonglong)*param_3 / (uVar1 & 0xffffffff));

    iStack_4 = 0;

    break;

  case 2:

    iStack_8 = (int)((ulonglong)*param_3 / (uVar1 & 0xffffffff));

    iStack_4 = iVar2 + -1;

    break;

  case 3:

    iStack_4 = (int)((ulonglong)param_3[1] / (uVar1 & 0xffffffff));

    iStack_8 = 0;

    break;

  case 4:

    iStack_4 = (int)((ulonglong)param_3[1] / (uVar1 & 0xffffffff));

    iStack_8 = iVar2 + -1;

    break;

  case 5:

    iStack_8 = iVar2 + -1;

    iStack_4 = 0;

    break;

  case 6:

    iStack_8 = iVar2 + -1;

    iStack_4 = iStack_8;

    break;

  case 7:

    iStack_8 = 0;

    iStack_4 = 0;

    break;

  case 8:

    iStack_4 = iVar2 + -1;

    iStack_8 = 0;

  }

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

  if ((iStack_8 == *(int *)(param_1 + 0xf4)) && (iStack_4 == *(int *)(param_1 + 0xf8))) {

    return 0;

  }

  *(int *)(param_1 + 0xf4) = iStack_8;

  *(int *)(param_1 + 0xf8) = iStack_4;

  if (iStack_4 < iStack_8) {

    iVar7 = (iVar2 - iStack_4) + -1;

    if (iVar7 < iStack_8) {

      iVar7 = iStack_8;

    }

  }

  else {

    iVar7 = (iVar2 - iStack_8) + -1;

    if (iVar7 < iStack_4) {

      iVar7 = iStack_4;

    }

  }

  param_3 = (uint *)(iVar2 * iVar2 + -1);

  iVar6 = 1;

  *(int *)(*(int *)(param_1 + 0x128) + (int)param_3 * 4) =

       (iVar2 * iStack_8 + iStack_4) * 0x108 + *(int *)(param_1 + 0x90);

  if (0 < iVar7) {

    do {

      iVar2 = 0;

      if (0 < iVar6) {

        do {

          iVar4 = 0;

          do {

            iVar5 = *(int *)((int)&DAT_0081f038 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081f018 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081eff8 + iVar4) + iStack_8;

            iVar9 = *(int *)((int)&DAT_0081efb8 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081efd8 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081ef98 + iVar4) + iStack_4;

            iVar8 = *(int *)(param_1 + 0x48) + -1;

            if ((((iVar5 <= iVar8) && (iVar9 <= iVar8)) && (-1 < iVar5)) && (-1 < iVar9)) {

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

              *(int *)(*(int *)(param_1 + 0x128) + (int)param_3 * 4) =

                   (*(int *)(param_1 + 0x48) * iVar5 + iVar9) * 0x108 + *(int *)(param_1 + 0x90);

            }

            iVar5 = *(int *)((int)&DAT_0081f03c + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081f01c + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081effc + iVar4) + iStack_8;

            iVar9 = *(int *)((int)&DAT_0081efbc + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081efdc + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081ef9c + iVar4) + iStack_4;

            iVar8 = *(int *)(param_1 + 0x48) + -1;

            if (((iVar5 <= iVar8) && (iVar9 <= iVar8)) && ((-1 < iVar5 && (-1 < iVar9)))) {

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

              *(int *)(*(int *)(param_1 + 0x128) + (int)param_3 * 4) =

                   (*(int *)(param_1 + 0x48) * iVar5 + iVar9) * 0x108 + *(int *)(param_1 + 0x90);

            }

            iVar5 = *(int *)((int)&DAT_0081f040 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081f020 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081f000 + iVar4) + iStack_8;

            iVar9 = *(int *)((int)&DAT_0081efc0 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081efe0 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081efa0 + iVar4) + iStack_4;

            iVar8 = *(int *)(param_1 + 0x48) + -1;

            if (((iVar5 <= iVar8) && (iVar9 <= iVar8)) && ((-1 < iVar5 && (-1 < iVar9)))) {

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

              *(int *)(*(int *)(param_1 + 0x128) + (int)param_3 * 4) =

                   (*(int *)(param_1 + 0x48) * iVar5 + iVar9) * 0x108 + *(int *)(param_1 + 0x90);

            }

            iVar5 = *(int *)((int)&DAT_0081f044 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081f024 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081f004 + iVar4) + iStack_8;

            iVar9 = *(int *)((int)&DAT_0081efc4 + iVar4) * iVar2 +

                    *(int *)((int)&DAT_0081efe4 + iVar4) * iVar6 +

                    *(int *)((int)&DAT_0081efa4 + iVar4) + iStack_4;

            iVar8 = *(int *)(param_1 + 0x48) + -1;

            if ((((iVar5 <= iVar8) && (iVar9 <= iVar8)) && (-1 < iVar5)) && (-1 < iVar9)) {

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

              *(int *)(*(int *)(param_1 + 0x128) + (int)param_3 * 4) =

                   (*(int *)(param_1 + 0x48) * iVar5 + iVar9) * 0x108 + *(int *)(param_1 + 0x90);

            }

            iVar4 = iVar4 + 0x10;

          } while (iVar4 < 0x20);

          iVar2 = iVar2 + 1;

        } while (iVar2 < iVar6);

      }

      iVar6 = iVar6 + 1;

    } while (iVar6 <= iVar7);

  }

  return 1;

}




// --- FUN_00531050 at 0x00531050 ---


void __fastcall FUN_00531050(int param_1)



{

  ushort uVar1;

  uint uVar2;

  int iVar3;

  undefined4 *puVar4;

  uint uVar5;

  ushort uVar6;

  int local_58;

  uint local_54;

  int local_50;

  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;

  

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

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

  local_54 = 0;

  if (uVar2 != 0) {

    local_50 = 0;

    do {

      uVar5 = 0;

      if (uVar2 != 0) {

        local_58 = local_50;

        do {

          puVar4 = (undefined4 *)

                   ((*(int *)(param_1 + 0x40) * local_54 + uVar5) * DAT_0081f710 +

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

          local_c = *puVar4;

          local_8 = puVar4[1];

          local_4 = puVar4[2];

          local_44 = *(undefined4 *)

                      ((uVar2 * local_54 + uVar5) * 0x108 + 0x28 + *(int *)(param_1 + 0x90));

          uVar1 = *(ushort *)(*(int *)(param_1 + 0x54) + local_58);

          uVar6 = uVar1 >> 2 & 0x1f;

          uVar2 = (uint)(uVar1 >> 0xb);

          iVar3 = FUN_004ff3e0(uVar6);

          if (((int)uVar2 < iVar3) && (iVar3 = FUN_004ff530(uVar6,uVar2), iVar3 != 0)) {

            FUN_00552230(iVar3,&local_48);

          }

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

          uVar5 = uVar5 + 1;

          local_58 = local_58 + 2;

        } while (uVar5 < uVar2);

      }

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

      local_54 = local_54 + 1;

      local_50 = local_50 + 0x12;

    } while (local_54 < uVar2);

  }

  return;

}




// --- FUN_005311a0 at 0x005311A0 ---


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



void __fastcall FUN_005311a0(int param_1)



{

  float fVar1;

  float fVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  int *piVar6;

  undefined4 *puVar7;

  int iVar8;

  int iVar9;

  ushort uVar10;

  int *piVar11;

  uint uStack_a4;

  float fStack_a0;

  float fStack_9c;

  undefined4 uStack_98;

  int local_94;

  uint local_90;

  int local_8c;

  int local_88;

  int iStack_84;

  int local_80;

  int local_7c;

  uint uStack_78;

  undefined4 uStack_74;

  int iStack_70;

  int *piStack_6c;

  int iStack_68;

  int iStack_64;

  int iStack_60;

  int iStack_5c;

  undefined **ppuStack_58;

  int iStack_54;

  undefined4 uStack_50;

  int iStack_4c;

  int iStack_48;

  int iStack_44;

  float fStack_1c;

  float fStack_18;

  int iStack_14;

  

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

    DAT_00845c18 = DAT_00845c18 | 1;

    _DAT_00845bd8 = 0x3f800000;

    _DAT_00845bdc = 0;

    _DAT_00845be0 = 0;

    _DAT_00845be4 = 0;

    _DAT_00845c0c = 0;

    _DAT_00845c10 = 0;

    _DAT_00845c14 = 0;

    FUN_00535b30();

    _atexit((_func_4879 *)&DAT_0076a230);

  }

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

    DAT_00845c18 = DAT_00845c18 | 2;

    _DAT_00845b90 = &PTR_LAB_00797910;

    _DAT_00845b94 = 0;

    _DAT_00845b98 = 0x3f800000;

    _DAT_00845b9c = 0;

    _DAT_00845ba0 = 0;

    _DAT_00845ba4 = 0;

    _DAT_00845bcc = 0;

    _DAT_00845bd0 = 0;

    _DAT_00845bd4 = 0;

    FUN_00535b30();

    _atexit((_func_4879 *)&LAB_0076a410);

  }

  local_88 = DAT_0084247c;

  if (DAT_0084247c != 0) {

    iVar8 = *(int *)(param_1 + 0x40);

    local_8c = 0;

    if (0 < iVar8) {

      local_7c = 0;

      do {

        local_94 = 0;

        if (0 < iVar8) {

          local_80 = local_7c;

          do {

            uVar10 = *(ushort *)(local_80 + *(int *)(param_1 + 0x54));

            uVar3 = (uint)(uVar10 >> 0xb);

            uVar10 = uVar10 >> 2 & 0x1f;

            local_90 = uVar3;

            uVar4 = FUN_004ff3e0();

            if ((uVar3 < uVar4) && (uVar3 = FUN_004ff3f0(uVar10,uVar3), uVar3 != 0)) {

              iVar8 = *(int *)(param_1 + 0x98) + local_8c;

              iVar9 = *(int *)(param_1 + 0x9c) + local_94;

              if (uVar3 == 1) {

LAB_00531393:

                uVar4 = 0;

              }

              else {

                iVar5 = (iVar8 * 0x2a7f2b89 + 0x6c1ac587) * iVar9 + iVar8 * -0x421be3bd + 0x7f8cda01

                ;

                fVar1 = (float)iVar5;

                if (iVar5 < 0) {

                  fVar1 = fVar1 + _DAT_0079920c;

                }

                fVar2 = (float)(int)uVar3;

                if ((int)uVar3 < 0) {

                  fVar2 = fVar2 + _DAT_0079920c;

                }

                uStack_78 = uVar3;

                floor((double)(fVar2 * fVar1 * _DAT_007c6f10));

                uVar4 = FUN_005df4c4();

                if (uVar3 <= uVar4) goto LAB_00531393;

              }

              FUN_004ff570(&iStack_5c,uVar10,local_90,uVar4);

              if (iStack_5c != DAT_00845b04) {

                FUN_004220b0(iStack_5c,0x1b);

                piVar6 = (int *)FUN_00415430();

                piStack_6c = piVar6;

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

                  uStack_a4 = 0;

                  if (piVar6[0xf] != 0) {

                    iStack_84 = 0;

                    iStack_60 = iVar9 * 0x6c1ac587;

                    uStack_78 = iVar9 * iVar8 * 0x5111bfef + 0x70892fb7;

                    iStack_64 = iVar8 * -0x421be3bd;

                    local_90 = uStack_78 * 0x5b67;

                    do {

                      piVar11 = (int *)(piVar6[0x10] + iStack_84);

                      iStack_70 = (iStack_60 - local_90) + iStack_64;

                      fVar1 = (float)iStack_70;

                      if (iStack_70 < 0) {

                        fVar1 = fVar1 + _DAT_0079920c;

                      }

                      if ((fVar1 * _DAT_007c6f10 < (float)piVar11[0x11]) && (piVar11[0x1b] == 0)) {

                        iStack_70 = *piVar11;

                        FUN_005a6cc0(iVar8,iVar9,uStack_a4,&fStack_a0);

                        fStack_a0 = (float)local_8c * DAT_007c9cf0 + fStack_a0;

                        fStack_9c = (float)local_94 * DAT_007c9cf0 + fStack_9c;

                        if (((DAT_00796344 <= fStack_a0) &&

                            (((DAT_00796344 <= fStack_9c && (fStack_a0 < _DAT_00845afc)) &&

                             (fStack_9c < _DAT_00845afc)))) && (iVar5 = FUN_00530d30(), iVar5 == 0))

                        {

                          ppuStack_58 = &PTR_LAB_00797910;

                          uStack_50 = 0x3f800000;

                          iStack_54 = iVar5;

                          iStack_4c = iVar5;

                          iStack_48 = iVar5;

                          iStack_44 = iVar5;

                          fStack_1c = (float)iVar5;

                          fStack_18 = (float)iVar5;

                          iStack_14 = iVar5;

                          FUN_00535b30();

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

                          fStack_18 = fStack_9c;

                          fStack_1c = fStack_a0;

                          iStack_14 = uStack_98;

                          FUN_004527f0();

                          uStack_74 = FUN_00530a60();

                          iVar5 = FUN_00534d40();

                          if (((iVar5 == 0) &&

                              (iVar5 = FUN_00533a30(&fStack_a0,&iStack_68), iVar5 != 0)) &&

                             (iVar5 = FUN_0052fdd0(), iVar5 != 0)) {

                            iVar5 = iStack_68 + 0x20;

                            FUN_0052fd90();

                            if (piVar11[0x19] == 0) {

                              FUN_005a6e60(iVar8,iVar9,uStack_a4,&fStack_a0,&DAT_00845bd8);

                            }

                            else {

                              FUN_005a6f60(iVar5,&fStack_a0,&DAT_00845bd8);

                            }

                            puVar7 = (undefined4 *)FUN_00514470(iStack_70);

                            piVar6 = piStack_6c;

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

                              FUN_00514c20();

                              iVar5 = FUN_00511b00();

                              if (iVar5 == 0) {

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

                                piVar6 = piStack_6c;

                              }

                              else {

                                FUN_005164e0(uStack_74,&DAT_00845bd8);

                                FUN_0052fe00(iVar8,iVar9,uStack_a4);

                                FUN_00512680();

                                FUN_00530650();

                                piVar6 = piStack_6c;

                              }

                            }

                          }

                          ppuStack_58 = &PTR_FUN_0079385c;

                        }

                      }

                      local_90 = local_90 + uStack_78;

                      uStack_a4 = uStack_a4 + 1;

                      iStack_84 = iStack_84 + 0x70;

                    } while (uStack_a4 < (uint)piVar6[0xf]);

                  }

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

                }

              }

            }

            local_94 = local_94 + 1;

            local_80 = local_80 + 2;

          } while (local_94 < *(int *)(param_1 + 0x40));

        }

        iVar8 = *(int *)(param_1 + 0x40);

        local_8c = local_8c + 1;

        local_7c = local_7c + 0x12;

      } while (local_8c < iVar8);

    }

  }

  return;

}




// --- FUN_00531720 at 0x00531720 ---


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



{

  *param_1 = &PTR_LAB_007c9d88;

  param_1[0xc] = &PTR_LAB_007c9d70;

  FUN_005307e0();

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

  param_1[0x42] = 0;

  FUN_005334f0();

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

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

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_00531780 at 0x00531780 ---


void __fastcall FUN_00531780(int param_1)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  uint local_58;

  undefined4 local_54;

  undefined4 local_50;

  undefined4 local_4c;

  uint local_44;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

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

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

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

      if (iVar2 != 0) {

        uVar5 = 0;

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

          iVar6 = 0;

          do {

            puVar3 = (undefined4 *)

                     FUN_00514470(*(undefined4 *)(*(int *)(iVar2 + 0x3c) + uVar5 * 4),0,0);

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

              local_44 = *(uint *)(param_1 + 0x28);

              FUN_00425f10(*(int *)(*(int *)(param_1 + 0x100) + 0x40) + iVar6);

              local_50 = local_8;

              local_4c = local_4;

              local_54 = local_c;

              local_58 = local_44;

              iVar2 = FUN_005aac70(&local_58,&local_54);

              iVar2 = FUN_00530a60(-(uint)(iVar2 != 0) & local_58);

              if (iVar2 == 0) {

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

              }

              else {

                FUN_005164e0(iVar2,*(int *)(*(int *)(param_1 + 0x100) + 0x40) + iVar6);

                FUN_00530650(puVar3);

              }

            }

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

            uVar5 = uVar5 + 1;

            iVar6 = iVar6 + 0x40;

          } while (uVar5 < *(uint *)(iVar2 + 0x38));

        }

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

        if (0 < iVar2) {

          iVar6 = 0;

          do {

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

            iVar4 = FUN_0052fbd0(*(undefined4 *)(iVar1 + 0x28 + iVar6));

            if (iVar4 != 0) {

              *(int *)(iVar1 + iVar6 + 0xd8) = iVar4;

            }

            iVar6 = iVar6 + 0x108;

            iVar2 = iVar2 + -1;

          } while (iVar2 != 0);

        }

      }

      if (DAT_0081ef08 != 0) {

        FUN_005311a0();

      }

    }

    else {

      FUN_00530c30();

      uVar5 = 0;

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

        do {

          if ((*(int *)(*(int *)(param_1 + 0x108) + uVar5 * 4) != 0) &&

             (iVar2 = FUN_00511d90(), iVar2 == 0)) {

            FUN_00515c60();

          }

          uVar5 = uVar5 + 1;

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

      }

    }

    if (*(uint *)(param_1 + 0x104) < *(uint *)(param_1 + 0x114)) {

      FUN_00508290(*(uint *)(param_1 + 0x104));

    }

  }

  return;

}




// --- FUN_00531930 at 0x00531930 ---


int __thiscall FUN_00531930(int param_1,int param_2)



{

  return param_2 * 0x58 + *(int *)(param_1 + 0x3c);

}




// --- FUN_00531940 at 0x00531940 ---


int __fastcall FUN_00531940(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  undefined4 local_4;

  

  uVar3 = 0;

  local_4 = 0;

  iVar2 = 4;

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

    do {

      iVar1 = FUN_00534760(&local_4,0);

      iVar2 = iVar2 + iVar1;

      uVar3 = uVar3 + 1;

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

  }

  return iVar2;

}




// --- FUN_00531990 at 0x00531990 ---


undefined4 * __fastcall FUN_00531990(undefined4 *param_1)



{

  FUN_00415460(DAT_00845c38);

  param_1[0xc] = &PTR_FUN_0079385c;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  *param_1 = &PTR_LAB_007c9e18;

  param_1[0xc] = &PTR_LAB_007c9e00;

  return param_1;

}




// --- FUN_00531a30 at 0x00531A30 ---


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



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  uint uVar4;

  

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

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

  *param_2 = *param_2 + 4;

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

  piVar1 = (int *)thunk_FUN_005df0f5(iVar3 * 0x58 + 4);

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

    piVar2 = (int *)0x0;

  }

  else {

    piVar2 = piVar1 + 1;

    *piVar1 = iVar3;

    if (-1 < iVar3 + -1) {

      do {

        FUN_005345b0();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

  }

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

  uVar4 = 0;

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

    do {

      FUN_00534a40(param_2,param_3);

      uVar4 = uVar4 + 1;

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

  }

  return 1;

}




// --- FUN_00531ae0 at 0x00531AE0 ---


void __fastcall FUN_00531ae0(int param_1)



{

  int iVar1;

  int iVar2;

  

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

  if (iVar1 == 0) {

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

    return;

  }

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

  if (-1 < iVar2 + -1) {

    do {

      FUN_00534cd0();

      iVar2 = iVar2 + -1;

    } while (iVar2 != 0);

  }

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

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

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

  return;

}




// --- FUN_00531b30 at 0x00531B30 ---


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



{

  *param_1 = &PTR_LAB_007c9e18;

  param_1[0xc] = &PTR_LAB_007c9e00;

  FUN_00531ae0();

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

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

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_00531b70 at 0x00531B70 ---


undefined4 * __fastcall FUN_00531b70(undefined4 *param_1)



{

  undefined4 uVar1;

  

  *param_1 = 0;

  param_1[1] = 9;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  FUN_0053cd10();

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  uVar1 = thunk_FUN_005df0f5(0x51);

  param_1[6] = uVar1;

  uVar1 = thunk_FUN_005df0f5(0xa2);

  param_1[7] = uVar1;

  param_1[0x15] = 0xffffffff;

  return param_1;

}




// --- FUN_00531bd0 at 0x00531BD0 ---


void __fastcall FUN_00531bd0(undefined4 *param_1)



{

  int iVar1;

  int *piVar2;

  undefined4 uVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int *piVar9;

  int iVar10;

  

  iVar8 = param_1[3] * param_1[3];

  iVar4 = param_1[2] * param_1[2];

  iVar6 = param_1[4] * param_1[4];

  FUN_0053cb90(iVar4,1);

  iVar10 = 0;

  if (0 < (int)param_1[2]) {

    do {

      iVar7 = 0;

      if (0 < (int)param_1[2]) {

        do {

          iVar5 = param_1[2] * iVar10 + iVar7;

          iVar1 = DAT_0081f710 * iVar5 + param_1[0x11];

          *(short *)(iVar1 + 0xc) = (short)iVar5;

          *(undefined2 *)(iVar1 + 0xe) = 4;

          *(undefined **)(iVar1 + 0x10) = &DAT_00845cb8;

          iVar7 = iVar7 + 1;

        } while (iVar7 < (int)param_1[2]);

      }

      iVar10 = iVar10 + 1;

    } while (iVar10 < (int)param_1[2]);

  }

  iVar10 = iVar8 * 2;

  piVar2 = (int *)thunk_FUN_005df0f5(iVar8 * 0x60 + 4);

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

    piVar2 = (int *)0x0;

  }

  else {

    *piVar2 = iVar10;

    piVar2 = piVar2 + 1;

    if (-1 < iVar10 + -1) {

      do {

        FUN_005390e0();

        iVar10 = iVar10 + -1;

      } while (iVar10 != 0);

    }

  }

  param_1[0x12] = piVar2;

  iVar10 = 0;

  if (0 < iVar8 * 2) {

    iVar7 = 0;

    do {

      *(undefined1 *)(iVar7 + 0xe + param_1[0x12]) = 3;

      *(short *)(iVar7 + 0xc + param_1[0x12]) = (short)iVar10;

      uVar3 = thunk_FUN_005df0f5(0xc);

      *(undefined4 *)(iVar7 + param_1[0x12]) = uVar3;

      uVar3 = thunk_FUN_005df0f5(6);

      *(undefined4 *)(iVar7 + 4 + param_1[0x12]) = uVar3;

      *(undefined4 *)(iVar7 + 0x10 + param_1[0x12]) = 0;

      if (param_1[0xf] == 1) {

        uVar3 = thunk_FUN_005df0f5(3);

        *(undefined4 *)(iVar7 + 0x14 + param_1[0x12]) = uVar3;

        *(undefined4 *)(iVar7 + 0x18 + param_1[0x12]) = 0;

        uVar3 = thunk_FUN_005df0f5(0xc);

        *(undefined4 *)(iVar7 + 8 + param_1[0x12]) = uVar3;

      }

      iVar10 = iVar10 + 1;

      iVar7 = iVar7 + 0x30;

    } while (iVar10 < iVar8 * 2);

  }

  uVar3 = thunk_FUN_005df0f5(iVar8 * 4);

  param_1[0x17] = uVar3;

  piVar2 = (int *)thunk_FUN_005df0f5(iVar6 * 0x108 + 4);

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

    piVar9 = (int *)0x0;

  }

  else {

    piVar9 = piVar2 + 1;

    *piVar2 = iVar6;

    if (-1 < iVar6 + -1) {

      do {

        FUN_005339b0();

        iVar6 = iVar6 + -1;

      } while (iVar6 != 0);

    }

  }

  param_1[0x16] = piVar9;

  uVar3 = thunk_FUN_005df0f5(iVar4 * 0xc);

  *param_1 = uVar3;

  return;

}




// --- FUN_00531e10 at 0x00531E10 ---


int __thiscall FUN_00531e10(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  int *piVar1;

  int iVar2;

  

  param_2 = param_2 * 0x30;

  **(int **)(param_2 + *(int *)(param_1 + 0x48)) = DAT_0081f710 * param_3 + *(int *)(param_1 + 0x44)

  ;

  **(undefined2 **)(*(int *)(param_1 + 0x48) + 4 + param_2) = (short)param_3;

  *(int *)(*(int *)(*(int *)(param_1 + 0x48) + param_2) + 4) =

       DAT_0081f710 * param_4 + *(int *)(param_1 + 0x44);

  *(short *)(*(int *)(*(int *)(param_1 + 0x48) + 4 + param_2) + 2) = (short)param_4;

  *(int *)(*(int *)(*(int *)(param_1 + 0x48) + param_2) + 8) =

       DAT_0081f710 * param_5 + *(int *)(param_1 + 0x44);

  *(short *)(*(int *)(*(int *)(param_1 + 0x48) + 4 + param_2) + 4) = (short)param_5;

  FUN_00539110();

  *(undefined2 *)(*(int *)(param_1 + 0x48) + 0x1c + param_2) = 0;

  piVar1 = *(int **)(*(int *)(param_1 + 0x48) + param_2);

  iVar2 = *(int *)(param_1 + 0x48) + param_2;

  if (((*(float *)(*piVar1 + 8) == DAT_00796344) && (*(float *)(piVar1[1] + 8) == DAT_00796344)) &&

     (*(float *)(piVar1[2] + 8) == DAT_00796344)) {

    *(undefined2 *)(iVar2 + 0x1c) = 0;

    return *(int *)(param_1 + 0x48) + param_2;

  }

  *(undefined2 *)(iVar2 + 0x1c) = 1;

  return *(int *)(param_1 + 0x48) + param_2;

}




// --- FUN_00531f10 at 0x00531F10 ---


undefined4 FUN_00531f10(void)



{

  return 0xf4;

}




// --- FUN_00531f20 at 0x00531F20 ---


undefined4 __thiscall FUN_00531f20(int param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  undefined1 *puVar3;

  uint uVar4;

  

  iVar2 = 6;

  do {

    *(undefined2 *)*param_2 = *(undefined2 *)(iVar2 + -6 + *(int *)(param_1 + 0x1c));

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar1 + 2) = *(undefined2 *)(iVar2 + -4 + *(int *)(param_1 + 0x1c));

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar1 + 2) = *(undefined2 *)(iVar2 + -2 + *(int *)(param_1 + 0x1c));

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar1 + 2) = *(undefined2 *)(iVar2 + *(int *)(param_1 + 0x1c));

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar1 + 2) = *(undefined2 *)(iVar2 + 2 + *(int *)(param_1 + 0x1c));

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar1 + 2) = *(undefined2 *)(iVar2 + 4 + *(int *)(param_1 + 0x1c));

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar1 + 2) = *(undefined2 *)(iVar2 + 6 + *(int *)(param_1 + 0x1c));

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar1 + 2) = *(undefined2 *)(iVar2 + 8 + *(int *)(param_1 + 0x1c));

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar1 + 2) = *(undefined2 *)(iVar2 + 10 + *(int *)(param_1 + 0x1c));

    iVar2 = iVar2 + 0x12;

    *param_2 = *param_2 + 2;

  } while (iVar2 < 0xa8);

  iVar2 = 0;

  do {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(iVar1 + 1) = *(undefined1 *)(iVar2 + 1 + *(int *)(param_1 + 0x18));

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(iVar1 + 1) = *(undefined1 *)(iVar2 + 2 + *(int *)(param_1 + 0x18));

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(iVar1 + 1) = *(undefined1 *)(iVar2 + 3 + *(int *)(param_1 + 0x18));

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(iVar1 + 1) = *(undefined1 *)(iVar2 + 4 + *(int *)(param_1 + 0x18));

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(iVar1 + 1) = *(undefined1 *)(iVar2 + 5 + *(int *)(param_1 + 0x18));

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(iVar1 + 1) = *(undefined1 *)(iVar2 + 6 + *(int *)(param_1 + 0x18));

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(iVar1 + 1) = *(undefined1 *)(iVar2 + 7 + *(int *)(param_1 + 0x18));

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(iVar1 + 1) = *(undefined1 *)(iVar2 + 8 + *(int *)(param_1 + 0x18));

    puVar3 = (undefined1 *)(*param_2 + 1);

    iVar2 = iVar2 + 9;

    *param_2 = (int)puVar3;

  } while (iVar2 < 0x51);

  uVar4 = (uint)puVar3 & 0x80000003;

  if ((int)uVar4 < 0) {

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

  }

  if (uVar4 != 0) {

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

      *puVar3 = 0;

      puVar3 = (undefined1 *)(*param_2 + 1);

      *param_2 = (int)puVar3;

    }

  }

  return 0;

}




// --- FUN_005320c0 at 0x005320C0 ---


void __fastcall FUN_005320c0(int param_1)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  

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

  uVar2 = 0;

  if (uVar3 != 0) {

    do {

      uVar1 = 0;

      if (uVar3 != 0) {

        do {

          uVar3 = 0;

          do {

            FUN_00539110();

            uVar3 = uVar3 + 1;

          } while (uVar3 < 2);

          uVar1 = uVar1 + 1;

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

      }

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

      uVar2 = uVar2 + 1;

    } while (uVar2 < uVar3);

  }

  return;

}




// --- FUN_00532120 at 0x00532120 ---


void __fastcall FUN_00532120(int param_1)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  

  if (DAT_0084247c != 0) {

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

    uVar2 = 0;

    if (uVar1 != 0) {

      do {

        uVar3 = 0;

        if (uVar1 != 0) {

          do {

            uVar1 = (uint)*(ushort *)

                           (**(int **)((uVar1 * uVar2 + uVar3) * 0x108 + 0x100 +

                                      *(int *)(param_1 + 0x58)) + 0x1c);

            FUN_006b5980(uVar1);

            FUN_00503950(uVar1);

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

            uVar3 = uVar3 + 1;

          } while (uVar3 < uVar1);

        }

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

        uVar2 = uVar2 + 1;

      } while (uVar2 < uVar1);

    }

  }

  return;

}




// --- FUN_00532190 at 0x00532190 ---


void __fastcall FUN_00532190(undefined4 *param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  

  if ((param_1[0xf] == 1) && (iVar2 = 0, 0 < (int)param_1[0x10])) {

    do {

      *(undefined4 *)(DAT_0081f710 * iVar2 + 0x10 + param_1[0x11]) = 0;

      iVar2 = iVar2 + 1;

    } while (iVar2 < (int)param_1[0x10]);

  }

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

    FUN_00532120();

    piVar1 = (int *)param_1[0x16];

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

      if (piVar1[-1] == 0) {

        operator_delete__(piVar1 + -1);

      }

      else {

        (**(code **)(*piVar1 + 0x18))(3);

      }

    }

    param_1[0x16] = 0;

  }

  iVar2 = param_1[0x12];

  if (iVar2 != 0) {

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

    if (-1 < iVar3 + -1) {

      do {

        FUN_00538e20();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

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

    param_1[0x12] = 0;

  }

  FUN_0053cc10();

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

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

    param_1[0x17] = 0;

  }

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

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

    param_1[0x14] = 0;

  }

  param_1[0x13] = 0;

  param_1[4] = 0;

  param_1[1] = 9;

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

    operator_delete__((void *)*param_1);

    *param_1 = 0;

  }

  return;

}




// --- FUN_00532290 at 0x00532290 ---


void __thiscall

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



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  *param_4 = 0;

  *param_5 = 1;

  if (param_2 <= param_2 + 1) {

    iVar3 = (param_3 + param_2 * 9) * 2;

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

    do {

      if (param_3 <= param_3 + 1) {

        iVar1 = ((param_3 + 1) - param_3) + 1;

        iVar2 = iVar3;

        do {

          if (*(int *)(&DAT_007c9ec0 + (*(byte *)(iVar2 + *(int *)(param_1 + 0x1c)) >> 2 & 0x1f) * 4

                      ) == 1) {

            *param_4 = 1;

          }

          else {

            *param_5 = 0;

          }

          iVar2 = iVar2 + 2;

          iVar1 = iVar1 + -1;

        } while (iVar1 != 0);

      }

      iVar3 = iVar3 + 0x12;

      param_2 = param_2 + -1;

    } while (param_2 != 0);

  }

  return;

}




// --- FUN_00532330 at 0x00532330 ---


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



float10 __thiscall FUN_00532330(uint param_1,uint param_2,float *param_3)



{

  byte bVar1;

  float fVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  

  iVar3 = FUN_00497c80(param_2);

  uVar5 = param_1;

  if ((iVar3 != 0) && (uVar4 = param_2 & 0xffff, uVar4 < 0x100)) {

    param_2 = param_2 - 1 & 7;

    uVar5 = uVar4 - 1 >> 3;

  }

  fVar2 = ((float)(int)param_2 + (float)(int)param_2 + _DAT_007938b0) * _DAT_00845c9c;

  if (*param_3 <= ((float)(int)uVar5 + (float)(int)uVar5 + _DAT_007938b0) * _DAT_00845c9c) {

    iVar3 = param_2 + uVar5 * 9;

    if (param_3[1] <= fVar2) {

      bVar1 = *(byte *)(*(int *)(param_1 + 0x1c) + iVar3 * 2);

    }

    else {

      bVar1 = *(byte *)(*(int *)(param_1 + 0x1c) + 2 + iVar3 * 2);

    }

    iVar3 = *(int *)(&DAT_007c9ec0 + (bVar1 >> 2 & 0x1f) * 4);

  }

  else if (param_3[1] <= fVar2) {

    iVar3 = *(int *)(&DAT_007c9ec0 +

                    (*(byte *)(*(int *)(param_1 + 0x1c) + (param_2 + (uVar5 + 1) * 9) * 2) >> 2 &

                    0x1f) * 4);

  }

  else {

    iVar3 = *(int *)(&DAT_007c9ec0 +

                    (*(byte *)(*(int *)(param_1 + 0x1c) + 0x14 + (param_2 + uVar5 * 9) * 2) & 0x7c))

    ;

  }

  if (iVar3 == 0) {

    return (float10)_DAT_007958cc;

  }

  if (iVar3 == 1) {

    return (float10)_DAT_007c9f9c;

  }

  return (float10)DAT_00796344;

}




// --- FUN_00532440 at 0x00532440 ---


/* WARNING: Function: __chkstk replaced with injection: alloca_probe */

/* WARNING: Unable to track spacebase fully for stack */

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



void __fastcall FUN_00532440(int *param_1)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  undefined4 *puVar7;

  int iVar8;

  float *pfVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  float local_44 [2];

  int local_3c;

  int local_38;

  int local_34;

  float local_30;

  float local_2c;

  uint local_28;

  int local_24;

  int local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_c;

  float local_8;

  

  fVar6 = DAT_00842950;

  iVar12 = param_1[2] * param_1[2];

  local_20 = iVar12;

  iVar10 = iVar12 * -0xc;

  if (0 < iVar12) {

    local_44[0] = 0.0;

    local_44[1] = 0.0;

    puVar7 = (undefined4 *)(&stack0xffffffac + iVar10);

    iVar13 = iVar12;

    do {

      *puVar7 = 0;

      puVar7[1] = local_44[0];

      iVar13 = iVar13 + -1;

      puVar7[2] = local_44[1];

      puVar7 = puVar7 + 3;

    } while (iVar13 != 0);

  }

  iVar13 = 0;

  if (0 < param_1[3] * param_1[3] * 2) {

    iVar11 = 0;

    do {

      iVar8 = iVar11 + param_1[0x12];

      pfVar9 = (float *)(&stack0xffffffac + (uint)**(ushort **)(iVar8 + 4) * 0xc + iVar10);

      *pfVar9 = *pfVar9 + *(float *)(iVar8 + 0x20);

      pfVar9[1] = *(float *)(iVar8 + 0x24) + pfVar9[1];

      pfVar9[2] = *(float *)(iVar8 + 0x28) + pfVar9[2];

      iVar8 = param_1[0x12];

      pfVar9 = (float *)(&stack0xffffffac +

                        (uint)*(ushort *)(*(int *)(iVar8 + 4 + iVar11) + 2) * 0xc + iVar10);

      *pfVar9 = *(float *)(iVar8 + 0x20 + iVar11) + *pfVar9;

      pfVar9[1] = *(float *)(iVar8 + iVar11 + 0x24) + pfVar9[1];

      pfVar9[2] = *(float *)(iVar8 + iVar11 + 0x28) + pfVar9[2];

      iVar8 = param_1[0x12] + iVar11;

      pfVar9 = (float *)(&stack0xffffffac +

                        (uint)*(ushort *)(*(int *)(param_1[0x12] + 4 + iVar11) + 4) * 0xc + iVar10);

      iVar13 = iVar13 + 1;

      iVar11 = iVar11 + 0x30;

      *pfVar9 = *pfVar9 + *(float *)(iVar8 + 0x20);

      pfVar9[1] = *(float *)(iVar8 + 0x24) + pfVar9[1];

      pfVar9[2] = *(float *)(iVar8 + 0x28) + pfVar9[2];

    } while (iVar13 < param_1[3] * param_1[3] * 2);

  }

  iVar13 = local_20;

  if (0 < local_20) {

    pfVar9 = (float *)(&stack0xffffffb4 + iVar10);

    iVar11 = local_20;

    do {

      fVar1 = SQRT(*pfVar9 * *pfVar9 + pfVar9[-1] * pfVar9[-1] + pfVar9[-2] * pfVar9[-2]);

      if (fVar1 < _DAT_007c9f98) {

        pfVar9[-2] = 0.0;

        local_44[0] = 0.0;

        pfVar9[-1] = 0.0;

        local_44[1] = 1.0;

        *pfVar9 = 1.0;

      }

      else {

        fVar1 = _DAT_007938b0 / fVar1;

        pfVar9[-2] = fVar1 * pfVar9[-2];

        pfVar9[-1] = fVar1 * pfVar9[-1];

        *pfVar9 = fVar1 * *pfVar9;

      }

      pfVar9 = pfVar9 + 3;

      iVar11 = iVar11 + -1;

    } while (iVar11 != 0);

  }

  local_10 = DAT_00842780;

  fVar1 = (float)(DAT_0084277c >> 0x10 & 0xff) * _DAT_00799208;

  local_44[0] = DAT_00842954;

  local_2c = (float)(DAT_0084277c >> 8 & 0xff) * _DAT_00799208;

  local_44[1] = DAT_00842958;

  local_30 = (float)(DAT_0084277c & 0xff) * _DAT_00799208;

  local_14 = (float)(DAT_00842778 >> 0x10 & 0xff) * _DAT_00799208;

  iVar11 = 0;

  local_28 = DAT_00842778 & 0xff;

  local_24 = 0;

  local_18 = (float)(DAT_00842778 >> 8 & 0xff) * _DAT_00799208;

  local_1c = (float)(DAT_00842778 & 0xff) * _DAT_00799208;

  if (3 < iVar13) {

    fVar2 = DAT_00842780 * fVar1;

    fVar5 = local_2c * DAT_00842780;

    fVar4 = local_30 * DAT_00842780;

    local_28 = 3;

    local_38 = 8 - (int)(&stack0xffffffac + iVar10);

    local_3c = 0x14 - (int)(&stack0xffffffac + iVar10);

    local_34 = -0x10 - (int)(&stack0xffffffac + iVar10);

    pfVar9 = local_44 + iVar12 * -3;

    do {

      iVar13 = local_34;

      iVar12 = local_38;

      fVar3 = DAT_00842950 * pfVar9[-4] + local_44[0] * pfVar9[-3] + local_44[1] * pfVar9[-2];

      if (fVar3 < DAT_00796344) {

        fVar3 = DAT_00796344;

      }

      local_8 = local_14 * fVar3 + fVar2;

      local_c = local_18 * fVar3 + fVar5;

      fVar3 = fVar3 * local_1c + fVar4;

      if ((float)_DAT_007938c0 < local_8) {

        local_8 = 1.0;

      }

      if ((float)_DAT_007938c0 < local_c) {

        local_c = 1.0;

      }

      if ((float)_DAT_007938c0 < fVar3) {

        fVar3 = _DAT_007938b0;

      }

      *(float *)((int)pfVar9 + *param_1 + local_34) = local_8;

      *(float *)((int)pfVar9 + *param_1 + iVar13 + 4) = local_c;

      *(float *)((int)pfVar9 + *param_1 + iVar13 + 8) = fVar3;

      fVar3 = local_44[0] * *pfVar9 + DAT_00842950 * pfVar9[-1] + local_44[1] * pfVar9[1];

      if (fVar3 < DAT_00796344) {

        fVar3 = DAT_00796344;

      }

      local_8 = local_14 * fVar3 + fVar2;

      local_c = local_18 * fVar3 + fVar5;

      fVar3 = fVar3 * local_1c + fVar4;

      if ((float)_DAT_007938c0 < local_8) {

        local_8 = 1.0;

      }

      if ((float)_DAT_007938c0 < local_c) {

        local_c = 1.0;

      }

      if ((float)_DAT_007938c0 < fVar3) {

        fVar3 = _DAT_007938b0;

      }

      *(float *)((int)pfVar9 + *param_1 + iVar13 + 0xc) = local_8;

      *(float *)((int)pfVar9 + *param_1 + iVar13 + 0x10) = local_c;

      *(float *)((int)pfVar9 + *param_1 + iVar13 + 0x14) = fVar3;

      fVar3 = DAT_00842950 * pfVar9[2] + local_44[0] * pfVar9[3] + local_44[1] * pfVar9[4];

      if (fVar3 < DAT_00796344) {

        fVar3 = DAT_00796344;

      }

      local_8 = local_14 * fVar3 + fVar2;

      local_c = local_18 * fVar3 + fVar5;

      fVar3 = fVar3 * local_1c + fVar4;

      if ((float)_DAT_007938c0 < local_8) {

        local_8 = 1.0;

      }

      if ((float)_DAT_007938c0 < local_c) {

        local_c = 1.0;

      }

      if ((float)_DAT_007938c0 < fVar3) {

        fVar3 = _DAT_007938b0;

      }

      *(float *)((int)pfVar9 + *param_1 + iVar12) = local_8;

      *(float *)((int)pfVar9 + *param_1 + iVar13 + 0x1c) = local_c;

      *(float *)((int)pfVar9 + *param_1 + iVar13 + 0x20) = fVar3;

      fVar3 = DAT_00842950 * pfVar9[5] + local_44[0] * pfVar9[6] + local_44[1] * pfVar9[7];

      if (fVar3 < DAT_00796344) {

        fVar3 = DAT_00796344;

      }

      local_8 = local_14 * fVar3 + fVar2;

      local_c = local_18 * fVar3 + fVar5;

      fVar3 = fVar3 * local_1c + fVar4;

      if ((float)_DAT_007938c0 < local_8) {

        local_8 = 1.0;

      }

      if ((float)_DAT_007938c0 < local_c) {

        local_c = 1.0;

      }

      if ((float)_DAT_007938c0 < fVar3) {

        fVar3 = _DAT_007938b0;

      }

      *(float *)((int)pfVar9 + *param_1 + local_3c) = local_8;

      *(float *)((int)pfVar9 + *param_1 + iVar13 + 0x28) = local_c;

      *(float *)((int)pfVar9 + *param_1 + iVar13 + 0x2c) = fVar3;

      local_28 = local_28 + 4;

      iVar11 = local_24 + 4;

      local_24 = iVar11;

      pfVar9 = pfVar9 + 0xc;

      iVar13 = local_20;

    } while ((int)local_28 < local_20);

  }

  if (iVar11 < iVar13) {

    pfVar9 = (float *)(&stack0xffffffb0 + iVar11 * 0xc + iVar10);

    iVar13 = iVar13 - iVar11;

    iVar10 = iVar11 * 0xc;

    do {

      fVar2 = local_44[0] * *pfVar9 + fVar6 * pfVar9[-1] + local_44[1] * pfVar9[1];

      if (fVar2 < DAT_00796344) {

        fVar2 = DAT_00796344;

      }

      local_8 = local_14 * fVar2 + fVar1 * local_10;

      local_c = local_18 * fVar2 + local_2c * local_10;

      fVar2 = fVar2 * local_1c + local_30 * local_10;

      if ((float)_DAT_007938c0 < local_8) {

        local_8 = 1.0;

      }

      if ((float)_DAT_007938c0 < local_c) {

        local_c = 1.0;

      }

      if ((float)_DAT_007938c0 < fVar2) {

        fVar2 = _DAT_007938b0;

      }

      *(float *)(iVar10 + *param_1) = local_8;

      *(float *)(iVar10 + 4 + *param_1) = local_c;

      pfVar9 = pfVar9 + 3;

      iVar13 = iVar13 + -1;

      *(float *)(iVar10 + 8 + *param_1) = fVar2;

      iVar10 = iVar10 + 0xc;

    } while (iVar13 != 0);

  }

  return;

}




// --- FUN_00532a50 at 0x00532A50 ---


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



void __thiscall FUN_00532a50(int param_1,uint param_2)



{

  uint uVar1;

  int iVar2;

  int iVar3;

  float fVar4;

  undefined4 uVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  uint uVar9;

  int iVar10;

  int iVar11;

  int local_14;

  uint local_10;

  int local_c;

  

  if (param_2 != 0) {

    local_10 = param_2 >> 0x15 & 0x7f8;

    local_c = (param_2 >> 0x10 & 0xff) << 3;

  }

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

  iVar10 = 0;

  if (0 < iVar8) {

    do {

      iVar11 = 0;

      if (0 < iVar8) {

        local_14 = 1;

        do {

          uVar9 = iVar11 + local_c;

          iVar8 = ((local_10 + iVar10) * 0xccac033 + 0x6c1ac587) * uVar9 +

                  (local_10 + iVar10) * -0x421be3bd + -0x519b8f25;

          fVar4 = (float)iVar8;

          if (iVar8 < 0) {

            fVar4 = fVar4 + _DAT_0079920c;

          }

          if ((float)_DAT_00799088 <= fVar4 * _DAT_007c6f10) {

            *(undefined4 *)

             (*(int *)(param_1 + 0x5c) + (*(int *)(param_1 + 0xc) * iVar10 + iVar11) * 4) = 1;

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

            iVar7 = (iVar10 + 1) * *(int *)(param_1 + 8) + iVar11;

            uVar5 = FUN_00531e10((*(int *)(param_1 + 0xc) * iVar10 + iVar11) * 2,

                                 *(int *)(param_1 + 8) * iVar10 + iVar11,iVar7,iVar7 + 1);

            **(undefined4 **)(*(int *)(param_1 + 0x58) + 0x100 + (iVar8 * iVar10 + iVar11) * 0x108)

                 = uVar5;

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

            iVar7 = *(int *)(param_1 + 8) * iVar10 + iVar11;

            iVar8 = iVar7 + 1;

            iVar6 = (iVar10 + 1) * *(int *)(param_1 + 8);

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

          }

          else {

            *(undefined4 *)

             (*(int *)(param_1 + 0x5c) + (*(int *)(param_1 + 0xc) * iVar10 + iVar11) * 4) = 0;

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

            iVar8 = *(int *)(param_1 + 8) * iVar10 + iVar11;

            uVar5 = FUN_00531e10((*(int *)(param_1 + 0xc) * iVar10 + iVar11) * 2,iVar8,

                                 (iVar10 + 1) * *(int *)(param_1 + 8) + iVar11,iVar8 + 1);

            **(undefined4 **)(*(int *)(param_1 + 0x58) + 0x100 + (iVar7 * iVar10 + iVar11) * 0x108)

                 = uVar5;

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

            iVar6 = *(int *)(param_1 + 8) * iVar10;

            iVar8 = (iVar10 + 1) * *(int *)(param_1 + 8) + iVar11;

            iVar7 = iVar8 + 1;

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

          }

          uVar5 = FUN_00531e10((iVar3 * iVar10 + iVar11) * 2 + 1,iVar7,iVar6 + 1 + iVar11,iVar8);

          *(undefined4 *)

           (*(int *)(*(int *)(param_1 + 0x58) + 0x100 + (iVar2 * iVar10 + iVar11) * 0x108) + 4) =

               uVar5;

          uVar1 = iVar10 + local_10;

          if (((((int)uVar1 < 0) || ((int)uVar9 < 0)) || (0x7f7 < (int)uVar1)) ||

             (0x7f7 < (int)uVar9)) {

            uVar9 = 0;

          }

          else {

            uVar9 = (uVar9 & 7) + 1 + (uVar1 & 7) * 8 |

                    ((int)uVar9 >> 3 | (uVar1 & 0xfffffff8) << 5) << 0x10;

          }

          iVar8 = (*(int *)(param_1 + 0x10) * iVar10 + iVar11) * 0x108;

          *(uint *)(*(int *)(param_1 + 0x58) + 0x58 + iVar8) = uVar9;

          (**(code **)(*(int *)(*(int *)(param_1 + 0x58) + iVar8) + 0x44))(uVar9);

          iVar11 = iVar11 + 1;

          *(float *)(*(int *)(param_1 + 0x58) + 0x90 + iVar8) =

               (float)(iVar10 * 2 + 1) * _DAT_00845c9c;

          fVar4 = (float)local_14;

          local_14 = local_14 + 2;

          *(float *)(*(int *)(param_1 + 0x58) + 0x94 + iVar8) = fVar4 * _DAT_00845c9c;

        } while (iVar11 < *(int *)(param_1 + 0x10));

      }

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

      iVar10 = iVar10 + 1;

    } while (iVar10 < iVar8);

  }

  return;

}




// --- FUN_00532d10 at 0x00532D10 ---


undefined4 __thiscall FUN_00532d10(int param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  undefined1 *puVar3;

  uint uVar4;

  

  FUN_00532190();

  iVar2 = 6;

  do {

    *(undefined2 *)(iVar2 + -6 + *(int *)(param_1 + 0x1c)) = *(undefined2 *)*param_2;

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar2 + -4 + *(int *)(param_1 + 0x1c)) = *(undefined2 *)(iVar1 + 2);

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar2 + -2 + *(int *)(param_1 + 0x1c)) = *(undefined2 *)(iVar1 + 2);

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar2 + *(int *)(param_1 + 0x1c)) = *(undefined2 *)(iVar1 + 2);

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar2 + 2 + *(int *)(param_1 + 0x1c)) = *(undefined2 *)(iVar1 + 2);

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar2 + 4 + *(int *)(param_1 + 0x1c)) = *(undefined2 *)(iVar1 + 2);

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar2 + 6 + *(int *)(param_1 + 0x1c)) = *(undefined2 *)(iVar1 + 2);

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar2 + 8 + *(int *)(param_1 + 0x1c)) = *(undefined2 *)(iVar1 + 2);

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar2 + 10 + *(int *)(param_1 + 0x1c)) = *(undefined2 *)(iVar1 + 2);

    iVar2 = iVar2 + 0x12;

    *param_2 = *param_2 + 2;

  } while (iVar2 < 0xa8);

  iVar2 = 0;

  do {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(*(int *)(param_1 + 0x18) + 1 + iVar2) = *(undefined1 *)(iVar1 + 1);

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(*(int *)(param_1 + 0x18) + 2 + iVar2) = *(undefined1 *)(iVar1 + 1);

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(*(int *)(param_1 + 0x18) + 3 + iVar2) = *(undefined1 *)(iVar1 + 1);

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(*(int *)(param_1 + 0x18) + 4 + iVar2) = *(undefined1 *)(iVar1 + 1);

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(*(int *)(param_1 + 0x18) + 5 + iVar2) = *(undefined1 *)(iVar1 + 1);

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(*(int *)(param_1 + 0x18) + 6 + iVar2) = *(undefined1 *)(iVar1 + 1);

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(*(int *)(param_1 + 0x18) + 7 + iVar2) = *(undefined1 *)(iVar1 + 1);

    iVar1 = *param_2;

    *param_2 = iVar1 + 1;

    *(undefined1 *)(*(int *)(param_1 + 0x18) + 8 + iVar2) = *(undefined1 *)(iVar1 + 1);

    puVar3 = (undefined1 *)(*param_2 + 1);

    iVar2 = iVar2 + 9;

    *param_2 = (int)puVar3;

  } while (iVar2 < 0x51);

  uVar4 = (uint)puVar3 & 0x80000003;

  if ((int)uVar4 < 0) {

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

  }

  if (uVar4 != 0) {

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

      *puVar3 = 0;

      puVar3 = (undefined1 *)(*param_2 + 1);

      *param_2 = (int)puVar3;

    }

  }

  return 1;

}




// --- FUN_00532eb0 at 0x00532EB0 ---


void __thiscall

FUN_00532eb0(int param_1,uint param_2,int param_3,int param_4,char *param_5,undefined4 param_6,

            undefined4 param_7)



{

  int iVar1;

  ushort uVar2;

  ushort uVar3;

  int iVar4;

  bool bVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  uint uVar9;

  uint uVar10;

  uint uVar11;

  char cVar12;

  int iVar13;

  uint uVar14;

  uint uVar15;

  uint uVar16;

  uint uVar17;

  uint uVar18;

  int *piVar19;

  undefined4 uVar20;

  int local_1c;

  uint local_18;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  int local_4;

  

  if (param_2 != 0) {

    local_18 = param_2 >> 0x15 & 0x7f8;

    local_14 = (param_2 >> 0x10 & 0xff) << 3;

  }

  iVar13 = local_18 + param_3;

  iVar6 = local_14 + param_4;

  iVar7 = (int)(8 / (longlong)*(int *)(param_1 + 0x10));

  iVar8 = FUN_004ff400();

  if (iVar8 == 0) {

    local_1c = (-(uint)(iVar7 != 1) & 3) + 1;

  }

  else {

    local_1c = 1;

  }

  iVar8 = param_4 + param_3 * 9;

  iVar4 = *(int *)(param_1 + 0x1c);

  uVar2 = *(ushort *)(iVar4 + iVar8 * iVar7 * 2);

  uVar10 = uVar2 & 3;

  iVar1 = param_4 + 9 + param_3 * 9;

  uVar3 = *(ushort *)(iVar4 + iVar1 * iVar7 * 2);

  uVar16 = uVar3 & 3;

  uVar9 = uVar2 >> 2 & 0x1f;

  uVar11 = uVar3 >> 2 & 0x1f;

  uVar3 = *(ushort *)(iVar4 + (iVar1 + 1) * iVar7 * 2);

  uVar14 = uVar3 & 3;

  uVar17 = uVar3 >> 2 & 0x1f;

  uVar3 = *(ushort *)(iVar4 + (iVar8 + 1) * iVar7 * 2);

  uVar15 = uVar3 & 3;

  iVar7 = local_1c * 0x10000000;

  uVar18 = uVar3 >> 2 & 0x1f;

  local_10 = ((((uVar15 + (uVar14 + (uVar16 + uVar10 * 4) * 4) * 4) * 0x20 + uVar9) * 0x20 + uVar11)

              * 0x20 + uVar17) * 0x20 + iVar7 + uVar18;

  local_c = ((((uVar10 + (uVar15 + (uVar14 + uVar16 * 4) * 4) * 4) * 0x20 + uVar11) * 0x20 + uVar17)

             * 0x20 + uVar18) * 0x20 + iVar7 + uVar9;

  local_8 = ((((uVar16 + (uVar10 + (uVar15 + uVar14 * 4) * 4) * 4) * 0x20 + uVar17) * 0x20 + uVar18)

             * 0x20 + uVar9) * 0x20 + iVar7 + uVar11;

  local_4 = ((((uVar14 + (uVar16 + (uVar10 + uVar15 * 4) * 4) * 4) * 0x20 + uVar18) * 0x20 + uVar9)

             * 0x20 + uVar11) * 0x20 + iVar7 + uVar17;

  if (((uVar10 == uVar16) && (uVar10 == uVar14)) && (uVar10 == uVar15)) {

    cVar12 = '\x01';

  }

  else {

    cVar12 = '\0';

  }

  if (((uVar9 == uVar11) && (uVar9 == uVar17)) && (uVar9 == uVar18)) {

    bVar5 = true;

  }

  else {

    bVar5 = false;

  }

  if ((uVar2 & 3) == 0) {

    if ((cVar12 == '\0') || (!bVar5)) {

      cVar12 = '\0';

    }

    else {

      cVar12 = '\x01';

    }

  }

  *param_5 = cVar12;

  uVar20 = *(undefined4 *)(DAT_0084247c + 0x44);

  piVar19 = &local_10;

  FUN_006b5980(iVar13,iVar6,param_6,param_7,piVar19,local_1c,uVar20);

  FUN_00503ad0(iVar13,iVar6,param_6,param_7,piVar19,local_1c,uVar20);

  return;

}




// --- FUN_00533110 at 0x00533110 ---


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



void __fastcall FUN_00533110(int param_1)



{

  int iVar1;

  float *pfVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  

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

  iVar11 = 1;

  if ((((iVar10 == 5) || (iVar10 == 1)) || (iVar10 == 7)) &&

     (iVar10 = *(int *)(param_1 + 0xc), 1 < iVar10)) {

    do {

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

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

      iVar8 = iVar11 + 1;

      iVar1 = iVar11 + -1;

      iVar6 = iVar9 * iVar11;

      iVar11 = iVar11 + 2;

      *(float *)((iVar6 + iVar10) * DAT_0081f710 + 8 + iVar7) =

           (*(float *)(iVar7 + 8 + (iVar1 * iVar9 + iVar10) * DAT_0081f710) +

           *(float *)((iVar8 * iVar9 + iVar10) * DAT_0081f710 + 8 + iVar7)) * _DAT_007938b8;

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

    } while (iVar11 < iVar10);

  }

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

  if ((((iVar10 == 5) || (iVar10 == 4)) || (iVar10 == 6)) &&

     (iVar10 = 1, 1 < *(int *)(param_1 + 0xc))) {

    do {

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

      iVar11 = iVar10 + 1;

      iVar8 = iVar10 + -1;

      iVar9 = DAT_0081f710 * iVar10;

      iVar10 = iVar10 + 2;

      *(float *)(iVar9 + 8 + iVar1) =

           (*(float *)(iVar1 + 8 + iVar8 * DAT_0081f710) +

           *(float *)(iVar11 * DAT_0081f710 + 8 + iVar1)) * _DAT_007938b8;

    } while (iVar10 < *(int *)(param_1 + 0xc));

  }

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

  if ((((iVar10 == 6) || (iVar10 == 2)) || (iVar10 == 8)) &&

     (iVar10 = 1, 1 < *(int *)(param_1 + 0xc))) {

    do {

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

      iVar9 = *(int *)(param_1 + 0x44);

      iVar11 = iVar10 + 1;

      iVar8 = iVar10 + -1;

      iVar7 = iVar1 * DAT_0081f710 * iVar10;

      iVar10 = iVar10 + 2;

      *(float *)(iVar7 + 8 + iVar9) =

           (*(float *)(iVar9 + 8 + iVar8 * iVar1 * DAT_0081f710) +

           *(float *)(iVar11 * iVar1 * DAT_0081f710 + 8 + iVar9)) * _DAT_007938b8;

    } while (iVar10 < *(int *)(param_1 + 0xc));

  }

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

  if (((iVar10 == 8) || (iVar10 == 3)) || (iVar10 == 7)) {

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

    iVar11 = 1;

    if (1 < iVar10) {

      do {

        iVar10 = *(int *)(param_1 + 8) * iVar10 + iVar11;

        iVar8 = *(int *)(param_1 + 0x44);

        iVar11 = iVar11 + 2;

        *(float *)(iVar10 * DAT_0081f710 + 8 + iVar8) =

             (*(float *)((iVar10 + -1) * DAT_0081f710 + 8 + iVar8) +

             *(float *)(iVar8 + 8 + (iVar10 + 1) * DAT_0081f710)) * _DAT_007938b8;

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

      } while (iVar11 < iVar10);

    }

  }

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

    if ((*(int *)(param_1 + 4) == 1) && (iVar10 = 1, 1 < *(int *)(param_1 + 0xc))) {

      iVar11 = 0x12;

      do {

        pfVar2 = (float *)(*(int *)(param_1 + 8) * DAT_0081f710 * iVar10 + 8 +

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

        iVar8 = *(int *)(param_1 + 0x18) + iVar11;

        fVar3 = (float)(&DAT_008eea38)[*(byte *)(*(int *)(param_1 + 0x18) + 9 + iVar11)];

        fVar4 = (float)(&DAT_008eea38)[*(byte *)(iVar8 + 0x12)];

        fVar5 = ((float)(&DAT_008eea38)[*(byte *)(iVar8 + -9)] +

                (float)(&DAT_008eea38)[*(byte *)(iVar8 + -9)]) -

                (float)(&DAT_008eea38)[*(byte *)(iVar8 + -0x12)];

        if (fVar5 < *pfVar2) {

          *pfVar2 = fVar5;

        }

        fVar4 = (fVar3 + fVar3) - fVar4;

        if (fVar4 < *pfVar2) {

          *pfVar2 = fVar4;

        }

        iVar10 = iVar10 + 2;

        iVar11 = iVar11 + 0x24;

      } while (iVar10 < *(int *)(param_1 + 0xc));

    }

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

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

      iVar11 = 1;

      if (1 < iVar10) {

        iVar8 = 0x12;

        do {

          pfVar2 = (float *)((*(int *)(param_1 + 8) * iVar11 + iVar10) * DAT_0081f710 + 8 +

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

          iVar10 = *(int *)(param_1 + 0x18) + 9 + iVar8;

          fVar3 = (float)(&DAT_008eea38)[*(byte *)(*(int *)(param_1 + 0x18) + 0x11 + iVar8)];

          fVar4 = (float)(&DAT_008eea38)[*(byte *)(iVar10 + 0x11)];

          fVar5 = ((float)(&DAT_008eea38)[*(byte *)(iVar10 + -10)] +

                  (float)(&DAT_008eea38)[*(byte *)(iVar10 + -10)]) -

                  (float)(&DAT_008eea38)[*(byte *)(iVar10 + -0x13)];

          if (fVar5 < *pfVar2) {

            *pfVar2 = fVar5;

          }

          fVar4 = (fVar3 + fVar3) - fVar4;

          if (fVar4 < *pfVar2) {

            *pfVar2 = fVar4;

          }

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

          iVar11 = iVar11 + 2;

          iVar8 = iVar8 + 0x24;

        } while (iVar11 < iVar10);

      }

    }

    if ((*(int *)(param_1 + 4) == 3) && (iVar10 = 1, 1 < *(int *)(param_1 + 0xc))) {

      do {

        pfVar2 = (float *)(DAT_0081f710 * iVar10 + 8 + *(int *)(param_1 + 0x44));

        iVar11 = *(int *)(param_1 + 0x18) + iVar10 * 2;

        fVar3 = (float)(&DAT_008eea38)[*(byte *)(*(int *)(param_1 + 0x18) + 1 + iVar10 * 2)];

        fVar4 = (float)(&DAT_008eea38)[*(byte *)(iVar11 + 2)];

        fVar5 = ((float)(&DAT_008eea38)[*(byte *)(iVar11 + -1)] +

                (float)(&DAT_008eea38)[*(byte *)(iVar11 + -1)]) -

                (float)(&DAT_008eea38)[*(byte *)(iVar11 + -2)];

        if (fVar5 < *pfVar2) {

          *pfVar2 = fVar5;

        }

        fVar4 = (fVar3 + fVar3) - fVar4;

        if (fVar4 < *pfVar2) {

          *pfVar2 = fVar4;

        }

        iVar10 = iVar10 + 2;

      } while (iVar10 < *(int *)(param_1 + 0xc));

    }

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

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

      iVar11 = 1;

      if (1 < iVar10) {

        do {

          pfVar2 = (float *)((*(int *)(param_1 + 8) * iVar10 + iVar11) * DAT_0081f710 + 8 +

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

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

          fVar3 = (float)(&DAT_008eea38)[*(byte *)(iVar10 + 0x49 + iVar11 * 2)];

          fVar4 = (float)(&DAT_008eea38)[*(byte *)(iVar10 + 0x4a + iVar11 * 2)];

          fVar5 = ((float)(&DAT_008eea38)[*(byte *)(iVar10 + 0x47 + iVar11 * 2)] +

                  (float)(&DAT_008eea38)[*(byte *)(iVar10 + 0x47 + iVar11 * 2)]) -

                  (float)(&DAT_008eea38)[*(byte *)(iVar10 + 0x46 + iVar11 * 2)];

          if (fVar5 < *pfVar2) {

            *pfVar2 = fVar5;

          }

          fVar4 = (fVar3 + fVar3) - fVar4;

          if (fVar4 < *pfVar2) {

            *pfVar2 = fVar4;

          }

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

          iVar11 = iVar11 + 2;

        } while (iVar11 < iVar10);

      }

    }

  }

  return;

}




// --- FUN_005334f0 at 0x005334F0 ---


void __fastcall FUN_005334f0(int param_1)



{

  FUN_00532190();

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

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

  FUN_00695670();

  return;

}




// --- FUN_00533520 at 0x00533520 ---


void __fastcall FUN_00533520(int param_1)



{

  byte bVar1;

  bool bVar2;

  int iVar3;

  int iVar4;

  int local_8;

  int local_4;

  

  iVar3 = 0;

  bVar2 = false;

  bVar1 = 1;

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

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

    return;

  }

  do {

    iVar4 = 0;

    if (0 < *(int *)(param_1 + 0x10)) {

      do {

        FUN_00532290(iVar3,iVar4,&local_8,&local_4);

        if (local_8 == 0) {

          bVar1 = 0;

          *(undefined4 *)

           ((*(int *)(param_1 + 0x10) * iVar3 + iVar4) * 0x108 + 0x50 + *(int *)(param_1 + 0x58)) =

               0;

        }

        else {

          bVar2 = true;

          if (local_4 == 0) {

            bVar1 = 0;

            *(undefined4 *)

             ((*(int *)(param_1 + 0x10) * iVar3 + iVar4) * 0x108 + 0x50 + *(int *)(param_1 + 0x58))

                 = 1;

          }

          else {

            *(undefined4 *)

             ((*(int *)(param_1 + 0x10) * iVar3 + iVar4) * 0x108 + 0x50 + *(int *)(param_1 + 0x58))

                 = 2;

          }

        }

        iVar4 = iVar4 + 1;

      } while (iVar4 < *(int *)(param_1 + 0x10));

    }

    iVar3 = iVar3 + 1;

  } while (iVar3 < *(int *)(param_1 + 0x10));

  if (!bVar2) {

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

    return;

  }

  *(uint *)(param_1 + 0x14) = bVar1 + 1;

  return;

}




// --- FUN_00533610 at 0x00533610 ---


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



void __fastcall FUN_00533610(int param_1)



{

  float fVar1;

  float fVar2;

  int iVar3;

  int iVar4;

  float *pfVar5;

  int iVar6;

  int local_18;

  int local_14;

  int local_10;

  

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

  fVar2 = _DAT_00845c98 / (float)*(int *)(param_1 + 0xc);

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

  local_14 = 0;

  if (0 < iVar4) {

    local_10 = 0;

    do {

      local_18 = 0;

      if (0 < iVar4) {

        iVar6 = local_10;

        do {

          fVar1 = (float)(&DAT_008eea38)[*(byte *)(iVar6 + *(int *)(param_1 + 0x18))];

          pfVar5 = (float *)((iVar4 * local_14 + local_18) * DAT_0081f710 + *(int *)(param_1 + 0x44)

                            );

          *pfVar5 = (float)local_14 * fVar2;

          pfVar5[1] = (float)local_18 * fVar2;

          pfVar5[2] = fVar1;

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

          local_18 = local_18 + 1;

          iVar6 = iVar6 + iVar3;

        } while (local_18 < iVar4);

      }

      local_10 = local_10 + iVar3 * 9;

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

      local_14 = local_14 + 1;

    } while (local_14 < iVar4);

  }

  return;

}




// --- FUN_005336e0 at 0x005336E0 ---


void __thiscall FUN_005336e0(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  undefined1 uVar3;

  int iVar4;

  int iVar5;

  char local_9;

  int local_8;

  undefined2 local_4 [2];

  

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

  iVar4 = 0;

  if (0 < iVar1) {

    do {

      iVar5 = 0;

      if (0 < iVar1) {

        do {

          FUN_00532eb0(param_2,iVar4,iVar5,&local_9,local_4,&local_8);

          iVar1 = *(int *)(param_1 + 0xc) * iVar4 + iVar5;

          if (local_9 != '\0') {

            *(undefined1 *)(iVar1 * 0x60 + 0xf + *(int *)(param_1 + 0x48)) = 3;

            *(undefined1 *)((iVar1 * 6 + 3) * 0x10 + 0xf + *(int *)(param_1 + 0x48)) = 3;

          }

          if (*(int *)(*(int *)(param_1 + 0x5c) + (*(int *)(param_1 + 0xc) * iVar4 + iVar5) * 4) ==

              0) {

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

              iVar2 = iVar1 * 0x60;

              **(undefined1 **)(*(int *)(param_1 + 0x48) + 0x14 + iVar2) =

                   (&DAT_007c9f58)[local_8 * 4];

              *(undefined *)(*(int *)(*(int *)(param_1 + 0x48) + 0x14 + iVar2) + 1) =

                   (&DAT_007c9f68)[local_8 * 4];

              *(undefined *)(*(int *)(*(int *)(param_1 + 0x48) + 0x14 + iVar2) + 2) =

                   (&DAT_007c9f88)[local_8 * 4];

              iVar2 = (iVar1 * 6 + 3) * 0x10;

              **(undefined1 **)(*(int *)(param_1 + 0x48) + 0x14 + iVar2) =

                   (&DAT_007c9f78)[local_8 * 4];

              *(undefined *)(*(int *)(*(int *)(param_1 + 0x48) + 0x14 + iVar2) + 1) =

                   (&DAT_007c9f88)[local_8 * 4];

              iVar2 = *(int *)(*(int *)(param_1 + 0x48) + 0x14 + iVar2);

              uVar3 = (&DAT_007c9f68)[local_8 * 4];

              goto LAB_00533895;

            }

          }

          else if (*(int *)(param_1 + 0x3c) == 1) {

            iVar2 = iVar1 * 0x60;

            **(undefined1 **)(*(int *)(param_1 + 0x48) + 0x14 + iVar2) =

                 (&DAT_007c9f58)[local_8 * 4];

            *(undefined *)(*(int *)(*(int *)(param_1 + 0x48) + 0x14 + iVar2) + 1) =

                 (&DAT_007c9f68)[local_8 * 4];

            *(undefined *)(*(int *)(*(int *)(param_1 + 0x48) + 0x14 + iVar2) + 2) =

                 (&DAT_007c9f78)[local_8 * 4];

            iVar2 = (iVar1 * 6 + 3) * 0x10;

            **(undefined1 **)(*(int *)(param_1 + 0x48) + 0x14 + iVar2) =

                 (&DAT_007c9f58)[local_8 * 4];

            *(undefined *)(*(int *)(*(int *)(param_1 + 0x48) + 0x14 + iVar2) + 1) =

                 (&DAT_007c9f78)[local_8 * 4];

            iVar2 = *(int *)(*(int *)(param_1 + 0x48) + 0x14 + iVar2);

            uVar3 = (&DAT_007c9f88)[local_8 * 4];

LAB_00533895:

            *(undefined1 *)(iVar2 + 2) = uVar3;

          }

          *(undefined2 *)(iVar1 * 0x60 + 0x1c + *(int *)(param_1 + 0x48)) = local_4[0];

          *(undefined2 *)((iVar1 * 6 + 3) * 0x10 + 0x1c + *(int *)(param_1 + 0x48)) = local_4[0];

          iVar5 = iVar5 + 1;

        } while (iVar5 < *(int *)(param_1 + 0xc));

      }

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

      iVar4 = iVar4 + 1;

    } while (iVar4 < iVar1);

  }

  return;

}




// --- FUN_005338f0 at 0x005338F0 ---


int __thiscall FUN_005338f0(int param_1,undefined4 param_2,uint param_3,int param_4)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  iVar2 = (int)(8 / (ulonglong)param_3);

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

  if ((iVar1 == iVar2) && (*(int *)(param_1 + 4) == param_4)) {

    return 0;

  }

  iVar3 = 0;

  if (iVar1 != iVar2) {

    iVar3 = 1;

    if (0 < iVar1) {

      FUN_00532190();

    }

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

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

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

    FUN_00531bd0();

  }

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

  FUN_00533610();

  if (((*(int *)(param_1 + 4) != 0) && (1 < *(int *)(param_1 + 0x10))) &&

     (*(int *)(param_1 + 0x10) < 8)) {

    FUN_00533110();

  }

  if (iVar3 == 0) {

    FUN_005320c0();

    FUN_00533520();

    return 0;

  }

  FUN_00532a50(param_2);

  FUN_005336e0(param_2);

  FUN_00533520();

  return iVar3;

}




// --- FUN_005339b0 at 0x005339B0 ---


undefined4 * __fastcall FUN_005339b0(undefined4 *param_1)



{

  undefined4 uVar1;

  

  FUN_00534cf0();

  *param_1 = &PTR_LAB_007ca0d8;

  param_1[0xc] = &PTR_LAB_007ca0c0;

  param_1[0xe] = &PTR_LAB_007ca0b4;

  uVar1 = thunk_FUN_005df0f5(8);

  param_1[0x40] = uVar1;

  param_1[0x41] = 0;

  return param_1;

}




// --- FUN_00533a00 at 0x00533A00 ---


void __fastcall FUN_00533a00(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007ca0d8;

  param_1[0xc] = &PTR_LAB_007ca0c0;

  param_1[0xe] = &PTR_LAB_007ca0b4;

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

  FUN_00534d20();

  return;

}




// --- FUN_00533a30 at 0x00533A30 ---


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



{

  int iVar1;

  int iVar2;

  

  iVar2 = 0;

  do {

    iVar1 = FUN_00538da0(param_2,0);

    if (iVar1 != 0) {

      *param_3 = *(undefined4 *)(*(int *)(param_1 + 0x100) + iVar2 * 4);

      return 1;

    }

    iVar2 = iVar2 + 1;

  } while (iVar2 < 2);

  return 0;

}




// --- FUN_00533af0 at 0x00533AF0 ---


void FUN_00533af0(undefined4 param_1)



{

  FUN_00506970(param_1);

  return;

}




// --- FUN_00533b60 at 0x00533B60 ---


undefined4 __thiscall FUN_00533b60(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined1 local_54 [12];

  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;

  

  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_0050aa30(local_54,param_2);

  iVar1 = FUN_005308b0(*(undefined4 *)(param_1 + 0x28),local_54);

  return *(undefined4 *)(&DAT_007ca018 + iVar1 * 4);

}




// --- FUN_00533c00 at 0x00533C00 ---


void FUN_00533c00(undefined4 param_1,uint param_2,uint param_3)



{

  undefined4 uVar1;

  uint uVar2;

  

  if ((((-1 < (int)param_2) && (-1 < (int)param_3)) && ((int)param_2 < 0x7f8)) &&

     ((int)param_3 < 0x7f8)) {

    uVar2 = (param_3 & 7) + 1 + (param_2 & 7) * 8 |

            ((param_2 & 0xfffffff8) << 5 | (int)param_3 >> 3) << 0x10;

    uVar1 = FUN_00506970(uVar2);

    FUN_006b5f30(uVar2,uVar1);

  }

  return;

}




// --- FUN_00533f10 at 0x00533F10 ---


void FUN_00533f10(uint param_1,uint param_2,int param_3,int param_4)



{

  uint uVar1;

  undefined4 uVar2;

  uint uVar3;

  

  for (; uVar1 = param_2, (int)param_1 <= param_3; param_1 = param_1 + 1) {

    for (; (int)uVar1 <= param_4; uVar1 = uVar1 + 1) {

      if ((((-1 < (int)param_1) && (-1 < (int)uVar1)) && ((int)param_1 < 0x7f8)) &&

         ((int)uVar1 < 0x7f8)) {

        uVar3 = (uVar1 & 7) + 1 + (param_1 & 7) * 8 |

                ((param_1 & 0xfffffff8) << 5 | (int)uVar1 >> 3) << 0x10;

        uVar2 = FUN_00506970(uVar3);

        FUN_006b5f30(uVar3,uVar2);

      }

    }

  }

  return;

}




// --- FUN_00533fa0 at 0x00533FA0 ---


void FUN_00533fa0(undefined4 param_1,float *param_2,int param_3,int param_4,float param_5,

                 float param_6)



{

  int iVar1;

  

  if (param_5 < *param_2) {

    iVar1 = param_3 + 1;

    FUN_00533c00(param_1,iVar1,param_4);

    if (param_5 < param_2[1]) {

      FUN_00533c00(param_1,iVar1,param_4 + 1);

    }

    if (param_2[1] < param_6) {

      FUN_00533c00(param_1,iVar1,param_4 + -1);

    }

  }

  if (*param_2 < param_6) {

    iVar1 = param_3 + -1;

    FUN_00533c00(param_1,iVar1,param_4);

    if (param_5 < param_2[1]) {

      FUN_00533c00(param_1,iVar1,param_4 + 1);

    }

    if (param_2[1] < param_6) {

      FUN_00533c00(param_1,iVar1,param_4 + -1);

    }

  }

  if (param_5 < param_2[1]) {

    FUN_00533c00(param_1,param_3,param_4 + 1);

  }

  if (param_2[1] < param_6) {

    FUN_00533c00(param_1,param_3,param_4 + -1);

  }

  return;

}




// --- FUN_005340a0 at 0x005340A0 ---


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



void FUN_005340a0(uint param_1,int param_2,int *param_3)



{

  float fVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  float local_58;

  int local_54;

  int local_50;

  int local_4c;

  int local_48;

  uint local_44;

  int local_40;

  uint local_3c;

  uint local_38;

  int local_34;

  int local_30;

  float local_2c;

  float local_28;

  undefined4 local_24;

  float local_20;

  float local_1c;

  float local_14;

  float local_10;

  

  if ((*param_3 == 0) && (*param_3 = 1, param_1 != 0)) {

    uVar6 = 0;

    local_48 = 0;

    local_4c = 0;

    local_50 = 0;

    local_54 = 0;

    uVar7 = local_44;

    if (param_1 != 0) {

      do {

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

          iVar2 = *(int *)(param_2 + uVar6 * 4);

          local_2c = *(float *)(iVar2 + 0x6c);

          local_28 = *(float *)(iVar2 + 0x70);

          local_24 = *(undefined4 *)(iVar2 + 0x74);

          local_58 = *(float *)(iVar2 + 0x34);

          iVar2 = FUN_005aac70(&local_58,&local_2c);

          uVar7 = -(uint)(iVar2 != 0) & (uint)local_58;

          break;

        }

        uVar6 = uVar6 + 1;

      } while (uVar6 < param_1);

    }

    if (((uVar6 != param_1) && (local_40 = FUN_00506970(), local_40 != 0)) &&

       (iVar2 = FUN_00497d70(uVar7,&local_30,&local_34), iVar2 != 0)) {

      local_3c = (uVar7 & 0xffff) - 1 >> 3;

      local_38 = uVar7 - 1 & 7;

      uVar7 = 0;

      if (param_1 != 0) {

        do {

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

            iVar2 = FUN_0050e370();

            if (iVar2 == 0) {

              uVar4 = FUN_0050e0d0();

              FUN_005b31d0(uVar4,*(int *)(param_2 + uVar7 * 4) + 0x30,local_40 + 0x54);

              floor((double)(local_20 / _DAT_007c9fd4));

              iVar2 = FUN_005df4c4();

              floor((double)(local_1c / _DAT_007c9fd4));

              iVar3 = FUN_005df4c4();

              floor((double)(local_14 / _DAT_007c9fd4));

              local_44 = FUN_005df4c4();

              fVar1 = local_10;

            }

            else {

              iVar2 = *(int *)(param_2 + uVar7 * 4);

              iVar3 = *(int *)(**(int **)(iVar2 + 0x20) + 0x74);

              if (iVar3 == 0) {

                iVar3 = *(int *)(**(int **)(iVar2 + 0x20) + 0x90);

              }

              local_58 = *(float *)(iVar3 + 0xc);

              local_2c = *(float *)(iVar2 + 0x6c);

              local_28 = *(float *)(iVar2 + 0x70);

              floor((double)((local_2c - local_58) / _DAT_007c9fd4));

              iVar2 = FUN_005df4c4();

              floor((double)((local_28 - local_58) / _DAT_007c9fd4));

              iVar3 = FUN_005df4c4();

              floor((double)((local_2c + local_58) / _DAT_007c9fd4));

              local_44 = FUN_005df4c4();

              fVar1 = local_28 + local_58;

            }

            floor((double)(fVar1 / _DAT_007c9fd4));

            iVar5 = FUN_005df4c4();

            if ((int)(iVar2 - local_3c) < local_48) {

              local_48 = iVar2 - local_3c;

            }

            if ((int)(iVar3 - local_38) < local_4c) {

              local_4c = iVar3 - local_38;

            }

            if (local_50 < (int)(local_44 - local_3c)) {

              local_50 = local_44 - local_3c;

            }

            if (local_54 < (int)(iVar5 - local_38)) {

              local_54 = iVar5 - local_38;

            }

          }

          uVar7 = uVar7 + 1;

        } while (uVar7 < param_1);

      }

      FUN_00533f10(local_30 + local_48,local_34 + local_4c,local_50 + local_30,local_34 + local_54,

                   param_3);

    }

  }

  return;

}




// --- FUN_00534370 at 0x00534370 ---


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



void FUN_00534370(int param_1,uint param_2,int param_3,int *param_4)



{

  undefined4 uVar1;

  undefined4 uVar2;

  int iVar3;

  undefined4 *puVar4;

  undefined4 local_38;

  undefined4 local_34;

  undefined4 local_30;

  float local_2c;

  uint local_28;

  int local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  undefined4 local_c;

  

  if (*param_4 == 0) {

    *param_4 = 1;

    if (param_2 == 0) {

      local_14 = *(float *)(param_1 + 0x3c);

      local_10 = *(float *)(param_1 + 0x40);

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

      local_28 = *(uint *)(param_1 + 4);

      iVar3 = FUN_005aac70(&local_28,&local_14);

      if (iVar3 != 0) {

        iVar3 = FUN_00497d70(local_28,&local_34,&local_38);

        if (iVar3 != 0) {

          FUN_00533c00(param_4,local_34,local_38);

        }

      }

    }

    else {

      local_28 = 0;

      puVar4 = (undefined4 *)(param_3 + 8);

      while( true ) {

        local_14 = (float)puVar4[-2];

        local_c = *puVar4;

        local_10 = (float)puVar4[-1];

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

        iVar3 = FUN_005aac70(&local_30,&local_14);

        if (iVar3 == 0) break;

        FUN_0050a140();

        floor((double)(local_14 / _DAT_007c9fd4));

        local_24 = FUN_005df4c4();

        floor((double)(local_10 / _DAT_007c9fd4));

        iVar3 = FUN_005df4c4();

        local_2c = (float)puVar4[1];

        local_1c = local_14 - (float)local_24 * _DAT_007c9fd4;

        local_18 = local_10 - (float)iVar3 * _DAT_007c9fd4;

        local_20 = _DAT_007c9fd4 - local_2c;

        iVar3 = FUN_00497d70(local_30,&local_34,&local_38);

        uVar2 = local_34;

        uVar1 = local_38;

        if (iVar3 != 0) {

          FUN_00533c00(param_4);

          FUN_00533fa0(param_4,&local_1c,uVar2,uVar1,local_20,local_2c);

        }

        FUN_00695670();

        local_28 = local_28 + 1;

        puVar4 = puVar4 + 4;

        if (param_2 <= local_28) {

          return;

        }

      }

    }

  }

  return;

}




// --- FUN_00534580 at 0x00534580 ---


void FUN_00534580(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005340a0(param_1,param_2,param_3);

  FUN_00534dc0(param_1,param_2,param_3);

  return;

}




// --- FUN_005345b0 at 0x005345B0 ---


undefined4 * __fastcall FUN_005345b0(undefined4 *param_1)



{

  *param_1 = 0;

  FUN_0053cd10();

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  return param_1;

}




// --- FUN_005345f0 at 0x005345F0 ---


int __thiscall FUN_005345f0(int param_1,ushort param_2)



{

  uint uVar1;

  int *piVar2;

  

  uVar1 = 0;

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

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

    do {

      if ((int)*(short *)(*piVar2 + 0xc) == (uint)param_2) {

        return (*(int **)(param_1 + 0x30))[uVar1];

      }

      uVar1 = uVar1 + 1;

      piVar2 = piVar2 + 1;

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

  }

  return 0;

}




// --- FUN_00534630 at 0x00534630 ---


void FUN_00534630(void)



{

  FUN_0053a620();

  return;

}




// --- FUN_00534640 at 0x00534640 ---


void FUN_00534640(void)



{

  FUN_0053a630();

  return;

}




// --- FUN_00534650 at 0x00534650 ---


void FUN_00534650(void)



{

  FUN_0053a610();

  return;

}




// --- FUN_00534660 at 0x00534660 ---


uint __fastcall FUN_00534660(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  undefined4 local_4;

  

  local_4 = 0;

  iVar1 = FUN_0053ccc0();

  iVar1 = iVar1 + 0x10;

  uVar4 = 0;

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

    do {

      iVar2 = FUN_00539270(&local_4,0);

      iVar1 = iVar1 + iVar2;

      uVar4 = uVar4 + 1;

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

  }

  uVar4 = iVar1 + *(int *)(param_1 + 0x2c) * 2;

  uVar3 = uVar4 & 3;

  if (uVar3 == 0) {

    iVar1 = 0;

  }

  else {

    iVar1 = 4 - uVar3;

  }

  DAT_0084638c = 2;

  iVar2 = FUN_0053a550(&local_4,0);

  iVar1 = uVar4 + iVar2 + iVar1;

  uVar4 = 0;

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

    do {

      iVar2 = FUN_00539270(&local_4,0);

      iVar1 = iVar1 + iVar2;

      uVar4 = uVar4 + 1;

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

  }

  DAT_0084638c = 1;

  iVar2 = FUN_0053a550(&local_4,0);

  uVar4 = iVar1 + 4 + iVar2;

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

    DAT_0084638c = 0;

    iVar1 = FUN_0053a550(&local_4,0);

    uVar4 = uVar4 + iVar1;

  }

  if ((uVar4 & 3) == 0) {

    return uVar4;

  }

  return (4 - (uVar4 & 3)) + uVar4;

}




// --- FUN_00534760 at 0x00534760 ---


uint __thiscall FUN_00534760(undefined4 *param_1,uint *param_2,uint param_3)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  

  uVar1 = FUN_00534660();

  if (uVar1 <= param_3) {

    *(undefined4 *)*param_2 = *param_1;

    uVar3 = *param_2;

    *param_2 = uVar3 + 4;

    *(undefined4 *)(uVar3 + 4) = param_1[0xf];

    uVar3 = *param_2;

    *param_2 = uVar3 + 4;

    *(undefined4 *)(uVar3 + 4) = param_1[0x12];

    uVar3 = *param_2;

    *param_2 = uVar3 + 4;

    *(undefined4 *)(uVar3 + 4) = param_1[0xb];

    *param_2 = *param_2 + 4;

    FUN_0053cd20(param_2,param_3);

    uVar3 = 0;

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

      do {

        FUN_00539270(param_2,param_3);

        uVar3 = uVar3 + 1;

      } while (uVar3 < (uint)param_1[0xf]);

    }

    uVar3 = 0;

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

      do {

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

        *param_2 = *param_2 + 2;

        uVar3 = uVar3 + 1;

      } while (uVar3 < (uint)param_1[0xb]);

    }

    uVar3 = *param_2 & 0x80000003;

    if ((int)uVar3 < 0) {

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

    }

    if (uVar3 != 0) {

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

        *(undefined1 *)*param_2 = 0;

        *param_2 = *param_2 + 1;

      }

    }

    DAT_0084638c = 2;

    FUN_0053a550(param_2,param_3);

    uVar3 = 0;

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

      do {

        FUN_00539270(param_2,param_3);

        uVar3 = uVar3 + 1;

      } while (uVar3 < (uint)param_1[0x12]);

    }

    DAT_0084638c = 1;

    FUN_0053a550(param_2,param_3);

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

      *(undefined4 *)*param_2 = 0;

      *param_2 = *param_2 + 4;

    }

    else {

      DAT_0084638c = 0;

      *(undefined4 *)*param_2 = 1;

      *param_2 = *param_2 + 4;

      FUN_0053a550(param_2,param_3);

    }

    uVar3 = *param_2 & 0x80000003;

    if ((int)uVar3 < 0) {

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

    }

    if (uVar3 != 0) {

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

        *(undefined1 *)*param_2 = 0;

        *param_2 = *param_2 + 1;

      }

    }

  }

  return uVar1;

}




// --- FUN_00534910 at 0x00534910 ---


void __fastcall FUN_00534910(int param_1)



{

  void *pvVar1;

  int iVar2;

  int iVar3;

  

  pvVar1 = *(void **)(param_1 + 0x54);

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

    FUN_0053a6a0();

    operator_delete(pvVar1);

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

  }

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

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

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

  }

  pvVar1 = *(void **)(param_1 + 0x50);

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

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

    FUN_0053a6a0();

    operator_delete(pvVar1);

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

  }

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

  if (iVar2 != 0) {

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

    if (-1 < iVar3 + -1) {

      do {

        FUN_00538e20();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

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

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

  }

  pvVar1 = *(void **)(param_1 + 0x44);

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

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

    FUN_0053a6a0();

    operator_delete(pvVar1);

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

  }

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

  if (iVar2 != 0) {

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

    if (-1 < iVar3 + -1) {

      do {

        FUN_00538e20();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

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

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

  }

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

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

  if (iVar2 != 0) {

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

    if (-1 < iVar3 + -1) {

      do {

        FUN_00535a30();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

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

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

  }

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

  FUN_0053cc10();

  return;

}




// --- FUN_00534a40 at 0x00534A40 ---


undefined4 __thiscall FUN_00534a40(undefined4 *param_1,uint *param_2,undefined4 param_3)



{

  ushort uVar1;

  int iVar2;

  int *piVar3;

  undefined4 uVar4;

  int *piVar5;

  uint uVar6;

  

  FUN_00534910();

  *param_1 = *(undefined4 *)*param_2;

  uVar6 = *param_2;

  *param_2 = uVar6 + 4;

  param_1[0xf] = *(undefined4 *)(uVar6 + 4);

  uVar6 = *param_2;

  *param_2 = uVar6 + 4;

  param_1[0x12] = *(undefined4 *)(uVar6 + 4);

  uVar6 = *param_2;

  *param_2 = uVar6 + 4;

  param_1[0xb] = *(undefined4 *)(uVar6 + 4);

  *param_2 = *param_2 + 4;

  iVar2 = FUN_0053cd90(param_2,param_3);

  if (iVar2 != 0) {

    iVar2 = param_1[0xf];

    DAT_0084610c = param_1 + 1;

    piVar3 = (int *)thunk_FUN_005df0f5(iVar2 * 0x30 + 4);

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

      piVar5 = (int *)0x0;

    }

    else {

      piVar5 = piVar3 + 1;

      *piVar3 = iVar2;

      FUN_00401000(piVar5,0x30,iVar2,FUN_005390e0);

    }

    uVar6 = 0;

    param_1[0x10] = piVar5;

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

      do {

        FUN_00539390(param_2,param_3);

        uVar6 = uVar6 + 1;

      } while (uVar6 < (uint)param_1[0xf]);

    }

    uVar4 = thunk_FUN_005df0f5(param_1[0xb] << 2);

    param_1[0xc] = uVar4;

    uVar6 = 0;

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

      do {

        uVar1 = *(ushort *)*param_2;

        *param_2 = (uint)((ushort *)*param_2 + 1);

        *(uint *)(param_1[0xc] + uVar6 * 4) = (uint)uVar1 * 0x30 + param_1[0x10];

        uVar6 = uVar6 + 1;

      } while (uVar6 < (uint)param_1[0xb]);

    }

    uVar6 = *param_2 & 0x80000003;

    if ((int)uVar6 < 0) {

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

    }

    if (uVar6 != 0) {

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

        *(undefined1 *)*param_2 = 0;

        *param_2 = *param_2 + 1;

      }

    }

    DAT_00846388 = param_1[0x10];

    DAT_0084638c = 2;

    iVar2 = FUN_005df0f5(4);

    if (iVar2 == 0) {

      uVar4 = 0;

    }

    else {

      uVar4 = FUN_00535a80();

    }

    param_1[0x15] = uVar4;

    FUN_0053a590(param_2,param_3);

    iVar2 = param_1[0x12];

    piVar3 = (int *)thunk_FUN_005df0f5(iVar2 * 0x30 + 4);

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

      piVar5 = (int *)0x0;

    }

    else {

      piVar5 = piVar3 + 1;

      *piVar3 = iVar2;

      if (-1 < iVar2 + -1) {

        do {

          FUN_005390e0();

          iVar2 = iVar2 + -1;

        } while (iVar2 != 0);

      }

    }

    param_1[0x13] = piVar5;

    uVar6 = 0;

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

      do {

        FUN_00539390(param_2,param_3);

        uVar6 = uVar6 + 1;

      } while (uVar6 < (uint)param_1[0x12]);

    }

    DAT_00846388 = param_1[0x13];

    DAT_0084638c = 1;

    iVar2 = FUN_005df0f5(4);

    if (iVar2 == 0) {

      uVar4 = 0;

    }

    else {

      uVar4 = FUN_00535a80();

    }

    param_1[0x14] = uVar4;

    FUN_0053a590(param_2,param_3);

    DAT_00846388 = param_1[0x10];

    iVar2 = *(int *)*param_2;

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

    if (iVar2 != 0) {

      DAT_0084638c = 0;

      iVar2 = FUN_005df0f5(4);

      if (iVar2 == 0) {

        uVar4 = 0;

      }

      else {

        uVar4 = FUN_00535a80();

      }

      param_1[0x11] = uVar4;

      FUN_0053a590(param_2,param_3);

    }

    uVar6 = *param_2 & 0x80000003;

    if ((int)uVar6 < 0) {

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

    }

    if (uVar6 != 0) {

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

        *(undefined1 *)*param_2 = 0;

        *param_2 = *param_2 + 1;

      }

    }

    return 1;

  }

  return 0;

}




// --- FUN_00534cd0 at 0x00534CD0 ---


void FUN_00534cd0(void)



{

  FUN_00534910();

  FUN_00695670();

  return;

}




// --- FUN_00534cf0 at 0x00534CF0 ---


undefined4 * __fastcall FUN_00534cf0(undefined4 *param_1)



{

  FUN_0052bb80();

  *param_1 = &PTR_LAB_007ca2d0;

  param_1[0xc] = &PTR_LAB_007ca2bc;

  param_1[0xe] = &PTR_LAB_007ca2b0;

  param_1[0x3e] = 0;

  return param_1;

}




// --- FUN_00534d20 at 0x00534D20 ---


void __fastcall FUN_00534d20(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007ca2d0;

  param_1[0xc] = &PTR_LAB_007ca2bc;

  param_1[0xe] = &PTR_LAB_007ca2b0;

  FUN_0052bcd0();

  return;

}




// --- FUN_00534d40 at 0x00534D40 ---


bool __fastcall FUN_00534d40(int param_1)



{

  return *(int *)(param_1 + 0xf8) != 0;

}




// --- FUN_00534d70 at 0x00534D70 ---


void __thiscall FUN_00534d70(int param_1,undefined4 param_2)



{

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

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

  }

  return;

}




// --- FUN_00534d90 at 0x00534D90 ---


void __fastcall FUN_00534d90(int param_1)



{

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

  return;

}




// --- FUN_00534da0 at 0x00534DA0 ---


void __fastcall FUN_00534da0(int param_1)



{

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

    FUN_006b6170();

    return;

  }

  return;

}




// --- FUN_00534dc0 at 0x00534DC0 ---


void __fastcall FUN_00534dc0(int param_1)



{

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

    FUN_006b61e0();

    return;

  }

  return;

}




// --- FUN_00534de0 at 0x00534DE0 ---


undefined4 __fastcall FUN_00534de0(int param_1)



{

  undefined4 uVar1;

  

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

    uVar1 = FUN_006b6240();

    return uVar1;

  }

  return 1;

}




// --- FUN_00534e50 at 0x00534E50 ---


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



{

  *param_1 = &PTR_LAB_007ca2d0;

  param_1[0xc] = &PTR_LAB_007ca2bc;

  param_1[0xe] = &PTR_LAB_007ca2b0;

  FUN_0052bcd0();

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

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_00534e90 at 0x00534E90 ---


void __thiscall FUN_00534e90(float *param_1,float *param_2)



{

  if (*param_2 < *param_1) {

    *param_1 = *param_2;

  }

  if (param_2[1] < param_1[1]) {

    param_1[1] = param_2[1];

  }

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

    param_1[2] = param_2[2];

  }

  if (param_1[3] < *param_2) {

    param_1[3] = *param_2;

  }

  if (param_1[4] < param_2[1]) {

    param_1[4] = param_2[1];

  }

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

    param_1[5] = param_2[2];

  }

  return;

}




// --- FUN_00534f10 at 0x00534F10 ---


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



{

  int iVar1;

  

  iVar1 = 0;

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

    *(undefined1 *)(*(int *)(param_1 + 0x6c) + 0x15) = 1;

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

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

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

  }

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

}




// --- FUN_00534f40 at 0x00534F40 ---


void __fastcall FUN_00534f40(int param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  

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

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

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

    *(undefined4 *)(param_1 + 0x9c) = puVar1[1];

    *(undefined4 *)(param_1 + 0xa0) = puVar1[2];

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

    *(undefined4 *)(param_1 + 0xa8) = puVar1[1];

    *(undefined4 *)(param_1 + 0xac) = puVar1[2];

    uVar2 = 1;

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

      do {

        FUN_00534e90(DAT_0081f710 * uVar2 + *(int *)(param_1 + 0x60));

        uVar2 = uVar2 + 1;

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

    }

    return;

  }

  *(undefined4 *)(param_1 + 0x98) = DAT_00845ec4;

  *(undefined4 *)(param_1 + 0x9c) = DAT_00845ec8;

  *(undefined4 *)(param_1 + 0xa0) = DAT_00845ecc;

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

  *(undefined4 *)(param_1 + 0xa8) = DAT_00845ec8;

  *(undefined4 *)(param_1 + 0xac) = DAT_00845ecc;

  return;

}




// --- FUN_00535000 at 0x00535000 ---


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



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  int iVar4;

  int iVar5;

  int local_4;

  

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

    uVar2 = FUN_0040a8f0();

    uVar1 = uVar2;

    uVar3 = FUN_0040a8d0(uVar2);

    iVar4 = FUN_0040ac70(uVar3,uVar1);

    param_3 = iVar4;

    iVar5 = FUN_0053cd90(&param_3,uVar2);

    if (iVar5 != 0) {

      FUN_0040acf0(param_3 - iVar4);

      return;

    }

    FUN_0040aa50();

  }

  else {

    param_3 = 0;

    uVar1 = FUN_0053cd20(&param_3,0);

    local_4 = FUN_0040acf0(uVar1);

    if (local_4 != 0) {

      FUN_0053cd20(&local_4,uVar1);

      return;

    }

  }

  return;

}




// --- FUN_005350a0 at 0x005350A0 ---


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



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  int iVar4;

  int iVar5;

  int local_4;

  

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

    uVar2 = FUN_0040a8f0();

    uVar1 = uVar2;

    uVar3 = FUN_0040a8d0(uVar2);

    iVar4 = FUN_0040ac70(uVar3,uVar1);

    param_3 = iVar4;

    iVar5 = FUN_00539390(&param_3,uVar2);

    if (iVar5 != 0) {

      FUN_0040acf0(param_3 - iVar4);

      return;

    }

    FUN_0040aa50();

  }

  else {

    param_3 = 0;

    uVar1 = FUN_00539270(&param_3,0);

    local_4 = FUN_0040acf0(uVar1);

    if (local_4 != 0) {

      FUN_00539270(&local_4,uVar1);

      return;

    }

  }

  return;

}




// --- FUN_00535140 at 0x00535140 ---


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



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  int iVar4;

  int iVar5;

  int local_4;

  

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

    uVar2 = FUN_0040a8f0();

    uVar1 = uVar2;

    uVar3 = FUN_0040a8d0(uVar2);

    iVar4 = FUN_0040ac70(uVar3,uVar1);

    param_3 = iVar4;

    iVar5 = FUN_0053a590(&param_3,uVar2);

    if (iVar5 != 0) {

      FUN_0040acf0(param_3 - iVar4);

      return;

    }

    FUN_0040aa50();

  }

  else {

    param_3 = 0;

    uVar1 = FUN_0053a550(&param_3,0);

    local_4 = FUN_0040acf0(uVar1);

    if (local_4 != 0) {

      FUN_0053a550(&local_4,uVar1);

      return;

    }

  }

  return;

}




// --- FUN_005351e0 at 0x005351E0 ---


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



undefined4 __thiscall FUN_005351e0(float *param_1,float *param_2)



{

  if (((param_1[1] - param_2[1]) * (param_1[1] - param_2[1]) +

      (param_1[2] - param_2[2]) * (param_1[2] - param_2[2]) +

      (*param_1 - *param_2) * (*param_1 - *param_2)) -

      (param_2[3] + param_1[3]) * (param_2[3] + param_1[3]) < _DAT_007ca400) {

    return 1;

  }

  return 0;

}




// --- FUN_00535240 at 0x00535240 ---


undefined4 * __fastcall FUN_00535240(undefined4 *param_1)



{

  FUN_00415460(DAT_00845edc);

  *param_1 = &PTR_LAB_007ca418;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  FUN_0053cd10();

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  param_1[0x22] = 0;

  param_1[0x23] = 0;

  param_1[0x24] = 0;

  param_1[0x25] = 0;

  param_1[0x2c] = DAT_00845edc;

  return param_1;

}




// --- FUN_005352c0 at 0x005352C0 ---


void __fastcall FUN_005352c0(int param_1)



{

  void *pvVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  

  pvVar1 = *(void **)(param_1 + 0x94);

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

    FUN_0053a6a0();

    operator_delete(pvVar1);

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

  }

  iVar4 = *(int *)(param_1 + 0x8c);

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

  if (iVar4 != 0) {

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

    if (-1 < iVar3 + -1) {

      do {

        FUN_00538e20();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

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

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

  }

  iVar4 = *(int *)(param_1 + 0x68);

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

  if (iVar4 != 0) {

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

    if (-1 < iVar3 + -1) {

      do {

        FUN_00538e20();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

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

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

  }

  pvVar1 = *(void **)(param_1 + 0x78);

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

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

    FUN_0053a6a0();

    operator_delete(pvVar1);

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

  }

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

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

  }

  FUN_0053cc10();

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

    iVar4 = 0;

    if (0 < *(int *)(param_1 + 0x34)) {

      do {

        piVar2 = *(int **)(*(int *)(param_1 + 0x38) + iVar4 * 4);

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

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

        }

        iVar4 = iVar4 + 1;

      } while (iVar4 < *(int *)(param_1 + 0x34));

    }

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

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

  }

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

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

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

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

  }

  return;

}




// --- FUN_005353f0 at 0x005353F0 ---


undefined4 __fastcall FUN_005353f0(int param_1)



{

  char cVar1;

  

  cVar1 = FUN_00413a70();

  if (cVar1 != '\0') {

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

      FUN_0053ada0();

    }

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

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

       (cVar1 = FUN_0059fba0(param_1,param_1 + 0x6c), cVar1 != '\0')) {

      return 1;

    }

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

  }

  return 1;

}




// --- FUN_00535440 at 0x00535440 ---


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



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



{

  float *pfVar1;

  undefined4 uVar2;

  float *pfVar3;

  uint uVar4;

  

  uVar4 = 0;

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

    pfVar3 = *(float **)(param_2 + 0x44);

    pfVar1 = *(float **)(param_1 + 0x74);

    do {

      if (((pfVar1[1] - pfVar3[1]) * (pfVar1[1] - pfVar3[1]) +

          (pfVar1[2] - pfVar3[2]) * (pfVar1[2] - pfVar3[2]) +

          (*pfVar1 - *pfVar3) * (*pfVar1 - *pfVar3)) -

          (pfVar3[3] + pfVar1[3]) * (pfVar3[3] + pfVar1[3]) < _DAT_007ca400) {

        if (*(int *)(param_2 + 0x174) != 2) {

          uVar2 = FUN_0053b1a0(param_2,param_3);

          return uVar2;

        }

        uVar2 = FUN_0053a6c0(param_2);

        return uVar2;

      }

      uVar4 = uVar4 + 1;

      pfVar3 = pfVar3 + 4;

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

  }

  return 1;

}




// --- FUN_005354e0 at 0x005354E0 ---


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



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 uVar3;

  uint uVar4;

  

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

    uVar2 = FUN_0040a8f0();

    uVar4 = uVar2;

    uVar3 = FUN_0040a8d0(uVar2);

    puVar1 = (undefined4 *)FUN_0040ac70(uVar3,uVar4);

    if (uVar2 < 0xc) {

      FUN_0040aa50();

      return;

    }

    *param_2 = *puVar1;

    param_2[1] = puVar1[1];

    param_2[2] = puVar1[2];

    FUN_0040acf0(0xc);

  }

  else {

    puVar1 = (undefined4 *)FUN_0040acf0(0xc);

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

      *puVar1 = *param_2;

      puVar1[1] = param_2[1];

      puVar1[2] = param_2[2];

      return;

    }

  }

  return;

}




// --- FUN_00535570 at 0x00535570 ---


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



{

  *param_1 = &PTR_LAB_007ca418;

  FUN_005352c0();

  FUN_00695670();

  FUN_004154b0();

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

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_00535620 at 0x00535620 ---


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



{

  int *piVar1;

  undefined4 uVar2;

  int iVar3;

  

  iVar3 = DAT_00845edc;

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

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

  }

  FUN_0040ad10(4);

  piVar1 = (int *)FUN_0040acf0(4);

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

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

      iVar3 = *piVar1;

    }

    else {

      *piVar1 = iVar3;

    }

  }

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

    if (iVar3 == DAT_00845edc) {

      *param_2 = 0;

      return;

    }

    uVar2 = FUN_004220b0(iVar3,0xd);

    iVar3 = FUN_00415430(uVar2);

    *param_2 = iVar3;

  }

  return;

}




// --- free at 0x00535A20 ---


void __cdecl free(void *_Memory)



{

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

                    /* WARNING: Treating indirect jump as call */

  free(_Memory);

  return;

}




// --- FUN_00535a30 at 0x00535A30 ---


void __fastcall FUN_00535a30(int param_1)



{

  int iVar1;

  int iVar2;

  

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

  if (iVar1 != 0) {

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

    if (-1 < iVar2 + -1) {

      do {

        FUN_00535a70();

        iVar2 = iVar2 + -1;

      } while (iVar2 != 0);

    }

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

  }

  return;

}




// --- FUN_00535a70 at 0x00535A70 ---


void __fastcall FUN_00535a70(int param_1)



{

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

  return;

}




// --- FUN_00535a80 at 0x00535A80 ---


void __fastcall FUN_00535a80(undefined4 *param_1)



{

  *param_1 = 0;

  return;

}




// --- FUN_00535a90 at 0x00535A90 ---


void __thiscall FUN_00535a90(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  *param_1 = param_2;

  param_1[1] = param_3;

  return;

}




// --- FUN_00535ab0 at 0x00535AB0 ---


void FUN_00535ab0(uint param_1,int *param_2,int *param_3,int *param_4,int *param_5,uint *param_6,

                 uint *param_7,uint *param_8)



{

  char cVar1;

  

  *param_8 = param_1 & 1;

  *param_7 = param_1 >> 1 & 1;

  *param_6 = param_1 >> 2 & 1;

  cVar1 = (&DAT_007ca48c)[param_1 >> 3 & 3];

  *param_2 = (int)cVar1;

  *param_3 = (int)(char)(&DAT_007ca484)[(int)cVar1 + *param_6];

  cVar1 = (&DAT_007ca485)[*param_2 - *param_6];

  *param_4 = (int)cVar1;

  if (*param_7 != 0) {

    *param_5 = (int)cVar1;

    return;

  }

  *param_5 = *param_2;

  return;

}




// --- FUN_00535b30 at 0x00535B30 ---


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



void __fastcall FUN_00535b30(float *param_1)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  

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

  fVar2 = param_1[2] + param_1[2];

  fVar3 = param_1[3] + param_1[3];

  fVar4 = *param_1 * fVar1;

  param_1[4] = ((float)_DAT_007938c0 - param_1[2] * fVar2) - param_1[3] * fVar3;

  param_1[5] = param_1[1] * fVar2 + *param_1 * fVar3;

  param_1[6] = param_1[1] * fVar3 - *param_1 * fVar2;

  param_1[7] = param_1[1] * fVar2 - *param_1 * fVar3;

  fVar1 = (float)_DAT_007938c0 - param_1[1] * fVar1;

  param_1[8] = fVar1 - param_1[3] * fVar3;

  param_1[9] = param_1[2] * fVar3 + fVar4;

  param_1[10] = param_1[1] * fVar3 + *param_1 * fVar2;

  param_1[0xb] = param_1[2] * fVar3 - fVar4;

  param_1[0xc] = fVar1 - param_1[2] * fVar2;

  return;

}




// --- FUN_00535c10 at 0x00535C10 ---


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



undefined4 __fastcall FUN_00535c10(float *param_1)



{

  float fVar1;

  int iVar2;

  undefined4 uVar3;

  

  uVar3 = 1;

  iVar2 = _isnan((double)param_1[0xd]);

  if (iVar2 == 0) {

    iVar2 = _isnan((double)param_1[0xe]);

    if (iVar2 == 0) {

      iVar2 = _isnan((double)param_1[0xf]);

      if (iVar2 == 0) {

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

            }

          }

        }

      }

    }

  }

  uVar3 = 0;

LAB_00535ca6:

  fVar1 = *param_1 * *param_1 +

          param_1[1] * param_1[1] + param_1[2] * param_1[2] + param_1[3] * param_1[3];

  iVar2 = _isnan((double)fVar1);

  if ((iVar2 == 0) && (ABS(fVar1 - _DAT_007938b0) <= _DAT_007ca480 * _DAT_007b817c)) {

    return uVar3;

  }

  return 0;

}




// --- FUN_00535d20 at 0x00535D20 ---


undefined4 __fastcall FUN_00535d20(float *param_1)



{

  int iVar1;

  

  iVar1 = _isnan((double)param_1[0xd]);

  if (((iVar1 != 0) || (iVar1 = _isnan((double)param_1[0xe]), iVar1 != 0)) ||

     (iVar1 = _isnan((double)param_1[0xf]), iVar1 != 0)) {

    return 0;

  }

  iVar1 = _isnan((double)*param_1);

  if (((iVar1 == 0) && (iVar1 = _isnan((double)param_1[1]), iVar1 == 0)) &&

     ((iVar1 = _isnan((double)param_1[2]), iVar1 == 0 &&

      (iVar1 = _isnan((double)param_1[3]), iVar1 == 0)))) {

    return 0;

  }

  return 1;

}




// --- FUN_00535dc0 at 0x00535DC0 ---


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



void __thiscall FUN_00535dc0(float *param_1,float param_2,float param_3,float param_4,float param_5)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  int iVar6;

  

  fVar1 = *param_1;

  fVar2 = param_1[1];

  fVar3 = param_1[2];

  fVar4 = param_1[3];

  fVar5 = (float)_DAT_007938c0 /

          SQRT(param_5 * param_5 + param_4 * param_4 + param_3 * param_3 + param_2 * param_2);

  *param_1 = param_2 * fVar5;

  param_1[1] = param_3 * fVar5;

  param_1[2] = param_4 * fVar5;

  param_1[3] = fVar5 * param_5;

  iVar6 = FUN_00535c10();

  if (iVar6 != 0) {

    FUN_00535b30();

    return;

  }

  *param_1 = fVar1;

  param_1[1] = fVar2;

  param_1[2] = fVar3;

  param_1[3] = fVar4;

  return;

}




// --- FUN_00535e70 at 0x00535E70 ---


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



{

  int iVar1;

  

  if (0x1b < param_3) {

    if (0xb < param_3) {

      *(undefined4 *)*param_2 = param_1[0xd];

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

      *(undefined4 *)(iVar1 + 4) = param_1[0xe];

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

      *(undefined4 *)(iVar1 + 4) = param_1[0xf];

      *param_2 = *param_2 + 4;

    }

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return 0x1c;

}




// --- FUN_00535ee0 at 0x00535EE0 ---


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



{

  int iVar1;

  

  if ((0x1b < param_3) && (0xb < param_3)) {

    param_1[0xd] = *(undefined4 *)*param_2;

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    param_1[0xe] = *(undefined4 *)(iVar1 + 4);

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    param_1[0xf] = *(undefined4 *)(iVar1 + 4);

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

    iVar1 = FUN_00535c10();

    if (iVar1 != 0) {

      FUN_00535b30();

      return 1;

    }

  }

  return 0;

}




// --- FUN_00535f70 at 0x00535F70 ---


void __thiscall FUN_00535f70(undefined4 *param_1,int param_2)



{

  undefined4 *puVar1;

  

  FUN_006855e0(param_2);

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

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

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

      *param_1 = *puVar1;

    }

    else {

      *puVar1 = *param_1;

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

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

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

      param_1[1] = *puVar1;

    }

    else {

      *puVar1 = param_1[1];

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

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

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

      param_1[2] = *puVar1;

    }

    else {

      *puVar1 = param_1[2];

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

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

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

      *puVar1 = param_1[3];

      return;

    }

    param_1[3] = *puVar1;

  }

  return;

}




// ============================================================
// REGION: Nearby functions (0x00536000 - 0x00540000)
// ============================================================

// --- FUN_00536030 at 0x00536030 ---


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



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



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  

  fVar1 = *(float *)(param_3 + 0x38);

  fVar2 = *(float *)(param_3 + 0x3c);

  fVar5 = _DAT_007938b0 - param_4;

  fVar3 = *(float *)(param_2 + 0x38);

  fVar4 = *(float *)(param_2 + 0x3c);

  *(float *)(param_1 + 0x34) =

       param_4 * *(float *)(param_3 + 0x34) + fVar5 * *(float *)(param_2 + 0x34);

  *(float *)(param_1 + 0x38) = fVar5 * fVar3 + param_4 * fVar1;

  *(float *)(param_1 + 0x3c) = fVar5 * fVar4 + param_4 * fVar2;

  return;

}




// --- FUN_005360d0 at 0x005360D0 ---


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



void FUN_005360d0(float *param_1,float *param_2,float param_3)



{

  float fVar1;

  float10 fVar2;

  float10 fVar3;

  float10 fVar4;

  float local_10;

  float local_c;

  float local_8;

  float local_4;

  

  fVar1 = param_1[3] * param_2[3] +

          param_1[1] * param_2[1] + *param_1 * *param_2 + param_1[2] * param_2[2];

  if ((float)_DAT_00795610 <= fVar1) {

    local_10 = *param_2;

    local_c = param_2[1];

    local_8 = param_2[2];

    local_4 = param_2[3];

  }

  else {

    fVar1 = -fVar1;

    local_10 = -*param_2;

    local_c = -param_2[1];

    local_8 = -param_2[2];

    local_4 = -param_2[3];

  }

  if ((float)_DAT_007938c0 - fVar1 <= _DAT_007ca480) {

    fVar4 = (float10)_DAT_007938c0 - (float10)param_3;

  }

  else {

    fVar2 = (float10)_CIacos();

    fVar3 = (float10)fsin(fVar2);

    fVar4 = (float10)fsin((float10)((float)_DAT_007938c0 - param_3) * fVar2);

    fVar4 = fVar4 * ((float10)_DAT_007938c0 / fVar3);

    fVar2 = (float10)fsin((float10)param_3 * (float10)(double)fVar2);

    fVar2 = fVar2 * (float10)(double)((float10)_DAT_007938c0 / fVar3);

    if (((((float10)_DAT_00795610 <= fVar4) && (fVar4 <= (float10)_DAT_007938c0)) &&

        ((float10)_DAT_00795610 <= fVar2)) && (fVar2 <= (float10)_DAT_007938c0)) goto LAB_00536202;

    fVar4 = (float10)((float)_DAT_007938c0 - param_3);

  }

  fVar2 = (float10)param_3;

LAB_00536202:

  FUN_00535dc0((float)((float10)local_10 * fVar2 + (float10)*param_1 * fVar4),

               (float)((float10)local_c * fVar2 + (float10)param_1[1] * fVar4),

               (float)((float10)local_8 * fVar2 + (float10)param_1[2] * fVar4),

               (float)((float10)param_1[3] * fVar4 + (float10)local_4 * fVar2));

  return;

}




// --- FUN_00536260 at 0x00536260 ---


void __thiscall FUN_00536260(int param_1,float *param_2,float *param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  

  FUN_00535dc0(param_3[6] * param_2[3] +

               *param_2 * param_3[3] + param_3[4] * param_2[1] + param_2[2] * param_3[5],

               param_2[3] * param_3[5] +

               ((param_2[1] * param_3[3] - param_3[4] * *param_2) - param_2[2] * param_3[6]),

               (param_3[6] * param_2[1] + (param_2[2] * param_3[3] - *param_2 * param_3[5])) -

               param_3[4] * param_2[3],

               param_2[2] * param_3[4] +

               (param_2[3] * param_3[3] - (param_3[5] * param_2[1] + *param_2 * param_3[6])));

  fVar3 = -*param_3;

  fVar5 = -param_3[1];

  fVar4 = -param_3[2];

  fVar1 = param_2[0xe];

  fVar2 = param_2[0xf];

  *(float *)(param_1 + 0x34) =

       fVar5 * *(float *)(param_1 + 0x1c) +

       fVar3 * *(float *)(param_1 + 0x10) + fVar4 * *(float *)(param_1 + 0x28) + param_2[0xd];

  *(float *)(param_1 + 0x38) =

       fVar5 * *(float *)(param_1 + 0x20) +

       fVar3 * *(float *)(param_1 + 0x14) + fVar4 * *(float *)(param_1 + 0x2c) + fVar1;

  *(float *)(param_1 + 0x3c) =

       fVar5 * *(float *)(param_1 + 0x24) +

       fVar3 * *(float *)(param_1 + 0x18) + fVar4 * *(float *)(param_1 + 0x30) + fVar2;

  return;

}




// --- FUN_00536390 at 0x00536390 ---


void __thiscall FUN_00536390(int param_1,float *param_2,float *param_3)



{

  undefined4 *puVar1;

  undefined1 local_c [12];

  

  puVar1 = (undefined4 *)FUN_004526c0(local_c,param_2 + 0xd);

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

  *(undefined4 *)(param_1 + 0x38) = puVar1[1];

  *(undefined4 *)(param_1 + 0x3c) = puVar1[2];

  FUN_00535dc0(param_2[3] * param_3[3] +

               param_2[1] * param_3[1] + param_3[2] * param_2[2] + *param_2 * *param_3,

               param_2[2] * param_3[3] +

               ((param_2[1] * *param_3 - *param_2 * param_3[1]) - param_3[2] * param_2[3]),

               ((*param_3 * param_2[2] + param_2[3] * param_3[1]) - param_3[2] * *param_2) -

               param_2[1] * param_3[3],

               (param_2[1] * param_3[2] + (param_2[3] * *param_3 - param_2[2] * param_3[1])) -

               *param_2 * param_3[3]);

  return;

}




// --- FUN_00536460 at 0x00536460 ---


void __thiscall FUN_00536460(int param_1,float *param_2)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  

  fVar3 = (*(float *)(param_1 + 0x2c) + *(float *)(param_1 + 0x14)) * DAT_00796344;

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

  fVar4 = (*(float *)(param_1 + 0x30) + *(float *)(param_1 + 0x18)) * DAT_00796344;

  fVar2 = *(float *)(param_1 + 0x24);

  *param_2 = (*(float *)(param_1 + 0x28) + *(float *)(param_1 + 0x10)) * DAT_00796344 +

             *(float *)(param_1 + 0x1c);

  param_2[1] = fVar3 + fVar1;

  param_2[2] = fVar4 + fVar2;

  return;

}




// --- FUN_005364a0 at 0x005364A0 ---


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



void __fastcall FUN_005364a0(int param_1)



{

  float10 fVar1;

  

  fVar1 = (float10)fpatan(((float10)*(float *)(param_1 + 0x2c) + (float10)*(float *)(param_1 + 0x14)

                          ) * (float10)DAT_00796344 + (float10)*(float *)(param_1 + 0x20),

                          ((float10)*(float *)(param_1 + 0x28) + (float10)*(float *)(param_1 + 0x10)

                          ) * (float10)DAT_00796344 + (float10)*(float *)(param_1 + 0x1c));

  _CIfmod((float)((float10)_DAT_0079c6c0 - fVar1 * (float10)_DAT_0079c6c8));

  return;

}




// --- FUN_005364e0 at 0x005364E0 ---


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



void __thiscall FUN_005364e0(float *param_1,float *param_2)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float10 fVar5;

  float10 fVar6;

  

  fVar6 = (float10)param_2[2] * (float10)param_2[2] +

          (float10)param_2[1] * (float10)param_2[1] + (float10)*param_2 * (float10)*param_2;

  if ((float10)_DAT_007ca480 * (float10)_DAT_007ca480 <= fVar6) {

    fVar6 = SQRT(fVar6);

    fVar1 = (float)((float10)_DAT_007938c0 / fVar6);

    fVar6 = fVar6 * (float10)_DAT_00799088;

    fVar5 = (float10)fsin(fVar6);

    fVar6 = (float10)fcos(fVar6);

    fVar2 = (float)fVar6;

    fVar3 = (float)(fVar5 * (float10)*param_2 * (float10)fVar1);

    fVar4 = (float)((float10)fVar1 * fVar5 * (float10)param_2[1]);

    fVar6 = fVar5 * (float10)fVar1 * (float10)param_2[2];

    FUN_00535dc0((float)((((float10)fVar2 * (float10)*param_1 - (float10)fVar3 * (float10)param_1[1]

                          ) - (float10)fVar4 * (float10)param_1[2]) - fVar6 * (float10)param_1[3]),

                 (float)(((float10)fVar3 * (float10)*param_1 +

                         (float10)fVar4 * (float10)param_1[3] + (float10)fVar2 * (float10)param_1[1]

                         ) - fVar6 * (float10)param_1[2]),

                 (float)((float10)fVar4 * (float10)*param_1 +

                        fVar6 * (float10)param_1[1] +

                        ((float10)fVar2 * (float10)param_1[2] - (float10)fVar3 * (float10)param_1[3]

                        )),

                 (float)(fVar6 * (float10)*param_1 +

                        (((float10)fVar2 * (float10)param_1[3] +

                         (float10)fVar3 * (float10)param_1[2]) -

                        (float10)fVar4 * (float10)param_1[1])));

    return;

  }

  return;

}




// --- FUN_00536610 at 0x00536610 ---


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



void __fastcall FUN_00536610(int param_1)



{

  int iVar1;

  int iVar2;

  float fVar3;

  uint uVar4;

  int local_2c [3];

  double local_20 [4];

  

  fVar3 = *(float *)(param_1 + 0x10) + *(float *)(param_1 + 0x20) + *(float *)(param_1 + 0x30) +

          _DAT_007938b0;

  if (fVar3 <= _DAT_007ca480) {

    local_2c[0] = 1;

    local_2c[1] = 2;

    local_2c[2] = 0;

    uVar4 = (uint)(*(float *)(param_1 + 0x10) < *(float *)(param_1 + 0x20));

    if (*(float *)((uVar4 + 1) * 0x10 + param_1) < *(float *)(param_1 + 0x30)) {

      uVar4 = 2;

    }

    iVar1 = local_2c[uVar4];

    iVar2 = local_2c[iVar1];

    fVar3 = SQRT((*(float *)((uVar4 + 1) * 0x10 + param_1) -

                 (*(float *)((iVar2 + 1) * 0x10 + param_1) +

                 *(float *)(param_1 + (iVar1 + 1) * 0x10))) + (float)_DAT_007938c0);

    local_20[uVar4] = (double)((float)_DAT_00799088 * fVar3);

    if (_DAT_007ca480 < fVar3) {

      fVar3 = (float)_DAT_00799088 / fVar3;

    }

    local_20[3] = (double)((*(float *)(param_1 + 0x10 + (iVar1 * 3 + iVar2) * 4) -

                           *(float *)(param_1 + 0x10 + (iVar2 * 3 + iVar1) * 4)) * fVar3);

    local_20[iVar1] =

         (double)((*(float *)(param_1 + 0x10 + (uVar4 * 3 + iVar1) * 4) -

                  *(float *)(param_1 + 0x10 + (iVar1 * 3 + uVar4) * 4)) * fVar3);

    local_20[iVar2] =

         (double)((*(float *)(param_1 + 0x10 + (uVar4 * 3 + iVar2) * 4) -

                  *(float *)(param_1 + 0x10 + (iVar2 * 3 + uVar4) * 4)) * fVar3);

    fVar3 = (float)local_20[2];

  }

  else {

    fVar3 = (float)_DAT_00799088 / SQRT(fVar3);

    local_20[3] = (double)((float)_DAT_007994a8 / fVar3);

    local_20[0] = (double)((*(float *)(param_1 + 0x24) - *(float *)(param_1 + 0x2c)) * fVar3);

    local_20[1] = (double)((*(float *)(param_1 + 0x28) - *(float *)(param_1 + 0x18)) * fVar3);

    fVar3 = (*(float *)(param_1 + 0x14) - *(float *)(param_1 + 0x1c)) * fVar3;

  }

  FUN_00535dc0((float)local_20[3],(float)local_20[0],(float)local_20[1],fVar3);

  return;

}




// --- FUN_00536780 at 0x00536780 ---


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



void __thiscall FUN_00536780(int param_1,int param_2,float *param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  int iVar4;

  float fVar5;

  int iVar6;

  float local_30;

  float local_2c;

  float local_28;

  int local_c [3];

  

  fVar1 = *(float *)(param_1 + 0x14 + param_2 * 0xc);

  fVar3 = *(float *)(param_1 + 0x10 + param_2 * 0xc);

  fVar2 = *(float *)(param_1 + (param_2 * 3 + 6) * 4);

  local_c[0] = 2;

  local_c[1] = 0;

  local_c[2] = 1;

  fVar5 = fVar3 * *param_3 + fVar1 * param_3[1] + fVar2 * param_3[2];

  local_30 = *param_3 - fVar3 * fVar5;

  local_2c = param_3[1] - fVar1 * fVar5;

  local_28 = param_3[2] - fVar2 * fVar5;

  iVar6 = FUN_004524a0();

  if (iVar6 != 0) {

    iVar6 = local_c[param_2];

    local_2c = *(float *)(param_1 + 0x14 + iVar6 * 0xc);

    local_30 = *(float *)(param_1 + 0x10 + iVar6 * 0xc);

    local_28 = *(float *)(param_1 + (iVar6 * 3 + 6) * 4);

  }

  if (ABS(local_30 * fVar3 + local_2c * fVar1 + local_28 * fVar2) <= _DAT_007ca480 * _DAT_007b817c)

  {

    iVar6 = local_c[param_2];

    *(float *)(param_1 + 0x10 + iVar6 * 0xc) = local_30;

    *(float *)(param_1 + iVar6 * 0xc + 0x14) = local_2c;

    *(float *)(param_1 + (iVar6 * 3 + 6) * 4) = local_28;

    iVar4 = local_c[iVar6];

    iVar6 = param_1 + iVar4 * 0xc;

    *(float *)(iVar6 + 0x10) = local_2c * fVar2 - local_28 * fVar1;

    *(float *)(iVar6 + 0x14) = local_28 * fVar3 - fVar2 * local_30;

    *(float *)(param_1 + (iVar4 * 3 + 6) * 4) = fVar1 * local_30 - local_2c * fVar3;

    FUN_00536610();

  }

  return;

}




// --- FUN_00536930 at 0x00536930 ---


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



void FUN_00536930(float param_1,float param_2,float param_3,float param_4)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float *pfVar5;

  float10 fVar6;

  float10 fVar7;

  float10 fVar8;

  float10 fVar9;

  float local_24;

  float local_20;

  int local_1c;

  int local_18;

  int local_14;

  int local_10;

  float local_c [3];

  

  fVar1 = param_1;

  FUN_00535ab0(param_4,&local_1c,&local_18,&local_14,&local_24,&local_20,&local_10,&param_4);

  if (param_4 == 1.4013e-45) {

    param_1 = param_3;

    param_3 = fVar1;

  }

  if (local_20 == 1.4013e-45) {

    param_2 = -param_2;

  }

  fVar6 = (float10)fcos((float10)param_1 * (float10)_DAT_007938b8);

  fVar7 = (float10)fcos((float10)param_2 * (float10)_DAT_007938b8);

  fVar1 = (float)fVar7;

  fVar7 = (float10)fcos((float10)(param_3 * _DAT_007938b8));

  fVar8 = (float10)fsin((float10)param_1 * (float10)_DAT_007938b8);

  fVar2 = (float)fVar8;

  fVar8 = (float10)fsin((float10)param_2 * (float10)_DAT_007938b8);

  fVar9 = (float10)fsin((float10)(param_3 * _DAT_007938b8));

  local_24 = (float)fVar7 * (float)fVar6;

  fVar3 = (float)((float10)(float)fVar6 * fVar9);

  fVar4 = fVar2 * (float)fVar7;

  param_4 = (float)(fVar9 * (float10)fVar2);

  if (local_10 == 1) {

    local_c[local_1c] = (float)(((float10)fVar4 + (float10)fVar3) * (float10)fVar1);

    pfVar5 = local_c + local_18;

    *pfVar5 = (float)(((float10)param_4 + (float10)local_24) * fVar8);

    local_c[local_14] = (float)(((float10)fVar3 - (float10)fVar4) * fVar8);

    param_1 = (local_24 - param_4) * fVar1;

  }

  else {

    local_c[local_1c] = (float)((float10)fVar4 * (float10)fVar1 - (float10)fVar3 * fVar8);

    pfVar5 = local_c + local_18;

    *pfVar5 = (float)((float10)param_4 * (float10)fVar1 + (float10)local_24 * fVar8);

    local_c[local_14] = (float)((float10)fVar3 * (float10)fVar1 - (float10)fVar4 * fVar8);

    param_1 = (float)((float10)local_24 * (float10)fVar1 + (float10)param_4 * fVar8);

  }

  if (local_20 == 1.4013e-45) {

    *pfVar5 = -*pfVar5;

  }

  local_20 = fVar2;

  FUN_00535dc0(param_1,local_c[0],local_c[1],local_c[2]);

  return;

}




// --- FUN_00536af0 at 0x00536AF0 ---


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



void FUN_00536af0(float *param_1)



{

  float fVar1;

  int iVar2;

  float10 fVar3;

  undefined4 uVar4;

  float fVar5;

  

  fVar5 = param_1[1];

  fVar1 = *param_1;

  iVar2 = FUN_004524a0();

  if (iVar2 == 0) {

    fpatan((float10)fVar5,(float10)fVar1);

    fVar3 = (float10)_CIfmod(0);

    fVar5 = (float)(-fVar3 * (float10)_DAT_0079c6b0);

    uVar4 = 0;

    fVar3 = (float10)_CIasin(0,fVar5);

    FUN_00536930((float)(fVar3 * (float10)_DAT_0079c6c8 * (float10)_DAT_0079c6b0),uVar4,fVar5,iVar2)

    ;

  }

  return;

}




// --- FUN_00536b80 at 0x00536B80 ---


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



void __thiscall FUN_00536b80(int param_1,float param_2)



{

  float10 fVar1;

  float local_c;

  float local_8;

  float local_4;

  

  local_4 = (*(float *)(param_1 + 0x30) + *(float *)(param_1 + 0x18)) * DAT_00796344 +

            *(float *)(param_1 + 0x24);

  fVar1 = (float10)fsin((float10)param_2 * (float10)_DAT_0079c6b0);

  local_c = (float)fVar1;

  fVar1 = (float10)fcos((float10)param_2 * (float10)_DAT_0079c6b0);

  local_8 = (float)fVar1;

  FUN_00536af0(&local_c);

  return;

}




// --- FUN_00536bc0 at 0x00536BC0 ---


undefined4 __fastcall FUN_00536bc0(int param_1)



{

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

    return *(undefined4 *)(*(int *)(param_1 + 100) + 0xdc);

  }

  return 0;

}




// --- FUN_00536be0 at 0x00536BE0 ---


void __thiscall FUN_00536be0(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  

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

    FUN_0053ed10(*(int *)(param_1 + 0x70));

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

  }

  uVar1 = FUN_0053ed90(param_2);

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

  return;

}




// --- FUN_00536c10 at 0x00536C10 ---


void FUN_00536c10(int *param_1)



{

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

                    /* WARNING: Treating indirect jump as call */

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

  return;

}




// --- FUN_00536c20 at 0x00536C20 ---


undefined4 __fastcall FUN_00536c20(int param_1)



{

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

    return 0;

  }

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

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

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

  }

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

    FUN_0053ed10(*(int *)(param_1 + 0x70));

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

  }

  return 1;

}




// --- FUN_00536c60 at 0x00536C60 ---


undefined4 __thiscall FUN_00536c60(int param_1,int param_2)



{

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

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

      *(undefined4 *)(param_1 + 0x5c) = 2;

    }

    if ((*(int *)(param_1 + 0x5c) == 2) && (param_2 != 0)) {

      FUN_00536be0(param_2);

      return 1;

    }

  }

  return 0;

}




// --- FUN_00536ca0 at 0x00536CA0 ---


undefined4 __fastcall FUN_00536ca0(int param_1)



{

  undefined4 uVar1;

  

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

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

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

      FUN_0053ed10(*(int *)(param_1 + 0x70));

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

    }

    uVar1 = FUN_0053ed90(uVar1);

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

    return 1;

  }

  return 0;

}




// --- FUN_00536cf0 at 0x00536CF0 ---


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



{

  int iVar1;

  

  *(undefined4 *)(param_1 + 0x5c) = 2;

  if ((*(byte *)(param_1 + 0x58) & 4) == 0) {

    DAT_00846784 = DAT_00846780;

  }

  else {

    DAT_00846784 = DAT_00846778;

  }

  iVar1 = FUN_005410d0(param_2,param_3,*(uint *)(param_1 + 0x58) >> 2 & 0xffffff01);

  if (iVar1 != 0) {

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

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

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

    }

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

    return 1;

  }

  return 0;

}




// --- FUN_00536d70 at 0x00536D70 ---


undefined1 __fastcall FUN_00536d70(int param_1)



{

  char cVar1;

  

  cVar1 = FUN_004154a0();

  if (cVar1 == '\0') {

    return 0;

  }

  if ((*(int *)(param_1 + 0x2c) != 4) && (*(int **)(param_1 + 0x3c) != (int *)0x0)) {

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

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

  }

  return 1;

}




// --- FUN_00536da0 at 0x00536DA0 ---


undefined4 * __fastcall FUN_00536da0(undefined4 *param_1)



{

  undefined4 uVar1;

  

  FUN_00415460(DAT_00846070);

  FUN_00447220();

  param_1[0x18] = 0xffffffff;

  param_1[0x19] = 0xffffffff;

  *param_1 = &PTR_LAB_007ca4f0;

  param_1[0xc] = &PTR_LAB_007ca4dc;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x1a] = DAT_00846070;

  param_1[0x1f] = 0x3f800000;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x20] = DAT_00846070;

  uVar1 = DAT_00846070;

  param_1[0x23] = 0x3f800000;

  param_1[0x21] = uVar1;

  param_1[0x22] = 0;

  FUN_00446bf0(1);

  return param_1;

}




// --- FUN_00536e40 at 0x00536E40 ---


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



{

  int *piVar1;

  int iVar2;

  undefined4 uVar3;

  

  FUN_00415460(DAT_00846070);

  FUN_00447220();

  param_1[0xc] = &PTR_LAB_007ca4dc;

  *param_1 = &PTR_LAB_007ca4f0;

  if (param_1 != param_2) {

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

    if (param_2[0x17] == 1) {

      param_1[0x17] = 4;

    }

    else {

      param_1[0x17] = param_2[0x17];

    }

    param_1[0x1a] = param_2[0x1a];

    param_1[0x1b] = 0;

    param_1[0x1c] = 0;

    param_1[0x18] = param_2[0x18];

    param_1[0x19] = param_2[0x19];

    param_1[0x1d] = param_2[0x1d];

    param_1[0x1e] = param_2[0x1e];

    param_1[0x1f] = param_2[0x1f];

    param_1[0x20] = param_2[0x20];

    param_1[0x21] = param_2[0x21];

    param_1[0x22] = param_2[0x22];

    param_1[0x23] = param_2[0x23];

    piVar1 = (int *)param_2[0x1b];

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

      param_1[0x1b] = piVar1;

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

    }

    iVar2 = param_2[0x1c];

    if (iVar2 != 0) {

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

        FUN_0053ed10(param_1[0x1c]);

        param_1[0x1c] = 0;

      }

      uVar3 = FUN_0053ed90(iVar2);

      param_1[0x1c] = uVar3;

    }

  }

  return param_1;

}




// --- FUN_00536f30 at 0x00536F30 ---


void __fastcall FUN_00536f30(int param_1)



{

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

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

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

  }

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

    FUN_0053ed10(*(int *)(param_1 + 0x70));

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

  }

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

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

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

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

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

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

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

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

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

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

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

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

  return;

}




// --- FUN_00536fb0 at 0x00536FB0 ---


int FUN_00536fb0(int param_1)



{

  int iVar1;

  

  if ((((param_1 != 1) && (param_1 != 0)) && (iVar1 = FUN_005df0f5(0x90), iVar1 != 0)) &&

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

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

    return iVar1;

  }

  return 0;

}




// --- FUN_00536ff0 at 0x00536FF0 ---


undefined4 FUN_00536ff0(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  if (param_1 != 0) {

    iVar1 = FUN_005df0f5(0x90);

    if (iVar1 != 0) {

      uVar2 = FUN_00536e40(param_1);

      return uVar2;

    }

  }

  return 0;

}




// --- FUN_00537020 at 0x00537020 ---


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



{

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

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

      *(undefined4 *)(param_1 + 0x5c) = 2;

    }

    if ((*(int *)(param_1 + 0x5c) == 2) && ((*(int *)(param_1 + 0x6c) != 0 || (param_3 != 0)))) {

      if ((*(byte *)(param_1 + 0x58) & 6) == 0) {

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

      }

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

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

        FUN_0053ed10(*(int *)(param_1 + 0x70));

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

      }

      return 1;

    }

  }

  return 0;

}




// --- FUN_00537090 at 0x00537090 ---


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



{

  if ((*(int *)(param_1 + 0x20) == 0) && (*(int *)(param_1 + 0x5c) == param_3)) {

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

      return 0;

    }

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

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

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

    }

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

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

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

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

      *(undefined4 *)(param_1 + 0x80) = *(undefined4 *)(*(int *)(param_1 + 0x6c) + 0x28);

    }

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

      FUN_0053ed10(*(int *)(param_1 + 0x70));

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

    }

    return 1;

  }

  return 0;

}




// --- FUN_00537120 at 0x00537120 ---


void __thiscall FUN_00537120(int param_1,undefined4 *param_2)



{

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

  return;

}




// --- FUN_00537130 at 0x00537130 ---


void __thiscall FUN_00537130(int param_1,undefined4 *param_2)



{

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

  return;

}




// --- FUN_00537140 at 0x00537140 ---


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



void __thiscall FUN_00537140(int param_1,int param_2)



{

  undefined4 uVar1;

  int iVar2;

  

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

  if (iVar2 == 0) {

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

  }

  if (iVar2 == 0) {

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

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

LAB_005371f1:

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

    }

  }

  else if ((*(byte *)(param_1 + 0x58) & 6) != 0) {

    uVar1 = FUN_004220b0(iVar2,0xb);

    iVar2 = FUN_00415430(uVar1);

    if (iVar2 == 0) {

      if ((param_2 == 4) && (*(int **)(param_1 + 0x6c) != (int *)0x0)) {

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

        goto LAB_005371f1;

      }

    }

    else {

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

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

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

      }

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

      if (((*(int *)(iVar2 + 0x68) != 0) &&

          (*(undefined4 *)(param_1 + 0x68) = *(undefined4 *)(iVar2 + 0x28),

          *(int *)(param_1 + 0x70) == 0)) && (*(int *)(iVar2 + 0x68) != 0)) {

        FUN_00536be0(*(int *)(iVar2 + 0x68));

        if ((param_2 == 1) || (param_2 == 2)) {

          *(undefined4 *)(param_1 + 0x84) = *(undefined4 *)(*(int *)(param_1 + 0x70) + 0x28);

        }

      }

    }

  }

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

  if ((iVar2 != 0) &&

     ((((*(int *)(iVar2 + 100) != 0 && (*(int *)(*(int *)(iVar2 + 100) + 0xdc) == 0x29)) ||

       ((*(int *)(iVar2 + 100) != 0 && (*(int *)(*(int *)(iVar2 + 100) + 0xdc) == 0x65)))) &&

      (param_2 != 2)))) {

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

      iVar2 = FUN_00536cf0(iVar2,*(int *)(param_1 + 0x70));

      if (iVar2 != 0) goto LAB_00537244;

    }

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

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

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

    }

  }

LAB_00537244:

  if (_DAT_007ca4c8 < *(float *)(param_1 + 0x74)) {

    *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) | 0x10;

  }

  return;

}




// --- FUN_00537270 at 0x00537270 ---


undefined1 __fastcall FUN_00537270(int param_1)



{

  undefined4 uVar1;

  int *piVar2;

  int iVar3;

  undefined1 uVar4;

  

  uVar4 = 0;

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

  piVar2 = (int *)FUN_00415430(uVar1);

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

    if ((char)piVar2[0xe] != '\0') {

      (**(code **)(piVar2[0xc] + 0xc))();

    }

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

    uVar4 = 0;

    if ((iVar3 != 0) || (iVar3 = piVar2[0x1a], iVar3 != 0)) {

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

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

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

      }

      if ((*(byte *)(param_1 + 0x58) & 4) == 0) {

        DAT_00846784 = DAT_00846780;

      }

      else {

        DAT_00846784 = DAT_00846778;

      }

      iVar3 = FUN_005410d0(piVar2,iVar3,*(uint *)(param_1 + 0x58) >> 2 & 0xffffff01);

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

      if (iVar3 != 0) {

        uVar4 = 1;

      }

    }

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

  }

  return uVar4;

}




// --- FUN_005374c0 at 0x005374C0 ---


char __fastcall FUN_005374c0(int param_1)



{

  char cVar1;

  undefined4 uVar2;

  int iVar3;

  

  switch(*(int *)(param_1 + 0x5c) + -1) {

  case 0:

  case 3:

    DAT_00846784 = DAT_0084677c;

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

      return '\x01';

    }

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

    iVar3 = FUN_00415430(uVar2);

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

    if (iVar3 != 0) {

      return '\x01';

    }

    goto switchD_005374d6_default;

  case 1:

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

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

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

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

        if (iVar3 != 0) {

          return '\x01';

        }

      }

      goto switchD_005374d6_default;

    }

    cVar1 = FUN_00537270();

    break;

  case 2:

    DAT_00846784 = 0;

    cVar1 = FUN_00505370(param_1);

    break;

  default:

    goto switchD_005374d6_default;

  }

  if (cVar1 != '\0') {

    return cVar1;

  }

switchD_005374d6_default:

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

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

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

  }

  return '\0';

}




// --- FUN_005375a0 at 0x005375A0 ---


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



{

  *param_1 = &PTR_LAB_007ca4f0;

  param_1[0xc] = &PTR_LAB_007ca4dc;

  FUN_00536f30();

  FUN_00446f00();

  FUN_004154b0();

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

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_005375e0 at 0x005375E0 ---


byte __fastcall FUN_005375e0(int param_1)



{

  byte bVar1;

  byte bVar2;

  

  bVar1 = FUN_00446c20();

  if ((*(byte *)(param_1 + 0x28) & 6) != 0) {

    bVar2 = FUN_005374c0();

    bVar1 = bVar1 & bVar2;

  }

  if (bVar1 != 0) {

    FUN_00446c00();

  }

  return bVar1;

}




// --- FUN_00537610 at 0x00537610 ---


undefined4 __thiscall FUN_00537610(int param_1,float param_2)



{

  if (*(float *)(param_1 + 0x1b8) < param_2) {

    return 1;

  }

  return 0;

}




// --- FUN_00537630 at 0x00537630 ---


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



float10 FUN_00537630(float *param_1,float *param_2,float param_3)



{

  float10 fVar1;

  float10 fVar2;

  float10 fVar3;

  float10 fVar4;

  

  fVar3 = (float10)param_1[2] * (float10)param_1[2] +

          (float10)param_1[1] * (float10)param_1[1] + (float10)*param_1 * (float10)*param_1;

  fVar1 = -((float10)*param_1 * (float10)*param_2 +

           (float10)param_2[1] * (float10)param_1[1] + (float10)param_2[2] * (float10)param_1[2]);

  fVar4 = ((float10)param_2[2] * (float10)param_2[2] +

          (float10)param_2[1] * (float10)param_2[1] + (float10)*param_2 * (float10)*param_2) -

          (float10)param_3 * (float10)param_3;

  if ((((float10)_DAT_007ca5d8 <= fVar4) &&

      (fVar4 = fVar1 * fVar1 - fVar4 * fVar3, (float10)_DAT_007ca5d8 <= fVar3)) &&

     ((float10)_DAT_00795610 <= fVar4)) {

    fVar4 = SQRT(fVar4);

    fVar2 = fVar1 - fVar4;

    if ((float10)_DAT_00795610 <= fVar2) {

      return (float10)(double)fVar2 / fVar3;

    }

    return (fVar4 + fVar1) / fVar3;

  }

  return (float10)_DAT_0079cc48;

}




// --- FUN_00537720 at 0x00537720 ---


undefined4 FUN_00537720(float *param_1,float param_2)



{

  if (param_1[2] * param_1[2] + param_1[1] * param_1[1] + *param_1 * *param_1 <= param_2 * param_2)

  {

    return 1;

  }

  return 0;

}




// --- FUN_00537760 at 0x00537760 ---


void __thiscall FUN_00537760(float *param_1,float *param_2,float *param_3)



{

  *param_1 = *param_2;

  param_1[1] = param_2[1];

  param_1[2] = param_2[2];

  param_1[3] = -(*param_3 * *param_1 + param_3[1] * param_1[1] + param_3[2] * param_1[2]);

  return;

}




// --- FUN_005377a0 at 0x005377A0 ---


void __thiscall FUN_005377a0(int param_1,float *param_2)



{

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

  *(float *)(param_1 + 0x148) = *(float *)(param_1 + 0x148) + *param_2;

  *(float *)(param_1 + 0x14c) = param_2[1] + *(float *)(param_1 + 0x14c);

  *(float *)(param_1 + 0x150) = param_2[2] + *(float *)(param_1 + 0x150);

  FUN_0050d2e0(param_2);

  return;

}




// --- FUN_005377f0 at 0x005377F0 ---


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



uint FUN_005377f0(undefined4 param_1,float param_2,float param_3,undefined4 param_4,float *param_5,

                 float *param_6,float param_7,float param_8)



{

  float fVar1;

  float fVar2;

  float fVar3;

  uint uVar4;

  float local_24;

  float local_20;

  float local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  float local_c;

  float local_8;

  

  local_18 = 0;

  local_14 = 0;

  local_10 = 0;

  FUN_00452830(&local_24,param_1,&local_18);

  if ((DAT_00796344 <= param_8) && (param_8 <= param_3)) {

    param_7 = param_2 + param_7;

    fVar1 = local_24 * local_24 + local_20 * local_20;

    if (param_7 * param_7 < fVar1) {

      return 0;

    }

    if (ABS(local_1c) <= param_7) {

      local_18 = 0;

      local_14 = 0;

      local_10 = 0;

      FUN_00452830(&local_c,param_4,&local_18);

      uVar4 = 8;

      if (DAT_00796344 <= local_c) {

        uVar4 = 0x10;

      }

      if (DAT_00796344 <= local_8) {

        uVar4 = uVar4 | 0x20;

      }

      else {

        uVar4 = uVar4 | 0x40;

      }

      if (param_3 * (float)_DAT_007ca5e8 <= param_8) {

        if (param_3 * (float)_DAT_007ca5e0 <= param_8) {

          uVar4 = uVar4 | 1;

        }

        else {

          uVar4 = uVar4 | 2;

        }

      }

      else {

        uVar4 = uVar4 | 4;

      }

      fVar2 = local_20 * *param_5 - local_24 * param_5[1];

      fVar3 = local_24 * param_6[1] - local_20 * *param_6;

      if ((fVar2 < DAT_00796344 == (fVar2 == DAT_00796344)) ||

         (fVar3 < DAT_00796344 == (fVar3 == DAT_00796344))) {

        if (DAT_00796344 <= *param_5 * param_6[1] - param_5[1] * *param_6) {

          if (fVar3 * fVar2 < DAT_00796344 != (fVar3 * fVar2 == DAT_00796344)) {

            return uVar4;

          }

          if (fVar2 < param_2) {

            return uVar4;

          }

        }

        else if (DAT_00796344 <= fVar2) {

          if (DAT_00796344 <= fVar3) {

            if (param_2 * param_2 < fVar1) {

              return 0;

            }

            return uVar4;

          }

          if (DAT_00796344 <= fVar2) {

            if (fVar2 < param_2 == (fVar2 == param_2)) {

              return 0;

            }

            return uVar4;

          }

        }

        if (fVar3 < param_2 == (fVar3 == param_2)) {

          return 0;

        }

      }

      return uVar4;

    }

  }

  return 0;

}




// --- FUN_00537a60 at 0x00537A60 ---


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



undefined4 __thiscall

FUN_00537a60(float *param_1,undefined4 param_2,uint *param_3,int param_4,int param_5,float *param_6,

            float param_7)



{

  uint uVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  int iVar5;

  undefined4 uVar6;

  float *pfVar7;

  float local_28;

  float local_24;

  float local_20;

  undefined1 local_1c [12];

  undefined1 local_10 [16];

  

  fVar2 = param_6[1] * param_6[1];

  fVar3 = *param_6 * *param_6;

  if (param_7 * param_7 < param_6[2] * param_6[2] + fVar3 + fVar2) {

    if (*param_3 < 2) {

      return 1;

    }

    uVar1 = param_3[5];

    local_28 = *(float *)(uVar1 + 0x10) - *param_1;

    local_24 = *(float *)(uVar1 + 0x14) - param_1[1];

    local_20 = *(float *)(uVar1 + 0x18) - param_1[2];

    iVar5 = FUN_00537720(&local_28,param_7);

    if (iVar5 == 0) {

      return 1;

    }

  }

  fVar4 = (float)param_3[0x70] * (float)param_3[0x6f];

  if (_DAT_007ca5d8 <= ABS(fVar4)) {

    param_7 = _DAT_007ca5d8 + param_7;

    fVar2 = (SQRT(param_7 * param_7 - (fVar3 + fVar2)) - param_6[2]) / fVar4;

    fVar3 = ((float)_DAT_007938c0 - fVar2) * (float)param_3[0x6f];

    if ((fVar3 < (float)param_3[0x6f]) && ((float)_DAT_007c7700 <= fVar3)) {

      fVar4 = fVar4 * fVar2;

      fVar2 = fVar4 + param_6[2];

      param_6[2] = fVar2;

      param_7 = _DAT_007938b0 / param_7;

      *param_6 = param_7 * *param_6;

      param_6[1] = param_7 * param_6[1];

      param_7 = param_7 * fVar2;

      param_6[2] = param_7;

      if (param_7 <= (float)param_3[0x6e]) {

        return 1;

      }

      uVar6 = FUN_00455f30(local_1c,param_1[3],param_6);

      pfVar7 = (float *)FUN_0043d8b0(local_10,uVar6);

      local_28 = *pfVar7;

      local_24 = pfVar7[1];

      local_20 = pfVar7[2];

      FUN_00537760(param_6,&local_28);

      FUN_0050a850(local_10,1);

      *(uint *)(param_4 + 0x2c) = param_3[0x44];

      param_3[0x6f] = (uint)fVar3;

      local_28 = 0.0;

      local_24 = 0.0;

      local_20 = fVar4;

      FUN_005377a0(&local_28,*(undefined4 *)(param_5 + 0xc));

      return 3;

    }

  }

  return 2;

}




// --- FUN_00537c80 at 0x00537C80 ---


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



undefined4 __thiscall

FUN_00537c80(float *param_1,undefined4 param_2,int param_3,int param_4,float *param_5,

            undefined4 param_6,int param_7)



{

  float *pfVar1;

  float fVar2;

  float fVar3;

  int iVar4;

  float *pfVar5;

  float *pfVar6;

  float local_48;

  float local_44;

  float local_40;

  float local_3c;

  float local_38;

  float local_34;

  float local_30;

  float local_2c;

  float local_28;

  float local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_4;

  

  pfVar6 = (float *)(param_7 * 0x10 + *(int *)(param_3 + 0x14));

  local_48 = *(float *)(*(int *)(param_3 + 0x38) + param_7 * 0xc) - *param_1;

  pfVar1 = (float *)(*(int *)(param_3 + 0x38) + param_7 * 0xc);

  local_44 = pfVar1[1] - param_1[1];

  local_40 = pfVar1[2] - param_1[2];

  iVar4 = FUN_004524a0();

  if (iVar4 != 0) {

    return 2;

  }

  FUN_0050aad0(&local_48);

  if (*(int *)(param_4 + 0x18) == 0) {

    pfVar5 = (float *)(param_4 + 4);

  }

  else {

    pfVar5 = (float *)(param_4 + 0x1c);

  }

  local_3c = *pfVar5;

  local_38 = pfVar5[1];

  local_34 = pfVar5[2];

  local_30 = local_34 * local_44 - local_38 * local_40;

  local_2c = local_40 * local_3c - local_34 * local_48;

  local_28 = local_38 * local_48 - local_44 * local_3c;

  FUN_0043e7d0(&local_18,*(undefined4 *)(param_3 + 0xa4),*(undefined4 *)(param_3 + 0x110));

  local_4 = pfVar6[2] - pfVar1[2];

  local_24 = local_18 + (*pfVar6 - *pfVar1);

  local_20 = local_14 + (pfVar6[1] - pfVar1[1]);

  local_1c = local_10 + local_4;

  fVar3 = local_30 * local_30 + local_2c * local_2c + local_28 * local_28;

  if (_DAT_007ca5d8 <= fVar3) {

    fVar2 = local_24 * local_30 + local_20 * local_2c + local_1c * local_28;

    fVar3 = _DAT_007938b0 / fVar3;

    local_48 = local_30 * fVar2 * fVar3;

    local_38 = local_2c * fVar2 * fVar3;

    local_34 = local_28 * fVar2 * fVar3;

    if (local_48 * local_48 + local_38 * local_38 + local_34 * local_34 < _DAT_007ca5d8) {

      return 2;

    }

    local_30 = local_48 - local_24;

    local_2c = local_38 - local_20;

    local_28 = local_34 - local_1c;

    local_3c = local_48;

  }

  else {

    if (local_3c * *param_5 + local_38 * param_5[1] + local_34 * param_5[2] < DAT_00796344) {

      return 2;

    }

    local_14 = -local_44;

    local_10 = -local_40;

    local_28 = local_24 * local_48 + local_20 * local_44 + local_1c * local_40;

    local_30 = -local_48 * local_28;

    local_2c = local_14 * local_28;

    local_28 = local_10 * local_28;

    local_24 = local_30;

    local_20 = local_2c;

    local_1c = local_28;

    local_4 = local_28;

  }

  FUN_005377a0(&local_30,pfVar6[3]);

  return 4;

}




// --- FUN_00537f70 at 0x00537F70 ---


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



undefined4 __thiscall

FUN_00537f70(float *param_1,int param_2,int param_3,undefined4 param_4,float *param_5,

            undefined4 param_6,float param_7,int param_8)



{

  float *pfVar1;

  int iVar2;

  float10 fVar3;

  float10 fVar4;

  float local_30;

  float local_2c;

  float local_28;

  float local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_4;

  

  pfVar1 = (float *)(*(int *)(param_3 + 0x38) + param_8 * 0xc);

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

    local_30 = *pfVar1 - *param_1;

    local_2c = pfVar1[1] - param_1[1];

    local_28 = pfVar1[2] - param_1[2];

    iVar2 = FUN_004524a0();

    if (iVar2 == 0) {

      FUN_0050aad0(&local_30);

    }

    return 2;

  }

  param_7 = _DAT_007ca5d8 + param_7;

  local_18 = *pfVar1 - *param_1;

  local_14 = pfVar1[1] - param_1[1];

  local_10 = pfVar1[2] - param_1[2];

  FUN_0043e7d0(&local_24,*(undefined4 *)(param_3 + 0xa4),*(undefined4 *)(param_3 + 0x110));

  local_4 = param_5[2] - pfVar1[2];

  local_30 = local_24 + (*param_5 - *pfVar1);

  local_2c = local_20 + (param_5[1] - pfVar1[1]);

  local_28 = local_1c + local_4;

  local_24 = local_30;

  local_20 = local_2c;

  local_1c = local_28;

  fVar3 = (float10)FUN_00537630(&local_24,&local_18,param_7);

  if (((float10)_DAT_007ca5d8 <= fVar3) && (fVar3 <= (float10)_DAT_007938c0)) {

    local_10 = (float)((float10)local_28 * fVar3);

    fVar4 = (float10)local_30 * fVar3 - (float10)local_30;

    local_2c = (float)((float10)local_2c * fVar3) - local_2c;

    local_28 = local_10 - local_28;

    local_30 = (float)fVar4;

    local_18 = (float)(fVar4 + (float10)*param_5) - *param_1;

    local_14 = (local_2c + param_5[1]) - param_1[1];

    local_1c = _DAT_007938b0 / param_7;

    local_24 = local_18 * local_1c;

    local_20 = local_14 * local_1c;

    local_1c = ((local_28 + param_5[2]) - param_1[2]) * local_1c;

    local_4 = local_28;

    FUN_0050aad0(&local_24);

    FUN_005377a0(&local_30,param_5[3]);

    return 3;

  }

  return 2;

}




// --- FUN_00538180 at 0x00538180 ---


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



undefined4 __thiscall

FUN_00538180(float *param_1,int param_2,int param_3,float *param_4,float *param_5)



{

  float fVar1;

  float fVar2;

  float fVar3;

  int iVar4;

  float *pfVar5;

  float fVar6;

  float local_18;

  float local_14;

  float local_10;

  float local_c;

  float local_8;

  float local_4;

  

  if (((*param_4 == DAT_00796344) && (param_4[1] == DAT_00796344)) && (param_4[2] == DAT_00796344))

  {

    local_8 = param_5[1] - param_1[1];

    local_18 = (*param_5 - *param_1) * _DAT_007938b8;

    local_14 = local_8 * _DAT_007938b8;

    local_10 = (param_5[2] - param_1[2]) * _DAT_007938b8;

    local_4 = local_10;

    FUN_005377a0(&local_18,param_1[3]);

    return 3;

  }

  FUN_0050aad0(param_4);

  FUN_0043e7d0(&local_c,*(undefined4 *)(param_2 + 0xa4),*(undefined4 *)(param_2 + 0x110));

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

  local_c = local_c + (*param_1 - *param_5);

  local_8 = local_8 + (param_1[1] - param_5[1]);

  local_4 = local_4 + (param_1[2] - param_5[2]);

  if (*(int *)(param_3 + 0x18) == 0) {

    pfVar5 = (float *)(param_3 + 4);

  }

  local_18 = param_4[1] * pfVar5[2] - param_4[2] * pfVar5[1];

  fVar6 = *pfVar5 * param_4[2] - pfVar5[2] * *param_4;

  local_10 = pfVar5[1] * *param_4 - *pfVar5 * param_4[1];

  fVar3 = local_18 * local_18 + fVar6 * fVar6 + local_10 * local_10;

  if (_DAT_007ca5d8 <= fVar3) {

    fVar1 = local_18 * local_c + fVar6 * local_8 + local_10 * local_4;

    fVar3 = _DAT_007938b0 / fVar3;

    fVar2 = fVar3 * local_18 * fVar1;

    local_14 = fVar6 * fVar1 * fVar3;

    local_10 = local_10 * fVar1 * fVar3;

    if (fVar2 * fVar2 + local_14 * local_14 + local_10 * local_10 < _DAT_007ca5d8) {

      return 2;

    }

    local_c = fVar2 - local_c;

    fVar6 = param_1[3];

    pfVar5 = &local_c;

    local_8 = local_14 - local_8;

    local_4 = local_10 - local_4;

  }

  else {

    if (*pfVar5 * *param_4 + param_4[1] * pfVar5[1] + param_4[2] * pfVar5[2] < DAT_00796344) {

      local_c = -local_c;

      *param_4 = local_c;

      local_8 = -local_8;

      local_4 = -local_4;

      param_4[1] = local_8;

      param_4[2] = local_4;

      iVar4 = FUN_004524a0();

      if (iVar4 == 0) {

        FUN_0050aad0(param_4);

      }

      return 2;

    }

    local_10 = local_8 * param_4[1] + local_4 * param_4[2] + local_c * *param_4;

    local_18 = -*param_4 * local_10;

    local_14 = -param_4[1] * local_10;

    local_10 = -param_4[2] * local_10;

    fVar6 = param_1[3];

    pfVar5 = &local_18;

    local_c = local_18;

    local_8 = local_14;

    local_4 = local_10;

  }

  FUN_005377a0(pfVar5,fVar6);

  return 4;

}




// --- FUN_005384e0 at 0x005384E0 ---


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



undefined4 __thiscall FUN_005384e0(float *param_1,float *param_2,double *param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  

  fVar1 = *param_2 - *param_1;

  fVar2 = param_2[1] - param_1[1];

  fVar3 = param_2[2] - param_1[2];

  fVar4 = param_2[3] * param_2[3] + param_2[4] * param_2[4] + param_2[5] * param_2[5];

  fVar5 = -(fVar1 * param_2[3] + fVar2 * param_2[4] + fVar3 * param_2[5]);

  fVar1 = (fVar2 * fVar2 + fVar3 * fVar3 + fVar1 * fVar1) - param_1[3] * param_1[3];

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

    fVar1 = fVar5 * fVar5 - fVar1 * fVar4;

    if (_DAT_007ca5d8 <= fVar4) {

      if ((float)_DAT_00795610 <= fVar1) {

        fVar1 = SQRT(fVar1);

        if (fVar1 < fVar5) {

          *param_3 = (double)((fVar5 - fVar1) / fVar4);

          return 1;

        }

        *param_3 = (double)((fVar1 + fVar5) / fVar4);

        return 1;

      }

    }

  }

  return 0;

}




// --- FUN_005385e0 at 0x005385E0 ---


void __thiscall FUN_005385e0(int param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  

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

  *(undefined4 *)(param_1 + 0x160) = *(undefined4 *)(param_1 + 0x108);

  *(undefined4 *)(param_1 + 0x168) = *(undefined4 *)(param_1 + 0x110);

  FUN_00425f10(param_1 + 0x114);

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

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

  uVar1 = param_2[2];

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

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

  return;

}




// --- FUN_00538640 at 0x00538640 ---


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



undefined4 __thiscall

FUN_00538640(float *param_1,int param_2,undefined4 param_3,int param_4,float param_5)



{

  float *pfVar1;

  int iVar2;

  undefined4 uVar3;

  float local_c;

  float local_8;

  float local_4;

  

  if (*(float *)(param_2 + 0xc) < (_DAT_007ca5d8 + param_5) - *(float *)(param_4 + 8)) {

    uVar3 = FUN_00537c80(param_2,param_2 + 0x20,param_2 + 0x270,param_4,_DAT_007ca5d8 + param_5,0);

    return uVar3;

  }

  pfVar1 = *(float **)(param_2 + 0x58);

  local_4 = pfVar1[2] - param_1[2];

  local_8 = pfVar1[1] - param_1[1];

  local_c = *pfVar1 - *param_1;

  iVar2 = FUN_0050c0e0(&local_c);

  if (iVar2 != 0) {

    return 1;

  }

  uVar3 = FUN_0050ce80(param_2,param_2 + 0x270);

  return uVar3;

}




// --- FUN_005386e0 at 0x005386E0 ---


undefined4 __thiscall FUN_005386e0(float *param_1,undefined4 param_2,int param_3)



{

  float *pfVar1;

  int iVar2;

  float local_c;

  float local_8;

  float local_4;

  

  pfVar1 = *(float **)(param_3 + 0x38);

  local_c = *pfVar1 - *param_1;

  local_8 = pfVar1[1] - param_1[1];

  local_4 = pfVar1[2] - param_1[2];

  iVar2 = FUN_004524a0();

  if (iVar2 != 0) {

    return 2;

  }

  FUN_005385e0(&local_c);

  *(undefined4 *)(param_3 + 0x1b8) = DAT_007ca580;

  return 3;

}




// --- FUN_00538750 at 0x00538750 ---


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



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  int in_stack_0000001c;

  float local_c;

  float local_8;

  float local_4;

  

  iVar1 = *(int *)(param_3 + 0x38) + in_stack_0000001c * 0xc;

  local_c = *(float *)(*(int *)(param_3 + 0x38) + in_stack_0000001c * 0xc) - *param_1;

  local_8 = *(float *)(iVar1 + 4) - param_1[1];

  local_4 = *(float *)(iVar1 + 8) - param_1[2];

  iVar2 = FUN_004524a0();

  if (iVar2 != 0) {

    return 2;

  }

  uVar3 = FUN_00538180(param_3,param_4,&local_c,iVar1);

  return uVar3;

}




// --- FUN_005387c0 at 0x005387C0 ---


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



undefined4 __thiscall FUN_005387c0(float *param_1,float param_2,int param_3)



{

  uint *puVar1;

  float fVar2;

  int iVar3;

  undefined4 uVar4;

  int iVar5;

  float *pfVar6;

  float *pfVar7;

  int iVar8;

  float10 fVar9;

  float10 fVar10;

  float10 fVar11;

  undefined8 uVar12;

  float local_34;

  float local_30;

  float local_2c;

  float local_28;

  float local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  undefined1 local_10 [8];

  float local_8;

  

  iVar3 = (int)param_2;

  puVar1 = (uint *)((int)param_2 + 0x20);

  pfVar6 = *(float **)((int)param_2 + 0x34);

  local_34 = *pfVar6 - *param_1;

  iVar5 = (int)param_2 + 0x270;

  local_30 = pfVar6[1] - param_1[1];

  local_2c = pfVar6[2] - param_1[2];

  fVar2 = (param_1[3] + pfVar6[3]) - _DAT_007ca5d8;

  if ((*(int *)((int)param_2 + 0x1cc) == 0) && (*(int *)((int)param_2 + 0x174) != 1)) {

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

      if (param_3 == 0) {

        param_2 = fVar2;

        uVar4 = FUN_00537a60(iVar3,puVar1,iVar5,pfVar6,&local_34,fVar2);

        return uVar4;

      }

      return 1;

    }

    if (*(int *)((int)param_2 + 0x1f8) == 0) {

      if (*(int *)((int)param_2 + 0x124) == 0) {

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

          param_2 = fVar2;

          uVar12 = FUN_00537720(&local_34,fVar2);

          if ((int)uVar12 != 0) {

            uVar4 = FUN_00538640(iVar3,pfVar6,&local_34,(int)((ulonglong)uVar12 >> 0x20));

            return uVar4;

          }

          if (*puVar1 < 2) {

            return 1;

          }

          FUN_00452500(&local_1c,param_1);

          iVar8 = FUN_00537720(&local_1c,param_2);

          if (iVar8 == 0) {

            return 1;

          }

          uVar4 = FUN_00538750(iVar3,puVar1,iVar5,pfVar6 + 4,&local_1c,&param_2,1);

          return uVar4;

        }

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

          param_2 = fVar2;

          uVar12 = FUN_00537720(&local_34,fVar2);

          if ((int)uVar12 == 0) {

            return 1;

          }

          uVar4 = FUN_00537f70(iVar3,puVar1,(int)((ulonglong)uVar12 >> 0x20),pfVar6,&local_34,

                               param_2,0);

          return uVar4;

        }

        param_2 = fVar2;

        uVar12 = FUN_00537720(&local_34,fVar2);

        if ((int)uVar12 == 0) {

          if (*puVar1 < 2) {

            return 1;

          }

          FUN_00452500(&local_1c,param_1);

          uVar12 = FUN_00537720(&local_1c,param_2);

          if ((int)uVar12 == 0) {

            return 1;

          }

          uVar4 = FUN_00537f70(iVar3,puVar1,iVar5,pfVar6 + 4,&local_1c,

                               (int)((ulonglong)uVar12 >> 0x20),1);

          return uVar4;

        }

        uVar4 = FUN_005386e0(iVar3,puVar1,(int)((ulonglong)uVar12 >> 0x20),pfVar6,&local_34,param_2)

        ;

        return uVar4;

      }

      if (param_3 != 0) {

        return 1;

      }

      param_2 = fVar2;

      iVar5 = FUN_00537720(&local_34,fVar2);

      if (iVar5 == 0) {

        if (*puVar1 < 2) {

          return 1;

        }

        FUN_00452500(&local_1c,param_1);

        iVar5 = FUN_00537720(&local_1c,fVar2);

        if (iVar5 == 0) {

          return 1;

        }

      }

      uVar4 = FUN_0050aaa0(local_10);

      pfVar7 = &local_28;

      FUN_00452500(&local_1c,pfVar6);

      FUN_00452500(pfVar7,uVar4);

      param_2 = _DAT_007ca5d8 + param_2;

      fVar10 = (float10)local_28 * (float10)local_28 +

               (float10)local_24 * (float10)local_24 + (float10)local_20 * (float10)local_20;

      fVar9 = -((float10)local_20 * (float10)local_2c +

               (float10)local_28 * (float10)local_34 + (float10)local_24 * (float10)local_30);

      if (ABS(fVar10) < (float10)_DAT_007ca5d8) {

        return 2;

      }

      fVar11 = SQRT(fVar9 * fVar9 -

                    (((float10)local_2c * (float10)local_2c +

                     (float10)local_34 * (float10)local_34 + (float10)local_30 * (float10)local_30)

                    - (float10)param_2 * (float10)param_2) * fVar10) + fVar9;

      if ((float10)_DAT_007938c0 < fVar11) {

        fVar11 = ((float10)(double)fVar9 + (float10)(double)fVar9) - fVar11;

      }

      fVar11 = fVar11 / fVar10;

      fVar9 = ((float10)_DAT_007938c0 - fVar11) * (float10)*(float *)(iVar3 + 0x1dc);

      if (fVar9 < (float10)*(float *)(iVar3 + 0x1dc)) {

        if (fVar9 < (float10)_DAT_007c7700) {

          return 2;

        }

        local_28 = (float)((float10)local_28 * fVar11);

        local_24 = (float)((float10)local_24 * fVar11);

        local_20 = (float)((float10)local_20 * fVar11);

        local_34 = local_28 + local_34;

        local_30 = local_24 + local_30;

        local_2c = local_20 + local_2c;

        FUN_00451ae0(param_2);

        iVar5 = FUN_00537610(local_2c);

        if (iVar5 == 0) {

          return 1;

        }

        pfVar7 = (float *)FUN_00455f30(local_10,pfVar6[3],&local_34);

        local_8 = pfVar7[2];

        local_1c = *pfVar6 - *pfVar7;

        local_18 = pfVar6[1] - pfVar7[1];

        local_14 = pfVar6[2] - local_8;

        FUN_00537760(&local_34,&local_1c);

        FUN_0050a850(local_10,1);

        *(undefined4 *)(iVar3 + 0x29c) = *(undefined4 *)(iVar3 + 0x130);

        *(float *)(iVar3 + 0x1dc) = (float)fVar9;

        FUN_005377a0(&local_28,pfVar6[3]);

        return 3;

      }

      return 2;

    }

    param_2 = fVar2;

    iVar5 = FUN_00537720(&local_34,fVar2);

    if (iVar5 != 0) {

      return 2;

    }

    if (*puVar1 < 2) {

      return 1;

    }

    pfVar6 = (float *)FUN_00452500(local_10,param_1);

    local_34 = *pfVar6;

    local_30 = pfVar6[1];

    local_2c = pfVar6[2];

  }

  else {

    if (local_2c * local_2c + local_34 * local_34 + local_30 * local_30 <= fVar2 * fVar2) {

      return 2;

    }

    if (*puVar1 < 2) {

      return 1;

    }

    local_34 = pfVar6[4] - *param_1;

    local_30 = pfVar6[5] - param_1[1];

    local_2c = pfVar6[6] - param_1[2];

    param_2 = fVar2;

    local_28 = local_34;

    local_24 = local_30;

    local_20 = local_2c;

  }

  iVar5 = FUN_00537720(&local_34,fVar2);

  if (iVar5 == 0) {

    return 1;

  }

  return 2;

}




// --- FUN_00538d10 at 0x00538D10 ---


void __thiscall

FUN_00538d10(float *param_1,undefined4 param_2,float param_3,undefined4 param_4,undefined4 param_5)



{

  undefined4 *puVar1;

  float local_28;

  float local_24;

  float local_20;

  undefined1 local_1c [8];

  float local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  float local_4;

  

  local_4 = param_3 * param_1[3];

  local_28 = param_3 * *param_1;

  local_24 = param_3 * param_1[1];

  local_20 = param_3 * param_1[2];

  local_14 = local_20;

  puVar1 = (undefined4 *)FUN_004562a0(local_1c,param_2,&local_28);

  local_10 = *puVar1;

  local_c = puVar1[1];

  local_8 = puVar1[2];

  FUN_005387c0(param_4,param_5);

  return;

}




// --- FUN_00538da0 at 0x00538DA0 ---


undefined4 __thiscall FUN_00538da0(undefined4 *param_1,float *param_2,int param_3)



{

  float *pfVar1;

  float fVar2;

  float *pfVar3;

  int iVar4;

  undefined4 *puVar5;

  

  iVar4 = *(byte *)((int)param_1 + 0xe) - 1;

  if (-1 < iVar4) {

    puVar5 = (undefined4 *)*param_1 + iVar4;

    pfVar3 = *(float **)*param_1;

    do {

      pfVar1 = (float *)*puVar5;

      fVar2 = (pfVar3[1] - pfVar1[1]) * *param_2 +

              (*pfVar1 - *pfVar3) * param_2[1] +

              (-((pfVar3[1] - pfVar1[1]) * *pfVar1) - (*pfVar1 - *pfVar3) * pfVar1[1]);

      if (param_3 == 0) {

        if (DAT_00796344 < fVar2) {

          return 0;

        }

      }

      else if (fVar2 < DAT_00796344) {

        return 0;

      }

      iVar4 = iVar4 + -1;

      puVar5 = puVar5 + -1;

      pfVar3 = pfVar1;

    } while (-1 < iVar4);

  }

  return 1;

}




// --- FUN_00538e20 at 0x00538E20 ---


void __fastcall FUN_00538e20(undefined4 *param_1)



{

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

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

    param_1[5] = 0;

  }

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

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

    param_1[6] = 0;

  }

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

    operator_delete__((void *)*param_1);

    *param_1 = 0;

  }

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

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

    param_1[1] = 0;

  }

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

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

    param_1[2] = 0;

  }

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

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

  *(undefined2 *)(param_1 + 7) = 0xffff;

  *(undefined2 *)((int)param_1 + 0x1e) = 0xffff;

  *(undefined2 *)(param_1 + 3) = 0xffff;

  return;

}




// --- FUN_00538eb0 at 0x00538EB0 ---


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



float10 __thiscall FUN_00538eb0(int param_1,int param_2,float *param_3,float *param_4)



{

  float fVar1;

  float10 fVar2;

  float10 fVar3;

  

  fVar1 = *param_3 * *(float *)(param_1 + 0x20) +

          *(float *)(param_1 + 0x24) * param_3[1] + *(float *)(param_1 + 0x28) * param_3[2] +

          *(float *)(param_1 + 0x2c);

  if (ABS(fVar1) < *(float *)(param_2 + 0xc)) {

    return (float10)_DAT_007938c0;

  }

  fVar3 = (float10)*param_4 * (float10)*(float *)(param_1 + 0x20) +

          (float10)*(float *)(param_1 + 0x24) * (float10)param_4[1] +

          (float10)*(float *)(param_1 + 0x28) * (float10)param_4[2];

  if (ABS(fVar3) < (float10)_DAT_007ca628) {

    return (float10)_DAT_00795610;

  }

  fVar2 = (float10)*(float *)(param_2 + 0xc);

  if (fVar1 <= DAT_00796344) {

    fVar2 = -fVar2;

  }

  return (fVar2 - (float10)fVar1) / fVar3;

}




// --- FUN_00538f50 at 0x00538F50 ---


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



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



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  

  fVar3 = *param_3 * *(float *)(param_1 + 0x20) +

          *(float *)(param_1 + 0x28) * param_3[2] + *(float *)(param_1 + 0x24) * param_3[1] +

          *(float *)(param_1 + 0x2c);

  fVar4 = *(float *)(param_1 + 0x20) * *param_4 +

          *(float *)(param_1 + 0x24) * param_4[1] + *(float *)(param_1 + 0x28) * param_4[2];

  if (fVar4 <= _DAT_007ca628) {

    if (-_DAT_007ca628 <= fVar4) {

      return 0;

    }

    fVar3 = fVar3 - param_3[3];

  }

  else {

    fVar3 = -param_3[3] - fVar3;

  }

  fVar3 = fVar3 / fVar4;

  fVar4 = ((float)_DAT_007938c0 - fVar3) * *(float *)(param_2 + 0x1bc);

  if ((fVar4 < *(float *)(param_2 + 0x1bc)) && ((float)_DAT_007ca630 <= fVar4)) {

    fVar1 = param_4[1];

    fVar2 = param_4[2];

    *param_3 = *param_3 - fVar3 * *param_4;

    param_3[1] = param_3[1] - fVar3 * fVar1;

    param_3[2] = param_3[2] - fVar3 * fVar2;

    *(float *)(param_2 + 0x1bc) = fVar4;

    return 1;

  }

  return 0;

}




// --- FUN_00539060 at 0x00539060 ---


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



undefined4 __thiscall FUN_00539060(float *param_1,float *param_2,double *param_3)



{

  float fVar1;

  

  fVar1 = param_2[3] * *param_1 + param_2[4] * param_1[1] + param_2[5] * param_1[2];

  if ((_DAT_007ca628 <= ABS(fVar1)) &&

     (fVar1 = ((float)_DAT_0079cc48 / fVar1) *

              (*param_2 * *param_1 + param_2[1] * param_1[1] + param_2[2] * param_1[2] + param_1[3])

     , *param_3 = (double)fVar1, (float)_DAT_00795610 <= fVar1)) {

    return 1;

  }

  return 0;

}




// --- FUN_005390e0 at 0x005390E0 ---


void __fastcall FUN_005390e0(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  *(undefined2 *)(param_1 + 3) = 0xffff;

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

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

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  *(undefined2 *)(param_1 + 7) = 0xffff;

  *(undefined2 *)((int)param_1 + 0x1e) = 0xffff;

  param_1[2] = 0;

  return;

}




// --- FUN_00539110 at 0x00539110 ---


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



void __fastcall FUN_00539110(undefined4 *param_1)



{

  float *pfVar1;

  float *pfVar2;

  float *pfVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float fVar7;

  undefined4 *puVar8;

  uint uVar9;

  uint uVar10;

  int iVar11;

  float local_1c;

  

  uVar9 = (uint)*(byte *)((int)param_1 + 0xe);

  local_1c = 0.0;

  fVar4 = DAT_00796344;

  fVar6 = DAT_00796344;

  if (1 < (int)(uVar9 - 1)) {

    pfVar1 = *(float **)*param_1;

    iVar11 = *(byte *)((int)param_1 + 0xe) - 2;

    puVar8 = (undefined4 *)*param_1;

    do {

      pfVar2 = (float *)puVar8[2];

      iVar11 = iVar11 + -1;

      pfVar3 = (float *)puVar8[1];

      fVar4 = ((pfVar3[1] - pfVar1[1]) * (pfVar2[2] - pfVar1[2]) -

              (pfVar3[2] - pfVar1[2]) * (pfVar2[1] - pfVar1[1])) + fVar4;

      fVar6 = ((pfVar3[2] - pfVar1[2]) * (*pfVar2 - *pfVar1) -

              (pfVar2[2] - pfVar1[2]) * (*pfVar3 - *pfVar1)) + fVar6;

      local_1c = ((pfVar2[1] - pfVar1[1]) * (*pfVar3 - *pfVar1) -

                 (pfVar3[1] - pfVar1[1]) * (*pfVar2 - *pfVar1)) + local_1c;

      puVar8 = puVar8 + 1;

    } while (iVar11 != 0);

  }

  fVar5 = _DAT_007938b0 / SQRT(fVar4 * fVar4 + fVar6 * fVar6 + local_1c * local_1c);

  fVar7 = DAT_00796344;

  if (uVar9 != 0) {

    puVar8 = (undefined4 *)*param_1;

    uVar10 = (uint)*(byte *)((int)param_1 + 0xe);

    do {

      pfVar1 = (float *)*puVar8;

      puVar8 = puVar8 + 1;

      uVar10 = uVar10 - 1;

      fVar7 = fVar5 * fVar4 * *pfVar1 + fVar5 * fVar6 * pfVar1[1] + fVar5 * local_1c * pfVar1[2] +

              fVar7;

    } while (uVar10 != 0);

  }

  param_1[0xb] = -(fVar7 / (float)uVar9);

  param_1[8] = fVar5 * fVar4;

  param_1[9] = fVar5 * fVar6;

  param_1[10] = fVar5 * local_1c;

  return;

}




// --- FUN_00539270 at 0x00539270 ---


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



{

  uint uVar1;

  uint uVar2;

  undefined2 *puVar3;

  int iVar4;

  

  uVar2 = (uint)*(byte *)(param_1 + 0xe);

  uVar1 = uVar2 * 2 + 0xc;

  if ((*(byte *)(param_1 + 0xf) & 4) == 0) {

    uVar1 = uVar1 + uVar2;

  }

  if ((*(int *)(param_1 + 0x10) == 2) && ((*(byte *)(param_1 + 0xf) & 8) == 0)) {

    uVar1 = uVar1 + uVar2;

  }

  if (uVar1 <= param_3) {

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 2;

    *(undefined1 *)(iVar4 + 2) = *(undefined1 *)(param_1 + 0xe);

    iVar4 = *param_2;

    *param_2 = iVar4 + 1;

    *(undefined1 *)(iVar4 + 1) = *(undefined1 *)(param_1 + 0xf);

    iVar4 = *param_2;

    *param_2 = iVar4 + 1;

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

    *(undefined2 *)(iVar4 + 4) = *(undefined2 *)(param_1 + 0x1c);

    iVar4 = *param_2;

    *param_2 = iVar4 + 2;

    *(undefined2 *)(iVar4 + 2) = *(undefined2 *)(param_1 + 0x1e);

    puVar3 = (undefined2 *)(*param_2 + 2);

    *param_2 = (int)puVar3;

    iVar4 = 0;

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

      do {

        *puVar3 = *(undefined2 *)(*(int *)(param_1 + 4) + iVar4 * 2);

        puVar3 = (undefined2 *)(*param_2 + 2);

        *param_2 = (int)puVar3;

        iVar4 = iVar4 + 1;

      } while (iVar4 < (int)(uint)*(byte *)(param_1 + 0xe));

    }

    if (((*(byte *)(param_1 + 0xf) & 4) == 0) && (iVar4 = 0, *(char *)(param_1 + 0xe) != '\0')) {

      do {

        *(undefined1 *)*param_2 = *(undefined1 *)(iVar4 + *(int *)(param_1 + 0x14));

        *param_2 = *param_2 + 1;

        iVar4 = iVar4 + 1;

      } while (iVar4 < (int)(uint)*(byte *)(param_1 + 0xe));

    }

    if (((*(int *)(param_1 + 0x10) == 2) && ((*(byte *)(param_1 + 0xf) & 8) == 0)) &&

       (iVar4 = 0, *(char *)(param_1 + 0xe) != '\0')) {

      do {

        *(undefined1 *)*param_2 = *(undefined1 *)(iVar4 + *(int *)(param_1 + 0x18));

        *param_2 = *param_2 + 1;

        iVar4 = iVar4 + 1;

      } while (iVar4 < (int)(uint)*(byte *)(param_1 + 0xe));

    }

  }

  return;

}




// --- FUN_00539390 at 0x00539390 ---


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



{

  int iVar1;

  

  FUN_00538e20();

  *(undefined2 *)(param_1 + 3) = *(undefined2 *)*param_2;

  iVar1 = *param_2;

  *param_2 = iVar1 + 2;

  *(undefined1 *)((int)param_1 + 0xe) = *(undefined1 *)(iVar1 + 2);

  iVar1 = *param_2;

  *param_2 = iVar1 + 1;

  *(undefined1 *)((int)param_1 + 0xf) = *(undefined1 *)(iVar1 + 1);

  iVar1 = *param_2;

  *param_2 = iVar1 + 1;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined2 *)(param_1 + 7) = *(undefined2 *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 2;

  *(undefined2 *)((int)param_1 + 0x1e) = *(undefined2 *)(iVar1 + 2);

  *param_2 = *param_2 + 2;

  iVar1 = thunk_FUN_005df0f5((uint)*(byte *)((int)param_1 + 0xe) << 2);

  *param_1 = iVar1;

  iVar1 = thunk_FUN_005df0f5((uint)*(byte *)((int)param_1 + 0xe) << 1);

  param_1[1] = iVar1;

  iVar1 = thunk_FUN_005df0f5((uint)*(byte *)((int)param_1 + 0xe) << 2);

  param_1[2] = iVar1;

  iVar1 = 0;

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

    do {

      *(undefined2 *)(param_1[1] + iVar1 * 2) = *(undefined2 *)*param_2;

      *param_2 = *param_2 + 2;

      *(uint *)(*param_1 + iVar1 * 4) =

           (uint)*(ushort *)(param_1[1] + iVar1 * 2) * DAT_0081f710 + *(int *)(DAT_0084610c + 0x24);

      iVar1 = iVar1 + 1;

    } while (iVar1 < (int)(uint)*(byte *)((int)param_1 + 0xe));

  }

  if ((*(byte *)((int)param_1 + 0xf) & 4) == 0) {

    iVar1 = thunk_FUN_005df0f5(*(undefined1 *)((int)param_1 + 0xe));

    param_1[5] = iVar1;

    iVar1 = 0;

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

      do {

        *(undefined1 *)(iVar1 + param_1[5]) = *(undefined1 *)*param_2;

        *param_2 = *param_2 + 1;

        iVar1 = iVar1 + 1;

      } while (iVar1 < (int)(uint)*(byte *)((int)param_1 + 0xe));

    }

  }

  if ((param_1[4] == 2) && ((*(byte *)((int)param_1 + 0xf) & 8) == 0)) {

    iVar1 = thunk_FUN_005df0f5(*(undefined1 *)((int)param_1 + 0xe));

    param_1[6] = iVar1;

    iVar1 = 0;

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

      do {

        *(undefined1 *)(iVar1 + param_1[6]) = *(undefined1 *)*param_2;

        *param_2 = *param_2 + 1;

        iVar1 = iVar1 + 1;

      } while (iVar1 < (int)(uint)*(byte *)((int)param_1 + 0xe));

    }

  }

  if (param_1[4] == 1) {

    *(short *)((int)param_1 + 0x1e) = (short)param_1[7];

    param_1[6] = param_1[5];

  }

  FUN_00539110();

  return 1;

}




// --- FUN_00539500 at 0x00539500 ---


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



undefined4 __thiscall FUN_00539500(int *param_1,float *param_2,float *param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float *pfVar5;

  float *pfVar6;

  float fVar7;

  float fVar8;

  float fVar9;

  float fVar10;

  float fVar11;

  float fVar12;

  float fVar13;

  float *pfVar14;

  int iVar15;

  int iVar16;

  

  pfVar14 = param_3;

  fVar7 = (float)param_1[8] * *param_2 +

          (float)param_1[10] * param_2[2] + (float)param_1[9] * param_2[1] + (float)param_1[0xb];

  fVar1 = param_2[3] - _DAT_007ca628;

  if (fVar1 < ABS(fVar7)) {

    return 0;

  }

  iVar15 = 0;

  fVar8 = fVar1 * fVar1 - fVar7 * fVar7;

  param_3 = (float *)0x1;

  fVar1 = (float)param_1[9];

  fVar2 = (float)param_1[10];

  fVar3 = param_2[1];

  fVar4 = param_2[2];

  *pfVar14 = *param_2 - fVar7 * (float)param_1[8];

  pfVar14[1] = fVar3 - fVar7 * fVar1;

  pfVar14[2] = fVar4 - fVar7 * fVar2;

  if (*(byte *)((int)param_1 + 0xe) != 0) {

    iVar16 = (uint)*(byte *)((int)param_1 + 0xe) * 4 + -4;

    do {

      pfVar5 = *(float **)(iVar16 + *param_1);

      iVar16 = iVar15 * 4;

      pfVar6 = *(float **)(iVar16 + *param_1);

      fVar7 = *pfVar6 - *pfVar5;

      fVar1 = pfVar6[1] - pfVar5[1];

      fVar4 = pfVar6[2] - pfVar5[2];

      fVar9 = fVar4 * (float)param_1[9] - fVar1 * (float)param_1[10];

      fVar13 = fVar7 * (float)param_1[10] - fVar4 * (float)param_1[8];

      fVar11 = fVar1 * (float)param_1[8] - fVar7 * (float)param_1[9];

      fVar2 = *pfVar14 - *pfVar5;

      fVar3 = pfVar14[1] - pfVar5[1];

      fVar12 = pfVar14[2] - pfVar5[2];

      fVar10 = fVar2 * fVar9 + fVar3 * fVar13 + fVar12 * fVar11;

      if (fVar10 < DAT_00796344) {

        if ((fVar9 * fVar9 + fVar13 * fVar13 + fVar11 * fVar11) * fVar8 < fVar10 * fVar10) {

          return 0;

        }

        fVar9 = fVar2 * fVar7 + fVar3 * fVar1 + fVar12 * fVar4;

        if ((DAT_00796344 <= fVar9) &&

           (fVar7 = fVar7 * fVar7 + fVar1 * fVar1 + fVar4 * fVar4, fVar9 < fVar7 != (fVar9 == fVar7)

           )) {

          return 1;

        }

        param_3 = (float *)0x0;

      }

      fVar7 = fVar2 * fVar2 + fVar3 * fVar3 + fVar12 * fVar12;

      if (fVar7 < fVar8 != (fVar7 == fVar8)) {

        return 1;

      }

      iVar15 = iVar15 + 1;

    } while (iVar15 < (int)(uint)*(byte *)((int)param_1 + 0xe));

  }

  return param_3;

}




// --- FUN_00539750 at 0x00539750 ---


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



undefined4 __thiscall FUN_00539750(int *param_1,float *param_2,float *param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  int iVar5;

  float *pfVar6;

  float *pfVar7;

  float fVar8;

  float fVar9;

  float fVar10;

  float fVar11;

  float fVar12;

  float fVar13;

  float fVar14;

  int iVar15;

  int iVar16;

  

  fVar8 = *param_2 * (float)param_1[8] +

          (float)param_1[10] * param_2[2] + (float)param_1[9] * param_2[1] + (float)param_1[0xb];

  fVar1 = param_2[3] - _DAT_007ca628;

  if (fVar1 < ABS(fVar8)) {

    return 0;

  }

  iVar15 = 0;

  fVar9 = fVar1 * fVar1 - fVar8 * fVar8;

  fVar1 = (float)param_1[9];

  fVar2 = (float)param_1[10];

  fVar3 = param_2[1];

  fVar4 = param_2[2];

  *param_3 = *param_2 - fVar8 * (float)param_1[8];

  param_3[1] = fVar3 - fVar8 * fVar1;

  param_3[2] = fVar4 - fVar8 * fVar2;

  if (*(byte *)((int)param_1 + 0xe) != 0) {

    iVar5 = *param_1;

    iVar16 = (uint)*(byte *)((int)param_1 + 0xe) * 4 + -4;

    do {

      pfVar6 = *(float **)(iVar16 + iVar5);

      iVar16 = iVar15 * 4;

      pfVar7 = *(float **)(iVar16 + iVar5);

      if ((*param_3 - *pfVar6) *

          ((pfVar7[2] - pfVar6[2]) * (float)param_1[9] -

          (pfVar7[1] - pfVar6[1]) * (float)param_1[10]) +

          (param_3[1] - pfVar6[1]) *

          ((*pfVar7 - *pfVar6) * (float)param_1[10] - (pfVar7[2] - pfVar6[2]) * (float)param_1[8]) +

          (param_3[2] - pfVar6[2]) *

          ((pfVar7[1] - pfVar6[1]) * (float)param_1[8] - (*pfVar7 - *pfVar6) * (float)param_1[9]) <

          DAT_00796344) {

        iVar16 = 0;

        iVar15 = (uint)*(byte *)((int)param_1 + 0xe) * 4 + -4;

        do {

          pfVar6 = *(float **)(iVar15 + iVar5);

          iVar15 = iVar16 * 4;

          pfVar7 = *(float **)(iVar15 + iVar5);

          fVar8 = *pfVar7 - *pfVar6;

          fVar1 = pfVar7[1] - pfVar6[1];

          fVar4 = pfVar7[2] - pfVar6[2];

          fVar10 = fVar4 * (float)param_1[9] - fVar1 * (float)param_1[10];

          fVar14 = fVar8 * (float)param_1[10] - fVar4 * (float)param_1[8];

          fVar12 = fVar1 * (float)param_1[8] - fVar8 * (float)param_1[9];

          fVar2 = *param_3 - *pfVar6;

          fVar3 = param_3[1] - pfVar6[1];

          fVar13 = param_3[2] - pfVar6[2];

          fVar11 = fVar2 * fVar10 + fVar3 * fVar14 + fVar13 * fVar12;

          if (fVar11 < DAT_00796344) {

            if ((fVar10 * fVar10 + fVar14 * fVar14 + fVar12 * fVar12) * fVar9 < fVar11 * fVar11) {

              return 0;

            }

            fVar10 = fVar2 * fVar8 + fVar3 * fVar1 + fVar13 * fVar4;

            if ((DAT_00796344 <= fVar10) &&

               (fVar8 = fVar8 * fVar8 + fVar1 * fVar1 + fVar4 * fVar4,

               fVar10 < fVar8 != (fVar10 == fVar8))) {

              return 1;

            }

          }

          fVar8 = fVar2 * fVar2 + fVar3 * fVar3 + fVar13 * fVar13;

          if (fVar8 < fVar9 != (fVar8 == fVar9)) {

            return 1;

          }

          iVar16 = iVar16 + 1;

        } while (iVar16 < (int)(uint)*(byte *)((int)param_1 + 0xe));

        return 0;

      }

      iVar15 = iVar15 + 1;

    } while (iVar15 < (int)(uint)*(byte *)((int)param_1 + 0xe));

  }

  return 1;

}




// --- FUN_00539a20 at 0x00539A20 ---


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



void __thiscall

FUN_00539a20(int param_1,float *param_2,float *param_3,float param_4,int param_5,int param_6)



{

  float fVar1;

  float fVar2;

  

  fVar1 = *param_2 * *(float *)(param_1 + 0x20) +

          *(float *)(param_1 + 0x28) * param_2[2] + *(float *)(param_1 + 0x24) * param_2[1] +

          *(float *)(param_1 + 0x2c);

  if (param_6 != 0) {

    if (param_5 != 0) {

      param_4 = param_4 * _DAT_0079a1a0;

    }

    if (fVar1 <= DAT_00796344) {

      param_4 = -param_4;

    }

  }

  param_4 = param_4 - fVar1;

  fVar1 = param_4 * *(float *)(param_1 + 0x20);

  fVar2 = param_4 * *(float *)(param_1 + 0x24);

  param_4 = param_4 * *(float *)(param_1 + 0x28);

  *param_2 = fVar1 + *param_2;

  param_2[1] = fVar2 + param_2[1];

  param_2[2] = param_4 + param_2[2];

  *param_3 = fVar1 + *param_3;

  param_3[1] = fVar2 + param_3[1];

  param_3[2] = param_4 + param_3[2];

  return;

}




// --- FUN_00539ad0 at 0x00539AD0 ---


undefined4 __thiscall FUN_00539ad0(int *param_1,float *param_2)



{

  float *pfVar1;

  float *pfVar2;

  int iVar3;

  int iVar4;

  

  iVar3 = 0;

  if (*(byte *)((int)param_1 + 0xe) != 0) {

    iVar4 = (uint)*(byte *)((int)param_1 + 0xe) * 4 + -4;

    do {

      pfVar1 = *(float **)(iVar4 + *param_1);

      iVar4 = iVar3 * 4;

      pfVar2 = *(float **)(iVar4 + *param_1);

      if ((*param_2 - *pfVar1) *

          ((pfVar2[2] - pfVar1[2]) * (float)param_1[9] -

          (pfVar2[1] - pfVar1[1]) * (float)param_1[10]) +

          (param_2[1] - pfVar1[1]) *

          ((*pfVar2 - *pfVar1) * (float)param_1[10] - (pfVar2[2] - pfVar1[2]) * (float)param_1[8]) +

          (param_2[2] - pfVar1[2]) *

          ((pfVar2[1] - pfVar1[1]) * (float)param_1[8] - (*pfVar2 - *pfVar1) * (float)param_1[9]) <

          DAT_00796344) {

        return 0;

      }

      iVar3 = iVar3 + 1;

    } while (iVar3 < (int)(uint)*(byte *)((int)param_1 + 0xe));

  }

  return 1;

}




// --- FUN_00539ba0 at 0x00539BA0 ---


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



undefined4 __thiscall FUN_00539ba0(int *param_1,float *param_2,float *param_3)



{

  float fVar1;

  float *pfVar2;

  float *pfVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float fVar7;

  float fVar8;

  float fVar9;

  float fVar10;

  float fVar11;

  float fVar12;

  float fVar13;

  float fVar14;

  float *pfVar15;

  uint uVar16;

  int iVar17;

  int iVar18;

  

  pfVar15 = param_2;

  fVar8 = *param_3 * (float)param_1[8] +

          (float)param_1[10] * param_3[2] + (float)param_1[9] * param_3[1];

  if (ABS(fVar8) < _DAT_007ca628) {

    return 0;

  }

  pfVar2 = param_2 + 2;

  pfVar3 = param_2 + 1;

  uVar16 = (uint)*(byte *)((int)param_1 + 0xe);

  iVar17 = 0;

  fVar1 = *param_2;

  param_2 = (float *)0x1;

  fVar8 = (fVar1 * (float)param_1[8] + (float)param_1[9] * *pfVar3 + (float)param_1[10] * *pfVar2 +

          (float)param_1[0xb]) / fVar8;

  fVar1 = pfVar15[3] * pfVar15[3];

  if (uVar16 != 0) {

    iVar18 = uVar16 * 4 + -4;

    do {

      pfVar2 = *(float **)(iVar18 + *param_1);

      iVar18 = iVar17 * 4;

      pfVar3 = *(float **)(iVar18 + *param_1);

      fVar4 = *pfVar3 - *pfVar2;

      fVar5 = pfVar3[1] - pfVar2[1];

      fVar9 = pfVar3[2] - pfVar2[2];

      fVar10 = fVar9 * (float)param_1[9] - fVar5 * (float)param_1[10];

      fVar14 = fVar4 * (float)param_1[10] - fVar9 * (float)param_1[8];

      fVar12 = fVar5 * (float)param_1[8] - fVar4 * (float)param_1[9];

      fVar6 = (*pfVar15 - fVar8 * *param_3) - *pfVar2;

      fVar7 = (pfVar15[1] - fVar8 * param_3[1]) - pfVar2[1];

      fVar13 = (pfVar15[2] - fVar8 * param_3[2]) - pfVar2[2];

      fVar11 = fVar6 * fVar10 + fVar7 * fVar14 + fVar13 * fVar12;

      if (fVar11 < DAT_00796344) {

        if ((fVar10 * fVar10 + fVar14 * fVar14 + fVar12 * fVar12) * fVar1 < fVar11 * fVar11) {

          return 0;

        }

        fVar10 = fVar6 * fVar4 + fVar7 * fVar5 + fVar13 * fVar9;

        if ((DAT_00796344 <= fVar10) &&

           (fVar4 = fVar4 * fVar4 + fVar5 * fVar5 + fVar9 * fVar9,

           fVar10 < fVar4 != (fVar10 == fVar4))) {

          return 1;

        }

        param_2 = (float *)0x0;

      }

      fVar4 = fVar6 * fVar6 + fVar7 * fVar7 + fVar13 * fVar13;

      if (fVar4 < fVar1 != (fVar4 == fVar1)) {

        return 1;

      }

      iVar17 = iVar17 + 1;

    } while (iVar17 < (int)uVar16);

  }

  return param_2;

}




// --- FUN_00539df0 at 0x00539DF0 ---


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



undefined4 __thiscall FUN_00539df0(int *param_1,float *param_2,float *param_3)



{

  float fVar1;

  float *pfVar2;

  float *pfVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float fVar7;

  float fVar8;

  float fVar9;

  float fVar10;

  float fVar11;

  float fVar12;

  float fVar13;

  float fVar14;

  float *pfVar15;

  uint uVar16;

  int iVar17;

  int iVar18;

  

  pfVar15 = param_2;

  fVar8 = *param_3 * (float)param_1[8] +

          (float)param_1[10] * param_3[2] + (float)param_1[9] * param_3[1];

  if (ABS(fVar8) < _DAT_007ca628) {

    return 0;

  }

  pfVar2 = param_2 + 2;

  pfVar3 = param_2 + 1;

  uVar16 = (uint)*(byte *)((int)param_1 + 0xe);

  iVar17 = 0;

  fVar1 = *param_2;

  param_2 = (float *)0x1;

  fVar8 = (fVar1 * (float)param_1[8] + (float)param_1[9] * *pfVar3 + (float)param_1[10] * *pfVar2 +

          (float)param_1[0xb]) / fVar8;

  fVar1 = pfVar15[3] * pfVar15[3] * _DAT_007c97cc;

  if (uVar16 != 0) {

    iVar18 = uVar16 * 4 + -4;

    do {

      pfVar2 = *(float **)(iVar18 + *param_1);

      iVar18 = iVar17 * 4;

      pfVar3 = *(float **)(iVar18 + *param_1);

      fVar4 = *pfVar3 - *pfVar2;

      fVar5 = pfVar3[1] - pfVar2[1];

      fVar9 = pfVar3[2] - pfVar2[2];

      fVar10 = fVar9 * (float)param_1[9] - fVar5 * (float)param_1[10];

      fVar14 = fVar4 * (float)param_1[10] - fVar9 * (float)param_1[8];

      fVar12 = fVar5 * (float)param_1[8] - fVar4 * (float)param_1[9];

      fVar6 = (*pfVar15 - fVar8 * *param_3) - *pfVar2;

      fVar7 = (pfVar15[1] - fVar8 * param_3[1]) - pfVar2[1];

      fVar13 = (pfVar15[2] - fVar8 * param_3[2]) - pfVar2[2];

      fVar11 = fVar6 * fVar10 + fVar7 * fVar14 + fVar13 * fVar12;

      if (fVar11 < DAT_00796344) {

        if ((fVar10 * fVar10 + fVar14 * fVar14 + fVar12 * fVar12) * fVar1 < fVar11 * fVar11) {

          return 0;

        }

        fVar10 = fVar6 * fVar4 + fVar7 * fVar5 + fVar13 * fVar9;

        if ((DAT_00796344 <= fVar10) &&

           (fVar4 = fVar4 * fVar4 + fVar5 * fVar5 + fVar9 * fVar9,

           fVar10 < fVar4 != (fVar10 == fVar4))) {

          return 1;

        }

        param_2 = (float *)0x0;

      }

      fVar4 = fVar6 * fVar6 + fVar7 * fVar7 + fVar13 * fVar13;

      if (fVar4 < fVar1 != (fVar4 == fVar1)) {

        return 1;

      }

      iVar17 = iVar17 + 1;

    } while (iVar17 < (int)uVar16);

  }

  return param_2;

}




// --- FUN_0053a040 at 0x0053A040 ---


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



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



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float *pfVar5;

  float *pfVar6;

  float fVar7;

  float fVar8;

  float fVar9;

  uint uVar10;

  int iVar11;

  int iVar12;

  

  fVar1 = (float)param_1[8] * *param_3 +

          (float)param_1[10] * param_3[2] + (float)param_1[9] * param_3[1];

  if (ABS(fVar1) < _DAT_007ca628) {

    return 0;

  }

  uVar10 = (uint)*(byte *)((int)param_1 + 0xe);

  iVar12 = 0;

  fVar1 = ((float)param_1[8] * *param_2 +

           (float)param_1[9] * param_2[1] + (float)param_1[10] * param_2[2] + (float)param_1[0xb]) /

          fVar1;

  if (uVar10 != 0) {

    iVar11 = uVar10 * 4 + -4;

    do {

      pfVar5 = *(float **)(iVar11 + *param_1);

      iVar11 = iVar12 * 4;

      pfVar6 = *(float **)(iVar11 + *param_1);

      fVar7 = *pfVar6 - *pfVar5;

      fVar8 = pfVar6[1] - pfVar5[1];

      fVar9 = pfVar6[2] - pfVar5[2];

      if (((*param_2 - fVar1 * *param_3) - *pfVar5) *

          (fVar9 * (float)param_1[9] - fVar8 * (float)param_1[10]) +

          ((param_2[1] - fVar1 * param_3[1]) - pfVar5[1]) *

          (fVar7 * (float)param_1[10] - fVar9 * (float)param_1[8]) +

          ((param_2[2] - fVar1 * param_3[2]) - pfVar5[2]) *

          (fVar8 * (float)param_1[8] - fVar7 * (float)param_1[9]) < DAT_00796344) {

        fVar1 = (float)param_1[10];

        fVar2 = (float)param_1[8];

        fVar3 = (float)param_1[8];

        fVar4 = (float)param_1[9];

        *param_4 = fVar9 * (float)param_1[9] - fVar8 * (float)param_1[10];

        param_4[1] = fVar7 * fVar1 - fVar9 * fVar2;

        param_4[2] = fVar8 * fVar3 - fVar7 * fVar4;

        fVar1 = _DAT_007938b0 /

                SQRT(param_4[2] * param_4[2] + param_4[1] * param_4[1] + *param_4 * *param_4);

        *param_4 = fVar1 * *param_4;

        param_4[1] = fVar1 * param_4[1];

        param_4[2] = fVar1 * param_4[2];

        return 1;

      }

      iVar12 = iVar12 + 1;

    } while (iVar12 < (int)uVar10);

  }

  return 0;

}




// --- FUN_0053a230 at 0x0053A230 ---


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



{

  int iVar1;

  int extraout_ECX;

  

  iVar1 = FUN_00539750(param_1,param_3);

  if (iVar1 != 0) {

    *param_4 = extraout_ECX;

  }

  if (*(float *)(extraout_ECX + 0x20) * *param_2 +

      *(float *)(extraout_ECX + 0x24) * param_2[1] + *(float *)(extraout_ECX + 0x28) * param_2[2] <

      DAT_00796344) {

    return iVar1;

  }

  return 0;

}




// --- FUN_0053a280 at 0x0053A280 ---


void FUN_0053a280(undefined4 param_1)



{

  undefined1 local_c [12];

  

  FUN_00539750(param_1,local_c);

  return;

}




// --- FUN_0053a2a0 at 0x0053A2A0 ---


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



{

  int iVar1;

  int iVar2;

  undefined1 local_c [12];

  

  if (*param_4 * *(float *)(param_1 + 0x20) +

      *(float *)(param_1 + 0x24) * param_4[1] + *(float *)(param_1 + 0x28) * param_4[2] <=

      *(float *)(param_2 + 0x1b8)) {

    return 0;

  }

  iVar1 = FUN_00539750(param_3,local_c);

  iVar2 = FUN_00539500(param_3,local_c);

  if (iVar1 != iVar2) {

    FUN_00539750(param_3,local_c);

    FUN_00539500(param_3,local_c);

  }

  return iVar1;

}




// --- FUN_0053a320 at 0x0053A320 ---


undefined4 __thiscall FUN_0053a320(int param_1,float *param_2,double *param_3)



{

  float fVar1;

  int iVar2;

  undefined4 uVar3;

  float local_18;

  float local_14;

  float local_10;

  float local_4;

  

  if ((*(int *)(param_1 + 0x10) == 0) &&

     (DAT_00796344 <

      param_2[3] * *(float *)(param_1 + 0x20) +

      param_2[4] * *(float *)(param_1 + 0x24) + param_2[5] * *(float *)(param_1 + 0x28))) {

    return 0;

  }

  iVar2 = FUN_00539060(param_2,param_3);

  if (iVar2 == 0) {

    return 0;

  }

  fVar1 = (float)*param_3;

  local_18 = fVar1 * param_2[3] + *param_2;

  local_14 = fVar1 * param_2[4] + param_2[1];

  local_10 = fVar1 * param_2[5] + param_2[2];

  local_4 = local_10;

  uVar3 = FUN_00539ad0(&local_18);

  return uVar3;

}




// --- FUN_0053a3e0 at 0x0053A3E0 ---


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



void __fastcall FUN_0053a3e0(int param_1)



{

  if ((((_DAT_007938b0 <= *(float *)(param_1 + 0x28)) &&

       (_DAT_007938b0 <= *(float *)(param_1 + 0x18))) &&

      (_DAT_007938b0 <= *(float *)(param_1 + 0x38))) &&

     (_DAT_007938b0 <= *(float *)(param_1 + 0x48))) {

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

    return;

  }

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

  return;

}




// --- FUN_0053a430 at 0x0053A430 ---


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



void __thiscall FUN_0053a430(int param_1,float param_2)



{

  param_2 = _DAT_007938b0 - param_2;

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

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

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

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

  FUN_0053a3e0();

  return;

}




// --- FUN_0053a450 at 0x0053A450 ---


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



float10 __fastcall FUN_0053a450(int param_1)



{

  return (float10)_DAT_007938b0 - (float10)*(float *)(param_1 + 0x18);

}




// --- FUN_0053a460 at 0x0053A460 ---


void __thiscall FUN_0053a460(int param_1,undefined4 param_2)



{

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

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

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

  return;

}




// --- FUN_0053a480 at 0x0053A480 ---


float10 __fastcall FUN_0053a480(int param_1)



{

  return (float10)*(float *)(param_1 + 0x3c);

}




// --- FUN_0053a490 at 0x0053A490 ---


void __thiscall FUN_0053a490(int param_1,undefined4 param_2)



{

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

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

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

  return;

}




// --- FUN_0053a4b0 at 0x0053A4B0 ---


undefined4 * __fastcall FUN_0053a4b0(undefined4 *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  param_1[1] = 1;

  *param_1 = &PTR_FUN_0079cd94;

  param_1[2] = 0;

  puVar2 = param_1 + 3;

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

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

  param_1[3] = 0x3f800000;

  param_1[4] = 0x3f800000;

  param_1[5] = 0x3f800000;

  param_1[6] = 0x3f800000;

  param_1[7] = 0x3f800000;

  param_1[8] = 0x3f800000;

  param_1[9] = 0x3f800000;

  param_1[10] = 0x3f800000;

  return param_1;

}




// --- FUN_0053a500 at 0x0053A500 ---


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



{

  *param_1 = &PTR_FUN_0079cd94;

  param_1[1] = 1;

  *param_1 = *param_2;

  return;

}




// --- FUN_0053a520 at 0x0053A520 ---


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



{

  *param_1 = &PTR_FUN_007952f4;

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

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_0053a540 at 0x0053A540 ---


int __fastcall FUN_0053a540(int *param_1)



{

  return *param_1 + 4;

}




// --- FUN_0053a550 at 0x0053A550 ---


void __thiscall FUN_0053a550(undefined4 *param_1,undefined4 param_2,uint param_3)



{

  uint uVar1;

  undefined4 local_4;

  

  local_4 = 0;

  uVar1 = FUN_0053d460(*param_1,&local_4,0);

  if (uVar1 <= param_3) {

    FUN_0053d460(*param_1,param_2,param_3);

  }

  return;

}




// --- FUN_0053a590 at 0x0053A590 ---


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



{

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

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

    *param_1 = 0;

  }

  FUN_0053d4d0(param_1,param_2,param_3);

  return;

}




// --- FUN_0053a5c0 at 0x0053A5C0 ---


void __thiscall FUN_0053a5c0(int *param_1,undefined4 param_2)



{

  int iVar1;

  

  if ((*param_1 != 0) && (iVar1 = *(int *)(*param_1 + 0x24), iVar1 != 0x4c454146)) {

    if (iVar1 == 0x504f5254) {

      FUN_0053e5d0(param_2);

    }

    else {

      FUN_0053ce60(param_2);

    }

  }

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

  DAT_008672e8 = &DAT_008471c8;

  return;

}




// --- FUN_0053a610 at 0x0053A610 ---


void FUN_0053a610(void)



{

  FUN_0053d5e0();

  return;

}




// --- FUN_0053a620 at 0x0053A620 ---


void FUN_0053a620(void)



{

  FUN_0053cf50();

  return;

}




// --- FUN_0053a630 at 0x0053A630 ---


void FUN_0053a630(void)



{

  FUN_0053cfc0();

  return;

}




// --- FUN_0053a640 at 0x0053A640 ---


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



{

  float fVar1;

  float fVar2;

  

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

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

  fVar1 = param_3[1];

  fVar2 = param_3[2];

  *(float *)(param_1 + 0x23c) = -*param_3;

  *(float *)(param_1 + 0x240) = -fVar1;

  *(float *)(param_1 + 0x244) = -fVar2;

  return;

}




// --- FUN_0053a6a0 at 0x0053A6A0 ---


void __fastcall FUN_0053a6a0(int *param_1)



{

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

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

    *param_1 = 0;

  }

  return;

}




// --- FUN_0053a6c0 at 0x0053A6C0 ---


undefined4 __thiscall FUN_0053a6c0(undefined4 *param_1,float param_2)



{

  float fVar1;

  float fVar2;

  float fVar3;

  int iVar4;

  int iVar5;

  float *pfVar6;

  float *pfVar7;

  uint *puVar8;

  bool bVar9;

  int local_48;

  undefined4 local_44;

  int local_40;

  undefined4 *local_3c;

  float fStack_38;

  float fStack_34;

  float fStack_30;

  float fStack_2c;

  float fStack_28;

  float fStack_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_c;

  float local_8;

  float local_4;

  

  iVar4 = (int)param_2;

  pfVar7 = *(float **)((int)param_2 + 0x44);

  puVar8 = (uint *)((int)param_2 + 0x20);

  local_20 = *pfVar7;

  local_1c = pfVar7[1];

  local_18 = pfVar7[2];

  local_14 = pfVar7[3];

  if (1 < *puVar8) {

    local_10 = pfVar7[4];

    local_c = pfVar7[5];

    local_8 = pfVar7[6];

    local_4 = pfVar7[7];

  }

  local_48 = 0;

  bVar9 = true;

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

    bVar9 = *(int *)((int)param_2 + 0x1d0) == 0;

  }

  local_40 = 0;

  param_2 = local_14;

  local_3c = param_1;

  do {

    local_44 = 0;

    iVar5 = (**(code **)(*(int *)*local_3c + 0x10))(&local_20,param_2,&local_44,&local_48,bVar9);

    if (iVar5 == 0) {

      if (*puVar8 < 2) {

        if (local_40 == 0) {

          return 1;

        }

        pfVar7 = *(float **)(iVar4 + 0x44);

        fVar1 = local_18 - pfVar7[2];

        fVar3 = local_1c - pfVar7[1];

        fVar2 = local_20 - *pfVar7;

        fStack_38 = fVar1 * *(float *)(iVar4 + 0x8c) +

                    fVar3 * *(float *)(iVar4 + 0x80) + fVar2 * *(float *)(iVar4 + 0x74);

        fStack_34 = fVar1 * *(float *)(iVar4 + 0x90) +

                    fVar3 * *(float *)(iVar4 + 0x84) + fVar2 * *(float *)(iVar4 + 0x78);

        *(undefined4 *)(iVar4 + 0x254) = 0;

        fStack_30 = fVar1 * *(float *)(iVar4 + 0x94) +

                    fVar3 * *(float *)(iVar4 + 0x88) + fVar2 * *(float *)(iVar4 + 0x7c);

        *(float *)(iVar4 + 0x168) = fStack_38 + *(float *)(iVar4 + 0x168);

        *(float *)(iVar4 + 0x16c) = fStack_34 + *(float *)(iVar4 + 0x16c);

        *(float *)(iVar4 + 0x170) = fStack_30 + *(float *)(iVar4 + 0x170);

        fStack_2c = fStack_38;

        fStack_28 = fStack_34;

        fStack_24 = fStack_30;

        FUN_0050d2e0(&fStack_2c);

        return 3;

      }

      iVar5 = (**(code **)(*(int *)*local_3c + 0x10))(&local_10,param_2,&local_44,&local_48,bVar9);

      if (iVar5 == 0) {

        if (local_40 == 0) {

          return 1;

        }

        pfVar7 = *(float **)(iVar4 + 0x44);

        fStack_30 = local_18 - pfVar7[2];

        fStack_34 = local_1c - pfVar7[1];

        fStack_38 = local_20 - *pfVar7;

        pfVar7 = (float *)FUN_00456340(&fStack_2c,&fStack_38);

        fStack_38 = *pfVar7;

        fStack_34 = pfVar7[1];

        fStack_30 = pfVar7[2];

        FUN_0050a7e0(&fStack_38);

        return 3;

      }

      if (local_48 != 0) {

        pfVar7 = &local_20;

        pfVar6 = &local_10;

        goto LAB_0053a7c0;

      }

LAB_0053a7d6:

      param_2 = param_2 + param_2;

    }

    else {

      if (local_48 == 0) goto LAB_0053a7d6;

      pfVar7 = &local_10;

      pfVar6 = &local_20;

LAB_0053a7c0:

      FUN_00539a20(pfVar6,pfVar7,param_2,local_44,bVar9);

      local_48 = 0;

      param_2 = local_14;

    }

    local_40 = local_40 + 1;

    if (0x13 < local_40) {

      return 2;

    }

  } while( true );

}




// --- FUN_0053a950 at 0x0053A950 ---


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



undefined4 __thiscall

FUN_0053a950(undefined4 *param_1,float *param_2,float param_3,float param_4,float param_5,

            undefined4 param_6,undefined4 param_7)



{

  double dVar1;

  float fVar2;

  double dVar3;

  double dVar4;

  int iVar5;

  int iVar6;

  float10 fVar7;

  undefined4 local_48;

  undefined4 local_44;

  undefined4 local_40;

  undefined4 uStack_3c;

  float local_38;

  float local_34;

  float local_30;

  float local_2c;

  float local_28;

  float local_24;

  float local_20;

  float local_1c;

  float local_c;

  

  local_38 = *param_2 - param_3;

  local_48 = 0;

  local_44 = 0x3ff00000;

  local_34 = param_2[1] - param_4;

  iVar6 = 0;

  local_30 = param_2[2] - param_5;

  while( true ) {

    dVar4 = (double)CONCAT44(local_44,local_48);

    fVar7 = (float10)FUN_00538eb0(param_2,&param_3,&local_38);

    dVar1 = (double)fVar7;

    dVar3 = 0.0;

    if (fVar7 == (float10)_DAT_007938c0) break;

    local_20 = (float)((float10)local_38 * fVar7);

    local_1c = (float)((float10)local_34 * fVar7);

    local_2c = local_20 + param_3;

    local_28 = local_1c + param_4;

    local_24 = (float)(fVar7 * (float10)local_30 + (float10)param_5);

    *param_2 = local_2c;

    param_2[1] = local_28;

    param_2[2] = local_24;

    local_c = local_24;

    iVar5 = (**(code **)(*(int *)*param_1 + 4))(param_2,&local_38,&param_6,param_7);

    local_40 = SUB84(dVar1,0);

    uStack_3c = (undefined4)((ulonglong)dVar1 >> 0x20);

    dVar3 = dVar1;

    if (iVar5 == 0) break;

    local_48 = local_40;

    local_44 = uStack_3c;

    iVar6 = iVar6 + 1;

    if (0xe < iVar6) {

      return 0;

    }

  }

  if (iVar6 < 0xf) {

    do {

      fVar7 = ((float10)dVar3 + (float10)dVar4) * (float10)_DAT_00799088;

      local_20 = (float)((float10)local_38 * fVar7);

      local_1c = (float)((float10)local_34 * fVar7);

      local_2c = local_20 + param_3;

      local_28 = local_1c + param_4;

      local_24 = (float)(fVar7 * (float10)local_30 + (float10)param_5);

      *param_2 = local_2c;

      param_2[1] = local_28;

      param_2[2] = local_24;

      local_c = local_24;

      iVar5 = (**(code **)(*(int *)*param_1 + 4))(param_2,&local_38,&param_6,param_7);

      dVar1 = (double)fVar7;

      if (iVar5 != 0) {

        dVar1 = dVar3;

        dVar4 = (double)fVar7;

      }

      dVar3 = dVar1;

    } while ((_DAT_0079cc78 <= dVar4 - dVar3) && (iVar6 = iVar6 + 1, iVar6 < 0xf));

    fVar2 = (float)dVar3;

    *param_2 = local_38 * fVar2 + param_3;

    param_2[1] = local_34 * fVar2 + param_4;

    param_2[2] = fVar2 * local_30 + param_5;

    return 1;

  }

  return 0;

}




// --- FUN_0053abb0 at 0x0053ABB0 ---


void FUN_0053abb0(int param_1,undefined4 param_2,float *param_3)



{

  float local_c;

  float local_8;

  float local_4;

  

  local_c = *(float *)(param_1 + 0x60) * param_3[1] +

            *(float *)(param_1 + 0x54) * *param_3 + *(float *)(param_1 + 0x6c) * param_3[2];

  local_8 = *(float *)(param_1 + 100) * param_3[1] +

            *(float *)(param_1 + 0x58) * *param_3 + *(float *)(param_1 + 0x70) * param_3[2];

  local_4 = *(float *)(param_1 + 0x68) * param_3[1] +

            *(float *)(param_1 + 0x5c) * *param_3 + *(float *)(param_1 + 0x74) * param_3[2];

  FUN_00538180(param_1,param_2,&local_c,*(undefined4 *)(param_1 + 0x38));

  return;

}




// --- FUN_0053ac30 at 0x0053AC30 ---


char __thiscall FUN_0053ac30(undefined4 *param_1,int param_2,undefined4 *param_3)



{

  int iVar1;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_10 = *param_3;

  local_c = param_3[1];

  local_8 = param_3[2];

  local_4 = param_3[3];

  iVar1 = (**(code **)(*(int *)*param_1 + 0x1c))(param_2,&local_10,param_2 + 0x84);

  return (iVar1 != 0) + '\x01';

}




// --- FUN_0053ac80 at 0x0053AC80 ---


undefined4 FUN_0053ac80(int param_1,float *param_2)



{

  int iVar1;

  undefined4 uVar2;

  float local_c;

  float local_8;

  float local_4;

  

  local_c = *(float *)(param_1 + 0x80) * param_2[1] +

            *(float *)(param_1 + 0x74) * *param_2 + *(float *)(param_1 + 0x8c) * param_2[2];

  local_8 = *(float *)(param_1 + 0x84) * param_2[1] +

            *(float *)(param_1 + 0x78) * *param_2 + *(float *)(param_1 + 0x90) * param_2[2];

  local_4 = *(float *)(param_1 + 0x88) * param_2[1] +

            *(float *)(param_1 + 0x7c) * *param_2 + *(float *)(param_1 + 0x94) * param_2[2];

  iVar1 = FUN_0050c0e0(&local_c);

  if (iVar1 != 0) {

    return 1;

  }

  uVar2 = FUN_0050ce80(param_1,param_1 + 0x270);

  return uVar2;

}




// --- FUN_0053ad20 at 0x0053AD20 ---


void __thiscall

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

            undefined4 param_6)



{

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

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

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

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

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

  *(undefined4 *)(param_1 + 0x1dc) = *param_4;

  *(undefined4 *)(param_1 + 0x1e0) = param_4[1];

  *(undefined4 *)(param_1 + 0x1e4) = param_4[2];

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

  FUN_00425f10(param_5 + 8);

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

  return;

}




// --- FUN_0053ada0 at 0x0053ADA0 ---


void FUN_0053ada0(void)



{

  void *local_c;

  uint local_8;

  undefined4 local_4;

  

  local_c = (void *)0x0;

  local_8 = 0;

  local_4 = 0;

  FUN_0053e0a0(&local_c);

  FUN_0053d5b0(&local_c);

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

    operator_delete__(local_c);

  }

  return;

}




// --- FUN_0053adf0 at 0x0053ADF0 ---


undefined4

FUN_0053adf0(int param_1,int param_2,undefined4 param_3,float *param_4,undefined4 *param_5,

            int param_6,undefined4 param_7,float param_8)



{

  int iVar1;

  undefined4 uVar2;

  float *pfVar3;

  float local_28;

  float local_24;

  float local_20;

  undefined1 local_1c [12];

  float local_10;

  float local_c;

  float local_8;

  float local_4;

  

  if ((*(byte *)(param_1 + 4) & 0x40) == 0) {

    local_28 = *(float *)(param_2 + 0x6c) * *(float *)(param_6 + 0x28) +

               *(float *)(param_2 + 0x60) * *(float *)(param_6 + 0x24) +

               *(float *)(param_2 + 0x54) * *(float *)(param_6 + 0x20);

    local_24 = *(float *)(param_2 + 0x70) * *(float *)(param_6 + 0x28) +

               *(float *)(param_2 + 100) * *(float *)(param_6 + 0x24) +

               *(float *)(param_2 + 0x58) * *(float *)(param_6 + 0x20);

    local_20 = *(float *)(param_2 + 0x74) * *(float *)(param_6 + 0x28) +

               *(float *)(param_2 + 0x68) * *(float *)(param_6 + 0x24) +

               *(float *)(param_2 + 0x5c) * *(float *)(param_6 + 0x20);

    FUN_0050aad0(&local_28);

  }

  else {

    local_10 = *param_4;

    local_c = param_4[1];

    local_8 = param_4[2];

    local_4 = param_4[3];

    iVar1 = FUN_0053a950(&local_10,*param_5,param_5[1],param_5[2],param_6,param_7);

    if (iVar1 != 0) {

      uVar2 = FUN_00456340(local_1c,param_6 + 0x20);

      FUN_0050aad0(uVar2);

      local_28 = local_10 - *param_4;

      local_24 = local_c - param_4[1];

      local_20 = local_8 - param_4[2];

      pfVar3 = (float *)FUN_00456340(local_1c,&local_28);

      local_28 = *pfVar3 * param_8;

      local_24 = pfVar3[1] * param_8;

      local_20 = pfVar3[2] * param_8;

      FUN_0050a7e0(&local_28);

      return 3;

    }

  }

  return 2;

}




// --- FUN_0053af70 at 0x0053AF70 ---


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



undefined4 __thiscall

FUN_0053af70(undefined4 *param_1,int param_2,undefined4 param_3,float *param_4,float param_5)



{

  float *pfVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  int iVar6;

  float *pfVar7;

  float *pfStack_50;

  undefined4 *puStack_4c;

  float fStack_38;

  float local_28;

  float local_24;

  float fStack_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_c;

  float local_8;

  float local_4;

  

  pfVar7 = param_4;

  iVar6 = param_2;

  pfVar1 = (float *)(param_2 + 0x84);

  local_10 = *param_4;

  fVar2 = -(*(float *)(param_2 + 0x1c0) * *(float *)(param_2 + 0x1bc));

  local_c = param_4[1];

  local_8 = param_4[2];

  local_28 = fVar2 * *(float *)(param_2 + 0x88);

  local_4 = param_4[3];

  param_2 = 0;

  local_24 = _DAT_007938b0 / param_5;

  local_1c = local_24 * fVar2 * *pfVar1;

  local_18 = local_28 * local_24;

  local_24 = fVar2 * *(float *)(iVar6 + 0x8c) * local_24;

  param_4 = (float *)0x0;

  puStack_4c = &param_2;

  pfStack_50 = pfVar1;

  local_14 = local_24;

  (**(code **)(*(int *)*param_1 + 0x18))(iVar6,&local_10,&param_4,&local_1c);

  if (local_14 != 0.0) {

    fVar2 = local_28 - *pfVar7;

    fVar5 = local_24 - pfVar7[1];

    fStack_20 = fStack_20 - pfVar7[2];

    fVar4 = fVar2 * *(float *)(iVar6 + 0x54) +

            fVar5 * *(float *)(iVar6 + 0x60) + fStack_20 * *(float *)(iVar6 + 0x6c);

    fVar3 = fVar2 * *(float *)(iVar6 + 0x58) +

            fVar5 * *(float *)(iVar6 + 100) + fStack_20 * *(float *)(iVar6 + 0x70);

    *(undefined4 *)(iVar6 + 0x234) = 0;

    fVar2 = fVar2 * *(float *)(iVar6 + 0x5c) +

            fVar5 * *(float *)(iVar6 + 0x68) + fStack_20 * *(float *)(iVar6 + 0x74);

    pfStack_50 = (float *)(fVar4 * local_8);

    puStack_4c = (undefined4 *)(fVar3 * local_8);

    *(float *)(iVar6 + 0x148) = (float)pfStack_50 + *(float *)(iVar6 + 0x148);

    *(float *)(iVar6 + 0x14c) = (float)puStack_4c + *(float *)(iVar6 + 0x14c);

    *(float *)(iVar6 + 0x150) = fVar2 * local_8 + *(float *)(iVar6 + 0x150);

    FUN_0050d2e0(&pfStack_50);

    FUN_005ab150(&stack0xffffffbc,iVar6 + 0x10c,iVar6 + 0x3c,(int)local_c + 0x20);

    *(undefined4 *)((int)local_10 + 0x18) = 1;

    *(float *)((int)local_10 + 0x28) = fStack_38 * local_8;

    *(float *)((int)local_10 + 0x1c) = fVar4;

    *(float *)((int)local_10 + 0x20) = fVar3;

    *(float *)((int)local_10 + 0x24) = fVar2;

    *(undefined4 *)((int)local_10 + 0x34) = 0;

    *(undefined4 *)((int)local_10 + 0x2c) = *(undefined4 *)(iVar6 + 0x110);

    FUN_0053ad20(&local_28,local_c,pfVar1,iVar6 + 0x3c,local_8);

    return 3;

  }

  return 1;

}




// --- FUN_0053b1a0 at 0x0053B1A0 ---


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



{

  uint *puVar1;

  undefined4 uVar2;

  int iVar3;

  int iVar4;

  undefined4 unaff_ESI;

  int unaff_EDI;

  bool bVar5;

  float *pfVar6;

  float *pfVar7;

  int iVar8;

  undefined4 local_5c;

  int local_58;

  undefined4 local_54 [2];

  undefined1 auStack_4c [4];

  undefined1 auStack_48 [4];

  float local_44;

  float local_40;

  float local_3c;

  undefined1 local_38 [12];

  undefined1 auStack_2c [12];

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  undefined4 uStack_c;

  int aiStack_8 [2];

  

  iVar3 = param_2;

  pfVar7 = *(float **)(param_2 + 0x54);

  puVar1 = (uint *)(param_2 + 0x20);

  pfVar6 = *(float **)(param_2 + 0x44);

  local_3c = pfVar6[2] - pfVar7[2];

  local_40 = pfVar6[1] - pfVar7[1];

  local_58 = param_2 + 0x270;

  local_44 = *pfVar6 - *pfVar7;

  local_5c = 0;

  if ((*(int *)(param_2 + 0x174) == 1) || (*(int *)(param_2 + 0x1cc) != 0)) {

    bVar5 = true;

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

      bVar5 = *(int *)(param_2 + 0x1d0) == 0;

    }

    iVar4 = (**(code **)(*(int *)*param_1 + 8))(pfVar6,bVar5);

    if (iVar4 != 0) {

      return 2;

    }

    if ((1 < *puVar1) &&

       (iVar3 = (**(code **)(*(int *)*param_1 + 8))(*(int *)(iVar3 + 0x44) + 0x10,bVar5), iVar3 != 0

       )) {

      return 2;

    }

  }

  else {

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

      uVar2 = FUN_0053ac30(puVar1,pfVar6,param_3);

      return uVar2;

    }

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

      uVar2 = FUN_0053af70(puVar1,local_58,pfVar6,param_3);

      return uVar2;

    }

    if (*(int *)(param_2 + 0x124) == 0) {

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

        iVar4 = *(int *)*param_1;

        if ((*(uint *)(param_2 + 4) & 8) == 0) {

          iVar4 = (**(code **)(iVar4 + 4))();

          if ((iVar4 != 0) || (unaff_EDI != 0)) {

            FUN_00456340(&stack0xffffffa0,unaff_EDI + 0x20);

            FUN_005385e0(&stack0xffffffa0);

            *(undefined4 *)(iVar3 + 0x1d8) = DAT_007ca63c;

            return 3;

          }

          if ((1 < *puVar1) &&

             ((iVar3 = (**(code **)(*(int *)*param_1 + 4))

                                 (*(int *)(iVar3 + 0x44) + 0x10,local_54,&stack0xffffff94,auStack_48

                                 ), iVar3 != 0 || (pfVar6 != (float *)0x0)))) {

            uVar2 = FUN_00456340(auStack_4c,pfVar6 + 8);

            FUN_0050aad0(uVar2);

            return 2;

          }

        }

        else {

          iVar3 = (**(code **)(iVar4 + 4))(pfVar6,&local_44,&local_5c,local_38);

          if ((iVar3 != 0) || (unaff_EDI != 0)) {

            uVar2 = FUN_0053adf0(uStack_c,puVar1,unaff_ESI,pfVar6,pfVar7,unaff_EDI,auStack_48,

                                 aiStack_8[0]);

            return uVar2;

          }

        }

      }

      else {

        pfVar7 = &local_44;

        aiStack_8[0] = (**(code **)(*(int *)*param_1 + 4))(pfVar6,pfVar7,&local_5c,local_38);

        if (aiStack_8[0] != 0) {

          uVar2 = FUN_0053ac80(uStack_c,unaff_EDI + 0x20);

          return uVar2;

        }

        if (1 < *puVar1) {

          iVar3 = (**(code **)(*(int *)*param_1 + 4))

                            (*(int *)(iVar3 + 0x44) + 0x10,local_54,aiStack_8,auStack_48);

          if (iVar3 != 0) {

            uVar2 = FUN_0053abb0(puVar1,pfVar7,(int)local_18 + 0x20);

            return uVar2;

          }

          if (local_18 != 0.0) {

            uVar2 = FUN_00456340(auStack_4c,(int)local_18 + 0x20);

            FUN_0053a640(0,uVar2);

            return 1;

          }

          if (pfVar6 != (float *)0x0) {

            uVar2 = FUN_00456340(auStack_4c,pfVar6 + 8);

            FUN_0053a640(1,uVar2);

            return 1;

          }

        }

      }

    }

    else {

      local_1c = pfVar6[1];

      local_20 = *pfVar6;

      local_14 = pfVar6[3];

      param_2 = 0;

      local_54[0] = 0;

      iVar4 = iVar3 + 0xa4;

      local_18 = pfVar6[2];

      iVar8 = iVar4;

      (**(code **)(*(int *)*param_1 + 0x18))(puVar1,&local_20,&param_2,&local_44,iVar4,local_54);

      if (unaff_EDI != 0) {

        FUN_00456340(&local_44,&stack0xffffff98);

        FUN_0050a7e0(&stack0xffffff98);

        FUN_005ab150(auStack_2c,iVar3 + 300,iVar3 + 0x5c,(int)local_18 + 0x20);

        local_20 = local_20 * local_14;

        FUN_0050a850(auStack_2c,0);

        *(undefined4 *)(iVar8 + 0x2c) = *(undefined4 *)(iVar3 + 0x130);

        FUN_0053ad20(&local_3c,local_18,iVar4,iVar3 + 0x5c,local_14);

        return 3;

      }

    }

  }

  return 1;

}




// --- FUN_0053b5e0 at 0x0053B5E0 ---


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



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



{

  float fVar1;

  

  if ((param_3[1] * param_3[1] + *param_3 * *param_3 <= param_4 * param_4) &&

     (fVar1 = *(float *)(param_1 + 0xc) * (float)_DAT_00799088,

     ABS(fVar1 - param_3[2]) <= (*(float *)(param_2 + 0xc) - _DAT_007ca760) + fVar1)) {

    return 1;

  }

  return 0;

}




// --- FUN_0053b640 at 0x0053B640 ---


void __fastcall FUN_0053b640(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  return;

}




// --- FUN_0053b660 at 0x0053B660 ---


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



{

  int iVar1;

  

  if (0x13 < 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[4];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return 0x14;

}




// --- FUN_0053b6c0 at 0x0053B6C0 ---


undefined4 __thiscall FUN_0053b6c0(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[4] = *(undefined4 *)*param_2;

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  return 1;

}




// --- FUN_0053b710 at 0x0053B710 ---


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



undefined4

FUN_0053b710(undefined4 param_1,uint *param_2,int param_3,undefined4 *param_4,int param_5,

            undefined4 param_6)



{

  uint uVar1;

  float fVar2;

  float fVar3;

  int iVar4;

  float *extraout_ECX;

  float *extraout_ECX_00;

  float *pfVar5;

  undefined8 local_34;

  float local_2c;

  undefined4 local_28;

  undefined4 local_24;

  float local_20;

  undefined4 local_1c;

  undefined4 local_18;

  float local_14;

  undefined1 local_10 [16];

  

  iVar4 = FUN_0053b5e0(param_4,param_5,param_6);

  pfVar5 = extraout_ECX;

  if (iVar4 != 0) {

LAB_0053b77a:

    if (ABS((float)param_2[0x70] * (float)param_2[0x6f]) < _DAT_007ca760) {

      return 2;

    }

    fVar3 = (pfVar5[3] + (float)param_4[3]) - *(float *)(param_5 + 8);

    fVar2 = ((float)_DAT_007938c0 - fVar3 / ((float)param_2[0x70] * (float)param_2[0x6f])) *

            (float)param_2[0x6f];

    local_34 = (double)fVar2;

    if ((fVar2 < (float)param_2[0x6f]) && ((float)_DAT_007c7700 <= fVar2)) {

      local_28 = *param_4;

      local_24 = param_4[1];

      local_20 = (fVar3 - (float)param_4[3]) + (float)param_4[2];

      local_1c = 0;

      local_18 = 0;

      local_14 = 1.0;

      FUN_00537760(&local_1c,&local_28);

      FUN_0050a850(local_10,1);

      *(uint *)(param_3 + 0x2c) = param_2[0x44];

      param_2[0x6f] = (uint)(float)local_34;

      local_1c = 0;

      local_18 = 0;

      local_14 = fVar3;

      FUN_005377a0(&local_1c,param_4[3]);

      return 3;

    }

    return 2;

  }

  if (1 < *param_2) {

    uVar1 = param_2[5];

    local_34 = (double)CONCAT44(*(float *)(uVar1 + 0x14) - extraout_ECX[1],

                                *(float *)(uVar1 + 0x10) - *extraout_ECX);

    local_2c = *(float *)(uVar1 + 0x18) - extraout_ECX[2];

    iVar4 = FUN_0053b5e0(uVar1 + 0x10,&local_34,param_6);

    pfVar5 = extraout_ECX_00;

    if (iVar4 != 0) goto LAB_0053b77a;

  }

  return 1;

}




// --- FUN_0053b8b0 at 0x0053B8B0 ---


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



undefined4 __thiscall

FUN_0053b8b0(float *param_1,int param_2,int param_3,int param_4,float param_5,int param_6,

            float *param_7)



{

  int iVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  

  fVar5 = DAT_00796344;

  iVar1 = *(int *)(param_2 + 0x38) + param_6 * 0xc;

  fVar2 = *(float *)(*(int *)(param_2 + 0x38) + param_6 * 0xc) - *param_1;

  fVar3 = *(float *)(iVar1 + 4) - param_1[1];

  fVar4 = *(float *)(iVar1 + 8) - param_1[2];

  if (param_5 * param_5 < fVar2 * fVar2 + fVar3 * fVar3) {

    *param_7 = fVar2;

    param_7[1] = fVar3;

    param_7[2] = fVar4;

    param_7[2] = 0.0;

    if (((*(float *)(param_3 + 0xc) - _DAT_007ca760) + param_1[3] * (float)_DAT_00799088 <

         ABS(param_1[3] * (float)_DAT_00799088 - fVar4)) &&

       (_DAT_007ca760 < ABS(fVar4 - *(float *)(param_4 + 8)))) {

      return 0;

    }

  }

  else {

    fVar4 = *(float *)(param_4 + 8) - fVar4;

    if (fVar4 < DAT_00796344 == (fVar4 == DAT_00796344)) {

      *param_7 = DAT_00796344;

      param_7[1] = fVar5;

      param_7[2] = -1.0;

      return 1;

    }

    *param_7 = DAT_00796344;

    param_7[1] = fVar5;

    param_7[2] = 1.0;

  }

  return 1;

}




// --- FUN_0053ba10 at 0x0053BA10 ---


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



undefined4 __thiscall

FUN_0053ba10(float *param_1,int param_2,int param_3,undefined4 param_4,float *param_5,

            undefined4 param_6,float param_7,undefined4 param_8)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  int iVar5;

  int iVar6;

  float *pfVar7;

  float *pfVar8;

  double local_68;

  float local_44;

  float local_40;

  float local_3c;

  float local_38;

  float local_34;

  float local_30;

  float local_2c;

  float local_28;

  float local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_c;

  

  iVar5 = FUN_0053b8b0(param_3,param_5,param_6,param_7,param_8,&local_44);

  iVar6 = FUN_004524a0();

  if (iVar6 != 0) {

    return 2;

  }

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

    FUN_0050aad0(&local_44);

    return 2;

  }

  pfVar7 = *(float **)(param_3 + 0x38);

  FUN_0043e7d0(&local_14,*(undefined4 *)(param_3 + 0xa4),*(undefined4 *)(param_3 + 0x110));

  local_18 = param_5[2] - pfVar7[2];

  local_14 = local_14 + (*param_5 - *pfVar7);

  local_10 = local_10 + (param_5[1] - pfVar7[1]);

  local_c = local_c + local_18;

  fVar1 = *pfVar7 - *param_1;

  fVar2 = pfVar7[1] - param_1[1];

  fVar3 = pfVar7[2] - param_1[2];

  param_7 = _DAT_007ca760 + param_7;

  if (iVar5 == 0) {

    if (ABS(local_c) < _DAT_007ca760) {

      return 2;

    }

    if (local_c < DAT_00796344 == (local_c == DAT_00796344)) {

      local_30 = -1.0;

      fVar3 = -((fVar3 + param_5[3]) / local_c);

    }

    else {

      local_30 = 1.0;

      fVar3 = ((param_5[3] + param_1[3]) - fVar3) / local_c;

    }

    local_68 = (double)fVar3;

    local_3c = local_30;

    local_44 = DAT_00796344;

    local_40 = DAT_00796344;

    local_38 = local_14 * fVar3;

    local_34 = local_10 * fVar3;

    local_30 = fVar3 * local_c;

    local_2c = local_38;

    local_28 = local_34;

    local_24 = local_30;

    local_20 = local_38;

    local_1c = local_34;

    if (param_7 * param_7 <=

        (local_38 + fVar1) * (local_38 + fVar1) + (local_34 + fVar2) * (local_34 + fVar2)) {

      fVar3 = local_14 * local_14 + local_10 * local_10;

      if (ABS(fVar3) < _DAT_007ca760) {

        return 2;

      }

      fVar4 = -(local_14 * fVar1 + local_10 * fVar2);

      fVar1 = fVar4 * fVar4 - ((fVar1 * fVar1 + fVar2 * fVar2) - param_7 * param_7) * fVar3;

      if (((float)_DAT_00795610 <= fVar1) && (_DAT_007ca760 < fVar3)) {

        fVar1 = SQRT(fVar1);

        fVar2 = fVar4 - fVar1;

        if (fVar2 < (float)_DAT_00795610) {

          fVar2 = fVar1 + fVar4;

        }

        local_68 = (double)(fVar2 / fVar3);

        pfVar7 = (float *)FUN_00455f30(&local_2c,fVar2 / fVar3,&local_14);

        local_20 = *pfVar7;

        local_1c = pfVar7[1];

        local_30 = pfVar7[2];

        local_18 = local_30;

      }

      pfVar7 = &local_14;

      local_38 = local_20;

      local_34 = local_1c;

      FUN_0043d8b0(&local_2c,&local_38);

      pfVar7 = (float *)FUN_0043d8e0(pfVar7,param_1);

      local_44 = *pfVar7;

      local_40 = pfVar7[1];

      local_18 = pfVar7[2];

      local_3c = 0.0;

      local_20 = local_44;

      local_1c = local_40;

      FUN_00451ae0(param_7);

    }

  }

  else {

    if (local_3c == DAT_00796344) {

      fVar3 = local_14 * local_14 + local_10 * local_10;

      fVar4 = -(local_14 * fVar1 + local_10 * fVar2);

      fVar1 = fVar4 * fVar4 - ((fVar1 * fVar1 + fVar2 * fVar2) - param_7 * param_7) * fVar3;

      if (fVar1 < (float)_DAT_00795610) {

        return 2;

      }

      if (fVar3 < _DAT_007ca760) {

        return 2;

      }

      fVar1 = SQRT(fVar1);

      fVar2 = fVar4 - fVar1;

      if (fVar2 < (float)_DAT_00795610) {

        fVar2 = fVar1 + fVar4;

      }

      local_68 = (double)(fVar2 / fVar3);

      pfVar7 = (float *)FUN_00455f30(&local_20,fVar2 / fVar3,&local_14);

      local_38 = *pfVar7;

      local_34 = pfVar7[1];

      local_30 = pfVar7[2];

      if (local_68 < _DAT_00795610) {

        return 2;

      }

      if (_DAT_007938c0 < local_68) {

        return 2;

      }

      pfVar7 = &local_20;

      local_14 = local_38;

      local_10 = local_34;

      local_c = local_30;

      FUN_0043d8b0(&local_2c,&local_38);

      pfVar7 = (float *)FUN_0043d8e0(pfVar7,param_1);

      local_44 = *pfVar7;

      local_40 = pfVar7[1];

      local_c = pfVar7[2];

      local_3c = 0.0;

      local_14 = local_44;

      local_10 = local_40;

      FUN_00451ae0(param_7);

      goto LAB_0053bf78;

    }

    if (ABS(local_c) < _DAT_007ca760) {

      return 2;

    }

    if (local_c < DAT_00796344 == (local_c == DAT_00796344)) {

      fVar1 = -((fVar3 + param_5[3]) / local_c);

    }

    else {

      fVar1 = ((param_5[3] + param_1[3]) - fVar3) / local_c;

    }

    local_68 = (double)fVar1;

    pfVar7 = (float *)FUN_00455f30(&local_2c,fVar1,&local_14);

    local_38 = *pfVar7;

    local_34 = pfVar7[1];

    local_30 = pfVar7[2];

    local_20 = local_38;

    local_1c = local_34;

    local_18 = local_30;

  }

  if (local_68 < _DAT_00795610) {

    return 2;

  }

  if (_DAT_007938c0 < local_68) {

    return 2;

  }

LAB_0053bf78:

  pfVar7 = &local_20;

  pfVar8 = param_5;

  FUN_0043d8b0(&local_2c,&local_38);

  pfVar7 = (float *)FUN_0043d8e0(pfVar7,pfVar8);

  local_38 = *pfVar7;

  local_34 = pfVar7[1];

  local_30 = pfVar7[2];

  local_14 = local_38;

  local_10 = local_34;

  local_c = local_30;

  FUN_0050aad0(&local_44);

  FUN_005377a0(&local_38,param_5[3]);

  return 3;

}




// --- FUN_0053c000 at 0x0053C000 ---


undefined4

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

            ,undefined4 param_6,int param_7)



{

  int iVar1;

  undefined4 uVar2;

  undefined1 local_c [12];

  

  FUN_0053b8b0(param_2,param_4,param_5,param_6,param_7,local_c);

  iVar1 = FUN_004524a0();

  if (iVar1 != 0) {

    return 2;

  }

  uVar2 = FUN_00538180(param_2,param_3,local_c,*(int *)(param_2 + 0x38) + param_7 * 0xc);

  return uVar2;

}




// --- FUN_0053c070 at 0x0053C070 ---


undefined4 __thiscall

FUN_0053c070(int param_1,int param_2,int param_3,int param_4,undefined4 param_5)



{

  int iVar1;

  undefined4 uVar2;

  undefined1 local_18 [12];

  undefined1 local_c [12];

  

  if (*(float *)(param_2 + 0xc) <

      (*(float *)(param_3 + 0xc) + *(float *)(param_1 + 0xc)) - *(float *)(param_4 + 8)) {

    uVar2 = FUN_0053c000(param_2,param_2 + 0x20,param_2 + 0x270,param_3,param_4,param_5,0);

    return uVar2;

  }

  FUN_0053b8b0(param_2 + 0x20,param_3,param_4,param_5,0,local_18);

  iVar1 = FUN_004524a0();

  if (iVar1 != 0) {

    return 2;

  }

  uVar2 = FUN_00456340(local_c,local_18);

  iVar1 = FUN_0050c0e0(uVar2);

  if (iVar1 != 0) {

    return 1;

  }

  uVar2 = FUN_0050ce80(param_2,param_2 + 0x270);

  return uVar2;

}




// --- FUN_0053c130 at 0x0053C130 ---


undefined4

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

            ,undefined4 param_6)



{

  int iVar1;

  undefined1 local_c [12];

  

  FUN_0053b8b0(param_2,param_4,param_5,param_6,0,local_c);

  iVar1 = FUN_004524a0();

  if (iVar1 != 0) {

    return 2;

  }

  FUN_005385e0(local_c);

  *(undefined4 *)(param_2 + 0x1b8) = DAT_007ca708;

  return 3;

}




// --- FUN_0053c1a0 at 0x0053C1A0 ---


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



undefined4 __thiscall FUN_0053c1a0(float *param_1,int param_2)



{

  uint *puVar1;

  float *pfVar2;

  float fVar3;

  undefined4 uVar4;

  int iVar5;

  float *pfVar6;

  undefined4 *puVar7;

  int iVar8;

  double local_40;

  float local_34;

  float local_30;

  float local_2c;

  float local_28;

  float local_24;

  float local_20;

  undefined4 local_1c;

  undefined4 local_18;

  float local_14;

  undefined1 local_10 [16];

  

  puVar1 = (uint *)(param_2 + 0x20);

  pfVar2 = *(float **)(param_2 + 0x34);

  local_34 = *pfVar2 - *param_1;

  iVar5 = param_2 + 0x270;

  local_30 = pfVar2[1] - param_1[1];

  local_2c = pfVar2[2] - param_1[2];

  fVar3 = (param_1[4] - _DAT_007ca760) + pfVar2[3];

  if ((*(int *)(param_2 + 0x174) == 1) || (*(int *)(param_2 + 0x1cc) != 0)) {

    iVar5 = FUN_0053b5e0(pfVar2,&local_34,fVar3);

    if (iVar5 != 0) {

      return 2;

    }

    if (*puVar1 < 2) {

      return 1;

    }

    local_34 = pfVar2[4] - *param_1;

    local_30 = pfVar2[5] - param_1[1];

    local_2c = pfVar2[6] - param_1[2];

    local_28 = local_34;

    local_24 = local_30;

    local_20 = local_2c;

  }

  else {

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

      uVar4 = FUN_0053b710(param_2,puVar1,iVar5,pfVar2,&local_34,fVar3);

      return uVar4;

    }

    if (*(int *)(param_2 + 0x1f8) == 0) {

      if (*(int *)(param_2 + 0x124) == 0) {

        if ((*(uint *)(param_2 + 4) & 3) != 0) {

          iVar8 = FUN_0053b5e0(pfVar2,&local_34,fVar3);

          if (iVar8 != 0) {

            uVar4 = FUN_0053c070(param_2,pfVar2,&local_34,fVar3);

            return uVar4;

          }

          if (*puVar1 < 2) {

            return 1;

          }

          FUN_00452500(&local_1c,param_1);

          iVar8 = FUN_0053b5e0(pfVar2 + 4,&local_1c,fVar3);

          if (iVar8 == 0) {

            return 1;

          }

          uVar4 = FUN_0053c000(param_2,puVar1,iVar5,pfVar2 + 4,&local_1c,fVar3,1);

          return uVar4;

        }

        if ((*(uint *)(param_2 + 4) & 8) != 0) {

          iVar8 = FUN_0053b5e0(pfVar2,&local_34,fVar3);

          if (iVar8 == 0) {

            return 1;

          }

          uVar4 = FUN_0053ba10(param_2,puVar1,iVar5,pfVar2,&local_34,fVar3,0);

          return uVar4;

        }

        iVar8 = FUN_0053b5e0(pfVar2,&local_34,fVar3);

        if (iVar8 == 0) {

          if (*puVar1 < 2) {

            return 1;

          }

          FUN_00452500(&local_1c,param_1);

          iVar8 = FUN_0053b5e0(pfVar2 + 4,&local_1c,fVar3);

          if (iVar8 == 0) {

            return 1;

          }

          uVar4 = FUN_0053ba10(param_2,puVar1,iVar5,pfVar2 + 4,&local_1c,fVar3,1);

          return uVar4;

        }

        uVar4 = FUN_0053c130(param_2,puVar1,iVar5,pfVar2,&local_34,fVar3);

        return uVar4;

      }

      iVar5 = FUN_0053b5e0(pfVar2,&local_34,fVar3);

      if (iVar5 == 0) {

        if (*puVar1 < 2) {

          return 1;

        }

        FUN_00452500(&local_1c,param_1);

        iVar5 = FUN_0053b5e0(pfVar2 + 4,&local_1c,fVar3);

        if (iVar5 == 0) {

          return 1;

        }

      }

      uVar4 = FUN_0050aaa0(&local_40);

      puVar7 = &local_1c;

      FUN_00452500(local_10,pfVar2);

      FUN_00452500(puVar7,uVar4);

      if (ABS(local_14) < _DAT_007ca760) {

        return 2;

      }

      local_14 = ((param_1[3] + pfVar2[3]) - local_2c) / local_14;

      local_40 = (double)local_14;

      pfVar6 = (float *)FUN_0043d910(local_10,local_14);

      local_28 = *pfVar6;

      local_24 = pfVar6[1];

      local_20 = pfVar6[2];

      if (fVar3 * fVar3 <

          (local_28 + local_34) * (local_28 + local_34) +

          (local_24 + local_30) * (local_24 + local_30)) {

        return 1;

      }

      local_40 = (_DAT_007938c0 - local_40) * (double)*(float *)(param_2 + 0x1dc);

      if ((double)*(float *)(param_2 + 0x1dc) <= local_40) {

        return 2;

      }

      if (_DAT_007c7700 <= local_40) {

        puVar7 = (undefined4 *)FUN_0043d8b0(local_10,&local_28);

        local_1c = *puVar7;

        local_18 = puVar7[1];

        local_14 = (float)puVar7[2] - pfVar2[3];

        local_34 = 0.0;

        local_30 = 0.0;

        local_2c = 1.0;

        FUN_00537760(&local_34,&local_1c);

        FUN_0050a850(local_10,1);

        *(undefined4 *)(param_2 + 0x29c) = *(undefined4 *)(param_2 + 0x130);

        *(float *)(param_2 + 0x1dc) = (float)local_40;

        FUN_005377a0(&local_28,pfVar2[3]);

        return 3;

      }

      return 2;

    }

    iVar5 = FUN_0053b5e0(pfVar2,&local_34,fVar3);

    if (iVar5 != 0) {

      return 2;

    }

    if (*puVar1 < 2) {

      return 1;

    }

    pfVar6 = (float *)FUN_00452500(&local_1c,param_1);

    local_34 = *pfVar6;

    local_30 = pfVar6[1];

    local_2c = pfVar6[2];

  }

  iVar5 = FUN_0053b5e0(pfVar2 + 4,&local_34,fVar3);

  if (iVar5 == 0) {

    return 1;

  }

  return 2;

}




// --- FUN_0053c650 at 0x0053C650 ---


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



{

  undefined4 *puVar1;

  float local_2c;

  float local_28;

  float local_24;

  undefined1 local_20 [8];

  float local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_c;

  float local_8;

  float local_4;

  

  FUN_0050d4a0(param_2,0x3f800000);

  local_4 = param_3 * param_1[4];

  local_8 = param_3 * param_1[3];

  local_2c = param_3 * *param_1;

  local_28 = param_3 * param_1[1];

  local_24 = param_3 * param_1[2];

  local_18 = local_24;

  puVar1 = (undefined4 *)FUN_004562a0(local_20,param_2,&local_2c);

  local_14 = *puVar1;

  local_10 = puVar1[1];

  local_c = puVar1[2];

  FUN_0053c1a0(param_4);

  return;

}




// --- FUN_0053c6f0 at 0x0053C6F0 ---


void __fastcall FUN_0053c6f0(int *param_1)



{

  int iVar1;

  int iVar2;

  

  iVar1 = *param_1;

  if (iVar1 != 0) {

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

    if (-1 < iVar2 + -1) {

      do {

        FUN_00695670();

        iVar2 = iVar2 + -1;

      } while (iVar2 != 0);

    }

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

  }

  *param_1 = 0;

  return;

}




// --- FUN_0053c740 at 0x0053C740 ---


void __fastcall FUN_0053c740(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  param_1[4] = 0;

  param_1[3] = 0;

  param_1[2] = 0x80;

  param_1[5] = 0;

  return;

}




// --- FUN_0053c760 at 0x0053C760 ---


void FUN_0053c760(void)



{

  FUN_0053c6f0();

  return;

}




// --- FUN_0053c770 at 0x0053C770 ---


void __fastcall FUN_0053c770(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0xffffffff;

  param_1[5] = 0xffffffff;

  return;

}




// --- FUN_0053c790 at 0x0053C790 ---


void __fastcall FUN_0053c790(undefined4 *param_1)



{

  FUN_0052e870(*param_1);

  return;

}




// --- FUN_0053c7a0 at 0x0053C7A0 ---


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



{

  int iVar1;

  ushort uVar2;

  

  if (7 < param_3) {

    uVar2 = (ushort)(param_1[5] != 0);

    if (param_1[3] == 0) {

      uVar2 = uVar2 | 2;

    }

    if (*param_1 == -1) {

      uVar2 = uVar2 | 4;

    }

    *(ushort *)*param_2 = uVar2;

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(undefined2 *)(iVar1 + 2) = *(undefined2 *)(param_1[2] + 0xc);

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

    *(short *)(iVar1 + 2) = (short)*param_1;

    iVar1 = *param_2;

    *param_2 = iVar1 + 2;

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

    *param_2 = *param_2 + 2;

  }

  return 8;

}




// --- FUN_0053c810 at 0x0053C810 ---


undefined4 __thiscall

FUN_0053c810(uint *param_1,uint param_2,undefined2 *param_3,undefined4 *param_4)



{

  ushort uVar1;

  undefined2 uVar2;

  ushort uVar3;

  short sVar4;

  byte bVar5;

  

  uVar1 = *(ushort *)*param_4;

  *param_4 = (ushort *)*param_4 + 1;

  bVar5 = (byte)uVar1;

  param_1[5] = bVar5 & 1;

  param_1[3] = (byte)~bVar5 >> 1 & 1;

  uVar2 = *(undefined2 *)*param_4;

  *param_4 = (undefined2 *)*param_4 + 1;

  *param_3 = uVar2;

  uVar3 = *(ushort *)*param_4;

  *param_4 = (ushort *)*param_4 + 1;

  if ((uVar1 & 4) == 0) {

    *param_1 = uVar3 | param_2;

  }

  else {

    *param_1 = 0xffffffff;

  }

  sVar4 = *(short *)*param_4;

  *param_4 = (short *)*param_4 + 1;

  param_1[4] = (int)sVar4;

  return 1;

}




// --- FUN_0053c890 at 0x0053C890 ---


void __fastcall FUN_0053c890(undefined4 *param_1)



{

  *param_1 = 0xffffffff;

  param_1[1] = 0;

  param_1[2] = 0xffffffff;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  return;

}




// --- FUN_0053c8b0 at 0x0053C8B0 ---


void __fastcall FUN_0053c8b0(int param_1)



{

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

  return;

}




// --- FUN_0053c8c0 at 0x0053C8C0 ---


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



{

  void *pvVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  int *piVar5;

  bool bVar6;

  uint local_4;

  

  local_4 = 0;

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

    do {

      uVar4 = *param_4;

      bVar6 = uVar4 == 0;

      if (!bVar6) {

        piVar5 = (int *)(*param_2 + -4 + uVar4 * 4);

        uVar2 = uVar4;

        do {

          if (*(int *)(*(int *)(param_1 + 0x14) + local_4 * 4) == *piVar5) break;

          uVar2 = uVar2 - 1;

          piVar5 = piVar5 + -1;

        } while (uVar2 != 0);

        bVar6 = uVar2 == 0;

      }

      if (bVar6) {

        if (*param_3 <= uVar4) {

          pvVar1 = (void *)*param_2;

          iVar3 = thunk_FUN_005df0f5(*param_3 * 4 + 0x28);

          *param_2 = iVar3;

          *param_3 = *param_3 + 10;

          uVar4 = 0;

          if (*param_4 != 0) {

            do {

              *(undefined4 *)(*param_2 + uVar4 * 4) = *(undefined4 *)((int)pvVar1 + uVar4 * 4);

              uVar4 = uVar4 + 1;

            } while (uVar4 < *param_4);

          }

          operator_delete(pvVar1);

        }

        *(undefined4 *)(*param_2 + *param_4 * 4) =

             *(undefined4 *)(*(int *)(param_1 + 0x14) + local_4 * 4);

        *param_4 = *param_4 + 1;

      }

      local_4 = local_4 + 1;

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

  }

  return;

}




// --- FUN_0053c990 at 0x0053C990 ---


void __fastcall FUN_0053c990(int param_1)



{

  FUN_0052e870(*(undefined4 *)(param_1 + 4));

  return;

}




// --- FUN_0053c9a0 at 0x0053C9A0 ---


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



{

  undefined2 uVar1;

  ushort uVar2;

  short sVar3;

  byte bVar4;

  uint uVar5;

  

  uVar1 = *(undefined2 *)*param_3;

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

  bVar4 = (byte)uVar1;

  param_1[3] = bVar4 & 1;

  *param_1 = (byte)~bVar4 >> 1 & 1;

  uVar2 = *(ushort *)*param_3;

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

  param_1[1] = uVar2 | param_2;

  sVar3 = *(short *)*param_3;

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

  param_1[2] = (int)sVar3;

  uVar2 = *(ushort *)*param_3;

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

  uVar5 = (uint)uVar2;

  param_1[4] = uVar5;

  uVar5 = thunk_FUN_005df0f5(uVar5 * 4);

  param_1[5] = uVar5;

  uVar5 = 0;

  if (param_1[4] != 0) {

    do {

      uVar2 = *(ushort *)*param_3;

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

      *(uint *)(param_1[5] + uVar5 * 4) = uVar2 | param_2;

      uVar5 = uVar5 + 1;

    } while (uVar5 < param_1[4]);

  }

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

    *param_3 = *param_3 + 2;

  }

  return 1;

}




// --- FUN_0053ca60 at 0x0053CA60 ---


undefined4 __fastcall FUN_0053ca60(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  undefined4 uVar3;

  uint uVar4;

  

  uVar4 = 0;

  uVar3 = 1;

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

    do {

      uVar1 = FUN_004220b0(*(undefined4 *)(*(int *)(param_1 + 0x14) + uVar4 * 4),3);

      iVar2 = thunk_FUN_00413a30(uVar1);

      if ((iVar2 != 2) && (iVar2 != 1)) {

        uVar3 = 0;

      }

      uVar4 = uVar4 + 1;

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

  }

  return uVar3;

}




// --- FUN_0053cab0 at 0x0053CAB0 ---


uint __fastcall FUN_0053cab0(int param_1)



{

  uint uVar1;

  

  uVar1 = *(int *)(param_1 + 0x10) * 2 + 8;

  if ((uVar1 & 3) != 0) {

    return (4 - (uVar1 & 3)) + uVar1;

  }

  return uVar1;

}




// --- FUN_0053cad0 at 0x0053CAD0 ---


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



{

  uint uVar1;

  int iVar2;

  ushort uVar3;

  undefined2 *puVar4;

  uint uVar5;

  

  uVar5 = param_1[4] * 2 + 8;

  uVar1 = uVar5 & 3;

  if (uVar1 == 0) {

    iVar2 = 0;

  }

  else {

    iVar2 = 4 - uVar1;

  }

  if (iVar2 + uVar5 <= param_3) {

    uVar3 = (ushort)(param_1[3] != 0);

    if (*param_1 == 0) {

      uVar3 = param_1[3] != 0 | 2;

    }

    *(ushort *)*param_2 = uVar3;

    iVar2 = *param_2;

    *param_2 = iVar2 + 2;

    *(short *)(iVar2 + 2) = (short)param_1[1];

    iVar2 = *param_2;

    *param_2 = iVar2 + 2;

    *(short *)(iVar2 + 2) = (short)param_1[2];

    iVar2 = *param_2;

    *param_2 = iVar2 + 2;

    *(short *)(iVar2 + 2) = (short)param_1[4];

    puVar4 = (undefined2 *)(*param_2 + 2);

    *param_2 = (int)puVar4;

    uVar5 = 0;

    if (param_1[4] != 0) {

      do {

        *puVar4 = *(undefined2 *)(param_1[5] + uVar5 * 4);

        puVar4 = (undefined2 *)(*param_2 + 2);

        *param_2 = (int)puVar4;

        uVar5 = uVar5 + 1;

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

    }

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

      *puVar4 = 0;

      *param_2 = *param_2 + 2;

    }

  }

  return;

}




// --- FUN_0053cb90 at 0x0053CB90 ---


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



{

  void *pvVar1;

  uint uVar2;

  

  pvVar1 = malloc((param_2 + 1) * DAT_0081f710);

  *param_1 = pvVar1;

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

    return 0;

  }

  if ((DAT_0081f710 == 0x20) && (((uint)pvVar1 & 0x1f) != 0)) {

    pvVar1 = (void *)((int)pvVar1 + (0x20 - ((uint)pvVar1 & 0x1f)));

  }

  param_1[9] = pvVar1;

  param_1[7] = param_3;

  param_1[8] = param_2;

  if ((param_3 == 1) && (uVar2 = 0, param_2 != 0)) {

    do {

      FUN_0053ea90();

      uVar2 = uVar2 + 1;

    } while (uVar2 < (uint)param_1[8]);

  }

  return 1;

}




// --- FUN_0053cc10 at 0x0053CC10 ---


void __fastcall FUN_0053cc10(undefined4 *param_1)



{

  uint uVar1;

  

  if ((param_1[7] == 1) && (uVar1 = 0, param_1[8] != 0)) {

    do {

      FUN_0053eb90();

      uVar1 = uVar1 + 1;

    } while (uVar1 < (uint)param_1[8]);

  }

  free((void *)*param_1);

  *param_1 = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  return;

}




// --- FUN_0053cc70 at 0x0053CC70 ---


void __fastcall FUN_0053cc70(int param_1)



{

  uint uVar1;

  

  FUN_005b2ea0();

  uVar1 = 0;

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

    do {

      FUN_00534e90(DAT_0081f710 * uVar1 + *(int *)(param_1 + 0x24));

      uVar1 = uVar1 + 1;

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

  }

  return;

}




// --- FUN_0053ccc0 at 0x0053CCC0 ---


int __fastcall FUN_0053ccc0(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  iVar2 = 8;

  if ((*(int *)(param_1 + 0x1c) == 1) && (uVar3 = 0, *(int *)(param_1 + 0x20) != 0)) {

    do {

      iVar1 = FUN_0053eaa0();

      iVar2 = iVar2 + iVar1;

      uVar3 = uVar3 + 1;

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

  }

  return iVar2;

}




// --- FUN_0053cd10 at 0x0053CD10 ---


void __fastcall FUN_0053cd10(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  return;

}




// --- FUN_0053cd20 at 0x0053CD20 ---


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



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  

  uVar2 = FUN_0053ccc0();

  if (uVar2 <= param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

    if ((*(int *)(param_1 + 0x1c) == 1) && (uVar3 = 0, *(int *)(param_1 + 0x20) != 0)) {

      do {

        FUN_0053eab0(param_2,param_3);

        uVar3 = uVar3 + 1;

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

    }

  }

  return uVar2;

}




// --- FUN_0053cd90 at 0x0053CD90 ---


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



{

  int iVar1;

  uint uVar2;

  

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  iVar1 = FUN_0053cb90(*(undefined4 *)(param_1 + 0x20),*(undefined4 *)(param_1 + 0x1c));

  if (iVar1 != 0) {

    if ((*(int *)(param_1 + 0x1c) == 1) && (uVar2 = 0, *(int *)(param_1 + 0x20) != 0)) {

      do {

        FUN_0053ebb0(param_2,param_3);

        uVar2 = uVar2 + 1;

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

    }

    FUN_0053cc70();

    return 1;

  }

  return 0;

}




// --- FUN_0053ce10 at 0x0053CE10 ---


void __fastcall FUN_0053ce10(int param_1)



{

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

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

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

  }

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

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

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

  }

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

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

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

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

  }

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

  return;

}




// --- FUN_0053ce60 at 0x0053CE60 ---


void __thiscall FUN_0053ce60(int param_1,undefined4 param_2)



{

  float fVar1;

  int iVar2;

  

  do {

    fVar1 = *(float *)(param_1 + 0x14) * *DAT_00867334 +

            DAT_00867334[1] * *(float *)(param_1 + 0x18) +

            DAT_00867334[2] * *(float *)(param_1 + 0x1c) + *(float *)(param_1 + 0x20);

    if (fVar1 <= DAT_007ca8ac) {

      iVar2 = 1;

      if (-DAT_007ca8ac <= fVar1) {

        iVar2 = 2;

      }

    }

    else {

      iVar2 = 0;

    }

    if (iVar2 == 0) {

      if ((*(int *)(param_1 + 0x34) != 0) &&

         (iVar2 = *(int *)(*(int *)(param_1 + 0x34) + 0x24), iVar2 != 0x4c454146)) {

        if (iVar2 != 0x504f5254) {

          FUN_0053ce60(param_2);

          param_1 = *(int *)(param_1 + 0x30);

          goto LAB_0053cef0;

        }

        FUN_0053e5d0(param_2);

      }

      param_1 = *(int *)(param_1 + 0x30);

    }

    else {

      if ((iVar2 != 1) && (iVar2 != 2)) {

        return;

      }

      if ((*(int *)(param_1 + 0x30) != 0) &&

         (iVar2 = *(int *)(*(int *)(param_1 + 0x30) + 0x24), iVar2 != 0x4c454146)) {

        if (iVar2 == 0x504f5254) {

          FUN_0053e5d0(param_2);

        }

        else {

          FUN_0053ce60(param_2);

        }

      }

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

    }

LAB_0053cef0:

    if (param_1 == 0) {

      return;

    }

    if (*(int *)(param_1 + 0x24) == 0x4c454146) {

      return;

    }

    if (*(int *)(param_1 + 0x24) == 0x504f5254) {

      FUN_0053e5d0(param_2);

      return;

    }

  } while( true );

}




// --- FUN_0053cf50 at 0x0053CF50 ---


undefined4 __thiscall FUN_0053cf50(int param_1,float *param_2)



{

  float fVar1;

  int iVar2;

  

  while( true ) {

    fVar1 = *(float *)(param_1 + 0x14) * *param_2 +

            *(float *)(param_1 + 0x1c) * param_2[2] + *(float *)(param_1 + 0x18) * param_2[1] +

            *(float *)(param_1 + 0x20);

    if (fVar1 <= DAT_007ca8ac) {

      iVar2 = 1;

      if (-DAT_007ca8ac <= fVar1) {

        iVar2 = 2;

      }

    }

    else {

      iVar2 = 0;

    }

    if ((iVar2 != 0) && ((iVar2 == 1 || (iVar2 != 2)))) break;

    param_1 = *(int *)(param_1 + 0x30);

    if (param_1 == 0) {

      return 1;

    }

  }

  return 0;

}




// --- FUN_0053cfc0 at 0x0053CFC0 ---


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



bool __thiscall FUN_0053cfc0(int param_1,float *param_2)



{

  float fVar1;

  float fVar2;

  int iVar3;

  

  fVar1 = *(float *)(param_1 + 0x14) * *param_2 +

          *(float *)(param_1 + 0x1c) * param_2[2] + *(float *)(param_1 + 0x18) * param_2[1] +

          *(float *)(param_1 + 0x20);

  fVar2 = param_2[3] + _DAT_007a1870;

  if (fVar1 < -fVar2 == (fVar1 == -fVar2)) {

    do {

      param_1 = *(int *)(param_1 + 0x30);

      if (fVar1 < fVar2) {

        if (param_1 != 0) {

          iVar3 = FUN_0053cfc0(param_2);

          return iVar3 != 0;

        }

        return true;

      }

      if (param_1 == 0) {

        return (bool)2;

      }

      fVar1 = *(float *)(param_1 + 0x14) * *param_2 +

              *(float *)(param_1 + 0x1c) * param_2[2] + *(float *)(param_1 + 0x18) * param_2[1] +

              *(float *)(param_1 + 0x20);

    } while (fVar1 < -fVar2 == (fVar1 == -fVar2));

  }

  return false;

}




// --- FUN_0053d0c0 at 0x0053D0C0 ---


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



{

  int iVar1;

  

  if (0xf < 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];

    *param_2 = *param_2 + 4;

  }

  return 0x10;

}




// --- FUN_0053d110 at 0x0053D110 ---


void __fastcall FUN_0053d110(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007ca8b0;

  param_1[9] = 0x23232323;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  return;

}




// --- FUN_0053d130 at 0x0053D130 ---


void __fastcall FUN_0053d130(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007ca8b0;

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

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

    param_1[0xc] = 0;

  }

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

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

    param_1[0xb] = 0;

  }

  param_1[10] = 0;

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

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

    param_1[0xd] = 0;

  }

  param_1[9] = 0x23232323;

  return;

}




// --- FUN_0053d180 at 0x0053D180 ---


int __fastcall FUN_0053d180(int param_1)



{

  int iVar1;

  int iVar2;

  undefined4 local_4;

  

  local_4 = 0;

  iVar2 = 0x10;

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

    iVar2 = FUN_0053d460(*(int *)(param_1 + 0x30),&local_4,0);

    iVar2 = iVar2 + 0x10;

  }

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

    iVar1 = FUN_0053d460(*(int *)(param_1 + 0x34),&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

  if (DAT_0084638c == 0) {

    return iVar2 + 0x14 + *(int *)(param_1 + 0x28) * 2;

  }

  if (DAT_0084638c == 1) {

    iVar2 = iVar2 + 0x10;

  }

  return iVar2;

}




// --- FUN_0053d1f0 at 0x0053D1F0 ---


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



{

  uint uVar1;

  uint uVar2;

  

  uVar1 = FUN_0053d180();

  if (uVar1 <= param_3) {

    FUN_0053d0c0(param_2,param_3);

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

      FUN_0053d460(*(int *)(param_1 + 0x30),param_2,param_3);

    }

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

      FUN_0053d460(*(int *)(param_1 + 0x34),param_2,param_3);

    }

    if (DAT_0084638c == 0) {

      FUN_0053d0c0(param_2,param_3);

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

      *param_2 = *param_2 + 4;

      uVar2 = 0;

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

        do {

          *(undefined2 *)*param_2 =

               *(undefined2 *)(*(int *)(*(int *)(param_1 + 0x2c) + uVar2 * 4) + 0xc);

          *param_2 = *param_2 + 2;

          uVar2 = uVar2 + 1;

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

        return uVar1;

      }

    }

    else if (DAT_0084638c == 1) {

      FUN_0053d0c0(param_2,param_3);

    }

  }

  return uVar1;

}




// --- FUN_0053d2a0 at 0x0053D2A0 ---


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



{

  short sVar1;

  undefined4 *puVar2;

  int iVar3;

  undefined4 uVar4;

  uint uVar5;

  

  puVar2 = (undefined4 *)*param_2;

  if (0xf < param_3) {

    if (0xb < param_3) {

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

      iVar3 = *param_2;

      *param_2 = iVar3 + 4;

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

      iVar3 = *param_2;

      *param_2 = iVar3 + 4;

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

      *param_2 = *param_2 + 4;

    }

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

    *param_2 = *param_2 + 4;

  }

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

  if (0x42506e6e < iVar3) {

    if (((iVar3 == 0x4270494e) || (iVar3 == 0x42706e4e)) &&

       (iVar3 = FUN_0053d4d0(param_1 + 0x34,param_2,param_3), iVar3 == 0)) goto LAB_0053d370;

    goto LAB_0053d37b;

  }

  if (iVar3 == 0x42506e6e) {

LAB_0053d335:

    iVar3 = FUN_0053d4d0(param_1 + 0x30,param_2,param_3);

    if (iVar3 == 0) {

      *param_2 = (int)puVar2;

      return 0;

    }

  }

  else {

    if (iVar3 != 0x4250494e) {

      if (iVar3 == 0x4250496e) goto LAB_0053d335;

      if (iVar3 != 0x42506e4e) goto LAB_0053d37b;

    }

    iVar3 = FUN_0053d4d0(param_1 + 0x30,param_2,param_3);

    if (iVar3 == 0) {

LAB_0053d370:

      *param_2 = (int)puVar2;

      return 0;

    }

    iVar3 = FUN_0053d4d0(param_1 + 0x34,param_2,param_3);

    if (iVar3 == 0) {

      *param_2 = (int)puVar2;

      return 0;

    }

  }

LAB_0053d37b:

  if (DAT_0084638c == 0) {

    FUN_00520830(param_2,param_3);

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

    *param_2 = *param_2 + 4;

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

      uVar4 = thunk_FUN_005df0f5(*(int *)(param_1 + 0x28) * 4);

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

      uVar5 = 0;

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

        do {

          sVar1 = *(short *)*param_2;

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

          *(int *)(*(int *)(param_1 + 0x2c) + uVar5 * 4) = sVar1 * 0x30 + DAT_00846388;

          uVar5 = uVar5 + 1;

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

        return 1;

      }

    }

  }

  else if (DAT_0084638c == 1) {

    FUN_00520830(param_2,param_3);

  }

  return 1;

}




// --- FUN_0053d410 at 0x0053D410 ---


int FUN_0053d410(int param_1)



{

  int iVar1;

  undefined4 local_4;

  

  local_4 = 0;

  if (*(int *)(param_1 + 0x24) == 0x504f5254) {

    iVar1 = FUN_0053e800(&local_4,0);

    return iVar1 + 4;

  }

  if (*(int *)(param_1 + 0x24) == 0x4c454146) {

    iVar1 = FUN_0053e160(&local_4,0);

    return iVar1 + 4;

  }

  iVar1 = FUN_0053d1f0(&local_4,0);

  return iVar1 + 4;

}




// --- FUN_0053d460 at 0x0053D460 ---


uint FUN_0053d460(int param_1,int *param_2,uint param_3)



{

  uint uVar1;

  

  uVar1 = FUN_0053d410(param_1);

  if (uVar1 <= param_3) {

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

    *param_2 = *param_2 + 4;

    if (*(int *)(param_1 + 0x24) == 0x504f5254) {

      FUN_0053e800(param_2,param_3);

      return uVar1;

    }

    if (*(int *)(param_1 + 0x24) == 0x4c454146) {

      FUN_0053e160(param_2,param_3);

      return uVar1;

    }

    FUN_0053d1f0(param_2,param_3);

  }

  return uVar1;

}




// --- FUN_0053d4d0 at 0x0053D4D0 ---


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



{

  int iVar1;

  undefined4 *puVar2;

  int iVar3;

  

  iVar1 = *(int *)*param_2;

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

  if (iVar1 == 0x504f5254) {

    iVar1 = FUN_005df0f5(0x40);

    iVar3 = 0;

    if (iVar1 != 0) {

      iVar3 = FUN_0053e5b0();

    }

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

    FUN_0053e8d0(param_2,param_3);

    *param_1 = iVar3;

    return;

  }

  if (iVar1 == 0x4c454146) {

    iVar1 = FUN_005df0f5(0x40);

    iVar3 = 0;

    if (iVar1 != 0) {

      iVar3 = FUN_0053e130();

    }

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

    FUN_0053e200(param_2,param_3);

    *param_1 = iVar3;

    return;

  }

  puVar2 = (undefined4 *)FUN_005df0f5(0x38);

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

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = &PTR_FUN_007ca8b0;

    puVar2[9] = 0x23232323;

    puVar2[10] = 0;

    puVar2[0xb] = 0;

    puVar2[0xc] = 0;

    puVar2[0xd] = 0;

  }

  *param_1 = (int)puVar2;

  puVar2[9] = iVar1;

  FUN_0053d2a0(param_2,param_3);

  return;

}




// --- FUN_0053d5b0 at 0x0053D5B0 ---


void __thiscall FUN_0053d5b0(int param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  

  iVar1 = param_2[2];

  while (iVar1 = iVar1 + -1, -1 < iVar1) {

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

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

    param_1 = iVar2;

    if (0 < iVar1) {

      *(undefined4 *)(iVar2 + 0x30) = *(undefined4 *)(*param_2 + -4 + iVar1 * 4);

    }

  }

  return;

}




// --- FUN_0053d5e0 at 0x0053D5E0 ---


undefined4 __thiscall FUN_0053d5e0(int param_1,float *param_2)



{

  float fVar1;

  float fVar2;

  int iVar3;

  float local_54;

  float local_50;

  float local_4c;

  float local_48;

  float local_44;

  float local_40;

  float local_3c;

  float local_38;

  float local_34;

  float local_30;

  float local_2c;

  float local_28;

  float local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_c;

  float local_8;

  float local_4;

  

  fVar2 = DAT_007ca8ac;

  do {

    fVar1 = *param_2 * *(float *)(param_1 + 0x14) +

            param_2[1] * *(float *)(param_1 + 0x18) + param_2[2] * *(float *)(param_1 + 0x1c) +

            *(float *)(param_1 + 0x20);

    if ((fVar1 <= DAT_007ca8ac) && (fVar1 < -DAT_007ca8ac)) {

      local_54 = param_2[3];

      local_50 = param_2[4];

      local_4c = param_2[5];

      iVar3 = FUN_00444880(&local_54,fVar2);

      if (iVar3 == 1) {

        local_48 = *param_2;

        local_44 = param_2[1];

        local_40 = param_2[5];

        iVar3 = FUN_00444880(&local_48,fVar2);

        if (iVar3 == 1) {

          local_3c = *param_2;

          local_34 = param_2[2];

          local_38 = param_2[4];

          iVar3 = FUN_00444880(&local_3c,fVar2);

          if (iVar3 == 1) {

            local_30 = param_2[3];

            local_2c = param_2[1];

            local_28 = param_2[2];

            iVar3 = FUN_00444880(&local_30,fVar2);

            if (iVar3 == 1) {

              local_24 = param_2[3];

              local_20 = param_2[1];

              local_1c = param_2[5];

              iVar3 = FUN_00444880(&local_24,fVar2);

              if (iVar3 == 1) {

                local_18 = *param_2;

                local_10 = param_2[5];

                local_14 = param_2[4];

                iVar3 = FUN_00444880(&local_18,fVar2);

                if (iVar3 == 1) {

                  local_c = param_2[3];

                  local_8 = param_2[4];

                  local_4 = param_2[2];

                  iVar3 = FUN_00444880(&local_c,fVar2);

                  if (iVar3 == 1) {

                    return 0;

                  }

                }

              }

            }

          }

        }

      }

    }

    param_1 = *(int *)(param_1 + 0x30);

  } while (param_1 != 0);

  return 1;

}




// --- FUN_0053e040 at 0x0053E040 ---


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



{

  *param_1 = &PTR_FUN_007ca8b0;

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

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

    param_1[0xc] = 0;

  }

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

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

    param_1[0xb] = 0;

  }

  param_1[10] = 0;

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

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

    param_1[0xd] = 0;

  }

  param_1[9] = 0x23232323;

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

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_0053e0a0 at 0x0053E0A0 ---


void __thiscall FUN_0053e0a0(int param_1,undefined4 param_2)



{

  int *piVar1;

  undefined4 *puVar2;

  

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

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

    FUN_0053e0a0(param_2);

    puVar2 = (undefined4 *)*piVar1;

    if (puVar2[9] == 0x504f5254) {

      FUN_004637a0(piVar1);

    }

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

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

    }

    *piVar1 = 0;

  }

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

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

    FUN_0053e0a0(param_2);

    puVar2 = (undefined4 *)*piVar1;

    if (puVar2[9] == 0x504f5254) {

      FUN_004637a0(piVar1);

    }

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

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

      *piVar1 = 0;

      return;

    }

    *piVar1 = 0;

  }

  return;

}




// --- FUN_0053e130 at 0x0053E130 ---


undefined4 * __fastcall FUN_0053e130(undefined4 *param_1)



{

  FUN_0053d110();

  *param_1 = &PTR_FUN_007ca964;

  param_1[0xe] = 0xffffffff;

  param_1[0xf] = 0;

  return param_1;

}




// --- FUN_0053e160 at 0x0053E160 ---


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



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  

  uVar3 = 4;

  if (DAT_0084638c == 1) {

    uVar3 = *(int *)(param_1 + 0x28) * 2 + 0x1c;

  }

  if (uVar3 <= param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    if (DAT_0084638c == 1) {

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

      *param_2 = *param_2 + 4;

      FUN_0053d0c0(param_2,param_3);

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

      *param_2 = *param_2 + 4;

      uVar2 = 0;

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

        do {

          *(undefined2 *)*param_2 =

               *(undefined2 *)(*(int *)(*(int *)(param_1 + 0x2c) + uVar2 * 4) + 0xc);

          *param_2 = *param_2 + 2;

          uVar2 = uVar2 + 1;

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

      }

    }

  }

  return uVar3;

}




// --- FUN_0053e200 at 0x0053E200 ---


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



{

  short sVar1;

  int iVar2;

  undefined4 uVar3;

  uint uVar4;

  undefined4 *puVar5;

  

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

  iVar2 = *param_2;

  *param_2 = iVar2 + 4;

  if (DAT_0084638c == 1) {

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

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

    *param_2 = (int)puVar5;

    if (0xb < param_3) {

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

      iVar2 = *param_2;

      *param_2 = iVar2 + 4;

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

      iVar2 = *param_2;

      *param_2 = iVar2 + 4;

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

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

      *param_2 = (int)puVar5;

    }

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

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

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

    *param_2 = *param_2 + 4;

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

      uVar3 = thunk_FUN_005df0f5(*(int *)(param_1 + 0x28) * 4);

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

      uVar4 = 0;

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

        do {

          sVar1 = *(short *)*param_2;

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

          *(int *)(*(int *)(param_1 + 0x2c) + uVar4 * 4) = sVar1 * 0x30 + DAT_00846388;

          uVar4 = uVar4 + 1;

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

      }

    }

  }

  return 1;

}




// --- FUN_0053e350 at 0x0053E350 ---


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



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

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

  if (iVar2 == 0) {

    return 0;

  }

  if ((param_3 != 0) && (*(int *)(param_1 + 0x3c) != 0)) {

    return 1;

  }

  iVar1 = FUN_005351e0(param_2);

  if ((iVar1 != 0) && (uVar3 = 0, iVar2 != 0)) {

    do {

      iVar2 = FUN_0053a280(param_2);

      if (iVar2 != 0) {

        return 1;

      }

      uVar3 = uVar3 + 1;

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

  }

  return 0;

}




// --- FUN_0053e4e0 at 0x0053E4E0 ---


undefined4 __thiscall

FUN_0053e4e0(int param_1,undefined4 param_2,undefined4 param_3,undefined4 *param_4,

            undefined4 *param_5,int param_6)



{

  int iVar1;

  uint uVar2;

  

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

    return 0;

  }

  if ((param_6 != 0) && (*(int *)(param_1 + 0x3c) != 0)) {

    *param_4 = 1;

  }

  iVar1 = FUN_005351e0(param_2);

  if ((iVar1 != 0) && (uVar2 = 0, *(int *)(param_1 + 0x28) != 0)) {

    do {

      iVar1 = FUN_0053a280(param_2);

      if (iVar1 != 0) {

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

        return 1;

      }

      uVar2 = uVar2 + 1;

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

  }

  return *param_4;

}




// --- FUN_0053e570 at 0x0053E570 ---


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



{

  *param_1 = &PTR_FUN_007ca964;

  param_1[0xe] = 0xffffffff;

  FUN_0053ce10();

  FUN_0053d130();

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

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_0053e5b0 at 0x0053E5B0 ---


undefined4 * __fastcall FUN_0053e5b0(undefined4 *param_1)



{

  FUN_0053d110();

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  *param_1 = &PTR_FUN_007ca9c0;

  return param_1;

}




// --- FUN_0053e5d0 at 0x0053E5D0 ---


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



void __thiscall FUN_0053e5d0(int param_1,undefined4 param_2)



{

  float fVar1;

  int iVar2;

  uint uVar3;

  

  do {

    fVar1 = *(float *)(param_1 + 0x14) * *DAT_00867334 +

            DAT_00867334[1] * *(float *)(param_1 + 0x18) +

            DAT_00867334[2] * *(float *)(param_1 + 0x1c) + *(float *)(param_1 + 0x20);

    if (fVar1 <= _DAT_007ca9bc) {

      iVar2 = 1;

      if (-_DAT_007ca9bc <= fVar1) {

        iVar2 = 2;

      }

    }

    else {

      iVar2 = 0;

    }

    if (iVar2 == 0) {

      if ((*(int *)(param_1 + 0x34) != 0) &&

         (iVar2 = *(int *)(*(int *)(param_1 + 0x34) + 0x24), iVar2 != 0x4c454146)) {

        if (iVar2 == 0x504f5254) {

          FUN_0053e5d0(param_2);

        }

        else {

          FUN_0053ce60(param_2);

        }

      }

      uVar3 = 0;

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

        do {

          (**(code **)(*DAT_00870340 + 0x4c))

                    (*(undefined4 *)(*(int *)(param_1 + 0x3c) + uVar3 * 4),1,param_2);

          uVar3 = uVar3 + 1;

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

      }

      param_1 = *(int *)(param_1 + 0x30);

    }

    else if (iVar2 == 1) {

      if ((*(int *)(param_1 + 0x30) != 0) &&

         (iVar2 = *(int *)(*(int *)(param_1 + 0x30) + 0x24), iVar2 != 0x4c454146)) {

        if (iVar2 == 0x504f5254) {

          FUN_0053e5d0(param_2);

        }

        else {

          FUN_0053ce60(param_2);

        }

      }

      uVar3 = 0;

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

        do {

          (**(code **)(*DAT_00870340 + 0x4c))

                    (*(undefined4 *)(*(int *)(param_1 + 0x3c) + uVar3 * 4),1,param_2);

          uVar3 = uVar3 + 1;

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

      }

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

    }

    else {

      if (iVar2 != 2) {

        return;

      }

      if ((*(int *)(param_1 + 0x30) != 0) &&

         (iVar2 = *(int *)(*(int *)(param_1 + 0x30) + 0x24), iVar2 != 0x4c454146)) {

        if (iVar2 != 0x504f5254) {

          FUN_0053ce60(param_2);

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

          goto LAB_0053e711;

        }

        FUN_0053e5d0(param_2);

      }

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

    }

LAB_0053e711:

    if (param_1 == 0) {

      return;

    }

    if (*(int *)(param_1 + 0x24) == 0x4c454146) {

      return;

    }

    if (*(int *)(param_1 + 0x24) != 0x504f5254) {

      FUN_0053ce60(param_2);

      return;

    }

  } while( true );

}




// --- FUN_0053e740 at 0x0053E740 ---


void __fastcall FUN_0053e740(int param_1)



{

  void *pvVar1;

  uint uVar2;

  

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

    uVar2 = 0;

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

      do {

        pvVar1 = *(void **)(*(int *)(param_1 + 0x3c) + uVar2 * 4);

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

          FUN_0053ece0();

          operator_delete(pvVar1);

        }

        uVar2 = uVar2 + 1;

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

    }

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

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

  }

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

  FUN_0053ce10();

  return;

}




// --- FUN_0053e7a0 at 0x0053E7A0 ---


int __fastcall FUN_0053e7a0(int param_1)



{

  int iVar1;

  int iVar2;

  undefined4 local_4;

  

  local_4 = 0;

  iVar1 = FUN_0053d460(*(undefined4 *)(param_1 + 0x30),&local_4,0);

  iVar2 = FUN_0053d460(*(undefined4 *)(param_1 + 0x34),&local_4,0);

  iVar2 = iVar1 + 0x10 + iVar2;

  if (DAT_0084638c == 0) {

    return iVar2 + (*(int *)(param_1 + 0x28) + 0xc + *(int *)(param_1 + 0x38) * 2) * 2;

  }

  return iVar2;

}




// --- FUN_0053e800 at 0x0053E800 ---


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



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  

  uVar2 = FUN_0053e7a0();

  if (uVar2 <= param_3) {

    FUN_0053d0c0(param_2,param_3);

    FUN_0053d460(*(undefined4 *)(param_1 + 0x30),param_2,param_3);

    FUN_0053d460(*(undefined4 *)(param_1 + 0x34),param_2,param_3);

    if (DAT_0084638c == 0) {

      FUN_0053d0c0(param_2,param_3);

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      *param_2 = *param_2 + 4;

      uVar3 = 0;

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

        do {

          *(undefined2 *)*param_2 =

               *(undefined2 *)(*(int *)(*(int *)(param_1 + 0x2c) + uVar3 * 4) + 0xc);

          *param_2 = *param_2 + 2;

          uVar3 = uVar3 + 1;

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

      }

      uVar3 = 0;

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

        do {

          *(undefined2 *)*param_2 =

               *(undefined2 *)(*(int *)(*(int *)(*(int *)(param_1 + 0x3c) + uVar3 * 4) + 4) + 0xc);

          iVar1 = *param_2;

          *param_2 = iVar1 + 2;

          *(undefined2 *)(iVar1 + 2) = **(undefined2 **)(*(int *)(param_1 + 0x3c) + uVar3 * 4);

          *param_2 = *param_2 + 2;

          uVar3 = uVar3 + 1;

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

      }

    }

  }

  return uVar2;

}




// --- FUN_0053e8d0 at 0x0053E8D0 ---


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



{

  short sVar1;

  undefined4 *puVar2;

  int iVar3;

  undefined4 uVar4;

  uint uVar5;

  

  puVar2 = (undefined4 *)*param_2;

  if (0xf < param_3) {

    if (0xb < param_3) {

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

      iVar3 = *param_2;

      *param_2 = iVar3 + 4;

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

      iVar3 = *param_2;

      *param_2 = iVar3 + 4;

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

      *param_2 = *param_2 + 4;

    }

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

    *param_2 = *param_2 + 4;

    iVar3 = FUN_0053d4d0(param_1 + 0x30,param_2,param_3);

    if ((iVar3 != 0) && (iVar3 = FUN_0053d4d0(param_1 + 0x34,param_2,param_3), iVar3 != 0)) {

      if (DAT_0084638c == 0) {

        FUN_00520830(param_2,param_3);

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

        iVar3 = *param_2;

        *param_2 = iVar3 + 4;

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

        *param_2 = *param_2 + 4;

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

          uVar4 = thunk_FUN_005df0f5(*(int *)(param_1 + 0x28) * 4);

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

          uVar5 = 0;

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

            do {

              sVar1 = *(short *)*param_2;

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

              *(int *)(*(int *)(param_1 + 0x2c) + uVar5 * 4) = sVar1 * 0x30 + DAT_00846388;

              uVar5 = uVar5 + 1;

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

          }

        }

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

          uVar4 = thunk_FUN_005df0f5(*(int *)(param_1 + 0x38) * 4);

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

          uVar5 = 0;

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

            do {

              iVar3 = FUN_005df0f5(8);

              if (iVar3 == 0) {

                uVar4 = 0;

              }

              else {

                uVar4 = FUN_0053ecd0();

              }

              *(undefined4 *)(*(int *)(param_1 + 0x3c) + uVar5 * 4) = uVar4;

              sVar1 = *(short *)*param_2;

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

              *(int *)(*(int *)(*(int *)(param_1 + 0x3c) + uVar5 * 4) + 4) =

                   sVar1 * 0x30 + DAT_00846388;

              sVar1 = *(short *)*param_2;

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

              **(int **)(*(int *)(param_1 + 0x3c) + uVar5 * 4) = (int)sVar1;

              uVar5 = uVar5 + 1;

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

          }

        }

      }

      return 1;

    }

    *param_2 = (int)puVar2;

  }

  return 0;

}




// --- FUN_0053ea60 at 0x0053EA60 ---


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



{

  *param_1 = &PTR_FUN_007ca9c0;

  FUN_0053e740();

  FUN_0053d130();

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

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_0053ea90 at 0x0053EA90 ---


void __fastcall FUN_0053ea90(int param_1)



{

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

  *(undefined2 *)(param_1 + 0xe) = 0;

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

  return;

}




// --- FUN_0053eaa0 at 0x0053EAA0 ---


int __fastcall FUN_0053eaa0(int param_1)



{

  return (uint)*(ushort *)(param_1 + 0xe) * 8 + 0x1c;

}




// --- FUN_0053eab0 at 0x0053EAB0 ---


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



{

  undefined4 *puVar1;

  uint uVar2;

  int iVar3;

  int iVar4;

  

  uVar2 = (uint)*(ushort *)((int)param_1 + 0xe) * 8 + 0x1c;

  if (uVar2 <= param_3) {

    *(undefined2 *)*param_2 = *(undefined2 *)(param_1 + 3);

    iVar4 = *param_2;

    *param_2 = iVar4 + 2;

    *(undefined2 *)(iVar4 + 2) = *(undefined2 *)((int)param_1 + 0xe);

    iVar4 = *param_2;

    *param_2 = iVar4 + 2;

    if (0xb < param_3) {

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

      iVar4 = *param_2;

      *param_2 = iVar4 + 4;

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

      iVar4 = *param_2;

      *param_2 = iVar4 + 4;

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

      iVar4 = *param_2;

      *param_2 = iVar4 + 4;

      if (0xb < param_3) {

        *(undefined4 *)(iVar4 + 4) = param_1[5];

        iVar4 = *param_2;

        *param_2 = iVar4 + 4;

        *(undefined4 *)(iVar4 + 4) = param_1[6];

        iVar4 = *param_2;

        *param_2 = iVar4 + 4;

        *(undefined4 *)(iVar4 + 4) = param_1[7];

        *param_2 = *param_2 + 4;

      }

    }

    iVar4 = 0;

    if (*(short *)((int)param_1 + 0xe) != 0) {

      do {

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

        if (7 < param_3) {

          *(undefined4 *)*param_2 = *puVar1;

          iVar3 = *param_2;

          *param_2 = iVar3 + 4;

          *(undefined4 *)(iVar3 + 4) = puVar1[1];

          *param_2 = *param_2 + 4;

        }

        iVar4 = iVar4 + 1;

      } while (iVar4 < (int)(uint)*(ushort *)((int)param_1 + 0xe));

    }

  }

  return uVar2;

}




// --- FUN_0053eb90 at 0x0053EB90 ---


void __fastcall FUN_0053eb90(int param_1)



{

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

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

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

  }

  return;

}




// --- FUN_0053ebb0 at 0x0053EBB0 ---


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



{

  int iVar1;

  int iVar2;

  uint *puVar3;

  int iVar4;

  uint uVar5;

  uint *puVar6;

  

  puVar6 = (uint *)0x0;

  if (param_1[4] != 0) {

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

    param_1[4] = 0;

  }

  *(undefined2 *)(param_1 + 3) = *(undefined2 *)*param_2;

  iVar4 = *param_2;

  *param_2 = iVar4 + 2;

  *(undefined2 *)((int)param_1 + 0xe) = *(undefined2 *)(iVar4 + 2);

  iVar4 = *param_2;

  *param_2 = iVar4 + 2;

  if (0xb < param_3) {

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

    if (0xb < param_3) {

      param_1[5] = *(undefined4 *)(iVar4 + 4);

      iVar4 = *param_2;

      *param_2 = iVar4 + 4;

      param_1[6] = *(undefined4 *)(iVar4 + 4);

      iVar4 = *param_2;

      *param_2 = iVar4 + 4;

      param_1[7] = *(undefined4 *)(iVar4 + 4);

      *param_2 = *param_2 + 4;

    }

  }

  if (*(ushort *)((int)param_1 + 0xe) != 0) {

    uVar5 = (uint)*(ushort *)((int)param_1 + 0xe);

    puVar3 = (uint *)thunk_FUN_005df0f5(uVar5 * 8 + 4);

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

      puVar6 = puVar3 + 1;

      *puVar3 = uVar5;

      FUN_00401000(puVar6,8,uVar5,FUN_0050a140);

    }

    iVar4 = 0;

    param_1[4] = puVar6;

    if (*(short *)((int)param_1 + 0xe) != 0) {

      do {

        iVar1 = param_1[4];

        *(undefined4 *)(iVar1 + iVar4 * 8) = *(undefined4 *)*param_2;

        iVar2 = *param_2;

        *param_2 = iVar2 + 4;

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

        *param_2 = *param_2 + 4;

        iVar4 = iVar4 + 1;

      } while (iVar4 < (int)(uint)*(ushort *)((int)param_1 + 0xe));

    }

  }

  return 1;

}




// --- FUN_0053ecd0 at 0x0053ECD0 ---


void __fastcall FUN_0053ecd0(undefined4 *param_1)



{

  *param_1 = 0xffffffff;

  param_1[1] = 0;

  return;

}




// --- FUN_0053ece0 at 0x0053ECE0 ---


void __fastcall FUN_0053ece0(undefined4 *param_1)



{

  param_1[1] = 0;

  *param_1 = 0xffffffff;

  return;

}




// --- FUN_0053ecf0 at 0x0053ECF0 ---


void __fastcall FUN_0053ecf0(int param_1)



{

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

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

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

  }

  return;

}




// --- FUN_0053ed10 at 0x0053ED10 ---


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



void FUN_0053ed10(int *param_1)



{

  int *piVar1;

  int iVar2;

  

  piVar1 = DAT_00846758;

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

    if (param_1 == DAT_00846758) {

      iVar2 = DAT_00846758[9];

      DAT_00846758[9] = iVar2 + -1;

      if (iVar2 + -1 == 0) {

        (**(code **)(*piVar1 + 0x18))(1);

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

          (**(code **)(*DAT_00846758 + 0x18))(1);

        }

        DAT_00846758 = (int *)0x0;

        _DAT_0081f918 = 0xffffffff;

      }

    }

    else {

      if (param_1[8] != 0) {

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

                    /* WARNING: Treating indirect jump as call */

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

        return;

      }

      piVar1 = param_1 + 9;

      *piVar1 = *piVar1 + -1;

      if (*piVar1 == 0) {

        (**(code **)(*param_1 + 0x18))(1);

        (**(code **)(*param_1 + 0x18))(1);

        return;

      }

    }

  }

  return;

}




// --- FUN_0053ed90 at 0x0053ED90 ---


int * FUN_0053ed90(int *param_1)



{

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

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

  }

  return param_1;

}




// --- FUN_0053edb0 at 0x0053EDB0 ---


undefined4 __thiscall FUN_0053edb0(int param_1,int param_2)



{

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

}




// --- FUN_0053edc0 at 0x0053EDC0 ---


undefined4 __fastcall FUN_0053edc0(int param_1)



{

  undefined4 *puVar1;

  char cVar2;

  undefined4 uVar3;

  uint uVar4;

  undefined4 *puVar5;

  

  cVar2 = FUN_00413a70();

  if ((cVar2 != '\0') && (*(int *)(param_1 + 0x38) == 0x100)) {

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

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

    uVar3 = thunk_FUN_005df0f5(0x2000);

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

    uVar4 = 0xc;

    puVar5 = puVar1;

    do {

      uVar3 = *puVar5;

      *(undefined4 *)((uVar4 - 0xc) + *(int *)(param_1 + 0x40)) = uVar3;

      *(undefined4 *)((uVar4 - 8) + *(int *)(param_1 + 0x40)) = uVar3;

      *(undefined4 *)((uVar4 - 4) + *(int *)(param_1 + 0x40)) = uVar3;

      *(undefined4 *)(uVar4 + *(int *)(param_1 + 0x40)) = uVar3;

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

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

      *(undefined4 *)(uVar4 + 0xc + *(int *)(param_1 + 0x40)) = uVar3;

      *(undefined4 *)(uVar4 + 0x10 + *(int *)(param_1 + 0x40)) = uVar3;

      uVar4 = uVar4 + 0x20;

      puVar5 = puVar5 + 1;

    } while (uVar4 < 0x200c);

    operator_delete__(puVar1);

  }

  return 1;

}




// --- FUN_0053ee60 at 0x0053EE60 ---


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



{

  undefined4 uVar1;

  

  FUN_00415460(DAT_0084676c);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007caa08;

  param_1[0xc] = &PTR_LAB_007ca9f4;

  param_1[0x10] = 0;

  param_1[0xf] = 0x3dcccccd;

  param_1[0xe] = param_2;

  uVar1 = thunk_FUN_005df0f5(param_2 * 4);

  param_1[0x10] = uVar1;

  return param_1;

}




// --- FUN_0053eec0 at 0x0053EEC0 ---


undefined4 __thiscall FUN_0053eec0(int param_1,int param_2,uint param_3,int param_4)



{

  uint uVar1;

  undefined4 uVar2;

  int *piVar3;

  

  if ((*(int *)(param_1 + 0x20) == 0) && (param_2 != DAT_0084676c)) {

    uVar1 = param_3 + param_4;

    if (uVar1 <= *(uint *)(param_1 + 0x38)) {

      uVar2 = FUN_004220b0(param_2,10);

      piVar3 = (int *)FUN_00415430(uVar2);

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

        for (; param_3 < uVar1; param_3 = param_3 + 1) {

          *(undefined4 *)(*(int *)(param_1 + 0x40) + param_3 * 4) =

               *(undefined4 *)(piVar3[0x10] + param_3 * 4);

        }

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

        return 1;

      }

    }

    return 0;

  }

  return 0;

}




// --- FUN_0053ef50 at 0x0053EF50 ---


undefined4 FUN_0053ef50(int param_1)



{

  int iVar1;

  

  while( true ) {

    if (param_1 == 0) {

      return 1;

    }

    iVar1 = FUN_0053eec0(*(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 8),

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

    if (iVar1 == 0) break;

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

  }

  return 0;

}




// --- FUN_0053ef90 at 0x0053EF90 ---


undefined4 FUN_0053ef90(int param_1,int param_2)



{

  int iVar1;

  undefined4 *puVar2;

  int iVar3;

  

  iVar3 = 0;

  if (0 < param_1) {

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

    do {

      iVar1 = FUN_0053eec0(puVar2[-1],*puVar2,puVar2[1]);

      if (iVar1 == 0) {

        return 0;

      }

      iVar3 = iVar3 + 1;

      puVar2 = puVar2 + 6;

    } while (iVar3 < param_1);

  }

  return 1;

}




// --- FUN_0053efe0 at 0x0053EFE0 ---


int FUN_0053efe0(void)



{

  int iVar1;

  

  iVar1 = FUN_005df0f5(0x48);

  if (iVar1 != 0) {

    iVar1 = FUN_0053ee60(0x800);

    if (iVar1 != 0) {

      *(int *)(iVar1 + 0x24) = *(int *)(iVar1 + 0x24) + 1;

    }

    return iVar1;

  }

  return 0;

}




// --- FUN_0053f0d0 at 0x0053F0D0 ---


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



{

  *param_1 = &PTR_LAB_007caa08;

  param_1[0xc] = &PTR_LAB_007ca9f4;

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

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

    param_1[0x10] = 0;

  }

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

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

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_0053f120 at 0x0053F120 ---


int * FUN_0053f120(int param_1,int param_2)



{

  undefined4 uVar1;

  int *piVar2;

  int iVar3;

  

  if (param_1 == DAT_0084676c) {

    return (int *)0x0;

  }

  iVar3 = DAT_0084676c;

  if ((((param_2 != 0) && (*(int *)(param_2 + 0x14) == 0)) && (*(int *)(param_2 + 8) == 0)) &&

     (*(int *)(param_2 + 0xc) == 0x800)) {

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

  }

  if (iVar3 != 0) {

    uVar1 = FUN_004220b0(iVar3,10);

    piVar2 = (int *)FUN_00415430(uVar1);

    return piVar2;

  }

  iVar3 = FUN_005df0f5(0x48);

  if (iVar3 != 0) {

    piVar2 = (int *)FUN_0053ee60(0x800);

    if (piVar2 != (int *)0x0) {

      piVar2[9] = piVar2[9] + 1;

      (**(code **)(*piVar2 + 0x44))(param_1);

      iVar3 = FUN_0053eec0(param_1,0,0x800);

      if (iVar3 != 0) {

        iVar3 = FUN_0053ef50(param_2);

        if (iVar3 != 0) {

          return piVar2;

        }

      }

      (**(code **)(*piVar2 + 0x18))(1);

    }

  }

  return (int *)0x0;

}




// --- FUN_0053f1f0 at 0x0053F1F0 ---


undefined4 __fastcall FUN_0053f1f0(int param_1)



{

  if (*(int *)(param_1 + 100) != 0) {

    return *(undefined4 *)(*(int *)(param_1 + 100) + 0xa0);

  }

  return 0;

}




// --- FUN_0053f210 at 0x0053F210 ---


undefined4 __fastcall FUN_0053f210(int param_1)



{

  if (*(int *)(param_1 + 100) != 0) {

    return *(undefined4 *)(*(int *)(param_1 + 100) + 0xa4);

  }

  return 0;

}




// --- FUN_0053f230 at 0x0053F230 ---


uint FUN_0053f230(undefined4 *param_1,int param_2,uint param_3,undefined4 *param_4,int param_5,

                 uint param_6)



{

  uint in_EAX;

  uint uVar1;

  int iVar2;

  

  if ((param_2 == param_5) && (in_EAX = param_6, param_3 == param_6)) {

    for (uVar1 = param_5 * param_6 & 0x3fffffff; uVar1 != 0; uVar1 = uVar1 - 1) {

      *param_4 = *param_1;

      param_1 = param_1 + 1;

      param_4 = param_4 + 1;

    }

    for (iVar2 = 0; iVar2 != 0; iVar2 = iVar2 + -1) {

      *(undefined1 *)param_4 = *(undefined1 *)param_1;

      param_1 = (undefined4 *)((int)param_1 + 1);

      param_4 = (undefined4 *)((int)param_4 + 1);

    }

    return CONCAT31((int3)(param_5 * param_6 * 4 >> 8),1);

  }

  return in_EAX & 0xffffff00;

}




// --- FUN_0053f270 at 0x0053F270 ---


undefined4 __fastcall FUN_0053f270(int param_1)



{

  int *piVar1;

  char cVar2;

  undefined4 uVar3;

  int local_4;

  

  piVar1 = *(int **)(param_1 + 100);

  if (piVar1 != (int *)0x0) {

    uVar3 = 0;

    local_4 = param_1;

    cVar2 = (**(code **)(*piVar1 + 0x60))(piVar1 + 0x2e,0,param_1 + 0x6c,&local_4);

    if (cVar2 != '\0') {

      *(undefined1 *)(param_1 + 0x84) = 1;

      return uVar3;

    }

  }

  return 0;

}




// --- FUN_0053f2b0 at 0x0053F2B0 ---


undefined1 __fastcall FUN_0053f2b0(int param_1)



{

  int *piVar1;

  char cVar2;

  

  cVar2 = FUN_004154a0();

  if (cVar2 == '\0') {

    return 0;

  }

  if (*(int *)(param_1 + 0x34) != 0) {

    cVar2 = (**(code **)(*(int *)(*(int *)(param_1 + 0x34) + 0x30) + 8))();

    if (cVar2 != '\0') {

      FUN_00446c10();

    }

  }

  piVar1 = *(int **)(param_1 + 0x48);

  if (piVar1 != (int *)0x0) {

    (**(code **)(*piVar1 + 8))(piVar1);

    *(undefined4 *)(param_1 + 0x48) = 0;

  }

  if (*(int **)(param_1 + 0x4c) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x4c) + 0x14))();

    *(undefined4 *)(param_1 + 0x4c) = 0;

  }

  return 1;

}




// --- FUN_0053f310 at 0x0053F310 ---


undefined4 __fastcall FUN_0053f310(int param_1)



{

  char cVar1;

  int *piVar2;

  int iVar3;

  undefined4 uVar4;

  undefined4 uStack_3c;

  uint uStack_34;

  

  if ((*(char *)(param_1 + 0x38) != '\0') &&

     (cVar1 = (**(code **)(*(int *)(param_1 + 0x30) + 0xc))(), cVar1 == '\0')) {

    return 0;

  }

  uVar4 = DAT_008379b4;

  *(undefined4 *)(param_1 + 0x40) = DAT_008379b0;

  *(undefined4 *)(param_1 + 0x44) = uVar4;

  if (DAT_00870340 != (int *)0x0) {

    *(int *)(param_1 + 0x48) = DAT_00870340[0x2c];

  }

  if ((*(int *)(param_1 + 0x80) != 0) && (*(char *)(*(int *)(param_1 + 0x80) + 0x38) == '\0')) {

    piVar2 = *(int **)(param_1 + 0x7c);

    if (piVar2 != (int *)0x0) {

      if ((char)piVar2[0xe] == '\0') goto LAB_0053f487;

      if (piVar2 != (int *)0x0) {

        (**(code **)(*piVar2 + 0x14))();

        *(undefined4 *)(param_1 + 0x7c) = 0;

      }

    }

    FUN_00535a80();

    FUN_0043d290(*(undefined4 *)(*(int *)(param_1 + 0x80) + 0x60));

    uStack_3c = 0;

    if ((((uStack_34 >> 2 & 1) == 0) && (*(int *)(*(int *)(param_1 + 0x80) + 0x5c) == 1)) &&

       ((DAT_00870340[0xc6] & 0x40000000U) != 0)) {

      uStack_3c = 4;

    }

    piVar2 = (int *)(**(code **)(*DAT_00870340 + 0x14))();

    iVar3 = *(int *)(param_1 + 0x80);

    *(int **)(param_1 + 0x7c) = piVar2;

    cVar1 = (**(code **)(*piVar2 + 0x58))

                      (*(undefined4 *)(iVar3 + 0x88),*(undefined4 *)(iVar3 + 0x8c),

                       *(undefined4 *)(iVar3 + 0x5c),*(undefined4 *)(iVar3 + 0x60),uStack_3c);

    if ((cVar1 != '\0') && (iVar3 = FUN_006968d0(), iVar3 != 0)) {

      FUN_00446be0(1);

      *(undefined1 *)(*(int *)(param_1 + 0x7c) + 0x78) = 0;

      piVar2 = (int *)FUN_006968d0();

      if (piVar2 != (int *)0x0) {

        (**(code **)(*piVar2 + 0x54))(piVar2,0);

        cVar1 = (**(code **)(**(int **)(param_1 + 0x7c) + 0x60))(*(undefined4 *)(param_1 + 0x80));

        if (cVar1 != '\0') goto LAB_0053f487;

      }

    }

  }

  if (*(int **)(param_1 + 0x7c) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x7c) + 0x14))();

    *(undefined4 *)(param_1 + 0x7c) = 0;

  }

  if (*(int **)(param_1 + 0x80) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x80) + 0x14))();

    *(undefined4 *)(param_1 + 0x80) = 0;

  }

LAB_0053f487:

  uVar4 = 0;

  if (*(int *)(param_1 + 0x7c) != 0) {

    uVar4 = FUN_006968d0();

  }

  return uVar4;

}




// --- FUN_0053f4a0 at 0x0053F4A0 ---


void FUN_0053f4a0(int param_1,undefined4 param_2,int param_3,int param_4,int param_5)



{

  int *piVar1;

  undefined4 *puVar2;

  int iVar3;

  char cVar4;

  undefined4 *puVar5;

  int iVar6;

  undefined4 *puVar7;

  int iVar8;

  undefined4 *local_24;

  int iStack_20;

  int local_1c;

  int iStack_14;

  int local_10;

  int local_c;

  undefined4 *local_8;

  int local_4;

  

  piVar1 = *(int **)(param_4 + 100);

  if (piVar1 == (int *)0x0) {

    iVar6 = 0;

    local_1c = 0;

  }

  else {

    iVar6 = piVar1[0x29];

    local_1c = piVar1[0x28];

    cVar4 = (**(code **)(*piVar1 + 0x60))(piVar1 + 0x2e,0,param_4 + 0x6c,&local_8);

    if (cVar4 != '\0') {

      *(undefined1 *)(param_4 + 0x84) = 1;

      local_24 = local_8;

      goto LAB_0053f508;

    }

  }

  local_24 = (undefined4 *)0x0;

LAB_0053f508:

  if (param_5 != 0) {

    local_4 = iVar6 * param_3;

    local_10 = 0;

    local_c = param_5;

    do {

      iStack_20 = 0;

      iStack_14 = param_5;

      do {

        if (iVar6 != 0) {

          puVar5 = (undefined4 *)(param_1 + (local_10 + iStack_20) * 4);

          puVar2 = local_24;

          iVar3 = local_1c;

          iVar8 = iVar6;

          puVar7 = puVar5;

          do {

            for (; iVar3 != 0; iVar3 = iVar3 + -1) {

              *puVar5 = *puVar2;

              puVar5 = puVar5 + 1;

              puVar2 = puVar2 + 1;

            }

            puVar5 = puVar7 + param_3;

            iVar8 = iVar8 + -1;

            iVar3 = local_1c;

            puVar7 = puVar5;

          } while (iVar8 != 0);

        }

        iStack_20 = iStack_20 + local_4;

        iStack_14 = iStack_14 + -1;

      } while (iStack_14 != 0);

      local_10 = local_10 + local_1c;

      local_c = local_c + -1;

    } while (local_c != 0);

  }

  if (*(int **)(param_4 + 100) != (int *)0x0) {

    *(undefined4 *)(param_4 + 0x6c) = 0;

    (**(code **)(**(int **)(param_4 + 100) + 100))();

    *(undefined1 *)(param_4 + 0x84) = 0;

  }

  return;

}




// --- FUN_0053f5d0 at 0x0053F5D0 ---


void FUN_0053f5d0(byte *param_1,uint param_2,uint param_3,int param_4,undefined4 param_5,int param_6

                 ,uint param_7)



{

  byte *pbVar1;

  int *piVar2;

  char cVar3;

  uint uVar4;

  uint uVar5;

  byte bVar6;

  int iVar7;

  byte *pbVar8;

  int iVar9;

  int iVar10;

  byte *pbVar11;

  byte *local_34;

  uint local_30;

  uint local_2c;

  uint uStack_28;

  uint uStack_24;

  uint uStack_1c;

  byte *pbStack_18;

  byte *pbStack_14;

  byte *pbStack_10;

  uint uStack_c;

  byte *local_8;

  byte *local_4;

  

  piVar2 = *(int **)(param_4 + 100);

  if (piVar2 == (int *)0x0) {

    local_30 = 0;

    iVar7 = 0;

  }

  else {

    local_30 = piVar2[0x29];

    iVar7 = piVar2[0x28];

  }

  if (*(int *)(param_6 + 100) == 0) {

    uVar4 = 0;

  }

  else {

    uVar4 = *(uint *)(*(int *)(param_6 + 100) + 0xa0);

  }

  local_2c = 0;

  if ((piVar2 == (int *)0x0) ||

     (cVar3 = (**(code **)(*piVar2 + 0x60))(piVar2 + 0x2e,0,param_4 + 0x6c,&local_8), cVar3 == '\0')

     ) {

    local_34 = (byte *)0x0;

  }

  else {

    *(undefined1 *)(param_4 + 0x84) = 1;

    local_34 = local_8;

  }

  piVar2 = *(int **)(param_6 + 100);

  if ((piVar2 == (int *)0x0) ||

     (cVar3 = (**(code **)(*piVar2 + 0x60))(piVar2 + 0x2e,0,param_6 + 0x6c,&local_4), cVar3 == '\0')

     ) {

    local_4 = (byte *)0x0;

  }

  else {

    *(undefined1 *)(param_6 + 0x84) = 1;

  }

  if (uVar4 < param_3) {

    uStack_28 = param_3 / uVar4;

  }

  else {

    uStack_28 = 1;

  }

  if (param_3 < uVar4) {

    uVar4 = uVar4 / param_3;

  }

  else {

    uVar4 = 1;

  }

  if (param_7 == 1) {

    local_4 = local_4 + iVar7 + -1;

    param_7 = -1;

    param_3 = iVar7;

  }

  else if (param_7 == 2) {

    local_4 = local_4 + iVar7 * local_30 + -1;

    param_3 = -1;

    param_7 = -iVar7;

  }

  else if (param_7 == 3) {

    local_4 = local_4 + (local_30 - 1) * iVar7;

    param_3 = -iVar7;

    param_7 = 1;

  }

  else {

    param_3 = 1;

    param_7 = iVar7;

  }

  if ((uVar4 == 0) || (1 < uStack_28)) {

    pbStack_18 = local_34;

    if (param_2 != 0) {

      uStack_c = param_2;

      pbVar8 = param_1;

      param_1 = (byte *)uStack_28;

      uStack_24 = uStack_28;

      pbStack_14 = local_4;

      pbStack_10 = local_4;

      do {

        uStack_1c = 0;

        pbVar11 = pbStack_10;

        do {

          uVar4 = (uint)*pbVar11;

          pbVar1 = pbStack_18 + (iVar7 - 1U & uStack_1c) * 4;

          if (uVar4 < 0xff) {

            if (0x80 < uVar4) {

              uVar4 = uVar4 + 1;

            }

            iVar10 = 0x100 - uVar4;

            *pbVar8 = (byte)((uint)*pbVar1 * iVar10 + *pbVar8 * uVar4 >> 8);

            pbVar8[1] = (byte)((uint)pbVar1[1] * iVar10 + pbVar8[1] * uVar4 >> 8);

            pbVar8[2] = (byte)((uint)pbVar1[2] * iVar10 + pbVar8[2] * uVar4 >> 8);

          }

          pbVar8 = pbVar8 + 4;

          param_1 = (byte *)((int)param_1 - 1);

          if (param_1 == (byte *)0x0) {

            pbVar11 = pbVar11 + param_3;

            param_1 = (byte *)uStack_28;

          }

          uStack_1c = uStack_1c + 1;

        } while (uStack_1c < param_2);

        local_2c = local_2c + 1;

        if (local_30 <= local_2c) {

          local_2c = 0;

        }

        pbStack_18 = local_34 + local_2c * iVar7 * 4;

        uStack_24 = uStack_24 - 1;

        if (uStack_24 == 0) {

          pbStack_14 = pbStack_14 + param_7;

          uStack_24 = uStack_28;

          pbStack_10 = pbStack_14;

        }

        uStack_c = uStack_c - 1;

      } while (uStack_c != 0);

    }

  }

  else if (param_2 != 0) {

    iVar10 = param_7 * uVar4;

    uStack_28 = param_2;

    do {

      param_7 = param_2;

      pbVar8 = local_4;

      pbVar11 = local_34;

      do {

        uVar5 = (uint)*pbVar8;

        if (uVar5 == 0) {

          *param_1 = *pbVar11;

          param_1[1] = pbVar11[1];

          bVar6 = pbVar11[2];

LAB_0053f7f0:

          param_1[2] = bVar6;

        }

        else if (uVar5 < 0xff) {

          if (0x80 < uVar5) {

            uVar5 = uVar5 + 1;

          }

          iVar9 = 0x100 - uVar5;

          *param_1 = (byte)((uint)*pbVar11 * iVar9 + *param_1 * uVar5 >> 8);

          param_1[1] = (byte)((uint)pbVar11[1] * iVar9 + param_1[1] * uVar5 >> 8);

          bVar6 = (byte)((uint)pbVar11[2] * iVar9 + param_1[2] * uVar5 >> 8);

          goto LAB_0053f7f0;

        }

        param_1 = param_1 + 4;

        pbVar11 = pbVar11 + 4;

        pbVar8 = pbVar8 + param_3 * uVar4;

        param_7 = param_7 - 1;

      } while (param_7 != 0);

      local_34 = local_34 + iVar7 * 4;

      local_4 = local_4 + iVar10;

      uStack_28 = uStack_28 - 1;

    } while (uStack_28 != 0);

  }

  if (*(int **)(param_4 + 100) != (int *)0x0) {

    *(undefined4 *)(param_4 + 0x6c) = 0;

    (**(code **)(**(int **)(param_4 + 100) + 100))();

    *(undefined1 *)(param_4 + 0x84) = 0;

  }

  if (*(int **)(param_6 + 100) != (int *)0x0) {

    *(undefined4 *)(param_6 + 0x6c) = 0;

    (**(code **)(**(int **)(param_6 + 100) + 100))();

    *(undefined1 *)(param_6 + 0x84) = 0;

  }

  return;

}




// --- FUN_0053f9c0 at 0x0053F9C0 ---


undefined4

FUN_0053f9c0(undefined4 *param_1,int param_2,uint param_3,undefined4 param_4,char param_5)



{

  ushort uVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  char cVar5;

  undefined4 uVar6;

  int iVar7;

  uint uVar8;

  undefined4 *puVar9;

  int local_8;

  int local_4;

  

  iVar4 = param_3;

  piVar2 = *(int **)(param_3 + 100);

  if ((piVar2 == (int *)0x0) ||

     (cVar5 = (**(code **)(*piVar2 + 0x60))(piVar2 + 0x2e,0,param_3 + 0x6c,&local_8), cVar5 == '\0')

     ) {

    local_8 = 0;

  }

  else {

    *(undefined1 *)(param_3 + 0x84) = 1;

  }

  local_4 = *(int *)(param_3 + 0x6c);

  iVar7 = local_8;

  for (param_3 = 0;

      (iVar3 = *(int *)(iVar4 + 100), iVar3 != 0 && (param_3 < *(uint *)(iVar3 + 0xa4)));

      param_3 = param_3 + 1) {

    uVar8 = 0;

    puVar9 = param_1;

    if (*(int *)(iVar3 + 0xdc) == 0x65) {

      while ((*(int *)(iVar4 + 100) != 0 && (uVar8 < *(uint *)(*(int *)(iVar4 + 100) + 0xa0)))) {

        uVar1 = *(ushort *)(iVar7 + uVar8 * 2);

        if ((param_5 == '\0') || (7 < uVar1)) {

          uVar6 = FUN_0053edb0(uVar1);

          *puVar9 = uVar6;

          uVar8 = uVar8 + 1;

          puVar9 = puVar9 + 1;

        }

        else {

          *puVar9 = 0;

          uVar8 = uVar8 + 1;

          puVar9 = puVar9 + 1;

        }

      }

    }

    else {

      while ((*(int *)(iVar4 + 100) != 0 && (uVar8 < *(uint *)(*(int *)(iVar4 + 100) + 0xa0)))) {

        if ((param_5 == '\0') || (7 < *(byte *)(uVar8 + iVar7))) {

          uVar6 = FUN_0053edb0(*(byte *)(uVar8 + iVar7));

          *puVar9 = uVar6;

          puVar9 = puVar9 + 1;

          uVar8 = uVar8 + 1;

        }

        else {

          *puVar9 = 0;

          puVar9 = puVar9 + 1;

          uVar8 = uVar8 + 1;

        }

      }

    }

    param_1 = (undefined4 *)((int)param_1 + param_2);

    iVar7 = iVar7 + local_4;

  }

  if (*(int **)(iVar4 + 100) != (int *)0x0) {

    *(undefined4 *)(iVar4 + 0x6c) = 0;

    (**(code **)(**(int **)(iVar4 + 100) + 100))();

    *(undefined1 *)(iVar4 + 0x84) = 0;

  }

  return 1;

}




// --- FUN_0053fb10 at 0x0053FB10 ---


undefined1 __fastcall FUN_0053fb10(int param_1)



{

  char cVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  int *piVar5;

  int iVar6;

  int iVar7;

  undefined4 uVar8;

  int *unaff_EBX;

  int unaff_EBP;

  int unaff_EDI;

  undefined1 uVar9;

  uint uStack_44;

  uint uStack_40;

  

  cVar1 = FUN_00413a70();

  if (cVar1 == '\0') {

    return 0;

  }

  if ((*(int *)(param_1 + 100) != 0) && (*(int *)(*(int *)(param_1 + 100) + 0x114) == 0)) {

    piVar5 = *(int **)(param_1 + 0x78);

    if (piVar5 != (int *)0x0) {

      (**(code **)(*piVar5 + 8))(piVar5);

      *(undefined4 *)(param_1 + 0x78) = 0;

    }

    if (*(int **)(param_1 + 0x7c) != (int *)0x0) {

      (**(code **)(**(int **)(param_1 + 0x7c) + 0x14))();

      *(undefined4 *)(param_1 + 0x7c) = 0;

    }

    if (*(int **)(param_1 + 0x80) != (int *)0x0) {

      (**(code **)(**(int **)(param_1 + 0x80) + 0x14))();

      *(undefined4 *)(param_1 + 0x80) = 0;

    }

    FUN_00446bd0(0);

    uVar4 = DAT_0081f928;

    iVar6 = *(int *)(param_1 + 100);

    if (iVar6 == 0) {

      uStack_44 = 0;

    }

    else {

      uStack_44 = *(uint *)(iVar6 + 0xa0);

    }

    uStack_44 = uStack_44 >> ((byte)DAT_00846784 & 0x1f);

    if (iVar6 == 0) {

      uVar2 = 0;

    }

    else {

      uVar2 = *(uint *)(iVar6 + 0xa4);

    }

    uVar2 = uVar2 >> ((byte)DAT_00846784 & 0x1f);

    if (DAT_00846784 != 0) {

      if (uStack_44 < DAT_0081f928) {

        uStack_44 = DAT_0081f928;

        uVar3 = FUN_0053f1f0();

        if (uVar3 < uVar4) {

          uStack_44 = FUN_0053f1f0();

        }

      }

      if ((uVar2 < uVar4) && (uVar3 = FUN_0053f210(), uVar2 = uVar4, uVar3 < uVar4)) {

        uVar2 = FUN_0053f210();

      }

    }

    uVar3 = 1;

    uStack_40 = 1;

    uVar4 = uStack_44;

    if (uStack_44 <= uVar2) {

      uVar4 = uVar2;

    }

    if (1 < uVar4) {

      do {

        uVar4 = uVar4 >> 1;

        uVar3 = uVar3 + 1;

      } while (1 < uVar4);

      uStack_40 = uVar3;

      if (4 < uVar3) {

        uStack_40 = 4;

      }

    }

    uVar4 = *(uint *)(iVar6 + 0xe0);

    piVar5 = (int *)(**(code **)(*DAT_00870340 + 0x14))();

    *(int **)(param_1 + 0x80) = piVar5;

    uVar3 = uStack_40;

    if ((uVar4 >> 2 & 1) == 0) {

      uVar3 = 1;

    }

    if (*(int *)(param_1 + 100) == 0) {

      uVar8 = 0;

    }

    else {

      uVar8 = *(undefined4 *)(*(int *)(param_1 + 100) + 0xdc);

    }

    cVar1 = (**(code **)(*piVar5 + 0x58))(uStack_44,uVar2,uVar3,uVar8);

    piVar5 = *(int **)(param_1 + 0x80);

    if (cVar1 != '\0') {

      FUN_00446be0(0);

      *(undefined1 *)(*(int *)(param_1 + 0x80) + 0x78) = 0;

      piVar5 = (int *)FUN_006968d0();

      if (piVar5 != (int *)0x0) {

        uVar9 = 0;

        iVar6 = FUN_00696c50();

        if ((iVar6 != 0) &&

           (iVar7 = (**(code **)(*piVar5 + 0x48))(piVar5,0,&stack0xffffffb0), -1 < iVar7)) {

          iVar6 = FUN_005dfd12(unaff_EBX,0,0,iVar6,0,0,0x70005,0);

          (**(code **)(*unaff_EBX + 8))(unaff_EBX);

          if ((-1 < iVar6) && (iVar6 = FUN_005dffae(piVar5,0,0xffffffff,0x70005), -1 < iVar6)) {

            uVar9 = 1;

            uVar8 = FUN_00536bc0();

            FUN_0043d7d0(uVar8);

            uVar4 = (uStack_40 & 0xff) * uVar2 * unaff_EDI >> 3;

            iVar6 = 0;

            for (; unaff_EBP != 0; unaff_EBP = unaff_EBP + -1) {

              iVar6 = iVar6 + uVar4;

              uVar4 = uVar4 >> 2;

            }

            FUN_00446bd0(iVar6);

            cVar1 = (**(code **)(*(int *)(*(int *)(param_1 + 100) + 0x30) + 8))();

            if (cVar1 == '\0') {

              return uVar9;

            }

            FUN_00446c10();

            return uVar9;

          }

        }

        if (*(int **)(param_1 + 0x80) != (int *)0x0) {

          (**(code **)(**(int **)(param_1 + 0x80) + 0x14))();

          *(undefined4 *)(param_1 + 0x80) = 0;

        }

        piVar5 = *(int **)(param_1 + 0x78);

        if (piVar5 != (int *)0x0) {

          (**(code **)(*piVar5 + 8))(piVar5);

          *(undefined4 *)(param_1 + 0x78) = 0;

        }

        return uVar9;

      }

      piVar5 = *(int **)(param_1 + 0x80);

    }

    if (piVar5 != (int *)0x0) {

      (**(code **)(*piVar5 + 0x14))();

      *(undefined4 *)(param_1 + 0x80) = 0;

    }

  }

  return 0;

}




// --- FUN_0053fde0 at 0x0053FDE0 ---


byte __fastcall FUN_0053fde0(int param_1)



{

  int iVar1;

  char cVar2;

  byte bVar3;

  byte bVar4;

  

  cVar2 = FUN_00446c20();

  if ((cVar2 != '\0') && (iVar1 = *(int *)(param_1 + 0x34), iVar1 != 0)) {

    bVar3 = 1;

    if (*(char *)(iVar1 + 0x38) != '\0') {

      bVar3 = (**(code **)(*(int *)(iVar1 + 0x30) + 0xc))();

      bVar3 = bVar3 & 1;

    }

    if (*(int *)(*(int *)(param_1 + 0x34) + 0x114) == 0) {

      bVar4 = FUN_0053fb10();

      bVar3 = bVar3 & bVar4;

    }

    if (bVar3 != 0) {

      FUN_00446c00();

    }

    return bVar3;

  }

  return 0;

}




// --- FUN_0053fe40 at 0x0053FE40 ---


void __thiscall FUN_0053fe40(int param_1,undefined4 *param_2)



{

  char cVar1;

  

  if (*(int *)(param_1 + 0x60) != 1) {

    if (*(int *)(param_1 + 0x60) != 2) {

      FUN_00413570(*(undefined4 *)(param_1 + 0x28),

                   "Cannot get surface DID, no source levels are listed!");

      *param_2 = DAT_008467e8;

      return;

    }

    cVar1 = FUN_0054d310();

    if (cVar1 != '\0') {

      *param_2 = *(undefined4 *)(*(int *)(param_1 + 0x58) + 4);

      return;

    }

  }

  *param_2 = **(undefined4 **)(param_1 + 0x58);

  return;

}




// --- FUN_0053fea0 at 0x0053FEA0 ---


void __fastcall FUN_0053fea0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007cab00;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  return;

}




// --- FUN_0053fed0 at 0x0053FED0 ---


undefined4 * __thiscall FUN_0053fed0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007caaf4;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_0053ff10 at 0x0053FF10 ---


undefined4 * __thiscall FUN_0053ff10(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007caaf8;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_0053ff50 at 0x0053FF50 ---


undefined4 * __thiscall FUN_0053ff50(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007caafc;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_0053ff90 at 0x0053FF90 ---


undefined4 * __thiscall FUN_0053ff90(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007cab00;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}




// --- FUN_0053ffd0 at 0x0053FFD0 ---


void __thiscall FUN_0053ffd0(int param_1,int *param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  *(int **)(param_1 + 100) = param_2;

  if (param_2 != (int *)0x0) {

    (**(code **)(*param_2 + 0x10))();

    iVar1 = *(int *)(*(int *)(param_1 + 100) + 0x118);

    if (DAT_008467e8 != iVar1) {

      uVar2 = FUN_004220b0(iVar1,10);

      uVar2 = FUN_00415430(uVar2);

      *(undefined4 *)(param_1 + 0x68) = uVar2;

      return;

    }

    if (*(int *)(*(int *)(param_1 + 100) + 0x114) == 0) {

      FUN_0053fb10();

    }

  }

  return;

}




// ============================================================
// REGION: LandDefs region (0x005A9000 - 0x005AB000)
// ============================================================

// --- FUN_005a9120 at 0x005A9120 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


/* 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 ---


/* 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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


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 ---


/* 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 ---


/* 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 ---


/* 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 ---


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 ---


/* 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 ---


/* 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 ---


/* 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 ---


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 ---


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 ---


/* 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 ---


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;

}




