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

// --- FUN_005e02a0 at 0x005E02A0 (size: 52) ---


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



undefined4 FUN_005e02a0(float param_1,float param_2)



{

  undefined4 uVar1;

  

  param_1 = param_1 - param_2;

  if ((_DAT_007ed2fc < param_1 == (_DAT_007ed2fc == param_1)) ||

     (param_1 < _DAT_007ed2f8 == (param_1 == _DAT_007ed2f8))) {

    uVar1 = 0;

  }

  else {

    uVar1 = 1;

  }

  return uVar1;

}





// --- FUN_005e02d4 at 0x005E02D4 (size: 19) ---


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



void FUN_005e02d4(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252d0)();

  return;

}





// --- thunk_FUN_005e02d4 at 0x005E02E7 (size: 6) ---


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



void thunk_FUN_005e02d4(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252d0)();

  return;

}





// --- FUN_005e02ed at 0x005E02ED (size: 162) ---


void FUN_005e02ed(int param_1,int param_2,uint param_3)



{

  uint uVar1;

  ushort uVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  

  uVar4 = 0;

  if (param_3 != 0) {

    do {

      uVar1 = *(uint *)(param_2 + uVar4 * 4);

      uVar3 = uVar1 & 0x7fffffff;

      uVar2 = (ushort)(uVar1 >> 0x10) & 0x8000;

      if (uVar3 < 0x47fff000) {

        if (uVar3 < 0x38800000) {

          iVar5 = 0x71 - (uVar3 >> 0x17);

          if (iVar5 < 0x20) {

            uVar3 = (uVar1 & 0x7fffff | 0x800000) >> ((byte)iVar5 & 0x1f);

          }

          else {

            uVar3 = 0;

          }

          uVar3 = (uVar3 >> 0xd & 1) + 0xfff + uVar3;

        }

        else {

          uVar3 = (uVar3 >> 0xd & 1) + 0xc8000fff + uVar3;

        }

        uVar2 = (ushort)(uVar3 >> 0xd) | uVar2;

      }

      else {

        uVar2 = uVar2 | 0x7fff;

      }

      *(ushort *)(param_1 + uVar4 * 2) = uVar2;

      uVar4 = uVar4 + 1;

    } while (uVar4 < param_3);

  }

  return;

}





// --- FUN_005e038f at 0x005E038F (size: 19) ---


void FUN_005e038f(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_008252d4)();

  return;

}





// --- thunk_FUN_005e038f at 0x005E03A2 (size: 6) ---


void thunk_FUN_005e038f(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_008252d4)();

  return;

}





// --- FUN_005e03a8 at 0x005E03A8 (size: 167) ---


int FUN_005e03a8(int param_1,int param_2,uint param_3)



{

  ushort uVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  

  uVar4 = 0;

  if (param_3 != 0) {

    do {

      uVar1 = *(ushort *)(param_2 + uVar4 * 2);

      uVar2 = (uint)uVar1;

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

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

          uVar2 = (uVar2 & 0xffff8000) << 0x10;

        }

        else {

          iVar5 = -0xe;

          for (uVar3 = uVar2 & 0x3ff; (uVar3 & 0x400) == 0; uVar3 = uVar3 << 1) {

            iVar5 = iVar5 + -1;

          }

          uVar2 = (((uVar2 & 0xffff8080) << 3 | uVar3) & 0xfffffbff) << 0xd |

                  (iVar5 + 0x7f) * 0x800000;

        }

      }

      else {

        uVar2 = ((uVar2 & 0xffff8000) << 3 | uVar2 & 0x3ff) << 0xd |

                ((uVar1 >> 10 & 0x1f) + 0x70) * 0x800000;

      }

      *(uint *)(param_1 + uVar4 * 4) = uVar2;

      uVar4 = uVar4 + 1;

    } while (uVar4 < param_3);

  }

  return param_1;

}





// --- FUN_005e044f at 0x005E044F (size: 19) ---


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



void FUN_005e044f(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252a4)();

  return;

}





// --- FUN_005e0462 at 0x005E0462 (size: 44) ---


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

                 undefined4 param_5,undefined4 param_6)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825230)(param_1,param_2,param_3,param_4,param_5,param_6);

  return;

}





// --- FUN_005e048e at 0x005E048E (size: 144) ---


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



void FUN_005e048e(float *param_1,float *param_2,float *param_3,float *param_4,float *param_5,

                 float param_6)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  

  fVar1 = param_6 * param_6;

  fVar2 = param_6 * fVar1;

  fVar4 = ((fVar2 + fVar2) - fVar1 * _DAT_007938bc) + _DAT_007938b0;

  param_6 = (fVar2 - (fVar1 + fVar1)) + param_6;

  fVar3 = fVar1 * _DAT_007938bc - (fVar2 + fVar2);

  *param_1 = (fVar2 - fVar1) * *param_5 + fVar3 * *param_4 + param_6 * *param_3 + fVar4 * *param_2;

  param_1[1] = fVar4 * param_2[1] +

               param_6 * param_3[1] + fVar3 * param_4[1] + (fVar2 - fVar1) * param_5[1];

  return;

}





// --- FUN_005e051e at 0x005E051E (size: 44) ---


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

                 undefined4 param_5,undefined4 param_6)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_008252a8)(param_1,param_2,param_3,param_4,param_5,param_6);

  return;

}





// --- FUN_005e054a at 0x005E054A (size: 177) ---


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



void FUN_005e054a(float *param_1,float *param_2,float *param_3,float *param_4,float *param_5,

                 float param_6)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  

  fVar5 = _DAT_007938b8;

  fVar1 = param_6 * param_6;

  fVar2 = param_6 * fVar1;

  fVar4 = (fVar1 * _DAT_007c6bc4 - fVar2) - param_6;

  fVar3 = (fVar2 * _DAT_007938bc - fVar1 * _DAT_007b817c) + _DAT_007c6bc4;

  param_6 = (fVar1 * _DAT_007c6f14 - fVar2 * _DAT_007938bc) + param_6;

  *param_1 = ((fVar2 - fVar1) * *param_5 + param_6 * *param_4 + fVar3 * *param_3 + fVar4 * *param_2)

             * _DAT_007938b8;

  param_1[1] = (fVar4 * param_2[1] +

               fVar3 * param_3[1] + param_6 * param_4[1] + (fVar2 - fVar1) * param_5[1]) * fVar5;

  return;

}





// --- FUN_005e05fb at 0x005E05FB (size: 49) ---


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

                 undefined4 param_5,undefined4 param_6)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_008252ac)(param_1,param_2,param_3,param_4,param_5,param_6);

  return;

}





// --- FUN_005e062c at 0x005E062C (size: 69) ---


void FUN_005e062c(float *param_1,float *param_2,float *param_3,float *param_4,float param_5,

                 float param_6)



{

  *param_1 = (*param_4 - *param_2) * param_6 + (*param_3 - *param_2) * param_5 + *param_2;

  param_1[1] = (param_4[1] - param_2[1]) * param_6 + (param_3[1] - param_2[1]) * param_5 +

               param_2[1];

  return;

}





// --- FUN_005e0671 at 0x005E0671 (size: 19) ---


void FUN_005e0671(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_008251e8)();

  return;

}





// --- thunk_FUN_005e0671 at 0x005E0684 (size: 6) ---


void thunk_FUN_005e0671(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_008251e8)();

  return;

}





// --- FUN_005e069d at 0x005E069D (size: 19) ---


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



void FUN_005e069d(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_0082520c)();

  return;

}





// --- thunk_FUN_005e069d at 0x005E06B0 (size: 6) ---


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



void thunk_FUN_005e069d(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_0082520c)();

  return;

}





// --- FUN_005e06c9 at 0x005E06C9 (size: 19) ---


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



void FUN_005e06c9(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008251fc)();

  return;

}





// --- thunk_FUN_005e06c9 at 0x005E06DC (size: 6) ---


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



void thunk_FUN_005e06c9(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008251fc)();

  return;

}





// --- FUN_005e06f5 at 0x005E06F5 (size: 19) ---


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



void FUN_005e06f5(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825204)();

  return;

}





// --- thunk_FUN_005e06f5 at 0x005E0708 (size: 6) ---


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



void thunk_FUN_005e06f5(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825204)();

  return;

}





// --- FUN_005e073a at 0x005E073A (size: 176) ---


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



void FUN_005e073a(float *param_1,float *param_2,float *param_3,float *param_4,float *param_5,

                 float param_6)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  

  fVar1 = param_6 * param_6;

  fVar2 = param_6 * fVar1;

  fVar4 = ((fVar2 + fVar2) - fVar1 * _DAT_007938bc) + _DAT_007938b0;

  param_6 = (fVar2 - (fVar1 + fVar1)) + param_6;

  fVar3 = fVar1 * _DAT_007938bc - (fVar2 + fVar2);

  fVar2 = fVar2 - fVar1;

  *param_1 = fVar2 * *param_5 + fVar3 * *param_4 + param_6 * *param_3 + fVar4 * *param_2;

  param_1[1] = fVar4 * param_2[1] + param_6 * param_3[1] + fVar3 * param_4[1] + fVar2 * param_5[1];

  param_1[2] = fVar4 * param_2[2] + param_6 * param_3[2] + fVar3 * param_4[2] + fVar2 * param_5[2];

  return;

}





// --- FUN_005e07ea at 0x005E07EA (size: 44) ---


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

                 undefined4 param_5,undefined4 param_6)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_008252b4)(param_1,param_2,param_3,param_4,param_5,param_6);

  return;

}





// --- FUN_005e0816 at 0x005E0816 (size: 211) ---


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



void FUN_005e0816(float *param_1,float *param_2,float *param_3,float *param_4,float *param_5,

                 float param_6)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  

  fVar5 = _DAT_007938b8;

  fVar1 = param_6 * param_6;

  fVar2 = param_6 * fVar1;

  fVar4 = (fVar1 * _DAT_007c6bc4 - fVar2) - param_6;

  fVar3 = (fVar2 * _DAT_007938bc - fVar1 * _DAT_007b817c) + _DAT_007c6bc4;

  param_6 = (fVar1 * _DAT_007c6f14 - fVar2 * _DAT_007938bc) + param_6;

  fVar2 = fVar2 - fVar1;

  *param_1 = (fVar2 * *param_5 + param_6 * *param_4 + fVar3 * *param_3 + fVar4 * *param_2) *

             _DAT_007938b8;

  param_1[1] = (fVar4 * param_2[1] + fVar3 * param_3[1] + param_6 * param_4[1] + fVar2 * param_5[1])

               * fVar5;

  param_1[2] = (fVar4 * param_2[2] + fVar3 * param_3[2] + param_6 * param_4[2] + fVar2 * param_5[2])

               * fVar5;

  return;

}





// --- FUN_005e08e9 at 0x005E08E9 (size: 49) ---


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

                 undefined4 param_5,undefined4 param_6)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_008252b8)(param_1,param_2,param_3,param_4,param_5,param_6);

  return;

}





// --- FUN_005e091a at 0x005E091A (size: 95) ---


void FUN_005e091a(float *param_1,float *param_2,float *param_3,float *param_4,float param_5,

                 float param_6)



{

  *param_1 = (*param_4 - *param_2) * param_6 + (*param_3 - *param_2) * param_5 + *param_2;

  param_1[1] = (param_4[1] - param_2[1]) * param_6 + (param_3[1] - param_2[1]) * param_5 +

               param_2[1];

  param_1[2] = (param_4[2] - param_2[2]) * param_6 + (param_3[2] - param_2[2]) * param_5 +

               param_2[2];

  return;

}





// --- FUN_005e0979 at 0x005E0979 (size: 19) ---


void FUN_005e0979(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_008251ec)();

  return;

}





// --- thunk_FUN_005e0979 at 0x005E098C (size: 6) ---


void thunk_FUN_005e0979(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_008251ec)();

  return;

}





// --- FUN_005e09a5 at 0x005E09A5 (size: 19) ---


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



void FUN_005e09a5(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825210)();

  return;

}





// --- thunk_FUN_005e09a5 at 0x005E09B8 (size: 6) ---


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



void thunk_FUN_005e09a5(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825210)();

  return;

}





// --- FUN_005e09be at 0x005E09BE (size: 19) ---


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



void FUN_005e09be(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252e8)();

  return;

}





// --- thunk_FUN_005e09be at 0x005E09D1 (size: 6) ---


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



void thunk_FUN_005e09be(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252e8)();

  return;

}





// --- FUN_005e09d7 at 0x005E09D7 (size: 19) ---


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



void FUN_005e09d7(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825200)();

  return;

}





// --- thunk_FUN_005e09d7 at 0x005E09EA (size: 6) ---


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



void thunk_FUN_005e09d7(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825200)();

  return;

}





// --- FUN_005e0a58 at 0x005E0A58 (size: 19) ---


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



void FUN_005e0a58(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252ec)();

  return;

}





// --- FUN_005e0aeb at 0x005E0AEB (size: 19) ---


void FUN_005e0aeb(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00825224)();

  return;

}





// --- FUN_005e0c3c at 0x005E0C3C (size: 19) ---


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



void FUN_005e0c3c(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825208)();

  return;

}





// --- FUN_005e0c7b at 0x005E0C7B (size: 211) ---


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



void FUN_005e0c7b(float *param_1,float *param_2,float *param_3,float *param_4,float *param_5,

                 float param_6)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  

  fVar1 = param_6 * param_6;

  fVar2 = param_6 * fVar1;

  fVar3 = ((fVar2 + fVar2) - _DAT_007938bc * fVar1) + _DAT_007938b0;

  param_6 = (fVar2 - (fVar1 + fVar1)) + param_6;

  fVar4 = _DAT_007938bc * fVar1 - (fVar2 + fVar2);

  fVar2 = fVar2 - fVar1;

  *param_1 = fVar2 * *param_5 + fVar4 * *param_4 + param_6 * *param_3 + fVar3 * *param_2;

  param_1[1] = fVar3 * param_2[1] + param_6 * param_3[1] + fVar4 * param_4[1] + fVar2 * param_5[1];

  param_1[2] = fVar3 * param_2[2] + param_6 * param_3[2] + fVar4 * param_4[2] + fVar2 * param_5[2];

  param_1[3] = fVar3 * param_2[3] + param_6 * param_3[3] + fVar4 * param_4[3] + fVar2 * param_5[3];

  return;

}





// --- FUN_005e0d4e at 0x005E0D4E (size: 44) ---


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

                 undefined4 param_5,undefined4 param_6)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_008252c0)(param_1,param_2,param_3,param_4,param_5,param_6);

  return;

}





// --- FUN_005e0d7a at 0x005E0D7A (size: 245) ---


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



void FUN_005e0d7a(float *param_1,float *param_2,float *param_3,float *param_4,float *param_5,

                 float param_6)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  

  fVar5 = _DAT_007938b8;

  fVar1 = param_6 * param_6;

  fVar2 = param_6 * fVar1;

  fVar4 = (fVar1 * _DAT_007c6bc4 - fVar2) - param_6;

  fVar3 = (fVar2 * _DAT_007938bc - fVar1 * _DAT_007b817c) + _DAT_007c6bc4;

  param_6 = (fVar1 * _DAT_007c6f14 - fVar2 * _DAT_007938bc) + param_6;

  fVar2 = fVar2 - fVar1;

  *param_1 = (fVar2 * *param_5 + param_6 * *param_4 + fVar3 * *param_3 + fVar4 * *param_2) *

             _DAT_007938b8;

  param_1[1] = (fVar4 * param_2[1] + fVar3 * param_3[1] + param_6 * param_4[1] + fVar2 * param_5[1])

               * fVar5;

  param_1[2] = (fVar4 * param_2[2] + fVar3 * param_3[2] + param_6 * param_4[2] + fVar2 * param_5[2])

               * fVar5;

  param_1[3] = (fVar4 * param_2[3] + fVar3 * param_3[3] + param_6 * param_4[3] + fVar2 * param_5[3])

               * fVar5;

  return;

}





// --- FUN_005e0e6f at 0x005E0E6F (size: 49) ---


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

                 undefined4 param_5,undefined4 param_6)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_008252c4)(param_1,param_2,param_3,param_4,param_5,param_6);

  return;

}





// --- FUN_005e0ea0 at 0x005E0EA0 (size: 121) ---


void FUN_005e0ea0(float *param_1,float *param_2,float *param_3,float *param_4,float param_5,

                 float param_6)



{

  *param_1 = (*param_4 - *param_2) * param_6 + (*param_3 - *param_2) * param_5 + *param_2;

  param_1[1] = (param_4[1] - param_2[1]) * param_6 + (param_3[1] - param_2[1]) * param_5 +

               param_2[1];

  param_1[2] = (param_4[2] - param_2[2]) * param_6 + (param_3[2] - param_2[2]) * param_5 +

               param_2[2];

  param_1[3] = (param_4[3] - param_2[3]) * param_6 + (param_3[3] - param_2[3]) * param_5 +

               param_2[3];

  return;

}





// --- FUN_005e0f19 at 0x005E0F19 (size: 19) ---


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



void FUN_005e0f19(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008251f0)();

  return;

}





// --- FUN_005e0fcd at 0x005E0FCD (size: 19) ---


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



void FUN_005e0fcd(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252f0)();

  return;

}





// --- FUN_005e10a1 at 0x005E10A1 (size: 19) ---


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



void FUN_005e10a1(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825214)();

  return;

}





// --- thunk_FUN_005e10a1 at 0x005E10B4 (size: 6) ---


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



void thunk_FUN_005e10a1(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825214)();

  return;

}





// --- FUN_005e1186 at 0x005E1186 (size: 19) ---


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



void FUN_005e1186(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825218)();

  return;

}





// --- FUN_005e1199 at 0x005E1199 (size: 19) ---


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



void FUN_005e1199(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008251f4)();

  return;

}





// --- thunk_FUN_005e1199 at 0x005E11AC (size: 6) ---


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



void thunk_FUN_005e1199(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008251f4)();

  return;

}





// --- FUN_005e13ea at 0x005E13EA (size: 19) ---


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



void FUN_005e13ea(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825280)();

  return;

}





// --- thunk_FUN_005e13ea at 0x005E13FD (size: 6) ---


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



void thunk_FUN_005e13ea(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825280)();

  return;

}





// --- FUN_005e1474 at 0x005E1474 (size: 19) ---


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



void FUN_005e1474(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008251f8)();

  return;

}





// --- FUN_005e16bf at 0x005E16BF (size: 19) ---


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



void FUN_005e16bf(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825234)();

  return;

}





// --- thunk_FUN_005e16bf at 0x005E16D2 (size: 6) ---


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



void thunk_FUN_005e16bf(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825234)();

  return;

}





// --- FUN_005e1a7f at 0x005E1A7F (size: 48) ---


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



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825270)(param_1,param_2,param_3,param_4);

  return;

}





// --- FUN_005e1aaf at 0x005E1AAF (size: 94) ---


void FUN_005e1aaf(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  param_1[0xe] = 0;

  *param_1 = param_2;

  param_1[0xd] = 0;

  param_1[5] = param_3;

  param_1[0xc] = 0;

  param_1[10] = param_4;

  param_1[0xb] = 0;

  param_1[9] = 0;

  param_1[8] = 0;

  param_1[7] = 0;

  param_1[6] = 0;

  param_1[4] = 0;

  param_1[3] = 0;

  param_1[2] = 0;

  param_1[1] = 0;

  param_1[0xf] = 0x3f800000;

  return;

}





// --- FUN_005e1b0d at 0x005E1B0D (size: 48) ---


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



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825254)(param_1,param_2,param_3,param_4);

  return;

}





// --- FUN_005e1b3d at 0x005E1B3D (size: 94) ---


void FUN_005e1b3d(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  param_1[0xb] = 0;

  param_1[0xc] = param_2;

  param_1[9] = 0;

  param_1[0xd] = param_3;

  param_1[8] = 0;

  param_1[0xe] = param_4;

  param_1[7] = 0;

  param_1[6] = 0;

  param_1[4] = 0;

  param_1[3] = 0;

  param_1[2] = 0;

  param_1[1] = 0;

  param_1[0xf] = 0x3f800000;

  param_1[10] = 0x3f800000;

  param_1[5] = 0x3f800000;

  *param_1 = 0x3f800000;

  return;

}





// --- FUN_005e1b9b at 0x005E1B9B (size: 32) ---


void FUN_005e1b9b(undefined4 param_1,undefined4 param_2)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825264)(param_1,param_2);

  return;

}





// --- FUN_005e1bbb at 0x005E1BBB (size: 124) ---


void FUN_005e1bbb(undefined4 *param_1,float param_2)



{

  float10 fVar1;

  float10 fVar2;

  

  fVar1 = (float10)fcos((float10)param_2);

  fVar2 = (float10)fsin((float10)param_2);

  *param_1 = 0x3f800000;

  param_1[1] = 0;

  param_1[6] = (float)fVar2;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = (float)fVar1;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = -(float)fVar2;

  param_1[10] = (float)fVar1;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0x3f800000;

  return;

}





// --- FUN_005e1c37 at 0x005E1C37 (size: 32) ---


void FUN_005e1c37(undefined4 param_1,undefined4 param_2)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825268)(param_1,param_2);

  return;

}





// --- FUN_005e1c57 at 0x005E1C57 (size: 125) ---


void FUN_005e1c57(float *param_1,float param_2)



{

  float10 fVar1;

  float10 fVar2;

  

  fVar1 = (float10)fcos((float10)param_2);

  fVar2 = (float10)fsin((float10)param_2);

  *param_1 = (float)fVar1;

  param_1[1] = 0.0;

  param_1[2] = -(float)fVar2;

  param_1[3] = 0.0;

  param_1[4] = 0.0;

  param_1[5] = 1.0;

  param_1[6] = 0.0;

  param_1[7] = 0.0;

  param_1[8] = (float)fVar2;

  param_1[9] = 0.0;

  param_1[10] = (float)fVar1;

  param_1[0xb] = 0.0;

  param_1[0xc] = 0.0;

  param_1[0xd] = 0.0;

  param_1[0xe] = 0.0;

  param_1[0xf] = 1.0;

  return;

}





// --- FUN_005e1cd4 at 0x005E1CD4 (size: 32) ---


void FUN_005e1cd4(undefined4 param_1,undefined4 param_2)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_0082526c)(param_1,param_2);

  return;

}





// --- thunk_FUN_005e1cd4 at 0x005E1CF4 (size: 6) ---


void thunk_FUN_005e1cd4(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_0082526c)();

  return;

}





// --- FUN_005e1d78 at 0x005E1D78 (size: 35) ---


void FUN_005e1d78(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825294)(param_1,param_2,param_3);

  return;

}





// --- FUN_005e1d9b at 0x005E1D9B (size: 257) ---


void FUN_005e1d9b(float *param_1,float *param_2,float param_3)



{

  float10 fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float10 fVar6;

  float local_20;

  float local_1c;

  float local_18;

  float *local_14;

  float *local_10;

  float local_c;

  float local_8;

  

  local_10 = &local_8;

  local_14 = &local_c;

  fVar1 = (float10)fcos((float10)param_3);

  fVar6 = (float10)fsin((float10)param_3);

  local_8 = (float)fVar1;

  local_c = (float)fVar6;

  fVar2 = 1.0 - local_8;

  local_20 = *param_2;

  local_1c = param_2[1];

  local_18 = param_2[2];

  thunk_FUN_005e06f5(&local_20,&local_20);

  fVar3 = local_1c * local_20 * fVar2;

  fVar4 = local_1c * local_18 * fVar2;

  fVar5 = local_18 * local_20 * fVar2;

  *param_1 = local_20 * local_20 * fVar2 + local_8;

  param_1[1] = fVar3 + local_18 * local_c;

  param_1[2] = fVar5 - local_1c * local_c;

  param_1[3] = 0.0;

  param_1[4] = fVar3 - local_18 * local_c;

  param_1[5] = local_1c * local_1c * fVar2 + local_8;

  param_1[6] = local_20 * local_c + fVar4;

  param_1[7] = 0.0;

  param_1[8] = local_1c * local_c + fVar5;

  param_1[9] = fVar4 - local_20 * local_c;

  param_1[10] = local_18 * local_18 * fVar2 + local_8;

  param_1[0xb] = 0.0;

  param_1[0xc] = 0.0;

  param_1[0xd] = 0.0;

  param_1[0xe] = 0.0;

  param_1[0xf] = 1.0;

  return;

}





// --- FUN_005e1e9c at 0x005E1E9C (size: 19) ---


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



void FUN_005e1e9c(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825284)();

  return;

}





// --- thunk_FUN_005e1e9c at 0x005E1EAF (size: 6) ---


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



void thunk_FUN_005e1e9c(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825284)();

  return;

}





// --- FUN_005e1f99 at 0x005E1F99 (size: 48) ---


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



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_0082528c)(param_1,param_2,param_3,param_4);

  return;

}





// --- FUN_005e1fc9 at 0x005E1FC9 (size: 19) ---


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



void FUN_005e1fc9(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825288)();

  return;

}





// --- FUN_005e200f at 0x005E200F (size: 41) ---


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

                 undefined4 param_5)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825290)(param_1,param_2,param_3,param_4,param_5);

  return;

}





// --- FUN_005e2128 at 0x005E2128 (size: 45) ---


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

                 undefined4 param_5)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_0082530c)(param_1,param_2,param_3,param_4,param_5);

  return;

}





// --- FUN_005e223c at 0x005E223C (size: 150) ---


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



void FUN_005e223c(float *param_1,float param_2,float param_3,float param_4,float param_5)



{

  float10 fVar1;

  float10 fVar2;

  

  fVar1 = (float10)fcos((float10)(param_2 * _DAT_007938b8));

  fVar2 = (float10)fsin((float10)(param_2 * _DAT_007938b8));

  *param_1 = ((float)fVar1 / (float)fVar2) / param_3;

  param_1[1] = 0.0;

  param_1[2] = 0.0;

  param_1[3] = 0.0;

  param_1[4] = 0.0;

  param_1[5] = (float)fVar1 / (float)fVar2;

  param_1[6] = 0.0;

  param_1[7] = 0.0;

  param_1[8] = 0.0;

  param_1[9] = 0.0;

  param_5 = param_5 / (param_5 - param_4);

  param_1[10] = param_5;

  param_1[0xb] = 1.0;

  param_1[0xc] = 0.0;

  param_1[0xd] = 0.0;

  param_1[0xe] = -(param_5 * param_4);

  param_1[0xf] = 0.0;

  return;

}





// --- FUN_005e22d2 at 0x005E22D2 (size: 19) ---


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



void FUN_005e22d2(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825258)();

  return;

}





// --- FUN_005e2343 at 0x005E2343 (size: 19) ---


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



void FUN_005e2343(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_0082524c)();

  return;

}





// --- thunk_FUN_005e2343 at 0x005E2356 (size: 6) ---


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



void thunk_FUN_005e2343(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_0082524c)();

  return;

}





// --- FUN_005e2492 at 0x005E2492 (size: 35) ---


void FUN_005e2492(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825260)(param_1,param_2,param_3);

  return;

}





// --- FUN_005e24b5 at 0x005E24B5 (size: 94) ---


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



float * FUN_005e24b5(float *param_1,undefined4 param_2,float param_3)



{

  float fVar1;

  float10 fVar2;

  float10 fVar3;

  float local_18;

  float local_14;

  float local_10;

  

  thunk_FUN_005e06f5(&local_18,param_2);

  fVar2 = (float10)fcos((float10)(param_3 * _DAT_007938b8));

  fVar3 = (float10)fsin((float10)(param_3 * _DAT_007938b8));

  param_1[3] = (float)fVar2;

  fVar1 = (float)fVar3;

  *param_1 = local_18 * fVar1;

  param_1[1] = local_14 * fVar1;

  param_1[2] = local_10 * fVar1;

  return param_1;

}





// --- FUN_005e2513 at 0x005E2513 (size: 48) ---


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



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825250)(param_1,param_2,param_3,param_4);

  return;

}





// --- thunk_FUN_005e2513 at 0x005E2543 (size: 6) ---


void thunk_FUN_005e2513(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00825250)();

  return;

}





// --- FUN_005e2624 at 0x005E2624 (size: 19) ---


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



void FUN_005e2624(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825238)();

  return;

}





// --- thunk_FUN_005e2624 at 0x005E2637 (size: 6) ---


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



void thunk_FUN_005e2624(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825238)();

  return;

}





// --- FUN_005e26d5 at 0x005E26D5 (size: 19) ---


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



void FUN_005e26d5(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_0082523c)();

  return;

}





// --- FUN_005e27a0 at 0x005E27A0 (size: 19) ---


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



void FUN_005e27a0(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_0082529c)();

  return;

}





// --- thunk_FUN_005e27a0 at 0x005E27B3 (size: 6) ---


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



void thunk_FUN_005e27a0(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_0082529c)();

  return;

}





// --- FUN_005e286c at 0x005E286C (size: 19) ---


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



void FUN_005e286c(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252c8)();

  return;

}





// --- thunk_FUN_005e286c at 0x005E287F (size: 6) ---


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



void thunk_FUN_005e286c(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252c8)();

  return;

}





// --- FUN_005e2902 at 0x005E2902 (size: 19) ---


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



void FUN_005e2902(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252cc)();

  return;

}





// --- thunk_FUN_005e2902 at 0x005E2915 (size: 6) ---


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



void thunk_FUN_005e2902(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252cc)();

  return;

}





// --- FUN_005e29b5 at 0x005E29B5 (size: 38) ---


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



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825278)(param_1,param_2,param_3,param_4);

  return;

}





// --- thunk_FUN_005e29b5 at 0x005E29DB (size: 6) ---


void thunk_FUN_005e29b5(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00825278)();

  return;

}





// --- FUN_005e2ac6 at 0x005E2AC6 (size: 44) ---


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

                 undefined4 param_5,undefined4 param_6)



{

  FUN_005ff7f1(1);

  (*(code *)PTR_FUN_00825298)(param_1,param_2,param_3,param_4,param_5,param_6);

  return;

}





// --- FUN_005e2af2 at 0x005E2AF2 (size: 89) ---


undefined4

FUN_005e2af2(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

            undefined4 param_5,float param_6)



{

  undefined1 local_24 [16];

  undefined1 local_14 [16];

  

  thunk_FUN_005e29b5(local_24,param_2,param_5,param_6);

  thunk_FUN_005e29b5(local_14,param_3,param_4,param_6);

  param_6 = (1.0 - param_6) * param_6;

  thunk_FUN_005e29b5(param_1,local_24,local_14,param_6 + param_6);

  return param_1;

}





// --- FUN_005e2b4b at 0x005E2B4B (size: 19) ---


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



void FUN_005e2b4b(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252a0)();

  return;

}





// --- FUN_005e2b8f at 0x005E2B8F (size: 138) ---


undefined4 *

FUN_005e2b8f(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,

            float param_5,float param_6)



{

  int iVar1;

  undefined1 local_24 [16];

  undefined1 local_14 [16];

  

  param_5 = param_5 + param_6;

  iVar1 = FUN_005e02a0(param_5,0);

  if (iVar1 == 0) {

    thunk_FUN_005e29b5(local_24,param_2,param_3,param_5);

    thunk_FUN_005e29b5(local_14,param_2,param_4,param_5);

    thunk_FUN_005e29b5(param_1,local_24,local_14,param_6 / param_5);

  }

  else if (param_1 != param_2) {

    *param_1 = *param_2;

    param_1[1] = param_2[1];

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

  }

  return param_1;

}





// --- FUN_005e2c19 at 0x005E2C19 (size: 19) ---


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



void FUN_005e2c19(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825240)();

  return;

}





// --- thunk_FUN_005e2c19 at 0x005E2C2C (size: 6) ---


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



void thunk_FUN_005e2c19(void)



{

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825240)();

  return;

}





// --- FUN_005e2cd5 at 0x005E2CD5 (size: 19) ---


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



void FUN_005e2cd5(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825244)();

  return;

}





// --- FUN_005e2d9e at 0x005E2D9E (size: 19) ---


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



void FUN_005e2d9e(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_0082521c)();

  return;

}





// --- FUN_005e2dec at 0x005E2DEC (size: 19) ---


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



void FUN_005e2dec(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825220)();

  return;

}





// --- FUN_005e2ea3 at 0x005E2EA3 (size: 19) ---


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



void FUN_005e2ea3(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825274)();

  return;

}





// --- FUN_005e2f57 at 0x005E2F57 (size: 19) ---


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



void FUN_005e2f57(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_008252fc)();

  return;

}





// --- FUN_005e302b at 0x005E302B (size: 19) ---


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



void FUN_005e302b(void)



{

  FUN_005ff7f1(1);

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

                    /* WARNING: Treating indirect jump as call */

  (*_DAT_00825300)();

  return;

}





// --- FUN_005e30dd at 0x005E30DD (size: 109) ---


void FUN_005e30dd(float *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;

  float fVar15;

  

  fVar1 = param_3[1];

  fVar2 = *param_2;

  fVar3 = param_3[5];

  fVar4 = param_2[1];

  fVar5 = param_3[0xd];

  fVar6 = param_3[2];

  fVar7 = *param_2;

  fVar8 = param_3[6];

  fVar9 = param_2[1];

  fVar10 = param_3[0xe];

  fVar11 = param_3[3];

  fVar12 = *param_2;

  fVar13 = param_3[7];

  fVar14 = param_2[1];

  fVar15 = param_3[0xf];

  *param_1 = *param_2 * *param_3 + param_3[4] * param_2[1] + param_3[0xc];

  param_1[1] = fVar3 * fVar4 + fVar1 * fVar2 + fVar5;

  param_1[2] = fVar8 * fVar9 + fVar6 * fVar7 + fVar10;

  param_1[3] = fVar13 * fVar14 + fVar11 * fVar12 + fVar15;

  return;

}





// --- FUN_005e314a at 0x005E314A (size: 133) ---


float * FUN_005e314a(float *param_1,int param_2,float *param_3,int param_4,float *param_5,

                    int param_6)



{

  float *pfVar1;

  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;

  float fVar15;

  float fVar16;

  float fVar17;

  float *pfVar18;

  

  pfVar18 = param_1;

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

    pfVar1 = param_3 + 1;

    fVar2 = *param_3;

    fVar3 = param_5[1];

    fVar4 = *param_3;

    fVar5 = param_5[5];

    fVar6 = param_3[1];

    fVar7 = param_5[0xd];

    fVar8 = param_5[2];

    fVar9 = *param_3;

    fVar10 = param_5[6];

    fVar11 = param_3[1];

    fVar12 = param_5[0xe];

    fVar13 = *param_3;

    fVar14 = param_5[3];

    fVar15 = param_3[1];

    param_3 = (float *)((int)param_3 + param_4);

    fVar16 = param_5[7];

    fVar17 = param_5[0xf];

    *pfVar18 = fVar2 * *param_5 + param_5[4] * *pfVar1 + param_5[0xc];

    pfVar18[1] = fVar5 * fVar6 + fVar3 * fVar4 + fVar7;

    pfVar18[2] = fVar10 * fVar11 + fVar8 * fVar9 + fVar12;

    pfVar18[3] = fVar15 * fVar16 + fVar13 * fVar14 + fVar17;

    pfVar18 = (float *)((int)pfVar18 + param_2);

  }

  return param_1;

}





// --- FUN_005e31cf at 0x005E31CF (size: 127) ---


void FUN_005e31cf(float *param_1,float *param_2,float *param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  int iVar7;

  

  fVar1 = *param_2;

  fVar2 = param_3[1];

  fVar3 = param_2[1];

  fVar4 = param_3[5];

  fVar5 = param_3[0xd];

  fVar6 = param_3[0xf] + param_2[1] * param_3[7] + *param_2 * param_3[3];

  *param_1 = param_3[0xc] + param_2[1] * param_3[4] + *param_2 * *param_3;

  param_1[1] = fVar5 + fVar3 * fVar4 + fVar1 * fVar2;

  iVar7 = FUN_005e02a0(fVar6,0x3f800000);

  if (iVar7 == 0) {

    fVar6 = 1.0 / fVar6;

    *param_1 = fVar6 * *param_1;

    param_1[1] = fVar6 * param_1[1];

  }

  return;

}





// --- FUN_005e324e at 0x005E324E (size: 154) ---


float * FUN_005e324e(float *param_1,int param_2,float *param_3,int param_4,float *param_5,

                    int param_6)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float *extraout_ECX;

  float *pfVar7;

  undefined8 uVar8;

  

  pfVar7 = param_1;

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

    fVar1 = param_5[1];

    fVar2 = *param_3;

    fVar3 = param_5[5];

    fVar4 = param_3[1];

    fVar5 = param_5[0xd];

    fVar6 = param_5[7] * param_3[1] + param_5[3] * *param_3 + param_5[0xf];

    *pfVar7 = *param_3 * *param_5 + param_5[4] * param_3[1] + param_5[0xc];

    pfVar7[1] = fVar3 * fVar4 + fVar1 * fVar2 + fVar5;

    uVar8 = FUN_005e02a0(fVar6,0x3f800000);

    if ((int)uVar8 == 0) {

      fVar6 = 1.0 / fVar6;

      *pfVar7 = fVar6 * *pfVar7;

      pfVar7[1] = fVar6 * pfVar7[1];

    }

    param_3 = (float *)((int)((ulonglong)uVar8 >> 0x20) + param_4);

    pfVar7 = (float *)((int)pfVar7 + param_2);

    param_5 = extraout_ECX;

  }

  return param_1;

}





// --- FUN_005e32e8 at 0x005E32E8 (size: 62) ---


void FUN_005e32e8(float *param_1,float *param_2,float *param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  

  fVar1 = param_3[1];

  fVar2 = *param_2;

  fVar3 = param_3[5];

  fVar4 = param_2[1];

  *param_1 = *param_2 * *param_3 + param_3[4] * param_2[1];

  param_1[1] = fVar3 * fVar4 + fVar1 * fVar2;

  return;

}





// --- FUN_005e3326 at 0x005E3326 (size: 86) ---


float * FUN_005e3326(float *param_1,int param_2,float *param_3,int param_4,float *param_5,

                    int param_6)



{

  float *pfVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float *pfVar7;

  

  pfVar7 = param_1;

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

    pfVar1 = param_3 + 1;

    fVar2 = *param_3;

    fVar3 = param_5[1];

    fVar4 = *param_3;

    fVar5 = param_5[5];

    fVar6 = param_3[1];

    param_3 = (float *)((int)param_3 + param_4);

    *param_1 = fVar2 * *param_5 + param_5[4] * *pfVar1;

    param_1[1] = fVar5 * fVar6 + fVar3 * fVar4;

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

  }

  return pfVar7;

}





// --- FUN_005e337c at 0x005E337C (size: 159) ---


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



void FUN_005e337c(float *param_1,float *param_2)



{

  float *pfVar1;

  float fVar2;

  int iVar3;

  float local_10;

  float local_c;

  float local_8;

  

  fVar2 = param_2[2] * param_2[2] + param_2[1] * param_2[1] + *param_2 * *param_2;

  iVar3 = FUN_005e02a0(fVar2,0x3f800000);

  if (iVar3 == 0) {

    if (fVar2 <= _DAT_007ed300) {

      *param_1 = 0.0;

      param_1[1] = 0.0;

      param_1[2] = 0.0;

      return;

    }

    fVar2 = _DAT_007938b0 / SQRT(fVar2);

    local_10 = fVar2 * *param_2;

    local_c = fVar2 * param_2[1];

    pfVar1 = param_2 + 2;

    param_2 = &local_10;

    local_8 = fVar2 * *pfVar1;

  }

  else if (param_1 == param_2) {

    return;

  }

  *param_1 = *param_2;

  param_1[1] = param_2[1];

  param_1[2] = param_2[2];

  return;

}





// --- FUN_005e341b at 0x005E341B (size: 141) ---


void FUN_005e341b(float *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;

  float fVar15;

  float fVar16;

  float fVar17;

  float fVar18;

  float fVar19;

  float fVar20;

  float fVar21;

  

  fVar1 = param_3[9];

  fVar2 = param_2[2];

  fVar3 = param_3[5];

  fVar4 = param_2[1];

  fVar5 = param_3[1];

  fVar6 = *param_2;

  fVar7 = param_3[0xd];

  fVar8 = param_3[10];

  fVar9 = param_2[2];

  fVar10 = param_3[6];

  fVar11 = param_2[1];

  fVar12 = param_3[2];

  fVar13 = *param_2;

  fVar14 = param_3[0xe];

  fVar15 = param_3[0xb];

  fVar16 = param_2[2];

  fVar17 = param_3[7];

  fVar18 = param_2[1];

  fVar19 = param_3[3];

  fVar20 = *param_2;

  fVar21 = param_3[0xf];

  *param_1 = *param_2 * *param_3 + param_3[4] * param_2[1] + param_3[8] * param_2[2] + param_3[0xc];

  param_1[1] = fVar5 * fVar6 + fVar3 * fVar4 + fVar1 * fVar2 + fVar7;

  param_1[2] = fVar12 * fVar13 + fVar10 * fVar11 + fVar8 * fVar9 + fVar14;

  param_1[3] = fVar19 * fVar20 + fVar17 * fVar18 + fVar15 * fVar16 + fVar21;

  return;

}





// --- FUN_005e34a8 at 0x005E34A8 (size: 169) ---


float * FUN_005e34a8(float *param_1,int param_2,float *param_3,int param_4,float *param_5,

                    int param_6)



{

  float *pfVar1;

  float *pfVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float fVar7;

  float fVar8;

  float fVar9;

  float fVar10;

  float fVar11;

  float fVar12;

  float fVar13;

  float fVar14;

  float fVar15;

  float fVar16;

  float fVar17;

  float fVar18;

  float fVar19;

  float fVar20;

  float fVar21;

  float fVar22;

  float fVar23;

  float fVar24;

  float *pfVar25;

  

  pfVar25 = param_1;

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

    pfVar1 = param_3 + 1;

    pfVar2 = param_3 + 2;

    fVar3 = *param_3;

    fVar4 = param_5[1];

    fVar5 = *param_3;

    fVar6 = param_5[5];

    fVar7 = param_3[1];

    fVar8 = param_5[9];

    fVar9 = param_3[2];

    fVar10 = param_5[0xd];

    fVar11 = param_3[2];

    fVar12 = param_5[10];

    fVar13 = *param_3;

    fVar14 = param_5[2];

    fVar15 = param_3[1];

    fVar16 = param_5[6];

    fVar17 = param_5[0xe];

    fVar18 = param_5[3];

    fVar19 = *param_3;

    fVar20 = param_5[7];

    fVar21 = param_3[1];

    fVar22 = param_5[0xb];

    fVar23 = param_3[2];

    param_3 = (float *)((int)param_3 + param_4);

    fVar24 = param_5[0xf];

    *pfVar25 = fVar3 * *param_5 + param_5[8] * *pfVar2 + param_5[4] * *pfVar1 + param_5[0xc];

    pfVar25[1] = fVar8 * fVar9 + fVar6 * fVar7 + fVar4 * fVar5 + fVar10;

    pfVar25[2] = fVar15 * fVar16 + fVar13 * fVar14 + fVar11 * fVar12 + fVar17;

    pfVar25[3] = fVar22 * fVar23 + fVar20 * fVar21 + fVar18 * fVar19 + fVar24;

    pfVar25 = (float *)((int)pfVar25 + param_2);

  }

  return param_1;

}





// --- FUN_005e3551 at 0x005E3551 (size: 190) ---


void FUN_005e3551(float *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;

  float fVar15;

  int iVar16;

  

  fVar1 = *param_2;

  fVar2 = param_3[2];

  fVar3 = *param_2;

  fVar4 = param_3[1];

  fVar5 = param_2[1];

  fVar6 = param_3[6];

  fVar7 = param_2[1];

  fVar8 = param_3[5];

  fVar9 = param_2[2];

  fVar10 = param_3[10];

  fVar11 = param_2[2];

  fVar12 = param_3[9];

  fVar13 = param_3[0xd];

  fVar14 = param_3[0xe];

  fVar15 = param_3[0xf] +

           param_2[2] * param_3[0xb] + param_2[1] * param_3[7] + *param_2 * param_3[3];

  *param_1 = param_3[0xc] + param_2[2] * param_3[8] + param_2[1] * param_3[4] + *param_2 * *param_3;

  param_1[1] = fVar13 + fVar11 * fVar12 + fVar7 * fVar8 + fVar3 * fVar4;

  param_1[2] = fVar14 + fVar9 * fVar10 + fVar5 * fVar6 + fVar1 * fVar2;

  iVar16 = FUN_005e02a0(fVar15,0x3f800000);

  if (iVar16 == 0) {

    fVar15 = 1.0 / fVar15;

    *param_1 = fVar15 * *param_1;

    param_1[1] = fVar15 * param_1[1];

    param_1[2] = fVar15 * param_1[2];

  }

  return;

}





// --- FUN_005e360f at 0x005E360F (size: 225) ---


float * FUN_005e360f(float *param_1,int param_2,float *param_3,int param_4,float *param_5,

                    int param_6)



{

  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;

  float fVar15;

  float *extraout_ECX;

  float *pfVar16;

  undefined8 uVar17;

  

  pfVar16 = param_1;

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

    fVar1 = param_5[1];

    fVar2 = *param_3;

    fVar3 = param_5[5];

    fVar4 = param_3[1];

    fVar5 = param_5[9];

    fVar6 = param_3[2];

    fVar7 = param_5[0xd];

    fVar8 = param_3[2];

    fVar9 = param_5[10];

    fVar10 = *param_3;

    fVar11 = param_5[2];

    fVar12 = param_3[1];

    fVar13 = param_5[6];

    fVar14 = param_5[0xe];

    fVar15 = param_5[0xb] * param_3[2] + param_5[7] * param_3[1] + param_5[3] * *param_3 +

             param_5[0xf];

    *pfVar16 = *param_3 * *param_5 + param_5[8] * param_3[2] + param_5[4] * param_3[1] +

               param_5[0xc];

    pfVar16[1] = fVar5 * fVar6 + fVar3 * fVar4 + fVar1 * fVar2 + fVar7;

    pfVar16[2] = fVar12 * fVar13 + fVar10 * fVar11 + fVar8 * fVar9 + fVar14;

    uVar17 = FUN_005e02a0(fVar15,0x3f800000);

    if ((int)uVar17 == 0) {

      fVar15 = 1.0 / fVar15;

      *pfVar16 = fVar15 * *pfVar16;

      pfVar16[1] = fVar15 * pfVar16[1];

      pfVar16[2] = fVar15 * pfVar16[2];

    }

    param_3 = (float *)((int)((ulonglong)uVar17 >> 0x20) + param_4);

    pfVar16 = (float *)((int)pfVar16 + param_2);

    param_5 = extraout_ECX;

  }

  return param_1;

}





// --- FUN_005e3e1f at 0x005E3E1F (size: 912) ---


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



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



{

  float **ppfVar1;

  float *pfVar2;

  float *pfVar3;

  float *pfVar4;

  float fVar5;

  float fVar6;

  float fVar7;

  int iVar8;

  undefined4 uVar9;

  float10 fVar10;

  float local_88 [10];

  float *local_60;

  float local_5c;

  float local_58;

  float local_54;

  undefined4 local_50;

  float local_4c;

  float local_48;

  float local_44;

  undefined4 local_40;

  float local_3c;

  float local_38;

  float local_34;

  undefined4 local_30;

  undefined4 local_2c;

  undefined4 local_28;

  undefined4 local_24;

  undefined4 local_20;

  float local_1c;

  float local_18;

  float local_14;

  float *local_10 [3];

  

  local_88[0] = 1.0;

  local_88[1] = 0.0;

  local_88[2] = 0.0;

  local_88[3] = 0.0;

  local_88[4] = 1.0;

  local_88[5] = 0.0;

  local_88[6] = 0.0;

  *param_3 = param_4[0xc];

  local_24 = 0;

  local_88[7] = 0.0;

  local_28 = 0;

  local_88[8] = 1.0;

  local_2c = 0;

  param_3[1] = param_4[0xd];

  local_30 = 0;

  param_3[2] = param_4[0xe];

  local_40 = 0;

  local_10[0] = &local_5c;

  local_50 = 0;

  local_10[1] = &local_4c;

  local_20 = 0x3f800000;

  local_5c = *param_4;

  local_58 = param_4[1];

  local_54 = param_4[2];

  local_4c = param_4[4];

  local_48 = param_4[5];

  local_44 = param_4[6];

  local_3c = param_4[8];

  local_38 = param_4[9];

  local_34 = param_4[10];

  local_10[2] = &local_3c;

  fVar5 = SQRT(local_5c * local_5c + local_58 * local_58 + local_54 * local_54);

  *param_1 = fVar5;

  fVar6 = SQRT(local_4c * local_4c + local_48 * local_48 + local_44 * local_44);

  param_1[1] = fVar6;

  fVar7 = SQRT(local_3c * local_3c + local_38 * local_38 + local_34 * local_34);

  param_1[2] = fVar7;

  if (fVar6 <= fVar5) {

    if (fVar7 <= fVar5) {

      iVar8 = 0;

      if (fVar7 <= fVar6) {

        param_3 = (float *)0x2;

        goto LAB_005e3fbd;

      }

      param_4 = (float *)0x2;

    }

    else {

      param_4 = (float *)0x0;

      iVar8 = 2;

    }

    param_3 = (float *)0x1;

  }

  else if (fVar7 <= fVar6) {

    iVar8 = 1;

    if (fVar7 <= fVar5) {

      param_4 = (float *)0x0;

      param_3 = (float *)0x2;

    }

    else {

      param_3 = (float *)0x0;

      param_4 = (float *)0x2;

    }

  }

  else {

    param_3 = (float *)0x0;

    iVar8 = 2;

LAB_005e3fbd:

    param_4 = (float *)0x1;

  }

  local_60 = param_1 + iVar8;

  if (*local_60 < _DAT_007ed308) {

    pfVar2 = local_10[iVar8];

    *pfVar2 = local_88[iVar8 * 3];

    pfVar2[1] = local_88[iVar8 * 3 + 1];

    pfVar2[2] = local_88[iVar8 * 3 + 2];

  }

  ppfVar1 = local_10 + iVar8;

  thunk_FUN_005e06f5(*ppfVar1,*ppfVar1);

  if (_DAT_007ed308 <= param_1[(int)param_4]) goto LAB_005e40bb;

  pfVar2 = *ppfVar1;

  fVar5 = ABS(*pfVar2);

  local_88[9] = ABS(pfVar2[1]);

  fVar6 = ABS(pfVar2[2]);

  if (local_88[9] <= fVar5) {

    if ((fVar6 <= fVar5) && (fVar6 <= local_88[9])) goto LAB_005e4075;

    iVar8 = 1;

  }

  else if ((local_88[9] < fVar6) || (fVar5 < fVar6)) {

    iVar8 = 0;

  }

  else {

LAB_005e4075:

    iVar8 = 2;

  }

  pfVar3 = local_10[(int)param_4];

  local_1c = local_88[iVar8 * 3 + 2] * pfVar2[1] - local_88[iVar8 * 3 + 1] * pfVar2[2];

  local_18 = pfVar2[2] * local_88[iVar8 * 3] - local_88[iVar8 * 3 + 2] * *pfVar2;

  local_14 = local_88[iVar8 * 3 + 1] * *pfVar2 - pfVar2[1] * local_88[iVar8 * 3];

  *pfVar3 = local_1c;

  pfVar3[1] = local_18;

  pfVar3[2] = local_14;

LAB_005e40bb:

  pfVar2 = local_10[(int)param_4];

  thunk_FUN_005e06f5(pfVar2,pfVar2);

  if (param_1[(int)param_3] < _DAT_007ed308) {

    pfVar2 = local_10[(int)param_4];

    pfVar3 = *ppfVar1;

    pfVar4 = local_10[(int)param_3];

    local_1c = pfVar2[2] * pfVar3[1] - pfVar2[1] * pfVar3[2];

    local_18 = *pfVar2 * pfVar3[2] - pfVar2[2] * *pfVar3;

    local_14 = *pfVar3 * pfVar2[1] - pfVar3[1] * *pfVar2;

    *pfVar4 = local_1c;

    pfVar4[1] = local_18;

    pfVar4[2] = local_14;

  }

  thunk_FUN_005e06f5(local_10[(int)param_3],local_10[(int)param_3]);

  fVar10 = (float10)thunk_FUN_005e10a1(&local_5c);

  if (fVar10 < (float10)DAT_00796344) {

    pfVar2 = *ppfVar1;

    *local_60 = -*local_60;

    local_1c = -*pfVar2;

    local_18 = -pfVar2[1];

    local_14 = -pfVar2[2];

    *pfVar2 = local_1c;

    pfVar2[1] = local_18;

    fVar10 = -fVar10;

    pfVar2[2] = local_14;

  }

  if ((fVar10 - (float10)_DAT_007938b0) * (fVar10 - (float10)_DAT_007938b0) <=

      (float10)_DAT_007ed308) {

    thunk_FUN_005e2343(param_2,&local_5c);

    uVar9 = 0;

    *(float *)(param_2 + 0xc) = -*(float *)(param_2 + 0xc);

  }

  else {

    uVar9 = 0x8876086c;

  }

  return uVar9;

}





// --- FUN_005e41af at 0x005E41AF (size: 59) ---


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



{

  undefined1 local_14 [16];

  

  thunk_FUN_005e2513(local_14,param_2,param_3,param_4);

  thunk_FUN_005e1e9c(param_1,local_14);

  return param_1;

}





// --- FUN_005e47ef at 0x005E47EF (size: 254) ---


void FUN_005e47ef(float *param_1,float *param_2,undefined4 param_3)



{

  float fVar1;

  float local_14;

  float local_10;

  float local_c;

  float local_8;

  

  thunk_FUN_005e2c19(&local_14,param_3);

  fVar1 = local_c * param_2[2] + local_8 * param_2[3] + local_14 * *param_2 + local_10 * param_2[1];

  local_14 = -local_14;

  local_10 = -local_10;

  local_c = -local_c;

  local_8 = -local_8;

  *param_1 = local_14 * *param_2 + fVar1;

  param_1[4] = local_10 * *param_2;

  param_1[8] = local_c * *param_2;

  param_1[0xc] = local_8 * *param_2;

  param_1[1] = local_14 * param_2[1];

  param_1[5] = local_10 * param_2[1] + fVar1;

  param_1[9] = local_c * param_2[1];

  param_1[0xd] = local_8 * param_2[1];

  param_1[2] = local_14 * param_2[2];

  param_1[6] = local_10 * param_2[2];

  param_1[10] = local_c * param_2[2] + fVar1;

  param_1[0xe] = local_8 * param_2[2];

  param_1[3] = local_14 * param_2[3];

  param_1[7] = local_10 * param_2[3];

  param_1[0xb] = local_c * param_2[3];

  param_1[0xf] = local_8 * param_2[3] + fVar1;

  return;

}





// --- FUN_005e48ed at 0x005E48ED (size: 193) ---


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



void FUN_005e48ed(float *param_1,undefined4 param_2)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float local_14;

  float local_10;

  float local_c;

  float local_8;

  

  thunk_FUN_005e2c19(&local_14,param_2);

  fVar4 = _DAT_007938b0;

  fVar1 = local_14 * _DAT_007e689c;

  fVar3 = local_10 * _DAT_007e689c;

  fVar2 = local_c * _DAT_007e689c;

  *param_1 = local_14 * fVar1 + _DAT_007938b0;

  param_1[1] = fVar3 * local_14;

  param_1[2] = fVar2 * local_14;

  param_1[3] = 0.0;

  param_1[4] = local_10 * fVar1;

  param_1[5] = local_10 * fVar3 + fVar4;

  param_1[6] = fVar2 * local_10;

  param_1[7] = 0.0;

  param_1[8] = local_c * fVar1;

  param_1[9] = local_c * fVar3;

  param_1[10] = local_c * fVar2 + fVar4;

  param_1[0xb] = 0.0;

  param_1[0xc] = local_8 * fVar1;

  param_1[0xd] = local_8 * fVar3;

  param_1[0xe] = local_8 * fVar2;

  param_1[0xf] = 1.0;

  return;

}





// --- FUN_005e49ae at 0x005E49AE (size: 1025) ---


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



void FUN_005e49ae(float *param_1,float *param_2,float *param_3,float *param_4,float *param_5,

                 float *param_6,float *param_7)



{

  undefined1 local_a4 [16];

  float local_94;

  float local_90;

  float local_8c;

  float local_88;

  float local_84;

  float local_80;

  float local_7c;

  float local_78;

  float local_74;

  float local_70;

  float local_6c;

  float local_68;

  float local_64;

  float local_60;

  float local_5c;

  float local_58;

  float local_54;

  float local_50;

  float local_4c;

  float local_48;

  float local_44;

  float local_40;

  float local_3c;

  float fStack_38;

  float local_34;

  float local_30;

  float local_2c;

  float local_28;

  float local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_c;

  float local_8;

  

  local_84 = *param_4;

  local_80 = param_4[1];

  local_7c = param_4[2];

  local_78 = param_4[3];

  local_54 = *param_5;

  local_50 = param_5[1];

  local_4c = param_5[2];

  local_48 = param_5[3];

  local_24 = *param_6;

  local_20 = param_6[1];

  local_1c = param_6[2];

  local_18 = param_6[3];

  local_74 = *param_7;

  local_70 = param_7[1];

  local_6c = param_7[2];

  local_68 = param_7[3];

  if ((local_54 + local_84) * (local_54 + local_84) +

      (local_50 + local_80) * (local_50 + local_80) +

      (local_4c + local_7c) * (local_4c + local_7c) + (local_48 + local_78) * (local_48 + local_78)

      < (local_84 - local_54) * (local_84 - local_54) +

        (local_80 - local_50) * (local_80 - local_50) +

        (local_7c - local_4c) * (local_7c - local_4c) +

        (local_78 - local_48) * (local_78 - local_48)) {

    local_84 = -local_84;

    local_80 = -local_80;

    local_7c = -local_7c;

    local_78 = -local_78;

    local_34 = local_84;

    local_30 = local_80;

    local_2c = local_7c;

    local_28 = local_78;

  }

  if ((local_24 + local_54) * (local_24 + local_54) +

      (local_20 + local_50) * (local_20 + local_50) +

      (local_1c + local_4c) * (local_1c + local_4c) + (local_18 + local_48) * (local_18 + local_48)

      < (local_54 - local_24) * (local_54 - local_24) +

        (local_50 - local_20) * (local_50 - local_20) +

        (local_4c - local_1c) * (local_4c - local_1c) +

        (local_48 - local_18) * (local_48 - local_18)) {

    local_34 = -local_24;

    local_30 = -local_20;

    local_2c = -local_1c;

    local_28 = -local_18;

    local_24 = local_34;

    local_20 = local_30;

    local_1c = local_2c;

    local_18 = local_28;

  }

  local_10 = local_20 - local_70;

  local_c = local_1c - local_6c;

  local_8 = local_18 - local_68;

  if ((local_74 + local_24) * (local_74 + local_24) +

      (local_70 + local_20) * (local_70 + local_20) +

      (local_6c + local_1c) * (local_6c + local_1c) + (local_68 + local_18) * (local_68 + local_18)

      < (local_24 - local_74) * (local_24 - local_74) +

        local_10 * local_10 + local_c * local_c + local_8 * local_8) {

    local_74 = -local_74;

    local_70 = -local_70;

    local_6c = -local_6c;

    local_68 = -local_68;

    local_34 = local_74;

    local_30 = local_70;

    local_2c = local_6c;

    local_28 = local_68;

  }

  thunk_FUN_005e27a0(&local_34,&local_54);

  thunk_FUN_005e2624(&local_44,&local_34,&local_84);

  local_64 = local_44;

  local_60 = local_40;

  local_5c = local_3c;

  local_58 = fStack_38;

  thunk_FUN_005e286c(&local_94,&local_64);

  thunk_FUN_005e2624(&local_44,&local_34,&local_24);

  local_64 = local_44;

  local_60 = local_40;

  local_5c = local_3c;

  local_58 = fStack_38;

  thunk_FUN_005e286c(&local_14,&local_64);

  local_40 = local_90 + local_10;

  local_3c = local_8c + local_c;

  local_64 = (local_94 + local_14) * _DAT_007ed30c;

  local_60 = local_40 * _DAT_007ed30c;

  local_5c = local_3c * _DAT_007ed30c;

  local_58 = (local_88 + local_8) * _DAT_007ed30c;

  thunk_FUN_005e2902(local_a4,&local_64);

  thunk_FUN_005e2624(&local_44,&local_54,local_a4);

  *param_1 = local_44;

  param_1[1] = local_40;

  param_1[2] = local_3c;

  param_1[3] = fStack_38;

  thunk_FUN_005e27a0(&local_34,&local_24);

  thunk_FUN_005e2624(&local_44,&local_34,&local_54);

  local_64 = local_44;

  local_60 = local_40;

  local_5c = local_3c;

  local_58 = fStack_38;

  thunk_FUN_005e286c(&local_94,&local_64);

  thunk_FUN_005e2624(&local_44,&local_34,&local_74);

  local_64 = local_44;

  local_60 = local_40;

  local_5c = local_3c;

  local_58 = fStack_38;

  thunk_FUN_005e286c(&local_14,&local_64);

  local_40 = local_90 + local_10;

  local_3c = local_8c + local_c;

  local_64 = (local_94 + local_14) * _DAT_007ed30c;

  local_60 = local_40 * _DAT_007ed30c;

  local_5c = local_3c * _DAT_007ed30c;

  local_58 = (local_88 + local_8) * _DAT_007ed30c;

  thunk_FUN_005e2902(local_a4,&local_64);

  thunk_FUN_005e2624(&local_44,&local_24,local_a4);

  *param_2 = local_44;

  param_2[1] = local_40;

  param_2[2] = local_3c;

  param_2[3] = fStack_38;

  *param_3 = local_24;

  param_3[1] = local_20;

  param_3[2] = local_1c;

  param_3[3] = local_18;

  return;

}





// --- FUN_005e4daf at 0x005E4DAF (size: 57) ---


void FUN_005e4daf(int param_1,int param_2,int param_3)



{

  undefined4 uVar1;

  undefined4 *puVar2;

  int iVar3;

  int iVar4;

  

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

  iVar3 = (param_3 + param_2 * 0xc) - (int)puVar2;

  iVar4 = 3;

  do {

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

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

    *puVar2 = uVar1;

    puVar2 = puVar2 + 1;

    iVar4 = iVar4 + -1;

  } while (iVar4 != 0);

  return;

}





// --- FUN_005e4de8 at 0x005E4DE8 (size: 54) ---


void FUN_005e4de8(int param_1,int param_2,int param_3)



{

  int iVar1;

  uint uVar2;

  

  param_3 = param_3 + param_1 * 0xc;

  uVar2 = 0;

  do {

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

    if (iVar1 == -1) {

      *(undefined4 *)(param_3 + uVar2 * 4) = 0xffffffff;

    }

    else {

      *(undefined4 *)(param_3 + uVar2 * 4) = *(undefined4 *)(param_2 + iVar1 * 4);

    }

    uVar2 = uVar2 + 1;

  } while (uVar2 < 3);

  return;

}





// --- FUN_005e4e1e at 0x005E4E1E (size: 162) ---


undefined4 FUN_005e4e1e(int param_1,undefined4 param_2,uint param_3)



{

  undefined4 *puVar1;

  uint uVar2;

  uint uVar3;

  undefined4 *puVar4;

  undefined4 local_8;

  

  local_8 = 0;

  puVar1 = (undefined4 *)FUN_005df0f5(param_3);

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

    local_8 = 0x8007000e;

  }

  else {

    puVar4 = puVar1;

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

      *puVar4 = 0;

      puVar4 = puVar4 + 1;

    }

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

      *(undefined1 *)puVar4 = 0;

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

    }

    uVar2 = 0;

    if (param_3 != 0) {

      do {

        if ((*(char *)(uVar2 + (int)puVar1) == '\0') &&

           (uVar3 = *(uint *)(param_1 + uVar2 * 4), uVar3 != 0xffffffff)) {

          while (uVar3 != uVar2) {

            FUN_005e4daf(uVar2,uVar3,param_2);

            FUN_005e4de8(uVar3,param_1,param_2);

            *(undefined1 *)(uVar3 + (int)puVar1) = 1;

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

            if ((uVar3 == 0xffffffff) || (*(char *)(uVar3 + (int)puVar1) != '\0'))

            goto LAB_005e4ea9;

          }

          FUN_005e4de8(uVar2,param_1,param_2);

        }

LAB_005e4ea9:

        uVar2 = uVar2 + 1;

      } while (uVar2 < param_3);

    }

  }

  operator_delete(puVar1);

  return local_8;

}





// --- FUN_005e4ec0 at 0x005E4EC0 (size: 75) ---


void FUN_005e4ec0(uint param_1,uint param_2,uint param_3,uint param_4,int param_5,int param_6,

                 uint param_7,int *param_8)



{

  uint *puVar1;

  uint *puVar2;

  int iVar3;

  

  iVar3 = *param_8;

  *param_8 = iVar3 + 1;

  puVar1 = (uint *)(param_6 + iVar3 * 0x14);

  puVar1[3] = param_4;

  puVar1[1] = param_2;

  puVar1[2] = param_3;

  *puVar1 = param_1;

  puVar2 = (uint *)(param_5 + (param_1 % param_7) * 4);

  puVar1[4] = *puVar2;

  *puVar2 = (uint)puVar1;

  return;

}





// --- FUN_005e4f0b at 0x005E4F0B (size: 82) ---


void FUN_005e4f0b(uint param_1,uint param_2,uint param_3,int param_4,uint param_5)



{

  uint *puVar1;

  uint *puVar2;

  uint *puVar3;

  uint *puVar4;

  

  puVar1 = (uint *)(param_4 + (param_1 % param_5) * 4);

  puVar4 = (uint *)*puVar1;

  puVar3 = (uint *)0x0;

  while( true ) {

    puVar2 = puVar4;

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

      return;

    }

    if (((puVar2[3] == param_3) && (puVar2[1] == param_2)) && (*puVar2 == param_1)) break;

    puVar4 = (uint *)puVar2[4];

    puVar3 = puVar2;

  }

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

    puVar3[4] = puVar2[4];

    return;

  }

  *puVar1 = puVar2[4];

  return;

}





// --- FUN_005e4f5d at 0x005E4F5D (size: 60) ---


void FUN_005e4f5d(undefined2 *param_1,undefined1 param_2,int param_3,byte *param_4,

                 undefined1 param_5)



{

  byte bVar1;

  

  *param_1 = 0;

  bVar1 = *param_4;

  *(undefined1 *)(param_1 + 3) = param_2;

  param_1[1] = (ushort)bVar1;

  *(undefined1 *)((int)param_1 + 7) = param_5;

  *(char *)(param_1 + 2) = (char)param_3;

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

  *(uint *)param_4 = *(int *)param_4 + (uint)(byte)(&DAT_007ed398)[param_3];

  return;

}





// --- FUN_005e4f99 at 0x005E4F99 (size: 80) ---


void FUN_005e4f99(ushort *param_1,uint param_2)



{

  ushort uVar1;

  uint uVar2;

  

  uVar2 = 0;

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

    uVar1 = *param_1;

    while (uVar1 != 0xff) {

      if (((uVar1 == param_2) && (*(char *)((int)param_1 + 5) != '\x04')) &&

         (uVar2 < (uint)(byte)(&DAT_007ed398)[(byte)param_1[2]] + (uint)param_1[1])) {

        uVar2 = (uint)(byte)(&DAT_007ed398)[(byte)param_1[2]] + (uint)param_1[1];

      }

      param_1 = param_1 + 4;

      uVar1 = *param_1;

    }

  }

  return;

}





// --- FUN_005e4fe9 at 0x005E4FE9 (size: 524) ---


undefined4 FUN_005e4fe9(short *param_1,uint *param_2)



{

  byte bVar1;

  short sVar2;

  short *psVar3;

  undefined4 uVar4;

  byte *pbVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  uint uVar9;

  int iStack_14;

  

  sVar2 = *param_1;

  uVar9 = 0;

  uVar8 = 0;

  if (sVar2 != 0xff) {

    pbVar5 = (byte *)(param_1 + 3);

    do {

      if ((((((sVar2 != 0) || (7 < pbVar5[-2])) || (uVar8 != *(ushort *)(pbVar5 + -4))) ||

           (5 < pbVar5[-1])) || (((bVar1 = *pbVar5, 5 < bVar1 && (bVar1 != 9)) && (bVar1 != 10))))

         || ((bVar1 == 10 && (1 < pbVar5[1])))) goto LAB_005e51db;

      uVar8 = uVar8 + (byte)(&DAT_007ed398)[pbVar5[-2]];

      sVar2 = *(short *)(pbVar5 + 2);

      pbVar5 = pbVar5 + 8;

    } while (sVar2 != 0xff);

  }

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

    if ((char)param_1[2] == '\x02') {

      iVar6 = 0;

      psVar3 = param_1 + 4;

      if (((char)param_1[7] == '\x01') && (*(byte *)(param_1 + 6) < 4)) {

        iVar6 = *(byte *)(param_1 + 6) + 1;

        psVar3 = param_1 + 8;

      }

      param_1 = psVar3;

      if ((char)param_1[3] == '\x02') {

        if ((char)param_1[2] == '\x05') {

          iVar6 = iVar6 + 1;

          uVar9 = 0x1000;

          param_1 = param_1 + 4;

        }

        if (((char)param_1[3] == '\x02') && ((char)param_1[2] == '\x04')) {

          uVar9 = uVar9 | 0x8000;

          iVar6 = iVar6 + 1;

          param_1 = param_1 + 4;

        }

      }

      if (iVar6 == 0) {

        uVar9 = uVar9 | 2;

      }

      else if (iVar6 == 1) {

        uVar9 = uVar9 | 6;

      }

      else if (iVar6 == 2) {

        uVar9 = uVar9 | 8;

      }

      else if (iVar6 == 3) {

        uVar9 = uVar9 | 10;

      }

      else if (iVar6 == 4) {

        uVar9 = uVar9 | 0xc;

      }

      else if (iVar6 == 5) {

        uVar9 = uVar9 | 0xe;

      }

    }

  }

  else if (((char)param_1[3] == '\t') && ((char)param_1[2] == '\x03')) {

    param_1 = param_1 + 4;

    uVar9 = 4;

  }

  uVar8 = 0x10;

  if (((char)param_1[3] == '\x03') && ((char)param_1[2] == '\x02')) {

    uVar9 = uVar9 | 0x10;

    param_1 = param_1 + 4;

  }

  if (((char)param_1[3] == '\x04') && ((char)param_1[2] == '\0')) {

    uVar9 = uVar9 | 0x20;

    param_1 = param_1 + 4;

  }

  if ((char)param_1[3] == '\n') {

    if ((*(char *)((int)param_1 + 7) == '\0') && ((char)param_1[2] == '\x04')) {

      uVar9 = uVar9 | 0x40;

      param_1 = param_1 + 4;

    }

    if ((((char)param_1[3] == '\n') && (*(char *)((int)param_1 + 7) == '\x01')) &&

       ((char)param_1[2] == '\x04')) {

      uVar9 = uVar9 | 0x80;

      param_1 = param_1 + 4;

    }

  }

  uVar7 = 0;

LAB_005e5168:

  if ((char)param_1[3] != '\x05') goto LAB_005e51d4;

  if (((char)param_1[2] == '\0') && (*(byte *)((int)param_1 + 7) == uVar7)) {

    iStack_14 = 3;

  }

  else {

    if (((char)param_1[2] == '\x01') && (*(byte *)((int)param_1 + 7) == uVar7)) goto LAB_005e51c9;

    if (((char)param_1[2] == '\x02') && (*(byte *)((int)param_1 + 7) == uVar7)) {

      iStack_14 = 1;

      goto LAB_005e51c3;

    }

    if (((char)param_1[2] != '\x03') || (*(byte *)((int)param_1 + 7) != uVar7)) goto LAB_005e51d4;

    iStack_14 = 2;

  }

LAB_005e51c3:

  uVar9 = uVar9 | iStack_14 << ((byte)uVar8 & 0x1f);

LAB_005e51c9:

  param_1 = param_1 + 4;

  uVar7 = uVar7 + 1;

  uVar8 = uVar8 + 2;

  if (0x1f < uVar8) {

LAB_005e51d4:

    if (*param_1 == 0xff) {

      *param_2 = uVar7 << 8 | uVar9;

      uVar4 = 0;

    }

    else {

LAB_005e51db:

      uVar4 = 0x8876086c;

    }

    return uVar4;

  }

  goto LAB_005e5168;

}





// --- FUN_005e51f5 at 0x005E51F5 (size: 17) ---


int FUN_005e51f5(int *param_1,int *param_2)



{

  return *param_1 - *param_2;

}





// --- FUN_005e5206 at 0x005E5206 (size: 208) ---


void __thiscall FUN_005e5206(uint *param_1,uint param_2)



{

  uint uVar1;

  uint *puVar2;

  uint uStack_14;

  

  uVar1 = param_2 & 0x400e;

  uStack_14 = 0;

  puVar2 = param_1 + 6;

  *param_1 = param_2;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  *puVar2 = 0;

  if (uVar1 == 2) {

    uStack_14 = 0xc;

  }

  else if (uVar1 == 4) {

    uStack_14 = 0x10;

  }

  else if (5 < uVar1) {

    uVar1 = (uVar1 >> 1) - 2;

    param_1[0xe] = uVar1;

    uStack_14 = uVar1 * 4 + 0xc;

  }

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

    param_1[2] = uStack_14;

    uStack_14 = uStack_14 + 0xc;

  }

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

    param_1[3] = uStack_14;

    uStack_14 = uStack_14 + 4;

  }

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

    param_1[4] = uStack_14;

    uStack_14 = uStack_14 + 4;

  }

  if ((char)param_2 < '\0') {

    param_1[5] = uStack_14;

    uStack_14 = uStack_14 + 4;

  }

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

    uVar1 = param_2 >> 8 & 0xf;

    *puVar2 = uStack_14;

    param_1[0xf] = uVar1;

    if (8 < uVar1) {

      param_1[0xf] = 8;

    }

    param_2 = param_2 >> 0x10;

    uVar1 = 0;

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

      do {

        *puVar2 = uStack_14;

        uStack_14 = uStack_14 + *(int *)(&DAT_007ed388 + (param_2 & 3) * 4);

        param_2 = param_2 >> 2;

        uVar1 = uVar1 + 1;

        puVar2 = puVar2 + 1;

      } while (uVar1 < param_1[0xf]);

    }

  }

  param_1[1] = uStack_14;

  return;

}





// --- FUN_005e52d6 at 0x005E52D6 (size: 41) ---


undefined4 __thiscall FUN_005e52d6(uint *param_1,uint param_2)



{

  undefined4 uVar1;

  

  if (param_2 < param_1[0xf]) {

    uVar1 = *(undefined4 *)

             (&DAT_007ed388 + (*param_1 >> ((char)param_2 * '\x02' + 0x10U & 0x1f) & 3) * 4);

  }

  else {

    uVar1 = 0;

  }

  return uVar1;

}





// --- FUN_005e52ff at 0x005E52FF (size: 43) ---


short * __thiscall FUN_005e52ff(undefined4 *param_1,uint param_2,uint param_3)



{

  short *psVar1;

  

  psVar1 = (short *)*param_1;

  while( true ) {

    if (*psVar1 == 0xff) {

      return (short *)0x0;

    }

    if ((*(byte *)(psVar1 + 3) == param_2) && (*(byte *)((int)psVar1 + 7) == param_3)) break;

    psVar1 = psVar1 + 4;

  }

  return psVar1;

}





// --- FUN_005e532a at 0x005E532A (size: 85) ---


undefined4 FUN_005e532a(ushort *param_1)



{

  undefined4 uVar1;

  ushort uVar2;

  byte bVar3;

  

  if (param_1 == (ushort *)0x0) {

LAB_005e537b:

    uVar1 = 0;

  }

  else {

    uVar2 = *param_1;

    bVar3 = 0;

    if (uVar2 != 0xff) {

      param_1 = param_1 + 1;

      do {

        if (uVar2 != 0) goto LAB_005e537b;

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

          if (*param_1 < (ushort)bVar3) goto LAB_005e537b;

          bVar3 = (&DAT_007ed398)[(byte)param_1[1]] + (char)*param_1;

        }

        uVar2 = param_1[3];

        param_1 = param_1 + 4;

      } while (uVar2 != 0xff);

    }

    uVar1 = 1;

  }

  return uVar1;

}





// --- FUN_005e537f at 0x005E537F (size: 27) ---


int FUN_005e537f(short *param_1)



{

  int iVar1;

  

  iVar1 = 0;

  for (; *param_1 != 0xff; param_1 = param_1 + 4) {

    iVar1 = iVar1 + 1;

  }

  return iVar1;

}





// --- FUN_005e539a at 0x005E539A (size: 257) ---


undefined4 __thiscall FUN_005e539a(undefined4 *param_1,undefined4 param_2)



{

  byte bVar1;

  char cVar2;

  short *psVar3;

  undefined4 uVar4;

  

  FUN_005ff907(param_2);

  for (psVar3 = (short *)*param_1; *psVar3 != 0xff; psVar3 = psVar3 + 4) {

    bVar1 = *(byte *)((int)psVar3 + 7);

    if (((bVar1 == 0) || ((char)psVar3[3] == '\x05')) || ((char)psVar3[3] == '\n')) {

      cVar2 = (char)psVar3[3];

      if (cVar2 == '\0') {

        if ((char)psVar3[2] == '\x02') {

          param_1[0x22] = psVar3;

        }

      }

      else if (cVar2 == '\x01') {

        if (*(byte *)(psVar3 + 2) < 4) {

          param_1[0x23] = psVar3;

        }

      }

      else if (cVar2 == '\x02') {

        if (((char)psVar3[2] == '\x05') || ((char)psVar3[2] == '\x04')) {

          param_1[0x24] = psVar3;

        }

      }

      else if (cVar2 == '\x03') {

        if ((char)psVar3[2] == '\x02') {

          param_1[0x25] = psVar3;

        }

      }

      else if (cVar2 == '\x05') {

        if ((*(byte *)(psVar3 + 2) < 4) && (bVar1 < 8)) {

          param_1[bVar1 + 0x28] = psVar3;

        }

      }

      else if (cVar2 == '\n') {

        if (bVar1 == 0) {

          if (((char)psVar3[2] == '\x03') || ((char)psVar3[2] == '\x04')) {

            param_1[0x26] = psVar3;

          }

        }

        else if ((bVar1 == 1) && (((char)psVar3[2] == '\x03' || ((char)psVar3[2] == '\x04')))) {

          param_1[0x27] = psVar3;

        }

      }

    }

  }

  uVar4 = FUN_005e4f99(*param_1,0);

  param_1[0x30] = uVar4;

  return 0;

}





// --- FUN_005e549b at 0x005E549B (size: 38) ---


void __thiscall FUN_005e549b(int param_1,undefined4 param_2,uint param_3)



{

  (**(code **)(**(int **)(param_1 + 0x248) + 0x2c))

            (*(int **)(param_1 + 0x248),0,0,param_2,param_3 | 0x800);

  return;

}





// --- FUN_005e54c1 at 0x005E54C1 (size: 43) ---


void FUN_005e54c1(undefined4 param_1,undefined4 param_2)



{

  FUN_005ff924(0,param_1,0);

  FUN_005ff924(0,param_2,0);

  return;

}





// --- FUN_005e54ec at 0x005E54EC (size: 184) ---


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



{

  byte bVar1;

  float fVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  undefined4 *puVar6;

  int *piVar7;

  float local_14 [4];

  

  uVar5 = 0;

  if (param_4 != 0) {

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

    puVar6 = (undefined4 *)(*(int *)(param_1 + 0x10c) * param_3 + *(int *)(param_1 + 0xcc));

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

      *puVar6 = 0;

      puVar6 = puVar6 + 1;

    }

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

      *(undefined1 *)puVar6 = 0;

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

    }

  }

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

    piVar7 = (int *)(param_1 + 0x18c);

    do {

      FUN_005ff975(*piVar7,param_2,local_14,4);

      if ((*(char *)(*piVar7 + 6) == '\x01') && (bVar1 = *(byte *)(*piVar7 + 4), bVar1 < 3)) {

        fVar2 = 0.0;

        uVar3 = bVar1 + 1;

        uVar4 = 0;

        if (uVar3 != 0) {

          do {

            uVar4 = uVar4 + 1;

            fVar2 = fVar2 + *(float *)(&stack0xffffffe8 + uVar4 * 4);

          } while (uVar4 < uVar3);

        }

        local_14[uVar3] = 1.0 - fVar2;

      }

      FUN_005ffd85(piVar7[0x41],param_3,local_14,4);

      uVar5 = uVar5 + 1;

      piVar7 = piVar7 + 1;

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

  }

  return;

}





// --- FUN_005e55a4 at 0x005E55A4 (size: 117) ---


undefined4 FUN_005e55a4(short *param_1,short *param_2)



{

  short *psVar1;

  short *psVar2;

  

  psVar2 = param_2;

  if (*param_1 != 0xff) {

    psVar1 = param_1;

    do {

      if (((*psVar2 == 0xff) ||

          (((*psVar2 != *psVar1 &&

            (*(short *)((int)param_2 + (2 - (int)param_1) + (int)psVar1) != psVar1[1])) ||

           ((char)psVar2[2] != (char)psVar1[2])))) ||

         (((*(char *)((int)psVar2 + 5) != *(char *)((int)psVar1 + 5) ||

           ((char)psVar2[3] != (char)psVar1[3])) ||

          (*(char *)((int)psVar2 + 7) != *(char *)((int)psVar1 + 7))))) break;

      psVar1 = psVar1 + 4;

      psVar2 = psVar2 + 4;

    } while (*psVar1 != 0xff);

    if (*psVar1 != 0xff) {

      return 0;

    }

  }

  if (*psVar2 != 0xff) {

    return 0;

  }

  return 1;

}





// --- FUN_005e5619 at 0x005E5619 (size: 46) ---


void FUN_005e5619(undefined4 *param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  

  for (; uVar1 = *param_2, *param_1 = uVar1, (short)uVar1 != 0xff; param_2 = param_2 + 2) {

    param_1[1] = param_2[1];

    param_1 = param_1 + 2;

  }

  param_1[1] = param_2[1];

  return;

}





// --- FUN_005e5647 at 0x005E5647 (size: 173) ---


void __fastcall FUN_005e5647(undefined4 *param_1)



{

  int *piVar1;

  

  piVar1 = (int *)param_1[2];

  *param_1 = &PTR_FUN_007ed3b0;

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

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

    param_1[2] = 0;

  }

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

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

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

    param_1[0x8b] = 0;

  }

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

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

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

    param_1[0x8c] = 0;

  }

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

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

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

    param_1[0x8d] = 0;

  }

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

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

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

    param_1[0x92] = 0;

  }

  operator_delete((void *)param_1[0x94]);

  operator_delete((void *)param_1[0x95]);

  operator_delete((void *)param_1[0x96]);

  operator_delete((void *)param_1[0x97]);

  operator_delete((void *)param_1[0x91]);

  return;

}





// --- FUN_005e56f4 at 0x005E56F4 (size: 50) ---


undefined4 FUN_005e56f4(int param_1,undefined4 *param_2)



{

  int *piVar1;

  undefined4 uVar2;

  

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

    uVar2 = 0x8876086c;

  }

  else {

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

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

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

    uVar2 = 0;

  }

  return uVar2;

}





// --- FUN_005e5726 at 0x005E5726 (size: 24) ---


void FUN_005e5726(int param_1)



{

  (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

  return;

}





// --- FUN_005e573e at 0x005E573E (size: 24) ---


void FUN_005e573e(int param_1)



{

  (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  return;

}





// --- FUN_005e5756 at 0x005E5756 (size: 66) ---


undefined4 FUN_005e5756(int param_1,byte param_2,undefined4 *param_3)



{

  if ((param_2 & 0x10) == 0) {

    operator_delete(*(void **)(param_1 + 0x25c));

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

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

    *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) & 0xffffffef;

  }

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

  return 0;

}





// --- FUN_005e5798 at 0x005E5798 (size: 118) ---


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



{

  undefined4 *puVar1;

  undefined4 uVar2;

  int iVar3;

  int *piVar4;

  int *piVar5;

  bool bVar6;

  

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

    *param_3 = 0;

    iVar3 = 4;

    bVar6 = true;

    piVar4 = param_2;

    piVar5 = &DAT_007cc670;

    do {

      if (iVar3 == 0) break;

      iVar3 = iVar3 + -1;

      bVar6 = *piVar4 == *piVar5;

      piVar4 = piVar4 + 1;

      piVar5 = piVar5 + 1;

    } while (bVar6);

    if (!bVar6) {

      iVar3 = 4;

      bVar6 = true;

      piVar4 = param_2;

      piVar5 = &DAT_007f14c8;

      do {

        if (iVar3 == 0) break;

        iVar3 = iVar3 + -1;

        bVar6 = *piVar4 == *piVar5;

        piVar4 = piVar4 + 1;

        piVar5 = piVar5 + 1;

      } while (bVar6);

      if (!bVar6) {

        iVar3 = 4;

        bVar6 = true;

        piVar4 = &DAT_007f14b8;

        do {

          if (iVar3 == 0) break;

          iVar3 = iVar3 + -1;

          bVar6 = *param_2 == *piVar4;

          param_2 = param_2 + 1;

          piVar4 = piVar4 + 1;

        } while (bVar6);

        if (!bVar6) {

          return 0x80004002;

        }

      }

    }

    *param_3 = param_1;

    (**(code **)(*param_1 + 4))(param_1);

    uVar2 = 0;

  }

  else {

    puVar1 = (undefined4 *)param_1[0x9c];

    uVar2 = (**(code **)*puVar1)(puVar1,param_2,param_3);

  }

  return uVar2;

}





// --- FUN_005e580e at 0x005E580E (size: 15) ---


undefined4 FUN_005e580e(int param_1)



{

  return *(undefined4 *)(param_1 + 4);

}





// --- FUN_005e581d at 0x005E581D (size: 193) ---


undefined4 FUN_005e581d(int param_1,undefined4 *param_2,uint param_3)



{

  undefined4 *puVar1;

  uint uVar2;

  int iVar3;

  undefined4 local_8;

  

  local_8 = 0;

  if (param_3 == 0) {

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

      operator_delete(*(void **)(param_1 + 0x25c));

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

    }

    else {

      local_8 = 0x8876086c;

    }

  }

  else if (param_3 < *(uint *)(param_1 + 0x260)) {

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

    for (uVar2 = param_3 * 5 & 0x3fffffff; uVar2 != 0; uVar2 = uVar2 - 1) {

      *puVar1 = *param_2;

      param_2 = param_2 + 1;

      puVar1 = puVar1 + 1;

    }

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

      *(undefined1 *)puVar1 = *(undefined1 *)param_2;

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

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

    }

    *(uint *)(param_1 + 0x260) = param_3;

  }

  else {

    operator_delete(*(void **)(param_1 + 0x25c));

    puVar1 = (undefined4 *)FUN_005df0f5(param_3 * 0x14);

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

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

      local_8 = 0x8007000e;

    }

    else {

      for (uVar2 = param_3 * 5 & 0x3fffffff; uVar2 != 0; uVar2 = uVar2 - 1) {

        *puVar1 = *param_2;

        param_2 = param_2 + 1;

        puVar1 = puVar1 + 1;

      }

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

        *(undefined1 *)puVar1 = *(undefined1 *)param_2;

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

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

      }

      *(uint *)(param_1 + 0x260) = param_3;

    }

  }

  return local_8;

}





// --- FUN_005e58de at 0x005E58DE (size: 332) ---


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



{

  int iVar1;

  undefined4 *puVar2;

  uint uVar3;

  int iVar4;

  undefined4 *puVar5;

  undefined4 *puVar6;

  uint local_24;

  int local_20;

  int local_1c;

  undefined4 local_18;

  uint local_14;

  undefined4 *local_10;

  uint local_c;

  uint local_8;

  

  local_18 = 0;

  local_c = 0;

  local_10 = (undefined4 *)0x0;

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

    *param_3 = 0;

    *param_2 = 0;

    local_18 = 0x80004005;

  }

  else {

    local_24 = 10;

    puVar2 = (undefined4 *)FUN_005df0f5(0x28);

    local_10 = puVar2;

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

LAB_005e592f:

      local_18 = 0x8007000e;

    }

    else {

      local_20 = 0;

      local_14 = 0;

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

        local_8 = 0;

        local_1c = 0;

        puVar5 = puVar2;

        do {

          puVar2 = puVar5;

          if ((*(short *)(local_1c + *(int *)(param_1 + 0x24c)) != -1) &&

             ((iVar1 = *(int *)(*(int *)(param_1 + 0x254) + local_14 * 4), iVar1 != local_20 ||

              (local_8 == 0)))) {

            uVar3 = 0;

            if (local_8 != 0) {

              do {

                if (puVar5[uVar3] == iVar1) break;

                uVar3 = uVar3 + 1;

              } while (uVar3 < local_c);

            }

            local_20 = iVar1;

            if (uVar3 == local_c) {

              if (local_c == local_24) {

                puVar2 = (undefined4 *)FUN_005df0f5(local_24 << 3);

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

                puVar6 = puVar2;

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

                  *puVar6 = *puVar5;

                  puVar5 = puVar5 + 1;

                  puVar6 = puVar6 + 1;

                }

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

                  *(undefined1 *)puVar6 = *(undefined1 *)puVar5;

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

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

                }

                operator_delete(local_10);

                local_24 = local_24 * 2;

                local_10 = puVar2;

              }

              local_c = local_c + 1;

              *(int *)(local_8 + (int)puVar2) = iVar1;

              local_8 = local_8 + 4;

            }

          }

          local_14 = local_14 + 1;

          local_1c = local_1c + 6;

          puVar5 = puVar2;

        } while (local_14 < *(uint *)(param_1 + 0x264));

      }

      *param_2 = puVar2;

      *param_3 = local_c;

      local_10 = (undefined4 *)0x0;

    }

  }

  operator_delete(local_10);

  return local_18;

}





// --- FUN_005e5a2a at 0x005E5A2A (size: 173) ---


void __fastcall FUN_005e5a2a(undefined4 *param_1)



{

  int *piVar1;

  

  piVar1 = (int *)param_1[2];

  *param_1 = &PTR_FUN_007ed428;

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

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

    param_1[2] = 0;

  }

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

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

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

    param_1[0x8b] = 0;

  }

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

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

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

    param_1[0x8c] = 0;

  }

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

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

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

    param_1[0x8d] = 0;

  }

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

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

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

    param_1[0x92] = 0;

  }

  operator_delete((void *)param_1[0x94]);

  operator_delete((void *)param_1[0x95]);

  operator_delete((void *)param_1[0x96]);

  operator_delete((void *)param_1[0x97]);

  operator_delete((void *)param_1[0x91]);

  return;

}





// --- FUN_005e5ad7 at 0x005E5AD7 (size: 39) ---


int FUN_005e5ad7(int param_1)



{

  int iVar1;

  int *piVar2;

  

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

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

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

    *piVar2 = *piVar2 + 1;

    iVar1 = *piVar2;

  }

  else {

    iVar1 = (**(code **)(*piVar2 + 4))(piVar2);

  }

  return iVar1;

}





// --- FUN_005e5afe at 0x005E5AFE (size: 41) ---


void FUN_005e5afe(int param_1,uint param_2,undefined4 param_3)



{

  (**(code **)(**(int **)(param_1 + 0x234) + 0x2c))

            (*(int **)(param_1 + 0x234),0,0,param_3,param_2 | 0x800);

  return;

}





// --- FUN_005e5b27 at 0x005E5B27 (size: 41) ---


void FUN_005e5b27(int param_1,uint param_2,undefined4 param_3)



{

  (**(code **)(**(int **)(param_1 + 0x248) + 0x2c))

            (*(int **)(param_1 + 0x248),0,0,param_3,param_2 | 0x800);

  return;

}





// --- FUN_005e5b55 at 0x005E5B55 (size: 18) ---


undefined4 FUN_005e5b55(int param_1)



{

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

}





// --- FUN_005e5b67 at 0x005E5B67 (size: 18) ---


undefined4 FUN_005e5b67(int param_1)



{

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

}





// --- FUN_005e5b79 at 0x005E5B79 (size: 39) ---


undefined4 FUN_005e5b79(int param_1,int param_2)



{

  undefined4 uVar1;

  

  if (param_2 == 0) {

    uVar1 = 0x8876086c;

  }

  else {

    FUN_005e5619(param_2,param_1 + 0xc);

    uVar1 = 0;

  }

  return uVar1;

}





// --- FUN_005e5ba0 at 0x005E5BA0 (size: 18) ---


undefined4 FUN_005e5ba0(int param_1)



{

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

}





// --- FUN_005e5bb2 at 0x005E5BB2 (size: 18) ---


undefined4 FUN_005e5bb2(int param_1)



{

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

}





// --- FUN_005e5bc4 at 0x005E5BC4 (size: 45) ---


undefined4 FUN_005e5bc4(int param_1,undefined4 *param_2)



{

  int *piVar1;

  undefined4 uVar2;

  

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

    uVar2 = 0x8876086c;

  }

  else {

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

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

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

    uVar2 = 0;

  }

  return uVar2;

}





// --- FUN_005e5bf1 at 0x005E5BF1 (size: 45) ---


undefined4 FUN_005e5bf1(int param_1,undefined4 *param_2)



{

  int *piVar1;

  undefined4 uVar2;

  

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

    uVar2 = 0x8876086c;

  }

  else {

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

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

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

    uVar2 = 0;

  }

  return uVar2;

}





// --- FUN_005e5c1e at 0x005E5C1E (size: 76) ---


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



{

  uint uVar1;

  int iVar2;

  undefined4 *puVar3;

  

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

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

  }

  if ((param_2 != (undefined4 *)0x0) && (*(undefined4 **)(param_1 + 0x25c) != (undefined4 *)0x0)) {

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

    for (uVar1 = *(int *)(param_1 + 0x260) * 5 & 0x3fffffff; uVar1 != 0; uVar1 = uVar1 - 1) {

      *param_2 = *puVar3;

      puVar3 = puVar3 + 1;

      param_2 = param_2 + 1;

    }

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

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

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

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

    }

  }

  return 0;

}





// --- FUN_005e5c6a at 0x005E5C6A (size: 141) ---


undefined4 FUN_005e5c6a(int param_1,undefined4 param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 uVar3;

  

  uVar3 = param_2;

  iVar2 = FUN_005e532a(param_2,0);

  if (iVar2 == 0) {

    uVar3 = 0x8876086c;

  }

  else {

    iVar2 = FUN_005e4f99(uVar3,0);

    if (iVar2 == *(int *)(param_1 + 0x238)) {

      FUN_005efb7f(1);

      iVar2 = (**(code **)(**(int **)(param_1 + 0x230) + 0x158))

                        (*(int **)(param_1 + 0x230),uVar3,&param_2);

      FUN_005efb7f(0);

      if (iVar2 < 0) {

        param_2 = 0;

      }

      FUN_005e5619(param_1 + 0xc,uVar3);

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

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

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

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

      }

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

      uVar3 = 0;

    }

    else {

      uVar3 = 0x8876086c;

    }

  }

  return uVar3;

}





// --- FUN_005e5cf7 at 0x005E5CF7 (size: 330) ---


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



{

  int iVar1;

  undefined4 *puVar2;

  uint uVar3;

  int iVar4;

  undefined4 *puVar5;

  undefined4 *puVar6;

  uint local_24;

  int local_20;

  int local_1c;

  undefined4 local_18;

  uint local_14;

  undefined4 *local_10;

  uint local_c;

  uint local_8;

  

  local_18 = 0;

  local_c = 0;

  local_10 = (undefined4 *)0x0;

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

    *param_3 = 0;

    *param_2 = 0;

    local_18 = 0x80004005;

  }

  else {

    local_24 = 10;

    puVar2 = (undefined4 *)FUN_005df0f5(0x28);

    local_10 = puVar2;

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

LAB_005e5d48:

      local_18 = 0x8007000e;

    }

    else {

      local_20 = 0;

      local_14 = 0;

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

        local_8 = 0;

        local_1c = 0;

        puVar5 = puVar2;

        do {

          puVar2 = puVar5;

          if ((*(int *)(local_1c + *(int *)(param_1 + 0x24c)) != -1) &&

             ((iVar1 = *(int *)(*(int *)(param_1 + 0x254) + local_14 * 4), iVar1 != local_20 ||

              (local_8 == 0)))) {

            uVar3 = 0;

            if (local_8 != 0) {

              do {

                if (puVar5[uVar3] == iVar1) break;

                uVar3 = uVar3 + 1;

              } while (uVar3 < local_c);

            }

            local_20 = iVar1;

            if (uVar3 == local_c) {

              if (local_c == local_24) {

                puVar2 = (undefined4 *)FUN_005df0f5(local_24 << 3);

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

                puVar6 = puVar2;

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

                  *puVar6 = *puVar5;

                  puVar5 = puVar5 + 1;

                  puVar6 = puVar6 + 1;

                }

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

                  *(undefined1 *)puVar6 = *(undefined1 *)puVar5;

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

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

                }

                operator_delete(local_10);

                local_24 = local_24 * 2;

                local_10 = puVar2;

              }

              local_c = local_c + 1;

              *(int *)(local_8 + (int)puVar2) = iVar1;

              local_8 = local_8 + 4;

            }

          }

          local_14 = local_14 + 1;

          local_1c = local_1c + 0xc;

          puVar5 = puVar2;

        } while (local_14 < *(uint *)(param_1 + 0x264));

      }

      *param_2 = puVar2;

      *param_3 = local_c;

      local_10 = (undefined4 *)0x0;

    }

  }

  operator_delete(local_10);

  return local_18;

}





// --- FUN_005e5e41 at 0x005E5E41 (size: 38) ---


void __thiscall FUN_005e5e41(int param_1,undefined4 param_2,uint param_3)



{

  (**(code **)(**(int **)(param_1 + 0x234) + 0x2c))

            (*(int **)(param_1 + 0x234),0,0,param_2,param_3 | 0x800);

  return;

}





// --- FUN_005e5e67 at 0x005E5E67 (size: 42) ---


void __thiscall FUN_005e5e67(undefined2 *param_1,undefined4 param_2)



{

  *param_1 = 0xffff;

  param_1[1] = 0xffff;

  param_1[2] = 0xffff;

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

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

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

  return;

}





// --- FUN_005e5e91 at 0x005E5E91 (size: 36) ---


void __thiscall FUN_005e5e91(undefined4 *param_1,undefined4 param_2)



{

  *param_1 = 0xffffffff;

  param_1[1] = 0xffffffff;

  param_1[2] = 0xffffffff;

  param_1[5] = param_2;

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

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

  return;

}





// --- FUN_005e5eb5 at 0x005E5EB5 (size: 54) ---


char FUN_005e5eb5(ushort *param_1,uint param_2)



{

  char cVar1;

  

  if (*param_1 == param_2) {

    cVar1 = '\0';

  }

  else if (param_1[1] == param_2) {

    cVar1 = '\x01';

  }

  else {

    cVar1 = (param_1[2] != param_2) + '\x02';

  }

  return cVar1;

}





// --- FUN_005e5eeb at 0x005E5EEB (size: 45) ---


char FUN_005e5eeb(int *param_1,int param_2)



{

  char cVar1;

  

  if (*param_1 == param_2) {

    cVar1 = '\0';

  }

  else if (param_1[1] == param_2) {

    cVar1 = '\x01';

  }

  else {

    cVar1 = (param_1[2] != param_2) + '\x02';

  }

  return cVar1;

}





// --- FUN_005e5f18 at 0x005E5F18 (size: 193) ---


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



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  uint uVar3;

  undefined4 *puVar4;

  undefined4 *local_8;

  

  uVar3 = (uint)param_2;

  local_8 = (undefined4 *)*param_1;

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

    local_8 = (undefined4 *)FUN_005df0f5((int)param_2 * 6);

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

      local_8 = (undefined4 *)0x0;

    }

    else {

      FUN_00401000(local_8,6,param_2,&LAB_005eda5e);

    }

    *param_4 = (uint)param_2;

  }

  else if (*param_4 < param_2) {

    puVar4 = (undefined4 *)FUN_005df0f5((int)param_2 * 6);

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

      param_2 = (undefined4 *)0x0;

    }

    else {

      FUN_00401000(puVar4,6,param_2,&LAB_005eda5e);

      param_2 = puVar4;

    }

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

      return 0;

    }

    if (param_3 != 0) {

      puVar4 = param_2;

      do {

        puVar1 = (undefined4 *)(((int)local_8 - (int)param_2) + (int)puVar4);

        puVar2 = puVar4 + 1;

        *puVar4 = *puVar1;

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

        param_3 = param_3 + -1;

        *(undefined2 *)puVar2 = *(undefined2 *)(puVar1 + 1);

      } while (param_3 != 0);

    }

    *param_4 = uVar3;

    operator_delete(local_8);

    local_8 = param_2;

  }

  *param_1 = local_8;

  return 1;

}





// --- FUN_005e5fd9 at 0x005E5FD9 (size: 123) ---


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



{

  undefined2 *puVar1;

  uint uVar2;

  undefined2 *puVar3;

  undefined2 *puVar4;

  

  uVar2 = param_2;

  puVar1 = (undefined2 *)*param_1;

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

    puVar3 = (undefined2 *)FUN_005df0f5(param_2 * 2);

    *param_4 = param_2;

  }

  else {

    puVar3 = puVar1;

    if (*param_4 < param_2) {

      puVar3 = (undefined2 *)FUN_005df0f5(param_2 * 2);

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

        return 0;

      }

      if (param_3 != 0) {

        param_2 = param_3;

        puVar4 = puVar3;

        do {

          *puVar4 = *(undefined2 *)(((int)puVar1 - (int)puVar3) + (int)puVar4);

          puVar4 = puVar4 + 1;

          param_2 = param_2 + -1;

        } while (param_2 != 0);

      }

      *param_4 = uVar2;

      operator_delete(puVar1);

    }

  }

  *param_1 = puVar3;

  return 1;

}





// --- FUN_005e6054 at 0x005E6054 (size: 30) ---


void FUN_005e6054(int param_1,short param_2)



{

  uint uVar1;

  

  uVar1 = 0;

  do {

    if (*(short *)(param_1 + uVar1 * 2) == param_2) {

      return;

    }

    uVar1 = uVar1 + 1;

  } while (uVar1 < 3);

  return;

}





// --- FUN_005e6072 at 0x005E6072 (size: 195) ---


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



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  uint uVar3;

  undefined4 *puVar4;

  undefined4 *local_8;

  

  uVar3 = (uint)param_2;

  local_8 = (undefined4 *)*param_1;

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

    local_8 = (undefined4 *)FUN_005df0f5((int)param_2 * 0xc);

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

      local_8 = (undefined4 *)0x0;

    }

    else {

      FUN_00401000(local_8,0xc,param_2,&LAB_005eda5e);

    }

    *param_4 = (uint)param_2;

  }

  else if (*param_4 < param_2) {

    puVar4 = (undefined4 *)FUN_005df0f5((int)param_2 * 0xc);

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

      param_2 = (undefined4 *)0x0;

    }

    else {

      FUN_00401000(puVar4,0xc,param_2,&LAB_005eda5e);

      param_2 = puVar4;

    }

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

      return 0;

    }

    if (param_3 != 0) {

      puVar4 = param_2;

      do {

        puVar1 = (undefined4 *)(((int)local_8 - (int)param_2) + (int)puVar4);

        *puVar4 = *puVar1;

        puVar2 = puVar4 + 2;

        puVar4[1] = puVar1[1];

        puVar4 = puVar4 + 3;

        param_3 = param_3 + -1;

        *puVar2 = puVar1[2];

      } while (param_3 != 0);

    }

    *param_4 = uVar3;

    operator_delete(local_8);

    local_8 = param_2;

  }

  *param_1 = local_8;

  return 1;

}





// --- FUN_005e6135 at 0x005E6135 (size: 126) ---


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



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  

  uVar2 = param_2;

  puVar1 = (undefined4 *)*param_1;

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

    puVar3 = (undefined4 *)FUN_005df0f5(param_2 << 2);

    *param_4 = param_2;

  }

  else {

    puVar3 = puVar1;

    if (*param_4 < param_2) {

      puVar3 = (undefined4 *)FUN_005df0f5(param_2 << 2);

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

        return 0;

      }

      if (param_3 != 0) {

        param_2 = param_3;

        puVar4 = puVar3;

        do {

          *puVar4 = *(undefined4 *)(((int)puVar1 - (int)puVar3) + (int)puVar4);

          puVar4 = puVar4 + 1;

          param_2 = param_2 + -1;

        } while (param_2 != 0);

      }

      *param_4 = uVar2;

      operator_delete(puVar1);

    }

  }

  *param_1 = puVar3;

  return 1;

}





// --- FUN_005e61b3 at 0x005E61B3 (size: 28) ---


void FUN_005e61b3(int param_1,int param_2)



{

  uint uVar1;

  

  uVar1 = 0;

  do {

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

      return;

    }

    uVar1 = uVar1 + 1;

  } while (uVar1 < 3);

  return;

}





// --- FUN_005e61cf at 0x005E61CF (size: 38) ---


void __thiscall

FUN_005e61cf(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined2 param_4)



{

  param_1[4] = 0;

  param_1[8] = 0;

  *param_1 = param_2;

  param_1[1] = param_3;

  *(undefined2 *)(param_1 + 6) = param_4;

  return;

}





// --- FUN_005e61f5 at 0x005E61F5 (size: 25) ---


void __fastcall FUN_005e61f5(int param_1)



{

  operator_delete(*(void **)(param_1 + 0x10));

  operator_delete(*(void **)(param_1 + 0x20));

  return;

}





// --- FUN_005e620e at 0x005E620E (size: 36) ---


void __thiscall

FUN_005e620e(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  param_1[6] = 0;

  param_1[0xb] = 0;

  *param_1 = param_2;

  param_1[1] = param_3;

  param_1[9] = param_4;

  return;

}





// --- FUN_005e6232 at 0x005E6232 (size: 25) ---


void __fastcall FUN_005e6232(int param_1)



{

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

  operator_delete(*(void **)(param_1 + 0x2c));

  return;

}





// --- FUN_005e624b at 0x005E624B (size: 41) ---


int __fastcall FUN_005e624b(int param_1)



{

  uint uVar1;

  

  uVar1 = 0;

  do {

    if (*(short *)(param_1 + 8 + (uVar1 & 0xffff) * 2) != -1) {

      return (uint)*(ushort *)(param_1 + 8 + (uVar1 & 0xffff) * 2) +

             (uint)*(ushort *)(param_1 + 0x14);

    }

    uVar1 = uVar1 + 1;

  } while ((ushort)uVar1 < 4);

  return CONCAT22((short)(uVar1 >> 0x10),0xffff);

}





// --- FUN_005e6274 at 0x005E6274 (size: 31) ---


int __fastcall FUN_005e6274(int param_1)



{

  int *piVar1;

  uint uVar2;

  

  uVar2 = 0;

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

  do {

    if (*piVar1 != -1) {

      return *(int *)(param_1 + 8 + uVar2 * 4) + *(int *)(param_1 + 0x1c);

    }

    uVar2 = uVar2 + 1;

    piVar1 = piVar1 + 1;

  } while (uVar2 < 4);

  return -1;

}





// --- FUN_005e6293 at 0x005E6293 (size: 74) ---


undefined4 __fastcall FUN_005e6293(undefined4 *param_1)



{

  int iVar1;

  uint uVar2;

  

  if (param_1[4] == 0) {

    iVar1 = FUN_005df0f5(param_1[3] << 1);

    param_1[4] = iVar1;

    if (iVar1 == 0) {

      return 0x8007000e;

    }

  }

  uVar2 = 0;

  if (param_1[3] != 0) {

    do {

      *(undefined2 *)(param_1[4] + uVar2 * 2) = 0xffff;

      uVar2 = uVar2 + 1;

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

  }

  param_1[2] = 0;

  param_1[1] = 0;

  *param_1 = 0;

  return 0;

}





// --- FUN_005e62dd at 0x005E62DD (size: 45) ---


int __thiscall FUN_005e62dd(int param_1,short param_2)



{

  uint uVar1;

  uint3 uVar2;

  short *psVar3;

  uint uVar4;

  

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

  uVar4 = 0;

  uVar2 = (uint3)(uVar1 >> 8);

  if (uVar1 != 0) {

    psVar3 = *(short **)(param_1 + 0x10);

    do {

      if (*psVar3 == param_2) {

        return CONCAT31(uVar2,1);

      }

      uVar4 = uVar4 + 1;

      psVar3 = psVar3 + 1;

    } while (uVar4 < uVar1);

  }

  return (uint)uVar2 << 8;

}





// --- FUN_005e630a at 0x005E630A (size: 43) ---


void __thiscall FUN_005e630a(int param_1,undefined2 param_2)



{

  *(undefined2 *)(*(int *)(param_1 + 0x10) + *(int *)(param_1 + 4) * 2) = param_2;

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

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

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

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

  }

  return;

}





// --- FUN_005e6335 at 0x005E6335 (size: 73) ---


undefined4 __fastcall FUN_005e6335(undefined4 *param_1)



{

  int iVar1;

  uint uVar2;

  

  if (param_1[4] == 0) {

    iVar1 = FUN_005df0f5(param_1[3] << 2);

    param_1[4] = iVar1;

    if (iVar1 == 0) {

      return 0x8007000e;

    }

  }

  uVar2 = 0;

  if (param_1[3] != 0) {

    do {

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

      uVar2 = uVar2 + 1;

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

  }

  param_1[2] = 0;

  param_1[1] = 0;

  *param_1 = 0;

  return 0;

}





// --- FUN_005e637e at 0x005E637E (size: 44) ---


int __thiscall FUN_005e637e(int param_1,int param_2)



{

  uint uVar1;

  uint3 uVar2;

  int *piVar3;

  uint uVar4;

  

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

  uVar4 = 0;

  uVar2 = (uint3)(uVar1 >> 8);

  if (uVar1 != 0) {

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

    do {

      if (*piVar3 == param_2) {

        return CONCAT31(uVar2,1);

      }

      uVar4 = uVar4 + 1;

      piVar3 = piVar3 + 1;

    } while (uVar4 < uVar1);

  }

  return (uint)uVar2 << 8;

}





// --- FUN_005e63aa at 0x005E63AA (size: 41) ---


void __thiscall FUN_005e63aa(int param_1,undefined4 param_2)



{

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

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

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

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

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

  }

  return;

}





// --- FUN_005e63d3 at 0x005E63D3 (size: 286) ---


undefined4 __thiscall FUN_005e63d3(int param_1,int param_2,int param_3,int param_4)



{

  ushort *puVar1;

  uint *puVar2;

  ushort uVar3;

  ushort uVar4;

  uint uVar5;

  uint uVar6;

  ushort uVar7;

  undefined4 local_10;

  

  uVar6 = 0;

  local_10 = 0;

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

    uVar5 = 0;

    do {

      uVar6 = uVar6 + 1;

      *(undefined4 *)(param_4 + uVar5 * 4) = 0xffff;

      uVar5 = uVar6 & 0xffff;

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

  }

  uVar6 = 0;

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

    uVar5 = 0;

    do {

      uVar6 = uVar6 + 1;

      *(uint *)(param_3 + uVar5 * 4) = uVar5;

      uVar5 = uVar6 & 0xffff;

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

  }

  uVar7 = 0;

  uVar3 = 0;

  uVar4 = uVar7;

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

    uVar6 = 0;

    do {

      puVar1 = (ushort *)(*(int *)(param_1 + 0x24c) + uVar6 * 6);

      if (*puVar1 == 0xffff) {

        *(undefined4 *)(param_2 + uVar6 * 4) = 0xffff;

      }

      else {

        uVar5 = (uint)uVar7;

        uVar7 = uVar7 + 1;

        *(uint *)(param_2 + uVar6 * 4) = uVar5;

        *(uint *)(param_3 + uVar5 * 4) = uVar6;

        *(undefined4 *)(param_4 + (uint)*puVar1 * 4) = 1;

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

        *(undefined4 *)(param_4 + (uint)puVar1[2] * 4) = 1;

      }

      uVar3 = uVar3 + 1;

      uVar6 = (uint)uVar3;

      uVar4 = uVar7;

    } while (uVar6 < *(uint *)(param_1 + 0x264));

  }

  for (; (uint)uVar7 < *(uint *)(param_1 + 0x264); uVar7 = uVar7 + 1) {

    *(undefined4 *)(param_3 + (uint)uVar7 * 4) = 0xffff;

  }

  uVar7 = 0;

  uVar6 = 0;

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

    uVar5 = 0;

    uVar7 = 0;

    do {

      puVar2 = (uint *)(param_4 + uVar5 * 4);

      if (*puVar2 != 0xffff) {

        *puVar2 = (uint)uVar7;

        uVar7 = uVar7 + 1;

      }

      uVar6 = uVar6 + 1;

      uVar5 = uVar6 & 0xffff;

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

  }

  if ((uVar4 == 0) || (uVar7 == 0)) {

    local_10 = 0x88760b5a;

  }

  return local_10;

}





// --- FUN_005e64f1 at 0x005E64F1 (size: 1228) ---


int __thiscall FUN_005e64f1(int param_1,ushort *param_2,int param_3,int param_4,uint param_5)



{

  uint *puVar1;

  int *piVar2;

  uint uVar3;

  ushort uVar4;

  uint uVar5;

  void *pvVar6;

  uint uVar7;

  uint uVar8;

  int *piVar9;

  uint uVar10;

  undefined4 *puVar11;

  int iVar12;

  int iVar13;

  uint local_24;

  void *local_20;

  uint local_1c;

  uint local_18;

  uint local_14;

  int local_10;

  undefined4 *local_c;

  void *local_8;

  

  uVar5 = param_5 & 0x10000000;

  uVar3 = param_5 & 0x800000;

  local_10 = 0;

  local_c = (undefined4 *)0x0;

  local_8 = (void *)0x0;

  local_20 = (void *)0x0;

  if (uVar3 == 0) {

    local_10 = FUN_005e58de(&local_8,&local_18);

    pvVar6 = local_8;

    uVar10 = local_18;

    if (local_10 < 0) goto LAB_005e697a;

    qsort(local_8,local_18,4,FUN_005e51f5);

LAB_005e659e:

    local_c = (undefined4 *)FUN_005df0f5(uVar10 << 4);

    puVar11 = local_c;

    uVar7 = uVar10;

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

      for (; uVar7 != 0; uVar7 = uVar7 - 1) {

        *puVar11 = 0;

        puVar11[2] = 0;

        puVar11 = puVar11 + 4;

      }

      uVar7 = 0;

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

        do {

          *(undefined4 *)(param_4 + uVar7 * 4) = 0xffff;

          uVar7 = uVar7 + 1;

        } while (uVar7 < *(uint *)(param_1 + 0x23c));

      }

      uVar7 = 0;

      local_14 = 0;

      if (uVar10 != 0) {

        do {

          if (*(int *)((int)pvVar6 + uVar7 * 4) == 0) break;

          uVar7 = uVar7 + 1;

        } while (uVar7 < uVar10);

      }

      uVar8 = 0;

      param_5 = 0;

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

        do {

          uVar4 = *(ushort *)(param_3 + uVar8 * 4);

          if (uVar4 != 0xffff) {

            uVar8 = *(uint *)(*(int *)(param_1 + 0x254) + (uint)uVar4 * 4);

            if ((uVar8 != local_14) && (uVar7 = 0, local_14 = uVar8, uVar10 != 0)) {

              do {

                if (*(uint *)((int)local_8 + uVar7 * 4) == uVar8) break;

                uVar7 = uVar7 + 1;

              } while (uVar7 < uVar10);

            }

            iVar12 = (uint)uVar4 * 6;

            local_20 = (void *)0x3;

            do {

              puVar1 = (uint *)(param_4 + (uint)*(ushort *)(*(int *)(param_1 + 0x24c) + iVar12) * 4)

              ;

              if (*puVar1 == 0xffff) {

                *puVar1 = uVar7;

                local_c[uVar7 * 4 + 2] = local_c[uVar7 * 4 + 2] + 1;

              }

              iVar12 = iVar12 + 2;

              local_20 = (void *)((int)local_20 + -1);

            } while (local_20 != (void *)0x0);

            local_c[uVar7 * 4] = local_c[uVar7 * 4] + 1;

            uVar10 = local_18;

          }

          param_5 = param_5 + 1;

          uVar8 = param_5 & 0xffff;

        } while (uVar8 < *(uint *)(param_1 + 0x264));

      }

      local_20 = *(void **)(param_1 + 0x25c);

      *(uint *)(param_1 + 0x260) = uVar10;

      iVar12 = FUN_005df0f5(uVar10 * 0x14);

      iVar13 = 0;

      *(int *)(param_1 + 0x25c) = iVar12;

      if (iVar12 != 0) {

        local_14 = 0;

        local_24 = 0;

        param_5 = 0;

        uVar7 = 0;

        if (uVar10 != 0) {

          piVar9 = local_c + 2;

          do {

            piVar9[-1] = local_14;

            *(undefined4 *)(iVar13 + *(int *)(param_1 + 0x25c)) =

                 *(undefined4 *)((int)local_8 + param_5 * 4);

            *(uint *)(*(int *)(param_1 + 0x25c) + 4 + iVar13) = local_14;

            *(int *)(*(int *)(param_1 + 0x25c) + 8 + iVar13) = piVar9[-2];

            local_14 = local_14 + piVar9[-2];

            iVar13 = iVar13 + 0x14;

            piVar9[1] = local_24;

            *(uint *)(*(int *)(param_1 + 0x25c) + -8 + iVar13) = local_24;

            *(int *)(*(int *)(param_1 + 0x25c) + -4 + iVar13) = *piVar9;

            local_24 = local_24 + *piVar9;

            param_5 = param_5 + 1;

            piVar9 = piVar9 + 4;

            uVar7 = local_18;

          } while (param_5 < local_18);

        }

        local_24 = 0;

        local_14 = 0;

        if (uVar7 != 0) {

          do {

            if (*(int *)((int)local_8 + local_24 * 4) == 0) break;

            local_24 = local_24 + 1;

          } while (local_24 < uVar7);

        }

        param_5 = 0;

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

          uVar10 = 0;

          do {

            uVar4 = *(ushort *)(param_3 + uVar10 * 4);

            if (uVar4 != 0xffff) {

              iVar12 = (uint)uVar4 * 4;

              uVar10 = *(uint *)(iVar12 + *(int *)(param_1 + 0x254));

              if ((uVar10 != local_14) && (local_24 = 0, local_14 = uVar10, uVar7 != 0)) {

                do {

                  if (*(uint *)((int)local_8 + local_24 * 4) == uVar10) break;

                  local_24 = local_24 + 1;

                } while (local_24 < uVar7);

              }

              piVar9 = local_c + local_24 * 4 + 1;

              *(int *)(iVar12 + (int)param_2) = *piVar9;

              *piVar9 = *piVar9 + 1;

            }

            param_5 = param_5 + 1;

            uVar10 = param_5 & 0xffff;

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

        }

        if (uVar5 == 0) {

          uVar5 = 0;

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

            do {

              piVar9 = (int *)(param_4 + uVar5 * 4);

              iVar12 = *piVar9;

              if (iVar12 != 0xffff) {

                piVar2 = local_c + iVar12 * 4 + 3;

                *piVar9 = *piVar2;

                *piVar2 = *piVar2 + 1;

              }

              uVar5 = uVar5 + 1;

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

          }

        }

        else {

          uVar5 = 0;

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

            do {

              *(uint *)(param_4 + uVar5 * 4) = uVar5;

              uVar5 = uVar5 + 1;

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

          }

        }

        uVar5 = 0;

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

          uVar10 = 0;

          do {

            uVar5 = uVar5 + 1;

            *(undefined4 *)(param_3 + uVar10 * 4) = 0xffff;

            uVar10 = uVar5 & 0xffff;

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

        }

        uVar5 = 0;

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

          uVar10 = 0;

          do {

            uVar4 = *(ushort *)((int)param_2 + uVar10 * 4);

            if (uVar4 != 0xffff) {

              *(uint *)(param_3 + (uint)uVar4 * 4) = uVar10;

            }

            uVar5 = uVar5 + 1;

            uVar10 = uVar5 & 0xffff;

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

        }

        if (uVar3 == 0) {

          if (uVar7 != 0) {

            local_18 = 0;

            local_14 = uVar7;

            do {

              iVar12 = local_18 + *(int *)(param_1 + 0x25c);

              uVar3 = *(uint *)(iVar12 + 4);

              uVar5 = *(uint *)(param_4 +

                               (uint)*(ushort *)

                                      (*(int *)(param_1 + 0x24c) + *(int *)(param_3 + uVar3 * 4) * 6

                                      ) * 4);

              uVar10 = *(int *)(iVar12 + 8) + uVar3;

              local_1c = uVar5;

              for (; (uVar3 & 0xffff) < uVar10; uVar3 = uVar3 + 1) {

                param_2 = (ushort *)

                          (*(int *)(param_1 + 0x24c) + *(int *)(param_3 + (uVar3 & 0xffff) * 4) * 6)

                ;

                local_24 = 3;

                do {

                  uVar7 = *(uint *)(param_4 + (uint)*param_2 * 4);

                  if (uVar7 < uVar5) {

                    uVar5 = uVar7;

                  }

                  if (local_1c < uVar7) {

                    local_1c = uVar7;

                  }

                  param_2 = param_2 + 1;

                  local_24 = local_24 + -1;

                } while (local_24 != 0);

              }

              *(uint *)(iVar12 + 0xc) = uVar5;

              *(uint *)(local_18 + 0x10 + *(int *)(param_1 + 0x25c)) = (local_1c - uVar5) + 1;

              local_18 = local_18 + 0x14;

              local_14 = local_14 - 1;

            } while (local_14 != 0);

          }

        }

        else if (uVar7 != 0) {

          iVar12 = 0;

          puVar11 = (undefined4 *)((int)local_20 + 0x10);

          do {

            *(undefined4 *)(iVar12 + 0xc + *(int *)(param_1 + 0x25c)) = puVar11[-1];

            *(undefined4 *)(iVar12 + 0x10 + *(int *)(param_1 + 0x25c)) = *puVar11;

            iVar12 = iVar12 + 0x14;

            puVar11 = puVar11 + 5;

            uVar7 = uVar7 - 1;

          } while (uVar7 != 0);

        }

        *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x10;

        goto LAB_005e697a;

      }

    }

  }

  else {

    uVar10 = *(uint *)(param_1 + 0x260);

    local_18 = uVar10;

    pvVar6 = (void *)FUN_005df0f5(uVar10 << 2);

    local_8 = pvVar6;

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

      uVar7 = 0;

      if (uVar10 != 0) {

        iVar12 = 0;

        do {

          *(undefined4 *)((int)pvVar6 + uVar7 * 4) =

               *(undefined4 *)(iVar12 + *(int *)(param_1 + 0x25c));

          uVar7 = uVar7 + 1;

          iVar12 = iVar12 + 0x14;

        } while (uVar7 < uVar10);

      }

      goto LAB_005e659e;

    }

  }

  local_10 = -0x7ff8fff2;

LAB_005e697a:

  operator_delete(local_c);

  operator_delete(local_8);

  operator_delete(local_20);

  if (local_10 < 0) {

    *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) & 0xffffffef;

    operator_delete(*(void **)(param_1 + 0x25c));

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

  }

  return local_10;

}





// --- FUN_005e69bd at 0x005E69BD (size: 143) ---


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



{

  uint *puVar1;

  ushort uVar2;

  ushort uVar3;

  ushort uVar4;

  uint uVar5;

  ushort *puVar6;

  uint uVar7;

  int local_c;

  

  uVar7 = 0;

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

    uVar5 = 0;

    do {

      uVar7 = uVar7 + 1;

      *(undefined4 *)(param_3 + uVar5 * 4) = 0xffff;

      uVar5 = uVar7 & 0xffff;

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

  }

  uVar7 = 0;

  uVar4 = 0;

  uVar2 = 0;

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

    do {

      uVar3 = *(ushort *)(param_2 + uVar7 * 4);

      if (uVar3 != 0xffff) {

        puVar6 = (ushort *)(*(int *)(param_1 + 0x24c) + (uint)uVar3 * 6);

        local_c = 3;

        do {

          puVar1 = (uint *)(param_3 + (uint)*puVar6 * 4);

          if (*puVar1 == 0xffff) {

            uVar7 = (uint)uVar4;

            uVar4 = uVar4 + 1;

            *puVar1 = uVar7;

          }

          puVar6 = puVar6 + 1;

          local_c = local_c + -1;

        } while (local_c != 0);

      }

      uVar2 = uVar2 + 1;

      uVar7 = (uint)uVar2;

    } while (uVar7 < *(uint *)(param_1 + 0x264));

  }

  return 0;

}





// --- FUN_005e6a4c at 0x005E6A4C (size: 24) ---


undefined4 __fastcall FUN_005e6a4c(int param_1)



{

  *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) & 0xffffffef;

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

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

  return 0;

}





// --- FUN_005e6a64 at 0x005E6A64 (size: 248) ---


undefined4 __thiscall FUN_005e6a64(int param_1,int param_2,int param_3,int param_4)



{

  uint uVar1;

  int *piVar2;

  int iVar3;

  undefined4 local_10;

  uint local_c;

  int local_8;

  

  uVar1 = 0;

  local_10 = 0;

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

    do {

      *(undefined4 *)(param_4 + uVar1 * 4) = 0xffffffff;

      uVar1 = uVar1 + 1;

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

  }

  uVar1 = 0;

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

    do {

      *(uint *)(param_3 + uVar1 * 4) = uVar1;

      uVar1 = uVar1 + 1;

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

  }

  uVar1 = 0;

  local_c = 0;

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

    local_8 = 0;

    do {

      piVar2 = (int *)(*(int *)(param_1 + 0x24c) + local_8);

      if (*piVar2 == -1) {

        *(undefined4 *)(param_2 + uVar1 * 4) = 0xffffffff;

      }

      else {

        *(uint *)(param_2 + uVar1 * 4) = local_c;

        *(uint *)(param_3 + local_c * 4) = uVar1;

        local_c = local_c + 1;

        *(undefined4 *)(param_4 + *piVar2 * 4) = 1;

        *(undefined4 *)(param_4 + piVar2[1] * 4) = 1;

        *(undefined4 *)(param_4 + piVar2[2] * 4) = 1;

      }

      local_8 = local_8 + 0xc;

      uVar1 = uVar1 + 1;

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

  }

  uVar1 = local_c;

  if (local_c < *(uint *)(param_1 + 0x264)) {

    do {

      *(undefined4 *)(param_3 + uVar1 * 4) = 0xffffffff;

      uVar1 = uVar1 + 1;

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

  }

  iVar3 = 0;

  uVar1 = 0;

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

    do {

      if (*(int *)(param_4 + uVar1 * 4) != -1) {

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

        iVar3 = iVar3 + 1;

      }

      uVar1 = uVar1 + 1;

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

  }

  if ((local_c == 0) || (iVar3 == 0)) {

    local_10 = 0x88760b5a;

  }

  return local_10;

}





// --- FUN_005e6b5c at 0x005E6B5C (size: 1185) ---


int __thiscall FUN_005e6b5c(int param_1,int param_2,int param_3,int param_4,int *param_5)



{

  uint *puVar1;

  int *piVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  int *piVar7;

  undefined4 *puVar8;

  int iVar9;

  uint uVar10;

  int local_24;

  void *local_20;

  uint local_1c;

  uint local_18;

  uint local_14;

  uint local_10;

  undefined4 *local_c;

  void *local_8;

  

  uVar5 = (uint)param_5 & 0x10000000;

  uVar3 = (uint)param_5 & 0x800000;

  local_24 = 0;

  local_c = (undefined4 *)0x0;

  local_8 = (void *)0x0;

  local_20 = (void *)0x0;

  if (uVar3 == 0) {

    local_24 = FUN_005e5cf7(&local_8,&local_14);

    uVar10 = local_14;

    if (local_24 < 0) goto LAB_005e6fbe;

    qsort(local_8,local_14,4,FUN_005e51f5);

LAB_005e6c0b:

    local_c = (undefined4 *)FUN_005df0f5(uVar10 << 4);

    puVar8 = local_c;

    uVar6 = uVar10;

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

      for (; uVar6 != 0; uVar6 = uVar6 - 1) {

        *puVar8 = 0;

        puVar8[2] = 0;

        puVar8 = puVar8 + 4;

      }

      uVar6 = 0;

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

        do {

          *(undefined4 *)(param_4 + uVar6 * 4) = 0xffffffff;

          uVar6 = uVar6 + 1;

        } while (uVar6 < *(uint *)(param_1 + 0x23c));

      }

      param_5 = (int *)0x0;

      local_10 = 0;

      if (uVar10 != 0) {

        do {

          if (*(int *)((int)local_8 + (int)param_5 * 4) == 0) break;

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

        } while (param_5 < uVar10);

      }

      local_18 = 0;

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

        do {

          iVar9 = *(int *)(param_3 + local_18 * 4);

          if (iVar9 != -1) {

            uVar6 = *(uint *)(*(int *)(param_1 + 0x254) + iVar9 * 4);

            if ((uVar6 != local_10) && (param_5 = (int *)0x0, local_10 = uVar6, uVar10 != 0)) {

              do {

                if (*(uint *)((int)local_8 + (int)param_5 * 4) == uVar6) break;

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

              } while (param_5 < uVar10);

            }

            iVar9 = iVar9 * 0xc;

            local_20 = (void *)0x3;

            do {

              puVar1 = (uint *)(param_4 + *(int *)(iVar9 + *(int *)(param_1 + 0x24c)) * 4);

              if (*puVar1 == 0xffffffff) {

                *puVar1 = (uint)param_5;

                local_c[(int)param_5 * 4 + 2] = local_c[(int)param_5 * 4 + 2] + 1;

              }

              iVar9 = iVar9 + 4;

              local_20 = (void *)((int)local_20 + -1);

            } while (local_20 != (void *)0x0);

            local_c[(int)param_5 * 4] = local_c[(int)param_5 * 4] + 1;

          }

          local_18 = local_18 + 1;

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

      }

      local_20 = *(void **)(param_1 + 0x25c);

      *(uint *)(param_1 + 0x260) = uVar10;

      iVar9 = FUN_005df0f5(uVar10 * 0x14);

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

      if (iVar9 != 0) {

        local_18 = 0;

        local_10 = 0;

        param_5 = (int *)0x0;

        uVar6 = 0;

        if (uVar10 != 0) {

          iVar9 = 0;

          piVar7 = local_c + 2;

          do {

            piVar7[-1] = local_18;

            *(undefined4 *)(iVar9 + *(int *)(param_1 + 0x25c)) =

                 *(undefined4 *)((int)local_8 + (int)param_5 * 4);

            *(uint *)(*(int *)(param_1 + 0x25c) + 4 + iVar9) = local_18;

            *(int *)(*(int *)(param_1 + 0x25c) + 8 + iVar9) = piVar7[-2];

            local_18 = local_18 + piVar7[-2];

            iVar9 = iVar9 + 0x14;

            piVar7[1] = local_10;

            *(uint *)(*(int *)(param_1 + 0x25c) + -8 + iVar9) = local_10;

            *(int *)(*(int *)(param_1 + 0x25c) + -4 + iVar9) = *piVar7;

            local_10 = local_10 + *piVar7;

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

            piVar7 = piVar7 + 4;

            uVar6 = local_14;

          } while (param_5 < local_14);

        }

        local_10 = 0;

        param_5 = (int *)0x0;

        if (uVar6 != 0) {

          do {

            if (*(int *)((int)local_8 + (int)param_5 * 4) == 0) break;

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

          } while (param_5 < uVar6);

        }

        uVar10 = 0;

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

          do {

            iVar9 = *(int *)(param_3 + uVar10 * 4);

            if (iVar9 != -1) {

              iVar9 = iVar9 * 4;

              uVar4 = *(uint *)(iVar9 + *(int *)(param_1 + 0x254));

              if ((uVar4 != local_10) && (param_5 = (int *)0x0, local_10 = uVar4, uVar6 != 0)) {

                do {

                  if (*(uint *)((int)local_8 + (int)param_5 * 4) == uVar4) break;

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

                } while (param_5 < local_14);

              }

              piVar7 = local_c + (int)param_5 * 4 + 1;

              *(int *)(iVar9 + param_2) = *piVar7;

              *piVar7 = *piVar7 + 1;

              uVar6 = local_14;

            }

            uVar10 = uVar10 + 1;

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

        }

        if (uVar5 == 0) {

          uVar5 = 0;

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

            do {

              piVar7 = (int *)(param_4 + uVar5 * 4);

              iVar9 = *piVar7;

              if (iVar9 != -1) {

                piVar2 = local_c + iVar9 * 4 + 3;

                *piVar7 = *piVar2;

                *piVar2 = *piVar2 + 1;

              }

              uVar5 = uVar5 + 1;

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

          }

        }

        else {

          uVar5 = 0;

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

            do {

              *(uint *)(param_4 + uVar5 * 4) = uVar5;

              uVar5 = uVar5 + 1;

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

          }

        }

        uVar5 = 0;

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

          do {

            *(undefined4 *)(param_3 + uVar5 * 4) = 0xffffffff;

            uVar5 = uVar5 + 1;

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

        }

        uVar5 = 0;

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

          do {

            iVar9 = *(int *)(param_2 + uVar5 * 4);

            if (iVar9 != -1) {

              *(uint *)(param_3 + iVar9 * 4) = uVar5;

            }

            uVar5 = uVar5 + 1;

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

        }

        if (uVar3 == 0) {

          if (uVar6 != 0) {

            local_14 = 0;

            local_10 = uVar6;

            do {

              iVar9 = local_14 + *(int *)(param_1 + 0x25c);

              uVar3 = *(uint *)(iVar9 + 4);

              uVar5 = *(uint *)(param_4 +

                               *(int *)(*(int *)(param_1 + 0x24c) +

                                       *(int *)(param_3 + uVar3 * 4) * 0xc) * 4);

              uVar10 = *(int *)(iVar9 + 8) + uVar3;

              local_1c = uVar5;

              for (; uVar3 < uVar10; uVar3 = uVar3 + 1) {

                param_5 = (int *)(*(int *)(param_1 + 0x24c) + *(int *)(param_3 + uVar3 * 4) * 0xc);

                local_18 = 3;

                do {

                  uVar6 = *(uint *)(param_4 + *param_5 * 4);

                  if (uVar6 < local_1c) {

                    local_1c = uVar6;

                  }

                  if (uVar5 < uVar6) {

                    uVar5 = uVar6;

                  }

                  param_5 = param_5 + 1;

                  local_18 = local_18 + -1;

                } while (local_18 != 0);

              }

              *(uint *)(iVar9 + 0xc) = local_1c;

              *(uint *)(local_14 + 0x10 + *(int *)(param_1 + 0x25c)) = (uVar5 - local_1c) + 1;

              local_14 = local_14 + 0x14;

              local_10 = local_10 - 1;

            } while (local_10 != 0);

          }

        }

        else if (uVar6 != 0) {

          iVar9 = 0;

          puVar8 = (undefined4 *)((int)local_20 + 0x10);

          do {

            *(undefined4 *)(iVar9 + 0xc + *(int *)(param_1 + 0x25c)) = puVar8[-1];

            *(undefined4 *)(iVar9 + 0x10 + *(int *)(param_1 + 0x25c)) = *puVar8;

            iVar9 = iVar9 + 0x14;

            puVar8 = puVar8 + 5;

            uVar6 = uVar6 - 1;

          } while (uVar6 != 0);

        }

        *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x10;

        goto LAB_005e6fbe;

      }

    }

  }

  else {

    uVar10 = *(uint *)(param_1 + 0x260);

    local_14 = uVar10;

    local_8 = (void *)FUN_005df0f5(uVar10 << 2);

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

      uVar6 = 0;

      if (uVar10 != 0) {

        iVar9 = 0;

        do {

          *(undefined4 *)((int)local_8 + uVar6 * 4) =

               *(undefined4 *)(iVar9 + *(int *)(param_1 + 0x25c));

          uVar6 = uVar6 + 1;

          iVar9 = iVar9 + 0x14;

        } while (uVar6 < uVar10);

      }

      goto LAB_005e6c0b;

    }

  }

  local_24 = -0x7ff8fff2;

LAB_005e6fbe:

  operator_delete(local_c);

  operator_delete(local_8);

  operator_delete(local_20);

  if (local_24 < 0) {

    *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) & 0xffffffef;

    operator_delete(*(void **)(param_1 + 0x25c));

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

  }

  return local_24;

}





// --- FUN_005e6ffd at 0x005E6FFD (size: 117) ---


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



{

  int *piVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  undefined4 local_8;

  

  uVar5 = 0;

  uVar4 = 0;

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

    do {

      *(undefined4 *)(param_3 + uVar4 * 4) = 0xffffffff;

      uVar4 = uVar4 + 1;

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

  }

  local_8 = 0;

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

    do {

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

      if (iVar2 != -1) {

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

        uVar4 = 0;

        do {

          piVar1 = (int *)(param_3 + *(int *)(iVar3 + iVar2 * 0xc + uVar4 * 4) * 4);

          if (*piVar1 == -1) {

            *piVar1 = local_8;

            local_8 = local_8 + 1;

          }

          uVar4 = uVar4 + 1;

        } while (uVar4 < 3);

      }

      uVar5 = uVar5 + 1;

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

  }

  return 0;

}





// --- FUN_005e7072 at 0x005E7072 (size: 147) ---


undefined4 FUN_005e7072(undefined4 *param_1,undefined4 *param_2,uint *param_3,uint *param_4)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  uint uVar4;

  

  puVar1 = (undefined4 *)*param_1;

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

    puVar2 = (undefined4 *)FUN_005df0f5(8);

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

      return 0;

    }

    *param_3 = 0;

    *param_4 = 2;

  }

  else {

    puVar2 = puVar1;

    if (*param_3 == *param_4) {

      puVar2 = (undefined4 *)FUN_005df0f5(*param_4 << 3);

      uVar4 = 0;

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

        return 0;

      }

      if (*param_3 != 0) {

        puVar3 = puVar2;

        do {

          *puVar3 = *(undefined4 *)(((int)puVar1 - (int)puVar2) + (int)puVar3);

          uVar4 = uVar4 + 1;

          puVar3 = puVar3 + 1;

        } while (uVar4 < *param_3);

      }

      *param_4 = *param_4 << 1;

      operator_delete(puVar1);

    }

  }

  puVar2[*param_3] = *param_2;

  *param_3 = *param_3 + 1;

  *param_1 = puVar2;

  return 1;

}





// --- FUN_005e7105 at 0x005E7105 (size: 150) ---


undefined4 FUN_005e7105(undefined4 *param_1,undefined2 *param_2,uint *param_3,uint *param_4)



{

  undefined2 *puVar1;

  undefined2 *puVar2;

  undefined2 *puVar3;

  uint uVar4;

  

  puVar1 = (undefined2 *)*param_1;

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

    puVar2 = (undefined2 *)FUN_005df0f5(4);

    if (puVar2 == (undefined2 *)0x0) {

      return 0;

    }

    *param_3 = 0;

    *param_4 = 2;

  }

  else {

    puVar2 = puVar1;

    if (*param_3 == *param_4) {

      puVar2 = (undefined2 *)FUN_005df0f5(*param_4 << 2);

      uVar4 = 0;

      if (puVar2 == (undefined2 *)0x0) {

        return 0;

      }

      if (*param_3 != 0) {

        puVar3 = puVar2;

        do {

          *puVar3 = *(undefined2 *)(((int)puVar1 - (int)puVar2) + (int)puVar3);

          uVar4 = uVar4 + 1;

          puVar3 = puVar3 + 1;

        } while (uVar4 < *param_3);

      }

      *param_4 = *param_4 << 1;

      operator_delete(puVar1);

    }

  }

  puVar2[*param_3] = *param_2;

  *param_3 = *param_3 + 1;

  *param_1 = puVar2;

  return 1;

}





// --- FUN_005e719b at 0x005E719B (size: 84) ---


uint * FUN_005e719b(uint *param_1,ushort *param_2,int param_3)



{

  uint uVar1;

  uint uVar2;

  

  uVar2 = (uint)*(ushort *)

                 (*(int *)(param_3 + 4) +

                 ((*(int *)(param_2 + 2) + 2U) % 3 + (uint)*param_2 * 3) * 2);

  uVar1 = 0xffff;

  if (uVar2 != 0xffff) {

    uVar1 = FUN_005e6054(*(int *)(param_3 + 4) + uVar2 * 6,*param_2);

  }

  *param_1 = uVar2;

  param_1[1] = uVar1;

  return param_1;

}





// --- FUN_005e71ef at 0x005E71EF (size: 76) ---


void FUN_005e71ef(int *param_1,int *param_2,int param_3)



{

  int iVar1;

  int iVar2;

  

  iVar1 = *(int *)(*(int *)(param_3 + 4) + ((param_2[1] + 2U) % 3 + *param_2 * 3) * 4);

  if (iVar1 == -1) {

    iVar2 = -1;

  }

  else {

    iVar2 = FUN_005e61b3(*(int *)(param_3 + 4) + iVar1 * 0xc,*param_2);

  }

  *param_1 = iVar1;

  param_1[1] = iVar2;

  return;

}





// --- FUN_005e723b at 0x005E723B (size: 36) ---


void FUN_005e723b(undefined4 *param_1,undefined4 *param_2)



{

  int iVar1;

  

  iVar1 = param_2[1];

  *param_1 = *param_2;

  param_1[1] = (iVar1 + 2U) % 3;

  return;

}





// --- FUN_005e725f at 0x005E725F (size: 43) ---


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



{

  ushort *puVar1;

  

  if ((*(byte *)(param_1 + 0x218) & 2) != 0) {

    puVar1 = (ushort *)(*(int *)(param_1 + 0x244) + param_2 * 2);

    *puVar1 = *(ushort *)(param_3 + (uint)*puVar1 * 4);

  }

  return;

}





// --- FUN_005e728a at 0x005E728A (size: 112) ---


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



{

  short *psVar1;

  int iVar2;

  ushort *puVar3;

  int iVar4;

  

  psVar1 = (short *)(*(int *)(param_1 + 0x24c) + param_2 * 6);

  puVar3 = (ushort *)(*(int *)(param_1 + 0x250) + param_2 * 6);

  if (*psVar1 != -1) {

    iVar2 = (int)psVar1 - (int)puVar3;

    iVar4 = 3;

    do {

      *(undefined2 *)(iVar2 + (int)puVar3) =

           *(undefined2 *)(param_3 + (uint)*(ushort *)(iVar2 + (int)puVar3) * 4);

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

        if (*puVar3 == 0xffff) {

          *puVar3 = 0xffff;

        }

        else {

          *puVar3 = *(ushort *)(param_4 + (uint)*puVar3 * 4);

        }

      }

      puVar3 = puVar3 + 1;

      iVar4 = iVar4 + -1;

    } while (iVar4 != 0);

  }

  return;

}





// --- FUN_005e72fa at 0x005E72FA (size: 177) ---


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

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



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



{

  undefined2 *puVar1;

  undefined2 uVar2;

  int iVar3;

  undefined4 *puVar4;

  uint uVar5;

  uint uVar6;

  undefined4 *puVar7;

  undefined4 *puVar8;

  undefined4 *puVar9;

  

  iVar3 = -(*(int *)(param_1 + 0x238) + 3U & 0xfffffffc);

  uVar6 = *(uint *)(param_1 + 0x238);

  puVar7 = (undefined4 *)(uVar6 * param_3 + param_4);

  puVar4 = (undefined4 *)(uVar6 * param_2 + param_4);

  puVar8 = puVar7;

  puVar9 = (undefined4 *)(&stack0xffffffec + iVar3);

  for (uVar5 = uVar6 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {

    *puVar9 = *puVar8;

    puVar8 = puVar8 + 1;

    puVar9 = puVar9 + 1;

  }

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

    *(undefined1 *)puVar9 = *(undefined1 *)puVar8;

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

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

  }

  uVar6 = *(uint *)(param_1 + 0x238);

  puVar8 = puVar4;

  for (uVar5 = uVar6 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {

    *puVar7 = *puVar8;

    puVar8 = puVar8 + 1;

    puVar7 = puVar7 + 1;

  }

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

    *(undefined1 *)puVar7 = *(undefined1 *)puVar8;

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

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

  }

  uVar6 = *(uint *)(param_1 + 0x238);

  puVar8 = (undefined4 *)(&stack0xffffffec + iVar3);

  for (uVar5 = uVar6 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {

    *puVar4 = *puVar8;

    puVar8 = puVar8 + 1;

    puVar4 = puVar4 + 1;

  }

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

    *(undefined1 *)puVar4 = *(undefined1 *)puVar8;

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

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

  }

  if ((*(byte *)(param_1 + 0x218) & 2) != 0) {

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

    puVar1 = (undefined2 *)(iVar3 + param_3 * 2);

    uVar2 = *puVar1;

    *puVar1 = *(undefined2 *)(param_2 * 2 + iVar3);

    *(undefined2 *)(param_2 * 2 + *(int *)(param_1 + 0x244)) = uVar2;

  }

  return;

}





// --- FUN_005e73ab at 0x005E73AB (size: 257) ---


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



{

  undefined4 *puVar1;

  undefined2 uVar2;

  undefined4 uVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  undefined2 *puVar7;

  undefined2 *puVar8;

  int local_8;

  

  puVar8 = (undefined2 *)(*(int *)(param_1 + 0x24c) + param_2 * 6);

  iVar4 = (*(int *)(param_1 + 0x24c) + param_3 * 6) - (int)puVar8;

  iVar5 = (*(int *)(param_1 + 0x250) + param_3 * 6) - (int)puVar8;

  iVar6 = (param_2 * 6 + *(int *)(param_1 + 0x250)) - (int)puVar8;

  local_8 = 3;

  do {

    puVar7 = (undefined2 *)(iVar4 + (int)puVar8);

    uVar2 = *puVar7;

    *puVar7 = *puVar8;

    *puVar8 = uVar2;

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

      puVar7 = (undefined2 *)(iVar5 + (int)puVar8);

      uVar2 = *puVar7;

      *puVar7 = *(undefined2 *)(iVar6 + (int)puVar8);

      *(undefined2 *)(iVar6 + (int)puVar8) = uVar2;

    }

    puVar8 = puVar8 + 1;

    local_8 = local_8 + -1;

  } while (local_8 != 0);

  if ((*(byte *)(param_1 + 0x218) & 4) != 0) {

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

    puVar1 = (undefined4 *)(iVar4 + param_3 * 4);

    uVar3 = *puVar1;

    *puVar1 = *(undefined4 *)(iVar4 + param_2 * 4);

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

  }

  if ((*(byte *)(param_1 + 0x218) & 8) != 0) {

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

    puVar8 = (undefined2 *)(iVar4 + param_3 * 2);

    uVar2 = *puVar8;

    *puVar8 = *(undefined2 *)(param_2 * 2 + iVar4);

    *(undefined2 *)(param_2 * 2 + *(int *)(param_1 + 600)) = uVar2;

  }

  return;

}





// --- FUN_005e74ac at 0x005E74AC (size: 142) ---


void __thiscall FUN_005e74ac(int param_1,ushort param_2)



{

  ushort uVar1;

  ushort uVar2;

  int iVar3;

  int iVar4;

  

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

  iVar4 = (uint)param_2 * 6;

  if (*(short *)(iVar3 + 2 + iVar4) == -1) {

    uVar1 = *(ushort *)(iVar3 + iVar4 + 4);

    *(ushort *)(param_1 + 8 + (uint)*(byte *)(iVar3 + iVar4 + 1) * 2) = uVar1;

    if (uVar1 != 0xffff) {

      *(undefined2 *)(*(int *)(param_1 + 0x10) + 2 + (uint)uVar1 * 6) = 0xffff;

    }

  }

  else {

    uVar1 = *(ushort *)(iVar3 + 2 + iVar4);

    uVar2 = *(ushort *)(iVar3 + 4 + iVar4);

    *(ushort *)(iVar3 + 4 + (uint)uVar1 * 6) = uVar2;

    if (uVar2 != 0xffff) {

      *(ushort *)(*(int *)(param_1 + 0x10) + 2 + (uint)uVar2 * 6) = uVar1;

    }

  }

  *(undefined2 *)(*(int *)(param_1 + 0x10) + 4 + iVar4) = 0xffff;

  *(undefined2 *)(*(int *)(param_1 + 0x10) + 2 + iVar4) = 0xffff;

  return;

}





// --- FUN_005e753a at 0x005E753A (size: 81) ---


void __thiscall FUN_005e753a(int param_1,ushort param_2)



{

  ushort *puVar1;

  ushort uVar2;

  int iVar3;

  

  iVar3 = *(int *)(param_1 + 0x10) + (uint)param_2 * 6;

  puVar1 = (ushort *)(param_1 + 8 + (uint)*(byte *)(iVar3 + 1) * 2);

  uVar2 = *puVar1;

  *(ushort *)(iVar3 + 4) = uVar2;

  if (uVar2 != 0xffff) {

    *(ushort *)(*(int *)(param_1 + 0x10) + 2 + (uint)uVar2 * 6) = param_2;

  }

  *puVar1 = param_2;

  *(undefined2 *)(*(int *)(param_1 + 0x10) + 2 + (uint)param_2 * 6) = 0xffff;

  return;

}





// --- FUN_005e758b at 0x005E758B (size: 54) ---


void __thiscall FUN_005e758b(int param_1,short param_2)



{

  char *pcVar1;

  ushort uVar2;

  

  uVar2 = param_2 - *(short *)(param_1 + 0x14);

  FUN_005e74ac(uVar2);

  pcVar1 = (char *)(*(int *)(param_1 + 0x10) + 1 + (uint)uVar2 * 6);

  *pcVar1 = *pcVar1 + -1;

  FUN_005e753a(uVar2);

  return;

}





// --- FUN_005e75c1 at 0x005E75C1 (size: 40) ---


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



{

  int *piVar1;

  

  if ((*(byte *)(param_1 + 0x218) & 2) != 0) {

    piVar1 = (int *)(*(int *)(param_1 + 0x244) + param_2 * 4);

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

  }

  return;

}





// --- FUN_005e75e9 at 0x005E75E9 (size: 99) ---


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



{

  int *piVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  

  piVar1 = (int *)(*(int *)(param_1 + 0x24c) + param_2 * 0xc);

  piVar3 = (int *)(*(int *)(param_1 + 0x250) + param_2 * 0xc);

  if (*piVar1 != -1) {

    iVar2 = (int)piVar1 - (int)piVar3;

    iVar4 = 3;

    do {

      *(undefined4 *)(iVar2 + (int)piVar3) =

           *(undefined4 *)(param_3 + *(int *)(iVar2 + (int)piVar3) * 4);

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

        if (*piVar3 == -1) {

          *piVar3 = -1;

        }

        else {

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

        }

      }

      piVar3 = piVar3 + 1;

      iVar4 = iVar4 + -1;

    } while (iVar4 != 0);

  }

  return;

}





// --- FUN_005e764c at 0x005E764C (size: 174) ---


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

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



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



{

  int iVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  uint uVar4;

  uint uVar5;

  undefined4 *puVar6;

  undefined4 *puVar7;

  undefined4 *puVar8;

  

  iVar1 = -(*(int *)(param_1 + 0x238) + 3U & 0xfffffffc);

  uVar5 = *(uint *)(param_1 + 0x238);

  puVar6 = (undefined4 *)(uVar5 * param_3 + param_4);

  puVar3 = (undefined4 *)(uVar5 * param_2 + param_4);

  puVar7 = puVar6;

  puVar8 = (undefined4 *)(&stack0xffffffec + iVar1);

  for (uVar4 = uVar5 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar8 = *puVar7;

    puVar7 = puVar7 + 1;

    puVar8 = puVar8 + 1;

  }

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

    *(undefined1 *)puVar8 = *(undefined1 *)puVar7;

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

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

  }

  uVar5 = *(uint *)(param_1 + 0x238);

  puVar7 = puVar3;

  for (uVar4 = uVar5 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = *puVar7;

    puVar7 = puVar7 + 1;

    puVar6 = puVar6 + 1;

  }

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

    *(undefined1 *)puVar6 = *(undefined1 *)puVar7;

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

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

  }

  uVar5 = *(uint *)(param_1 + 0x238);

  puVar7 = (undefined4 *)(&stack0xffffffec + iVar1);

  for (uVar4 = uVar5 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar3 = *puVar7;

    puVar7 = puVar7 + 1;

    puVar3 = puVar3 + 1;

  }

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

    *(undefined1 *)puVar3 = *(undefined1 *)puVar7;

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

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

  }

  if ((*(byte *)(param_1 + 0x218) & 2) != 0) {

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

    puVar7 = (undefined4 *)(iVar1 + param_3 * 4);

    uVar2 = *puVar7;

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

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

  }

  return;

}





// --- FUN_005e76fa at 0x005E76FA (size: 248) ---


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



{

  undefined2 *puVar1;

  undefined2 uVar2;

  undefined4 uVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  undefined4 *puVar7;

  undefined4 *puVar8;

  int local_8;

  

  puVar8 = (undefined4 *)(*(int *)(param_1 + 0x24c) + param_2 * 0xc);

  iVar4 = (*(int *)(param_1 + 0x24c) + param_3 * 0xc) - (int)puVar8;

  iVar5 = (*(int *)(param_1 + 0x250) + param_3 * 0xc) - (int)puVar8;

  iVar6 = (param_2 * 0xc + *(int *)(param_1 + 0x250)) - (int)puVar8;

  local_8 = 3;

  do {

    puVar7 = (undefined4 *)(iVar4 + (int)puVar8);

    uVar3 = *puVar7;

    *puVar7 = *puVar8;

    *puVar8 = uVar3;

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

      puVar7 = (undefined4 *)(iVar5 + (int)puVar8);

      uVar3 = *puVar7;

      *puVar7 = *(undefined4 *)(iVar6 + (int)puVar8);

      *(undefined4 *)(iVar6 + (int)puVar8) = uVar3;

    }

    puVar8 = puVar8 + 1;

    local_8 = local_8 + -1;

  } while (local_8 != 0);

  if ((*(byte *)(param_1 + 0x218) & 4) != 0) {

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

    puVar8 = (undefined4 *)(iVar4 + param_3 * 4);

    uVar3 = *puVar8;

    *puVar8 = *(undefined4 *)(iVar4 + param_2 * 4);

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

  }

  if ((*(byte *)(param_1 + 0x218) & 8) != 0) {

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

    puVar1 = (undefined2 *)(iVar4 + param_3 * 2);

    uVar2 = *puVar1;

    *puVar1 = *(undefined2 *)(param_2 * 2 + iVar4);

    *(undefined2 *)(param_2 * 2 + *(int *)(param_1 + 600)) = uVar2;

  }

  return;

}





// --- FUN_005e77f2 at 0x005E77F2 (size: 116) ---


void __thiscall FUN_005e77f2(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

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

  param_2 = param_2 * 0xc;

  if (*(int *)(iVar1 + 4 + param_2) == -1) {

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

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

    *(int *)(param_1 + 8 + (uint)*(byte *)(iVar3 + 1) * 4) = iVar1;

    if (iVar1 != -1) {

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

    }

  }

  else {

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

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

    *(int *)(iVar1 + 8 + iVar3 * 0xc) = iVar2;

    if (iVar2 != -1) {

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

    }

  }

  *(undefined4 *)(*(int *)(param_1 + 0x18) + 8 + param_2) = 0xffffffff;

  *(undefined4 *)(*(int *)(param_1 + 0x18) + 4 + param_2) = 0xffffffff;

  return;

}





// --- FUN_005e7866 at 0x005E7866 (size: 68) ---


void __thiscall FUN_005e7866(int param_1,int param_2)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  

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

  piVar2 = (int *)(param_1 + 8 + (uint)*(byte *)(iVar1 + 1) * 4);

  iVar3 = *piVar2;

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

  if (iVar3 != -1) {

    *(int *)(*(int *)(param_1 + 0x18) + 4 + iVar3 * 0xc) = param_2;

  }

  *piVar2 = param_2;

  *(undefined4 *)(*(int *)(param_1 + 0x18) + 4 + param_2 * 0xc) = 0xffffffff;

  return;

}





// --- FUN_005e78aa at 0x005E78AA (size: 47) ---


void __thiscall FUN_005e78aa(int param_1,int param_2)



{

  char *pcVar1;

  

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

  FUN_005e77f2(param_2);

  pcVar1 = (char *)(*(int *)(param_1 + 0x18) + 1 + param_2 * 0xc);

  *pcVar1 = *pcVar1 + -1;

  FUN_005e7866(param_2);

  return;

}





// --- FUN_005e78d9 at 0x005E78D9 (size: 31) ---


undefined4 __thiscall FUN_005e78d9(int param_1,ushort param_2)



{

  int iVar1;

  

  iVar1 = (uint)param_2 - (uint)*(ushort *)(param_1 + 0x14);

  return CONCAT22((short)((uint)(iVar1 * 3) >> 0x10),

                  (ushort)*(byte *)(*(int *)(param_1 + 0x10) + 1 + iVar1 * 6));

}





// --- FUN_005e78f8 at 0x005E78F8 (size: 400) ---


float10 FUN_005e78f8(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6,

                    int param_7,int param_8)



{

  float *pfVar1;

  float *pfVar2;

  float *pfVar3;

  float *pfVar4;

  float *pfVar5;

  float10 fVar6;

  float local_34;

  float local_30;

  float local_2c;

  float local_28;

  float local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_c;

  float local_8;

  

  if (param_7 == 0) {

    fVar6 = (float10)DAT_00796344;

  }

  else {

    pfVar1 = (float *)(param_1 * param_8 + param_7);

    pfVar2 = (float *)(param_2 * param_8 + param_7);

    pfVar3 = (float *)(param_3 * param_8 + param_7);

    pfVar4 = (float *)(param_4 * param_8 + param_7);

    local_10 = *pfVar1 - *pfVar2;

    local_c = pfVar1[1] - pfVar2[1];

    local_8 = pfVar1[2] - pfVar2[2];

    pfVar2 = (float *)(param_5 * param_8 + param_7);

    local_1c = *pfVar1 - *pfVar3;

    pfVar5 = (float *)(param_6 * param_8 + param_7);

    local_18 = pfVar1[1] - pfVar3[1];

    local_14 = pfVar1[2] - pfVar3[2];

    local_34 = local_14 * local_c - local_18 * local_8;

    local_30 = local_8 * local_1c - local_14 * local_10;

    local_2c = local_18 * local_10 - local_c * local_1c;

    local_28 = local_34;

    local_24 = local_30;

    local_20 = local_2c;

    thunk_FUN_005e06f5(&local_34,&local_34);

    local_10 = *pfVar4 - *pfVar2;

    local_c = pfVar4[1] - pfVar2[1];

    local_8 = pfVar4[2] - pfVar2[2];

    local_1c = *pfVar4 - *pfVar5;

    local_18 = pfVar4[1] - pfVar5[1];

    local_14 = pfVar4[2] - pfVar5[2];

    local_28 = local_14 * local_c - local_18 * local_8;

    local_24 = local_8 * local_1c - local_14 * local_10;

    local_20 = local_18 * local_10 - local_c * local_1c;

    thunk_FUN_005e06f5(&local_28,&local_28);

    fVar6 = (float10)local_28 * (float10)local_34 +

            (float10)local_24 * (float10)local_30 + (float10)local_20 * (float10)local_2c;

  }

  return fVar6;

}





// --- FUN_005e7a88 at 0x005E7A88 (size: 223) ---


void FUN_005e7a88(uint param_1,uint param_2,undefined4 param_3,uint *param_4,uint param_5,

                 uint param_6,undefined4 param_7,undefined4 param_8)



{

  uint *puVar1;

  uint *puVar2;

  uint *puVar3;

  uint *puVar4;

  float10 fVar5;

  float10 fVar6;

  uint *local_8;

  

  puVar1 = (uint *)((int)param_4 + (param_1 % param_5) * 4);

  param_5 = param_6;

  puVar2 = (uint *)*puVar1;

  local_8 = (uint *)0x0;

  do {

    puVar4 = puVar2;

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

LAB_005e7acb:

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

        puVar2 = (uint *)puVar4[4];

        param_4 = puVar4;

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

          if ((puVar3[1] == param_2) && (*puVar3 == param_1)) {

            fVar5 = (float10)FUN_005e78f8(*puVar4,puVar4[1],puVar4[2],param_2,param_1,param_3,

                                          param_7,param_8);

            fVar6 = (float10)FUN_005e78f8(*puVar3,puVar3[1],puVar3[2],param_2,param_1,param_3,

                                          param_7,param_8);

            if ((float10)(float)fVar5 < fVar6) {

              local_8 = param_4;

              param_5 = puVar3[3];

              puVar4 = puVar3;

            }

          }

          param_4 = puVar3;

          puVar2 = (uint *)puVar3[4];

        }

      }

      if (param_5 != param_6) {

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

          *puVar1 = puVar4[4];

        }

        else {

          local_8[4] = puVar4[4];

        }

      }

      return;

    }

    if ((puVar4[1] == param_2) && (*puVar4 == param_1)) {

      param_5 = puVar4[3];

      goto LAB_005e7acb;

    }

    puVar2 = (uint *)puVar4[4];

    local_8 = puVar4;

  } while( true );

}





// --- FUN_005e7b67 at 0x005E7B67 (size: 379) ---


undefined4 FUN_005e7b67(uint param_1,undefined4 *param_2)



{

  uint uVar1;

  uint uVar2;

  undefined4 uVar3;

  int iVar4;

  undefined4 uVar5;

  undefined4 *puVar6;

  uint uVar7;

  byte local_53;

  uint local_1c;

  uint local_18;

  undefined4 local_c;

  undefined4 local_8;

  

  FUN_005e5206(param_1);

  uVar2 = 0;

  local_c = 0;

  local_8 = 0;

  if (((param_1 & 0x6001) == 0) && ((param_1 & 0xf00) < 0x801)) {

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

      if ((param_1 & 0x400e) == 4) {

        uVar5 = 3;

        uVar3 = 9;

      }

      else {

        uVar5 = 2;

        uVar3 = 0;

      }

      FUN_005e4f5d(param_2,uVar3,uVar5,&local_8,0);

      param_2 = param_2 + 2;

    }

    if (local_1c != 0) {

      if ((local_53 & 0x90) == 0) {

        if (local_1c == 5) {

          return 0x8876086c;

        }

        iVar4 = local_1c - 1;

        uVar3 = 1;

      }

      else {

        if (1 < local_1c) {

          FUN_005e4f5d(param_2,1,local_1c - 2,&local_8,0);

          param_2 = param_2 + 2;

        }

        if ((local_53 & 0x10) == 0) {

          iVar4 = 4;

        }

        else {

          iVar4 = 5;

        }

        uVar3 = 2;

      }

      FUN_005e4f5d(param_2,uVar3,iVar4,&local_8,0);

      param_2 = param_2 + 2;

    }

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

      FUN_005e4f5d(param_2,3,2,&local_8,0);

      param_2 = param_2 + 2;

    }

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

      FUN_005e4f5d(param_2,4,0,&local_8,0);

      param_2 = param_2 + 2;

    }

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

      FUN_005e4f5d(param_2,10,4,&local_8,0);

      param_2 = param_2 + 2;

    }

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

      FUN_005e4f5d(param_2,10,4,&local_8,1);

      param_2 = param_2 + 2;

    }

    if (local_18 != 0) {

      do {

        puVar6 = &local_8;

        uVar7 = uVar2;

        uVar1 = FUN_005e52d6(uVar2);

        FUN_005e4f5d(param_2,5,(uVar1 >> 2) - 1,puVar6,uVar7);

        param_2 = param_2 + 2;

        uVar2 = uVar2 + 1;

      } while (uVar2 < local_18);

    }

    *param_2 = 0xff;

    param_2[1] = 0x11;

  }

  else {

    local_c = 0x8876086c;

  }

  return local_c;

}





// --- FUN_005e7ce2 at 0x005E7CE2 (size: 81) ---


int __thiscall FUN_005e7ce2(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  FUN_005ff8f4();

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

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

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

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

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

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

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

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

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

  FUN_005e539a(param_2);

  return param_1;

}





// --- FUN_005e7d33 at 0x005E7D33 (size: 139) ---


int __thiscall FUN_005e7d33(int param_1,short *param_2,undefined4 param_3)



{

  short *psVar1;

  int iVar2;

  short *psVar3;

  

  FUN_005e7ce2(param_2);

  FUN_005e7ce2(param_3);

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

  if (*param_2 != 0xff) {

    psVar3 = param_2 + 3;

    do {

      iVar2 = FUN_005e52ff((char)*psVar3,*(undefined1 *)((int)psVar3 + 1));

      if (((iVar2 != 0) && (*(char *)((int)psVar3 + -1) != '\x04')) &&

         (*(char *)(iVar2 + 5) != '\x04')) {

        *(short **)(param_1 + 0x18c + *(int *)(param_1 + 0x188) * 4) = psVar3 + -3;

        *(int *)(param_1 + 0x290 + *(int *)(param_1 + 0x188) * 4) = iVar2;

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

      }

      psVar1 = psVar3 + 1;

      psVar3 = psVar3 + 4;

    } while (*psVar1 != 0xff);

  }

  return param_1;

}





// --- FUN_005e7dbe at 0x005E7DBE (size: 388) ---


undefined4 FUN_005e7dbe(int param_1,uint param_2)



{

  int *piVar1;

  uint uVar2;

  int iVar3;

  uint *puVar4;

  uint uVar5;

  undefined4 local_8;

  

  iVar3 = param_1;

  local_8 = 0;

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

    (**(code **)(**(int **)(param_1 + 0x230) + 0x15c))

              (*(int **)(param_1 + 0x230),*(undefined4 *)(param_1 + 8));

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

              (*(int **)(param_1 + 0x230),0,*(undefined4 *)(param_1 + 0x234),0,

               *(undefined4 *)(param_1 + 0x238));

    (**(code **)(**(int **)(param_1 + 0x230) + 0x1a0))

              (*(int **)(param_1 + 0x230),*(undefined4 *)(param_1 + 0x248));

    if ((*(byte *)(param_1 + 0x218) & 0x10) == 0) {

      uVar5 = 0;

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

      param_1 = 0;

      if (*piVar1 != 0) {

        do {

          if (*(uint *)(*(int *)(iVar3 + 0x254) + uVar5 * 4) == param_2) {

            param_1 = param_1 + 1;

          }

          else {

            if (param_1 != 0) {

              (**(code **)(**(int **)(iVar3 + 0x230) + 0x148))

                        (*(int **)(iVar3 + 0x230),4,0,0,*(undefined4 *)(iVar3 + 0x23c),

                         (uVar5 - param_1) * 3,param_1);

            }

            param_1 = 0;

          }

          uVar5 = uVar5 + 1;

        } while (uVar5 < *(uint *)(iVar3 + 0x264));

        if (param_1 != 0) {

          local_8 = (**(code **)(**(int **)(iVar3 + 0x230) + 0x148))

                              (*(int **)(iVar3 + 0x230),4,0,0,*(undefined4 *)(iVar3 + 0x23c),

                               (uVar5 - param_1) * 3,param_1);

        }

      }

    }

    else {

      uVar5 = *(uint *)(param_1 + 0x260);

      if (((uVar5 <= param_2) ||

          (uVar2 = param_2, *(uint *)(*(int *)(param_1 + 0x25c) + param_2 * 0x14) != param_2)) &&

         (uVar2 = 0, uVar5 != 0)) {

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

        do {

          if (*puVar4 == param_2) break;

          uVar2 = uVar2 + 1;

          puVar4 = puVar4 + 5;

        } while (uVar2 < uVar5);

      }

      if (uVar2 < uVar5) {

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

          iVar3 = uVar2 * 0x14 + *(int *)(param_1 + 0x25c);

          local_8 = (**(code **)(**(int **)(param_1 + 0x230) + 0x148))

                              (*(int **)(param_1 + 0x230),4,0,*(undefined4 *)(iVar3 + 0xc),

                               *(undefined4 *)(iVar3 + 0x10),*(int *)(iVar3 + 4) * 3,

                               *(undefined4 *)(iVar3 + 8));

        }

      }

    }

  }

  return local_8;

}





// --- FUN_005e7f42 at 0x005E7F42 (size: 59) ---


void FUN_005e7f42(int *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

                 undefined4 param_5)



{

  int iVar1;

  undefined1 local_20c [520];

  

  iVar1 = FUN_005e7b67(param_3,local_20c);

  if (-1 < iVar1) {

    (**(code **)(*param_1 + 0x30))(param_1,param_2,local_20c,param_4,param_5);

  }

  return;

}





// --- FUN_005e7f7d at 0x005E7F7D (size: 1666) ---


/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */



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



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  undefined4 *puVar6;

  undefined4 *puVar7;

  bool bVar8;

  undefined1 local_5c4 [4];

  undefined4 local_5c0;

  undefined4 local_494;

  undefined4 local_490;

  undefined4 local_48c;

  undefined4 local_488;

  undefined4 local_484;

  int local_480;

  undefined4 local_47c;

  undefined4 local_478;

  undefined4 *local_474;

  int *local_470;

  undefined4 *local_46c;

  undefined4 *local_468;

  undefined4 *local_464;

  int *local_460;

  int *local_45c;

  int *local_458;

  undefined1 local_454 [1064];

  int local_2c;

  uint local_28;

  undefined4 local_8;

  

  local_8 = DAT_00836f40;

  local_490 = *(undefined4 *)(param_1 + 0x268);

  local_494 = *(undefined4 *)(param_1 + 0x240);

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

  local_46c = (undefined4 *)0x0;

  local_468 = (undefined4 *)0x0;

  local_458 = (int *)0x0;

  local_45c = (int *)0x0;

  local_474 = (undefined4 *)0x0;

  local_464 = (undefined4 *)0x0;

  local_470 = (int *)0x0;

  local_48c = local_490;

  local_488 = local_490;

  if (*piVar1 == 0) {

    FUN_005efb7f(1);

    local_460 = (int *)(**(code **)(**(int **)(param_1 + 0x230) + 0x158))

                                 (*(int **)(param_1 + 0x230),param_1 + 0xc,piVar1);

    FUN_005efb7f(0);

    if ((int)local_460 < 0) {

      *piVar1 = 0;

    }

  }

  if ((0xfffe < param_2) || (0xfffe < param_3)) {

    iVar3 = -0x7789f794;

    goto LAB_005e8583;

  }

  if (*(uint *)(param_1 + 0x268) < param_2) {

    iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x6c))

                      (*(int **)(param_1 + 0x230),param_2 * 6,*(undefined4 *)(param_1 + 0x224),0x65,

                       *(undefined4 *)(param_1 + 0x21c),&local_45c,0);

    if (iVar3 < 0) goto LAB_005e8583;

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

      iVar3 = (**(code **)(**(int **)(param_1 + 0x248) + 0x2c))

                        (*(int **)(param_1 + 0x248),0,0,&local_474,0x800);

      if (iVar3 < 0) goto LAB_005e8583;

      iVar3 = (**(code **)(*local_45c + 0x2c))(local_45c,0,0,&local_464,0x800);

      if (iVar3 < 0) goto LAB_005e8583;

      uVar4 = *(int *)(param_1 + 0x264) * 6;

      puVar6 = local_474;

      puVar7 = local_464;

      for (uVar5 = uVar4 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {

        *puVar7 = *puVar6;

        puVar6 = puVar6 + 1;

        puVar7 = puVar7 + 1;

      }

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

        *(undefined1 *)puVar7 = *(undefined1 *)puVar6;

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

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

      }

      uVar4 = (param_2 - *(int *)(param_1 + 0x264)) * 6;

      puVar6 = (undefined4 *)((int)local_464 + *(int *)(param_1 + 0x264) * 6);

      for (uVar5 = uVar4 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {

        *puVar6 = 0;

        puVar6 = puVar6 + 1;

      }

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

        *(undefined1 *)puVar6 = 0;

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

      }

      iVar3 = (**(code **)(*local_45c + 0x30))(local_45c);

      if (iVar3 < 0) goto LAB_005e8583;

      local_464 = (undefined4 *)0x0;

      iVar3 = (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

      if (iVar3 < 0) goto LAB_005e8583;

      local_474 = (undefined4 *)0x0;

    }

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

    piVar2 = (int *)*piVar1;

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

      (**(code **)(*piVar2 + 8))(piVar2);

      *piVar1 = 0;

    }

    piVar2 = local_45c;

    local_45c = (int *)0x0;

    *piVar1 = (int)piVar2;

    *(uint *)(param_1 + 0x268) = param_2;

    if ((*(byte *)(param_1 + 0x218) & 1) == 0) {

LAB_005e81b3:

      if ((*(byte *)(param_1 + 0x218) & 4) != 0) {

        iVar3 = FUN_005e6135((int *)(param_1 + 0x254),param_2,*(undefined4 *)(param_1 + 0x264),

                             &local_488);

        if (iVar3 == 0) goto LAB_005e81a9;

        puVar6 = (undefined4 *)(*(int *)(param_1 + 0x254) + *(int *)(param_1 + 0x264) * 4);

        for (uVar5 = param_2 - *(int *)(param_1 + 0x264) & 0x3fffffff; uVar5 != 0; uVar5 = uVar5 - 1

            ) {

          *puVar6 = 0;

          puVar6 = puVar6 + 1;

        }

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

          *(undefined1 *)puVar6 = 0;

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

        }

      }

      if ((*(byte *)(param_1 + 0x218) & 8) != 0) {

        iVar3 = FUN_005e5fd9(param_1 + 600,param_2,*(undefined4 *)(param_1 + 0x264),&local_490);

        if (iVar3 == 0) goto LAB_005e81a9;

      }

      goto LAB_005e8223;

    }

    iVar3 = FUN_005e5f18(param_1 + 0x250,param_2,*(undefined4 *)(param_1 + 0x264),&local_48c);

    if (iVar3 != 0) goto LAB_005e81b3;

LAB_005e81a9:

    iVar3 = -0x7ff8fff2;

    goto LAB_005e8583;

  }

LAB_005e8223:

  if (*(uint *)(param_1 + 0x240) < param_3) {

    if ((*(byte *)(param_1 + 0x218) & 2) != 0) {

      iVar3 = FUN_005e5fd9(param_1 + 0x244,param_3,*(undefined4 *)(param_1 + 0x23c),&local_494);

      if (iVar3 == 0) goto LAB_005e81a9;

    }

    if ((*(byte *)(param_1 + 0x218) & 0x20) == 0) {

      iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x68))

                        (*(int **)(param_1 + 0x230),*(int *)(param_1 + 0x238) * param_3,

                         *(undefined4 *)(param_1 + 0x228),*(undefined4 *)(param_1 + 4),

                         *(undefined4 *)(param_1 + 0x220),&local_458,0);

      if (iVar3 < 0) goto LAB_005e8583;

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

        iVar3 = (**(code **)(**(int **)(param_1 + 0x234) + 0x2c))

                          (*(int **)(param_1 + 0x234),0,0,&local_46c,0x800);

        if (iVar3 < 0) goto LAB_005e8583;

        iVar3 = (**(code **)(*local_458 + 0x2c))(local_458,0,0,&local_468,0x800);

        if (iVar3 < 0) goto LAB_005e8583;

        uVar4 = *(int *)(param_1 + 0x238) * *(int *)(param_1 + 0x23c);

        puVar6 = local_46c;

        puVar7 = local_468;

        for (uVar5 = uVar4 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {

          *puVar7 = *puVar6;

          puVar6 = puVar6 + 1;

          puVar7 = puVar7 + 1;

        }

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

          *(undefined1 *)puVar7 = *(undefined1 *)puVar6;

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

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

        }

        uVar4 = (param_3 - *(int *)(param_1 + 0x23c)) * *(int *)(param_1 + 0x238);

        puVar6 = (undefined4 *)

                 (*(int *)(param_1 + 0x238) * *(int *)(param_1 + 0x23c) + (int)local_468);

        for (uVar5 = uVar4 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {

          *puVar6 = 0;

          puVar6 = puVar6 + 1;

        }

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

          *(undefined1 *)puVar6 = 0;

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

        }

        iVar3 = (**(code **)(*local_458 + 0x30))(local_458);

        if (iVar3 < 0) goto LAB_005e8583;

        local_468 = (undefined4 *)0x0;

        iVar3 = (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

        if (iVar3 < 0) goto LAB_005e8583;

        local_46c = (undefined4 *)0x0;

      }

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

      piVar2 = (int *)*piVar1;

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

        (**(code **)(*piVar2 + 8))(piVar2);

        *piVar1 = 0;

      }

      piVar2 = local_458;

      local_458 = (int *)0x0;

      *piVar1 = (int)piVar2;

      *(uint *)(param_1 + 0x240) = param_3;

    }

  }

  *(uint *)(param_1 + 0x23c) = param_3;

  *(uint *)(param_1 + 0x264) = param_2;

  iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x1c))(*(int **)(param_1 + 0x230),local_5c4);

  if (iVar3 < 0) goto LAB_005e8583;

  iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x18))(*(int **)(param_1 + 0x230),&local_470);

  if (iVar3 < 0) goto LAB_005e8583;

  if (DAT_008f297c == *(int *)(param_1 + 0x230)) {

    *(undefined4 *)(param_1 + 0x274) = DAT_008f2980;

    *(undefined4 *)(param_1 + 0x278) = DAT_008f2984;

    goto LAB_005e8583;

  }

  iVar3 = (**(code **)(*local_470 + 0x14))(local_470,local_5c0,0,local_454);

  if (iVar3 < 0) goto LAB_005e8583;

  if (((local_2c == 0x1002) && (0x5143 < local_28)) && (local_28 < 0x5148)) {

    local_480 = 0;

    local_47c = 0;

    local_478 = 0;

  }

  else {

    local_484 = 0;

    local_480 = 0;

    local_47c = 0;

    local_478 = 0;

    iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x1d8))(*(int **)(param_1 + 0x230),4,0);

    if (iVar3 < 0) {

LAB_005e84f0:

      local_480 = 1;

      local_47c = 0xc;

      local_478 = 7;

      iVar3 = 0;

    }

    else {

      iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x1d8))

                        (*(int **)(param_1 + 0x230),4,&local_460);

      if (iVar3 < 0) goto LAB_005e84f0;

      iVar3 = (**(code **)(*local_460 + 0x18))(local_460,1);

      if (-1 < iVar3) {

        iVar3 = 1;

        do {

          bVar8 = iVar3 == 0;

          iVar3 = 0;

          if (bVar8) break;

          iVar3 = (**(code **)(*local_460 + 0x1c))(local_460,&local_484,0x10,1);

        } while (-1 < iVar3);

      }

      (**(code **)(*local_460 + 8))(local_460);

      if (iVar3 < 0) goto LAB_005e84f0;

    }

    if (local_480 == 0) {

      local_47c = 0;

      local_478 = 0;

    }

    if (*(uint *)(param_1 + 0x274) < *(uint *)(param_1 + 0x278)) {

      *(uint *)(param_1 + 0x278) = *(uint *)(param_1 + 0x274);

    }

  }

  DAT_008f2980 = local_47c;

  DAT_008f2984 = local_478;

  *(undefined4 *)(param_1 + 0x274) = local_47c;

  DAT_008f297c = *(int *)(param_1 + 0x230);

  *(undefined4 *)(param_1 + 0x278) = local_478;

LAB_005e8583:

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

    (**(code **)(*local_470 + 8))(local_470);

    local_470 = (int *)0x0;

  }

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

    (**(code **)(*local_45c + 0x30))(local_45c);

  }

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

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  }

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

    (**(code **)(*local_458 + 0x30))(local_458);

  }

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

    (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

  }

  return iVar3;

}





// --- FUN_005e85ff at 0x005E85FF (size: 707) ---


undefined1 __thiscall FUN_005e85ff(int param_1,int param_2)



{

  short *psVar1;

  int iVar2;

  uint uVar3;

  ushort uVar4;

  char cVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  uint uVar9;

  uint uVar10;

  uint uVar11;

  ushort *puVar12;

  bool bVar13;

  uint local_18;

  ushort *local_14;

  ushort *local_10;

  int local_c;

  undefined1 local_6;

  char local_5;

  

  local_6 = 0;

  local_5 = '\0';

  iVar2 = param_2;

  if (param_2 == 0) {

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

      iVar6 = FUN_005e549b(&local_c,0x10);

      iVar2 = local_c;

      if (iVar6 < 0) goto LAB_005e88a2;

    }

    else {

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

      iVar2 = param_2;

    }

  }

  local_c = iVar2;

  local_18 = 0;

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

    local_14 = *(ushort **)(param_1 + 0x250);

    puVar12 = (ushort *)(local_c + 2);

    iVar2 = (int)local_14 - local_c;

    do {

      uVar4 = puVar12[-1];

      if (uVar4 == 0xffff) {

        if ((*puVar12 != 0xffff) || (puVar12[1] != 0xffff)) goto LAB_005e88a2;

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

          if (*local_14 != 0xffff) goto LAB_005e88a2;

          psVar1 = (short *)(iVar2 + (int)puVar12);

          if ((*psVar1 != -1) || (psVar1[1] != -1)) goto LAB_005e88a2;

        }

      }

      else {

        uVar3 = *(uint *)(param_1 + 0x218) & 2;

        if (uVar3 == 0) {

          if ((uVar4 == *puVar12) || (*puVar12 == puVar12[1])) goto LAB_005e8732;

          bVar13 = puVar12[1] == uVar4;

LAB_005e8730:

          if (bVar13) goto LAB_005e8732;

        }

        else {

          if (*(short *)((uint)uVar4 * 2 + *(int *)(param_1 + 0x244)) !=

              *(short *)((uint)*puVar12 * 2 + *(int *)(param_1 + 0x244))) {

            iVar6 = *(int *)(param_1 + 0x244);

            if (*(short *)((uint)*puVar12 * 2 + iVar6) != *(short *)((uint)puVar12[1] * 2 + iVar6))

            {

              bVar13 = *(short *)((uint)puVar12[1] * 2 + iVar6) ==

                       *(short *)((uint)uVar4 * 2 + iVar6);

              goto LAB_005e8730;

            }

          }

LAB_005e8732:

          local_5 = '\x01';

        }

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

          uVar7 = 0;

          local_10 = local_14;

          do {

            uVar9 = (uint)*(ushort *)((int)puVar12 + (-2 - (int)local_14) + (int)local_10);

            uVar7 = uVar7 + 1;

            uVar11 = (uint)puVar12[uVar7 % 3 - 1];

            if ((*(uint *)(param_1 + 0x23c) <= uVar9) || (*(uint *)(param_1 + 0x23c) <= uVar11))

            goto LAB_005e88a2;

            if (*local_10 != 0xffff) {

              if (*(uint *)(param_1 + 0x264) <= (uint)*local_10) goto LAB_005e88a2;

              iVar6 = (uint)*local_10 * 6 + local_c;

              uVar8 = FUN_005e6054((uint)*local_10 * 6 + *(int *)(param_1 + 0x250),local_18);

              if (2 < uVar8) goto LAB_005e88a2;

              if (uVar3 != 0) {

                uVar10 = (uint)*(ushort *)(iVar6 + uVar8 * 2);

                uVar8 = (uint)*(ushort *)(iVar6 + ((uVar8 + 1) % 3) * 2);

                iVar6 = *(int *)(param_1 + 0x244);

                if (((*(short *)(uVar9 * 2 + iVar6) != *(short *)(iVar6 + uVar10 * 2)) ||

                    (*(short *)(iVar6 + uVar11 * 2) != *(short *)(iVar6 + uVar8 * 2))) &&

                   ((iVar6 = *(int *)(param_1 + 0x244),

                    *(short *)(iVar6 + uVar11 * 2) != *(short *)(iVar6 + uVar10 * 2) ||

                    (*(short *)(iVar6 + uVar9 * 2) != *(short *)(iVar6 + uVar8 * 2)))))

                goto LAB_005e88a2;

              }

            }

            local_10 = local_10 + 1;

          } while (uVar7 < 3);

        }

      }

      local_18 = local_18 + 1;

      local_14 = local_14 + 3;

      puVar12 = puVar12 + 3;

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

    if (local_5 != '\0') {

      local_6 = 0;

      goto LAB_005e88a2;

    }

  }

  if ((((*(byte *)(param_1 + 0x218) & 0x10) == 0) || (*(int *)(param_1 + 0x25c) == 0)) ||

     (cVar5 = FUN_005e88c2(local_c), cVar5 != '\0')) {

    local_6 = 1;

  }

LAB_005e88a2:

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

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  }

  return local_6;

}





// --- FUN_005e88c2 at 0x005E88C2 (size: 95) ---


undefined4 __fastcall FUN_005e88c2(int param_1)



{

  int *piVar1;

  uint uVar2;

  uint uVar3;

  uint local_8;

  

  local_8 = 0;

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

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

    do {

      uVar3 = piVar1[1];

      uVar2 = piVar1[2] + uVar3;

      for (; uVar3 < uVar2; uVar3 = uVar3 + 1) {

        if (((*(byte *)(param_1 + 0x218) & 4) != 0) &&

           (*(int *)(*(int *)(param_1 + 0x254) + uVar3 * 4) != *piVar1)) {

          return 0;

        }

      }

      local_8 = local_8 + 1;

      piVar1 = piVar1 + 5;

    } while (local_8 < *(uint *)(param_1 + 0x260));

  }

  return 1;

}





// --- FUN_005e8921 at 0x005E8921 (size: 850) ---


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



undefined4 * FUN_005e8921(int param_1,uint param_2)



{

  bool bVar1;

  uint uVar2;

  int *piVar3;

  uint *puVar4;

  int iVar5;

  uint uVar6;

  undefined4 *puVar7;

  undefined4 *puVar8;

  undefined4 *puVar9;

  uint local_18;

  uint local_10;

  int local_c;

  undefined4 *local_8;

  

  local_8 = (undefined4 *)0x0;

  local_c = 0;

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

    iVar5 = **(int **)(param_1 + 0x230);

    if ((*(byte *)(param_1 + 0x218) & 0x40) == 0) {

      (**(code **)(iVar5 + 0x15c))(*(int **)(param_1 + 0x230),*(undefined4 *)(param_1 + 8));

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

                (*(int **)(param_1 + 0x230),0,*(undefined4 *)(param_1 + 0x234),0,

                 *(undefined4 *)(param_1 + 0x238));

      (**(code **)(**(int **)(param_1 + 0x230) + 0x1a0))

                (*(int **)(param_1 + 0x230),*(undefined4 *)(param_1 + 0x248));

      if ((*(byte *)(param_1 + 0x218) & 0x10) == 0) {

        iVar5 = 0;

        uVar2 = 0;

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

          do {

            if (*(uint *)(*(int *)(param_1 + 0x254) + uVar2 * 4) == param_2) {

              iVar5 = iVar5 + 1;

            }

            else {

              if ((iVar5 != 0) &&

                 (local_8 = (undefined4 *)

                            (**(code **)(**(int **)(param_1 + 0x230) + 0x148))

                                      (*(int **)(param_1 + 0x230),4,0,0,

                                       *(undefined4 *)(param_1 + 0x23c),(uVar2 - iVar5) * 3,iVar5),

                 (int)local_8 < 0)) goto LAB_005e8c3d;

              iVar5 = 0;

            }

            uVar2 = uVar2 + 1;

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

          if (iVar5 != 0) {

            local_8 = (undefined4 *)

                      (**(code **)(**(int **)(param_1 + 0x230) + 0x148))

                                (*(int **)(param_1 + 0x230),4,0,0,*(undefined4 *)(param_1 + 0x23c),

                                 (uVar2 - iVar5) * 3,iVar5);

          }

        }

      }

      else {

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

        if (((uVar2 <= param_2) ||

            (uVar6 = param_2, *(uint *)(*(int *)(param_1 + 0x25c) + param_2 * 0x14) != param_2)) &&

           (uVar6 = 0, uVar2 != 0)) {

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

          do {

            if (*puVar4 == param_2) break;

            uVar6 = uVar6 + 1;

            puVar4 = puVar4 + 5;

          } while (uVar6 < *(uint *)(param_1 + 0x260));

        }

        if (uVar6 < uVar2) {

          iVar5 = *(int *)(param_1 + 0x25c) + uVar6 * 0x14;

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

            local_8 = (undefined4 *)

                      (**(code **)(**(int **)(param_1 + 0x230) + 0x148))

                                (*(int **)(param_1 + 0x230),4,0,*(undefined4 *)(iVar5 + 0xc),

                                 *(undefined4 *)(iVar5 + 0x10),*(int *)(iVar5 + 4) * 3,

                                 *(int *)(iVar5 + 8));

          }

        }

      }

    }

    else {

      (**(code **)(iVar5 + 0x15c))();

      local_18 = *(uint *)(param_1 + 0x264);

      bVar1 = false;

      local_10 = 0;

      if ((*(byte *)(param_1 + 0x218) & 0x10) != 0) {

        uVar2 = 0;

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

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

          do {

            if (*puVar4 == param_2) break;

            uVar2 = uVar2 + 1;

            puVar4 = puVar4 + 5;

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

        }

        if (uVar2 == *(uint *)(param_1 + 0x260)) {

          return (undefined4 *)0;

        }

        iVar5 = *(int *)(param_1 + 0x25c) + uVar2 * 0x14;

        local_10 = *(uint *)(iVar5 + 4);

        local_18 = *(int *)(iVar5 + 8) + local_10;

        bVar1 = true;

      }

      local_8 = (undefined4 *)FUN_005e5e41(&local_c,0x10);

      if (((-1 < (int)local_8) &&

          (local_8 = (undefined4 *)FUN_005e549b(param_1 + 0x24c,0x10), -1 < (int)local_8)) &&

         (local_10 < local_18)) {

        iVar5 = local_10 * 0xc;

        do {

          piVar3 = (int *)(*(int *)(param_1 + 0x24c) + iVar5);

          if ((bVar1) || (*(uint *)(*(int *)(param_1 + 0x254) + local_10 * 4) == param_2)) {

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

            puVar7 = (undefined4 *)(*piVar3 * uVar2 + local_c);

            puVar8 = (undefined4 *)&stack0xffffffd8;

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

              *puVar8 = *puVar7;

              puVar7 = puVar7 + 1;

              puVar8 = puVar8 + 1;

            }

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

              *(undefined1 *)puVar8 = *(undefined1 *)puVar7;

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

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

            }

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

            puVar7 = (undefined4 *)(&stack0xffffffd8 + uVar2);

            puVar8 = (undefined4 *)(piVar3[1] * uVar2 + local_c);

            puVar9 = puVar7;

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

              *puVar9 = *puVar8;

              puVar8 = puVar8 + 1;

              puVar9 = puVar9 + 1;

            }

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

              *(undefined1 *)puVar9 = *(undefined1 *)puVar8;

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

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

            }

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

            puVar8 = (undefined4 *)(piVar3[2] * uVar2 + local_c);

            puVar9 = (undefined4 *)(uVar2 + (int)puVar7);

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

              *puVar9 = *puVar8;

              puVar8 = puVar8 + 1;

              puVar9 = puVar9 + 1;

            }

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

              *(undefined1 *)puVar9 = *(undefined1 *)puVar8;

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

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

            }

            local_8 = puVar7;

            local_8 = (undefined4 *)

                      (**(code **)(**(int **)(param_1 + 0x230) + 0x14c))

                                (*(int **)(param_1 + 0x230),4,1,&stack0xffffffd8,

                                 *(undefined4 *)(param_1 + 0x238));

            if ((int)local_8 < 0) break;

          }

          local_10 = local_10 + 1;

          iVar5 = iVar5 + 0xc;

        } while (local_10 < local_18);

      }

    }

LAB_005e8c3d:

    if (local_c != 0) {

      (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

    }

  }

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

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

    *(int *)(param_1 + 0x24c) = 0;

  }

  return local_8;

}





// --- FUN_005e8c73 at 0x005E8C73 (size: 1708) ---


/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */



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



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  undefined4 *puVar6;

  undefined4 *puVar7;

  bool bVar8;

  undefined1 local_5c4 [4];

  undefined4 local_5c0;

  uint local_510;

  uint local_50c;

  undefined4 local_494;

  undefined4 local_490;

  undefined4 local_48c;

  undefined4 local_488;

  undefined4 local_484;

  int local_480;

  undefined4 local_47c;

  undefined4 local_478;

  undefined4 *local_474;

  int *local_470;

  undefined4 *local_46c;

  undefined4 *local_468;

  undefined4 *local_464;

  int *local_460;

  int *local_45c;

  int *local_458;

  undefined1 local_454 [1064];

  int local_2c;

  uint local_28;

  undefined4 local_8;

  

  local_8 = DAT_00836f40;

  local_490 = *(undefined4 *)(param_1 + 0x268);

  local_494 = *(undefined4 *)(param_1 + 0x240);

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

  local_46c = (undefined4 *)0x0;

  local_468 = (undefined4 *)0x0;

  local_458 = (int *)0x0;

  local_45c = (int *)0x0;

  local_474 = (undefined4 *)0x0;

  local_464 = (undefined4 *)0x0;

  local_470 = (int *)0x0;

  local_48c = local_490;

  local_488 = local_490;

  if (*piVar1 == 0) {

    FUN_005efb7f(1);

    local_460 = (int *)(**(code **)(**(int **)(param_1 + 0x230) + 0x158))

                                 (*(int **)(param_1 + 0x230),param_1 + 0xc,piVar1);

    FUN_005efb7f(0);

    if ((int)local_460 < 0) {

      *piVar1 = 0;

    }

  }

  if ((param_2 == 0xffffffff) || (param_3 == 0xffffffff)) {

    iVar3 = -0x7789f794;

    goto LAB_005e92a3;

  }

  if (*(uint *)(param_1 + 0x268) < param_2) {

    iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x6c))

                      (*(int **)(param_1 + 0x230),param_2 * 0xc,*(undefined4 *)(param_1 + 0x224),

                       0x66,*(undefined4 *)(param_1 + 0x21c),&local_45c,0);

    if (iVar3 < 0) goto LAB_005e92a3;

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

      iVar3 = (**(code **)(**(int **)(param_1 + 0x248) + 0x2c))

                        (*(int **)(param_1 + 0x248),0,0,&local_474,0x800);

      if (iVar3 < 0) goto LAB_005e92a3;

      iVar3 = (**(code **)(*local_45c + 0x2c))(local_45c,0,0,&local_464,0x800);

      if (iVar3 < 0) goto LAB_005e92a3;

      puVar6 = local_474;

      puVar7 = local_464;

      for (uVar4 = *(int *)(param_1 + 0x264) * 3 & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

        *puVar7 = *puVar6;

        puVar6 = puVar6 + 1;

        puVar7 = puVar7 + 1;

      }

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

        *(undefined1 *)puVar7 = *(undefined1 *)puVar6;

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

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

      }

      puVar6 = local_464 + *(int *)(param_1 + 0x264) * 3;

      for (uVar4 = (param_2 - *(int *)(param_1 + 0x264)) * 3 & 0x3fffffff; uVar4 != 0;

          uVar4 = uVar4 - 1) {

        *puVar6 = 0;

        puVar6 = puVar6 + 1;

      }

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

        *(undefined1 *)puVar6 = 0;

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

      }

      iVar3 = (**(code **)(*local_45c + 0x30))(local_45c);

      if (iVar3 < 0) goto LAB_005e92a3;

      local_464 = (undefined4 *)0x0;

      iVar3 = (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

      if (iVar3 < 0) goto LAB_005e92a3;

      local_474 = (undefined4 *)0x0;

    }

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

    piVar2 = (int *)*piVar1;

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

      (**(code **)(*piVar2 + 8))(piVar2);

      *piVar1 = 0;

    }

    piVar2 = local_45c;

    local_45c = (int *)0x0;

    *piVar1 = (int)piVar2;

    *(uint *)(param_1 + 0x268) = param_2;

    if ((*(byte *)(param_1 + 0x218) & 1) == 0) {

LAB_005e8ea9:

      if ((*(byte *)(param_1 + 0x218) & 4) != 0) {

        iVar3 = FUN_005e6135((int *)(param_1 + 0x254),param_2,*(undefined4 *)(param_1 + 0x264),

                             &local_488);

        if (iVar3 == 0) goto LAB_005e8e9f;

        puVar6 = (undefined4 *)(*(int *)(param_1 + 0x254) + *(int *)(param_1 + 0x264) * 4);

        for (uVar4 = param_2 - *(int *)(param_1 + 0x264) & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1

            ) {

          *puVar6 = 0;

          puVar6 = puVar6 + 1;

        }

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

          *(undefined1 *)puVar6 = 0;

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

        }

      }

      if ((*(byte *)(param_1 + 0x218) & 8) != 0) {

        iVar3 = FUN_005e5fd9(param_1 + 600,param_2,*(undefined4 *)(param_1 + 0x264),&local_490);

        if (iVar3 == 0) goto LAB_005e8e9f;

      }

      goto LAB_005e8f19;

    }

    iVar3 = FUN_005e6072(param_1 + 0x250,param_2,*(undefined4 *)(param_1 + 0x264),&local_48c);

    if (iVar3 != 0) goto LAB_005e8ea9;

LAB_005e8e9f:

    iVar3 = -0x7ff8fff2;

    goto LAB_005e92a3;

  }

LAB_005e8f19:

  if (*(uint *)(param_1 + 0x240) < param_3) {

    if ((*(byte *)(param_1 + 0x218) & 2) != 0) {

      iVar3 = FUN_005e6135(param_1 + 0x244,param_3,*(undefined4 *)(param_1 + 0x23c),&local_494);

      if (iVar3 == 0) goto LAB_005e8e9f;

    }

    if ((*(byte *)(param_1 + 0x218) & 0x20) == 0) {

      iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x68))

                        (*(int **)(param_1 + 0x230),*(int *)(param_1 + 0x238) * param_3,

                         *(undefined4 *)(param_1 + 0x228),*(undefined4 *)(param_1 + 4),

                         *(undefined4 *)(param_1 + 0x220),&local_458,0);

      if (iVar3 < 0) goto LAB_005e92a3;

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

        iVar3 = (**(code **)(**(int **)(param_1 + 0x234) + 0x2c))

                          (*(int **)(param_1 + 0x234),0,0,&local_46c,0x800);

        if (iVar3 < 0) goto LAB_005e92a3;

        iVar3 = (**(code **)(*local_458 + 0x2c))(local_458,0,0,&local_468,0x800);

        if (iVar3 < 0) goto LAB_005e92a3;

        uVar5 = *(int *)(param_1 + 0x238) * *(int *)(param_1 + 0x23c);

        puVar6 = local_46c;

        puVar7 = local_468;

        for (uVar4 = uVar5 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

          *puVar7 = *puVar6;

          puVar6 = puVar6 + 1;

          puVar7 = puVar7 + 1;

        }

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

          *(undefined1 *)puVar7 = *(undefined1 *)puVar6;

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

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

        }

        uVar5 = (param_3 - *(int *)(param_1 + 0x23c)) * *(int *)(param_1 + 0x238);

        puVar6 = (undefined4 *)

                 (*(int *)(param_1 + 0x238) * *(int *)(param_1 + 0x23c) + (int)local_468);

        for (uVar4 = uVar5 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

          *puVar6 = 0;

          puVar6 = puVar6 + 1;

        }

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

          *(undefined1 *)puVar6 = 0;

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

        }

        iVar3 = (**(code **)(*local_458 + 0x30))(local_458);

        if (iVar3 < 0) goto LAB_005e92a3;

        local_468 = (undefined4 *)0x0;

        iVar3 = (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

        if (iVar3 < 0) goto LAB_005e92a3;

        local_46c = (undefined4 *)0x0;

      }

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

      piVar2 = (int *)*piVar1;

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

        (**(code **)(*piVar2 + 8))(piVar2);

        *piVar1 = 0;

      }

      piVar2 = local_458;

      local_458 = (int *)0x0;

      *piVar1 = (int)piVar2;

      *(uint *)(param_1 + 0x240) = param_3;

    }

  }

  *(uint *)(param_1 + 0x23c) = param_3;

  *(uint *)(param_1 + 0x264) = param_2;

  iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x1c))(*(int **)(param_1 + 0x230),local_5c4);

  if (iVar3 < 0) goto LAB_005e92a3;

  iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x18))(*(int **)(param_1 + 0x230),&local_470);

  if (iVar3 < 0) goto LAB_005e92a3;

  if (((local_50c < *(uint *)(param_1 + 0x240)) || (local_50c < 0x10000)) ||

     (local_510 < *(uint *)(param_1 + 0x268))) {

    *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x40;

  }

  if (DAT_008f297c == *(int *)(param_1 + 0x230)) {

    *(undefined4 *)(param_1 + 0x274) = DAT_008f2980;

    *(undefined4 *)(param_1 + 0x278) = DAT_008f2984;

    goto LAB_005e92a3;

  }

  iVar3 = (**(code **)(*local_470 + 0x14))(local_470,local_5c0,0,local_454);

  if (iVar3 < 0) goto LAB_005e92a3;

  if (((local_2c == 0x1002) && (0x5143 < local_28)) && (local_28 < 0x5148)) {

    local_480 = 0;

    local_47c = 0;

    local_478 = 0;

  }

  else {

    local_484 = 0;

    local_480 = 0;

    local_47c = 0;

    local_478 = 0;

    iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x1d8))(*(int **)(param_1 + 0x230),4,0);

    if (iVar3 < 0) {

LAB_005e9210:

      local_480 = 1;

      local_47c = 0xc;

      local_478 = 7;

      iVar3 = 0;

    }

    else {

      iVar3 = (**(code **)(**(int **)(param_1 + 0x230) + 0x1d8))

                        (*(int **)(param_1 + 0x230),4,&local_460);

      if (iVar3 < 0) goto LAB_005e9210;

      iVar3 = (**(code **)(*local_460 + 0x18))(local_460,1);

      if (-1 < iVar3) {

        iVar3 = 1;

        do {

          bVar8 = iVar3 == 0;

          iVar3 = 0;

          if (bVar8) break;

          iVar3 = (**(code **)(*local_460 + 0x1c))(local_460,&local_484,0x10,1);

        } while (-1 < iVar3);

      }

      (**(code **)(*local_460 + 8))(local_460);

      if (iVar3 < 0) goto LAB_005e9210;

    }

    if (local_480 == 0) {

      local_47c = 0;

      local_478 = 0;

    }

    if (*(uint *)(param_1 + 0x274) < *(uint *)(param_1 + 0x278)) {

      *(uint *)(param_1 + 0x278) = *(uint *)(param_1 + 0x274);

    }

  }

  DAT_008f2980 = local_47c;

  DAT_008f2984 = local_478;

  *(undefined4 *)(param_1 + 0x274) = local_47c;

  DAT_008f297c = *(int *)(param_1 + 0x230);

  *(undefined4 *)(param_1 + 0x278) = local_478;

LAB_005e92a3:

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

    (**(code **)(*local_470 + 8))(local_470);

    local_470 = (int *)0x0;

  }

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

    (**(code **)(*local_45c + 0x30))(local_45c);

  }

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

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  }

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

    (**(code **)(*local_458 + 0x30))(local_458);

  }

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

    (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

  }

  return iVar3;

}





// --- FUN_005e931f at 0x005E931F (size: 654) ---


undefined1 __thiscall FUN_005e931f(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  char cVar8;

  int iVar9;

  uint uVar10;

  uint uVar11;

  int *piVar12;

  bool bVar13;

  uint local_18;

  uint *local_14;

  uint *local_10;

  int local_c;

  undefined1 local_6;

  char local_5;

  

  local_6 = 0;

  local_5 = '\0';

  iVar2 = param_2;

  if (param_2 == 0) {

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

      iVar9 = FUN_005e549b(&local_c,0x10);

      iVar2 = local_c;

      if (iVar9 < 0) goto LAB_005e958d;

    }

    else {

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

      iVar2 = param_2;

    }

  }

  local_c = iVar2;

  local_18 = 0;

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

    local_14 = *(uint **)(param_1 + 0x250);

    piVar12 = (int *)(local_c + 4);

    iVar2 = (int)local_14 - local_c;

    do {

      iVar9 = piVar12[-1];

      if (iVar9 == -1) {

        if ((*piVar12 != -1) || (piVar12[1] != -1)) goto LAB_005e958d;

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

          if (*local_14 != 0xffffffff) goto LAB_005e958d;

          piVar1 = (int *)(iVar2 + (int)piVar12);

          if ((*piVar1 != -1) || (piVar1[1] != -1)) goto LAB_005e958d;

        }

      }

      else {

        uVar3 = *(uint *)(param_1 + 0x218) & 2;

        iVar4 = *piVar12;

        if (uVar3 == 0) {

          if ((iVar9 == iVar4) || (iVar4 == piVar12[1])) goto LAB_005e9436;

          bVar13 = piVar12[1] == iVar9;

LAB_005e9434:

          if (bVar13) goto LAB_005e9436;

        }

        else {

          if (*(int *)(iVar9 * 4 + *(int *)(param_1 + 0x244)) !=

              *(int *)(iVar4 * 4 + *(int *)(param_1 + 0x244))) {

            iVar5 = *(int *)(param_1 + 0x244);

            if (*(int *)(iVar4 * 4 + iVar5) != *(int *)(piVar12[1] * 4 + iVar5)) {

              bVar13 = *(int *)(piVar12[1] * 4 + iVar5) == *(int *)(iVar9 * 4 + iVar5);

              goto LAB_005e9434;

            }

          }

LAB_005e9436:

          local_5 = '\x01';

        }

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

          uVar10 = 0;

          local_10 = local_14;

          do {

            uVar6 = *(uint *)((int)piVar12 + (-4 - (int)local_14) + (int)local_10);

            uVar10 = uVar10 + 1;

            uVar7 = piVar12[uVar10 % 3 - 1];

            if ((*(uint *)(param_1 + 0x23c) <= uVar6) || (*(uint *)(param_1 + 0x23c) <= uVar7))

            goto LAB_005e958d;

            uVar11 = *local_10;

            if (uVar11 != 0xffffffff) {

              if (*(uint *)(param_1 + 0x264) <= uVar11) goto LAB_005e958d;

              iVar9 = uVar11 * 0xc + local_c;

              uVar11 = FUN_005e61b3(uVar11 * 0xc + *(int *)(param_1 + 0x250),local_18);

              if (2 < uVar11) goto LAB_005e958d;

              if (uVar3 != 0) {

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

                iVar9 = *(int *)(iVar9 + ((uVar11 + 1) % 3) * 4);

                iVar5 = *(int *)(param_1 + 0x244);

                if (((*(int *)(uVar6 * 4 + iVar5) != *(int *)(iVar5 + iVar4 * 4)) ||

                    (*(int *)(iVar5 + uVar7 * 4) != *(int *)(iVar5 + iVar9 * 4))) &&

                   ((iVar5 = *(int *)(param_1 + 0x244),

                    *(int *)(iVar5 + uVar7 * 4) != *(int *)(iVar5 + iVar4 * 4) ||

                    (*(int *)(iVar5 + uVar6 * 4) != *(int *)(iVar5 + iVar9 * 4)))))

                goto LAB_005e958d;

              }

            }

            local_10 = local_10 + 1;

          } while (uVar10 < 3);

        }

      }

      local_18 = local_18 + 1;

      local_14 = local_14 + 3;

      piVar12 = piVar12 + 3;

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

    if (local_5 != '\0') {

      local_6 = 0;

      goto LAB_005e958d;

    }

  }

  if ((((*(byte *)(param_1 + 0x218) & 0x10) == 0) || (*(int *)(param_1 + 0x25c) == 0)) ||

     (cVar8 = FUN_005e88c2(local_c), cVar8 != '\0')) {

    local_6 = 1;

  }

LAB_005e958d:

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

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  }

  return local_6;

}





// --- FUN_005e95ad at 0x005E95AD (size: 115) ---


void __thiscall FUN_005e95ad(ushort *param_1,ushort param_2,ushort param_3,char param_4)



{

  ushort uVar1;

  

  *param_1 = param_2;

  param_1[2] = param_2;

  *(bool *)((int)param_1 + 0x11) = param_4 != '\0';

  param_1[1] = param_3;

  *(bool *)(param_1 + 8) = param_4 != '\x02';

  uVar1 = FUN_005e5eb5(*(int *)(*(int *)(param_1 + 6) + 0x24c) + (uint)param_2 * 6,param_3);

  param_1[4] = uVar1;

  if (param_4 == '\x02') {

    param_1[4] = (ushort)((ulonglong)(uVar1 + 2) % 3);

  }

  param_1[3] = param_1[4];

  return;

}





// --- FUN_005e9620 at 0x005E9620 (size: 99) ---


void __thiscall FUN_005e9620(int *param_1,int param_2,int param_3,char param_4)



{

  int iVar1;

  

  *(bool *)((int)param_1 + 0x19) = param_4 != '\0';

  *param_1 = param_2;

  param_1[2] = param_2;

  param_1[1] = param_3;

  *(bool *)(param_1 + 6) = param_4 != '\x02';

  iVar1 = FUN_005e5eeb(*(int *)(param_1[5] + 0x24c) + param_2 * 0xc,param_3);

  param_1[4] = iVar1;

  if (param_4 == '\x02') {

    param_1[4] = (iVar1 + 2U) % 3;

  }

  param_1[3] = param_1[4];

  return;

}





// --- FUN_005e9683 at 0x005E9683 (size: 642) ---


int __thiscall FUN_005e9683(int param_1,int param_2)



{

  uint uVar1;

  uint uVar2;

  int iVar3;

  undefined2 *puVar4;

  undefined4 *puVar5;

  undefined2 *puVar6;

  undefined4 *puVar7;

  undefined4 *local_18;

  undefined4 *local_14;

  undefined4 *local_10;

  undefined4 *local_c;

  int local_8;

  

  local_c = (undefined4 *)0x0;

  local_10 = (undefined4 *)0x0;

  local_14 = (undefined4 *)0x0;

  local_18 = (undefined4 *)0x0;

  local_8 = FUN_005e549b(&local_18,0);

  if ((-1 < local_8) && (local_8 = FUN_005e549b(&local_14,0x10), -1 < local_8)) {

    uVar1 = *(int *)(param_1 + 0x264) * 6;

    puVar5 = local_14;

    puVar7 = local_18;

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

      *puVar7 = *puVar5;

      puVar5 = puVar5 + 1;

      puVar7 = puVar7 + 1;

    }

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

      *(undefined1 *)puVar7 = *(undefined1 *)puVar5;

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

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

    }

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

      uVar1 = *(int *)(param_1 + 0x264) * 6;

      puVar5 = *(undefined4 **)(param_2 + 0x250);

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

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

        *puVar7 = *puVar5;

        puVar5 = puVar5 + 1;

        puVar7 = puVar7 + 1;

      }

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

        *(undefined1 *)puVar7 = *(undefined1 *)puVar5;

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

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

      }

    }

    if (((*(byte *)(param_1 + 0x218) & 4) != 0) && ((*(byte *)(param_2 + 0x218) & 4) != 0)) {

      puVar5 = *(undefined4 **)(param_2 + 0x254);

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

      for (uVar2 = *(uint *)(param_1 + 0x264) & 0x3fffffff; uVar2 != 0; uVar2 = uVar2 - 1) {

        *puVar7 = *puVar5;

        puVar5 = puVar5 + 1;

        puVar7 = puVar7 + 1;

      }

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

        *(undefined1 *)puVar7 = *(undefined1 *)puVar5;

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

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

      }

    }

    if (((*(byte *)(param_1 + 0x218) & 8) != 0) && ((*(byte *)(param_2 + 0x218) & 8) != 0)) {

      uVar1 = *(int *)(param_1 + 0x264) << 1;

      puVar5 = *(undefined4 **)(param_2 + 600);

      puVar7 = *(undefined4 **)(param_1 + 600);

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

        *puVar7 = *puVar5;

        puVar5 = puVar5 + 1;

        puVar7 = puVar7 + 1;

      }

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

        *(undefined1 *)puVar7 = *(undefined1 *)puVar5;

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

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

      }

    }

    if ((*(byte *)(param_2 + 0x218) & 0x10) != 0) {

      if (((*(byte *)(param_1 + 0x218) & 0x10) == 0) ||

         (*(int *)(param_1 + 0x260) != *(int *)(param_2 + 0x260))) {

        operator_delete(*(void **)(param_1 + 0x25c));

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

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

        iVar3 = FUN_005df0f5(iVar3 * 0x14);

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

        if (iVar3 == 0) {

          local_8 = -0x7ff8fff2;

          goto LAB_005e98a6;

        }

        *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x10;

      }

      puVar5 = *(undefined4 **)(param_2 + 0x25c);

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

      for (uVar2 = *(int *)(param_1 + 0x260) * 5 & 0x3fffffff; uVar2 != 0; uVar2 = uVar2 - 1) {

        *puVar7 = *puVar5;

        puVar5 = puVar5 + 1;

        puVar7 = puVar7 + 1;

      }

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

        *(undefined1 *)puVar7 = *(undefined1 *)puVar5;

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

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

      }

    }

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

    if (iVar3 != 0) {

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

        puVar4 = *(undefined2 **)(param_2 + 0x244);

        puVar6 = *(undefined2 **)(param_1 + 0x244);

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

          *puVar6 = *puVar4;

          puVar4 = puVar4 + 1;

          puVar6 = puVar6 + 1;

        }

      }

      if ((((*(byte *)(param_1 + 0x218) & 0x20) == 0) &&

          (local_8 = FUN_005e5e41(&local_10,0x10), -1 < local_8)) &&

         (local_8 = FUN_005e5e41(&local_c,0), -1 < local_8)) {

        uVar1 = *(int *)(param_1 + 0x238) * *(int *)(param_1 + 0x23c);

        puVar5 = local_10;

        puVar7 = local_c;

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

          *puVar7 = *puVar5;

          puVar5 = puVar5 + 1;

          puVar7 = puVar7 + 1;

        }

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

          *(undefined1 *)puVar7 = *(undefined1 *)puVar5;

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

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

        }

      }

    }

  }

LAB_005e98a6:

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

    (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

  }

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

    (**(code **)(**(int **)(param_2 + 0x234) + 0x30))(*(int **)(param_2 + 0x234));

  }

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

    (**(code **)(**(int **)(param_2 + 0x248) + 0x30))(*(int **)(param_2 + 0x248));

  }

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

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  }

  if (local_8 < 0) {

    FUN_005e6a4c();

  }

  return local_8;

}





// --- FUN_005e9905 at 0x005E9905 (size: 641) ---


int __thiscall FUN_005e9905(int param_1,int param_2)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  undefined4 *puVar4;

  undefined4 *puVar5;

  undefined4 *local_18;

  undefined4 *local_14;

  undefined4 *local_10;

  undefined4 *local_c;

  int local_8;

  

  local_c = (undefined4 *)0x0;

  local_10 = (undefined4 *)0x0;

  local_14 = (undefined4 *)0x0;

  local_18 = (undefined4 *)0x0;

  local_8 = FUN_005e549b(&local_18,0);

  if ((-1 < local_8) && (local_8 = FUN_005e549b(&local_14,0x10), -1 < local_8)) {

    puVar4 = local_14;

    puVar5 = local_18;

    for (uVar1 = *(int *)(param_1 + 0x264) * 3 & 0x3fffffff; uVar1 != 0; uVar1 = uVar1 - 1) {

      *puVar5 = *puVar4;

      puVar4 = puVar4 + 1;

      puVar5 = puVar5 + 1;

    }

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

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

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

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

    }

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

      puVar4 = *(undefined4 **)(param_2 + 0x250);

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

      for (uVar1 = *(int *)(param_1 + 0x264) * 3 & 0x3fffffff; uVar1 != 0; uVar1 = uVar1 - 1) {

        *puVar5 = *puVar4;

        puVar4 = puVar4 + 1;

        puVar5 = puVar5 + 1;

      }

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

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

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

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

      }

    }

    if (((*(byte *)(param_1 + 0x218) & 4) != 0) && ((*(byte *)(param_2 + 0x218) & 4) != 0)) {

      puVar4 = *(undefined4 **)(param_2 + 0x254);

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

      for (uVar1 = *(uint *)(param_1 + 0x264) & 0x3fffffff; uVar1 != 0; uVar1 = uVar1 - 1) {

        *puVar5 = *puVar4;

        puVar4 = puVar4 + 1;

        puVar5 = puVar5 + 1;

      }

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

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

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

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

      }

    }

    if (((*(byte *)(param_1 + 0x218) & 8) != 0) && ((*(byte *)(param_2 + 0x218) & 8) != 0)) {

      uVar3 = *(int *)(param_1 + 0x264) << 1;

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

      puVar5 = *(undefined4 **)(param_1 + 600);

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

        *puVar5 = *puVar4;

        puVar4 = puVar4 + 1;

        puVar5 = puVar5 + 1;

      }

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

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

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

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

      }

    }

    if ((*(byte *)(param_2 + 0x218) & 0x10) != 0) {

      if (((*(byte *)(param_1 + 0x218) & 0x10) == 0) ||

         (*(int *)(param_1 + 0x260) != *(int *)(param_2 + 0x260))) {

        operator_delete(*(void **)(param_1 + 0x25c));

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

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

        iVar2 = FUN_005df0f5(iVar2 * 0x14);

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

        if (iVar2 == 0) {

          local_8 = -0x7ff8fff2;

          goto LAB_005e9b27;

        }

        *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x10;

      }

      puVar4 = *(undefined4 **)(param_2 + 0x25c);

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

      for (uVar1 = *(int *)(param_1 + 0x260) * 5 & 0x3fffffff; uVar1 != 0; uVar1 = uVar1 - 1) {

        *puVar5 = *puVar4;

        puVar4 = puVar4 + 1;

        puVar5 = puVar5 + 1;

      }

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

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

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

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

      }

    }

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

    if (iVar2 != 0) {

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

        puVar4 = *(undefined4 **)(param_2 + 0x244);

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

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

          *puVar5 = *puVar4;

          puVar4 = puVar4 + 1;

          puVar5 = puVar5 + 1;

        }

      }

      if ((((*(byte *)(param_1 + 0x218) & 0x20) == 0) &&

          (local_8 = FUN_005e5e41(&local_10,0x10), -1 < local_8)) &&

         (local_8 = FUN_005e5e41(&local_c,0), -1 < local_8)) {

        uVar3 = *(int *)(param_1 + 0x238) * *(int *)(param_1 + 0x23c);

        puVar4 = local_10;

        puVar5 = local_c;

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

          *puVar5 = *puVar4;

          puVar4 = puVar4 + 1;

          puVar5 = puVar5 + 1;

        }

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

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

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

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

        }

      }

    }

  }

LAB_005e9b27:

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

    (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

  }

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

    (**(code **)(**(int **)(param_2 + 0x234) + 0x30))(*(int **)(param_2 + 0x234));

  }

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

    (**(code **)(**(int **)(param_2 + 0x248) + 0x30))(*(int **)(param_2 + 0x248));

  }

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

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  }

  if (local_8 < 0) {

    FUN_005e6a4c();

  }

  return local_8;

}





// --- FUN_005e9b86 at 0x005E9B86 (size: 268) ---


undefined4 __fastcall FUN_005e9b86(ushort *param_1)



{

  ushort uVar1;

  ushort uVar2;

  int iVar3;

  undefined2 uVar5;

  uint uVar4;

  ushort uVar6;

  

  uVar1 = param_1[2];

  param_1[3] = param_1[4];

  iVar3 = (uint)uVar1 * 3 + (uint)param_1[4];

  uVar2 = *(ushort *)(*(int *)(*(int *)(param_1 + 6) + 0x250) + iVar3 * 2);

  uVar5 = (undefined2)((uint)iVar3 >> 0x10);

  param_1[2] = uVar2;

  uVar6 = uVar1;

  if (uVar2 != *param_1) {

    do {

      if (param_1[2] != 0xffff) {

        uVar2 = FUN_005e6054(*(int *)(*(int *)(param_1 + 6) + 0x250) + (uint)param_1[2] * 6,uVar6);

        param_1[4] = uVar2;

        uVar4 = uVar2 + 1;

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

          uVar4 = uVar2 + 2;

        }

        uVar5 = 0;

        param_1[4] = (ushort)((ulonglong)uVar4 % 3);

        goto LAB_005e9c56;

      }

      if (((char)param_1[8] == '\0') || (*(char *)((int)param_1 + 0x11) != '\0')) goto LAB_005e9c56;

      param_1[2] = *param_1;

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

      uVar4 = FUN_005e5eb5(*(int *)(*(int *)(param_1 + 6) + 0x24c) + (uint)*param_1 * 6,param_1[1]);

      param_1[4] = (ushort)((ulonglong)((uVar4 & 0xffff) + 2) % 3);

      param_1[3] = (ushort)((ulonglong)(param_1[3] + 2) % 3);

      uVar6 = param_1[2];

      iVar3 = (uint)uVar6 * 3 + (uint)param_1[4];

      uVar2 = *(ushort *)(*(int *)(*(int *)(param_1 + 6) + 0x250) + iVar3 * 2);

      uVar5 = (undefined2)((uint)iVar3 >> 0x10);

      param_1[2] = uVar2;

    } while (uVar2 != *param_1);

  }

  param_1[2] = 0xffff;

LAB_005e9c56:

  return CONCAT22(uVar5,uVar1);

}





// --- FUN_005e9c92 at 0x005E9C92 (size: 210) ---


int __fastcall FUN_005e9c92(int *param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  

  iVar1 = param_1[2];

  param_1[3] = param_1[4];

  iVar3 = *(int *)(*(int *)(param_1[5] + 0x250) + (param_1[4] + iVar1 * 2 + iVar1) * 4);

  param_1[2] = iVar3;

  iVar2 = iVar1;

  if (iVar3 != *param_1) {

    do {

      if (param_1[2] != -1) {

        iVar3 = FUN_005e61b3(*(int *)(param_1[5] + 0x250) + param_1[2] * 0xc,iVar2);

        param_1[4] = iVar3;

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

          uVar4 = iVar3 + 2;

        }

        else {

          uVar4 = iVar3 + 1;

        }

        param_1[4] = uVar4 % 3;

        return iVar1;

      }

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

        return iVar1;

      }

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

        return iVar1;

      }

      param_1[2] = *param_1;

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

      iVar3 = FUN_005e5eeb(*(int *)(param_1[5] + 0x24c) + *param_1 * 0xc,param_1[1]);

      param_1[4] = (iVar3 + 2U) % 3;

      param_1[3] = (param_1[3] + 2U) % 3;

      iVar2 = param_1[2];

      iVar3 = *(int *)(*(int *)(param_1[5] + 0x250) + (iVar2 * 3 + param_1[4]) * 4);

      param_1[2] = iVar3;

    } while (iVar3 != *param_1);

  }

  param_1[2] = -1;

  return iVar1;

}





// --- FUN_005e9d64 at 0x005E9D64 (size: 912) ---


undefined4

FUN_005e9d64(int param_1,undefined4 param_2,uint param_3,int param_4,undefined1 *param_5,

            uint *param_6,int param_7,undefined4 *param_8,uint param_9,undefined4 param_10)



{

  undefined4 uVar1;

  uint uVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  uint *puVar6;

  ushort *puVar7;

  uint uVar8;

  ushort *puVar9;

  uint *puVar10;

  int *piVar11;

  int *piVar12;

  undefined4 *puVar13;

  bool bVar14;

  undefined1 local_50 [4];

  undefined4 local_4c;

  int local_48;

  undefined4 local_44;

  uint local_40;

  uint local_3c [3];

  void *local_30;

  int local_2c;

  uint *local_28;

  int local_24;

  uint *local_20;

  undefined4 local_1c;

  uint local_18;

  undefined1 *local_14;

  uint *local_10;

  uint local_c;

  undefined4 *local_8;

  

  uVar2 = param_3 / 3;

  local_1c = 0;

  local_2c = 0;

  iVar3 = param_4 * 3;

  local_24 = iVar3;

  local_c = uVar2;

  local_8 = (undefined4 *)FUN_005df0f5(uVar2 << 2);

  local_30 = (void *)FUN_005df0f5(param_4 * 0x3c);

  if ((local_8 == (undefined4 *)0x0) || (local_30 == (void *)0x0)) {

    local_1c = 0x8007000e;

  }

  else {

    puVar13 = local_8;

    for (uVar2 = uVar2 & 0x3fffffff; uVar2 != 0; uVar2 = uVar2 - 1) {

      *puVar13 = 0;

      puVar13 = puVar13 + 1;

    }

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

      *(undefined1 *)puVar13 = 0;

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

    }

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

      local_4c = 0;

      local_44 = 0;

      param_6 = (uint *)0x1;

      param_5 = local_50;

      local_48 = param_4;

      local_40 = param_3;

    }

    local_14 = param_5;

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

      local_10 = (uint *)(param_5 + 4);

      local_20 = param_6;

      do {

        param_3 = *local_10;

        uVar2 = local_10[1] + param_3;

        local_18 = uVar2;

        if (param_3 < uVar2) {

          puVar7 = (ushort *)(param_1 + 4 + param_3 * 6);

          do {

            uVar5 = (uint)puVar7[-2];

            if (uVar5 != param_9) {

              if (param_7 == 0) {

                local_3c[2] = (uint)*puVar7;

                local_3c[0] = uVar5;

                local_3c[1] = (uint)puVar7[-1];

              }

              else {

                local_3c[0] = *(uint *)(param_7 + uVar5 * 4);

                local_3c[1] = *(uint *)(param_7 + (uint)puVar7[-1] * 4);

                local_3c[2] = *(uint *)(param_7 + (uint)*puVar7 * 4);

              }

              if (((local_3c[0] != local_3c[1]) && (local_3c[0] != local_3c[2])) &&

                 (local_3c[1] != local_3c[2])) {

                puVar10 = local_3c;

                param_5 = (undefined1 *)0x3;

                puVar6 = (uint *)0x1;

                do {

                  local_28 = (uint *)((int)puVar6 + 1U);

                  FUN_005e4ec0(*puVar10,local_3c[(uint)puVar6 % 3],local_3c[((int)puVar6 + 1U) % 3],

                               param_3,local_8,local_30,local_c,&local_2c);

                  puVar10 = puVar10 + 1;

                  param_5 = (undefined1 *)((int)param_5 + -1);

                  puVar6 = local_28;

                  uVar2 = local_18;

                } while (param_5 != (undefined1 *)0x0);

              }

            }

            param_3 = param_3 + 1;

            puVar7 = puVar7 + 3;

            param_5 = local_14;

            iVar3 = local_24;

          } while (param_3 < uVar2);

        }

        local_10 = local_10 + 5;

        local_20 = (uint *)((int)local_20 - 1);

      } while (local_20 != (uint *)0x0);

    }

    puVar13 = param_8;

    for (uVar2 = param_4 * 3 & 0x3fffffff; uVar2 != 0; uVar2 = uVar2 - 1) {

      *puVar13 = 0xffffffff;

      puVar13 = puVar13 + 1;

    }

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

      *(undefined1 *)puVar13 = 0xff;

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

    }

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

      local_20 = (uint *)(param_5 + 4);

      local_28 = param_6;

      do {

        uVar2 = *local_20;

        local_18 = local_20[1] + uVar2;

        if (uVar2 < local_20[1] + uVar2) {

          piVar11 = param_8 + uVar2 * 3;

          puVar7 = (ushort *)(param_1 + 4 + uVar2 * 6);

          local_14 = (undefined1 *)((int)local_3c + (uVar2 * -0xc - (int)param_8));

          do {

            uVar5 = (uint)puVar7[-2];

            if (uVar5 != param_9) {

              if (param_7 == 0) {

                local_3c[2] = (uint)*puVar7;

                local_3c[0] = uVar5;

                local_3c[1] = (uint)puVar7[-1];

              }

              else {

                local_3c[0] = *(uint *)(param_7 + uVar5 * 4);

                local_3c[1] = *(uint *)(param_7 + (uint)puVar7[-1] * 4);

                local_3c[2] = *(uint *)(param_7 + (uint)*puVar7 * 4);

              }

              if (((local_3c[0] == local_3c[1]) || (local_3c[0] == local_3c[2])) ||

                 (local_3c[1] == local_3c[2])) {

                *piVar11 = -1;

                piVar11[1] = -1;

                piVar11[2] = -1;

              }

              else {

                piVar12 = piVar11;

                uVar5 = 1;

                do {

                  if (*piVar12 == -1) {

                    uVar1 = *(undefined4 *)(local_14 + (int)piVar12);

                    local_10 = (uint *)local_3c[uVar5 % 3];

                    iVar3 = FUN_005e7a88((uint *)local_3c[uVar5 % 3],uVar1,local_3c[(uVar5 + 1) % 3]

                                         ,local_8,local_c,0xffffffff,param_2,param_10);

                    *piVar12 = iVar3;

                    if (iVar3 != -1) {

                      FUN_005e4f0b(uVar1,local_10,uVar2,local_8,local_c);

                      uVar8 = 0;

                      if (uVar5 != 1) {

                        do {

                          if (*piVar12 == piVar11[uVar8]) {

                            *piVar12 = -1;

                            goto LAB_005ea069;

                          }

                          uVar8 = uVar8 + 1;

                        } while (uVar8 < uVar5 - 1);

                      }

                      param_6 = (uint *)0x0;

                      puVar9 = (ushort *)(param_1 + *piVar12 * 6);

                      do {

                        puVar10 = (uint *)(uint)*puVar9;

                        if (param_7 != 0) {

                          puVar10 = *(uint **)(param_7 + (int)puVar10 * 4);

                        }

                        if (puVar10 == local_10) break;

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

                        puVar9 = puVar9 + 1;

                      } while (param_6 < 3);

                      param_8[(int)param_6 + *piVar12 * 3] = uVar2;

                    }

                  }

LAB_005ea069:

                  piVar12 = piVar12 + 1;

                  bVar14 = uVar5 < 3;

                  iVar3 = local_24;

                  uVar5 = uVar5 + 1;

                } while (bVar14);

              }

            }

            local_14 = local_14 + -0xc;

            uVar2 = uVar2 + 1;

            puVar7 = puVar7 + 3;

            piVar11 = piVar11 + 3;

          } while (uVar2 < local_18);

        }

        local_20 = local_20 + 5;

        local_28 = (uint *)((int)local_28 - 1);

      } while (local_28 != (uint *)0x0);

    }

    if (iVar3 < local_2c) {

      local_1c = 0x80004005;

    }

  }

  operator_delete(local_8);

  operator_delete(local_30);

  return local_1c;

}





// --- FUN_005ea0f4 at 0x005EA0F4 (size: 912) ---


undefined4

FUN_005ea0f4(int param_1,undefined4 param_2,uint param_3,int *param_4,undefined1 *param_5,

            uint *param_6,int param_7,undefined4 *param_8,uint param_9,undefined4 param_10)



{

  undefined4 uVar1;

  uint uVar2;

  int iVar3;

  uint *puVar4;

  uint uVar5;

  int *piVar6;

  uint *puVar7;

  undefined1 *puVar8;

  uint uVar9;

  int *piVar10;

  uint *puVar11;

  undefined4 *puVar12;

  uint uVar13;

  bool bVar14;

  undefined1 local_54 [4];

  undefined4 local_50;

  int local_4c;

  undefined4 local_48;

  uint local_44;

  uint local_40 [4];

  void *local_30;

  int local_2c;

  int local_28;

  uint *local_24;

  uint *local_20;

  undefined4 local_1c;

  int local_18;

  undefined1 *local_14;

  uint local_10;

  uint *local_c;

  undefined4 *local_8;

  

  local_28 = (int)param_4 * 3;

  uVar2 = param_3 / 3;

  local_1c = 0;

  local_2c = 0;

  local_10 = uVar2;

  local_8 = (undefined4 *)FUN_005df0f5(uVar2 << 2);

  local_30 = (void *)FUN_005df0f5(local_28 * 0x14);

  if ((local_8 == (undefined4 *)0x0) || (local_30 == (void *)0x0)) {

    local_1c = 0x8007000e;

  }

  else {

    puVar12 = local_8;

    for (uVar2 = uVar2 & 0x3fffffff; uVar2 != 0; uVar2 = uVar2 - 1) {

      *puVar12 = 0;

      puVar12 = puVar12 + 1;

    }

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

      *(undefined1 *)puVar12 = 0;

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

    }

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

      local_50 = 0;

      local_48 = 0;

      param_6 = (uint *)0x1;

      param_5 = local_54;

      local_4c = (int)param_4;

      local_44 = param_3;

    }

    local_14 = param_5;

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

      local_c = (uint *)(param_5 + 4);

      local_20 = param_6;

      do {

        param_3 = *local_c;

        uVar2 = local_c[1] + param_3;

        if (param_3 < uVar2) {

          puVar7 = (uint *)(param_1 + 8 + param_3 * 0xc);

          do {

            uVar9 = puVar7[-2];

            if (uVar9 != param_9) {

              if (param_7 == 0) {

                local_40[2] = *puVar7;

                local_40[0] = uVar9;

                local_40[1] = puVar7[-1];

              }

              else {

                local_40[0] = *(uint *)(param_7 + uVar9 * 4);

                local_40[1] = *(uint *)(param_7 + puVar7[-1] * 4);

                local_40[2] = *(uint *)(param_7 + *puVar7 * 4);

              }

              if (((local_40[0] != local_40[1]) && (local_40[0] != local_40[2])) &&

                 (local_40[1] != local_40[2])) {

                puVar11 = local_40;

                local_18 = 3;

                puVar4 = (uint *)0x1;

                do {

                  local_24 = (uint *)((int)puVar4 + 1U);

                  FUN_005e4ec0(*puVar11,local_40[(uint)puVar4 % 3],local_40[((int)puVar4 + 1U) % 3],

                               param_3,local_8,local_30,local_10,&local_2c);

                  puVar11 = puVar11 + 1;

                  local_18 = local_18 + -1;

                  puVar4 = local_24;

                } while (local_18 != 0);

              }

            }

            param_3 = param_3 + 1;

            puVar7 = puVar7 + 3;

            param_5 = local_14;

          } while (param_3 < uVar2);

        }

        local_c = local_c + 5;

        local_20 = (uint *)((int)local_20 - 1);

      } while (local_20 != (uint *)0x0);

    }

    puVar12 = param_8;

    for (uVar2 = (int)param_4 * 3 & 0x3fffffff; uVar2 != 0; uVar2 = uVar2 - 1) {

      *puVar12 = 0xffffffff;

      puVar12 = puVar12 + 1;

    }

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

      *(undefined1 *)puVar12 = 0xff;

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

    }

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

      local_20 = (uint *)(param_5 + 4);

      local_24 = param_6;

      do {

        uVar2 = *local_20;

        uVar9 = local_20[1] + uVar2;

        if (uVar2 < uVar9) {

          param_4 = param_8 + uVar2 * 3;

          local_18 = (int)local_40 + (uVar2 * -0xc - (int)param_8);

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

          local_c = puVar7;

          local_40[3] = (int)param_8 - param_1;

          do {

            uVar13 = puVar7[-2];

            if (uVar13 != param_9) {

              if (param_7 == 0) {

                local_40[2] = *puVar7;

                local_40[0] = uVar13;

                local_40[1] = puVar7[-1];

              }

              else {

                local_40[0] = *(uint *)(param_7 + uVar13 * 4);

                local_40[1] = *(uint *)(param_7 + puVar7[-1] * 4);

                local_40[2] = *(uint *)(param_7 + *puVar7 * 4);

              }

              if (((local_40[0] == local_40[1]) || (local_40[0] == local_40[2])) ||

                 (local_40[1] == local_40[2])) {

                *param_4 = -1;

                param_4[1] = -1;

                *(undefined4 *)(local_40[3] + (int)puVar7) = 0xffffffff;

              }

              else {

                piVar10 = param_4;

                uVar13 = 1;

                local_c = puVar7;

                do {

                  if (*piVar10 == -1) {

                    uVar1 = *(undefined4 *)((int)piVar10 + local_18);

                    local_14 = (undefined1 *)local_40[uVar13 % 3];

                    iVar3 = FUN_005e7a88((undefined1 *)local_40[uVar13 % 3],uVar1,

                                         local_40[(uVar13 + 1) % 3],local_8,local_10,0xffffffff,

                                         param_2,param_10);

                    *piVar10 = iVar3;

                    puVar7 = local_c;

                    if (iVar3 != -1) {

                      FUN_005e4f0b(uVar1,local_14,uVar2,local_8,local_10);

                      uVar5 = 0;

                      puVar7 = local_c;

                      if (uVar13 != 1) {

                        do {

                          if (*piVar10 == param_4[uVar5]) {

                            *piVar10 = -1;

                            goto LAB_005ea3f1;

                          }

                          uVar5 = uVar5 + 1;

                        } while (uVar5 < uVar13 - 1);

                      }

                      param_6 = (uint *)0x0;

                      piVar6 = (int *)(param_1 + *piVar10 * 0xc);

                      do {

                        puVar8 = (undefined1 *)*piVar6;

                        if (param_7 != 0) {

                          puVar8 = *(undefined1 **)(param_7 + (int)puVar8 * 4);

                        }

                        if (puVar8 == local_14) break;

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

                        piVar6 = piVar6 + 1;

                      } while (param_6 < 3);

                      param_8[(int)param_6 + *piVar10 * 3] = uVar2;

                    }

                  }

LAB_005ea3f1:

                  piVar10 = piVar10 + 1;

                  bVar14 = uVar13 < 3;

                  uVar13 = uVar13 + 1;

                } while (bVar14);

              }

            }

            param_4 = param_4 + 3;

            uVar2 = uVar2 + 1;

            local_18 = local_18 + -0xc;

            puVar7 = puVar7 + 3;

            local_c = puVar7;

          } while (uVar2 < uVar9);

        }

        local_20 = local_20 + 5;

        local_24 = (uint *)((int)local_24 - 1);

      } while (local_24 != (uint *)0x0);

    }

    if (local_28 < local_2c) {

      local_1c = 0x80004005;

    }

  }

  operator_delete(local_8);

  operator_delete(local_30);

  return local_1c;

}





// --- FUN_005ea484 at 0x005EA484 (size: 40) ---


void FUN_005ea484(undefined4 param_1,char *param_2)



{

  char cVar1;

  

  cVar1 = FUN_005e62dd(param_1);

  *param_2 = cVar1;

  if (cVar1 == '\0') {

    FUN_005e630a(param_1);

  }

  return;

}





// --- FUN_005ea4ac at 0x005EA4AC (size: 40) ---


void FUN_005ea4ac(undefined4 param_1,char *param_2)



{

  char cVar1;

  

  cVar1 = FUN_005e637e(param_1);

  *param_2 = cVar1;

  if (cVar1 == '\0') {

    FUN_005e63aa(param_1);

  }

  return;

}





// --- FUN_005ea4d4 at 0x005EA4D4 (size: 650) ---


/* WARNING: Type propagation algorithm not settling */



undefined4 __thiscall FUN_005ea4d4(int param_1,int *param_2,ushort *param_3)



{

  ushort *puVar1;

  ushort uVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  short *psVar6;

  undefined4 *puVar7;

  uint local_50 [4];

  undefined4 *local_40;

  short *local_3c;

  ushort local_38 [2];

  ushort local_34;

  undefined4 local_30;

  undefined4 local_2c;

  int local_28;

  int local_24;

  uint local_20;

  uint local_1c;

  int local_18;

  void *local_14;

  undefined4 *local_10;

  undefined4 local_c;

  void *local_8;

  

  local_50[3] = *(undefined4 *)(param_1 + 0x23c);

  *param_2 = 0;

  param_3[0] = 0;

  param_3[1] = 0;

  local_c = 0;

  local_8 = (void *)0x0;

  local_14 = (void *)0x0;

  local_50[2] = 0;

  local_24 = 0;

  local_50[1] = 0;

  local_2c = 0;

  local_30 = 0;

  local_10 = (undefined4 *)FUN_005df0f5(*(int *)(param_1 + 0x23c) << 1);

  local_40 = (undefined4 *)FUN_005df0f5(*(int *)(param_1 + 0x23c) << 2);

  if ((local_10 == (undefined4 *)0x0) || (local_40 == (undefined4 *)0x0)) {

LAB_005ea72a:

    local_c = 0x8007000e;

  }

  else {

    puVar7 = local_40;

    for (uVar3 = *(uint *)(param_1 + 0x23c) & 0x3fffffff; uVar3 != 0; uVar3 = uVar3 - 1) {

      *puVar7 = 0xffffffff;

      puVar7 = puVar7 + 1;

    }

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

      *(undefined1 *)puVar7 = 0xff;

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

    }

    uVar5 = *(int *)(param_1 + 0x23c) << 1;

    puVar7 = local_10;

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

      *puVar7 = 0xffffffff;

      puVar7 = puVar7 + 1;

    }

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

      *(undefined1 *)puVar7 = 0xff;

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

    }

    local_20 = 0;

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

      local_28 = 0;

      do {

        psVar6 = (short *)(*(int *)(param_1 + 0x24c) + local_28);

        local_3c = psVar6;

        if (*psVar6 != -1) {

          local_18 = *(int *)(*(int *)(param_1 + 0x254) + local_20 * 4);

          local_1c = 0;

          do {

            puVar1 = (ushort *)(psVar6 + local_1c);

            iVar4 = local_40[*puVar1];

            if (iVar4 != local_18) {

              if (iVar4 == -1) {

                local_40[*puVar1] = local_18;

              }

              else {

                for (uVar2 = *(ushort *)((int)local_10 + (uint)*puVar1 * 2); uVar2 != 0xffff;

                    uVar2 = *(ushort *)((int)local_8 + (uint)uVar2 * 2)) {

                  if (*(int *)((int)local_14 + (uint)uVar2 * 4) == local_18) {

                    *puVar1 = (short)local_50[3] + uVar2;

                    psVar6 = local_3c;

                    goto LAB_005ea6f9;

                  }

                }

                if (local_24 == 0) {

                  local_2c = 0x100;

                  local_24 = 0x100;

                  local_30 = 0x100;

                  local_8 = (void *)FUN_005df0f5(0x200);

                  local_14 = (void *)FUN_005df0f5(0x400);

                  iVar4 = FUN_005df0f5(0x400);

                  *param_2 = iVar4;

                  if (((local_8 == (void *)0x0) || (local_14 == (void *)0x0)) || (iVar4 == 0))

                  goto LAB_005ea72a;

                }

                puVar7 = local_10;

                local_38[0] = *(ushort *)(param_1 + 0x23c);

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

                local_34 = *param_3;

                iVar4 = FUN_005e7072(&local_14,&local_18,local_50 + 2,&local_24);

                if ((iVar4 == 0) ||

                   (iVar4 = FUN_005e7105(&local_8,local_38,local_50 + 1,&local_2c), iVar4 == 0))

                goto LAB_005ea72a;

                local_50[0] = (uint)*puVar1;

                iVar4 = FUN_005e7072(param_2,local_50,param_3,&local_30);

                if (iVar4 == 0) goto LAB_005ea72a;

                *(undefined2 *)((int)local_8 + (uint)local_34 * 2) =

                     *(undefined2 *)((int)puVar7 + (uint)*puVar1 * 2);

                *(ushort *)((int)puVar7 + (uint)*puVar1 * 2) = local_34;

                *puVar1 = local_38[0];

                psVar6 = local_3c;

              }

            }

LAB_005ea6f9:

            local_1c = local_1c + 1;

          } while (local_1c < 3);

        }

        local_20 = local_20 + 1;

        local_28 = local_28 + 6;

      } while (local_20 < *(uint *)(param_1 + 0x264));

    }

  }

  operator_delete(local_10);

  operator_delete(local_8);

  operator_delete(local_40);

  operator_delete(local_14);

  return local_c;

}





// --- FUN_005ea75e at 0x005EA75E (size: 360) ---


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



{

  ushort *puVar1;

  int *piVar2;

  ushort uVar3;

  undefined4 *puVar4;

  uint uVar5;

  uint uVar6;

  int iVar7;

  undefined4 *puVar8;

  undefined4 local_10;

  uint local_8;

  

  local_10 = 0;

  uVar5 = *(uint *)(param_1 + 0x23c);

  if (*(uint *)(param_1 + 0x23c) <= *(uint *)(param_1 + 0x264)) {

    uVar5 = *(uint *)(param_1 + 0x264);

  }

  puVar4 = (undefined4 *)FUN_005df0f5(uVar5);

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

    local_10 = 0x8007000e;

  }

  else {

    if (((*(byte *)(param_1 + 0x218) & 2) != 0) && (uVar5 = 0, *(int *)(param_1 + 0x23c) != 0)) {

      do {

        if ((*(int *)(param_2 + uVar5 * 4) != 0xffff) &&

           (puVar1 = (ushort *)(*(int *)(param_1 + 0x244) + uVar5 * 2),

           *(int *)(param_2 + (uint)*puVar1 * 4) == 0xffff)) {

          uVar3 = *puVar1;

          *puVar1 = (ushort)uVar5;

          uVar6 = uVar5;

          while (uVar6 = uVar6 + 1, uVar6 < *(uint *)(param_1 + 0x23c)) {

            puVar1 = (ushort *)(*(int *)(param_1 + 0x244) + uVar6 * 2);

            if (*puVar1 == uVar3) {

              *puVar1 = (ushort)uVar5;

            }

          }

        }

        uVar5 = uVar5 + 1;

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

    }

    uVar5 = *(uint *)(param_1 + 0x23c);

    puVar8 = puVar4;

    for (uVar6 = uVar5 >> 2; uVar6 != 0; uVar6 = uVar6 - 1) {

      *puVar8 = 0;

      puVar8 = puVar8 + 1;

    }

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

      *(undefined1 *)puVar8 = 0;

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

    }

    local_8 = 0;

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

      do {

        if ((*(char *)(local_8 + (int)puVar4) == '\0') &&

           (uVar5 = *(uint *)(param_2 + local_8 * 4), uVar5 != 0xffff)) {

          while (uVar5 != local_8) {

            FUN_005e72fa(local_8,uVar5,param_3);

            FUN_005e725f(uVar5,param_2);

            *(undefined1 *)(uVar5 + (int)puVar4) = 1;

            uVar5 = *(uint *)(param_2 + uVar5 * 4);

            if ((uVar5 == 0xffff) || (*(char *)(uVar5 + (int)puVar4) != '\0')) goto LAB_005ea879;

          }

          FUN_005e725f(local_8,param_2);

        }

LAB_005ea879:

        local_8 = local_8 + 1;

      } while (local_8 < *(uint *)(param_1 + 0x23c));

    }

    uVar5 = 0;

    iVar7 = 0;

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

      do {

        piVar2 = (int *)(param_2 + uVar5 * 4);

        if (*piVar2 == 0xffff) {

          *piVar2 = -1;

        }

        else {

          iVar7 = iVar7 + 1;

        }

        uVar5 = uVar5 + 1;

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

    }

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

  }

  operator_delete(puVar4);

  return local_10;

}





// --- FUN_005ea8c6 at 0x005EA8C6 (size: 260) ---


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



{

  int *piVar1;

  undefined4 *puVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  undefined4 local_c;

  

  local_c = 0;

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

  if (*(uint *)(param_1 + 0x23c) <= *(uint *)(param_1 + 0x264)) {

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

  }

  puVar2 = (undefined4 *)FUN_005df0f5(uVar4);

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

    local_c = 0x8007000e;

  }

  else {

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

    puVar6 = puVar2;

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

      *puVar6 = 0;

      puVar6 = puVar6 + 1;

    }

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

      *(undefined1 *)puVar6 = 0;

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

    }

    uVar4 = 0;

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

      do {

        if ((*(char *)(uVar4 + (int)puVar2) == '\0') &&

           (uVar3 = *(uint *)(param_2 + uVar4 * 4), uVar3 != 0xffff)) {

          while (uVar3 != uVar4) {

            FUN_005e73ab(uVar4,uVar3);

            FUN_005e728a(uVar3,param_3,param_2);

            *(undefined1 *)(uVar3 + (int)puVar2) = 1;

            uVar3 = *(uint *)(param_2 + uVar3 * 4);

            if ((uVar3 == 0xffff) || (*(char *)(uVar3 + (int)puVar2) != '\0')) goto LAB_005ea97f;

          }

          FUN_005e728a(uVar4,param_3,param_2);

        }

LAB_005ea97f:

        uVar4 = uVar4 + 1;

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

    }

    uVar4 = 0;

    iVar5 = 0;

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

      do {

        piVar1 = (int *)(param_2 + uVar4 * 4);

        if (*piVar1 == 0xffff) {

          *piVar1 = -1;

        }

        else {

          iVar5 = iVar5 + 1;

        }

        uVar4 = uVar4 + 1;

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

    }

    *(int *)(param_1 + 0x264) = iVar5;

  }

  operator_delete(puVar2);

  return local_c;

}





// --- FUN_005ea9ca at 0x005EA9CA (size: 617) ---


/* WARNING: Type propagation algorithm not settling */



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



{

  int *piVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  int *piVar5;

  undefined4 *puVar6;

  int local_4c [4];

  undefined4 *local_3c;

  int *local_38;

  int local_34 [8];

  void *local_14;

  undefined4 *local_10;

  undefined4 local_c;

  void *local_8;

  

  local_4c[3] = *(int *)(param_1 + 0x23c);

  *param_2 = 0;

  *param_3 = 0;

  local_c = 0;

  local_8 = (void *)0x0;

  local_14 = (void *)0x0;

  local_4c[2] = 0;

  local_34[4] = 0;

  local_4c[1] = 0;

  local_34[2] = 0;

  local_34[1] = 0;

  local_10 = (undefined4 *)FUN_005df0f5(*(int *)(param_1 + 0x23c) << 2);

  local_3c = (undefined4 *)FUN_005df0f5(*(int *)(param_1 + 0x23c) << 2);

  if ((local_10 == (undefined4 *)0x0) || (local_3c == (undefined4 *)0x0)) {

LAB_005eabff:

    local_c = 0x8007000e;

  }

  else {

    puVar6 = local_3c;

    for (uVar3 = *(uint *)(param_1 + 0x23c) & 0x3fffffff; uVar3 != 0; uVar3 = uVar3 - 1) {

      *puVar6 = 0xffffffff;

      puVar6 = puVar6 + 1;

    }

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

      *(undefined1 *)puVar6 = 0xff;

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

    }

    puVar6 = local_10;

    for (uVar3 = *(uint *)(param_1 + 0x23c) & 0x3fffffff; uVar3 != 0; uVar3 = uVar3 - 1) {

      *puVar6 = 0xffffffff;

      puVar6 = puVar6 + 1;

    }

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

      *(undefined1 *)puVar6 = 0xff;

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

    }

    local_34[5] = 0;

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

      local_34[3] = 0;

      do {

        piVar5 = (int *)(*(int *)(param_1 + 0x24c) + local_34[3]);

        local_38 = piVar5;

        if (*piVar5 != -1) {

          local_34[7] = *(int *)(*(int *)(param_1 + 0x254) + local_34[5] * 4);

          local_34[6] = 0;

          do {

            piVar1 = piVar5 + local_34[6];

            iVar4 = local_3c[*piVar1];

            if (iVar4 != local_34[7]) {

              if (iVar4 == -1) {

                local_3c[*piVar1] = local_34[7];

              }

              else {

                for (iVar4 = local_10[*piVar1]; iVar4 != -1;

                    iVar4 = *(int *)(iVar4 * 4 + (int)local_8)) {

                  if (*(int *)(iVar4 * 4 + (int)local_14) == local_34[7]) {

                    iVar4 = iVar4 + local_4c[3];

                    goto LAB_005eabcc;

                  }

                }

                if (local_34[4] == 0) {

                  local_34[2] = 0x100;

                  local_34[4] = 0x100;

                  local_34[1] = 0x100;

                  local_8 = (void *)FUN_005df0f5(0x400);

                  local_14 = (void *)FUN_005df0f5(0x400);

                  iVar4 = FUN_005df0f5(0x400);

                  *param_2 = iVar4;

                  if (((local_8 == (void *)0x0) || (local_14 == (void *)0x0)) || (iVar4 == 0))

                  goto LAB_005eabff;

                }

                local_34[0] = *(int *)(param_1 + 0x23c);

                *(int *)(param_1 + 0x23c) = local_34[0] + 1;

                iVar4 = *param_3;

                iVar2 = FUN_005e7072(&local_14,local_34 + 7,local_4c + 2,local_34 + 4);

                if ((iVar2 == 0) ||

                   (iVar2 = FUN_005e7072(&local_8,local_34,local_4c + 1,local_34 + 2), iVar2 == 0))

                goto LAB_005eabff;

                local_4c[0] = *piVar1;

                iVar2 = FUN_005e7072(param_2,local_4c,param_3,local_34 + 1);

                if (iVar2 == 0) goto LAB_005eabff;

                *(undefined4 *)((int)local_8 + iVar4 * 4) = local_10[*piVar1];

                local_10[*piVar1] = iVar4;

                iVar4 = local_34[0];

LAB_005eabcc:

                *piVar1 = iVar4;

                piVar5 = local_38;

              }

            }

            local_34[6] = local_34[6] + 1;

          } while ((uint)local_34[6] < 3);

        }

        local_34[5] = local_34[5] + 1;

        local_34[3] = local_34[3] + 0xc;

      } while ((uint)local_34[5] < *(uint *)(param_1 + 0x264));

    }

  }

  operator_delete(local_10);

  operator_delete(local_8);

  operator_delete(local_3c);

  operator_delete(local_14);

  return local_c;

}





// --- FUN_005eac33 at 0x005EAC33 (size: 341) ---


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



{

  uint *puVar1;

  undefined4 *puVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  int iVar6;

  undefined4 *puVar7;

  undefined4 local_c;

  

  local_c = 0;

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

  if (*(uint *)(param_1 + 0x23c) <= *(uint *)(param_1 + 0x264)) {

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

  }

  puVar2 = (undefined4 *)FUN_005df0f5(uVar4);

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

    local_c = 0x8007000e;

  }

  else {

    if (((*(byte *)(param_1 + 0x218) & 2) != 0) && (uVar4 = 0, *(int *)(param_1 + 0x23c) != 0)) {

      do {

        if (*(int *)(param_2 + uVar4 * 4) != -1) {

          puVar1 = (uint *)(*(int *)(param_1 + 0x244) + uVar4 * 4);

          uVar5 = *puVar1;

          if (*(int *)(param_2 + uVar5 * 4) == -1) {

            *puVar1 = uVar4;

            uVar3 = uVar4;

            while (uVar3 = uVar3 + 1, uVar3 < *(uint *)(param_1 + 0x23c)) {

              puVar1 = (uint *)(*(int *)(param_1 + 0x244) + uVar3 * 4);

              if (*puVar1 == uVar5) {

                *puVar1 = uVar4;

              }

            }

          }

        }

        uVar4 = uVar4 + 1;

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

    }

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

    puVar7 = puVar2;

    for (uVar5 = uVar4 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {

      *puVar7 = 0;

      puVar7 = puVar7 + 1;

    }

    uVar5 = 0;

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

      *(undefined1 *)puVar7 = 0;

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

    }

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

      do {

        if ((*(char *)(uVar5 + (int)puVar2) == '\0') &&

           (uVar4 = *(uint *)(param_2 + uVar5 * 4), uVar4 != 0xffffffff)) {

          while (uVar4 != uVar5) {

            FUN_005e764c(uVar5,uVar4,param_3);

            FUN_005e75c1(uVar4,param_2);

            *(undefined1 *)(uVar4 + (int)puVar2) = 1;

            uVar4 = *(uint *)(param_2 + uVar4 * 4);

            if ((uVar4 == 0xffffffff) || (*(char *)(uVar4 + (int)puVar2) != '\0'))

            goto LAB_005ead44;

          }

          FUN_005e75c1(uVar5,param_2);

        }

LAB_005ead44:

        uVar5 = uVar5 + 1;

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

    }

    uVar4 = 0;

    iVar6 = 0;

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

      do {

        if (*(int *)(param_2 + uVar4 * 4) == -1) {

          *(undefined4 *)(param_2 + uVar4 * 4) = 0xffffffff;

        }

        else {

          iVar6 = iVar6 + 1;

        }

        uVar4 = uVar4 + 1;

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

    }

    *(int *)(param_1 + 0x23c) = iVar6;

  }

  operator_delete(puVar2);

  return local_c;

}





// --- FUN_005ead88 at 0x005EAD88 (size: 251) ---


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



{

  int *piVar1;

  undefined4 *puVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  undefined4 local_c;

  

  local_c = 0;

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

  if (*(uint *)(param_1 + 0x23c) <= *(uint *)(param_1 + 0x264)) {

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

  }

  puVar2 = (undefined4 *)FUN_005df0f5(uVar4);

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

    local_c = 0x8007000e;

  }

  else {

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

    puVar6 = puVar2;

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

      *puVar6 = 0;

      puVar6 = puVar6 + 1;

    }

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

      *(undefined1 *)puVar6 = 0;

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

    }

    uVar4 = 0;

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

      do {

        if ((*(char *)(uVar4 + (int)puVar2) == '\0') &&

           (uVar3 = *(uint *)(param_2 + uVar4 * 4), uVar3 != 0xffffffff)) {

          while (uVar3 != uVar4) {

            FUN_005e76fa(uVar4,uVar3);

            FUN_005e75e9(uVar3,param_3,param_2);

            *(undefined1 *)(uVar3 + (int)puVar2) = 1;

            uVar3 = *(uint *)(param_2 + uVar3 * 4);

            if ((uVar3 == 0xffffffff) || (*(char *)(uVar3 + (int)puVar2) != '\0'))

            goto LAB_005eae3b;

          }

          FUN_005e75e9(uVar4,param_3,param_2);

        }

LAB_005eae3b:

        uVar4 = uVar4 + 1;

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

    }

    uVar4 = 0;

    iVar5 = 0;

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

      do {

        piVar1 = (int *)(param_2 + uVar4 * 4);

        if (*piVar1 == -1) {

          *piVar1 = -1;

        }

        else {

          iVar5 = iVar5 + 1;

        }

        uVar4 = uVar4 + 1;

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

    }

    *(int *)(param_1 + 0x264) = iVar5;

  }

  operator_delete(puVar2);

  return local_c;

}





// --- FUN_005eae83 at 0x005EAE83 (size: 254) ---


undefined4 __thiscall FUN_005eae83(int param_1,uint param_2,ushort param_3,char param_4)



{

  int iVar1;

  uint uVar2;

  short *psVar3;

  char cVar4;

  uint uVar5;

  uint uVar6;

  undefined4 *puVar7;

  

  uVar6 = 0;

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

    iVar1 = FUN_005df0f5((uint)*(ushort *)(param_1 + 0x18) * 6);

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

    if (iVar1 == 0) {

LAB_005eaec9:

      operator_delete(*(void **)(param_1 + 0x10));

      return 0x8007000e;

    }

    if (param_4 != '\0') {

      iVar1 = FUN_005df0f5((uint)*(ushort *)(param_1 + 0x18) << 2);

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

      if (iVar1 == 0) goto LAB_005eaec9;

    }

  }

  *(undefined2 *)(param_1 + 8) = 0xffff;

  *(undefined2 *)(param_1 + 10) = 0xffff;

  *(undefined2 *)(param_1 + 0xc) = 0xffff;

  *(undefined2 *)(param_1 + 0xe) = 0xffff;

  *(ushort *)(param_1 + 0x16) = param_3;

  uVar2 = param_2 & 0xffff;

  uVar5 = (uint)param_3;

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

  if (uVar2 < uVar2 + uVar5) {

    do {

      psVar3 = (short *)(*(int *)(param_1 + 4) + uVar2 * 6);

      cVar4 = '\0';

      iVar1 = 3;

      do {

        if (*psVar3 != -1) {

          cVar4 = cVar4 + '\x01';

        }

        psVar3 = psVar3 + 1;

        iVar1 = iVar1 + -1;

      } while (iVar1 != 0);

      iVar1 = (uVar6 & 0xffff) * 6;

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

      *(char *)(iVar1 + 1 + *(int *)(param_1 + 0x10)) = cVar4;

      FUN_005e753a(uVar6);

      uVar6 = uVar6 + 1;

      uVar2 = uVar6 + param_2 & 0xffff;

    } while (uVar2 < *(ushort *)(param_1 + 0x14) + uVar5);

  }

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

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

    for (; uVar5 != 0; uVar5 = uVar5 - 1) {

      *puVar7 = 0;

      puVar7 = puVar7 + 1;

    }

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

  }

  return 0;

}





// --- FUN_005eaf81 at 0x005EAF81 (size: 125) ---


void __thiscall FUN_005eaf81(int param_1,ushort param_2)



{

  ushort uVar1;

  ushort uVar2;

  ushort *puVar3;

  

  uVar2 = param_2 - *(short *)(param_1 + 0x14);

  *(undefined1 *)(*(int *)(param_1 + 0x10) + (uint)uVar2 * 6) = 1;

  FUN_005e74ac(uVar2);

  puVar3 = (ushort *)(*(int *)(param_1 + 4) + (uint)param_2 * 6);

  _param_2 = 3;

  do {

    uVar1 = *puVar3;

    if ((uVar1 != 0xffff) &&

       (*(char *)(*(int *)(param_1 + 0x10) + ((uint)uVar1 - (uint)*(ushort *)(param_1 + 0x14)) * 6)

        == '\0')) {

      FUN_005e758b(uVar1);

    }

    puVar3 = puVar3 + 1;

    _param_2 = _param_2 + -1;

  } while (_param_2 != 0);

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

    *(undefined4 *)(*(int *)(param_1 + 0x20) + (uint)uVar2 * 4) = 0xffffffff;

  }

  return;

}





// --- FUN_005eaffe at 0x005EAFFE (size: 238) ---


undefined4 __thiscall FUN_005eaffe(int param_1,uint param_2,int param_3,char param_4)



{

  int iVar1;

  char cVar2;

  uint uVar3;

  int iVar4;

  undefined4 *puVar5;

  

  iVar4 = 0;

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

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

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

    if (iVar1 == 0) {

LAB_005eb043:

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

      return 0x8007000e;

    }

    if (param_4 != '\0') {

      iVar1 = FUN_005df0f5(*(int *)(param_1 + 0x24) << 2);

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

      if (iVar1 == 0) goto LAB_005eb043;

    }

  }

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

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

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

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

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

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

  if (param_2 < param_2 + param_3) {

    _param_4 = 0;

    iVar1 = param_2 * 0xc;

    do {

      cVar2 = '\0';

      uVar3 = 0;

      do {

        if (*(int *)(*(int *)(param_1 + 4) + iVar1 + uVar3 * 4) != -1) {

          cVar2 = cVar2 + '\x01';

        }

        uVar3 = uVar3 + 1;

      } while (uVar3 < 3);

      *(undefined1 *)(iVar4 + *(int *)(param_1 + 0x18)) = 0;

      *(char *)(iVar4 + 1 + *(int *)(param_1 + 0x18)) = cVar2;

      FUN_005e7866(_param_4);

      param_2 = param_2 + 1;

      iVar1 = iVar1 + 0xc;

      iVar4 = iVar4 + 0xc;

      _param_4 = _param_4 + 1;

    } while (param_2 < (uint)(*(int *)(param_1 + 0x1c) + param_3));

  }

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

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

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

      *puVar5 = 0;

      puVar5 = puVar5 + 1;

    }

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

  }

  return 0;

}





// --- FUN_005eb0ec at 0x005EB0EC (size: 112) ---


void __thiscall FUN_005eb0ec(int param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  

  iVar3 = param_2;

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

  *(undefined1 *)(*(int *)(param_1 + 0x18) + iVar4 * 0xc) = 1;

  FUN_005e77f2(iVar4);

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

  param_2 = 0;

  do {

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

    if ((iVar2 != -1) &&

       (*(char *)(*(int *)(param_1 + 0x18) + (iVar2 - *(int *)(param_1 + 0x1c)) * 0xc) == '\0')) {

      FUN_005e78aa(iVar2);

    }

    param_2 = param_2 + 1;

  } while (param_2 < 3);

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

    *(undefined4 *)(*(int *)(param_1 + 0x2c) + iVar4 * 4) = 0xffffffff;

  }

  return;

}





// --- FUN_005eb15c at 0x005EB15C (size: 269) ---


ushort __thiscall FUN_005eb15c(int param_1,ushort param_2)



{

  ushort uVar1;

  int iVar2;

  ushort uVar3;

  ushort uVar4;

  ushort uVar5;

  ushort uVar6;

  ushort uVar7;

  ushort uVar8;

  ushort *puVar9;

  ushort local_1c;

  int local_18;

  ushort *local_10;

  

  uVar1 = 0;

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

  local_10 = (ushort *)(iVar2 + (uint)param_2 * 6);

  uVar5 = 3;

  uVar4 = 0xffff;

  do {

    uVar7 = *local_10;

    if (uVar7 != 0xffff) {

      if (*(char *)(*(int *)(param_1 + 0x10) + ((uint)uVar7 - (uint)*(ushort *)(param_1 + 0x14)) * 6

                   ) == '\0') {

        uVar6 = FUN_005e78d9(uVar7);

        uVar8 = 0xffff;

        uVar3 = 0xffff;

        local_18 = 3;

        puVar9 = (ushort *)(iVar2 + (uint)uVar7 * 6);

        do {

          if ((*puVar9 != 0xffff) &&

             (*(char *)(*(int *)(param_1 + 0x10) +

                       ((uint)*puVar9 - (uint)*(ushort *)(param_1 + 0x14)) * 6) == '\0')) {

            uVar7 = FUN_005e78d9(*puVar9);

            uVar8 = uVar3;

            if (uVar7 < uVar3) {

              uVar3 = uVar7;

              uVar8 = uVar7;

            }

          }

          puVar9 = puVar9 + 1;

          local_18 = local_18 + -1;

        } while (local_18 != 0);

        if (uVar8 == 0xffff) {

          uVar8 = 0;

        }

        if ((uVar6 < uVar4) || ((uVar6 == uVar4 && (uVar6 = uVar4, uVar8 < local_1c)))) {

          local_1c = uVar8;

          uVar4 = uVar6;

          uVar5 = uVar1;

        }

      }

    }

    uVar1 = uVar1 + 1;

    local_10 = local_10 + 1;

  } while (uVar1 < 3);

  return uVar5;

}





// --- FUN_005eb269 at 0x005EB269 (size: 218) ---


uint __thiscall FUN_005eb269(int param_1,uint param_2)



{

  char *pcVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  uint local_18;

  uint local_14;

  uint local_10;

  uint local_c;

  uint local_8;

  

  iVar4 = param_2;

  local_10 = 0xffffffff;

  param_2 = 0;

  local_14 = 3;

  do {

    iVar2 = *(int *)(*(int *)(param_1 + 4) + iVar4 * 0xc + param_2 * 4);

    if (iVar2 != -1) {

      pcVar1 = (char *)(*(int *)(param_1 + 0x18) + (iVar2 - *(int *)(param_1 + 0x1c)) * 0xc);

      if (*pcVar1 == '\0') {

        uVar5 = (uint)(byte)pcVar1[1];

        uVar6 = 0xffffffff;

        local_8 = 0;

        local_c = 0xffffffff;

        do {

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

          if (((iVar3 != -1) &&

              (pcVar1 = (char *)(*(int *)(param_1 + 0x18) + (iVar3 - *(int *)(param_1 + 0x1c)) * 0xc

                                ), uVar6 = local_c, *pcVar1 == '\0')) &&

             (uVar7 = (uint)(byte)pcVar1[1], uVar7 < local_c)) {

            uVar6 = uVar7;

            local_c = uVar7;

          }

          local_8 = local_8 + 1;

        } while (local_8 < 3);

        if (uVar6 == 0xffffffff) {

          uVar6 = 0;

        }

        if ((uVar5 < local_10) || ((uVar5 == local_10 && (uVar5 = local_10, uVar6 < local_18)))) {

          local_10 = uVar5;

          local_14 = param_2;

          local_18 = uVar6;

        }

      }

    }

    param_2 = param_2 + 1;

  } while (param_2 < 3);

  return local_14;

}





// --- FUN_005eb343 at 0x005EB343 (size: 68) ---


int FUN_005eb343(void *param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  

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

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

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

    iVar3 = iVar2 + -1;

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

    if (iVar2 == 1) {

      FUN_005e5647();

      operator_delete(param_1);

    }

  }

  else {

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

  }

  return iVar3;

}





// --- FUN_005eb387 at 0x005EB387 (size: 68) ---


int FUN_005eb387(void *param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  

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

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

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

    iVar3 = iVar2 + -1;

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

    if (iVar2 == 1) {

      FUN_005e5a2a();

      operator_delete(param_1);

    }

  }

  else {

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

  }

  return iVar3;

}





// --- FUN_005eb3cb at 0x005EB3CB (size: 521) ---


undefined4 * __thiscall

FUN_005eb3cb(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 uVar3;

  int iVar4;

  

  param_1[0x85] = param_4;

  puVar1 = param_1 + 3;

  *param_1 = &PTR_FUN_007ed3b0;

  param_1[0x86] = 4;

  param_1[0x8b] = 0;

  param_1[0x8d] = 0;

  param_1[0x8f] = 0;

  param_1[0x90] = 0;

  param_1[0x91] = 0;

  param_1[0x92] = 0;

  param_1[0x93] = 0;

  param_1[0x94] = 0;

  param_1[0x95] = 0;

  param_1[0x96] = 0;

  param_1[0x97] = 0;

  param_1[0x98] = 0;

  param_1[0x99] = 0;

  param_1[0x9a] = 0;

  param_1[0x9b] = 1;

  param_1[0x9c] = 0;

  param_1[0x8c] = param_2;

  FUN_005e5619(puVar1,param_3);

  uVar3 = FUN_005e4f99(puVar1,0);

  param_1[0x8e] = uVar3;

  param_1[2] = 0;

  iVar4 = FUN_005e4fe9(puVar1,param_1 + 1,1);

  if (iVar4 < 0) {

    param_1[1] = 0;

  }

  uVar2 = param_1[0x85];

  param_1[0x87] = 0;

  param_1[0x89] = 0;

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

    param_1[0x87] = 1;

  }

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

    param_1[0x87] = 2;

  }

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

    param_1[0x89] = 8;

  }

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

    param_1[0x89] = param_1[0x89] | 0x20;

  }

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

    param_1[0x89] = param_1[0x89] | 0x40;

  }

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

    param_1[0x89] = param_1[0x89] | 0x80;

  }

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

    *(byte *)((int)param_1 + 0x225) = *(byte *)((int)param_1 + 0x225) | 1;

  }

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

    *(byte *)((int)param_1 + 0x225) = *(byte *)((int)param_1 + 0x225) | 2;

  }

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

    param_1[0x89] = param_1[0x89] | 0x10;

  }

  puVar1 = param_1 + 0x88;

  *puVar1 = 0;

  param_1[0x8a] = 0;

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

    *puVar1 = 1;

  }

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

    *puVar1 = 2;

  }

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

    param_1[0x8a] = 8;

  }

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

    param_1[0x8a] = param_1[0x8a] | 0x20;

  }

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

    param_1[0x8a] = param_1[0x8a] | 0x40;

  }

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

    param_1[0x8a] = param_1[0x8a] | 0x80;

  }

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

    *(byte *)((int)param_1 + 0x229) = *(byte *)((int)param_1 + 0x229) | 1;

  }

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

    *(byte *)((int)param_1 + 0x229) = *(byte *)((int)param_1 + 0x229) | 2;

  }

  if ((char)(uVar2 >> 8) < '\0') {

    param_1[0x8a] = param_1[0x8a] | 0x10;

  }

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

    param_1[0x86] = param_1[0x86] | 0x20;

  }

  (**(code **)(*(int *)param_1[0x8c] + 4))((int *)param_1[0x8c]);

  (**(code **)(*(int *)param_1[0x8c] + 0x18))((int *)param_1[0x8c],param_1 + 0x8b);

  return param_1;

}





// --- FUN_005eb5d4 at 0x005EB5D4 (size: 668) ---


int FUN_005eb5d4(int param_1,undefined2 *param_2,undefined4 *param_3)



{

  ushort uVar1;

  int iVar2;

  int iVar3;

  undefined2 *puVar4;

  undefined2 *puVar5;

  undefined1 *puVar6;

  int iVar7;

  uint uVar8;

  uint uVar9;

  undefined4 *puVar10;

  undefined1 local_54 [4];

  undefined4 local_50;

  undefined4 local_4c;

  undefined4 local_48;

  undefined4 local_44;

  short local_3c;

  ushort local_3a;

  char local_30;

  undefined4 local_2c;

  uint local_28;

  int local_24;

  uint *local_20;

  uint local_1c;

  uint local_18;

  uint local_14;

  int local_10;

  uint local_c;

  uint local_8;

  

  iVar2 = param_1;

  FUN_005e5e67(param_1);

  local_2c = *(undefined4 *)(iVar2 + 0x250);

  param_1 = 0;

  if (((param_2 == (undefined2 *)0x0) || (param_3 == (undefined4 *)0x0)) ||

     ((*(byte *)(iVar2 + 0x215) & 4) != 0)) {

    param_2 = (undefined2 *)0x8876086c;

  }

  else {

    iVar7 = *(int *)(iVar2 + 0x264);

    iVar3 = FUN_005df0f5(iVar7 * 6);

    if (iVar3 == 0) {

      iVar3 = 0;

    }

    else {

      FUN_00401000(iVar3,6,iVar7,&LAB_005eda5e);

    }

    iVar7 = 0;

    *(int *)(iVar2 + 0x250) = iVar3;

    if (iVar3 == 0) {

      param_2 = (undefined2 *)0x8007000e;

    }

    else {

      uVar8 = 0;

      puVar4 = param_2;

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

        do {

          *(undefined2 *)(iVar7 + *(int *)(iVar2 + 0x250)) = *puVar4;

          *(undefined2 *)(iVar7 + 2 + *(int *)(iVar2 + 0x250)) = puVar4[2];

          puVar5 = puVar4 + 4;

          puVar4 = puVar4 + 6;

          *(undefined2 *)(iVar7 + 4 + *(int *)(iVar2 + 0x250)) = *puVar5;

          uVar8 = uVar8 + 1;

          iVar7 = iVar7 + 6;

        } while (uVar8 < *(uint *)(iVar2 + 0x264));

      }

      puVar10 = param_3;

      for (uVar8 = *(uint *)(iVar2 + 0x23c) & 0x3fffffff; uVar8 != 0; uVar8 = uVar8 - 1) {

        *puVar10 = 0xffffffff;

        puVar10 = puVar10 + 1;

      }

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

        *(undefined1 *)puVar10 = 0xff;

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

      }

      param_2 = (undefined2 *)FUN_005e549b(&param_1,0x10);

      if (-1 < (int)param_2) {

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

        if (*(uint *)(iVar2 + 0x260) == 0) {

          local_4c = *(undefined4 *)(iVar2 + 0x264);

          local_18 = 1;

          puVar6 = local_54;

          local_50 = 0;

          local_48 = 0;

          local_44 = *(undefined4 *)(iVar2 + 0x23c);

        }

        else {

          local_18 = *(uint *)(iVar2 + 0x260);

          puVar6 = *(undefined1 **)(iVar2 + 0x25c);

        }

        local_14 = 0;

        if (local_18 != 0) {

          local_20 = (uint *)(puVar6 + 4);

          do {

            local_c = *local_20;

            uVar8 = local_20[1] + local_c;

            local_1c = uVar8;

            if (local_c < uVar8) {

              iVar7 = local_c * 6;

              do {

                local_8 = 0;

                local_24 = param_1 + iVar7;

                local_10 = iVar7;

                do {

                  uVar1 = *(ushort *)(local_24 + local_8 * 2);

                  if ((uVar1 != 0xffff) && (param_3[uVar1] == -1)) {

                    uVar9 = 0;

                    FUN_005e95ad(local_c,uVar1,0);

                    while (iVar7 = local_10, uVar8 = local_1c, local_3c != -1) {

                      local_28 = FUN_005e9b86();

                      if (local_30 == '\0') {

                        uVar8 = (local_3a + 1) % 3;

                      }

                      else {

                        uVar8 = (uint)local_3a;

                      }

                      uVar9 = uVar9 + 1;

                      param_3[*(ushort *)(param_1 + ((local_28 & 0xffff) * 3 + uVar8) * 2)] =

                           (uint)uVar1;

                      if (10000 < uVar9) {

                        param_2 = (undefined2 *)0x88760b55;

                        goto LAB_005eb838;

                      }

                    }

                  }

                  local_8 = local_8 + 1;

                } while (local_8 < 3);

                local_c = local_c + 1;

                iVar7 = iVar7 + 6;

                local_10 = iVar7;

              } while (local_c < uVar8);

            }

            local_14 = local_14 + 1;

            local_20 = local_20 + 5;

          } while (local_14 < local_18);

        }

        uVar8 = 0;

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

          do {

            if (param_3[uVar8] == 0xffffffff) {

              param_3[uVar8] = uVar8;

            }

            uVar8 = uVar8 + 1;

          } while (uVar8 < *(uint *)(iVar2 + 0x23c));

        }

      }

    }

LAB_005eb838:

    if (param_1 != 0) {

      (**(code **)(**(int **)(iVar2 + 0x248) + 0x30))(*(int **)(iVar2 + 0x248));

    }

  }

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

  operator_delete(*(void **)(iVar2 + 0x250));

  *(undefined4 *)(iVar2 + 0x250) = local_2c;

  return (int)param_2;

}





// --- FUN_005eb870 at 0x005EB870 (size: 521) ---


undefined4 * __thiscall

FUN_005eb870(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 uVar3;

  int iVar4;

  

  param_1[0x85] = param_4;

  puVar1 = param_1 + 3;

  *param_1 = &PTR_FUN_007ed428;

  param_1[0x86] = 4;

  param_1[0x8b] = 0;

  param_1[0x8d] = 0;

  param_1[0x8f] = 0;

  param_1[0x90] = 0;

  param_1[0x91] = 0;

  param_1[0x92] = 0;

  param_1[0x93] = 0;

  param_1[0x94] = 0;

  param_1[0x95] = 0;

  param_1[0x96] = 0;

  param_1[0x97] = 0;

  param_1[0x98] = 0;

  param_1[0x99] = 0;

  param_1[0x9a] = 0;

  param_1[0x9b] = 1;

  param_1[0x9c] = 0;

  param_1[0x8c] = param_2;

  FUN_005e5619(puVar1,param_3);

  uVar3 = FUN_005e4f99(puVar1,0);

  param_1[0x8e] = uVar3;

  param_1[2] = 0;

  iVar4 = FUN_005e4fe9(puVar1,param_1 + 1,1);

  if (iVar4 < 0) {

    param_1[1] = 0;

  }

  uVar2 = param_1[0x85];

  param_1[0x87] = 0;

  param_1[0x89] = 0;

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

    param_1[0x87] = 1;

  }

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

    param_1[0x87] = 2;

  }

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

    param_1[0x89] = 8;

  }

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

    param_1[0x89] = param_1[0x89] | 0x20;

  }

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

    param_1[0x89] = param_1[0x89] | 0x40;

  }

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

    param_1[0x89] = param_1[0x89] | 0x80;

  }

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

    *(byte *)((int)param_1 + 0x225) = *(byte *)((int)param_1 + 0x225) | 1;

  }

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

    *(byte *)((int)param_1 + 0x225) = *(byte *)((int)param_1 + 0x225) | 2;

  }

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

    param_1[0x89] = param_1[0x89] | 0x10;

  }

  puVar1 = param_1 + 0x88;

  *puVar1 = 0;

  param_1[0x8a] = 0;

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

    *puVar1 = 1;

  }

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

    *puVar1 = 2;

  }

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

    param_1[0x8a] = 8;

  }

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

    param_1[0x8a] = param_1[0x8a] | 0x20;

  }

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

    param_1[0x8a] = param_1[0x8a] | 0x40;

  }

  if ((uVar2 & 8) != 0) {

    param_1[0x8a] = param_1[0x8a] | 0x80;

  }

  if ((uVar2 & 0x4000) != 0) {

    *(byte *)((int)param_1 + 0x229) = *(byte *)((int)param_1 + 0x229) | 1;

  }

  if ((uVar2 & 0x80) != 0) {

    *(byte *)((int)param_1 + 0x229) = *(byte *)((int)param_1 + 0x229) | 2;

  }

  if ((char)(uVar2 >> 8) < '\0') {

    param_1[0x8a] = param_1[0x8a] | 0x10;

  }

  if ((uVar2 & 0x1000) != 0) {

    param_1[0x86] = param_1[0x86] | 0x20;

  }

  (**(code **)(*(int *)param_1[0x8c] + 4))((int *)param_1[0x8c]);

  (**(code **)(*(int *)param_1[0x8c] + 0x18))((int *)param_1[0x8c],param_1 + 0x8b);

  return param_1;

}





// --- FUN_005eba79 at 0x005EBA79 (size: 493) ---


int FUN_005eba79(int param_1,uint param_2,int param_3,int param_4,undefined4 *param_5)



{

  int *piVar1;

  int iVar2;

  uint uVar3;

  int *piVar4;

  int iVar5;

  int *local_c;

  int *local_8;

  

  local_c = (int *)0x0;

  if (param_3 == 0) {

    param_3 = param_1 + 0xc;

  }

  iVar2 = FUN_005e532a(param_3,0);

  if (iVar2 == 0) {

    return -0x7789f794;

  }

  if (((((param_2 & 0xfffe2000) != 0) ||

       ((uVar3 = param_2 & 0x1000, uVar3 != 0 &&

        (iVar2 = FUN_005e55a4(param_3,param_1 + 0xc), iVar2 == 0)))) ||

      ((uVar3 != 0 && (param_4 != *(int *)(param_1 + 0x230))))) ||

     (((*(uint *)(param_1 + 0x214) & 0x400) != 0 || ((*(uint *)(param_1 + 0x214) & 0x40) != 0)))) {

    return -0x7789f794;

  }

  if ((param_2 & 1) == 0) {

    if ((0xffff < *(uint *)(param_1 + 0x264)) || (0xffff < *(uint *)(param_1 + 0x23c))) {

      iVar2 = -0x7789f794;

      goto LAB_005ebc39;

    }

    iVar2 = FUN_005df0f5(0x27c);

    if (iVar2 == 0) {

      piVar4 = (int *)0x0;

    }

    else {

      piVar4 = (int *)FUN_005eb3cb(param_4,param_3,param_2);

    }

    if (piVar4 == (int *)0x0) {

      return -0x7ff8fff2;

    }

    iVar2 = FUN_005ebc66(piVar4);

    if (-1 < iVar2) {

      if (uVar3 != 0) {

        *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x20;

        piVar4[0x8d] = *(int *)(param_1 + 0x234);

        piVar1 = *(int **)(param_1 + 0x234);

        (**(code **)(*piVar1 + 4))(piVar1);

      }

      iVar5 = piVar4[0x8d];

      local_c = piVar4;

      goto LAB_005ebc13;

    }

  }

  else {

    iVar2 = FUN_005df0f5(0x27c);

    if (iVar2 == 0) {

      local_8 = (int *)0x0;

    }

    else {

      local_8 = (int *)FUN_005eb870(param_4,param_3,param_2);

    }

    if (local_8 == (int *)0x0) {

      return -0x7ff8fff2;

    }

    iVar2 = FUN_005ebe8d(local_8);

    if (iVar2 < 0) goto LAB_005ebc50;

    if (uVar3 != 0) {

      *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x20;

      local_8[0x8d] = *(int *)(param_1 + 0x234);

      piVar4 = *(int **)(param_1 + 0x234);

      (**(code **)(*piVar4 + 4))(piVar4);

    }

    iVar5 = local_8[0x8d];

    local_c = local_8;

LAB_005ebc13:

    if ((uVar3 != 0) || (iVar2 = FUN_005ec09a(param_3,iVar5), -1 < iVar2)) {

      *param_5 = local_c;

      return iVar2;

    }

LAB_005ebc39:

    piVar4 = (int *)0x0;

    if (local_c == (int *)0x0) {

      return iVar2;

    }

    (**(code **)(*local_c + 8))(local_c);

  }

  local_8 = (int *)0x0;

  if (piVar4 == (int *)0x0) {

    return iVar2;

  }

  (**(code **)(*piVar4 + 8))(piVar4);

LAB_005ebc50:

  if (local_8 != (int *)0x0) {

    (**(code **)(*local_8 + 8))(local_8);

  }

  return iVar2;

}





// --- FUN_005ebc66 at 0x005EBC66 (size: 551) ---


int __thiscall FUN_005ebc66(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 *puVar3;

  uint uVar4;

  int iVar5;

  uint uVar6;

  int iVar7;

  undefined4 *puVar8;

  int local_18;

  int local_14;

  int local_10;

  int local_c;

  uint local_8;

  

  iVar2 = param_2;

  local_14 = 0;

  *(uint *)(param_2 + 0x218) =

       (*(uint *)(param_1 + 0x218) ^ *(uint *)(param_2 + 0x218)) & 0x20 ^ *(uint *)(param_1 + 0x218)

  ;

  local_18 = 0;

  local_c = FUN_005e7f7d(*(undefined4 *)(param_1 + 0x264),*(undefined4 *)(param_1 + 0x23c));

  if (((-1 < local_c) && (local_c = FUN_005e549b(&local_18,0), -1 < local_c)) &&

     (local_c = FUN_005e549b(&local_14,0x10), -1 < local_c)) {

    if ((*(byte *)(param_1 + 0x218) & 4) != 0) {

      puVar3 = *(undefined4 **)(param_1 + 0x254);

      puVar8 = *(undefined4 **)(param_2 + 0x254);

      for (uVar4 = *(uint *)(param_1 + 0x264) & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

        *puVar8 = *puVar3;

        puVar3 = puVar3 + 1;

        puVar8 = puVar8 + 1;

      }

      for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

        *(undefined1 *)puVar8 = *(undefined1 *)puVar3;

        puVar3 = (undefined4 *)((int)puVar3 + 1);

        puVar8 = (undefined4 *)((int)puVar8 + 1);

      }

    }

    if ((*(byte *)(param_1 + 0x218) & 8) != 0) {

      uVar6 = *(int *)(param_1 + 0x264) << 1;

      puVar3 = *(undefined4 **)(param_1 + 600);

      puVar8 = *(undefined4 **)(param_2 + 600);

      for (uVar4 = uVar6 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

        *puVar8 = *puVar3;

        puVar3 = puVar3 + 1;

        puVar8 = puVar8 + 1;

      }

      for (uVar6 = uVar6 & 3; uVar6 != 0; uVar6 = uVar6 - 1) {

        *(undefined1 *)puVar8 = *(undefined1 *)puVar3;

        puVar3 = (undefined4 *)((int)puVar3 + 1);

        puVar8 = (undefined4 *)((int)puVar8 + 1);

      }

    }

    if (*(int *)(param_1 + 0x25c) != 0) {

      puVar3 = (undefined4 *)FUN_005df0f5(*(int *)(param_1 + 0x260) * 0x14);

      *(undefined4 **)(param_2 + 0x25c) = puVar3;

      if (puVar3 == (undefined4 *)0x0) {

        local_c = -0x7ff8fff2;

        goto LAB_005ebe61;

      }

      puVar8 = *(undefined4 **)(param_1 + 0x25c);

      for (uVar4 = *(int *)(param_1 + 0x260) * 5 & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

        *puVar3 = *puVar8;

        puVar8 = puVar8 + 1;

        puVar3 = puVar3 + 1;

      }

      for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

        *(undefined1 *)puVar3 = *(undefined1 *)puVar8;

        puVar8 = (undefined4 *)((int)puVar8 + 1);

        puVar3 = (undefined4 *)((int)puVar3 + 1);

      }

      *(undefined4 *)(param_2 + 0x260) = *(undefined4 *)(param_1 + 0x260);

    }

    iVar5 = 0;

    local_8 = 0;

    if (*(int *)(param_1 + 0x264) != 0) {

      local_10 = 0;

      do {

        uVar4 = 0;

        do {

          if (*(int *)(local_10 + local_14 + uVar4 * 4) == -1) {

            *(undefined2 *)(iVar5 + local_18 + uVar4 * 2) = 0xffff;

          }

          else {

            *(undefined2 *)(iVar5 + local_18 + uVar4 * 2) =

                 *(undefined2 *)(local_10 + local_14 + uVar4 * 4);

          }

          uVar4 = uVar4 + 1;

        } while (uVar4 < 3);

        local_8 = local_8 + 1;

        local_10 = local_10 + 0xc;

        iVar5 = iVar5 + 6;

      } while (local_8 < *(uint *)(param_1 + 0x264));

    }

    if (((*(byte *)(param_1 + 0x218) & 1) != 0) && (local_8 = 0, *(int *)(param_1 + 0x264) != 0)) {

      local_10 = 0;

      param_2 = 0;

      do {

        iVar5 = *(int *)(iVar2 + 0x250) + param_2;

        iVar7 = *(int *)(param_1 + 0x250) + local_10;

        uVar4 = 0;

        do {

          if (*(int *)(iVar7 + uVar4 * 4) == -1) {

            *(undefined2 *)(iVar5 + uVar4 * 2) = 0xffff;

          }

          else {

            *(undefined2 *)(iVar5 + uVar4 * 2) = *(undefined2 *)(iVar7 + uVar4 * 4);

          }

          uVar4 = uVar4 + 1;

        } while (uVar4 < 3);

        local_8 = local_8 + 1;

        param_2 = param_2 + 6;

        local_10 = local_10 + 0xc;

      } while (local_8 < *(uint *)(param_1 + 0x264));

    }

  }

LAB_005ebe61:

  if (local_14 != 0) {

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  }

  if (local_18 != 0) {

    piVar1 = *(int **)(iVar2 + 0x248);

    (**(code **)(*piVar1 + 0x30))(piVar1);

  }

  return local_c;

}





// --- FUN_005ebe8d at 0x005EBE8D (size: 525) ---


int __thiscall FUN_005ebe8d(int param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  uint uVar4;

  int iVar5;

  uint uVar6;

  int *piVar7;

  int iVar8;

  undefined4 *puVar9;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  

  iVar2 = param_2;

  local_c = 0;

  *(uint *)(param_2 + 0x218) =

       (*(uint *)(param_1 + 0x218) ^ *(uint *)(param_2 + 0x218)) & 0x20 ^ *(uint *)(param_1 + 0x218)

  ;

  local_10 = 0;

  local_8 = FUN_005e8c73(*(undefined4 *)(param_1 + 0x264),*(undefined4 *)(param_1 + 0x23c));

  if (((-1 < local_8) && (local_8 = FUN_005e549b(&local_10,0), -1 < local_8)) &&

     (local_8 = FUN_005e549b(&local_c,0x10), -1 < local_8)) {

    if ((*(byte *)(param_1 + 0x218) & 4) != 0) {

      puVar3 = *(undefined4 **)(param_1 + 0x254);

      puVar9 = *(undefined4 **)(param_2 + 0x254);

      for (uVar4 = *(uint *)(param_1 + 0x264) & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

        *puVar9 = *puVar3;

        puVar3 = puVar3 + 1;

        puVar9 = puVar9 + 1;

      }

      for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

        *(undefined1 *)puVar9 = *(undefined1 *)puVar3;

        puVar3 = (undefined4 *)((int)puVar3 + 1);

        puVar9 = (undefined4 *)((int)puVar9 + 1);

      }

    }

    if ((*(byte *)(param_1 + 0x218) & 8) != 0) {

      uVar6 = *(int *)(param_1 + 0x264) << 1;

      puVar3 = *(undefined4 **)(param_1 + 600);

      puVar9 = *(undefined4 **)(param_2 + 600);

      for (uVar4 = uVar6 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

        *puVar9 = *puVar3;

        puVar3 = puVar3 + 1;

        puVar9 = puVar9 + 1;

      }

      for (uVar6 = uVar6 & 3; uVar6 != 0; uVar6 = uVar6 - 1) {

        *(undefined1 *)puVar9 = *(undefined1 *)puVar3;

        puVar3 = (undefined4 *)((int)puVar3 + 1);

        puVar9 = (undefined4 *)((int)puVar9 + 1);

      }

    }

    if (*(int *)(param_1 + 0x25c) != 0) {

      puVar3 = (undefined4 *)FUN_005df0f5(*(int *)(param_1 + 0x260) * 0x14);

      *(undefined4 **)(param_2 + 0x25c) = puVar3;

      if (puVar3 == (undefined4 *)0x0) {

        local_8 = -0x7ff8fff2;

        goto LAB_005ec06c;

      }

      puVar9 = *(undefined4 **)(param_1 + 0x25c);

      for (uVar4 = *(int *)(param_1 + 0x260) * 5 & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

        *puVar3 = *puVar9;

        puVar9 = puVar9 + 1;

        puVar3 = puVar3 + 1;

      }

      for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

        *(undefined1 *)puVar3 = *(undefined1 *)puVar9;

        puVar9 = (undefined4 *)((int)puVar9 + 1);

        puVar3 = (undefined4 *)((int)puVar3 + 1);

      }

      *(undefined4 *)(param_2 + 0x260) = *(undefined4 *)(param_1 + 0x260);

    }

    iVar5 = 0;

    param_2 = 0;

    if (*(int *)(param_1 + 0x264) != 0) {

      do {

        piVar7 = (int *)(local_10 + iVar5);

        iVar8 = (local_c + iVar5) - (int)piVar7;

        local_14 = 3;

        do {

          iVar1 = *(int *)(iVar8 + (int)piVar7);

          if (iVar1 == -1) {

            *piVar7 = -1;

          }

          else {

            *piVar7 = iVar1;

          }

          piVar7 = piVar7 + 1;

          local_14 = local_14 + -1;

        } while (local_14 != 0);

        param_2 = param_2 + 1;

        iVar5 = iVar5 + 0xc;

      } while (param_2 < *(uint *)(param_1 + 0x264));

    }

    if ((*(byte *)(param_1 + 0x218) & 1) != 0) {

      iVar5 = 0;

      param_2 = 0;

      if (*(int *)(param_1 + 0x264) != 0) {

        do {

          piVar7 = (int *)(*(int *)(iVar2 + 0x250) + iVar5);

          iVar8 = (*(int *)(param_1 + 0x250) + iVar5) - (int)piVar7;

          local_14 = 3;

          do {

            iVar1 = *(int *)((int)piVar7 + iVar8);

            if (iVar1 == -1) {

              *piVar7 = -1;

            }

            else {

              *piVar7 = iVar1;

            }

            piVar7 = piVar7 + 1;

            local_14 = local_14 + -1;

          } while (local_14 != 0);

          param_2 = param_2 + 1;

          iVar5 = iVar5 + 0xc;

        } while (param_2 < *(uint *)(param_1 + 0x264));

      }

    }

  }

LAB_005ec06c:

  if (local_c != 0) {

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  }

  if (local_10 != 0) {

    piVar7 = *(int **)(iVar2 + 0x248);

    (**(code **)(*piVar7 + 0x30))(piVar7);

  }

  return local_8;

}





// --- FUN_005ec09a at 0x005EC09A (size: 232) ---


int __thiscall FUN_005ec09a(int param_1,undefined4 param_2,int *param_3)



{

  int iVar1;

  uint uVar2;

  undefined4 *puVar3;

  uint uVar4;

  undefined4 *puVar5;

  int local_10;

  undefined4 *local_c;

  undefined4 *local_8;

  

  uVar4 = 0;

  local_c = (undefined4 *)0x0;

  local_8 = (undefined4 *)0x0;

  local_10 = (**(code **)(*param_3 + 0x2c))(param_3,0,0,&local_c,0x800);

  if ((-1 < local_10) && (local_10 = FUN_005e5e41(&local_8,0x10), -1 < local_10)) {

    iVar1 = FUN_005e55a4(param_2,param_1 + 0xc);

    if (iVar1 == 0) {

      FUN_005e7d33(param_1 + 0xc,param_2);

      FUN_005e54c1(local_8,local_c);

      if (*(uint *)(param_1 + 0x23c) != 0) {

        do {

          FUN_005e54ec(uVar4,uVar4,1);

          uVar4 = uVar4 + 1;

        } while (uVar4 < *(uint *)(param_1 + 0x23c));

      }

    }

    else {

      uVar2 = *(int *)(param_1 + 0x23c) * *(int *)(param_1 + 0x238);

      puVar3 = local_8;

      puVar5 = local_c;

      for (uVar4 = uVar2 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

        *puVar5 = *puVar3;

        puVar3 = puVar3 + 1;

        puVar5 = puVar5 + 1;

      }

      for (uVar2 = uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) {

        *(undefined1 *)puVar5 = *(undefined1 *)puVar3;

        puVar3 = (undefined4 *)((int)puVar3 + 1);

        puVar5 = (undefined4 *)((int)puVar5 + 1);

      }

    }

  }

  if (local_c != (undefined4 *)0x0) {

    (**(code **)(*param_3 + 0x30))(param_3);

  }

  if (local_8 != (undefined4 *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

  }

  return local_10;

}





// --- FUN_005ec182 at 0x005EC182 (size: 653) ---


int FUN_005ec182(int param_1,undefined4 *param_2,undefined4 *param_3)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  undefined1 *puVar5;

  int iVar6;

  int iVar7;

  uint uVar8;

  int local_54;

  uint local_50;

  char local_44;

  undefined1 local_40 [4];

  undefined4 local_3c;

  undefined4 local_38;

  undefined4 local_34;

  undefined4 local_30;

  undefined4 local_2c;

  int local_28;

  uint *local_24;

  int local_20;

  uint local_1c;

  uint local_18;

  uint local_14;

  uint local_10;

  uint local_c;

  uint local_8;

  

  iVar1 = param_1;

  FUN_005e5e91(param_1);

  local_2c = *(undefined4 *)(iVar1 + 0x250);

  param_1 = 0;

  if (((param_2 == (undefined4 *)0x0) || (param_3 == (undefined4 *)0x0)) ||

     ((*(byte *)(iVar1 + 0x215) & 4) != 0)) {

    param_2 = (undefined4 *)0x8876086c;

  }

  else {

    iVar7 = *(int *)(iVar1 + 0x264);

    iVar2 = FUN_005df0f5(iVar7 * 0xc);

    if (iVar2 == 0) {

      iVar2 = 0;

    }

    else {

      FUN_00401000(iVar2,0xc,iVar7,&LAB_005eda5e);

    }

    iVar7 = 0;

    *(int *)(iVar1 + 0x250) = iVar2;

    if (iVar2 == 0) {

      param_2 = (undefined4 *)0x8007000e;

    }

    else {

      uVar8 = 0;

      puVar3 = param_2;

      if (*(int *)(iVar1 + 0x264) != 0) {

        do {

          *(undefined4 *)(iVar7 + *(int *)(iVar1 + 0x250)) = *puVar3;

          *(undefined4 *)(iVar7 + 4 + *(int *)(iVar1 + 0x250)) = puVar3[1];

          puVar4 = puVar3 + 2;

          puVar3 = puVar3 + 3;

          *(undefined4 *)(iVar7 + 8 + *(int *)(iVar1 + 0x250)) = *puVar4;

          uVar8 = uVar8 + 1;

          iVar7 = iVar7 + 0xc;

        } while (uVar8 < *(uint *)(iVar1 + 0x264));

      }

      puVar3 = param_3;

      for (uVar8 = *(uint *)(iVar1 + 0x23c) & 0x3fffffff; uVar8 != 0; uVar8 = uVar8 - 1) {

        *puVar3 = 0xffffffff;

        puVar3 = puVar3 + 1;

      }

      for (iVar7 = 0; iVar7 != 0; iVar7 = iVar7 + -1) {

        *(undefined1 *)puVar3 = 0xff;

        puVar3 = (undefined4 *)((int)puVar3 + 1);

      }

      param_2 = (undefined4 *)FUN_005e549b(&param_1,0x10);

      if (-1 < (int)param_2) {

        *(int *)(iVar1 + 0x24c) = param_1;

        if (*(uint *)(iVar1 + 0x260) == 0) {

          local_38 = *(undefined4 *)(iVar1 + 0x264);

          local_18 = 1;

          puVar5 = local_40;

          local_3c = 0;

          local_34 = 0;

          local_30 = *(undefined4 *)(iVar1 + 0x23c);

        }

        else {

          local_18 = *(uint *)(iVar1 + 0x260);

          puVar5 = *(undefined1 **)(iVar1 + 0x25c);

        }

        local_14 = 0;

        if (local_18 != 0) {

          local_24 = (uint *)(puVar5 + 4);

          do {

            local_c = *local_24;

            uVar8 = local_24[1] + local_c;

            local_1c = uVar8;

            if (local_c < uVar8) {

              iVar7 = local_c * 0xc;

              do {

                local_8 = 0;

                local_28 = param_1 + iVar7;

                local_20 = iVar7;

                do {

                  iVar2 = *(int *)(local_28 + local_8 * 4);

                  if ((iVar2 != -1) && (param_3[iVar2] == -1)) {

                    FUN_005e9620(local_c,iVar2,0);

                    local_10 = 0;

                    while (uVar8 = local_1c, local_54 != -1) {

                      iVar6 = FUN_005e9c92();

                      uVar8 = local_50;

                      if (local_44 == '\0') {

                        uVar8 = (local_50 + 1) % 3;

                        iVar7 = local_20;

                      }

                      local_10 = local_10 + 1;

                      param_3[*(int *)(param_1 + uVar8 * 4 + iVar6 * 0xc)] = iVar2;

                      if (10000 < local_10) {

                        param_2 = (undefined4 *)0x88760b55;

                        goto LAB_005ec3d7;

                      }

                    }

                  }

                  local_8 = local_8 + 1;

                } while (local_8 < 3);

                local_c = local_c + 1;

                iVar7 = iVar7 + 0xc;

                local_20 = iVar7;

              } while (local_c < uVar8);

            }

            local_14 = local_14 + 1;

            local_24 = local_24 + 5;

          } while (local_14 < local_18);

        }

        uVar8 = 0;

        if (*(int *)(iVar1 + 0x23c) != 0) {

          do {

            if (param_3[uVar8] == 0xffffffff) {

              param_3[uVar8] = uVar8;

            }

            uVar8 = uVar8 + 1;

          } while (uVar8 < *(uint *)(iVar1 + 0x23c));

        }

      }

    }

LAB_005ec3d7:

    if (param_1 != 0) {

      (**(code **)(**(int **)(iVar1 + 0x248) + 0x30))(*(int **)(iVar1 + 0x248));

    }

  }

  *(undefined4 *)(iVar1 + 0x24c) = 0;

  operator_delete(*(void **)(iVar1 + 0x250));

  *(undefined4 *)(iVar1 + 0x250) = local_2c;

  return (int)param_2;

}





// --- FUN_005ec40f at 0x005EC40F (size: 661) ---


int FUN_005ec40f(undefined4 param_1,int param_2,int param_3,uint param_4,uint param_5,int param_6,

                uint param_7,int param_8)



{

  ushort *puVar1;

  ushort uVar2;

  uint uVar3;

  bool bVar4;

  uint *puVar5;

  uint uVar6;

  undefined4 uVar7;

  uint *puVar8;

  uint uVar9;

  bool bVar10;

  int iVar11;

  undefined1 local_58 [8];

  undefined1 local_50 [12];

  uint local_44;

  undefined1 local_40 [8];

  undefined1 local_38 [12];

  uint local_2c;

  uint local_28;

  uint local_24;

  uint local_20;

  uint local_1c;

  uint local_18;

  uint local_14;

  int local_10;

  int local_c;

  int local_8;

  

  local_10 = param_4 - param_5;

  local_18 = 0xffffffff;

  local_14 = 0xffffffff;

  local_1c = 0xffffffff;

  local_8 = 0;

  local_20 = 0xffff;

  local_c = FUN_005e6293();

  if ((-1 < local_c) && (local_c = FUN_005eae83(param_6,param_7,0), -1 < local_c)) {

    param_7 = 0;

LAB_005ec466:

    local_18 = FUN_005e624b();

    local_18 = local_18 & 0xffff;

    if (local_18 != 0xffff) {

      puVar1 = (ushort *)(*(int *)(param_2 + 4) + local_18 * 6);

      uVar2 = *puVar1;

      if ((uVar2 == 0xffff) ||

         (*(char *)(*(int *)(param_2 + 0x10) + ((uint)uVar2 - (uint)*(ushort *)(param_2 + 0x14)) * 6

                   ) != '\0')) {

        uVar2 = puVar1[1];

        if ((uVar2 == 0xffff) ||

           (*(char *)(*(int *)(param_2 + 0x10) +

                     ((uint)uVar2 - (uint)*(ushort *)(param_2 + 0x14)) * 6) != '\0')) {

          local_14 = 0;

        }

        else {

          local_14 = 2;

        }

      }

      else {

        local_14 = 1;

      }

      do {

        uVar9 = local_18;

        if (local_20 != 0xffff) {

          param_4 = 1;

          uVar6 = local_14;

          local_28 = local_18;

          while( true ) {

            local_24 = uVar6;

            puVar5 = (uint *)FUN_005e719b(local_38,&local_28,param_2);

            uVar3 = *puVar5;

            uVar6 = puVar5[1];

            local_2c = uVar6;

            if ((uVar3 == 0xffff) ||

               (*(char *)(*(int *)(param_2 + 0x10) +

                         ((uVar3 & 0xffff) - (uint)*(ushort *)(param_2 + 0x14)) * 6) != '\0'))

            break;

            param_4 = param_4 + 1;

            local_28 = uVar3;

          }

          if (local_10 < (int)(param_4 + -1 + local_8)) {

            if (*(char *)(*(int *)(param_2 + 0x10) +

                         ((local_20 & 0xffff) - (uint)*(ushort *)(param_2 + 0x14)) * 6) == '\0') {

              local_18 = local_20;

              local_14 = local_1c;

              uVar9 = local_20;

            }

            local_20 = 0xffff;

          }

        }

        while( true ) {

          while( true ) {

            FUN_005eaf81(uVar9);

            uVar6 = param_7 & 0xffff;

            param_7 = param_7 + 1;

            param_4 = 0;

            *(uint *)(param_3 + uVar9 * 4) = uVar6 + param_6;

            iVar11 = param_8 + uVar9 * 6;

            do {

              FUN_005ea484(*(undefined2 *)(iVar11 + param_4 * 2),(int)&param_5 + 3);

              local_8 = local_8 + (1 - (param_5 >> 0x18));

              param_4 = param_4 + 1;

            } while (param_4 < 3);

            puVar5 = (uint *)FUN_005e719b(local_40,&local_18,param_2);

            local_44 = puVar5[1];

            iVar11 = param_2;

            uVar7 = FUN_005e723b(local_50,&local_18);

            puVar8 = (uint *)FUN_005e719b(local_58,uVar7,iVar11);

            uVar9 = local_20;

            local_44 = puVar8[1];

            if ((*puVar5 == 0xffff) ||

               (bVar10 = true,

               *(char *)(*(int *)(param_2 + 0x10) +

                        ((*puVar5 & 0xffff) - (uint)*(ushort *)(param_2 + 0x14)) * 6) != '\0')) {

              bVar10 = false;

            }

            if ((*puVar8 == 0xffff) ||

               (*(char *)(*(int *)(param_2 + 0x10) +

                         ((*puVar8 & 0xffff) - (uint)*(ushort *)(param_2 + 0x14)) * 6) != '\0')) {

              bVar4 = false;

            }

            else {

              bVar4 = true;

            }

            if (!bVar10) break;

            if ((bVar4) && (local_20 == 0xffff)) {

              local_20 = *puVar8;

              local_1c = puVar8[1];

              local_8 = 0;

            }

            uVar9 = *puVar5;

            local_14 = puVar5[1];

            local_18 = uVar9;

          }

          if (bVar4) break;

          local_18 = local_20;

          bVar10 = local_20 == 0xffff;

          local_14 = local_1c;

          local_20 = 0xffff;

          if ((bVar10) ||

             (*(char *)(*(int *)(param_2 + 0x10) +

                       ((uVar9 & 0xffff) - (uint)*(ushort *)(param_2 + 0x14)) * 6) != '\0'))

          goto LAB_005ec466;

        }

        local_18 = *puVar8;

        local_14 = puVar8[1];

      } while( true );

    }

  }

  return local_c;

}





// --- FUN_005ec6a4 at 0x005EC6A4 (size: 620) ---


int FUN_005ec6a4(undefined4 param_1,int param_2,int param_3,uint param_4,int param_5,int param_6,

                int param_7,int param_8)



{

  bool bVar1;

  bool bVar2;

  int *piVar3;

  undefined4 uVar4;

  int *piVar5;

  int iVar6;

  uint uVar7;

  int iVar8;

  undefined1 local_50 [8];

  undefined1 local_48 [12];

  int local_3c;

  undefined1 local_38 [8];

  undefined1 local_30 [8];

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  

  local_10 = param_4 - param_5;

  local_8 = 0;

  local_18 = -1;

  local_14 = 0xffffffff;

  local_1c = -1;

  local_20 = -1;

  local_c = FUN_005e6335();

  if ((-1 < local_c) && (local_c = FUN_005eaffe(param_6,param_7,0), -1 < local_c)) {

    param_7 = 0;

    local_18 = FUN_005e6274();

LAB_005ec8ed:

    if (local_18 != -1) {

      piVar3 = (int *)(*(int *)(param_2 + 4) + local_18 * 0xc);

      iVar8 = *piVar3;

      if ((iVar8 == -1) ||

         (*(char *)(*(int *)(param_2 + 0x18) + (iVar8 - *(int *)(param_2 + 0x1c)) * 0xc) != '\0')) {

        iVar8 = piVar3[1];

        if ((iVar8 == -1) ||

           (*(char *)(*(int *)(param_2 + 0x18) + (iVar8 - *(int *)(param_2 + 0x1c)) * 0xc) != '\0'))

        {

          local_14 = 0;

        }

        else {

          local_14 = 2;

        }

      }

      else {

        local_14 = 1;

      }

      do {

        iVar8 = local_18;

        if (local_20 != -1) {

          param_5 = 1;

          local_24 = local_14;

          local_28 = local_18;

          while( true ) {

            piVar3 = (int *)FUN_005e71ef(local_30,&local_28,param_2);

            iVar6 = *piVar3;

            if ((iVar6 == -1) ||

               (*(char *)(*(int *)(param_2 + 0x18) + (iVar6 - *(int *)(param_2 + 0x1c)) * 0xc) !=

                '\0')) break;

            param_5 = param_5 + 1;

            local_28 = iVar6;

            local_24 = piVar3[1];

          }

          if (local_10 < param_5 + -1 + local_8) {

            if (*(char *)(*(int *)(param_2 + 0x18) + (local_20 - *(int *)(param_2 + 0x1c)) * 0xc) ==

                '\0') {

              local_18 = local_20;

              local_14 = local_1c;

              iVar8 = local_20;

            }

            local_20 = -1;

          }

        }

        while( true ) {

          while( true ) {

            FUN_005eb0ec(iVar8);

            iVar6 = param_7 + param_6;

            param_7 = param_7 + 1;

            *(int *)(param_3 + iVar8 * 4) = iVar6;

            iVar8 = param_8 + iVar8 * 0xc;

            uVar7 = 0;

            do {

              FUN_005ea4ac(*(undefined4 *)(iVar8 + uVar7 * 4),(int)&param_4 + 3);

              local_8 = local_8 + (1 - (param_4 >> 0x18));

              uVar7 = uVar7 + 1;

            } while (uVar7 < 3);

            piVar3 = (int *)FUN_005e71ef(local_38,&local_18,param_2);

            local_3c = piVar3[1];

            iVar6 = *piVar3;

            iVar8 = param_2;

            uVar4 = FUN_005e723b(local_48,&local_18);

            piVar5 = (int *)FUN_005e71ef(local_50,uVar4,iVar8);

            iVar8 = local_20;

            local_3c = piVar5[1];

            if ((iVar6 == -1) ||

               (*(char *)(*(int *)(param_2 + 0x18) + (iVar6 - *(int *)(param_2 + 0x1c)) * 0xc) !=

                '\0')) {

              bVar1 = false;

            }

            else {

              bVar1 = true;

            }

            if ((*piVar5 == -1) ||

               (*(char *)(*(int *)(param_2 + 0x18) + (*piVar5 - *(int *)(param_2 + 0x1c)) * 0xc) !=

                '\0')) {

              bVar2 = false;

            }

            else {

              bVar2 = true;

            }

            if (!bVar1) break;

            if ((bVar2) && (local_20 == -1)) {

              local_20 = *piVar5;

              local_1c = piVar5[1];

              local_8 = 0;

            }

            iVar8 = *piVar3;

            local_14 = piVar3[1];

            local_18 = iVar8;

          }

          if (bVar2) break;

          local_20 = -1;

          local_18 = iVar8;

          local_14 = local_1c;

          if ((iVar8 == -1) ||

             (*(char *)(*(int *)(param_2 + 0x18) + (iVar8 - *(int *)(param_2 + 0x1c)) * 0xc) != '\0'

             )) {

            local_18 = FUN_005e6274();

            goto LAB_005ec8ed;

          }

        }

        local_18 = *piVar5;

        local_14 = piVar5[1];

      } while( true );

    }

  }

  return local_c;

}





// --- FUN_005ec910 at 0x005EC910 (size: 269) ---


int __thiscall FUN_005ec910(int param_1,uint param_2,int param_3,int param_4)



{

  int iVar1;

  int iVar2;

  ushort uVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  int local_18;

  uint local_10;

  int local_c;

  

  iVar2 = param_2;

  local_18 = 0;

  local_10 = 0;

  if (*(int *)(param_1 + 0x260) != 0) {

    local_c = 0;

    do {

      iVar6 = 0;

      iVar4 = *(int *)(param_1 + 0x25c) + local_c;

      iVar1 = *(int *)(iVar4 + 4);

      local_18 = FUN_005eae83(iVar1,*(undefined4 *)(iVar4 + 8),0);

      if (local_18 < 0) {

        return local_18;

      }

      while (param_2 = FUN_005e624b(), (short)param_2 != -1) {

        while( true ) {

          FUN_005eaf81(param_2);

          uVar3 = FUN_005eb15c(param_2);

          iVar4 = iVar6 + iVar1;

          iVar6 = iVar6 + 1;

          *(int *)(param_3 + (param_2 & 0xffff) * 4) = iVar4;

          if (uVar3 == 3) break;

          param_2 = (uint)*(ushort *)

                           (*(int *)(iVar2 + 4) + ((param_2 & 0xffff) * 3 + (uint)uVar3) * 2);

        }

      }

      local_10 = local_10 + 1;

      local_c = local_c + 0x14;

    } while (local_10 < *(uint *)(param_1 + 0x260));

  }

  uVar5 = 0;

  if (*(int *)(param_1 + 0x264) != 0) {

    do {

      *(undefined4 *)(param_4 + uVar5 * 4) = 0xffff;

      uVar5 = uVar5 + 1;

    } while (uVar5 < *(uint *)(param_1 + 0x264));

  }

  uVar5 = 0;

  if (*(int *)(param_1 + 0x264) != 0) {

    do {

      uVar3 = *(ushort *)(param_3 + uVar5 * 4);

      if (uVar3 != 0xffff) {

        *(uint *)(param_4 + (uint)uVar3 * 4) = uVar5;

      }

      uVar5 = uVar5 + 1;

    } while (uVar5 < *(uint *)(param_1 + 0x264));

  }

  return local_18;

}





// --- FUN_005eca1d at 0x005ECA1D (size: 194) ---


int __thiscall

FUN_005eca1d(int param_1,undefined4 param_2,int param_3,int param_4,uint param_5,undefined4 param_6)



{

  undefined4 uVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  undefined1 local_1c [12];

  undefined4 local_10;

  void *local_c;

  int local_8;

  

  uVar1 = param_5;

  iVar5 = 0;

  local_8 = 0;

  local_10 = param_5;

  local_c = (void *)0x0;

  param_5 = 0;

  if (*(int *)(param_1 + 0x260) != 0) {

    do {

      iVar2 = *(int *)(param_1 + 0x25c) + iVar5;

      local_8 = FUN_005ec40f(local_1c,param_2,param_3,uVar1,param_6,*(undefined4 *)(iVar2 + 4),

                             *(undefined4 *)(iVar2 + 8),*(undefined4 *)(param_1 + 0x24c));

      if (local_8 < 0) goto LAB_005ecacc;

      param_5 = param_5 + 1;

      iVar5 = iVar5 + 0x14;

    } while (param_5 < *(uint *)(param_1 + 0x260));

  }

  uVar3 = 0;

  uVar4 = 0;

  if (*(int *)(param_1 + 0x264) != 0) {

    do {

      uVar4 = uVar4 + 1;

      *(undefined4 *)(param_4 + uVar3 * 4) = 0xffff;

      uVar3 = uVar4 & 0xffff;

    } while (uVar3 < *(uint *)(param_1 + 0x264));

  }

  uVar3 = 0;

  uVar4 = 0;

  if (*(int *)(param_1 + 0x264) != 0) {

    do {

      iVar5 = *(int *)(param_3 + uVar3 * 4);

      if (iVar5 != 0xffff) {

        *(uint *)(param_4 + iVar5 * 4) = uVar3;

      }

      uVar4 = uVar4 + 1;

      uVar3 = uVar4 & 0xffff;

    } while (uVar3 < *(uint *)(param_1 + 0x264));

  }

LAB_005ecacc:

  operator_delete(local_c);

  return local_8;

}





// --- FUN_005ecadf at 0x005ECADF (size: 241) ---


int __thiscall FUN_005ecadf(int param_1,int param_2,int param_3,int param_4)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  int iVar5;

  int local_14;

  uint local_10;

  int local_c;

  int local_8;

  

  local_14 = 0;

  local_10 = 0;

  if (*(int *)(param_1 + 0x260) != 0) {

    local_c = 0;

    do {

      iVar2 = *(int *)(param_1 + 0x25c) + local_c;

      iVar1 = *(int *)(iVar2 + 4);

      local_8 = 0;

      local_14 = FUN_005eaffe(iVar1,*(undefined4 *)(iVar2 + 8),0);

      if (local_14 < 0) {

        return local_14;

      }

      while (iVar2 = FUN_005e6274(), iVar2 != -1) {

        while( true ) {

          FUN_005eb0ec(iVar2);

          iVar3 = FUN_005eb269(iVar2);

          iVar5 = local_8 + iVar1;

          local_8 = local_8 + 1;

          *(int *)(param_3 + iVar2 * 4) = iVar5;

          if (iVar3 == 3) break;

          iVar2 = *(int *)(*(int *)(param_2 + 4) + (iVar3 + iVar2 * 3) * 4);

        }

      }

      local_10 = local_10 + 1;

      local_c = local_c + 0x14;

    } while (local_10 < *(uint *)(param_1 + 0x260));

  }

  uVar4 = 0;

  if (*(int *)(param_1 + 0x264) != 0) {

    do {

      *(undefined4 *)(param_4 + uVar4 * 4) = 0xffffffff;

      uVar4 = uVar4 + 1;

    } while (uVar4 < *(uint *)(param_1 + 0x264));

  }

  uVar4 = 0;

  if (*(int *)(param_1 + 0x264) != 0) {

    do {

      iVar1 = *(int *)(param_3 + uVar4 * 4);

      if (iVar1 != -1) {

        *(uint *)(param_4 + iVar1 * 4) = uVar4;

      }

      uVar4 = uVar4 + 1;

    } while (uVar4 < *(uint *)(param_1 + 0x264));

  }

  return local_14;

}





// --- FUN_005ecbd0 at 0x005ECBD0 (size: 183) ---


int __thiscall

FUN_005ecbd0(int param_1,undefined4 param_2,int param_3,int param_4,uint param_5,undefined4 param_6)



{

  undefined4 uVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  undefined1 local_1c [12];

  undefined4 local_10;

  void *local_c;

  int local_8;

  

  uVar1 = param_5;

  iVar4 = 0;

  local_8 = 0;

  local_10 = param_5;

  local_c = (void *)0x0;

  param_5 = 0;

  if (*(int *)(param_1 + 0x260) != 0) {

    do {

      iVar2 = *(int *)(param_1 + 0x25c) + iVar4;

      local_8 = FUN_005ec6a4(local_1c,param_2,param_3,uVar1,param_6,*(undefined4 *)(iVar2 + 4),

                             *(undefined4 *)(iVar2 + 8),*(undefined4 *)(param_1 + 0x24c));

      if (local_8 < 0) goto LAB_005ecc74;

      param_5 = param_5 + 1;

      iVar4 = iVar4 + 0x14;

    } while (param_5 < *(uint *)(param_1 + 0x260));

  }

  uVar3 = 0;

  if (*(int *)(param_1 + 0x264) != 0) {

    do {

      *(undefined4 *)(param_4 + uVar3 * 4) = 0xffffffff;

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0x264));

  }

  uVar3 = 0;

  if (*(int *)(param_1 + 0x264) != 0) {

    do {

      iVar4 = *(int *)(param_3 + uVar3 * 4);

      if (iVar4 != -1) {

        *(uint *)(param_4 + iVar4 * 4) = uVar3;

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0x264));

  }

LAB_005ecc74:

  operator_delete(local_c);

  return local_8;

}





// --- FUN_005ecc87 at 0x005ECC87 (size: 236) ---


int FUN_005ecc87(uint param_1,uint param_2,uint param_3,undefined4 param_4,int param_5,int *param_6)



{

  int iVar1;

  int iVar2;

  

  if (((((param_3 & 0xfffe3000) != 0) || (param_5 == 0)) || (param_6 == (int *)0x0)) ||

     (((iVar1 = FUN_005e532a(param_4,0), iVar1 == 0 || (param_1 == 0)) || (param_2 == 0)))) {

    return -0x7789f794;

  }

  *param_6 = 0;

  if ((param_3 & 1) == 0) {

    if (0xffff < param_1) {

      return -0x7789f794;

    }

    if (0xffff < param_2) {

      return -0x7789f794;

    }

    iVar1 = FUN_005df0f5(0x27c);

    if (iVar1 == 0) {

      iVar1 = 0;

    }

    else {

      iVar1 = FUN_005eb3cb(param_5,param_4,param_3);

    }

    if (iVar1 != 0) {

      iVar2 = FUN_005e7f7d(param_1,param_2);

      goto LAB_005ecd5c;

    }

  }

  else {

    iVar1 = FUN_005df0f5(0x27c);

    if (iVar1 == 0) {

      iVar1 = 0;

    }

    else {

      iVar1 = FUN_005eb870(param_5,param_4,param_3);

    }

    if (iVar1 != 0) {

      iVar2 = FUN_005e8c73(param_1,param_2);

LAB_005ecd5c:

      if (-1 < iVar2) {

        *param_6 = iVar1;

        return iVar2;

      }

      return iVar2;

    }

  }

  return -0x7ff8fff2;

}





// --- FUN_005ecd73 at 0x005ECD73 (size: 493) ---


int FUN_005ecd73(int param_1,uint param_2,int param_3,int param_4,undefined4 *param_5)



{

  int *piVar1;

  int iVar2;

  uint uVar3;

  int *piVar4;

  int iVar5;

  int *local_c;

  int *local_8;

  

  local_c = (int *)0x0;

  if (param_3 == 0) {

    param_3 = param_1 + 0xc;

  }

  iVar2 = FUN_005e532a(param_3,0);

  if (iVar2 == 0) {

    return -0x7789f794;

  }

  if (((((param_2 & 0xfffe2000) != 0) ||

       ((uVar3 = param_2 & 0x1000, uVar3 != 0 &&

        (iVar2 = FUN_005e55a4(param_3,param_1 + 0xc), iVar2 == 0)))) ||

      ((uVar3 != 0 && (param_4 != *(int *)(param_1 + 0x230))))) ||

     (((*(uint *)(param_1 + 0x214) & 0x400) != 0 || ((*(uint *)(param_1 + 0x214) & 0x40) != 0)))) {

    return -0x7789f794;

  }

  if ((param_2 & 1) == 0) {

    if ((0xffff < *(uint *)(param_1 + 0x264)) || (0xffff < *(uint *)(param_1 + 0x23c))) {

      iVar2 = -0x7789f794;

      goto LAB_005ecf33;

    }

    iVar2 = FUN_005df0f5(0x27c);

    if (iVar2 == 0) {

      piVar4 = (int *)0x0;

    }

    else {

      piVar4 = (int *)FUN_005eb3cb(param_4,param_3,param_2);

    }

    if (piVar4 == (int *)0x0) {

      return -0x7ff8fff2;

    }

    iVar2 = FUN_005ecf60(piVar4);

    if (-1 < iVar2) {

      if (uVar3 != 0) {

        *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x20;

        piVar4[0x8d] = *(int *)(param_1 + 0x234);

        piVar1 = *(int **)(param_1 + 0x234);

        (**(code **)(*piVar1 + 4))(piVar1);

      }

      iVar5 = piVar4[0x8d];

      local_c = piVar4;

      goto LAB_005ecf0d;

    }

  }

  else {

    iVar2 = FUN_005df0f5(0x27c);

    if (iVar2 == 0) {

      local_8 = (int *)0x0;

    }

    else {

      local_8 = (int *)FUN_005eb870(param_4,param_3,param_2);

    }

    if (local_8 == (int *)0x0) {

      return -0x7ff8fff2;

    }

    iVar2 = FUN_005ed177(local_8);

    if (iVar2 < 0) goto LAB_005ecf4a;

    if (uVar3 != 0) {

      *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x20;

      local_8[0x8d] = *(int *)(param_1 + 0x234);

      piVar4 = *(int **)(param_1 + 0x234);

      (**(code **)(*piVar4 + 4))(piVar4);

    }

    iVar5 = local_8[0x8d];

    local_c = local_8;

LAB_005ecf0d:

    if ((uVar3 != 0) || (iVar2 = FUN_005ec09a(param_3,iVar5), -1 < iVar2)) {

      *param_5 = local_c;

      return iVar2;

    }

LAB_005ecf33:

    piVar4 = (int *)0x0;

    if (local_c == (int *)0x0) {

      return iVar2;

    }

    (**(code **)(*local_c + 8))(local_c);

  }

  local_8 = (int *)0x0;

  if (piVar4 == (int *)0x0) {

    return iVar2;

  }

  (**(code **)(*piVar4 + 8))(piVar4);

LAB_005ecf4a:

  if (local_8 != (int *)0x0) {

    (**(code **)(*local_8 + 8))(local_8);

  }

  return iVar2;

}





// --- FUN_005ecf60 at 0x005ECF60 (size: 535) ---


int __thiscall FUN_005ecf60(int param_1,uint param_2)



{

  short sVar1;

  int *piVar2;

  int iVar3;

  undefined4 *puVar4;

  uint uVar5;

  int iVar6;

  uint uVar7;

  short *psVar8;

  int iVar9;

  undefined4 *puVar10;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  

  iVar3 = param_2;

  local_c = 0;

  *(uint *)(param_2 + 0x218) =

       (*(uint *)(param_1 + 0x218) ^ *(uint *)(param_2 + 0x218)) & 0x20 ^ *(uint *)(param_1 + 0x218)

  ;

  local_10 = 0;

  local_8 = FUN_005e7f7d(*(undefined4 *)(param_1 + 0x264),*(undefined4 *)(param_1 + 0x23c));

  if (((-1 < local_8) && (local_8 = FUN_005e549b(&local_10,0), -1 < local_8)) &&

     (local_8 = FUN_005e549b(&local_c,0x10), -1 < local_8)) {

    if ((*(byte *)(param_1 + 0x218) & 4) != 0) {

      puVar4 = *(undefined4 **)(param_1 + 0x254);

      puVar10 = *(undefined4 **)(param_2 + 0x254);

      for (uVar5 = *(uint *)(param_1 + 0x264) & 0x3fffffff; uVar5 != 0; uVar5 = uVar5 - 1) {

        *puVar10 = *puVar4;

        puVar4 = puVar4 + 1;

        puVar10 = puVar10 + 1;

      }

      for (iVar6 = 0; iVar6 != 0; iVar6 = iVar6 + -1) {

        *(undefined1 *)puVar10 = *(undefined1 *)puVar4;

        puVar4 = (undefined4 *)((int)puVar4 + 1);

        puVar10 = (undefined4 *)((int)puVar10 + 1);

      }

    }

    if ((*(byte *)(param_1 + 0x218) & 8) != 0) {

      uVar7 = *(int *)(param_1 + 0x264) << 1;

      puVar4 = *(undefined4 **)(param_1 + 600);

      puVar10 = *(undefined4 **)(param_2 + 600);

      for (uVar5 = uVar7 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {

        *puVar10 = *puVar4;

        puVar4 = puVar4 + 1;

        puVar10 = puVar10 + 1;

      }

      for (uVar7 = uVar7 & 3; uVar7 != 0; uVar7 = uVar7 - 1) {

        *(undefined1 *)puVar10 = *(undefined1 *)puVar4;

        puVar4 = (undefined4 *)((int)puVar4 + 1);

        puVar10 = (undefined4 *)((int)puVar10 + 1);

      }

    }

    if (*(int *)(param_1 + 0x25c) != 0) {

      puVar4 = (undefined4 *)FUN_005df0f5(*(int *)(param_1 + 0x260) * 0x14);

      *(undefined4 **)(param_2 + 0x25c) = puVar4;

      if (puVar4 == (undefined4 *)0x0) {

        local_8 = -0x7ff8fff2;

        goto LAB_005ed149;

      }

      puVar10 = *(undefined4 **)(param_1 + 0x25c);

      for (uVar5 = *(int *)(param_1 + 0x260) * 5 & 0x3fffffff; uVar5 != 0; uVar5 = uVar5 - 1) {

        *puVar4 = *puVar10;

        puVar10 = puVar10 + 1;

        puVar4 = puVar4 + 1;

      }

      for (iVar6 = 0; iVar6 != 0; iVar6 = iVar6 + -1) {

        *(undefined1 *)puVar4 = *(undefined1 *)puVar10;

        puVar10 = (undefined4 *)((int)puVar10 + 1);

        puVar4 = (undefined4 *)((int)puVar4 + 1);

      }

      *(undefined4 *)(param_2 + 0x260) = *(undefined4 *)(param_1 + 0x260);

    }

    iVar6 = 0;

    param_2 = 0;

    if (*(int *)(param_1 + 0x264) != 0) {

      do {

        psVar8 = (short *)(local_10 + iVar6);

        iVar9 = (local_c + iVar6) - (int)psVar8;

        local_14 = 3;

        do {

          sVar1 = *(short *)(iVar9 + (int)psVar8);

          if (sVar1 == -1) {

            *psVar8 = -1;

          }

          else {

            *psVar8 = sVar1;

          }

          psVar8 = psVar8 + 1;

          local_14 = local_14 + -1;

        } while (local_14 != 0);

        param_2 = param_2 + 1;

        iVar6 = iVar6 + 6;

      } while (param_2 < *(uint *)(param_1 + 0x264));

    }

    if ((*(byte *)(param_1 + 0x218) & 1) != 0) {

      iVar6 = 0;

      param_2 = 0;

      if (*(int *)(param_1 + 0x264) != 0) {

        do {

          psVar8 = (short *)(*(int *)(iVar3 + 0x250) + iVar6);

          iVar9 = (*(int *)(param_1 + 0x250) + iVar6) - (int)psVar8;

          local_14 = 3;

          do {

            sVar1 = *(short *)((int)psVar8 + iVar9);

            if (sVar1 == -1) {

              *psVar8 = -1;

            }

            else {

              *psVar8 = sVar1;

            }

            psVar8 = psVar8 + 1;

            local_14 = local_14 + -1;

          } while (local_14 != 0);

          param_2 = param_2 + 1;

          iVar6 = iVar6 + 6;

        } while (param_2 < *(uint *)(param_1 + 0x264));

      }

    }

  }

LAB_005ed149:

  if (local_c != 0) {

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  }

  if (local_10 != 0) {

    piVar2 = *(int **)(iVar3 + 0x248);

    (**(code **)(*piVar2 + 0x30))(piVar2);

  }

  return local_8;

}





// --- FUN_005ed177 at 0x005ED177 (size: 550) ---


int __thiscall FUN_005ed177(int param_1,int param_2)



{

  ushort uVar1;

  int *piVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  uint uVar6;

  int iVar7;

  uint uVar8;

  undefined4 *puVar9;

  int local_18;

  int local_14;

  int local_10;

  int local_c;

  uint local_8;

  

  iVar3 = param_2;

  local_14 = 0;

  *(uint *)(param_2 + 0x218) =

       (*(uint *)(param_1 + 0x218) ^ *(uint *)(param_2 + 0x218)) & 0x20 ^ *(uint *)(param_1 + 0x218)

  ;

  local_18 = 0;

  local_c = FUN_005e8c73(*(undefined4 *)(param_1 + 0x264),*(undefined4 *)(param_1 + 0x23c));

  if (((-1 < local_c) && (local_c = FUN_005e549b(&local_18,0), -1 < local_c)) &&

     (local_c = FUN_005e549b(&local_14,0x10), -1 < local_c)) {

    if ((*(byte *)(param_1 + 0x218) & 4) != 0) {

      puVar4 = *(undefined4 **)(param_1 + 0x254);

      puVar9 = *(undefined4 **)(param_2 + 0x254);

      for (uVar6 = *(uint *)(param_1 + 0x264) & 0x3fffffff; uVar6 != 0; uVar6 = uVar6 - 1) {

        *puVar9 = *puVar4;

        puVar4 = puVar4 + 1;

        puVar9 = puVar9 + 1;

      }

      for (iVar7 = 0; iVar7 != 0; iVar7 = iVar7 + -1) {

        *(undefined1 *)puVar9 = *(undefined1 *)puVar4;

        puVar4 = (undefined4 *)((int)puVar4 + 1);

        puVar9 = (undefined4 *)((int)puVar9 + 1);

      }

    }

    if ((*(byte *)(param_1 + 0x218) & 8) != 0) {

      uVar8 = *(int *)(param_1 + 0x264) << 1;

      puVar4 = *(undefined4 **)(param_1 + 600);

      puVar9 = *(undefined4 **)(param_2 + 600);

      for (uVar6 = uVar8 >> 2; uVar6 != 0; uVar6 = uVar6 - 1) {

        *puVar9 = *puVar4;

        puVar4 = puVar4 + 1;

        puVar9 = puVar9 + 1;

      }

      for (uVar8 = uVar8 & 3; uVar8 != 0; uVar8 = uVar8 - 1) {

        *(undefined1 *)puVar9 = *(undefined1 *)puVar4;

        puVar4 = (undefined4 *)((int)puVar4 + 1);

        puVar9 = (undefined4 *)((int)puVar9 + 1);

      }

    }

    if (*(int *)(param_1 + 0x25c) != 0) {

      puVar4 = (undefined4 *)FUN_005df0f5(*(int *)(param_1 + 0x260) * 0x14);

      *(undefined4 **)(param_2 + 0x25c) = puVar4;

      if (puVar4 == (undefined4 *)0x0) {

        local_c = -0x7ff8fff2;

        goto LAB_005ed36f;

      }

      puVar9 = *(undefined4 **)(param_1 + 0x25c);

      for (uVar6 = *(int *)(param_1 + 0x260) * 5 & 0x3fffffff; uVar6 != 0; uVar6 = uVar6 - 1) {

        *puVar4 = *puVar9;

        puVar9 = puVar9 + 1;

        puVar4 = puVar4 + 1;

      }

      for (iVar7 = 0; iVar7 != 0; iVar7 = iVar7 + -1) {

        *(undefined1 *)puVar4 = *(undefined1 *)puVar9;

        puVar9 = (undefined4 *)((int)puVar9 + 1);

        puVar4 = (undefined4 *)((int)puVar4 + 1);

      }

      *(undefined4 *)(param_2 + 0x260) = *(undefined4 *)(param_1 + 0x260);

    }

    iVar7 = 0;

    local_8 = 0;

    if (*(int *)(param_1 + 0x264) != 0) {

      local_10 = 0;

      do {

        uVar6 = 0;

        do {

          uVar1 = *(ushort *)(local_10 + local_14 + uVar6 * 2);

          if (uVar1 == 0xffff) {

            *(undefined4 *)(iVar7 + local_18 + uVar6 * 4) = 0xffffffff;

          }

          else {

            *(uint *)(iVar7 + local_18 + uVar6 * 4) = (uint)uVar1;

          }

          uVar6 = uVar6 + 1;

        } while (uVar6 < 3);

        local_8 = local_8 + 1;

        local_10 = local_10 + 6;

        iVar7 = iVar7 + 0xc;

      } while (local_8 < *(uint *)(param_1 + 0x264));

    }

    if (((*(byte *)(param_1 + 0x218) & 1) != 0) && (local_8 = 0, *(int *)(param_1 + 0x264) != 0)) {

      local_10 = 0;

      param_2 = 0;

      do {

        iVar7 = *(int *)(param_1 + 0x250);

        iVar5 = *(int *)(iVar3 + 0x250) + param_2;

        uVar6 = 0;

        do {

          uVar1 = *(ushort *)(iVar7 + local_10 + uVar6 * 2);

          if (uVar1 == 0xffff) {

            *(undefined4 *)(iVar5 + uVar6 * 4) = 0xffffffff;

          }

          else {

            *(uint *)(iVar5 + uVar6 * 4) = (uint)uVar1;

          }

          uVar6 = uVar6 + 1;

        } while (uVar6 < 3);

        local_8 = local_8 + 1;

        param_2 = param_2 + 0xc;

        local_10 = local_10 + 6;

      } while (local_8 < *(uint *)(param_1 + 0x264));

    }

  }

LAB_005ed36f:

  if (local_14 != 0) {

    (**(code **)(**(int **)(param_1 + 0x248) + 0x30))(*(int **)(param_1 + 0x248));

  }

  if (local_18 != 0) {

    piVar2 = *(int **)(iVar3 + 0x248);

    (**(code **)(*piVar2 + 0x30))(piVar2);

  }

  return local_c;

}





// --- FUN_005ed39d at 0x005ED39D (size: 71) ---


void FUN_005ed39d(int param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005ed3e4(*(undefined4 *)(param_1 + 0x234),*(undefined4 *)(param_1 + 0x248),

               *(undefined4 *)(param_1 + 0x214),*(undefined4 *)(param_1 + 0x23c),

               *(undefined4 *)(param_1 + 0x264),*(undefined4 *)(param_1 + 0x25c),

               *(undefined4 *)(param_1 + 0x260),param_2,param_3,*(undefined4 *)(param_1 + 0x238));

  return;

}





// --- FUN_005ed3e4 at 0x005ED3E4 (size: 155) ---


int FUN_005ed3e4(int *param_1,int *param_2,uint param_3,undefined4 param_4,undefined4 param_5,

                undefined4 param_6,undefined4 param_7,undefined4 param_8,int param_9,

                undefined4 param_10)



{

  int iVar1;

  int local_c;

  int local_8;

  

  local_8 = 0;

  local_c = 0;

  if ((param_9 == 0) || ((param_3 & 0x400) != 0)) {

    iVar1 = -0x7789f794;

  }

  else {

    iVar1 = (**(code **)(*param_2 + 0x2c))(param_2,0,0,&local_8,0x10);

    if (-1 < iVar1) {

      iVar1 = (**(code **)(*param_1 + 0x2c))(param_1,0,0,&local_c,0x10);

      if (-1 < iVar1) {

        iVar1 = FUN_005e9d64(local_8,local_c,param_4,param_5,param_6,param_7,param_8,param_9,0xffff,

                             param_10);

      }

    }

    if (local_8 != 0) {

      (**(code **)(*param_2 + 0x30))(param_2);

    }

    if (local_c != 0) {

      (**(code **)(*param_1 + 0x30))(param_1);

    }

  }

  return iVar1;

}





// --- FUN_005ed47f at 0x005ED47F (size: 73) ---


void FUN_005ed47f(int param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005ed4c8(*(undefined4 *)(param_1 + 0x234),*(undefined4 *)(param_1 + 0x248),param_1 + 0xc,

               *(undefined4 *)(param_1 + 0x214),*(undefined4 *)(param_1 + 0x23c),

               *(undefined4 *)(param_1 + 0x264),*(undefined4 *)(param_1 + 0x25c),

               *(undefined4 *)(param_1 + 0x260),param_2,param_3);

  return;

}





// --- FUN_005ed4c8 at 0x005ED4C8 (size: 1127) ---


int FUN_005ed4c8(int *param_1,int *param_2,uint param_3,uint param_4,uint param_5,int param_6,

                undefined4 param_7,undefined4 param_8,float param_9,int param_10)



{

  ushort *puVar1;

  float fVar2;

  uint uVar3;

  void *pvVar4;

  int *piVar5;

  float *pfVar6;

  undefined4 *puVar7;

  float *pfVar8;

  int iVar9;

  int iVar10;

  int local_8c;

  int local_54;

  undefined4 local_4c;

  undefined4 local_48;

  float local_44;

  float local_40;

  float local_3c;

  uint local_38;

  void *local_34;

  uint local_30;

  int *local_2c;

  int local_28;

  void *local_24;

  undefined4 *local_20;

  undefined4 *local_1c;

  uint local_18;

  undefined4 *local_14;

  undefined4 *local_10;

  uint local_c;

  undefined4 *local_8;

  

  local_8 = (undefined4 *)0x0;

  local_1c = (undefined4 *)0x0;

  FUN_005e7ce2(param_3);

  uVar3 = param_5 / 3;

  local_20 = (undefined4 *)0x0;

  local_24 = (void *)0x0;

  local_48 = 0;

  local_10 = (undefined4 *)0x0;

  local_14 = (undefined4 *)0x0;

  local_28 = 0;

  local_34 = (void *)0x0;

  local_2c = (int *)0x0;

  local_30 = uVar3;

  if (((param_10 == 0) || ((param_4 & 0x440) != 0)) || (local_8c == 0)) {

    iVar9 = -0x7789f794;

    goto LAB_005ed8cf;

  }

  local_20 = (undefined4 *)FUN_005df0f5(uVar3 << 2);

  pvVar4 = (void *)FUN_005df0f5(param_5 * 0x14);

  if (pvVar4 == (void *)0x0) {

    local_24 = (void *)0x0;

  }

  else {

    FUN_00401000(pvVar4,0x14,param_5,&LAB_005eda5e);

    local_24 = pvVar4;

  }

  local_10 = (undefined4 *)FUN_005df0f5(param_5 << 2);

  local_14 = (undefined4 *)FUN_005df0f5(param_6 * 0xc);

  local_8 = (undefined4 *)FUN_005df0f5(param_5 << 2);

  if (((local_20 == (undefined4 *)0x0) || (local_24 == (void *)0x0)) ||

     ((local_10 == (undefined4 *)0x0 ||

      ((local_14 == (undefined4 *)0x0 || (local_8 == (undefined4 *)0x0)))))) {

LAB_005ed8c8:

    iVar9 = -0x7ff8fff2;

  }

  else {

    puVar7 = local_20;

    for (uVar3 = uVar3 & 0x3fffffff; uVar3 != 0; uVar3 = uVar3 - 1) {

      *puVar7 = 0;

      puVar7 = puVar7 + 1;

    }

    for (iVar9 = 0; iVar9 != 0; iVar9 = iVar9 + -1) {

      *(undefined1 *)puVar7 = 0;

      puVar7 = (undefined4 *)((int)puVar7 + 1);

    }

    puVar7 = local_10;

    for (uVar3 = param_5 & 0x3fffffff; uVar3 != 0; uVar3 = uVar3 - 1) {

      *puVar7 = 0xffffffff;

      puVar7 = puVar7 + 1;

    }

    for (iVar9 = 0; iVar9 != 0; iVar9 = iVar9 + -1) {

      *(undefined1 *)puVar7 = 0xff;

      puVar7 = (undefined4 *)((int)puVar7 + 1);

    }

    iVar9 = (**(code **)(*param_2 + 0x2c))(param_2,0,0,&local_28,0x10);

    if (iVar9 < 0) goto LAB_005ed8cf;

    if (param_6 != 0) {

      local_c = 0;

      param_3 = 0;

      local_18 = param_6;

      puVar7 = local_14;

      do {

        uVar3 = 0;

        do {

          *puVar7 = local_10[*(ushort *)(param_3 + local_28 + uVar3 * 2)];

          iVar9 = uVar3 * 2;

          iVar10 = local_c + uVar3;

          uVar3 = uVar3 + 1;

          puVar7 = puVar7 + 1;

          local_10[*(ushort *)(param_3 + local_28 + iVar9)] = iVar10;

        } while (uVar3 < 3);

        param_3 = param_3 + 6;

        local_c = local_c + 3;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

      local_18 = 0;

    }

    iVar9 = (**(code **)(*param_1 + 0x2c))(param_1,0,0,&local_1c,0x10);

    if (iVar9 < 0) goto LAB_005ed8cf;

    if (param_9 == DAT_00796344) {

      uVar3 = 0;

      puVar7 = local_1c;

      if (param_5 != 0) {

        do {

          iVar9 = FUN_005eda61((uint)*(ushort *)(local_8c + 2) + (int)puVar7,uVar3,local_20,local_24

                               ,local_30,local_10,local_14,local_28,&local_48,&local_4c);

          if (iVar9 == 0) {

            local_8[uVar3] = uVar3;

          }

          else {

            local_8[uVar3] = local_4c;

          }

          puVar7 = (undefined4 *)((int)puVar7 + local_54);

          uVar3 = uVar3 + 1;

        } while (uVar3 < param_5);

      }

    }

    else {

      pvVar4 = (void *)FUN_005df0f5(param_5 << 2);

      local_34 = pvVar4;

      piVar5 = (int *)FUN_005df0f5(param_5 << 2);

      local_2c = piVar5;

      if ((pvVar4 == (void *)0x0) || (piVar5 == (int *)0x0)) goto LAB_005ed8c8;

      uVar3 = 0;

      puVar7 = local_1c;

      if (param_5 != 0) {

        do {

          *(undefined4 *)((int)pvVar4 + uVar3 * 4) = *puVar7;

          puVar7 = (undefined4 *)((int)puVar7 + local_54);

          uVar3 = uVar3 + 1;

        } while (uVar3 < param_5);

      }

      FUN_005ed92f(piVar5,pvVar4,param_5);

      param_3 = 0;

      puVar7 = local_8;

      for (uVar3 = param_5 & 0x3fffffff; uVar3 != 0; uVar3 = uVar3 - 1) {

        *puVar7 = 0xffffffff;

        puVar7 = puVar7 + 1;

      }

      for (iVar9 = 0; iVar9 != 0; iVar9 = iVar9 + -1) {

        *(undefined1 *)puVar7 = 0xff;

        puVar7 = (undefined4 *)((int)puVar7 + 1);

      }

      if (param_5 != 0) {

        local_18 = 1;

        local_30 = param_5;

        do {

          if (param_3 < param_5) {

            do {

              fVar2 = *(float *)((int)local_34 + *piVar5 * 4) -

                      *(float *)((int)local_34 + local_2c[param_3] * 4);

              if (fVar2 < param_9 == (fVar2 == param_9)) break;

              param_3 = param_3 + 1;

            } while (param_3 < param_5);

          }

          iVar9 = *piVar5;

          if (local_8[iVar9] == -1) {

            local_8[iVar9] = iVar9;

            pfVar6 = (float *)((int)local_1c + (uint)*(ushort *)(local_8c + 2) + *piVar5 * local_54)

            ;

            for (local_c = local_18; local_c < param_3; local_c = local_c + 1) {

              local_38 = local_2c[local_c];

              if (local_8[local_38] == -1) {

                pfVar8 = (float *)((int)local_1c +

                                  (uint)*(ushort *)(local_8c + 2) + local_38 * local_54);

                local_44 = *pfVar8 - *pfVar6;

                local_40 = pfVar8[1] - pfVar6[1];

                local_3c = pfVar8[2] - pfVar6[2];

                if (local_44 * local_44 + local_40 * local_40 + local_3c * local_3c <

                    param_9 * param_9) {

                  for (uVar3 = local_10[*piVar5]; uVar3 != 0xffffffff; uVar3 = local_14[uVar3]) {

                    puVar1 = (ushort *)(local_28 + (uVar3 / 3) * 6);

                    if (((*puVar1 == local_38) || (puVar1[1] == local_38)) ||

                       (puVar1[2] == local_38)) goto LAB_005ed883;

                  }

                  local_8[local_38] = *piVar5;

                }

              }

LAB_005ed883:

            }

          }

          local_18 = local_18 + 1;

          piVar5 = piVar5 + 1;

          local_30 = local_30 - 1;

        } while (local_30 != 0);

      }

    }

    iVar9 = FUN_005ed3e4(param_1,param_2,param_4,param_5,param_6,param_7,param_8,local_8,param_10,

                         local_54);

  }

LAB_005ed8cf:

  operator_delete(local_20);

  operator_delete(local_24);

  operator_delete(local_10);

  operator_delete(local_14);

  operator_delete(local_34);

  operator_delete(local_2c);

  operator_delete(local_8);

  if (local_1c != (undefined4 *)0x0) {

    (**(code **)(*param_1 + 0x30))(param_1);

  }

  if (local_28 != 0) {

    (**(code **)(*param_2 + 0x30))(param_2);

  }

  return iVar9;

}





// --- FUN_005ed92f at 0x005ED92F (size: 303) ---


void FUN_005ed92f(undefined4 *param_1,int param_2,uint param_3)



{

  float fVar1;

  float fVar2;

  int iVar3;

  undefined4 *puVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  int iVar8;

  uint local_8;

  

  puVar4 = param_1;

  uVar5 = 0;

  if (param_3 != 0) {

    do {

      param_1[uVar5] = uVar5;

      uVar5 = uVar5 + 1;

    } while (uVar5 < param_3);

  }

  if (1 < param_3) {

    uVar5 = (param_3 >> 1) - 1;

    if (uVar5 != 0xffffffff) {

      local_8 = (param_3 >> 1) + uVar5;

      do {

        iVar3 = puVar4[uVar5];

        param_1 = (undefined4 *)uVar5;

        if (local_8 < param_3) {

          uVar7 = local_8;

          do {

            iVar8 = puVar4[uVar7];

            uVar6 = uVar7;

            if ((uVar7 + 1 < param_3) &&

               (fVar1 = *(float *)(param_2 + puVar4[uVar7 + 1] * 4),

               fVar2 = *(float *)(param_2 + iVar8 * 4), fVar1 < fVar2 != (fVar1 == fVar2))) {

              uVar6 = uVar7 + 1;

              iVar8 = puVar4[uVar7 + 1];

            }

            if (*(float *)(param_2 + iVar3 * 4) < *(float *)(param_2 + iVar8 * 4)) break;

            uVar7 = uVar6 * 2 + 1;

            puVar4[(int)param_1] = puVar4[uVar6];

            param_1 = (undefined4 *)uVar6;

          } while (uVar7 < param_3);

        }

        local_8 = local_8 - 2;

        uVar5 = uVar5 - 1;

        puVar4[(int)param_1] = iVar3;

      } while (uVar5 != 0xffffffff);

    }

    while (param_3 = param_3 - 1, param_3 != 0xffffffff) {

      iVar3 = puVar4[param_3];

      param_1 = (undefined4 *)0x0;

      puVar4[param_3] = *puVar4;

      uVar5 = 1;

      if (1 < param_3) {

        do {

          iVar8 = puVar4[uVar5];

          uVar7 = uVar5;

          if ((uVar5 + 1 < param_3) &&

             (fVar1 = *(float *)(param_2 + puVar4[uVar5 + 1] * 4),

             fVar2 = *(float *)(param_2 + iVar8 * 4), fVar1 < fVar2 != (fVar1 == fVar2))) {

            uVar7 = uVar5 + 1;

            iVar8 = puVar4[uVar5 + 1];

          }

          if (*(float *)(param_2 + iVar3 * 4) < *(float *)(param_2 + iVar8 * 4)) break;

          uVar5 = uVar7 * 2 + 1;

          puVar4[(int)param_1] = puVar4[uVar7];

          param_1 = (undefined4 *)uVar7;

        } while (uVar5 < param_3);

      }

      puVar4[(int)param_1] = iVar3;

    }

  }

  return;

}





// --- FUN_005eda61 at 0x005EDA61 (size: 218) ---


undefined4

FUN_005eda61(float *param_1,float param_2,int param_3,int param_4,uint param_5,int param_6,

            int param_7,int param_8,int *param_9,float *param_10)



{

  float *pfVar1;

  ushort *puVar2;

  float fVar3;

  float fVar4;

  int iVar5;

  float *pfVar6;

  float fVar7;

  

  fVar7 = param_1[1];

  fVar3 = *param_1;

  fVar4 = param_1[2];

  *param_10 = -NAN;

  pfVar1 = (float *)(param_3 + ((uint)((int)fVar7 + (int)fVar3 + (int)fVar4) % param_5) * 4);

  pfVar6 = (float *)*pfVar1;

  do {

    if (pfVar6 == (float *)0x0) {

      pfVar6 = (float *)(param_4 + *param_9 * 0x14);

      *param_9 = *param_9 + 1;

      *pfVar6 = *param_1;

      pfVar6[1] = param_1[1];

      pfVar6[2] = param_1[2];

      pfVar6[3] = param_2;

      pfVar6[4] = *pfVar1;

      *pfVar1 = (float)pfVar6;

      return 0;

    }

    if (((*pfVar6 == *param_1) && (pfVar6[1] == param_1[1])) &&

       (iVar5 = param_6, fVar7 = param_2, pfVar6[2] == param_1[2])) {

      do {

        fVar7 = *(float *)(iVar5 + (int)fVar7 * 4);

        if (fVar7 == -NAN) {

          *param_10 = pfVar6[3];

          return 1;

        }

        puVar2 = (ushort *)(param_8 + ((uint)fVar7 / 3) * 6);

        fVar3 = pfVar6[3];

      } while ((((float)(uint)*puVar2 != fVar3) && ((float)(uint)puVar2[1] != fVar3)) &&

              (iVar5 = param_7, (float)(uint)puVar2[2] != fVar3));

    }

    pfVar6 = (float *)pfVar6[4];

  } while( true );

}





// --- FUN_005edb3b at 0x005EDB3B (size: 71) ---


void FUN_005edb3b(int param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005edb82(*(undefined4 *)(param_1 + 0x234),*(undefined4 *)(param_1 + 0x248),

               *(undefined4 *)(param_1 + 0x214),*(undefined4 *)(param_1 + 0x23c),

               *(undefined4 *)(param_1 + 0x264),*(undefined4 *)(param_1 + 0x25c),

               *(undefined4 *)(param_1 + 0x260),param_2,param_3,*(undefined4 *)(param_1 + 0x238));

  return;

}





// --- FUN_005edb82 at 0x005EDB82 (size: 152) ---


int FUN_005edb82(int *param_1,int *param_2,uint param_3,undefined4 param_4,undefined4 param_5,

                undefined4 param_6,undefined4 param_7,undefined4 param_8,int param_9,

                undefined4 param_10)



{

  int iVar1;

  int local_c;

  int local_8;

  

  local_8 = 0;

  local_c = 0;

  if ((param_9 == 0) || ((param_3 & 0x400) != 0)) {

    iVar1 = -0x7789f794;

  }

  else {

    iVar1 = (**(code **)(*param_2 + 0x2c))(param_2,0,0,&local_8,0x10);

    if (-1 < iVar1) {

      iVar1 = (**(code **)(*param_1 + 0x2c))(param_1,0,0,&local_c,0x10);

      if (-1 < iVar1) {

        iVar1 = FUN_005ea0f4(local_8,local_c,param_4,param_5,param_6,param_7,param_8,param_9,

                             0xffffffff,param_10);

      }

    }

    if (local_8 != 0) {

      (**(code **)(*param_2 + 0x30))(param_2);

    }

    if (local_c != 0) {

      (**(code **)(*param_1 + 0x30))(param_1);

    }

  }

  return iVar1;

}





// --- FUN_005edc1a at 0x005EDC1A (size: 73) ---


void FUN_005edc1a(int param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_005edc63(*(undefined4 *)(param_1 + 0x234),*(undefined4 *)(param_1 + 0x248),param_1 + 0xc,

               *(undefined4 *)(param_1 + 0x214),*(undefined4 *)(param_1 + 0x23c),

               *(undefined4 *)(param_1 + 0x264),*(undefined4 *)(param_1 + 0x25c),

               *(undefined4 *)(param_1 + 0x260),param_2,param_3);

  return;

}





// --- FUN_005edc63 at 0x005EDC63 (size: 1142) ---


int FUN_005edc63(int *param_1,int *param_2,uint param_3,uint param_4,uint param_5,int param_6,

                undefined4 param_7,undefined4 param_8,float param_9,int param_10)



{

  int *piVar1;

  float fVar2;

  uint uVar3;

  void *pvVar4;

  undefined4 *puVar5;

  float *pfVar6;

  float *pfVar7;

  int iVar8;

  int iVar9;

  int local_90;

  int local_58;

  undefined4 local_54;

  undefined4 local_50;

  int local_4c;

  int *local_48;

  float local_44;

  float local_40;

  float local_3c;

  void *local_38;

  uint local_34;

  uint local_30;

  void *local_2c;

  undefined4 *local_28;

  int local_24;

  int *local_20;

  undefined4 *local_1c;

  void *local_18;

  uint local_14;

  int *local_10;

  undefined4 *local_c;

  undefined4 *local_8;

  

  local_8 = (undefined4 *)0x0;

  local_1c = (undefined4 *)0x0;

  FUN_005e7ce2(param_3);

  uVar3 = param_5 / 3;

  local_28 = (undefined4 *)0x0;

  local_2c = (void *)0x0;

  local_54 = 0;

  local_c = (undefined4 *)0x0;

  local_18 = (void *)0x0;

  local_24 = 0;

  local_38 = (void *)0x0;

  local_10 = (int *)0x0;

  local_34 = uVar3;

  if (((param_10 == 0) || ((param_4 & 0x440) != 0)) || (local_90 == 0)) {

    iVar8 = -0x7789f794;

    goto LAB_005ee079;

  }

  local_28 = (undefined4 *)FUN_005df0f5(uVar3 << 2);

  pvVar4 = (void *)FUN_005df0f5(param_5 * 0x14);

  if (pvVar4 == (void *)0x0) {

    local_2c = (void *)0x0;

  }

  else {

    FUN_00401000(pvVar4,0x14,param_5,&LAB_005eda5e);

    local_2c = pvVar4;

  }

  local_c = (undefined4 *)FUN_005df0f5(param_5 << 2);

  local_18 = (void *)FUN_005df0f5(param_6 * 0xc);

  local_8 = (undefined4 *)FUN_005df0f5(param_5 << 2);

  if (((local_28 == (undefined4 *)0x0) || (local_2c == (void *)0x0)) ||

     ((local_c == (undefined4 *)0x0 || ((local_18 == (void *)0x0 || (local_8 == (undefined4 *)0x0)))

      ))) {

LAB_005ee072:

    iVar8 = -0x7ff8fff2;

  }

  else {

    puVar5 = local_28;

    for (uVar3 = uVar3 & 0x3fffffff; uVar3 != 0; uVar3 = uVar3 - 1) {

      *puVar5 = 0;

      puVar5 = puVar5 + 1;

    }

    for (iVar8 = 0; iVar8 != 0; iVar8 = iVar8 + -1) {

      *(undefined1 *)puVar5 = 0;

      puVar5 = (undefined4 *)((int)puVar5 + 1);

    }

    puVar5 = local_c;

    for (uVar3 = param_5 & 0x3fffffff; uVar3 != 0; uVar3 = uVar3 - 1) {

      *puVar5 = 0xffffffff;

      puVar5 = puVar5 + 1;

    }

    for (iVar8 = 0; iVar8 != 0; iVar8 = iVar8 + -1) {

      *(undefined1 *)puVar5 = 0xff;

      puVar5 = (undefined4 *)((int)puVar5 + 1);

    }

    iVar8 = (**(code **)(*param_2 + 0x2c))(param_2,0,0,&local_24,0x10);

    if (iVar8 < 0) goto LAB_005ee079;

    if (param_6 != 0) {

      param_3 = 0;

      local_20 = (int *)0x0;

      local_14 = param_6;

      do {

        uVar3 = 0;

        puVar5 = (undefined4 *)((int)local_20 + (int)local_18);

        do {

          *puVar5 = local_c[*(int *)((int)local_20 + uVar3 * 4 + local_24)];

          iVar8 = uVar3 * 4;

          iVar9 = param_3 + uVar3;

          uVar3 = uVar3 + 1;

          puVar5 = puVar5 + 1;

          local_c[*(int *)((int)local_20 + iVar8 + local_24)] = iVar9;

        } while (uVar3 < 3);

        param_3 = param_3 + 3;

        local_20 = local_20 + 3;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

      local_14 = 0;

    }

    iVar8 = (**(code **)(*param_1 + 0x2c))(param_1,0,0,&local_1c,0x10);

    if (iVar8 < 0) goto LAB_005ee079;

    if (param_9 == DAT_00796344) {

      uVar3 = 0;

      puVar5 = local_1c;

      if (param_5 != 0) {

        do {

          iVar8 = FUN_005ee0d9((uint)*(ushort *)(local_90 + 2) + (int)puVar5,uVar3,local_28,local_2c

                               ,local_34,local_c,local_18,local_24,&local_54,&local_50);

          if (iVar8 == 0) {

            local_8[uVar3] = uVar3;

          }

          else {

            local_8[uVar3] = local_50;

          }

          puVar5 = (undefined4 *)((int)puVar5 + local_58);

          uVar3 = uVar3 + 1;

        } while (uVar3 < param_5);

      }

    }

    else {

      pvVar4 = (void *)FUN_005df0f5(param_5 << 2);

      local_38 = pvVar4;

      local_10 = (int *)FUN_005df0f5(param_5 << 2);

      uVar3 = 0;

      if ((pvVar4 == (void *)0x0) || (local_10 == (int *)0x0)) goto LAB_005ee072;

      puVar5 = local_1c;

      if (param_5 != 0) {

        do {

          *(undefined4 *)((int)pvVar4 + uVar3 * 4) = *puVar5;

          puVar5 = (undefined4 *)((int)puVar5 + local_58);

          uVar3 = uVar3 + 1;

        } while (uVar3 < param_5);

      }

      FUN_005ed92f(local_10,pvVar4,param_5);

      param_3 = 0;

      puVar5 = local_8;

      for (uVar3 = param_5 & 0x3fffffff; uVar3 != 0; uVar3 = uVar3 - 1) {

        *puVar5 = 0xffffffff;

        puVar5 = puVar5 + 1;

      }

      for (iVar8 = 0; iVar8 != 0; iVar8 = iVar8 + -1) {

        *(undefined1 *)puVar5 = 0xff;

        puVar5 = (undefined4 *)((int)puVar5 + 1);

      }

      if (param_5 != 0) {

        local_14 = 1;

        local_34 = param_5;

        local_20 = local_10;

        do {

          if (param_3 < param_5) {

            do {

              fVar2 = *(float *)((int)pvVar4 + *local_20 * 4) -

                      *(float *)((int)pvVar4 + local_10[param_3] * 4);

              if (fVar2 < param_9 == (fVar2 == param_9)) break;

              param_3 = param_3 + 1;

            } while (param_3 < param_5);

          }

          iVar8 = *local_20;

          if (local_8[iVar8] == -1) {

            local_8[iVar8] = iVar8;

            pfVar6 = (float *)((int)local_1c +

                              (uint)*(ushort *)(local_90 + 2) + *local_20 * local_58);

            for (local_30 = local_14; local_30 < param_3; local_30 = local_30 + 1) {

              iVar8 = local_10[local_30];

              local_48 = local_8 + iVar8;

              if (*local_48 == -1) {

                pfVar7 = (float *)((int)local_1c +

                                  (uint)*(ushort *)(local_90 + 2) + iVar8 * local_58);

                local_44 = *pfVar7 - *pfVar6;

                local_40 = pfVar7[1] - pfVar6[1];

                local_3c = pfVar7[2] - pfVar6[2];

                if (local_44 * local_44 + local_40 * local_40 + local_3c * local_3c <

                    param_9 * param_9) {

                  local_4c = *local_20;

                  for (uVar3 = local_c[local_4c]; uVar3 != 0xffffffff;

                      uVar3 = *(uint *)((int)local_18 + uVar3 * 4)) {

                    piVar1 = (int *)(local_24 + (uVar3 / 3) * 0xc);

                    if (((*piVar1 == iVar8) || (piVar1[1] == iVar8)) || (piVar1[2] == iVar8))

                    goto LAB_005ee024;

                  }

                  *local_48 = local_4c;

                }

              }

LAB_005ee024:

              pvVar4 = local_38;

            }

          }

          local_14 = local_14 + 1;

          local_20 = local_20 + 1;

          local_34 = local_34 - 1;

        } while (local_34 != 0);

      }

    }

    iVar8 = FUN_005edb82(param_1,param_2,param_4,param_5,param_6,param_7,param_8,local_8,param_10,

                         local_58);

  }

LAB_005ee079:

  operator_delete(local_28);

  operator_delete(local_2c);

  operator_delete(local_c);

  operator_delete(local_18);

  operator_delete(local_38);

  operator_delete(local_10);

  operator_delete(local_8);

  if (local_1c != (undefined4 *)0x0) {

    (**(code **)(*param_1 + 0x30))(param_1);

  }

  if (local_24 != 0) {

    (**(code **)(*param_2 + 0x30))(param_2);

  }

  return iVar8;

}





// --- FUN_005ee0d9 at 0x005EE0D9 (size: 205) ---


undefined4

FUN_005ee0d9(float *param_1,float param_2,int param_3,int param_4,uint param_5,int param_6,

            int param_7,int param_8,int *param_9,float *param_10)



{

  float *pfVar1;

  float *pfVar2;

  float fVar3;

  float fVar4;

  int iVar5;

  float *pfVar6;

  float fVar7;

  

  fVar7 = param_1[1];

  fVar3 = *param_1;

  fVar4 = param_1[2];

  *param_10 = -NAN;

  pfVar1 = (float *)(param_3 + ((uint)((int)fVar7 + (int)fVar3 + (int)fVar4) % param_5) * 4);

  pfVar6 = (float *)*pfVar1;

  do {

    if (pfVar6 == (float *)0x0) {

      pfVar6 = (float *)(param_4 + *param_9 * 0x14);

      *param_9 = *param_9 + 1;

      *pfVar6 = *param_1;

      pfVar6[1] = param_1[1];

      pfVar6[2] = param_1[2];

      pfVar6[3] = param_2;

      pfVar6[4] = *pfVar1;

      *pfVar1 = (float)pfVar6;

      return 0;

    }

    if (((*pfVar6 == *param_1) && (pfVar6[1] == param_1[1])) &&

       (iVar5 = param_6, fVar7 = param_2, pfVar6[2] == param_1[2])) {

      do {

        fVar7 = *(float *)(iVar5 + (int)fVar7 * 4);

        if (fVar7 == -NAN) {

          *param_10 = pfVar6[3];

          return 1;

        }

        pfVar2 = (float *)(param_8 + ((uint)fVar7 / 3) * 0xc);

        fVar3 = pfVar6[3];

      } while (((*pfVar2 != fVar3) && (pfVar2[1] != fVar3)) && (iVar5 = param_7, pfVar2[2] != fVar3)

              );

    }

    pfVar6 = (float *)pfVar6[4];

  } while( true );

}





// --- FUN_005ee1a6 at 0x005EE1A6 (size: 818) ---


/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */



undefined4 __thiscall FUN_005ee1a6(int param_1,uint param_2,int param_3,uint *param_4,int param_5)



{

  ushort *puVar1;

  uint uVar2;

  uint *puVar3;

  ushort *puVar4;

  uint uVar5;

  int iVar6;

  uint uVar7;

  undefined4 *puVar8;

  int iVar9;

  ushort *puVar10;

  uint uVar11;

  undefined4 uVar12;

  undefined4 *puVar13;

  int local_68;

  int local_64;

  int local_60;

  uint local_5c;

  int local_58;

  ushort local_54;

  uint local_50;

  uint *local_48;

  int local_44;

  uint local_38;

  void *local_34;

  undefined4 local_2c [4];

  undefined4 local_1c;

  undefined4 local_c;

  undefined4 local_8;

  

  local_8 = DAT_00836f40;

  iVar9 = *(int *)(param_1 + 0x274);

  if ((iVar9 == 0) || (local_64 = iVar9, (param_2 & 0x400000) != 0)) {

    local_64 = 0xc;

  }

  uVar2 = param_2;

  if ((((param_2 & 0x4000000) != 0) && (iVar9 == 0)) && ((param_2 & 0x400000) == 0)) {

    uVar2 = param_2 & 0xfbffffff | 0x8000000;

  }

  local_2c[0] = 0;

  local_1c = 0;

  local_c = 0;

  if ((param_5 == 0) || (((uVar2 & 0x8000000) != 0 && ((uVar2 & 0x4000000) != 0)))) {

    uVar12 = 0x8876086c;

  }

  else {

    iVar9 = *(int *)(param_1 + 0x260);

    local_50 = 0;

    if (iVar9 != 0) {

      puVar3 = (uint *)(*(int *)(param_1 + 0x25c) + 8);

      do {

        if (local_50 < *puVar3) {

          local_50 = *puVar3;

        }

        puVar3 = puVar3 + 5;

        iVar9 = iVar9 + -1;

      } while (iVar9 != 0);

    }

    iVar9 = *(int *)(param_1 + 0x264);

    local_34 = (void *)FUN_005df0f5(iVar9 * 6);

    if (local_34 == (void *)0x0) {

      local_34 = (void *)0x0;

    }

    else {

      FUN_00401000(local_34,6,iVar9,&LAB_005eda5e);

    }

    if (local_34 == (void *)0x0) {

      uVar12 = 0x8007000e;

    }

    else {

      local_5c = 0;

      if (*(int *)(param_1 + 0x260) != 0) {

        local_58 = 0;

        do {

          iVar9 = *(int *)(param_1 + 0x25c) + local_58;

          uVar7 = *(uint *)(iVar9 + 4);

          uVar11 = *(int *)(iVar9 + 8) + uVar7;

          if (uVar7 < uVar11) {

            local_44 = uVar7 * 3;

            local_48 = param_4 + uVar7;

            puVar10 = (ushort *)((int)local_34 + uVar7 * 6);

            local_68 = uVar11 - uVar7;

            do {

              puVar1 = (ushort *)(param_5 + *local_48 * 0xc);

              local_38 = 1;

              local_60 = 3;

              puVar4 = puVar1;

              do {

                if (*(int *)puVar4 == -1) {

                  *puVar10 = 0xffff;

                }

                else {

                  local_54 = *(ushort *)(param_3 + (uint)*puVar4 * 4);

                  uVar5 = (uint)local_54;

                  if (((uVar5 < uVar7) || (uVar11 <= uVar5)) ||

                     ((*(int *)puVar4 == *(int *)(puVar1 + (local_38 % 3) * 2) ||

                      (*(int *)puVar4 == *(int *)(puVar1 + ((local_38 + 1) % 3) * 2))))) {

LAB_005ee3cf:

                    local_54 = 0xffff;

                  }

                  else {

                    iVar6 = FUN_005e61b3(param_5 + param_4[uVar5] * 0xc,*local_48);

                    iVar9 = *(int *)(param_1 + 0x24c);

                    if ((*(short *)(iVar9 + -2 + (local_44 + local_38) * 2) !=

                         *(short *)(iVar9 + ((iVar6 + 1U) % 3 + uVar5 * 3) * 2)) ||

                       (*(short *)(iVar9 + (local_44 + local_38 % 3) * 2) !=

                        *(short *)(iVar9 + (uVar5 * 3 + iVar6) * 2))) goto LAB_005ee3cf;

                  }

                  *puVar10 = local_54;

                }

                puVar4 = puVar4 + 2;

                local_38 = local_38 + 1;

                puVar10 = puVar10 + 1;

                local_60 = local_60 + -1;

              } while (local_60 != 0);

              local_48 = local_48 + 1;

              local_44 = local_44 + 3;

              local_68 = local_68 + -1;

            } while (local_68 != 0);

          }

          local_5c = local_5c + 1;

          local_58 = local_58 + 0x14;

        } while (local_5c < *(uint *)(param_1 + 0x260));

      }

      uVar7 = 0;

      if (*(int *)(param_1 + 0x264) != 0) {

        puVar3 = param_4;

        do {

          *(uint *)((param_3 - (int)param_4) + (int)puVar3) = uVar7;

          *puVar3 = uVar7;

          uVar7 = uVar7 + 1;

          puVar3 = puVar3 + 1;

        } while (uVar7 < *(uint *)(param_1 + 0x264));

      }

      puVar8 = (undefined4 *)FUN_005e61cf(param_1,local_34,local_50);

      puVar13 = local_2c;

      for (iVar9 = 9; iVar9 != 0; iVar9 = iVar9 + -1) {

        *puVar13 = *puVar8;

        puVar8 = puVar8 + 1;

        puVar13 = puVar13 + 1;

      }

      FUN_005e61f5();

      if ((uVar2 & 0x8000000) == 0) {

        if ((param_2 & 0x400000) == 0) {

          uVar12 = *(undefined4 *)(param_1 + 0x278);

        }

        else {

          uVar12 = 7;

        }

        uVar12 = FUN_005eca1d(local_2c,param_3,param_4,local_64,uVar12);

      }

      else {

        uVar12 = FUN_005ec910(local_2c,param_3,param_4);

      }

    }

    operator_delete(local_34);

  }

  FUN_005e61f5();

  return uVar12;

}





// --- FUN_005ee4d8 at 0x005EE4D8 (size: 781) ---


undefined4 __thiscall FUN_005ee4d8(int param_1,uint param_2,int param_3,uint *param_4,int param_5)



{

  uint *puVar1;

  uint uVar2;

  undefined4 *puVar3;

  int iVar4;

  undefined4 uVar5;

  uint uVar6;

  undefined4 *puVar7;

  undefined4 local_80 [6];

  undefined4 local_68;

  undefined4 local_54;

  uint local_50;

  int local_4c;

  int local_48;

  uint local_44;

  int local_40;

  int local_3c;

  int local_38;

  int local_34;

  int *local_30;

  uint local_2c;

  void *local_28;

  uint local_24;

  uint local_20;

  int local_1c;

  int *local_18;

  uint *local_14;

  int local_10;

  void *local_c;

  uint local_8;

  

  iVar4 = *(int *)(param_1 + 0x274);

  if ((iVar4 == 0) || (local_40 = iVar4, (param_2 & 0x400000) != 0)) {

    local_40 = 0xc;

  }

  uVar2 = param_2;

  if ((((param_2 & 0x4000000) != 0) && (iVar4 == 0)) && ((param_2 & 0x400000) == 0)) {

    uVar2 = param_2 & 0xfbffffff | 0x8000000;

  }

  local_80[0] = 0;

  local_68 = 0;

  local_54 = 0;

  local_3c = param_1;

  if ((param_5 == 0) ||

     ((local_2c = uVar2 & 0x8000000, local_2c != 0 && ((uVar2 & 0x4000000) != 0)))) {

    uVar5 = 0x8876086c;

  }

  else {

    iVar4 = *(int *)(param_1 + 0x260);

    local_24 = 0;

    if (iVar4 != 0) {

      puVar1 = (uint *)(*(int *)(param_1 + 0x25c) + 8);

      do {

        if (local_24 < *puVar1) {

          local_24 = *puVar1;

        }

        puVar1 = puVar1 + 5;

        iVar4 = iVar4 + -1;

      } while (iVar4 != 0);

    }

    iVar4 = *(int *)(param_1 + 0x264);

    local_c = (void *)FUN_005df0f5(iVar4 * 0xc);

    if (local_c == (void *)0x0) {

      local_c = (void *)0x0;

    }

    else {

      FUN_00401000(local_c,0xc,iVar4,&LAB_005eda5e);

    }

    if (local_c == (void *)0x0) {

      uVar5 = 0x8007000e;

    }

    else {

      local_20 = 0;

      if (*(int *)(param_1 + 0x260) != 0) {

        local_1c = 0;

        do {

          iVar4 = *(int *)(param_1 + 0x25c) + local_1c;

          uVar2 = *(uint *)(iVar4 + 4);

          local_44 = *(int *)(iVar4 + 8) + uVar2;

          if (uVar2 < local_44) {

            local_10 = uVar2 * 3;

            local_14 = param_4 + uVar2;

            local_28 = (void *)((int)local_c + uVar2 * 0xc);

            local_38 = local_44 - uVar2;

            do {

              local_18 = (int *)(param_5 + *local_14 * 0xc);

              iVar4 = (int)local_28 - (int)local_18;

              local_8 = 1;

              local_34 = 3;

              local_48 = iVar4;

              local_30 = local_18;

              do {

                if (*local_18 == -1) {

                  *(undefined4 *)(iVar4 + (int)local_18) = 0xffffffff;

                }

                else {

                  uVar6 = *(uint *)(param_3 + *local_18 * 4);

                  if (((uVar6 < uVar2) || (local_44 <= uVar6)) ||

                     ((local_50 = local_8 % 3, *local_18 == local_30[local_50] ||

                      (*local_18 == local_30[(local_8 + 1) % 3])))) {

                    uVar6 = 0xffffffff;

                  }

                  else {

                    local_4c = FUN_005e61b3(param_5 + param_4[uVar6] * 0xc,*local_14);

                    iVar4 = *(int *)(param_1 + 0x24c);

                    param_1 = local_3c;

                    if ((*(int *)(iVar4 + -4 + (local_10 + local_8) * 4) !=

                         *(int *)(iVar4 + ((local_4c + 1U) % 3 + uVar6 * 3) * 4)) ||

                       (*(int *)(iVar4 + (local_10 + local_50) * 4) !=

                        *(int *)(iVar4 + (uVar6 * 3 + local_4c) * 4))) {

                      uVar6 = 0xffffffff;

                    }

                  }

                  *(uint *)(local_48 + (int)local_18) = uVar6;

                  iVar4 = local_48;

                }

                local_8 = local_8 + 1;

                local_18 = local_18 + 1;

                local_34 = local_34 + -1;

              } while (local_34 != 0);

              local_28 = (void *)((int)local_28 + 0xc);

              local_14 = local_14 + 1;

              local_10 = local_10 + 3;

              local_38 = local_38 + -1;

              local_34 = 0;

            } while (local_38 != 0);

          }

          local_20 = local_20 + 1;

          local_1c = local_1c + 0x14;

        } while (local_20 < *(uint *)(param_1 + 0x260));

      }

      uVar2 = 0;

      if (*(int *)(param_1 + 0x264) != 0) {

        puVar1 = param_4;

        do {

          *(uint *)((param_3 - (int)param_4) + (int)puVar1) = uVar2;

          *puVar1 = uVar2;

          uVar2 = uVar2 + 1;

          puVar1 = puVar1 + 1;

        } while (uVar2 < *(uint *)(param_1 + 0x264));

      }

      puVar3 = (undefined4 *)FUN_005e620e(param_1,local_c,local_24);

      puVar7 = local_80;

      for (iVar4 = 0xc; iVar4 != 0; iVar4 = iVar4 + -1) {

        *puVar7 = *puVar3;

        puVar3 = puVar3 + 1;

        puVar7 = puVar7 + 1;

      }

      FUN_005e6232();

      if (local_2c == 0) {

        if ((param_2 & 0x400000) == 0) {

          uVar5 = *(undefined4 *)(param_1 + 0x278);

        }

        else {

          uVar5 = 7;

        }

        uVar5 = FUN_005ecbd0(local_80,param_3,param_4,local_40,uVar5);

      }

      else {

        uVar5 = FUN_005ecadf(local_80,param_3,param_4);

      }

    }

    operator_delete(local_c);

  }

  FUN_005e6232();

  return uVar5;

}





// --- FUN_005ee7e5 at 0x005EE7E5 (size: 90) ---


int FUN_005ee7e5(undefined4 param_1,undefined4 param_2,undefined4 param_3,uint param_4,

                undefined4 param_5,undefined4 param_6)



{

  int iVar1;

  undefined1 local_20c [520];

  

  if (((param_4 == 0) || ((param_4 & 1) != 0)) || ((param_4 & 0x400e) == 4)) {

    iVar1 = -0x7789f794;

  }

  else {

    iVar1 = FUN_005e7b67(param_4,local_20c);

    if (-1 < iVar1) {

      iVar1 = FUN_005ecc87(param_1,param_2,param_3,local_20c,param_5,param_6);

    }

  }

  return iVar1;

}





// --- FUN_005ee83f at 0x005EE83F (size: 1896) ---


int __thiscall

FUN_005ee83f(int param_1,uint *param_2,uint *param_3,uint *param_4,uint *param_5,undefined4 *param_6

            ,int *param_7,uint param_8)



{

  int *piVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  uint uVar4;

  undefined4 *puVar5;

  uint *puVar6;

  int iVar7;

  uint uVar8;

  undefined4 *puVar9;

  uint *puVar10;

  undefined4 *puVar11;

  void *local_44;

  uint local_40;

  void *local_3c;

  int local_38;

  void *local_34;

  int local_30;

  uint *local_2c;

  uint local_28;

  int *local_24;

  int local_20;

  int *local_1c;

  undefined4 *local_18;

  uint *local_14;

  void *local_10;

  uint *local_c;

  int local_8;

  

  uVar8 = (uint)param_2;

  uVar2 = *(undefined4 *)(param_1 + 0x264);

  local_c = (uint *)0x0;

  local_14 = (uint *)0x0;

  local_2c = (uint *)0x0;

  local_10 = (void *)0x0;

  local_34 = (void *)0x0;

  local_18 = (undefined4 *)0x0;

  local_3c = (void *)0x0;

  local_20 = 0;

  local_40 = 0;

  local_1c = (int *)0x0;

  local_38 = 0;

  local_30 = 0;

  local_24 = (int *)0x0;

  local_44 = (void *)0x0;

  if ((((param_2 == (uint *)0x0) || (((uint)param_2 & 0x3fefff) != 0)) ||

      ((param_3 == (uint *)0x0 && (param_4 != (uint *)0x0)))) ||

     ((((uint)param_2 & 0x40000000) != 0 && (*(int *)(param_1 + 0x260) == 0)))) {

    local_8 = -0x7789f794;

    goto LAB_005eef1d;

  }

  param_2 = (uint *)((uint)param_2 | 0x1000000);

  if ((uVar8 & 0xc000000) != 0) {

    param_2 = (uint *)(uVar8 | 0x3000000);

  }

  local_28 = (uint)param_2 & 0x2000000;

  if (((local_28 != 0) && (((uint)param_2 & 0x40000000) == 0)) &&

     (local_40 = *(uint *)(param_1 + 0x23c), ((uint)param_2 & 0x20000000) == 0)) {

    local_8 = FUN_005ea4d4(&local_3c,&local_20);

    if (local_8 < 0) goto LAB_005eef1d;

    if ((local_20 != 0) && (((uint)param_2 & 0x10000000) != 0)) {

      local_8 = -0x7789f4aa;

      goto LAB_005eef1d;

    }

  }

  local_c = (uint *)FUN_005df0f5(*(int *)(param_1 + 0x264) << 2);

  local_14 = (uint *)FUN_005df0f5(*(int *)(param_1 + 0x264) << 2);

  local_10 = (void *)FUN_005df0f5(*(int *)(param_1 + 0x23c) << 2);

  if (((local_c != (uint *)0x0) && (local_14 != (uint *)0x0)) && (local_10 != (void *)0x0)) {

    uVar8 = *(uint *)(param_1 + 0x23c);

    if ((((uint)param_2 & 0xc000000) == 0) ||

       (local_2c = (uint *)FUN_005df0f5(*(int *)(param_1 + 0x264) << 2), local_2c != (uint *)0x0)) {

      if ((((uint)param_2 & 0x1000000) == 0) || (((uint)param_2 & 0x40000000) != 0)) {

        uVar4 = 0;

        if (*(int *)(param_1 + 0x264) != 0) {

          puVar6 = local_c;

          do {

            *(uint *)(((int)local_14 - (int)local_c) + (int)puVar6) = uVar4;

            *puVar6 = uVar4;

            uVar4 = uVar4 + 1;

            puVar6 = puVar6 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x264));

        }

        uVar4 = 0;

        if (*(int *)(param_1 + 0x23c) != 0) {

          do {

            *(uint *)((int)local_10 + uVar4 * 4) = uVar4;

            uVar4 = uVar4 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x23c));

        }

      }

      else {

        local_8 = FUN_005e63d3(local_c,local_14,local_10);

        if (local_8 < 0) goto LAB_005eef1d;

      }

      if (((local_28 != 0) && (((uint)param_2 & 0x40000000) == 0)) &&

         (local_8 = FUN_005e64f1(local_c,local_14,local_10,param_2), local_8 < 0))

      goto LAB_005eef1d;

      local_28 = (uint)param_2 & 0x10000000;

      if ((local_28 != 0) && (uVar4 = 0, *(int *)(param_1 + 0x23c) != 0)) {

        do {

          *(uint *)((int)local_10 + uVar4 * 4) = uVar4;

          uVar4 = uVar4 + 1;

        } while (uVar4 < *(uint *)(param_1 + 0x23c));

      }

      local_8 = FUN_005ea8c6(local_c,local_10);

      if (local_8 < 0) goto LAB_005eef1d;

      if (((uint)param_2 & 0xc000000) != 0) {

        puVar6 = local_14;

        puVar10 = local_2c;

        for (uVar4 = *(uint *)(param_1 + 0x264) & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

          *puVar10 = *puVar6;

          puVar6 = puVar6 + 1;

          puVar10 = puVar10 + 1;

        }

        for (iVar7 = 0; iVar7 != 0; iVar7 = iVar7 + -1) {

          *(char *)puVar10 = (char)*puVar6;

          puVar6 = (uint *)((int)puVar6 + 1);

          puVar10 = (uint *)((int)puVar10 + 1);

        }

        local_8 = FUN_005ee1a6(param_2,local_c,local_14,param_3);

        if (local_8 < 0) goto LAB_005eef1d;

        local_34 = (void *)FUN_005df0f5(*(int *)(param_1 + 0x23c) << 2);

        if (local_34 == (void *)0x0) goto LAB_005eef16;

        if (local_28 == 0) {

          local_8 = FUN_005e69bd(local_14,local_34);

          if (local_8 < 0) goto LAB_005eef1d;

          uVar4 = 0;

          if (*(int *)(param_1 + 0x23c) != 0) {

            do {

              piVar1 = (int *)((int)local_10 + uVar4 * 4);

              iVar7 = *piVar1;

              if (iVar7 != 0xffff) {

                *piVar1 = *(int *)((int)local_34 + iVar7 * 4);

              }

              uVar4 = uVar4 + 1;

            } while (uVar4 < *(uint *)(param_1 + 0x23c));

          }

        }

        else {

          uVar4 = 0;

          if (*(int *)(param_1 + 0x23c) != 0) {

            do {

              *(uint *)((int)local_34 + uVar4 * 4) = uVar4;

              uVar4 = uVar4 + 1;

            } while (uVar4 < *(uint *)(param_1 + 0x23c));

          }

        }

        local_8 = FUN_005ea8c6(local_c,local_34);

        if (local_8 < 0) goto LAB_005eef1d;

        uVar4 = 0;

        if (*(int *)(param_1 + 0x264) != 0) {

          do {

            puVar6 = local_14 + uVar4;

            if (*puVar6 == 0xffffffff) {

              *puVar6 = 0xffffffff;

            }

            else {

              *puVar6 = local_2c[*puVar6];

            }

            uVar4 = uVar4 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x264));

        }

        uVar4 = 0;

        if (*(int *)(param_1 + 0x264) != 0) {

          do {

            local_c[uVar4] = 0xffff;

            uVar4 = uVar4 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x264));

        }

        uVar4 = 0;

        if (*(int *)(param_1 + 0x264) != 0) {

          do {

            if (local_14[uVar4] != 0xffff) {

              local_c[local_14[uVar4]] = uVar4;

            }

            uVar4 = uVar4 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x264));

        }

      }

      if (((param_6 != (undefined4 *)0x0) || (local_20 != 0)) || (*(int *)(param_1 + 0x240) == 0)) {

        local_8 = FUN_00600394(*(int *)(param_1 + 0x23c) << 2,&local_1c);

        if (local_8 < 0) goto LAB_005eef1d;

        local_38 = (**(code **)(*local_1c + 0xc))(local_1c);

        uVar4 = 0;

        if (*(int *)(param_1 + 0x23c) != 0) {

          do {

            *(undefined4 *)(local_38 + uVar4 * 4) = 0xffffffff;

            uVar4 = uVar4 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x23c));

        }

        uVar4 = 0;

        if (uVar8 != 0) {

          do {

            iVar7 = *(int *)((int)local_10 + uVar4 * 4);

            if (iVar7 != 0xffff) {

              *(uint *)(local_38 + iVar7 * 4) = uVar4;

            }

            uVar4 = uVar4 + 1;

          } while (uVar4 < uVar8);

        }

        if ((local_20 != 0) && (uVar8 = 0, *(int *)(param_1 + 0x23c) != 0)) {

          do {

            uVar4 = *(uint *)(local_38 + uVar8 * 4);

            if ((uVar4 != 0xffffffff) && (local_40 <= uVar4)) {

              *(undefined4 *)(local_38 + uVar8 * 4) =

                   *(undefined4 *)((int)local_3c + (uVar4 - local_40) * 4);

            }

            uVar8 = uVar8 + 1;

          } while (uVar8 < *(uint *)(param_1 + 0x23c));

        }

      }

      if ((local_20 == 0) && (*(int *)(param_1 + 0x240) != 0)) {

        local_8 = FUN_005e5e41(&local_18,0);

        if ((local_8 < 0) || (local_8 = FUN_005ea75e(local_10,local_18), local_8 < 0))

        goto LAB_005eef1d;

      }

      else if ((*(byte *)(param_1 + 0x218) & 0x20) == 0) {

        local_24 = *(int **)(param_1 + 0x234);

        uVar3 = *(undefined4 *)(param_1 + 0x23c);

        local_44 = *(void **)(param_1 + 0x244);

        if (*(int *)(param_1 + 0x240) == 0) {

          local_24 = param_7;

          (**(code **)(*param_7 + 4))(param_7);

        }

        *(undefined4 *)(param_1 + 0x234) = 0;

        *(undefined4 *)(param_1 + 0x23c) = 0;

        *(int *)(param_1 + 0x240) = 0;

        *(undefined4 *)(param_1 + 0x244) = 0;

        local_8 = FUN_005e7f7d(*(undefined4 *)(param_1 + 0x264),uVar3);

        if (((local_8 < 0) || (local_8 = FUN_005e5e41(&local_18,0), local_8 < 0)) ||

           (local_8 = (**(code **)(*local_24 + 0x2c))(local_24,0,0,&local_30,0x810), local_8 < 0))

        goto LAB_005eef1d;

        if (param_8 == 0) {

LAB_005eedb1:

          param_8 = 0;

          puVar5 = local_18;

          if (*(int *)(param_1 + 0x23c) != 0) {

            do {

              iVar7 = *(int *)(local_38 + param_8 * 4);

              if (iVar7 != -1) {

                uVar8 = *(uint *)(param_1 + 0x238);

                puVar9 = (undefined4 *)(uVar8 * iVar7 + local_30);

                puVar11 = puVar5;

                for (uVar4 = uVar8 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

                  *puVar11 = *puVar9;

                  puVar9 = puVar9 + 1;

                  puVar11 = puVar11 + 1;

                }

                for (uVar8 = uVar8 & 3; uVar8 != 0; uVar8 = uVar8 - 1) {

                  *(undefined1 *)puVar11 = *(undefined1 *)puVar9;

                  puVar9 = (undefined4 *)((int)puVar9 + 1);

                  puVar11 = (undefined4 *)((int)puVar11 + 1);

                }

                puVar5 = (undefined4 *)((int)puVar5 + *(int *)(param_1 + 0x238));

              }

              param_8 = param_8 + 1;

            } while (param_8 < *(uint *)(param_1 + 0x23c));

          }

        }

        else {

          iVar7 = FUN_005e55a4(param_8,param_1 + 0xc);

          if (iVar7 != 0) goto LAB_005eedb1;

          FUN_005e7d33(param_8,param_1 + 0xc);

          FUN_005e54c1(local_30,local_18);

          uVar8 = 0;

          if (*(int *)(param_1 + 0x23c) != 0) {

            do {

              iVar7 = *(int *)(local_38 + uVar8 * 4);

              if (iVar7 != -1) {

                FUN_005e54ec(iVar7,uVar8,1);

              }

              uVar8 = uVar8 + 1;

            } while (uVar8 < *(uint *)(param_1 + 0x23c));

          }

        }

        if ((local_44 != (void *)0x0) && (uVar8 = 0, *(int *)(param_1 + 0x23c) != 0)) {

          do {

            *(undefined2 *)(*(int *)(param_1 + 0x244) + uVar8 * 2) =

                 *(undefined2 *)

                  ((int)local_10 +

                  (uint)*(ushort *)((int)local_44 + *(int *)(local_38 + uVar8 * 4) * 2) * 4);

            uVar8 = uVar8 + 1;

          } while (uVar8 < *(uint *)(param_1 + 0x23c));

        }

        uVar8 = 0;

        iVar7 = 0;

        if (*(int *)(param_1 + 0x23c) != 0) {

          do {

            piVar1 = (int *)((int)local_10 + uVar8 * 4);

            if (*piVar1 == 0xffff) {

              *piVar1 = -1;

            }

            else {

              iVar7 = iVar7 + 1;

            }

            uVar8 = uVar8 + 1;

          } while (uVar8 < *(uint *)(param_1 + 0x23c));

        }

        *(int *)(param_1 + 0x23c) = iVar7;

      }

      if (param_5 != (uint *)0x0) {

        uVar8 = *(uint *)(param_1 + 0x264) & 0x3fffffff;

        puVar6 = local_c;

        if (((uint)param_2 & 0x80000000) == 0) {

          puVar6 = local_14;

        }

        for (; uVar8 != 0; uVar8 = uVar8 - 1) {

          *param_5 = *puVar6;

          puVar6 = puVar6 + 1;

          param_5 = param_5 + 1;

        }

        for (iVar7 = 0; iVar7 != 0; iVar7 = iVar7 + -1) {

          *(char *)param_5 = (char)*puVar6;

          puVar6 = (uint *)((int)puVar6 + 1);

          param_5 = (uint *)((int)param_5 + 1);

        }

      }

      uVar8 = 0;

      if (param_4 != (uint *)0x0) {

        if (param_4 == param_3) {

          local_8 = FUN_005e4e1e(local_c,param_4,uVar2);

          if (local_8 < 0) goto LAB_005eef1d;

        }

        else if (*(int *)(param_1 + 0x264) != 0) {

          param_2 = param_4;

          do {

            uVar4 = local_14[uVar8];

            param_8 = 3;

            puVar6 = param_2;

            do {

              iVar7 = *(int *)((int)param_3 + (uVar4 * 0xc - (int)param_2) + (int)puVar6);

              if (iVar7 == -1) {

                *puVar6 = 0xffffffff;

              }

              else {

                *puVar6 = local_c[iVar7];

              }

              puVar6 = puVar6 + 1;

              param_8 = param_8 + -1;

            } while (param_8 != 0);

            param_2 = param_2 + 3;

            uVar8 = uVar8 + 1;

          } while (uVar8 < *(uint *)(param_1 + 0x264));

        }

      }

      piVar1 = local_1c;

      if (param_6 != (undefined4 *)0x0) {

        local_1c = (int *)0x0;

        *param_6 = piVar1;

      }

      goto LAB_005eef1d;

    }

  }

LAB_005eef16:

  local_8 = -0x7ff8fff2;

LAB_005eef1d:

  operator_delete(local_10);

  operator_delete(local_c);

  operator_delete(local_14);

  operator_delete(local_2c);

  operator_delete(local_3c);

  operator_delete(local_34);

  if (*(void **)(param_1 + 0x244) != local_44) {

    operator_delete(local_44);

  }

  if (local_18 != (undefined4 *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

  }

  piVar1 = local_24;

  if (local_30 != 0) {

    (**(code **)(*local_24 + 0x30))(local_24);

  }

  if (local_1c != (int *)0x0) {

    (**(code **)(*local_1c + 8))(local_1c);

    local_1c = (int *)0x0;

  }

  if (piVar1 != (int *)0x0) {

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  return local_8;

}





// --- FUN_005eefa7 at 0x005EEFA7 (size: 1878) ---


int __thiscall

FUN_005eefa7(int param_1,uint *param_2,uint *param_3,uint *param_4,uint *param_5,undefined4 *param_6

            ,int *param_7,uint param_8)



{

  int *piVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  uint uVar4;

  undefined4 *puVar5;

  uint *puVar6;

  int iVar7;

  uint uVar8;

  undefined4 *puVar9;

  uint *puVar10;

  undefined4 *puVar11;

  void *local_44;

  uint local_40;

  void *local_3c;

  int local_38;

  void *local_34;

  int local_30;

  uint *local_2c;

  uint local_28;

  int *local_24;

  int local_20;

  int *local_1c;

  undefined4 *local_18;

  uint *local_14;

  void *local_10;

  uint *local_c;

  int local_8;

  

  uVar8 = (uint)param_2;

  uVar2 = *(undefined4 *)(param_1 + 0x264);

  local_c = (uint *)0x0;

  local_14 = (uint *)0x0;

  local_2c = (uint *)0x0;

  local_10 = (void *)0x0;

  local_34 = (void *)0x0;

  local_18 = (undefined4 *)0x0;

  local_3c = (void *)0x0;

  local_20 = 0;

  local_40 = 0;

  local_1c = (int *)0x0;

  local_38 = 0;

  local_30 = 0;

  local_24 = (int *)0x0;

  local_44 = (void *)0x0;

  if ((((param_2 == (uint *)0x0) || (((uint)param_2 & 0x3fefff) != 0)) ||

      ((param_3 == (uint *)0x0 && (param_4 != (uint *)0x0)))) ||

     ((((uint)param_2 & 0x40000000) != 0 && (*(int *)(param_1 + 0x260) == 0)))) {

    local_8 = -0x7789f794;

    goto LAB_005ef673;

  }

  param_2 = (uint *)((uint)param_2 | 0x1000000);

  if ((uVar8 & 0xc000000) != 0) {

    param_2 = (uint *)(uVar8 | 0x3000000);

  }

  local_28 = (uint)param_2 & 0x2000000;

  if (((local_28 != 0) && (((uint)param_2 & 0x40000000) == 0)) &&

     (local_40 = *(uint *)(param_1 + 0x23c), ((uint)param_2 & 0x20000000) == 0)) {

    local_8 = FUN_005ea9ca(&local_3c,&local_20);

    if (local_8 < 0) goto LAB_005ef673;

    if ((local_20 != 0) && (((uint)param_2 & 0x10000000) != 0)) {

      local_8 = -0x7789f4aa;

      goto LAB_005ef673;

    }

  }

  local_c = (uint *)FUN_005df0f5(*(int *)(param_1 + 0x264) << 2);

  local_14 = (uint *)FUN_005df0f5(*(int *)(param_1 + 0x264) << 2);

  local_10 = (void *)FUN_005df0f5(*(int *)(param_1 + 0x23c) << 2);

  if (((local_c != (uint *)0x0) && (local_14 != (uint *)0x0)) && (local_10 != (void *)0x0)) {

    uVar8 = *(uint *)(param_1 + 0x23c);

    if ((((uint)param_2 & 0xc000000) == 0) ||

       (local_2c = (uint *)FUN_005df0f5(*(int *)(param_1 + 0x264) << 2), local_2c != (uint *)0x0)) {

      if ((((uint)param_2 & 0x1000000) == 0) || (((uint)param_2 & 0x40000000) != 0)) {

        uVar4 = 0;

        if (*(int *)(param_1 + 0x264) != 0) {

          puVar6 = local_c;

          do {

            *(uint *)(((int)local_14 - (int)local_c) + (int)puVar6) = uVar4;

            *puVar6 = uVar4;

            uVar4 = uVar4 + 1;

            puVar6 = puVar6 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x264));

        }

        uVar4 = 0;

        if (*(int *)(param_1 + 0x23c) != 0) {

          do {

            *(uint *)((int)local_10 + uVar4 * 4) = uVar4;

            uVar4 = uVar4 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x23c));

        }

      }

      else {

        local_8 = FUN_005e6a64(local_c,local_14,local_10);

        if (local_8 < 0) goto LAB_005ef673;

      }

      if (((local_28 != 0) && (((uint)param_2 & 0x40000000) == 0)) &&

         (local_8 = FUN_005e6b5c(local_c,local_14,local_10,param_2), local_8 < 0))

      goto LAB_005ef673;

      local_28 = (uint)param_2 & 0x10000000;

      if ((local_28 != 0) && (uVar4 = 0, *(int *)(param_1 + 0x23c) != 0)) {

        do {

          *(uint *)((int)local_10 + uVar4 * 4) = uVar4;

          uVar4 = uVar4 + 1;

        } while (uVar4 < *(uint *)(param_1 + 0x23c));

      }

      local_8 = FUN_005ead88(local_c,local_10);

      if (local_8 < 0) goto LAB_005ef673;

      if (((uint)param_2 & 0xc000000) != 0) {

        puVar6 = local_14;

        puVar10 = local_2c;

        for (uVar4 = *(uint *)(param_1 + 0x264) & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

          *puVar10 = *puVar6;

          puVar6 = puVar6 + 1;

          puVar10 = puVar10 + 1;

        }

        for (iVar7 = 0; iVar7 != 0; iVar7 = iVar7 + -1) {

          *(char *)puVar10 = (char)*puVar6;

          puVar6 = (uint *)((int)puVar6 + 1);

          puVar10 = (uint *)((int)puVar10 + 1);

        }

        local_8 = FUN_005ee4d8(param_2,local_c,local_14,param_3);

        if (local_8 < 0) goto LAB_005ef673;

        local_34 = (void *)FUN_005df0f5(*(int *)(param_1 + 0x23c) << 2);

        if (local_34 == (void *)0x0) goto LAB_005ef66c;

        if (local_28 == 0) {

          local_8 = FUN_005e6ffd(local_14,local_34);

          if (local_8 < 0) goto LAB_005ef673;

          uVar4 = 0;

          if (*(int *)(param_1 + 0x23c) != 0) {

            do {

              piVar1 = (int *)((int)local_10 + uVar4 * 4);

              iVar7 = *piVar1;

              if (iVar7 != -1) {

                *piVar1 = *(int *)((int)local_34 + iVar7 * 4);

              }

              uVar4 = uVar4 + 1;

            } while (uVar4 < *(uint *)(param_1 + 0x23c));

          }

        }

        else {

          uVar4 = 0;

          if (*(int *)(param_1 + 0x23c) != 0) {

            do {

              *(uint *)((int)local_34 + uVar4 * 4) = uVar4;

              uVar4 = uVar4 + 1;

            } while (uVar4 < *(uint *)(param_1 + 0x23c));

          }

        }

        local_8 = FUN_005ead88(local_c,local_34);

        if (local_8 < 0) goto LAB_005ef673;

        uVar4 = 0;

        if (*(int *)(param_1 + 0x264) != 0) {

          do {

            puVar6 = local_14 + uVar4;

            if (*puVar6 == 0xffffffff) {

              *puVar6 = 0xffffffff;

            }

            else {

              *puVar6 = local_2c[*puVar6];

            }

            uVar4 = uVar4 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x264));

        }

        uVar4 = 0;

        if (*(int *)(param_1 + 0x264) != 0) {

          do {

            local_c[uVar4] = 0xffffffff;

            uVar4 = uVar4 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x264));

        }

        uVar4 = 0;

        if (*(int *)(param_1 + 0x264) != 0) {

          do {

            if (local_14[uVar4] != 0xffffffff) {

              local_c[local_14[uVar4]] = uVar4;

            }

            uVar4 = uVar4 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x264));

        }

      }

      if (((param_6 != (undefined4 *)0x0) || (local_20 != 0)) || (*(int *)(param_1 + 0x240) == 0)) {

        local_8 = FUN_00600394(*(int *)(param_1 + 0x23c) << 2,&local_1c);

        if (local_8 < 0) goto LAB_005ef673;

        local_38 = (**(code **)(*local_1c + 0xc))(local_1c);

        uVar4 = 0;

        if (*(int *)(param_1 + 0x23c) != 0) {

          do {

            *(undefined4 *)(local_38 + uVar4 * 4) = 0xffffffff;

            uVar4 = uVar4 + 1;

          } while (uVar4 < *(uint *)(param_1 + 0x23c));

        }

        uVar4 = 0;

        if (uVar8 != 0) {

          do {

            iVar7 = *(int *)((int)local_10 + uVar4 * 4);

            if (iVar7 != -1) {

              *(uint *)(local_38 + iVar7 * 4) = uVar4;

            }

            uVar4 = uVar4 + 1;

          } while (uVar4 < uVar8);

        }

        if ((local_20 != 0) && (uVar8 = 0, *(int *)(param_1 + 0x23c) != 0)) {

          do {

            uVar4 = *(uint *)(local_38 + uVar8 * 4);

            if ((uVar4 != 0xffffffff) && (local_40 <= uVar4)) {

              *(undefined4 *)(local_38 + uVar8 * 4) =

                   *(undefined4 *)((int)local_3c + (uVar4 - local_40) * 4);

            }

            uVar8 = uVar8 + 1;

          } while (uVar8 < *(uint *)(param_1 + 0x23c));

        }

      }

      if ((local_20 == 0) && (*(int *)(param_1 + 0x240) != 0)) {

        local_8 = FUN_005e5e41(&local_18,0);

        if ((local_8 < 0) || (local_8 = FUN_005eac33(local_10,local_18), local_8 < 0))

        goto LAB_005ef673;

      }

      else if ((*(byte *)(param_1 + 0x218) & 0x20) == 0) {

        local_24 = *(int **)(param_1 + 0x234);

        uVar3 = *(undefined4 *)(param_1 + 0x23c);

        local_44 = *(void **)(param_1 + 0x244);

        if (*(int *)(param_1 + 0x240) == 0) {

          local_24 = param_7;

          (**(code **)(*param_7 + 4))(param_7);

        }

        *(undefined4 *)(param_1 + 0x234) = 0;

        *(undefined4 *)(param_1 + 0x23c) = 0;

        *(int *)(param_1 + 0x240) = 0;

        *(undefined4 *)(param_1 + 0x244) = 0;

        local_8 = FUN_005e8c73(*(undefined4 *)(param_1 + 0x264),uVar3);

        if (((local_8 < 0) || (local_8 = FUN_005e5e41(&local_18,0), local_8 < 0)) ||

           (local_8 = (**(code **)(*local_24 + 0x2c))(local_24,0,0,&local_30,0x810), local_8 < 0))

        goto LAB_005ef673;

        if (param_8 == 0) {

LAB_005ef50d:

          param_8 = 0;

          puVar5 = local_18;

          if (*(int *)(param_1 + 0x23c) != 0) {

            do {

              iVar7 = *(int *)(local_38 + param_8 * 4);

              if (iVar7 != -1) {

                uVar8 = *(uint *)(param_1 + 0x238);

                puVar9 = (undefined4 *)(uVar8 * iVar7 + local_30);

                puVar11 = puVar5;

                for (uVar4 = uVar8 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

                  *puVar11 = *puVar9;

                  puVar9 = puVar9 + 1;

                  puVar11 = puVar11 + 1;

                }

                for (uVar8 = uVar8 & 3; uVar8 != 0; uVar8 = uVar8 - 1) {

                  *(undefined1 *)puVar11 = *(undefined1 *)puVar9;

                  puVar9 = (undefined4 *)((int)puVar9 + 1);

                  puVar11 = (undefined4 *)((int)puVar11 + 1);

                }

                puVar5 = (undefined4 *)((int)puVar5 + *(int *)(param_1 + 0x238));

              }

              param_8 = param_8 + 1;

            } while (param_8 < *(uint *)(param_1 + 0x23c));

          }

        }

        else {

          iVar7 = FUN_005e55a4(param_8,param_1 + 0xc);

          if (iVar7 != 0) goto LAB_005ef50d;

          FUN_005e7d33(param_8,param_1 + 0xc);

          FUN_005e54c1(local_30,local_18);

          uVar8 = 0;

          if (*(int *)(param_1 + 0x23c) != 0) {

            do {

              iVar7 = *(int *)(local_38 + uVar8 * 4);

              if (iVar7 != -1) {

                FUN_005e54ec(iVar7,uVar8,1);

              }

              uVar8 = uVar8 + 1;

            } while (uVar8 < *(uint *)(param_1 + 0x23c));

          }

        }

        if ((local_44 != (void *)0x0) && (uVar8 = 0, *(int *)(param_1 + 0x23c) != 0)) {

          do {

            *(undefined4 *)(*(int *)(param_1 + 0x244) + uVar8 * 4) =

                 *(undefined4 *)

                  ((int)local_10 + *(int *)((int)local_44 + *(int *)(local_38 + uVar8 * 4) * 4) * 4)

            ;

            uVar8 = uVar8 + 1;

          } while (uVar8 < *(uint *)(param_1 + 0x23c));

        }

        uVar8 = 0;

        iVar7 = 0;

        if (*(int *)(param_1 + 0x23c) != 0) {

          do {

            piVar1 = (int *)((int)local_10 + uVar8 * 4);

            if (*piVar1 == -1) {

              *piVar1 = -1;

            }

            else {

              iVar7 = iVar7 + 1;

            }

            uVar8 = uVar8 + 1;

          } while (uVar8 < *(uint *)(param_1 + 0x23c));

        }

        *(int *)(param_1 + 0x23c) = iVar7;

      }

      if (param_5 != (uint *)0x0) {

        uVar8 = *(uint *)(param_1 + 0x264) & 0x3fffffff;

        puVar6 = local_c;

        if (((uint)param_2 & 0x80000000) == 0) {

          puVar6 = local_14;

        }

        for (; uVar8 != 0; uVar8 = uVar8 - 1) {

          *param_5 = *puVar6;

          puVar6 = puVar6 + 1;

          param_5 = param_5 + 1;

        }

        for (iVar7 = 0; iVar7 != 0; iVar7 = iVar7 + -1) {

          *(char *)param_5 = (char)*puVar6;

          puVar6 = (uint *)((int)puVar6 + 1);

          param_5 = (uint *)((int)param_5 + 1);

        }

      }

      uVar8 = 0;

      if (param_4 != (uint *)0x0) {

        if (param_4 == param_3) {

          local_8 = FUN_005e4e1e(local_c,param_4,uVar2);

          if (local_8 < 0) goto LAB_005ef673;

        }

        else if (*(int *)(param_1 + 0x264) != 0) {

          param_2 = param_4;

          do {

            uVar4 = local_14[uVar8];

            param_8 = 3;

            puVar6 = param_2;

            do {

              iVar7 = *(int *)((int)param_3 + (uVar4 * 0xc - (int)param_2) + (int)puVar6);

              if (iVar7 == -1) {

                *puVar6 = 0xffffffff;

              }

              else {

                *puVar6 = local_c[iVar7];

              }

              puVar6 = puVar6 + 1;

              param_8 = param_8 + -1;

            } while (param_8 != 0);

            param_2 = param_2 + 3;

            uVar8 = uVar8 + 1;

          } while (uVar8 < *(uint *)(param_1 + 0x264));

        }

      }

      piVar1 = local_1c;

      if (param_6 != (undefined4 *)0x0) {

        local_1c = (int *)0x0;

        *param_6 = piVar1;

      }

      goto LAB_005ef673;

    }

  }

LAB_005ef66c:

  local_8 = -0x7ff8fff2;

LAB_005ef673:

  operator_delete(local_10);

  operator_delete(local_c);

  operator_delete(local_14);

  operator_delete(local_2c);

  operator_delete(local_3c);

  operator_delete(local_34);

  if (*(void **)(param_1 + 0x244) != local_44) {

    operator_delete(local_44);

  }

  if (local_18 != (undefined4 *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x234) + 0x30))(*(int **)(param_1 + 0x234));

  }

  piVar1 = local_24;

  if (local_30 != 0) {

    (**(code **)(*local_24 + 0x30))(local_24);

  }

  if (local_1c != (int *)0x0) {

    (**(code **)(*local_1c + 8))(local_1c);

    local_1c = (int *)0x0;

  }

  if (piVar1 != (int *)0x0) {

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  return local_8;

}





// --- FUN_005ef6fd at 0x005EF6FD (size: 435) ---


int FUN_005ef6fd(int param_1,uint param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5,

                undefined4 param_6,undefined4 *param_7)



{

  uint uVar1;

  int *piVar2;

  int iVar3;

  int *piVar4;

  undefined4 uVar5;

  uint uVar6;

  

  if ((((param_2 & 0xc0be2000) == 0) && ((param_2 & 1) == 0)) && ((param_2 & 0x400) == 0)) {

    uVar1 = *(uint *)(param_1 + 0x214);

    if (((uVar1 & 0x400) == 0) && ((uVar1 & 0x40) == 0)) {

      uVar6 = param_2 & 0x1cfff;

      if (uVar6 == 0) {

        if ((param_2 & 0x1000) == 0) {

          uVar6 = uVar1 & 0xffffefff;

        }

        else {

          uVar6 = uVar1 | 0x1000;

        }

      }

      else {

        if ((param_2 & 0x1000) != 0) {

          uVar6 = uVar6 | 0x1000;

        }

        if ((uVar1 & 1) != 0) {

          uVar6 = uVar6 | 1;

        }

        param_2 = param_2 & 0xfffe3000;

      }

      iVar3 = FUN_005df0f5(0x27c);

      if (iVar3 == 0) {

        piVar4 = (int *)0x0;

      }

      else {

        piVar4 = (int *)FUN_005eb3cb(*(undefined4 *)(param_1 + 0x230),param_1 + 0xc,uVar6);

      }

      if (piVar4 == (int *)0x0) {

        param_1 = -0x7ff8fff2;

      }

      else {

        if ((*(byte *)(piVar4 + 0x86) & 0x20) == 0) {

          uVar5 = 0;

        }

        else {

          uVar5 = *(undefined4 *)(param_1 + 0x23c);

        }

        iVar3 = FUN_005e7f7d(*(undefined4 *)(param_1 + 0x264),uVar5);

        if (-1 < iVar3) {

          if ((*(byte *)(piVar4 + 0x86) & 0x20) != 0) {

            *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x20;

            piVar4[0x8d] = *(int *)(param_1 + 0x234);

            piVar2 = *(int **)(param_1 + 0x234);

            (**(code **)(*piVar2 + 4))(piVar2);

            param_2 = param_2 | 0x10000000;

          }

          iVar3 = FUN_005e9683(param_1);

          if (-1 < iVar3) {

            if ((*(byte *)(piVar4 + 0x86) & 0x20) == 0) {

              piVar4[0x8f] = *(int *)(param_1 + 0x23c);

            }

            piVar2 = piVar4 + 0x93;

            iVar3 = FUN_005e549b(piVar2,0);

            if ((-1 < iVar3) &&

               (iVar3 = FUN_005ee83f(param_2,param_3,param_4,param_5,param_6,

                                     *(undefined4 *)(param_1 + 0x234),0), -1 < iVar3)) {

              if (*piVar2 != 0) {

                (**(code **)(*(int *)piVar4[0x92] + 0x30))((int *)piVar4[0x92]);

                *piVar2 = 0;

              }

              *param_7 = piVar4;

              piVar4 = (int *)0x0;

            }

          }

        }

        param_1 = iVar3;

        if (piVar4 != (int *)0x0) {

          if (piVar4[0x93] != 0) {

            (**(code **)(*(int *)piVar4[0x92] + 0x30))((int *)piVar4[0x92]);

          }

          (**(code **)(*piVar4 + 8))(piVar4);

        }

      }

    }

    else {

      param_1 = -0x7789f794;

    }

  }

  else {

    param_1 = -0x7789f794;

  }

  return param_1;

}





// --- FUN_005ef8b0 at 0x005EF8B0 (size: 142) ---


int FUN_005ef8b0(int param_1,uint param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5,

                undefined4 param_6)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  

  iVar3 = param_1;

  if ((((param_2 & 0xc0bfefff) == 0) && ((*(uint *)(param_1 + 0x214) & 0x400) == 0)) &&

     ((*(uint *)(param_1 + 0x214) & 0x40) == 0)) {

    iVar4 = FUN_005e549b(param_1 + 0x24c,0);

    if (-1 < iVar4) {

      if ((*(byte *)(param_1 + 0x218) & 0x20) != 0) {

        param_2 = param_2 | 0x10000000;

      }

      iVar4 = FUN_005ee83f(param_2,param_3,param_4,param_5,param_6,0,0);

    }

  }

  else {

    param_1 = -0x7789f794;

    iVar4 = param_1;

  }

  param_1 = iVar4;

  piVar1 = (int *)(iVar3 + 0x24c);

  if (*piVar1 != 0) {

    piVar2 = *(int **)(iVar3 + 0x248);

    (**(code **)(*piVar2 + 0x30))(piVar2);

    *piVar1 = 0;

  }

  return param_1;

}





// --- FUN_005ef93e at 0x005EF93E (size: 435) ---


int FUN_005ef93e(int param_1,uint param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5,

                undefined4 param_6,undefined4 *param_7)



{

  uint uVar1;

  int *piVar2;

  int iVar3;

  int *piVar4;

  undefined4 uVar5;

  uint uVar6;

  

  if ((((param_2 & 0xc0be2000) == 0) && ((param_2 & 1) == 0)) && ((param_2 & 0x400) == 0)) {

    uVar1 = *(uint *)(param_1 + 0x214);

    if (((uVar1 & 0x400) == 0) && ((uVar1 & 0x40) == 0)) {

      uVar6 = param_2 & 0x1cfff;

      if (uVar6 == 0) {

        if ((param_2 & 0x1000) == 0) {

          uVar6 = uVar1 & 0xffffefff;

        }

        else {

          uVar6 = uVar1 | 0x1000;

        }

      }

      else {

        if ((param_2 & 0x1000) != 0) {

          uVar6 = uVar6 | 0x1000;

        }

        if ((uVar1 & 1) != 0) {

          uVar6 = uVar6 | 1;

        }

        param_2 = param_2 & 0xfffe3000;

      }

      iVar3 = FUN_005df0f5(0x27c);

      if (iVar3 == 0) {

        piVar4 = (int *)0x0;

      }

      else {

        piVar4 = (int *)FUN_005eb870(*(undefined4 *)(param_1 + 0x230),param_1 + 0xc,uVar6);

      }

      if (piVar4 == (int *)0x0) {

        param_1 = -0x7ff8fff2;

      }

      else {

        if ((*(byte *)(piVar4 + 0x86) & 0x20) == 0) {

          uVar5 = 0;

        }

        else {

          uVar5 = *(undefined4 *)(param_1 + 0x23c);

        }

        iVar3 = FUN_005e8c73(*(undefined4 *)(param_1 + 0x264),uVar5);

        if (-1 < iVar3) {

          if ((*(byte *)(piVar4 + 0x86) & 0x20) != 0) {

            *(uint *)(param_1 + 0x218) = *(uint *)(param_1 + 0x218) | 0x20;

            piVar4[0x8d] = *(int *)(param_1 + 0x234);

            piVar2 = *(int **)(param_1 + 0x234);

            (**(code **)(*piVar2 + 4))(piVar2);

            param_2 = param_2 | 0x10000000;

          }

          iVar3 = FUN_005e9905(param_1);

          if (-1 < iVar3) {

            if ((*(byte *)(piVar4 + 0x86) & 0x20) == 0) {

              piVar4[0x8f] = *(int *)(param_1 + 0x23c);

            }

            piVar2 = piVar4 + 0x93;

            iVar3 = FUN_005e549b(piVar2,0);

            if ((-1 < iVar3) &&

               (iVar3 = FUN_005eefa7(param_2,param_3,param_4,param_5,param_6,

                                     *(undefined4 *)(param_1 + 0x234),0), -1 < iVar3)) {

              if (*piVar2 != 0) {

                (**(code **)(*(int *)piVar4[0x92] + 0x30))((int *)piVar4[0x92]);

                *piVar2 = 0;

              }

              *param_7 = piVar4;

              piVar4 = (int *)0x0;

            }

          }

        }

        param_1 = iVar3;

        if (piVar4 != (int *)0x0) {

          if (piVar4[0x93] != 0) {

            (**(code **)(*(int *)piVar4[0x92] + 0x30))((int *)piVar4[0x92]);

          }

          (**(code **)(*piVar4 + 8))(piVar4);

        }

      }

    }

    else {

      param_1 = -0x7789f794;

    }

  }

  else {

    param_1 = -0x7789f794;

  }

  return param_1;

}





// --- FUN_005efaf1 at 0x005EFAF1 (size: 142) ---


int FUN_005efaf1(int param_1,uint param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5,

                undefined4 param_6)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  

  iVar3 = param_1;

  if ((((param_2 & 0xc0bfefff) == 0) && ((*(uint *)(param_1 + 0x214) & 0x400) == 0)) &&

     ((*(uint *)(param_1 + 0x214) & 0x40) == 0)) {

    iVar4 = FUN_005e549b(param_1 + 0x24c,0);

    if (-1 < iVar4) {

      if ((*(byte *)(param_1 + 0x218) & 0x20) != 0) {

        param_2 = param_2 | 0x10000000;

      }

      iVar4 = FUN_005eefa7(param_2,param_3,param_4,param_5,param_6,0,0);

    }

  }

  else {

    param_1 = -0x7789f794;

    iVar4 = param_1;

  }

  param_1 = iVar4;

  piVar1 = (int *)(iVar3 + 0x24c);

  if (*piVar1 != 0) {

    piVar2 = *(int **)(iVar3 + 0x248);

    (**(code **)(*piVar2 + 0x30))(piVar2);

    *piVar1 = 0;

  }

  return param_1;

}





// --- FUN_005efb7f at 0x005EFB7F (size: 233) ---


undefined4 FUN_005efb7f(undefined4 param_1)



{

  undefined *puVar1;

  undefined4 uVar2;

  HMODULE pHVar3;

  int iVar4;

  

  uVar2 = DAT_008f2988;

  DAT_008f2988 = param_1;

  if ((DAT_008f2990 == (code *)0x0) && (DAT_008f298c == (code *)0x0)) {

    pHVar3 = GetModuleHandleA("d3d9.dll");

    puVar1 = PTR_FUN_00837388;

    if ((pHVar3 != (HMODULE)0x0) && (pHVar3 = LoadLibraryA("d3d9.dll"), pHVar3 != (HMODULE)0x0)) {

      DAT_008f2990 = (code *)(*(code *)puVar1)(pHVar3,"DebugSetMute");

    }

    pHVar3 = GetModuleHandleA("d3d9d.dll");

    if ((pHVar3 != (HMODULE)0x0) && (pHVar3 = LoadLibraryA("d3d9d.dll"), pHVar3 != (HMODULE)0x0)) {

      DAT_008f298c = (code *)(*(code *)puVar1)(pHVar3,"DebugSetMute");

    }

  }

  if (DAT_00825438 == -1) {

    iVar4 = FUN_005ff607(4,"D3DXDoNotMute",&DAT_00825438,4);

    if (iVar4 == 0) {

      DAT_00825438 = 0;

    }

    if (DAT_00825438 == 0) goto LAB_005efc43;

    DAT_00825438 = 1;

  }

  if (DAT_00825438 != 0) {

    return uVar2;

  }

LAB_005efc43:

  if (DAT_008f2990 != (code *)0x0) {

    (*DAT_008f2990)(param_1);

  }

  if (DAT_008f298c != (code *)0x0) {

    (*DAT_008f298c)(param_1);

  }

  return uVar2;

}





// --- FUN_005efc68 at 0x005EFC68 (size: 143) ---


void FUN_005efc68(void)



{

  bool bVar1;

  void *pvVar2;

  void *pvVar3;

  

  if (DAT_008f2994 == 0) {

    DAT_008f2994 = 1;

    bVar1 = false;

    pvVar2 = (void *)FUN_005df0f5(0);

    pvVar3 = (void *)FUN_005df0f5(0);

    if (((pvVar2 == (void *)0x0) || (pvVar3 == (void *)0x0)) || (pvVar2 == pvVar3)) {

      bVar1 = true;

    }

    if (pvVar2 != (void *)0x0) {

      operator_delete(pvVar2);

    }

    if ((pvVar3 != (void *)0x0) && (pvVar3 != pvVar2)) {

      operator_delete(pvVar3);

    }

    operator_delete((void *)0x0);

    if (bVar1) {

      OutputDebugStringA(

                        "D3DX: (WARN) Overloaded ::new and ::delete operators do not conform to C++ standards:\r\n"

                        );

      OutputDebugStringA(

                        "D3DX: (WARN) An allocation of zero bytes should return a unique non-null pointer to at\r\n"

                        );

      OutputDebugStringA(

                        "D3DX: (WARN) least zero bytes. Deletion of a null pointer should quietly do nothing.\r\n"

                        );

      OutputDebugStringA("D3DX: (WARN) D3DX relies upon this behavior.\r\n");

    }

  }

  return;

}





// --- FUN_005efcf7 at 0x005EFCF7 (size: 10) ---


void __fastcall FUN_005efcf7(undefined4 *param_1)



{

  param_1[1] = 0;

  *param_1 = 0;

  return;

}





// --- FUN_005efd01 at 0x005EFD01 (size: 32) ---


void __fastcall FUN_005efd01(int *param_1)



{

  if ((undefined4 *)param_1[1] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[1])(1);

  }

  if ((undefined4 *)*param_1 != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)*param_1)(1);

  }

  return;

}





// --- FUN_005efd21 at 0x005EFD21 (size: 24) ---


float10 FUN_005efd21(float param_1)



{

  double dVar1;

  

  dVar1 = floor((double)param_1);

  return (float10)dVar1;

}





// --- FUN_005efd4f at 0x005EFD4F (size: 702) ---


/* WARNING: Removing unreachable block (ram,0x005efdc6) */

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



int * FUN_005efd4f(uint param_1,int param_2,int param_3)



{

  int *piVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float fVar7;

  float fVar8;

  float fVar9;

  int iVar10;

  int *piVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int iVar16;

  uint uVar17;

  float local_24;

  uint local_1c;

  float local_18;

  uint local_10;

  float local_c;

  float local_8;

  

  uVar17 = 0;

  if ((param_1 != 0) && (param_2 != 0)) {

    fVar2 = (float)param_2;

    if (param_2 < 0) {

      fVar2 = fVar2 + _DAT_0079920c;

    }

    fVar3 = (float)(int)param_1;

    if ((int)param_1 < 0) {

      fVar3 = fVar3 + _DAT_0079920c;

    }

    fVar4 = fVar2 / fVar3;

    iVar16 = 0x10;

    fVar5 = _DAT_007938b8 / fVar4;

    if (param_1 != 0) {

      do {

        iVar10 = FUN_005df4c4();

        uVar17 = uVar17 + 1;

        iVar16 = iVar16 + 0xc + iVar10 * 0x10;

      } while (uVar17 < param_1);

    }

    piVar11 = (int *)FUN_005df0f5(iVar16);

    if (piVar11 != (int *)0x0) {

      iVar10 = 0;

      local_1c = 0;

      iVar16 = 4;

      iVar15 = iVar16;

      if (param_1 != 0) {

        do {

          local_8 = 0.0;

          local_10 = 0;

          fVar6 = (float)(int)local_1c;

          iVar16 = iVar15 + 4;

          if ((int)local_1c < 0) {

            fVar6 = fVar6 + _DAT_0079920c;

          }

          do {

            fVar7 = (float)(int)local_10;

            if ((int)local_10 < 0) {

              fVar7 = fVar7 + _DAT_0079920c;

            }

            fVar7 = (fVar7 + fVar6) - _DAT_007938b8;

            local_24 = fVar7 * fVar4;

            local_c = fVar4 + local_24;

            if (param_3 == 0) {

              if (local_24 < DAT_00796344) {

                local_24 = 0.0;

              }

              if (fVar2 < local_c) {

                local_c = fVar2;

              }

            }

            FUN_005efd21(local_24);

            iVar12 = FUN_005df4c4();

            fVar8 = (float)iVar12;

            if (fVar8 < local_c) {

              iVar13 = iVar12 - param_2;

              do {

                local_18 = _DAT_007938b0 + fVar8;

                if (iVar12 < 0) {

                  iVar14 = iVar12 + param_2;

                }

                else {

                  iVar14 = iVar13;

                  if (iVar12 < param_2) {

                    iVar14 = iVar12;

                  }

                }

                if (iVar14 != iVar10) {

                  if (_DAT_007ed694 < local_8) {

                    piVar1 = (int *)(iVar16 + (int)piVar11);

                    *piVar1 = iVar10;

                    iVar16 = iVar16 + 8;

                    piVar1[1] = (int)local_8;

                  }

                  local_8 = 0.0;

                  iVar10 = iVar14;

                }

                if (fVar8 < local_24) {

                  fVar8 = local_24;

                }

                if (local_c < local_18) {

                  local_18 = local_c;

                }

                if (param_3 == 0) {

                  if (DAT_00796344 <= fVar7) {

                    if (fVar7 + _DAT_007938b0 < fVar3) goto LAB_005eff75;

                    fVar9 = 0.0;

                  }

                  else {

                    fVar9 = 1.0;

                  }

                }

                else {

LAB_005eff75:

                  fVar9 = (local_18 + fVar8) * fVar5 - fVar7;

                }

                if (local_10 != 0) {

                  fVar9 = 1.0 - fVar9;

                }

                iVar12 = iVar12 + 1;

                iVar13 = iVar13 + 1;

                local_8 = (local_18 - fVar8) * fVar9 + local_8;

                fVar8 = (float)iVar12;

              } while (fVar8 < local_c);

            }

            local_10 = local_10 + 1;

          } while (local_10 < 2);

          if (_DAT_007ed694 < local_8) {

            piVar1 = (int *)(iVar16 + (int)piVar11);

            iVar16 = iVar16 + 8;

            *piVar1 = iVar10;

            piVar1[1] = (int)local_8;

          }

          local_1c = local_1c + 1;

          *(int *)(iVar15 + (int)piVar11) = iVar16 - iVar15;

          iVar15 = iVar16;

        } while (local_1c < param_1);

      }

      *piVar11 = iVar16;

      return piVar11;

    }

  }

  return (int *)0x0;

}





