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

// --- FUN_005200d0 at 0x005200D0 (size: 22) ---


void __fastcall FUN_005200d0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007c8804;

  FUN_0051f630();

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005200f0 at 0x005200F0 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007c8818;

  FUN_0051f420();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00520120 at 0x00520120 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007c8804;

  FUN_0051f630();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00520150 at 0x00520150 (size: 44) ---


int __thiscall FUN_00520150(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  iVar3 = param_2 * 0x1c + 4;

  for (iVar1 = *(int *)(param_1 + 8); iVar1 != 0; iVar1 = *(int *)(iVar1 + 4)) {

    iVar2 = FUN_00527570(iVar1);

    iVar3 = iVar3 + iVar2;

  }

  return iVar3;

}





// --- FUN_005201a0 at 0x005201A0 (size: 55) ---


undefined4 * __fastcall FUN_005201a0(undefined4 *param_1)



{

  FUN_00415460(DAT_00845480);

  param_1[0xc] = &PTR_FUN_0079385c;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  *param_1 = &PTR_LAB_007c8858;

  param_1[0xc] = &PTR_LAB_007c8840;

  return param_1;

}





// --- FUN_005201e0 at 0x005201E0 (size: 6) ---


undefined4 FUN_005201e0(void)



{

  return 8;

}





// --- FUN_00520250 at 0x00520250 (size: 145) ---


int __fastcall FUN_00520250(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int local_8;

  uint local_4;

  

  iVar4 = 0;

  local_8 = 0xc;

  if ((*(int *)(param_1 + 0x38) != 0) && (iVar1 = *(int *)(param_1 + 0x48), iVar1 != 0)) {

    iVar2 = FUN_006b2f10();

    local_8 = iVar2 * iVar1 + 0xc;

  }

  local_4 = 0;

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

    do {

      iVar2 = *(int *)(param_1 + 0x44) * 0x1c + 4;

      for (iVar1 = *(int *)(*(int *)(param_1 + 0x3c) + 8 + iVar4); iVar1 != 0;

          iVar1 = *(int *)(iVar1 + 4)) {

        iVar3 = FUN_00527570(iVar1);

        iVar2 = iVar2 + iVar3;

      }

      local_8 = local_8 + iVar2;

      local_4 = local_4 + 1;

      iVar4 = iVar4 + 0x10;

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

  }

  return local_8;

}





// --- FUN_005202f0 at 0x005202F0 (size: 70) ---


void __fastcall FUN_005202f0(int *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  if (*param_1 != 0) {

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

    *param_1 = 0;

  }

  iVar1 = param_1[2];

  while (iVar1 != 0) {

    puVar2 = (undefined4 *)param_1[2];

    iVar1 = puVar2[1];

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

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

    }

    param_1[2] = iVar1;

  }

  param_1[2] = 0;

  return;

}





// --- FUN_00520340 at 0x00520340 (size: 162) ---


uint __thiscall FUN_00520340(int param_1,int param_2,int *param_3,uint param_4)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  

  uVar2 = param_2 * 0x1c + 4;

  for (iVar3 = *(int *)(param_1 + 8); iVar3 != 0; iVar3 = *(int *)(iVar3 + 4)) {

    iVar1 = FUN_00527570(iVar3);

    uVar2 = uVar2 + iVar1;

  }

  if (uVar2 <= param_4) {

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

      FUN_005aaff0(param_3,param_4);

    }

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

    *param_3 = *param_3 + 4;

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

    uVar4 = 0;

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

      do {

        FUN_005275a0(iVar3,param_3,param_4);

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

        uVar4 = uVar4 + 1;

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

    }

    return uVar2;

  }

  return uVar2;

}





// --- FUN_005203f0 at 0x005203F0 (size: 202) ---


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



{

  int *piVar1;

  int *piVar2;

  uint uVar3;

  

  FUN_005202f0();

  param_1[3] = param_2;

  piVar1 = (int *)thunk_FUN_005df0f5(param_2 * 0x1c + 4);

  uVar3 = 0;

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

    piVar2 = (int *)0x0;

  }

  else {

    piVar2 = piVar1 + 1;

    *piVar1 = param_2;

    piVar1 = piVar2;

    if (-1 < param_2 + -1) {

      do {

        *piVar1 = 0;

        piVar1[1] = 0;

        piVar1[2] = 0;

        piVar1[3] = 0x3f800000;

        piVar1[4] = 0;

        piVar1[5] = 0;

        piVar1[6] = 0;

        param_2 = param_2 + -1;

        piVar1 = piVar1 + 7;

      } while (param_2 != 0);

    }

  }

  *param_1 = piVar2;

  if (param_1[3] != 0) {

    do {

      FUN_005ab060(param_3,param_4);

      uVar3 = uVar3 + 1;

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

  }

  uVar3 = 0;

  param_1[1] = *(undefined4 *)*param_3;

  *param_3 = *param_3 + 4;

  if (param_1[1] != 0) {

    do {

      FUN_00527dd0(param_3,param_4);

      FUN_00527540(param_1 + 2);

      uVar3 = uVar3 + 1;

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

  }

  return 1;

}





// --- FUN_005204d0 at 0x005204D0 (size: 188) ---


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



{

  int iVar1;

  undefined4 *puVar2;

  int iVar3;

  undefined4 *puVar4;

  

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

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

    puVar4 = (undefined4 *)(iVar3 * 0x10 + (int)param_1);

    if (-1 < iVar3 + -1) {

      do {

        iVar1 = puVar4[-4];

        if (iVar1 != 0) {

          FUN_00401030(iVar1,0x1c,*(undefined4 *)(iVar1 + -4),FUN_00695670);

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

          puVar4[-4] = 0;

        }

        iVar1 = puVar4[-2];

        while (iVar1 != 0) {

          puVar2 = (undefined4 *)puVar4[-2];

          iVar1 = puVar2[1];

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

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

          }

          puVar4[-2] = iVar1;

        }

        iVar3 = iVar3 + -1;

        puVar4[-2] = 0;

        puVar4 = puVar4 + -4;

      } while (iVar3 != 0);

    }

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

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

    }

    return (void *)((int)param_1 + -4);

  }

  FUN_005202f0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00520660 at 0x00520660 (size: 285) ---


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



{

  uint *puVar1;

  int *piVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  int *piVar6;

  

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

  uVar5 = *(uint *)*param_2;

  puVar1 = (uint *)*param_2 + 1;

  *param_2 = (int)puVar1;

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

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

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

  *param_2 = *param_2 + 4;

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

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

    piVar2 = (int *)thunk_FUN_005df0f5(iVar3 * 0x1c + 4);

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

      piVar6 = (int *)0x0;

    }

    else {

      piVar6 = piVar2 + 1;

      *piVar2 = iVar3;

      FUN_00401000(piVar6,0x1c,iVar3,&LAB_00520180);

    }

    uVar4 = 0;

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

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

      do {

        FUN_005ab060(param_2,param_3);

        uVar4 = uVar4 + 1;

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

    }

  }

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

  *(uint *)(param_1 + 0x10) = uVar5 >> 1 & 1;

  piVar2 = (int *)thunk_FUN_005df0f5(iVar3 * 0x10 + 4);

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

    piVar2 = (int *)0x0;

  }

  else {

    *piVar2 = iVar3;

    piVar2 = piVar2 + 1;

    piVar6 = piVar2;

    if (-1 < iVar3 + -1) {

      do {

        *piVar6 = 0;

        piVar6[1] = 0;

        piVar6[2] = 0;

        piVar6[3] = 0;

        iVar3 = iVar3 + -1;

        piVar6 = piVar6 + 4;

      } while (iVar3 != 0);

    }

  }

  uVar5 = 0;

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

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

    do {

      FUN_005203f0(*(undefined4 *)(param_1 + 0x14),param_2,param_3);

      uVar5 = uVar5 + 1;

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

  }

  return 1;

}





// --- FUN_00520780 at 0x00520780 (size: 54) ---


void __fastcall FUN_00520780(int param_1)



{

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

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

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

  }

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

    FUN_005204d0(3);

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

  }

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

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

  return;

}





// --- FUN_005207c0 at 0x005207C0 (size: 80) ---


void __fastcall FUN_005207c0(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007c8858;

  param_1[0xc] = &PTR_LAB_007c8840;

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

    operator_delete__((void *)(param_1[0xe] + -4));

    param_1[0xe] = 0;

  }

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

    FUN_005204d0(3);

    param_1[0xf] = 0;

  }

  param_1[0x12] = 0;

  param_1[0x11] = 0;

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  return;

}





// --- FUN_00520810 at 0x00520810 (size: 30) ---


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



{

  FUN_005207c0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00520830 at 0x00520830 (size: 62) ---


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



{

  int iVar1;

  

  if (0xb < param_3) {

    *param_1 = *(undefined4 *)*param_2;

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

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

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_00520870 at 0x00520870 (size: 53) ---


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



{

  *param_1 = &PTR_FUN_007c892c;

  FUN_005202f0();

  param_1[1] = 0;

  param_1[2] = 0;

  *param_1 = &PTR_LAB_007c78e0;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005208b0 at 0x005208B0 (size: 217) ---


void __fastcall FUN_005208b0(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  undefined4 uVar3;

  

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

    iVar2 = 0;

    do {

      uVar3 = 0;

      uVar1 = FUN_004220b0(*(undefined4 *)(*(int *)(param_1 + 0x3c) + iVar2 * 4),0);

      FUN_0041a4e0(uVar1,uVar3);

      iVar2 = iVar2 + 1;

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

  }

  uVar3 = 0;

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

  FUN_0041a4e0(uVar1,uVar3);

  uVar3 = 0;

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

  FUN_0041a4e0(uVar1,uVar3);

  uVar3 = 0;

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

  FUN_0041a4e0(uVar1,uVar3);

  uVar3 = 0;

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

  FUN_0041a4e0(uVar1,uVar3);

  uVar3 = 0;

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

  FUN_0041a4e0(uVar1,uVar3);

  return;

}





// --- FUN_00520990 at 0x00520990 (size: 50) ---


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



{

  *param_1 = &PTR_FUN_007c7450;

  if (param_1[5] == 0) {

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

  }

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005209d0 at 0x005209D0 (size: 36) ---


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



{

  *param_1 = &PTR_FUN_007c8930;

  FUN_004f7fc0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00520a00 at 0x00520A00 (size: 390) ---


undefined4 * __fastcall FUN_00520a00(undefined4 *param_1)



{

  undefined4 uVar1;

  uint uVar2;

  uint uVar3;

  

  FUN_00415460(DAT_008454b0);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007c8948;

  param_1[0xc] = &PTR_LAB_007c8934;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 1;

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1f] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x23] = 0;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  param_1[0x22] = 0;

  param_1[0x24] = 0;

  param_1[0x25] = 0;

  param_1[0x26] = 0x3f800000;

  param_1[0x27] = 0x3f800000;

  param_1[0x28] = 0x3f800000;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  param_1[0x2b] = &PTR_FUN_007c7450;

  param_1[0x30] = 0;

  uVar1 = thunk_FUN_005df0f5(8);

  param_1[0x2e] = uVar1;

  param_1[0x2f] = 2;

  param_1[0x2d] = 8;

  param_1[0x2c] = 0;

  uVar2 = 1;

  do {

    uVar3 = param_1[0x2c] | uVar2;

    uVar2 = uVar2 << 1;

    param_1[0x2c] = uVar3;

  } while ((uVar3 | uVar2) < (uint)param_1[0x2f]);

  uVar2 = 0;

  do {

    *(undefined4 *)(param_1[0x2e] + uVar2 * 4) = 0;

    uVar2 = uVar2 + 1;

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

  param_1[0x2b] = &PTR_FUN_007c7450;

  param_1[0x31] = DAT_008454b0;

  param_1[0x32] = DAT_008454b0;

  param_1[0x33] = DAT_008454b0;

  param_1[0x34] = DAT_008454b0;

  param_1[0x35] = DAT_008454b0;

  return param_1;

}





// --- FUN_00520bb0 at 0x00520BB0 (size: 347) ---


int * FUN_00520bb0(undefined4 param_1)



{

  int iVar1;

  int *piVar2;

  undefined4 *puVar3;

  undefined4 uVar4;

  int *piVar5;

  undefined4 *puVar6;

  uint uVar7;

  int *piVar8;

  undefined4 *puVar9;

  

  iVar1 = FUN_005df0f5(0xd8);

  if (iVar1 != 0) {

    piVar2 = (int *)FUN_00520a00();

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

      puVar3 = (undefined4 *)thunk_FUN_005df0f5(8);

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

        puVar6 = (undefined4 *)0x0;

      }

      else {

        puVar6 = puVar3 + 1;

        *puVar3 = 1;

        FUN_00401000(puVar6,4,1,FUN_0050a140);

      }

      piVar2[0xf] = (int)puVar6;

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

        piVar2[0xe] = 1;

        *puVar6 = param_1;

        uVar4 = FUN_004220b0(param_1,6);

        piVar5 = (int *)FUN_00415430(uVar4);

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

          piVar8 = (int *)piVar5[0x1d];

          if ((piVar8 != (int *)0x0) || (piVar8 = (int *)piVar5[0x24], piVar8 != (int *)0x0)) {

            piVar2[0x1c] = *piVar8;

            piVar2[0x1d] = piVar8[1];

            piVar2[0x1e] = piVar8[2];

            piVar2[0x1f] = piVar8[3];

          }

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

        }

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

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

          puVar3[1] = 0;

          puVar3[2] = 0;

          *puVar3 = &PTR_FUN_007c892c;

          puVar3[3] = 0;

          puVar3[4] = 0;

          puVar3[5] = 0;

          puVar3[6] = 0;

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

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

            puVar9 = (undefined4 *)0x0;

          }

          else {

            puVar9 = puVar6 + 1;

            *puVar6 = 1;

            FUN_00401000(puVar9,0x1c,1,&LAB_00520180);

          }

          puVar3[3] = puVar9;

          puVar3[2] = 0;

          uVar7 = 0U >> ((byte)piVar2[0x2d] & 0x1f) & piVar2[0x2c];

          puVar3[1] = *(undefined4 *)(piVar2[0x2e] + uVar7 * 4);

          *(undefined4 **)(piVar2[0x2e] + uVar7 * 4) = puVar3;

          puVar3[6] = 1;

          return piVar2;

        }

      }

      (**(code **)(*piVar2 + 0x18))(1);

      return (int *)0x0;

    }

  }

  return (int *)0x0;

}





// --- FUN_00520d10 at 0x00520D10 (size: 46) ---


int FUN_00520d10(undefined4 param_1)



{

  int iVar1;

  

  iVar1 = FUN_005df0f5(0xd8);

  if (iVar1 != 0) {

    iVar1 = FUN_00520a00();

    if (iVar1 != 0) {

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

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

      return iVar1;

    }

  }

  return 0;

}





// --- FUN_00520d40 at 0x00520D40 (size: 858) ---


uint __fastcall FUN_00520d40(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  undefined4 *puVar5;

  int iVar6;

  undefined4 *local_20;

  int local_1c;

  uint local_18;

  int local_14;

  uint local_10;

  int local_c;

  undefined4 local_8;

  undefined4 local_4;

  

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

  local_20 = (undefined4 *)0x0;

  iVar6 = iVar2 * 4 + 8;

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

    iVar6 = iVar6 + iVar2 * 4;

  }

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

    iVar6 = iVar6 + iVar2 * 0xc;

  }

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

  iVar6 = iVar6 + 4;

  local_1c = 0;

  local_8 = 0;

  local_10 = 0;

  local_14 = iVar2;

  if (iVar2 != 0) {

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

    local_4 = 0;

    if (local_c == 0) {

      FUN_004d8d00();

    }

  }

  if (iVar2 != 0) {

    local_8 = 0;

    local_10 = 0;

    if (local_14 != 0) {

      local_c = **(int **)(local_14 + 0xc);

      local_4 = 0;

      if (local_c != 0) goto LAB_00520df0;

      FUN_004d8d00();

      while (local_c != 0) {

LAB_00520df0:

        local_1c = local_1c + 1;

        FUN_004d8d00();

      }

    }

    iVar6 = iVar6 + local_1c * 0x24;

  }

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

  iVar6 = iVar6 + 4;

  local_1c = 0;

  local_8 = 0;

  local_10 = 0;

  local_14 = iVar2;

  if (iVar2 == 0) {

    local_c = 0;

  }

  else {

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

    local_4 = 0;

    if (local_c == 0) {

      FUN_004d8d00();

    }

  }

  if (iVar2 != 0) {

    local_8 = 0;

    local_10 = 0;

    if (local_14 != 0) {

      local_c = **(int **)(local_14 + 0xc);

      local_4 = 0;

      iVar2 = local_c;

      if ((local_c != 0) || (FUN_004d8d00(), iVar2 = local_c, local_c != 0)) {

LAB_00520e90:

        local_1c = local_1c + 1;

        if (iVar2 != 0) {

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

          if (iVar2 != 0) goto LAB_00520e90;

        }

        do {

          local_10 = local_10 + 1;

          if (*(uint *)(local_14 + 0x10) <= local_10) {

            if (iVar2 == 0) goto LAB_00520ec8;

            break;

          }

          iVar2 = *(int *)(*(int *)(local_14 + 0xc) + local_10 * 4);

        } while (iVar2 == 0);

        goto LAB_00520e90;

      }

    }

LAB_00520ec8:

    iVar6 = iVar6 + local_1c * 0x24;

  }

  local_14 = param_1 + 0xac;

  iVar6 = iVar6 + 4;

  local_8 = 0;

  local_10 = 0;

  if (local_14 == 0) {

    local_4 = 1;

  }

  else {

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

    local_4 = 0;

    if (local_c == 0) {

      FUN_004d8d00();

    }

  }

  local_8 = 0;

  local_10 = 0;

  if (local_14 != 0) {

    local_4 = 0;

    local_c = **(int **)(local_14 + 0xc);

    iVar3 = local_14;

    iVar2 = local_c;

    if ((local_c != 0) || (FUN_004d8d00(), iVar3 = local_14, iVar2 = local_c, local_c != 0)) {

LAB_00520f45:

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

      iVar6 = iVar6 + 4 + iVar1;

      if (iVar2 != 0) {

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

        if (iVar2 != 0) goto LAB_00520f45;

      }

      do {

        local_10 = local_10 + 1;

        if (*(uint *)(iVar3 + 0x10) <= local_10) {

          if (iVar2 == 0) goto LAB_00520f82;

          break;

        }

        iVar2 = *(int *)(*(int *)(iVar3 + 0xc) + local_10 * 4);

      } while (iVar2 == 0);

      goto LAB_00520f45;

    }

  }

LAB_00520f82:

  uVar4 = 0;

  iVar6 = iVar6 + 4;

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

    do {

      iVar2 = FUN_0053b660(&local_20,0);

      iVar6 = iVar6 + iVar2;

      uVar4 = uVar4 + 1;

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

  }

  iVar6 = iVar6 + 4;

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

    iVar6 = iVar6 + *(int *)(param_1 + 0x50) * 0x10;

  }

  iVar6 = iVar6 + 0x34;

  local_18 = 0;

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

    local_1c = 0;

    do {

      puVar5 = (undefined4 *)(*(int *)(param_1 + 0x94) + local_1c);

      iVar2 = FUN_00525410();

      if (iVar2 + 0x2c == 0) {

        *local_20 = *puVar5;

        local_20 = local_20 + 1;

        FUN_00535e70(&local_20,0);

        FUN_005ab0d0(&local_20,0);

        *local_20 = puVar5[0x17];

        local_20[1] = puVar5[0x18];

        local_20[2] = puVar5[0x19];

        local_20 = local_20 + 3;

      }

      iVar6 = iVar6 + iVar2 + 0x2c;

      local_18 = local_18 + 1;

      local_1c = local_1c + 0x68;

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

  }

  uVar4 = iVar6 + 0x14;

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

    return (4 - (uVar4 & 3)) + uVar4;

  }

  return uVar4;

}





// --- FUN_00521770 at 0x00521770 (size: 1930) ---


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



{

  int iVar1;

  uint *puVar2;

  uint uVar3;

  int *piVar4;

  uint uVar5;

  undefined4 uVar6;

  undefined4 *puVar7;

  int *piVar8;

  int iVar9;

  uint uVar10;

  

  uVar3 = param_3;

  puVar2 = param_2;

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

  uVar10 = *(uint *)*param_2;

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

  *(uint *)(param_1 + 0x2c) = (uVar10 & 0xff) >> 2 & 1;

  *(uint *)(param_1 + 0x28) = (uVar10 & 0xff) >> 3 & 1;

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

  *param_2 = *param_2 + 4;

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

  if (iVar9 != 0) {

    piVar4 = (int *)thunk_FUN_005df0f5(iVar9 * 4 + 4);

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

      piVar4 = (int *)0x0;

    }

    else {

      *piVar4 = iVar9;

      piVar4 = piVar4 + 1;

      FUN_00401000(piVar4,4,iVar9,FUN_0050a140);

    }

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

    uVar5 = 0;

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

      do {

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

        uVar6 = *(undefined4 *)*param_2;

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

        *(undefined4 *)(iVar9 + uVar5 * 4) = uVar6;

        uVar5 = uVar5 + 1;

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

    }

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

      uVar6 = thunk_FUN_005df0f5(*(int *)(param_1 + 8) << 2);

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

      uVar5 = 0;

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

        do {

          *(undefined4 *)(*(int *)(param_1 + 0x10) + uVar5 * 4) = *(undefined4 *)*param_2;

          *param_2 = *param_2 + 4;

          uVar5 = uVar5 + 1;

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

      }

    }

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

      uVar6 = thunk_FUN_005df0f5(*(int *)(param_1 + 8) * 0xc);

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

      uVar10 = 0;

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

        iVar9 = 0;

        do {

          puVar7 = (undefined4 *)(*(int *)(param_1 + 0x14) + iVar9);

          if (0xb < param_3) {

            *puVar7 = *(undefined4 *)*param_2;

            uVar5 = *param_2;

            *param_2 = uVar5 + 4;

            puVar7[1] = *(undefined4 *)(uVar5 + 4);

            uVar5 = *param_2;

            *param_2 = uVar5 + 4;

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

            *param_2 = *param_2 + 4;

          }

          uVar10 = uVar10 + 1;

          iVar9 = iVar9 + 0xc;

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

      }

    }

  }

  iVar9 = *(int *)*param_2;

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

  if (iVar9 != 0) {

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

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

      puVar7 = (undefined4 *)0x0;

    }

    else {

      *puVar7 = &PTR_FUN_007c7450;

      puVar7[5] = 0;

      uVar6 = thunk_FUN_005df0f5(0x10);

      puVar7[3] = uVar6;

      puVar7[4] = 4;

      puVar7[2] = 8;

      puVar7[1] = 0;

      uVar10 = 1;

      do {

        uVar5 = puVar7[1] | uVar10;

        uVar10 = uVar10 << 1;

        puVar7[1] = uVar5;

      } while ((uVar5 | uVar10) < (uint)puVar7[4]);

      uVar10 = 0;

      do {

        *(undefined4 *)(puVar7[3] + uVar10 * 4) = 0;

        uVar10 = uVar10 + 1;

      } while (uVar10 < (uint)puVar7[4]);

      *puVar7 = &PTR_FUN_007c8930;

    }

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

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

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

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

        puVar7 = (undefined4 *)0x0;

      }

      else {

        puVar7[1] = 0;

        puVar7[2] = 0;

        *puVar7 = &PTR_LAB_007c78e0;

        puVar7[4] = 0x3f800000;

        puVar7[5] = 0;

        puVar7[6] = 0;

        puVar7[7] = 0;

        puVar7[0x11] = 0;

        puVar7[0x12] = 0;

        puVar7[0x13] = 0;

        FUN_00535b30();

      }

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

      uVar10 = *param_2;

      *param_2 = uVar10 + 4;

      puVar7[3] = *(undefined4 *)(uVar10 + 4);

      *param_2 = *param_2 + 4;

      FUN_00535ee0(param_2,param_3);

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

      uVar10 = ((uint)puVar7[2] >> ((byte)*(undefined4 *)(iVar1 + 8) & 0x1f) ^ puVar7[2]) &

               *(uint *)(iVar1 + 4);

      puVar7[1] = *(undefined4 *)(*(int *)(iVar1 + 0xc) + uVar10 * 4);

      *(undefined4 **)(*(int *)(iVar1 + 0xc) + uVar10 * 4) = puVar7;

    }

  }

  iVar9 = *(int *)*param_2;

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

  if (iVar9 != 0) {

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

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

      puVar7 = (undefined4 *)0x0;

    }

    else {

      *puVar7 = &PTR_FUN_007c7450;

      puVar7[5] = 0;

      uVar6 = thunk_FUN_005df0f5(0x10);

      puVar7[3] = uVar6;

      puVar7[4] = 4;

      puVar7[2] = 8;

      puVar7[1] = 0;

      uVar10 = 1;

      do {

        uVar5 = puVar7[1] | uVar10;

        uVar10 = uVar10 << 1;

        puVar7[1] = uVar5;

      } while ((uVar5 | uVar10) < (uint)puVar7[4]);

      uVar10 = 0;

      do {

        *(undefined4 *)(puVar7[3] + uVar10 * 4) = 0;

        uVar10 = uVar10 + 1;

      } while (uVar10 < (uint)puVar7[4]);

      *puVar7 = &PTR_FUN_007c8930;

    }

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

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

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

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

        puVar7 = (undefined4 *)0x0;

      }

      else {

        puVar7[1] = 0;

        puVar7[2] = 0;

        *puVar7 = &PTR_LAB_007c78e0;

        puVar7[4] = 0x3f800000;

        puVar7[5] = 0;

        puVar7[6] = 0;

        puVar7[7] = 0;

        puVar7[0x11] = 0;

        puVar7[0x12] = 0;

        puVar7[0x13] = 0;

        FUN_00535b30();

      }

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

      uVar10 = *param_2;

      *param_2 = uVar10 + 4;

      puVar7[3] = *(undefined4 *)(uVar10 + 4);

      *param_2 = *param_2 + 4;

      FUN_00535ee0(param_2,param_3);

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

      uVar10 = ((uint)puVar7[2] >> ((byte)*(undefined4 *)(iVar1 + 8) & 0x1f) ^ puVar7[2]) &

               *(uint *)(iVar1 + 4);

      puVar7[1] = *(undefined4 *)(*(int *)(iVar1 + 0xc) + uVar10 * 4);

      *(undefined4 **)(*(int *)(iVar1 + 0xc) + uVar10 * 4) = puVar7;

    }

  }

  iVar9 = *(int *)*param_2;

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

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

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

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

      puVar7 = (undefined4 *)0x0;

    }

    else {

      puVar7[1] = 0;

      puVar7[2] = 0;

      *puVar7 = &PTR_FUN_007c892c;

      puVar7[3] = 0;

      puVar7[4] = 0;

      puVar7[5] = 0;

      puVar7[6] = 0;

    }

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

    *param_2 = *param_2 + 4;

    FUN_005203f0(*(undefined4 *)(param_1 + 8),param_2,param_3);

    uVar10 = ((uint)puVar7[2] >> ((byte)*(undefined4 *)(param_1 + 0x84) & 0x1f) ^ puVar7[2]) &

             *(uint *)(param_1 + 0x80);

    puVar7[1] = *(undefined4 *)(*(int *)(param_1 + 0x88) + uVar10 * 4);

    *(undefined4 **)(*(int *)(param_1 + 0x88) + uVar10 * 4) = puVar7;

  }

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

  *param_2 = *param_2 + 4;

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

  if (iVar9 != 0) {

    piVar4 = (int *)thunk_FUN_005df0f5(iVar9 * 0x14 + 4);

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

      piVar8 = (int *)0x0;

    }

    else {

      piVar8 = piVar4 + 1;

      *piVar4 = iVar9;

      if (-1 < iVar9 + -1) {

        do {

          FUN_0053b640();

          iVar9 = iVar9 + -1;

        } while (iVar9 != 0);

      }

    }

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

    uVar10 = 0;

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

      do {

        FUN_0053b6c0(param_2,param_3);

        uVar10 = uVar10 + 1;

      } while (uVar10 < *(uint *)(param_1 + 0x18));

    }

  }

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

  *param_2 = *param_2 + 4;

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

  if (iVar9 != 0) {

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

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

      piVar4 = (int *)0x0;

    }

    else {

      *piVar4 = iVar9;

      piVar4 = piVar4 + 1;

    }

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

    uVar10 = 0;

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

      iVar9 = 0;

      do {

        puVar7 = (undefined4 *)(*(int *)(param_1 + 0x24) + iVar9);

        if (0xb < param_3) {

          *puVar7 = *(undefined4 *)*param_2;

          uVar5 = *param_2;

          *param_2 = uVar5 + 4;

          puVar7[1] = *(undefined4 *)(uVar5 + 4);

          uVar5 = *param_2;

          *param_2 = uVar5 + 4;

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

          *param_2 = *param_2 + 4;

        }

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

        *param_2 = *param_2 + 4;

        uVar10 = uVar10 + 1;

        iVar9 = iVar9 + 0x10;

      } while (uVar10 < *(uint *)(param_1 + 0x20));

    }

  }

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

  uVar10 = *param_2;

  *param_2 = uVar10 + 4;

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

  uVar10 = *param_2;

  *param_2 = uVar10 + 4;

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

  uVar10 = *param_2;

  *param_2 = uVar10 + 4;

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

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

  *param_2 = (uint)puVar7;

  if (0xb < param_3) {

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

    uVar10 = *param_2;

    *param_2 = uVar10 + 4;

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

    uVar10 = *param_2;

    *param_2 = uVar10 + 4;

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

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

    *param_2 = (uint)puVar7;

  }

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

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

  *param_2 = (uint)puVar7;

  if (0xb < param_3) {

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

    uVar10 = *param_2;

    *param_2 = uVar10 + 4;

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

    uVar10 = *param_2;

    *param_2 = uVar10 + 4;

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

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

    *param_2 = (uint)puVar7;

  }

  *(undefined4 *)(param_1 + 0x5c) = *puVar7;

  uVar10 = *param_2;

  *param_2 = uVar10 + 4;

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

  *param_2 = *param_2 + 4;

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

  if (param_3 != 0) {

    piVar4 = (int *)thunk_FUN_005df0f5(param_3 * 0x68 + 4);

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

      piVar8 = (int *)0x0;

    }

    else {

      *piVar4 = param_3;

      piVar8 = piVar4 + 1;

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

        piVar4 = piVar4 + 0x11;

        do {

          piVar4[-0xf] = 0x3f800000;

          piVar4[-0xe] = 0;

          piVar4[-0xd] = 0;

          piVar4[-0xc] = 0;

          piVar4[-2] = 0;

          piVar4[-1] = 0;

          *piVar4 = 0;

          FUN_00535b30();

          piVar4 = piVar4 + 0x1a;

          param_3 = param_3 + -1;

        } while (param_3 != 0);

      }

    }

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

    param_2 = (uint *)0x0;

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

      param_3 = 0;

      do {

        puVar7 = (undefined4 *)(*(int *)(param_1 + 100) + param_3);

        iVar9 = FUN_00525410();

        if (iVar9 + 0x2cU <= uVar3) {

          *puVar7 = *(undefined4 *)*puVar2;

          *puVar2 = *puVar2 + 4;

          FUN_00535ee0(puVar2,uVar3);

          FUN_005ab130(puVar2,uVar3);

          puVar7[0x17] = *(undefined4 *)*puVar2;

          uVar10 = *puVar2;

          *puVar2 = uVar10 + 4;

          puVar7[0x18] = *(undefined4 *)(uVar10 + 4);

          uVar10 = *puVar2;

          *puVar2 = uVar10 + 4;

          puVar7[0x19] = *(undefined4 *)(uVar10 + 4);

          *puVar2 = *puVar2 + 4;

        }

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

        param_3 = param_3 + 0x68;

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

    }

  }

  uVar6 = *(undefined4 *)*puVar2;

  *puVar2 = (uint)((undefined4 *)*puVar2 + 1);

  *(undefined4 *)(param_1 + 0x94) = uVar6;

  uVar6 = *(undefined4 *)*puVar2;

  *puVar2 = (uint)((undefined4 *)*puVar2 + 1);

  *(undefined4 *)(param_1 + 0x98) = uVar6;

  uVar6 = *(undefined4 *)*puVar2;

  *puVar2 = (uint)((undefined4 *)*puVar2 + 1);

  *(undefined4 *)(param_1 + 0x9c) = uVar6;

  uVar6 = *(undefined4 *)*puVar2;

  *puVar2 = (uint)((undefined4 *)*puVar2 + 1);

  *(undefined4 *)(param_1 + 0xa0) = uVar6;

  uVar6 = *(undefined4 *)*puVar2;

  *puVar2 = (uint)((undefined4 *)*puVar2 + 1);

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

  uVar10 = *puVar2 & 0x80000003;

  if ((int)uVar10 < 0) {

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

  }

  if (uVar10 != 0) {

    for (iVar9 = 4 - uVar10; iVar9 != 0; iVar9 = iVar9 + -1) {

      *(undefined1 *)*puVar2 = 0;

      *puVar2 = *puVar2 + 1;

    }

  }

  return 1;

}





// --- FUN_00521f10 at 0x00521F10 (size: 57) ---


int __thiscall FUN_00521f10(int param_1,uint param_2)



{

  int iVar1;

  

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

  if (iVar1 != 0) {

    for (iVar1 = *(int *)(*(int *)(iVar1 + 0xc) +

                         ((param_2 >> ((byte)*(undefined4 *)(iVar1 + 8) & 0x1f) ^ param_2) &

                         *(uint *)(iVar1 + 4)) * 4); iVar1 != 0; iVar1 = *(int *)(iVar1 + 4)) {

      if (param_2 == *(uint *)(iVar1 + 8)) {

        return iVar1;

      }

    }

  }

  return 0;

}





// --- FUN_00521f60 at 0x00521F60 (size: 341) ---


void __fastcall FUN_00521f60(int param_1)



{

  int iVar1;

  int iVar2;

  

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

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

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

  }

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

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

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

  }

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

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

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

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

    FUN_00524910();

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

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

    }

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

  }

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

    FUN_00524910();

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

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

    }

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

  }

  FUN_00524910();

  *(undefined4 *)(param_1 + 0xc4) = DAT_008454b0;

  *(undefined4 *)(param_1 + 200) = DAT_008454b0;

  *(undefined4 *)(param_1 + 0xcc) = DAT_008454b0;

  *(undefined4 *)(param_1 + 0xd0) = DAT_008454b0;

  *(undefined4 *)(param_1 + 0xd4) = DAT_008454b0;

  return;

}





// --- FUN_005220c0 at 0x005220C0 (size: 92) ---


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



{

  *param_1 = &PTR_LAB_007c8948;

  param_1[0xc] = &PTR_LAB_007c8934;

  FUN_00521f60();

  param_1[0x2b] = &PTR_FUN_007c7450;

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

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

  }

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00522150 at 0x00522150 (size: 94) ---


undefined4 __thiscall FUN_00522150(int *param_1,int param_2)



{

  int iVar1;

  int iVar2;

  

  iVar1 = thunk_FUN_005df0f5(param_2 * 4);

  if (iVar1 == 0) {

    return 0;

  }

  if (*param_1 != 0) {

    iVar2 = 0;

    if (0 < param_1[3]) {

      do {

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

        iVar2 = iVar2 + 1;

      } while (iVar2 < param_1[3]);

    }

    operator_delete__((void *)*param_1);

  }

  *param_1 = iVar1;

  param_1[2] = param_2;

  return 1;

}





// --- FUN_005221b0 at 0x005221B0 (size: 62) ---


undefined4 * __fastcall FUN_005221b0(undefined4 *param_1)



{

  FUN_00415460(DAT_008454d8);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007c89b8;

  param_1[0xc] = &PTR_LAB_007c89a4;

  param_1[0xe] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0xf] = 2;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  return param_1;

}





// --- FUN_00522210 at 0x00522210 (size: 103) ---


void __fastcall FUN_00522210(int param_1)



{

  void *pvVar1;

  int iVar2;

  

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

    iVar2 = 0;

    do {

      pvVar1 = *(void **)(*(int *)(param_1 + 0x38) + iVar2 * 4);

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

        if (*(undefined4 **)((int)pvVar1 + 8) != (undefined4 *)0x0) {

          (**(code **)**(undefined4 **)((int)pvVar1 + 8))(1);

        }

        operator_delete(pvVar1);

      }

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

      iVar2 = iVar2 + 1;

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

  }

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

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

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

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

  return;

}





// --- FUN_00522280 at 0x00522280 (size: 47) ---


void __thiscall FUN_00522280(int param_1,undefined4 param_2)



{

  int iVar1;

  

  iVar1 = 0;

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

    do {

      (**(code **)(**(int **)(*(int *)(*(int *)(param_1 + 0x38) + iVar1 * 4) + 8) + 0xc))(param_2);

      iVar1 = iVar1 + 1;

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

  }

  return;

}





// --- FUN_005222b0 at 0x005222B0 (size: 77) ---


uint __fastcall FUN_005222b0(int param_1)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  

  iVar3 = 0;

  uVar2 = 4;

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

    do {

      iVar1 = FUN_00527570(*(undefined4 *)(*(int *)(*(int *)(param_1 + 0x38) + iVar3 * 4) + 8));

      uVar2 = uVar2 + 8 + iVar1;

      iVar3 = iVar3 + 1;

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

  }

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

    return (4 - (uVar2 & 3)) + uVar2;

  }

  return uVar2;

}





// --- FUN_005223d0 at 0x005223D0 (size: 284) ---


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



{

  undefined4 *puVar1;

  undefined4 uVar2;

  int iVar3;

  uint uVar4;

  undefined4 *puVar5;

  int iStack_10;

  

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

  iStack_10 = *(int *)*param_2;

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

  FUN_00522150(iStack_10);

  if (0 < iStack_10) {

    do {

      puVar1 = (undefined4 *)FUN_005df0f5(0x10);

      puVar5 = (undefined4 *)0x0;

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

        *puVar1 = 0;

        puVar1[1] = 0;

        puVar1[2] = 0;

        puVar5 = puVar1;

      }

      puVar1 = (undefined4 *)*param_2;

      *puVar5 = *puVar1;

      puVar5[1] = puVar1[1];

      *param_2 = *param_2 + 8;

      uVar2 = FUN_00527dd0(param_2,param_3);

      puVar5[2] = uVar2;

      if ((*(int *)(param_1 + 0x14) < *(int *)(param_1 + 0x10)) ||

         (iVar3 = FUN_00522150(*(int *)(param_1 + 0xc) + *(int *)(param_1 + 0x14)), iVar3 != 0)) {

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

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

      }

      iStack_10 = iStack_10 + -1;

    } while (iStack_10 != 0);

  }

  uVar4 = *param_2 & 0x80000003;

  if ((int)uVar4 < 0) {

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

  }

  if (uVar4 != 0) {

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

      *(undefined1 *)*param_2 = 0;

      *param_2 = *param_2 + 1;

    }

  }

  if (0 < (int)*(size_t *)(param_1 + 0x14)) {

    qsort(*(void **)(param_1 + 8),*(size_t *)(param_1 + 0x14),4,(_PtFuncCompare *)&LAB_00522120);

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

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

    *(undefined4 *)(param_1 + 0x1c) = puVar5[1];

  }

  return 1;

}





// --- FUN_005224f0 at 0x005224F0 (size: 69) ---


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



{

  *param_1 = &PTR_LAB_007c89b8;

  param_1[0xc] = &PTR_LAB_007c89a4;

  FUN_00522210();

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

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00522540 at 0x00522540 (size: 65) ---


void __thiscall FUN_00522540(undefined4 *param_1,float *param_2,float param_3)



{

  float *pfVar1;

  uint uVar2;

  

  uVar2 = 0;

  if (param_1[2] != 0) {

    pfVar1 = (float *)*param_1;

    do {

      if (param_3 < *pfVar1 != (param_3 == *pfVar1)) {

        *param_2 = pfVar1[1];

        return;

      }

      uVar2 = uVar2 + 1;

      pfVar1 = pfVar1 + 2;

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

  }

  *param_2 = DAT_008454e0;

  return;

}





// --- FUN_00522590 at 0x00522590 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_007c8a10;

  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_005225d0 at 0x005225D0 (size: 43) ---


void __fastcall FUN_005225d0(int *param_1)



{

  param_1[2] = 0;

  param_1[1] = 0;

  if (*param_1 != 0) {

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

  }

  *param_1 = 0;

  return;

}





// --- FUN_00522600 at 0x00522600 (size: 119) ---


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



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  undefined4 *puVar4;

  uint uVar5;

  

  iVar2 = param_1[2];

  uVar5 = 4;

  if (iVar2 != 0) {

    uVar5 = iVar2 * 8 + 4;

  }

  if (uVar5 <= param_3) {

    *(int *)*param_2 = iVar2;

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

    *param_2 = (int)puVar4;

    uVar3 = 0;

    if (param_1[2] != 0) {

      do {

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

        if (7 < param_3) {

          *puVar4 = *puVar1;

          iVar2 = *param_2;

          *param_2 = iVar2 + 4;

          *(undefined4 *)(iVar2 + 4) = puVar1[1];

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

          *param_2 = (int)puVar4;

        }

        uVar3 = uVar3 + 1;

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

    }

  }

  return uVar5;

}





// --- FUN_00522680 at 0x00522680 (size: 66) ---


void __fastcall FUN_00522680(int *param_1)



{

  undefined4 uVar1;

  uint uVar2;

  undefined4 uVar3;

  

  uVar2 = 0;

  if (param_1[2] != 0) {

    do {

      uVar3 = 8;

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

      FUN_0041a4e0(uVar1,uVar3);

      uVar2 = uVar2 + 1;

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

  }

  return;

}





// --- FUN_005226d0 at 0x005226D0 (size: 166) ---


undefined4 __thiscall FUN_005226d0(int *param_1,uint param_2)



{

  uint *puVar1;

  int iVar2;

  uint *puVar3;

  uint uVar4;

  

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

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

      return 1;

    }

    if (param_2 == 0) {

      FUN_005225d0();

      return 1;

    }

    puVar3 = (uint *)thunk_FUN_005df0f5(param_2 * 8 + 4);

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

      puVar1 = puVar3 + 1;

      *puVar3 = param_2;

      FUN_00401000(puVar1,8,param_2,FUN_0050a140);

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

        if (*param_1 != 0) {

          uVar4 = 0;

          if (param_1[2] != 0) {

            do {

              iVar2 = *param_1;

              puVar1[uVar4 * 2] = *(uint *)(iVar2 + uVar4 * 8);

              puVar3[uVar4 * 2 + 2] = *(uint *)(iVar2 + 4 + uVar4 * 8);

              uVar4 = uVar4 + 1;

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

          }

          if (*param_1 != 0) {

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

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = param_2;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_00522780 at 0x00522780 (size: 127) ---


int FUN_00522780(int *param_1)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  int *piVar5;

  int iVar6;

  int iVar7;

  undefined1 local_c [12];

  

  iVar6 = 4;

  *param_1 = 0;

  piVar3 = (int *)FUN_0052dcf0(local_c);

  iVar1 = *piVar3;

  piVar5 = (int *)piVar3[1];

  iVar4 = piVar3[2];

  do {

    if (iVar4 == 0) {

      return iVar6;

    }

    do {

      *param_1 = *param_1 + 1;

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

      iVar7 = 4;

      if (iVar2 != 0) {

        iVar7 = iVar2 * 8 + 4;

      }

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

      iVar6 = iVar6 + 4 + iVar7;

    } while (iVar4 != 0);

    do {

      piVar5 = piVar5 + 1;

      if (piVar5 == (int *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4)) {

        return iVar6;

      }

      iVar4 = *piVar5;

    } while (iVar4 == 0);

  } while( true );

}





// --- FUN_00522910 at 0x00522910 (size: 122) ---


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



{

  undefined4 *puVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  

  iVar7 = *(int *)*param_2;

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

  FUN_005226d0(iVar7);

  if (0 < iVar7) {

    do {

      puVar1 = (undefined4 *)*param_2;

      uVar2 = *puVar1;

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

      uVar3 = puVar1[1];

      *param_2 = (int)(puVar1 + 2);

      uVar4 = param_1[1];

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

LAB_00522965:

        iVar6 = param_1[2];

        iVar5 = *param_1;

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

        *(undefined4 *)(iVar5 + 4 + iVar6 * 8) = uVar3;

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

      }

      else {

        if (uVar4 == 0) {

          iVar6 = 8;

        }

        else {

          iVar6 = uVar4 * 2;

        }

        iVar6 = FUN_005226d0(iVar6);

        if (iVar6 != 0) goto LAB_00522965;

      }

      iVar7 = iVar7 + -1;

    } while (iVar7 != 0);

  }

  return 1;

}





// --- FUN_00522990 at 0x00522990 (size: 98) ---


undefined4 * __thiscall

FUN_00522990(int param_1,undefined4 *param_2,uint param_3,undefined4 param_4)



{

  uint *puVar1;

  undefined4 *puVar2;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 0x9c) + (param_3 % *(uint *)(param_1 + 0xa4)) * 4);

  do {

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

LAB_005229c0:

      *param_2 = DAT_008454e0;

      return param_2;

    }

    if (*puVar1 == param_3) {

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

        puVar2 = (undefined4 *)FUN_00522540(&param_3,param_4);

        *param_2 = *puVar2;

        return param_2;

      }

      goto LAB_005229c0;

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_00522a00 at 0x00522A00 (size: 143) ---


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



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_007c8a10;

  puVar1 = PTR_DAT_00818558;

  puVar2 = (uint *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

  if (puVar2 == (uint *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

  param_1[0x19] = (undefined4 *)param_1[0x18] + param_1[0x1a];

  puVar6 = (undefined4 *)param_1[0x18];

  for (uVar4 = param_1[0x1a] & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

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

    *(undefined1 *)puVar6 = 0;

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

  }

  return param_1;

}





// --- FUN_00522a90 at 0x00522A90 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_007c8a14;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_007c8a10;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

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

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00522af0 at 0x00522AF0 (size: 55) ---


undefined4 * __fastcall FUN_00522af0(undefined4 *param_1)



{

  FUN_00415460(DAT_008454e0);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007c8a30;

  param_1[0xc] = &PTR_LAB_007c8a18;

  param_1[0xe] = &PTR_FUN_007c8a14;

  FUN_00522a00(4);

  return param_1;

}





// --- FUN_00522b50 at 0x00522B50 (size: 207) ---


void FUN_00522b50(void)



{

  int iVar1;

  int *piVar2;

  void *pvVar3;

  int *piVar4;

  void *pvVar5;

  void *pvVar6;

  int *piVar7;

  void *pvVar8;

  undefined1 local_c [12];

  

  piVar4 = (int *)FUN_0052dcf0(local_c);

  iVar1 = *piVar4;

  pvVar3 = (void *)piVar4[2];

  piVar4 = (int *)piVar4[1];

  do {

    if (pvVar3 == (void *)0x0) {

      return;

    }

    piVar2 = *(int **)((int)pvVar3 + 8);

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

    piVar7 = piVar4;

    pvVar8 = pvVar6;

    if (pvVar6 == (void *)0x0) {

      do {

        piVar7 = piVar7 + 1;

        pvVar8 = pvVar6;

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

        pvVar8 = (void *)*piVar7;

      } while (pvVar8 == (void *)0x0);

    }

    pvVar6 = (void *)*piVar4;

    if (pvVar6 == pvVar3) {

LAB_00522bc2:

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

    }

    else {

      do {

        pvVar5 = pvVar6;

        pvVar6 = *(void **)((int)pvVar5 + 4);

      } while (pvVar6 != pvVar3);

      if (pvVar5 == (void *)0x0) goto LAB_00522bc2;

      *(undefined4 *)((int)pvVar5 + 4) = *(undefined4 *)((int)pvVar6 + 4);

    }

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

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

      operator_delete(pvVar3);

    }

    pvVar3 = pvVar8;

    piVar4 = piVar7;

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

      if (*piVar2 != 0) {

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

      }

      operator_delete(piVar2);

    }

  } while( true );

}





// --- FUN_00522d30 at 0x00522D30 (size: 94) ---


void __fastcall FUN_00522d30(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007c8a30;

  param_1[0xc] = &PTR_LAB_007c8a18;

  FUN_00522b50();

  param_1[0xe] = &PTR_FUN_007c8a14;

  FUN_005870f0();

  param_1[0xf] = &PTR_FUN_007c8a10;

  if ((undefined4 *)param_1[0x27] != param_1 + 0x10) {

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

  }

  param_1[0x27] = 0;

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  return;

}





// --- FUN_00522d90 at 0x00522D90 (size: 30) ---


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



{

  FUN_00522d30();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00522db0 at 0x00522DB0 (size: 48) ---


undefined4 FUN_00522db0(float param_1,float param_2)



{

  if (DAT_00796344 <= param_1) {

    if (param_2 >= DAT_00796344) {

      return 1;

    }

  }

  else if (param_2 < DAT_00796344) {

    return 1;

  }

  return 0;

}





// --- FUN_00522de0 at 0x00522DE0 (size: 76) ---


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



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



{

  if (_DAT_007c8a98 < ABS(param_3)) {

    FUN_00525540(param_4 / param_3);

    return;

  }

  if (ABS(param_4) < _DAT_007c8a98) {

    FUN_00525540(0);

  }

  return;

}





// --- FUN_00522e30 at 0x00522E30 (size: 135) ---


void FUN_00522e30(undefined4 param_1,int param_2)



{

  undefined4 *puVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  int iVar4;

  int local_c;

  

  iVar4 = param_2;

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

    FUN_00527390(param_2);

    uVar3 = param_1;

    while (local_c != 0) {

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

      param_2 = puVar1[1];

      uVar2 = *puVar1;

      FUN_00526c40(puVar1,0);

      FUN_00526c40(local_c,0);

      FUN_00523400(uVar2,iVar4,uVar3,param_2,&param_1,0);

    }

    thunk_FUN_00526ee0();

  }

  return;

}





// --- FUN_00522ec0 at 0x00522EC0 (size: 90) ---


void __thiscall FUN_00522ec0(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    FUN_00522f20(param_2);

    return;

  }

  iVar1 = thunk_FUN_005df0f5(param_2 * 4);

  uVar2 = 0;

  if (param_1[3] != 0) {

    do {

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

      uVar2 = uVar2 + 1;

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

  }

  operator_delete__((void *)*param_1);

  *param_1 = iVar1;

  param_1[3] = param_2;

  return;

}





// --- FUN_00522f20 at 0x00522F20 (size: 123) ---


void __thiscall FUN_00522f20(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    if (param_2 == 0) {

      param_1[3] = 0;

      operator_delete__((void *)*param_1);

      *param_1 = 0;

    }

    else {

      iVar1 = thunk_FUN_005df0f5(param_2 * 4);

      uVar2 = 0;

      param_1[3] = param_2;

      if (param_2 != 0) {

        do {

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

          uVar2 = uVar2 + 1;

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

      }

      operator_delete__((void *)*param_1);

      *param_1 = iVar1;

    }

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

      param_1[2] = param_2;

    }

    return;

  }

  FUN_00522ec0(param_2);

  return;

}





// --- FUN_00522fb0 at 0x00522FB0 (size: 30) ---


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



{

  FUN_00522fd0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00522fd0 at 0x00522FD0 (size: 44) ---


void __fastcall FUN_00522fd0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007c8aa0;

  param_1[1] = &PTR_LAB_007c8a9c;

  FUN_00526d50();

  param_1[1] = &PTR_LAB_007c78e0;

  param_1[2] = 0;

  param_1[3] = 0;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_00523000 at 0x00523000 (size: 205) ---


void FUN_00523000(undefined4 param_1,int param_2,float param_3)



{

  undefined4 uVar1;

  int iVar2;

  uint uVar3;

  float local_20;

  float local_1c;

  float local_18;

  undefined1 local_14 [8];

  float local_c;

  

  if (param_2 != 0) {

    local_20 = param_3 * *(float *)(param_2 + 0x18);

    local_1c = param_3 * *(float *)(param_2 + 0x1c);

    local_18 = param_3 * *(float *)(param_2 + 0x20);

    local_c = local_18;

    FUN_00525480(&local_20);

    local_20 = param_3 * *(float *)(param_2 + 0x24);

    local_1c = param_3 * *(float *)(param_2 + 0x28);

    local_18 = param_3 * *(float *)(param_2 + 0x2c);

    local_c = local_18;

    FUN_005254a0(&local_20);

    uVar3 = 0;

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

      iVar2 = 0;

      do {

        uVar1 = FUN_00526900(local_14,param_3,*(int *)(param_2 + 0x14) + iVar2);

        FUN_00526110(uVar1);

        FUN_005aebf0();

        uVar3 = uVar3 + 1;

        iVar2 = iVar2 + 0x14;

      } while (uVar3 < *(byte *)(param_2 + 0x10));

    }

  }

  return;

}





// --- FUN_005230d0 at 0x005230D0 (size: 120) ---


void FUN_005230d0(undefined4 param_1,int param_2,float param_3)



{

  float local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_4;

  

  if (param_2 != 0) {

    local_24 = param_3 * *(float *)(param_2 + 0x24);

    local_20 = param_3 * *(float *)(param_2 + 0x28);

    local_1c = param_3 * *(float *)(param_2 + 0x2c);

    local_18 = param_3 * *(float *)(param_2 + 0x18);

    local_14 = param_3 * *(float *)(param_2 + 0x1c);

    local_10 = param_3 * *(float *)(param_2 + 0x20);

    local_4 = local_10;

    FUN_005254c0(&local_18,&local_24);

  }

  return;

}





// --- FUN_00523150 at 0x00523150 (size: 120) ---


void FUN_00523150(undefined4 param_1,int param_2,float param_3)



{

  float local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_4;

  

  if (param_2 != 0) {

    local_24 = param_3 * *(float *)(param_2 + 0x24);

    local_20 = param_3 * *(float *)(param_2 + 0x28);

    local_1c = param_3 * *(float *)(param_2 + 0x2c);

    local_18 = param_3 * *(float *)(param_2 + 0x18);

    local_14 = param_3 * *(float *)(param_2 + 0x1c);

    local_10 = param_3 * *(float *)(param_2 + 0x20);

    local_4 = local_10;

    FUN_00525500(&local_18,&local_24);

  }

  return;

}





// --- FUN_005231d0 at 0x005231D0 (size: 55) ---


int __thiscall FUN_005231d0(int param_1,uint param_2)



{

  int iVar1;

  

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

                  ((param_2 >> ((byte)*(undefined4 *)(param_1 + 8) & 0x1f) ^ param_2) &

                  *(uint *)(param_1 + 4)) * 4);

  while( true ) {

    if (iVar1 == 0) {

      return 0;

    }

    if (param_2 == *(uint *)(iVar1 + 8)) break;

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

  }

  return iVar1 + -4;

}





// --- FUN_00523210 at 0x00523210 (size: 66) ---


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



{

  int iVar1;

  

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

                  ((param_2 >> ((byte)*(undefined4 *)(param_1 + 8) & 0x1f) ^ param_2) &

                  *(uint *)(param_1 + 4)) * 4);

  while( true ) {

    if (iVar1 == 0) {

      return 0;

    }

    if (param_2 == *(uint *)(iVar1 + 8)) break;

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

  }

  *param_3 = *(undefined4 *)(iVar1 + 0xc);

  return 1;

}





// --- FUN_00523260 at 0x00523260 (size: 72) ---


bool FUN_00523260(int param_1,int param_2,undefined4 *param_3)



{

  int iVar1;

  

  if (param_2 == 0) {

    return false;

  }

  if ((*(byte *)(param_2 + 0x30) & 2) != 0) {

    iVar1 = param_3[1];

    if (param_1 != iVar1) {

      FUN_00523210(*param_3,&param_2);

      return param_2 == iVar1;

    }

  }

  return true;

}





// --- FUN_005232b0 at 0x005232B0 (size: 331) ---


int FUN_005232b0(int param_1,uint param_2,float param_3,uint param_4,float param_5)



{

  uint uVar1;

  int iVar2;

  int local_4;

  

  uVar1 = param_2;

  local_4 = 0;

  if ((param_5 < DAT_00796344) || (param_3 < DAT_00796344)) {

    iVar2 = FUN_00523210(param_4 & 0xffffff | param_1 << 0x10,&param_2);

    if (iVar2 == 0) goto LAB_00523361;

    local_4 = FUN_005231d0(uVar1);

  }

  else {

    iVar2 = FUN_00523210(param_2 & 0xffffff | param_1 << 0x10,&param_2);

    if (iVar2 == 0) goto LAB_00523361;

    local_4 = FUN_005231d0(param_4);

  }

  if (local_4 != 0) {

    return local_4;

  }

LAB_00523361:

  if ((param_5 < DAT_00796344) || (param_3 < DAT_00796344)) {

    iVar2 = FUN_00523210(param_1,&param_4);

    if ((iVar2 != 0) &&

       (iVar2 = FUN_00523210(uVar1 & 0xffffff | param_1 << 0x10,&param_2), iVar2 != 0)) {

      iVar2 = FUN_005231d0(param_4);

      return iVar2;

    }

  }

  else {

    iVar2 = FUN_00523210(param_1 << 0x10,&param_2);

    if (iVar2 != 0) {

      iVar2 = FUN_005231d0(param_4);

      return iVar2;

    }

  }

  return local_4;

}





// --- FUN_00523400 at 0x00523400 (size: 1878) ---


undefined4 __thiscall

FUN_00523400(int param_1,float param_2,float *param_3,undefined4 param_4,float param_5,uint *param_6

            ,float param_7)



{

  float fVar1;

  float fVar2;

  float fVar3;

  int iVar4;

  int iVar5;

  uint uVar6;

  int iVar7;

  int iVar8;

  uint uVar9;

  uint uVar10;

  int local_10;

  float local_c;

  float local_8;

  int local_4;

  

  fVar2 = param_5;

  fVar3 = param_2;

  *param_6 = 0;

  if (*param_3 == 0.0) {

    return 0;

  }

  fVar1 = param_3[1];

  if (fVar1 == 0.0) {

    return 0;

  }

  local_10 = 0;

  local_4 = 0;

  local_8 = fVar1;

  FUN_00523210(*param_3,&local_c);

  if (((param_2 == local_c) && (param_7 == 0.0)) && (((uint)fVar1 & 0x20000000) != 0)) {

    return 1;

  }

  if ((int)param_2 < 0) {

    if (*param_3 == param_2) {

      return 1;

    }

    FUN_00523210(*param_3,&local_c);

    if (local_8 != local_c) {

      local_4 = FUN_005232b0(*param_3,local_8,param_3[2],local_c,param_5);

    }

    iVar4 = FUN_00523210(param_2,&param_7);

    if ((iVar4 != 0) &&

       (iVar4 = FUN_005231d0((uint)param_7 & 0xffffff | (int)param_2 << 0x10), iVar4 != 0)) {

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

        FUN_00526c70();

      }

      iVar5 = FUN_005232b0(*param_3,local_c,param_3[2],param_2,param_5);

      if ((iVar5 == 0) && (param_2 != *param_3)) {

        iVar5 = FUN_005232b0(*param_3,local_c,0x3f800000,*(undefined4 *)(param_1 + 0x98),0x3f800000)

        ;

        FUN_00523210(*(undefined4 *)(param_1 + 0x98),&local_8);

        local_10 = FUN_005232b0(*(undefined4 *)(param_1 + 0x98),local_8,0x3f800000,param_2,

                                0x3f800000);

      }

      param_2 = (float)iVar5;

      FUN_00525950();

      FUN_00525a40();

      FUN_00523000(param_4,local_4,param_5);

      FUN_00523000(param_4,param_2,param_5);

      FUN_00523000(param_4,local_10,param_5);

      FUN_00523000(param_4,iVar4,param_5);

      param_3[1] = param_7;

      *param_3 = fVar3;

      param_3[2] = param_5;

      FUN_00522e30(param_4,param_3);

      if (local_4 == 0) {

        uVar10 = 0;

      }

      else {

        uVar10 = (uint)*(byte *)(local_4 + 0x10);

      }

      if (param_2 == 0.0) {

        uVar9 = 0;

      }

      else {

        uVar9 = (uint)*(byte *)((int)param_2 + 0x10);

      }

      if (local_10 == 0) {

        uVar6 = 0;

      }

      else {

        uVar6 = (uint)*(byte *)(local_10 + 0x10);

      }

      *param_6 = *(byte *)(iVar4 + 0x10) + uVar6 + uVar9 + -1 + uVar10;

      return 1;

    }

  }

  if (((uint)param_2 & 0x40000000) != 0) {

    iVar4 = FUN_005231d0((int)*param_3 << 0x10 | (uint)param_2 & 0xffffff);

    if (((iVar4 != 0) ||

        (iVar4 = FUN_005231d0(*(int *)(param_1 + 0x98) << 0x10 | (uint)param_2 & 0xffffff),

        iVar4 != 0)) && (iVar5 = FUN_00523260(param_2,iVar4,param_3), iVar5 != 0)) {

      if (((param_2 == local_8) && (iVar5 = FUN_00522db0(param_5,param_3[2]), iVar5 != 0)) &&

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

        FUN_00522de0(param_4,iVar4,param_3[2],param_5);

        FUN_00523150(param_4,iVar4,param_3[2]);

        FUN_005230d0(param_4,iVar4,param_5);

        param_3[2] = param_5;

        return 1;

      }

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

        FUN_00526c70();

      }

      iVar5 = FUN_005232b0(*param_3,param_3[1],param_3[2],param_2,param_5);

      if ((iVar5 == 0) || (iVar7 = FUN_00522db0(param_5,param_3[2]), iVar7 == 0)) {

        FUN_00523210(*param_3,&param_7);

        iVar5 = FUN_005232b0(*param_3,param_3[1],param_3[2],param_7,0x3f800000);

        local_10 = FUN_005232b0(*param_3,param_7,0x3f800000,param_2,param_5);

      }

      param_2 = (float)iVar5;

      FUN_00525950();

      FUN_00525a40();

      if (local_10 == 0) {

        if ((DAT_00796344 <= param_3[2]) || (param_5 <= DAT_00796344)) {

          param_7 = param_5;

        }

        else {

          param_7 = -param_5;

        }

        FUN_00523000(param_4,param_2,param_7);

      }

      else {

        FUN_00523000(param_4,param_2,param_3[2]);

        FUN_00523000(param_4,local_10,param_5);

      }

      FUN_00523000(param_4,iVar4,param_5);

      fVar2 = param_3[1];

      if (((fVar2 != fVar3) && (((uint)fVar2 & 0x20000000) != 0)) &&

         (FUN_00523210(*param_3,&param_7), param_7 != fVar3)) {

        FUN_00526bf0(fVar2,param_3[2]);

      }

      param_3[2] = param_5;

      param_3[1] = fVar3;

      FUN_00522e30(param_4,param_3);

      if (param_2 == 0.0) {

        uVar10 = 0;

      }

      else {

        uVar10 = (uint)*(byte *)((int)param_2 + 0x10);

      }

      if (local_10 == 0) {

        uVar9 = 0;

      }

      else {

        uVar9 = (uint)*(byte *)(local_10 + 0x10);

      }

      *param_6 = *(byte *)(iVar4 + 0x10) + uVar9 + -1 + uVar10;

      return 1;

    }

  }

  if (((uint)param_2 & 0x10000000) != 0) {

    uVar10 = (int)*param_3 << 0x10 | (uint)local_8 & 0xffffff;

    iVar4 = FUN_005231d0(uVar10);

    if (iVar4 != 0) {

      iVar5 = FUN_005232b0(*param_3,local_8,param_3[2],param_2,param_5);

      if (iVar5 != 0) {

        FUN_00526ca0(param_2,param_5);

        FUN_00525950();

        FUN_00525a40();

        FUN_00523000(param_4,iVar5,param_5);

        FUN_00523000(param_4,iVar4,param_3[2]);

        FUN_00522e30(param_4,param_3);

        *param_6 = (uint)*(byte *)(iVar5 + 0x10);

        return 1;

      }

      FUN_00523210(*param_3,&local_c);

      iVar4 = FUN_005232b0(*param_3,local_8,param_3[2],local_c,0x3f800000);

      if (((iVar4 != 0) &&

          (iVar5 = FUN_005232b0(*param_3,local_c,0x3f800000,param_2,param_5), iVar5 != 0)) &&

         (iVar7 = FUN_005231d0(uVar10), iVar7 != 0)) {

        iVar8 = FUN_005232b0(*param_3,local_c,0x3f800000,local_8,param_3[2]);

        FUN_00526ca0(param_2,param_5);

        FUN_00525950();

        FUN_00525a40();

        FUN_00523000(param_4,iVar4,0x3f800000);

        FUN_00523000(param_4,iVar5,param_5);

        FUN_00523000(param_4,iVar8,0x3f800000);

        FUN_00523000(param_4,iVar7,param_3[2]);

        FUN_00522e30(param_4,param_3);

        uVar10 = (uint)*(byte *)(iVar4 + 0x10) + (uint)*(byte *)(iVar5 + 0x10);

        *param_6 = uVar10;

        if (iVar8 != 0) {

          *param_6 = *(byte *)(iVar8 + 0x10) + uVar10;

        }

        return 1;

      }

    }

  }

  if (((uint)param_2 & 0x20000000) != 0) {

    fVar3 = *param_3;

    iVar4 = FUN_005231d0((uint)local_8 & 0xffffff | (int)fVar3 << 0x10);

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

      param_5 = (float)FUN_005231d0((uint)param_2 & 0xffffff | (int)fVar3 << 0x10);

      if ((param_5 == 0.0) &&

         (param_5 = (float)FUN_005231d0((uint)param_2 & 0xffffff), param_5 == 0.0)) {

        return 0;

      }

      iVar4 = FUN_00526f40(param_2,fVar2);

      if (iVar4 == 0) {

        FUN_00523b60(param_2,0x3f800000,param_3,param_4,&param_6);

        iVar4 = FUN_00526f40(param_2,fVar2);

        if (iVar4 == 0) {

          return 0;

        }

      }

      FUN_005230d0(param_4,param_5,fVar2);

      return 1;

    }

  }

  return 0;

}





// --- FUN_00523b60 at 0x00523B60 (size: 223) ---


undefined4

FUN_00523b60(uint param_1,undefined4 param_2,int *param_3,undefined4 param_4,uint *param_5)



{

  uint *puVar1;

  undefined4 *puVar2;

  uint *puVar3;

  int iVar4;

  

  puVar2 = param_5;

  *param_5 = 0;

  if (((param_1 & 0x40000000) != 0) && (param_1 == param_3[1])) {

    FUN_00523210(*param_3,&param_5);

    FUN_00523400(param_5,param_3,param_4,0x3f800000,puVar2,1);

    return 1;

  }

  if ((param_1 & 0x20000000) != 0) {

    param_5 = (uint *)0x0;

    puVar3 = (uint *)param_3[3];

    while (puVar1 = puVar3, puVar1 != (uint *)0x0) {

      if (*puVar1 == param_1) {

        iVar4 = FUN_005231d0(*param_3 << 0x10 | param_1 & 0xffffff);

        if ((iVar4 == 0) && (iVar4 = FUN_005231d0(param_1 & 0xffffff), iVar4 == 0)) {

          return 0;

        }

        FUN_00523150(param_4,iVar4,puVar1[1]);

        FUN_00526c40(puVar1,param_5);

        return 1;

      }

      param_5 = puVar1;

      puVar3 = (uint *)puVar1[2];

    }

  }

  return 0;

}





// --- FUN_00523c40 at 0x00523C40 (size: 209) ---


undefined4 __thiscall FUN_00523c40(uint param_1,int *param_2,undefined4 param_3,int *param_4)



{

  int iVar1;

  uint uVar2;

  uint local_4;

  

  local_4 = param_1;

  iVar1 = FUN_00523210(*(undefined4 *)(param_1 + 0x98),&local_4);

  if (iVar1 == 0) {

    return 0;

  }

  FUN_00526c70();

  FUN_00526cf0();

  uVar2 = local_4 & 0xffffff | *(int *)(param_1 + 0x98) << 0x10;

  iVar1 = *(int *)(*(int *)(param_1 + 0x5c) +

                  ((uVar2 >> ((byte)*(undefined4 *)(param_1 + 0x58) & 0x1f) ^ uVar2) &

                  *(uint *)(param_1 + 0x54)) * 4);

  if (iVar1 != 0) {

    while (uVar2 != *(uint *)(iVar1 + 8)) {

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

      if (iVar1 == 0) {

        return 0;

      }

    }

    if (iVar1 + -4 != 0) {

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

      param_2[1] = local_4;

      param_2[2] = 0x3f800000;

      *param_4 = *(byte *)(iVar1 + 0xc) - 1;

      FUN_00525950();

      FUN_005259c0();

      FUN_00523000(param_3,iVar1 + -4,param_2[2]);

      return 1;

    }

  }

  return 0;

}





// --- FUN_00524910 at 0x00524910 (size: 86) ---


void __fastcall FUN_00524910(int param_1)



{

  if (param_1 == 0) {

    return;

  }

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

    FUN_004d8d00(param_1,0,0,0);

  }

  do {

    FUN_004f8040();

  } while( true );

}





// --- FUN_00524970 at 0x00524970 (size: 284) ---


/* WARNING: Removing unreachable block (ram,0x00524a2c) */



void __fastcall FUN_00524970(int param_1)



{

  undefined4 local_c;

  

  FUN_00524910();

  FUN_00524910();

  if (param_1 == -0x80) {

    local_c = 0;

  }

  else {

    local_c = **(int **)(param_1 + 0x8c);

    if (local_c == 0) {

      FUN_004d8d00();

    }

  }

  while( true ) {

    if (local_c == 0) {

      if (param_1 == -0x38) {

        local_c = 0;

      }

      else {

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

        if (local_c == 0) {

          FUN_004d8d00();

        }

      }

      while (local_c != 0) {

        FUN_004f8040();

      }

      return;

    }

    if (*(int *)(local_c + 0xc) != 0) break;

    FUN_004f8040();

  }

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

    FUN_004d8d00();

  }

  do {

    FUN_004f8040();

  } while( true );

}





// --- FUN_00524a90 at 0x00524A90 (size: 35) ---


void FUN_00524a90(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

                 undefined4 param_5)



{

  FUN_00523400(param_1,param_2,param_3,param_4,param_5,0);

  return;

}





// --- thunk_FUN_00523b60 at 0x00524AC0 (size: 5) ---


undefined4

thunk_FUN_00523b60(uint param_1,undefined4 param_2,int *param_3,undefined4 param_4,uint *param_5)



{

  uint *puVar1;

  undefined4 *puVar2;

  uint *puVar3;

  int iVar4;

  

  puVar2 = param_5;

  *param_5 = 0;

  if (((param_1 & 0x40000000) != 0) && (param_1 == param_3[1])) {

    FUN_00523210(*param_3,&param_5);

    FUN_00523400(param_5,param_3,param_4,0x3f800000,puVar2,1);

    return 1;

  }

  if ((param_1 & 0x20000000) != 0) {

    param_5 = (uint *)0x0;

    puVar3 = (uint *)param_3[3];

    while (puVar1 = puVar3, puVar1 != (uint *)0x0) {

      if (*puVar1 == param_1) {

        iVar4 = FUN_005231d0(*param_3 << 0x10 | param_1 & 0xffffff);

        if ((iVar4 == 0) && (iVar4 = FUN_005231d0(param_1 & 0xffffff), iVar4 == 0)) {

          return 0;

        }

        FUN_00523150(param_4,iVar4,puVar1[1]);

        FUN_00526c40(puVar1,param_5);

        return 1;

      }

      param_5 = puVar1;

      puVar3 = (uint *)puVar1[2];

    }

  }

  return 0;

}





// --- FUN_00524ad0 at 0x00524AD0 (size: 123) ---


undefined4 FUN_00524ad0(int param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 uVar3;

  undefined4 local_4;

  

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

  local_4 = 0;

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

    iVar2 = FUN_00523b60(*puVar1,puVar1[1],param_1,param_2,param_3);

    if (iVar2 != 0) {

      local_4 = 1;

    }

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

  }

  iVar2 = FUN_00523b60(*(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 8),param_1,param_2,

                       param_3);

  uVar3 = 1;

  if (iVar2 == 0) {

    uVar3 = local_4;

  }

  return uVar3;

}





// --- FUN_00524b50 at 0x00524B50 (size: 175) ---


void __fastcall FUN_00524b50(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007c6930;

  param_1[0xc] = &PTR_LAB_007c691c;

  FUN_00524970();

  param_1[0x20] = &PTR_FUN_007c6858;

  FUN_00524910();

  param_1[0x20] = &PTR_FUN_007c7450;

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

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

  }

  param_1[0x1a] = &PTR_FUN_007c7450;

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

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

  }

  param_1[0x14] = &PTR_FUN_007c7450;

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

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

  }

  param_1[0xe] = &PTR_FUN_007c6854;

  FUN_00524910();

  param_1[0xe] = &PTR_FUN_007c7450;

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

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

  }

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  return;

}





// --- FUN_00524c00 at 0x00524C00 (size: 31) ---


void __fastcall FUN_00524c00(int param_1)



{

  undefined4 uVar1;

  

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

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

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

  }

  return;

}





// --- FUN_00524c20 at 0x00524C20 (size: 41) ---


void __thiscall FUN_00524c20(int *param_1,int param_2)



{

  param_1[3] = param_2;

  if (*param_1 != 0) {

    FUN_00529530(param_2);

  }

  if (param_1[1] != 0) {

    FUN_00529e40(param_2);

  }

  return;

}





// --- FUN_00524c50 at 0x00524C50 (size: 118) ---


int * FUN_00524c50(int param_1,int param_2)



{

  int *piVar1;

  

  piVar1 = (int *)FUN_005df0f5(0x10);

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

    piVar1 = (int *)0x0;

  }

  else {

    *piVar1 = 0;

    piVar1[1] = 0;

    piVar1[2] = 0;

    piVar1[3] = 0;

  }

  piVar1[2] = param_1;

  if (*piVar1 != 0) {

    FUN_00529580(param_1);

  }

  if (piVar1[1] != 0) {

    FUN_00529e50(param_1);

  }

  piVar1[3] = param_2;

  if (*piVar1 != 0) {

    FUN_00529530(param_2);

  }

  if (piVar1[1] != 0) {

    FUN_00529e40(param_2);

  }

  return piVar1;

}





// --- FUN_00524cd0 at 0x00524CD0 (size: 140) ---


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



{

  int iVar1;

  undefined4 uVar2;

  

  FUN_00510710(1);

  switch(*param_2) {

  case 1:

  case 2:

  case 3:

  case 4:

  case 5:

    break;

  case 6:

  case 7:

  case 8:

  case 9:

    if (param_1[1] == 0) {

      iVar1 = FUN_0052a080(param_1[2],param_1[3]);

      param_1[1] = iVar1;

    }

    uVar2 = FUN_0052b510(param_2);

    return uVar2;

  default:

    return 0x47;

  }

  if (*param_1 == 0) {

    iVar1 = FUN_00529810(param_1[2],param_1[3]);

    *param_1 = iVar1;

    if (param_1[2] != 0) {

      FUN_00529890();

    }

  }

  uVar2 = FUN_00529a90(param_2);

  return uVar2;

}





// --- FUN_00524d70 at 0x00524D70 (size: 56) ---


void __thiscall FUN_00524d70(int *param_1,undefined4 param_2)



{

  int iVar1;

  

  if (*param_1 == 0) {

    iVar1 = FUN_00529810(param_1[2],param_1[3]);

    *param_1 = iVar1;

    if (param_1[2] != 0) {

      FUN_00529890();

    }

  }

  FUN_005295d0(param_2);

  return;

}





// --- FUN_00524db0 at 0x00524DB0 (size: 15) ---


void __fastcall FUN_00524db0(int param_1)



{

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

    FUN_0052a540();

    return;

  }

  return;

}





// --- FUN_00524dc0 at 0x00524DC0 (size: 54) ---


void __fastcall FUN_00524dc0(int *param_1)



{

  int iVar1;

  

  if (param_1[2] != 0) {

    if (*param_1 == 0) {

      iVar1 = FUN_00529810(param_1[2],param_1[3]);

      *param_1 = iVar1;

      if (param_1[2] != 0) {

        FUN_00529890();

      }

    }

    FUN_00529890();

    return;

  }

  return;

}





// --- FUN_00524e00 at 0x00524E00 (size: 47) ---


int __fastcall FUN_00524e00(int *param_1)



{

  int iVar1;

  

  if (*param_1 == 0) {

    iVar1 = FUN_00529810(param_1[2],param_1[3]);

    *param_1 = iVar1;

    if (param_1[2] != 0) {

      FUN_00529890();

    }

  }

  return *param_1 + 0xc;

}





// --- FUN_00524e30 at 0x00524E30 (size: 47) ---


int __fastcall FUN_00524e30(int *param_1)



{

  int iVar1;

  

  if (*param_1 == 0) {

    iVar1 = FUN_00529810(param_1[2],param_1[3]);

    *param_1 = iVar1;

    if (param_1[2] != 0) {

      FUN_00529890();

    }

  }

  return *param_1 + 0x44;

}





// --- FUN_00524e60 at 0x00524E60 (size: 25) ---


undefined4 __fastcall FUN_00524e60(int param_1)



{

  int iVar1;

  

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

    iVar1 = FUN_00529e30();

    if (iVar1 != 0) {

      return 1;

    }

  }

  return 0;

}





// --- FUN_00524e80 at 0x00524E80 (size: 24) ---


undefined4 __fastcall FUN_00524e80(int *param_1)



{

  int iVar1;

  

  if (*param_1 != 0) {

    iVar1 = FUN_00528bf0();

    if (iVar1 != 0) {

      return 1;

    }

  }

  return 0;

}





// --- FUN_00524ea0 at 0x00524EA0 (size: 44) ---


int __fastcall FUN_00524ea0(int *param_1)



{

  int iVar1;

  

  if (*param_1 == 0) {

    iVar1 = FUN_00529810(param_1[2],param_1[3]);

    *param_1 = iVar1;

    if (param_1[2] != 0) {

      FUN_00529890();

    }

  }

  return *param_1;

}





// --- FUN_00524ed0 at 0x00524ED0 (size: 19) ---


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



{

  if (*param_1 != 0) {

    FUN_00528ad0(param_3);

  }

  return;

}





// --- FUN_00524ef0 at 0x00524EF0 (size: 13) ---


void __fastcall FUN_00524ef0(int param_1)



{

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

    FUN_0052b390();

    return;

  }

  return;

}





// --- FUN_00524f00 at 0x00524F00 (size: 28) ---


void __fastcall FUN_00524f00(int *param_1)



{

  if (*param_1 != 0) {

    FUN_005296d0();

  }

  if (param_1[1] != 0) {

    FUN_0052a980();

    return;

  }

  return;

}





// --- FUN_00524f20 at 0x00524F20 (size: 28) ---


void __fastcall FUN_00524f20(int *param_1)



{

  if (*param_1 != 0) {

    FUN_00529710();

  }

  if (param_1[1] != 0) {

    FUN_00695670();

    return;

  }

  return;

}





// --- FUN_00524f40 at 0x00524F40 (size: 12) ---


void __fastcall FUN_00524f40(int *param_1)



{

  if (*param_1 != 0) {

    FUN_00695670();

    return;

  }

  return;

}





// --- FUN_00524f50 at 0x00524F50 (size: 12) ---


void __fastcall FUN_00524f50(int *param_1)



{

  if (*param_1 != 0) {

    FUN_00528b40();

    return;

  }

  return;

}





// --- FUN_00524f60 at 0x00524F60 (size: 28) ---


void __fastcall FUN_00524f60(int *param_1)



{

  if (*param_1 != 0) {

    FUN_005294e0();

  }

  if (param_1[1] != 0) {

    FUN_00695670();

    return;

  }

  return;

}





// --- FUN_00524f80 at 0x00524F80 (size: 104) ---


void __fastcall FUN_00524f80(undefined4 *param_1)



{

  undefined4 uVar1;

  undefined4 uVar2;

  

  uVar1 = DAT_007c916c;

  param_1[3] = DAT_007c9168;

  uVar2 = DAT_007c9174;

  param_1[2] = uVar1;

  param_1[6] = uVar2;

  uVar1 = DAT_007c9170;

  *param_1 = &PTR_FUN_007c91c0;

  param_1[4] = 0;

  param_1[5] = 0x3f800000;

  param_1[7] = uVar1;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  if (DAT_008454f8 != 0) {

    param_1[1] = DAT_008454f8;

    return;

  }

  DAT_008454f8 = param_1[1] & 0xfffdee0f | 0x1ee0f;

  param_1[1] = DAT_008454f8;

  return;

}





// --- FUN_00524ff0 at 0x00524FF0 (size: 65) ---


void __fastcall FUN_00524ff0(undefined4 *param_1)



{

  void *pvVar1;

  

  pvVar1 = (void *)*param_1;

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

    FUN_00528c00();

    operator_delete(pvVar1);

  }

  pvVar1 = (void *)param_1[1];

  *param_1 = 0;

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

    FUN_0052a5e0();

    operator_delete(pvVar1);

  }

  param_1[1] = 0;

  return;

}





// --- FUN_00525040 at 0x00525040 (size: 803) ---


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



{

  ushort uVar1;

  ushort uVar2;

  ushort *puVar3;

  undefined4 *puVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  int iVar7;

  int iVar8;

  undefined1 local_9c [16];

  undefined4 local_8c;

  undefined **local_70;

  undefined4 local_6c;

  undefined4 local_68;

  undefined4 local_64;

  undefined4 local_60;

  undefined4 local_5c;

  undefined4 local_34;

  undefined4 local_30;

  undefined4 local_2c;

  undefined1 local_28 [40];

  

  if ((*param_1 == 0) || (param_1[2] == 0)) {

    return 0;

  }

  FUN_00510cc0();

  FUN_0050f5b0();

  local_70 = &PTR_LAB_00797910;

  local_6c = 0;

  local_68 = 0x3f800000;

  local_64 = 0;

  local_60 = 0;

  local_5c = 0;

  local_34 = 0;

  local_30 = 0;

  local_2c = 0;

  FUN_00535b30();

  FUN_00524f80();

  FUN_0051f3e0();

  puVar3 = (ushort *)*param_2;

  uVar1 = *puVar3;

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

  uVar2 = puVar3[1];

  *param_2 = (int)(puVar3 + 2);

  iVar8 = *(int *)(&DAT_007c8af0 + (uint)uVar2 * 4);

  iVar7 = FUN_00528720();

  if (iVar7 != iVar8) {

    FUN_00529930(iVar8,local_9c);

  }

  switch(uVar1 & 0xff) {

  case 0:

    FUN_0051ff10(param_2,param_3);

    if ((uVar1 & 0x100) == 0) {

      iVar8 = 0;

    }

    else {

      iVar8 = *(int *)*param_2;

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

    }

    FUN_00524d70(local_28);

    if (iVar8 != 0) {

      FUN_005132e0(iVar8);

    }

    *(uint *)(*param_1 + 0x70) = uVar1 & 0x200;

    FUN_0051fcc0();

    return 1;

  default:

    FUN_0051fcc0();

    return 0;

  case 6:

    FUN_00524c00();

    uVar6 = *(undefined4 *)*param_2;

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

    FUN_005aa840(param_2,param_3);

    FUN_0052b860(6,param_2,param_3);

    uVar5 = *(undefined4 *)*param_2;

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

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

    iVar8 = FUN_0050ff60(uVar6);

    if (iVar8 != 0) {

      FUN_00513360(uVar6,local_9c);

      FUN_0051fcc0();

      return 1;

    }

    break;

  case 7:

    FUN_00524c00();

    FUN_005aa840(param_2,param_3);

    FUN_0052b860(7,param_2,param_3);

    uVar5 = *(undefined4 *)*param_2;

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

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

    break;

  case 8:

    FUN_00524c00();

    puVar4 = (undefined4 *)*param_2;

    uVar5 = *puVar4;

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

    uVar6 = puVar4[1];

    *param_2 = (int)(puVar4 + 2);

    FUN_0052b860(8,param_2,param_3);

    iVar8 = FUN_0050ff60(uVar5);

    local_8c = uVar6;

    if (iVar8 != 0) {

      FUN_00513440(uVar5,local_9c);

      FUN_0051fcc0();

      return 1;

    }

    goto LAB_00525322;

  case 9:

    FUN_00524c00();

    FUN_0052b860(9,param_2,param_3);

LAB_00525322:

    FUN_0052b240(local_9c);

    FUN_0051fcc0();

    return 1;

  }

  FUN_0052ae50(&local_70,local_9c);

  FUN_0051fcc0();

  return 1;

}





// --- FUN_00525390 at 0x00525390 (size: 20) ---


void __fastcall FUN_00525390(int param_1)



{

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

    FUN_0052b3e0(&stack0x00000004);

  }

  return;

}





// --- FUN_005253b0 at 0x005253B0 (size: 39) ---


void FUN_005253b0(undefined4 param_1,undefined4 param_2)



{

  undefined4 uVar1;

  

  floor((double)CONCAT44(param_2,param_1));

  uVar1 = FUN_005df4c4();

  FUN_00526810(uVar1);

  return;

}





// --- FUN_00525400 at 0x00525400 (size: 8) ---


undefined4 FUN_00525400(void)



{

  return 1;

}





// --- FUN_00525410 at 0x00525410 (size: 6) ---


undefined4 FUN_00525410(void)



{

  return 4;

}





// --- FUN_00525420 at 0x00525420 (size: 10) ---


void __thiscall FUN_00525420(int param_1,undefined4 param_2)



{

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

  return;

}





// --- FUN_00525430 at 0x00525430 (size: 62) ---


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



{

  int iVar1;

  

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

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

      if ((*(int *)(iVar1 + 8) == 0) || (param_3 == *(int *)(iVar1 + 8))) {

        FUN_00515720(iVar1);

      }

    }

  }

  return;

}





// --- FUN_00525480 at 0x00525480 (size: 26) ---


void __thiscall FUN_00525480(int param_1,undefined4 *param_2)



{

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

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

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

  return;

}





// --- FUN_005254a0 at 0x005254A0 (size: 26) ---


void __thiscall FUN_005254a0(int param_1,undefined4 *param_2)



{

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

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

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

  return;

}





// --- FUN_005254c0 at 0x005254C0 (size: 63) ---


void __thiscall FUN_005254c0(int param_1,float *param_2,float *param_3)



{

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

  *(float *)(param_1 + 0x14) = param_2[1] + *(float *)(param_1 + 0x14);

  *(float *)(param_1 + 0x18) = param_2[2] + *(float *)(param_1 + 0x18);

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

  *(float *)(param_1 + 0x20) = param_3[1] + *(float *)(param_1 + 0x20);

  *(float *)(param_1 + 0x24) = param_3[2] + *(float *)(param_1 + 0x24);

  return;

}





// --- FUN_00525500 at 0x00525500 (size: 63) ---


void __thiscall FUN_00525500(int param_1,float *param_2,float *param_3)



{

  *(float *)(param_1 + 0x10) = *(float *)(param_1 + 0x10) - *param_2;

  *(float *)(param_1 + 0x14) = *(float *)(param_1 + 0x14) - param_2[1];

  *(float *)(param_1 + 0x18) = *(float *)(param_1 + 0x18) - param_2[2];

  *(float *)(param_1 + 0x1c) = *(float *)(param_1 + 0x1c) - *param_3;

  *(float *)(param_1 + 0x20) = *(float *)(param_1 + 0x20) - param_3[1];

  *(float *)(param_1 + 0x24) = *(float *)(param_1 + 0x24) - param_3[2];

  return;

}





// --- FUN_00525540 at 0x00525540 (size: 42) ---


void __thiscall FUN_00525540(int param_1,undefined4 param_2)



{

  int iVar1;

  

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

  while (iVar1 != 0) {

    FUN_005267e0(param_2);

    iVar1 = FUN_005269e0();

  }

  return;

}





// --- FUN_00525570 at 0x00525570 (size: 64) ---


undefined4 __fastcall FUN_00525570(int param_1)



{

  undefined4 uVar1;

  

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

    floor(*(double *)(param_1 + 0x30));

    uVar1 = FUN_005df4c4();

    uVar1 = FUN_00526840(uVar1);

    return uVar1;

  }

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

}





// --- FUN_005255b0 at 0x005255B0 (size: 17) ---


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



{

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

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

  return;

}





// --- FUN_005255d0 at 0x005255D0 (size: 22) ---


void __fastcall FUN_005255d0(int param_1)



{

  floor(*(double *)(param_1 + 0x30));

  FUN_005df4c4();

  return;

}





// --- FUN_005255f0 at 0x005255F0 (size: 59) ---


void __fastcall FUN_005255f0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007c92a0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  return;

}





// --- FUN_00525630 at 0x00525630 (size: 116) ---


void __fastcall FUN_00525630(undefined4 *param_1)



{

  int iVar1;

  int *piVar2;

  undefined4 *puVar3;

  

  iVar1 = param_1[1];

  *param_1 = &PTR_FUN_007c92a0;

  while (iVar1 != 0) {

    piVar2 = (int *)param_1[1];

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

      if ((int *)piVar2[1] == (int *)0x0) {

        iVar1 = *piVar2;

        param_1[1] = iVar1;

        if (iVar1 != 0) {

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

        }

      }

      else {

        *(int *)piVar2[1] = *piVar2;

      }

      if (*piVar2 == 0) {

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

        param_1[2] = puVar3;

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

          *puVar3 = 0;

        }

      }

      else {

        *(int *)(*piVar2 + 4) = piVar2[1];

      }

      *piVar2 = 0;

      piVar2[1] = 0;

      if ((piVar2 != (int *)0x0) && (piVar2 + -1 != (int *)0x0)) {

        (**(code **)piVar2[-1])(1);

      }

    }

    iVar1 = param_1[1];

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005256b0 at 0x005256B0 (size: 136) ---


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



void __thiscall FUN_005256b0(int param_1,int param_2,double param_3,double param_4)



{

  float fVar1;

  float fVar2;

  float local_18;

  float local_14;

  float local_10;

  float local_4;

  

  local_10 = ABS((float)param_3);

  if (param_4 < _DAT_00795610) {

    local_10 = -local_10;

  }

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

  fVar2 = *(float *)(param_1 + 0x18);

  *(float *)(param_2 + 0x34) = local_10 * *(float *)(param_1 + 0x10) + *(float *)(param_2 + 0x34);

  *(float *)(param_2 + 0x38) = local_10 * fVar1 + *(float *)(param_2 + 0x38);

  *(float *)(param_2 + 0x3c) = local_10 * fVar2 + *(float *)(param_2 + 0x3c);

  local_18 = local_10 * *(float *)(param_1 + 0x1c);

  local_14 = local_10 * *(float *)(param_1 + 0x20);

  local_10 = local_10 * *(float *)(param_1 + 0x24);

  local_4 = local_10;

  FUN_004525f0(&local_18);

  return;

}





// --- FUN_00525740 at 0x00525740 (size: 143) ---


void __fastcall FUN_00525740(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  int *piVar3;

  undefined4 *puVar4;

  

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

    puVar4 = (undefined4 *)0x0;

  }

  else {

    puVar4 = (undefined4 *)(*(int *)(param_1 + 4) + -4);

  }

  if (puVar4 != *(undefined4 **)(param_1 + 0x38)) {

    do {

      if (puVar4 == *(undefined4 **)(param_1 + 0xc)) {

        return;

      }

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

        piVar3 = (int *)0x0;

      }

      else {

        piVar3 = puVar4 + 1;

      }

      if ((int *)piVar3[1] == (int *)0x0) {

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

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

        if (iVar1 != 0) {

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

        }

      }

      else {

        *(int *)piVar3[1] = *piVar3;

      }

      if (*piVar3 == 0) {

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

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

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

          *puVar2 = 0;

        }

      }

      else {

        *(int *)(*piVar3 + 4) = piVar3[1];

      }

      *piVar3 = 0;

      piVar3[1] = 0;

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

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

      }

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

        puVar4 = (undefined4 *)0x0;

      }

      else {

        puVar4 = (undefined4 *)(*(int *)(param_1 + 4) + -4);

      }

    } while (puVar4 != *(undefined4 **)(param_1 + 0x38));

  }

  return;

}





// --- FUN_005257d0 at 0x005257D0 (size: 11) ---


bool __fastcall FUN_005257d0(int param_1)



{

  return *(int *)(param_1 + 4) != 0;

}





// --- FUN_005257e0 at 0x005257E0 (size: 12) ---


void __thiscall FUN_005257e0(int param_1,uint param_2)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 *puVar3;

  int *piVar4;

  uint uVar5;

  float10 fVar6;

  

  uVar5 = 0;

  if (param_2 != 0) {

    do {

      iVar2 = FUN_005269f0();

      if (iVar2 == 0) {

        return;

      }

      iVar2 = FUN_005269f0();

      if ((iVar2 == *(int *)(param_1 + 0x38)) &&

         (*(int *)(param_1 + 0x38) = *(int *)(param_1 + 0xc), *(int *)(param_1 + 0xc) != 0)) {

        fVar6 = (float10)FUN_00526880();

        *(double *)(param_1 + 0x30) = (double)fVar6;

      }

      puVar3 = (undefined4 *)FUN_005269f0();

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

        piVar4 = (int *)0x0;

      }

      else {

        piVar4 = puVar3 + 1;

      }

      if ((int *)piVar4[1] == (int *)0x0) {

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

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

        if (iVar2 != 0) {

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

        }

      }

      else {

        *(int *)piVar4[1] = *piVar4;

      }

      if (*piVar4 == 0) {

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

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

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

          *puVar1 = 0;

        }

      }

      else {

        *(int *)(*piVar4 + 4) = piVar4[1];

      }

      *piVar4 = 0;

      piVar4[1] = 0;

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

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

      }

      uVar5 = uVar5 + 1;

    } while (uVar5 < param_2);

  }

  return;

}





// --- FUN_005257ec at 0x005257EC (size: 170) ---


void __thiscall FUN_005257ec(int param_1,undefined4 param_2,undefined4 param_3,uint param_4)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  undefined4 *unaff_EBX;

  uint unaff_EBP;

  bool in_CF;

  bool in_ZF;

  float10 fVar5;

  

  if (!in_CF && !in_ZF) {

    do {

      iVar2 = FUN_005269f0();

      if (iVar2 == 0) {

        return;

      }

      iVar2 = FUN_005269f0();

      if ((iVar2 == *(int *)(param_1 + 0x38)) &&

         (*(undefined4 **)(param_1 + 0x38) = *(undefined4 **)(param_1 + 0xc),

         *(undefined4 **)(param_1 + 0xc) != unaff_EBX)) {

        fVar5 = (float10)FUN_00526880();

        *(double *)(param_1 + 0x30) = (double)fVar5;

      }

      puVar3 = (undefined4 *)FUN_005269f0();

      if (puVar3 == unaff_EBX) {

        puVar4 = (undefined4 *)0x0;

      }

      else {

        puVar4 = puVar3 + 1;

      }

      if ((undefined4 *)puVar4[1] == unaff_EBX) {

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

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

        if (puVar1 != unaff_EBX) {

          puVar1[1] = unaff_EBX;

        }

      }

      else {

        *(undefined4 *)puVar4[1] = *puVar4;

      }

      if ((undefined4 *)*puVar4 == unaff_EBX) {

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

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

        if (puVar1 != unaff_EBX) {

          *puVar1 = unaff_EBX;

        }

      }

      else {

        ((undefined4 *)*puVar4)[1] = puVar4[1];

      }

      *puVar4 = unaff_EBX;

      puVar4[1] = unaff_EBX;

      if (puVar3 != unaff_EBX) {

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

      }

      unaff_EBP = unaff_EBP + 1;

    } while (unaff_EBP < param_4);

  }

  return;

}





// --- FUN_005258a0 at 0x005258A0 (size: 176) ---


void __fastcall FUN_005258a0(int param_1)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 *puVar3;

  int *piVar4;

  float10 fVar5;

  

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

    iVar2 = FUN_005269f0();

    while (iVar2 != 0) {

      iVar2 = FUN_005269f0();

      if ((iVar2 == *(int *)(param_1 + 0x38)) &&

         (*(int *)(param_1 + 0x38) = *(int *)(param_1 + 0xc), *(int *)(param_1 + 0xc) != 0)) {

        fVar5 = (float10)FUN_00526880();

        *(double *)(param_1 + 0x30) = (double)fVar5;

      }

      puVar3 = (undefined4 *)FUN_005269f0();

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

        piVar4 = (int *)0x0;

      }

      else {

        piVar4 = puVar3 + 1;

      }

      if ((int *)piVar4[1] == (int *)0x0) {

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

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

        if (iVar2 != 0) {

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

        }

      }

      else {

        *(int *)piVar4[1] = *piVar4;

      }

      if (*piVar4 == 0) {

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

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

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

          *puVar1 = 0;

        }

      }

      else {

        *(int *)(*piVar4 + 4) = piVar4[1];

      }

      *piVar4 = 0;

      piVar4[1] = 0;

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

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

      }

      iVar2 = FUN_005269f0();

    }

  }

  return;

}





// --- FUN_00525950 at 0x00525950 (size: 101) ---


void __fastcall FUN_00525950(int param_1)



{

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

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

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

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

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

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

  return;

}





// --- FUN_005259c0 at 0x005259C0 (size: 119) ---


void __fastcall FUN_005259c0(int param_1)



{

  int iVar1;

  int *piVar2;

  undefined4 *puVar3;

  

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

  while (iVar1 != 0) {

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

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

      if ((int *)piVar2[1] == (int *)0x0) {

        iVar1 = *piVar2;

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

        if (iVar1 != 0) {

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

        }

      }

      else {

        *(int *)piVar2[1] = *piVar2;

      }

      if (*piVar2 == 0) {

        puVar3 = *(undefined4 **)(*(int *)(param_1 + 8) + 4);

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

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

          *puVar3 = 0;

        }

      }

      else {

        *(int *)(*piVar2 + 4) = piVar2[1];

      }

      *piVar2 = 0;

      piVar2[1] = 0;

      if ((piVar2 != (int *)0x0) && (piVar2 + -1 != (int *)0x0)) {

        (**(code **)piVar2[-1])(1);

      }

    }

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

  }

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

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

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

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

  return;

}





// --- FUN_00525a40 at 0x00525A40 (size: 209) ---


void __fastcall FUN_00525a40(int param_1)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  int iVar3;

  undefined4 *puVar4;

  int *piVar5;

  float10 fVar6;

  

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

  while (puVar2 = puVar4, puVar2 != (undefined4 *)0x0) {

    if (*(undefined4 **)(param_1 + 0x38) == puVar2) {

      iVar3 = FUN_005269f0();

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

      if (iVar3 == 0) {

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

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

      }

      else {

        fVar6 = (float10)FUN_005268b0();

        *(double *)(param_1 + 0x30) = (double)fVar6;

      }

    }

    puVar4 = (undefined4 *)FUN_005269e0();

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

      piVar5 = (int *)0x0;

    }

    else {

      piVar5 = puVar2 + 1;

    }

    if ((int *)piVar5[1] == (int *)0x0) {

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

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

      if (iVar3 != 0) {

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

      }

    }

    else {

      *(int *)piVar5[1] = *piVar5;

    }

    if (*piVar5 == 0) {

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

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

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

        *puVar1 = 0;

      }

    }

    else {

      *(int *)(*piVar5 + 4) = piVar5[1];

    }

    *piVar5 = 0;

    piVar5[1] = 0;

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

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

    }

  }

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

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

    return;

  }

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 8) + -4;

  return;

}





// --- FUN_00525b20 at 0x00525B20 (size: 244) ---


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



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



{

  int *piVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  

  piVar1 = param_3;

  *param_2 = 0;

  *param_3 = 0;

  param_3 = (int *)0x0;

  iVar4 = 4;

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

     (piVar3 = (int *)(*(int *)(param_1 + 4) + -4), piVar3 != (int *)0x0)) {

    do {

      iVar2 = (**(code **)(*piVar3 + 0xc))(&param_3,0);

      iVar4 = iVar4 + iVar2;

      *piVar1 = *piVar1 + 1;

      piVar3 = (int *)FUN_005269e0();

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

    if (*piVar1 != 0) {

      iVar4 = iVar4 + 0x10;

      goto LAB_00525b88;

    }

  }

  iVar4 = iVar4 + 4;

LAB_00525b88:

  iVar2 = iVar4 + 4;

  if (((ABS(*(float *)(param_1 + 0x10)) < _DAT_007c9264 ==

        (ABS(*(float *)(param_1 + 0x10)) == _DAT_007c9264)) ||

      (ABS(*(float *)(param_1 + 0x14)) < _DAT_007c9264 ==

       (ABS(*(float *)(param_1 + 0x14)) == _DAT_007c9264))) ||

     (ABS(*(float *)(param_1 + 0x18)) < _DAT_007c9264 ==

      (ABS(*(float *)(param_1 + 0x18)) == _DAT_007c9264))) {

    iVar2 = iVar4 + 0x10;

    *param_2 = *param_2 | 1;

  }

  if (((ABS(*(float *)(param_1 + 0x1c)) < _DAT_007c9264 ==

        (ABS(*(float *)(param_1 + 0x1c)) == _DAT_007c9264)) ||

      (ABS(*(float *)(param_1 + 0x20)) < _DAT_007c9264 ==

       (ABS(*(float *)(param_1 + 0x20)) == _DAT_007c9264))) ||

     (ABS(*(float *)(param_1 + 0x24)) < _DAT_007c9264 ==

      (ABS(*(float *)(param_1 + 0x24)) == _DAT_007c9264))) {

    iVar2 = iVar2 + 0xc;

    *param_2 = *param_2 | 2;

  }

  return iVar2;

}





// --- FUN_00525d80 at 0x00525D80 (size: 267) ---


void __thiscall FUN_00525d80(int param_1,float *param_2,float *param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float fVar7;

  float fVar8;

  float fVar9;

  float fVar10;

  float fVar11;

  float fVar12;

  float fVar13;

  float fVar14;

  

  fVar1 = param_2[0xb];

  fVar2 = param_3[2];

  fVar3 = param_2[5];

  fVar4 = *param_3;

  fVar5 = param_2[8];

  fVar6 = param_3[1];

  fVar7 = param_2[0xe];

  fVar8 = param_2[0xc];

  fVar9 = param_3[2];

  fVar10 = param_2[6];

  fVar11 = *param_3;

  fVar12 = param_2[9];

  fVar13 = param_3[1];

  fVar14 = param_2[0xf];

  *(float *)(param_1 + 0x34) =

       param_2[7] * param_3[1] + param_2[4] * *param_3 + param_2[10] * param_3[2] + param_2[0xd];

  *(float *)(param_1 + 0x38) = fVar5 * fVar6 + fVar3 * fVar4 + fVar1 * fVar2 + fVar7;

  *(float *)(param_1 + 0x3c) = fVar12 * fVar13 + fVar10 * fVar11 + fVar8 * fVar9 + fVar14;

  FUN_00535dc0(((*param_2 * param_3[3] - param_2[1] * param_3[4]) - param_3[5] * param_2[2]) -

               param_3[6] * param_2[3],

               (param_3[6] * param_2[2] + *param_2 * param_3[4] + param_2[1] * param_3[3]) -

               param_3[5] * param_2[3],

               param_2[2] * param_3[3] +

               param_2[3] * param_3[4] + (param_3[5] * *param_2 - param_2[1] * param_3[6]),

               param_2[3] * param_3[3] +

               ((param_3[6] * *param_2 + param_2[1] * param_3[5]) - param_2[2] * param_3[4]));

  return;

}





// --- FUN_00525e90 at 0x00525E90 (size: 30) ---


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



{

  FUN_00525630();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00525eb0 at 0x00525EB0 (size: 605) ---


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



void __thiscall

FUN_00525eb0(int param_1,undefined4 param_2,undefined4 param_3,int *param_4,double *param_5,

            int param_6)



{

  undefined4 uVar1;

  int iVar2;

  float10 fVar3;

  undefined4 uVar4;

  

  if ((double)CONCAT44(param_3,param_2) < _DAT_00795610) {

    fVar3 = (float10)FUN_0069eda0();

    if (((float10)DAT_00796344 <= fVar3) && (param_6 != 0)) {

      if (*(int *)(*(int *)(*param_4 + 0xc) + 0x38) != 0) {

        uVar1 = FUN_005253b0(*(undefined4 *)param_5,*(undefined4 *)((int)param_5 + 4));

        FUN_00536260(param_6,uVar1);

      }

      fVar3 = (float10)FUN_0069eda0();

      if ((float10)_DAT_007c9264 < ABS(fVar3)) {

        uVar1 = param_2;

        uVar4 = param_3;

        fVar3 = (float10)FUN_0069eda0(param_2,param_3);

        FUN_005256b0(param_6,(double)((float10)_DAT_007938c0 / fVar3),uVar1,uVar4);

      }

    }

    iVar2 = FUN_005269f0();

    if (iVar2 == 0) {

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

        iVar2 = 0;

      }

      else {

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

      }

    }

    else {

      iVar2 = FUN_005269f0();

    }

    *param_4 = iVar2;

    fVar3 = (float10)FUN_005268b0();

    *param_5 = (double)fVar3;

    fVar3 = (float10)FUN_0069eda0();

    if ((float10)DAT_00796344 <= fVar3) {

      return;

    }

    if (param_6 == 0) {

      return;

    }

    if (*(int *)(*(int *)(*param_4 + 0xc) + 0x38) != 0) {

      uVar1 = FUN_005253b0(*(undefined4 *)param_5,*(undefined4 *)((int)param_5 + 4));

      FUN_00525d80(param_6,uVar1);

    }

    fVar3 = (float10)FUN_0069eda0();

    if (ABS(fVar3) <= (float10)_DAT_007c9264) {

      return;

    }

  }

  else {

    fVar3 = (float10)FUN_0069eda0();

    if ((fVar3 < (float10)DAT_00796344) && (param_6 != 0)) {

      if (*(int *)(*(int *)(*param_4 + 0xc) + 0x38) != 0) {

        uVar1 = FUN_005253b0(*(undefined4 *)param_5,*(undefined4 *)((int)param_5 + 4));

        FUN_00536260(param_6,uVar1);

      }

      fVar3 = (float10)FUN_0069eda0();

      if ((float10)_DAT_007c9264 < ABS(fVar3)) {

        uVar1 = param_2;

        uVar4 = param_3;

        fVar3 = (float10)FUN_0069eda0(param_2,param_3);

        FUN_005256b0(param_6,(double)((float10)_DAT_007938c0 / fVar3),uVar1,uVar4);

      }

    }

    iVar2 = FUN_005269e0();

    if (iVar2 == 0) {

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

    }

    else {

      iVar2 = FUN_005269e0();

      *param_4 = iVar2;

    }

    fVar3 = (float10)FUN_00526880();

    *param_5 = (double)fVar3;

    fVar3 = (float10)FUN_0069eda0();

    if (fVar3 <= (float10)DAT_00796344) {

      return;

    }

    if (param_6 == 0) {

      return;

    }

    if (*(int *)(*(int *)(*param_4 + 0xc) + 0x38) != 0) {

      uVar1 = FUN_005253b0(*(undefined4 *)param_5,*(undefined4 *)((int)param_5 + 4));

      FUN_00525d80(param_6,uVar1);

    }

    fVar3 = (float10)FUN_0069eda0();

    if (ABS(fVar3) <= (float10)_DAT_007c9264) {

      return;

    }

  }

  fVar3 = (float10)FUN_0069eda0(param_2,param_3);

  FUN_005256b0(param_6,(double)((float10)_DAT_007938c0 / fVar3),param_2,param_3);

  return;

}





// --- FUN_00526110 at 0x00526110 (size: 160) ---


void __thiscall FUN_00526110(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 *puVar2;

  float10 fVar3;

  

  iVar1 = FUN_005df0f5(0x1c);

  if (iVar1 == 0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    puVar2 = (undefined4 *)FUN_00526b90(param_2);

  }

  iVar1 = FUN_00526870();

  if (iVar1 == 0) {

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

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

      return;

    }

  }

  else {

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

      puVar2 = (undefined4 *)0x0;

    }

    else {

      puVar2 = puVar2 + 1;

    }

    FUN_00410820(puVar2,*(undefined4 *)(param_1 + 8));

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

      iVar1 = 0;

    }

    else {

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

    }

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

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

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

        *(int *)(param_1 + 0x38) = *(int *)(param_1 + 4) + -4;

        fVar3 = (float10)FUN_00526880();

        *(double *)(param_1 + 0x30) = (double)fVar3;

        return;

      }

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

      fVar3 = (float10)FUN_00526880();

      *(double *)(param_1 + 0x30) = (double)fVar3;

    }

  }

  return;

}





// --- FUN_005261b0 at 0x005261B0 (size: 25) ---


void __fastcall FUN_005261b0(int param_1)



{

  FUN_005259c0();

  FUN_00525950();

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

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

  return;

}





// --- FUN_005261d0 at 0x005261D0 (size: 1021) ---


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



void __thiscall

FUN_005261d0(int param_1,undefined4 param_2,undefined4 param_3,int *param_4,double *param_5,

            int param_6)



{

  double dVar1;

  double _X;

  bool bVar2;

  int iVar3;

  int iVar4;

  undefined4 uVar5;

  float10 fVar6;

  double dVar7;

  undefined4 uVar8;

  undefined8 local_18;

  

  while( true ) {

    fVar6 = (float10)FUN_0069eda0();

    dVar1 = (double)fVar6;

    dVar7 = (double)(fVar6 * (float10)(double)CONCAT44(param_3,param_2));

    bVar2 = false;

    floor(*param_5);

    iVar3 = FUN_005df4c4();

    _X = dVar7 + *param_5;

    local_18 = 0.0;

    *param_5 = _X;

    if (dVar7 <= _DAT_00795610) {

      if (_DAT_00795610 <= dVar7) {

        if ((param_6 != 0) && ((double)_DAT_007c9264 < ABS((double)CONCAT44(param_3,param_2)))) {

          FUN_005256b0(param_6,param_2,param_3,param_2,param_3);

        }

        return;

      }

      dVar7 = floor(_X);

      iVar4 = FUN_004f32b0();

      if (dVar7 < (double)iVar4) {

        iVar4 = FUN_004f32b0();

        local_18 = *param_5 - (double)iVar4;

        if (_DAT_00795610 < *param_5 - (double)iVar4) {

          local_18 = _DAT_00795610;

        }

        if (ABS(dVar1) <= (double)_DAT_007c9264) {

          local_18 = 0.0;

        }

        else {

          local_18 = local_18 / dVar1;

        }

        iVar4 = FUN_004f32b0();

        bVar2 = true;

        *param_5 = (double)iVar4;

      }

      dVar7 = floor(*param_5);

      if (dVar7 < (double)iVar3) {

        do {

          if (param_6 != 0) {

            if (*(int *)(*(int *)(*param_4 + 0xc) + 0x38) != 0) {

              uVar5 = FUN_00526810(iVar3);

              FUN_00536260(param_6,uVar5);

            }

            if ((double)_DAT_007c9264 < ABS(dVar1)) {

              FUN_005256b0(param_6,_DAT_007938c0 / dVar1,param_2,param_3);

            }

          }

          uVar8 = 0xffffffff;

          uVar5 = FUN_00526840(iVar3);

          FUN_00525430(uVar5,uVar8);

          iVar3 = iVar3 + -1;

          dVar7 = floor(*param_5);

        } while (dVar7 < (double)iVar3);

      }

    }

    else {

      dVar7 = floor(_X);

      iVar4 = FUN_004f24e0();

      if ((double)iVar4 < dVar7) {

        iVar4 = FUN_004f24e0();

        local_18 = (*param_5 - (double)iVar4) - _DAT_007938c0;

        if (local_18 < _DAT_00795610) {

          local_18 = _DAT_00795610;

        }

        if (ABS(dVar1) <= (double)_DAT_007c9264) {

          local_18 = 0.0;

        }

        else {

          local_18 = local_18 / dVar1;

        }

        iVar4 = FUN_004f24e0();

        bVar2 = true;

        *param_5 = (double)iVar4;

      }

      dVar7 = floor(*param_5);

      if ((double)iVar3 < dVar7) {

        do {

          if (param_6 != 0) {

            if (*(int *)(*(int *)(*param_4 + 0xc) + 0x38) != 0) {

              uVar5 = FUN_00526810(iVar3);

              FUN_00525d80(param_6,uVar5);

            }

            if ((double)_DAT_007c9264 < ABS(dVar1)) {

              FUN_005256b0(param_6,_DAT_007938c0 / dVar1,param_2,param_3);

            }

          }

          uVar8 = 1;

          uVar5 = FUN_00526840(iVar3);

          FUN_00525430(uVar5,uVar8);

          iVar3 = iVar3 + 1;

          dVar7 = floor(*param_5);

        } while ((double)iVar3 < dVar7);

      }

    }

    if (!bVar2) break;

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

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

        iVar3 = 0;

      }

      else {

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

      }

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

        FUN_00515720(&PTR_PTR_0081ea0c);

      }

    }

    FUN_00525eb0(param_2,param_3,param_4,param_5,param_6);

    param_2 = (undefined4)local_18;

    param_3 = local_18._4_4_;

  }

  return;

}





// --- FUN_00526780 at 0x00526780 (size: 83) ---


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



{

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

    FUN_005261d0(param_2,param_3,param_1 + 0x38,param_1 + 0x30,param_4);

    FUN_00525740();

    return;

  }

  if (param_4 != 0) {

    FUN_005256b0(param_4,param_2,param_3,param_2,param_3);

  }

  return;

}





// --- FUN_005267e0 at 0x005267E0 (size: 42) ---


void __thiscall FUN_005267e0(int param_1,float param_2)



{

  undefined4 uVar1;

  

  if (param_2 < DAT_00796344) {

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

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

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

  }

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

  return;

}





// --- FUN_00526810 at 0x00526810 (size: 36) ---


int __thiscall FUN_00526810(int param_1,int param_2)



{

  int iVar1;

  

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

  if (((iVar1 != 0) && (-1 < param_2)) && (param_2 < *(int *)(iVar1 + 0x48))) {

    return param_2 * 0x1c + *(int *)(iVar1 + 0x38);

  }

  return 0;

}





// --- FUN_00526840 at 0x00526840 (size: 36) ---


int __thiscall FUN_00526840(int param_1,int param_2)



{

  int iVar1;

  

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

  if (((iVar1 != 0) && (-1 < param_2)) && (param_2 < *(int *)(iVar1 + 0x48))) {

    return param_2 * 0x10 + *(int *)(iVar1 + 0x3c);

  }

  return 0;

}





// --- FUN_00526870 at 0x00526870 (size: 11) ---


bool __fastcall FUN_00526870(int param_1)



{

  return *(int *)(param_1 + 0xc) != 0;

}





// --- FUN_00526880 at 0x00526880 (size: 42) ---


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



float10 __fastcall FUN_00526880(int param_1)



{

  if (DAT_00796344 <= *(float *)(param_1 + 0x10)) {

    return (float10)*(int *)(param_1 + 0x14);

  }

  return (float10)(*(int *)(param_1 + 0x18) + 1) - (float10)_DAT_007c92b4;

}





// --- FUN_005268b0 at 0x005268B0 (size: 42) ---


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



float10 __fastcall FUN_005268b0(int param_1)



{

  if (DAT_00796344 <= *(float *)(param_1 + 0x10)) {

    return (float10)(*(int *)(param_1 + 0x18) + 1) - (float10)_DAT_007c92b4;

  }

  return (float10)*(int *)(param_1 + 0x14);

}





// --- FUN_005268e0 at 0x005268E0 (size: 31) ---


void __fastcall FUN_005268e0(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007c92b8;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0xffffffff;

  param_1[4] = 0x41f00000;

  return;

}





// --- FUN_00526900 at 0x00526900 (size: 45) ---


void FUN_00526900(undefined4 *param_1,float param_2,int param_3)



{

  float fVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  

  fVar1 = *(float *)(param_3 + 0x10);

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

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

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

  *param_1 = &PTR_LAB_007c92b8;

  param_1[4] = fVar1 * param_2;

  param_1[1] = uVar2;

  param_1[2] = uVar3;

  return;

}





// --- FUN_00526930 at 0x00526930 (size: 36) ---


void __fastcall FUN_00526930(undefined4 *param_1)



{

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  *param_1 = &PTR_FUN_007c92cc;

  param_1[4] = 0x41f00000;

  param_1[5] = 0xffffffff;

  param_1[6] = 0xffffffff;

  return;

}





// --- FUN_00526960 at 0x00526960 (size: 122) ---


void __thiscall FUN_00526960(int param_1,int param_2)



{

  int iVar1;

  undefined4 uVar2;

  

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

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

  }

  if (param_2 == 0) {

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

  }

  else {

    uVar2 = FUN_004220b0(param_2,8);

    uVar2 = FUN_00415430(uVar2);

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

  }

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

  if (iVar1 != 0) {

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

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

    }

    if (*(uint *)(iVar1 + 0x48) <= *(uint *)(param_1 + 0x14)) {

      *(uint *)(param_1 + 0x14) = *(uint *)(iVar1 + 0x48) - 1;

    }

    if (*(uint *)(iVar1 + 0x48) <= *(uint *)(param_1 + 0x18)) {

      *(uint *)(param_1 + 0x18) = *(uint *)(iVar1 + 0x48) - 1;

    }

    if (*(int *)(param_1 + 0x18) < *(int *)(param_1 + 0x14)) {

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

    }

  }

  return;

}





// --- FUN_005269e0 at 0x005269E0 (size: 14) ---


int __fastcall FUN_005269e0(int param_1)



{

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

    return *(int *)(param_1 + 4) + -4;

  }

  return 0;

}





// --- FUN_005269f0 at 0x005269F0 (size: 14) ---


int __fastcall FUN_005269f0(int param_1)



{

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

    return *(int *)(param_1 + 8) + -4;

  }

  return 0;

}





// --- FUN_00526aa0 at 0x00526AA0 (size: 49) ---


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



{

  *param_1 = &PTR_FUN_007c92cc;

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00526b90 at 0x00526B90 (size: 59) ---


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



{

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  *param_1 = &PTR_FUN_007c92cc;

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

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

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

  FUN_00526960(*(undefined4 *)(param_2 + 4));

  return param_1;

}





// --- FUN_00526bd0 at 0x00526BD0 (size: 26) ---


void __fastcall FUN_00526bd0(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0x3f800000;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  return;

}





// --- FUN_00526bf0 at 0x00526BF0 (size: 67) ---


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



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0xc);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x3f800000;

    puVar1[2] = 0;

  }

  *puVar1 = param_2;

  puVar1[1] = param_3;

  puVar1[2] = *(undefined4 *)(param_1 + 0xc);

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

  return;

}





// --- FUN_00526c40 at 0x00526C40 (size: 45) ---


void __thiscall FUN_00526c40(int param_1,void *param_2,int param_3)



{

  if (param_3 != 0) {

    *(undefined4 *)(param_3 + 8) = *(undefined4 *)((int)param_2 + 8);

    operator_delete(param_2);

    return;

  }

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

  operator_delete(param_2);

  return;

}





// --- FUN_00526c70 at 0x00526C70 (size: 41) ---


void __fastcall FUN_00526c70(int param_1)



{

  void *pvVar1;

  void *pvVar2;

  

  pvVar2 = *(void **)(param_1 + 0xc);

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

    pvVar1 = *(void **)((int)pvVar2 + 8);

    operator_delete(pvVar2);

    pvVar2 = pvVar1;

  }

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

  return;

}





// --- FUN_00526ca0 at 0x00526CA0 (size: 76) ---


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



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0xc);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0x3f800000;

    puVar1[2] = 0;

  }

  *puVar1 = param_2;

  puVar1[1] = param_3;

  puVar1[2] = 0;

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

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

  }

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

    *(undefined4 **)(*(int *)(param_1 + 0x14) + 8) = puVar1;

  }

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

  return;

}





// --- FUN_00526cf0 at 0x00526CF0 (size: 44) ---


void __fastcall FUN_00526cf0(int param_1)



{

  void *pvVar1;

  void *pvVar2;

  

  pvVar2 = *(void **)(param_1 + 0x10);

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

    pvVar1 = *(void **)((int)pvVar2 + 8);

    operator_delete(pvVar2);

    pvVar2 = pvVar1;

  }

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

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

  return;

}





// --- FUN_00526d20 at 0x00526D20 (size: 38) ---


undefined4 __fastcall FUN_00526d20(int param_1)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 uVar3;

  

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

  uVar3 = 0;

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

    iVar2 = puVar1[2];

    uVar3 = *puVar1;

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

    if (iVar2 == 0) {

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

    }

    operator_delete(puVar1);

  }

  return uVar3;

}





// --- FUN_00526d50 at 0x00526D50 (size: 56) ---


void __fastcall FUN_00526d50(int param_1)



{

  undefined4 *puVar1;

  

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

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

    if (puVar1[-1] != 0) {

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

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

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

      return;

    }

    operator_delete__(puVar1 + -1);

  }

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

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

  return;

}





// --- FUN_00526d90 at 0x00526D90 (size: 26) ---


int FUN_00526d90(int param_1,int param_2,uint param_3)



{

  if ((uint)(param_1 - param_2) < param_3) {

    return param_3 - (param_1 - param_2);

  }

  return 0;

}





// --- FUN_00526db0 at 0x00526DB0 (size: 25) ---


bool FUN_00526db0(uint param_1,uint param_2,uint param_3)



{

  if (param_2 <= param_1) {

    return param_1 - param_2 <= param_3;

  }

  return false;

}





// --- FUN_00526dd0 at 0x00526DD0 (size: 264) ---


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



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  

  *param_1 = *param_2;

  param_1[1] = param_2[1];

  param_1[2] = param_2[2];

  if (param_2[3] == 0) {

    param_1[3] = 0;

  }

  else {

    puVar1 = (undefined4 *)FUN_005df0f5(0xc);

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

      puVar1 = (undefined4 *)0x0;

    }

    else {

      puVar3 = (undefined4 *)param_2[3];

      puVar1[2] = 0;

      *puVar1 = *puVar3;

      puVar1[1] = puVar3[1];

    }

    param_1[3] = puVar1;

    for (puVar3 = *(undefined4 **)(param_2[3] + 8); puVar3 != (undefined4 *)0x0;

        puVar3 = (undefined4 *)puVar3[2]) {

      puVar2 = (undefined4 *)FUN_005df0f5(0xc);

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

        puVar2 = (undefined4 *)0x0;

      }

      else {

        puVar2[2] = 0;

        *puVar2 = *puVar3;

        puVar2[1] = puVar3[1];

      }

      puVar1[2] = puVar2;

      puVar1 = puVar2;

    }

  }

  if (param_2[4] == 0) {

    param_1[4] = 0;

    param_1[5] = 0;

  }

  else {

    puVar1 = (undefined4 *)FUN_005df0f5(0xc);

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

      puVar1 = (undefined4 *)0x0;

    }

    else {

      puVar3 = (undefined4 *)param_2[4];

      puVar1[2] = 0;

      *puVar1 = *puVar3;

      puVar1[1] = puVar3[1];

    }

    param_1[4] = puVar1;

    puVar3 = *(undefined4 **)(param_2[4] + 8);

    param_1[5] = puVar1;

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

      do {

        puVar2 = (undefined4 *)FUN_005df0f5(0xc);

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

          puVar2 = (undefined4 *)0x0;

        }

        else {

          puVar2[2] = 0;

          *puVar2 = *puVar3;

          puVar2[1] = puVar3[1];

        }

        param_1[5] = puVar2;

        puVar1[2] = puVar2;

        puVar3 = (undefined4 *)puVar3[2];

        puVar1 = (undefined4 *)param_1[5];

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

      return;

    }

  }

  return;

}





// --- FUN_00526ee0 at 0x00526EE0 (size: 76) ---


void __fastcall FUN_00526ee0(int param_1)



{

  void *pvVar1;

  void *pvVar2;

  

  pvVar2 = *(void **)(param_1 + 0xc);

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

    pvVar1 = *(void **)((int)pvVar2 + 8);

    operator_delete(pvVar2);

    pvVar2 = pvVar1;

  }

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

  pvVar2 = *(void **)(param_1 + 0x10);

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

    pvVar1 = *(void **)((int)pvVar2 + 8);

    operator_delete(pvVar2);

    pvVar2 = pvVar1;

  }

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

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

  return;

}





// --- thunk_FUN_00526ee0 at 0x00526F30 (size: 5) ---


void __fastcall thunk_FUN_00526ee0(int param_1)



{

  void *pvVar1;

  void *pvVar2;

  

  pvVar2 = *(void **)(param_1 + 0xc);

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

    pvVar1 = *(void **)((int)pvVar2 + 8);

    operator_delete(pvVar2);

    pvVar2 = pvVar1;

  }

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

  pvVar2 = *(void **)(param_1 + 0x10);

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

    pvVar1 = *(void **)((int)pvVar2 + 8);

    operator_delete(pvVar2);

    pvVar2 = pvVar1;

  }

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

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

  return;

}





// --- FUN_00526f40 at 0x00526F40 (size: 53) ---


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



{

  int *piVar1;

  

  for (piVar1 = *(int **)(param_1 + 0xc); piVar1 != (int *)0x0; piVar1 = (int *)piVar1[2]) {

    if (*piVar1 == param_2) {

      return 0;

    }

  }

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

    return 0;

  }

  FUN_00526bf0(param_2,param_3);

  return 1;

}





// --- FUN_00527170 at 0x00527170 (size: 428) ---


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



{

  byte bVar1;

  byte *pbVar2;

  uint uVar3;

  uint *puVar4;

  int iVar5;

  uint *puVar6;

  

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

  uVar3 = *param_2;

  *param_2 = uVar3 + 4;

  *(undefined1 *)(param_1 + 0x10) = *(undefined1 *)(uVar3 + 4);

  uVar3 = *param_2;

  *param_2 = uVar3 + 1;

  *(undefined1 *)(param_1 + 0x30) = *(undefined1 *)(uVar3 + 1);

  uVar3 = *param_2;

  pbVar2 = (byte *)(uVar3 + 1);

  *param_2 = (uint)pbVar2;

  bVar1 = *pbVar2;

  uVar3 = uVar3 + 2;

  *param_2 = uVar3;

  uVar3 = uVar3 & 0x80000003;

  if ((int)uVar3 < 0) {

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

  }

  if (uVar3 != 0) {

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

      *(undefined1 *)*param_2 = 0;

      *param_2 = *param_2 + 1;

    }

  }

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

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

    puVar4 = (uint *)thunk_FUN_005df0f5(uVar3 * 0x14 + 4);

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

      puVar6 = (uint *)0x0;

    }

    else {

      puVar6 = puVar4 + 1;

      *puVar4 = uVar3;

      FUN_00401000(puVar6,0x14,uVar3,FUN_005268e0);

    }

    *(uint **)(param_1 + 0x14) = puVar6;

  }

  uVar3 = 0;

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

    iVar5 = 0;

    do {

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

      uVar3 = uVar3 + 1;

      iVar5 = iVar5 + 0x14;

    } while (uVar3 < *(byte *)(param_1 + 0x10));

  }

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

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

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

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

  }

  else if (0xb < param_3) {

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

    uVar3 = *param_2;

    *param_2 = uVar3 + 4;

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

    uVar3 = *param_2;

    *param_2 = uVar3 + 4;

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

    *param_2 = *param_2 + 4;

  }

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

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

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

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

  }

  else if (0xb < param_3) {

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

    uVar3 = *param_2;

    *param_2 = uVar3 + 4;

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

    uVar3 = *param_2;

    *param_2 = uVar3 + 4;

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

    *param_2 = *param_2 + 4;

    return 1;

  }

  return 1;

}





// --- FUN_00527390 at 0x00527390 (size: 19) ---


undefined4 __thiscall FUN_00527390(undefined4 param_1,undefined4 param_2)



{

  FUN_00526dd0(param_2);

  return param_1;

}





// --- FUN_005273b0 at 0x005273B0 (size: 20) ---


void FUN_005273b0(void)



{

  FUN_00695670();

  FUN_00695670();

  return;

}





// --- FUN_005273d0 at 0x005273D0 (size: 43) ---


undefined4 * __fastcall FUN_005273d0(undefined4 *param_1)



{

  param_1[1] = 0;

  param_1[2] = 0xfffffffe;

  *param_1 = &PTR_FUN_007c93b4;

  FUN_0050a140();

  FUN_0050a140();

  return param_1;

}





// --- FUN_00527410 at 0x00527410 (size: 45) ---


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



{

  *param_1 = &PTR_FUN_007c93b4;

  FUN_005273b0();

  *param_1 = &PTR_LAB_007c9268;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00527450 at 0x00527450 (size: 6) ---


undefined4 FUN_00527450(void)



{

  return 0x10;

}





// --- FUN_005274c0 at 0x005274C0 (size: 34) ---


void __fastcall FUN_005274c0(undefined4 *param_1)



{

  param_1[1] = 0;

  param_1[2] = 0xfffffffe;

  *param_1 = &PTR_LAB_007c953c;

  param_1[3] = 0xffffffff;

  param_1[4] = 0;

  param_1[5] = 0;

  return;

}





// --- FUN_00527500 at 0x00527500 (size: 27) ---


void __fastcall FUN_00527500(undefined4 *param_1)



{

  param_1[1] = 0;

  param_1[2] = 0xfffffffe;

  *param_1 = &PTR_LAB_007c9558;

  param_1[3] = 0;

  param_1[4] = 0;

  return;

}





// --- FUN_00527540 at 0x00527540 (size: 38) ---


void __thiscall FUN_00527540(int param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  

  iVar1 = *param_2;

  if (iVar1 != 0) {

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

    while (iVar2 != 0) {

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

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

    }

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

    return;

  }

  *param_2 = param_1;

  return;

}





// --- FUN_00527570 at 0x00527570 (size: 34) ---


uint FUN_00527570(int *param_1)



{

  int iVar1;

  uint uVar2;

  

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

  uVar2 = iVar1 + 8;

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

    return uVar2 + (4 - (uVar2 & 3));

  }

  return uVar2;

}





// --- FUN_005275a0 at 0x005275A0 (size: 72) ---


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



{

  int iVar1;

  int *piVar2;

  int *piVar3;

  undefined4 uVar4;

  

  piVar2 = param_1;

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

  piVar3 = param_2;

  *(undefined4 *)*param_2 = uVar4;

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  (**(code **)(*piVar2 + 0x14))(param_2,param_3);

  FUN_00500610(piVar3,&param_1);

  return;

}





// --- FUN_00527600 at 0x00527600 (size: 32) ---


void __fastcall FUN_00527600(undefined4 *param_1)



{

  param_1[1] = 0;

  param_1[2] = 0xfffffffe;

  *param_1 = &PTR_FUN_007c9590;

  param_1[3] = DAT_008455d4;

  return;

}





// --- FUN_00527640 at 0x00527640 (size: 50) ---


void __fastcall FUN_00527640(undefined4 *param_1)



{

  param_1[1] = 0;

  param_1[2] = 0xfffffffe;

  *param_1 = &PTR_FUN_007c95ac;

  param_1[3] = DAT_008455d4;

  param_1[4] = 0x3f666666;

  param_1[5] = 0x3f800000;

  param_1[6] = 0x3f800000;

  return;

}





// --- FUN_005276d0 at 0x005276D0 (size: 26) ---


void __thiscall FUN_005276d0(int *param_1,int *param_2)



{

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

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

  *param_2 = *param_2 + 4;

  return;

}





// --- FUN_005276f0 at 0x005276F0 (size: 26) ---


undefined4 __thiscall FUN_005276f0(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  uVar1 = *(undefined4 *)*param_2;

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

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

  return 1;

}





// --- FUN_00527750 at 0x00527750 (size: 29) ---


int FUN_00527750(void)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005201e0();

  iVar2 = FUN_005201e0();

  return iVar1 + 0xc + iVar2;

}





// --- FUN_00527780 at 0x00527780 (size: 32) ---


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



{

  uint uVar1;

  

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

  if (uVar1 <= param_3) {

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

    *param_2 = *param_2 + 4;

  }

  return;

}





// --- FUN_005277a0 at 0x005277A0 (size: 22) ---


undefined4 __thiscall FUN_005277a0(int param_1,int *param_2)



{

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

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_00527850 at 0x00527850 (size: 56) ---


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



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 0x10))();

  if (uVar2 <= param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return;

}





// --- FUN_00527890 at 0x00527890 (size: 46) ---


undefined4 __thiscall FUN_00527890(int param_1,int *param_2)



{

  int iVar1;

  

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_005278f0 at 0x005278F0 (size: 58) ---


undefined4 __thiscall FUN_005278f0(int param_1,int *param_2)



{

  int iVar1;

  

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_005279b0 at 0x005279B0 (size: 74) ---


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



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 0x10))();

  if (uVar2 <= param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return;

}





// --- FUN_00527a60 at 0x00527A60 (size: 44) ---


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



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 0x10))();

  if (uVar2 <= param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return;

}





// --- FUN_00527a90 at 0x00527A90 (size: 34) ---


undefined4 __thiscall FUN_00527a90(int param_1,int *param_2)



{

  int iVar1;

  

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_00527b70 at 0x00527B70 (size: 60) ---


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



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 0x10))();

  if (uVar2 <= param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return;

}





// --- FUN_00527bf0 at 0x00527BF0 (size: 108) ---


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



{

  uint uVar1;

  int iVar2;

  int iVar3;

  

  iVar2 = FUN_005201e0();

  iVar3 = FUN_005201e0();

  uVar1 = iVar2 + 0xc + iVar3;

  if (uVar1 <= param_3) {

    *(undefined4 *)*param_2 = *param_1;

    *param_2 = *param_2 + 4;

    FUN_005aae80(param_2,param_3);

    FUN_005aae80(param_2,param_3);

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

    iVar2 = *param_2;

    *param_2 = iVar2 + 4;

    *(undefined4 *)(iVar2 + 4) = param_1[6];

    *param_2 = *param_2 + 4;

  }

  return uVar1;

}





// --- FUN_00527cc0 at 0x00527CC0 (size: 46) ---


void __fastcall FUN_00527cc0(undefined4 *param_1)



{

  param_1[1] = 0;

  param_1[2] = 0xfffffffe;

  *param_1 = &PTR_LAB_007c95f8;

  param_1[3] = &PTR_FUN_007c95e4;

  param_1[4] = 0;

  param_1[5] = DAT_008455d4;

  param_1[6] = 0;

  param_1[7] = 0;

  return;

}





// --- FUN_00527d30 at 0x00527D30 (size: 57) ---


undefined4 * __fastcall FUN_00527d30(undefined4 *param_1)



{

  param_1[1] = 0;

  param_1[2] = 0xfffffffe;

  *param_1 = &PTR_LAB_007c9614;

  param_1[5] = 0x3f800000;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  FUN_00535b30();

  return param_1;

}





// --- FUN_00527d80 at 0x00527D80 (size: 63) ---


undefined4 * __fastcall FUN_00527d80(undefined4 *param_1)



{

  param_1[1] = 0;

  param_1[2] = 0xfffffffe;

  *param_1 = &PTR_LAB_007c9614;

  param_1[5] = 0x3f800000;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  FUN_00535b30();

  *param_1 = &PTR_LAB_007c9630;

  return param_1;

}





// --- FUN_00527dd0 at 0x00527DD0 (size: 1078) ---


int * FUN_00527dd0(int *param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  undefined4 uVar2;

  int iVar3;

  int iVar4;

  int *piVar5;

  

  puVar1 = (undefined4 *)*param_1;

  uVar2 = *puVar1;

  *param_1 = (int)(puVar1 + 1);

  iVar3 = puVar1[1];

  piVar5 = (int *)0x0;

  *param_1 = (int)(puVar1 + 2);

  switch(uVar2) {

  case 0:

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

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

      piVar5 = (int *)0x0;

      (**(code **)(iRam00000000 + 0x18))(param_1,param_2);

    }

    else {

      piVar5[1] = 0;

      piVar5[2] = -2;

      *piVar5 = (int)&PTR_LAB_007c9398;

      (**(code **)(*piVar5 + 0x18))(param_1,param_2);

    }

    goto LAB_005281ee;

  case 1:

    iVar4 = FUN_005df0f5(0x10);

    if (iVar4 == 0) {

LAB_005281df:

      piVar5 = (int *)0x0;

    }

    else {

      piVar5 = (int *)FUN_00527600();

    }

    break;

  case 2:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c95c8;

    piVar5[3] = 0;

    break;

  case 3:

    iVar4 = FUN_005df0f5(0x28);

    if (iVar4 == 0) goto LAB_005281df;

    piVar5 = (int *)FUN_005273d0();

    break;

  default:

    goto switchD_00527df5_caseD_4;

  case 5:

    iVar4 = FUN_005df0f5(0x20);

    if (iVar4 == 0) goto LAB_005281df;

    piVar5 = (int *)FUN_00527cc0();

    break;

  case 6:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c93d0;

    break;

  case 7:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c945c;

    break;

  case 8:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c9494;

    break;

  case 9:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c9478;

    break;

  case 10:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c94cc;

    break;

  case 0xb:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c94b0;

    break;

  case 0xc:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c94e8;

    break;

  case 0xd:

    iVar4 = FUN_005df0f5(0x58);

    if (iVar4 == 0) goto LAB_005281df;

    piVar5 = (int *)FUN_00527d30();

    break;

  case 0xe:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c9504;

    break;

  case 0xf:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c9520;

    break;

  case 0x10:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c93ec;

    break;

  case 0x11:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c9424;

    break;

  case 0x12:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c9408;

    break;

  case 0x13:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c964c;

    break;

  case 0x14:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c9440;

    break;

  case 0x15:

    iVar4 = FUN_005df0f5(0x1c);

    if (iVar4 == 0) goto LAB_005281df;

    piVar5 = (int *)FUN_00527640();

    break;

  case 0x16:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c9668;

    break;

  case 0x17:

    iVar4 = FUN_005df0f5(0x14);

    if (iVar4 == 0) goto LAB_005281df;

    piVar5 = (int *)FUN_00527500();

    break;

  case 0x18:

    iVar4 = FUN_005df0f5(0x18);

    if (iVar4 == 0) goto LAB_005281df;

    piVar5 = (int *)FUN_005274c0();

    break;

  case 0x19:

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

    if (piVar5 == (int *)0x0) goto LAB_005281df;

    piVar5[1] = 0;

    piVar5[2] = -2;

    *piVar5 = (int)&PTR_LAB_007c9574;

    break;

  case 0x1a:

    iVar4 = FUN_005df0f5(0x58);

    if (iVar4 == 0) goto LAB_005281df;

    piVar5 = (int *)FUN_00527d80();

  }

  (**(code **)(*piVar5 + 0x18))(param_1,param_2);

LAB_005281ee:

  piVar5[2] = iVar3;

switchD_00527df5_caseD_4:

  FUN_00500610(param_1,&param_2);

  return piVar5;

}





// --- FUN_00528280 at 0x00528280 (size: 50) ---


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



{

  *param_1 = &PTR_FUN_007c9590;

  FUN_00551870(param_1[3]);

  *param_1 = &PTR_LAB_007c9268;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005282c0 at 0x005282C0 (size: 35) ---


undefined4 __thiscall FUN_005282c0(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  uVar1 = *(undefined4 *)*param_2;

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

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

  FUN_00551800(uVar1);

  return 1;

}





// --- FUN_005282f0 at 0x005282F0 (size: 50) ---


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



{

  *param_1 = &PTR_FUN_007c95ac;

  FUN_00551870(param_1[3]);

  *param_1 = &PTR_LAB_007c9268;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00528330 at 0x00528330 (size: 72) ---


void __thiscall FUN_00528330(int *param_1,int *param_2)



{

  int iVar1;

  

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

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  return;

}





// --- FUN_005283f0 at 0x005283F0 (size: 48) ---


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



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 0x10))();

  if (uVar2 <= param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return;

}





// --- FUN_00528420 at 0x00528420 (size: 36) ---


undefined4 __thiscall FUN_00528420(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  uVar1 = *(undefined4 *)*param_2;

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

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

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

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_005284f0 at 0x005284F0 (size: 67) ---


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



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 0x10))();

  if ((uVar2 <= param_3) && (0xb < param_3)) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return;

}





// --- FUN_00528540 at 0x00528540 (size: 53) ---


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



{

  int iVar1;

  

  if (0xb < param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return 1;

}





// --- FUN_005285e0 at 0x005285E0 (size: 115) ---


undefined4 FUN_005285e0(uint param_1)



{

  bool bVar1;

  bool bVar2;

  

  if (param_1 < 0x40000009) {

    if (param_1 == 0x40000008) {

      return 0x48;

    }

    if (0x10000134 < param_1) {

      if (param_1 == 0x1000019b) {

        return 0x48;

      }

      return 0;

    }

    if (0x1000012a < param_1) {

      return 0x48;

    }

    if (param_1 == 0x10000057) {

      return 0x48;

    }

    if (param_1 < 0x1000006f) {

      return 0;

    }

    bVar1 = param_1 < 0x10000078;

    bVar2 = param_1 == 0x10000078;

  }

  else {

    if (0x40000039 < param_1) {

      if (param_1 < 0x41000012) {

        return 0;

      }

      if (0x41000014 < param_1) {

        return 0;

      }

      return 0x48;

    }

    if (0x4000001d < param_1) {

      return 0x48;

    }

    if (param_1 < 0x40000016) {

      return 0;

    }

    bVar1 = param_1 < 0x40000018;

    bVar2 = param_1 == 0x40000018;

  }

  if (!bVar1 && !bVar2) {

    return 0;

  }

  return 0x48;

}





// --- FUN_00528660 at 0x00528660 (size: 74) ---


undefined4 __fastcall FUN_00528660(int param_1)



{

  uint uVar1;

  char cVar2;

  

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

     (cVar2 = (**(code **)(**(int **)(param_1 + 4) + 0x3c))(*(undefined4 *)(param_1 + 0x74)),

     cVar2 == '\0')) {

    return 0x49;

  }

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

  if (uVar1 < 0x40000009) {

    if ((uVar1 == 0x40000008) || (uVar1 == 0x10000057)) {

      return 0x48;

    }

  }

  else if ((0x41000011 < uVar1) && (uVar1 < 0x41000015)) {

    return 0x48;

  }

  return 0;

}





// --- FUN_005286b0 at 0x005286B0 (size: 98) ---


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



float10 __fastcall FUN_005286b0(int param_1)



{

  char cVar1;

  float local_4;

  

  local_4 = *(float *)(param_1 + 0x74);

  if (_DAT_007c9734 <= local_4) {

    if (_DAT_007938b0 < local_4) {

      local_4 = 1.0;

    }

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

      return (float10)_DAT_0079c6d4;

    }

    cVar1 = (**(code **)(**(int **)(param_1 + 4) + 0x30))(local_4,&local_4);

    if (cVar1 != '\0') {

      return (float10)local_4;

    }

  }

  return (float10)DAT_00796344;

}





// --- FUN_00528720 at 0x00528720 (size: 4) ---


undefined4 __fastcall FUN_00528720(int param_1)



{

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

}





// --- FUN_00528730 at 0x00528730 (size: 23) ---


undefined4 __fastcall FUN_00528730(int param_1)



{

  if (((*(uint *)(param_1 + 0xac) & 1) != 0) && ((*(uint *)(param_1 + 0xac) & 2) != 0)) {

    return 1;

  }

  return 0;

}





// --- FUN_00528750 at 0x00528750 (size: 50) ---


void __fastcall FUN_00528750(int param_1)



{

  int *piVar1;

  int iVar2;

  

  while (piVar1 = *(int **)(param_1 + 0x80), piVar1 != (int *)0x0) {

    iVar2 = *piVar1;

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

    if (iVar2 == 0) {

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

    }

    *piVar1 = 0;

    operator_delete(piVar1);

  }

  return;

}





// --- FUN_00528790 at 0x00528790 (size: 86) ---


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



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0x10);

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    puVar1[1] = param_2;

    *puVar1 = 0;

    puVar1[2] = param_3;

    puVar1[3] = param_4;

  }

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

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

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

    return;

  }

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

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

  return;

}





// --- FUN_005287f0 at 0x005287F0 (size: 207) ---


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



void __thiscall FUN_005287f0(float param_1,int *param_2,float *param_3)



{

  int iVar1;

  char cVar2;

  float local_4;

  

  local_4 = _DAT_007938b0;

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

     (local_4 = param_1, cVar2 = (**(code **)(**(int **)((int)param_1 + 4) + 0x34))(&local_4),

     cVar2 == '\0')) {

    local_4 = *(float *)((int)param_1 + 0x7c);

  }

  iVar1 = *param_2;

  if (iVar1 == 0x45000005) {

    if (DAT_00796344 < *param_3) {

      *param_2 = 0x44000007;

    }

    *param_3 = local_4 * *param_3;

    return;

  }

  if (iVar1 == 0x6500000d) {

    *param_3 = _DAT_007c96dc * *param_3;

    return;

  }

  if (iVar1 == 0x6500000f) {

    local_4 = local_4 * *param_3;

    *param_3 = local_4;

    if (_DAT_007c96ec < ABS(local_4)) {

      if (local_4 <= DAT_00796344) {

        *param_3 = _DAT_0079a1a0 * _DAT_007c96ec;

        return;

      }

      *param_3 = _DAT_007938b0 * _DAT_007c96ec;

      return;

    }

  }

  return;

}





// --- FUN_005288c0 at 0x005288C0 (size: 73) ---


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



float10 __fastcall FUN_005288c0(int param_1)



{

  char cVar1;

  float unaff_ESI;

  undefined4 local_4;

  

  local_4 = 0;

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

    return (float10)_DAT_007938b0 * (float10)_DAT_007c96e0;

  }

  cVar1 = (**(code **)(**(int **)(param_1 + 4) + 0x34))(&local_4);

  if (cVar1 == '\0') {

    return (float10)*(float *)(param_1 + 0x7c) * (float10)_DAT_007c96e0;

  }

  return (float10)unaff_ESI * (float10)_DAT_007c96e0;

}





// --- FUN_00528910 at 0x00528910 (size: 68) ---


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



float10 __fastcall FUN_00528910(int param_1)



{

  char cVar1;

  float unaff_ESI;

  float10 fVar2;

  int local_4;

  

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

    fVar2 = (float10)_DAT_007938b0;

  }

  else {

    local_4 = param_1;

    cVar1 = (**(code **)(**(int **)(param_1 + 4) + 0x34))(&local_4);

    if (cVar1 == '\0') {

      fVar2 = (float10)*(float *)(param_1 + 0x7c);

    }

    else {

      fVar2 = (float10)unaff_ESI;

    }

  }

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

    fVar2 = (float10)*(float *)(param_1 + 0x50) / (float10)*(float *)(param_1 + 0x6c);

  }

  return fVar2 * (float10)_DAT_007c96e0;

}





// --- FUN_00528960 at 0x00528960 (size: 232) ---


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



void __thiscall FUN_00528960(int param_1,float *param_2)



{

  float fVar1;

  float fVar2;

  float *pfVar3;

  char cVar4;

  float unaff_retaddr;

  

  pfVar3 = param_2;

  fVar1 = DAT_00796344;

  if (*(int *)(param_1 + 0x54) == 0x6500000f) {

    fVar1 = _DAT_007c96e8 * *(float *)(param_1 + 0x58);

  }

  *param_2 = fVar1;

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

    fVar1 = _DAT_007c96e4 * *(float *)(param_1 + 0x50);

  }

  else {

    fVar1 = DAT_00796344;

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

      fVar1 = _DAT_007c96e0 * *(float *)(param_1 + 0x50);

    }

  }

  param_2[1] = fVar1;

  param_2[2] = 0.0;

  param_2 = (float *)0x0;

  fVar1 = _DAT_007938b0;

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

     (cVar4 = (**(code **)(**(int **)(param_1 + 4) + 0x34))(&param_2), fVar1 = unaff_retaddr,

     cVar4 == '\0')) {

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

  }

  fVar1 = fVar1 * _DAT_007c96e0;

  fVar2 = SQRT(pfVar3[2] * pfVar3[2] + pfVar3[1] * pfVar3[1] + *pfVar3 * *pfVar3);

  if (fVar2 <= fVar1) {

    return;

  }

  fVar2 = _DAT_007938b0 / fVar2;

  *pfVar3 = fVar2 * *pfVar3 * fVar1;

  pfVar3[1] = fVar2 * pfVar3[1] * fVar1;

  pfVar3[2] = fVar2 * pfVar3[2] * fVar1;

  return;

}





// --- FUN_00528a50 at 0x00528A50 (size: 125) ---


undefined4 __fastcall FUN_00528a50(int param_1)



{

  undefined4 uVar1;

  

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

    return 8;

  }

  FUN_00510cc0();

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

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

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

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

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

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

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

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

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

  FUN_0050f5a0();

  FUN_00528790(0,0x41000003,uVar1);

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

    FUN_005108f0();

  }

  return 0;

}





// --- FUN_00528ad0 at 0x00528AD0 (size: 97) ---


void __fastcall FUN_00528ad0(int param_1)



{

  int *piVar1;

  int iVar2;

  

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

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

      FUN_0050f5b0();

      FUN_0051f5e0();

      FUN_0051f3b0();

    }

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

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

      iVar2 = *piVar1;

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

      if (iVar2 == 0) {

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

      }

      *piVar1 = 0;

      operator_delete(piVar1);

    }

  }

  return;

}





// --- FUN_00528b40 at 0x00528B40 (size: 112) ---


void __fastcall FUN_00528b40(int param_1)



{

  int iVar1;

  int *piVar2;

  

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

  while (iVar1 != 0) {

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

      if ((*(uint *)(iVar1 + 8) & 0x10000000) != 0) {

        FUN_0050f5b0();

        FUN_0051f5e0();

        FUN_0051f3b0();

      }

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

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

        iVar1 = *piVar2;

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

        if (iVar1 == 0) {

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

        }

        *piVar2 = 0;

        operator_delete(piVar2);

      }

    }

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

  }

  return;

}





// --- FUN_00528bb0 at 0x00528BB0 (size: 49) ---


undefined4 __fastcall FUN_00528bb0(int param_1)



{

  uint uVar1;

  

  uVar1 = *(uint *)(*(int *)(param_1 + 8) + 0xac);

  if (((((uVar1 & 1) != 0) && ((uVar1 & 2) != 0)) && (*(int *)(param_1 + 0x4c) == 0x41000003)) &&

     ((*(int *)(param_1 + 0x54) == 0 && (*(int *)(param_1 + 0x5c) == 0)))) {

    return 1;

  }

  return 0;

}





// --- FUN_00528bf0 at 0x00528BF0 (size: 14) ---


bool __fastcall FUN_00528bf0(int param_1)



{

  return *(int *)(param_1 + 0x80) != 0;

}





// --- FUN_00528c00 at 0x00528C00 (size: 25) ---


void FUN_00528c00(void)



{

  FUN_00528750();

  FUN_0051fcc0();

  FUN_005200d0();

  return;

}





// --- FUN_00528c20 at 0x00528C20 (size: 174) ---


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



void __thiscall FUN_00528c20(int param_1,uint *param_2,float *param_3,int param_4)



{

  uint uVar1;

  float fVar2;

  int iVar3;

  

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

     (iVar3 = (**(code **)(**(int **)(param_1 + 4) + 0x2c))(), iVar3 == 0)) {

    return;

  }

  fVar2 = _DAT_007c96d8;

  uVar1 = *param_2;

  if (uVar1 < 0x6500000f) {

    if (uVar1 != 0x6500000e) {

      if (uVar1 == 0x44000007) {

        return;

      }

      if (uVar1 != 0x45000006) goto LAB_00528ca8;

      *param_2 = 0x45000005;

      fVar2 = -fVar2;

      goto LAB_00528ca4;

    }

    *param_2 = 0x6500000d;

    fVar2 = *param_3 * _DAT_0079a1a0;

  }

  else {

    if (uVar1 != 0x6500000f) {

      if (uVar1 != 0x65000010) goto LAB_00528ca8;

      *param_2 = 0x6500000f;

      *param_3 = *param_3 * _DAT_0079a1a0;

    }

    fVar2 = (_DAT_007c96e4 / _DAT_007c96e8) * _DAT_007c96d4;

LAB_00528ca4:

    fVar2 = fVar2 * *param_3;

  }

  *param_3 = fVar2;

LAB_00528ca8:

  if (param_4 == 0) {

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

  }

  if (param_4 == 2) {

    FUN_005287f0(param_2,param_3);

  }

  return;

}





// --- FUN_00528cd0 at 0x00528CD0 (size: 246) ---


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



void __thiscall FUN_00528cd0(int param_1,float *param_2)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float fVar7;

  float fVar8;

  float fVar9;

  float fVar10;

  float fVar11;

  float fVar12;

  int iVar13;

  float10 fVar14;

  

  FUN_00528960(param_2);

  fVar14 = (float10)FUN_005286b0();

  param_2[2] = (float)fVar14;

  if (((ABS(*param_2) < _DAT_007c9734) && (ABS(param_2[1]) < _DAT_007c9734)) &&

     (ABS((float)fVar14) < _DAT_007c9734)) {

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

    fVar1 = *(float *)(iVar13 + 0x70);

    fVar2 = *(float *)(iVar13 + 0xe4);

    fVar3 = *(float *)(iVar13 + 0x6c);

    fVar4 = *(float *)(iVar13 + 0xe0);

    fVar5 = *(float *)(iVar13 + 0x74);

    fVar6 = *(float *)(iVar13 + 0xe8);

    fVar7 = *(float *)(iVar13 + 0x7c);

    fVar8 = *(float *)(iVar13 + 0xe4);

    fVar9 = *(float *)(iVar13 + 0x78);

    fVar10 = *(float *)(iVar13 + 0xe0);

    fVar11 = *(float *)(iVar13 + 0x80);

    fVar12 = *(float *)(iVar13 + 0xe8);

    *param_2 = *(float *)(iVar13 + 0x68) * *(float *)(iVar13 + 0xe8) +

               *(float *)(iVar13 + 0x60) * *(float *)(iVar13 + 0xe0) +

               *(float *)(iVar13 + 100) * *(float *)(iVar13 + 0xe4);

    param_2[1] = fVar5 * fVar6 + fVar3 * fVar4 + fVar1 * fVar2;

    param_2[2] = fVar11 * fVar12 + fVar9 * fVar10 + fVar7 * fVar8;

  }

  return;

}





// --- FUN_00528dd0 at 0x00528DD0 (size: 126) ---


undefined4 __fastcall FUN_00528dd0(int param_1)



{

  uint uVar1;

  uint uVar2;

  char cVar3;

  

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

     (cVar3 = (**(code **)(**(int **)(param_1 + 4) + 0x3c))(*(undefined4 *)(param_1 + 0x74)),

     cVar3 == '\0')) {

    return 0x49;

  }

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

  if (uVar1 < 0x40000009) {

    if ((uVar1 == 0x40000008) || (uVar1 == 0x10000057)) {

      return 0x48;

    }

  }

  else if ((0x41000011 < uVar1) && (uVar1 < 0x41000015)) {

    return 0x48;

  }

  uVar2 = *(uint *)(*(int *)(param_1 + 8) + 0xac);

  if (((((uVar2 & 1) != 0) && ((uVar2 & 2) != 0)) && (uVar1 == 0x41000003)) &&

     ((*(int *)(param_1 + 0x54) == 0 && (*(int *)(param_1 + 0x5c) == 0)))) {

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

  }

  return 0;

}





// --- FUN_00528e50 at 0x00528E50 (size: 107) ---


undefined4 __thiscall FUN_00528e50(int param_1,uint param_2)



{

  int iVar1;

  

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

    if (param_2 < 0x40000016) {

      if (param_2 == 0x40000015) {

        return 1;

      }

      if (param_2 == 0x40000011) {

        return 1;

      }

    }

    else if ((0x6500000c < param_2) && (param_2 < 0x6500000f)) {

      return 1;

    }

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

       (iVar1 = (**(code **)(**(int **)(param_1 + 4) + 0x2c))(), iVar1 == 0)) {

      return 1;

    }

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

    if (((iVar1 == 0) || ((*(uint *)(iVar1 + 0xa8) & 0x400) == 0)) ||

       (((*(uint *)(iVar1 + 0xac) & 1) != 0 && ((*(uint *)(iVar1 + 0xac) & 2) != 0)))) {

      return 1;

    }

  }

  return 0;

}





// --- FUN_00528ec0 at 0x00528EC0 (size: 172) ---


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



{

  char cVar1;

  int iVar2;

  

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

     ((((*(int **)(param_1 + 4) == (int *)0x0 ||

        (iVar2 = (**(code **)(**(int **)(param_1 + 4) + 0x2c))(), iVar2 != 0)) &&

       (iVar2 = *(int *)(param_1 + 8), iVar2 != 0)) &&

      (((*(uint *)(iVar2 + 0xa8) & 0x400) != 0 &&

       (((*(uint *)(iVar2 + 0xac) & 1) == 0 || ((*(uint *)(iVar2 + 0xac) & 2) == 0)))))))) {

    return 0x24;

  }

  iVar2 = FUN_0050f730();

  if (iVar2 != 0) {

    return 0x47;

  }

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

      (iVar2 = *(int *)(*(int *)(param_1 + 0x80) + 0xc), iVar2 == 0)) &&

     ((iVar2 = FUN_00528660(), iVar2 == 0 &&

      (((iVar2 = FUN_005285e0(*(undefined4 *)(param_1 + 0x4c)), iVar2 == 0 &&

        (*(int **)(param_1 + 4) != (int *)0x0)) &&

       (cVar1 = (**(code **)(**(int **)(param_1 + 4) + 0x40))(param_2,param_3), cVar1 == '\0'))))))

  {

    return 0x47;

  }

  return iVar2;

}





// --- FUN_00528f70 at 0x00528F70 (size: 269) ---


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



{

  int iVar1;

  int iVar2;

  

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

    return 8;

  }

  iVar1 = FUN_00528e50(param_2);

  if (iVar1 == 0) {

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

      iVar1 = 0x24;

      goto LAB_0052905e;

    }

  }

  else if ((*(int *)(param_1 + 0x70) == 0) ||

          (((param_2 != 0x45000005 && (param_2 != 0x44000007)) && (param_2 != 0x6500000f)))) {

    if (param_2 == 0x40000011) {

      FUN_005108f0();

    }

    iVar1 = FUN_0050f540(param_2,param_3);

    if (iVar1 == 0) {

      if ((*(uint *)(param_3 + 4) & 0x20000) == 0) {

        iVar2 = FUN_005285e0(param_2);

        if ((iVar2 == 0) && ((param_2 & 0x10000000) == 0)) {

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

        }

      }

      else {

        iVar2 = 0x48;

      }

      FUN_00528790(*(undefined4 *)(param_3 + 0x20),param_2,iVar2);

      if ((*(uint *)(param_3 + 4) & 0x4000) != 0) {

        FUN_0051f550(param_2,param_3);

      }

    }

    goto LAB_0052905e;

  }

  if ((*(uint *)(param_3 + 4) & 0x4000) != 0) {

    FUN_0051f550(param_2,param_3);

  }

  iVar1 = 0;

LAB_0052905e:

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

    FUN_005108f0();

  }

  return iVar1;

}





// --- FUN_00529080 at 0x00529080 (size: 179) ---


int __thiscall FUN_00529080(int param_1,int param_2,int param_3)



{

  int iVar1;

  

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

    return 8;

  }

  iVar1 = FUN_00528e50(param_2);

  if ((iVar1 == 0) ||

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

      (((param_2 == 0x45000005 || (param_2 == 0x44000007)) || (param_2 == 0x6500000f)))))) {

    if ((*(uint *)(param_3 + 4) & 0x4000) != 0) {

      FUN_0051f2a0(param_2);

    }

    iVar1 = 0;

  }

  else {

    iVar1 = FUN_0050f560(param_2,param_3);

    if (iVar1 == 0) {

      FUN_00528790(*(undefined4 *)(param_3 + 0x20),0x41000003,0);

      if ((*(uint *)(param_3 + 4) & 0x4000) != 0) {

        FUN_0051f2a0(param_2);

      }

    }

  }

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

    FUN_005108f0();

  }

  return iVar1;

}





// --- FUN_00529140 at 0x00529140 (size: 25) ---


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



{

  int iVar1;

  int iVar2;

  undefined **ppuStack_2c;

  undefined4 uStack_28;

  undefined4 uStack_24;

  undefined4 uStack_20;

  undefined4 uStack_1c;

  undefined4 uStack_18;

  undefined4 uStack_14;

  undefined4 uStack_10;

  undefined4 uStack_c;

  undefined4 uStack_8;

  undefined4 uStack_4;

  

  iVar1 = param_3;

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

    return 8;

  }

  if ((char)((uint)*(undefined4 *)(param_3 + 4) >> 8) < '\0') {

    FUN_00510cc0();

  }

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

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

  uStack_20 = *(undefined4 *)(iVar1 + 0xc);

  uStack_1c = *(undefined4 *)(iVar1 + 0x10);

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

  uStack_18 = *(undefined4 *)(iVar1 + 0x14);

  uStack_8 = *(undefined4 *)(iVar1 + 0x24);

  uStack_c = *(undefined4 *)(iVar1 + 0x20);

  uStack_14 = *(undefined4 *)(iVar1 + 0x18);

  uStack_4 = *(undefined4 *)(iVar1 + 0x28);

  param_3 = param_2;

  ppuStack_2c = &PTR_FUN_007c91c0;

  FUN_00528c20(&param_3,&uStack_18,uStack_8);

  iVar2 = FUN_00529080(param_3,&ppuStack_2c);

  if ((iVar2 == 0) && ((*(uint *)(iVar1 + 4) & 0x2000) != 0)) {

    FUN_0051f1f0(param_2);

  }

  return iVar2;

}





// --- FUN_00529159 at 0x00529159 (size: 175) ---


int FUN_00529159(undefined **param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

                undefined4 param_5,undefined4 param_6,undefined4 param_7,undefined4 param_8,

                undefined4 param_9,undefined4 param_10,undefined4 param_11,undefined4 param_12,

                undefined4 param_13,int param_14)



{

  undefined4 uVar1;

  int iVar2;

  int iVar3;

  

  iVar2 = param_14;

  if ((char)((uint)*(undefined4 *)(param_14 + 4) >> 8) < '\0') {

    FUN_00510cc0();

  }

  uVar1 = param_13;

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

  param_3 = *(undefined4 *)(iVar2 + 8);

  param_4 = *(undefined4 *)(iVar2 + 0xc);

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

  param_8 = *(undefined4 *)(iVar2 + 0x1c);

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

  param_10 = *(undefined4 *)(iVar2 + 0x24);

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

  param_7 = *(undefined4 *)(iVar2 + 0x18);

  param_11 = *(undefined4 *)(iVar2 + 0x28);

  param_14 = param_13;

  param_1 = &PTR_FUN_007c91c0;

  FUN_00528c20(&param_14,&param_6,param_10);

  iVar3 = FUN_00529080(param_14,&param_1);

  if ((iVar3 == 0) && ((*(uint *)(iVar2 + 4) & 0x2000) != 0)) {

    FUN_0051f1f0(uVar1);

  }

  return iVar3;

}





// --- FUN_00529210 at 0x00529210 (size: 372) ---


void __thiscall FUN_00529210(int param_1,uint param_2,uint param_3)



{

  int iVar1;

  undefined1 local_2c [4];

  uint local_28;

  undefined4 local_18;

  undefined4 local_c;

  

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

    return;

  }

  FUN_00524f80();

  local_28 = ((param_3 & 1) << 2 | param_2 & 1) << 0xf | local_28 & 0xfffd37ff;

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

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

  }

  FUN_00528f70(*(undefined4 *)(param_1 + 0x48),local_2c);

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

  if (iVar1 == 0) {

    local_18 = 0x3f800000;

    iVar1 = 0x40000015;

  }

  else {

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

      local_18 = 0x3f800000;

      FUN_00528f70(0x41000003,local_2c);

      FUN_00529080(0x6500000f,local_2c);

      goto LAB_00529303;

    }

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

    FUN_00528f70(*(undefined4 *)(param_1 + 0x4c),local_2c);

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

    if (iVar1 == 0) {

      FUN_00529080(0x6500000f,local_2c);

      goto LAB_00529303;

    }

    local_18 = *(undefined4 *)(param_1 + 0x58);

  }

  FUN_00528f70(iVar1,local_2c);

LAB_00529303:

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

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

      iVar1 = FUN_0050f560(0x6500000d,local_2c);

      if ((iVar1 == 0) && (FUN_00528790(local_c,0x41000003,0), (local_28 & 0x4000) != 0)) {

        FUN_0051f2a0(0x6500000d);

      }

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

        FUN_005108f0();

      }

    }

    return;

  }

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

  FUN_00528f70(*(int *)(param_1 + 0x5c),local_2c);

  return;

}





// --- FUN_00529390 at 0x00529390 (size: 85) ---


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



{

  int iVar1;

  

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

    return 8;

  }

  FUN_00510cc0();

  iVar1 = FUN_00528ec0(param_2,param_3);

  if (iVar1 == 0) {

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

    FUN_00511de0(0);

    return 0;

  }

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

  return iVar1;

}





// --- FUN_005293f0 at 0x005293F0 (size: 135) ---


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



{

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

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

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

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

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

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

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

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

    FUN_00528c20((undefined4 *)(param_1 + 0x4c),param_1 + 0x50,*(undefined4 *)(param_1 + 0x24));

    FUN_00528c20(param_1 + 0x54,param_1 + 0x58,*(undefined4 *)(param_1 + 0x30));

    FUN_00528c20(param_1 + 0x5c,(undefined4 *)(param_1 + 0x60),*(undefined4 *)(param_1 + 0x3c));

    FUN_00529210(param_2,param_3);

  }

  return;

}





// --- FUN_00529480 at 0x00529480 (size: 85) ---


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



{

  int iVar1;

  

  if (param_1[2] == 0) {

    return;

  }

  if (*param_1 != 0) {

    if ((((int *)param_1[1] == (int *)0x0) ||

        (iVar1 = (**(code **)(*(int *)param_1[1] + 0x14))(), iVar1 != 0)) &&

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

      FUN_005293f0(param_2,param_3);

      return;

    }

    FUN_00529210(param_2,param_3);

    return;

  }

  return;

}





// --- FUN_005294e0 at 0x005294E0 (size: 69) ---


void __fastcall FUN_005294e0(int *param_1)



{

  int iVar1;

  

  if (param_1[2] == 0) {

    return;

  }

  if (*param_1 != 0) {

    if ((((int *)param_1[1] == (int *)0x0) ||

        (iVar1 = (**(code **)(*(int *)param_1[1] + 0x14))(), iVar1 != 0)) &&

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

      FUN_005293f0(0,0);

      return;

    }

    FUN_00529210(0,0);

    return;

  }

  return;

}





// --- FUN_00529530 at 0x00529530 (size: 77) ---


void __thiscall FUN_00529530(int *param_1,int *param_2)



{

  int iVar1;

  

  param_1[1] = (int)param_2;

  if (param_1[2] == 0) {

    return;

  }

  if (*param_1 != 0) {

    if (((param_2 == (int *)0x0) || (iVar1 = (**(code **)(*param_2 + 0x14))(), iVar1 != 0)) &&

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

      FUN_005293f0(1,0);

      return;

    }

    FUN_00529210(1,0);

    return;

  }

  return;

}





// --- FUN_00529580 at 0x00529580 (size: 77) ---


void __thiscall FUN_00529580(int *param_1,int param_2)



{

  int iVar1;

  

  param_1[2] = param_2;

  if (param_2 == 0) {

    return;

  }

  if (*param_1 != 0) {

    if ((((int *)param_1[1] == (int *)0x0) ||

        (iVar1 = (**(code **)(*(int *)param_1[1] + 0x14))(), iVar1 != 0)) &&

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

      FUN_005293f0(1,0);

      return;

    }

    FUN_00529210(1,0);

    return;

  }

  return;

}





// --- FUN_005295d0 at 0x005295D0 (size: 250) ---


undefined4 __thiscall FUN_005295d0(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  bool bVar6;

  undefined1 local_2c [4];

  uint uStack_28;

  undefined4 uStack_18;

  

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

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

    FUN_00510cc0();

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

    FUN_0051f260(param_2);

    FUN_00529480(1,iVar2 != 0);

    FUN_00524f80();

    for (puVar1 = *(undefined4 **)(param_2 + 0x20); puVar1 != (undefined4 *)0x0;

        puVar1 = (undefined4 *)*puVar1) {

      uVar3 = puVar1[3] & 0x7fff;

      uVar4 = *(uint *)(param_1 + 0x78) & 0x7fff;

      if (uVar4 < uVar3) {

        uVar5 = uVar3 - uVar4;

      }

      else {

        uVar5 = uVar4 - uVar3;

      }

      if (uVar5 < 0x4000) {

        bVar6 = uVar4 < uVar3;

      }

      else {

        bVar6 = uVar3 < uVar4;

      }

      if ((bVar6) &&

         (((*(int **)(param_1 + 4) != (int *)0x0 &&

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

          (puVar1[4] == 0)))) {

        *(undefined4 *)(param_1 + 0x78) = puVar1[3];

        uStack_18 = puVar1[2];

        uStack_28 = uStack_28 ^ (puVar1[4] << 0xc ^ uStack_28) & 0x1000;

        FUN_00528f70(puVar1[1],local_2c);

      }

    }

    return 1;

  }

  return 0;

}





// --- FUN_005296d0 at 0x005296D0 (size: 62) ---


void __fastcall FUN_005296d0(int param_1)



{

  int iVar1;

  

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

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

       (iVar1 = (**(code **)(**(int **)(param_1 + 4) + 0x2c))(), iVar1 == 0)) {

      return;

    }

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

      FUN_005108f0();

      FUN_00529480(0,0);

    }

  }

  return;

}





// --- FUN_00529710 at 0x00529710 (size: 112) ---


void __fastcall FUN_00529710(int param_1)



{

  int iVar1;

  undefined1 local_c [12];

  

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

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

       (iVar1 = (**(code **)(**(int **)(param_1 + 4) + 0x2c))(), iVar1 == 0)) {

      return;

    }

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

      FUN_00528cd0(local_c);

      FUN_00511fa0(local_c,1);

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

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

      FUN_005108f0();

      FUN_00529480(0,0);

    }

  }

  return;

}





// --- FUN_00529780 at 0x00529780 (size: 56) ---


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



{

  if ((param_2 == 0) != (*(int *)(param_1 + 0x18) != 2)) {

    *(uint *)(param_1 + 0x18) = (param_2 != 0) + 1;

    FUN_00529480(param_3,0);

  }

  return;

}





// --- FUN_005297c0 at 0x005297C0 (size: 71) ---


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



{

  int iVar1;

  

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

  if (param_2 != iVar1) {

    if (param_2 == 1) {

      if (iVar1 == 2) {

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

        FUN_00529480(param_3,0);

      }

    }

    else if ((param_2 == 2) && (iVar1 != 2)) {

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

      FUN_00529480(param_3,0);

      return;

    }

  }

  return;

}





// --- FUN_00529810 at 0x00529810 (size: 113) ---


undefined4 * FUN_00529810(undefined4 param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0x88);

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

    *puVar1 = 0;

    puVar1[1] = 0;

    puVar1[2] = 0;

    FUN_0051f300();

    FUN_0051f3e0();

    puVar1[0x1b] = 0x3f800000;

    puVar1[0x1f] = 0x3f800000;

    puVar1[0x1c] = 0;

    puVar1[0x1d] = 0;

    puVar1[0x1e] = 0;

    puVar1[0x20] = 0;

    puVar1[0x21] = 0;

    FUN_00529530(param_2);

    FUN_00529580(param_1);

    return puVar1;

  }

  return (undefined4 *)0x0;

}





// --- FUN_00529890 at 0x00529890 (size: 147) ---


void __fastcall FUN_00529890(undefined4 *param_1)



{

  undefined4 uVar1;

  undefined4 *puVar2;

  

  uVar1 = FUN_0051f300();

  FUN_0051f770(uVar1);

  FUN_005200d0();

  uVar1 = FUN_0051f3e0();

  FUN_0051f460(uVar1);

  FUN_0051fcc0();

  FUN_0050f530();

  puVar2 = (undefined4 *)FUN_005df0f5(0x10);

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

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = 0;

    puVar2[1] = 0;

    puVar2[2] = 0x41000003;

    puVar2[3] = 0;

  }

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

    param_1[0x20] = puVar2;

  }

  else {

    *(undefined4 *)param_1[0x21] = puVar2;

  }

  param_1[0x21] = puVar2;

  *param_1 = 1;

  FUN_00529710();

  return;

}





// --- FUN_00529930 at 0x00529930 (size: 350) ---


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



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  undefined **local_2c;

  undefined4 local_28;

  undefined4 local_24;

  undefined4 local_20;

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  iVar2 = param_3;

  uVar1 = param_2;

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

    return 8;

  }

  local_24 = *(undefined4 *)(param_3 + 8);

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

  local_20 = *(undefined4 *)(param_3 + 0xc);

  local_1c = *(undefined4 *)(param_3 + 0x10);

  local_18 = *(undefined4 *)(param_3 + 0x14);

  local_14 = *(undefined4 *)(param_3 + 0x18);

  local_10 = *(undefined4 *)(param_3 + 0x1c);

  local_c = *(undefined4 *)(param_3 + 0x20);

  local_8 = *(undefined4 *)(param_3 + 0x24);

  local_4 = *(undefined4 *)(param_3 + 0x28);

  local_2c = &PTR_FUN_007c91c0;

  if ((char)((uint)local_28 >> 8) < '\0') {

    FUN_00510cc0();

  }

  if ((*(uint *)(iVar2 + 4) & 0x800) != 0) {

    FUN_005297c0(*(undefined4 *)(iVar2 + 0x24),*(uint *)(iVar2 + 4) >> 0xf & 1);

  }

  FUN_00528c20(&param_2,&local_18,*(undefined4 *)(iVar2 + 0x24));

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

    if (uVar1 == 0x41000012) {

      return 0x3f;

    }

    if (uVar1 == 0x41000013) {

      return 0x40;

    }

    if (uVar1 == 0x41000014) {

      return 0x41;

    }

    if ((uVar1 & 0x2000000) != 0) {

      return 0x42;

    }

  }

  if ((uVar1 & 0x10000000) != 0) {

    uVar3 = FUN_0051f610();

    if (5 < uVar3) {

      return 0x45;

    }

  }

  iVar4 = FUN_00528f70(param_2,&local_2c);

  if ((iVar4 == 0) && ((*(uint *)(iVar2 + 4) & 0x2000) != 0)) {

    FUN_0051f670(uVar1,iVar2);

  }

  return iVar4;

}





// --- FUN_00529a90 at 0x00529A90 (size: 189) ---


undefined4 FUN_00529a90(undefined4 *param_1)



{

  undefined4 uVar1;

  

  switch(*param_1) {

  case 1:

    uVar1 = FUN_00529930(param_1[1],param_1[0x18]);

    FUN_00510900();

    return uVar1;

  case 2:

    uVar1 = FUN_00528f70(param_1[1],param_1[0x18]);

    FUN_00510900();

    return uVar1;

  case 3:

    uVar1 = FUN_00529140(param_1[1],param_1[0x18]);

    FUN_00510900();

    return uVar1;

  case 4:

    uVar1 = FUN_00529080(param_1[1],param_1[0x18]);

    FUN_00510900();

    return uVar1;

  case 5:

    FUN_00528a50();

    FUN_00510900();

    return 0;

  default:

    return 0x47;

  }

}





// --- FUN_00529b70 at 0x00529B70 (size: 77) ---


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



bool FUN_00529b70(float param_1,float param_2,int param_3)



{

  bool bVar1;

  ushort uVar2;

  

  if (ABS(param_1 - param_2) <= (float)_DAT_007c64e0) {

    uVar2 = (ushort)(param_1 < param_2) << 8 | (ushort)(param_1 == param_2) << 0xe;

  }

  else {

    uVar2 = (ushort)(param_2 < param_1) << 8 | (ushort)(param_2 == param_1) << 0xe;

  }

  bVar1 = uVar2 == 0;

  if (param_3 != 0x6500000d) {

    bVar1 = !bVar1;

  }

  return bVar1;

}





// --- FUN_00529bc0 at 0x00529BC0 (size: 90) ---


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



float10 FUN_00529bc0(float param_1,float param_2,int param_3)



{

  float10 fVar1;

  

  fVar1 = (float10)param_1 - (float10)param_2;

  if (ABS(fVar1) < (float10)_DAT_007c97c8) {

    fVar1 = (float10)DAT_00796344;

  }

  if (fVar1 < -(float10)_DAT_007c97c8) {

    fVar1 = fVar1 + (float10)_DAT_0079cc60;

  }

  if (((float10)_DAT_007c97c8 < fVar1) && (param_3 != 0x6500000d)) {

    fVar1 = (float10)_DAT_0079cc60 - fVar1;

  }

  return fVar1;

}





// --- FUN_00529c20 at 0x00529C20 (size: 105) ---


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



{

  int iVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  int iVar4;

  

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

    return 8;

  }

  iVar1 = FUN_00512b90();

  iVar4 = param_3;

  if (iVar1 == 0) {

    return 0xb;

  }

  uVar2 = *(undefined4 *)(param_3 + 0x24);

  iVar1 = param_3 + 0x14;

  puVar3 = &param_2;

  FUN_00512b90(puVar3,iVar1,uVar2);

  FUN_00528c20(puVar3,iVar1,uVar2);

  uVar2 = param_2;

  FUN_00512b90(param_2,iVar4);

  uVar2 = FUN_00528f70(uVar2,iVar4);

  return uVar2;

}





// --- FUN_00529c90 at 0x00529C90 (size: 105) ---


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



{

  int iVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  int iVar4;

  

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

    return 8;

  }

  iVar1 = FUN_00512b90();

  iVar4 = param_3;

  if (iVar1 == 0) {

    return 0xb;

  }

  uVar2 = *(undefined4 *)(param_3 + 0x24);

  iVar1 = param_3 + 0x14;

  puVar3 = &param_2;

  FUN_00512b90(puVar3,iVar1,uVar2);

  FUN_00528c20(puVar3,iVar1,uVar2);

  uVar2 = param_2;

  FUN_00512b90(param_2,iVar4);

  uVar2 = FUN_00529080(uVar2,iVar4);

  return uVar2;

}





// --- FUN_00529d00 at 0x00529D00 (size: 188) ---


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



undefined4 __thiscall FUN_00529d00(int param_1,float param_2)



{

  double dVar1;

  double dVar2;

  undefined4 uVar3;

  

  dVar1 = (double)CONCAT44(DAT_008379ac,DAT_008379a8) - *(double *)(param_1 + 0x110);

  if (dVar1 <= (double)_DAT_007938b0) {

    return 1;

  }

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

    dVar2 = (double)*(float *)(param_1 + 0x10c) - (double)param_2;

  }

  else {

    dVar2 = (double)param_2 - (double)*(float *)(param_1 + 0x10c);

  }

  if ((double)_DAT_007c97cc <= dVar2 / dVar1) {

    *(float *)(param_1 + 0x10c) = param_2;

    uVar3 = DAT_008379a8;

    *(undefined4 *)(param_1 + 0x114) = DAT_008379ac;

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

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

      dVar1 = (double)*(float *)(param_1 + 0x118) - (double)param_2;

    }

    else {

      dVar1 = (double)param_2 - (double)*(float *)(param_1 + 0x118);

    }

    if ((double)_DAT_007c97cc <=

        dVar1 / ((double)CONCAT44(DAT_008379ac,DAT_008379a8) - *(double *)(param_1 + 0x120))) {

      return 1;

    }

  }

  return 0;

}





// --- FUN_00529dc0 at 0x00529DC0 (size: 102) ---


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



float10 __fastcall FUN_00529dc0(int param_1)



{

  float10 fVar1;

  

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

    return (float10)_DAT_007c78e8;

  }

  if ((*(uint *)(param_1 + 0xe0) & 0x400) != 0) {

    fVar1 = (float10)FUN_0050f4b0(*(int *)(param_1 + 0x154) + 0x48,*(undefined4 *)(param_1 + 0x134),

                                  *(undefined4 *)(param_1 + 0x138),param_1 + 0x4c);

    fVar1 = (float10)FUN_0050f490((float)fVar1);

    fVar1 = (float10)FUN_005aa8a0((float)fVar1);

    return fVar1;

  }

  fVar1 = (float10)FUN_005aa560(param_1 + 0x4c);

  return fVar1;

}





// --- FUN_00529e30 at 0x00529E30 (size: 10) ---


bool __fastcall FUN_00529e30(int *param_1)



{

  return *param_1 != 0;

}





// --- FUN_00529e40 at 0x00529E40 (size: 13) ---


void __thiscall FUN_00529e40(int param_1,undefined4 param_2)



{

  *(undefined4 *)(param_1 + 0x158) = param_2;

  return;

}





// --- FUN_00529e50 at 0x00529E50 (size: 13) ---


void __thiscall FUN_00529e50(int param_1,undefined4 param_2)



{

  *(undefined4 *)(param_1 + 0x154) = param_2;

  return;

}





// --- FUN_00529e60 at 0x00529E60 (size: 299) ---


void __fastcall FUN_00529e60(undefined4 *param_1)



{

  undefined4 uVar1;

  undefined4 local_40;

  undefined4 local_3c;

  undefined4 local_38;

  undefined4 local_34;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  *param_1 = 0;

  param_1[0x38] = 0;

  param_1[0x3f] = 0;

  param_1[0x43] = 0x7f7fffff;

  uVar1 = DAT_008379ac;

  param_1[0x44] = DAT_008379a8;

  param_1[0x45] = uVar1;

  param_1[0x46] = 0x7f7fffff;

  uVar1 = DAT_008379a8;

  param_1[0x49] = DAT_008379ac;

  param_1[0x48] = uVar1;

  param_1[0x42] = 0;

  param_1[0x4a] = 0;

  param_1[0x4f] = 0;

  param_1[0x50] = 0;

  param_1[0x51] = 0;

  param_1[0x52] = 0;

  local_40 = 0x3f800000;

  local_3c = 0;

  local_38 = 0;

  local_34 = 0;

  local_c = 0;

  local_8 = 0;

  local_4 = 0;

  FUN_00535b30();

  param_1[2] = 0;

  FUN_00425f10(&local_40);

  local_40 = 0x3f800000;

  local_3c = 0;

  local_38 = 0;

  local_34 = 0;

  local_c = 0;

  local_8 = 0;

  local_4 = 0;

  FUN_00535b30();

  param_1[0x14] = 0;

  FUN_00425f10(&local_40);

  param_1[0x4b] = 0;

  param_1[0x4c] = 0;

  param_1[0x4d] = 0;

  param_1[0x4e] = 0;

  return;

}





// --- FUN_00529f90 at 0x00529F90 (size: 34) ---


void __fastcall FUN_00529f90(int param_1)



{

  void *pvVar1;

  

  pvVar1 = *(void **)(param_1 + 0x14c);

  if (pvVar1 != (void *)0x0) {

    FUN_00410880(pvVar1);

    if (pvVar1 != (void *)0x0) {

      operator_delete(pvVar1);

    }

  }

  return;

}





// --- FUN_00529fc0 at 0x00529FC0 (size: 188) ---


int __fastcall FUN_00529fc0(int param_1)



{

  *(undefined ***)(param_1 + 4) = &PTR_LAB_00797910;

  *(undefined4 *)(param_1 + 8) = 0;

  *(undefined4 *)(param_1 + 0xc) = 0x3f800000;

  *(undefined4 *)(param_1 + 0x10) = 0;

  *(undefined4 *)(param_1 + 0x14) = 0;

  *(undefined4 *)(param_1 + 0x18) = 0;

  *(undefined4 *)(param_1 + 0x40) = 0;

  *(undefined4 *)(param_1 + 0x44) = 0;

  *(undefined4 *)(param_1 + 0x48) = 0;

  FUN_00535b30();

  *(undefined ***)(param_1 + 0x4c) = &PTR_LAB_00797910;

  *(undefined4 *)(param_1 + 0x50) = 0;

  *(undefined4 *)(param_1 + 0x54) = 0x3f800000;

  *(undefined4 *)(param_1 + 0x58) = 0;

  *(undefined4 *)(param_1 + 0x5c) = 0;

  *(undefined4 *)(param_1 + 0x60) = 0;

  *(undefined4 *)(param_1 + 0x88) = 0;

  *(undefined4 *)(param_1 + 0x8c) = 0;

  *(undefined4 *)(param_1 + 0x90) = 0;

  FUN_00535b30();

  *(undefined ***)(param_1 + 0x94) = &PTR_LAB_00797910;

  *(undefined4 *)(param_1 + 0x98) = 0;

  *(undefined4 *)(param_1 + 0x9c) = 0x3f800000;

  *(undefined4 *)(param_1 + 0xa0) = 0;

  *(undefined4 *)(param_1 + 0xa4) = 0;

  *(undefined4 *)(param_1 + 0xa8) = 0;

  *(undefined4 *)(param_1 + 0xd0) = 0;

  *(undefined4 *)(param_1 + 0xd4) = 0;

  *(undefined4 *)(param_1 + 0xd8) = 0;

  FUN_00535b30();

  FUN_00524f80();

  *(undefined4 *)(param_1 + 0x14c) = 0;

  *(undefined4 *)(param_1 + 0x150) = 0;

  *(undefined4 *)(param_1 + 0x154) = 0;

  *(undefined4 *)(param_1 + 0x158) = 0;

  FUN_00529e60();

  return param_1;

}





// --- FUN_0052a080 at 0x0052A080 (size: 52) ---


int FUN_0052a080(undefined4 param_1,undefined4 param_2)



{

  int iVar1;

  

  iVar1 = FUN_005df0f5(0x160);

  if (iVar1 != 0) {

    iVar1 = FUN_00529fc0();

    if (iVar1 != 0) {

      *(undefined4 *)(iVar1 + 0x154) = param_1;

      *(undefined4 *)(iVar1 + 0x158) = param_2;

    }

    return iVar1;

  }

  return 0;

}





// --- FUN_0052a0c0 at 0x0052A0C0 (size: 124) ---


void __fastcall FUN_0052a0c0(int param_1)



{

  int iVar1;

  int *piVar2;

  undefined4 *puVar3;

  

  iVar1 = *(int *)(param_1 + 0x14c);

  while (iVar1 != 0) {

    piVar2 = *(int **)(param_1 + 0x14c);

    if (piVar2 != (int *)0x0) {

      if ((int *)piVar2[1] == (int *)0x0) {

        iVar1 = *piVar2;

        *(int *)(param_1 + 0x14c) = iVar1;

        if (iVar1 != 0) {

          *(undefined4 *)(iVar1 + 4) = 0;

        }

      }

      else {

        *(int *)piVar2[1] = *piVar2;

      }

      if (*piVar2 == 0) {

        puVar3 = *(undefined4 **)(*(int *)(param_1 + 0x150) + 4);

        *(undefined4 **)(param_1 + 0x150) = puVar3;

        if (puVar3 != (undefined4 *)0x0) {

          *puVar3 = 0;

        }

      }

      else {

        *(int *)(*piVar2 + 4) = piVar2[1];

      }

      *piVar2 = 0;

      piVar2[1] = 0;

      if (piVar2 != (int *)0x0) {

        operator_delete(piVar2);

      }

    }

    iVar1 = *(int *)(param_1 + 0x14c);

  }

  FUN_00529e60();

  return;

}





// --- FUN_0052a140 at 0x0052A140 (size: 68) ---


void __thiscall FUN_0052a140(int param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0x10);

  if (puVar1 == (undefined4 *)0x0) {

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0;

    puVar1[2] = 0;

    puVar1[3] = 0;

  }

  puVar1[3] = param_2;

  puVar1[2] = 9;

  FUN_00410820(puVar1,*(undefined4 *)(param_1 + 0x150));

  return;

}





// --- FUN_0052a190 at 0x0052A190 (size: 59) ---


void __fastcall FUN_0052a190(int param_1)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0x10);

  if (puVar1 == (undefined4 *)0x0) {

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0;

    puVar1[2] = 0;

    puVar1[3] = 0;

  }

  puVar1[2] = 7;

  FUN_00410820(puVar1,*(undefined4 *)(param_1 + 0x150));

  return;

}





// --- FUN_0052a1d0 at 0x0052A1D0 (size: 133) ---


void __fastcall FUN_0052a1d0(int *param_1)



{

  undefined1 local_2c [4];

  uint local_28;

  int local_8;

  

  FUN_00524f80();

  local_8 = param_1[0x40];

  local_28 = local_28 & 0xffff7fff;

  if (param_1[0x55] != 0) {

    if (param_1[0x4f] != 0) {

      FUN_00529c90(param_1[0x4f],local_2c);

    }

    if (param_1[0x50] != 0) {

      FUN_00529c90(param_1[0x50],local_2c);

    }

    if ((param_1[0x4c] != 0) && (*param_1 != 0)) {

      FUN_0050f860();

    }

  }

  FUN_00529e60();

  return;

}





// --- FUN_0052a260 at 0x0052A260 (size: 35) ---


void __fastcall FUN_0052a260(int param_1)



{

  FUN_0052a1d0();

  if (*(int *)(param_1 + 0x154) != 0) {

    FUN_00510c50();

    return;

  }

  return;

}





// --- FUN_0052a290 at 0x0052A290 (size: 336) ---


void __thiscall

FUN_0052a290(undefined4 *param_1,undefined4 param_2,int param_3,undefined4 param_4,

            undefined4 param_5,int param_6)



{

  if (param_1[0x55] == 0) {

    FUN_00535b30();

  }

  else {

    FUN_00510c50(0);

    param_1[0x26] = *(undefined4 *)(param_1[0x55] + 0x4c);

    FUN_00425f10(param_1[0x55] + 0x50);

    param_1[0x4b] = param_2;

    param_1[0x4d] = param_4;

    param_1[0x4e] = param_5;

    *param_1 = 6;

    param_1[0x4c] = param_3;

    param_1[0x38] = *(undefined4 *)(param_6 + 4);

    param_1[0x39] = *(undefined4 *)(param_6 + 8);

    param_1[0x3a] = *(undefined4 *)(param_6 + 0xc);

    param_1[0x3b] = *(undefined4 *)(param_6 + 0x10);

    param_1[0x3c] = *(undefined4 *)(param_6 + 0x14);

    param_1[0x3d] = *(undefined4 *)(param_6 + 0x18);

    param_1[0x3e] = *(undefined4 *)(param_6 + 0x1c);

    param_1[0x3f] = *(undefined4 *)(param_6 + 0x20);

    param_1[0x40] = *(undefined4 *)(param_6 + 0x24);

    param_1[0x41] = *(undefined4 *)(param_6 + 0x28);

    param_1[0x52] = 0;

    if (param_3 != *(int *)(param_1[0x55] + 8)) {

      FUN_0050f800(0,param_1[0x4c],0x3f000000,0,0);

      return;

    }

    FUN_0052a1d0();

  }

  if (param_1[0x55] == 0) {

    return;

  }

  FUN_00510c50(0);

  return;

}





// --- FUN_0052a3e0 at 0x0052A3E0 (size: 338) ---


void __thiscall FUN_0052a3e0(undefined4 *param_1,undefined4 param_2,int param_3,int param_4)



{

  if (param_1[0x55] == 0) {

    param_1[0x3f] = *(undefined4 *)(param_4 + 0x20);

    FUN_00535b30();

  }

  else {

    if ((*(byte *)(param_4 + 6) & 1) != 0) {

      FUN_00510c50(0);

    }

    *param_1 = 8;

    param_1[0x4b] = param_2;

    FUN_00536b80(*(undefined4 *)(param_4 + 0x10));

    param_1[0x4c] = param_3;

    param_1[0x38] = *(undefined4 *)(param_4 + 4);

    param_1[0x39] = *(undefined4 *)(param_4 + 8);

    param_1[0x3a] = *(undefined4 *)(param_4 + 0xc);

    param_1[0x3b] = *(undefined4 *)(param_4 + 0x10);

    param_1[0x3c] = *(undefined4 *)(param_4 + 0x14);

    param_1[0x3d] = *(undefined4 *)(param_4 + 0x18);

    param_1[0x3e] = *(undefined4 *)(param_4 + 0x1c);

    param_1[0x3f] = *(undefined4 *)(param_4 + 0x20);

    param_1[0x40] = *(undefined4 *)(param_4 + 0x24);

    param_1[0x41] = *(undefined4 *)(param_4 + 0x28);

    if (param_3 != *(int *)(param_1[0x55] + 8)) {

      param_1[0x52] = 0;

      FUN_0050f800(0,param_3,0x3f000000,0,0);

      return;

    }

    FUN_0052a1d0();

  }

  if (param_1[0x55] == 0) {

    return;

  }

  FUN_00510c50(0);

  return;

}





// --- FUN_0052a540 at 0x0052A540 (size: 153) ---


void __fastcall FUN_0052a540(int *param_1)



{

  int iVar1;

  int *piVar2;

  undefined4 *puVar3;

  

  if (*param_1 != 0) {

    iVar1 = param_1[0x53];

    while (iVar1 != 0) {

      piVar2 = (int *)param_1[0x53];

      if (piVar2 != (int *)0x0) {

        if ((int *)piVar2[1] == (int *)0x0) {

          iVar1 = *piVar2;

          param_1[0x53] = iVar1;

          if (iVar1 != 0) {

            *(undefined4 *)(iVar1 + 4) = 0;

          }

        }

        else {

          *(int *)piVar2[1] = *piVar2;

        }

        if (*piVar2 == 0) {

          puVar3 = *(undefined4 **)(param_1[0x54] + 4);

          param_1[0x54] = (int)puVar3;

          if (puVar3 != (undefined4 *)0x0) {

            *puVar3 = 0;

          }

        }

        else {

          *(int *)(*piVar2 + 4) = piVar2[1];

        }

        *piVar2 = 0;

        piVar2[1] = 0;

        if (piVar2 != (int *)0x0) {

          operator_delete(piVar2);

        }

      }

      iVar1 = param_1[0x53];

    }

    FUN_0052a1d0();

    if (param_1[0x55] != 0) {

      FUN_00510c50(0);

    }

  }

  return;

}





// --- FUN_0052a5e0 at 0x0052A5E0 (size: 33) ---


void __fastcall FUN_0052a5e0(int param_1)



{

  FUN_0052a0c0();

  *(undefined ***)(param_1 + 0xdc) = &PTR_FUN_0079385c;

  *(undefined ***)(param_1 + 0x94) = &PTR_FUN_0079385c;

  *(undefined ***)(param_1 + 0x4c) = &PTR_FUN_0079385c;

  *(undefined ***)(param_1 + 4) = &PTR_FUN_0079385c;

  return;

}





// --- FUN_0052a610 at 0x0052A610 (size: 397) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __fastcall FUN_0052a610(int param_1)



{

  float fVar1;

  void *pvVar2;

  undefined4 uVar3;

  int iVar4;

  float10 fVar5;

  float10 fVar6;

  float fStack_40;

  int iStack_38;

  undefined4 uStack_34;

  undefined4 uStack_30;

  undefined1 auStack_2c [4];

  uint uStack_28;

  undefined4 uStack_18;

  undefined4 uStack_8;

  

  if (*(int *)(param_1 + 0x154) == 0) {

    FUN_0052a540(8);

    return;

  }

  fVar5 = (float10)FUN_00529dc0();

  fVar1 = (float)fVar5;

  fVar5 = (float10)FUN_00512010();

  fVar6 = (float10)FUN_005aa5d0(param_1 + 0x4c);

  fStack_40 = (float)(fVar6 - (float10)(float)fVar5);

  if (ABS(fVar6 - (float10)(float)fVar5) < (float10)_DAT_007c97c8) {

    fStack_40 = 0.0;

  }

  if (fStack_40 < -_DAT_007c97c8) {

    fStack_40 = fStack_40 + _DAT_0079cc60;

  }

  FUN_0052b610(fVar1,fStack_40,&iStack_38,&uStack_34,&uStack_30);

  iVar4 = iStack_38;

  if (iStack_38 == 0) {

    pvVar2 = *(void **)(param_1 + 0x14c);

    if (pvVar2 != (void *)0x0) {

      FUN_00410880(pvVar2);

      if (pvVar2 != (void *)0x0) {

        operator_delete(pvVar2);

      }

    }

    FUN_0052a8c0();

    return;

  }

  FUN_00524f80();

  uStack_18 = *(undefined4 *)(param_1 + 0xf0);

  uStack_8 = uStack_34;

  uStack_28 = uStack_28 & 0xffff7fff;

  iVar4 = FUN_00529c20(iVar4,auStack_2c);

  if (iVar4 != 0) {

    FUN_0052a540(iVar4);

    return;

  }

  *(int *)(param_1 + 0x13c) = iStack_38;

  *(undefined4 *)(param_1 + 0x144) = uStack_30;

  *(undefined4 *)(param_1 + 0x100) = uStack_34;

  *(float *)(param_1 + 0x10c) = fVar1;

  uVar3 = DAT_008379ac;

  *(undefined4 *)(param_1 + 0x110) = DAT_008379a8;

  *(undefined4 *)(param_1 + 0x114) = uVar3;

  *(float *)(param_1 + 0x118) = fVar1;

  uVar3 = DAT_008379ac;

  *(undefined4 *)(param_1 + 0x120) = DAT_008379a8;

  *(undefined4 *)(param_1 + 0x124) = uVar3;

  return;

}





// --- FUN_0052a7a0 at 0x0052A7A0 (size: 288) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __fastcall FUN_0052a7a0(int param_1)



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  float10 fVar4;

  undefined1 auStack_2c [4];

  uint uStack_28;

  undefined4 uStack_18;

  undefined4 uStack_8;

  

  iVar2 = *(int *)(param_1 + 0x14c);

  if ((iVar2 == 0) || (*(int *)(param_1 + 0x154) == 0)) {

    FUN_0052a540(8);

  }

  else {

    iVar1 = FUN_0050f580();

    if (iVar1 == 0) {

      uVar3 = *(undefined4 *)(iVar2 + 0xc);

      fVar4 = (float10)FUN_00512010(0x6500000d);

      fVar4 = (float10)FUN_00529bc0(uVar3,(float)fVar4);

      if (fVar4 < (float10)_DAT_0079cc8c == (fVar4 == (float10)_DAT_0079cc8c)) {

        if ((float10)_DAT_0079cc60 <= (float10)_DAT_007c97c8 + fVar4) goto LAB_0052a89d;

        uVar3 = 0x6500000e;

      }

      else {

        if (fVar4 <= (float10)_DAT_007c97c8) {

LAB_0052a89d:

          FUN_00529f90();

          FUN_0052a8c0();

          return;

        }

        uVar3 = 0x6500000d;

      }

      FUN_00524f80();

      uStack_18 = *(undefined4 *)(param_1 + 0xf0);

      uStack_8 = *(undefined4 *)(param_1 + 0x100);

      uStack_28 = uStack_28 & 0xffff7fff;

      iVar2 = FUN_00529c20(uVar3,auStack_2c);

      if (iVar2 != 0) {

        FUN_0052a540(iVar2);

        return;

      }

      *(undefined4 *)(param_1 + 0x13c) = uVar3;

      *(float *)(param_1 + 0x108) = (float)fVar4;

      return;

    }

  }

  return;

}





// --- FUN_0052a8c0 at 0x0052A8C0 (size: 178) ---


void __fastcall FUN_0052a8c0(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  

  if (*(int *)(param_1 + 0x14c) == 0) {

    if (*(char *)(param_1 + 0xe0) < '\0') {

      uVar4 = *(undefined4 *)(param_1 + 0x138);

      uVar3 = *(undefined4 *)(param_1 + 0x134);

      uVar2 = *(undefined4 *)(param_1 + 0x130);

      FUN_0052a1d0();

      if (*(int *)(param_1 + 0x154) != 0) {

        FUN_00510c50(0);

      }

      FUN_00512c00(uVar2,uVar3,uVar4);

      FUN_00555e50(uVar2,uVar3,uVar4);

      return;

    }

    FUN_0052a1d0();

    if (*(int *)(param_1 + 0x154) != 0) {

      FUN_00510c50(0);

    }

  }

  else {

    iVar1 = *(int *)(*(int *)(param_1 + 0x14c) + 8);

    if (iVar1 == 7) {

      FUN_0052a610();

      return;

    }

    if (iVar1 == 9) {

      FUN_0052a7a0();

      return;

    }

  }

  return;

}





// --- FUN_0052a980 at 0x0052A980 (size: 11) ---


void __fastcall FUN_0052a980(int *param_1)



{

  if (*param_1 != 0) {

    FUN_0052a8c0();

    return;

  }

  return;

}





// --- FUN_0052a990 at 0x0052A990 (size: 831) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __fastcall FUN_0052a990(int *param_1)



{

  float fVar1;

  void *pvVar2;

  float fVar3;

  int iVar4;

  float *pfVar5;

  float10 fVar6;

  float10 fVar7;

  undefined1 local_80 [4];

  uint local_7c;

  int local_6c;

  int local_5c;

  undefined1 auStack_54 [12];

  undefined **local_48;

  undefined4 local_44;

  

  iVar4 = param_1[0x55];

  if (iVar4 == 0) {

    FUN_0052a540(8);

    return;

  }

  local_48 = &PTR_LAB_00797910;

  local_44 = *(undefined4 *)(iVar4 + 0x4c);

  FUN_00425f10(iVar4 + 0x50);

  FUN_00524f80();

  local_6c = param_1[0x3c];

  local_5c = param_1[0x40];

  local_7c = local_7c & 0xffff7fff;

  iVar4 = FUN_0050f580();

  if (iVar4 == 0) {

    fVar6 = (float10)FUN_005aa5d0(param_1 + 0x13);

    fVar7 = (float10)FUN_0052b6e0(param_1[0x4f],param_1[0x51]);

    fVar1 = (float)(fVar7 + (float10)(float)fVar6);

    if ((float10)_DAT_0079cc60 <= fVar7 + (float10)(float)fVar6) {

      fVar1 = fVar1 - _DAT_0079cc60;

    }

    fVar6 = (float10)FUN_00512010();

    fVar6 = (float10)fVar1 - fVar6;

    if (ABS(fVar6) < (float10)_DAT_007c97c8) {

      fVar6 = (float10)DAT_00796344;

    }

    if (fVar6 < -(float10)_DAT_007c97c8) {

      fVar6 = fVar6 + (float10)_DAT_0079cc60;

    }

    if ((fVar6 <= (float10)_DAT_007c97c4) ||

       ((float10)_DAT_0079cc60 - (float10)_DAT_007c97c4 <= fVar6)) {

      iVar4 = param_1[0x50];

      goto joined_r0x0052ab0e;

    }

    iVar4 = 0x6500000d;

    if ((float10)_DAT_0079cc8c <= fVar6) {

      iVar4 = 0x6500000e;

    }

    if (iVar4 != param_1[0x50]) {

      FUN_00529c20(iVar4,local_80);

      param_1[0x50] = iVar4;

    }

  }

  else {

    iVar4 = param_1[0x50];

joined_r0x0052ab0e:

    if (iVar4 != 0) {

      FUN_00529c90(iVar4,local_80);

      param_1[0x50] = 0;

    }

  }

  fVar6 = (float10)FUN_00529dc0();

  fVar1 = (float)fVar6;

  iVar4 = FUN_00529d00(fVar1);

  if (iVar4 == 0) {

    iVar4 = FUN_0050f620();

    if ((iVar4 == 0) && (iVar4 = FUN_0050f580(), iVar4 == 0)) {

      param_1[0x4a] = param_1[0x4a] + 1;

    }

    goto LAB_0052ac2a;

  }

  param_1[0x4a] = 0;

  if (param_1[0x51] == 0) {

    if (fVar1 < (float)param_1[0x39] != (fVar1 == (float)param_1[0x39])) goto LAB_0052aba4;

  }

  else if ((float)param_1[0x3a] <= fVar1) {

LAB_0052aba4:

    pvVar2 = (void *)param_1[0x53];

    if ((pvVar2 != (void *)0x0) && (FUN_00410880(pvVar2), pvVar2 != (void *)0x0)) {

      operator_delete(pvVar2);

    }

    FUN_00529c90(param_1[0x4f],local_80);

    param_1[0x4f] = 0;

    if (param_1[0x50] != 0) {

      FUN_00529c90(param_1[0x50],local_80);

      param_1[0x50] = 0;

    }

    FUN_0052a8c0();

    goto LAB_0052ac2a;

  }

  fVar6 = (float10)FUN_005aa560(param_1[0x55] + 0x48);

  if ((float10)(float)param_1[0x3d] < fVar6) {

    FUN_0052a540(0x3d);

  }

LAB_0052ac2a:

  if ((param_1[0x4c] != 0) && (*param_1 != 0)) {

    pfVar5 = (float *)FUN_00511e90(auStack_54);

    fVar3 = SQRT(pfVar5[2] * pfVar5[2] + pfVar5[1] * pfVar5[1] + *pfVar5 * *pfVar5);

    if ((float)_DAT_007a7e00 < fVar3) {

      fVar1 = fVar1 / fVar3;

      fVar6 = (float10)FUN_0050f890();

      if ((float10)_DAT_007938c0 < ABS((float10)fVar1 - fVar6)) {

        FUN_0050f870((double)fVar1);

        return;

      }

    }

  }

  return;

}





// --- FUN_0052acd0 at 0x0052ACD0 (size: 370) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __fastcall FUN_0052acd0(int param_1)



{

  float fVar1;

  undefined4 uVar2;

  void *pvVar3;

  int iVar4;

  int iVar5;

  float10 fVar6;

  undefined1 auStack_2c [4];

  uint uStack_28;

  undefined4 uStack_8;

  

  if (*(int *)(param_1 + 0x154) == 0) {

    FUN_0052a540(8);

    return;

  }

  if ((*(int *)(param_1 + 0x13c) != 0x6500000e) && (*(int *)(param_1 + 0x13c) != 0x6500000d)) {

    FUN_0052a7a0();

    return;

  }

  iVar5 = *(int *)(param_1 + 0x14c);

  fVar6 = (float10)FUN_00512010();

  fVar1 = (float)fVar6;

  uVar2 = *(undefined4 *)(param_1 + 0x13c);

  iVar4 = FUN_00529b70(fVar1,*(undefined4 *)(iVar5 + 0xc),uVar2);

  if (iVar4 != 0) {

    *(undefined4 *)(param_1 + 0x128) = 0;

    FUN_00514c60(*(undefined4 *)(iVar5 + 0xc),1);

    pvVar3 = *(void **)(param_1 + 0x14c);

    if ((pvVar3 != (void *)0x0) && (FUN_00410880(pvVar3), pvVar3 != (void *)0x0)) {

      operator_delete(pvVar3);

    }

    FUN_00524f80();

    uStack_8 = *(undefined4 *)(param_1 + 0x100);

    uStack_28 = uStack_28 & 0xffff7fff;

    FUN_00529c90(*(undefined4 *)(param_1 + 0x13c),auStack_2c);

    *(undefined4 *)(param_1 + 0x13c) = 0;

    FUN_0052a8c0();

    return;

  }

  fVar6 = (float10)FUN_00529bc0(fVar1,*(undefined4 *)(param_1 + 0x108),uVar2);

  if ((fVar6 < (float10)_DAT_0079cc8c) && ((float10)_DAT_007c97c8 < fVar6)) {

    *(undefined4 *)(param_1 + 0x128) = 0;

    *(float *)(param_1 + 0x108) = fVar1;

    return;

  }

  *(float *)(param_1 + 0x108) = fVar1;

  iVar5 = FUN_0050f620();

  if ((iVar5 == 0) && (iVar5 = FUN_0050f580(), iVar5 == 0)) {

    *(int *)(param_1 + 0x128) = *(int *)(param_1 + 0x128) + 1;

  }

  return;

}





// --- FUN_0052ae50 at 0x0052AE50 (size: 442) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_0052ae50(undefined4 *param_1,float param_2,int param_3)



{

  int iVar1;

  int iVar2;

  float10 fVar3;

  float10 fVar4;

  float10 fVar5;

  int iStack_c;

  undefined1 auStack_8 [4];

  undefined1 auStack_4 [4];

  

  iVar2 = (int)param_2;

  if (param_1[0x55] != 0) {

    FUN_00510c50(0);

    iVar1 = (int)param_2 + 8;

    param_1[0x14] = *(undefined4 *)((int)param_2 + 4);

    FUN_00425f10(iVar1);

    param_1[0x4d] = 0;

    fVar3 = (float10)FUN_00529dc0();

    fVar4 = (float10)FUN_00512010();

    fVar5 = (float10)FUN_005aa5d0(param_2);

    param_2 = (float)(fVar5 - (float10)(float)fVar4);

    if (ABS(fVar5 - (float10)(float)fVar4) < (float10)_DAT_007c97c8) {

      param_2 = 0.0;

    }

    if (param_2 < -_DAT_007c97c8) {

      param_2 = param_2 + _DAT_0079cc60;

    }

    FUN_0052b610((float)fVar3,param_2,&iStack_c,auStack_4,auStack_8);

    if (iStack_c != 0) {

      fVar3 = (float10)FUN_005aa5d0(iVar2);

      FUN_0052a140((float)fVar3);

      FUN_0052a190();

    }

    if ((*(byte *)(param_3 + 4) & 0x40) != 0) {

      FUN_0052a140(*(undefined4 *)(param_3 + 0x10));

    }

    param_1[2] = *(undefined4 *)(iVar2 + 4);

    FUN_00425f10(iVar1);

    param_1[0x26] = *(undefined4 *)(param_1[0x55] + 0x4c);

    FUN_00425f10(param_1[0x55] + 0x50);

    *param_1 = 7;

    param_1[0x38] = *(undefined4 *)(param_3 + 4);

    param_1[0x39] = *(undefined4 *)(param_3 + 8);

    param_1[0x3a] = *(undefined4 *)(param_3 + 0xc);

    param_1[0x3b] = *(undefined4 *)(param_3 + 0x10);

    param_1[0x3c] = *(undefined4 *)(param_3 + 0x14);

    param_1[0x3d] = *(undefined4 *)(param_3 + 0x18);

    param_1[0x3e] = *(undefined4 *)(param_3 + 0x1c);

    param_1[0x3f] = *(undefined4 *)(param_3 + 0x20);

    param_1[0x40] = *(undefined4 *)(param_3 + 0x24);

    param_1[0x41] = *(undefined4 *)(param_3 + 0x28);

    param_1[0x38] = param_1[0x38] & 0xffffff7f;

    FUN_0052a8c0();

  }

  return;

}





// --- FUN_0052b010 at 0x0052B010 (size: 332) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_0052b010(int param_1,int param_2,float param_3)



{

  float fVar1;

  float10 fVar2;

  float10 fVar3;

  int iStack_c;

  undefined1 auStack_8 [4];

  undefined1 auStack_4 [4];

  

  if (*(int *)(param_1 + 0x154) == 0) {

    FUN_0052a540(8);

    return;

  }

  *(undefined4 *)(param_1 + 8) = *(undefined4 *)((int)param_3 + 4);

  FUN_00425f10((int)param_3 + 8);

  *(undefined4 *)(param_1 + 0x50) = *(undefined4 *)(param_2 + 4);

  FUN_00425f10(param_2 + 8);

  fVar2 = (float10)FUN_005aa5d0(param_3);

  fVar1 = (float)fVar2;

  fVar2 = (float10)FUN_00529dc0();

  fVar3 = (float10)FUN_00512010();

  param_3 = (float)((float10)fVar1 - fVar3);

  if (ABS((float10)fVar1 - fVar3) < (float10)_DAT_007c97c8) {

    param_3 = 0.0;

  }

  if (param_3 < -_DAT_007c97c8) {

    param_3 = param_3 + _DAT_0079cc60;

  }

  FUN_0052b610((float)fVar2,param_3,&iStack_c,auStack_4,auStack_8);

  if (iStack_c != 0) {

    FUN_0052a140(fVar1);

    FUN_0052a190();

  }

  if ((*(byte *)(param_1 + 0xe0) & 0x40) != 0) {

    param_3 = fVar1 + *(float *)(param_1 + 0xec);

    if (_DAT_0079cc60 <= param_3) {

      param_3 = param_3 - _DAT_0079cc60;

    }

    FUN_0052a140(param_3);

  }

  *(undefined4 *)(param_1 + 0x148) = 1;

  FUN_0052a8c0();

  return;

}





// --- FUN_0052b160 at 0x0052B160 (size: 209) ---


void __thiscall FUN_0052b160(int param_1,int param_2)



{

  undefined4 *puVar1;

  float10 fVar2;

  

  if (*(int *)(param_1 + 0x154) == 0) {

    FUN_0052a540(8);

    return;

  }

  *(undefined4 *)(param_1 + 0x50) = *(undefined4 *)(param_2 + 4);

  FUN_00425f10(param_2 + 8);

  FUN_005364a0();

  FUN_005aa5d0(param_1 + 0x4c);

  fVar2 = (float10)_CIfmod();

  FUN_00536b80((float)fVar2);

  puVar1 = (undefined4 *)FUN_005df0f5(0x10);

  if (puVar1 == (undefined4 *)0x0) {

    puVar1 = (undefined4 *)0x0;

  }

  else {

    *puVar1 = 0;

    puVar1[1] = 0;

    puVar1[2] = 0;

    puVar1[3] = 0;

  }

  puVar1[3] = (float)fVar2;

  puVar1[2] = 9;

  FUN_00410820(puVar1,*(undefined4 *)(param_1 + 0x150));

  *(undefined4 *)(param_1 + 0x148) = 1;

  FUN_0052a8c0();

  return;

}





// --- FUN_0052b240 at 0x0052B240 (size: 330) ---


void __thiscall FUN_0052b240(undefined4 *param_1,int param_2)



{

  undefined4 uVar1;

  undefined4 *puVar2;

  

  if (param_1[0x55] == 0) {

    param_1[0x3f] = *(undefined4 *)(param_2 + 0x20);

    FUN_00535b30();

    if (param_1[0x55] != 0) {

      FUN_00510c50(0);

      return;

    }

  }

  else {

    if ((*(byte *)(param_2 + 6) & 1) != 0) {

      FUN_00510c50(0);

    }

    param_1[0x38] = *(undefined4 *)(param_2 + 4);

    param_1[0x39] = *(undefined4 *)(param_2 + 8);

    param_1[0x3a] = *(undefined4 *)(param_2 + 0xc);

    param_1[0x3b] = *(undefined4 *)(param_2 + 0x10);

    param_1[0x3c] = *(undefined4 *)(param_2 + 0x14);

    param_1[0x3d] = *(undefined4 *)(param_2 + 0x18);

    param_1[0x3e] = *(undefined4 *)(param_2 + 0x1c);

    param_1[0x3f] = *(undefined4 *)(param_2 + 0x20);

    param_1[0x40] = *(undefined4 *)(param_2 + 0x24);

    param_1[0x41] = *(undefined4 *)(param_2 + 0x28);

    param_1[0x38] = param_1[0x38] & 0xffffff7f;

    FUN_00536b80(*(undefined4 *)(param_2 + 0x10));

    *param_1 = 9;

    uVar1 = *(undefined4 *)(param_2 + 0x10);

    puVar2 = (undefined4 *)FUN_005df0f5(0x10);

    if (puVar2 == (undefined4 *)0x0) {

      puVar2 = (undefined4 *)0x0;

    }

    else {

      *puVar2 = 0;

      puVar2[1] = 0;

      puVar2[2] = 0;

      puVar2[3] = 0;

    }

    puVar2[2] = 9;

    puVar2[3] = uVar1;

    FUN_00410820(puVar2,param_1[0x54]);

    FUN_0052a8c0();

  }

  return;

}





// --- FUN_0052b390 at 0x0052B390 (size: 78) ---


void __fastcall FUN_0052b390(int *param_1)



{

  int iVar1;

  

  if ((((param_1[0x55] != 0) && ((*(byte *)(param_1[0x55] + 0xac) & 1) != 0)) &&

      (param_1[0x53] != 0)) && (((param_1[0x4c] == 0 || (*param_1 == 0)) || (param_1[0x52] != 0))))

  {

    iVar1 = *(int *)(param_1[0x53] + 8);

    if (iVar1 == 7) {

      FUN_0052a990();

      return;

    }

    if (iVar1 == 9) {

      FUN_0052acd0();

      return;

    }

  }

  return;

}





// --- FUN_0052b3e0 at 0x0052B3E0 (size: 299) ---


void __thiscall FUN_0052b3e0(int *param_1,int param_2)



{

  int iVar1;

  

  iVar1 = param_1[0x55];

  if (iVar1 == 0) {

    FUN_0052a540(8);

    return;

  }

  if (param_1[0x4c] == *(int *)(param_2 + 4)) {

    if (param_1[0x52] == 0) {

      if (param_1[0x4c] == *(int *)(iVar1 + 8)) {

        FUN_0043e8c0(iVar1 + 0x48);

        FUN_0043e8c0(param_1[0x55] + 0x48);

        FUN_0052a260(0);

        return;

      }

      if (*(int *)(param_2 + 0xc0) != 1) {

        FUN_0052a540(0x38);

        return;

      }

      if (*param_1 == 6) {

        FUN_0052b010(param_2 + 0x18,param_2 + 0x60);

      }

      else if (*param_1 == 8) {

        FUN_0052b160(param_2 + 0x18);

        return;

      }

    }

    else {

      if (*(int *)(param_2 + 0xc0) != 1) {

        FUN_0052a540(0x37);

        return;

      }

      if (*param_1 == 6) {

        FUN_0043e8c0(param_2 + 0x60);

        FUN_0043e8c0(param_2 + 0x18);

        param_1[0x43] = 0x7f7fffff;

        iVar1 = DAT_008379ac;

        param_1[0x44] = DAT_008379a8;

        param_1[0x45] = iVar1;

        param_1[0x46] = 0x7f7fffff;

        iVar1 = DAT_008379ac;

        param_1[0x48] = DAT_008379a8;

        param_1[0x49] = iVar1;

        return;

      }

    }

  }

  return;

}





// --- FUN_0052b510 at 0x0052B510 (size: 138) ---


undefined4 FUN_0052b510(undefined4 *param_1)



{

  FUN_0052a540(0x36);

  FUN_0050f5b0();

  switch(*param_1) {

  case 6:

    FUN_0052a290(param_1[2],param_1[3],param_1[0x16],param_1[0x17],param_1[0x18]);

    return 0;

  case 7:

    FUN_0052ae50(param_1 + 4,param_1[0x18]);

    return 0;

  case 8:

    FUN_0052a3e0(param_1[2],param_1[3],param_1[0x18]);

    return 0;

  case 9:

    FUN_0052b240(param_1[0x18]);

  }

  return 0;

}





// --- FUN_0052b5b0 at 0x0052B5B0 (size: 93) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall

FUN_0052b5b0(int param_1,float param_2,undefined4 param_3,undefined4 *param_4,undefined4 *param_5)



{

  if (*(float *)(param_1 + 8) < param_2) {

    *param_4 = 0x45000005;

    *param_5 = 0;

    return;

  }

  if (param_2 - *(float *)(param_1 + 0xc) < _DAT_007c981c) {

    *param_4 = 0x45000006;

    *param_5 = 1;

    return;

  }

  *param_4 = 0;

  return;

}





// --- FUN_0052b610 at 0x0052B610 (size: 204) ---


void __thiscall

FUN_0052b610(int param_1,float param_2,undefined4 param_3,undefined4 *param_4,undefined4 *param_5,

            undefined4 *param_6)



{

  float fVar1;

  uint uVar2;

  

  uVar2 = *(uint *)(param_1 + 4);

  if ((uVar2 & 0x200) == 0) {

    if ((uVar2 & 0x100) != 0) {

      if (param_2 < *(float *)(param_1 + 0xc)) {

        *param_4 = 0x45000005;

        *param_6 = 1;

      }

      else {

        *param_4 = 0;

      }

      goto LAB_0052b6a0;

    }

  }

  else if ((uVar2 & 0x100) != 0) {

    FUN_0052b5b0(param_2,param_3,param_4,param_6);

    goto LAB_0052b6a0;

  }

  fVar1 = *(float *)(param_1 + 8);

  if ((NAN(param_2) || NAN(fVar1)) || param_2 < fVar1 == (param_2 == fVar1)) {

    *param_4 = 0x45000005;

    *param_6 = 0;

  }

  else {

    *param_4 = 0;

  }

LAB_0052b6a0:

  uVar2 = *(uint *)(param_1 + 4);

  if (((uVar2 & 0x10) == 0) &&

     (((uVar2 & 2) == 0 ||

      (((uVar2 & 1) != 0 && (param_2 - *(float *)(param_1 + 8) <= *(float *)(param_1 + 0x1c))))))) {

    *param_5 = 1;

    return;

  }

  *param_5 = 2;

  return;

}





// --- FUN_0052b6e0 at 0x0052B6E0 (size: 74) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



float10 FUN_0052b6e0(int param_1,int param_2)



{

  if ((param_1 == 0x44000007) || (param_1 == 0x45000005)) {

    if (param_2 == 0) goto LAB_0052b718;

  }

  else {

    if (param_1 != 0x45000006) {

      return (float10)0.0;

    }

    if (param_2 != 0) {

LAB_0052b718:

      return (float10)DAT_00796344;

    }

  }

  return (float10)_DAT_0079cc8c;

}





// --- FUN_0052b860 at 0x0052B860 (size: 196) ---


undefined4 __thiscall FUN_0052b860(int param_1,int param_2,int *param_3,uint param_4)



{

  int iVar1;

  uint uVar2;

  

  switch(param_2 + -6) {

  case 0:

  case 1:

    uVar2 = 0x1c;

    break;

  case 2:

  case 3:

    uVar2 = 0xc;

    break;

  default:

    goto switchD_0052b871_default;

  }

  if (param_4 < uVar2) {

switchD_0052b871_default:

    return 0;

  }

  switch(param_2 + -6) {

  case 0:

  case 1:

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)*param_3;

    iVar1 = *param_3;

    *param_3 = iVar1 + 4;

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar1 + 4);

    iVar1 = *param_3;

    *param_3 = iVar1 + 4;

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(iVar1 + 4);

    iVar1 = *param_3;

    *param_3 = iVar1 + 4;

    *(undefined4 *)(param_1 + 0x18) = *(undefined4 *)(iVar1 + 4);

    iVar1 = *param_3;

    *param_3 = iVar1 + 4;

    *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(iVar1 + 4);

    iVar1 = *param_3;

    *param_3 = iVar1 + 4;

    *(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)(iVar1 + 4);

    break;

  case 2:

  case 3:

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)*param_3;

    iVar1 = *param_3;

    *param_3 = iVar1 + 4;

    *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(iVar1 + 4);

    break;

  default:

    goto switchD_0052b871_default;

  }

  iVar1 = *param_3;

  *param_3 = iVar1 + 4;

  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(iVar1 + 4);

  *param_3 = *param_3 + 4;

  return 1;

}





// --- FUN_0052b950 at 0x0052B950 (size: 43) ---


void FUN_0052b950(uint param_1)



{

  if (param_1 == 0) {

    return;

  }

  if ((param_1 & 0xffff) < 0x100) {

    FUN_00533af0();

    return;

  }

  FUN_0052e870();

  return;

}





// --- FUN_0052b980 at 0x0052B980 (size: 10) ---


void FUN_0052b980(undefined4 param_1)



{

  DAT_008456ec = param_1;

  return;

}





// --- thunk_FUN_0052e070 at 0x0052B990 (size: 5) ---


void thunk_FUN_0052e070(void)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  undefined1 auStack_c [12];

  

  piVar2 = (int *)FUN_0052dcf0(auStack_c);

  iVar3 = piVar2[2];

  iVar1 = *piVar2;

  piVar2 = (int *)piVar2[1];

  do {

    if (iVar3 == 0) {

      return;

    }

    do {

      FUN_0052bfa0();

      iVar3 = *(int *)(iVar3 + 4);

    } while (iVar3 != 0);

    do {

      piVar2 = piVar2 + 1;

      if (piVar2 == (int *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4)) {

        return;

      }

      iVar3 = *piVar2;

    } while (iVar3 == 0);

  } while( true );

}





// --- FUN_0052b9a0 at 0x0052B9A0 (size: 17) ---


undefined4 __fastcall FUN_0052b9a0(int param_1)



{

  if (*(int *)(param_1 + 0xf0) != 0) {

    return *(undefined4 *)(*(int *)(param_1 + 0xf0) + 0x4c);

  }

  return 0;

}





// --- FUN_0052b9c0 at 0x0052B9C0 (size: 123) ---


void __thiscall FUN_0052b9c0(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

  if (param_2 <= (uint)param_1[3]) {

    if (param_2 == 0) {

      param_1[3] = 0;

      operator_delete__((void *)*param_1);

      *param_1 = 0;

    }

    else {

      iVar1 = thunk_FUN_005df0f5(param_2 * 4);

      uVar2 = 0;

      param_1[3] = param_2;

      if (param_2 != 0) {

        do {

          *(undefined4 *)(iVar1 + uVar2 * 4) = *(undefined4 *)(*param_1 + uVar2 * 4);

          uVar2 = uVar2 + 1;

        } while (uVar2 < (uint)param_1[3]);

      }

      operator_delete__((void *)*param_1);

      *param_1 = iVar1;

    }

    if (param_2 < (uint)param_1[2]) {

      param_1[2] = param_2;

    }

    return;

  }

  FUN_0052ba40(param_2);

  return;

}





// --- FUN_0052ba40 at 0x0052BA40 (size: 90) ---


void __thiscall FUN_0052ba40(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

  if (param_2 <= (uint)param_1[3]) {

    FUN_0052b9c0(param_2);

    return;

  }

  iVar1 = thunk_FUN_005df0f5(param_2 * 4);

  uVar2 = 0;

  if (param_1[3] != 0) {

    do {

      *(undefined4 *)(iVar1 + uVar2 * 4) = *(undefined4 *)(*param_1 + uVar2 * 4);

      uVar2 = uVar2 + 1;

    } while (uVar2 < (uint)param_1[3]);

  }

  operator_delete__((void *)*param_1);

  *param_1 = iVar1;

  param_1[3] = param_2;

  return;

}





// --- FUN_0052baa0 at 0x0052BAA0 (size: 123) ---


void __thiscall FUN_0052baa0(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

  if (param_2 <= (uint)param_1[3]) {

    if (param_2 == 0) {

      param_1[3] = 0;

      operator_delete__((void *)*param_1);

      *param_1 = 0;

    }

    else {

      iVar1 = thunk_FUN_005df0f5(param_2 * 4);

      uVar2 = 0;

      param_1[3] = param_2;

      if (param_2 != 0) {

        do {

          *(undefined4 *)(iVar1 + uVar2 * 4) = *(undefined4 *)(*param_1 + uVar2 * 4);

          uVar2 = uVar2 + 1;

        } while (uVar2 < (uint)param_1[3]);

      }

      operator_delete__((void *)*param_1);

      *param_1 = iVar1;

    }

    if (param_2 < (uint)param_1[2]) {

      param_1[2] = param_2;

    }

    return;

  }

  FUN_0052bb20(param_2);

  return;

}





// --- FUN_0052bb20 at 0x0052BB20 (size: 90) ---


void __thiscall FUN_0052bb20(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

  if (param_2 <= (uint)param_1[3]) {

    FUN_0052baa0(param_2);

    return;

  }

  iVar1 = thunk_FUN_005df0f5(param_2 * 4);

  uVar2 = 0;

  if (param_1[3] != 0) {

    do {

      *(undefined4 *)(iVar1 + uVar2 * 4) = *(undefined4 *)(*param_1 + uVar2 * 4);

      uVar2 = uVar2 + 1;

    } while (uVar2 < (uint)param_1[3]);

  }

  operator_delete__((void *)*param_1);

  *param_1 = iVar1;

  param_1[3] = param_2;

  return;

}





// --- FUN_0052bb80 at 0x0052BB80 (size: 253) ---


undefined4 * __fastcall FUN_0052bb80(undefined4 *param_1)



{

  FUN_00415460(DAT_00845754);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007c6720;

  param_1[0xc] = &PTR_LAB_007c670c;

  FUN_0052f250();

  param_1[0xe] = &PTR_LAB_007c9988;

  *param_1 = &PTR_LAB_007c98e8;

  param_1[0xc] = &PTR_LAB_007c98d4;

  param_1[0x14] = 0;

  param_1[0x15] = &PTR_LAB_00797910;

  param_1[0x16] = 0;

  param_1[0x17] = 0x3f800000;

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x24] = 0;

  param_1[0x25] = 0;

  param_1[0x26] = 0;

  FUN_00535b30();

  param_1[0x27] = 0;

  param_1[0x28] = 0;

  param_1[0x2b] = 0;

  param_1[0x2a] = 0;

  param_1[0x29] = 0x80;

  param_1[0x2c] = 0;

  param_1[0x2d] = 0;

  param_1[0x30] = 0;

  param_1[0x2f] = 0;

  param_1[0x2e] = 0x80;

  param_1[0x31] = 0;

  param_1[0x32] = 0;

  param_1[0x35] = 0;

  param_1[0x34] = 0;

  param_1[0x33] = 0x80;

  param_1[0x36] = 0;

  param_1[0x37] = 0;

  param_1[0x38] = 0;

  param_1[0x39] = 0;

  param_1[0x3a] = 0;

  param_1[0x3b] = 0;

  param_1[0x3c] = 0;

  return param_1;

}





// --- FUN_0052bcd0 at 0x0052BCD0 (size: 185) ---


void __fastcall FUN_0052bcd0(undefined4 *param_1)



{

  void *pvVar1;

  

  *param_1 = &PTR_LAB_007c98e8;

  param_1[0xc] = &PTR_LAB_007c98d4;

  param_1[0xe] = &PTR_LAB_007c9988;

  if ((undefined4 *)param_1[0x3b] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[0x3b])(1);

    param_1[0x3b] = 0;

  }

  if ((undefined4 *)param_1[0x37] != (undefined4 *)0x0) {

    pvVar1 = *(void **)param_1[0x37];

    if (pvVar1 != (void *)0x0) {

      FUN_0053c760();

      operator_delete(pvVar1);

    }

    operator_delete__((void *)param_1[0x37]);

  }

  operator_delete__((void *)param_1[0x32]);

  param_1[0x32] = 0;

  operator_delete__((void *)param_1[0x2d]);

  param_1[0x2d] = 0;

  operator_delete__((void *)param_1[0x28]);

  param_1[0x28] = 0;

  param_1[0x15] = &PTR_FUN_0079385c;

  FUN_0052f270();

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  return;

}





// --- FUN_0052bd90 at 0x0052BD90 (size: 69) ---


void FUN_0052bd90(uint param_1)



{

  undefined4 uVar1;

  

  if (param_1 == 0) {

    return;

  }

  if ((param_1 & 0xffff) < 0x100) {

    FUN_00533af0(param_1);

    return;

  }

  uVar1 = FUN_004220b0(param_1,3);

  FUN_00415430(uVar1);

  return;

}





// --- FUN_0052bde0 at 0x0052BDE0 (size: 64) ---


void __thiscall FUN_0052bde0(int param_1,undefined4 param_2)



{

  int iVar1;

  

  if (*(uint *)(param_1 + 0xc0) <= *(uint *)(param_1 + 0xb0)) {

    FUN_0052ba40(*(uint *)(param_1 + 0xc0) + 5);

  }

  iVar1 = *(int *)(param_1 + 0xb0);

  *(int *)(param_1 + 0xb0) = iVar1 + 1;

  *(undefined4 *)(*(int *)(param_1 + 0xb4) + iVar1 * 4) = param_2;

  return;

}





// --- FUN_0052be20 at 0x0052BE20 (size: 105) ---


void __thiscall FUN_0052be20(int param_1,int param_2)



{

  int iVar1;

  int *piVar2;

  uint uVar3;

  int *piVar4;

  

  uVar3 = 0;

  if (*(int *)(param_1 + 0xb0) != 0) {

    piVar2 = *(int **)(param_1 + 0xb4);

    piVar4 = piVar2;

    do {

      if (*piVar4 == param_2) {

        iVar1 = *(int *)(param_1 + 0xb0) + -1;

        *(int *)(param_1 + 0xb0) = iVar1;

        piVar2[uVar3] = piVar2[iVar1];

        if (*(uint *)(param_1 + 0xc0) <= *(int *)(param_1 + 0xb0) + 10U) {

          return;

        }

        FUN_0052b9c0();

        return;

      }

      uVar3 = uVar3 + 1;

      piVar4 = piVar4 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0xb0));

  }

  return;

}





// --- FUN_0052be90 at 0x0052BE90 (size: 67) ---


void __thiscall FUN_0052be90(int param_1,int param_2)



{

  int iVar1;

  

  if (*(uint *)(param_1 + 0xd4) <= *(uint *)(param_1 + 0xc4)) {

    FUN_0052bb20(*(uint *)(param_1 + 0xd4) + 5);

  }

  iVar1 = *(int *)(param_1 + 0xc4);

  *(int *)(param_1 + 0xc4) = iVar1 + 1;

  *(int *)(*(int *)(param_1 + 200) + iVar1 * 4) = param_2;

  *(int *)(param_2 + 0x14) = param_1;

  return;

}





// --- FUN_0052bee0 at 0x0052BEE0 (size: 121) ---


void __thiscall FUN_0052bee0(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  uint uVar3;

  

  uVar3 = 0;

  if (*(int *)(param_1 + 0xc4) != 0) {

    piVar1 = *(int **)(param_1 + 200);

    do {

      if (*piVar1 == param_2) {

        *(undefined4 *)(param_2 + 0x14) = 0;

        iVar2 = *(int *)(param_1 + 0xc4) + -1;

        *(int *)(param_1 + 0xc4) = iVar2;

        *(undefined4 *)(*(int *)(param_1 + 200) + uVar3 * 4) =

             *(undefined4 *)(*(int *)(param_1 + 200) + iVar2 * 4);

        if (*(uint *)(param_1 + 0xd4) <= *(int *)(param_1 + 0xc4) + 10U) {

          return;

        }

        FUN_0052baa0();

        return;

      }

      uVar3 = uVar3 + 1;

      piVar1 = piVar1 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0xc4));

  }

  return;

}





// --- FUN_0052bf60 at 0x0052BF60 (size: 64) ---


void __fastcall FUN_0052bf60(int param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  

  uVar2 = 0;

  if (*(int *)(param_1 + 0xb0) != 0) {

    do {

      puVar1 = *(undefined4 **)(*(int *)(param_1 + 0xb4) + uVar2 * 4);

      if ((*(byte *)(puVar1 + 0x11) & 1) != 0) {

        FUN_0054dff0(*puVar1,*(undefined4 *)(param_1 + 0x28),puVar1 + 1);

      }

      uVar2 = uVar2 + 1;

    } while (uVar2 < *(uint *)(param_1 + 0xb0));

  }

  return;

}





// --- FUN_0052bfa0 at 0x0052BFA0 (size: 68) ---


void __fastcall FUN_0052bfa0(int param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  

  uVar2 = 0;

  if (*(int *)(param_1 + 0xb0) != 0) {

    do {

      puVar1 = *(undefined4 **)(*(int *)(param_1 + 0xb4) + uVar2 * 4);

      if ((~puVar1[0x11] & 1) != 0) {

        FUN_0054e030(*puVar1,*(undefined4 *)(param_1 + 0x28),puVar1 + 1);

      }

      uVar2 = uVar2 + 1;

    } while (uVar2 < *(uint *)(param_1 + 0xb0));

  }

  return;

}





// --- FUN_0052c030 at 0x0052C030 (size: 86) ---


void __fastcall FUN_0052c030(int param_1)



{

  int iVar1;

  uint uVar2;

  

  if (DAT_008456ec != 0) {

    FUN_00508d30(param_1);

    uVar2 = 0;

    if (*(int *)(param_1 + 0x9c) != 0) {

      do {

        if (((*(byte *)(*(int *)(*(int *)(param_1 + 0xa0) + uVar2 * 4) + 0xa8) & 1) == 0) &&

           (iVar1 = FUN_00511d90(), iVar1 == 0)) {

          FUN_00516530();

        }

        uVar2 = uVar2 + 1;

      } while (uVar2 < *(uint *)(param_1 + 0x9c));

    }

  }

  return;

}





// --- FUN_0052c0a0 at 0x0052C0A0 (size: 80) ---


void __fastcall FUN_0052c0a0(int param_1)



{

  int iVar1;

  

  iVar1 = *(int *)(param_1 + 0xc4);

  while (iVar1 != 0) {

    FUN_0052bee0(**(undefined4 **)(param_1 + 200));

    FUN_0050fff0(param_1);

    iVar1 = *(int *)(param_1 + 0xc4);

  }

  if ((*(int *)(param_1 + 0x9c) != 0) && (DAT_008456ec != 0)) {

    FUN_005086e0(param_1);

  }

  return;

}





// --- FUN_0052c0f0 at 0x0052C0F0 (size: 485) ---


void FUN_0052c0f0(int param_1,int param_2,float *param_3,undefined4 *param_4,int *param_5,

                 int param_6)



{

  int iVar1;

  float *pfVar2;

  int iVar3;

  uint uVar4;

  int *piVar5;

  uint uVar6;

  float fStack_18;

  float fStack_14;

  float fStack_10;

  undefined1 auStack_c [12];

  

  iVar1 = 0;

  param_4[2] = 0;

  *param_4 = 0;

  uVar6 = *(uint *)(param_1 + 4);

  if (uVar6 != 0) {

    if ((uVar6 & 0xffff) < 0x100) {

      iVar1 = FUN_00533af0();

    }

    else {

      iVar1 = FUN_0052e870(uVar6);

    }

  }

  if ((uVar6 & 0xffff) < 0x100) {

    FUN_00534370(param_1,param_2,param_3,param_4);

  }

  else {

    if (param_6 != 0) {

      *(undefined4 *)(param_6 + 0x1b0) = 1;

    }

    FUN_006b5f30(uVar6,iVar1);

  }

  if ((iVar1 != 0) && (param_2 != 0)) {

    uVar6 = 0;

    if (param_4[2] != 0) {

      do {

        piVar5 = *(int **)(param_4[3] + 4 + uVar6 * 8);

        if (piVar5 != (int *)0x0) {

          (**(code **)(*piVar5 + 0x80))(param_1,param_2,param_3,param_4,param_6);

        }

        uVar6 = uVar6 + 1;

      } while (uVar6 < (uint)param_4[2]);

    }

    if (param_5 != (int *)0x0) {

      *param_5 = 0;

      uVar6 = 0;

      if (param_4[2] != 0) {

        do {

          piVar5 = *(int **)(param_4[3] + 4 + uVar6 * 8);

          if (piVar5 != (int *)0x0) {

            pfVar2 = (float *)FUN_0043e7d0(auStack_c,*(undefined4 *)(param_1 + 4),piVar5[10]);

            fStack_10 = param_3[2] - pfVar2[2];

            fStack_14 = param_3[1] - pfVar2[1];

            fStack_18 = *param_3 - *pfVar2;

            iVar3 = (**(code **)(*piVar5 + 0x84))(&fStack_18);

            if ((iVar3 != 0) && (*param_5 = (int)piVar5, 0xff < (piVar5[10] & 0xffffU))) {

              if (param_6 != 0) {

                *(undefined4 *)(param_6 + 0x1b0) = 1;

              }

              break;

            }

          }

          uVar6 = uVar6 + 1;

        } while (uVar6 < (uint)param_4[2]);

      }

    }

    if (((param_4[1] != 0) && (0xff < (*(uint *)(param_1 + 4) & 0xffff))) &&

       (uVar6 = 0, param_4[2] != 0)) {

      do {

        iVar3 = *(int *)(param_4[3] + uVar6 * 8);

        if (iVar3 == *(int *)(iVar1 + 0x28)) {

LAB_0052c2c7:

          uVar6 = uVar6 + 1;

        }

        else {

          uVar4 = 0;

          if (*(uint *)(iVar1 + 0xe0) != 0) {

            piVar5 = *(int **)(iVar1 + 0xe4);

            do {

              if (iVar3 == *piVar5) goto LAB_0052c2c7;

              uVar4 = uVar4 + 1;

              piVar5 = piVar5 + 1;

            } while (uVar4 < *(uint *)(iVar1 + 0xe0));

          }

          FUN_006b5dc0(uVar6);

        }

      } while (uVar6 < (uint)param_4[2]);

    }

  }

  return;

}





// --- FUN_0052c2e0 at 0x0052C2E0 (size: 120) ---


undefined4 __thiscall FUN_0052c2e0(int *param_1,int *param_2)



{

  int *piVar1;

  int iVar2;

  

  if (*param_2 == 0) {

    return 2;

  }

  piVar1 = *(int **)(*param_2 + 300);

  if ((((piVar1 != (int *)0x0) &&

       (iVar2 = (**(code **)(*piVar1 + 0x48))(), (param_2[1] & 0x100U) != 0)) &&

      (param_1[0x36] != 0)) && (iVar2 == 0)) {

    iVar2 = FUN_0050ff60(param_1[0x36]);

    if ((iVar2 != 0) && (*(int **)(iVar2 + 300) != (int *)0x0)) {

      iVar2 = (**(code **)(**(int **)(iVar2 + 300) + 0x44))(piVar1);

      if (iVar2 != 0) {

        return 1;

      }

      (**(code **)(*param_1 + 0x90))(param_2);

    }

    return 2;

  }

  return 1;

}





// --- FUN_0052c360 at 0x0052C360 (size: 86) ---


int __thiscall FUN_0052c360(int param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  iVar2 = 1;

  if ((param_2[0x5d] != 2) && (uVar3 = 0, *(int *)(param_1 + 0xc4) != 0)) {

    do {

      iVar1 = *(int *)(*(int *)(*(int *)(param_1 + 200) + uVar3 * 4) + 0xc);

      if ((*(int *)(iVar1 + 0x40) == 0) &&

         ((iVar1 != *param_2 && (iVar2 = FUN_0050fb20(param_2), iVar2 != 1)))) {

        return iVar2;

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0xc4));

  }

  return iVar2;

}





// --- FUN_0052c3c0 at 0x0052C3C0 (size: 86) ---


undefined4 __thiscall FUN_0052c3c0(int param_1,int param_2)



{

  int iVar1;

  uint uVar2;

  

  uVar2 = 0;

  if (*(int *)(param_1 + 0xc4) != 0) {

    do {

      iVar1 = *(int *)(*(int *)(*(int *)(param_1 + 200) + uVar2 * 4) + 0xc);

      if (((*(int *)(iVar1 + 0x40) == 0) && (iVar1 != param_2)) &&

         (iVar1 = FUN_005139d0(param_2), iVar1 != 0)) {

        return 1;

      }

      uVar2 = uVar2 + 1;

    } while (uVar2 < *(uint *)(param_1 + 0xc4));

  }

  return 0;

}





// --- FUN_0052c420 at 0x0052C420 (size: 129) ---


void __thiscall

FUN_0052c420(int param_1,int param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5,

            int param_6)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  uVar3 = 0;

  if (*(int *)(param_1 + 0xc4) != 0) {

    do {

      iVar1 = *(int *)(*(int *)(*(int *)(param_1 + 200) + uVar3 * 4) + 0xc);

      if (((*(int *)(iVar1 + 8) != param_2) && ((*(byte *)(iVar1 + 0xa8) & 1) == 0)) &&

         (iVar2 = FUN_0050f750(param_3,param_4,param_5,*(undefined4 *)(param_6 + 8)), iVar2 != 0)) {

        FUN_0051ad00(*(undefined4 *)(iVar1 + 8),iVar2);

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0xc4));

  }

  return;

}





// --- FUN_0052c4b0 at 0x0052C4B0 (size: 71) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



float10 __thiscall FUN_0052c4b0(int param_1,undefined4 param_2)



{

  int iVar1;

  float10 fVar2;

  

  iVar1 = *(int *)(param_1 + 0x50);

  if (iVar1 != 0) {

    if (iVar1 == 1) {

      if (*(int *)(param_1 + 0xf0) != 0) {

        fVar2 = (float10)FUN_00532330(*(undefined4 *)(param_1 + 0x28),param_2);

        return fVar2;

      }

      return (float10)_DAT_007958cc;

    }

    if (iVar1 == 2) {

      return (float10)_DAT_007958c0;

    }

  }

  return (float10)DAT_00796344;

}





// --- FUN_0052c500 at 0x0052C500 (size: 50) ---


int __thiscall FUN_0052c500(int param_1,int param_2)



{

  int iVar1;

  int *piVar2;

  uint uVar3;

  

  uVar3 = 0;

  if (*(uint *)(param_1 + 0x9c) != 0) {

    piVar2 = *(int **)(param_1 + 0xa0);

    do {

      iVar1 = *piVar2;

      if ((iVar1 != 0) && (*(int *)(iVar1 + 8) == param_2)) {

        return iVar1;

      }

      uVar3 = uVar3 + 1;

      piVar2 = piVar2 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0x9c));

  }

  return 0;

}





// --- FUN_0052c540 at 0x0052C540 (size: 30) ---


void * __thiscall FUN_0052c540(void *param_1,byte param_2)



{

  FUN_0052bcd0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0052c560 at 0x0052C560 (size: 16) ---


void FUN_0052c560(void)



{

  FUN_0052bf60();

  FUN_0052bfa0();

  return;

}





// --- FUN_0052c570 at 0x0052C570 (size: 37) ---


void FUN_0052c570(undefined4 param_1,undefined4 param_2,undefined4 *param_3)



{

  FUN_0052c0f0(param_3 + 0x43,*param_3,param_3[5],param_1,param_2,param_3);

  return;

}





// --- FUN_0052c5a0 at 0x0052C5A0 (size: 86) ---


void FUN_0052c5a0(undefined4 param_1,int param_2,undefined4 param_3,undefined4 param_4)



{

  undefined4 *puVar1;

  undefined1 local_1c [12];

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_4 = *(undefined4 *)(param_2 + 0xc);

  puVar1 = (undefined4 *)FUN_004562a0(local_1c,param_1,param_2);

  local_10 = *puVar1;

  local_c = puVar1[1];

  local_8 = puVar1[2];

  FUN_0052c0f0(param_1,1,&local_10,param_3,0,param_4);

  return;

}





// --- FUN_0052c600 at 0x0052C600 (size: 182) ---


void FUN_0052c600(undefined4 param_1,uint param_2,int param_3,undefined4 param_4,undefined4 param_5)



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 *puVar3;

  undefined1 local_c [12];

  

  if ((DAT_008458e8 & 1) == 0) {

    DAT_008458e8 = DAT_008458e8 | 1;

    _atexit((_func_4879 *)&DAT_00769390);

  }

  if (10 < param_2) {

    param_2 = 10;

  }

  if (param_2 != 0) {

    puVar3 = &DAT_00845854;

    uVar2 = param_2;

    do {

      puVar1 = (undefined4 *)FUN_004562a0(local_c,param_1,param_3);

      puVar3[-3] = *puVar1;

      puVar3[-2] = puVar1[1];

      puVar3[-1] = puVar1[2];

      *puVar3 = *(undefined4 *)(param_3 + 0x10);

      param_3 = param_3 + 0x14;

      puVar3 = puVar3 + 4;

      uVar2 = uVar2 - 1;

    } while (uVar2 != 0);

  }

  FUN_0052c0f0(param_1,param_2,&DAT_00845848,param_4,0,param_5);

  return;

}





// --- FUN_0052c6c0 at 0x0052C6C0 (size: 61) ---


undefined4 * __thiscall FUN_0052c6c0(undefined4 *param_1,int param_2)



{

  undefined4 uVar1;

  

  *param_1 = &PTR_FUN_007c7450;

  param_1[5] = 0;

  uVar1 = thunk_FUN_005df0f5(param_2 * 4);

  param_1[3] = uVar1;

  FUN_004f7fe0(param_2);

  *param_1 = &PTR_FUN_007c9994;

  return param_1;

}





// --- FUN_0052c700 at 0x0052C700 (size: 98) ---


void __thiscall

FUN_0052c700(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5

            )



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 *puVar3;

  

  puVar1 = (undefined4 *)FUN_005df0f5(0x18);

  puVar3 = (undefined4 *)0x0;

  if (puVar1 != (undefined4 *)0x0) {

    puVar1[1] = 0;

    puVar1[2] = param_5;

    puVar1[3] = param_2;

    puVar1[4] = param_3;

    puVar1[5] = param_4;

    *puVar1 = &PTR_LAB_007c78e0;

    puVar3 = puVar1;

  }

  uVar2 = ((uint)puVar3[2] >> ((byte)*(undefined4 *)(param_1 + 8) & 0x1f) ^ puVar3[2]) &

          *(uint *)(param_1 + 4);

  puVar3[1] = *(undefined4 *)(*(int *)(param_1 + 0xc) + uVar2 * 4);

  *(undefined4 **)(*(int *)(param_1 + 0xc) + uVar2 * 4) = puVar3;

  return;

}





// --- FUN_0052c770 at 0x0052C770 (size: 302) ---


undefined4 __thiscall FUN_0052c770(int param_1,int param_2,int param_3)



{

  int iVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  int iVar4;

  uint uVar5;

  undefined4 local_c;

  undefined4 local_8;

  

  if ((param_2 == 0) || (param_3 == 0)) {

    return 0;

  }

  if (*(int *)(param_1 + 0xec) == 0) {

    iVar1 = FUN_005df0f5(0x18);

    if (iVar1 == 0) {

      uVar2 = 0;

    }

    else {

      uVar2 = FUN_0052c6c0(0x20);

    }

    *(undefined4 *)(param_1 + 0xec) = uVar2;

  }

  puVar3 = (undefined4 *)FUN_005085f0(param_2);

  if (puVar3 != (undefined4 *)0x0) {

    uVar2 = puVar3[3];

    local_8 = puVar3[4];

    iVar1 = puVar3[5];

    (**(code **)*puVar3)(1);

    FUN_0052c700(uVar2,local_c,iVar1 + 1,param_2);

    return 1;

  }

  FUN_0052c700(param_2,*(undefined4 *)(param_3 + 0x14),1,param_2);

  uVar5 = 0;

  if (*(int *)(param_1 + 0x9c) != 0) {

    do {

      iVar1 = *(int *)(*(int *)(param_1 + 0xa0) + uVar5 * 4);

      if (((*(int *)(iVar1 + 8) != param_2) && (*(int *)(iVar1 + 8) != 0)) &&

         (*(int *)(iVar1 + 0x40) == 0)) {

        iVar4 = FUN_0050ff60(param_2);

        if (iVar4 != 0) {

          local_c = *(undefined4 *)(iVar1 + 8);

          local_8 = 1;

          FUN_005110a0(&local_c);

        }

      }

      uVar5 = uVar5 + 1;

    } while (uVar5 < *(uint *)(param_1 + 0x9c));

  }

  return 1;

}





// --- FUN_0052c8a0 at 0x0052C8A0 (size: 233) ---


undefined4 __thiscall FUN_0052c8a0(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  undefined4 uVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  uint uVar6;

  int unaff_retaddr;

  

  if ((*(int *)(param_1 + 0xec) != 0) &&

     (puVar4 = (undefined4 *)FUN_005085f0(param_2), puVar4 != (undefined4 *)0x0)) {

    uVar1 = puVar4[3];

    uVar2 = puVar4[4];

    iVar5 = puVar4[5];

    (**(code **)*puVar4)(1);

    if (iVar5 + -1 < 1) {

      uVar6 = 0;

      if (*(int *)(param_1 + 0x9c) != 0) {

        do {

          iVar5 = *(int *)(*(int *)(param_1 + 0xa0) + uVar6 * 4);

          iVar3 = *(int *)(iVar5 + 8);

          if ((((iVar3 != unaff_retaddr) && (iVar3 != 0)) && (*(int *)(iVar5 + 0x40) == 0)) &&

             (iVar5 = FUN_0050ff60(unaff_retaddr), iVar5 != 0)) {

            FUN_005110a0(&stack0xfffffff4);

          }

          uVar6 = uVar6 + 1;

        } while (uVar6 < *(uint *)(param_1 + 0x9c));

      }

      return 1;

    }

    FUN_0052c700(uVar1,uVar2,iVar5 + -1,unaff_retaddr);

    return 1;

  }

  return 0;

}





// --- FUN_0052c990 at 0x0052C990 (size: 175) ---


void __thiscall FUN_0052c990(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  undefined4 local_1c;

  int local_18;

  int local_c;

  int local_4;

  

  if ((((*(int *)(param_2 + 8) != 0) && (*(int *)(param_2 + 0x40) == 0)) &&

      (((*(uint *)(param_2 + 0xa8) & 0x4000) == 0 || (param_3 != 1)))) &&

     (*(int *)(param_1 + 0xec) != 0)) {

    FUN_005143c0(*(int *)(param_1 + 0xec));

    iVar2 = param_2;

    while (local_4 == 0) {

      if (local_c != 0) {

        iVar2 = *(int *)(local_c + 8);

      }

      if ((((*(int *)(param_2 + 8) != iVar2) && (*(int *)(param_2 + 8) != 0)) &&

          (*(int *)(param_2 + 0x40) == 0)) && (iVar1 = FUN_0050ff60(iVar2), iVar1 != 0)) {

        local_1c = *(undefined4 *)(param_2 + 8);

        local_18 = param_3;

        FUN_005110a0(&local_1c);

      }

      FUN_004d8d00();

    }

  }

  return;

}





// --- FUN_0052ca40 at 0x0052CA40 (size: 15) ---


void FUN_0052ca40(undefined4 param_1)



{

  FUN_0052c990(param_1,2);

  return;

}





// --- FUN_0052ca50 at 0x0052CA50 (size: 174) ---


void __thiscall FUN_0052ca50(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  undefined4 local_1c;

  undefined4 local_18;

  int local_c;

  int local_4;

  

  if ((((*(int *)(param_2 + 8) != 0) && (*(int *)(param_2 + 0x40) == 0)) &&

      ((*(uint *)(param_2 + 0xa8) & 0x4000) == 0)) && (*(int *)(param_1 + 0xec) != 0)) {

    FUN_005143c0(*(int *)(param_1 + 0xec));

    iVar2 = param_2;

    while (local_4 == 0) {

      if (local_c != 0) {

        iVar2 = *(int *)(local_c + 8);

      }

      if (((*(int *)(param_2 + 8) != iVar2) && (*(int *)(param_2 + 8) != 0)) &&

         ((*(int *)(param_2 + 0x40) == 0 && (iVar1 = FUN_0050ff60(iVar2), iVar1 != 0)))) {

        local_1c = *(undefined4 *)(param_2 + 8);

        local_18 = 1;

        FUN_005110a0(&local_1c);

      }

      FUN_004d8d00();

    }

  }

  return;

}





// --- FUN_0052cb00 at 0x0052CB00 (size: 30) ---


void * __thiscall FUN_0052cb00(void *param_1,byte param_2)



{

  FUN_0052cb20();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0052cb20 at 0x0052CB20 (size: 79) ---


void __fastcall FUN_0052cb20(undefined4 *param_1)



{

  int local_4;

  

  *param_1 = &PTR_FUN_007c9994;

  FUN_005143c0(param_1);

  if (local_4 == 0) {

    do {

      FUN_004f8040();

    } while( true );

  }

  *param_1 = &PTR_FUN_007c7450;

  if (param_1[5] == 0) {

    operator_delete__((void *)param_1[3]);

  }

  return;

}





// --- FUN_0052cb70 at 0x0052CB70 (size: 223) ---


void __thiscall FUN_0052cb70(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  undefined4 local_1c;

  undefined4 local_18;

  int local_c;

  int local_4;

  

  if (*(uint *)(param_1 + 0xac) <= *(uint *)(param_1 + 0x9c)) {

    FUN_00508200(*(uint *)(param_1 + 0xac) + 5);

  }

  iVar2 = *(int *)(param_1 + 0x9c);

  *(int *)(param_1 + 0x9c) = iVar2 + 1;

  *(int *)(*(int *)(param_1 + 0xa0) + iVar2 * 4) = param_2;

  if ((((*(int *)(param_2 + 8) != 0) && (*(int *)(param_2 + 0x40) == 0)) &&

      ((*(uint *)(param_2 + 0xa8) & 0x4000) == 0)) && (*(int *)(param_1 + 0xec) != 0)) {

    FUN_005143c0(*(int *)(param_1 + 0xec));

    iVar2 = param_2;

    while (local_4 == 0) {

      if (local_c != 0) {

        iVar2 = *(int *)(local_c + 8);

      }

      if (((*(int *)(param_2 + 8) != iVar2) && (*(int *)(param_2 + 8) != 0)) &&

         ((*(int *)(param_2 + 0x40) == 0 && (iVar1 = FUN_0050ff60(iVar2), iVar1 != 0)))) {

        local_1c = *(undefined4 *)(param_2 + 8);

        local_18 = 1;

        FUN_005110a0(&local_1c);

      }

      FUN_004d8d00();

    }

  }

  return;

}





// --- FUN_0052cc50 at 0x0052CC50 (size: 121) ---


void __thiscall FUN_0052cc50(int param_1,int param_2)



{

  int iVar1;

  int *piVar2;

  uint uVar3;

  int *piVar4;

  

  uVar3 = 0;

  if (*(int *)(param_1 + 0x9c) != 0) {

    piVar2 = *(int **)(param_1 + 0xa0);

    piVar4 = piVar2;

    while (*piVar4 != param_2) {

      uVar3 = uVar3 + 1;

      piVar4 = piVar4 + 1;

      if (*(uint *)(param_1 + 0x9c) <= uVar3) {

        return;

      }

    }

    iVar1 = *(int *)(param_1 + 0x9c) + -1;

    *(int *)(param_1 + 0x9c) = iVar1;

    piVar2[uVar3] = piVar2[iVar1];

    FUN_0052c990(param_2,2);

    if (*(int *)(param_1 + 0x9c) + 10U < *(uint *)(param_1 + 0xac)) {

      FUN_00508290(*(int *)(param_1 + 0x9c) + 5);

    }

  }

  return;

}





// --- FUN_0052ccd0 at 0x0052CCD0 (size: 22) ---


undefined4 __fastcall FUN_0052ccd0(int param_1)



{

  return CONCAT31((int3)((uint)*(int *)(param_1 + 0x130) >> 8),

                  *(int *)(param_1 + 0x130) == *(int *)(DAT_00870340 + 0xb0));

}





// --- FUN_0052ccf0 at 0x0052CCF0 (size: 18) ---


void __fastcall FUN_0052ccf0(int param_1)



{

  *(undefined4 *)(param_1 + 0x130) = *(undefined4 *)(DAT_00870340 + 0xb0);

  return;

}





// --- FUN_0052cde0 at 0x0052CDE0 (size: 106) ---


int __fastcall FUN_0052cde0(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  iVar2 = *(int *)(param_1 + 0xf8) * 2 + 0x2c;

  if (*(int *)(param_1 + 0x108) != 0) {

    uVar3 = 0;

    do {

      iVar1 = FUN_005201e0();

      iVar2 = iVar2 + iVar1;

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0x108));

  }

  iVar2 = iVar2 + *(int *)(param_1 + 0xe0) * 2;

  if (*(int *)(param_1 + 0x110) != 0) {

    iVar2 = iVar2 + 4 + *(int *)(param_1 + 0x110) * 0x20;

  }

  if (*(int *)(param_1 + 0xd8) != 0) {

    iVar2 = iVar2 + 4;

  }

  return iVar2;

}





// --- FUN_0052ce50 at 0x0052CE50 (size: 152) ---


undefined4 * __fastcall FUN_0052ce50(undefined4 *param_1)



{

  FUN_0052bb80();

  param_1[0x3e] = 0;

  param_1[0x3f] = 0;

  param_1[0x40] = 0;

  param_1[0x41] = 0;

  param_1[0x42] = 0;

  param_1[0x43] = 0;

  param_1[0x44] = 0;

  param_1[0x45] = 0;

  param_1[0x46] = 0;

  param_1[0x47] = 0;

  *param_1 = &PTR_LAB_007c9a60;

  param_1[0xc] = &PTR_LAB_007c9a48;

  param_1[0xe] = &PTR_LAB_007c9a3c;

  param_1[0x4e] = 0;

  param_1[0x51] = 0;

  param_1[0x50] = 0;

  param_1[0x4f] = 0x80;

  param_1[0x49] = 0;

  param_1[0x4d] = 0;

  param_1[0x48] = 0;

  param_1[0x4a] = 0;

  param_1[0x4b] = 0;

  return param_1;

}





// --- FUN_0052cf10 at 0x0052CF10 (size: 66) ---


undefined4 __thiscall FUN_0052cf10(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  undefined1 local_c [12];

  

  if (*(int *)(param_1 + 0x10c) == 0) {

    return 0;

  }

  FUN_004526c0(local_c,param_2);

  uVar1 = FUN_00534630(local_c);

  return uVar1;

}





// --- FUN_0052cf60 at 0x0052CF60 (size: 224) ---


void __fastcall FUN_0052cf60(int param_1)



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  uint uVar4;

  

  if (*(int *)(param_1 + 0x11c) == 0) {

    if (*(int *)(param_1 + 0x110) != 0) {

      uVar3 = thunk_FUN_005df0f5(*(int *)(param_1 + 0x110) * 4);

      *(undefined4 *)(param_1 + 0x11c) = uVar3;

      uVar4 = 0;

      if (*(int *)(param_1 + 0x110) != 0) {

        iVar2 = 0;

        do {

          iVar1 = *(int *)(*(int *)(param_1 + 0x114) + uVar4 * 4);

          if (iVar1 == 0) {

            *(undefined4 *)(*(int *)(param_1 + 0x11c) + uVar4 * 4) = 0;

          }

          else {

            uVar3 = FUN_00514470(iVar1,0,0);

            *(undefined4 *)(*(int *)(param_1 + 0x11c) + uVar4 * 4) = uVar3;

          }

          if (*(int *)(*(int *)(param_1 + 0x11c) + uVar4 * 4) != 0) {

            FUN_005164e0(param_1,*(int *)(param_1 + 0x118) + iVar2);

          }

          uVar4 = uVar4 + 1;

          iVar2 = iVar2 + 0x40;

        } while (uVar4 < *(uint *)(param_1 + 0x110));

      }

    }

  }

  else {

    uVar4 = 0;

    if (*(int *)(param_1 + 0x110) != 0) {

      do {

        if (*(int *)(*(int *)(param_1 + 0x11c) + uVar4 * 4) != 0) {

          iVar2 = FUN_00511d90();

          if (iVar2 == 0) {

            FUN_00515c60();

          }

        }

        uVar4 = uVar4 + 1;

      } while (uVar4 < *(uint *)(param_1 + 0x110));

      return;

    }

  }

  return;

}





// --- FUN_0052d040 at 0x0052D040 (size: 36) ---


void __thiscall FUN_0052d040(int param_1,undefined4 param_2)



{

  FUN_0054dcf0(*(int *)(*(int *)(param_1 + 0x138) + -4 + *(int *)(param_1 + 0x134) * 4) + 0x10,

               param_2);

  return;

}





// --- FUN_0052d070 at 0x0052D070 (size: 357) ---


undefined4 __thiscall FUN_0052d070(int param_1,int *param_2)



{

  int iVar1;

  undefined4 uVar2;

  int *piVar3;

  int *piVar4;

  undefined4 uVar5;

  uint uVar6;

  uint uVar7;

  

  uVar5 = 1;

  if ((*(int *)(param_1 + 0xe8) != 0) &&

     (iVar1 = FUN_005060c0(*(uint *)(param_1 + 0x28) | 0xffff,param_2), iVar1 == 0)) {

    uVar5 = 0;

  }

  uVar6 = *(uint *)(param_1 + 0x28) | 0xffff;

  uVar2 = FUN_004220b0(uVar6,1);

  iVar1 = thunk_FUN_00413a30(uVar2);

  if ((iVar1 != 2) && (iVar1 != 1)) {

    return 0;

  }

  uVar2 = FUN_004220b0(uVar6,1);

  piVar3 = (int *)FUN_00415430(uVar2);

  if (piVar3 != (int *)0x0) {

    if (piVar3[0x3b] != 0) {

      uVar6 = *(uint *)(param_1 + 0x28) & 0xfffffffe | 0xfffe;

      uVar2 = FUN_004220b0(uVar6,2);

      iVar1 = thunk_FUN_00413a30(uVar2);

      if ((iVar1 != 2) && (iVar1 != 1)) {

        (**(code **)(*piVar3 + 0x14))();

        return 0;

      }

      uVar2 = FUN_004220b0(uVar6,2);

      piVar4 = (int *)FUN_00415430(uVar2);

      if (piVar4 != (int *)0x0) {

        uVar6 = *(uint *)(param_1 + 0x28);

        uVar7 = 0;

        if (piVar4[0x15] != 0) {

          do {

            uVar2 = FUN_004220b0(uVar7 + (uVar6 & 0xffff0100 | 0x100),3);

            iVar1 = thunk_FUN_00413a30(uVar2);

            if (((iVar1 != 2) && (iVar1 != 1)) && (uVar5 = 0, iVar1 == -1)) {

              *param_2 = *param_2 + 1;

            }

            uVar7 = uVar7 + 1;

          } while (uVar7 < (uint)piVar4[0x15]);

        }

        (**(code **)(*piVar4 + 0x14))();

      }

    }

    (**(code **)(*piVar3 + 0x14))();

  }

  return uVar5;

}





// --- FUN_0052d1e0 at 0x0052D1E0 (size: 162) ---


void __thiscall

FUN_0052d1e0(int param_1,int param_2,undefined4 param_3,uint param_4,int param_5,undefined4 param_6,

            int param_7)



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  undefined1 local_1c [12];

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if ((-1 < param_2) && (uVar3 = 0, param_4 != 0)) {

    while( true ) {

      puVar1 = (undefined4 *)FUN_004526c0(local_1c,param_5);

      local_10 = *puVar1;

      local_c = puVar1[1];

      local_4 = *(undefined4 *)(param_5 + 0xc);

      local_8 = puVar1[2];

      iVar2 = FUN_00534640(&local_10);

      if (iVar2 != 0) break;

      uVar3 = uVar3 + 1;

      param_5 = param_5 + 0x10;

      if (param_4 <= uVar3) {

        return;

      }

    }

    if (param_7 != 0) {

      *(undefined4 *)(param_7 + 0x1b0) = 1;

    }

    FUN_006b5f30(*(undefined4 *)(param_1 + 0x28),param_1);

  }

  return;

}





// --- FUN_0052d290 at 0x0052D290 (size: 415) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_0052d290(int *param_1,int param_2,uint param_3,int param_4,undefined4 param_5)



{

  float fVar1;

  float fVar2;

  undefined4 uVar3;

  int iVar4;

  int iVar5;

  uint local_4c;

  float local_3c;

  float local_38;

  float local_34;

  undefined1 local_30 [24];

  undefined1 local_18 [24];

  

  if ((param_2 < 0) || (local_4c = 0, param_3 == 0)) {

    return;

  }

  do {

    iVar4 = *(int *)(param_4 + local_4c * 4);

    if (iVar4 != 0) {

      iVar5 = *(int *)(**(int **)(iVar4 + 0x20) + 0x74);

      if ((iVar5 != 0) || (iVar5 = *(int *)(**(int **)(iVar4 + 0x20) + 0x90), iVar5 != 0)) {

        FUN_00452830(&local_3c,iVar4 + 0x30,iVar5);

        fVar2 = _DAT_007c9a38 + *(float *)(iVar5 + 0xc);

        iVar4 = *(int *)(param_1[0x43] + 8 + param_2 * 0x18);

        iVar5 = *(int *)(param_1[0x43] + 0xc + param_2 * 0x18);

        fVar1 = local_3c * *(float *)(iVar4 + 0x20) +

                local_34 * *(float *)(iVar4 + 0x28) + local_38 * *(float *)(iVar4 + 0x24) +

                *(float *)(iVar4 + 0x2c);

        if (iVar5 == 1) {

          if (fVar1 <= fVar2) {

LAB_0052d371:

            uVar3 = FUN_0050e0d0();

            FUN_005b2f10(uVar3,*(int *)(param_4 + local_4c * 4) + 0x30,param_1 + 0x15);

            iVar4 = FUN_005ab220(local_30);

            if ((iVar4 == 3) || (iVar4 == iVar5)) {

              FUN_005b2f10(uVar3,*(int *)(param_4 + local_4c * 4) + 0x30,param_1 + 0x15);

              iVar4 = FUN_00534650(local_18);

              if (iVar4 != 0) {

                FUN_006b5f30(param_1[10],param_1);

                (**(code **)(*param_1 + 0x7c))(param_3,param_4,param_5);

                return;

              }

            }

          }

        }

        else if ((iVar5 != 0) || (-fVar2 <= fVar1)) goto LAB_0052d371;

      }

    }

    local_4c = local_4c + 1;

    if (param_3 <= local_4c) {

      return;

    }

  } while( true );

}





// --- FUN_0052dae0 at 0x0052DAE0 (size: 187) ---


void __thiscall FUN_0052dae0(int *param_1,uint param_2)



{

  int iVar1;

  uint *puVar2;

  uint uVar3;

  int iVar4;

  uint *puVar5;

  

  if ((uint)param_1[3] < param_2) {

    puVar2 = (uint *)thunk_FUN_005df0f5(param_2 * 8 + 4);

    if (puVar2 == (uint *)0x0) {

      puVar5 = (uint *)0x0;

    }

    else {

      puVar5 = puVar2 + 1;

      *puVar2 = param_2;

      FUN_00401000(puVar5,8,param_2,FUN_00535a80);

    }

    uVar3 = 0;

    if (param_1[3] != 0) {

      do {

        iVar1 = *param_1;

        puVar5[uVar3 * 2] = *(uint *)(iVar1 + uVar3 * 8);

        puVar5[uVar3 * 2 + 1] = *(uint *)(iVar1 + uVar3 * 8 + 4);

        uVar3 = uVar3 + 1;

      } while (uVar3 < (uint)param_1[3]);

    }

    iVar1 = *param_1;

    if (iVar1 != 0) {

      iVar4 = *(int *)(iVar1 + -4);

      if (-1 < iVar4 + -1) {

        do {

          FUN_00695670();

          iVar4 = iVar4 + -1;

        } while (iVar4 != 0);

      }

      operator_delete__((void *)(iVar1 + -4));

    }

    *param_1 = (int)puVar5;

    param_1[3] = param_2;

    return;

  }

  FUN_0052dbe0(param_2);

  return;

}





// --- FUN_0052dba0 at 0x0052DBA0 (size: 64) ---


undefined4 * __thiscall FUN_0052dba0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007c9b00;

  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_0052dbe0 at 0x0052DBE0 (size: 272) ---


void __thiscall FUN_0052dbe0(int *param_1,uint param_2)



{

  int iVar1;

  uint *puVar2;

  uint uVar3;

  int iVar4;

  uint *puVar5;

  

  if (param_2 <= (uint)param_1[3]) {

    if (param_2 == 0) {

      iVar1 = *param_1;

      param_1[3] = 0;

      if (iVar1 != 0) {

        iVar4 = *(int *)(iVar1 + -4);

        if (-1 < iVar4 + -1) {

          do {

            FUN_00695670();

            iVar4 = iVar4 + -1;

          } while (iVar4 != 0);

        }

        operator_delete__((void *)(iVar1 + -4));

      }

      *param_1 = 0;

    }

    else {

      puVar2 = (uint *)thunk_FUN_005df0f5(param_2 * 8 + 4);

      if (puVar2 == (uint *)0x0) {

        puVar5 = (uint *)0x0;

      }

      else {

        puVar5 = puVar2 + 1;

        *puVar2 = param_2;

        FUN_00401000(puVar5,8,param_2,FUN_00535a80);

      }

      uVar3 = 0;

      param_1[3] = param_2;

      if (param_2 != 0) {

        do {

          iVar1 = *param_1;

          puVar5[uVar3 * 2] = *(uint *)(iVar1 + uVar3 * 8);

          puVar5[uVar3 * 2 + 1] = *(uint *)(iVar1 + uVar3 * 8 + 4);

          uVar3 = uVar3 + 1;

        } while (uVar3 < (uint)param_1[3]);

      }

      iVar1 = *param_1;

      if (iVar1 != 0) {

        iVar4 = *(int *)(iVar1 + -4);

        if (-1 < iVar4 + -1) {

          do {

            FUN_00695670();

            iVar4 = iVar4 + -1;

          } while (iVar4 != 0);

        }

        operator_delete__((void *)(iVar1 + -4));

      }

      *param_1 = (int)puVar5;

    }

    if (param_2 < (uint)param_1[2]) {

      param_1[2] = param_2;

    }

    return;

  }

  FUN_0052dae0(param_2);

  return;

}





// --- FUN_0052dcf0 at 0x0052DCF0 (size: 73) ---


void __thiscall FUN_0052dcf0(int param_1,int *param_2)



{

  int *piVar1;

  

  piVar1 = *(int **)(param_1 + 100);

  while( true ) {

    if (piVar1 == (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

      param_2[1] = 0;

      param_2[2] = 0;

      *param_2 = param_1;

      return;

    }

    if (**(int **)(param_1 + 100) != 0) break;

    piVar1 = *(int **)(param_1 + 100) + 1;

    *(int **)(param_1 + 100) = piVar1;

  }

  piVar1 = *(int **)(param_1 + 100);

  param_2[2] = *piVar1;

  param_2[1] = (int)piVar1;

  *param_2 = param_1;

  return;

}





// --- FUN_0052dd50 at 0x0052DD50 (size: 226) ---


void __fastcall FUN_0052dd50(int param_1)



{

  uint *puVar1;

  uint uVar2;

  undefined4 *puVar3;

  int iVar4;

  undefined4 uVar5;

  uint uVar6;

  undefined4 local_10;

  undefined4 local_c;

  

  if (*(int *)(param_1 + 0xdc) == 0) {

    puVar3 = (undefined4 *)thunk_FUN_005df0f5(4);

    *(undefined4 **)(param_1 + 0xdc) = puVar3;

    *puVar3 = 0;

  }

  if (**(int **)(param_1 + 0xdc) == 0) {

    iVar4 = FUN_005df0f5(0x18);

    if (iVar4 == 0) {

      uVar5 = 0;

    }

    else {

      uVar5 = FUN_0053c740();

    }

    **(undefined4 **)(param_1 + 0xdc) = uVar5;

  }

  uVar6 = 0;

  if (*(int *)(param_1 + 0x108) != 0) {

    iVar4 = 0;

    do {

      FUN_00535a90(*(int *)(iVar4 + *(int *)(param_1 + 0x10c) + 8) + 0x20,

                   *(undefined4 *)(iVar4 + 0xc + *(int *)(param_1 + 0x10c)));

      puVar1 = (uint *)**(undefined4 **)(param_1 + 0xdc);

      if (puVar1[4] <= *puVar1) {

        FUN_0052dae0(puVar1[4] + 5);

      }

      uVar2 = *puVar1;

      *puVar1 = uVar2 + 1;

      puVar3 = (undefined4 *)(puVar1[1] + uVar2 * 8);

      *puVar3 = local_10;

      puVar3[1] = local_c;

      FUN_00695670();

      uVar6 = uVar6 + 1;

      iVar4 = iVar4 + 0x18;

    } while (uVar6 < *(uint *)(param_1 + 0x108));

  }

  return;

}





// --- FUN_0052de40 at 0x0052DE40 (size: 121) ---


bool FUN_0052de40(undefined4 param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  

  bVar4 = true;

  *param_2 = 0;

  uVar1 = FUN_004220b0(param_1,3);

  iVar2 = thunk_FUN_00413a30(uVar1);

  if ((iVar2 != 2) && (iVar2 != 1)) {

    return false;

  }

  uVar1 = FUN_004220b0(param_1,3);

  piVar3 = (int *)FUN_00415430(uVar1);

  if (piVar3 != (int *)0x0) {

    iVar2 = FUN_0052d070(param_2);

    bVar4 = iVar2 != 0;

    (**(code **)(*piVar3 + 0x14))();

  }

  return bVar4;

}





// --- FUN_0052dec0 at 0x0052DEC0 (size: 179) ---


void __fastcall FUN_0052dec0(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  uint uVar3;

  undefined4 uVar4;

  

  uVar3 = 0;

  if (*(int *)(param_1 + 0xf8) != 0) {

    do {

      iVar1 = *(int *)(*(int *)(param_1 + 0xfc) + uVar3 * 4);

      if (iVar1 != 0) {

        uVar4 = 0;

        uVar2 = FUN_004220b0(*(undefined4 *)(iVar1 + 0x28),0);

        FUN_0041a4e0(uVar2,uVar4);

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0xf8));

  }

  if (*(int *)(param_1 + 0x104) != 0) {

    uVar4 = 0;

    uVar2 = FUN_004220b0(*(undefined4 *)(*(int *)(param_1 + 0x104) + 0x28),0);

    FUN_0041a4e0(uVar2,uVar4);

  }

  uVar3 = 0;

  if (*(int *)(param_1 + 0x110) != 0) {

    do {

      uVar4 = 0;

      uVar2 = FUN_004220b0(*(undefined4 *)(*(int *)(param_1 + 0x114) + uVar3 * 4),0);

      FUN_0041a4e0(uVar2,uVar4);

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0x110));

  }

  return;

}





// --- FUN_0052df80 at 0x0052DF80 (size: 66) ---


void __fastcall FUN_0052df80(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_0052dfd0 at 0x0052DFD0 (size: 151) ---


undefined4 __thiscall FUN_0052dfd0(int param_1,uint *param_2,uint *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[2]) {

      if (*param_2 == *puVar1) {

        if (puVar1 != (uint *)0xfffffffc) {

          return 0;

        }

        break;

      }

    }

  }

  puVar1 = (uint *)FUN_005df0f5(0x10);

  if (puVar1 == (uint *)0x0) {

    return 0;

  }

  uVar2 = *(uint *)(param_1 + 0xc);

  *puVar1 = *param_2;

  puVar1[1] = *param_3;

  puVar1[2] = 0;

  uVar2 = *param_2 % uVar2;

  puVar1[3] = uVar2;

  puVar1[2] = *(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_0052e070 at 0x0052E070 (size: 90) ---


void FUN_0052e070(void)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  undefined1 local_c [12];

  

  piVar2 = (int *)FUN_0052dcf0(local_c);

  iVar3 = piVar2[2];

  iVar1 = *piVar2;

  piVar2 = (int *)piVar2[1];

  do {

    if (iVar3 == 0) {

      return;

    }

    do {

      FUN_0052bfa0();

      iVar3 = *(int *)(iVar3 + 4);

    } while (iVar3 != 0);

    do {

      piVar2 = piVar2 + 1;

      if (piVar2 == (int *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4)) {

        return;

      }

      iVar3 = *piVar2;

    } while (iVar3 == 0);

  } while( true );

}





// --- FUN_0052e500 at 0x0052E500 (size: 237) ---


int __thiscall FUN_0052e500(int *param_1,int param_2)



{

  uint *puVar1;

  int iVar2;

  int iVar3;

  int *unaff_EBX;

  undefined4 unaff_retaddr;

  uint local_c;

  uint auStack_8 [2];

  

  iVar2 = param_2;

  iVar3 = (**(code **)(*param_1 + 0x78))(param_2);

  if (iVar3 == 0) {

    local_c = 0;

    if (param_1[0x42] != 0) {

      param_2 = 0;

      do {

        auStack_8[0] = *(uint *)(param_1[0x43] + param_2);

        if ((*(uint *)(iVar2 + 0xc) != 0) && (param_1 = unaff_EBX, *(int *)(iVar2 + 8) != 0)) {

          for (puVar1 = *(uint **)(*(int *)(iVar2 + 8) + (auStack_8[0] % *(uint *)(iVar2 + 0xc)) * 4

                                  ); puVar1 != (uint *)0x0; puVar1 = (uint *)puVar1[2]) {

            if (auStack_8[0] == *puVar1) {

              if (puVar1 != (uint *)0xfffffffc) goto LAB_0052e5c2;

              break;

            }

          }

        }

        if ((auStack_8[0] != 0xffffffff) && (iVar3 = FUN_0053c790(0), iVar3 != 0)) {

          FUN_0052dfd0(auStack_8,&DAT_007c9a24);

          iVar3 = FUN_0052e500(unaff_retaddr,iVar2);

          if (iVar3 != 0) {

            return iVar3;

          }

        }

LAB_0052e5c2:

        local_c = local_c + 1;

        param_2 = param_2 + 0x18;

      } while (local_c < (uint)param_1[0x42]);

    }

    iVar3 = 0;

  }

  return iVar3;

}





// --- FUN_0052e5f0 at 0x0052E5F0 (size: 624) ---


void __fastcall FUN_0052e5f0(int param_1)



{

  int *piVar1;

  undefined4 *puVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  uint uStack_8;

  

  if (*(int *)(param_1 + 0xfc) != 0) {

    uVar5 = 0;

    if (*(int *)(param_1 + 0xf8) != 0) {

      do {

        piVar1 = *(int **)(*(int *)(param_1 + 0xfc) + uVar5 * 4);

        if (piVar1 != (int *)0x0) {

          (**(code **)(*piVar1 + 0x14))();

        }

        uVar5 = uVar5 + 1;

      } while (uVar5 < *(uint *)(param_1 + 0xf8));

    }

    operator_delete__(*(void **)(param_1 + 0xfc));

    *(undefined4 *)(param_1 + 0xfc) = 0;

  }

  *(undefined4 *)(param_1 + 0xf8) = 0;

  if (*(void **)(param_1 + 0x120) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x120));

    *(undefined4 *)(param_1 + 0x120) = 0;

  }

  if ((*(undefined4 **)(param_1 + 0xdc) != (undefined4 *)0x0) &&

     (puVar2 = (undefined4 *)**(undefined4 **)(param_1 + 0xdc), puVar2 != (undefined4 *)0x0)) {

    *puVar2 = 0;

  }

  if (*(int *)(param_1 + 0x128) != 0) {

    FUN_0059d1e0((undefined4 *)(param_1 + 0x128));

    *(undefined4 *)(param_1 + 0x128) = 0;

  }

  if (*(int **)(param_1 + 0x104) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x104) + 0x14))();

    *(undefined4 *)(param_1 + 0x104) = 0;

  }

  uStack_8 = 0;

  if (*(int *)(param_1 + 0x144) != 0) {

    do {

      puVar2 = *(undefined4 **)(*(int *)(param_1 + 0x138) + uStack_8 * 4);

      if (puVar2 != (undefined4 *)0x0) {

        iVar3 = puVar2[9];

        if (iVar3 != 0) {

          iVar4 = *(int *)(iVar3 + -4);

          if (-1 < iVar4 + -1) {

            do {

              FUN_00695670();

              iVar4 = iVar4 + -1;

            } while (iVar4 != 0);

          }

          operator_delete__((void *)(iVar3 + -4));

        }

        puVar2[9] = 0;

        operator_delete__((void *)puVar2[5]);

        puVar2[5] = 0;

        operator_delete__((void *)*puVar2);

        *puVar2 = 0;

        operator_delete(puVar2);

        *(undefined4 *)(*(int *)(param_1 + 0x138) + uStack_8 * 4) = 0;

      }

      uStack_8 = uStack_8 + 1;

    } while (uStack_8 < *(uint *)(param_1 + 0x144));

  }

  iVar3 = *(int *)(param_1 + 0x10c);

  if (iVar3 != 0) {

    iVar4 = *(int *)(iVar3 + -4);

    if (-1 < iVar4 + -1) {

      do {

        FUN_00695670();

        iVar4 = iVar4 + -1;

      } while (iVar4 != 0);

    }

    operator_delete__((void *)(iVar3 + -4));

    *(undefined4 *)(param_1 + 0x10c) = 0;

  }

  *(undefined4 *)(param_1 + 0x108) = 0;

  if (*(void **)(param_1 + 0xe4) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0xe4));

    *(undefined4 *)(param_1 + 0xe4) = 0;

  }

  *(undefined4 *)(param_1 + 0xe0) = 0;

  if (*(int *)(param_1 + 0x114) != 0) {

    operator_delete__((void *)(*(int *)(param_1 + 0x114) + -4));

    *(undefined4 *)(param_1 + 0x114) = 0;

  }

  if (*(int *)(param_1 + 0x118) != 0) {

    operator_delete__((void *)(*(int *)(param_1 + 0x118) + -4));

    *(undefined4 *)(param_1 + 0x118) = 0;

  }

  if (*(int *)(param_1 + 0x11c) != 0) {

    uVar5 = 0;

    if (*(int *)(param_1 + 0x110) != 0) {

      do {

        if (*(int *)(*(int *)(param_1 + 0x11c) + uVar5 * 4) != 0) {

          FUN_005160a0();

          puVar2 = *(undefined4 **)(*(int *)(param_1 + 0x11c) + uVar5 * 4);

          if (puVar2 != (undefined4 *)0x0) {

            (**(code **)*puVar2)(1);

          }

        }

        uVar5 = uVar5 + 1;

      } while (uVar5 < *(uint *)(param_1 + 0x110));

    }

    operator_delete__(*(void **)(param_1 + 0x11c));

    *(undefined4 *)(param_1 + 0x11c) = 0;

  }

  *(undefined4 *)(param_1 + 0x110) = 0;

  *(undefined4 *)(param_1 + 0x100) = 0;

  *(undefined4 *)(param_1 + 0xe8) = 0;

  FUN_0052c0a0();

  return;

}





// --- FUN_0052e870 at 0x0052E870 (size: 56) ---


uint FUN_0052e870(uint param_1)



{

  uint *puVar1;

  

  puVar1 = *(uint **)(DAT_0081ed9c + (param_1 % DAT_0081eda4) * 4);

  while( true ) {

    if (puVar1 == (uint *)0x0) {

      return 0;

    }

    if (*puVar1 == param_1) break;

    puVar1 = (uint *)puVar1[1];

  }

  if (puVar1 == (uint *)0x0) {

    return 0;

  }

  return puVar1[2];

}





// --- FUN_0052e8b0 at 0x0052E8B0 (size: 245) ---


int * __thiscall FUN_0052e8b0(int *param_1,int param_2)



{

  uint uVar1;

  uint *puVar2;

  int iVar3;

  int *piVar4;

  uint uVar5;

  undefined4 unaff_retaddr;

  

  iVar3 = (**(code **)(*param_1 + 0x84))(param_2);

  if (iVar3 != 0) {

    return param_1;

  }

  if (param_2 == 0) {

    uVar5 = 0;

    if (param_1[0x42] != 0) {

      do {

        piVar4 = (int *)FUN_0053c790(1);

        if ((piVar4 != (int *)0x0) &&

           (iVar3 = (**(code **)(*piVar4 + 0x84))(unaff_retaddr), iVar3 != 0)) {

          return piVar4;

        }

        uVar5 = uVar5 + 1;

      } while (uVar5 < (uint)param_1[0x42]);

    }

  }

  else {

    uVar5 = 0;

    if (param_1[0x38] != 0) {

      do {

        uVar1 = *(uint *)(param_1[0x39] + uVar5 * 4);

        for (puVar2 = *(uint **)(DAT_0081ed9c + (uVar1 % DAT_0081eda4) * 4); puVar2 != (uint *)0x0;

            puVar2 = (uint *)puVar2[1]) {

          if (*puVar2 == uVar1) {

            if (((puVar2 != (uint *)0x0) && (piVar4 = (int *)puVar2[2], piVar4 != (int *)0x0)) &&

               (iVar3 = (**(code **)(*piVar4 + 0x84))(unaff_retaddr), iVar3 != 0)) {

              return piVar4;

            }

            break;

          }

        }

        uVar5 = uVar5 + 1;

        if ((uint)param_1[0x38] <= uVar5) {

          return (int *)0x0;

        }

      } while( true );

    }

  }

  return (int *)0x0;

}





// --- FUN_0052e9b0 at 0x0052E9B0 (size: 143) ---


undefined4 * __thiscall FUN_0052e9b0(undefined4 *param_1,undefined4 param_2)



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_007c9b00;

  puVar1 = PTR_DAT_00818558;

  puVar2 = (uint *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

  if (puVar2 == (uint *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

  param_1[0x19] = (undefined4 *)param_1[0x18] + param_1[0x1a];

  puVar6 = (undefined4 *)param_1[0x18];

  for (uVar4 = param_1[0x1a] & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

  for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

    *(undefined1 *)puVar6 = 0;

    puVar6 = (undefined4 *)((int)puVar6 + 1);

  }

  return param_1;

}





// --- FUN_0052ea40 at 0x0052EA40 (size: 82) ---


undefined4 * __thiscall FUN_0052ea40(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_LAB_007c9a60;

  param_1[0xc] = &PTR_LAB_007c9a48;

  param_1[0xe] = &PTR_LAB_007c9a3c;

  FUN_0052e5f0();

  operator_delete__((void *)param_1[0x4e]);

  param_1[0x4e] = 0;

  FUN_0052bcd0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0052eaa0 at 0x0052EAA0 (size: 165) ---


uint FUN_0052eaa0(uint param_1)



{

  uint *puVar1;

  uint uVar2;

  void *pvVar3;

  undefined4 uVar4;

  uint uVar5;

  undefined4 local_8 [2];

  

  uVar2 = param_1;

  uVar5 = 0;

  puVar1 = *(uint **)(DAT_0081ed9c + (param_1 % DAT_0081eda4) * 4);

  do {

    if (puVar1 == (uint *)0x0) {

LAB_0052ead4:

      if (uVar5 != 0) {

        return uVar5;

      }

      pvVar3 = (void *)FUN_004171e0(&param_1);

      if (pvVar3 == (void *)0x0) {

        uVar4 = FUN_004220b0(uVar2,3);

        uVar5 = FUN_00415430(uVar4);

        param_1 = uVar5;

        if (uVar5 == 0) {

          return 0;

        }

      }

      else {

        uVar5 = *(uint *)((int)pvVar3 + 8);

        param_1 = uVar5;

        operator_delete(pvVar3);

      }

      local_8[0] = *(undefined4 *)(uVar5 + 0x28);

      FUN_006891f0(local_8,&param_1);

      return uVar5;

    }

    if (*puVar1 == param_1) {

      if (puVar1 != (uint *)0x0) {

        uVar5 = puVar1[2];

      }

      goto LAB_0052ead4;

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_0052eb50 at 0x0052EB50 (size: 225) ---


void FUN_0052eb50(void)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  undefined1 local_c [12];

  

  piVar2 = (int *)FUN_0052dcf0(local_c);

  iVar3 = piVar2[2];

  iVar4 = *piVar2;

  piVar2 = (int *)piVar2[1];

  while (iVar3 != 0) {

    do {

      piVar1 = *(int **)(iVar3 + 8);

      FUN_0052c0a0();

      (**(code **)(*piVar1 + 0x14))();

      iVar3 = *(int *)(iVar3 + 4);

    } while (iVar3 != 0);

    do {

      piVar2 = piVar2 + 1;

      if (piVar2 == (int *)(*(int *)(iVar4 + 0x60) + *(int *)(iVar4 + 0x68) * 4)) goto LAB_0052eba6;

      iVar3 = *piVar2;

    } while (iVar3 == 0);

  }

LAB_0052eba6:

  FUN_005870f0();

  do {

    if (DAT_0081eda0 == (int *)(DAT_0081ed9c + DAT_0081eda4 * 4)) {

      iVar4 = 0;

      piVar2 = (int *)0x0;

joined_r0x0052ebe4:

      do {

        if (iVar4 == 0) {

          return;

        }

        do {

          (**(code **)(**(int **)(iVar4 + 8) + 0x9c))();

          FUN_0052c030();

          FUN_0052bf60();

          iVar4 = *(int *)(iVar4 + 4);

        } while (iVar4 != 0);

        do {

          piVar2 = piVar2 + 1;

          if (piVar2 == (int *)(DAT_0081ed9c + DAT_0081eda4 * 4)) {

            return;

          }

          iVar4 = *piVar2;

        } while (iVar4 == 0);

      } while( true );

    }

    if (*DAT_0081eda0 != 0) {

      iVar4 = *DAT_0081eda0;

      piVar2 = DAT_0081eda0;

      goto joined_r0x0052ebe4;

    }

    DAT_0081eda0 = DAT_0081eda0 + 1;

  } while( true );

}





// --- FUN_0052ec40 at 0x0052EC40 (size: 82) ---


undefined4 * __thiscall FUN_0052ec40(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007c9b04;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_007c9b00;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0052eca0 at 0x0052ECA0 (size: 54) ---


void FUN_0052eca0(uint param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  uint uVar2;

  

  uVar2 = 0;

  if (param_1 != 0) {

    do {

      iVar1 = FUN_0052eaa0(*(undefined4 *)(param_2 + uVar2 * 4));

      if (iVar1 != 0) {

        *(undefined4 *)(iVar1 + 0xf0) = param_3;

      }

      uVar2 = uVar2 + 1;

    } while (uVar2 < param_1);

  }

  return;

}





// --- FUN_0052ece0 at 0x0052ECE0 (size: 405) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void FUN_0052ece0(uint param_1,int param_2)



{

  uint *puVar1;

  uint uVar2;

  uint *puVar3;

  int iVar4;

  uint *puVar5;

  uint uVar6;

  uint uVar7;

  uint local_4;

  

  uVar7 = 0;

  if (param_1 != 0) {

    do {

      uVar6 = *(uint *)(param_2 + uVar7 * 4);

      for (puVar3 = *(uint **)(DAT_0081ed9c + (uVar6 % DAT_0081eda4) * 4); puVar3 != (uint *)0x0;

          puVar3 = (uint *)puVar3[1]) {

        if (*puVar3 == uVar6) {

          if ((puVar3 != (uint *)0x0) && (uVar6 = puVar3[2], uVar6 != 0)) {

            uVar2 = 0;

            if (*(int *)(uVar6 + 0x108) != 0) {

              iVar4 = 0;

              do {

                *(undefined4 *)(iVar4 + 4 + *(int *)(uVar6 + 0x10c)) = 0;

                uVar2 = uVar2 + 1;

                iVar4 = iVar4 + 0x18;

              } while (uVar2 < *(uint *)(uVar6 + 0x108));

            }

            *(undefined4 *)(uVar6 + 0xf0) = 0;

          }

          break;

        }

      }

      uVar7 = uVar7 + 1;

    } while (uVar7 < param_1);

  }

  local_4 = 0;

  if (param_1 != 0) {

    do {

      uVar7 = *(uint *)(param_2 + local_4 * 4);

      uVar6 = uVar7 % DAT_0081eda4;

      puVar3 = *(uint **)(DAT_0081ed9c + uVar6 * 4);

      puVar1 = puVar3;

      while( true ) {

        if (puVar1 == (uint *)0x0) goto LAB_0052ee66;

        if (*puVar1 == uVar7) break;

        puVar1 = (uint *)puVar1[1];

      }

      if (puVar1 == (uint *)0x0) goto LAB_0052ee66;

      if (puVar3 == puVar1) goto LAB_0052edcd;

      do {

        puVar5 = puVar3;

        puVar3 = (uint *)puVar5[1];

      } while (puVar3 != puVar1);

      if (puVar5 == (uint *)0x0) {

LAB_0052edcd:

        *(uint *)(DAT_0081ed9c + uVar6 * 4) = puVar3[1];

      }

      else {

        puVar5[1] = puVar3[1];

      }

      _DAT_0081eda8 = _DAT_0081eda8 + -1;

      uVar7 = puVar1[2];

      operator_delete(puVar1);

      uVar6 = *(uint *)(uVar7 + 0x28);

      puVar3 = (uint *)FUN_005df0f5(0xc);

      if (puVar3 == (uint *)0x0) {

        puVar3 = (uint *)0x0;

      }

      else {

        *puVar3 = uVar6;

        puVar3[1] = 0;

        puVar3[2] = uVar7;

      }

      uVar7 = *puVar3;

      for (puVar1 = *(uint **)(DAT_0081ee14 + (uVar7 % DAT_0081ee1c) * 4); puVar1 != (uint *)0x0;

          puVar1 = (uint *)puVar1[1]) {

        if (*puVar1 == uVar7) {

          if (puVar1 != (uint *)0x0) {

            operator_delete(puVar3);

            goto LAB_0052ee66;

          }

          break;

        }

      }

      puVar1 = (uint *)(DAT_0081ee14 + (uVar7 % DAT_0081ee1c) * 4);

      puVar3[1] = *puVar1;

      *puVar1 = (uint)puVar3;

      if (puVar1 < DAT_0081ee18) {

        DAT_0081ee18 = puVar1;

      }

      _DAT_0081ee20 = _DAT_0081ee20 + 1;

LAB_0052ee66:

      local_4 = local_4 + 1;

    } while (local_4 < param_1);

  }

  return;

}





// --- FUN_0052ee80 at 0x0052EE80 (size: 85) ---


void __fastcall FUN_0052ee80(int param_1)



{

  uint uVar1;

  

  FUN_0052eaa0(*(undefined4 *)(param_1 + 0x28));

  uVar1 = 0;

  if (*(int *)(param_1 + 0xe0) != 0) {

    do {

      FUN_0052eaa0(*(undefined4 *)(*(int *)(param_1 + 0xe4) + uVar1 * 4));

      uVar1 = uVar1 + 1;

    } while (uVar1 < *(uint *)(param_1 + 0xe0));

  }

  if (*(int *)(param_1 + 0xe8) == 0) {

    return;

  }

  FUN_00505920();

  return;

}





// --- FUN_0052f170 at 0x0052F170 (size: 123) ---


void __thiscall FUN_0052f170(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

  if (param_2 <= (uint)param_1[3]) {

    if (param_2 == 0) {

      param_1[3] = 0;

      operator_delete__((void *)*param_1);

      *param_1 = 0;

    }

    else {

      iVar1 = thunk_FUN_005df0f5(param_2 * 4);

      uVar2 = 0;

      param_1[3] = param_2;

      if (param_2 != 0) {

        do {

          *(undefined4 *)(iVar1 + uVar2 * 4) = *(undefined4 *)(*param_1 + uVar2 * 4);

          uVar2 = uVar2 + 1;

        } while (uVar2 < (uint)param_1[3]);

      }

      operator_delete__((void *)*param_1);

      *param_1 = iVar1;

    }

    if (param_2 < (uint)param_1[2]) {

      param_1[2] = param_2;

    }

    return;

  }

  FUN_0052f1f0(param_2);

  return;

}





// --- FUN_0052f1f0 at 0x0052F1F0 (size: 90) ---


void __thiscall FUN_0052f1f0(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

  if (param_2 <= (uint)param_1[3]) {

    FUN_0052f170(param_2);

    return;

  }

  iVar1 = thunk_FUN_005df0f5(param_2 * 4);

  uVar2 = 0;

  if (param_1[3] != 0) {

    do {

      *(undefined4 *)(iVar1 + uVar2 * 4) = *(undefined4 *)(*param_1 + uVar2 * 4);

      uVar2 = uVar2 + 1;

    } while (uVar2 < (uint)param_1[3]);

  }

  operator_delete__((void *)*param_1);

  *param_1 = iVar1;

  param_1[3] = param_2;

  return;

}





// --- FUN_0052f250 at 0x0052F250 (size: 30) ---


void __fastcall FUN_0052f250(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007c9bb0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[5] = 0;

  param_1[4] = 0;

  param_1[3] = 0x80;

  return;

}





// --- FUN_0052f270 at 0x0052F270 (size: 30) ---


void __fastcall FUN_0052f270(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007c9bb0;

  operator_delete__((void *)param_1[2]);

  param_1[2] = 0;

  return;

}





// --- FUN_0052f290 at 0x0052F290 (size: 122) ---


void __thiscall FUN_0052f290(int param_1,int param_2)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  int iVar3;

  uint uVar4;

  

  uVar4 = 0;

  if (*(int *)(param_1 + 4) != 0) {

    puVar2 = *(undefined4 **)(param_1 + 8);

    do {

      puVar1 = (undefined4 *)*puVar2;

      if (puVar1[3] == param_2) {

        puVar1[1] = 0;

        *puVar1 = 0;

        FUN_006b6020();

        operator_delete(puVar1);

        iVar3 = *(int *)(param_1 + 4) + -1;

        *(int *)(param_1 + 4) = iVar3;

        *(undefined4 *)(*(int *)(param_1 + 8) + uVar4 * 4) =

             *(undefined4 *)(*(int *)(param_1 + 8) + iVar3 * 4);

        break;

      }

      uVar4 = uVar4 + 1;

      puVar2 = puVar2 + 1;

    } while (uVar4 < *(uint *)(param_1 + 4));

  }

  if (*(int *)(param_1 + 4) + 200U < *(uint *)(param_1 + 0x14)) {

    FUN_0052f170(*(int *)(param_1 + 4) + 100);

  }

  return;

}





// --- FUN_0052f310 at 0x0052F310 (size: 69) ---


void __thiscall FUN_0052f310(int param_1,int param_2)



{

  void *pvVar1;

  uint uVar2;

  

  if ((param_2 != 0) && (uVar2 = 0, *(int *)(param_1 + 4) != 0)) {

    do {

      pvVar1 = *(void **)(*(int *)(param_1 + 8) + uVar2 * 4);

      if (pvVar1 != (void *)0x0) {

        FUN_006b6020();

        operator_delete(pvVar1);

      }

      uVar2 = uVar2 + 1;

    } while (uVar2 < *(uint *)(param_1 + 4));

  }

  *(undefined4 *)(param_1 + 4) = 0;

  return;

}





// --- FUN_0052f360 at 0x0052F360 (size: 51) ---


undefined4 * __thiscall FUN_0052f360(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_LAB_007c9bb0;

  operator_delete__((void *)param_1[2]);

  param_1[2] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0052f420 at 0x0052F420 (size: 93) ---


undefined4 __fastcall FUN_0052f420(int param_1)



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  uint uVar4;

  uint uVar5;

  undefined4 local_4;

  

  uVar4 = 0;

  local_4 = 1;

  uVar3 = 1;

  if (*(int *)(param_1 + 0x44) != 0) {

    do {

      iVar1 = *(int *)(*(int *)(param_1 + 0x48) + uVar4 * 4);

      uVar5 = 0;

      if (*(int *)(iVar1 + 0x48) != 0) {

        do {

          iVar2 = FUN_0053ca60();

          if (iVar2 == 0) {

            local_4 = 0;

          }

          uVar5 = uVar5 + 1;

        } while (uVar5 < *(uint *)(iVar1 + 0x48));

      }

      uVar4 = uVar4 + 1;

      uVar3 = local_4;

    } while (uVar4 < *(uint *)(param_1 + 0x44));

  }

  return uVar3;

}





// --- FUN_0052f480 at 0x0052F480 (size: 95) ---


void __fastcall FUN_0052f480(undefined4 *param_1)



{

  void *pvVar1;

  uint uVar2;

  

  uVar2 = 0;

  if (param_1[0x12] != 0) {

    do {

      pvVar1 = *(void **)(param_1[0x13] + uVar2 * 4);

      if (pvVar1 != (void *)0x0) {

        FUN_0053c8b0();

        operator_delete(pvVar1);

      }

      uVar2 = uVar2 + 1;

    } while (uVar2 < (uint)param_1[0x12]);

  }

  operator_delete__((void *)param_1[0x13]);

  param_1[0x13] = 0;

  *param_1 = DAT_00845ac0;

  param_1[0x12] = 0;

  param_1[0x11] = 0;

  return;

}





// --- FUN_0052f4e0 at 0x0052F4E0 (size: 70) ---


undefined4 * __fastcall FUN_0052f4e0(undefined4 *param_1)



{

  FUN_00415460(DAT_00845ac0);

  param_1[0xc] = &PTR_FUN_0079385c;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  *param_1 = &PTR_LAB_007c9c50;

  param_1[0xc] = &PTR_LAB_007c9c3c;

  return param_1;

}





// --- FUN_0052f540 at 0x0052F540 (size: 40) ---


undefined4 * __thiscall FUN_0052f540(undefined4 *param_1,undefined4 param_2)



{

  param_1[3] = param_2;

  *param_1 = &PTR_FUN_007c9ca8;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[4] = 0;

  FUN_005a8440();

  return param_1;

}





// --- FUN_0052f620 at 0x0052F620 (size: 255) ---


void __fastcall FUN_0052f620(int param_1)



{

  int *piVar1;

  void *pvVar2;

  uint uVar3;

  

  if (*(int *)(param_1 + 0x3c) != 0) {

    operator_delete__((void *)(*(int *)(param_1 + 0x3c) + -4));

    *(undefined4 *)(param_1 + 0x3c) = 0;

  }

  if (*(int *)(param_1 + 0x40) != 0) {

    operator_delete__((void *)(*(int *)(param_1 + 0x40) + -4));

    *(undefined4 *)(param_1 + 0x40) = 0;

  }

  if (*(int *)(param_1 + 0x5c) != 0) {

    uVar3 = 0;

    if (*(int *)(param_1 + 0x54) != 0) {

      do {

        FUN_00415610(*(undefined4 *)(*(int *)(param_1 + 0x5c) + uVar3 * 4));

        piVar1 = *(int **)(*(int *)(param_1 + 0x5c) + uVar3 * 4);

        if (piVar1 != (int *)0x0) {

          (**(code **)(*piVar1 + 0x14))();

          *(undefined4 *)(*(int *)(param_1 + 0x5c) + uVar3 * 4) = 0;

        }

        uVar3 = uVar3 + 1;

      } while (uVar3 < *(uint *)(param_1 + 0x54));

    }

    operator_delete__(*(void **)(param_1 + 0x5c));

    *(undefined4 *)(param_1 + 0x5c) = 0;

  }

  if (*(void **)(param_1 + 0x58) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x58));

    *(undefined4 *)(param_1 + 0x58) = 0;

  }

  if (*(int *)(param_1 + 0x48) != 0) {

    uVar3 = 0;

    if (*(int *)(param_1 + 0x44) != 0) {

      do {

        pvVar2 = *(void **)(*(int *)(param_1 + 0x48) + uVar3 * 4);

        if (pvVar2 != (void *)0x0) {

          FUN_0052f480();

          operator_delete(pvVar2);

        }

        uVar3 = uVar3 + 1;

      } while (uVar3 < *(uint *)(param_1 + 0x44));

    }

    operator_delete__(*(void **)(param_1 + 0x48));

    *(undefined4 *)(param_1 + 0x48) = 0;

  }

  *(undefined4 *)(param_1 + 0x38) = 0;

  if (*(undefined4 **)(param_1 + 0x4c) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x4c))(1);

    *(undefined4 *)(param_1 + 0x4c) = 0;

  }

  if (*(undefined4 **)(param_1 + 0x50) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x50))(1);

    *(undefined4 *)(param_1 + 0x50) = 0;

  }

  *(undefined4 *)(param_1 + 0x54) = 0;

  *(undefined4 *)(param_1 + 0x44) = 0;

  return;

}





// --- FUN_0052f720 at 0x0052F720 (size: 153) ---


int __fastcall FUN_0052f720(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int *piVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  

  iVar5 = *(int *)(param_1 + 0x38) * 0x20 + 0xc;

  uVar7 = 0;

  if (*(int *)(param_1 + 0x44) != 0) {

    iVar1 = FUN_006b2f10();

    iVar3 = *(int *)(param_1 + 0x48);

    do {

      iVar5 = iVar5 + iVar1 + 0xc;

      uVar6 = 0;

      if (*(int *)(*(int *)(iVar3 + uVar7 * 4) + 0x48) != 0) {

        do {

          iVar2 = FUN_0053cab0();

          iVar3 = *(int *)(param_1 + 0x48);

          iVar5 = iVar5 + iVar2;

          uVar6 = uVar6 + 1;

        } while (uVar6 < *(uint *)(*(int *)(iVar3 + uVar7 * 4) + 0x48));

      }

      uVar7 = uVar7 + 1;

    } while (uVar7 < *(uint *)(param_1 + 0x44));

  }

  iVar3 = *(int *)(param_1 + 0x4c);

  if (iVar3 != 0) {

    iVar1 = *(int *)(iVar3 + 0xc);

    iVar2 = 4;

    if (iVar1 != 0) {

      piVar4 = *(int **)(iVar3 + 8);

      do {

        for (iVar3 = *piVar4; iVar3 != 0; iVar3 = *(int *)(iVar3 + 8)) {

          iVar2 = iVar2 + 8;

        }

        piVar4 = piVar4 + 1;

        iVar1 = iVar1 + -1;

      } while (iVar1 != 0);

    }

    iVar5 = iVar5 + iVar2;

  }

  return iVar5;

}





// --- FUN_0052fbd0 at 0x0052FBD0 (size: 31) ---


undefined4 __fastcall FUN_0052fbd0(int param_1)



{

  undefined4 *puVar1;

  

  if (*(int *)(param_1 + 0x4c) != 0) {

    puVar1 = (undefined4 *)FUN_005d5760(&stack0x00000004);

    if (puVar1 != (undefined4 *)0x0) {

      return *puVar1;

    }

  }

  return 0;

}





// --- FUN_0052fbf0 at 0x0052FBF0 (size: 245) ---


bool __thiscall FUN_0052fbf0(int param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  int *piVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  uint uVar6;

  undefined4 local_c;

  int local_8;

  uint local_4;

  

  uVar3 = param_3;

  piVar2 = param_2;

  if (param_3 < 4) {

    return false;

  }

  local_8 = *param_2;

  local_4 = param_3;

  FUN_0052fcf0();

  uVar4 = *(uint *)*piVar2;

  *piVar2 = (int)((uint *)*piVar2 + 1);

  uVar6 = uVar4 >> 0x10;

  uVar4 = uVar4 & 0xffff;

  *(uint *)(param_1 + 0xc) = uVar6;

  if (uVar6 == 0) {

    return uVar4 == 0;

  }

  if (((0x10000 < uVar6) || (0x10000 < uVar4)) || (iVar5 = FUN_005a8440(), iVar5 == 0)) {

    return false;

  }

  param_3 = 0;

  if (uVar4 != 0) {

    do {

      if (uVar3 - 4 < 4) {

        return false;

      }

      puVar1 = (undefined4 *)*piVar2;

      local_c = *puVar1;

      *piVar2 = (int)(puVar1 + 1);

      param_2 = (int *)puVar1[1];

      *piVar2 = (int)(puVar1 + 2);

      iVar5 = FUN_0052dfd0(&local_c,&param_2);

      if ((iVar5 == 0) && (*(int *)(param_1 + 4) == 0)) {

        return false;

      }

      param_3 = param_3 + 1;

    } while (param_3 < uVar4);

  }

  return (uint)(*piVar2 - local_8) <= local_4;

}





// --- FUN_0052fcf0 at 0x0052FCF0 (size: 40) ---


void __fastcall FUN_0052fcf0(int param_1)



{

  FUN_005d59a0();

  if (*(void **)(param_1 + 8) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 8));

    *(undefined4 *)(param_1 + 8) = 0;

  }

  *(undefined4 *)(param_1 + 0xc) = 0;

  return;

}





// --- FUN_0052fd20 at 0x0052FD20 (size: 42) ---


undefined4 * __thiscall FUN_0052fd20(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007c9ca8;

  FUN_0052fcf0();

  *param_1 = &PTR_FUN_0079385c;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0052fd50 at 0x0052FD50 (size: 57) ---


undefined4 * __thiscall FUN_0052fd50(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_LAB_007c9c50;

  param_1[0xc] = &PTR_LAB_007c9c3c;

  FUN_0052f620();

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0052fd90 at 0x0052FD90 (size: 60) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



undefined4 __thiscall FUN_0052fd90(float *param_1,float *param_2)



{

  if (_DAT_007c9d6c < ABS(param_1[2])) {

    param_2[2] = -((*param_2 * *param_1 + param_2[1] * param_1[1] + param_1[3]) / param_1[2]);

    return 1;

  }

  return 0;

}





// --- FUN_0052fdd0 at 0x0052FDD0 (size: 41) ---


undefined4 __thiscall FUN_0052fdd0(int param_1,float param_2)



{

  if ((*(float *)(param_1 + 0x5c) <= param_2) &&

     (param_2 < *(float *)(param_1 + 0x60) != (param_2 == *(float *)(param_1 + 0x60)))) {

    return 1;

  }

  return 0;

}





// --- FUN_0052fe00 at 0x0052FE00 (size: 121) ---


float10 __fastcall FUN_0052fe00(int param_1)



{

  float10 fVar1;

  

  if (*(float *)(param_1 + 0x50) == *(float *)(param_1 + 0x54)) {

    return (float10)*(float *)(param_1 + 0x54);

  }

  fVar1 = (float10)_CIpow();

  return fVar1 * (float10)*(float *)(param_1 + 0x50);

}





// --- FUN_0052fe80 at 0x0052FE80 (size: 142) ---


void __fastcall FUN_0052fe80(int param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  

  if (*(int *)(param_1 + 0x11c) != 0) {

    uVar2 = 0;

    if (*(int *)(param_1 + 0x118) != 0) {

      do {

        if (*(int *)(*(int *)(param_1 + 0x11c) + uVar2 * 4) != 0) {

          FUN_006b6140();

          puVar1 = *(undefined4 **)(*(int *)(param_1 + 0x11c) + uVar2 * 4);

          if (puVar1 != (undefined4 *)0x0) {

            (**(code **)*puVar1)(1);

          }

        }

        uVar2 = uVar2 + 1;

      } while (uVar2 < *(uint *)(param_1 + 0x118));

    }

    operator_delete__(*(void **)(param_1 + 0x11c));

    *(undefined4 *)(param_1 + 0x11c) = 0;

  }

  *(undefined4 *)(param_1 + 0x118) = 0;

  if (*(void **)(param_1 + 0x124) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x124));

    *(undefined4 *)(param_1 + 0x124) = 0;

    *(undefined4 *)(param_1 + 0x120) = 0;

  }

  return;

}





// --- FUN_0052ff10 at 0x0052FF10 (size: 225) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __fastcall FUN_0052ff10(int param_1)



{

  byte bVar1;

  byte bVar2;

  byte bVar3;

  byte *pbVar4;

  int iVar5;

  

  bVar2 = **(byte **)(param_1 + 0x50);

  pbVar4 = *(byte **)(param_1 + 0x50) + 3;

  iVar5 = 8;

  bVar3 = bVar2;

  do {

    bVar1 = pbVar4[-2];

    if (bVar2 < bVar1) {

      bVar2 = bVar1;

    }

    if (bVar1 < bVar3) {

      bVar3 = bVar1;

    }

    bVar1 = pbVar4[-1];

    if (bVar2 < bVar1) {

      bVar2 = bVar1;

    }

    if (bVar1 < bVar3) {

      bVar3 = bVar1;

    }

    bVar1 = *pbVar4;

    if (bVar2 < bVar1) {

      bVar2 = bVar1;

    }

    if (bVar1 < bVar3) {

      bVar3 = bVar1;

    }

    bVar1 = pbVar4[1];

    if (bVar2 < bVar1) {

      bVar2 = bVar1;

    }

    if (bVar1 < bVar3) {

      bVar3 = bVar1;

    }

    bVar1 = pbVar4[2];

    if (bVar2 < bVar1) {

      bVar2 = bVar1;

    }

    if (bVar1 < bVar3) {

      bVar3 = bVar1;

    }

    bVar1 = pbVar4[3];

    if (bVar2 < bVar1) {

      bVar2 = bVar1;

    }

    if (bVar1 < bVar3) {

      bVar3 = bVar1;

    }

    bVar1 = pbVar4[4];

    if (bVar2 < bVar1) {

      bVar2 = bVar1;

    }

    if (bVar1 < bVar3) {

      bVar3 = bVar1;

    }

    bVar1 = pbVar4[5];

    if (bVar2 < bVar1) {

      bVar2 = bVar1;

    }

    if (bVar1 < bVar3) {

      bVar3 = bVar1;

    }

    bVar1 = pbVar4[6];

    if (bVar2 < bVar1) {

      bVar2 = bVar1;

    }

    if (bVar1 < bVar3) {

      bVar3 = bVar1;

    }

    bVar1 = pbVar4[7];

    if (bVar2 < bVar1) {

      bVar2 = bVar1;

    }

    if (bVar1 < bVar3) {

      bVar3 = bVar1;

    }

    pbVar4 = pbVar4 + 10;

    iVar5 = iVar5 + -1;

  } while (iVar5 != 0);

  *(float *)(param_1 + 0xe0) = (float)(&DAT_008eea38)[bVar2] + _DAT_007c9ce4;

  *(float *)(param_1 + 0xe4) = (float)(&DAT_008eea38)[bVar3] - _DAT_007938b0;

  return;

}





