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

// --- FUN_00690070 at 0x00690070 (size: 184) ---


void __fastcall FUN_00690070(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  *param_1 = &PTR_LAB_00801280;

  FUN_0068fa90();

  FUN_00676850();

  param_1[0x32] = &PTR_FUN_00801110;

  if ((undefined4 *)param_1[0x4a] != param_1 + 0x33) {

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

  }

  param_1[0x4a] = 0;

  param_1[0x4b] = 0;

  param_1[0x4c] = 0;

  param_1[0x4d] = 0;

  FUN_00676850();

  param_1[0x14] = &PTR_FUN_0080110c;

  if ((undefined4 *)param_1[0x2c] != param_1 + 0x15) {

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

  }

  param_1[0x2c] = 0;

  param_1[0x2d] = 0;

  param_1[0x2e] = 0;

  param_1[0x2f] = 0;

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

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

  }

  puVar2 = (undefined4 *)(param_1[0xc] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0xc] + -0x10));

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

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

  }

  FUN_004154b0();

  return;

}





// --- FUN_00690130 at 0x00690130 (size: 291) ---


undefined4 __thiscall FUN_00690130(int param_1,int *param_2)



{

  char cVar1;

  undefined4 uVar2;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  int iVar3;

  uint uVar4;

  undefined4 uVar5;

  uint uStack_c;

  uint uStack_8;

  int local_4;

  

  local_4 = FUN_0065ca40();

  iVar3 = 0;

  if (local_4 < 1) {

    return 1;

  }

  while( true ) {

    uVar2 = (**(code **)(*param_2 + 0xc))(iVar3);

    uStack_8 = 0;

    cVar1 = FUN_00448290(&uStack_8);

    if (((cVar1 == '\0') || (uStack_8 == 0)) || (0x20 < uStack_8)) break;

    uVar4 = 1 << (0x20U - (char)uStack_8 & 0x1f);

    uStack_c = 0xffffffff;

    uStack_8 = uVar4;

    cVar1 = FUN_0068c2b0(uVar2);

    if ((cVar1 == '\0') || (*(uint *)(param_1 + 0x4c) <= (uStack_c & 0xff))) {

      uVar5 = extraout_ECX_00;

      FUN_00401340("ERROR - Invalid device.\n");

      FUN_0065d620(uVar2,uVar5);

      return 0;

    }

    FUN_0068fc70(&uStack_c,&uStack_8);

    iVar3 = iVar3 + 1;

    *(uint *)(param_1 + 0x140) = *(uint *)(param_1 + 0x140) | uVar4;

    if (local_4 <= iVar3) {

      return 1;

    }

  }

  uVar5 = extraout_ECX;

  uVar4 = uStack_8;

  FUN_00401340("ERROR - Invalid index %d, index must be between 1 and 32\n");

  FUN_0065d620(uVar2,uVar5,uVar4);

  return 0;

}





// --- FUN_00690260 at 0x00690260 (size: 150) ---


int * __thiscall FUN_00690260(int *param_1,uint param_2)



{

  uint *puVar1;

  uint uVar2;

  int *piVar3;

  int *local_4;

  

  uVar2 = param_2;

  piVar3 = (int *)0x0;

  puVar1 = *(uint **)(param_1[0x4a] + (param_2 % (uint)param_1[0x4c]) * 4);

  do {

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

LAB_00690299:

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

        local_4 = param_1;

        piVar3 = (int *)FUN_005df0f5(0x80);

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

          piVar3 = (int *)0x0;

        }

        else {

          *piVar3 = (int)param_1;

          piVar3[1] = uVar2;

          FUN_0068ecc0(0);

          piVar3[0x1e] = 0;

          piVar3[0x1f] = 0;

        }

        local_4 = piVar3;

        FUN_0068fd10(&param_2,&local_4);

        return piVar3;

      }

      return piVar3;

    }

    if (*puVar1 == param_2) {

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

        piVar3 = (int *)puVar1[4];

      }

      goto LAB_00690299;

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_00690300 at 0x00690300 (size: 785) ---


undefined1 __thiscall FUN_00690300(int param_1,int *param_2)



{

  char cVar1;

  int *piVar2;

  int iVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  undefined4 extraout_ECX_02;

  undefined4 uVar6;

  undefined *puVar7;

  undefined1 local_3d;

  undefined *puStack_3c;

  undefined4 uStack_38;

  undefined4 uStack_34;

  undefined4 uStack_30;

  undefined4 uStack_2c;

  int local_28;

  undefined4 uStack_24;

  undefined4 uStack_20;

  undefined4 uStack_1c;

  undefined4 uStack_18;

  int local_14;

  int local_10;

  undefined4 uStack_c;

  undefined4 uStack_8;

  undefined4 uStack_4;

  

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

    return 0;

  }

  local_3d = 1;

  local_28 = param_1;

  local_10 = FUN_0065ca40();

  local_14 = 0;

  if (0 < local_10) {

    do {

      piVar2 = (int *)(**(code **)(*param_2 + 0xc))(local_14);

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

        uStack_38 = 0;

        cVar1 = FUN_00685800(piVar2,0x19,&uStack_38);

        if (cVar1 == '\0') {

          local_3d = 0;

        }

        else {

          uStack_20 = 0xffffffff;

          iVar3 = FUN_0065ca40();

          uVar4 = extraout_ECX;

          if (iVar3 != 0) {

            uVar4 = (**(code **)(*piVar2 + 0xc))(0);

            cVar1 = FUN_0068c2b0(uVar4);

            uVar4 = extraout_ECX_00;

            if (cVar1 != '\0') {

              iVar3 = (**(code **)(*piVar2 + 0xc))(1);

              uStack_1c = 0;

              if ((iVar3 == 0) || (cVar1 = FUN_00448290(&uStack_1c), cVar1 != '\0')) {

                uStack_18 = 3;

                iVar3 = (**(code **)(*piVar2 + 0xc))(2);

                if (iVar3 != 0) {

                  puStack_3c = PTR_DAT_00818344;

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

                  FUN_00426020(&puStack_3c);

                  cVar1 = FUN_0068be60(&puStack_3c,&uStack_18);

                  if (cVar1 == '\0') {

                    uVar4 = extraout_ECX_02;

                    puVar7 = puStack_3c;

                    FUN_00401340("ERROR - invalid control range \"%s\"\n");

                    FUN_0065d620(iVar3,uVar4,puVar7);

                    local_3d = 0;

                    FUN_004011b0();

                    goto LAB_006905c5;

                  }

                  FUN_004011b0();

                }

                if (((DAT_00837ff4 != (int *)0x0) &&

                    (iVar3 = (**(code **)(*DAT_00837ff4 + 0x44))(), iVar3 != 0)) &&

                   (cVar1 = FUN_00686470(uStack_38,*(undefined4 *)(param_1 + 4)), cVar1 == '\0')) {

                  FUN_00401a40();

                  FUN_00426020(&uStack_2c);

                  FUN_00401a40();

                  FUN_0041b060(0x1a,*(undefined4 *)(param_1 + 4),&uStack_30);

                  uVar4 = uStack_2c;

                  uVar6 = uStack_2c;

                  uVar5 = uStack_30;

                  FUN_00401340("Control \'%s\' is not allowed in this InputMap (\'%s\').");

                  FUN_0065d620(piVar2,uVar4,uVar6,uVar5);

                  local_3d = 0;

                  FUN_004011b0();

                  FUN_004011b0();

                }

                uVar4 = uStack_20;

                uStack_c = uStack_20;

                uVar5 = FUN_0068d710(uStack_1c);

                uVar6 = uStack_18;

                uStack_4 = uStack_18;

                uStack_8 = uVar5;

                cVar1 = FUN_0068dcb0(&uStack_c,uStack_38,piVar2);

                if ((cVar1 != '\0') &&

                   (cVar1 = FUN_0068fee0(uStack_38,uVar4,uVar5,uVar6), cVar1 == '\0')) {

                  FUN_00401a40();

                  FUN_00426020(&uStack_24);

                  uVar4 = uStack_24;

                  uVar6 = uStack_24;

                  FUN_00401340("ERROR - Control conflicts with another mapping \"%s\"\n");

                  FUN_0065d620(piVar2,uVar4,uVar6);

                  local_3d = 0;

                  FUN_004011b0();

                }

              }

              else {

                FUN_00401a40();

                FUN_00426020(&uStack_34);

                uVar4 = extraout_ECX_01;

                uVar6 = uStack_34;

                FUN_00401340("ERROR - invalid MetaKey flags \"%s\"\n");

                FUN_0065d620(iVar3,uVar4,uVar6);

                local_3d = 0;

                FUN_004011b0();

              }

              goto LAB_006905c5;

            }

          }

          FUN_00401340("ERROR - invalid Control Specification\n");

          FUN_0065d620(piVar2,uVar4);

          local_3d = 0;

        }

      }

LAB_006905c5:

      local_14 = local_14 + 1;

      param_1 = local_28;

    } while (local_14 < local_10);

  }

  return local_3d;

}





// --- FUN_00690620 at 0x00690620 (size: 30) ---


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



{

  FUN_00690070();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00690640 at 0x00690640 (size: 918) ---


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



{

  uint *puVar1;

  char cVar2;

  int *piVar3;

  uint uVar4;

  undefined4 uVar5;

  uint *puVar6;

  uint uVar7;

  int iVar8;

  uint *puVar9;

  int *piVar10;

  undefined4 *puVar11;

  int *piVar12;

  bool bVar13;

  int local_84;

  uint local_80;

  uint local_7c;

  int local_78;

  undefined **local_74;

  undefined **local_70;

  undefined1 local_6c [92];

  undefined1 *local_10;

  uint *local_c;

  uint local_8;

  int local_4;

  

  local_74 = &PTR_FUN_0079da04;

  FUN_0046c1f0(0x17);

  local_7c = *(uint *)(param_2 + 0x4c);

  local_80 = 0;

  if (local_7c != 0) {

    local_84 = 0;

    do {

      piVar10 = (int *)(*(int *)(param_2 + 0x44) + local_84);

      uVar7 = 0;

      if (*(uint *)(param_1 + 0x4c) != 0) {

        piVar3 = (int *)(*(int *)(param_1 + 0x44) + 0xc);

        do {

          if ((((piVar3[-2] == piVar10[1]) && (piVar3[-1] == piVar10[2])) && (*piVar3 == piVar10[3])

              ) && (piVar3[1] == piVar10[4])) goto LAB_006906d7;

          uVar7 = uVar7 + 1;

          piVar3 = piVar3 + 5;

        } while (uVar7 < *(uint *)(param_1 + 0x4c));

      }

      uVar7 = 0xffffffff;

LAB_006906d7:

      if (uVar7 == 0xffffffff) {

        uVar7 = *(uint *)(param_1 + 0x4c);

        uVar4 = *(uint *)(param_1 + 0x48) & 0x7fffffff;

        if (uVar4 <= *(uint *)(param_1 + 0x4c)) {

          uVar5 = FUN_00453850(uVar4 + 1);

          cVar2 = FUN_0068d910(uVar5);

          if (cVar2 == '\0') goto LAB_00690732;

        }

        piVar3 = piVar10;

        piVar12 = (int *)(*(int *)(param_1 + 0x44) + *(int *)(param_1 + 0x4c) * 0x14);

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

          *piVar12 = *piVar3;

          piVar3 = piVar3 + 1;

          piVar12 = piVar12 + 1;

        }

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

      }

LAB_00690732:

      piVar3 = (int *)(*(int *)(param_1 + 0x44) + uVar7 * 0x14);

      if (*piVar3 != *piVar10) {

        if ((char)param_3 == '\0') goto LAB_00690996;

        *piVar3 = *piVar10;

      }

      puVar6 = (uint *)FUN_005df0f5(0xc);

      puVar9 = (uint *)0x0;

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

        puVar6[1] = 0;

        *puVar6 = local_80;

        puVar6[2] = uVar7;

        puVar9 = puVar6;

      }

      puVar6 = (uint *)(local_10 + (*puVar9 % local_8) * 4);

      for (puVar1 = (uint *)*puVar6; puVar1 != (uint *)0x0; puVar1 = (uint *)puVar1[1]) {

        if (*puVar1 == *puVar9) {

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

            operator_delete(puVar9);

            goto LAB_006907cb;

          }

          break;

        }

      }

      puVar9[1] = *puVar6;

      *puVar6 = (uint)puVar9;

      if (puVar6 < local_c) {

        local_c = puVar6;

      }

      local_4 = local_4 + 1;

LAB_006907cb:

      local_80 = local_80 + 1;

      local_84 = local_84 + 0x14;

    } while (local_80 < local_7c);

  }

  local_78 = param_2 + 0x50;

  puVar9 = (uint *)0x0;

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

    if (*(int *)(param_2 + 0xc0) == 0) {

      puVar9 = (uint *)0x0;

    }

    else {

      puVar9 = (uint *)(*(int *)(param_2 + 0xc0) + -8);

    }

  }

  for (; puVar9 != (uint *)0x0; puVar9 = (uint *)(puVar9[2] - 8)) {

    local_7c = *puVar9;

    uVar7 = local_7c & 0xff;

    for (puVar6 = *(uint **)(local_10 + (uVar7 % local_8) * 4); puVar6 != (uint *)0x0;

        puVar6 = (uint *)puVar6[1]) {

      if (*puVar6 == uVar7) {

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

          uVar7 = puVar6[2];

        }

        break;

      }

    }

    local_7c = (uVar7 ^ local_7c) & 0xff ^ local_7c;

    for (puVar6 = *(uint **)(*(int *)(param_1 + 0xb0) + (local_7c % *(uint *)(param_1 + 0xb8)) * 4);

        puVar6 != (uint *)0x0; puVar6 = (uint *)puVar6[1]) {

      if (*puVar6 == local_7c) {

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

          if ((puVar6[4] == puVar9[4]) || ((char)param_3 != '\0')) goto LAB_0069089d;

          local_74 = &PTR_FUN_0079da04;

          FUN_005870f0();

          bVar13 = local_10 == local_6c;

          goto LAB_006909b4;

        }

        break;

      }

    }

    FUN_0068fc70(&local_7c,puVar9 + 4);

    *(uint *)(param_1 + 0x140) = *(uint *)(param_1 + 0x140) | puVar9[4];

LAB_0069089d:

    if (puVar9[2] == 0) break;

  }

  local_78 = param_2 + 200;

  puVar11 = (undefined4 *)0x0;

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

    if (*(int *)(param_2 + 0x138) == 0) {

      puVar11 = (undefined4 *)0x0;

    }

    else {

      puVar11 = (undefined4 *)(*(int *)(param_2 + 0x138) + -8);

    }

  }

  for (; puVar11 != (undefined4 *)0x0; puVar11 = (undefined4 *)(puVar11[2] + -8)) {

    uVar5 = puVar11[4];

    FUN_00690260(*puVar11);

    cVar2 = FUN_0068fff0(uVar5,&local_74,param_3);

    if (cVar2 == '\0') {

LAB_00690996:

      local_74 = &PTR_FUN_0079da04;

      FUN_005870f0();

      bVar13 = local_10 == local_6c;

LAB_006909b4:

      local_70 = &PTR_FUN_0079da00;

      if (!bVar13) {

        operator_delete__(local_10);

      }

      return 0;

    }

    if (puVar11[2] == 0) break;

  }

  local_74 = &PTR_FUN_0079da04;

  FUN_005870f0();

  local_70 = &PTR_FUN_0079da00;

  if (local_10 != local_6c) {

    operator_delete__(local_10);

  }

  return 1;

}





// --- FUN_006909e0 at 0x006909E0 (size: 469) ---


byte __thiscall FUN_006909e0(int param_1,int *param_2)



{

  uint *puVar1;

  int *piVar2;

  char cVar3;

  byte bVar4;

  undefined4 uVar5;

  LONG LVar6;

  int *piVar7;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 uVar8;

  byte local_15;

  uint uStack_14;

  int local_10;

  int *piStack_c;

  int local_8;

  int local_4;

  

  local_15 = 1;

  local_8 = param_1;

  local_4 = FUN_0065ca40();

  local_10 = 0;

  if (local_4 < 1) {

    return 1;

  }

  do {

    uVar5 = (**(code **)(*param_2 + 0xc))(local_10);

    cVar3 = FUN_00685800(uVar5,0x1a,&uStack_14);

    if (cVar3 == '\0') {

      piStack_c = (int *)PTR_DAT_00818344;

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

      FUN_00426020(&piStack_c);

      piVar2 = piStack_c;

      uVar8 = extraout_ECX;

      piVar7 = piStack_c;

      FUN_00401340("ERROR - invalid input map name \"%s\" found.");

      FUN_0065d620(uVar5,uVar8,piVar7);

      piVar7 = piVar2 + -5;

      local_15 = 0;

      LVar6 = InterlockedDecrement(piVar2 + -4);

      if ((LVar6 == 0) && (piVar7 != (int *)0x0)) {

        (**(code **)*piVar7)(1);

      }

    }

    else {

      for (puVar1 = *(uint **)(*(int *)(param_1 + 0x128) +

                              (uStack_14 % *(uint *)(param_1 + 0x130)) * 4); puVar1 != (uint *)0x0;

          puVar1 = (uint *)puVar1[1]) {

        if (*puVar1 == uStack_14) {

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

            piStack_c = (int *)PTR_DAT_00818344;

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

            FUN_00426020(&piStack_c);

            piVar2 = piStack_c;

            uVar8 = extraout_ECX_00;

            piVar7 = piStack_c;

            FUN_00401340("ERROR - duplicate input map name \"%s\" found.");

            FUN_0065d620(uVar5,uVar8,piVar7);

            piVar7 = piVar2 + -5;

            local_15 = 0;

            LVar6 = InterlockedDecrement(piVar2 + -4);

            if ((LVar6 == 0) && (piVar7 != (int *)0x0)) {

              (**(code **)*piVar7)(1);

            }

            goto LAB_00690b92;

          }

          break;

        }

      }

      piVar7 = (int *)FUN_005df0f5(0x80);

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

        piVar7 = (int *)0x0;

      }

      else {

        *piVar7 = param_1;

        piVar7[1] = uStack_14;

        FUN_0068ecc0(0);

        piVar7[0x1e] = 0;

        piVar7[0x1f] = 0;

        param_1 = local_8;

      }

      piStack_c = piVar7;

      bVar4 = FUN_00690300(uVar5);

      local_15 = local_15 & bVar4;

      FUN_0068fd10(&uStack_14,&piStack_c);

    }

LAB_00690b92:

    local_10 = local_10 + 1;

    if (local_4 <= local_10) {

      return local_15;

    }

  } while( true );

}





// --- FUN_00690f30 at 0x00690F30 (size: 168) ---


bool __thiscall FUN_00690f30(int param_1,int *param_2)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  undefined4 uVar4;

  undefined4 extraout_ECX;

  undefined4 uVar5;

  

  iVar2 = FUN_0065ca40();

  if (iVar2 == 4) {

    piVar3 = (int *)(**(code **)(*param_2 + 0xc))(0);

    FUN_00426020(param_1 + 0x30);

    uVar5 = 0;

    uVar4 = (**(code **)(*piVar3 + 0xc))(0,param_1 + 0x34);

    cVar1 = FUN_0068ddb0(uVar4,uVar5);

    if (cVar1 != '\0') {

      uVar4 = (**(code **)(*param_2 + 0xc))(1);

      cVar1 = FUN_0068e600(uVar4);

      if (cVar1 != '\0') {

        uVar4 = (**(code **)(*param_2 + 0xc))(2);

        cVar1 = FUN_00690130(uVar4);

        if (cVar1 != '\0') {

          uVar4 = (**(code **)(*param_2 + 0xc))(3);

          cVar1 = FUN_006909e0(uVar4);

          return cVar1 != '\0';

        }

      }

    }

  }

  else {

    uVar4 = extraout_ECX;

    FUN_00401340("ERROR - must have exactly 4 parts (Name, Devices, MetaKeys, Bindings)\n");

    FUN_0065d620(param_2,uVar4);

  }

  return false;

}





// --- FUN_00691000 at 0x00691000 (size: 35) ---


void __fastcall FUN_00691000(int param_1)



{

  char cVar1;

  int local_4;

  

  local_4 = param_1;

  cVar1 = FUN_00472ea0(*(undefined4 *)(param_1 + 0x50),&local_4);

  if (cVar1 != '\0') {

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

  }

  return;

}





// --- FUN_00691030 at 0x00691030 (size: 35) ---


void __fastcall FUN_00691030(int param_1)



{

  char cVar1;

  int local_4;

  

  local_4 = param_1;

  cVar1 = FUN_00472e40(*(undefined4 *)(param_1 + 0x50),&local_4);

  if (cVar1 != '\0') {

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

  }

  return;

}





// --- FUN_00691060 at 0x00691060 (size: 178) ---


void __fastcall FUN_00691060(int param_1)



{

  char cVar1;

  

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

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

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

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

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

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

      if (cVar1 != '\0') {

        (**(code **)(*DAT_00837ff4 + 0x48))(param_1 + 8);

        (**(code **)(*DAT_00837ff4 + 0x34))(7,param_1 + 0x14,4000);

        (**(code **)(*DAT_00837ff4 + 0x34))(1,param_1 + 0x14,3999);

        (**(code **)(*DAT_00837ff4 + 0xa8))(1);

        return;

      }

      (**(code **)(*DAT_00837ff4 + 0x4c))(param_1 + 8,2);

      (**(code **)(*DAT_00837ff4 + 0x38))(7,param_1 + 0x14);

      (**(code **)(*DAT_00837ff4 + 0x38))(1,param_1 + 0x14);

      (**(code **)(*DAT_00837ff4 + 0xa8))(0);

    }

  }

  return;

}





// --- FUN_00691120 at 0x00691120 (size: 128) ---


void __fastcall FUN_00691120(int param_1)



{

  undefined *puVar1;

  LONG LVar2;

  LONG *pLVar3;

  

  puVar1 = *(undefined **)(param_1 + 0x6c);

  if (puVar1 != PTR_DAT_00818344) {

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

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

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

    }

    pLVar3 = (LONG *)(PTR_DAT_00818344 + -0x10);

    *(undefined **)(param_1 + 0x6c) = PTR_DAT_00818344;

    InterlockedIncrement(pLVar3);

  }

  puVar1 = *(undefined **)(param_1 + 0x70);

  if (puVar1 != PTR_DAT_00818344) {

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

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

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

    }

    pLVar3 = (LONG *)(PTR_DAT_00818344 + -0x10);

    *(undefined **)(param_1 + 0x70) = PTR_DAT_00818344;

    InterlockedIncrement(pLVar3);

  }

  return;

}





// --- FUN_006911a0 at 0x006911A0 (size: 44) ---


void __fastcall FUN_006911a0(int param_1)



{

  int iVar1;

  

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

  if (iVar1 != 0) {

    *(int *)(param_1 + 0x50) = iVar1 + -1;

    FUN_00473460(iVar1 + -1,iVar1);

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

    FUN_00691120();

    return;

  }

  return;

}





// --- FUN_006911d0 at 0x006911D0 (size: 48) ---


void __thiscall FUN_006911d0(int param_1,int param_2)



{

  int iVar1;

  

  if ((*(int *)(param_1 + 0x3c) == -1) &&

     (iVar1 = *(int *)(*(int *)(param_1 + 0x24) + 0x1c) - *(int *)(param_1 + 0x34), 0 < iVar1)) {

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

  }

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

    param_2 = *(int *)(param_1 + 0x3c) - param_2;

    if (param_2 < 0) {

      param_2 = 0;

    }

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

  }

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

  return;

}





// --- FUN_00691200 at 0x00691200 (size: 75) ---


void __thiscall FUN_00691200(int param_1,int param_2)



{

  uint uVar1;

  int iVar2;

  

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

  if (uVar1 != 0xffffffff) {

    if (uVar1 < (uint)(*(int *)(*(int *)(param_1 + 0x24) + 0x1c) - *(int *)(param_1 + 0x34))) {

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

      iVar2 = *(int *)(*(int *)(param_1 + 0x24) + 0x1c);

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

      if (uVar1 + param_2 < (uint)(iVar2 - *(int *)(param_1 + 0x34))) {

        return;

      }

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

      return;

    }

  }

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

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

  return;

}





// --- FUN_00691250 at 0x00691250 (size: 23) ---


void __fastcall FUN_00691250(int param_1)



{

  uint uVar1;

  

  uVar1 = *(uint *)(*(int *)(param_1 + 0x24) + 0x1c);

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

  if (*(uint *)(param_1 + 0x34) < uVar1) {

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

  }

  return;

}





// --- FUN_00691270 at 0x00691270 (size: 41) ---


void __fastcall FUN_00691270(int param_1)



{

  uint uVar1;

  

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

  if (uVar1 < *(uint *)(*(int *)(param_1 + 0x20) + 0x10)) {

    FUN_00473460(uVar1,uVar1 + 1);

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

    FUN_00691120();

    return;

  }

  return;

}





// --- FUN_006912a0 at 0x006912A0 (size: 161) ---


void __thiscall FUN_006912a0(int param_1,int *param_2)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  undefined1 local_24 [36];

  

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

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

    FUN_004733e0();

  }

  iVar2 = *param_2;

  uVar3 = *(uint *)(iVar2 + -4);

  uVar4 = 0;

  if (uVar3 != 1) {

    do {

      uVar1 = uVar3 - 1;

      if (uVar4 < uVar3) {

        uVar1 = uVar4;

      }

      if (*(char *)(uVar1 + iVar2) != '\n') {

        uVar3 = uVar4;

        if (*(uint *)(iVar2 + -4) <= uVar4) {

          uVar3 = *(uint *)(iVar2 + -4) - 1;

        }

        FUN_00474ec0(CONCAT22((short)(uVar3 + iVar2 >> 0x10),(short)*(char *)(uVar3 + iVar2)),

                     &DAT_0083518c,0,0,8,0xc);

        FUN_00473410(*(undefined4 *)(param_1 + 0x50),local_24);

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

        FUN_00474be0();

      }

      iVar2 = *param_2;

      uVar3 = *(uint *)(iVar2 + -4);

      uVar4 = uVar4 + 1;

    } while (uVar4 < uVar3 - 1);

  }

  return;

}





// --- FUN_00691350 at 0x00691350 (size: 55) ---


void __fastcall FUN_00691350(int param_1)



{

  int iVar1;

  

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

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

    if ((iVar1 != -1) && (iVar1 != 0)) {

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

      FUN_006912a0(*(int *)(param_1 + 0x60) + (iVar1 + -1) * 4);

      return;

    }

    iVar1 = *(int *)(param_1 + 0x68) + -1;

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

    FUN_006912a0(*(int *)(param_1 + 0x60) + iVar1 * 4);

  }

  return;

}





// --- FUN_00691390 at 0x00691390 (size: 60) ---


void __fastcall FUN_00691390(int param_1)



{

  int iVar1;

  

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

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

    if ((iVar1 != -1) && (iVar1 != *(int *)(param_1 + 0x68) + -1)) {

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

      FUN_006912a0(*(int *)(param_1 + 0x60) + (iVar1 + 1) * 4);

      return;

    }

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

    FUN_006912a0(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x74) * 4);

  }

  return;

}





// --- FUN_006913d0 at 0x006913D0 (size: 578) ---


undefined4 __fastcall FUN_006913d0(int param_1)



{

  int iVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int local_8;

  int local_4;

  

  if (param_1 == 0) {

    iVar1 = 0;

  }

  else {

    iVar1 = param_1 + 0x10;

  }

  FUN_00436120(iVar1);

  FUN_00401340("Force console output to always be visible, even when inactive");

  FUN_00401340("Console.AlwaysDrawOutput");

  if (param_1 + 0x1b != 0) {

    FUN_004369a0(param_1 + 0x1b,2,&local_8,&local_4,0,0,0,0);

  }

  puVar3 = (undefined4 *)(local_8 + -0x14);

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

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

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

  }

  puVar3 = (undefined4 *)(local_4 + -0x14);

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

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

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

  }

  FUN_00401340("Print all typed console commands to the output buffer");

  FUN_00401340("Console.EchoInput");

  if (param_1 + 0x80 != 0) {

    FUN_004369a0(param_1 + 0x80,2,&local_4,&local_8,0,0,0,0);

  }

  puVar3 = (undefined4 *)(local_4 + -0x14);

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

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

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

  }

  puVar3 = (undefined4 *)(local_8 + -0x14);

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

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

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

  }

  FUN_00401340("Console background window opacity (between 0.0 and 1.0 inclusive)");

  FUN_00401340("Console.BackgroundOpacity");

  if (param_1 + 0x1c != 0) {

    FUN_004369a0(param_1 + 0x1c,9,&local_4,&local_8,0,0,0,0);

  }

  puVar3 = (undefined4 *)(local_4 + -0x14);

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

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

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

  }

  puVar3 = (undefined4 *)(local_8 + -0x14);

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

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

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

  }

  FUN_00401340("Clears the console output buffer");

  FUN_00401340("Clear");

  FUN_00436580(&LAB_00690fe0,&local_4,&local_8);

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

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

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

  }

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

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

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

  }

  FUN_0043c680();

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

    if (param_1 != 0) {

      (**(code **)(*DAT_00837ff4 + 0x34))(0xb,param_1 + 0x14,4000);

      return 1;

    }

    (**(code **)(*DAT_00837ff4 + 0x34))(0xb,0,4000);

  }

  return 1;

}





// --- FUN_00691620 at 0x00691620 (size: 323) ---


void __fastcall FUN_00691620(int param_1)



{

  LONG LVar1;

  int *piVar2;

  int iVar3;

  undefined4 *puVar4;

  int local_4;

  

  if (param_1 == 0) {

    iVar3 = 0;

  }

  else {

    iVar3 = param_1 + 0x10;

  }

  local_4 = param_1;

  FUN_004352e0(iVar3);

  FUN_00401340("Clear");

  FUN_00436830(&local_4);

  puVar4 = (undefined4 *)(local_4 + -0x14);

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

  if ((LVar1 == 0) && (puVar4 != (undefined4 *)0x0)) {

    (**(code **)*puVar4)(1);

  }

  FUN_00401340("Console.EchoInput");

  FUN_00436cf0(&local_4);

  puVar4 = (undefined4 *)(local_4 + -0x14);

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

  if ((LVar1 == 0) && (puVar4 != (undefined4 *)0x0)) {

    (**(code **)*puVar4)(1);

  }

  FUN_00401340("Console.AlwaysDrawOutput");

  FUN_00436cf0(&local_4);

  puVar4 = (undefined4 *)(local_4 + -0x14);

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

  if ((LVar1 == 0) && (puVar4 != (undefined4 *)0x0)) {

    (**(code **)*puVar4)(1);

  }

  FUN_00401340("Console.BackgroundOpacity");

  FUN_00436cf0(&local_4);

  puVar4 = (undefined4 *)(local_4 + -0x14);

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

  if ((LVar1 == 0) && (puVar4 != (undefined4 *)0x0)) {

    (**(code **)*puVar4)(1);

  }

  piVar2 = (int *)FUN_0043c680();

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

    if (param_1 == 0) {

      iVar3 = 0;

    }

    else {

      iVar3 = param_1 + 0xc;

    }

    (**(code **)(*piVar2 + 0xc))(iVar3);

  }

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

    if (param_1 != 0) {

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

      return;

    }

    (**(code **)(*DAT_00837ff4 + 0x3c))(0);

  }

  return;

}





// --- FUN_00691770 at 0x00691770 (size: 72) ---


void __fastcall FUN_00691770(int param_1)



{

  *(uint *)(param_1 + 0x34) = *(uint *)(*(int *)(param_1 + 0x2c) + 0x44) / 0xc;

  *(uint *)(param_1 + 0x38) = *(uint *)(*(int *)(param_1 + 0x2c) + 0x40) >> 3;

  FUN_00407a40();

  FUN_00408910(*(undefined4 *)(param_1 + 0x34),1);

  *(uint *)(param_1 + 0x4c) = *(uint *)(*(int *)(param_1 + 0x30) + 0x40) >> 3;

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

  return;

}





// --- FUN_006917c0 at 0x006917C0 (size: 351) ---


void __thiscall FUN_006917c0(int param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  char cVar3;

  char *pcVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  undefined1 local_24 [36];

  

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

  if (iVar1 != 0) {

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

      DAT_008f953c = DAT_008f953c | 1;

      DAT_008f9530 = 0;

      DAT_008f9534 = 0;

      DAT_008f9538 = 0;

      _atexit((_func_4879 *)&LAB_00785680);

    }

    uVar7 = 0;

    DAT_008f9538 = 0;

    if (iVar1 != 1) {

      do {

        uVar5 = *(uint *)(*param_2 + -4);

        uVar6 = uVar7;

        if (uVar5 <= uVar7) {

          uVar6 = uVar5 - 1;

        }

        pcVar4 = (char *)(uVar6 + *param_2);

        FUN_00474ec0(CONCAT22((short)((uint)pcVar4 >> 0x10),(short)*pcVar4),&DAT_0083518c,0,0,8,0xc)

        ;

        if (DAT_008f9538 < (DAT_008f9534 & 0x7fffffff)) {

LAB_006918d0:

          FUN_00474c30(local_24);

          DAT_008f9538 = DAT_008f9538 + 1;

        }

        else {

          uVar5 = (DAT_008f9534 & 0x7fffffff) + 1;

          if (uVar5 < 9) {

            uVar5 = 8;

          }

          else if (uVar5 < 0x4001) {

            iVar2 = 0x1f;

            if (uVar5 != 0) {

              for (; uVar5 >> iVar2 == 0; iVar2 = iVar2 + -1) {

              }

            }

            uVar6 = 1 << ((byte)iVar2 & 0x1f);

            if (uVar6 < uVar5) {

              uVar5 = uVar6 * 2;

            }

          }

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

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

          }

          cVar3 = FUN_004678e0(uVar5);

          if (cVar3 != '\0') goto LAB_006918d0;

        }

        FUN_00474be0();

        uVar7 = uVar7 + 1;

      } while (uVar7 < iVar1 - 1U);

    }

    FUN_00473550(*(undefined4 *)(*(int *)(param_1 + 0x24) + 0x10),&DAT_008f9530);

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

  }

  return;

}





// --- FUN_00691930 at 0x00691930 (size: 392) ---


void __fastcall FUN_00691930(int param_1)



{

  char *pcVar1;

  char cVar2;

  int iVar3;

  int *piVar4;

  LONG LVar5;

  uint uVar6;

  char *pcVar7;

  char *pcVar8;

  uint uVar9;

  uint uVar10;

  char *pcVar11;

  char local_10 [4];

  char *local_c;

  int local_8;

  uint local_4;

  

  local_8 = param_1;

  FUN_004733e0();

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

    iVar3 = FUN_005df0f5(0x8100);

    if (iVar3 == 0) {

      DAT_008380c8 = (int *)0x0;

    }

    else {

      DAT_008380c8 = (int *)FUN_00433d20();

    }

  }

  iVar3 = DAT_008380c8[2];

  if (iVar3 != 0) {

    local_c = PTR_DAT_00818344;

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

    uVar10 = iVar3 - 1;

    uVar9 = 0;

    piVar4 = DAT_008380c8;

    local_4 = uVar10;

    if (uVar10 != 0) {

      do {

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

          iVar3 = FUN_005df0f5(0x8100);

          if (iVar3 == 0) {

            piVar4 = (int *)0x0;

            DAT_008380c8 = piVar4;

          }

          else {

            piVar4 = (int *)FUN_00433d20();

            DAT_008380c8 = piVar4;

          }

        }

        pcVar11 = local_c;

        uVar6 = *piVar4 + uVar9;

        if (0x7fff < uVar6) {

          uVar6 = uVar6 - 0x8000;

        }

        local_10[0] = *(char *)((int)piVar4 + uVar6 + 0xc);

        if (local_10[0] != '\0') {

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

          if ((*(int *)(local_c + -0x10) == 1) && (iVar3 + 1U <= *(uint *)(local_c + -0xc))) {

            *(uint *)(local_c + -4) = iVar3 + 1U;

            local_c[-0xffffffff00000008] = -1;

            local_c[-0xffffffff00000007] = -1;

            local_c[-0xffffffff00000006] = -1;

            local_c[-0xffffffff00000005] = -1;

          }

          else {

            pcVar1 = local_c + -0x14;

            FUN_00401280(iVar3);

            pcVar7 = pcVar11;

            pcVar8 = local_c;

            do {

              cVar2 = *pcVar7;

              pcVar7 = pcVar7 + 1;

              *pcVar8 = cVar2;

              pcVar8 = pcVar8 + 1;

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

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

            if ((LVar5 == 0) && (pcVar1 != (char *)0x0)) {

              (*(code *)**(undefined4 **)pcVar1)(1);

            }

          }

          strncpy(local_c + iVar3 + -1,local_10,1);

          local_c[*(int *)(local_c + -4) + -1] = '\0';

          piVar4 = DAT_008380c8;

          uVar10 = local_4;

          param_1 = local_8;

        }

        uVar9 = uVar9 + 1;

      } while (uVar9 < uVar10);

    }

    FUN_006917c0(&local_c);

    pcVar11 = local_c + -0x14;

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

    if ((LVar5 == 0) && (pcVar11 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar11)(1);

    }

  }

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

  return;

}





// --- FUN_00691ac0 at 0x00691AC0 (size: 410) ---


undefined4 * __fastcall FUN_00691ac0(undefined4 *param_1)



{

  int iVar1;

  undefined4 uVar2;

  int *piVar3;

  LONG *pLVar4;

  undefined4 *local_4;

  

  param_1[1] = 1;

  param_1[2] = &PTR_FUN_0079ca88;

  param_1[3] = &PTR_FUN_00801670;

  param_1[4] = &PTR_FUN_00801520;

  param_1[5] = &PTR_FUN_00795824;

  *param_1 = &PTR_FUN_008016e8;

  param_1[2] = &PTR_FUN_008016d0;

  param_1[3] = &PTR_FUN_00801670;

  param_1[4] = &PTR_LAB_00801668;

  param_1[5] = &PTR_LAB_0080165c;

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

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

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

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

  param_1[7] = 0x3f800000;

  param_1[8] = 0;

  param_1[9] = 0;

  *(undefined1 *)(param_1 + 10) = 1;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0xffffffff;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

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

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  pLVar4 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x1b] = PTR_DAT_00818344;

  local_4 = param_1;

  InterlockedIncrement(pLVar4);

  pLVar4 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x1c] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar4);

  param_1[0x1d] = 0xffffffff;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

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

  iVar1 = FUN_005df0f5(0x34);

  if (iVar1 == 0) {

    uVar2 = 0;

  }

  else {

    uVar2 = FUN_00473860();

  }

  param_1[8] = uVar2;

  iVar1 = FUN_005df0f5(0x34);

  if (iVar1 == 0) {

    uVar2 = 0;

  }

  else {

    uVar2 = FUN_00473860();

  }

  param_1[9] = uVar2;

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

  *(undefined1 *)(param_1[8] + 0x24) = 0;

  *(undefined4 *)(param_1[9] + 0x20) = 0xffff;

  *(undefined1 *)(param_1[9] + 0x24) = 1;

  piVar3 = (int *)FUN_00699bb0(&local_4,param_1 + 0xb,0x14,0x14,800,300,8,6);

  if (-1 < *piVar3) {

    piVar3 = (int *)FUN_00699bb0(&local_4,param_1 + 0xc,0x14,0x14a,800,0x19,8,6);

    if (-1 < *piVar3) {

      FUN_00691770();

      FUN_00691930();

    }

  }

  return param_1;

}





// --- FUN_00691c70 at 0x00691C70 (size: 336) ---


void __fastcall FUN_00691c70(undefined4 *param_1)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  

  *param_1 = &PTR_FUN_008016e8;

  param_1[2] = &PTR_FUN_008016d0;

  param_1[3] = &PTR_FUN_00801670;

  param_1[4] = &PTR_LAB_00801668;

  param_1[5] = &PTR_LAB_0080165c;

  DAT_008f94a0 = 0;

  FUN_00691620();

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

  param_1[7] = 0x3f800000;

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

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

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

  }

  param_1[8] = 0;

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

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

  }

  puVar3 = (undefined4 *)param_1[0xb];

  param_1[9] = 0;

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

    piVar1 = puVar3 + 1;

    *piVar1 = *piVar1 + -1;

    if (*piVar1 == 0) {

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

    }

    param_1[0xb] = 0;

  }

  puVar3 = (undefined4 *)param_1[0xc];

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

    piVar1 = puVar3 + 1;

    *piVar1 = *piVar1 + -1;

    if (*piVar1 == 0) {

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

    }

    param_1[0xc] = 0;

  }

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

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

    param_1[0x1e] = 0;

  }

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

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

    param_1[0x1f] = 0;

  }

  puVar3 = (undefined4 *)(param_1[0x1c] + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(param_1[0x1c] + -0x10));

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

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

  }

  puVar3 = (undefined4 *)(param_1[0x1b] + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(param_1[0x1b] + -0x10));

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

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

  }

  if (((param_1[0x19] & 0x80000000) == 0x80000000) && (param_1[0x18] != 0)) {

    FUN_00407920(3);

  }

  if (((param_1[0x11] & 0x80000000) == 0x80000000) && (param_1[0x10] != 0)) {

    FUN_00407920(3);

  }

  param_1[5] = &PTR_FUN_00795824;

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

    (**(code **)(*DAT_00837ff4 + 0x3c))(param_1 + 5);

  }

  FUN_0043c610();

  *param_1 = &PTR_LAB_00796c4c;

  return;

}





// --- FUN_00691dc0 at 0x00691DC0 (size: 98) ---


void FUN_00691dc0(undefined4 *param_1,int *param_2)



{

  undefined4 *puVar1;

  char cVar2;

  int iVar3;

  

  iVar3 = FUN_005df0f5(0x88);

  if (iVar3 == 0) {

    iVar3 = 0;

  }

  else {

    iVar3 = FUN_00691ac0();

  }

  *param_2 = iVar3;

  if (iVar3 != 0) {

    cVar2 = FUN_006913d0();

    puVar1 = (undefined4 *)*param_2;

    if (cVar2 != '\0') {

      DAT_008f94a0 = puVar1;

      *param_1 = 0;

      return;

    }

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

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

    }

    *param_2 = 0;

  }

  *param_1 = 0x80004005;

  return;

}





// --- FUN_00691e40 at 0x00691E40 (size: 30) ---


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



{

  FUN_00691c70();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00692080 at 0x00692080 (size: 428) ---


void __fastcall FUN_00692080(int param_1)



{

  char cVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int local_10;

  int local_c;

  undefined *local_8;

  int local_4;

  

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

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

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

  }

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

    local_8 = PTR_DAT_00818340;

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

    cVar1 = FUN_00474130(0,&local_8);

    if (cVar1 == '\0') {

      puVar3 = (undefined4 *)(local_8 + -0x14);

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

      if (LVar2 != 0) {

        return;

      }

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

        return;

      }

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

      return;

    }

    FUN_00408fd0(&local_c,0);

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

      FUN_00401340("Console: \"");

      if (*(int *)(local_c + -4) != 1) {

        FUN_00404ef0(local_c,*(int *)(local_c + -4) + -1);

      }

      FUN_00401340(&DAT_008016ec);

      if (*(int *)(local_4 + -4) != 1) {

        FUN_00404ef0(local_4,*(int *)(local_4 + -4) + -1);

      }

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

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

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

      }

      FUN_004355a0(&local_10);

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

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

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

      }

    }

    FUN_00436190(&local_c);

    if (*(int *)(param_1 + 0x74) == -1) {

      FUN_0040c440(&local_c);

    }

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

    FUN_00691120();

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

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

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

    }

    puVar3 = (undefined4 *)(local_8 + -0x14);

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

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

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

    }

  }

  FUN_004733e0();

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

  return;

}





// --- FUN_00692230 at 0x00692230 (size: 573) ---


void __fastcall FUN_00692230(int param_1)



{

  int *piVar1;

  uint uVar2;

  int iVar3;

  ushort *puVar4;

  char cVar5;

  LONG LVar6;

  int iVar7;

  uint uVar8;

  uint uVar9;

  uint uVar10;

  undefined *local_30;

  uint local_2c;

  int local_28;

  uint local_20;

  undefined4 local_1c;

  undefined4 local_18;

  uint uStack_14;

  int aiStack_10 [2];

  ushort *local_8;

  

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

    local_18 = 0;

    local_1c = 0;

    cVar5 = FUN_00473bc0(*(undefined4 *)(*(int *)(param_1 + 0x2c) + 0x40),0,&local_18,&local_1c);

    if (cVar5 != '\0') {

      local_8 = *(ushort **)(*(int *)(param_1 + 0x24) + 8);

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

      uVar9 = *(int *)(*(int *)(param_1 + 0x24) + 0x1c) - *(int *)(param_1 + 0x34);

      local_20 = 0;

      uVar8 = uVar9;

      if ((uVar2 != 0xffffffff) && (uVar8 = uVar2, (int)uVar9 <= (int)uVar2)) {

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

        uVar8 = uVar9;

      }

      local_30 = PTR_DAT_00818340;

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

      local_2c = 0;

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

        local_28 = uVar8 << 4;

        do {

          if (local_30 != PTR_DAT_00818340) {

            LVar6 = InterlockedDecrement((LONG *)(local_30 + -0x10));

            if ((LVar6 == 0) && ((undefined4 *)(local_30 + -0x14) != (undefined4 *)0x0)) {

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

            }

            local_30 = PTR_DAT_00818340;

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

          }

          uVar2 = *(uint *)(*(int *)(param_1 + 0x24) + 0x1c);

          if (uVar8 < uVar2) {

            iVar7 = *(int *)(*(int *)(param_1 + 0x24) + 0x14);

            uVar9 = *(uint *)(local_28 + 4 + iVar7);

            uVar10 = 0xffffffff;

            if (uVar8 + 1 < uVar2) {

              uVar10 = *(uint *)(local_28 + iVar7 + 0x14);

            }

            for (; (((*(int *)(local_30 + -4) == 0 ||

                     (*(int *)(local_30 + -4) - 1U < *(uint *)(param_1 + 0x38))) &&

                    (uVar9 < *(uint *)(*(int *)(param_1 + 0x24) + 0x10))) &&

                   ((uVar10 == 0xffffffff || (uVar9 < uVar10)))); uVar9 = uVar9 + 1) {

              if (local_20 < uVar9) {

                iVar7 = uVar9 - local_20;

                local_20 = local_20 + iVar7;

                do {

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

                    local_8 = *(ushort **)(local_8 + 0x12);

                  }

                  iVar7 = iVar7 + -1;

                } while (iVar7 != 0);

              }

              puVar4 = local_8;

              cVar5 = FUN_00474bb0();

              if (cVar5 != '\0') break;

              uStack_14 = (uint)*puVar4;

              FUN_00402490(&uStack_14,1);

            }

          }

          FUN_00408fd0(aiStack_10,0);

          iVar3 = aiStack_10[0];

          piVar1 = (int *)(*(int *)(param_1 + 0x40) + local_2c * 4);

          iVar7 = *piVar1;

          if (iVar7 != aiStack_10[0]) {

            LVar6 = InterlockedDecrement((LONG *)(iVar7 + -0x10));

            if ((LVar6 == 0) && ((undefined4 *)(iVar7 + -0x14) != (undefined4 *)0x0)) {

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

            }

            *piVar1 = iVar3;

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

          }

          LVar6 = InterlockedDecrement((LONG *)(iVar3 + -0x10));

          if ((LVar6 == 0) && ((undefined4 *)(iVar3 + -0x14) != (undefined4 *)0x0)) {

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

          }

          local_2c = local_2c + 1;

          local_28 = local_28 + 0x10;

          uVar8 = uVar8 + 1;

        } while (local_2c < *(uint *)(param_1 + 0x34));

      }

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

      LVar6 = InterlockedDecrement((LONG *)(local_30 + -0x10));

      if ((LVar6 == 0) && ((undefined4 *)(local_30 + -0x14) != (undefined4 *)0x0)) {

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

      }

    }

  }

  return;

}





// --- FUN_00692470 at 0x00692470 (size: 1734) ---


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



void __fastcall FUN_00692470(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  char *pcVar4;

  char cVar5;

  undefined4 uVar6;

  LONG LVar7;

  int iVar8;

  char *pcVar9;

  char *pcVar10;

  uint uVar11;

  int iVar12;

  uint uVar13;

  uint uVar14;

  char *pcVar15;

  char *pcStack_94;

  char *pcStack_90;

  char *pcStack_8c;

  char cStack_85;

  char acStack_84 [4];

  char *pcStack_80;

  char *pcStack_7c;

  uint uStack_78;

  char *pcStack_74;

  undefined4 uStack_70;

  char *pcStack_6c;

  char *pcStack_68;

  undefined4 uStack_64;

  char *pcStack_60;

  char *pcStack_5c;

  undefined4 uStack_58;

  char *pcStack_54;

  char *pcStack_50;

  undefined4 uStack_4c;

  char *pcStack_48;

  int iStack_44;

  undefined4 local_40;

  undefined4 local_3c;

  undefined4 local_38;

  undefined4 local_34;

  undefined4 local_30;

  undefined4 local_2c;

  undefined4 local_28;

  undefined4 local_24;

  undefined4 local_20;

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if ((*(char *)(param_1 + 0x1a) == '\0') && (*(char *)(param_1 + 0x1b) == '\0')) {

    return;

  }

  FUN_005a4390(3);

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

  local_30 = 0x3f800000;

  local_2c = 0x3f800000;

  local_28 = 0x3f800000;

  local_40 = 0x3ecccccd;

  local_3c = 0x3ecccccd;

  local_38 = 0x3ecccccd;

  local_34 = 0x3f800000;

  local_10 = 0x3f800000;

  local_c = 0x3f800000;

  local_8 = 0x3f800000;

  local_20 = 0x3f800000;

  local_1c = 0x3f800000;

  local_18 = 0x3f800000;

  local_14 = 0x3f800000;

  local_4 = local_24;

  if ((*(char *)(param_1 + 0x1a) != '\0') || (*(char *)(param_1 + 0x1b) != '\0')) {

    FUN_00692230();

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

      uVar6 = FUN_00415730(0x12,2,0x1e);

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

      FUN_006998c0(uVar6);

    }

    FUN_006998a0(&local_30);

    (**(code **)(**(int **)(param_1 + 0x2c) + 4))();

    iVar12 = *(int *)(param_1 + 0x2c);

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

    iVar2 = *(int *)(iVar12 + 0x44);

    iVar8 = *(int *)(iVar12 + 0x40) + *(int *)(iVar12 + 0x38);

    iVar12 = iVar8 + -0xf;

    pcStack_80 = (char *)(iVar8 + -5);

    iStack_44 = iVar1 + 4;

    uStack_78 = iVar1 + 0xe;

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

      FUN_0043f5d0();

      FUN_0043dcd0(iVar12,iVar1 + -0xf + iVar2,&pcStack_90,&pcStack_94);

      FUN_0043dcd0(pcStack_80,iVar1 + -5 + iVar2,&pcStack_8c,&pcStack_7c);

      pcStack_74 = pcStack_90;

      pcStack_60 = pcStack_7c;

      pcStack_5c = pcStack_8c;

      pcStack_68 = (char *)(((float)pcStack_8c - (float)pcStack_90) * _DAT_007938b8 +

                           (float)pcStack_90);

      pcStack_6c = pcStack_94;

      pcStack_54 = pcStack_94;

      uStack_70 = 0;

      uStack_64 = 0;

      uStack_58 = 0;

      FUN_0043ec30(&pcStack_74,&pcStack_68,&pcStack_5c,&local_40,0,0,2,5,6);

    }

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

      iVar1 = *(int *)(*(int *)(param_1 + 0x24) + 0x1c);

      if (iVar1 == *(int *)(param_1 + 0x34) || iVar1 - *(int *)(param_1 + 0x34) < 0)

      goto LAB_0069275a;

    }

    else if (*(int *)(param_1 + 0x3c) == 0) goto LAB_0069275a;

    FUN_0043f5d0();

    FUN_0043dcd0(iVar12,iStack_44,&pcStack_90,&pcStack_7c);

    FUN_0043dcd0(pcStack_80,uStack_78,&pcStack_8c,&pcStack_94);

    FUN_00401000(&pcStack_74,0xc,3,FUN_0050a140);

    pcStack_74 = pcStack_8c;

    pcStack_60 = pcStack_7c;

    pcStack_5c = pcStack_90;

    pcStack_68 = (char *)(((float)pcStack_8c - (float)pcStack_90) * _DAT_007938b8 +

                         (float)pcStack_90);

    pcStack_6c = pcStack_94;

    pcStack_54 = pcStack_94;

    uStack_70 = 0;

    uStack_64 = 0;

    uStack_58 = 0;

    FUN_0043ec30(&pcStack_74,&pcStack_68,&pcStack_5c,&local_40,0,0,2,5,6);

  }

LAB_0069275a:

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

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

      uVar6 = FUN_00415730(0x13,2,0x1e);

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

      FUN_006998c0(uVar6);

    }

    FUN_006998a0(&local_10);

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

  }

  FUN_005a26a0();

  if ((*(char *)(param_1 + 0x1a) != '\0') || (*(char *)(param_1 + 0x1b) != '\0')) {

    FUN_00692230();

    uVar14 = 0;

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

      iVar12 = 0;

      do {

        FUN_00699a30(0,iVar12,*(undefined4 *)(*(int *)(param_1 + 0x40) + uVar14 * 4),0xffeaeaea);

        uVar14 = uVar14 + 1;

        iVar12 = iVar12 + 0xc;

      } while (uVar14 < *(uint *)(param_1 + 0x34));

    }

  }

  cStack_85 = '\0';

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

    FUN_00699a30(0,0,&DAT_00801708,0xff999999);

    pcStack_90 = PTR_DAT_00818340;

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

    cVar5 = FUN_00474130(0,&pcStack_90);

    if (cVar5 == '\0') {

      pcVar15 = pcStack_90 + -0x14;

      LVar7 = InterlockedDecrement((LONG *)(pcStack_90 + -0x10));

      if (LVar7 != 0) {

        return;

      }

      if (pcVar15 == (char *)0x0) {

        return;

      }

      (*(code *)**(undefined4 **)pcVar15)(1);

      return;

    }

    FUN_00408fd0(&pcStack_8c,0);

    pcStack_94 = PTR_DAT_00818344;

    uVar13 = *(int *)(param_1 + 0x4c) - 1;

    uStack_78 = uVar13;

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

    uVar14 = *(uint *)(pcStack_8c + -4);

    uVar11 = 0;

    pcVar15 = pcStack_8c;

    if (uVar14 != 1) {

      do {

        pcVar4 = pcStack_94;

        if (uVar13 <= uVar11) break;

        uVar3 = uVar14 - 1;

        if (uVar11 < uVar14) {

          uVar3 = uVar11;

        }

        acStack_84[0] = pcVar15[uVar3];

        if (acStack_84[0] != '\0') {

          iVar12 = *(int *)(pcStack_94 + -4);

          if ((*(int *)(pcStack_94 + -0x10) == 1) && (iVar12 + 1U <= *(uint *)(pcStack_94 + -0xc)))

          {

            *(uint *)(pcStack_94 + -4) = iVar12 + 1U;

            pcStack_94[-0xffffffff00000008] = -1;

            pcStack_94[-0xffffffff00000007] = -1;

            pcStack_94[-0xffffffff00000006] = -1;

            pcStack_94[-0xffffffff00000005] = -1;

          }

          else {

            pcVar15 = pcStack_94 + -0x14;

            FUN_00401280(iVar12);

            pcVar9 = pcVar4;

            pcVar10 = pcStack_94;

            do {

              cVar5 = *pcVar9;

              pcVar9 = pcVar9 + 1;

              *pcVar10 = cVar5;

              pcVar10 = pcVar10 + 1;

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

            LVar7 = InterlockedDecrement((LONG *)(pcVar4 + -0x10));

            if ((LVar7 == 0) && (pcVar15 != (char *)0x0)) {

              (*(code *)**(undefined4 **)pcVar15)(1);

            }

          }

          strncpy(pcStack_94 + iVar12 + -1,acStack_84,1);

          pcStack_94[*(int *)(pcStack_94 + -4) + -1] = '\0';

          pcVar15 = pcStack_8c;

          uVar13 = uStack_78;

        }

        uVar14 = *(uint *)(pcVar15 + -4);

        uVar11 = uVar11 + 1;

      } while (uVar11 < uVar14 - 1);

    }

    if (*(int *)(pcStack_94 + -4) - 1U < uVar13) {

      cStack_85 = '\x01';

    }

    FUN_00699a30(8,0,pcStack_94,0xffffffff);

    pcVar15 = pcStack_94 + -0x14;

    LVar7 = InterlockedDecrement((LONG *)(pcStack_94 + -0x10));

    if ((LVar7 == 0) && (pcVar15 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar15)(1);

    }

    pcVar15 = pcStack_8c + -0x14;

    LVar7 = InterlockedDecrement((LONG *)(pcStack_8c + -0x10));

    if ((LVar7 == 0) && (pcVar15 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar15)(1);

    }

    pcVar15 = pcStack_90 + -0x14;

    LVar7 = InterlockedDecrement((LONG *)(pcStack_90 + -0x10));

    if ((LVar7 == 0) && (pcVar15 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar15)(1);

    }

  }

  FUN_005a1390();

  if ((*(char *)(param_1 + 0x1a) != '\0') && (cStack_85 != '\0')) {

    if (_DAT_00801700 < _DAT_008379b0 - *(double *)(param_1 + 0x58)) {

      *(double *)(param_1 + 0x58) = _DAT_008379b0;

      *(bool *)(param_1 + 0x54) = *(char *)(param_1 + 0x54) == '\0';

    }

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

      FUN_0043f5d0();

      FUN_0043dcd0(*(int *)(*(int *)(param_1 + 0x30) + 0x38) + 8 + *(int *)(param_1 + 0x50) * 8,

                   *(undefined4 *)(*(int *)(param_1 + 0x30) + 0x3c),&pcStack_80,&pcStack_94);

      FUN_0043dcd0(*(int *)(*(int *)(param_1 + 0x30) + 0x38) + 0xf + *(int *)(param_1 + 0x50) * 8,

                   *(int *)(*(int *)(param_1 + 0x30) + 0x3c) + 0xb,&pcStack_90,&pcStack_8c);

      pcStack_74 = pcStack_80;

      pcStack_68 = pcStack_80;

      pcStack_6c = pcStack_94;

      pcStack_60 = pcStack_8c;

      pcStack_54 = pcStack_8c;

      pcStack_50 = pcStack_90;

      pcStack_5c = pcStack_90;

      uStack_70 = 0;

      uStack_64 = 0;

      uStack_58 = 0;

      uStack_4c = 0;

      pcStack_48 = pcStack_94;

      FUN_0043ec90(&pcStack_74,4,&local_20,0,0,2,5,6);

    }

  }

  FUN_005a4390(3 - (uint)(*(char *)(DAT_00870340 + 0xc4) != '\0'));

  return;

}





// --- FUN_00692b40 at 0x00692B40 (size: 2075) ---


void __thiscall FUN_00692b40(int param_1,undefined *param_2)



{

  char *pcVar1;

  void *pvVar2;

  uint uVar3;

  undefined *puVar4;

  uint uVar5;

  undefined *puVar6;

  char cVar7;

  LONG LVar8;

  int iVar9;

  int *piVar10;

  int iVar11;

  undefined4 extraout_ECX;

  int iVar12;

  int iVar13;

  code *pcVar14;

  undefined4 *puVar15;

  uint uVar16;

  int *piVar17;

  char *pcVar18;

  char *pcVar19;

  uint uVar20;

  char *pcVar21;

  undefined4 uVar22;

  char local_4c [4];

  char *local_48;

  char *pcStack_44;

  undefined *local_40;

  int local_3c;

  int iStack_38;

  int local_34;

  char *local_30;

  int iStack_2c;

  int iStack_28;

  undefined *puStack_24;

  undefined *local_20;

  uint uStack_1c;

  int local_18;

  uint local_14;

  uint local_10;

  undefined1 local_c [12];

  

  local_40 = PTR_DAT_00818340;

  local_34 = param_1;

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

  cVar7 = FUN_00474130(0,&local_40);

  if (cVar7 == '\0') {

    puVar15 = (undefined4 *)(local_40 + -0x14);

    iVar9 = InterlockedDecrement((LONG *)(local_40 + -0x10));

  }

  else {

    FUN_00408fd0(&local_3c,0);

    uVar22 = extraout_ECX;

    FUN_00401340(&DAT_00795098);

    FUN_00435720(1,1,uVar22);

    iVar9 = *(int *)(local_3c + -4);

    uVar20 = iVar9 - 1;

    if ((int)uVar20 < 1) {

      LVar8 = InterlockedDecrement((LONG *)(local_3c + -0x10));

      if ((LVar8 == 0) && ((undefined4 *)(local_3c + -0x14) != (undefined4 *)0x0)) {

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

      }

      puVar15 = (undefined4 *)(local_40 + -0x14);

      iVar9 = InterlockedDecrement((LONG *)(local_40 + -0x10));

    }

    else if (*(uint *)(param_1 + 0x50) == uVar20) {

      local_48 = PTR_DAT_00818344;

      iVar13 = 0;

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

      local_20 = PTR_DAT_00818344;

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

      uVar16 = 0;

      if (iVar9 != 1) {

        do {

          uVar3 = *(uint *)(local_3c + -4);

          uVar5 = uVar3 - 1;

          if (uVar16 < uVar3) {

            uVar5 = uVar16;

          }

          if (*(char *)(uVar5 + local_3c) == ' ') {

            iVar13 = iVar13 + 1;

          }

          if (uVar16 != 0) {

            uVar5 = uVar3 - 1;

            if (uVar16 < uVar3) {

              uVar5 = uVar16;

            }

            if (*(char *)(uVar5 + local_3c) != ' ') {

              if (uVar16 - 1 < uVar3) {

                uVar3 = uVar16;

              }

              if (*(char *)((uVar3 - 1) + local_3c) == ' ') {

                if (*(int *)(local_48 + -4) != 1) {

                  FUN_00404ef0(local_48,*(int *)(local_48 + -4) + -1);

                }

                FUN_00404cd0();

              }

            }

          }

          uVar3 = uVar16;

          if (*(uint *)(local_3c + -4) <= uVar16) {

            uVar3 = *(uint *)(local_3c + -4) - 1;

          }

          local_4c[0] = *(char *)(uVar3 + local_3c);

          FUN_00404ef0(local_4c,1);

          uVar16 = uVar16 + 1;

        } while (uVar16 < uVar20);

      }

      if (*(int *)(*(int *)(local_34 + 0x6c) + -4) != 1) {

        FUN_00402070(local_34 + 0x6c);

      }

      local_30 = local_48;

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

      FUN_004080c0();

      _strlwr(local_30);

      local_18 = 0;

      local_14 = 0;

      local_10 = 0;

      if (iVar13 == 0) {

        if (DAT_008380c8 == 0) {

          iVar9 = FUN_005df0f5(0x8100);

          if (iVar9 == 0) {

            DAT_008380c8 = 0;

          }

          else {

            DAT_008380c8 = FUN_00433d20();

          }

        }

        piVar10 = (int *)FUN_0052dcf0(local_c);

        iVar9 = *piVar10;

        piVar17 = (int *)piVar10[1];

        iVar13 = piVar10[2];

        if (DAT_008380c8 == 0) {

          iVar11 = FUN_005df0f5(0x8100);

          if (iVar11 == 0) {

            DAT_008380c8 = 0;

          }

          else {

            DAT_008380c8 = FUN_00433d20();

          }

        }

        while (iVar13 != 0) {

          do {

            FUN_0040c440(*(int *)(iVar13 + 8) + 4);

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

          } while (iVar13 != 0);

          do {

            piVar17 = piVar17 + 1;

            if (piVar17 == (int *)(*(int *)(iVar9 + 0x60) + *(int *)(iVar9 + 0x68) * 4))

            goto LAB_00692ea3;

            iVar13 = *piVar17;

          } while (iVar13 == 0);

        }

      }

      else {

        if (DAT_008380c8 == 0) {

          iVar9 = FUN_005df0f5(0x8100);

          if (iVar9 == 0) {

            DAT_008380c8 = 0;

          }

          else {

            DAT_008380c8 = FUN_00433d20();

          }

        }

        piVar10 = (int *)FUN_0052dcf0(local_c);

        iVar9 = *piVar10;

        piVar17 = (int *)piVar10[1];

        iVar13 = piVar10[2];

        if (DAT_008380c8 == 0) {

          iVar11 = FUN_005df0f5(0x8100);

          if (iVar11 == 0) {

            DAT_008380c8 = 0;

          }

          else {

            DAT_008380c8 = FUN_00433d20();

          }

        }

        while (iVar13 != 0) {

          do {

            piVar10 = *(int **)(iVar13 + 8);

            iVar11 = (**(code **)(*piVar10 + 0x3c))();

            if (iVar11 == 0) {

              FUN_0040c440(piVar10 + 1);

            }

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

          } while (iVar13 != 0);

          do {

            piVar17 = piVar17 + 1;

            if (piVar17 == (int *)(*(int *)(iVar9 + 0x60) + *(int *)(iVar9 + 0x68) * 4))

            goto LAB_00692ea3;

            iVar13 = *piVar17;

          } while (iVar13 == 0);

        }

      }

LAB_00692ea3:

      iVar13 = local_18;

      iVar9 = local_18 + local_10 * 4;

      if (local_18 != iVar9) {

        uVar20 = iVar9 - local_18;

        iVar12 = 0;

        for (iVar11 = (int)uVar20 >> 2; iVar11 != 1; iVar11 = iVar11 >> 1) {

          iVar12 = iVar12 + 1;

        }

        FUN_00433c80(local_18,iVar9,0,iVar12 * 2,param_2);

        puVar4 = param_2;

        if ((int)(uVar20 & 0xfffffffc) < 0x41) {

          FUN_00433ac0(iVar13,iVar9,param_2);

        }

        else {

          FUN_00433ac0(iVar13,iVar13 + 0x40,param_2);

          FUN_00433160(iVar13 + 0x40,iVar9,0,puVar4);

        }

      }

      iVar13 = local_34;

      iVar9 = 0;

      if ((*(int *)(*(int *)(local_34 + 0x70) + -4) != 1) && (uVar20 = 0, local_10 != 0)) {

        do {

          iVar11 = _stricmp(*(char **)(local_18 + uVar20 * 4),*(char **)(iVar13 + 0x70));

          if (iVar11 == 0) {

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

              if (uVar20 == 0) {

                iVar9 = local_10 - 1;

              }

              else {

                iVar9 = uVar20 - 1;

              }

            }

            else if (uVar20 == local_10 - 1) {

              iVar9 = 0;

            }

            else {

              iVar9 = uVar20 + 1;

            }

            break;

          }

          uVar20 = uVar20 + 1;

        } while (uVar20 < local_10);

      }

      puStack_24 = PTR_DAT_00818344;

      local_4c[0] = '\0';

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

      uStack_1c = 0;

      uVar20 = local_10;

      iVar13 = iVar9;

      if (local_10 != 0) {

        do {

          iStack_28 = iVar13;

          iStack_2c = iVar9;

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

            iStack_38 = iStack_28;

            if (iStack_28 < 0) {

              iStack_38 = uVar20 + iStack_28;

            }

          }

          else {

            iStack_38 = iStack_2c;

            if ((int)uVar20 <= iStack_2c) {

              iStack_38 = iStack_2c - uVar20;

            }

          }

          if (*(uint *)(local_48 + -4) <= *(uint *)(*(int *)(local_18 + iStack_38 * 4) + -4)) {

            pcStack_44 = *(char **)(local_18 + iStack_38 * 4);

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

            pcVar19 = pcStack_44;

            if (*(int *)(pcStack_44 + -0x10) == 1) {

              pcStack_44[-0xffffffff00000008] = -1;

              pcStack_44[-0xffffffff00000007] = -1;

              pcStack_44[-0xffffffff00000006] = -1;

              pcStack_44[-0xffffffff00000005] = -1;

            }

            else {

              pcVar1 = pcStack_44 + -0x14;

              FUN_00401280(*(int *)(pcStack_44 + -4) + -1);

              uVar20 = *(uint *)(pcStack_44 + -4);

              pcVar21 = pcStack_44;

              pcVar18 = pcVar19;

              for (uVar16 = uVar20 >> 2; uVar16 != 0; uVar16 = uVar16 - 1) {

                *(undefined4 *)pcVar21 = *(undefined4 *)pcVar18;

                pcVar21 = pcVar21 + 4;

                pcVar18 = pcVar18 + 4;

              }

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

                *pcVar21 = *pcVar18;

                pcVar18 = pcVar18 + 1;

                pcVar21 = pcVar21 + 1;

              }

              LVar8 = InterlockedDecrement((LONG *)(pcVar19 + -0x10));

              if ((LVar8 == 0) && (pcVar1 != (char *)0x0)) {

                (*(code *)**(undefined4 **)pcVar1)(1);

              }

            }

            _strlwr(pcStack_44);

            uVar20 = *(uint *)(local_30 + -4);

            uVar16 = 0;

            if (uVar20 == 1) {

LAB_006930bf:

              piVar17 = (int *)(local_18 + iStack_38 * 4);

              local_4c[0] = '\x01';

              if (puStack_24 != *(undefined **)(local_18 + iStack_38 * 4)) {

                puVar15 = (undefined4 *)(puStack_24 + -0x14);

                LVar8 = InterlockedDecrement((LONG *)(puStack_24 + -0x10));

                if ((LVar8 == 0) && (puVar15 != (undefined4 *)0x0)) {

                  (**(code **)*puVar15)(1);

                }

                puStack_24 = (undefined *)*piVar17;

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

              }

              pcVar19 = pcStack_44 + -0x14;

              LVar8 = InterlockedDecrement((LONG *)(pcStack_44 + -0x10));

              if ((LVar8 == 0) && (pcVar19 != (char *)0x0)) {

                (*(code *)**(undefined4 **)pcVar19)(1);

              }

              break;

            }

            while( true ) {

              uVar3 = uVar16;

              if (*(uint *)(pcStack_44 + -4) <= uVar16) {

                uVar3 = *(uint *)(pcStack_44 + -4) - 1;

              }

              uVar5 = uVar20 - 1;

              if (uVar16 < uVar20) {

                uVar5 = uVar16;

              }

              if (pcStack_44[uVar3] != local_30[uVar5]) break;

              uVar16 = uVar16 + 1;

              if (uVar20 - 1 <= uVar16) goto LAB_006930bf;

            }

            pcVar19 = pcStack_44 + -0x14;

            LVar8 = InterlockedDecrement((LONG *)(pcStack_44 + -0x10));

            uVar20 = local_10;

            if ((LVar8 == 0) && (pcVar19 != (char *)0x0)) {

              (*(code *)**(undefined4 **)pcVar19)(1);

              uVar20 = local_10;

            }

          }

          uStack_1c = uStack_1c + 1;

          iStack_2c = iStack_2c + 1;

          iStack_28 = iStack_28 + -1;

          iVar9 = iStack_2c;

          iVar13 = iStack_28;

        } while (uStack_1c < uVar20);

      }

      iVar9 = local_34;

      pcVar19 = *(char **)(local_34 + 0x6c);

      pcVar14 = InterlockedIncrement_exref;

      if (pcVar19 != local_48) {

        LVar8 = InterlockedDecrement((LONG *)(pcVar19 + -0x10));

        if ((LVar8 == 0) && (pcVar19 + -0x14 != (char *)0x0)) {

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

        }

        pcVar14 = InterlockedIncrement_exref;

        *(char **)(iVar9 + 0x6c) = local_48;

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

      }

      puVar6 = puStack_24;

      puVar4 = *(undefined **)(iVar9 + 0x70);

      if (puVar4 != puStack_24) {

        LVar8 = InterlockedDecrement((LONG *)(puVar4 + -0x10));

        if ((LVar8 == 0) && ((undefined4 *)(puVar4 + -0x14) != (undefined4 *)0x0)) {

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

        }

        *(undefined **)(iVar9 + 0x70) = puVar6;

        (*pcVar14)(puVar6 + -0x10);

      }

      if (local_4c[0] != '\0') {

        param_2 = local_20;

        (*pcVar14)(local_20 + -0x10);

        if (*(int *)(puVar6 + -4) != 1) {

          FUN_00404ef0(puVar6,*(int *)(puVar6 + -4) + -1);

        }

        FUN_006912a0(&param_2);

        puVar15 = (undefined4 *)(param_2 + -0x14);

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

        if ((LVar8 == 0) && (puVar15 != (undefined4 *)0x0)) {

          (**(code **)*puVar15)(1);

        }

      }

      LVar8 = InterlockedDecrement((LONG *)(puVar6 + -0x10));

      if ((LVar8 == 0) && ((undefined4 *)(puVar6 + -0x14) != (undefined4 *)0x0)) {

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

      }

      if (((local_14 & 0x80000000) == 0x80000000) && (local_18 != 0)) {

        puVar4 = *(undefined **)(local_18 + -4);

        pvVar2 = (void *)(local_18 + -4);

        iVar9 = local_18 + (int)puVar4 * 4;

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

          do {

            param_2 = puVar4;

            piVar17 = (int *)(iVar9 + -4);

            iVar9 = iVar9 + -4;

            puVar15 = (undefined4 *)(*piVar17 + -0x14);

            LVar8 = InterlockedDecrement((LONG *)(*piVar17 + -0x10));

            if ((LVar8 == 0) && (puVar15 != (undefined4 *)0x0)) {

              (**(code **)*puVar15)(1);

            }

            param_2 = param_2 + -1;

            puVar4 = param_2;

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

        }

        operator_delete__(pvVar2);

      }

      pcVar19 = local_30 + -0x14;

      LVar8 = InterlockedDecrement((LONG *)(local_30 + -0x10));

      if ((LVar8 == 0) && (pcVar19 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar19)(1);

      }

      puVar15 = (undefined4 *)(local_20 + -0x14);

      LVar8 = InterlockedDecrement((LONG *)(local_20 + -0x10));

      if ((LVar8 == 0) && (puVar15 != (undefined4 *)0x0)) {

        (**(code **)*puVar15)(1);

      }

      pcVar19 = local_48 + -0x14;

      LVar8 = InterlockedDecrement((LONG *)(local_48 + -0x10));

      if ((LVar8 == 0) && (pcVar19 != (char *)0x0)) {

        (*(code *)**(undefined4 **)pcVar19)(1);

      }

      LVar8 = InterlockedDecrement((LONG *)(local_3c + -0x10));

      if ((LVar8 == 0) && ((undefined4 *)(local_3c + -0x14) != (undefined4 *)0x0)) {

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

      }

      puVar15 = (undefined4 *)(local_40 + -0x14);

      iVar9 = InterlockedDecrement((LONG *)(local_40 + -0x10));

    }

    else {

      LVar8 = InterlockedDecrement((LONG *)(local_3c + -0x10));

      if ((LVar8 == 0) && ((undefined4 *)(local_3c + -0x14) != (undefined4 *)0x0)) {

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

      }

      puVar15 = (undefined4 *)(local_40 + -0x14);

      iVar9 = InterlockedDecrement((LONG *)(local_40 + -0x10));

    }

  }

  if ((iVar9 == 0) && (puVar15 != (undefined4 *)0x0)) {

    (**(code **)*puVar15)(1);

  }

  return;

}





// --- FUN_00693450 at 0x00693450 (size: 65) ---


undefined4 FUN_00693450(undefined4 param_1)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186a4);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x34))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_006934a0 at 0x006934A0 (size: 81) ---


undefined4 FUN_006934a0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186b6);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x38))(unaff_retaddr,param_1,param_2,param_3);

      }

    }

  }

  return 1;

}





// --- FUN_00693500 at 0x00693500 (size: 65) ---


undefined4 FUN_00693500(undefined4 param_1)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186a5);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x3c))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_00693550 at 0x00693550 (size: 65) ---


undefined4 FUN_00693550(undefined4 param_1)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186b7);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x40))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_006935a0 at 0x006935A0 (size: 58) ---


undefined4 FUN_006935a0(void)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186a3);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x44))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_006935e0 at 0x006935E0 (size: 58) ---


undefined4 FUN_006935e0(void)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186a7);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x48))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_00693620 at 0x00693620 (size: 65) ---


undefined4 FUN_00693620(undefined4 param_1)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186b3);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x4c))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_00693670 at 0x00693670 (size: 65) ---


undefined4 FUN_00693670(undefined4 param_1)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186b5);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x50))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_006936c0 at 0x006936C0 (size: 76) ---


undefined4 FUN_006936c0(undefined4 param_1,undefined4 param_2)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186b4);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x54))(unaff_retaddr,param_1,param_2);

      }

    }

  }

  return 1;

}





// --- FUN_00693710 at 0x00693710 (size: 76) ---


undefined4 FUN_00693710(undefined4 param_1,undefined4 param_2)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186b2);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x58))(unaff_retaddr,param_1,param_2);

      }

    }

  }

  return 1;

}





// --- FUN_00693760 at 0x00693760 (size: 81) ---


undefined4 FUN_00693760(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186ad);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x5c))(unaff_retaddr,param_1,param_2,param_3);

      }

    }

  }

  return 1;

}





// --- FUN_006937c0 at 0x006937C0 (size: 76) ---


undefined4 FUN_006937c0(undefined4 param_1,undefined4 param_2)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186b1);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0xc))(unaff_retaddr,param_1,param_2);

      }

    }

  }

  return 1;

}





// --- FUN_00693810 at 0x00693810 (size: 65) ---


undefined4 FUN_00693810(undefined4 param_1)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186ab);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x10))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_00693860 at 0x00693860 (size: 58) ---


undefined4 FUN_00693860(void)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186a9);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x14))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_006938a0 at 0x006938A0 (size: 101) ---


undefined4

FUN_006938a0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

            undefined4 param_5,undefined4 param_6,undefined4 param_7)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186a8);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

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

                  (unaff_retaddr,param_1,param_2,param_3,param_4,param_5,param_6,param_7);

      }

    }

  }

  return 1;

}





// --- FUN_00693910 at 0x00693910 (size: 65) ---


undefined4 FUN_00693910(undefined4 param_1)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186aa);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x1c))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_00693960 at 0x00693960 (size: 56) ---


undefined4 FUN_00693960(int param_1)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  

  iVar3 = (**(code **)(*(int *)(param_1 + 0xc) + 0x10))(0x186af);

  if (iVar3 != 0) {

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

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

      piVar2 = (int *)*piVar1;

      piVar1 = (int *)piVar1[1];

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

        (**(code **)(*piVar2 + 0x2c))(param_1);

      }

    }

  }

  return 1;

}





// --- FUN_006939a0 at 0x006939A0 (size: 58) ---


undefined4 FUN_006939a0(void)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186ae);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x30))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_006939e0 at 0x006939E0 (size: 58) ---


undefined4 FUN_006939e0(void)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186a1);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x20))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_00693a20 at 0x00693A20 (size: 54) ---


undefined4 FUN_00693a20(void)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(100000);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x24))();

      }

    }

  }

  return 1;

}





// --- FUN_00693a60 at 0x00693A60 (size: 58) ---


undefined4 FUN_00693a60(void)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186a2);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

        (**(code **)(*piVar1 + 0x28))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_00693aa0 at 0x00693AA0 (size: 58) ---


undefined4 FUN_00693aa0(void)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  undefined4 unaff_retaddr;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186a6);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

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

      }

    }

  }

  return 1;

}





// --- FUN_00693ae0 at 0x00693AE0 (size: 54) ---


undefined4 FUN_00693ae0(void)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  

  piVar2 = (int *)FUN_0043c680();

  iVar3 = (**(code **)(*piVar2 + 0x10))(0x186b0);

  if (iVar3 != 0) {

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

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

      piVar1 = (int *)*piVar2;

      piVar2 = (int *)piVar2[1];

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

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

      }

    }

  }

  return 1;

}





// --- FUN_00693b20 at 0x00693B20 (size: 75) ---


void __thiscall FUN_00693b20(int param_1,uint param_2)



{

  undefined4 *puVar1;

  uint uVar2;

  int iVar3;

  

  *(uint *)(param_1 + 0x68) = param_2;

  if (param_2 < 0x18) {

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

  }

  else {

    puVar1 = (undefined4 *)thunk_FUN_005df0f5(param_2 * 4);

  }

  *(undefined4 **)(param_1 + 100) = puVar1 + *(uint *)(param_1 + 0x68);

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

  for (uVar2 = *(uint *)(param_1 + 0x68) & 0x3fffffff; uVar2 != 0; uVar2 = uVar2 - 1) {

    *puVar1 = 0;

    puVar1 = puVar1 + 1;

  }

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

    *(undefined1 *)puVar1 = 0;

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

  }

  return;

}





// --- FUN_00693b70 at 0x00693B70 (size: 83) ---


uint __thiscall FUN_00693b70(uint *param_1,int *param_2)



{

  int *piVar1;

  int *piVar2;

  uint uVar3;

  

  piVar1 = (int *)*param_1;

  piVar2 = piVar1;

  if (piVar1 < piVar1 + param_1[2]) {

    do {

      if (*piVar2 == *param_2) {

        uVar3 = param_1[2] - 1;

        param_1[2] = uVar3;

        *piVar2 = piVar1[uVar3];

        uVar3 = param_1[2];

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

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

      }

      piVar2 = piVar2 + 1;

    } while (piVar2 < (int *)(*param_1 + param_1[2] * 4));

  }

  return (uint)piVar2 & 0xffffff00;

}





// --- FUN_00693bd0 at 0x00693BD0 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_0080178c;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

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

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00693c10 at 0x00693C10 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_00801790;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

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

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00693c50 at 0x00693C50 (size: 170) ---


undefined4 FUN_00693c50(int param_1)



{

  int iVar1;

  uint *puVar2;

  int *piVar3;

  int *piVar4;

  int *piVar5;

  uint uVar6;

  int iVar7;

  undefined1 local_c [12];

  

  piVar4 = (int *)FUN_0052dcf0(local_c);

  iVar7 = piVar4[2];

  iVar1 = *piVar4;

  piVar4 = (int *)piVar4[1];

  do {

    if (iVar7 == 0) {

      return 1;

    }

    do {

      puVar2 = *(uint **)(iVar7 + 0x10);

      piVar3 = (int *)*puVar2;

      piVar5 = piVar3;

      if (piVar3 < piVar3 + puVar2[2]) {

        do {

          if (*piVar5 == param_1) {

            uVar6 = puVar2[2] - 1;

            puVar2[2] = uVar6;

            *piVar5 = piVar3[uVar6];

            *(undefined4 *)(*puVar2 + puVar2[2] * 4) = 0;

            break;

          }

          piVar5 = piVar5 + 1;

        } while (piVar5 < (int *)(*puVar2 + puVar2[2] * 4));

      }

      iVar7 = *(int *)(iVar7 + 8);

    } while (iVar7 != 0);

    do {

      piVar4 = piVar4 + 1;

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

        return 1;

      }

      iVar7 = *piVar4;

    } while (iVar7 == 0);

  } while( true );

}





// --- FUN_00693d80 at 0x00693D80 (size: 73) ---


void __fastcall FUN_00693d80(int param_1)



{

  undefined *puVar1;

  undefined4 *puVar2;

  undefined4 local_4;

  

  puVar1 = PTR_DAT_00818558;

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

  puVar2 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&local_4,local_4,0);

  if ((puVar2 != (undefined4 *)puVar1) || (puVar2 = puVar2 + -1, puVar2 != (undefined4 *)puVar1)) {

    puVar2 = puVar2 + 1;

  }

  FUN_00694250(*puVar2);

  return;

}





// --- FUN_00693dd0 at 0x00693DD0 (size: 76) ---


uint FUN_00693dd0(undefined4 param_1,undefined4 param_2)



{

  uint uVar1;

  undefined4 local_14;

  undefined4 local_10;

  undefined1 local_c [8];

  uint local_4;

  

  local_14 = param_1;

  local_10 = param_2;

  FUN_0054b460(local_c,&local_14);

  if ((local_4 != 0) && (*(int *)(local_4 + 0x10) != 0)) {

    uVar1 = FUN_00693b70(&stack0x0000000c);

    return uVar1;

  }

  return local_4 & 0xffffff00;

}





// --- FUN_00693e20 at 0x00693E20 (size: 128) ---


uint FUN_00693e20(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  int *piVar1;

  uint uVar2;

  uint uVar3;

  undefined4 local_14;

  undefined4 local_10;

  undefined1 local_c [8];

  uint local_4;

  

  uVar3 = 0;

  local_10 = param_2;

  local_14 = param_3;

  FUN_0054b460(local_c,&local_14);

  if ((local_4 != 0) && (piVar1 = *(int **)(local_4 + 0x10), piVar1 != (int *)0x0)) {

    uVar2 = 0;

    if (piVar1[2] != 0) {

      do {

        (**(code **)**(undefined4 **)(*piVar1 + uVar3 * 4))(param_1,param_2,param_3);

        uVar2 = piVar1[2];

        uVar3 = uVar3 + 1;

      } while (uVar3 < uVar2);

    }

    return CONCAT31((int3)(uVar2 >> 8),1);

  }

  return local_4 & 0xffffff00;

}





// --- FUN_00693ea0 at 0x00693EA0 (size: 129) ---


uint FUN_00693ea0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  int *piVar1;

  uint uVar2;

  uint uVar3;

  undefined4 local_14;

  undefined4 local_10;

  undefined1 local_c [8];

  uint local_4;

  

  uVar3 = 0;

  local_10 = param_2;

  local_14 = param_3;

  FUN_0054b460(local_c,&local_14);

  if ((local_4 != 0) && (piVar1 = *(int **)(local_4 + 0x10), piVar1 != (int *)0x0)) {

    uVar2 = 0;

    if (piVar1[2] != 0) {

      do {

        (**(code **)(**(int **)(*piVar1 + uVar3 * 4) + 4))(param_1,param_2,param_3);

        uVar2 = piVar1[2];

        uVar3 = uVar3 + 1;

      } while (uVar3 < uVar2);

    }

    return CONCAT31((int3)(uVar2 >> 8),1);

  }

  return local_4 & 0xffffff00;

}





// --- FUN_00693f30 at 0x00693F30 (size: 98) ---


uint __thiscall

FUN_00693f30(int param_1,uint param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5)



{

  uint *in_EAX;

  uint uVar1;

  uint *puVar2;

  

  if (param_2 == 0) {

    puVar2 = (uint *)(param_1 + 0xf0);

  }

  else {

    for (in_EAX = *(uint **)(*(int *)(param_1 + 100) + (param_2 % *(uint *)(param_1 + 0x6c)) * 4);

        (puVar2 = in_EAX, in_EAX != (uint *)0x0 && (*in_EAX != param_2)); in_EAX = (uint *)in_EAX[1]

        ) {

    }

  }

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

    uVar1 = FUN_00693dd0(param_4,param_3,param_5);

    return uVar1;

  }

  return (uint)in_EAX & 0xffffff00;

}





// --- FUN_00694010 at 0x00694010 (size: 137) ---


undefined4 __thiscall FUN_00694010(int param_1,int param_2,undefined4 param_3,undefined4 param_4)



{

  uint uVar1;

  uint *puVar2;

  int iVar3;

  bool bVar4;

  

  uVar1 = *(uint *)(param_2 + 8);

  if (uVar1 == 0) {

    puVar2 = (uint *)(param_1 + 0xf0);

  }

  else {

    puVar2 = *(uint **)(*(int *)(param_1 + 100) + (uVar1 % *(uint *)(param_1 + 0x6c)) * 4);

    bVar4 = true;

    if (puVar2 == (uint *)0x0) goto LAB_00694049;

    do {

      if (*puVar2 == uVar1) break;

      puVar2 = (uint *)puVar2[1];

    } while (puVar2 != (uint *)0x0);

  }

  bVar4 = puVar2 == (uint *)0x0;

LAB_00694049:

  if (!bVar4) {

    FUN_00693e20(param_2,param_3,param_4);

  }

  if (DAT_0083da58 == 0) {

    iVar3 = 0;

  }

  else {

    iVar3 = *(int *)(DAT_0083da58 + 0xf4);

  }

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

    FUN_00693e20(param_2,param_3,param_4);

  }

  FUN_00693e20(param_2,param_3,param_4);

  return 1;

}





// --- FUN_006940a0 at 0x006940A0 (size: 137) ---


undefined4 __thiscall FUN_006940a0(int param_1,int param_2,undefined4 param_3,undefined4 param_4)



{

  uint uVar1;

  uint *puVar2;

  int iVar3;

  bool bVar4;

  

  uVar1 = *(uint *)(param_2 + 8);

  if (uVar1 == 0) {

    puVar2 = (uint *)(param_1 + 0xf0);

  }

  else {

    puVar2 = *(uint **)(*(int *)(param_1 + 100) + (uVar1 % *(uint *)(param_1 + 0x6c)) * 4);

    bVar4 = true;

    if (puVar2 == (uint *)0x0) goto LAB_006940d9;

    do {

      if (*puVar2 == uVar1) break;

      puVar2 = (uint *)puVar2[1];

    } while (puVar2 != (uint *)0x0);

  }

  bVar4 = puVar2 == (uint *)0x0;

LAB_006940d9:

  if (!bVar4) {

    FUN_00693ea0(param_2,param_3,param_4);

  }

  if (DAT_0083da58 == 0) {

    iVar3 = 0;

  }

  else {

    iVar3 = *(int *)(DAT_0083da58 + 0xf4);

  }

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

    FUN_00693ea0(param_2,param_3,param_4);

  }

  FUN_00693ea0(param_2,param_3,param_4);

  return 1;

}





// --- FUN_00694130 at 0x00694130 (size: 143) ---


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



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_00801790;

  puVar1 = PTR_DAT_00818558;

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

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

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

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

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

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

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

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

    *(undefined1 *)puVar6 = 0;

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

  }

  return param_1;

}





// --- FUN_006941c0 at 0x006941C0 (size: 143) ---


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



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_0080178c;

  puVar1 = PTR_DAT_00818558;

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

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

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

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

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

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

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

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

    *(undefined1 *)puVar6 = 0;

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

  }

  return param_1;

}





// --- FUN_00694250 at 0x00694250 (size: 310) ---


undefined4 __thiscall FUN_00694250(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  uint *puVar3;

  undefined4 *puVar4;

  int *piVar5;

  uint *puVar6;

  uint *puVar7;

  undefined4 *puVar8;

  uint *puVar9;

  uint uVar10;

  uint *puVar11;

  

  iVar2 = param_2;

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

    return 0;

  }

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

  puVar3 = (uint *)0x0;

  do {

    if (iVar1 == 0) {

      if (*(void **)(param_1 + 0x60) != (void *)(param_1 + 4)) {

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

      }

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

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

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

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

      FUN_00693b20(iVar2);

      puVar4 = (undefined4 *)PTR_DAT_00818558;

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

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

        puVar11 = (uint *)puVar3[1];

        PTR_DAT_00818558 = (undefined *)puVar4;

        if (param_2 * 2 < *(int *)(param_1 + 0x6c) + 1) {

          puVar8 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,puVar4,&param_2,param_2,0);

          if ((puVar8 != puVar4) || (puVar8 = puVar8 + -1, puVar8 != puVar4)) {

            puVar8 = puVar8 + 1;

          }

          FUN_00694250(*puVar8);

        }

        uVar10 = *puVar3 % *(uint *)(param_1 + 0x68);

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

        puVar3[1] = *(uint *)(iVar2 + uVar10 * 4);

        *(uint **)(iVar2 + uVar10 * 4) = puVar3;

        uVar10 = iVar2 + uVar10 * 4;

        if (uVar10 < *(uint *)(param_1 + 100)) {

          *(uint *)(param_1 + 100) = uVar10;

        }

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

        puVar4 = (undefined4 *)PTR_DAT_00818558;

        puVar3 = puVar11;

      }

      PTR_DAT_00818558 = (undefined *)puVar4;

      return 1;

    }

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

    while (piVar5 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

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

        puVar11 = *(uint **)(param_1 + 100);

        puVar9 = (uint *)*puVar11;

        goto LAB_0069429f;

      }

      piVar5 = *(int **)(param_1 + 100) + 1;

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

    }

    puVar11 = (uint *)0x0;

    puVar9 = (uint *)0x0;

LAB_0069429f:

    puVar7 = (uint *)*puVar11;

    if (puVar7 == puVar9) {

LAB_006942b2:

      *puVar11 = puVar7[1];

    }

    else {

      do {

        puVar6 = puVar7;

        puVar7 = (uint *)puVar6[1];

      } while (puVar7 != puVar9);

      if (puVar6 == (uint *)0x0) goto LAB_006942b2;

      puVar6[1] = puVar7[1];

    }

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

    puVar9[1] = (uint)puVar3;

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

    puVar3 = puVar9;

  } while( true );

}





// --- FUN_00694390 at 0x00694390 (size: 120) ---


uint __thiscall FUN_00694390(int param_1,uint *param_2)



{

  uint *puVar1;

  int iVar2;

  uint uVar3;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 0x60) + (*param_2 % *(uint *)(param_1 + 0x68)) * 4);

  do {

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

LAB_006943bb:

      if ((int)(*(uint *)(param_1 + 0x68) * 2) < *(int *)(param_1 + 0x6c) + 1) {

        FUN_00693d80();

      }

      uVar3 = *param_2 % *(uint *)(param_1 + 0x68);

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

      param_2[1] = *(uint *)(iVar2 + uVar3 * 4);

      *(uint **)(iVar2 + uVar3 * 4) = param_2;

      uVar3 = iVar2 + uVar3 * 4;

      if (uVar3 < *(uint *)(param_1 + 100)) {

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

      }

      iVar2 = *(int *)(param_1 + 0x6c) + 1;

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

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

    }

    if (*puVar1 == *param_2) {

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

        return (uint)puVar1 & 0xffffff00;

      }

      goto LAB_006943bb;

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_00694410 at 0x00694410 (size: 93) ---


uint __thiscall FUN_00694410(int param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  int iVar2;

  undefined1 local_c [8];

  uint local_4;

  

  FUN_0054b460(local_c,param_2);

  if (local_4 != 0) {

    return local_4 & 0xffffff00;

  }

  iVar2 = __aullrem(*param_2,param_2[1],*(undefined4 *)(param_1 + 0x68),0);

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

  param_2[2] = *(undefined4 *)(*(int *)(param_1 + 0x60) + iVar2 * 4);

  *puVar1 = param_2;

  if (puVar1 < *(undefined4 **)(param_1 + 100)) {

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

  }

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

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

}





// --- FUN_00694490 at 0x00694490 (size: 94) ---


undefined4 FUN_00694490(undefined4 *param_1,undefined4 *param_2)



{

  char cVar1;

  undefined4 *puVar2;

  

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

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

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = *param_1;

    puVar2[1] = param_1[1];

    puVar2[2] = 0;

    puVar2[4] = *param_2;

  }

  cVar1 = FUN_00694410(puVar2);

  if (cVar1 == '\0') {

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

      operator_delete(puVar2);

    }

    return 0;

  }

  return 1;

}





// --- FUN_006944f0 at 0x006944F0 (size: 128) ---


void FUN_006944f0(undefined4 *param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 *local_14;

  undefined4 local_10;

  undefined1 local_c [8];

  int local_4;

  

  local_14 = param_1;

  local_10 = param_2;

  iVar1 = 0;

  FUN_0054b460(local_c,&local_14);

  if (local_4 != 0) {

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

  }

  if (iVar1 == 0) {

    local_14 = (undefined4 *)FUN_005df0f5(0xc);

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

      local_14 = (undefined4 *)0x0;

    }

    else {

      *local_14 = 0;

      local_14[1] = 0;

      local_14[2] = 0;

    }

    FUN_00694490(&param_1,&local_14);

  }

  FUN_00455770(&stack0x0000000c);

  return;

}





// --- FUN_006945a0 at 0x006945A0 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_00801794;

  FUN_0041a390();

  param_1[1] = &PTR_FUN_0080178c;

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

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

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00694600 at 0x00694600 (size: 195) ---


void __fastcall FUN_00694600(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  int *piVar3;

  int iVar4;

  undefined1 local_c [12];

  

  piVar3 = (int *)FUN_0052dcf0(local_c);

  iVar4 = piVar3[2];

  iVar1 = *piVar3;

  piVar3 = (int *)piVar3[1];

  while (iVar4 != 0) {

    do {

      puVar2 = *(undefined4 **)(iVar4 + 0x10);

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

        if ((puVar2[1] & 0x80000000) == 0x80000000) {

          operator_delete__((void *)*puVar2);

        }

        operator_delete(puVar2);

      }

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

    } while (iVar4 != 0);

    do {

      piVar3 = piVar3 + 1;

      if (piVar3 == (int *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4)) goto LAB_0069467d;

      iVar4 = *piVar3;

    } while (iVar4 == 0);

  }

LAB_0069467d:

  FUN_0041a390();

  *(undefined ***)(param_1 + 8) = &PTR_FUN_00801794;

  FUN_0041a390();

  *(undefined ***)(param_1 + 0xc) = &PTR_FUN_0080178c;

  if (*(void **)(param_1 + 0x6c) != (void *)(param_1 + 0x10)) {

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

  }

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

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

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

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

  return;

}





// --- FUN_006946d0 at 0x006946D0 (size: 94) ---


undefined4 * __fastcall FUN_006946d0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00801798;

  FUN_00694130(7);

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = &PTR_FUN_00801794;

  FUN_006941c0(0x17);

  param_1[0x3c] = 0;

  param_1[0x3d] = 0;

  param_1[0x3e] = &PTR_FUN_00801794;

  FUN_006941c0(0x17);

  DAT_008f958c = param_1;

  return param_1;

}





// --- FUN_006947e0 at 0x006947E0 (size: 129) ---


void __fastcall FUN_006947e0(int param_1)



{

  int iVar1;

  void *pvVar2;

  void *pvVar3;

  int *piVar4;

  void *pvVar5;

  

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

  do {

    if (iVar1 == 0) {

      return;

    }

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

    while (piVar4 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

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

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

        pvVar5 = (void *)*piVar4;

        goto LAB_0069481f;

      }

      piVar4 = *(int **)(param_1 + 100) + 1;

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

    }

    piVar4 = (int *)0x0;

    pvVar5 = (void *)0x0;

LAB_0069481f:

    pvVar3 = (void *)*piVar4;

    if (pvVar3 == pvVar5) {

LAB_00694832:

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

    }

    else {

      do {

        pvVar2 = pvVar3;

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

      } while (pvVar3 != pvVar5);

      if (pvVar2 == (void *)0x0) goto LAB_00694832;

      *(undefined4 *)((int)pvVar2 + 4) = *(undefined4 *)((int)pvVar3 + 4);

    }

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

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

      FUN_00694600();

      operator_delete(pvVar5);

    }

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

  } while( true );

}





// --- FUN_00694870 at 0x00694870 (size: 89) ---


void __fastcall FUN_00694870(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00801798;

  DAT_008f958c = 0;

  FUN_006947e0();

  FUN_00694600();

  FUN_00694600();

  param_1[1] = &PTR_FUN_00801790;

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

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

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  return;

}





// --- FUN_006948d0 at 0x006948D0 (size: 30) ---


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



{

  FUN_00694870();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006948f0 at 0x006948F0 (size: 17) ---


undefined4 __fastcall FUN_006948f0(int param_1)



{

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

    return *(undefined4 *)(*(int *)(param_1 + 8) + 0xa0);

  }

  return 0;

}





// --- FUN_00694910 at 0x00694910 (size: 17) ---


undefined4 __fastcall FUN_00694910(int param_1)



{

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

    return *(undefined4 *)(*(int *)(param_1 + 8) + 0xa4);

  }

  return 0;

}





// --- FUN_00694930 at 0x00694930 (size: 23) ---


undefined4 __fastcall FUN_00694930(int param_1)



{

  undefined4 uVar1;

  

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

    uVar1 = FUN_00441840();

    return uVar1;

  }

  return 0;

}





// --- FUN_00694950 at 0x00694950 (size: 171) ---


void __thiscall

FUN_00694950(int param_1,undefined4 param_2,undefined4 param_3,undefined4 *param_4,

            undefined4 *param_5,int param_6)



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  undefined **local_2c [11];

  

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

    FUN_00441d40(*(int *)(param_1 + 8),*param_4,param_4[1],param_4[2],param_4[3]);

    uVar1 = *param_5;

    uVar2 = param_5[3];

    uVar3 = param_5[2];

    uVar4 = param_5[1];

    FUN_00440d20();

    FUN_00441d40(*(undefined4 *)(param_6 + 0xc),uVar1,uVar4,uVar3,uVar2);

    FUN_00442c70(local_2c,param_2,param_3);

    FUN_00440f40();

    local_2c[0] = &PTR_FUN_00799d14;

    FUN_00440f40();

  }

  return;

}





// --- FUN_00694a00 at 0x00694A00 (size: 59) ---


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



{

  int *piVar1;

  

  *param_1 = &PTR_FUN_008017c8;

  param_1[1] = DAT_008f9608;

  param_1[2] = 0;

  if (param_1 != param_2) {

    param_1[1] = param_2[1];

    piVar1 = (int *)param_2[2];

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

      param_1[2] = piVar1;

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

    }

  }

  return param_1;

}





// --- FUN_00694a40 at 0x00694A40 (size: 579) ---


int * __thiscall

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

            int *param_6,int *param_7,int param_8)



{

  int *piVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  undefined8 uVar10;

  int local_30;

  int local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  int *local_10;

  int local_c;

  int local_8;

  int local_4;

  

  piVar3 = (int *)*param_4;

  iVar6 = (param_4[2] - (int)piVar3) + 1;

  local_10 = piVar3;

  if (0 < iVar6) {

    iVar5 = param_4[1];

    piVar1 = (int *)((param_4[3] - iVar5) + 1);

    local_10 = piVar1;

    if (((((0 < (int)piVar1) && (local_10 = (int *)((param_5[2] - *param_5) + 1), 0 < (int)local_10)

          ) && (local_10 = (int *)((param_5[3] - param_5[1]) + 1), 0 < (int)local_10)) &&

        (((local_10 = param_6, param_6[2] - *param_6 != -1 && -1 < (param_6[2] - *param_6) + 1 &&

          (param_6[3] - param_6[1] != -1 && -1 < (param_6[3] - param_6[1]) + 1)) &&

         ((local_10 = *(int **)(param_1 + 8), local_10 != (int *)0x0 &&

          ((local_10[0x28] != 0 && (local_10[0x29] != 0)))))))) && (param_8 != 0)) {

      iVar8 = *param_7;

      if ((((iVar8 == 0) && (param_7[1] == 0)) && (iVar2 = FUN_006948f0(), iVar6 <= iVar2)) &&

         (iVar6 = FUN_00694910(), (int)piVar1 <= iVar6)) {

        piVar3 = (int *)FUN_00694950(param_2,param_3,param_6,param_5,param_8);

        return piVar3;

      }

      iVar2 = FUN_006948f0();

      uVar10 = FUN_00694910();

      iVar4 = (int)uVar10;

      local_30 = 0;

      local_2c = 0;

      local_28 = 0;

      local_24 = 0;

      local_10 = (int *)FUN_00466680((int)((ulonglong)uVar10 >> 0x20),&local_30);

      iVar6 = local_28;

      if ((char)local_10 != '\0') {

        param_6 = (int *)((iVar8 - (int)piVar3) + local_30);

        local_10 = param_6;

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

          local_10 = (int *)((int)param_6 / iVar2);

          param_6 = (int *)((int)param_6 % iVar2);

          if ((int)param_6 < 0) {

            local_10 = (int *)((int)param_6 + iVar2);

            param_6 = local_10;

          }

        }

        iVar5 = (param_7[1] - iVar5) + local_2c;

        local_c = 0;

        if (iVar5 != 0) {

          local_10 = (int *)(iVar5 / iVar4);

          local_c = iVar5 % iVar4;

          if (local_c < 0) {

            local_c = local_c + iVar4;

          }

        }

        iVar5 = local_2c;

        iVar8 = local_24;

        if (local_2c <= local_24) {

          do {

            iVar7 = iVar4 - local_c;

            if (iVar8 + 1 < iVar7 + iVar5) {

              iVar7 = (iVar8 - iVar5) + 1;

            }

            local_10 = param_6;

            if (local_30 <= iVar6) {

              local_14 = iVar7 + -1 + iVar5;

              local_4 = iVar7 + -1 + local_c;

              iVar9 = local_30;

              local_1c = iVar5;

              do {

                iVar8 = iVar2 - (int)local_10;

                if (iVar6 + 1 < iVar8 + iVar9) {

                  iVar8 = (iVar6 - iVar9) + 1;

                }

                local_8 = iVar8 + -1 + (int)local_10;

                local_18 = iVar8 + -1 + iVar9;

                local_20 = iVar9;

                FUN_00694950(param_2,param_3,&local_10,&local_20,param_8);

                iVar9 = iVar9 + iVar8;

                local_10 = (int *)0x0;

                iVar8 = local_24;

              } while (iVar9 <= iVar6);

            }

            iVar5 = iVar5 + iVar7;

            local_c = 0;

          } while (iVar5 <= iVar8);

        }

      }

    }

  }

  return local_10;

}





// --- FUN_00694c90 at 0x00694C90 (size: 234) ---


void __fastcall FUN_00694c90(int param_1)



{

  int iVar1;

  char cVar2;

  int *piVar3;

  undefined4 uVar4;

  undefined4 uStack_40;

  undefined4 uStack_30;

  undefined4 uStack_2c;

  undefined4 uStack_28;

  undefined4 uStack_24;

  undefined4 uStack_20;

  undefined4 uStack_1c;

  undefined4 uStack_18;

  undefined4 uStack_14;

  

  uStack_40 = 0x694ca3;

  piVar3 = (int *)(**(code **)(*DAT_00870340 + 0xc))();

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

  iVar1 = *piVar3;

  uStack_40 = 1;

  uVar4 = FUN_0054fe80();

  cVar2 = (**(code **)(iVar1 + 0x58))(0x20,0x20,uVar4);

  if (cVar2 == '\0') {

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

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

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

      return;

    }

  }

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

    uStack_40 = 0x3e99999a;

    FUN_00443040(&uStack_40);

    uStack_30 = 0x1d;

    uStack_1c = 0x1d;

    uStack_2c = 0;

    uStack_20 = 0;

    uStack_28 = 0x20;

    uStack_14 = 0x20;

    uStack_24 = 0x20;

    uStack_18 = 0x20;

    FUN_004431b0(&DAT_0083547c,&uStack_30);

    FUN_004431b0(&DAT_0083547c,&uStack_20);

  }

  return;

}





// --- FUN_00694d80 at 0x00694D80 (size: 61) ---


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



{

  *param_1 = &PTR_FUN_008017c8;

  param_1[1] = DAT_008f9608;

  param_1[2] = param_2;

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

    FUN_00694c90();

    return param_1;

  }

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

  param_1[1] = param_2[10];

  return param_1;

}





// --- FUN_00694dc0 at 0x00694DC0 (size: 59) ---


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



{

  *param_1 = &PTR_FUN_008017c8;

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

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

    param_1[2] = 0;

  }

  param_1[1] = DAT_008f9608;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00694e00 at 0x00694E00 (size: 70) ---


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



{

  undefined4 uVar1;

  int iVar2;

  

  *param_1 = &PTR_FUN_008017c8;

  param_1[1] = param_2;

  param_1[2] = 0;

  uVar1 = FUN_004220b0(param_2,0xc);

  iVar2 = FUN_00415430(uVar1);

  param_1[2] = iVar2;

  if (iVar2 == 0) {

    FUN_00694c90();

  }

  return param_1;

}





// --- FUN_00694f00 at 0x00694F00 (size: 105) ---


void __thiscall

FUN_00694f00(int param_1,undefined4 param_2,undefined4 param_3,undefined4 *param_4,

            undefined4 *param_5)



{

  undefined4 uVar1;

  

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

    uVar1 = FUN_005df4c4();

    *param_4 = uVar1;

    uVar1 = FUN_005df4c4();

    *param_5 = uVar1;

  }

  return;

}





// --- FUN_006952d0 at 0x006952D0 (size: 830) ---


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



void __fastcall FUN_006952d0(int *param_1)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  bool bVar5;

  char cVar6;

  int iVar7;

  undefined4 uVar8;

  uint uVar9;

  undefined4 local_108;

  undefined4 local_104;

  float local_100 [6];

  undefined4 local_e8;

  undefined4 local_e4;

  undefined4 local_e0;

  undefined4 local_dc;

  undefined4 local_d8;

  undefined4 local_d4;

  undefined4 local_d0;

  undefined4 local_cc;

  undefined4 local_c8;

  undefined4 local_c4;

  undefined1 local_c0 [64];

  undefined1 local_80 [64];

  undefined1 local_40 [64];

  

  FUN_00441080(param_1[8],param_1[9] + -1 + param_1[0xb],&local_108,&local_104);

  fVar1 = (float)param_1[10];

  if (param_1[10] < 0) {

    fVar1 = fVar1 + _DAT_0079920c;

  }

  fVar1 = fVar1 - _DAT_007c97cc;

  iVar7 = FUN_0054fd20();

  fVar2 = (float)iVar7;

  if (iVar7 < 0) {

    fVar2 = fVar2 + _DAT_0079920c;

  }

  fVar1 = fVar1 / fVar2;

  fVar2 = (float)param_1[0xb];

  if (param_1[0xb] < 0) {

    fVar2 = fVar2 + _DAT_0079920c;

  }

  fVar2 = fVar2 - _DAT_007c97cc;

  iVar7 = FUN_0054fd30();

  fVar3 = (float)iVar7;

  if (iVar7 < 0) {

    fVar3 = fVar3 + _DAT_0079920c;

  }

  fVar2 = fVar2 / fVar3;

  FUN_0065e030(0x3f000000,0x3f000000,0);

  local_d0 = local_108;

  local_cc = local_104;

  local_100[3] = 0.0;

  local_100[2] = 0.0;

  local_100[1] = 0.0;

  local_e4 = 0;

  local_e8 = 0;

  local_100[4] = 0.0;

  local_d4 = 0;

  local_dc = 0;

  local_e0 = 0;

  local_c8 = 0;

  local_c4 = 0x3f800000;

  local_d8 = 0x3f800000;

  local_100[0] = fVar1 + fVar1;

  local_100[5] = fVar2 + fVar2;

  FUN_0043d9c0(local_80,local_100);

  FUN_0043d9c0(param_1 + 0x34,local_c0);

  (**(code **)(*param_1 + 0x34))(local_40);

  if (((((char)param_1[0x47] != '\0') && (param_1[0x44] != 0)) &&

      (iVar7 = param_1[0x45], iVar7 != 0)) && (uVar9 = 0, *(int *)(iVar7 + 0x80) != 0)) {

    do {

      iVar7 = *(int *)(*(int *)(iVar7 + 0x78) + uVar9 * 4);

      if (*(int *)(iVar7 + 0x30) != 0) {

        fVar1 = (float)param_1[10];

        if (param_1[10] < 0) {

          fVar1 = fVar1 + _DAT_0079920c;

        }

        fVar2 = (float)*(int *)(param_1[0x44] + 0x1c);

        if (*(int *)(param_1[0x44] + 0x1c) < 0) {

          fVar2 = fVar2 + _DAT_0079920c;

        }

        uVar8 = FUN_005b2280(fVar1 / fVar2);

        FUN_0044f8d0(uVar8);

        fVar3 = (float)param_1[0xb];

        if (param_1[0xb] < 0) {

          fVar3 = fVar3 + _DAT_0079920c;

        }

        fVar4 = (float)*(int *)(param_1[0x44] + 0x20);

        if (*(int *)(param_1[0x44] + 0x20) < 0) {

          fVar4 = fVar4 + _DAT_0079920c;

        }

        uVar8 = FUN_005b2280(fVar3 / fVar4);

        FUN_0044f920(uVar8);

        fVar1 = ABS(ABS(fVar1 / fVar2) - _DAT_007938b0);

        uVar8 = 3;

        if (fVar1 < _DAT_00801804 == (fVar1 == _DAT_00801804)) {

          uVar8 = 1;

        }

        fVar1 = ABS(fVar3 / fVar4) - _DAT_007938b0;

        *(undefined4 *)(**(int **)(iVar7 + 0x1c) + 0x14) = uVar8;

        fVar1 = ABS(fVar1);

        uVar8 = 3;

        if (fVar1 < _DAT_00801804 == (fVar1 == _DAT_00801804)) {

          uVar8 = 1;

        }

        *(undefined4 *)(**(int **)(iVar7 + 0x1c) + 0x18) = uVar8;

      }

      iVar7 = param_1[0x45];

      uVar9 = uVar9 + 1;

    } while (uVar9 < *(uint *)(iVar7 + 0x80));

  }

  if (((param_1[10] == *(int *)(param_1[0x44] + 0x1c)) &&

      (param_1[0xb] == *(int *)(param_1[0x44] + 0x20))) &&

     (cVar6 = FUN_0065e5a0(param_1 + 0x34,&DAT_008354f8), cVar6 != '\0')) {

    bVar5 = false;

  }

  else {

    bVar5 = true;

  }

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

    if (bVar5) {

      (**(code **)(*param_1 + 0x50))(1);

      return;

    }

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

  }

  return;

}





// --- FUN_00695610 at 0x00695610 (size: 89) ---


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



{

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined1 local_c [4];

  undefined1 local_8 [8];

  

  local_18 = *param_1;

  local_14 = *param_2;

  local_10 = 0;

  FUN_0043d940(&local_18,local_c);

  FUN_00694f00(local_c,local_8,param_3,param_4);

  return;

}





// --- FUN_00695670 at 0x00695670 (size: 1) ---


void FUN_00695670(void)



{

  return;

}





// --- FUN_00695680 at 0x00695680 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_00801808;

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

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

  }

  *param_1 = &PTR_LAB_00796c4c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006956c0 at 0x006956C0 (size: 319) ---


undefined4 * __fastcall FUN_006956c0(undefined4 *param_1)



{

  FUN_0069a360();

  *param_1 = &PTR_FUN_00801840;

  param_1[0x44] = 0;

  param_1[0x45] = 0;

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

  param_1[0x48] = 0;

  param_1[0x49] = 0;

  param_1[0x4a] = 0;

  param_1[0x46] = 0x3f800000;

  param_1[0x17] = 0;

  param_1[0x16] = 0;

  param_1[0x15] = 0;

  param_1[0x1b] = 0;

  param_1[0x1a] = 0;

  param_1[0x18] = 0;

  param_1[0x1f] = 0;

  param_1[0x1d] = 0;

  param_1[0x1c] = 0;

  param_1[0x22] = 0;

  param_1[0x21] = 0;

  param_1[0x20] = 0;

  param_1[0x23] = 0x3f800000;

  param_1[0x1e] = 0x3f800000;

  param_1[0x19] = 0x3f800000;

  param_1[0x14] = 0x3f800000;

  param_1[0x27] = 0;

  param_1[0x26] = 0;

  param_1[0x25] = 0;

  param_1[0x2b] = 0;

  param_1[0x2a] = 0;

  param_1[0x28] = 0;

  param_1[0x2f] = 0;

  param_1[0x2d] = 0;

  param_1[0x2c] = 0;

  param_1[0x32] = 0;

  param_1[0x31] = 0;

  param_1[0x30] = 0;

  param_1[0x33] = 0x3f800000;

  param_1[0x2e] = 0x3f800000;

  param_1[0x29] = 0x3f800000;

  param_1[0x24] = 0x3f800000;

  param_1[0x37] = 0;

  param_1[0x36] = 0;

  param_1[0x35] = 0;

  param_1[0x3b] = 0;

  param_1[0x3a] = 0;

  param_1[0x38] = 0;

  param_1[0x3f] = 0;

  param_1[0x3d] = 0;

  param_1[0x3c] = 0;

  param_1[0x42] = 0;

  param_1[0x41] = 0;

  param_1[0x40] = 0;

  param_1[0x43] = 0x3f800000;

  param_1[0x3e] = 0x3f800000;

  param_1[0x39] = 0x3f800000;

  param_1[0x34] = 0x3f800000;

  return param_1;

}





// --- FUN_00695820 at 0x00695820 (size: 106) ---


void __fastcall FUN_00695820(undefined4 *param_1)



{

  int *piVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)param_1[0x44];

  *param_1 = &PTR_FUN_00801840;

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

    piVar1 = puVar2 + 1;

    *piVar1 = *piVar1 + -1;

    if (*piVar1 == 0) {

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

    }

    param_1[0x44] = 0;

  }

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

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

    param_1[0x45] = 0;

  }

  *param_1 = &PTR_FUN_00801808;

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

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

  }

  *param_1 = &PTR_LAB_00796c4c;

  return;

}





// --- FUN_006959b0 at 0x006959B0 (size: 30) ---


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



{

  FUN_00695820();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00695a60 at 0x00695A60 (size: 662) ---


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



int __fastcall FUN_00695a60(int param_1)



{

  char cVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  int iVar5;

  float fVar6;

  float fVar7;

  float fVar8;

  undefined4 uVar9;

  int local_38;

  float local_30 [12];

  

  iVar5 = FUN_005df0f5(0x4e0);

  if (iVar5 == 0) {

    local_38 = 0;

  }

  else {

    local_38 = FUN_004497e0();

  }

  iVar5 = FUN_005df0f5(0xd8);

  if (iVar5 == 0) {

    fVar6 = 0.0;

  }

  else {

    fVar6 = (float)FUN_0044aa40();

  }

  iVar5 = FUN_005df0f5(0x48);

  if (iVar5 == 0) {

    fVar7 = 0.0;

  }

  else {

    fVar7 = (float)FUN_00448350();

  }

  if (((local_38 != 0) && (fVar6 != 0.0)) && (fVar7 != 0.0)) {

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

    *(undefined4 *)((int)fVar7 + 0x1c) = 1;

    *(undefined4 *)((int)fVar7 + 0x20) = 1;

    *(undefined4 *)((int)fVar7 + 0x28) = 4;

    iVar5 = (uint)(cVar1 == '\0') * 2 + 1;

    *(int *)((int)fVar7 + 0x14) = iVar5;

    *(int *)((int)fVar7 + 0x18) = iVar5;

    *(undefined4 *)((int)fVar7 + 0x2c) = 2;

    *(undefined4 *)((int)fVar7 + 0x30) = 3;

    *(undefined4 *)((int)fVar7 + 0x34) = 3;

    *(undefined4 *)((int)fVar7 + 0x38) = 2;

    *(undefined4 *)((int)fVar7 + 0x3c) = 3;

    if ((*(int *)(param_1 + 0x110) != 0) && (*(char *)(*(int *)(param_1 + 0x110) + 0x18) != '\0')) {

      *(undefined4 *)((int)fVar7 + 0x34) = 4;

    }

    *(undefined4 *)((int)fVar6 + 0x48) = 1;

    *(undefined4 *)((int)fVar6 + 0x34) = 5;

    *(undefined4 *)((int)fVar6 + 0x38) = 6;

    *(undefined4 *)((int)fVar6 + 0x40) = 8;

    *(undefined1 *)((int)fVar6 + 0x44) = 0;

    *(undefined4 *)((int)fVar6 + 0x7c) = DAT_00835538;

    *(undefined4 *)((int)fVar6 + 0x80) = DAT_0083553c;

    *(undefined4 *)((int)fVar6 + 0x84) = DAT_00835540;

    *(undefined4 *)((int)fVar6 + 0x88) = DAT_00835544;

    local_30[0] = fVar7;

    FUN_0044a770(local_30,*(undefined4 *)((int)fVar6 + 0x24));

    if ((*(char *)(param_1 + 0x11c) == '\0') || (*(int *)(param_1 + 0x110) == 0)) {

LAB_00695cbf:

      local_30[0] = fVar6;

      FUN_0044a770(local_30,*(undefined4 *)(local_38 + 0x80));

      FUN_004494e0();

      return local_38;

    }

    iVar5 = FUN_005df0f5(0x60);

    if (iVar5 != 0) {

      fVar8 = (float)FUN_00450950();

      if (fVar8 != 0.0) {

        *(undefined4 *)((int)fVar8 + 4) = 0;

        fVar2 = (float)*(int *)(param_1 + 0x28);

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

          fVar2 = fVar2 + _DAT_0079920c;

        }

        fVar3 = (float)*(int *)(*(int *)(param_1 + 0x110) + 0x1c);

        if (*(int *)(*(int *)(param_1 + 0x110) + 0x1c) < 0) {

          fVar3 = fVar3 + _DAT_0079920c;

        }

        uVar9 = FUN_005b2280(fVar2 / fVar3);

        FUN_0044f8d0(uVar9);

        local_30[0] = (float)*(int *)(param_1 + 0x2c);

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

          local_30[0] = local_30[0] + _DAT_0079920c;

        }

        fVar4 = (float)*(int *)(*(int *)(param_1 + 0x110) + 0x20);

        if (*(int *)(*(int *)(param_1 + 0x110) + 0x20) < 0) {

          fVar4 = fVar4 + _DAT_0079920c;

        }

        local_30[0] = local_30[0] / fVar4;

        uVar9 = FUN_005b2280(local_30[0]);

        FUN_0044f920(uVar9);

        fVar2 = ABS(ABS(fVar2 / fVar3) - _DAT_007938b0);

        uVar9 = 3;

        if (fVar2 < _DAT_00801804 == (fVar2 == _DAT_00801804)) {

          uVar9 = 1;

        }

        *(undefined4 *)((int)fVar7 + 0x14) = uVar9;

        uVar9 = 3;

        if (ABS(ABS(local_30[0]) - _DAT_007938b0) < _DAT_00801804 ==

            (ABS(ABS(local_30[0]) - _DAT_007938b0) == _DAT_00801804)) {

          uVar9 = 1;

        }

        *(undefined4 *)((int)fVar7 + 0x18) = uVar9;

        local_30[0] = fVar8;

        FUN_0044a770(local_30,0);

        goto LAB_00695cbf;

      }

    }

  }

  return 0;

}





// --- FUN_00695f10 at 0x00695F10 (size: 56) ---


undefined4 * __fastcall FUN_00695f10(undefined4 *param_1)



{

  FUN_0069a360();

  *param_1 = &PTR_FUN_008018d4;

  param_1[0x14] = DAT_008355ac;

  param_1[0x15] = DAT_008355b0;

  param_1[0x16] = DAT_008355b4;

  param_1[0x17] = DAT_008355b8;

  return param_1;

}





// --- FUN_00696020 at 0x00696020 (size: 18) ---


undefined4 * __fastcall FUN_00696020(undefined4 *param_1)



{

  FUN_0069a360();

  *param_1 = &PTR_FUN_00801998;

  return param_1;

}





// --- FUN_00696060 at 0x00696060 (size: 43) ---


bool FUN_00696060(void)



{

  char cVar1;

  

  cVar1 = FUN_00413a70();

  if (cVar1 == '\0') {

    return true;

  }

  if (DAT_0086734c != 0) {

    cVar1 = FUN_0044bf80();

    return cVar1 != '\0';

  }

  return false;

}





// --- FUN_00696090 at 0x00696090 (size: 122) ---


void __fastcall FUN_00696090(int *param_1)



{

  uint uVar1;

  int iVar2;

  int iVar3;

  undefined4 *puVar4;

  undefined4 *puVar5;

  undefined4 local_18 [6];

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar1 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(uVar1 - 1)) {

        iVar3 = (uVar1 - 1) * 0x18;

        do {

          puVar4 = local_18;

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

            *puVar4 = 0;

            puVar4 = puVar4 + 1;

          }

          puVar5 = (undefined4 *)(*param_1 + iVar3);

          iVar3 = iVar3 + -0x18;

          uVar1 = uVar1 - 1;

          puVar4 = local_18;

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

            *puVar5 = *puVar4;

            puVar4 = puVar4 + 1;

            puVar5 = puVar5 + 1;

          }

        } while (uVar1 != 0);

      }

    }

    return;

  }

  operator_delete__((void *)*param_1);

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_00696110 at 0x00696110 (size: 192) ---


undefined4 __thiscall FUN_00696110(int *param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined4 *puVar5;

  undefined4 *puVar6;

  

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

    return 0;

  }

  if ((param_1[1] & 0x7fffffffU) < param_2) {

    if (param_2 == 0) {

      FUN_00696090();

      return 1;

    }

    iVar1 = thunk_FUN_005df0f5(param_2 * 0x18);

    if (iVar1 == 0) {

      return 0;

    }

    FUN_00401000(iVar1,0x18,param_2,&LAB_00696040);

    if (*param_1 != 0) {

      iVar4 = param_1[2];

      if (-1 < iVar4 + -1) {

        iVar2 = (iVar4 + -1) * 0x18;

        do {

          puVar5 = (undefined4 *)(*param_1 + iVar2);

          puVar6 = (undefined4 *)(iVar2 + iVar1);

          iVar2 = iVar2 + -0x18;

          iVar4 = iVar4 + -1;

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

            *puVar6 = *puVar5;

            puVar5 = puVar5 + 1;

            puVar6 = puVar6 + 1;

          }

        } while (iVar4 != 0);

      }

      if ((param_1[1] & 0x80000000U) == 0x80000000) {

        operator_delete__((void *)*param_1);

      }

    }

    *param_1 = iVar1;

    param_1[1] = param_2 | 0x80000000;

  }

  return 1;

}





// --- FUN_006961d0 at 0x006961D0 (size: 90) ---


void __fastcall FUN_006961d0(int param_1)



{

  int *piVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  

  uVar3 = 0;

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

    iVar4 = 0;

    do {

      iVar2 = 6;

      do {

        piVar1 = *(int **)(iVar4 + *(int *)(param_1 + 0xa0));

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

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

          *(undefined4 *)(iVar4 + *(int *)(param_1 + 0xa0)) = 0;

        }

        iVar4 = iVar4 + 4;

        iVar2 = iVar2 + -1;

      } while (iVar2 != 0);

      uVar3 = uVar3 + 1;

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

  }

  FUN_00696090();

  return;

}





// --- FUN_00696240 at 0x00696240 (size: 132) ---


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



void __fastcall FUN_00696240(int param_1)



{

  int *piVar1;

  

  FUN_006961d0();

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

    if (DAT_00870340 != 0) {

      FUN_005a15b0(*(int *)(param_1 + 0x98));

    }

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

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

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

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

    }

    _DAT_008f988c = _DAT_008f988c - *(int *)(param_1 + 0x50);

  }

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

    if (DAT_00870340 != 0) {

      FUN_005a15b0(*(int *)(param_1 + 0x9c));

    }

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

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

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

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

    }

    _DAT_008f988c = _DAT_008f988c - *(int *)(param_1 + 0x50);

  }

  return;

}





// --- FUN_006962d0 at 0x006962D0 (size: 26) ---


undefined1 FUN_006962d0(void)



{

  char cVar1;

  

  cVar1 = FUN_004154a0();

  if (cVar1 == '\0') {

    return 0;

  }

  FUN_00696240();

  return 1;

}





// --- FUN_006962f0 at 0x006962F0 (size: 138) ---


undefined1 __thiscall FUN_006962f0(int *param_1,uint param_2,char param_3)



{

  char cVar1;

  uint uVar2;

  int iVar3;

  int iVar4;

  undefined4 *puVar5;

  undefined4 *puVar6;

  undefined4 local_18 [6];

  

  if ((param_1[1] & 0x7fffffffU) < param_2) {

    uVar2 = param_2;

    if (param_3 == '\0') {

      uVar2 = FUN_00453850(param_2);

    }

    cVar1 = FUN_00696110(uVar2);

    if (cVar1 == '\0') {

      return 0;

    }

  }

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

    iVar4 = param_2 * 0x18;

    uVar2 = param_2;

    do {

      puVar5 = local_18;

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

        *puVar5 = 0;

        puVar5 = puVar5 + 1;

      }

      puVar5 = local_18;

      puVar6 = (undefined4 *)(*param_1 + iVar4);

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

        *puVar6 = *puVar5;

        puVar5 = puVar5 + 1;

        puVar6 = puVar6 + 1;

      }

      uVar2 = uVar2 + 1;

      iVar4 = iVar4 + 0x18;

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

  }

  param_1[2] = param_2;

  return 1;

}





// --- FUN_00696440 at 0x00696440 (size: 37) ---


bool FUN_00696440(void)



{

  char cVar1;

  

  cVar1 = FUN_00413a70();

  if (cVar1 == '\0') {

    return true;

  }

  FUN_00696240();

  cVar1 = FUN_0044bb20();

  return cVar1 != '\0';

}





// --- FUN_00696470 at 0x00696470 (size: 940) ---


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



undefined4 __fastcall FUN_00696470(int param_1)



{

  int *piVar1;

  int *piVar2;

  undefined1 uVar3;

  char cVar4;

  uint uVar5;

  uint uVar6;

  undefined4 uVar7;

  uint uVar8;

  int iVar9;

  int *unaff_EBX;

  int iVar10;

  undefined4 *puVar11;

  undefined4 uStack_58;

  uint local_54;

  int iStack_50;

  int local_4c;

  uint uStack_48;

  int iStack_44;

  int local_40;

  uint local_3c;

  byte bStack_2c;

  

  if (*(int *)(param_1 + 0x58) == 5) {

    return 1;

  }

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

    FUN_006961d0();

    local_54 = (uint)((*(byte *)(param_1 + 100) & 1) != 0);

    uVar5 = *(uint *)(param_1 + 100);

    local_4c = 0;

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

      local_4c = 2;

    }

    if (((uVar5 & 4) != 0) && ((char)DAT_00870340[0x14] != '\0')) {

      local_54 = local_54 | 0x400;

    }

    if (((uVar5 & 8) != 0) && (*(char *)((int)DAT_00870340 + 0x51) != '\0')) {

      local_54 = local_54 | 0x200;

    }

    FUN_00535a80();

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

    uStack_58 = CONCAT13(1,(undefined3)uStack_58);

    uVar5 = local_3c;

    while( true ) {

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

      iVar10 = 0;

      local_40 = 0;

      if (iVar9 == 2) {

        uVar5 = (**(code **)(*(int *)DAT_00870340[0x11a] + 0x5c))

                          ((int *)DAT_00870340[0x11a],*(undefined4 *)(param_1 + 0x88),

                           *(undefined4 *)(param_1 + 0x8c),*(undefined4 *)(param_1 + 0x5c),local_54,

                           *(undefined4 *)(param_1 + 0x60),local_4c,param_1 + 0x98,0);

        uVar8 = *(uint *)(param_1 + 0x8c);

        uVar6 = *(uint *)(param_1 + 0x88);

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

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

          do {

            local_40 = iVar9;

            iVar10 = iVar10 + (bStack_2c * uVar8 * uVar6 >> 3);

            if (uVar6 != 0) {

              uVar6 = uVar6 >> 1;

            }

            if (uVar8 != 0) {

              uVar8 = uVar8 >> 1;

            }

            iVar9 = local_40 + -1;

            local_40 = iVar10;

          } while (iVar9 != 0);

        }

      }

      else if (iVar9 == 4) {

        uVar5 = (**(code **)(*(int *)DAT_00870340[0x11a] + 100))

                          ((int *)DAT_00870340[0x11a],*(undefined4 *)(param_1 + 0x90),

                           *(undefined4 *)(param_1 + 0x5c),local_54,*(undefined4 *)(param_1 + 0x60),

                           local_4c,param_1 + 0x9c,0);

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

        uVar8 = *(uint *)(param_1 + 0x90);

        if (iVar9 != 0) {

          do {

            iVar10 = iVar10 + (bStack_2c * uVar8 * uVar8 >> 3);

            if (uVar8 != 0) {

              uVar8 = uVar8 >> 1;

            }

            iVar9 = iVar9 + -1;

            local_40 = iVar10;

          } while (iVar9 != 0);

        }

      }

      else if (iVar9 != 5) {

        return 0;

      }

      if (uVar5 == 0) break;

      if (uVar5 != 0x8876017c) {

        if ((int)uVar5 < 0) {

          return 0;

        }

        break;

      }

      if (uStack_58._3_1_ == '\0') {

        return 0;

      }

      uVar3 = FUN_004473d0(iVar10);

      uStack_58 = CONCAT13(uVar3,(undefined3)uStack_58);

    }

    if ((*(int *)(param_1 + 0x98) != 0) || (*(int *)(param_1 + 0x9c) != 0)) {

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

      FUN_006962f0(*(undefined4 *)(param_1 + 0x5c),1);

      uStack_48 = 0;

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

        iStack_44 = 0;

        local_4c = 0;

        do {

          puVar11 = (undefined4 *)(*piVar1 + local_4c);

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

            *puVar11 = 0;

            puVar11 = puVar11 + 1;

          }

          uVar5 = 0;

          local_3c = ((*(int *)(param_1 + 0x58) != 4) - 1 & 5) + 1;

          if (local_3c != 0) {

            do {

              iStack_50 = 0;

              if (*(int *)(param_1 + 0x58) == 2) {

                iVar9 = (**(code **)(**(int **)(param_1 + 0x98) + 0x48))

                                  (*(int **)(param_1 + 0x98),uStack_48,&iStack_50);

              }

              else {

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

                  return 0;

                }

                switch(uVar5) {

                case 0:

                  local_54 = 0;

                  break;

                case 1:

                  local_54 = 1;

                  break;

                case 2:

                  local_54 = 2;

                  break;

                case 3:

                  local_54 = 3;

                  break;

                case 4:

                  local_54 = 4;

                  break;

                case 5:

                  local_54 = 5;

                }

                iVar9 = (**(code **)(**(int **)(param_1 + 0x9c) + 0x48))

                                  (*(int **)(param_1 + 0x9c),local_54,uStack_48,&iStack_50);

              }

              if (iVar9 < 0) {

                return 0;

              }

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

                return 0;

              }

              iVar9 = *piVar1;

              uVar7 = (**(code **)(*DAT_00870340 + 0x10))();

              *(undefined4 *)(iVar9 + uStack_58 + uVar5 * 4) = uVar7;

              piVar2 = *(int **)(*piVar1 + (iStack_50 + uVar5) * 4);

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

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

                  return 0;

                }

                (**(code **)(*unaff_EBX + 8))(unaff_EBX);

                return 0;

              }

              cVar4 = (**(code **)(*piVar2 + 0x70))(unaff_EBX,0,0);

              if (cVar4 == '\0') {

                return 0;

              }

              uVar5 = uVar5 + 1;

            } while (uVar5 < local_3c);

          }

          uStack_48 = uStack_48 + 1;

          local_4c = local_4c + 0x18;

          iStack_44 = iStack_44 + 6;

          iVar10 = local_40;

        } while (uStack_48 < *(uint *)(param_1 + 0x5c));

      }

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

      if ((iVar9 == 2) || ((iVar9 != 3 && (iVar9 == 4)))) {

        _DAT_008f988c = _DAT_008f988c + iVar10;

      }

      FUN_00446bd0(iVar10);

      FUN_00446c00();

      return 1;

    }

  }

  return 0;

}





// --- FUN_00696840 at 0x00696840 (size: 56) ---


undefined4 __fastcall FUN_00696840(int param_1)



{

  char cVar1;

  

  cVar1 = FUN_00446c20();

  if (cVar1 != '\0') {

    if ((*(int *)(param_1 + -8) != DAT_008f98e0) &&

       (cVar1 = (**(code **)(*(int *)(param_1 + -0x30) + 0x54))(), cVar1 != '\0')) {

      return 1;

    }

    cVar1 = FUN_00696470();

    if (cVar1 != '\0') {

      return 1;

    }

  }

  return 0;

}





// --- FUN_00696880 at 0x00696880 (size: 74) ---


void __fastcall FUN_00696880(int param_1)



{

  char cVar1;

  

  cVar1 = FUN_00413a70();

  if (cVar1 != '\0') {

    FUN_00696240();

    FUN_0044bb20();

  }

  FUN_00446c00();

  FUN_0044c4f0();

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

  FUN_00696090();

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

  return;

}





// --- FUN_006968d0 at 0x006968D0 (size: 88) ---


undefined4 __fastcall FUN_006968d0(int param_1)



{

  undefined4 uVar1;

  char cVar2;

  

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

    cVar2 = (**(code **)(*(int *)(param_1 + 0x30) + 0xc))();

    if (cVar2 == '\0') {

      return 0;

    }

  }

  uVar1 = DAT_008379b4;

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

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

  if (DAT_00870340 != 0) {

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

  }

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

    FUN_00696470();

  }

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

}





// --- FUN_00696930 at 0x00696930 (size: 88) ---


undefined4 __fastcall FUN_00696930(int param_1)



{

  undefined4 uVar1;

  char cVar2;

  

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

    cVar2 = (**(code **)(*(int *)(param_1 + 0x30) + 0xc))();

    if (cVar2 == '\0') {

      return 0;

    }

  }

  uVar1 = DAT_008379b4;

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

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

  if (DAT_00870340 != 0) {

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

  }

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

    FUN_00696470();

  }

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

}





// --- FUN_00696990 at 0x00696990 (size: 60) ---


undefined4 * __fastcall FUN_00696990(undefined4 *param_1)



{

  FUN_0044c430();

  *param_1 = &PTR_LAB_00801a28;

  param_1[0xc] = &PTR_LAB_00801a18;

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  param_1[0x26] = 0;

  FUN_00696090();

  param_1[0x27] = 0;

  return param_1;

}





// --- FUN_006969e0 at 0x006969E0 (size: 125) ---


void __fastcall FUN_006969e0(undefined4 *param_1)



{

  char cVar1;

  

  *param_1 = &PTR_LAB_00801a28;

  param_1[0xc] = &PTR_LAB_00801a18;

  cVar1 = FUN_00413a70();

  if (cVar1 != '\0') {

    FUN_00696240();

    FUN_0044bb20();

  }

  FUN_00446c00();

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

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

  }

  *param_1 = &PTR_LAB_0079c1a8;

  param_1[0xc] = &PTR_LAB_0079c198;

  FUN_0044c4c0();

  FUN_0044c0e0();

  FUN_00446f00();

  FUN_004154b0();

  return;

}





// --- FUN_00696a60 at 0x00696A60 (size: 154) ---


int __thiscall FUN_00696a60(int param_1,uint param_2,int param_3)



{

  int *piVar1;

  int iVar2;

  

  if (*(int *)(param_1 + 0x58) == 2) {

    iVar2 = FUN_006968d0();

    if (iVar2 == 0) {

      return 0;

    }

    if (*(uint *)(param_1 + 0xa8) <= param_2) {

      return 0;

    }

    iVar2 = (param_3 + param_2 * 6) * 4;

    piVar1 = *(int **)(iVar2 + *(int *)(param_1 + 0xa0));

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

      return 0;

    }

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

  }

  else {

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

      return 0;

    }

    iVar2 = FUN_00696930();

    if (iVar2 == 0) {

      return 0;

    }

    if (*(uint *)(param_1 + 0xa8) <= param_2) {

      return 0;

    }

    iVar2 = (param_3 + param_2 * 6) * 4;

    piVar1 = *(int **)(iVar2 + *(int *)(param_1 + 0xa0));

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

      return 0;

    }

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

  }

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

  if (iVar2 == 0) {

    return 0;

  }

  return iVar2 + 0x30;

}





// --- FUN_00696b00 at 0x00696B00 (size: 135) ---


undefined4 __thiscall FUN_00696b00(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  

  if ((*(uint *)(param_2 + 100) >> 1 & 1) == 0) {

    return 0;

  }

  if ((*(uint *)(param_1 + 100) >> 1 & 1) != 0) {

    return 0;

  }

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

  if (iVar1 != *(int *)(param_2 + 0x58)) {

    return 0;

  }

  if ((iVar1 == 2) || (iVar1 == 5)) {

    iVar1 = FUN_006968d0();

    if (iVar1 == 0) {

      return 0;

    }

    iVar2 = FUN_006968d0();

  }

  else {

    if (iVar1 == 3) {

      return 1;

    }

    if (iVar1 != 4) {

      return 0;

    }

    iVar1 = FUN_00696930();

    if (iVar1 == 0) {

      return 0;

    }

    iVar2 = FUN_00696930();

  }

  if ((iVar2 != 0) &&

     (iVar1 = (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x7c))

                        (*(int **)(DAT_00870340 + 0x468),iVar1,iVar2), -1 < iVar1)) {

    return 1;

  }

  return 0;

}





// --- FUN_00696b90 at 0x00696B90 (size: 30) ---


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



{

  FUN_006969e0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00696c50 at 0x00696C50 (size: 71) ---


undefined4 __fastcall FUN_00696c50(int param_1)



{

  undefined4 uVar1;

  char cVar2;

  

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

    cVar2 = (**(code **)(*(int *)(param_1 + 0x30) + 0xc))();

    if (cVar2 == '\0') {

      return 0;

    }

  }

  uVar1 = DAT_008379b4;

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

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

  if (DAT_00870340 != 0) {

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

  }

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

}





// --- FUN_00696ca0 at 0x00696CA0 (size: 82) ---


void __thiscall FUN_00696ca0(int param_1,int param_2)



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  undefined4 uVar7;

  undefined4 uVar8;

  

  if ((*(int *)(param_1 + 0x114) == 0) && (*(int *)(param_2 + 0x114) == 0)) {

    uVar8 = 0;

    uVar7 = 2;

    uVar6 = 0;

    uVar5 = 0;

    uVar1 = FUN_00696c50(0,0,2,0);

    uVar4 = 0;

    uVar3 = 0;

    uVar2 = FUN_00696c50(0,0,uVar1);

    FUN_005dfd12(uVar2,uVar3,uVar4,uVar1,uVar5,uVar6,uVar7,uVar8);

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

    return;

  }

  FUN_00443f60(param_2);

  return;

}





// --- FUN_00696d00 at 0x00696D00 (size: 143) ---


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



undefined4 __fastcall FUN_00696d00(int param_1)



{

  uint uVar1;

  

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

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

              (*(int **)(DAT_00870340 + 0x468),*(undefined4 *)(param_1 + 0xa0),

               *(undefined4 *)(param_1 + 0xa4),*(undefined4 *)(param_1 + 0xdc),

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

    uVar1 = (uint)*(byte *)(param_1 + 0xe8) * *(int *)(param_1 + 0xa4) * *(int *)(param_1 + 0xa0) >>

            3;

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

    FUN_00446bd0(uVar1);

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

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

    }

  }

  FUN_00446c00();

  return 1;

}





// --- FUN_00696d90 at 0x00696D90 (size: 73) ---


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



undefined4 __fastcall FUN_00696d90(int param_1)



{

  int *piVar1;

  undefined4 uVar2;

  int iVar3;

  

  uVar2 = FUN_004154a0();

  if ((char)uVar2 == '\0') {

    return uVar2;

  }

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

  if ((iVar3 == 0) && (piVar1 = *(int **)(param_1 + 0xf0), iVar3 = 0, piVar1 != (int *)0x0)) {

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

    iVar3 = CONCAT31((int3)((uint)uVar2 >> 8),*(char *)(param_1 + 0xf9));

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

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

      _DAT_008f99c4 = _DAT_008f99c4 - *(int *)(param_1 + 0x20);

    }

  }

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

}





// --- FUN_00696de0 at 0x00696DE0 (size: 55) ---


undefined4 * __fastcall FUN_00696de0(undefined4 *param_1)



{

  FUN_004440f0();

  param_1[0x48] = 0;

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

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

  *param_1 = &PTR_LAB_00801aa8;

  param_1[0xc] = &PTR_LAB_00801a94;

  param_1[0x49] = 3;

  return param_1;

}





// --- FUN_00696eb0 at 0x00696EB0 (size: 91) ---


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



void __fastcall FUN_00696eb0(int param_1)



{

  int *piVar1;

  

  if ((*(int *)(param_1 + 0x114) == 0) &&

     (piVar1 = *(int **)(param_1 + 0x120), piVar1 != (int *)0x0)) {

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

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

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

      _DAT_008f99c4 = _DAT_008f99c4 - *(int *)(param_1 + 0x50);

    }

  }

  FUN_00446c00();

  FUN_00444540();

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

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

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

  return;

}





// --- FUN_00696fb0 at 0x00696FB0 (size: 44) ---


void __fastcall FUN_00696fb0(int param_1)



{

  int iVar1;

  

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

    iVar1 = FUN_00696c50();

    if (iVar1 == 0) {

      return;

    }

    (**(code **)(**(int **)(param_1 + 0x120) + 0x38))(*(int **)(param_1 + 0x120));

  }

  FUN_00443cc0();

  return;

}





// --- FUN_00696fe0 at 0x00696FE0 (size: 66) ---


undefined4 __fastcall FUN_00696fe0(int param_1)



{

  char cVar1;

  

  cVar1 = FUN_00446c20();

  if (cVar1 == '\0') {

    return 0;

  }

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

    if ((*(int *)(param_1 + -8) != DAT_008f9a0c) &&

       (cVar1 = (**(code **)(*(int *)(param_1 + -0x30) + 0x54))(), cVar1 != '\0')) {

      return 1;

    }

    cVar1 = FUN_00696d00();

    if (cVar1 == '\0') {

      return 0;

    }

  }

  return 1;

}





// --- FUN_00697030 at 0x00697030 (size: 90) ---


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



void __fastcall FUN_00697030(undefined4 *param_1)



{

  int *piVar1;

  

  *param_1 = &PTR_LAB_00801aa8;

  param_1[0xc] = &PTR_LAB_00801a94;

  if ((param_1[0x45] == 0) && (piVar1 = (int *)param_1[0x48], piVar1 != (int *)0x0)) {

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

    param_1[0x48] = 0;

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

      _DAT_008f99c4 = _DAT_008f99c4 - param_1[0x14];

    }

  }

  FUN_00446c00();

  FUN_00444580();

  return;

}





// --- FUN_00697090 at 0x00697090 (size: 30) ---


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



{

  FUN_00697030();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006970b0 at 0x006970B0 (size: 15) ---


void __fastcall FUN_006970b0(int param_1)



{

  DAT_008f9a98 = 0;

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

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

  return;

}





// --- FUN_006970c0 at 0x006970C0 (size: 114) ---


void __fastcall FUN_006970c0(int *param_1)



{

  uint uVar1;

  undefined4 *puVar2;

  int iVar3;

  int iVar4;

  undefined4 *puVar5;

  undefined4 *puVar6;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar1 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(uVar1 - 1)) {

        puVar2 = (undefined4 *)FUN_0050a140();

        iVar4 = (uVar1 - 1) * 0x18;

        do {

          puVar6 = (undefined4 *)(*param_1 + iVar4);

          iVar4 = iVar4 + -0x18;

          uVar1 = uVar1 - 1;

          puVar5 = puVar2;

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

            *puVar6 = *puVar5;

            puVar5 = puVar5 + 1;

            puVar6 = puVar6 + 1;

          }

        } while (uVar1 != 0);

      }

    }

    return;

  }

  operator_delete__((void *)*param_1);

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_00697140 at 0x00697140 (size: 908) ---


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



bool __fastcall FUN_00697140(int param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  ushort uVar4;

  ushort uVar5;

  undefined4 uVar6;

  float fVar7;

  char cVar8;

  int iVar9;

  undefined4 uVar10;

  int *piVar11;

  uint uVar12;

  int iVar13;

  uint uVar14;

  int *unaff_EBX;

  uint uVar15;

  int iVar16;

  float *pfVar17;

  undefined4 unaff_EDI;

  char cVar18;

  byte bVar19;

  undefined4 uStack_2c;

  int local_28;

  undefined4 uStack_24;

  undefined4 uStack_20;

  int *piStack_1c;

  

  iVar9 = FUN_0044b870(*(undefined4 *)(param_1 + 8));

  if (iVar9 != 0) {

    uVar4 = *(ushort *)(iVar9 + 100);

    *(ushort *)(param_1 + 0x14) = uVar4;

    uVar5 = *(ushort *)(iVar9 + 0x66);

    *(ushort *)(param_1 + 0x16) = uVar5;

    if ((uVar4 < 0x21) && (0x7e < uVar5)) {

      if (uVar4 < 0x20) {

        *(undefined2 *)(param_1 + 0x14) = 0x20;

      }

      if (0x7f < *(ushort *)(param_1 + 0x16)) {

        *(undefined2 *)(param_1 + 0x16) = 0x7f;

      }

      iVar16 = ((uint)*(ushort *)(param_1 + 0x16) - (uint)*(ushort *)(param_1 + 0x14)) + 1;

      local_28 = iVar9;

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

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

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

      *(int *)(param_1 + 0x28) = iVar16;

      uVar10 = thunk_FUN_005df0f5(iVar16 * 0x18);

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

      piVar11 = (int *)(**(code **)(*DAT_00870340 + 0x14))();

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

        uVar10 = 0;

        piStack_1c = piVar11;

        cVar8 = (**(code **)(*piVar11 + 0x58))(0x100,0x100,1,0x15,2);

        if (cVar8 == '\0') {

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

          return false;

        }

        iVar16 = (**(code **)(*piVar11 + 100))(0,0);

        if ((iVar16 == 0) || (piVar1 = (int *)(iVar16 + -0x30), piVar1 == (int *)0x0)) {

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

          return false;

        }

        uStack_2c = 0x3f800000;

        local_28 = 0x3f800000;

        uStack_24 = 0x3f800000;

        uStack_20 = 0;

        FUN_00443040(&uStack_2c);

        uVar6 = *(undefined4 *)(iVar9 + 0x30);

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

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

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

        }

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

          uVar15 = (uint)*(ushort *)(param_1 + 0x14);

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

          piVar11 = unaff_EBX;

          if (uVar15 <= *(ushort *)(param_1 + 0x16)) {

            do {

              uVar12 = FUN_00443550(uVar15);

              if (*(uint *)(param_1 + 0x1c) < (uVar12 & 0xff)) {

                *(uint *)(param_1 + 0x1c) = uVar12 & 0xff;

              }

              uVar15 = uVar15 + 1;

            } while (uVar15 <= *(ushort *)(param_1 + 0x16));

          }

        }

        cVar8 = FUN_004410c0(0);

        if (cVar8 != '\0') {

          cVar8 = FUN_004436a0();

          cVar18 = (char)((uint)uVar10 >> 0x10);

          if (cVar8 != '\0') {

            uVar12 = (uint)*(ushort *)(param_1 + 0x14);

            iVar9 = 0;

            uVar15 = 0;

            if (uVar12 <= *(ushort *)(param_1 + 0x16)) {

              iVar16 = 0;

              do {

                pfVar17 = (float *)(*(int *)(param_1 + 0x24) + iVar16);

                iVar13 = FUN_004434c0(uVar12);

                cVar18 = (char)((uint)uVar10 >> 0x10);

                bVar19 = *(byte *)(iVar13 + 6);

                uVar14 = (uint)bVar19;

                if (0xff < uVar14 + iVar9) {

                  uVar15 = *(int *)(param_1 + 0x18) + 1 + uVar15;

                  if (0xff < uVar15) break;

                  iVar9 = 0;

                }

                FUN_00442d30(iVar9,uVar15,unaff_EDI,uVar12,0xffffffff,0x100,0xff000000);

                cVar18 = (char)((uint)uVar10 >> 0x10);

                fVar7 = (float)iVar9;

                iVar2 = *(int *)(param_1 + 0x18) + -1 + uVar15;

                if (iVar9 < 0) {

                  fVar7 = fVar7 + _DAT_0079920c;

                }

                *pfVar17 = fVar7 * _DAT_007e75f8;

                fVar7 = (float)(int)uVar15;

                if ((int)uVar15 < 0) {

                  fVar7 = fVar7 + _DAT_0079920c;

                }

                iVar3 = (uVar14 - 1) + iVar9;

                pfVar17[1] = fVar7 * _DAT_007e75f8;

                fVar7 = (float)iVar3;

                if (iVar3 < 0) {

                  fVar7 = fVar7 + _DAT_0079920c;

                }

                pfVar17[2] = (fVar7 + _DAT_007938b0) * _DAT_007e75f8;

                fVar7 = (float)iVar2;

                if (iVar2 < 0) {

                  fVar7 = fVar7 + _DAT_0079920c;

                }

                fVar7 = fVar7 + _DAT_007938b0;

                *(byte *)(pfVar17 + 4) = bVar19;

                iVar9 = uVar14 + 1 + iVar9;

                pfVar17[3] = fVar7 * _DAT_007e75f8;

                *(undefined1 *)((int)pfVar17 + 0x12) = *(undefined1 *)(iVar13 + 8);

                *(undefined1 *)((int)pfVar17 + 0x13) = *(undefined1 *)(iVar13 + 9);

                *(undefined1 *)((int)pfVar17 + 0x11) = *(undefined1 *)(param_1 + 0x18);

                *(undefined1 *)(pfVar17 + 5) = *(undefined1 *)(iVar13 + 10);

                iVar16 = iVar16 + 0x18;

                uVar12 = uVar12 + 1;

              } while (uVar12 <= *(ushort *)(param_1 + 0x16));

            }

            FUN_004411d0();

            FUN_004436e0();

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

            cVar8 = (**(code **)(**(int **)(param_1 + 0xc) + 0x60))(unaff_EBX);

            if (cVar8 != '\0') {

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

              return cVar18 != '\0';

            }

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

            return false;

          }

        }

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

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

      }

    }

  }

  return false;

}





// --- FUN_006974d0 at 0x006974D0 (size: 203) ---


void __fastcall FUN_006974d0(int param_1)



{

  char cVar1;

  

  if ((*(char *)(*(int *)(param_1 + 0xc) + 0x38) != '\0') && (cVar1 = FUN_00697140(), cVar1 == '\0')

     ) {

    return;

  }

  if (DAT_008f9a98 != 0) {

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

      *(undefined4 *)(**(int **)(**(int **)(*(int *)(param_1 + 0x10) + 0x78) + 0x1c) + 0x1c) = 1;

      *(undefined4 *)(**(int **)(**(int **)(*(int *)(param_1 + 0x10) + 0x78) + 0x1c) + 0x20) = 1;

    }

    else {

      *(undefined4 *)(**(int **)(**(int **)(*(int *)(param_1 + 0x10) + 0x78) + 0x1c) + 0x1c) = 2;

      *(undefined4 *)(**(int **)(**(int **)(*(int *)(param_1 + 0x10) + 0x78) + 0x1c) + 0x20) = 2;

    }

    FUN_0043e640();

    FUN_0043f5d0();

    FUN_005a26d0(4,DAT_008f9a98 / 3,DAT_008f9a90,0x142,*(undefined4 *)(param_1 + 0x10),

                 *(undefined4 *)(param_1 + 0x10),&DAT_00835788);

    DAT_008f9a98 = 0;

    FUN_0043f700();

  }

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

  return;

}





// --- FUN_006975a0 at 0x006975A0 (size: 162) ---


int __thiscall FUN_006975a0(int param_1,char *param_2,uint param_3)



{

  char *pcVar1;

  char cVar2;

  char *pcVar3;

  int iVar4;

  uint uVar5;

  int local_c;

  

  pcVar1 = param_2 + 1;

  pcVar3 = param_2;

  do {

    cVar2 = *pcVar3;

    pcVar3 = pcVar3 + 1;

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

  if (pcVar3 != pcVar1) {

    uVar5 = 0;

    local_c = 0;

    if (pcVar3 != pcVar1) {

      do {

        iVar4 = *(int *)(param_1 + 0x24) +

                ((uint)(ushort)(short)param_2[uVar5] - (uint)*(ushort *)(param_1 + 0x14) & 0xffff) *

                0x18;

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

          iVar4 = (int)*(char *)(iVar4 + 0x13) + (int)*(char *)(iVar4 + 0x12) +

                  (uint)*(byte *)(iVar4 + 0x10);

        }

        else {

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

        }

        local_c = local_c + iVar4;

        uVar5 = uVar5 + 1;

      } while (uVar5 < (uint)((int)pcVar3 - (int)pcVar1));

    }

    return local_c;

  }

  return 0;

}





// --- FUN_00697650 at 0x00697650 (size: 192) ---


undefined4 __thiscall FUN_00697650(int *param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined4 *puVar5;

  undefined4 *puVar6;

  

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

    return 0;

  }

  if ((param_1[1] & 0x7fffffffU) < param_2) {

    if (param_2 == 0) {

      FUN_006970c0();

      return 1;

    }

    iVar1 = thunk_FUN_005df0f5(param_2 * 0x18);

    if (iVar1 == 0) {

      return 0;

    }

    FUN_00401000(iVar1,0x18,param_2,FUN_0050a140);

    if (*param_1 != 0) {

      iVar4 = param_1[2];

      if (-1 < iVar4 + -1) {

        iVar2 = (iVar4 + -1) * 0x18;

        do {

          puVar5 = (undefined4 *)(*param_1 + iVar2);

          puVar6 = (undefined4 *)(iVar2 + iVar1);

          iVar2 = iVar2 + -0x18;

          iVar4 = iVar4 + -1;

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

            *puVar6 = *puVar5;

            puVar5 = puVar5 + 1;

            puVar6 = puVar6 + 1;

          }

        } while (iVar4 != 0);

      }

      if ((param_1[1] & 0x80000000U) == 0x80000000) {

        operator_delete__((void *)*param_1);

      }

    }

    *param_1 = iVar1;

    param_1[1] = param_2 | 0x80000000;

  }

  return 1;

}





// --- FUN_00697710 at 0x00697710 (size: 90) ---


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



{

  *param_1 = &PTR_FUN_00801b54;

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

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

    param_1[3] = 0;

  }

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

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

    param_1[4] = 0;

  }

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

  param_1[9] = 0;

  param_1[10] = 0;

  *param_1 = &PTR_LAB_00796c4c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00697770 at 0x00697770 (size: 3002) ---


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



void __thiscall

FUN_00697770(int param_1,float param_2,float param_3,float param_4,char *param_5,float param_6,

            uint param_7)



{

  float *pfVar1;

  byte bVar2;

  byte bVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float fVar7;

  float fVar8;

  float fVar9;

  char cVar10;

  char *pcVar11;

  int iVar12;

  undefined4 uVar13;

  uint uVar14;

  int iVar15;

  int iVar16;

  int iVar17;

  uint uVar18;

  float *pfVar19;

  int local_30;

  int local_2c;

  int local_28;

  float local_20;

  float local_1c;

  char *local_18;

  char *local_10;

  

  pcVar11 = param_5;

  do {

    cVar10 = *pcVar11;

    pcVar11 = pcVar11 + 1;

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

  pcVar11 = pcVar11 + -(int)(param_5 + 1);

  if (pcVar11 == (char *)0x0) {

    return;

  }

  local_20 = param_2;

  local_1c = param_3;

  if ((param_7 & 8) == 0) {

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

      iVar12 = FUN_006975a0(param_5,param_7);

      fVar4 = (float)iVar12;

      if (iVar12 < 0) {

        fVar4 = fVar4 + _DAT_0079920c;

      }

      local_20 = fVar4 * param_4 * _DAT_007938b8;

      goto LAB_006977fe;

    }

  }

  else {

    iVar12 = FUN_006975a0(param_5,param_7);

    local_20 = (float)iVar12;

    if (iVar12 < 0) {

      local_20 = local_20 + _DAT_0079920c;

    }

    local_20 = local_20 * param_4;

LAB_006977fe:

    local_20 = param_2 - local_20;

  }

  uVar18 = DAT_008f9a98;

  if ((param_7 & 0x40) == 0) {

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

      fVar4 = (float)*(int *)(param_1 + 0x18);

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

        fVar4 = fVar4 + _DAT_0079920c;

      }

      local_1c = fVar4 * param_4 * _DAT_007938b8;

      goto LAB_00697842;

    }

  }

  else {

    local_1c = (float)*(int *)(param_1 + 0x18);

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

      local_1c = local_1c + _DAT_0079920c;

    }

    local_1c = local_1c * param_4;

LAB_00697842:

    local_1c = param_3 - local_1c;

  }

  fVar4 = (float)*(int *)(DAT_00870340 + 0x94);

  if (*(int *)(DAT_00870340 + 0x94) < 0) {

    fVar4 = fVar4 + _DAT_0079920c;

  }

  fVar4 = _DAT_007938b0 / fVar4;

  fVar5 = (float)*(int *)(DAT_00870340 + 0x98);

  if (*(int *)(DAT_00870340 + 0x98) < 0) {

    fVar5 = fVar5 + _DAT_0079920c;

  }

  fVar5 = _DAT_007938b0 / fVar5;

  uVar14 = DAT_008f9a98 + (int)pcVar11 * 6;

  if ((DAT_008f9a94 & 0x7fffffff) < uVar14) {

    uVar13 = FUN_00453850(uVar14);

    cVar10 = FUN_00697650(uVar13);

    if (cVar10 == '\0') goto LAB_006978d2;

  }

  DAT_008f9a98 = uVar14;

LAB_006978d2:

  iVar12 = 0;

  local_28 = 0;

  local_10 = (char *)0x0;

  if (3 < (int)pcVar11) {

    uVar14 = param_7 & 1;

    local_18 = param_5 + 1;

    iVar15 = uVar18 * 0x18;

    do {

      pfVar1 = (float *)(*(int *)(param_1 + 0x24) +

                        (uint)(ushort)((short)local_18[-1] - *(short *)(param_1 + 0x14)) * 0x18);

      local_30 = 0;

      if (uVar14 == 0) {

        local_2c = (uint)*(byte *)(pfVar1 + 4) +

                   (int)*(char *)((int)pfVar1 + 0x12) + (int)*(char *)((int)pfVar1 + 0x13);

        local_30 = (int)*(char *)(pfVar1 + 5);

        iVar12 = (int)*(char *)((int)pfVar1 + 0x12);

      }

      else {

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

        iVar12 = 0;

      }

      bVar2 = *(byte *)(pfVar1 + 4);

      bVar3 = *(byte *)((int)pfVar1 + 0x11);

      fVar6 = (float)(iVar12 + local_28) * param_4 + local_20;

      fVar7 = fVar6 * fVar4;

      fVar7 = ((fVar7 + fVar7) - _DAT_007938b0) - fVar4;

      pfVar19 = (float *)(DAT_008f9a90 + iVar15);

      pfVar19[2] = 0.0;

      pfVar19[3] = param_6;

      fVar6 = ((float)(int)(bVar2 - 1) * param_4 + fVar6) * fVar4;

      fVar6 = ((fVar6 + fVar6) - _DAT_007938b0) + fVar4;

      fVar8 = (float)local_30 * param_4 + local_1c;

      fVar9 = fVar5 * fVar8;

      fVar9 = -(((fVar9 + fVar9) - _DAT_007938b0) - fVar5);

      pfVar19[1] = fVar9;

      fVar8 = ((float)(int)(bVar3 - 1) * param_4 + fVar8) * fVar5;

      fVar8 = -(((fVar8 + fVar8) - _DAT_007938b0) + fVar5);

      *pfVar19 = fVar7;

      pfVar19[4] = *pfVar1;

      pfVar19[5] = pfVar1[1];

      iVar12 = DAT_008f9a90;

      *(float *)(DAT_008f9a90 + iVar15 + 0x18) = fVar7;

      iVar12 = iVar12 + iVar15 + 0x18;

      *(float *)(iVar12 + 4) = fVar8;

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

      *(float *)(iVar12 + 0xc) = param_6;

      *(float *)(iVar12 + 0x10) = *pfVar1;

      *(float *)(iVar12 + 0x14) = pfVar1[3];

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x30);

      iVar16 = iVar15 + 0x48;

      pfVar19[2] = 0.0;

      *pfVar19 = fVar6;

      pfVar19[3] = param_6;

      local_30 = 0;

      pfVar19[1] = fVar8;

      pfVar19[4] = pfVar1[2];

      pfVar19[5] = pfVar1[3];

      iVar12 = DAT_008f9a90;

      *(float *)(DAT_008f9a90 + iVar16) = fVar6;

      *(undefined4 *)(iVar12 + 8 + iVar16) = 0;

      *(float *)(iVar12 + 4 + iVar16) = fVar8;

      *(float *)(iVar12 + 0xc + iVar16) = param_6;

      *(float *)(iVar12 + 0x10 + iVar16) = pfVar1[2];

      *(float *)(iVar12 + iVar16 + 0x14) = pfVar1[3];

      iVar12 = DAT_008f9a90;

      iVar16 = iVar15 + 0x60;

      *(float *)(DAT_008f9a90 + 4 + iVar16) = fVar9;

      *(float *)(iVar12 + iVar16) = fVar6;

      iVar12 = iVar12 + iVar16;

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

      *(float *)(iVar12 + 0xc) = param_6;

      *(float *)(iVar12 + 0x10) = pfVar1[2];

      *(float *)(iVar12 + 0x14) = pfVar1[1];

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x78);

      pfVar19[1] = fVar9;

      *pfVar19 = fVar7;

      pfVar19[2] = 0.0;

      pfVar19[3] = param_6;

      pfVar19[4] = *pfVar1;

      pfVar19[5] = pfVar1[1];

      local_28 = local_28 + local_2c;

      pfVar1 = (float *)(*(int *)(param_1 + 0x24) +

                        (uint)(ushort)((short)*local_18 - *(short *)(param_1 + 0x14)) * 0x18);

      iVar12 = 0;

      if (uVar14 == 0) {

        local_2c = (uint)*(byte *)(pfVar1 + 4) +

                   (int)*(char *)((int)pfVar1 + 0x12) + (int)*(char *)((int)pfVar1 + 0x13);

        iVar12 = (int)*(char *)((int)pfVar1 + 0x12);

        local_30 = (int)*(char *)(pfVar1 + 5);

      }

      else {

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

      }

      bVar2 = *(byte *)(pfVar1 + 4);

      bVar3 = *(byte *)((int)pfVar1 + 0x11);

      fVar6 = (float)(iVar12 + local_28) * param_4 + local_20;

      fVar7 = fVar6 * fVar4;

      fVar7 = ((fVar7 + fVar7) - _DAT_007938b0) - fVar4;

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x90);

      pfVar19[2] = 0.0;

      pfVar19[3] = param_6;

      fVar6 = ((float)(int)(bVar2 - 1) * param_4 + fVar6) * fVar4;

      fVar6 = ((fVar6 + fVar6) - _DAT_007938b0) + fVar4;

      fVar8 = (float)local_30 * param_4 + local_1c;

      fVar9 = fVar5 * fVar8;

      fVar9 = -(((fVar9 + fVar9) - _DAT_007938b0) - fVar5);

      pfVar19[1] = fVar9;

      fVar8 = ((float)(int)(bVar3 - 1) * param_4 + fVar8) * fVar5;

      fVar8 = -(((fVar8 + fVar8) - _DAT_007938b0) + fVar5);

      *pfVar19 = fVar7;

      pfVar19[4] = *pfVar1;

      pfVar19[5] = pfVar1[1];

      iVar12 = DAT_008f9a90;

      *(float *)(DAT_008f9a90 + iVar15 + 0xa8) = fVar7;

      iVar12 = iVar12 + iVar15 + 0xa8;

      *(float *)(iVar12 + 4) = fVar8;

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

      *(float *)(iVar12 + 0xc) = param_6;

      *(float *)(iVar12 + 0x10) = *pfVar1;

      *(float *)(iVar12 + 0x14) = pfVar1[3];

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0xc0);

      pfVar19[2] = 0.0;

      *pfVar19 = fVar6;

      pfVar19[3] = param_6;

      iVar16 = iVar15 + 0xd8;

      pfVar19[1] = fVar8;

      pfVar19[4] = pfVar1[2];

      pfVar19[5] = pfVar1[3];

      iVar12 = DAT_008f9a90;

      *(float *)(DAT_008f9a90 + iVar16) = fVar6;

      *(undefined4 *)(iVar12 + 8 + iVar16) = 0;

      *(float *)(iVar12 + 4 + iVar16) = fVar8;

      *(float *)(iVar12 + 0xc + iVar16) = param_6;

      *(float *)(iVar12 + 0x10 + iVar16) = pfVar1[2];

      *(float *)(iVar12 + iVar16 + 0x14) = pfVar1[3];

      iVar12 = DAT_008f9a90;

      iVar16 = iVar15 + 0xf0;

      *(float *)(DAT_008f9a90 + 4 + iVar16) = fVar9;

      *(float *)(iVar12 + iVar16) = fVar6;

      iVar12 = iVar12 + iVar16;

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

      *(float *)(iVar12 + 0xc) = param_6;

      *(float *)(iVar12 + 0x10) = pfVar1[2];

      *(float *)(iVar12 + 0x14) = pfVar1[1];

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x108);

      pfVar19[1] = fVar9;

      *pfVar19 = fVar7;

      pfVar19[2] = 0.0;

      pfVar19[3] = param_6;

      pfVar19[4] = *pfVar1;

      pfVar19[5] = pfVar1[1];

      local_28 = local_28 + local_2c;

      pfVar1 = (float *)(*(int *)(param_1 + 0x24) +

                        (uint)(ushort)((short)local_18[1] - *(short *)(param_1 + 0x14)) * 0x18);

      iVar12 = 0;

      local_30 = 0;

      if (uVar14 == 0) {

        local_2c = (uint)*(byte *)(pfVar1 + 4) +

                   (int)*(char *)((int)pfVar1 + 0x12) + (int)*(char *)((int)pfVar1 + 0x13);

        iVar12 = (int)*(char *)((int)pfVar1 + 0x12);

        local_30 = (int)*(char *)(pfVar1 + 5);

      }

      else {

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

      }

      bVar2 = *(byte *)(pfVar1 + 4);

      bVar3 = *(byte *)((int)pfVar1 + 0x11);

      fVar6 = (float)(iVar12 + local_28) * param_4 + local_20;

      fVar7 = fVar6 * fVar4;

      fVar7 = ((fVar7 + fVar7) - _DAT_007938b0) - fVar4;

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x120);

      pfVar19[2] = 0.0;

      pfVar19[3] = param_6;

      fVar6 = ((float)(int)(bVar2 - 1) * param_4 + fVar6) * fVar4;

      fVar6 = ((fVar6 + fVar6) - _DAT_007938b0) + fVar4;

      fVar8 = (float)local_30 * param_4 + local_1c;

      fVar9 = fVar5 * fVar8;

      fVar9 = -(((fVar9 + fVar9) - _DAT_007938b0) - fVar5);

      pfVar19[1] = fVar9;

      fVar8 = ((float)(int)(bVar3 - 1) * param_4 + fVar8) * fVar5;

      fVar8 = -(((fVar8 + fVar8) - _DAT_007938b0) + fVar5);

      *pfVar19 = fVar7;

      pfVar19[4] = *pfVar1;

      pfVar19[5] = pfVar1[1];

      iVar12 = DAT_008f9a90;

      *(float *)(DAT_008f9a90 + iVar15 + 0x138) = fVar7;

      iVar12 = iVar12 + iVar15 + 0x138;

      *(float *)(iVar12 + 4) = fVar8;

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

      *(float *)(iVar12 + 0xc) = param_6;

      *(float *)(iVar12 + 0x10) = *pfVar1;

      *(float *)(iVar12 + 0x14) = pfVar1[3];

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x150);

      pfVar19[2] = 0.0;

      *pfVar19 = fVar6;

      pfVar19[3] = param_6;

      iVar16 = iVar15 + 0x168;

      pfVar19[1] = fVar8;

      pfVar19[4] = pfVar1[2];

      pfVar19[5] = pfVar1[3];

      iVar12 = DAT_008f9a90;

      *(float *)(DAT_008f9a90 + iVar16) = fVar6;

      *(undefined4 *)(iVar12 + 8 + iVar16) = 0;

      *(float *)(iVar12 + 4 + iVar16) = fVar8;

      *(float *)(iVar12 + 0xc + iVar16) = param_6;

      *(float *)(iVar12 + 0x10 + iVar16) = pfVar1[2];

      *(float *)(iVar12 + iVar16 + 0x14) = pfVar1[3];

      iVar12 = DAT_008f9a90;

      iVar16 = iVar15 + 0x180;

      *(float *)(DAT_008f9a90 + 4 + iVar16) = fVar9;

      *(float *)(iVar12 + iVar16) = fVar6;

      iVar12 = iVar12 + iVar16;

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

      *(float *)(iVar12 + 0xc) = param_6;

      *(float *)(iVar12 + 0x10) = pfVar1[2];

      *(float *)(iVar12 + 0x14) = pfVar1[1];

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x198);

      pfVar19[1] = fVar9;

      *pfVar19 = fVar7;

      pfVar19[2] = 0.0;

      pfVar19[3] = param_6;

      pfVar19[4] = *pfVar1;

      pfVar19[5] = pfVar1[1];

      local_28 = local_28 + local_2c;

      pfVar1 = (float *)(*(int *)(param_1 + 0x24) +

                        (uint)(ushort)((short)local_18[2] - *(short *)(param_1 + 0x14)) * 0x18);

      iVar12 = 0;

      local_30 = 0;

      if (uVar14 == 0) {

        local_2c = (uint)*(byte *)(pfVar1 + 4) +

                   (int)*(char *)((int)pfVar1 + 0x12) + (int)*(char *)((int)pfVar1 + 0x13);

        iVar12 = (int)*(char *)((int)pfVar1 + 0x12);

        local_30 = (int)*(char *)(pfVar1 + 5);

      }

      else {

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

      }

      bVar2 = *(byte *)(pfVar1 + 4);

      bVar3 = *(byte *)((int)pfVar1 + 0x11);

      fVar6 = (float)(iVar12 + local_28) * param_4 + local_20;

      fVar7 = fVar6 * fVar4;

      fVar7 = ((fVar7 + fVar7) - _DAT_007938b0) - fVar4;

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x1b0);

      pfVar19[2] = 0.0;

      pfVar19[3] = param_6;

      fVar6 = ((float)(int)(bVar2 - 1) * param_4 + fVar6) * fVar4;

      fVar6 = ((fVar6 + fVar6) - _DAT_007938b0) + fVar4;

      fVar8 = (float)local_30 * param_4 + local_1c;

      fVar9 = fVar5 * fVar8;

      fVar9 = -(((fVar9 + fVar9) - _DAT_007938b0) - fVar5);

      pfVar19[1] = fVar9;

      fVar8 = ((float)(int)(bVar3 - 1) * param_4 + fVar8) * fVar5;

      fVar8 = -(((fVar8 + fVar8) - _DAT_007938b0) + fVar5);

      *pfVar19 = fVar7;

      pfVar19[4] = *pfVar1;

      pfVar19[5] = pfVar1[1];

      iVar12 = DAT_008f9a90;

      *(float *)(DAT_008f9a90 + iVar15 + 0x1c8) = fVar7;

      iVar12 = iVar12 + iVar15 + 0x1c8;

      *(float *)(iVar12 + 4) = fVar8;

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

      *(float *)(iVar12 + 0xc) = param_6;

      *(float *)(iVar12 + 0x10) = *pfVar1;

      *(float *)(iVar12 + 0x14) = pfVar1[3];

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x1e0);

      pfVar19[2] = 0.0;

      *pfVar19 = fVar6;

      pfVar19[3] = param_6;

      pfVar19[1] = fVar8;

      pfVar19[4] = pfVar1[2];

      pfVar19[5] = pfVar1[3];

      iVar12 = DAT_008f9a90;

      *(float *)(DAT_008f9a90 + iVar15 + 0x1f8) = fVar6;

      iVar12 = iVar12 + iVar15 + 0x1f8;

      *(float *)(iVar12 + 4) = fVar8;

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

      *(float *)(iVar12 + 0xc) = param_6;

      *(float *)(iVar12 + 0x10) = pfVar1[2];

      *(float *)(iVar12 + 0x14) = pfVar1[3];

      iVar12 = DAT_008f9a90;

      iVar16 = iVar15 + 0x210;

      *(float *)(DAT_008f9a90 + 4 + iVar16) = fVar9;

      *(float *)(iVar12 + iVar16) = fVar6;

      iVar12 = iVar12 + iVar16;

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

      *(float *)(iVar12 + 0xc) = param_6;

      *(float *)(iVar12 + 0x10) = pfVar1[2];

      *(float *)(iVar12 + 0x14) = pfVar1[1];

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x228);

      pfVar19[1] = fVar9;

      *pfVar19 = fVar7;

      pfVar19[2] = 0.0;

      pfVar19[3] = param_6;

      pfVar19[4] = *pfVar1;

      pfVar19[5] = pfVar1[1];

      local_10 = local_10 + 4;

      iVar12 = local_28 + local_2c;

      local_18 = local_18 + 4;

      uVar18 = uVar18 + 0x18;

      iVar15 = iVar15 + 0x240;

      local_28 = iVar12;

    } while (local_18 + (2 - (int)param_5) < pcVar11);

  }

  if (local_10 < pcVar11) {

    iVar15 = uVar18 * 0x18;

    do {

      iVar16 = DAT_008f9a90;

      pfVar1 = (float *)(*(int *)(param_1 + 0x24) +

                        (uint)(ushort)((short)param_5[(int)local_10] - *(short *)(param_1 + 0x14)) *

                        0x18);

      iVar17 = 0;

      local_30 = 0;

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

        local_2c = (uint)*(byte *)(pfVar1 + 4) +

                   (int)*(char *)((int)pfVar1 + 0x12) + (int)*(char *)((int)pfVar1 + 0x13);

        local_30 = (int)*(char *)(pfVar1 + 5);

        iVar17 = (int)*(char *)((int)pfVar1 + 0x12);

      }

      else {

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

      }

      bVar2 = *(byte *)(pfVar1 + 4);

      bVar3 = *(byte *)((int)pfVar1 + 0x11);

      fVar6 = (float)(iVar17 + iVar12) * param_4 + local_20;

      fVar7 = fVar6 * fVar4;

      fVar7 = ((fVar7 + fVar7) - _DAT_007938b0) - fVar4;

      *(undefined4 *)(DAT_008f9a90 + 8 + iVar15) = 0;

      *(float *)(iVar16 + 0xc + iVar15) = param_6;

      pfVar19 = (float *)(iVar16 + iVar15);

      fVar6 = ((float)(int)(bVar2 - 1) * param_4 + fVar6) * fVar4;

      fVar6 = ((fVar6 + fVar6) - _DAT_007938b0) + fVar4;

      fVar8 = (float)local_30 * param_4 + local_1c;

      fVar9 = fVar5 * fVar8;

      fVar9 = -(((fVar9 + fVar9) - _DAT_007938b0) - fVar5);

      pfVar19[1] = fVar9;

      fVar8 = ((float)(int)(bVar3 - 1) * param_4 + fVar8) * fVar5;

      fVar8 = -(((fVar8 + fVar8) - _DAT_007938b0) + fVar5);

      *pfVar19 = fVar7;

      pfVar19[4] = *pfVar1;

      pfVar19[5] = pfVar1[1];

      iVar16 = DAT_008f9a90;

      *(float *)(DAT_008f9a90 + iVar15 + 0x18) = fVar7;

      iVar16 = iVar16 + iVar15 + 0x18;

      *(float *)(iVar16 + 4) = fVar8;

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

      *(float *)(iVar16 + 0xc) = param_6;

      *(float *)(iVar16 + 0x10) = *pfVar1;

      *(float *)(iVar16 + 0x14) = pfVar1[3];

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x30);

      *pfVar19 = fVar6;

      iVar17 = iVar15 + 0x48;

      pfVar19[1] = fVar8;

      pfVar19[2] = 0.0;

      pfVar19[3] = param_6;

      pfVar19[4] = pfVar1[2];

      pfVar19[5] = pfVar1[3];

      iVar16 = DAT_008f9a90;

      *(float *)(DAT_008f9a90 + iVar17) = fVar6;

      *(undefined4 *)(iVar16 + 8 + iVar17) = 0;

      *(float *)(iVar16 + 4 + iVar17) = fVar8;

      *(float *)(iVar16 + 0xc + iVar17) = param_6;

      *(float *)(iVar16 + 0x10 + iVar17) = pfVar1[2];

      *(float *)(iVar16 + iVar17 + 0x14) = pfVar1[3];

      iVar16 = DAT_008f9a90;

      iVar17 = iVar15 + 0x60;

      *(float *)(DAT_008f9a90 + 4 + iVar17) = fVar9;

      *(float *)(iVar16 + iVar17) = fVar6;

      iVar16 = iVar16 + iVar17;

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

      *(float *)(iVar16 + 0xc) = param_6;

      *(float *)(iVar16 + 0x10) = pfVar1[2];

      *(float *)(iVar16 + 0x14) = pfVar1[1];

      pfVar19 = (float *)(DAT_008f9a90 + iVar15 + 0x78);

      pfVar19[1] = fVar9;

      *pfVar19 = fVar7;

      pfVar19[2] = 0.0;

      pfVar19[3] = param_6;

      pfVar19[4] = *pfVar1;

      iVar12 = iVar12 + local_2c;

      iVar15 = iVar15 + 0x90;

      pfVar19[5] = pfVar1[1];

      local_10 = local_10 + 1;

    } while (local_10 < pcVar11);

  }

  if (ABS(param_4) < _DAT_00801b50 == (ABS(param_4) == _DAT_00801b50)) {

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

  }

  return;

}





// --- FUN_00698330 at 0x00698330 (size: 46) ---


void FUN_00698330(int param_1,int param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5)



{

  FUN_00697770((float)param_1,(float)param_2,0x3f800000,param_3,param_4,param_5);

  return;

}





// --- FUN_00698360 at 0x00698360 (size: 395) ---


bool __fastcall FUN_00698360(int param_1)



{

  char cVar1;

  int iVar2;

  uint *puVar3;

  int *piVar4;

  undefined4 unaff_EDI;

  

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

  iVar2 = (**(code **)(*DAT_00870340 + 0x14))();

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

  if (iVar2 == 0) {

    return false;

  }

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

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

    iVar2 = FUN_005df0f5(0x4e0);

    if (iVar2 == 0) {

      iVar2 = 0;

    }

    else {

      iVar2 = FUN_004497e0();

    }

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

    if (iVar2 == 0) {

      return false;

    }

    iVar2 = FUN_005df0f5(0xd8);

    if (iVar2 == 0) {

      return false;

    }

    puVar3 = (uint *)FUN_0044aa40();

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

      return false;

    }

    iVar2 = FUN_005df0f5(0x48);

    if (iVar2 == 0) {

      return false;

    }

    iVar2 = FUN_00448350();

    if (iVar2 == 0) {

      return false;

    }

    FUN_0043ffa0(puVar3[9],iVar2);

    FUN_0043ffc0(*(undefined4 *)(*(int *)(param_1 + 0x10) + 0x80),puVar3);

    *puVar3 = *puVar3 | 0x20;

    puVar3[0xd] = 5;

    puVar3[0xe] = 6;

    *(undefined1 *)(puVar3 + 0x11) = 0;

    puVar3[0x10] = 8;

    puVar3[0x12] = 1;

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

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

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

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

    *(undefined4 *)(iVar2 + 0x18) = 3;

    *(undefined4 *)(iVar2 + 0x28) = 3;

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

    *(undefined4 *)(iVar2 + 0x2c) = 2;

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

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

    *(undefined4 *)(iVar2 + 0x38) = 2;

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

    FUN_004494e0();

  }

  cVar1 = (**(code **)(**(int **)(param_1 + 0xc) + 0x58))(0x100,0x100,1,0x15,0);

  if (cVar1 == '\0') {

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

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

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

    }

  }

  else {

    piVar4 = (int *)FUN_00415640(&stack0xfffffff0,unaff_EDI,9);

    iVar2 = *piVar4;

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

    if (iVar2 != DAT_008f9a58) {

      cVar1 = FUN_00697140();

      return cVar1 != '\0';

    }

  }

  return false;

}





// --- FUN_006984f0 at 0x006984F0 (size: 143) ---


void FUN_006984f0(undefined4 *param_1,undefined4 param_2,int *param_3)



{

  int *piVar1;

  char cVar2;

  undefined4 *puVar3;

  

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

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

    puVar3 = (undefined4 *)0x0;

  }

  else {

    puVar3[1] = 1;

    *puVar3 = &PTR_FUN_00801b54;

    puVar3[2] = DAT_008f9a58;

    puVar3[4] = 0;

    *(undefined2 *)(puVar3 + 5) = 0;

    *(undefined2 *)((int)puVar3 + 0x16) = 0;

    puVar3[6] = 0;

    puVar3[7] = 0;

    puVar3[8] = 0;

    puVar3[9] = 0;

    puVar3[10] = 0;

    *(undefined1 *)(puVar3 + 0xb) = 0;

    *(undefined1 *)((int)puVar3 + 0x2d) = 0;

  }

  *param_3 = (int)puVar3;

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

    cVar2 = FUN_00698360(param_2);

    if (cVar2 != '\0') {

      *param_1 = 0;

      return;

    }

    puVar3 = (undefined4 *)*param_3;

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

      piVar1 = puVar3 + 1;

      *piVar1 = *piVar1 + -1;

      if (*piVar1 == 0) {

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

      }

      *param_3 = 0;

    }

  }

  *param_1 = 0x80004005;

  return;

}





// --- FUN_00698580 at 0x00698580 (size: 57) ---


void __fastcall FUN_00698580(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

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

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

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

  for (iVar1 = 0x1d; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

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

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

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

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

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

  return;

}





// --- FUN_006985c0 at 0x006985C0 (size: 85) ---


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



{

  if (param_2 != 0) {

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

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

    FUN_005d97f0();

    *(uint *)(param_1 + 0xa4) = param_4;

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

      FUN_00446be0(CONCAT31((uint3)(param_4 >> 10),~(byte)(param_4 >> 2)) & 0xffffff01);

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

      return 1;

    }

  }

  return 0;

}





// --- FUN_00698620 at 0x00698620 (size: 279) ---


uint __fastcall FUN_00698620(int param_1)



{

  uint uVar1;

  undefined4 uVar2;

  int iVar3;

  undefined1 local_9;

  undefined4 local_8;

  undefined4 local_4;

  

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

  local_8 = 8;

  if (((uVar1 & 1) != 0) || ((uVar1 & 0x10) == 0)) {

    local_8 = 0x208;

  }

  if (((*(uint *)(param_1 + 0x30) & 0x20) != 0) || ((uVar1 & 2) != 0)) {

    local_8 = local_8 | 0x40;

    *(uint *)(param_1 + 0xa4) = uVar1 | 2;

  }

  if (*(char *)(DAT_00870340 + 0x4c) == '\0') {

    local_8 = local_8 | 0x10;

  }

  uVar2 = 0;

  if (((*(uint *)(param_1 + 0xa4) & 4) != 0) || (*(char *)(DAT_00870340 + 0x4c) == '\0')) {

    uVar2 = 2;

    *(uint *)(param_1 + 0xa4) = *(uint *)(param_1 + 0xa4) | 4;

  }

  local_4 = 0;

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

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

  }

  iVar3 = *(int *)(param_1 + 0x34) * *(int *)(param_1 + 0x2c);

  local_9 = '\x01';

  while( true ) {

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

                      (*(int **)(DAT_00870340 + 0x468),iVar3,local_8,local_4,uVar2,param_1 + 0x28,0)

    ;

    if (uVar1 == 0) {

      FUN_00446bd0(iVar3);

      FUN_00446c00();

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

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

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

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

    }

    if ((uVar1 != 0x8876017c) || (uVar1 = CONCAT31(0x887601,local_9), local_9 == '\0')) break;

    local_9 = FUN_004473d0(iVar3);

  }

  return uVar1 & 0xffffff00;

}





// --- FUN_00698740 at 0x00698740 (size: 78) ---


int __fastcall FUN_00698740(int *param_1)



{

  int iVar1;

  char cVar2;

  

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

    cVar2 = (**(code **)(*param_1 + 0xc))();

    if (cVar2 == '\0') {

      return 0;

    }

  }

  iVar1 = DAT_008379b4;

  param_1[4] = DAT_008379b0;

  param_1[5] = iVar1;

  if (DAT_00870340 != 0) {

    param_1[6] = *(int *)(DAT_00870340 + 0xb0);

  }

  if (param_1[10] == 0) {

    FUN_00698620();

  }

  return param_1[10];

}





// --- FUN_00698790 at 0x00698790 (size: 381) ---


uint __thiscall FUN_00698790(int param_1,uint param_2,uint param_3)



{

  undefined4 uVar1;

  bool bVar2;

  int *piVar3;

  uint uVar4;

  int iVar5;

  uint uVar6;

  undefined4 *unaff_retaddr;

  undefined4 local_c;

  uint local_8;

  int *local_4;

  

  piVar3 = (int *)FUN_00698740();

  uVar4 = 0;

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

    local_8 = *(uint *)(param_1 + 0xa4) & 1;

    uVar6 = 0x800;

    if (local_8 == 0) {

      *(uint *)(param_1 + 0xa8) = param_2;

      uVar4 = param_2;

    }

    else {

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

      *(uint *)(param_1 + 0xac) = *(int *)(param_1 + 0xac) + param_3;

      if (uVar4 < param_3) goto LAB_00698901;

      if (uVar4 < *(int *)(param_1 + 0xa8) + param_3) {

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

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

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

      }

      uVar6 = (-(uint)(*(int *)(param_1 + 0xa8) != 0) & 0xfffff000) + 0x2800;

    }

    if (param_3 + *(int *)(param_1 + 0xa8) <= *(uint *)(param_1 + 0x2c)) {

      iVar5 = *(int *)(param_1 + 0x34) * *(int *)(param_1 + 0xa8);

      if ((iVar5 == 0) && (param_3 == *(uint *)(param_1 + 0x2c))) {

        bVar2 = true;

      }

      else {

        bVar2 = false;

      }

      local_c = 0;

      if ((local_8 == 0) && (*(int *)(param_1 + 0xb4) != 0)) {

        if (bVar2) {

          uVar6 = uVar6 | 0x2000;

        }

        else {

          uVar6 = uVar6 | 0x1000;

        }

      }

      local_4 = piVar3;

      uVar4 = (**(code **)(*piVar3 + 0x2c))

                        (piVar3,iVar5,bVar2 - 1 & *(int *)(param_1 + 0x34) * param_3,&local_c);

      if ((-1 < (int)uVar4) && (uVar4 = 0, uVar6 != 0)) {

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

        FUN_004476d0(local_8,local_4,uVar6,param_1 + 0x30,param_3,unaff_retaddr);

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

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

        *unaff_retaddr = uVar1;

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

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

        }

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

      }

    }

  }

LAB_00698901:

  return uVar4 & 0xffffff00;

}





// --- FUN_00698910 at 0x00698910 (size: 21) ---


void __fastcall FUN_00698910(int param_1)



{

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

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

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

  return;

}





// --- FUN_00698930 at 0x00698930 (size: 71) ---


undefined1 __fastcall FUN_00698930(int param_1)



{

  int *piVar1;

  char cVar2;

  

  cVar2 = FUN_004154a0();

  if (cVar2 == '\0') {

    return 0;

  }

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

    if (DAT_00870340 != 0) {

      FUN_005a15e0(*(int *)(param_1 + 0x28));

    }

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

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

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

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

    }

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

  }

  return 1;

}





// --- FUN_00698990 at 0x00698990 (size: 64) ---


void __fastcall FUN_00698990(int param_1)



{

  int *piVar1;

  

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

    if (DAT_00870340 != 0) {

      FUN_005a15e0(*(int *)(param_1 + 0x28));

    }

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

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

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

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

    }

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

  }

  FUN_00446c00();

  return;

}





// --- FUN_00698a40 at 0x00698A40 (size: 45) ---


undefined4 * __fastcall FUN_00698a40(undefined4 *param_1)



{

  FUN_00447220();

  param_1[10] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  *param_1 = &PTR_FUN_00801b64;

  param_1[0xb] = 2;

  return param_1;

}





// --- FUN_00698a70 at 0x00698A70 (size: 55) ---


undefined4 __thiscall FUN_00698a70(int param_1,int param_2,uint param_3)



{

  if (param_2 != 0) {

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

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

    FUN_00446be0(CONCAT31((uint3)(param_3 >> 9),~(byte)(param_3 >> 1)) & 0xffffff01);

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

    return 1;

  }

  return 0;

}





// --- FUN_00698ab0 at 0x00698AB0 (size: 272) ---


uint __fastcall FUN_00698ab0(int param_1)



{

  uint uVar1;

  undefined4 uVar2;

  int iVar3;

  undefined1 local_9;

  undefined4 local_8;

  undefined4 local_4;

  

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

  local_8 = 8;

  if (((uVar1 & 1) != 0) || ((uVar1 & 4) == 0)) {

    local_8 = 0x208;

  }

  if (*(char *)(DAT_00870340 + 0x4c) == '\0') {

    local_8 = local_8 | 0x10;

  }

  local_4 = 0;

  if (((uVar1 & 2) != 0) || (*(char *)(DAT_00870340 + 0x4c) == '\0')) {

    local_4 = 2;

  }

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

  if ((uVar1 != 2) && (uVar1 != 4)) {

    return uVar1 & 0xffffff00;

  }

  if (uVar1 == 2) {

    uVar2 = 0x65;

  }

  else {

    uVar2 = 0x66;

    if (uVar1 != 4) {

      uVar2 = local_4;

    }

  }

  iVar3 = *(int *)(param_1 + 0x30) * uVar1;

  local_9 = '\x01';

  while( true ) {

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

                      (*(int **)(DAT_00870340 + 0x468),iVar3,local_8,uVar2,local_4,param_1 + 0x34,0)

    ;

    if (uVar1 == 0) {

      FUN_00446bd0(iVar3);

      FUN_00446c00();

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

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

      DAT_008f9b14 = DAT_008f9b14 + iVar3;

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

    }

    if ((uVar1 != 0x8876017c) || (uVar1 = CONCAT31(0x887601,local_9), local_9 == '\0')) break;

    local_9 = FUN_004473d0(iVar3);

  }

  return uVar1 & 0xffffff00;

}





// --- FUN_00698bc0 at 0x00698BC0 (size: 58) ---


undefined1 __fastcall FUN_00698bc0(int param_1)



{

  int *piVar1;

  char cVar2;

  

  cVar2 = FUN_004154a0();

  if (cVar2 == '\0') {

    return 0;

  }

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

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

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

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

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

    DAT_008f9b14 = DAT_008f9b14 - *(int *)(param_1 + 0x30) * *(int *)(param_1 + 0x2c);

  }

  return 1;

}





// --- FUN_00698c00 at 0x00698C00 (size: 78) ---


int __fastcall FUN_00698c00(int *param_1)



{

  int iVar1;

  char cVar2;

  

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

    cVar2 = (**(code **)(*param_1 + 0xc))();

    if (cVar2 == '\0') {

      return 0;

    }

  }

  iVar1 = DAT_008379b4;

  param_1[4] = DAT_008379b0;

  param_1[5] = iVar1;

  if (DAT_00870340 != 0) {

    param_1[6] = *(int *)(DAT_00870340 + 0xb0);

  }

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

    FUN_00698ab0();

  }

  return param_1[0xd];

}





// --- FUN_00698c50 at 0x00698C50 (size: 317) ---


undefined4 __thiscall FUN_00698c50(int param_1,uint param_2)



{

  bool bVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  int unaff_EBP;

  undefined4 *puVar6;

  undefined4 *puVar7;

  undefined4 *local_c;

  uint local_8;

  int local_4;

  

  piVar2 = (int *)FUN_00698c00();

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

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

    puVar6 = (undefined4 *)0x800;

    if (param_2 <= uVar5) {

      local_8 = *(uint *)(param_1 + 0x28) & 1;

      if (local_8 != 0) {

        if (uVar5 < *(int *)(param_1 + 0x3c) + param_2) {

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

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

        }

        puVar6 = (undefined4 *)((-(uint)(*(int *)(param_1 + 0x3c) != 0) & 0xfffff000) + 0x2800);

      }

      if (*(int *)(param_1 + 0x3c) + param_2 <= uVar5) {

        uVar3 = *(int *)(param_1 + 0x2c) * param_2;

        iVar4 = *(int *)(param_1 + 0x2c) * *(int *)(param_1 + 0x3c);

        if ((iVar4 == 0) && (param_2 == uVar5)) {

          bVar1 = true;

        }

        else {

          bVar1 = false;

        }

        local_c = (undefined4 *)0x0;

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

          if (bVar1) {

            puVar6 = (undefined4 *)((uint)puVar6 | 0x2000);

          }

          else {

            puVar6 = (undefined4 *)((uint)puVar6 | 0x1000);

          }

        }

        local_4 = *piVar2;

        iVar4 = (**(code **)(local_4 + 0x2c))(piVar2,iVar4,bVar1 - 1 & uVar3,&local_c);

        if ((-1 < iVar4) && (puVar6 != (undefined4 *)0x0)) {

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

          puVar7 = local_c;

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

            *puVar6 = *puVar7;

            puVar7 = puVar7 + 1;

            puVar6 = puVar6 + 1;

          }

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

            *(undefined1 *)puVar6 = *(undefined1 *)puVar7;

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

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

          }

          (**(code **)(*piVar2 + 0x30))(piVar2);

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

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

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

          }

          return 1;

        }

      }

    }

  }

  return 0;

}





// --- FUN_00698d90 at 0x00698D90 (size: 15) ---


void __fastcall FUN_00698d90(int param_1)



{

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

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

  return;

}





// --- FUN_00698da0 at 0x00698DA0 (size: 85) ---


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



{

  int *piVar1;

  

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

  *param_1 = &PTR_FUN_00801b64;

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

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

    param_1[0xd] = 0;

    param_1[0x10] = 0;

    DAT_008f9b14 = DAT_008f9b14 - param_1[0xc] * param_1[0xb];

  }

  FUN_00446c00();

  FUN_00446f00();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00698e00 at 0x00698E00 (size: 8) ---


void __fastcall FUN_00698e00(int param_1)



{

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

  return;

}





// --- FUN_00698e10 at 0x00698E10 (size: 32) ---


void __fastcall FUN_00698e10(int param_1)



{

  if ((*(char *)(param_1 + 0x14) != '\0') && (*(undefined4 **)(param_1 + 0x28) != (undefined4 *)0x0)

     ) {

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

  }

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

  return;

}





// --- FUN_00698ed0 at 0x00698ED0 (size: 46) ---


void __fastcall FUN_00698ed0(int param_1)



{

  if ((*(char *)(param_1 + 0x14) != '\0') && (*(undefined4 **)(param_1 + 0x28) != (undefined4 *)0x0)

     ) {

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

  }

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

  FUN_0044cb20();

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

  return;

}





// --- FUN_00698f00 at 0x00698F00 (size: 215) ---


undefined4 __fastcall FUN_00698f00(int param_1)



{

  int *piVar1;

  int *piVar2;

  int *piVar3;

  uint uVar4;

  int *piVar5;

  int iVar6;

  int local_4;

  

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

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

  }

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

    local_4 = param_1;

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

      iVar6 = 0;

    }

    else {

      FUN_0044cb90();

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

    }

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

    piVar5 = (int *)0x0;

    if (iVar6 != 0) {

      piVar1 = (int *)thunk_FUN_005df0f5((uint)*(byte *)(param_1 + 0xc) * *(int *)(param_1 + 4));

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

        return 0;

      }

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

      uVar4 = 0;

      piVar5 = piVar1;

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

        piVar2 = piVar1;

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

          do {

            *(short *)piVar2 = (short)*piVar3 - (short)iVar6;

            piVar3 = (int *)((int)piVar3 + 2);

            uVar4 = uVar4 + 1;

            piVar2 = (int *)((int)piVar2 + 2);

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

        }

      }

      else {

        piVar2 = piVar1;

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

          do {

            *piVar2 = *piVar3 - iVar6;

            piVar3 = piVar3 + 1;

            uVar4 = uVar4 + 1;

            piVar2 = piVar2 + 1;

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

        }

      }

    }

    local_4 = 0;

    FUN_00698c50(*(undefined4 *)(param_1 + 4),piVar1,&local_4);

    operator_delete__(piVar5);

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

  }

  return 1;

}





// --- FUN_00699090 at 0x00699090 (size: 81) ---


uint __thiscall FUN_00699090(int *param_1,uint param_2)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  undefined4 local_8;

  undefined4 local_4;

  

  uVar3 = param_1[2];

  if (param_2 < uVar3) {

    uVar1 = uVar3 - 1;

    param_1[2] = uVar1;

    if (param_2 != uVar1) {

      iVar2 = *param_1;

      *(undefined4 *)(iVar2 + param_2 * 8) = *(undefined4 *)(iVar2 + uVar1 * 8);

      *(undefined4 *)(iVar2 + 4 + param_2 * 8) = *(undefined4 *)(iVar2 + 4 + uVar1 * 8);

      uVar3 = param_1[2];

      iVar2 = *param_1;

      *(undefined4 *)(iVar2 + uVar3 * 8) = local_8;

      *(undefined4 *)(iVar2 + 4 + uVar3 * 8) = local_4;

    }

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

  }

  return uVar3 & 0xffffff00;

}





// --- FUN_006990f0 at 0x006990F0 (size: 70) ---


void __fastcall FUN_006990f0(int param_1)



{

  uint uVar1;

  

  uVar1 = 0;

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

    do {

      FUN_005a05a0(uVar1,*(undefined4 *)(*(int *)(param_1 + 0x158) + uVar1 * 4));

      uVar1 = uVar1 + 1;

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

  }

  FUN_005a0610(param_1 + 0xb4);

  return;

}





// --- FUN_00699140 at 0x00699140 (size: 26) ---


void FUN_00699140(void)



{

  FUN_005d8570();

  FUN_0044dcb0();

  return;

}





// --- FUN_00699160 at 0x00699160 (size: 214) ---


void __fastcall FUN_00699160(int param_1)



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  

  uVar3 = 0;

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

    do {

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

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

      }

      else {

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

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

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

        }

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

      }

      uVar3 = uVar3 + 1;

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

  }

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

  if ((*(uint *)(param_1 + 0x15c) & 0x80000000) == 0x80000000) {

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

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

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

    FUN_005d8570();

    return;

  }

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

    iVar2 = (*(uint *)(param_1 + 0x15c) & 0x7fffffff) - 1;

    while (-1 < iVar2) {

      iVar2 = iVar2 + -1;

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

    }

  }

  FUN_005d8570();

  return;

}





// --- thunk_FUN_00699160 at 0x00699240 (size: 5) ---


void __fastcall thunk_FUN_00699160(int param_1)



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  

  uVar3 = 0;

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

    do {

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

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

      }

      else {

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

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

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

        }

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

      }

      uVar3 = uVar3 + 1;

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

  }

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

  if ((*(uint *)(param_1 + 0x15c) & 0x80000000) == 0x80000000) {

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

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

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

    FUN_005d8570();

    return;

  }

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

    iVar2 = (*(uint *)(param_1 + 0x15c) & 0x7fffffff) - 1;

    while (-1 < iVar2) {

      iVar2 = iVar2 + -1;

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

    }

  }

  FUN_005d8570();

  return;

}





// --- FUN_00699250 at 0x00699250 (size: 38) ---


void FUN_00699250(void)



{

  FUN_00699160();

  FUN_00447620();

  FUN_005d8570();

  FUN_0044dcb0();

  return;

}





// --- FUN_00699280 at 0x00699280 (size: 75) ---


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



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  

  if ((param_1[1] & 0x7fffffffU) <= (uint)param_1[2]) {

    uVar3 = FUN_00453850((param_1[1] & 0x7fffffffU) + 1);

    uVar3 = FUN_00459e20(uVar3);

    if ((char)uVar3 == '\0') {

      return uVar3;

    }

  }

  iVar1 = param_1[2];

  iVar2 = *param_1;

  *(undefined4 *)(iVar2 + iVar1 * 8) = *param_2;

  uVar3 = param_2[1];

  *(undefined4 *)(iVar2 + 4 + iVar1 * 8) = uVar3;

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

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

}





// --- FUN_006992d0 at 0x006992D0 (size: 356) ---


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



{

  int *piVar1;

  char cVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  bool bVar6;

  undefined4 local_8;

  undefined4 local_4;

  

  *param_4 = 0;

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

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

      bVar6 = *(char *)(param_1 + 0xac) == '\0';

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

      param_1 = param_1 + 8;

    }

    else {

      bVar6 = false;

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

      param_1 = param_1 + 0xb4;

    }

    cVar2 = FUN_00698790(param_2,param_3,*(int *)(param_1 + 4) * param_2 + iVar4,param_1,bVar6,

                         param_4);

    if (cVar2 == '\0') {

      return 0;

    }

  }

  else {

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

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

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

      local_8 = 0;

      FUN_00699280(&local_8);

    }

    param_3 = 0;

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

      do {

        piVar1 = (int *)(*(int *)(param_1 + 0x14c) + param_3 * 8);

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

          bVar6 = *(char *)(param_1 + 0xac) == '\0';

          iVar4 = param_1 + 8;

          iVar5 = *piVar1;

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

        }

        else {

          iVar5 = *piVar1;

          iVar4 = param_1 + 0xb4;

          iVar3 = *(int *)(param_1 + 0xb8) * iVar5 + *(int *)(param_1 + 0x128);

          bVar6 = false;

        }

        cVar2 = FUN_00698790(iVar5,piVar1[1],iVar3,iVar4,bVar6,param_4);

        if (cVar2 == '\0') {

          return 0;

        }

        param_3 = param_3 + 1;

      } while (param_3 < *(uint *)(param_1 + 0x154));

    }

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

  }

  return 1;

}





// --- FUN_006994e0 at 0x006994E0 (size: 192) ---


undefined4 __fastcall FUN_006994e0(int *param_1)



{

  int iVar1;

  char cVar2;

  int *piVar3;

  int *local_c [3];

  

  iVar1 = param_1[0x2d];

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

    local_c[0] = (int *)FUN_0059ffc0(iVar1,param_1[0x1f]);

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

LAB_00699587:

      FUN_004637a0(local_c);

      return 1;

    }

  }

  else {

    piVar3 = (int *)FUN_005df0f5(0xb8);

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

      FUN_00447220();

      *piVar3 = (int)&PTR_FUN_007e6520;

      FUN_00698580();

      local_c[0] = piVar3;

      cVar2 = (**(code **)(*piVar3 + 0x10))

                        (param_1[0x1f],iVar1,-(*(char *)((int)param_1 + 0x87) != '\0') & 0x10);

      if (cVar2 != '\0') {

        (**(code **)(*param_1 + 0x24))(&stack0xffffffec);

        goto LAB_00699587;

      }

      (**(code **)*piVar3)(1);

    }

  }

  return 0;

}





// --- FUN_00699880 at 0x00699880 (size: 29) ---


void __fastcall FUN_00699880(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00801c28;

  FUN_0054d2e0(param_1 + 0xd);

  *param_1 = &PTR_LAB_00796c4c;

  return;

}





// --- FUN_006998a0 at 0x006998A0 (size: 32) ---


void __thiscall FUN_006998a0(int param_1,undefined4 *param_2)



{

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

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

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

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

  return;

}





// --- FUN_006998c0 at 0x006998C0 (size: 47) ---


void __thiscall FUN_006998c0(int param_1,int *param_2)



{

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

    FUN_00695670(param_2);

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

  }

  FUN_0054d2e0((undefined4 *)(param_1 + 0x34));

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

  return;

}





// --- FUN_00699a30 at 0x00699A30 (size: 56) ---


void __thiscall

FUN_00699a30(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5)



{

  if ((param_2 < *(int *)(param_1 + 0x40)) && (param_3 < *(int *)(param_1 + 0x44))) {

    FUN_005a13a0(*(int *)(param_1 + 0x38) + param_2,*(int *)(param_1 + 0x3c) + param_3,param_4,

                 param_5);

  }

  return;

}





// --- FUN_00699a70 at 0x00699A70 (size: 94) ---


void __fastcall FUN_00699a70(undefined4 *param_1)



{

  param_1[1] = 1;

  *param_1 = &PTR_FUN_00801c28;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = DAT_008359dc;

  param_1[10] = DAT_008359e0;

  param_1[0xb] = DAT_008359e4;

  param_1[0xc] = DAT_008359e8;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  return;

}





// --- FUN_00699ad0 at 0x00699AD0 (size: 50) ---


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



{

  *param_1 = &PTR_FUN_00801c28;

  FUN_0054d2e0(param_1 + 0xd);

  *param_1 = &PTR_LAB_00796c4c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00699b10 at 0x00699B10 (size: 80) ---


undefined4 __thiscall

FUN_00699b10(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6,int param_7)



{

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

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

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

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

  *(int *)(param_1 + 0x40) = param_4 + param_6 * -2;

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

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

  *(int *)(param_1 + 0x3c) = param_3 + param_7;

  *(int *)(param_1 + 0x38) = param_2 + param_6;

  *(int *)(param_1 + 0x44) = param_5 + param_7 * -2;

  return CONCAT31((int3)((uint)(param_7 * 2) >> 8),1);

}





// --- FUN_00699b60 at 0x00699B60 (size: 55) ---


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



{

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

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

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

  *(int *)(param_1 + 0x3c) = param_3 + *(int *)(param_1 + 0x20);

  *(int *)(param_1 + 0x40) = *(int *)(param_1 + 0x14) + *(int *)(param_1 + 0x1c) * -2;

  *(int *)(param_1 + 0x44) = *(int *)(param_1 + 0x18) + *(int *)(param_1 + 0x20) * -2;

  return;

}





// --- FUN_00699bb0 at 0x00699BB0 (size: 132) ---


void FUN_00699bb0(undefined4 *param_1,int *param_2,int param_3,int param_4,int param_5,int param_6,

                 int param_7,int param_8)



{

  int iVar1;

  

  iVar1 = FUN_005df0f5(0x48);

  if (iVar1 == 0) {

    iVar1 = 0;

  }

  else {

    iVar1 = FUN_00699a70();

  }

  *param_2 = iVar1;

  if (iVar1 != 0) {

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

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

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

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

    *(int *)(iVar1 + 0x40) = param_5 + param_7 * -2;

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

    *(int *)(iVar1 + 0x18) = param_6;

    *(int *)(iVar1 + 0x38) = param_3 + param_7;

    *(int *)(iVar1 + 0x3c) = param_4 + param_8;

    *(int *)(iVar1 + 0x44) = param_6 + param_8 * -2;

    *param_1 = 0;

    return;

  }

  *param_1 = 0x80004005;

  return;

}





// --- FUN_00699cd0 at 0x00699CD0 (size: 10) ---


void __thiscall FUN_00699cd0(int param_1,undefined1 param_2)



{

  *(undefined1 *)(param_1 + 0x49) = param_2;

  return;

}





// --- FUN_00699fe0 at 0x00699FE0 (size: 119) ---


void __fastcall FUN_00699fe0(undefined4 *param_1)



{

  undefined *puVar1;

  LONG LVar2;

  LONG *lpAddend;

  undefined4 *puVar3;

  

  *param_1 = &PTR_FUN_00801c34;

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

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

  puVar1 = (undefined *)param_1[0x13];

  if (puVar1 != PTR_DAT_00818344) {

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

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

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

    }

    lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

    param_1[0x13] = PTR_DAT_00818344;

    InterlockedIncrement(lpAddend);

  }

  puVar3 = (undefined4 *)(param_1[0x13] + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(param_1[0x13] + -0x10));

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

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

  }

  FUN_00699880();

  return;

}





// --- FUN_0069a060 at 0x0069A060 (size: 125) ---


undefined4 __thiscall

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

            ,undefined4 param_6,undefined4 param_7,int *param_8)



{

  int iVar1;

  char cVar2;

  LONG LVar3;

  

  cVar2 = FUN_00699b10(param_2,param_3,param_4,param_5,param_6,param_7);

  if (cVar2 != '\0') {

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

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

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

    if (iVar1 != *param_8) {

      LVar3 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

      if ((LVar3 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

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

      }

      iVar1 = *param_8;

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

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

    }

    return 1;

  }

  return 0;

}





// --- FUN_0069a0e0 at 0x0069A0E0 (size: 30) ---


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



{

  FUN_00699fe0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069a100 at 0x0069A100 (size: 165) ---


void FUN_0069a100(undefined4 *param_1,int *param_2,undefined4 param_3,undefined4 param_4,

                 undefined4 param_5,undefined4 param_6,undefined4 param_7,undefined4 param_8,

                 undefined4 param_9)



{

  int *piVar1;

  char cVar2;

  undefined4 *puVar3;

  LONG *lpAddend;

  

  puVar3 = (undefined4 *)FUN_005df0f5(0x50);

  if (puVar3 == (undefined4 *)0x0) {

    puVar3 = (undefined4 *)0x0;

  }

  else {

    FUN_00699a70();

    *puVar3 = &PTR_FUN_00801c34;

    *(undefined1 *)(puVar3 + 0x12) = 0;

    *(undefined1 *)((int)puVar3 + 0x49) = 0;

    lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

    puVar3[0x13] = PTR_DAT_00818344;

    InterlockedIncrement(lpAddend);

  }

  *param_2 = (int)puVar3;

  if (puVar3 != (undefined4 *)0x0) {

    cVar2 = FUN_0069a060(param_3,param_4,param_5,param_6,param_7,param_8,param_9);

    if (cVar2 != '\0') {

      *param_1 = 0;

      return;

    }

    puVar3 = (undefined4 *)*param_2;

    if (puVar3 != (undefined4 *)0x0) {

      piVar1 = puVar3 + 1;

      *piVar1 = *piVar1 + -1;

      if (*piVar1 == 0) {

        (**(code **)*puVar3)(1);

      }

      *param_2 = 0;

    }

  }

  *param_1 = 0x80004005;

  return;

}





// --- FUN_0069a1b0 at 0x0069A1B0 (size: 134) ---


undefined4 __thiscall FUN_0069a1b0(int *param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  

  iVar1 = *param_2;

  iVar2 = param_2[1];

  iVar3 = *param_1;

  if (iVar3 <= iVar1) {

    iVar4 = param_1[2];

    if (((((iVar1 <= iVar4) && (iVar5 = param_1[1], iVar5 <= iVar2)) &&

         (iVar6 = param_1[3], iVar2 <= iVar6)) &&

        (((iVar7 = param_2[2], iVar3 <= iVar7 && (iVar7 <= iVar4)) &&

         ((iVar5 <= iVar2 && ((iVar2 <= iVar6 && (iVar2 = param_2[3], iVar3 <= iVar1)))))))) &&

       ((iVar1 <= iVar4 &&

        (((((iVar5 <= iVar2 && (iVar2 <= iVar6)) && (iVar3 <= iVar7)) &&

          ((iVar7 <= iVar4 && (iVar5 <= iVar2)))) && (iVar2 <= iVar6)))))) {

      return 1;

    }

  }

  return 0;

}





// --- FUN_0069a240 at 0x0069A240 (size: 121) ---


uint __thiscall FUN_0069a240(int *param_1,int *param_2)



{

  uint in_EAX;

  uint uVar1;

  uint3 uVar2;

  int iVar3;

  

  iVar3 = param_1[2] - *param_1;

  uVar1 = in_EAX & 0xffffff00;

  if (iVar3 != -1 && -1 < iVar3 + 1) {

    iVar3 = param_1[3] - param_1[1];

    if (iVar3 != -1 && -1 < iVar3 + 1) {

      iVar3 = param_2[2] - *param_2;

      if (iVar3 != -1 && -1 < iVar3 + 1) {

        iVar3 = (param_2[3] - param_2[1]) + 1;

        uVar2 = (uint3)((uint)iVar3 >> 8);

        if ((((0 < iVar3) && (*param_1 <= param_2[2])) && (*param_2 <= param_1[2])) &&

           ((param_1[1] <= param_2[3] && (param_2[1] <= param_1[3])))) {

          return CONCAT31(uVar2,1);

        }

        uVar1 = (uint)uVar2 << 8;

      }

    }

  }

  return uVar1;

}





// --- FUN_0069a2c0 at 0x0069A2C0 (size: 36) ---


void __thiscall

FUN_0069a2c0(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5

            )



{

  *(undefined4 *)(param_1 + 0x20) = param_2;

  *(undefined4 *)(param_1 + 0x24) = param_3;

  *(undefined4 *)(param_1 + 0x28) = param_4;

  *(undefined4 *)(param_1 + 0x2c) = param_5;

  FUN_00448be0();

  return;

}





// --- FUN_0069a2f0 at 0x0069A2F0 (size: 109) ---


uint __thiscall FUN_0069a2f0(int *param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  undefined4 local_10 [4];

  

  puVar1 = (undefined4 *)param_1[2];

  if (param_2 < puVar1) {

    puVar1 = (undefined4 *)((int)puVar1 + -1);

    param_1[2] = (int)puVar1;

    if (param_2 != puVar1) {

      puVar1 = (undefined4 *)((int)puVar1 * 0x10 + *param_1);

      puVar2 = (undefined4 *)((int)param_2 * 0x10 + *param_1);

      if (puVar2 != puVar1) {

        *puVar2 = *puVar1;

        puVar2[2] = puVar1[2];

        puVar2[1] = puVar1[1];

        puVar2[3] = puVar1[3];

      }

      puVar1 = (undefined4 *)(param_1[2] * 0x10 + *param_1);

      if (puVar1 != local_10) {

        *puVar1 = 0;

        puVar1[2] = 0;

        puVar1[1] = 0;

        puVar1[3] = 0;

      }

    }

    return CONCAT31((int3)((uint)puVar1 >> 8),1);

  }

  return (uint)puVar1 & 0xffffff00;

}





// --- FUN_0069a360 at 0x0069A360 (size: 89) ---


void __fastcall FUN_0069a360(undefined4 *param_1)



{

  param_1[6] = DAT_00801c40;

  param_1[1] = 1;

  *(undefined1 *)(param_1 + 2) = 1;

  *param_1 = &PTR_FUN_00801808;

  *(undefined1 *)((int)param_1 + 9) = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[7] = DAT_00801c44;

  param_1[0xc] = 0x3f800000;

  param_1[0xd] = 0x3f800000;

  param_1[0xe] = 0x3f800000;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  return;

}





// --- FUN_0069a3c0 at 0x0069A3C0 (size: 92) ---


undefined4 __thiscall FUN_0069a3c0(int *param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  undefined4 *puVar2;

  

  if ((param_1[1] & 0x7fffffffU) <= (uint)param_1[2]) {

    uVar1 = FUN_00453850((param_1[1] & 0x7fffffffU) + 1);

    uVar1 = FUN_00459d30(uVar1);

    if ((char)uVar1 == '\0') {

      return uVar1;

    }

  }

  puVar2 = (undefined4 *)(param_1[2] * 0x10 + *param_1);

  if (puVar2 != param_2) {

    *puVar2 = *param_2;

    puVar2[2] = param_2[2];

    puVar2[1] = param_2[1];

    puVar2[3] = param_2[3];

  }

  param_1[2] = param_1[2] + 1;

  return CONCAT31((int3)((uint)puVar2 >> 8),1);

}





// --- FUN_0069a420 at 0x0069A420 (size: 270) ---


uint __thiscall FUN_0069a420(int *param_1,int *param_2,int param_3)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  int local_4;

  

  uVar2 = FUN_0069a240(param_2);

  if ((char)uVar2 != '\0') {

    iVar3 = local_18;

    iVar4 = local_1c;

    if (&local_20 != param_1) {

      local_14 = param_1[3];

      local_20 = *param_1;

      iVar3 = param_1[2];

      iVar4 = param_1[1];

    }

    iVar1 = *param_2;

    iVar5 = local_20;

    if (local_20 <= iVar1) {

      local_8 = iVar1 + -1;

      local_4 = local_14;

      local_10 = local_20;

      local_c = iVar4;

      FUN_0069a3c0(&local_10);

      iVar5 = iVar1;

    }

    iVar1 = param_2[2];

    if (iVar1 <= iVar3) {

      local_10 = iVar1 + 1;

      local_4 = local_14;

      local_c = iVar4;

      local_8 = iVar3;

      FUN_0069a3c0(&local_10);

      iVar3 = iVar1;

    }

    if (iVar4 <= param_2[1]) {

      local_4 = param_2[1] + -1;

      local_10 = iVar5;

      local_c = iVar4;

      local_8 = iVar3;

      FUN_0069a3c0(&local_10);

    }

    if (param_2[3] <= local_14) {

      local_c = param_2[3] + 1;

      local_4 = local_14;

      local_10 = iVar5;

      local_8 = iVar3;

      FUN_0069a3c0(&local_10);

    }

    return (uint)(*(int *)(param_3 + 8) != 0);

  }

  return uVar2;

}





// --- FUN_0069a530 at 0x0069A530 (size: 375) ---


void __thiscall FUN_0069a530(int param_1,int *param_2)



{

  char cVar1;

  undefined4 uVar2;

  int *piVar3;

  int iVar4;

  int iVar5;

  uint uVar6;

  void *local_c;

  uint local_8;

  uint local_4;

  

  if ((param_2[2] - *param_2 != -1 && -1 < (param_2[2] - *param_2) + 1) &&

     (param_2[3] - param_2[1] != -1 && -1 < (param_2[3] - param_2[1]) + 1)) {

    uVar6 = 0;

    if (*(int *)(param_1 + 0x48) != 0) {

      iVar4 = 0;

      do {

        iVar5 = *(int *)(param_1 + 0x40) + iVar4;

        cVar1 = FUN_0069a1b0(param_2);

        if (cVar1 != '\0') {

          return;

        }

        cVar1 = FUN_0069a1b0(iVar5);

        if (cVar1 == '\0') {

          local_c = (void *)0x0;

          local_8 = 0;

          local_4 = 0;

          cVar1 = FUN_0069a420(iVar5,&local_c);

          if (cVar1 != '\0') {

            uVar6 = 0;

            if (local_4 != 0) {

              iVar4 = 0;

              do {

                FUN_0069a530(iVar4 + (int)local_c);

                uVar6 = uVar6 + 1;

                iVar4 = iVar4 + 0x10;

              } while (uVar6 < local_4);

            }

            if ((local_8 & 0x80000000) != 0x80000000) {

              return;

            }

            operator_delete__(local_c);

            return;

          }

          if ((local_8 & 0x80000000) == 0x80000000) {

            operator_delete__(local_c);

          }

        }

        else {

          FUN_0069a2f0(uVar6);

          uVar6 = uVar6 - 1;

          iVar4 = iVar4 + -0x10;

        }

        uVar6 = uVar6 + 1;

        iVar4 = iVar4 + 0x10;

      } while (uVar6 < *(uint *)(param_1 + 0x48));

    }

    uVar6 = *(uint *)(param_1 + 0x44) & 0x7fffffff;

    if (uVar6 <= *(uint *)(param_1 + 0x48)) {

      uVar2 = FUN_00453850(uVar6 + 1);

      cVar1 = FUN_00459d30(uVar2);

      if (cVar1 == '\0') {

        return;

      }

    }

    piVar3 = (int *)(*(int *)(param_1 + 0x48) * 0x10 + *(int *)(param_1 + 0x40));

    if (piVar3 != param_2) {

      *piVar3 = *param_2;

      piVar3[2] = param_2[2];

      piVar3[1] = param_2[1];

      piVar3[3] = param_2[3];

    }

    *(int *)(param_1 + 0x48) = *(int *)(param_1 + 0x48) + 1;

  }

  return;

}





// --- FUN_0069a6b0 at 0x0069A6B0 (size: 44) ---


void __fastcall FUN_0069a6b0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00801c4c;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  return;

}





// --- FUN_0069a6e0 at 0x0069A6E0 (size: 64) ---


undefined4 * __thiscall FUN_0069a6e0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00801c4c;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069a720 at 0x0069A720 (size: 64) ---


undefined4 * __thiscall FUN_0069a720(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00801c50;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069a760 at 0x0069A760 (size: 57) ---


bool __thiscall FUN_0069a760(undefined4 *param_1,int *param_2)



{

  int *piVar1;

  uint uVar2;

  

  uVar2 = 0;

  if (param_1[2] != 0) {

    piVar1 = (int *)*param_1;

    do {

      if ((*piVar1 == *param_2) && (piVar1[1] == param_2[1])) goto LAB_0069a78b;

      uVar2 = uVar2 + 1;

      piVar1 = piVar1 + 2;

    } while (uVar2 < (uint)param_1[2]);

  }

  uVar2 = 0xffffffff;

LAB_0069a78b:

  return uVar2 != 0xffffffff;

}





// --- FUN_0069a800 at 0x0069A800 (size: 72) ---


undefined4 __thiscall FUN_0069a800(int param_1,uint *param_2)



{

  uint *puVar1;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 100) + (*param_2 % *(uint *)(param_1 + 0x6c)) * 4);

  while( true ) {

    if (puVar1 == (uint *)0x0) {

      return 0;

    }

    if (*puVar1 == *param_2) break;

    puVar1 = (uint *)puVar1[1];

  }

  if (puVar1 == (uint *)0x0) {

    return 0;

  }

  FUN_0069c260(puVar1 + 2);

  return 1;

}





// --- FUN_0069a850 at 0x0069A850 (size: 60) ---


uint * __thiscall FUN_0069a850(int param_1,uint param_2)



{

  uint *puVar1;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 0x9c) + (param_2 % *(uint *)(param_1 + 0xa4)) * 4);

  while( true ) {

    if (puVar1 == (uint *)0x0) {

      return (uint *)0x0;

    }

    if (*puVar1 == param_2) break;

    puVar1 = (uint *)puVar1[1];

  }

  if (puVar1 == (uint *)0x0) {

    return (uint *)0x0;

  }

  return puVar1 + 2;

}





// --- FUN_0069a890 at 0x0069A890 (size: 143) ---


undefined4 * __thiscall FUN_0069a890(undefined4 *param_1,undefined4 param_2)



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_00801c4c;

  puVar1 = PTR_DAT_00818558;

  puVar2 = (uint *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

  if (puVar2 == (uint *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

  param_1[0x19] = (undefined4 *)param_1[0x18] + param_1[0x1a];

  puVar6 = (undefined4 *)param_1[0x18];

  for (uVar4 = param_1[0x1a] & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

  for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

    *(undefined1 *)puVar6 = 0;

    puVar6 = (undefined4 *)((int)puVar6 + 1);

  }

  return param_1;

}





// --- FUN_0069a920 at 0x0069A920 (size: 143) ---


undefined4 * __thiscall FUN_0069a920(undefined4 *param_1,undefined4 param_2)



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_00801c50;

  puVar1 = PTR_DAT_00818558;

  puVar2 = (uint *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

  if (puVar2 == (uint *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

  param_1[0x19] = (undefined4 *)param_1[0x18] + param_1[0x1a];

  puVar6 = (undefined4 *)param_1[0x18];

  for (uVar4 = param_1[0x1a] & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

  for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

    *(undefined1 *)puVar6 = 0;

    puVar6 = (undefined4 *)((int)puVar6 + 1);

  }

  return param_1;

}





// --- FUN_0069a9b0 at 0x0069A9B0 (size: 75) ---


undefined4 __thiscall FUN_0069a9b0(int *param_1,undefined4 *param_2)



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  

  if ((param_1[1] & 0x7fffffffU) <= (uint)param_1[2]) {

    uVar3 = FUN_00453850((param_1[1] & 0x7fffffffU) + 1);

    uVar3 = FUN_0044b740(uVar3);

    if ((char)uVar3 == '\0') {

      return uVar3;

    }

  }

  iVar1 = param_1[2];

  iVar2 = *param_1;

  *(undefined4 *)(iVar2 + iVar1 * 8) = *param_2;

  uVar3 = param_2[1];

  *(undefined4 *)(iVar2 + 4 + iVar1 * 8) = uVar3;

  param_1[2] = param_1[2] + 1;

  return CONCAT31((int3)((uint)uVar3 >> 8),1);

}





// --- FUN_0069aa00 at 0x0069AA00 (size: 38) ---


undefined1 FUN_0069aa00(undefined4 param_1)



{

  char cVar1;

  undefined1 uVar2;

  

  cVar1 = FUN_0069a760(param_1);

  if (cVar1 != '\0') {

    return 0;

  }

  uVar2 = FUN_0069a9b0(param_1);

  return uVar2;

}





// --- FUN_0069aa30 at 0x0069AA30 (size: 103) ---


undefined4 FUN_0069aa30(undefined4 *param_1,undefined4 param_2)



{

  char cVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0x1cc);

  if (puVar2 == (undefined4 *)0x0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = *param_1;

    puVar2[1] = 0;

    FUN_0069c3b0(param_2);

  }

  cVar1 = FUN_0042bd40(puVar2);

  if (cVar1 == '\0') {

    if (puVar2 != (undefined4 *)0x0) {

      FUN_0069c0c0();

      operator_delete(puVar2);

    }

    return 0;

  }

  return 1;

}





// --- FUN_0069aaa0 at 0x0069AAA0 (size: 130) ---


void __fastcall FUN_0069aaa0(int param_1)



{

  int iVar1;

  void *pvVar2;

  void *pvVar3;

  int *piVar4;

  void *pvVar5;

  

  iVar1 = *(int *)(param_1 + 0x6c);

  do {

    if (iVar1 == 0) {

      return;

    }

    piVar4 = *(int **)(param_1 + 100);

    while (piVar4 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

      if (**(int **)(param_1 + 100) != 0) {

        piVar4 = *(int **)(param_1 + 100);

        pvVar5 = (void *)*piVar4;

        goto LAB_0069aadf;

      }

      piVar4 = *(int **)(param_1 + 100) + 1;

      *(int **)(param_1 + 100) = piVar4;

    }

    piVar4 = (int *)0x0;

    pvVar5 = (void *)0x0;

LAB_0069aadf:

    pvVar3 = (void *)*piVar4;

    if (pvVar3 == pvVar5) {

LAB_0069aaf2:

      *piVar4 = *(int *)((int)pvVar3 + 4);

    }

    else {

      do {

        pvVar2 = pvVar3;

        pvVar3 = *(void **)((int)pvVar2 + 4);

      } while (pvVar3 != pvVar5);

      if (pvVar2 == (void *)0x0) goto LAB_0069aaf2;

      *(undefined4 *)((int)pvVar2 + 4) = *(undefined4 *)((int)pvVar3 + 4);

    }

    *(int *)(param_1 + 0x6c) = *(int *)(param_1 + 0x6c) + -1;

    if (pvVar5 != (void *)0x0) {

      FUN_0069c0c0();

      operator_delete(pvVar5);

    }

    iVar1 = *(int *)(param_1 + 0x6c);

  } while( true );

}





// --- FUN_0069ab30 at 0x0069AB30 (size: 531) ---


void FUN_0069ab30(undefined4 param_1,int param_2,uint param_3)



{

  int iVar1;

  undefined *puVar2;

  undefined *puVar3;

  uint uVar4;

  char cVar5;

  undefined *puVar6;

  byte *pbVar7;

  int *piVar8;

  undefined4 *puVar9;

  undefined4 *puVar10;

  uint uVar11;

  undefined4 *puVar12;

  undefined1 local_c [12];

  

  uVar4 = param_3;

  if ((~*(byte *)(param_3 + 4) & 1) != 0) {

    FUN_005c2c80();

  }

  puVar3 = PTR_DAT_00818558;

  puVar2 = PTR_DAT_00818554;

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    param_3 = *(uint *)(param_2 + 0x68);

    puVar6 = (undefined *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_3,param_3,0);

    if (puVar6 == puVar3) {

      puVar6 = puVar6 + -4;

    }

    uVar11 = (int)puVar6 - (int)puVar2 >> 2;

  }

  else {

    uVar11 = param_3 & 0xff;

  }

  FUN_0040ad10(1);

  pbVar7 = (byte *)FUN_0040acf0(1);

  if (pbVar7 != (byte *)0x0) {

    if ((*(byte *)(uVar4 + 4) & 1) == 0) {

      uVar11 = (uint)*pbVar7;

    }

    else {

      *pbVar7 = (byte)uVar11;

    }

  }

  if ((*(byte *)(uVar4 + 4) & 5) == 0) {

    if ((uVar11 & 0xff) < DAT_007956cc) {

      FUN_0069bba0(*(undefined4 *)(PTR_DAT_00818554 + (uVar11 & 0xff) * 4));

    }

    else {

      FUN_0040aa50();

    }

  }

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    param_3 = *(uint *)(param_2 + 0x6c);

  }

  FUN_00401a80(&param_3,&param_3,uVar4);

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    piVar8 = (int *)FUN_0052dcf0(local_c);

    iVar1 = *piVar8;

    puVar12 = (undefined4 *)piVar8[1];

    puVar9 = (undefined4 *)piVar8[2];

LAB_0069ac32:

    puVar10 = puVar9;

    if (puVar9 != (undefined4 *)0x0) {

      do {

        FUN_0040ad10(4);

        puVar9 = (undefined4 *)FUN_0040acf0(4);

        if (puVar9 != (undefined4 *)0x0) {

          if ((*(byte *)(uVar4 + 4) & 1) == 0) {

            *puVar10 = *puVar9;

          }

          else {

            *puVar9 = *puVar10;

          }

        }

        (**(code **)(puVar10[2] + 4))(uVar4);

        puVar10 = (undefined4 *)puVar10[1];

      } while (puVar10 != (undefined4 *)0x0);

      do {

        puVar12 = puVar12 + 1;

        puVar9 = puVar10;

        if (puVar12 == (undefined4 *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4)) break;

        puVar9 = (undefined4 *)*puVar12;

      } while (puVar9 == (undefined4 *)0x0);

      goto LAB_0069ac32;

    }

  }

  if ((*(byte *)(uVar4 + 4) & 5) == 0) {

    uVar11 = FUN_0040a8f0();

    if (uVar11 < param_3) {

LAB_0069ad34:

      FUN_0040aa50();

    }

    else {

      uVar11 = 0;

      puVar12 = (undefined4 *)0x0;

      if (param_3 != 0) {

        while( true ) {

          puVar9 = (undefined4 *)FUN_005df0f5(0x1cc);

          if (puVar9 == (undefined4 *)0x0) {

            puVar9 = (undefined4 *)0x0;

          }

          else {

            puVar9[1] = 0;

            FUN_0069c1a0();

          }

          FUN_0040ad10(4);

          puVar10 = (undefined4 *)FUN_0040acf0(4);

          if (puVar10 != (undefined4 *)0x0) {

            if ((*(byte *)(uVar4 + 4) & 1) == 0) {

              *puVar9 = *puVar10;

            }

            else {

              *puVar10 = *puVar9;

            }

          }

          (**(code **)(puVar9[2] + 4))(uVar4);

          if ((*(uint *)(uVar4 + 4) >> 2 & 1) != 0) break;

          cVar5 = FUN_00599310(puVar9,puVar12);

          if (cVar5 == '\0') goto LAB_0069ad34;

          uVar11 = uVar11 + 1;

          puVar12 = puVar9;

          if (param_3 <= uVar11) {

            return;

          }

        }

      }

    }

  }

  return;

}





// --- FUN_0069ad50 at 0x0069AD50 (size: 273) ---


void __fastcall FUN_0069ad50(int param_1)



{

  undefined *puVar1;

  LONG LVar2;

  LONG *pLVar3;

  

  *(undefined4 *)(param_1 + 0x34) = 0;

  *(undefined4 *)(param_1 + 0x30) = 0;

  FUN_0069aaa0();

  puVar1 = *(undefined **)(param_1 + 0xac);

  if (puVar1 != PTR_DAT_00818344) {

    LVar2 = InterlockedDecrement((LONG *)(puVar1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(puVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(puVar1 + -0x14))(1);

    }

    pLVar3 = (LONG *)(PTR_DAT_00818344 + -0x10);

    *(undefined **)(param_1 + 0xac) = PTR_DAT_00818344;

    InterlockedIncrement(pLVar3);

  }

  puVar1 = *(undefined **)(param_1 + 0xb0);

  if (puVar1 != PTR_DAT_00818344) {

    LVar2 = InterlockedDecrement((LONG *)(puVar1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(puVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(puVar1 + -0x14))(1);

    }

    pLVar3 = (LONG *)(PTR_DAT_00818344 + -0x10);

    *(undefined **)(param_1 + 0xb0) = PTR_DAT_00818344;

    InterlockedIncrement(pLVar3);

  }

  puVar1 = *(undefined **)(param_1 + 0xb4);

  if (puVar1 != PTR_DAT_00818344) {

    LVar2 = InterlockedDecrement((LONG *)(puVar1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(puVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(puVar1 + -0x14))(1);

    }

    pLVar3 = (LONG *)(PTR_DAT_00818344 + -0x10);

    *(undefined **)(param_1 + 0xb4) = PTR_DAT_00818344;

    InterlockedIncrement(pLVar3);

  }

  puVar1 = *(undefined **)(param_1 + 0xb8);

  if (puVar1 != PTR_DAT_00818344) {

    LVar2 = InterlockedDecrement((LONG *)(puVar1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(puVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(puVar1 + -0x14))(1);

    }

    pLVar3 = (LONG *)(PTR_DAT_00818344 + -0x10);

    *(undefined **)(param_1 + 0xb8) = PTR_DAT_00818344;

    InterlockedIncrement(pLVar3);

  }

  return;

}





// --- FUN_0069ae70 at 0x0069AE70 (size: 58) ---


void __fastcall FUN_0069ae70(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00801c54;

  FUN_0069aaa0();

  param_1[1] = &PTR_FUN_00801c4c;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  return;

}





// --- FUN_0069aeb0 at 0x0069AEB0 (size: 335) ---


int __thiscall FUN_0069aeb0(int param_1,int param_2)



{

  undefined *puVar1;

  int iVar2;

  undefined4 *puVar3;

  int *piVar4;

  uint uVar5;

  uint uVar6;

  uint *puVar7;

  uint *puVar8;

  uint *puVar9;

  undefined1 local_18 [4];

  undefined4 *local_14;

  int local_c;

  

  iVar2 = param_2;

  if (param_1 != param_2) {

    FUN_0069aaa0();

    puVar1 = PTR_DAT_00818558;

    param_2 = *(undefined4 *)(iVar2 + 0x6c);

    puVar3 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

    if (puVar3 == (undefined4 *)puVar1) {

      puVar3 = puVar3 + -1;

    }

    FUN_00682af0(*puVar3);

    puVar7 = (uint *)0x0;

    piVar4 = (int *)FUN_0052dcf0(local_18);

    local_c = *piVar4;

    puVar9 = (uint *)piVar4[2];

    local_14 = (undefined4 *)piVar4[1];

    while (puVar8 = puVar7, puVar9 != (uint *)0x0) {

      do {

        puVar7 = (uint *)FUN_005df0f5(0x1cc);

        if (puVar7 == (uint *)0x0) {

          puVar7 = (uint *)0x0;

        }

        else {

          *puVar7 = *puVar9;

          puVar7[1] = 0;

          FUN_0069c3b0(puVar9 + 2);

        }

        uVar5 = *puVar7 % *(uint *)(param_1 + 0x6c);

        if (puVar8 == (uint *)0x0) {

LAB_0069af92:

          puVar3 = (undefined4 *)(*(int *)(param_1 + 100) + uVar5 * 4);

          *puVar3 = puVar7;

          if (puVar8 == (uint *)0x0) {

            *(undefined4 **)(param_1 + 0x68) = puVar3;

          }

LAB_0069afa8:

          *(int *)(param_1 + 0x70) = *(int *)(param_1 + 0x70) + 1;

        }

        else {

          uVar6 = *puVar8 % *(uint *)(param_1 + 0x6c);

          if (uVar5 == uVar6) {

            puVar8[1] = (uint)puVar7;

            goto LAB_0069afa8;

          }

          if (uVar6 < uVar5) goto LAB_0069af92;

        }

        puVar9 = (uint *)puVar9[1];

        puVar8 = puVar7;

      } while (puVar9 != (uint *)0x0);

      do {

        local_14 = local_14 + 1;

        if (local_14 == (undefined4 *)(*(int *)(local_c + 0x60) + *(int *)(local_c + 0x68) * 4)) {

          return param_1;

        }

        puVar9 = (uint *)*local_14;

      } while (puVar9 == (uint *)0x0);

    }

  }

  return param_1;

}





// --- FUN_0069b000 at 0x0069B000 (size: 82) ---


undefined4 * __thiscall FUN_0069b000(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00801c54;

  FUN_0069aaa0();

  param_1[1] = &PTR_FUN_00801c4c;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069b060 at 0x0069B060 (size: 136) ---


undefined4 * __fastcall FUN_0069b060(undefined4 *param_1)



{

  LONG *pLVar1;

  

  FUN_00415460(DAT_008fa00c);

  *param_1 = &PTR_LAB_0079cd38;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = &PTR_FUN_00801c54;

  FUN_0069a890(0x17);

  pLVar1 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x2b] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x2c] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x2d] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x2e] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  return param_1;

}





// --- FUN_0069b0f0 at 0x0069B0F0 (size: 214) ---


void __fastcall FUN_0069b0f0(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  *param_1 = &PTR_LAB_0079cd38;

  FUN_0069ad50();

  puVar2 = (undefined4 *)(param_1[0x2e] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x2e] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  puVar2 = (undefined4 *)(param_1[0x2d] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x2d] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  puVar2 = (undefined4 *)(param_1[0x2c] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x2c] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  puVar2 = (undefined4 *)(param_1[0x2b] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x2b] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  param_1[0xe] = &PTR_FUN_00801c54;

  FUN_0069aaa0();

  param_1[0xf] = &PTR_FUN_00801c4c;

  if ((undefined4 *)param_1[0x27] != param_1 + 0x10) {

    operator_delete__((undefined4 *)param_1[0x27]);

  }

  param_1[0x27] = 0;

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  FUN_004154b0();

  return;

}





// --- FUN_0069b1d0 at 0x0069B1D0 (size: 183) ---


void __fastcall FUN_0069b1d0(int param_1)



{

  int iVar1;

  void *pvVar2;

  void *pvVar3;

  int *piVar4;

  void *pvVar5;

  

  iVar1 = *(int *)(param_1 + 0x6c);

  do {

    if (iVar1 == 0) {

      return;

    }

    piVar4 = *(int **)(param_1 + 100);

    while (piVar4 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

      if (**(int **)(param_1 + 100) != 0) {

        piVar4 = *(int **)(param_1 + 100);

        pvVar5 = (void *)*piVar4;

        goto LAB_0069b20f;

      }

      piVar4 = *(int **)(param_1 + 100) + 1;

      *(int **)(param_1 + 100) = piVar4;

    }

    piVar4 = (int *)0x0;

    pvVar5 = (void *)0x0;

LAB_0069b20f:

    pvVar3 = (void *)*piVar4;

    if (pvVar3 == pvVar5) {

LAB_0069b222:

      *piVar4 = *(int *)((int)pvVar3 + 4);

    }

    else {

      do {

        pvVar2 = pvVar3;

        pvVar3 = *(void **)((int)pvVar2 + 4);

      } while (pvVar3 != pvVar5);

      if (pvVar2 == (void *)0x0) goto LAB_0069b222;

      *(undefined4 *)((int)pvVar2 + 4) = *(undefined4 *)((int)pvVar3 + 4);

    }

    *(int *)(param_1 + 0x6c) = *(int *)(param_1 + 0x6c) + -1;

    if (pvVar5 != (void *)0x0) {

      *(undefined ***)((int)pvVar5 + 8) = &PTR_FUN_00801c54;

      FUN_0069aaa0();

      *(undefined ***)((int)pvVar5 + 0xc) = &PTR_FUN_00801c4c;

      if (*(void **)((int)pvVar5 + 0x6c) != (void *)((int)pvVar5 + 0x10)) {

        operator_delete__(*(void **)((int)pvVar5 + 0x6c));

      }

      *(undefined4 *)((int)pvVar5 + 0x6c) = 0;

      *(undefined4 *)((int)pvVar5 + 0x70) = 0;

      *(undefined4 *)((int)pvVar5 + 0x74) = 0;

      *(undefined4 *)((int)pvVar5 + 0x78) = 0;

      operator_delete(pvVar5);

    }

    iVar1 = *(int *)(param_1 + 0x6c);

  } while( true );

}





// --- FUN_0069b290 at 0x0069B290 (size: 30) ---


void * __thiscall FUN_0069b290(void *param_1,byte param_2)



{

  FUN_0069b0f0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069b2b0 at 0x0069B2B0 (size: 178) ---


undefined4 FUN_0069b2b0(undefined4 *param_1,int param_2)



{

  char cVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0x7c);

  if (puVar2 == (undefined4 *)0x0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = *param_1;

    puVar2[1] = 0;

    puVar2[2] = &PTR_FUN_00801c54;

    FUN_0069a890(*(undefined4 *)(param_2 + 0x6c));

    FUN_0069aeb0(param_2);

  }

  cVar1 = FUN_0042bd40(puVar2);

  if (cVar1 == '\0') {

    if (puVar2 != (undefined4 *)0x0) {

      puVar2[2] = &PTR_FUN_00801c54;

      FUN_0069aaa0();

      puVar2[3] = &PTR_FUN_00801c4c;

      if ((undefined4 *)puVar2[0x1b] != puVar2 + 4) {

        operator_delete__((undefined4 *)puVar2[0x1b]);

      }

      puVar2[0x1b] = 0;

      puVar2[0x1c] = 0;

      puVar2[0x1d] = 0;

      puVar2[0x1e] = 0;

      operator_delete(puVar2);

    }

    return 0;

  }

  return 1;

}





// --- FUN_0069b370 at 0x0069B370 (size: 134) ---


void __thiscall FUN_0069b370(int param_1,int param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  iVar1 = param_2;

  FUN_00415590(param_2);

  FUN_0040ad10(4);

  puVar2 = (undefined4 *)FUN_0040acf0(4);

  if (puVar2 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0x30) = *puVar2;

    }

    else {

      *puVar2 = *(undefined4 *)(param_1 + 0x30);

    }

  }

  FUN_0040ad10(4);

  puVar2 = (undefined4 *)FUN_0040acf0(4);

  if (puVar2 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0x34) = *puVar2;

    }

    else {

      *puVar2 = *(undefined4 *)(param_1 + 0x34);

    }

  }

  if ((~*(byte *)(iVar1 + 4) & 1) != 0) {

    FUN_0069aaa0();

  }

  FUN_0069ab30(&param_2,param_1 + 0x3c,iVar1);

  return;

}





// --- FUN_0069b400 at 0x0069B400 (size: 411) ---


bool FUN_0069b400(int param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  int iVar2;

  char cVar3;

  int iVar4;

  undefined4 uVar5;

  int *extraout_ECX;

  int local_84;

  undefined4 local_80;

  undefined4 local_7c;

  int local_78;

  undefined **local_74 [29];

  

  if (*(int *)(param_1 + 0xac) != 0) {

    FUN_0069c260(param_1);

    return true;

  }

  uVar1 = *(undefined4 *)(param_1 + 0xb4);

  iVar2 = *(int *)(param_1 + 0xb8);

  local_84 = iVar2;

  local_80 = uVar1;

  if (DAT_00835a70 != '\0') {

    iVar4 = FUN_00477380(&local_84);

    if (iVar4 == 0) {

      local_74[0] = &PTR_FUN_00801c54;

      FUN_0069a890(0x17);

      FUN_0069b2b0(&local_84,local_74);

      FUN_0069ae70();

      iVar4 = FUN_00477380(&local_84);

      if (iVar4 == 0) {

        return false;

      }

    }

    if ((DAT_00835a70 != '\0') && (cVar3 = FUN_0069a800(&local_80,param_2), cVar3 != '\0'))

    goto LAB_0069b57e;

  }

  uVar5 = FUN_004220b0(iVar2,0x23);

  local_84 = FUN_00415430(uVar5);

  if (local_84 != 0) {

    iVar4 = FUN_0069a850(uVar1);

    if (iVar4 != 0) {

      local_7c = uVar1;

      local_78 = iVar2;

      cVar3 = FUN_0069aa00(&local_7c);

      if ((cVar3 == '\0') || (cVar3 = FUN_0069b400(iVar4,param_2,param_3), cVar3 == '\0')) {

        FUN_0049b890();

        return false;

      }

      if (DAT_00835a70 != '\0') {

        FUN_0069aa30(&local_80,param_2);

      }

      FUN_0049b890();

LAB_0069b57e:

      cVar3 = FUN_0069c430(param_1);

      return cVar3 != '\0';

    }

    (**(code **)(*extraout_ECX + 0x14))();

  }

  return false;

}





// --- FUN_0069b5a0 at 0x0069B5A0 (size: 82) ---


undefined4 * __thiscall FUN_0069b5a0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00801c58;

  FUN_0069b1d0();

  param_1[1] = &PTR_FUN_00801c50;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069b600 at 0x0069B600 (size: 83) ---


int __thiscall FUN_0069b600(int *param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  iVar1 = (**(code **)(*param_1 + 4))();

  if (iVar1 == 0) {

    return 0;

  }

  if (*(undefined4 **)(iVar1 + 8) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(iVar1 + 8))(1);

  }

  *(undefined4 *)(iVar1 + 8) = 0;

  puVar2 = (undefined4 *)FUN_005df0f5(8);

  if (puVar2 != (undefined4 *)0x0) {

    *puVar2 = &PTR_FUN_00798124;

    puVar2[1] = param_2;

    *(undefined4 **)(iVar1 + 8) = puVar2;

    return iVar1;

  }

  *(undefined4 *)(iVar1 + 8) = 0;

  return iVar1;

}





// --- FUN_0069b660 at 0x0069B660 (size: 64) ---


undefined4 * __thiscall FUN_0069b660(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00801e64;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069b6a0 at 0x0069B6A0 (size: 236) ---


void __thiscall

FUN_0069b6a0(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5

            ,undefined4 param_6,undefined4 param_7)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  undefined1 local_2c [12];

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  int local_4;

  

  local_10 = *(int *)(param_1 + 0x10);

  local_c = *(int *)(param_1 + 0x14);

  local_8 = *(int *)(param_1 + 0x18) + -1 + local_10;

  local_4 = *(int *)(param_1 + 0x1c) + -1 + local_c;

  FUN_0069cdb0(param_2,param_3,param_4,param_5,param_6,param_7);

  local_20 = *(int *)(param_1 + 0x10);

  local_1c = *(int *)(param_1 + 0x14);

  local_18 = *(int *)(param_1 + 0x18) + -1 + local_20;

  local_14 = *(int *)(param_1 + 0x1c) + -1 + local_1c;

  piVar2 = (int *)FUN_0052dcf0(local_2c);

  iVar3 = piVar2[2];

  iVar1 = *piVar2;

  piVar2 = (int *)piVar2[1];

  do {

    if (iVar3 == 0) {

      return;

    }

    do {

      (**(code **)(*(int *)(iVar3 + 8) + 0x20))

                (&local_10,&local_20,*(undefined4 *)(iVar3 + 200),*(undefined4 *)(iVar3 + 0xcc),

                 *(undefined4 *)(iVar3 + 0xd0),*(undefined4 *)(iVar3 + 0xd4));

      iVar3 = *(int *)(iVar3 + 4);

    } while (iVar3 != 0);

    do {

      piVar2 = piVar2 + 1;

      if (piVar2 == (int *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4)) {

        return;

      }

      iVar3 = *piVar2;

    } while (iVar3 == 0);

  } while( true );

}





// --- FUN_0069ba20 at 0x0069BA20 (size: 167) ---


undefined1 __thiscall FUN_0069ba20(int param_1,undefined4 param_2)



{

  undefined1 uVar1;

  uint uVar2;

  char *pcVar3;

  int iVar4;

  

  uVar2 = *(uint *)(param_1 + 0xb4);

  uVar1 = 1;

  if ((uVar2 == 0) && (uVar2 = *(uint *)(param_1 + 0xb8), uVar2 == DAT_008fa0e0)) {

    uVar2 = uVar2 & 0xffffff00;

  }

  else {

    uVar2 = CONCAT31((int3)(uVar2 >> 8),1);

  }

  if (*(int *)(param_1 + 0xac) == 0) {

    if ((char)uVar2 != '\0') goto LAB_0069ba81;

    pcVar3 = "ElementDesc::CheckFFN, use either Typeor Base keywords.";

  }

  else {

    if ((char)uVar2 == '\0') goto LAB_0069ba81;

    pcVar3 = "ElementDesc::CheckFFN, use only Typeor Base keywords, not both.";

  }

  FUN_00401340(pcVar3);

  FUN_0065d620(param_2,uVar2);

  uVar1 = 0;

LAB_0069ba81:

  iVar4 = *(int *)(param_1 + 8);

  if (iVar4 != 0) {

    FUN_00401340("ElementDesc::CheckFFN, dont use the StateID keyword in Elements.");

    FUN_0065d620(param_2,iVar4);

    uVar1 = 0;

  }

  iVar4 = *(int *)(param_1 + 0xa8);

  if (iVar4 == 0) {

    FUN_00401340("ElementDesc::CheckFFN, you must use the ElementID keyword in Elements.");

    FUN_0065d620(param_2,iVar4);

    uVar1 = 0;

  }

  return uVar1;

}





// --- FUN_0069bad0 at 0x0069BAD0 (size: 60) ---


uint * __thiscall FUN_0069bad0(int param_1,uint param_2)



{

  uint *puVar1;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 0x134) + (param_2 % *(uint *)(param_1 + 0x13c)) * 4);

  while( true ) {

    if (puVar1 == (uint *)0x0) {

      return (uint *)0x0;

    }

    if (*puVar1 == param_2) break;

    puVar1 = (uint *)puVar1[1];

  }

  if (puVar1 == (uint *)0x0) {

    return (uint *)0x0;

  }

  return puVar1 + 2;

}





// --- FUN_0069bb10 at 0x0069BB10 (size: 143) ---


undefined4 * __thiscall FUN_0069bb10(undefined4 *param_1,undefined4 param_2)



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_00801e64;

  puVar1 = PTR_DAT_00818558;

  puVar2 = (uint *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

  if (puVar2 == (uint *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

  param_1[0x19] = (undefined4 *)param_1[0x18] + param_1[0x1a];

  puVar6 = (undefined4 *)param_1[0x18];

  for (uVar4 = param_1[0x1a] & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

  for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

    *(undefined1 *)puVar6 = 0;

    puVar6 = (undefined4 *)((int)puVar6 + 1);

  }

  return param_1;

}





// --- FUN_0069bba0 at 0x0069BBA0 (size: 67) ---


void FUN_0069bba0(undefined4 param_1)



{

  undefined *puVar1;

  undefined4 *puVar2;

  

  puVar1 = PTR_DAT_00818558;

  puVar2 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_1,param_1,0);

  if (puVar2 == (undefined4 *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  FUN_00682af0(*puVar2);

  return;

}





// --- FUN_0069bbf0 at 0x0069BBF0 (size: 103) ---


undefined4 FUN_0069bbf0(undefined4 *param_1,undefined4 param_2)



{

  char cVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0xb0);

  if (puVar2 == (undefined4 *)0x0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = *param_1;

    puVar2[1] = 0;

    FUN_0069dc20(param_2);

  }

  cVar1 = FUN_0042bd40(puVar2);

  if (cVar1 == '\0') {

    if (puVar2 != (undefined4 *)0x0) {

      FUN_0069d120();

      operator_delete(puVar2);

    }

    return 0;

  }

  return 1;

}





// --- FUN_0069bc60 at 0x0069BC60 (size: 130) ---


void __fastcall FUN_0069bc60(int param_1)



{

  int iVar1;

  void *pvVar2;

  void *pvVar3;

  int *piVar4;

  void *pvVar5;

  

  iVar1 = *(int *)(param_1 + 0x6c);

  do {

    if (iVar1 == 0) {

      return;

    }

    piVar4 = *(int **)(param_1 + 100);

    while (piVar4 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

      if (**(int **)(param_1 + 100) != 0) {

        piVar4 = *(int **)(param_1 + 100);

        pvVar5 = (void *)*piVar4;

        goto LAB_0069bc9f;

      }

      piVar4 = *(int **)(param_1 + 100) + 1;

      *(int **)(param_1 + 100) = piVar4;

    }

    piVar4 = (int *)0x0;

    pvVar5 = (void *)0x0;

LAB_0069bc9f:

    pvVar3 = (void *)*piVar4;

    if (pvVar3 == pvVar5) {

LAB_0069bcb2:

      *piVar4 = *(int *)((int)pvVar3 + 4);

    }

    else {

      do {

        pvVar2 = pvVar3;

        pvVar3 = *(void **)((int)pvVar2 + 4);

      } while (pvVar3 != pvVar5);

      if (pvVar2 == (void *)0x0) goto LAB_0069bcb2;

      *(undefined4 *)((int)pvVar2 + 4) = *(undefined4 *)((int)pvVar3 + 4);

    }

    *(int *)(param_1 + 0x6c) = *(int *)(param_1 + 0x6c) + -1;

    if (pvVar5 != (void *)0x0) {

      FUN_0069d120();

      operator_delete(pvVar5);

    }

    iVar1 = *(int *)(param_1 + 0x6c);

  } while( true );

}





// --- FUN_0069bcf0 at 0x0069BCF0 (size: 531) ---


void FUN_0069bcf0(undefined4 param_1,int param_2,uint param_3)



{

  int iVar1;

  undefined *puVar2;

  undefined *puVar3;

  uint uVar4;

  char cVar5;

  undefined *puVar6;

  byte *pbVar7;

  int *piVar8;

  undefined4 *puVar9;

  undefined4 *puVar10;

  uint uVar11;

  undefined4 *puVar12;

  undefined1 local_c [12];

  

  uVar4 = param_3;

  if ((~*(byte *)(param_3 + 4) & 1) != 0) {

    FUN_005c2c80();

  }

  puVar3 = PTR_DAT_00818558;

  puVar2 = PTR_DAT_00818554;

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    param_3 = *(uint *)(param_2 + 0x68);

    puVar6 = (undefined *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_3,param_3,0);

    if (puVar6 == puVar3) {

      puVar6 = puVar6 + -4;

    }

    uVar11 = (int)puVar6 - (int)puVar2 >> 2;

  }

  else {

    uVar11 = param_3 & 0xff;

  }

  FUN_0040ad10(1);

  pbVar7 = (byte *)FUN_0040acf0(1);

  if (pbVar7 != (byte *)0x0) {

    if ((*(byte *)(uVar4 + 4) & 1) == 0) {

      uVar11 = (uint)*pbVar7;

    }

    else {

      *pbVar7 = (byte)uVar11;

    }

  }

  if ((*(byte *)(uVar4 + 4) & 5) == 0) {

    if ((uVar11 & 0xff) < DAT_007956cc) {

      FUN_0069bba0(*(undefined4 *)(PTR_DAT_00818554 + (uVar11 & 0xff) * 4));

    }

    else {

      FUN_0040aa50();

    }

  }

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    param_3 = *(uint *)(param_2 + 0x6c);

  }

  FUN_00401a80(&param_3,&param_3,uVar4);

  if (((byte)*(undefined4 *)(uVar4 + 4) & 5) == 1) {

    piVar8 = (int *)FUN_0052dcf0(local_c);

    iVar1 = *piVar8;

    puVar12 = (undefined4 *)piVar8[1];

    puVar9 = (undefined4 *)piVar8[2];

LAB_0069bdf2:

    puVar10 = puVar9;

    if (puVar9 != (undefined4 *)0x0) {

      do {

        FUN_0040ad10(4);

        puVar9 = (undefined4 *)FUN_0040acf0(4);

        if (puVar9 != (undefined4 *)0x0) {

          if ((*(byte *)(uVar4 + 4) & 1) == 0) {

            *puVar10 = *puVar9;

          }

          else {

            *puVar9 = *puVar10;

          }

        }

        (**(code **)(puVar10[2] + 4))(uVar4);

        puVar10 = (undefined4 *)puVar10[1];

      } while (puVar10 != (undefined4 *)0x0);

      do {

        puVar12 = puVar12 + 1;

        puVar9 = puVar10;

        if (puVar12 == (undefined4 *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4)) break;

        puVar9 = (undefined4 *)*puVar12;

      } while (puVar9 == (undefined4 *)0x0);

      goto LAB_0069bdf2;

    }

  }

  if ((*(byte *)(uVar4 + 4) & 5) == 0) {

    uVar11 = FUN_0040a8f0();

    if (uVar11 < param_3) {

LAB_0069bef4:

      FUN_0040aa50();

    }

    else {

      uVar11 = 0;

      puVar12 = (undefined4 *)0x0;

      if (param_3 != 0) {

        while( true ) {

          puVar9 = (undefined4 *)FUN_005df0f5(0xb0);

          if (puVar9 == (undefined4 *)0x0) {

            puVar9 = (undefined4 *)0x0;

          }

          else {

            puVar9[1] = 0;

            FUN_0069d010();

          }

          FUN_0040ad10(4);

          puVar10 = (undefined4 *)FUN_0040acf0(4);

          if (puVar10 != (undefined4 *)0x0) {

            if ((*(byte *)(uVar4 + 4) & 1) == 0) {

              *puVar9 = *puVar10;

            }

            else {

              *puVar10 = *puVar9;

            }

          }

          (**(code **)(puVar9[2] + 4))(uVar4);

          if ((*(uint *)(uVar4 + 4) >> 2 & 1) != 0) break;

          cVar5 = FUN_00599310(puVar9,puVar12);

          if (cVar5 == '\0') goto LAB_0069bef4;

          uVar11 = uVar11 + 1;

          puVar12 = puVar9;

          if (param_3 <= uVar11) {

            return;

          }

        }

      }

    }

  }

  return;

}





// --- FUN_0069bf10 at 0x0069BF10 (size: 335) ---


int __thiscall FUN_0069bf10(int param_1,int param_2)



{

  undefined *puVar1;

  int iVar2;

  undefined4 *puVar3;

  int *piVar4;

  uint uVar5;

  uint uVar6;

  uint *puVar7;

  uint *puVar8;

  uint *puVar9;

  undefined1 local_18 [4];

  undefined4 *local_14;

  int local_c;

  

  iVar2 = param_2;

  if (param_1 != param_2) {

    FUN_0069bc60();

    puVar1 = PTR_DAT_00818558;

    param_2 = *(undefined4 *)(iVar2 + 0x6c);

    puVar3 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

    if (puVar3 == (undefined4 *)puVar1) {

      puVar3 = puVar3 + -1;

    }

    FUN_00682af0(*puVar3);

    puVar7 = (uint *)0x0;

    piVar4 = (int *)FUN_0052dcf0(local_18);

    local_c = *piVar4;

    puVar9 = (uint *)piVar4[2];

    local_14 = (undefined4 *)piVar4[1];

    while (puVar8 = puVar7, puVar9 != (uint *)0x0) {

      do {

        puVar7 = (uint *)FUN_005df0f5(0xb0);

        if (puVar7 == (uint *)0x0) {

          puVar7 = (uint *)0x0;

        }

        else {

          *puVar7 = *puVar9;

          puVar7[1] = 0;

          FUN_0069dc20(puVar9 + 2);

        }

        uVar5 = *puVar7 % *(uint *)(param_1 + 0x6c);

        if (puVar8 == (uint *)0x0) {

LAB_0069bff2:

          puVar3 = (undefined4 *)(*(int *)(param_1 + 100) + uVar5 * 4);

          *puVar3 = puVar7;

          if (puVar8 == (uint *)0x0) {

            *(undefined4 **)(param_1 + 0x68) = puVar3;

          }

LAB_0069c008:

          *(int *)(param_1 + 0x70) = *(int *)(param_1 + 0x70) + 1;

        }

        else {

          uVar6 = *puVar8 % *(uint *)(param_1 + 0x6c);

          if (uVar5 == uVar6) {

            puVar8[1] = (uint)puVar7;

            goto LAB_0069c008;

          }

          if (uVar6 < uVar5) goto LAB_0069bff2;

        }

        puVar9 = (uint *)puVar9[1];

        puVar8 = puVar7;

      } while (puVar9 != (uint *)0x0);

      do {

        local_14 = local_14 + 1;

        if (local_14 == (undefined4 *)(*(int *)(local_c + 0x60) + *(int *)(local_c + 0x68) * 4)) {

          return param_1;

        }

        puVar9 = (uint *)*local_14;

      } while (puVar9 == (uint *)0x0);

    }

  }

  return param_1;

}





// --- FUN_0069c060 at 0x0069C060 (size: 82) ---


undefined4 * __thiscall FUN_0069c060(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00801f70;

  FUN_0069bc60();

  param_1[1] = &PTR_FUN_00801e64;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069c0c0 at 0x0069C0C0 (size: 183) ---


void __fastcall FUN_0069c0c0(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)(param_1[0x70] + -0x14);

  *param_1 = &PTR_FUN_00801f74;

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x70] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  puVar2 = (undefined4 *)(param_1[0x6f] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x6f] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  param_1[0x51] = &PTR_FUN_00801c54;

  FUN_0069aaa0();

  FUN_0069a6b0();

  param_1[0x34] = &PTR_FUN_00801f70;

  FUN_0069bc60();

  param_1[0x35] = &PTR_FUN_00801e64;

  if ((undefined4 *)param_1[0x4d] != param_1 + 0x36) {

    operator_delete__((undefined4 *)param_1[0x4d]);

  }

  param_1[0x4d] = 0;

  param_1[0x4e] = 0;

  param_1[0x4f] = 0;

  param_1[0x50] = 0;

  FUN_0069d120();

  return;

}





// --- FUN_0069c180 at 0x0069C180 (size: 30) ---


void * __thiscall FUN_0069c180(void *param_1,byte param_2)



{

  FUN_0069c0c0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069c1a0 at 0x0069C1A0 (size: 179) ---


undefined4 * __fastcall FUN_0069c1a0(undefined4 *param_1)



{

  LONG *lpAddend;

  

  FUN_0069d010();

  *param_1 = &PTR_FUN_00801f74;

  param_1[0x2a] = 0;

  param_1[0x2b] = 0;

  param_1[0x2c] = 0;

  param_1[0x2d] = 0;

  param_1[0x2e] = DAT_008fa0e0;

  param_1[0x2f] = 0;

  param_1[0x30] = 0;

  param_1[0x31] = 0;

  param_1[0x32] = 0;

  param_1[0x33] = 0;

  param_1[0x34] = &PTR_FUN_00801f70;

  FUN_0069bb10(0x17);

  param_1[0x51] = &PTR_FUN_00801c54;

  FUN_0069a890(0x17);

  param_1[0x6e] = 0;

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x6f] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  FUN_00401340(&DAT_007938af);

  return param_1;

}





// --- FUN_0069c260 at 0x0069C260 (size: 329) ---


int __thiscall FUN_0069c260(int param_1,int param_2)



{

  int iVar1;

  LONG LVar2;

  

  if (param_1 != param_2) {

    FUN_0069dbb0(param_2);

    *(undefined4 *)(param_1 + 0xa8) = *(undefined4 *)(param_2 + 0xa8);

    *(undefined4 *)(param_1 + 0xac) = *(undefined4 *)(param_2 + 0xac);

    *(undefined4 *)(param_1 + 0xb0) = *(undefined4 *)(param_2 + 0xb0);

    *(undefined4 *)(param_1 + 0xb4) = *(undefined4 *)(param_2 + 0xb4);

    *(undefined4 *)(param_1 + 0xb8) = *(undefined4 *)(param_2 + 0xb8);

    *(undefined4 *)(param_1 + 0xbc) = *(undefined4 *)(param_2 + 0xbc);

    *(undefined4 *)(param_1 + 0xc0) = *(undefined4 *)(param_2 + 0xc0);

    *(undefined4 *)(param_1 + 0xc4) = *(undefined4 *)(param_2 + 0xc4);

    *(undefined4 *)(param_1 + 200) = *(undefined4 *)(param_2 + 200);

    *(undefined4 *)(param_1 + 0xcc) = *(undefined4 *)(param_2 + 0xcc);

    FUN_0069bf10(param_2 + 0xd0);

    FUN_0069aeb0(param_2 + 0x144);

    *(undefined4 *)(param_1 + 0x1b8) = *(undefined4 *)(param_2 + 0x1b8);

    iVar1 = *(int *)(param_1 + 0x1bc);

    if (iVar1 != *(int *)(param_2 + 0x1bc)) {

      LVar2 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

      if ((LVar2 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

      }

      iVar1 = *(int *)(param_2 + 0x1bc);

      *(int *)(param_1 + 0x1bc) = iVar1;

      InterlockedIncrement((LONG *)(iVar1 + -0x10));

    }

    iVar1 = *(int *)(param_1 + 0x1c0);

    if (iVar1 != *(int *)(param_2 + 0x1c0)) {

      LVar2 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

      if ((LVar2 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

      }

      iVar1 = *(int *)(param_2 + 0x1c0);

      *(int *)(param_1 + 0x1c0) = iVar1;

      InterlockedIncrement((LONG *)(iVar1 + -0x10));

    }

  }

  return param_1;

}





// --- FUN_0069c3b0 at 0x0069C3B0 (size: 125) ---


undefined4 * __thiscall FUN_0069c3b0(undefined4 *param_1,undefined4 param_2)



{

  LONG *pLVar1;

  

  FUN_0069d010();

  *param_1 = &PTR_FUN_00801f74;

  param_1[0x34] = &PTR_FUN_00801f70;

  FUN_0069bb10(0x17);

  param_1[0x51] = &PTR_FUN_00801c54;

  FUN_0069a890(0x17);

  pLVar1 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x6f] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x70] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  FUN_0069c260(param_2);

  return param_1;

}





// --- FUN_0069c430 at 0x0069C430 (size: 1526) ---


undefined4 __thiscall FUN_0069c430(int param_1,int param_2)



{

  uint uVar1;

  uint *puVar2;

  int iVar3;

  char cVar4;

  int *piVar5;

  undefined4 *puVar6;

  uint *puVar7;

  int iVar8;

  undefined4 *puVar9;

  uint *puVar10;

  bool local_45;

  int local_44;

  uint *local_40;

  int local_3c;

  int local_38;

  undefined4 *local_34;

  uint *local_30;

  undefined1 local_2c [12];

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  int local_4;

  

  local_10 = *(int *)(param_1 + 0x10);

  local_c = *(int *)(param_1 + 0x14);

  local_8 = *(int *)(param_1 + 0x18) + -1 + local_10;

  local_4 = *(int *)(param_1 + 0x1c) + -1 + local_c;

  cVar4 = FUN_0069db30(param_2);

  local_45 = cVar4 != '\0';

  local_20 = *(int *)(param_1 + 0x10);

  local_1c = *(int *)(param_1 + 0x14);

  iVar8 = *(int *)(param_1 + 0x18) + -1 + local_20;

  local_14 = *(int *)(param_1 + 0x1c) + -1 + local_1c;

  *(undefined4 *)(param_1 + 0xa8) = *(undefined4 *)(param_2 + 0xa8);

  *(undefined4 *)(param_1 + 0xbc) = *(undefined4 *)(param_2 + 0xbc);

  *(undefined4 *)(param_1 + 0xc0) = *(undefined4 *)(param_2 + 0xc0);

  *(undefined4 *)(param_1 + 0xc4) = *(undefined4 *)(param_2 + 0xc4);

  *(undefined4 *)(param_1 + 200) = *(undefined4 *)(param_2 + 200);

  *(undefined4 *)(param_1 + 0xcc) = *(undefined4 *)(param_2 + 0xcc);

  local_3c = param_2 + 0xd4;

  *(undefined4 *)(param_1 + 0x1b8) = *(undefined4 *)(param_2 + 0x1b8);

  local_18 = iVar8;

  piVar5 = (int *)FUN_0052dcf0(local_2c);

  puVar7 = (uint *)piVar5[2];

  local_38 = *piVar5;

  puVar6 = (undefined4 *)piVar5[1];

  while (puVar7 != (uint *)0x0) {

    do {

      local_40 = (uint *)*puVar7;

      for (puVar10 = *(uint **)(*(int *)(param_1 + 0x134) +

                               ((uint)local_40 % *(uint *)(param_1 + 0x13c)) * 4);

          puVar10 != (uint *)0x0; puVar10 = (uint *)puVar10[1]) {

        if ((uint *)*puVar10 == local_40) {

          if ((puVar10 != (uint *)0x0) && (puVar10 != (uint *)0xfffffff8)) {

            cVar4 = FUN_0069db30(puVar7 + 2);

            if (cVar4 == '\0') {

              local_45 = false;

            }

            goto LAB_0069c552;

          }

          break;

        }

      }

      FUN_0069bbf0(&local_40,puVar7 + 2);

LAB_0069c552:

      puVar7 = (uint *)puVar7[1];

    } while (puVar7 != (uint *)0x0);

    do {

      puVar6 = puVar6 + 1;

      iVar8 = local_18;

      if (puVar6 == (undefined4 *)(*(int *)(local_38 + 0x60) + *(int *)(local_38 + 0x68) * 4))

      goto LAB_0069c57e;

      puVar7 = (uint *)*puVar6;

    } while (puVar7 == (uint *)0x0);

  }

LAB_0069c57e:

  piVar5 = *(int **)(param_1 + 0x1ac);

  local_44 = 0;

  while (piVar5 != (int *)(*(int *)(param_1 + 0x1a8) + *(int *)(param_1 + 0x1b0) * 4)) {

    if (**(int **)(param_1 + 0x1ac) != 0) {

      puVar6 = *(undefined4 **)(param_1 + 0x1ac);

      puVar7 = (uint *)*puVar6;

      goto LAB_0069c5f2;

    }

    piVar5 = *(int **)(param_1 + 0x1ac) + 1;

    *(int **)(param_1 + 0x1ac) = piVar5;

  }

  puVar6 = (undefined4 *)0x0;

  puVar7 = (uint *)0x0;

LAB_0069c5f2:

  if (puVar7 != (uint *)0x0) {

    local_40 = *(uint **)(param_2 + 0x1a8);

    do {

      do {

        for (puVar10 = (uint *)local_40[*puVar7 % *(uint *)(param_2 + 0x1b0)];

            puVar10 != (uint *)0x0; puVar10 = (uint *)puVar10[1]) {

          if (*puVar10 == *puVar7) {

            if (puVar10 != (uint *)0x0) goto LAB_0069c638;

            break;

          }

        }

        local_44 = local_44 + 1;

LAB_0069c638:

        puVar7 = (uint *)puVar7[1];

      } while (puVar7 != (uint *)0x0);

      do {

        puVar6 = puVar6 + 1;

        iVar8 = local_18;

        if (puVar6 == (undefined4 *)(*(int *)(param_1 + 0x1a8) + *(int *)(param_1 + 0x1b0) * 4))

        goto LAB_0069c666;

        puVar7 = (uint *)*puVar6;

      } while (puVar7 == (uint *)0x0);

    } while (puVar7 != (uint *)0x0);

  }

LAB_0069c666:

  piVar5 = *(int **)(param_2 + 0x1ac);

  while (piVar5 != (int *)(*(int *)(param_2 + 0x1a8) + *(int *)(param_2 + 0x1b0) * 4)) {

    if (**(int **)(param_2 + 0x1ac) != 0) {

      puVar6 = *(undefined4 **)(param_2 + 0x1ac);

      local_30 = (uint *)*puVar6;

      goto joined_r0x0069c6b1;

    }

    piVar5 = *(int **)(param_2 + 0x1ac) + 1;

    *(int **)(param_2 + 0x1ac) = piVar5;

  }

  puVar6 = (undefined4 *)0x0;

  local_30 = (uint *)0x0;

joined_r0x0069c6b1:

  while (local_34 = puVar6, local_30 != (uint *)0x0) {

    do {

      puVar10 = local_30;

      uVar1 = *local_30;

      local_40 = local_30 + 2;

      for (puVar7 = *(uint **)(*(int *)(param_1 + 0x1a8) + (uVar1 % *(uint *)(param_1 + 0x1b0)) * 4)

          ; puVar7 != (uint *)0x0; puVar7 = (uint *)puVar7[1]) {

        if (*puVar7 == uVar1) {

          if ((puVar7 != (uint *)0x0) && (puVar7 != (uint *)0xfffffff8)) {

            cVar4 = FUN_0069c430(local_40);

            if (cVar4 == '\0') {

              local_45 = false;

            }

            goto LAB_0069c7e1;

          }

          break;

        }

      }

      puVar7 = (uint *)FUN_005df0f5(0x1cc);

      if (puVar7 == (uint *)0x0) {

        puVar7 = (uint *)0x0;

      }

      else {

        *puVar7 = uVar1;

        puVar7[1] = 0;

        FUN_0069c3b0(local_40);

      }

      puVar10 = (uint *)(*(int *)(param_1 + 0x1a8) + (*puVar7 % *(uint *)(param_1 + 0x1b0)) * 4);

      for (puVar2 = (uint *)*puVar10; puVar2 != (uint *)0x0; puVar2 = (uint *)puVar2[1]) {

        if (*puVar2 == *puVar7) {

          if (puVar2 != (uint *)0x0) {

            FUN_0069c0c0();

            operator_delete(puVar7);

            goto LAB_0069c79f;

          }

          break;

        }

      }

      puVar7[1] = *puVar10;

      *puVar10 = (uint)puVar7;

      if (puVar10 < *(uint **)(param_1 + 0x1ac)) {

        *(uint **)(param_1 + 0x1ac) = puVar10;

      }

      *(int *)(param_1 + 0x1b4) = *(int *)(param_1 + 0x1b4) + 1;

LAB_0069c79f:

      for (puVar7 = *(uint **)(*(int *)(param_1 + 0x1a8) + (uVar1 % *(uint *)(param_1 + 0x1b0)) * 4)

          ; puVar7 != (uint *)0x0; puVar7 = (uint *)puVar7[1]) {

        if (*puVar7 == uVar1) {

          if (puVar7 != (uint *)0x0) {

            puVar7 = puVar7 + 2;

            goto LAB_0069c7c7;

          }

          break;

        }

      }

      puVar7 = (uint *)0x0;

LAB_0069c7c7:

      puVar7[0x6e] = puVar7[0x6e] + local_44;

      puVar6 = local_34;

      puVar10 = local_30;

LAB_0069c7e1:

      local_30 = (uint *)puVar10[1];

    } while (local_30 != (uint *)0x0);

    do {

      puVar6 = puVar6 + 1;

      local_30 = (uint *)0x0;

      iVar8 = local_18;

      local_34 = puVar6;

      if (puVar6 == (undefined4 *)(*(int *)(param_2 + 0x1a8) + *(int *)(param_2 + 0x1b0) * 4))

      goto LAB_0069c827;

      local_30 = (uint *)*puVar6;

    } while (local_30 == (uint *)0x0);

  }

LAB_0069c827:

  iVar3 = local_3c;

  if (((local_8 - local_10) + 1 != (iVar8 - local_20) + 1) ||

     (puVar6 = (undefined4 *)((local_14 - local_1c) + 1),

     (undefined4 *)((local_4 - local_c) + 1) != puVar6)) {

    piVar5 = *(int **)(param_1 + 0x138);

    while (piVar5 != (int *)(*(int *)(param_1 + 0x134) + *(int *)(param_1 + 0x13c) * 4)) {

      if (**(int **)(param_1 + 0x138) != 0) {

        puVar6 = *(undefined4 **)(param_1 + 0x138);

        puVar7 = (uint *)*puVar6;

        goto joined_r0x0069c8ac;

      }

      piVar5 = *(int **)(param_1 + 0x138) + 1;

      *(int **)(param_1 + 0x138) = piVar5;

    }

    puVar6 = (undefined4 *)0x0;

    puVar7 = (uint *)0x0;

joined_r0x0069c8ac:

    while (puVar7 != (uint *)0x0) {

      do {

        for (puVar10 = *(uint **)(*(int *)(iVar3 + 0x60) + (*puVar7 % *(uint *)(iVar3 + 0x68)) * 4);

            puVar10 != (uint *)0x0; puVar10 = (uint *)puVar10[1]) {

          if (*puVar10 == *puVar7) {

            if (puVar10 != (uint *)0x0) goto LAB_0069c910;

            break;

          }

        }

        (**(code **)(puVar7[2] + 0x20))

                  (&local_10,&local_20,*(undefined4 *)(param_1 + 0xc0),

                   *(undefined4 *)(param_1 + 0xc4),*(undefined4 *)(param_1 + 200),

                   *(undefined4 *)(param_1 + 0xcc));

LAB_0069c910:

        puVar7 = (uint *)puVar7[1];

      } while (puVar7 != (uint *)0x0);

      do {

        puVar6 = puVar6 + 1;

        if (puVar6 == (undefined4 *)(*(int *)(param_1 + 0x134) + *(int *)(param_1 + 0x13c) * 4))

        goto LAB_0069c93e;

        puVar7 = (uint *)*puVar6;

      } while (puVar7 == (uint *)0x0);

    }

LAB_0069c93e:

    piVar5 = *(int **)(param_1 + 0x1ac);

    while (piVar5 != (int *)(*(int *)(param_1 + 0x1a8) + *(int *)(param_1 + 0x1b0) * 4)) {

      if (**(int **)(param_1 + 0x1ac) != 0) {

        puVar6 = *(undefined4 **)(param_1 + 0x1ac);

        puVar7 = (uint *)*puVar6;

        puVar9 = puVar6;

        goto joined_r0x0069c98a;

      }

      piVar5 = *(int **)(param_1 + 0x1ac) + 1;

      *(int **)(param_1 + 0x1ac) = piVar5;

    }

    puVar6 = (undefined4 *)0x0;

    puVar7 = (uint *)0x0;

    puVar9 = puVar6;

joined_r0x0069c98a:

    while (puVar7 != (uint *)0x0) {

      do {

        for (puVar10 = *(uint **)(*(int *)(param_2 + 0x1a8) +

                                 (*puVar7 % *(uint *)(param_2 + 0x1b0)) * 4); puVar10 != (uint *)0x0

            ; puVar10 = (uint *)puVar10[1]) {

          if (*puVar10 == *puVar7) {

            if (puVar10 != (uint *)0x0) goto LAB_0069c9f0;

            break;

          }

        }

        (**(code **)(puVar7[2] + 0x20))

                  (&local_10,&local_20,puVar7[0x32],puVar7[0x33],puVar7[0x34],puVar7[0x35]);

LAB_0069c9f0:

        puVar7 = (uint *)puVar7[1];

      } while (puVar7 != (uint *)0x0);

      puVar6 = (undefined4 *)(*(int *)(param_1 + 0x1a8) + *(int *)(param_1 + 0x1b0) * 4);

      do {

        puVar9 = puVar9 + 1;

        if (puVar9 == puVar6) goto LAB_0069ca1e;

        puVar7 = (uint *)*puVar9;

      } while (puVar7 == (uint *)0x0);

    }

  }

LAB_0069ca1e:

  return CONCAT31((int3)((uint)puVar6 >> 8),local_45);

}





// --- FUN_0069ca30 at 0x0069CA30 (size: 809) ---


void __thiscall FUN_0069ca30(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  

  iVar1 = param_2;

  iVar2 = FUN_0040a960(0x55494c20);

  FUN_0069d480(iVar1);

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0x1b8) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 0x1b8);

    }

  }

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0xa8) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 0xa8);

    }

  }

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0xac) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 0xac);

    }

  }

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0xb4) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 0xb4);

    }

  }

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0xb8) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 0xb8);

    }

  }

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0xbc) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 0xbc);

    }

  }

  if (iVar2 != 0) {

    if ((*(byte *)(param_1 + 4) & 2) != 0) {

      FUN_0040ad10(4);

      puVar3 = (undefined4 *)FUN_0040acf0(4);

      if (puVar3 != (undefined4 *)0x0) {

        if ((*(byte *)(iVar1 + 4) & 1) == 0) {

          *(undefined4 *)(param_1 + 0x10) = *puVar3;

        }

        else {

          *puVar3 = *(undefined4 *)(param_1 + 0x10);

        }

      }

    }

    if ((*(byte *)(param_1 + 4) & 4) != 0) {

      FUN_0040ad10(4);

      puVar3 = (undefined4 *)FUN_0040acf0(4);

      if (puVar3 != (undefined4 *)0x0) {

        if ((*(byte *)(iVar1 + 4) & 1) == 0) {

          *(undefined4 *)(param_1 + 0x14) = *puVar3;

        }

        else {

          *puVar3 = *(undefined4 *)(param_1 + 0x14);

        }

      }

    }

    if ((*(byte *)(param_1 + 4) & 8) != 0) {

      FUN_0040ad10(4);

      puVar3 = (undefined4 *)FUN_0040acf0(4);

      if (puVar3 != (undefined4 *)0x0) {

        if ((*(byte *)(iVar1 + 4) & 1) == 0) {

          *(undefined4 *)(param_1 + 0x18) = *puVar3;

        }

        else {

          *puVar3 = *(undefined4 *)(param_1 + 0x18);

        }

      }

    }

    if ((*(byte *)(param_1 + 4) & 0x10) != 0) {

      FUN_0040ad10(4);

      puVar3 = (undefined4 *)FUN_0040acf0(4);

      if (puVar3 != (undefined4 *)0x0) {

        if ((*(byte *)(iVar1 + 4) & 1) == 0) {

          *(undefined4 *)(param_1 + 0x1c) = *puVar3;

        }

        else {

          *puVar3 = *(undefined4 *)(param_1 + 0x1c);

        }

      }

    }

    if ((*(byte *)(param_1 + 4) & 0x20) != 0) {

      FUN_0040ad10(4);

      puVar3 = (undefined4 *)FUN_0040acf0(4);

      if (puVar3 != (undefined4 *)0x0) {

        if ((*(byte *)(iVar1 + 4) & 1) == 0) {

          *(undefined4 *)(param_1 + 0x20) = *puVar3;

        }

        else {

          *puVar3 = *(undefined4 *)(param_1 + 0x20);

        }

      }

    }

  }

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0xc0) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 0xc0);

    }

  }

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0xc4) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 0xc4);

    }

  }

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 200) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 200);

    }

  }

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0xcc) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 0xcc);

    }

  }

  if ((~*(byte *)(iVar1 + 4) & 1) != 0) {

    FUN_0069bc60();

  }

  FUN_0069bcf0(&param_2,param_1 + 0xd4,iVar1);

  if ((~*(byte *)(iVar1 + 4) & 1) != 0) {

    FUN_0069aaa0();

  }

  FUN_0069ab30(&param_2,param_1 + 0x148,iVar1);

  return;

}





// --- FUN_0069cd60 at 0x0069CD60 (size: 68) ---


void __thiscall FUN_0069cd60(int param_1,undefined4 param_2)



{

  int *piVar1;

  uint uVar2;

  

  FUN_00680eb0(param_2);

  if (*(int *)(param_1 + 0xa4) != 0) {

    uVar2 = 0;

    do {

      piVar1 = *(int **)(*(int *)(param_1 + 0x9c) + uVar2 * 4);

      if (piVar1 != (int *)0x0) {

        (**(code **)(*piVar1 + 8))(param_2);

      }

      uVar2 = uVar2 + 1;

    } while (uVar2 < *(uint *)(param_1 + 0xa4));

  }

  return;

}





// --- FUN_0069cdb0 at 0x0069CDB0 (size: 598) ---


void __thiscall

FUN_0069cdb0(int param_1,int *param_2,int *param_3,int param_4,int param_5,int param_6,int param_7)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int local_20;

  int local_1c;

  

  iVar1 = *(int *)(param_1 + 0x14);

  iVar2 = *(int *)(param_1 + 0x10);

  iVar8 = *(int *)(param_1 + 0x1c) + -1 + iVar1;

  iVar3 = param_3[2];

  iVar4 = *param_3;

  iVar7 = *(int *)(param_1 + 0x18) + -1 + iVar2;

  iVar10 = ((*param_2 - iVar4) - param_2[2]) + iVar3;

  iVar5 = param_3[1];

  iVar6 = param_3[3];

  iVar9 = ((iVar6 - iVar5) - param_2[3]) + param_2[1];

  if (param_4 == 2) {

    local_20 = iVar10 + iVar2;

  }

  else if (param_4 == 3) {

    local_20 = ((iVar3 - iVar4) + 1) / 2 - ((iVar7 - iVar2) + 1) / 2;

  }

  else {

    local_20 = iVar2;

    if (param_4 == 4) {

      local_20 = FUN_005df4c4();

    }

  }

  if (param_6 == 1) {

    iVar7 = iVar7 + iVar10;

  }

  else if (param_6 == 3) {

    iVar7 = ((iVar3 - iVar4) + 1) / 2 + -1 + ((iVar7 - iVar2) + 1) / 2;

  }

  else if (param_6 == 4) {

    iVar7 = FUN_005df4c4();

  }

  if (param_5 == 2) {

    local_1c = iVar1 + iVar9;

  }

  else if (param_5 == 3) {

    local_1c = ((iVar6 - iVar5) + 1) / 2 - ((iVar8 - iVar1) + 1) / 2;

  }

  else {

    local_1c = iVar1;

    if (param_5 == 4) {

      local_1c = FUN_005df4c4();

    }

  }

  if (param_7 == 1) {

    iVar8 = iVar8 + iVar9;

  }

  else if (param_7 == 3) {

    iVar8 = ((iVar6 - iVar5) + 1) / 2 + -1 + ((iVar8 - iVar1) + 1) / 2;

  }

  else if (param_7 == 4) {

    iVar8 = FUN_005df4c4();

  }

  *(int *)(param_1 + 0x18) = (iVar7 - local_20) + 1;

  *(int *)(param_1 + 0x10) = local_20;

  *(int *)(param_1 + 0x14) = local_1c;

  *(int *)(param_1 + 0x1c) = (iVar8 - local_1c) + 1;

  return;

}





// --- FUN_0069d010 at 0x0069D010 (size: 70) ---


undefined4 * __fastcall FUN_0069d010(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00801f98;

  param_1[1] = 0;

  param_1[2] = 0;

  *(undefined1 *)(param_1 + 3) = 0;

  *(undefined1 *)((int)param_1 + 0xd) = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  FUN_006823d0();

  param_1[0x27] = 0;

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  return param_1;

}





// --- FUN_0069d070 at 0x0069D070 (size: 156) ---


void __fastcall FUN_0069d070(int param_1)



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  

  uVar3 = 0;

  if (*(int *)(param_1 + 0xa4) != 0) {

    do {

      puVar1 = *(undefined4 **)(*(int *)(param_1 + 0x9c) + uVar3 * 4);

      if (puVar1 != (undefined4 *)0x0) {

        (**(code **)*puVar1)(1);

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0xa4));

  }

  *(undefined4 *)(param_1 + 0xa4) = 0;

  if ((*(uint *)(param_1 + 0xa0) & 0x80000000) == 0x80000000) {

    operator_delete__(*(void **)(param_1 + 0x9c));

    *(undefined4 *)(param_1 + 0x9c) = 0;

    *(undefined4 *)(param_1 + 0xa0) = 0;

    return;

  }

  if (*(int *)(param_1 + 0x9c) != 0) {

    iVar2 = (*(uint *)(param_1 + 0xa0) & 0x7fffffff) - 1;

    while (-1 < iVar2) {

      iVar2 = iVar2 + -1;

      *(undefined4 *)(*(int *)(param_1 + 0x9c) + 4 + iVar2 * 4) = 0;

    }

  }

  return;

}





// --- FUN_0069d120 at 0x0069D120 (size: 56) ---


void __fastcall FUN_0069d120(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00801f98;

  FUN_0069d070();

  if ((param_1[0x28] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[0x27]);

  }

  FUN_00681f60();

  return;

}





// --- FUN_0069d160 at 0x0069D160 (size: 367) ---


uint __thiscall FUN_0069d160(int *param_1,int param_2)



{

  int *piVar1;

  uint in_EAX;

  int iVar2;

  uint uVar3;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  uint uVar4;

  undefined4 uVar5;

  

  if (param_2 == 0) goto LAB_0069d2c6;

  if (param_1[2] != 0) {

    iVar2 = DAT_008fa188;

    InterlockedIncrement((LONG *)(DAT_008fa188 + -0x10));

    iVar2 = FUN_00426f90(iVar2);

    in_EAX = 0;

    if (iVar2 == 0) goto LAB_0069d2c6;

    iVar2 = FUN_0068dc70(iVar2,0x14,param_1[2]);

    in_EAX = 0;

    if (iVar2 == 0) goto LAB_0069d2c6;

    if ((char)param_1[3] != '\0') {

      uVar5 = extraout_ECX;

      FUN_0041ab80(&DAT_008fa0f8);

      iVar2 = FUN_00426f90(uVar5);

      in_EAX = 0;

      if (iVar2 == 0) goto LAB_0069d2c6;

    }

  }

  if ((*(byte *)(param_1 + 1) & 1) != 0) {

    iVar2 = DAT_008fa15c;

    InterlockedIncrement((LONG *)(DAT_008fa15c + -0x10));

    iVar2 = FUN_00426f90(iVar2);

    in_EAX = 0;

    if (iVar2 == 0) goto LAB_0069d2c6;

    iVar2 = FUN_00679170(*(undefined1 *)((int)param_1 + 0xd));

    in_EAX = 0;

    if (iVar2 == 0) goto LAB_0069d2c6;

  }

  in_EAX = (**(code **)(*param_1 + 0x14))(param_2);

  if ((char)in_EAX != '\0') {

    if (param_1[0x26] == 0) {

LAB_0069d268:

      uVar4 = 0;

      uVar3 = 0;

      if (param_1[0x29] != 0) {

        do {

          piVar1 = *(int **)(param_1[0x27] + uVar4 * 4);

          if (piVar1 != (int *)0x0) {

            iVar2 = DAT_008fa148;

            InterlockedIncrement((LONG *)(DAT_008fa148 + -0x10));

            iVar2 = FUN_00426f90(iVar2);

            in_EAX = 0;

            if (iVar2 == 0) goto LAB_0069d2c6;

            in_EAX = (**(code **)(*piVar1 + 0x68))(iVar2);

            if ((char)in_EAX == '\0') goto LAB_0069d2c6;

          }

          uVar3 = param_1[0x29];

          uVar4 = uVar4 + 1;

        } while (uVar4 < uVar3);

      }

      return CONCAT31((int3)(uVar3 >> 8),1);

    }

    uVar5 = extraout_ECX_00;

    FUN_0041ab80(&DAT_008fa164);

    iVar2 = FUN_00426f90(uVar5);

    in_EAX = 0;

    if (iVar2 != 0) {

      in_EAX = FUN_00681b30(iVar2);

      if ((char)in_EAX != '\0') goto LAB_0069d268;

    }

  }

LAB_0069d2c6:

  return in_EAX & 0xffffff00;

}





// --- FUN_0069d300 at 0x0069D300 (size: 289) ---


void FUN_0069d300(undefined4 param_1,int *param_2,int param_3)



{

  int *piVar1;

  uint uVar2;

  uint *puVar3;

  int iVar4;

  uint uVar5;

  int *piVar6;

  uint local_4;

  

  piVar1 = param_2;

  local_4 = param_2[2];

  FUN_00401a80(param_1,&local_4,param_3);

  param_2 = (int *)((uint)param_2 & 0xffffff00);

  if ((~*(byte *)(param_3 + 4) & 1) != 0) {

    uVar2 = FUN_0040a8f0();

    uVar5 = local_4;

    if (uVar2 < local_4) {

      FUN_0040aa50();

      return;

    }

    if ((uint)piVar1[2] < local_4) {

      FUN_004180a0(local_4);

      piVar1[2] = uVar5;

    }

    else if (local_4 < (uint)piVar1[2]) {

      piVar1[2] = local_4;

      FUN_005bf480();

    }

    param_2 = (int *)CONCAT31(SUB43(piVar1,1),1);

  }

  piVar6 = (int *)*piVar1;

  uVar5 = (uint)param_2;

  if (piVar6 != piVar6 + piVar1[2]) {

    while( true ) {

      if ((*(byte *)(param_3 + 4) & 1) != 0) {

        uVar5 = *(uint *)(*piVar6 + 4);

      }

      FUN_0040ad10(4);

      puVar3 = (uint *)FUN_0040acf0(4);

      if (puVar3 != (uint *)0x0) {

        if ((*(byte *)(param_3 + 4) & 1) == 0) {

          uVar5 = *puVar3;

        }

        else {

          *puVar3 = uVar5;

        }

      }

      if ((~*(byte *)(param_3 + 4) & 1) != 0) {

        iVar4 = FUN_0069e230(uVar5);

        *piVar6 = iVar4;

      }

      if ((int *)*piVar6 != (int *)0x0) {

        (**(code **)(*(int *)*piVar6 + 4))(param_3);

      }

      if ((*(uint *)(param_3 + 4) >> 2 & 1) != 0) break;

      piVar6 = piVar6 + 1;

      if (piVar6 == (int *)(*piVar1 + piVar1[2] * 4)) {

        return;

      }

    }

    if (((char)param_2 != '\0') && (piVar1[2] != 0)) {

      piVar1[2] = 0;

      FUN_005bf480();

    }

  }

  return;

}





// --- FUN_0069d430 at 0x0069D430 (size: 77) ---


undefined4 * __thiscall FUN_0069d430(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00801f98;

  FUN_0069d070();

  if ((param_1[0x28] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[0x27]);

  }

  FUN_00681f60();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069d480 at 0x0069D480 (size: 409) ---


void __thiscall FUN_0069d480(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  

  iVar1 = param_2;

  iVar2 = FUN_0040a960(0x55494c20);

  if (((*(byte *)(iVar1 + 4) & 1) != 0) && (iVar2 == 0)) {

    FUN_0040aa50();

    return;

  }

  FUN_0040ad10(4);

  puVar3 = (undefined4 *)FUN_0040acf0(4);

  if (puVar3 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 8) = *puVar3;

    }

    else {

      *puVar3 = *(undefined4 *)(param_1 + 8);

    }

  }

  FUN_00422250(param_1 + 0xd,iVar1);

  if (iVar2 == 0) {

    FUN_0040ad10(4);

    puVar3 = (undefined4 *)FUN_0040acf0(4);

    if (puVar3 != (undefined4 *)0x0) {

      if ((*(byte *)(iVar1 + 4) & 1) == 0) {

        *(undefined4 *)(param_1 + 0x10) = *puVar3;

      }

      else {

        *puVar3 = *(undefined4 *)(param_1 + 0x10);

      }

    }

    FUN_0040ad10(4);

    puVar3 = (undefined4 *)FUN_0040acf0(4);

    if (puVar3 != (undefined4 *)0x0) {

      if ((*(byte *)(iVar1 + 4) & 1) == 0) {

        *(undefined4 *)(param_1 + 0x14) = *puVar3;

      }

      else {

        *puVar3 = *(undefined4 *)(param_1 + 0x14);

      }

    }

    FUN_0040ad10(4);

    puVar3 = (undefined4 *)FUN_0040acf0(4);

    if (puVar3 != (undefined4 *)0x0) {

      if ((*(byte *)(iVar1 + 4) & 1) == 0) {

        *(undefined4 *)(param_1 + 0x18) = *puVar3;

      }

      else {

        *puVar3 = *(undefined4 *)(param_1 + 0x18);

      }

    }

    FUN_0040ad10(4);

    puVar3 = (undefined4 *)FUN_0040acf0(4);

    if (puVar3 != (undefined4 *)0x0) {

      if ((*(byte *)(iVar1 + 4) & 1) == 0) {

        *(undefined4 *)(param_1 + 0x1c) = *puVar3;

      }

      else {

        *puVar3 = *(undefined4 *)(param_1 + 0x1c);

      }

    }

    FUN_0040ad10(4);

    puVar3 = (undefined4 *)FUN_0040acf0(4);

    if (puVar3 != (undefined4 *)0x0) {

      if ((*(byte *)(iVar1 + 4) & 1) == 0) {

        *(undefined4 *)(param_1 + 0x20) = *puVar3;

      }

      else {

        *puVar3 = *(undefined4 *)(param_1 + 0x20);

      }

    }

    FUN_00422250(&param_2,iVar1);

    *(uint *)(param_1 + 4) = *(uint *)(param_1 + 4) | 0x3e;

  }

  else {

    FUN_0040ad10(4);

    puVar3 = (undefined4 *)FUN_0040acf0(4);

    if (puVar3 != (undefined4 *)0x0) {

      if ((*(byte *)(iVar1 + 4) & 1) == 0) {

        *(undefined4 *)(param_1 + 4) = *puVar3;

      }

      else {

        *puVar3 = *(undefined4 *)(param_1 + 4);

      }

    }

  }

  FUN_00682420(iVar1);

  FUN_0069d300(&param_2,param_1 + 0x9c,iVar1);

  return;

}





// --- FUN_0069d620 at 0x0069D620 (size: 29) ---


void FUN_0069d620(undefined4 param_1,undefined4 param_2)



{

  FUN_00463700(&param_1,param_2);

  return;

}





// --- FUN_0069d7e0 at 0x0069D7E0 (size: 85) ---


undefined4 FUN_0069d7e0(int param_1)



{

  int iVar1;

  char cVar2;

  undefined4 extraout_ECX;

  undefined4 uVar3;

  

  iVar1 = param_1;

  if (param_1 != 0) {

    param_1 = FUN_0069e5f0(param_1);

    if (param_1 != 0) {

      cVar2 = FUN_004637a0(&param_1);

      if (cVar2 != '\0') {

        return 1;

      }

      uVar3 = extraout_ECX;

      FUN_00401340("StateDesc::LoadMedia, failed adding desc");

      FUN_0065d620(iVar1,uVar3);

    }

  }

  return 0;

}





// --- FUN_0069d840 at 0x0069D840 (size: 143) ---


void __thiscall FUN_0069d840(int param_1,int param_2)



{

  char cVar1;

  int iVar2;

  uint uVar3;

  undefined4 uVar4;

  uint uVar5;

  

  if ((param_1 != param_2) && (uVar5 = 0, *(int *)(param_2 + 0xa4) != 0)) {

    do {

      iVar2 = *(int *)(*(int *)(param_2 + 0x9c) + uVar5 * 4);

      if ((iVar2 != 0) && (iVar2 = FUN_0069e380(iVar2), iVar2 != 0)) {

        uVar3 = *(uint *)(param_1 + 0xa0) & 0x7fffffff;

        if (uVar3 <= *(uint *)(param_1 + 0xa4)) {

          uVar4 = FUN_00453850(uVar3 + 1);

          cVar1 = FUN_004180a0(uVar4);

          if (cVar1 == '\0') goto LAB_0069d8bc;

        }

        *(int *)(*(int *)(param_1 + 0x9c) + *(int *)(param_1 + 0xa4) * 4) = iVar2;

        *(int *)(param_1 + 0xa4) = *(int *)(param_1 + 0xa4) + 1;

      }

LAB_0069d8bc:

      uVar5 = uVar5 + 1;

    } while (uVar5 < *(uint *)(param_2 + 0xa4));

  }

  return;

}





// --- FUN_0069d8d0 at 0x0069D8D0 (size: 8) ---


void FUN_0069d8d0(void)



{

  FUN_004643e0();

  return;

}





// --- FUN_0069d8e0 at 0x0069D8E0 (size: 173) ---


void __thiscall FUN_0069d8e0(int param_1,undefined4 param_2,undefined4 param_3)



{

  char cVar1;

  int iVar2;

  undefined4 uVar3;

  uint uVar4;

  

  iVar2 = FUN_005df0f5(0x10);

  if ((iVar2 != 0) && (iVar2 = FUN_0069dc60(), iVar2 != 0)) {

    *(undefined4 *)(iVar2 + 8) = param_2;

    *(undefined4 *)(iVar2 + 0xc) = param_3;

    if (*(int *)(param_1 + 0xa4) != 0) {

      uVar4 = 0;

      do {

        *(undefined4 *)(*(int *)(param_1 + 0x9c) + uVar4 * 4) = 0;

        uVar4 = uVar4 + 1;

      } while (uVar4 < *(uint *)(param_1 + 0xa4));

    }

    *(undefined4 *)(param_1 + 0xa4) = 0;

    uVar4 = *(uint *)(param_1 + 0xa0) & 0x7fffffff;

    if (uVar4 <= *(uint *)(param_1 + 0xa4)) {

      uVar3 = FUN_00453850(uVar4 + 1);

      cVar1 = FUN_004180a0(uVar3);

      if (cVar1 == '\0') {

        return;

      }

    }

    *(int *)(*(int *)(param_1 + 0x9c) + *(int *)(param_1 + 0xa4) * 4) = iVar2;

    *(int *)(param_1 + 0xa4) = *(int *)(param_1 + 0xa4) + 1;

  }

  return;

}





// --- FUN_0069db30 at 0x0069DB30 (size: 115) ---


undefined4 __thiscall FUN_0069db30(int param_1,int param_2)



{

  *(uint *)(param_1 + 4) = *(uint *)(param_1 + 4) | *(uint *)(param_2 + 4);

  if ((*(byte *)(param_2 + 4) & 1) != 0) {

    *(undefined1 *)(param_1 + 0xd) = *(undefined1 *)(param_2 + 0xd);

  }

  if ((*(byte *)(param_2 + 4) & 2) != 0) {

    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x10);

  }

  if ((*(byte *)(param_2 + 4) & 4) != 0) {

    *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(param_2 + 0x14);

  }

  if ((*(byte *)(param_2 + 4) & 8) != 0) {

    *(undefined4 *)(param_1 + 0x18) = *(undefined4 *)(param_2 + 0x18);

  }

  if ((*(byte *)(param_2 + 4) & 0x10) != 0) {

    *(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)(param_2 + 0x1c);

  }

  if ((*(byte *)(param_2 + 4) & 0x20) != 0) {

    *(undefined4 *)(param_1 + 0x20) = *(undefined4 *)(param_2 + 0x20);

  }

  FUN_0069d840(param_2);

  FUN_006817e0(param_2 + 0x24,1);

  return 1;

}





// --- FUN_0069dbb0 at 0x0069DBB0 (size: 100) ---


int __thiscall FUN_0069dbb0(int param_1,int param_2)



{

  if (param_1 != param_2) {

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(param_2 + 8);

    *(undefined1 *)(param_1 + 0xc) = *(undefined1 *)(param_2 + 0xc);

    *(undefined1 *)(param_1 + 0xd) = *(undefined1 *)(param_2 + 0xd);

    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x10);

    *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(param_2 + 0x14);

    *(undefined4 *)(param_1 + 0x18) = *(undefined4 *)(param_2 + 0x18);

    *(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)(param_2 + 0x1c);

    *(undefined4 *)(param_1 + 0x20) = *(undefined4 *)(param_2 + 0x20);

    FUN_00682400(param_2 + 0x24);

    FUN_0069d070();

    FUN_0069d840(param_2);

  }

  return param_1;

}





// --- FUN_0069dc20 at 0x0069DC20 (size: 55) ---


undefined4 * __thiscall FUN_0069dc20(undefined4 *param_1,undefined4 param_2)



{

  *param_1 = &PTR_FUN_00801f98;

  FUN_006823d0();

  param_1[0x27] = 0;

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  FUN_0069dbb0(param_2);

  return param_1;

}





// --- FUN_0069dc60 at 0x0069DC60 (size: 35) ---


undefined4 * __fastcall FUN_0069dc60(undefined4 *param_1)



{

  FUN_0069e1e0(5);

  *param_1 = &PTR_FUN_008020e8;

  param_1[2] = DAT_008fa284;

  param_1[3] = 1;

  return param_1;

}





// --- FUN_0069dc90 at 0x0069DC90 (size: 65) ---


undefined4 * __thiscall FUN_0069dc90(undefined4 *param_1,undefined4 *param_2)



{

  FUN_0069e1d0();

  *param_1 = &PTR_FUN_008020e8;

  param_1[2] = DAT_008fa284;

  param_1[3] = 1;

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

  }

  return param_1;

}





// --- FUN_0069dcf0 at 0x0069DCF0 (size: 48) ---


undefined4 * __fastcall FUN_0069dcf0(undefined4 *param_1)



{

  LONG *lpAddend;

  

  FUN_0069e1e0(1);

  *param_1 = &PTR_FUN_00802180;

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[2] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  *(undefined1 *)(param_1 + 3) = 0;

  param_1[4] = 0;

  return param_1;

}





// --- FUN_0069dd20 at 0x0069DD20 (size: 124) ---


int __thiscall FUN_0069dd20(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 *puVar3;

  LONG LVar4;

  

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    iVar2 = *(int *)(param_1 + 8);

    if (iVar2 != *(int *)(param_2 + 8)) {

      LVar4 = InterlockedDecrement((LONG *)(iVar2 + -0x10));

      if ((LVar4 == 0) && ((undefined4 *)(iVar2 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(iVar2 + -0x14))(1);

      }

      iVar2 = *(int *)(param_2 + 8);

      *(int *)(param_1 + 8) = iVar2;

      InterlockedIncrement((LONG *)(iVar2 + -0x10));

    }

    puVar3 = *(undefined4 **)(param_1 + 0x10);

    *(undefined1 *)(param_1 + 0xc) = *(undefined1 *)(param_2 + 0xc);

    if (puVar3 != (undefined4 *)0x0) {

      piVar1 = puVar3 + 1;

      *piVar1 = *piVar1 + -1;

      if (*piVar1 == 0) {

        (**(code **)*puVar3)(1);

      }

      *(undefined4 *)(param_1 + 0x10) = 0;

    }

    iVar2 = *(int *)(param_2 + 0x10);

    *(int *)(param_1 + 0x10) = iVar2;

    if (iVar2 != 0) {

      *(int *)(iVar2 + 4) = *(int *)(iVar2 + 4) + 1;

    }

  }

  return param_1;

}





// --- FUN_0069dda0 at 0x0069DDA0 (size: 97) ---


undefined4 * __thiscall FUN_0069dda0(undefined4 *param_1,byte param_2)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  

  puVar3 = (undefined4 *)param_1[4];

  *param_1 = &PTR_FUN_00802180;

  if (puVar3 != (undefined4 *)0x0) {

    piVar1 = puVar3 + 1;

    *piVar1 = *piVar1 + -1;

    if (*piVar1 == 0) {

      (**(code **)*puVar3)(1);

    }

    param_1[4] = 0;

  }

  puVar3 = (undefined4 *)(param_1[2] + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(param_1[2] + -0x10));

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  FUN_0069e200();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069de10 at 0x0069DE10 (size: 60) ---


undefined4 * __thiscall FUN_0069de10(undefined4 *param_1,undefined4 param_2)



{

  LONG *lpAddend;

  

  FUN_0069e1d0();

  *param_1 = &PTR_FUN_00802180;

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[2] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  *(undefined1 *)(param_1 + 3) = 0;

  param_1[4] = 0;

  FUN_0069dd20(param_2);

  return param_1;

}





// --- FUN_0069de50 at 0x0069DE50 (size: 105) ---


char __thiscall FUN_0069de50(int param_1,undefined4 param_2)



{

  int *piVar1;

  undefined4 *puVar2;

  char cVar3;

  int *piVar4;

  

  piVar1 = (int *)(param_1 + 0x10);

  if (*(int *)(param_1 + 0x10) == 0) {

    piVar4 = (int *)FUN_006bd780(&param_2,param_1 + 8,0,param_2,piVar1);

    if (*piVar4 < 0) {

      return '\x01';

    }

  }

  if (*piVar1 != 0) {

    cVar3 = FUN_006bd480();

    if ((cVar3 != '\0') && (puVar2 = (undefined4 *)*piVar1, puVar2 != (undefined4 *)0x0)) {

      piVar4 = puVar2 + 1;

      *piVar4 = *piVar4 + -1;

      if (*piVar4 == 0) {

        (**(code **)*puVar2)(1);

      }

      *piVar1 = 0;

    }

    return cVar3;

  }

  return '\0';

}





// --- FUN_0069def0 at 0x0069DEF0 (size: 173) ---


bool __thiscall FUN_0069def0(int param_1,int param_2)



{

  char cVar1;

  int iVar2;

  

  if (param_2 != 0) {

    cVar1 = FUN_0069e550(param_2);

    if (cVar1 != '\0') {

      iVar2 = DAT_008fa340;

      InterlockedIncrement((LONG *)(DAT_008fa340 + -0x10));

      iVar2 = FUN_00426f90(iVar2);

      if (iVar2 != 0) {

        iVar2 = *(int *)(param_1 + 8);

        InterlockedIncrement((LONG *)(iVar2 + -0x10));

        iVar2 = FUN_00426f90(iVar2);

        if (iVar2 != 0) {

          iVar2 = DAT_008fa344;

          InterlockedIncrement((LONG *)(DAT_008fa344 + -0x10));

          iVar2 = FUN_00426f90(iVar2);

          if (iVar2 != 0) {

            iVar2 = FUN_00679170(*(undefined1 *)(param_1 + 0xc));

            return iVar2 != 0;

          }

        }

      }

    }

  }

  return false;

}





// --- FUN_0069e1d0 at 0x0069E1D0 (size: 16) ---


void __fastcall FUN_0069e1d0(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_00802270;

  param_1[1] = 0;

  return;

}





// --- FUN_0069e1e0 at 0x0069E1E0 (size: 18) ---


void __thiscall FUN_0069e1e0(undefined4 *param_1,undefined4 param_2)



{

  *param_1 = &PTR_LAB_00802270;

  param_1[1] = param_2;

  return;

}





// --- FUN_0069e200 at 0x0069E200 (size: 7) ---


void __fastcall FUN_0069e200(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_00802270;

  return;

}





// --- FUN_0069e210 at 0x0069E210 (size: 19) ---


void __thiscall FUN_0069e210(int param_1,int param_2)



{

  if (param_1 != param_2) {

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

  }

  return;

}





// --- FUN_0069e230 at 0x0069E230 (size: 277) ---


undefined4 FUN_0069e230(undefined4 param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  switch(param_1) {

  case 1:

    iVar1 = FUN_005df0f5(0x14);

    if (iVar1 != 0) {

      uVar2 = FUN_0069dcf0();

      return uVar2;

    }

    break;

  case 2:

    iVar1 = FUN_005df0f5(0xc);

    if (iVar1 != 0) {

      uVar2 = FUN_0069f890();

      return uVar2;

    }

    break;

  case 3:

    iVar1 = FUN_005df0f5(0x30);

    if (iVar1 != 0) {

      uVar2 = FUN_0069f9a0();

      return uVar2;

    }

    break;

  case 4:

    iVar1 = FUN_005df0f5(0x14);

    if (iVar1 != 0) {

      uVar2 = FUN_0069e6b0();

      return uVar2;

    }

    break;

  case 5:

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      uVar2 = FUN_0069dc60();

      return uVar2;

    }

    break;

  case 6:

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      uVar2 = FUN_0069f140();

      return uVar2;

    }

    break;

  case 7:

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      uVar2 = FUN_0069ea40();

      return uVar2;

    }

    break;

  case 8:

    iVar1 = FUN_005df0f5(0x18);

    if (iVar1 != 0) {

      uVar2 = FUN_0069f510();

      return uVar2;

    }

    break;

  case 9:

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      uVar2 = FUN_0069f420();

      return uVar2;

    }

    break;

  case 10:

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      uVar2 = FUN_0069e730();

      return uVar2;

    }

    break;

  case 0xb:

    iVar1 = FUN_005df0f5(0x20);

    if (iVar1 != 0) {

      uVar2 = FUN_0069ed60();

      return uVar2;

    }

  }

  return 0;

}





// --- FUN_0069e380 at 0x0069E380 (size: 319) ---


undefined4 FUN_0069e380(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  switch(*(undefined4 *)(param_1 + 4)) {

  case 1:

    iVar1 = FUN_005df0f5(0x14);

    if (iVar1 != 0) {

      uVar2 = FUN_0069de10(param_1);

      return uVar2;

    }

    break;

  case 2:

    iVar1 = FUN_005df0f5(0xc);

    if (iVar1 != 0) {

      uVar2 = FUN_0069f8b0(param_1);

      return uVar2;

    }

    break;

  case 3:

    iVar1 = FUN_005df0f5(0x30);

    if (iVar1 != 0) {

      uVar2 = FUN_0069fae0(param_1);

      return uVar2;

    }

    break;

  case 4:

    iVar1 = FUN_005df0f5(0x14);

    if (iVar1 != 0) {

      uVar2 = FUN_0069e6e0(param_1);

      return uVar2;

    }

    break;

  case 5:

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      uVar2 = FUN_0069dc90(param_1);

      return uVar2;

    }

    break;

  case 6:

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      uVar2 = FUN_0069f160(param_1);

      return uVar2;

    }

    break;

  case 7:

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      uVar2 = FUN_0069ea80(param_1);

      return uVar2;

    }

    break;

  case 8:

    iVar1 = FUN_005df0f5(0x18);

    if (iVar1 != 0) {

      uVar2 = FUN_0069f550(param_1);

      return uVar2;

    }

    break;

  case 9:

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      uVar2 = FUN_0069f450(param_1);

      return uVar2;

    }

    break;

  case 10:

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      uVar2 = FUN_0069e760(param_1);

      return uVar2;

    }

    break;

  case 0xb:

    iVar1 = FUN_005df0f5(0x20);

    if (iVar1 != 0) {

      uVar2 = FUN_0069edb0(param_1);

      return uVar2;

    }

  }

  return 0;

}





// --- FUN_0069e510 at 0x0069E510 (size: 56) ---


void __thiscall FUN_0069e510(int param_1,int param_2)



{

  undefined4 *puVar1;

  

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) != 0) {

      *puVar1 = *(undefined4 *)(param_1 + 4);

      return;

    }

    *(undefined4 *)(param_1 + 4) = *puVar1;

  }

  return;

}





// --- FUN_0069e550 at 0x0069E550 (size: 149) ---


undefined4 __thiscall FUN_0069e550(int param_1,int param_2)



{

  LONG *lpAddend;

  undefined4 uVar1;

  char cVar2;

  int *piVar3;

  LONG LVar4;

  int iVar5;

  int iVar6;

  

  iVar5 = DAT_008fa408;

  if (param_2 != 0) {

    lpAddend = (LONG *)(DAT_008fa408 + -0x10);

    InterlockedIncrement(lpAddend);

    iVar6 = iVar5;

    InterlockedIncrement(lpAddend);

    piVar3 = (int *)FUN_00426fe0(iVar6);

    LVar4 = InterlockedDecrement((LONG *)(iVar5 + -0x10));

    if ((LVar4 == 0) && ((undefined4 *)(iVar5 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar5 + -0x14))(1);

    }

    if (piVar3 != (int *)0x0) {

      uVar1 = *(undefined4 *)(param_1 + 4);

      iVar5 = (**(code **)(*piVar3 + 4))();

      if (iVar5 != 0) {

        cVar2 = FUN_0068dbd0(iVar5,0xe,uVar1);

        if (cVar2 != '\0') {

          return 1;

        }

        FUN_0065d360(iVar5);

      }

    }

  }

  return 0;

}





// --- FUN_0069e5f0 at 0x0069E5F0 (size: 183) ---


int * FUN_0069e5f0(int param_1)



{

  int iVar1;

  char cVar2;

  int iVar3;

  int iVar4;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  int *piVar5;

  undefined4 uVar6;

  

  iVar1 = param_1;

  if (param_1 == 0) {

    return (int *)0x0;

  }

  piVar5 = (int *)0x0;

  iVar3 = thunk_FUN_0065cd80(&DAT_008fa408);

  if (iVar3 == 0) {

    uVar6 = extraout_ECX;

    FUN_00401340("MediaDesc::CreateFromFileNode, missing type node");

    FUN_0065d620(iVar1,uVar6);

    return (int *)0x0;

  }

  param_1 = 0;

  iVar4 = FUN_0065ca90();

  if (iVar4 != 0) {

    cVar2 = FUN_00685800(iVar4,0xe,&param_1);

    if (cVar2 != '\0') {

      piVar5 = (int *)FUN_0069e230(param_1);

      if (piVar5 != (int *)0x0) {

        cVar2 = (**(code **)(*piVar5 + 0x6c))(iVar1);

        if (cVar2 == '\0') {

          (**(code **)*piVar5)(1);

          piVar5 = (int *)0x0;

        }

      }

    }

    return piVar5;

  }

  uVar6 = extraout_ECX_00;

  FUN_00401340("Expecting a leaf node");

  FUN_0065d620(iVar3,uVar6);

  return (int *)0x0;

}





// --- FUN_0069e6b0 at 0x0069E6B0 (size: 36) ---


undefined4 * __fastcall FUN_0069e6b0(undefined4 *param_1)



{

  FUN_0069e1e0(4);

  *param_1 = &PTR_FUN_00802318;

  param_1[2] = DAT_008fa540;

  param_1[3] = 0;

  param_1[4] = 0;

  return param_1;

}





// --- FUN_0069e6e0 at 0x0069E6E0 (size: 72) ---


undefined4 * __thiscall FUN_0069e6e0(undefined4 *param_1,undefined4 *param_2)



{

  FUN_0069e1d0();

  *param_1 = &PTR_FUN_00802318;

  param_1[2] = DAT_008fa540;

  param_1[3] = 0;

  param_1[4] = 0;

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

    param_1[4] = param_2[4];

  }

  return param_1;

}





// --- FUN_0069e730 at 0x0069E730 (size: 34) ---


undefined4 * __fastcall FUN_0069e730(undefined4 *param_1)



{

  FUN_0069e1e0(10);

  *param_1 = &PTR_FUN_00802388;

  param_1[2] = 0;

  param_1[3] = 0x3f800000;

  return param_1;

}





// --- FUN_0069e760 at 0x0069E760 (size: 64) ---


undefined4 * __thiscall FUN_0069e760(undefined4 *param_1,undefined4 *param_2)



{

  FUN_0069e1d0();

  *param_1 = &PTR_FUN_00802388;

  param_1[2] = 0;

  param_1[3] = 0x3f800000;

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

  }

  return param_1;

}





// --- FUN_0069ea40 at 0x0069EA40 (size: 28) ---


undefined4 * __fastcall FUN_0069ea40(undefined4 *param_1)



{

  FUN_0069e1e0(7);

  param_1[2] = 0;

  param_1[3] = 0;

  *param_1 = &PTR_FUN_00802430;

  return param_1;

}





// --- FUN_0069ea60 at 0x0069EA60 (size: 30) ---


void * __thiscall FUN_0069ea60(void *param_1,byte param_2)



{

  FUN_0069e200();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069ea80 at 0x0069EA80 (size: 58) ---


undefined4 * __thiscall FUN_0069ea80(undefined4 *param_1,undefined4 *param_2)



{

  FUN_0069e1d0();

  *param_1 = &PTR_FUN_00802430;

  param_1[2] = 0;

  param_1[3] = 0;

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

  }

  return param_1;

}





// --- FUN_0069ed60 at 0x0069ED60 (size: 52) ---


undefined4 * __fastcall FUN_0069ed60(undefined4 *param_1)



{

  undefined4 uVar1;

  

  FUN_0069e1e0(0xb);

  uVar1 = DAT_008024dc;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[6] = DAT_008024d8;

  *param_1 = &PTR_FUN_008024e0;

  param_1[2] = 0x3f800000;

  param_1[7] = uVar1;

  return param_1;

}





// --- FUN_0069eda0 at 0x0069EDA0 (size: 4) ---


float10 __fastcall FUN_0069eda0(int param_1)



{

  return (float10)*(float *)(param_1 + 0x10);

}





// --- FUN_0069edb0 at 0x0069EDB0 (size: 88) ---


undefined4 * __thiscall FUN_0069edb0(undefined4 *param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  undefined4 uVar2;

  

  FUN_0069e1d0();

  uVar2 = DAT_008024dc;

  param_1[3] = 0;

  param_1[4] = 0;

  uVar1 = DAT_008024d8;

  *param_1 = &PTR_FUN_008024e0;

  param_1[2] = 0x3f800000;

  param_1[6] = uVar1;

  param_1[7] = uVar2;

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

    param_1[4] = param_2[4];

  }

  return param_1;

}





// --- FUN_0069ee10 at 0x0069EE10 (size: 142) ---


void __thiscall FUN_0069ee10(int param_1,int param_2)



{

  undefined4 *puVar1;

  

  FUN_0069e510(param_2);

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 8) = *puVar1;

    }

    else {

      *puVar1 = *(undefined4 *)(param_1 + 8);

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0xc) = *puVar1;

    }

    else {

      *puVar1 = *(undefined4 *)(param_1 + 0xc);

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) != 0) {

      *puVar1 = *(undefined4 *)(param_1 + 0x10);

      return;

    }

    *(undefined4 *)(param_1 + 0x10) = *puVar1;

  }

  return;

}





// --- FUN_0069f140 at 0x0069F140 (size: 28) ---


undefined4 * __fastcall FUN_0069f140(undefined4 *param_1)



{

  FUN_0069e1e0(6);

  param_1[2] = 0;

  param_1[3] = 0;

  *param_1 = &PTR_FUN_00802588;

  return param_1;

}





// --- FUN_0069f160 at 0x0069F160 (size: 58) ---


undefined4 * __thiscall FUN_0069f160(undefined4 *param_1,undefined4 *param_2)



{

  FUN_0069e1d0();

  *param_1 = &PTR_FUN_00802588;

  param_1[2] = 0;

  param_1[3] = 0;

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

  }

  return param_1;

}





// --- FUN_0069f420 at 0x0069F420 (size: 35) ---


undefined4 * __fastcall FUN_0069f420(undefined4 *param_1)



{

  FUN_0069e1e0(9);

  *param_1 = &PTR_FUN_00802660;

  param_1[2] = DAT_008fa94c;

  param_1[3] = 0;

  return param_1;

}





// --- FUN_0069f450 at 0x0069F450 (size: 65) ---


undefined4 * __thiscall FUN_0069f450(undefined4 *param_1,undefined4 *param_2)



{

  FUN_0069e1d0();

  *param_1 = &PTR_FUN_00802660;

  param_1[2] = DAT_008fa94c;

  param_1[3] = 0;

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

  }

  return param_1;

}





// --- FUN_0069f510 at 0x0069F510 (size: 45) ---


undefined4 * __fastcall FUN_0069f510(undefined4 *param_1)



{

  undefined4 uVar1;

  

  FUN_0069e1e0(8);

  uVar1 = DAT_008026d4;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = DAT_008026d0;

  *param_1 = &PTR_FUN_008026d8;

  param_1[5] = uVar1;

  return param_1;

}





// --- FUN_0069f540 at 0x0069F540 (size: 4) ---


float10 __fastcall FUN_0069f540(int param_1)



{

  return (float10)*(float *)(param_1 + 0xc);

}





// --- FUN_0069f550 at 0x0069F550 (size: 75) ---


undefined4 * __thiscall FUN_0069f550(undefined4 *param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  undefined4 uVar2;

  

  FUN_0069e1d0();

  uVar2 = DAT_008026d4;

  param_1[2] = 0;

  param_1[3] = 0;

  uVar1 = DAT_008026d0;

  *param_1 = &PTR_FUN_008026d8;

  param_1[4] = uVar1;

  param_1[5] = uVar2;

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

  }

  return param_1;

}





// --- FUN_0069f5a0 at 0x0069F5A0 (size: 102) ---


void __thiscall FUN_0069f5a0(int param_1,int param_2)



{

  undefined4 *puVar1;

  

  FUN_0069e510(param_2);

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 8) = *puVar1;

    }

    else {

      *puVar1 = *(undefined4 *)(param_1 + 8);

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) != 0) {

      *puVar1 = *(undefined4 *)(param_1 + 0xc);

      return;

    }

    *(undefined4 *)(param_1 + 0xc) = *puVar1;

  }

  return;

}





// --- FUN_0069f890 at 0x0069F890 (size: 28) ---


undefined4 * __fastcall FUN_0069f890(undefined4 *param_1)



{

  FUN_0069e1e0(2);

  *param_1 = &PTR_FUN_00802780;

  param_1[2] = DAT_008faaec;

  return param_1;

}





// --- FUN_0069f8b0 at 0x0069F8B0 (size: 52) ---


undefined4 * __thiscall FUN_0069f8b0(undefined4 *param_1,undefined4 *param_2)



{

  FUN_0069e1d0();

  *param_1 = &PTR_FUN_00802780;

  param_1[2] = DAT_008faaec;

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    param_1[2] = param_2[2];

  }

  return param_1;

}





// --- FUN_0069f8f0 at 0x0069F8F0 (size: 62) ---


void __thiscall FUN_0069f8f0(int param_1,int param_2)



{

  undefined4 *puVar1;

  

  FUN_0069e510(param_2);

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) != 0) {

      *puVar1 = *(undefined4 *)(param_1 + 8);

      return;

    }

    *(undefined4 *)(param_1 + 8) = *puVar1;

  }

  return;

}





// --- FUN_0069f990 at 0x0069F990 (size: 5) ---


undefined1 FUN_0069f990(void)



{

  return 0;

}





// --- FUN_0069f9a0 at 0x0069F9A0 (size: 65) ---


undefined4 * __fastcall FUN_0069f9a0(undefined4 *param_1)



{

  undefined4 uVar1;

  

  FUN_0069e1e0(3);

  uVar1 = DAT_008027f4;

  param_1[2] = 0;

  *param_1 = &PTR_FUN_008027f8;

  param_1[3] = 1;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[8] = DAT_008027f0;

  param_1[9] = uVar1;

  param_1[10] = 0xffffffff;

  return param_1;

}





// --- FUN_0069fa00 at 0x0069FA00 (size: 172) ---


void __thiscall FUN_0069fa00(int *param_1,int param_2)



{

  undefined4 *puVar1;

  uint *puVar2;

  uint uVar3;

  undefined4 *puVar4;

  uint uVar5;

  

  uVar5 = param_1[2];

  FUN_0040ad10(4);

  puVar2 = (uint *)FUN_0040acf0(4);

  if (puVar2 != (uint *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      uVar5 = *puVar2;

    }

    else {

      *puVar2 = uVar5;

    }

  }

  if ((~*(byte *)(param_2 + 4) & 1) != 0) {

    uVar3 = FUN_0040a8f0();

    if (uVar3 < uVar5) {

      FUN_0040aa50();

      return;

    }

    param_1[2] = 0;

    FUN_00540160(uVar5,1);

  }

  if (param_1[2] != 0) {

    uVar5 = 0;

    do {

      puVar1 = (undefined4 *)(*param_1 + uVar5 * 4);

      FUN_0040ad10(4);

      puVar4 = (undefined4 *)FUN_0040acf0(4);

      if (puVar4 != (undefined4 *)0x0) {

        if ((*(byte *)(param_2 + 4) & 1) == 0) {

          *puVar1 = *puVar4;

        }

        else {

          *puVar4 = *puVar1;

        }

      }

      uVar5 = uVar5 + 1;

    } while (uVar5 < (uint)param_1[2]);

  }

  return;

}





// --- FUN_0069fab0 at 0x0069FAB0 (size: 40) ---


void * __thiscall FUN_0069fab0(void *param_1,byte param_2)



{

  FUN_0047d580();

  FUN_0069e200();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0069fae0 at 0x0069FAE0 (size: 110) ---


undefined4 * __thiscall FUN_0069fae0(undefined4 *param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  

  FUN_0069e1d0();

  uVar1 = DAT_008027f4;

  param_1[2] = 0;

  *param_1 = &PTR_FUN_008027f8;

  param_1[3] = 1;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[8] = DAT_008027f0;

  param_1[9] = uVar1;

  param_1[10] = 0xffffffff;

  if (param_1 != param_2) {

    FUN_0069e210(param_2);

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

    FUN_005bfba0(param_2 + 4);

  }

  return param_1;

}





// --- FUN_0069fb50 at 0x0069FB50 (size: 120) ---


void __thiscall FUN_0069fb50(int param_1,int param_2)



{

  undefined4 *puVar1;

  

  FUN_0069e510(param_2);

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 8) = *puVar1;

    }

    else {

      *puVar1 = *(undefined4 *)(param_1 + 8);

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) != 0) {

      *puVar1 = *(undefined4 *)(param_1 + 0xc);

      FUN_0069fa00(param_2);

      return;

    }

    *(undefined4 *)(param_1 + 0xc) = *puVar1;

  }

  FUN_0069fa00(param_2);

  return;

}





// --- FUN_0069fbd0 at 0x0069FBD0 (size: 31) ---


void __fastcall FUN_0069fbd0(int param_1)



{

  if (*(undefined4 **)(param_1 + 0x9c) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x9c))(1);

  }

  *(undefined4 *)(param_1 + 0x9c) = 0;

  return;

}





// --- FUN_0069fca0 at 0x0069FCA0 (size: 19) ---


void __fastcall FUN_0069fca0(int param_1)



{

  if (*(int **)(param_1 + 0xac) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0xac) + 0x48))(param_1);

  }

  return;

}





// --- FUN_0069fcc0 at 0x0069FCC0 (size: 95) ---


undefined4 __thiscall FUN_0069fcc0(int param_1,int param_2,int param_3)



{

  char cVar1;

  

  if ((((*(int *)(param_1 + 0x7c) <= param_2) && (param_2 <= *(int *)(param_1 + 0x84))) &&

      (*(int *)(param_1 + 0x80) <= param_3)) && (param_3 <= *(int *)(param_1 + 0x88))) {

    if ((*(int *)(param_1 + 0x9c) != 0) &&

       (cVar1 = FUN_00694930(param_2 - *(int *)(param_1 + 0x7c),param_3 - *(int *)(param_1 + 0x80)),

       cVar1 != '\0')) {

      return 0;

    }

    return 1;

  }

  return 0;

}





// --- FUN_0069fd20 at 0x0069FD20 (size: 5) ---


void __fastcall FUN_0069fd20(int *param_1)



{

                    /* WARNING: Could not recover jumptable at 0x0069fd22. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (**(code **)(*param_1 + 0x4c))();

  return;

}





// --- FUN_0069fd40 at 0x0069FD40 (size: 37) ---


int __fastcall FUN_0069fd40(int param_1)



{

  int iVar1;

  

  if ((*(int *)(param_1 + 0xb0) == 0) && (*(int *)(param_1 + 0xac) != 0)) {

    iVar1 = FUN_0069fd40();

    return iVar1 + *(int *)(param_1 + 0x7c);

  }

  return 0;

}





// --- FUN_0069fd70 at 0x0069FD70 (size: 40) ---


int __fastcall FUN_0069fd70(int param_1)



{

  int iVar1;

  

  if ((*(int *)(param_1 + 0xb0) == 0) && (*(int *)(param_1 + 0xac) != 0)) {

    iVar1 = FUN_0069fd70();

    return iVar1 + *(int *)(param_1 + 0x80);

  }

  return 0;

}





// --- FUN_0069fda0 at 0x0069FDA0 (size: 94) ---


void __thiscall FUN_0069fda0(int param_1,undefined4 *param_2)



{

  int *piVar1;

  int local_8;

  int local_4;

  

  local_8 = 0;

  local_4 = 0;

  if (*(int **)(param_1 + 0xb0) != (int *)0x0) {

    piVar1 = (int *)(**(code **)(**(int **)(param_1 + 0xb0) + 0x1c))();

    if (piVar1 != (int *)0x0) {

      (**(code **)(*piVar1 + 0x14))(&local_8,&local_4);

    }

  }

  *param_2 = 0;

  param_2[1] = 0;

  param_2[2] = local_8 + -1;

  param_2[3] = local_4 + -1;

  return;

}





// --- FUN_0069fe00 at 0x0069FE00 (size: 42) ---


int __fastcall FUN_0069fe00(int param_1)



{

  int iVar1;

  

  if (*(int *)(param_1 + 0xb0) != 0) {

    return *(int *)(*(int *)(param_1 + 0xb0) + 0x20);

  }

  if (*(int *)(param_1 + 0xac) != 0) {

    iVar1 = FUN_0069fe00();

    return iVar1 + *(int *)(param_1 + 0x7c);

  }

  return 0;

}





// --- FUN_0069fe30 at 0x0069FE30 (size: 45) ---


int __fastcall FUN_0069fe30(int param_1)



{

  int iVar1;

  

  if (*(int *)(param_1 + 0xb0) != 0) {

    return *(int *)(*(int *)(param_1 + 0xb0) + 0x24);

  }

  if (*(int *)(param_1 + 0xac) != 0) {

    iVar1 = FUN_0069fe30();

    return iVar1 + *(int *)(param_1 + 0x80);

  }

  return 0;

}





// --- FUN_0069fe60 at 0x0069FE60 (size: 11) ---


int __fastcall FUN_0069fe60(int param_1)



{

  return (*(int *)(param_1 + 0x84) - *(int *)(param_1 + 0x7c)) + 1;

}





// --- FUN_0069fe70 at 0x0069FE70 (size: 14) ---


int __fastcall FUN_0069fe70(int param_1)



{

  return (*(int *)(param_1 + 0x88) - *(int *)(param_1 + 0x80)) + 1;

}





// --- FUN_0069fe80 at 0x0069FE80 (size: 38) ---


uint __thiscall FUN_0069fe80(int param_1,int param_2)



{

  if (*(int *)(param_1 + 0x94) < *(int *)(param_2 + 0x94)) {

    return 0xffffffff;

  }

  return (uint)(*(int *)(param_1 + 0x94) != *(int *)(param_2 + 0x94));

}





// --- FUN_0069feb0 at 0x0069FEB0 (size: 77) ---


void __thiscall FUN_0069feb0(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  if (*(undefined4 **)(param_1 + 0x9c) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 0x9c))(1);

  }

  *(undefined4 *)(param_1 + 0x9c) = 0;

  iVar1 = FUN_005df0f5(0xc);

  if (iVar1 != 0) {

    uVar2 = FUN_00694e00(param_2);

    *(undefined4 *)(param_1 + 0x9c) = uVar2;

    return;

  }

  *(undefined4 *)(param_1 + 0x9c) = 0;

  return;

}





// --- FUN_0069ff00 at 0x0069FF00 (size: 218) ---


void __fastcall FUN_0069ff00(int *param_1)



{

  char cVar1;

  int unaff_EDI;

  undefined4 unaff_retaddr;

  undefined4 local_30;

  undefined4 uStack_2c;

  int aiStack_28 [2];

  int iStack_20;

  undefined4 uStack_1c;

  int iStack_18;

  undefined1 auStack_14 [20];

  

  (**(code **)(*param_1 + 0x34))(&local_30);

  iStack_20 = local_30;

  uStack_1c = uStack_2c;

  iStack_18 = aiStack_28[0];

  cVar1 = FUN_00466680(unaff_retaddr,&stack0xffffffbc);

  if (cVar1 != '\0') {

    if (param_1[0x2c] != 0) {

      FUN_0069a530(&stack0xffffffbc);

      return;

    }

    if ((int *)param_1[0x2b] != (int *)0x0) {

      (**(code **)(*(int *)param_1[0x2b] + 0x34))(auStack_14);

      aiStack_28[0] = iStack_18 + unaff_EDI;

      iStack_20 = aiStack_28[0] - unaff_EDI;

      FUN_0069ff00(aiStack_28);

    }

  }

  return;

}





